text
stringlengths
0
843k
from __future__ import annotations import os.path import re from abc import ABCMeta, abstractmethod from collections import defaultdict from collections.abc import Iterator from email.message import Message from email.parser import Parser from email.policy import EmailPolicy from glob import iglob from pathlib import ...
from __future__ import annotations import email.policy import os.path import re from email.generator import BytesGenerator from email.parser import BytesParser from wheel.cli import WheelError from wheel.wheelfile import WheelFile DIST_INFO_RE = re.compile(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))\.dist-info$") ...
from __future__ import annotations import email.policy import itertools import os from collections.abc import Iterable from email.parser import BytesParser from ..wheelfile import WheelFile def _compute_tags(original_tags: Iterable[str], new_tags: str | None) -> set[str]: """Add or replace tags. Supports dot-se...
from __future__ import annotations from pathlib import Path from ..wheelfile import WheelFile def unpack(path: str, dest: str = ".") -> None: """Unpack a wheel. Wheel content will be unpacked to {dest}/{name}-{ver}, where {name} is the package name and {ver} its version. :param path: The path to t...
""" Wheel command-line utility. """ from __future__ import annotations import argparse import os import sys from argparse import ArgumentTypeError class WheelError(Exception): pass def unpack_f(args: argparse.Namespace) -> None: from .unpack import unpack unpack(args.wheelfile, args.dest) def pack_...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import operator import os import platform import sys from typing import Any, Callable, Dict, List, Optional, Tuple, Union from ._parser im...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from typing import Any, Iterator, Optional, Set from ._parser import parse_requirement as _parse_requirement from ._tokenizer import Parse...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. """ .. testsetup:: from packaging.specifiers import Specifier, SpecifierSet, InvalidSpecifier from packaging.version import Version...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import logging import platform import re import struct import subprocess import sys import sysconfig from importlib.machinery import EXTENS...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import re from typing import FrozenSet, NewType, Tuple, Union, cast from .tags import Tag, parse_tag from .version import InvalidVersion, ...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. """ .. testsetup:: from packaging.version import parse, Version """ import itertools import re from typing import Any, Callable, Named...
""" ELF file parser. This provides a class ``ELFFile`` that parses an ELF executable in a similar interface to ``ZipFile``. Only the read interface is implemented. Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html ""...
import collections import contextlib import functools import os import re import sys import warnings from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple from ._elffile import EIClass, EIData, ELFFile, EMachine EF_ARM_ABIMASK = 0xFF000000 EF_ARM_ABI_VER5 = 0x05000000 EF_ARM_ABI_FLOAT_HA...
"""PEP 656 support. This module implements logic to detect if the currently running Python is linked against musl, and what musl version is used. """ import functools import re import subprocess import sys from typing import Iterator, NamedTuple, Optional, Sequence from ._elffile import ELFFile class _MuslVersion(...
"""Handwritten parser of dependency specifiers. The docstring for each __parse_* function contains EBNF-inspired grammar representing the implementation. """ import ast from typing import Any, List, NamedTuple, Optional, Tuple, Union from ._tokenizer import DEFAULT_RULES, Tokenizer class Node: def __init__(sel...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. class InfinityType: def __repr__(self) -> str: return "Infinity" def __hash__(self) -> int: return hash(repr(self...
import contextlib import re from dataclasses import dataclass from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union from .specifiers import Specifier @dataclass class Token: name: str text: str position: int class ParserSyntaxError(Exception): """The provided source text could not be ...
# The inspect.formatargspec() function was dropped in Python 3.11 but we need # need it for when constructing signature changing decorators based on result of # inspect.getargspec() or inspect.getfullargspec(). The code here implements # inspect.formatargspec() base on Parameter and Signature from inspect module, # whi...
"""This module implements decorators for implementing other decorators as well as some commonly used decorators. """ import sys PY2 = sys.version_info[0] == 2 if PY2: string_types = basestring, def exec_(_code_, _globs_=None, _locs_=None): """Execute code in a namespace.""" if _globs_ is No...
"""This module implements a post import hook mechanism styled after what is described in PEP-369. Note that it doesn't cope with modules being reloaded. """ import sys import threading PY2 = sys.version_info[0] == 2 if PY2: string_types = basestring, find_spec = None else: string_types = str, from i...
import inspect import sys PY2 = sys.version_info[0] == 2 if PY2: string_types = basestring, else: string_types = str, from .__wrapt__ import FunctionWrapper # Helper functions for applying wrappers to existing functions. def resolve_path(module, name): if isinstance(module, string_types): __imp...
import functools import weakref from .__wrapt__ import ObjectProxy, _FunctionWrapperBase # A weak function proxy. This will work on instance methods, class # methods, static methods and regular functions. Special treatment is # needed for the method types because the bound method is effectively a # transient object a...
import sys import operator import inspect PY2 = sys.version_info[0] == 2 if PY2: string_types = basestring, else: string_types = str, def with_metaclass(meta, *bases): """Create a base class with a metaclass.""" return meta("NewBase", bases, {}) class _ObjectProxyMethods(object): # We use prope...
__version_info__ = ('1', '17', '2') __version__ = '.'.join(__version_info__) from .__wrapt__ import (ObjectProxy, CallableObjectProxy, FunctionWrapper, BoundFunctionWrapper, PartialCallableObjectProxy) from .patches import (resolve_path, apply_patch, wrap_object, wrap_object_attribute, function_wrappe...
import os from .wrappers import (ObjectProxy, CallableObjectProxy, PartialCallableObjectProxy, FunctionWrapper, BoundFunctionWrapper, _FunctionWrapperBase) try: if not os.environ.get('WRAPT_DISABLE_EXTENSIONS'): from ._wrappers import (ObjectProxy, CallableObjectProxy, PartialC...
""" wsproto/connection ~~~~~~~~~~~~~~~~~~ An implementation of a WebSocket connection. """ from collections import deque from enum import Enum from typing import Deque, Generator, List, Optional from .events import ( BytesMessage, CloseConnection, Event, Message, Ping, Pong, TextMessage, ...
""" wsproto/events ~~~~~~~~~~~~~~ Events that result from processing data on a WebSocket connection. """ from abc import ABC from dataclasses import dataclass, field from typing import Generic, List, Optional, Sequence, TypeVar, Union from .extensions import Extension from .typing import Headers class Event(ABC): ...
""" wsproto/extensions ~~~~~~~~~~~~~~~~~~ WebSocket extensions. """ import zlib from typing import Optional, Tuple, Union from .frame_protocol import CloseReason, FrameDecoder, FrameProtocol, Opcode, RsvBits class Extension: name: str def enabled(self) -> bool: return False def offer(self) ->...
""" wsproto/frame_protocol ~~~~~~~~~~~~~~~~~~~~~~ WebSocket frame protocol implementation. """ import os import struct from codecs import getincrementaldecoder, IncrementalDecoder from enum import IntEnum from typing import Generator, List, NamedTuple, Optional, Tuple, TYPE_CHECKING, Union if TYPE_CHECKING: from...
""" wsproto/handshake ~~~~~~~~~~~~~~~~~~ An implementation of WebSocket handshakes. """ from collections import deque from typing import ( cast, Deque, Dict, Generator, Iterable, List, Optional, Sequence, Union, ) import h11 from .connection import Connection, ConnectionState, Con...
from typing import List, Tuple Headers = List[Tuple[bytes, bytes]]
""" wsproto/utilities ~~~~~~~~~~~~~~~~~ Utility functions that do not belong in a separate module. """ import base64 import hashlib import os from typing import Dict, List, Optional, Union from h11._headers import Headers as H11Headers from .events import Event from .typing import Headers # RFC6455, Section 1.3 - O...
""" wsproto ~~~~~~~ A WebSocket implementation. """ from typing import Generator, Optional, Union from .connection import Connection, ConnectionState, ConnectionType from .events import Event from .handshake import H11Handshake from .typing import Headers __version__ = "1.2.0" class WSConnection: """ Repre...
__all__ = ['Composer', 'ComposerError'] from .error import MarkedYAMLError from .events import * from .nodes import * class ComposerError(MarkedYAMLError): pass class Composer: def __init__(self): self.anchors = {} def check_node(self): # Drop the STREAM-START event. if self.ch...
__all__ = [ 'BaseConstructor', 'SafeConstructor', 'FullConstructor', 'UnsafeConstructor', 'Constructor', 'ConstructorError' ] from .error import * from .nodes import * import collections.abc, datetime, base64, binascii, re, sys, types class ConstructorError(MarkedYAMLError): pass class ...
__all__ = [ 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader', 'CBaseDumper', 'CSafeDumper', 'CDumper' ] from yaml._yaml import CParser, CEmitter from .constructor import * from .serializer import * from .representer import * from .resolver import * class CBaseLoader(CParser, BaseCon...
__all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] from .emitter import * from .serializer import * from .representer import * from .resolver import * class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): def __init__(self, stream, default_style=None, default_flow_style=False, ...
# Emitter expects events obeying the following grammar: # stream ::= STREAM-START document* STREAM-END # document ::= DOCUMENT-START node DOCUMENT-END # node ::= SCALAR | sequence | mapping # sequence ::= SEQUENCE-START node* SEQUENCE-END # mapping ::= MAPPING-START (node node)* MAPPING-END __all__ = ['Emitter', 'Emi...
__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] class Mark: def __init__(self, name, index, line, column, buffer, pointer): self.name = name self.index = index self.line = line self.column = column self.buffer = buffer self.pointer = pointer def get_snippet...
# Abstract classes. class Event(object): def __init__(self, start_mark=None, end_mark=None): self.start_mark = start_mark self.end_mark = end_mark def __repr__(self): attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] if hasattr(self, key)] argu...
__all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader'] from .reader import * from .scanner import * from .parser import * from .composer import * from .constructor import * from .resolver import * class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): def __i...
class Node(object): def __init__(self, tag, value, start_mark, end_mark): self.tag = tag self.value = value self.start_mark = start_mark self.end_mark = end_mark def __repr__(self): value = self.value #if isinstance(value, list): # if len(value) == 0: ...
# The following YAML grammar is LL(1) and is parsed by a recursive descent # parser. # # stream ::= STREAM-START implicit_document? explicit_document* STREAM-END # implicit_document ::= block_node DOCUMENT-END* # explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* # block_node_or_inden...
# This module contains abstractions for the input stream. You don't have to # looks further, there are no pretty code. # # We define two classes here. # # Mark(source, line, column) # It's just a record and its only use is producing nice error messages. # Parser does not use it for any other purposes. # # Reader(so...
__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', 'RepresenterError'] from .error import * from .nodes import * import datetime, copyreg, types, base64, collections class RepresenterError(YAMLError): pass class BaseRepresenter: yaml_representers = {} yaml_multi_representers = {} ...
__all__ = ['BaseResolver', 'Resolver'] from .error import * from .nodes import * import re class ResolverError(YAMLError): pass class BaseResolver: DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str' DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq' DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map' yaml_im...
# Scanner produces tokens of the following types: # STREAM-START # STREAM-END # DIRECTIVE(name, value) # DOCUMENT-START # DOCUMENT-END # BLOCK-SEQUENCE-START # BLOCK-MAPPING-START # BLOCK-END # FLOW-SEQUENCE-START # FLOW-MAPPING-START # FLOW-SEQUENCE-END # FLOW-MAPPING-END # BLOCK-ENTRY # FLOW-ENTRY # KEY # VALUE # AL...
__all__ = ['Serializer', 'SerializerError'] from .error import YAMLError from .events import * from .nodes import * class SerializerError(YAMLError): pass class Serializer: ANCHOR_TEMPLATE = 'id%03d' def __init__(self, encoding=None, explicit_start=None, explicit_end=None, version=None, ta...
class Token(object): def __init__(self, start_mark, end_mark): self.start_mark = start_mark self.end_mark = end_mark def __repr__(self): attributes = [key for key in self.__dict__ if not key.endswith('_mark')] attributes.sort() arguments = ', '.join(['%s=...
from .error import * from .tokens import * from .events import * from .nodes import * from .loader import * from .dumper import * __version__ = '6.0.2' try: from .cyaml import * __with_libyaml__ = True except ImportError: __with_libyaml__ = False import io #--------------------------------------------...
__import__('_distutils_hack').do_override()
# don't import any costly modules import os import sys report_url = ( "https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml" ) def warn_distutils_present(): if 'distutils' not in sys.modules: return import warnings warnings.warn( "Distutils was imported be...
# This is a stub package designed to roughly emulate the _yaml # extension module, which previously existed as a standalone module # and has been moved into the `yaml` package namespace. # It does not perfectly mimic its old counterpart, but should get # close enough for anyone who's relying on it even when they should...
import os import reflex as rx from openai import OpenAI import dotenv # Load the environment variables dotenv.load_dotenv() OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") # Checking if the API key is set properly # if not os.getenv("OPENAI_API_KEY"): # raise Exception("Please set OPENAI_API_KEY environment variabl...
"""The main Chat app.""" import reflex as rx import reflex_chakra as rc from zapbot.components import chat, navbar def index() -> rx.Component: """The main app.""" return rc.vstack( navbar(), chat.chat(), chat.action_bar(), background_color=rx.color("mauve", 1), color...
import reflex as rx import reflex_chakra as rc from zapbot.components import loading_icon from zapbot.state import QA, State message_style = dict(display="inline-block", padding="1em", border_radius="8px", max_width=["30em", "30em", "50em", "50em", "50em", "50em"]) def message(qa: QA) -> rx.Co...
import reflex as rx class LoadingIcon(rx.Component): """A custom loading icon component.""" library = "react-loading-icons" tag = "SpinningCircles" stroke: rx.Var[str] stroke_opacity: rx.Var[str] fill: rx.Var[str] fill_opacity: rx.Var[str] stroke_width: rx.Var[str] speed: rx.Var[s...
import reflex as rx import reflex_chakra as rc from zapbot.state import State def modal() -> rx.Component: """A modal to create a new chat.""" return rc.modal( rc.modal_overlay( rc.modal_content( rc.modal_header( rc.hstack( rc.te...
import reflex as rx from zapbot.state import State def sidebar_chat(chat: str) -> rx.Component: """A sidebar chat item. Args: chat: The chat item. """ return rx.drawer.close(rx.hstack( rx.button( chat, on_click=lambda: State.set_chat(chat), width="80%", variant="surface" ...
from .loading_icon import loading_icon from .navbar import navbar
import reflex as rx config = rx.Config( app_name="zaton_web", )
"""Welcome to Reflex! This file outlines the steps to create a basic app.""" import reflex as rx from rxconfig import config from zaton_web.pages.home import index from zaton_web.pages.bio import bio from zaton_web.pages.contacto import contacto from zaton_web.pages.libros import libros from zaton_web.pages.portfolio ...
import reflex as rx from zaton_web.parts.header import navbar from zaton_web.styles.constants import * from zaton_web.styles.styles import MAX_WIDTH, Size, Spacing from zaton_web.styles.colors import Color from zaton_web.parts.footer import footer @rx.page(route= BIO) def bio() -> rx.Component: '''función bio dev...
import reflex as rx from zaton_web.parts.header import navbar from zaton_web.styles.constants import * from zaton_web.styles.styles import * from zaton_web.parts.footer import footer from zaton_web.parts.buttons import card_buttons @rx.page(route= BLOG) def blog() -> rx.Component: '''función index devuelve los com...
import reflex as rx from zaton_web.parts.header import navbar from zaton_web.styles.constants import * from zaton_web.styles.styles import * from zaton_web.parts.footer import footer from zaton_web.parts.buttons import card_buttons @rx.page(route= CONTACTO) def contacto() -> rx.Component: '''función index devuelve...
import reflex as rx from zaton_web.parts.header import navbar from zaton_web.styles.constants import * from zaton_web.styles.styles import * from zaton_web.parts.footer import footer from zaton_web.parts.buttons import card_buttons @rx.page(route= HOME) def index() -> rx.Component: '''función index devuelve los co...
import reflex as rx from zaton_web.parts.header import navbar from zaton_web.styles.constants import * from zaton_web.styles.styles import * from zaton_web.parts.footer import footer from zaton_web.parts.buttons import card_buttons @rx.page(route= LIBROS) def libros() -> rx.Component: '''función index devuelve los...
import reflex as rx from zaton_web.parts.header import navbar from zaton_web.styles.constants import * from zaton_web.styles.styles import * from zaton_web.parts.footer import footer from zaton_web.parts.buttons import card_buttons from zaton_web.parts.cards import card_portfolio @rx.page(route= PORTFOLIO) def portfol...
import reflex as rx from zaton_web.styles.constants import * from zaton_web.styles.styles import * def card_buttons(textos=[], enlaces=[], iconos=[]) -> rx.Component: '''Función que devuelve un conjunto de botones en un card textos: lista de textos de los botones enlaces: lista de enlaces a los que llevan...
import reflex as rx from zaton_web.styles.constants import * from zaton_web.styles.styles import * from zaton_web.styles.colors import Color def card_portfolio(headers=[], textos=[], enlaces=[], imagenes=[]) -> rx.Component: '''Función que devuelve un conjunto de cards distribuidos en dos columnas.''' return r...
import reflex as rx from zaton_web.styles.styles import * from zaton_web.styles.colors import Color from zaton_web.styles.constants import * import datetime def footers() ->rx.Component: '''funcion footer retorna un componente de reflex para dar forma al footer principal de la web''' return rx.vstack( ...
import reflex as rx from zaton_web.styles.colors import Color from zaton_web.styles.styles import Spacing, Size #actualmente deshabiliado def form_field( label: str, placeholder: str, type: str, name: str ) -> rx.Component: '''función form_field recibe los parámetros label, placeholder, type y name y devu...
import reflex as rx from zaton_web.styles.styles import * from zaton_web.styles.colors import Color from zaton_web.styles.constants import HOME, BIO, LIBROS, CONTACTO, PORTFOLIO def navbar_link(text: str, url: str) -> rx.Component: '''función nabvar_link retorna un componente para añadir enlaces al header o na...
import reflex as rx '''provisional, no utilizado en producción''' def sidebar_item( text: str, icon: str, href: str ) -> rx.Component: return rx.link( rx.hstack( rx.icon(icon), rx.text(text, size="4"), width="100%", padding_x="0.5rem", padding_...
'''archivo en el que se incluyen los colores genéricos de la web''' from enum import Enum import reflex as rx class Color(Enum): PRIMARY = "#1E3A8A" #azul oscuro SECONDARY = "#FFFFFF" #blanco, para fondos BACKGROUND = "#F3F4F6" #gris claro, contenidos secundarios y fondos CONTENT = "#F97316" #naranja,...
'''archivo de constantes para los estilos de la aplicación''' #LINK INTERNOS HOME ="/" PORTFOLIO = "/portfolio" LIBROS = "/libros" BIO = "/biografia" BLOG = "/blog" CONTACTO = "/contacto" #LINK EXTERNOS INSTAGRAM = "https://www.instagram.com/jorgezaton/" LINKEDIN = "https://www.linkedin.com/in/jorge-zaton/" GITHU...
'''archivo de fuentes y PESO de fuente de la web ''' from enum import Enum class Font(Enum): '''Clase Fuente, en él se incluyen las fuentes utilizadas en la web''' DEFAULT= "Poppins" SECONDARY="Roboto" ALTERNATIVE="Inter" class FontWeight(Enum): '''Clase FontWeight Se encluye el peso de la fue...
'''archivo de estilado de la web. En él se crean los estilos por defecto (fondo, fuente, etc)''' from enum import Enum from .fonts import * from .colors import * # Constants MAX_WIDTH = "600px" class Size(Enum): '''tamaños de la web para márgenes''' ZERO = "0px !important" SMALL = "0.5em" MEDIUM = "0...