language
stringclasses
1 value
repo
stringclasses
346 values
path
stringlengths
6
201
class_span
dict
source
stringlengths
21
2.38M
target
stringlengths
1
96
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/wasb.py
{ "start": 2531, "end": 25448 }
class ____(BaseHook): """ Interact with Azure Blob Storage through the ``wasb://`` protocol. These parameters have to be passed in Airflow Data Base: account_name and account_key. Additional options passed in the 'extra' field of the connection will be passed to the `BlobServiceClient()` construct...
WasbHook
python
django__django
django/contrib/admindocs/apps.py
{ "start": 91, "end": 216 }
class ____(AppConfig): name = "django.contrib.admindocs" verbose_name = _("Administrative Documentation")
AdminDocsConfig
python
ZoranPandovski__al-go-rithms
hashes/Python/sha1.py
{ "start": 1557, "end": 4911 }
class ____: """ Class to contain the entire pipeline for SHA1 Hashing Algorithm """ def __init__(self, data): """ Inititates the variables data and h. h is a list of 5 8-digit Hexadecimal numbers corresponding to (1732584193, 4023233417, 2562383102, 271733878, 3285377520) ...
SHA1Hash
python
dagster-io__dagster
python_modules/dagster/dagster/components/resolved/base.py
{ "start": 8986, "end": 19880 }
class ____: type: Any default: Any has_default: bool field_info: Optional[FieldInfo] def _get_annotations( resolved_type: type[Resolvable], ) -> dict[str, AnnotationInfo]: annotations: dict[str, AnnotationInfo] = {} init_kwargs = _get_init_kwargs(resolved_type) if is_dataclass(resolved...
AnnotationInfo
python
getsentry__sentry
src/sentry/users/api/bases/user.py
{ "start": 4889, "end": 5847 }
class ____(Endpoint): """ The base endpoint for APIs that deal with Users but live in the region silo. Inherit from this class to get permission checks and to automatically convert user ID "me" to the currently logged in user's ID. """ permission_classes = (UserPermission,) def convert_arg...
RegionSiloUserEndpoint
python
huggingface__transformers
src/transformers/models/dpt/modeling_dpt.py
{ "start": 42566, "end": 43383 }
class ____(nn.Module): def __init__(self, config: DPTConfig): super().__init__() self.config = config features = config.fusion_hidden_size self.head = nn.Sequential( nn.Conv2d(features, features, kernel_size=3, padding=1, bias=False), nn.BatchNorm2d(features)...
DPTSemanticSegmentationHead
python
openai__gym
gym/core.py
{ "start": 10073, "end": 14519 }
class ____(Env[ObsType, ActType]): """Wraps an environment to allow a modular transformation of the :meth:`step` and :meth:`reset` methods. This class is the base class for all wrappers. The subclass could override some methods to change the behavior of the original environment without touching the ori...
Wrapper
python
keras-team__keras
keras/src/layers/reshaping/repeat_vector.py
{ "start": 208, "end": 1335 }
class ____(Layer): """Repeats the input n times. Example: >>> x = keras.Input(shape=(32,)) >>> y = keras.layers.RepeatVector(3)(x) >>> y.shape (None, 3, 32) Args: n: Integer, repetition factor. Input shape: 2D tensor with shape `(batch_size, features)`. Output sh...
RepeatVector
python
ray-project__ray
rllib/env/remote_base_env.py
{ "start": 512, "end": 16999 }
class ____(BaseEnv): """BaseEnv that executes its sub environments as @ray.remote actors. This provides dynamic batching of inference as observations are returned from the remote simulator actors. Both single and multi-agent child envs are supported, and envs can be stepped synchronously or asynchronou...
RemoteBaseEnv
python
django__django
tests/contenttypes_tests/models.py
{ "start": 720, "end": 860 }
class ____(models.Model): url = models.URLField(max_length=100) def get_absolute_url(self): return self.url
SchemeIncludedURL
python
gevent__gevent
src/gevent/_ffi/watcher.py
{ "start": 17949, "end": 18009 }
class ____(object): _watcher_type = 'prepare'
PrepareMixin
python
viewflow__viewflow
viewflow/workflow/flow/mixins.py
{ "start": 1428, "end": 2042 }
class ____(metaclass=ViewsetMeta): """Re-execute a gate manually.""" execute_view_class: Optional[Type[View]] = None @viewprop def execute_view(self): """View for the admin to re-execute a gate.""" if self.execute_view_class: return self.execute_view_class.as_view() @p...
NodeExecuteMixin
python
tensorflow__tensorflow
tensorflow/python/tpu/tpu_embedding_v3.py
{ "start": 7342, "end": 8243 }
class ____: """Information about how we stack tables.""" # Indexed by stacked table name: stacked_table_to_tables: Dict[str, TableConfig] = _fielddict() quantization_configs: Dict[str, QuantizationConfig] = _fielddict() # Indexed by table name: table_name_to_table: Dict[str, TableConfig] = _fielddict() ...
TableStacking
python
huggingface__transformers
tests/models/hunyuan_v1_dense/test_modeling_hunyuan_v1_dense.py
{ "start": 1043, "end": 1190 }
class ____(CausalLMModelTester): if is_torch_available(): base_model_class = HunYuanDenseV1Model @require_torch
HunYuanDenseV1ModelTester
python
ipython__ipython
tests/test_interactiveshell.py
{ "start": 29951, "end": 30347 }
class ____(unittest.TestCase): def test_unregistering(self): err_transformer = ErrorTransformer() ip.ast_transformers.append(err_transformer) with self.assertWarnsRegex(UserWarning, "It will be unregistered"): ip.run_cell("1 + 2") # This should have been removed. ...
TestAstTransformError
python
apache__airflow
providers/standard/tests/unit/standard/operators/test_python.py
{ "start": 24744, "end": 39972 }
class ____(BasePythonTest): opcls = ShortCircuitOperator @pytest.fixture(autouse=True) def setup_tests(self): self.task_id = "short_circuit" self.op1 = EmptyOperator(task_id="op1") self.op2 = EmptyOperator(task_id="op2") all_downstream_skipped_states = { "short_circuit"...
TestShortCircuitOperator
python
django__django
django/db/models/constants.py
{ "start": 142, "end": 210 }
class ____(Enum): IGNORE = "ignore" UPDATE = "update"
OnConflict
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDictClosed4.py
{ "start": 196, "end": 261 }
class ____(TypedDict, extra_items=int | None): name: str
Movie1
python
django__django
tests/xor_lookups/models.py
{ "start": 31, "end": 144 }
class ____(models.Model): num = models.IntegerField() def __str__(self): return str(self.num)
Number
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 12829, "end": 13013 }
class ____(Stmt): """A node that represents the import tag.""" fields = ("template", "target", "with_context") template: "Expr" target: str with_context: bool
Import
python
PyCQA__pylint
tests/functional/m/missing/missing_self_argument.py
{ "start": 69, "end": 502 }
class ____: """A class with some methods missing self args.""" def __init__(self): self.var = "var" def method(): # [no-method-argument] """A method without a self argument.""" def setup(): # [no-method-argument] """A method without a self argument, but usage.""" sel...
MyClass
python
ansible__ansible
test/lib/ansible_test/_internal/cli/parsers/base_argument_parsers.py
{ "start": 773, "end": 1457 }
class ____(NamespaceParser, metaclass=abc.ABCMeta): """Base class for target namespace parsers involving a single target.""" @property def option_name(self) -> str: """The option name used for this parser.""" return '--target' @property def dest(self) -> str: """The name of...
TargetNamespaceParser
python
pandas-dev__pandas
pandas/core/computation/engines.py
{ "start": 2708, "end": 3100 }
class ____(AbstractEngine): """NumExpr engine class""" has_neg_frac = True def _evaluate(self): import numexpr as ne # convert the expression to a valid numexpr expression s = self.convert() env = self.expr.env scope = env.full_scope _check_ne_builtin_clas...
NumExprEngine
python
spyder-ide__spyder
spyder/plugins/ipythonconsole/widgets/client.py
{ "start": 2813, "end": 38578 }
class ____(QWidget, SaveHistoryMixin, SpyderWidgetMixin): # noqa: PLR0904 """ Client widget for the IPython Console This widget is necessary to handle the interaction between the plugin and each shell widget. """ sig_append_to_history_requested = Signal(str, str) sig_execution_state_chang...
ClientWidget
python
Netflix__metaflow
test/test_config/mutable_flow.py
{ "start": 3061, "end": 4730 }
class ____(FlowMutator): def mutate(self, mutable_flow): steps = ["start", "end"] count = 0 for name, s in mutable_flow.steps: assert name in steps, "Unexpected step name" steps.remove(name) count += 1 assert count == 2, "Unexpected number of steps...
ModifyFlow
python
dagster-io__dagster
python_modules/libraries/dagster-shared/dagster_shared/cli/__init__.py
{ "start": 7129, "end": 8781 }
class ____: python_file: Optional[str] = None module_name: Optional[str] = None package_name: Optional[str] = None working_directory: Optional[str] = None attribute: Optional[str] = None autoload_defs_module_name: Optional[str] = None @classmethod def extract_from_cli_options(cls, cli_o...
PythonPointerOpts
python
huggingface__transformers
src/transformers/models/led/modeling_led.py
{ "start": 33317, "end": 39739 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__( self, embed_dim: int, num_heads: int, dropout: Optional[float] = 0.0, is_decoder: Optional[bool] = False, bias: Optional[bool] = True, layer_idx: Opti...
LEDDecoderAttention
python
pyqtgraph__pyqtgraph
pyqtgraph/functions.py
{ "start": 2653, "end": 9700 }
class ____(TypedDict): hues: int values: int maxValue: int minValue: int maxHue: int minHue: int sat: int alpha: int color_like: TypeAlias = ( QtGui.QColor | str | float | int | tuple[int, int, int] | tuple[int, int, int, int] | tuple[float, float, float] ...
HueKeywordArgs
python
facelessuser__pymdown-extensions
tests/test_extensions/test_legacy_slugs.py
{ "start": 1838, "end": 2513 }
class ____(util.MdCase): """Test Unicode cased, encoded slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.uslugify_cased_encoded } } def test_slug(self): """Test the slug output.""" wit...
TestUslugifyCasedEncoded
python
numpy__numpy
doc/preprocess.py
{ "start": 692, "end": 1565 }
class ____(Template): delimiter = '@' def doxy_config(root_path): """ Fetch all Doxygen sub-config files and gather it with the main config file. """ confs = [] dsrc_path = os.path.join(root_path, "doc", "source") sub = {'ROOT_DIR': root_path} with open(os.path.join(dsrc_path, "doxyfil...
DoxyTpl
python
yaml__pyyaml
lib/yaml/emitter.py
{ "start": 385, "end": 426 }
class ____(YAMLError): pass
EmitterError
python
hyperopt__hyperopt
hyperopt/pyll_utils.py
{ "start": 3535, "end": 7407 }
class ____: def __init__(self, name, val, op): self.op = op self.name = name self.val = val def __str__(self): return f"Cond{{{self.name} {self.op} {self.val}}}" def __eq__(self, other): return self.op == other.op and self.name == other.name and self.val == other.va...
Cond
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 1054419, "end": 1054579 }
class ____(sgqlc.types.Union): """ See source code for more info. """ __schema__ = graphql_schema __types__ = (Team, User)
DeploymentReviewer
python
kamyu104__LeetCode-Solutions
Python/di-string-match.py
{ "start": 29, "end": 447 }
class ____(object): def diStringMatch(self, S): """ :type S: str :rtype: List[int] """ result = [] left, right = 0, len(S) for c in S: if c == 'I': result.append(left) left += 1 else: resu...
Solution
python
django__django
tests/proxy_models/models.py
{ "start": 665, "end": 869 }
class ____(models.Model): """ A simple concrete base class. """ name = models.CharField(max_length=50) objects = PersonManager() def __str__(self): return self.name
Person
python
pydata__xarray
xarray/structure/alignment.py
{ "start": 4610, "end": 45268 }
class ____(Generic[T_Alignable]): """Implements all the complex logic for the re-indexing and alignment of Xarray objects. For internal use only, not public API. Usage: aligner = Aligner(*objects, **kwargs) aligner.align() aligned_objects = aligner.results """ objects: tuple[T_Al...
Aligner
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ActorDefinitionResourceRequirements.py
{ "start": 865, "end": 1022 }
class ____(BaseModel): class Config: extra = Extra.forbid jobType: JobType resourceRequirements: ResourceRequirements
JobTypeResourceLimit
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0100_project_readthedocs_yaml_path.py
{ "start": 189, "end": 1771 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0099_alter_domain_https"), ] operations = [ migrations.AddField( model_name="historicalproject", name="readthedocs_yaml_path", field=models.CharField( ...
Migration
python
dagster-io__dagster
python_modules/libraries/dagster-tableau/dagster_tableau/resources.py
{ "start": 19329, "end": 20186 }
class ____(BaseTableauClient): """Represents a client for Tableau Server and provides utilities to interact with Tableau APIs. """ def __init__( self, connected_app_client_id: str, connected_app_secret_id: str, connected_app_secret_value: str, username: str, ...
TableauServerClient
python
airbytehq__airbyte
airbyte-integrations/connectors/source-zoho-crm/source_zoho_crm/types.py
{ "start": 1174, "end": 1873 }
class ____(ZohoBaseType): textarea = "textarea" event_reminder = "event_reminder" phone = "phone" text = "text" profileimage = "profileimage" picklist = "picklist" bigint = "bigint" website = "website" email = "email" date = "date" datetime = "datetime" integer = "integer...
ZohoDataType
python
weaviate__weaviate-python-client
weaviate/gql/filter.py
{ "start": 14124, "end": 14700 }
class ____(NearMedia): """NearImage class used to filter weaviate objects.""" def __init__( self, content: dict, ): """Initialize a NearImage class instance. Args: content: The content of the `nearImage` clause. Raises: TypeError: If 'conten...
NearImage
python
facebook__pyre-check
api/query.py
{ "start": 823, "end": 1098 }
class ____(NamedTuple): name: str parameters: List[DefineParameter] return_annotation: str def get_class_name(self) -> str: return ".".join(self.name.split(".")[:-1]) def get_method_name(self) -> str: return self.name.split(".")[-1]
Define
python
getsentry__sentry
src/sentry/integrations/slack/requests/base.py
{ "start": 1501, "end": 1700 }
class ____(Exception): """ Something was invalid about the request from Slack. Includes the status the endpoint should return, based on the error. """ status: int
SlackRequestError
python
dagster-io__dagster
python_modules/libraries/dagster-azure/dagster_azure/blob/fake_blob_client.py
{ "start": 1236, "end": 1281 }
class ____: name: str url: str
FakeBlob
python
django__django
tests/backends/models.py
{ "start": 2489, "end": 2866 }
class ____(models.Model): headline = models.CharField(max_length=100) pub_date = models.DateField() reporter = models.ForeignKey(Reporter, models.CASCADE) reporter_proxy = models.ForeignKey( ReporterProxy, models.SET_NULL, null=True, related_name="reporter_proxy", ) ...
Article
python
walkccc__LeetCode
solutions/2932. Maximum Strong Pair XOR I/2932.py
{ "start": 0, "end": 141 }
class ____: def __init__(self): self.children: list[TrieNode | None] = [None] * 2 self.mn = math.inf self.mx = -math.inf
TrieNode
python
mlflow__mlflow
mlflow/telemetry/events.py
{ "start": 2077, "end": 3092 }
class ____(Event): name: str = "genai_evaluate" @classmethod def parse(cls, arguments: dict[str, Any]) -> dict[str, Any] | None: from mlflow.genai.scorers.base import Scorer from mlflow.genai.scorers.builtin_scorers import BuiltInScorer record_params = {} # Track if predic...
GenAIEvaluateEvent
python
pallets__jinja
src/jinja2/runtime.py
{ "start": 32443, "end": 33247 }
class ____(Undefined): """An undefined that returns the debug info when printed. >>> foo = DebugUndefined(name='foo') >>> str(foo) '{{ foo }}' >>> not foo True >>> foo + 42 Traceback (most recent call last): ... jinja2.exceptions.UndefinedError: 'foo' is undefined """ ...
DebugUndefined
python
scipy__scipy
scipy/special/tests/test_spherical_bessel.py
{ "start": 9303, "end": 9801 }
class ____: def fundamental_theorem(self, n, a, b): integral, tolerance = quad(lambda z: self.df(n, z), a, b) assert_allclose(integral, self.f(n, b) - self.f(n, a), atol=tolerance) @pytest.mark.slow def test_fundamental_theorem_0(self): ...
SphericalDerivativesTestCase
python
plotly__plotly.py
plotly/graph_objs/layout/xaxis/_rangebreak.py
{ "start": 235, "end": 11958 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.xaxis" _path_str = "layout.xaxis.rangebreak" _valid_props = { "bounds", "dvalue", "enabled", "name", "pattern", "templateitemname", "values", } @property def bounds(self): ...
Rangebreak
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py
{ "start": 5542, "end": 15420 }
class ____(object): """ Linux inotify(7) API wrapper class. :param path: The directory path for which we want an inotify object. :type path: :class:`bytes` :param recursive: ``True`` if subdirectories should be monitored; ``False`` otherwise. """ def __init__(self, ...
Inotify
python
realpython__materials
python-range-membership-test/range_tools.py
{ "start": 66, "end": 1717 }
class ____: start: int stop: int step: int = 1 def __post_init__(self): """Validate parameters.""" if not isinstance(self.start, int): raise ValueError("'start' must be an integer") if not isinstance(self.stop, int): raise ValueError("'stop' must be an in...
Range
python
django-compressor__django-compressor
compressor/exceptions.py
{ "start": 100, "end": 232 }
class ____(Exception): """ This exception is raised when a file cannot be compressed """ pass
UncompressableFileError
python
apache__airflow
task-sdk/src/airflow/sdk/execution_time/comms.py
{ "start": 20545, "end": 21157 }
class ____(TaskBreadcrumbsResponse): type: Literal["TaskBreadcrumbsResult"] = "TaskBreadcrumbsResult" @classmethod def from_api_response(cls, response: TaskBreadcrumbsResponse) -> TaskBreadcrumbsResult: """ Create result class from API Response. API Response is autogenerated from t...
TaskBreadcrumbsResult
python
rq__rq
rq/local.py
{ "start": 2259, "end": 4738 }
class ____: """This class works similar to a :class:`Local` but keeps a stack of objects instead. This is best explained with an example:: >>> ls = LocalStack() >>> ls.push(42) >>> ls.top 42 >>> ls.push(23) >>> ls.top 23 >>> ls.pop() 23 ...
LocalStack
python
pallets__werkzeug
src/werkzeug/routing/rules.py
{ "start": 585, "end": 3326 }
class ____: """A part of a rule. Rules can be represented by parts as delimited by `/` with instances of this class representing those parts. The *content* is either the raw content if *static* or a regex string to match against. The *weight* can be used to order parts when matching. """ ...
RulePart
python
pypa__pipenv
pipenv/vendor/tomlkit/items.py
{ "start": 8211, "end": 8629 }
class ____: """ Trivia information (aka metadata). """ # Whitespace before a value. indent: str = "" # Whitespace after a value, but before a comment. comment_ws: str = "" # Comment, starting with # character, or empty string if no comment. comment: str = "" # Trailing newline. ...
Trivia
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1549769, "end": 1556004 }
class ____(VegaLiteSchema): """ UnitSpecWithFrame schema wrapper. Parameters ---------- mark : dict, :class:`Mark`, :class:`AnyMark`, :class:`BoxPlot`, :class:`MarkDef`, :class:`ErrorBar`, :class:`ErrorBand`, :class:`BoxPlotDef`, :class:`ErrorBarDef`, :class:`ErrorBandDef`, :class:`CompositeMark`, ...
UnitSpecWithFrame
python
modin-project__modin
modin/tests/pandas/test_io.py
{ "start": 111630, "end": 112357 }
class ____: # It's not easy to add infrastructure for `orc` format. # In case of defaulting to pandas, it's enough # to check that the parameters are passed to pandas. def test_read_orc(self): test_args = ("fake_path",) test_kwargs = dict( columns=["A"], dtype_bac...
TestOrc
python
joke2k__faker
faker/providers/ssn/fr_CH/__init__.py
{ "start": 66, "end": 1495 }
class ____(SsnProvider): ssn_formats = ("###.####.####.##",) def ssn(self) -> str: """ Returns a 13 digits Swiss SSN named AHV (German) or AVS (French and Italian) See: http://www.bsv.admin.ch/themen/ahv/00011/02185/ """ def _checksum(digits): ...
Provider
python
optuna__optuna
optuna/storages/_rdb/models.py
{ "start": 15674, "end": 18325 }
class ____(BaseModel): class TrialIntermediateValueType(enum.Enum): FINITE = 1 INF_POS = 2 INF_NEG = 3 NAN = 4 __tablename__ = "trial_intermediate_values" __table_args__: Any = (UniqueConstraint("trial_id", "step"),) trial_intermediate_value_id = _Column(Integer, primary...
TrialIntermediateValueModel
python
altair-viz__altair
altair/datasets/_reader.py
{ "start": 3433, "end": 12629 }
class ____(Generic[IntoDataFrameT, IntoFrameT]): """ Modular file reader, targeting remote & local tabular resources. .. warning:: Use ``reader(...)`` instead of instantiating ``Reader`` directly. """ _read: Sequence[Read[IntoDataFrameT]] """Eager file read functions.""" _scan: Se...
Reader
python
django__django
tests/migrations/test_migrations_run_before/0003_third.py
{ "start": 43, "end": 656 }
class ____(migrations.Migration): """ This is a wee bit crazy, but it's just to show that run_before works. """ dependencies = [ ("migrations", "0001_initial"), ] run_before = [ ("migrations", "0002_second"), ] operations = [ migrations.CreateModel( ...
Migration
python
mlflow__mlflow
mlflow/dspy/callback.py
{ "start": 1522, "end": 17571 }
class ____(BaseCallback): """Callback for generating MLflow traces for DSPy components""" def __init__(self, dependencies_schema: dict[str, Any] | None = None): self._dependencies_schema = dependencies_schema # call_id: (LiveSpan, OTel token) self._call_id_to_span: dict[str, SpanWithTok...
MlflowCallback
python
pandas-dev__pandas
pandas/tests/io/parser/conftest.py
{ "start": 2279, "end": 2372 }
class ____(BaseParser): engine = "python" float_precision_choices = [None]
PythonParser
python
pyca__cryptography
tests/conftest.py
{ "start": 1663, "end": 1816 }
class ____: @contextlib.contextmanager def test(self): try: yield except pytest.skip.Exception: pass
SubTests
python
numba__numba
numba/cuda/tests/nocuda/test_dummyarray.py
{ "start": 10761, "end": 11868 }
class ____(unittest.TestCase): def test_squeeze(self): nparr = np.empty((1, 2, 1, 4, 1, 3)) arr = Array.from_desc( 0, nparr.shape, nparr.strides, nparr.dtype.itemsize ) def _assert_equal_shape_strides(arr1, arr2): self.assertEqual(arr1.shape, arr2.shape) ...
TestSqueeze
python
ray-project__ray
python/ray/serve/_private/test_utils.py
{ "start": 19248, "end": 21023 }
class ____: def __init__(self, name: str = None, tag_keys: Tuple[str] = None): self.name = name self.counts = dict() self.tags = tag_keys or () self.default_tags = dict() def set_default_tags(self, tags: Dict[str, str]): for key, tag in tags.items(): assert ...
FakeCounter
python
anthropics__anthropic-sdk-python
src/anthropic/lib/streaming/_messages.py
{ "start": 8829, "end": 16958 }
class ____: """Wrapper over AsyncMessageStream that is returned by `.stream()` so that an async context manager can be used without `await`ing the original client call. ```py async with client.messages.stream(...) as stream: async for chunk in stream: ... ``` """ de...
AsyncMessageStreamManager
python
facebook__pyre-check
tools/upgrade/commands/tests/fixme_single_test.py
{ "start": 486, "end": 3930 }
class ____(unittest.TestCase): @patch("subprocess.run") @patch.object(Configuration, "find_project_configuration", return_value=Path("/")) @patch.object(Configuration, "write") @patch.object(Configuration, "remove_version") @patch.object(Configuration, "get_errors") @patch.object(ErrorSuppressin...
FixmeSingleTest
python
Netflix__metaflow
metaflow/plugins/env_escape/configurations/test_lib_impl/test_lib.py
{ "start": 706, "end": 1029 }
class ____(HTMLParser): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._output = [] def handle_starttag(self, tag, attrs): self._output.append(tag) return super().handle_starttag(tag, attrs) def get_output(self): return self._output
BaseClass
python
tensorflow__tensorflow
tensorflow/tools/common/public_api.py
{ "start": 820, "end": 5407 }
class ____: """Visitor to use with `traverse` to visit exactly the public TF API.""" def __init__(self, visitor): """Constructor. `visitor` should be a callable suitable as a visitor for `traverse`. It will be called only for members of the public TensorFlow API. Args: visitor: A visitor to...
PublicAPIVisitor
python
cython__cython
Cython/Debugger/libcython.py
{ "start": 37477, "end": 38018 }
class ____(CythonCommand): """ List Cython source code. To disable to customize colouring see the cy_* parameters. """ name = 'cy list' command_class = gdb.COMMAND_FILES completer_class = gdb.COMPLETE_NONE @libpython.dont_suppress_errors # @dispatch_on_frame(c_command='list') d...
CyList
python
kamyu104__LeetCode-Solutions
Python/maximum-and-minimum-sums-of-at-most-size-k-subsequences.py
{ "start": 977, "end": 1426 }
class ____(object): def minMaxSums(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ MOD = 10**9+7 nums.sort() result = 0 cnt = 1 for i in xrange(len(nums)): cnt = reduce(lambda accu, x: (accu+x)%MOD, (n...
Solution2
python
pytorch__pytorch
test/distributed/_composable/fsdp/test_fully_shard_state_dict.py
{ "start": 911, "end": 15426 }
class ____(FSDPTest): @property def world_size(self) -> int: return min(8, torch.get_device_module(device_type).device_count()) @skip_if_lt_x_gpu(2) def test_dp_state_dict_save_load(self): fsdp_mesh = init_device_mesh(device_type.type, (self.world_size,)) self.run_subtests( ...
TestFullyShardStateDictMultiProcess
python
pytorch__pytorch
torch/_inductor/template_heuristics/triton.py
{ "start": 4910, "end": 29118 }
class ____(metaclass=BaseHeuristicSingleton): """ Base class for mm_configs, device specific triton kernels config inherit from here """ def __init__(self) -> None: # Whether the heuristic is used for int8. Use this when the heuristic is int8 exclusive # but prefer the preprocess_mm_con...
BaseConfigHeuristic
python
spyder-ide__spyder
spyder/plugins/explorer/widgets/explorer.py
{ "start": 3292, "end": 3393 }
class ____: General = 'general_section' Language = 'language_section'
DirViewNewSubMenuSections
python
realpython__materials
tic-tac-toe-ai-python/source_code_bonus/tic-tac-toe/library/src/tic_tac_toe/logic/models.py
{ "start": 617, "end": 1017 }
class ____: cells: str = " " * 9 def __post_init__(self) -> None: validate_grid(self) @cached_property def x_count(self) -> int: return self.cells.count("X") @cached_property def o_count(self) -> int: return self.cells.count("O") @cached_property def empty_cou...
Grid
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 23948, "end": 24208 }
class ____(Sky2PixProjection, PseudoCylindrical): r""" Sanson-Flamsteed projection - sky to pixel. Corresponds to the ``SFL`` projection in FITS WCS. .. math:: x &= \phi \cos \theta \\ y &= \theta """
Sky2Pix_SansonFlamsteed
python
keras-team__keras
keras/src/layers/preprocessing/image_preprocessing/random_invert_test.py
{ "start": 164, "end": 2229 }
class ____(testing.TestCase): @pytest.mark.requires_trainable_backend def test_layer(self): self.run_layer_test( layers.RandomInvert, init_kwargs={ "factor": 0.75, "value_range": (20, 200), "seed": 1, }, inpu...
RandomInvertTest
python
coleifer__peewee
playhouse/mysql_ext.py
{ "start": 2791, "end": 3874 }
class ____(TextField): field_type = 'JSON' def __init__(self, json_dumps=None, json_loads=None, **kwargs): self._json_dumps = json_dumps or json.dumps self._json_loads = json_loads or json.loads super(JSONField, self).__init__(**kwargs) def python_value(self, value): if val...
JSONField
python
getsentry__sentry
src/sentry/integrations/vsts/actions/create_ticket.py
{ "start": 218, "end": 853 }
class ____(TicketEventAction): id = "sentry.integrations.vsts.notify_action.AzureDevopsCreateTicketAction" label = "Create an Azure DevOps work item in {integration} with these " ticket_type = "an Azure DevOps work item" link = "https://docs.sentry.io/product/integrations/source-code-mgmt/azure-devops/#...
AzureDevopsCreateTicketAction
python
automl__auto-sklearn
autosklearn/metalearning/metafeatures/metafeatures.py
{ "start": 4210, "end": 4411 }
class ____(MetaFeature): def _calculate(self, X, y, logger, feat_type): return np.log(metafeatures.get_value("NumberOfInstances")) @metafeatures.define("NumberOfClasses")
LogNumberOfInstances
python
euske__pdfminer
pdfminer/pdftypes.py
{ "start": 949, "end": 992 }
class ____(PSException): pass
PDFException
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 6974, "end": 7026 }
class ____(str, Enum): BOOL = "bool"
BoolIndexType
python
dagster-io__dagster
python_modules/libraries/dagster-deltalake/dagster_deltalake/io_manager.py
{ "start": 1766, "end": 5681 }
class ____(ConfigurableIOManagerFactory): """Base class for an IO manager definition that reads inputs from and writes outputs to Delta Lake. Examples: .. code-block:: python from dagster_deltalake import DeltaLakeIOManager from dagster_deltalake_pandas import DeltaLakePandasTy...
DeltaLakeIOManager
python
apache__airflow
airflow-core/tests/unit/utils/test_json.py
{ "start": 1517, "end": 3554 }
class ____: def test_encode_raises(self): with pytest.raises(TypeError, match="^.*is not JSON serializable$"): json.dumps( Exception, cls=utils_json.XComEncoder, ) def test_encode_xcom_asset(self): asset = Asset(uri="mytest://asset", name=...
TestXComEncoder
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-groups-with-increasing-length.py
{ "start": 1797, "end": 2595 }
class ____(object): def maxIncreasingGroups(self, usageLimits): """ :type usageLimits: List[int] :rtype: int """ def check(l): curr = 0 for i in xrange(l): curr += usageLimits[~i]-(l-i) curr = min(curr, 0) fo...
Solution3
python
pennersr__django-allauth
allauth/mfa/webauthn/views.py
{ "start": 6415, "end": 7364 }
class ____(FormView): form_class = SignupWebAuthnForm template_name = "mfa/webauthn/signup_form." + account_settings.TEMPLATE_EXTENSION def get_context_data(self, **kwargs): ret = super().get_context_data() creation_options = auth.begin_registration( self.request._login_stage.lo...
SignupWebAuthnView
python
jazzband__django-oauth-toolkit
oauth2_provider/views/oidc.py
{ "start": 5930, "end": 8814 }
class ____(OIDCOnlyMixin, OAuthLibMixin, View): """ View used to show Claims about the authenticated End-User """ def get(self, request, *args, **kwargs): return self._create_userinfo_response(request) def post(self, request, *args, **kwargs): return self._create_userinfo_response(...
UserInfoView
python
google__jax
tests/multiprocess/array_test.py
{ "start": 35541, "end": 41609 }
class ____(jt_multiprocess.MultiProcessTest): def test_cross_host_transfer_single_device_sharding(self): x = np.arange(64).reshape(8, 8) src_pid = 0 dst_pid = 1 src_sharding = jax.sharding.SingleDeviceSharding( jax.local_devices(process_index=src_pid)[0]) dst_sharding = jax.sharding.Singl...
CrossHostTransferTest
python
PyCQA__pylint
tests/testutils/_primer/test_primer.py
{ "start": 1668, "end": 4000 }
class ____: @pytest.mark.parametrize( "directory", [ pytest.param(p, id=str(p.relative_to(FIXTURES_PATH))) for p in FIXTURES_PATH.iterdir() if p.is_dir() and p.name != "batched" # tested separately ], ) def test_compare(self, directory: Path) -> N...
TestPrimer
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0011_delete-url.py
{ "start": 71, "end": 344 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0010_migrate_domain_data"), ] operations = [ migrations.RemoveField( model_name="domain", name="url", ), ]
Migration
python
walkccc__LeetCode
solutions/687. Longest Univalue Path/687.py
{ "start": 0, "end": 604 }
class ____: def longestUnivaluePath(self, root: TreeNode | None) -> int: ans = 0 def longestUnivaluePathDownFrom(root: TreeNode | None) -> int: nonlocal ans if not root: return 0 l = longestUnivaluePathDownFrom(root.left) r = longestUnivaluePathDownFrom(root.right) arro...
Solution
python
tornadoweb__tornado
tornado/test/websocket_test.py
{ "start": 6380, "end": 6879 }
class ____(AsyncHTTPTestCase): def setUp(self): super().setUp() self.conns_to_close = [] def tearDown(self): for conn in self.conns_to_close: conn.close() super().tearDown() @gen.coroutine def ws_connect(self, path, **kwargs): ws = yield websocket_co...
WebSocketBaseTestCase
python
google__jax
tests/pallas/tpu_pallas_state_test.py
{ "start": 6934, "end": 11120 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() if not jtu.is_device_tpu_at_least(4): self.skipTest("Only supported on TPU v4+") def test_can_create_tensorcore_mesh(self): _ = pltpu.create_tensorcore_mesh("x") def test_kernel_helper_basic(self): mesh = pltpu.create_tensorcor...
CoreMapTest
python
tensorflow__tensorflow
tensorflow/python/training/server_lib_same_variables_clear_test.py
{ "start": 1051, "end": 2634 }
class ____(test.TestCase): # Verifies behavior of tf.Session.reset(). # TODO(b/34465411): Starting multiple servers with different configurations # in the same test is flaky. Move this test case back into # "server_lib_test.py" when this is no longer the case. @test_util.run_deprecated_v1 def testSameVaria...
SameVariablesClearTest
python
networkx__networkx
benchmarks/benchmarks/benchmark_many_components.py
{ "start": 24, "end": 915 }
class ____: """Use atlas6() as a benchmarking case to probe for performance on graphs with many connected components. ``atlas6()`` is all of the graphs with at most 6 nodes and at least one edge that are connected and not isomorphic to one another (142 components in total). See the atlas6 gallery e...
ManyComponentsBenchmark
python
jina-ai__jina
tests/unit/serve/executors/test_executor.py
{ "start": 872, "end": 1006 }
class ____(Executor): @requests def foo(self, docs, **kwargs): docs.texts = [self.workspace for _ in docs]
WorkspaceExec
python
pytorch__pytorch
benchmarks/tensorexpr/broadcast.py
{ "start": 4570, "end": 9601 }
class ____(benchmark.Benchmark): # List of customization class variables. op_str = None binary_op_pt_func = None binary_op_np_func = None unary_op_pt_func = None unary_op_np_func = None split_input = True def __init__(self, mode, device, dtype, M, N, K): super().__init__(mode, d...
BroadcastBench