23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct
Dataset Card for LLMcoder-GitHub-Python-Mix-Direct Python target autocomplete suggestions in the format of conversations for OpenAI's fine-tuning. Dataset Details Dataset Description Curated by: [More Information Needed] Funded by [optional]: [More Information Needed] Shared by [optional]: [More Information Needed] Language(s) (NLP): [More Information Needed] License: [More Information Needed] Dataset Sources [optional] The data… See the full description on the dataset page: https://huggingface.co/datasets/23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct.
0216
1from __future__ import annotations2 3import os4import typing as t5from collections import defaultdict6from functools import update_wrapper7 8from .. import typing as ft9from .scaffold import _endpoint_from_view_func10from .scaffold import _sentinel11from .scaffold import Scaffold12from .scaffold import setupmethod13 14if t.TYPE_CHECKING: # pragma: no cover15 from .app import App16 17DeferredSetupFunction = t.Callable[["BlueprintSetupState"], t.Callable]18T_after_request = t.TypeVar("T_after_request", bound=ft.AfterRequestCallable)19T_before_request = t.TypeVar("T_before_request", bound=ft.BeforeRequestCallable)20T_error_handler = t.TypeVar("T_error_handler", bound=ft.ErrorHandlerCallable)21T_teardown = t.TypeVar("T_teardown", bound=ft.TeardownCallable)22T_template_context_processor = t.TypeVar(23 "T_template_context_processor", bound=ft.TemplateContextProcessorCallable24)25T_template_filter = t.TypeVar("T_template_filter", bound=ft.TemplateFilterCallable)26T_template_global = t.TypeVar("T_template_global", bound=ft.TemplateGlobalCallable)27T_template_test = t.TypeVar("T_template_test", bound=ft.TemplateTestCallable)28T_url_defaults = t.TypeVar("T_url_defaults", bound=ft.URLDefaultCallable)29T_url_value_preprocessor = t.TypeVar(30 "T_url_value_preprocessor", bound=ft.URLValuePreprocessorCallable31)32 33 34class BlueprintSetupState:35 """Temporary holder object for registering a blueprint with the36 application. An instance of this class is created by the37 :meth:`~flask.Blueprint.make_setup_state` method and later passed38 to all register callback functions.39 """40 41 def __init__(42 self,43 blueprint: Blueprint,44 app: App,45 options: t.Any,46 first_registration: bool,47 ) -> None:48 #: a reference to the current application49 self.app = app50 51 #: a reference to the blueprint that created this setup state.52 self.blueprint = blueprint53 54 #: a dictionary with all options that were passed to the55 #: :meth:`~flask.Flask.register_blueprint` method.56 self.options = options57 58 #: as blueprints can be registered multiple times with the59 #: application and not everything wants to be registered60 #: multiple times on it, this attribute can be used to figure61 #: out if the blueprint was registered in the past already.62 self.first_registration = first_registration63 64 subdomain = self.options.get("subdomain")65 if subdomain is None:66 subdomain = self.blueprint.subdomain67 68 #: The subdomain that the blueprint should be active for, ``None``69 #: otherwise.70 self.subdomain = subdomain71 72 url_prefix = self.options.get("url_prefix")73 if url_prefix is None:74 url_prefix = self.blueprint.url_prefix75 #: The prefix that should be used for all URLs defined on the76 #: blueprint.77 self.url_prefix = url_prefix78 79 self.name = self.options.get("name", blueprint.name)80 self.name_prefix = self.options.get("name_prefix", "")81 82 #: A dictionary with URL defaults that is added to each and every83 #: URL that was defined with the blueprint.84 self.url_defaults = dict(self.blueprint.url_values_defaults)85 self.url_defaults.update(self.options.get("url_defaults", ()))86 87 def add_url_rule(88 self,89 rule: str,90 endpoint: str | None = None,91 view_func: t.Callable | None = None,92 **options: t.Any,93 ) -> None:94 """A helper method to register a rule (and optionally a view function)95 to the application. The endpoint is automatically prefixed with the96 blueprint's name.97 """98 if self.url_prefix is not None:99 if rule:100 rule = "/".join((self.url_prefix.rstrip("/"), rule.lstrip("/")))101 else:102 rule = self.url_prefix103 options.setdefault("subdomain", self.subdomain)104 if endpoint is None:105 endpoint = _endpoint_from_view_func(view_func) # type: ignore106 defaults = self.url_defaults107 if "defaults" in options:108 defaults = dict(defaults, **options.pop("defaults"))109 110 self.app.add_url_rule(111 rule,112 f"{self.name_prefix}.{self.name}.{endpoint}".lstrip("."),113 view_func,114 