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
astropy__astropy
astropy/extern/configobj/configobj.py
{ "start": 4845, "end": 5171 }
class ____(SyntaxError): """ This is the base class for all errors that ConfigObj raises. It is a subclass of SyntaxError. """ def __init__(self, message='', line_number=None, line=''): self.line = line self.line_number = line_number SyntaxError.__init__(self, message)
ConfigObjError
python
pytorch__pytorch
torch/_inductor/cache.py
{ "start": 898, "end": 1015 }
class ____(ValueError): """ Exception raised for errors encountered during cache operations. """
CacheError
python
redis__redis-py
tests/conftest.py
{ "start": 1320, "end": 22749 }
class ____(argparse.Action): def __init__( self, option_strings, dest, default=None, type=None, choices=None, required=False, help=None, metavar=None, ): _option_strings = [] for option_string in option_strings: ...
BooleanOptionalAction
python
aimacode__aima-python
logic.py
{ "start": 66401, "end": 74057 }
class ____(KB): """A knowledge base consisting of first-order definite clauses. >>> kb0 = FolKB([expr('Farmer(Mac)'), expr('Rabbit(Pete)'), ... expr('(Rabbit(r) & Farmer(f)) ==> Hates(f, r)')]) >>> kb0.tell(expr('Rabbit(Flopsie)')) >>> kb0.retract(expr('Rabbit(Pete)')) >>> kb0.ask(e...
FolKB
python
conda__conda
conda/core/path_actions.py
{ "start": 47595, "end": 51773 }
class ____(PathAction): def __init__( self, source_full_path, target_pkgs_dir, target_extracted_dirname, record_or_spec, sha256, size, md5, ): self.source_full_path = source_full_path self.target_pkgs_dir = target_pkgs_dir s...
ExtractPackageAction
python
streamlit__streamlit
lib/tests/streamlit/elements/element_policies_test.py
{ "start": 1222, "end": 1279 }
class ____(unittest.TestCase): pass
ElementPoliciesTest
python
sqlalchemy__sqlalchemy
test/sql/test_compare.py
{ "start": 82419, "end": 85009 }
class ____(fixtures.TestBase): def test_str(self): eq_( re.compile(r"[\n\s]+", re.M).sub( " ", str( CacheKey( key=((1, (2, 7, 4), 5),), bindparams=[], params={} ) ), ), ...
TestCacheKeyUtil
python
pytorch__pytorch
torch/distributed/elastic/timer/file_based_local_timer.py
{ "start": 3084, "end": 5907 }
class ____(TimerClient): """ Client side of ``FileTimerServer``. This client is meant to be used on the same host that the ``FileTimerServer`` is running on and uses pid to uniquely identify a worker. This client uses a named_pipe to send timer requests to the ``FileTimerServer``. This client is...
FileTimerClient
python
pytorch__pytorch
torch/_library/effects.py
{ "start": 66, "end": 170 }
class ____(Enum): ORDERED = "Ordered" from torch._library.utils import RegistrationHandle
EffectType
python
huggingface__transformers
src/transformers/models/whisper/modeling_whisper.py
{ "start": 9628, "end": 15464 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__( self, embed_dim: int, num_heads: int, dropout: float = 0.0, is_decoder: bool = False, bias: bool = True, is_causal: bool = False, layer_idx: O...
WhisperAttention
python
fluentpython__example-code
10-seq-hacking/vector_v4.py
{ "start": 3135, "end": 5016 }
class ____: typecode = 'd' def __init__(self, components): self._components = array(self.typecode, components) def __iter__(self): return iter(self._components) def __repr__(self): components = reprlib.repr(self._components) components = components[components.find('[')...
Vector
python
getsentry__sentry
tests/snuba/rules/conditions/test_event_frequency.py
{ "start": 1184, "end": 2309 }
class ____(BaseMetricsTestCase): def _make_sessions( self, num: int, environment_name: str | None = None, project: Project | None = None, received: float | None = None, ): if received is None: received = time.time() def make_session(i): ...
BaseEventFrequencyPercentTest
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/math_ops/basic_gpu_test.py
{ "start": 1365, "end": 3823 }
class ____(test.TestCase): def _compareGPU(self, x, y, np_func, tf_func): with self.cached_session(): inx = ops.convert_to_tensor(x) iny = ops.convert_to_tensor(y) out = tf_func(inx, iny) tf_gpu = self.evaluate(out) with self.cached_session(use_gpu=False): inx = ops.convert_to_...
GPUBinaryOpsTest
python
tensorflow__tensorflow
tensorflow/python/framework/function.py
{ "start": 9885, "end": 23530 }
class ____(object): """_DefinedFunction encapsulates a function definition and its properties. Attributes: name: The function name. definition: The definition of this function. A FunctionDef proto. cached_definition: Same as definition. Needed to match AtomicFunction API. grad_func_name: If not Non...
_DefinedFunction
python
optuna__optuna
optuna/terminator/terminator.py
{ "start": 875, "end": 5257 }
class ____(BaseTerminator): """Automatic stopping mechanism for Optuna studies. This class implements an automatic stopping mechanism for Optuna studies, aiming to prevent unnecessary computation. The study is terminated when the statistical error, e.g. cross-validation error, exceeds the room left for...
Terminator
python
google__jax
docs/autodidax.py
{ "start": 35906, "end": 37233 }
class ____(Trace): def new_arg(self, aval: ShapedArray) -> JaxprTracer: aval = raise_to_shaped(aval) tracer = self.builder.new_tracer(self, aval) self.builder.tracer_to_var[id(tracer)] = Var(aval) return tracer def get_or_make_const_tracer(self, val: Any) -> JaxprTracer: tracer = self.builder.c...
JaxprTrace
python
python__mypy
mypyc/ir/ops.py
{ "start": 34682, "end": 35574 }
class ____(RegisterOp): """box(type, src) This converts from a potentially unboxed representation to a straight Python object. Only supported for types with an unboxed representation. """ error_kind = ERR_NEVER def __init__(self, src: Value, line: int = -1) -> None: super().__init__(l...
Box
python
google__jax
tests/memories_test.py
{ "start": 1972, "end": 6154 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() self._default_memory_kind = "device" @parameterized.named_parameters( ("named_sharding", "named_sharding"), ("single_device_sharding", "single_device_sharding"), ("gspmd_sharding", "gspmd_sharding"), ) def test_canonicaliz...
ShardingMemoriesTest
python
dask__distributed
distributed/dashboard/components/shared.py
{ "start": 11068, "end": 15563 }
class ____(DashboardComponent): """Time plots of the current resource usage on the cluster This is two plots, one for CPU and Memory and another for Network I/O """ def __init__(self, server, doc=None, **kwargs): if doc is not None: self.doc = weakref.ref(doc) self.server =...
ProfileServer
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/types.py
{ "start": 13907, "end": 15305 }
class ____(sqltypes.TIME): """MySQL TIME type.""" __visit_name__ = "TIME" def __init__(self, timezone: bool = False, fsp: Optional[int] = None): """Construct a MySQL TIME type. :param timezone: not used by the MySQL dialect. :param fsp: fractional seconds precision value. ...
TIME
python
allegroai__clearml
clearml/backend_api/services/v2_20/models.py
{ "start": 2065, "end": 4285 }
class ____(NonStrictDataModel): """ :param key: The key uniquely identifying the metadata item inside the given entity :type key: str :param type: The type of the metadata item :type type: str :param value: The value stored in the metadata item :type value: str """ _schema =...
MetadataItem
python
getsentry__sentry
tests/sentry/users/api/endpoints/test_user_permissions_config.py
{ "start": 379, "end": 1722 }
class ____(UserPermissionsConfigTest): method = "GET" def test_superuser_lookup_self(self) -> None: self.superuser = self.create_user(is_superuser=True) self.login_as(user=self.superuser, superuser=True) self.add_user_permission(self.superuser, "users.admin") response = self.ge...
UserPermissionsConfigGetTest
python
ray-project__ray
rllib/core/models/torch/primitives.py
{ "start": 15305, "end": 22684 }
class ____(nn.Module): """A model containing a CNNTranspose with N Conv2DTranspose layers. All layers share the same activation function, bias setup (use bias or not), and LayerNormalization setup (use layer normalization or not), except for the last one, which is never activated and never layer norm'd...
TorchCNNTranspose
python
xlwings__xlwings
xlwings/constants.py
{ "start": 88627, "end": 89612 }
class ____: xlDifferenceFrom = 2 # from enum XlPivotFieldCalculation xlIndex = 9 # from enum XlPivotFieldCalculation xlNoAdditionalCalculation = -4143 # from enum XlPivotFieldCalculation xlPercentDifferenceFrom = 4 # from enum XlPivotFieldCalculation xlPercentOf = 3 # from enum XlPivotFieldCalc...
PivotFieldCalculation
python
walkccc__LeetCode
solutions/2874. Maximum Value of an Ordered Triplet II/2874.py
{ "start": 0, "end": 436 }
class ____: # Same as 2873. Maximum Value of an Ordered Triplet I def maximumTripletValue(self, nums: list[int]) -> int: ans = 0 maxDiff = 0 # max(nums[i] - nums[j]) maxNum = 0 # max(nums[i]) for num in nums: ans = max(ans, maxDiff * num) # num := nums[k] maxDiff = max(maxDif...
Solution
python
pypa__warehouse
tests/unit/email/test_init.py
{ "start": 70151, "end": 72704 }
class ____: @pytest.fixture def _organization_project(self, pyramid_user): self.user = pyramid_user self.organization_name = "exampleorganization" self.project_name = "exampleproject" @pytest.mark.usefixtures("_organization_project") @pytest.mark.parametrize( ("email_tem...
TestOrganizationProjectEmails
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_match_powers_of_base.py
{ "start": 1737, "end": 9019 }
class ____(ColumnMapExpectation): """Expect column values to match powers of Base (Base ** power == column value).""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "most...
ExpectColumnValuesToMatchPowersOfBase
python
doocs__leetcode
solution/2000-2099/2007.Find Original Array From Doubled Array/Solution.py
{ "start": 0, "end": 389 }
class ____: def findOriginalArray(self, changed: List[int]) -> List[int]: changed.sort() cnt = Counter(changed) ans = [] for x in changed: if cnt[x] == 0: continue cnt[x] -= 1 if cnt[x << 1] <= 0: return [] ...
Solution
python
pytorch__pytorch
test/dynamo/test_higher_order_ops.py
{ "start": 230628, "end": 231656 }
class ____(torch.nn.Module): def forward(self, L_self_buffers_tensor_constant0_: "f32[3, 3, 3]"): l_self_buffers_tensor_constant0_ = L_self_buffers_tensor_constant0_ alias_default: "f32[3, 3, 3]" = torch.ops.aten.alias.default(l_self_buffers_tensor_constant0_); l_self_buffers_tensor_constant0_ = N...
GraphModule
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_verified_permissions.py
{ "start": 915, "end": 1063 }
class ____: def test_conn_attribute(self): hook = VerifiedPermissionsHook() assert hasattr(hook, "conn")
TestVerifiedPermissionsHook
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/generated/AssetSelectionVisitor.py
{ "start": 258, "end": 6217 }
class ____(ParseTreeVisitor): # Visit a parse tree produced by AssetSelectionParser#start. def visitStart(self, ctx: AssetSelectionParser.StartContext): return self.visitChildren(ctx) # Visit a parse tree produced by AssetSelectionParser#UpTraversalExpression. def visitUpTraversalExpression(sel...
AssetSelectionVisitor
python
python-attrs__attrs
tests/test_dunders.py
{ "start": 27064, "end": 27181 }
class ____: pass # Store this class so that we recreate it. OriginalC = C @attr.s(unsafe_hash=True, order=True)
C
python
plotly__plotly.py
plotly/utils.py
{ "start": 3189, "end": 6233 }
class ____(PrettyPrinter): """ PrettyPrinter subclass that elides long lists/arrays/strings """ def __init__(self, *args, **kwargs): self.threshold = kwargs.pop("threshold", 200) PrettyPrinter.__init__(self, *args, **kwargs) def _format(self, val, stream, indent, allowance, context...
ElidedPrettyPrinter
python
RaRe-Technologies__gensim
gensim/similarities/docsim.py
{ "start": 8988, "end": 29340 }
class ____(interfaces.SimilarityABC): """Compute cosine similarity of a dynamic query against a corpus of documents ('the index'). The index supports adding new documents dynamically. Notes ----- Scalability is achieved by sharding the index into smaller pieces, each of which fits into core memory...
Similarity
python
ray-project__ray
python/ray/data/preprocessors/chain.py
{ "start": 266, "end": 4159 }
class ____(Preprocessor): """Combine multiple preprocessors into a single :py:class:`Preprocessor`. When you call ``fit``, each preprocessor is fit on the dataset produced by the preceeding preprocessor's ``fit_transform``. Example: >>> import pandas as pd >>> import ray >>> fr...
Chain
python
pytransitions__transitions
transitions/extensions/states.py
{ "start": 9723, "end": 9826 }
class ____(object): """Empty Python object which can be used to assign attributes to."""
VolatileObject
python
explosion__spaCy
spacy/lang/he/__init__.py
{ "start": 298, "end": 391 }
class ____(Language): lang = "he" Defaults = HebrewDefaults __all__ = ["Hebrew"]
Hebrew
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pep8_naming/N802.py
{ "start": 635, "end": 716 }
class ____(Visitor): def visit_Constant(self, node): pass
ExtendsVisitor
python
qdrant__qdrant-client
tools/async_client_generator/transformers/function_def_transformer.py
{ "start": 52, "end": 1109 }
class ____(ast.NodeTransformer): def __init__(self, keep_sync: Optional[list[str]] = None): self.keep_sync = keep_sync if keep_sync is not None else [] def _keep_sync(self, name: str) -> bool: return name in self.keep_sync def visit_FunctionDef(self, sync_node: ast.FunctionDef) -> ast.AST:...
FunctionDefTransformer
python
apache__airflow
airflow-ctl/src/airflowctl/ctl/cli_config.py
{ "start": 4337, "end": 6172 }
class ____: """Class to keep information about command line argument.""" def __init__( self, flags=_UNSET, help=_UNSET, action=_UNSET, default=_UNSET, nargs=_UNSET, type=_UNSET, choices=_UNSET, required=_UNSET, metavar=_UNSET, ...
Arg
python
huggingface__transformers
src/transformers/models/esm/modeling_esmfold.py
{ "start": 66912, "end": 72237 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config c_s = config.sequence_state_dim c_z = config.pairwise_state_dim self.pairwise_positional_embedding = EsmFoldRelativePosition(config) self.blocks = nn.ModuleList([EsmFoldTrian...
EsmFoldingTrunk
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-gitbook/llama_index/readers/gitbook/gitbook_client.py
{ "start": 104, "end": 3346 }
class ____: """ Gitbook Restful API Client. Helper Class to invoke gitbook restful api & parse result Args: api_token (str): Gitbook API Token. api_url (str): Gitbook API Endpoint. """ def __init__(self, api_token: str, api_url: str = DEFAULT_GITBOOK_API_URL): self.ap...
GitbookClient
python
openai__openai-python
src/openai/types/responses/response_input_item_param.py
{ "start": 6954, "end": 7383 }
class ____(TypedDict, total=False): commands: Required[SequenceNotStr[str]] """Ordered shell commands for the execution environment to run.""" max_output_length: Optional[int] """ Maximum number of UTF-8 characters to capture from combined stdout and stderr output. """ timeout_ms: Opti...
ShellCallAction
python
django__django
tests/admin_views/admin.py
{ "start": 24493, "end": 24826 }
class ____(admin.ModelAdmin): def get_urls(self): # Disable change_view, but leave other urls untouched urlpatterns = super().get_urls() return [p for p in urlpatterns if p.name and not p.name.endswith("_change")] @admin.display def callable_on_unknown(obj): return obj.unknown
UnchangeableObjectAdmin
python
tensorflow__tensorflow
tensorflow/python/autograph/operators/control_flow_test.py
{ "start": 2234, "end": 15990 }
class ____(testing.AutoGraphTestCase): def test_tensor(self): def body(i): nonlocal s s = s * 10 + i def set_state(loop_vars): nonlocal s s, = loop_vars s = 0 control_flow.for_stmt( constant_op.constant([1, 2, 3, 4]), extra_test=lambda: True, body=bod...
ForLoopTest
python
getsentry__sentry
tests/apidocs/endpoints/releases/test_project_release_file_details.py
{ "start": 136, "end": 1514 }
class ____(APIDocsTestCase): def setUp(self) -> None: self.login_as(user=self.user) project = self.create_project(name="foo") release = self.create_release(project=project, version="1") file1 = self.create_file( name="blah.js", size=42, type="relea...
ProjectReleaseFileDetailsDocsTest
python
huggingface__transformers
tests/models/qwen3/test_modeling_qwen3.py
{ "start": 1420, "end": 1979 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = Qwen3ModelTester # TODO (ydshieh): Check this. See https://app.circleci.com/pipelines/github/huggingface/transformers/79245/workflows/9490ef58-79c2-410d-8f51-e3495156cf9c/jobs/1012146 def is_pipeline_test_to_skip( self, ...
Qwen3ModelTest
python
mlflow__mlflow
dev/clint/tests/rules/test_markdown_link.py
{ "start": 480, "end": 1077 }
class ____: """ Class with [another markdown link](https://test.com). """ # Good def function_with_rest_link(): """ This function has a `reST link <https://example.com>`_. """ ''' config = Config(select={MarkdownLink.name}) violations = lint_file(Path("test.py"), code, config, index_pa...
MyClass
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 65741, "end": 66142 }
class ____(SimpleHandlerTestCase): class Handler(RequestHandler): def get(self): self.set_status(204) self.finish() def test_204_headers(self): response = self.fetch("/") self.assertEqual(response.code, 204) self.assertNotIn("Content-Length", response.hea...
Header204Test
python
vyperlang__vyper
vyper/builtins/functions.py
{ "start": 88584, "end": 88702 }
class ____(_MinMaxValue): _id = "min_value" def _eval(self, type_): return type_.ast_bounds[0]
MinValue
python
facelessuser__pymdown-extensions
tests/test_extensions/test_slugs.py
{ "start": 2280, "end": 2808 }
class ____(util.MdCase): """Test GitHub Flavored Markdown style slugs.""" extension = ['markdown.extensions.toc'] extension_configs = { 'markdown.extensions.toc': { "slugify": slugs.slugify(case="lower-ascii") } } def test_slug(self): """Test the slug output."""...
TestGFM
python
gevent__gevent
src/greentest/3.10/test_wsgiref.py
{ "start": 794, "end": 1181 }
class ____(WSGIServer): """Non-socket HTTP server""" def __init__(self, server_address, RequestHandlerClass): BaseServer.__init__(self, server_address, RequestHandlerClass) self.server_bind() def server_bind(self): host, port = self.server_address self.server_name = host ...
MockServer
python
celery__celery
t/unit/events/test_state.py
{ "start": 1180, "end": 1389 }
class ____(replay): def setup(self): self.events = [ Event('worker-online', hostname='utest1'), Event('worker-offline', hostname='utest1'), ]
ev_worker_online_offline
python
xlwings__xlwings
xlwings/_xlmac.py
{ "start": 43780, "end": 44288 }
class ____(base_classes.PageSetup): def __init__(self, parent, xl): self.parent = parent self.xl = xl @property def api(self): return self.xl @property def print_area(self): value = self.xl.print_area.get() if value == kw.missing_value: return No...
PageSetup
python
pytorch__pytorch
test/dynamo/test_modules.py
{ "start": 1224, "end": 1487 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.linear1 = torch.nn.Linear(10, 10) self.scale = torch.randn(1, 10) def forward(self, x): return F.relu(self.linear1(x)) * self.scale
BasicModule
python
readthedocs__readthedocs.org
readthedocs/oauth/migrations/0016_deprecate_old_vcs.py
{ "start": 180, "end": 1030 }
class ____(migrations.Migration): safe = Safe.before_deploy() dependencies = [ ("oauth", "0015_increase_avatar_url_length"), ] operations = [ migrations.AlterField( model_name="remoterepository", name="clone_url", field=models.URLField( ...
Migration
python
pytorch__pytorch
torch/cuda/_sanitizer.py
{ "start": 7408, "end": 12096 }
class ____: def __init__(self) -> None: self.current_sync_states: dict[StreamId, dict[StreamId, SeqNum]] = {} self.recorded_sync_states: dict[EventId, dict[StreamId, SeqNum]] = {} self.host_sync_state: dict[StreamId, SeqNum] = {} self.create_stream(DEFAULT_STREAM_ID) def _ensure...
StreamSynchronizations
python
ray-project__ray
python/ray/data/_internal/planner/plan_expression/expression_visitors.py
{ "start": 3348, "end": 7413 }
class ____(_ExprVisitor[Expr]): """Visitor rebinding column references in ``Expression``s. This visitor traverses given ``Expression`` trees and substitutes column references according to a provided substitution map. """ def __init__(self, column_ref_substitutions: Dict[str, Expr]): """Ini...
_ColumnSubstitutionVisitor
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_queried_slowly_changing_table_to_have_no_gaps.py
{ "start": 526, "end": 8293 }
class ____(QueryExpectation): """Expect Slowly changing table type II to have no gaps between the 'end date' of each row, and the next 'start date' in the next row. Args: template_dict: dict with the following keys: \ primary_key (primary key column name or multiple columns, comma separated...
ExpectQueriedSlowlyChangingTableToHaveNoGaps
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_glue.py
{ "start": 1334, "end": 23485 }
class ____: def setup_method(self): self.some_aws_region = "us-west-2" @mock_aws @pytest.mark.parametrize("role_path", ["/", "/custom-path/"]) def test_get_iam_execution_role(self, role_path): expected_role = "my_test_role" boto3.client("iam").create_role( Path=role_...
TestGlueJobHook
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_hyperlink15.py
{ "start": 315, "end": 1063 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("hyperlink15.xlsx") def test_create_file(self): """ Test the creation of a simple XlsxWriter file with hyperlinks. This exam...
TestCompareXLSXFiles
python
pytorch__pytorch
torch/distributions/transforms.py
{ "start": 30490, "end": 31522 }
class ____(Transform): r""" Transform from unconstrained space to the simplex via :math:`y = \exp(x)` then normalizing. This is not bijective and cannot be used for HMC. However this acts mostly coordinate-wise (except for the final normalization), and thus is appropriate for coordinate-wise op...
SoftmaxTransform
python
scikit-learn__scikit-learn
sklearn/linear_model/_coordinate_descent.py
{ "start": 24790, "end": 41349 }
class ____(MultiOutputMixin, RegressorMixin, LinearModel): """Linear regression with combined L1 and L2 priors as regularizer. Minimizes the objective function: .. math:: \\frac{1}{2 n_{\\rm samples}} \\cdot \\|y - X w\\|_2^2 + \\alpha \\cdot {\\rm l1\\_{ratio}} \\cdot \\|w\\|_1 +...
ElasticNet
python
getsentry__sentry
src/sentry/ratelimits/base.py
{ "start": 179, "end": 1064 }
class ____(Service): __all__ = ("is_limited", "validate", "current_value", "is_limited_with_value") window = 60 def is_limited( self, key: str, limit: int, project: Project | None = None, window: int | None = None ) -> bool: is_limited, _, _ = self.is_limited_with_value(key, limit, pro...
RateLimiter
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1468582, "end": 1468858 }
class ____(sgqlc.types.Type, Node, AuditEntry, EnterpriseAuditEntryData, OrganizationAuditEntryData): """Audit log entry for a repository_visibility_change.disable event.""" __schema__ = github_schema __field_names__ = ()
RepositoryVisibilityChangeDisableAuditEntry
python
mlflow__mlflow
mlflow/models/evaluation/base.py
{ "start": 32002, "end": 81247 }
class ____: name: str evaluator: ModelEvaluator config: dict[str, Any] def _resolve_default_evaluator(model_type, default_config) -> list[EvaluatorBundle]: """ Determine which built-in evaluators should be used for the given model type by default. Previously, MLflow evaluate API only had a si...
EvaluatorBundle
python
graphql-python__graphene
graphene/relay/tests/test_node_custom.py
{ "start": 555, "end": 649 }
class ____(Interface): width = Int(description="The width of the photo in pixels")
BasePhoto
python
numpy__numpy
numpy/random/tests/test_direct.py
{ "start": 17634, "end": 18798 }
class ____(Base): @classmethod def setup_class(cls): cls.bit_generator = SFC64 cls.bits = 64 cls.dtype = np.uint64 cls.data1 = cls._read_csv( join(pwd, './data/sfc64-testset-1.csv')) cls.data2 = cls._read_csv( join(pwd, './data/sfc64-testset-2.csv'...
TestSFC64
python
ray-project__ray
python/ray/data/tests/unit/test_expressions.py
{ "start": 7785, "end": 10257 }
class ____: """Test boolean expression functionality.""" @pytest.mark.parametrize( "condition", [ col("age") > lit(18), col("status") == lit("active"), col("name").is_not_null(), (col("age") >= lit(21)) & (col("country") == lit("USA")), ],...
TestBooleanExpressions
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin_ini/plugin_fail.py
{ "start": 3924, "end": 4597 }
class ____(BaseModel): undefined: Undefined # noqa F821 # MYPY: error: Name "Undefined" is not defined [name-defined] UndefinedAnnotationModel() # MYPY: error: Missing named argument "undefined" for "UndefinedAnnotationModel" [call-arg] Model.model_construct(x=1) # MYPY: error: Missing named argument "y" for...
UndefinedAnnotationModel
python
pytorch__pytorch
test/dynamo/test_subclasses.py
{ "start": 68905, "end": 79545 }
class ____(torch.nn.Module): def forward(self): ones: "f32[4, 3]" = torch.ones([4, 3]) return (ones,) """ test_recompilation( f, torch.randn([3, 4]), [3, 3, 4, 5], exp_graphs=[true_graph, true_graph, false_graph, false_graph], exp_f...
GraphModule
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/exceptions.py
{ "start": 999, "end": 1130 }
class ____(AirflowException): """Raised when an error is encountered while trying to merge pod configs."""
PodReconciliationError
python
dask__distributed
distributed/shuffle/tests/test_shuffle.py
{ "start": 76002, "end": 87098 }
class ____(_ShuffleRunManager): def __init__(self, *args: Any, **kwargs: Any): super().__init__(*args, **kwargs) self.in_get_or_create_shuffle = asyncio.Event() self.block_get_or_create_shuffle = asyncio.Event() self.in_get_shuffle_run = asyncio.Event() self.block_get_shuffle...
BlockedShuffleAccessAndFailShuffleRunManager
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance6.py
{ "start": 1492, "end": 1654 }
class ____(ParentC[_T3]): pass def func6(var: ParentC[int]): if isinstance(var, ChildC1): reveal_type(var, expected_text="ChildC1[float]")
ChildC1
python
charliermarsh__ruff
crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring.py
{ "start": 1942, "end": 2136 }
class ____: """Browse module classes and functions in IDLE.""" # This class is also the base class for pathbrowser.PathBrowser. def __init__(self): pass
CommentAfterDocstring1
python
getsentry__sentry
src/sentry/sentry_apps/utils/errors.py
{ "start": 1956, "end": 2129 }
class ____(SentryAppBaseError): error_type = SentryAppErrorType.INTEGRATOR status_code = 400 # Represents an error that's our (sentry's) fault
SentryAppIntegratorError
python
django__django
tests/m2m_through_regress/tests.py
{ "start": 2379, "end": 4460 }
class ____(TestCase): @classmethod def setUpTestData(cls): cls.bob = Person.objects.create(name="Bob") cls.roll = Group.objects.create(name="Roll") cls.bob_roll = Membership.objects.create(person=cls.bob, group=cls.roll) def test_serialization(self): "m2m-through models aren...
M2MThroughSerializationTestCase
python
encode__httpx
httpx/_decoders.py
{ "start": 9806, "end": 12041 }
class ____: """ Handles incrementally reading lines from text. Has the same behaviour as the stdllib splitlines, but handling the input iteratively. """ def __init__(self) -> None: self.buffer: list[str] = [] self.trailing_cr: bool = False def decode(self, text: str) -> li...
LineDecoder
python
ray-project__ray
python/ray/serve/tests/unit/test_router.py
{ "start": 1433, "end": 2575 }
class ____(ReplicaResult): def __init__( self, replica_id, is_generator_object: bool, queue_len_info: Optional[ReplicaQueueLengthInfo] = None, ): self._replica_id = replica_id self._is_generator_object = is_generator_object self._queue_len_info = queue_len...
FakeReplicaResult
python
pytorch__pytorch
test/distributed/elastic/utils/util_test.py
{ "start": 572, "end": 1458 }
class ____: _TEST_TIMEOUT = 1234 def __init__(self) -> None: self.ops = [] def set_timeout(self, timeout: float) -> None: self.ops.append(("set_timeout", timeout)) @property def timeout(self) -> datetime.timedelta: self.ops.append(("timeout",)) return datetime.tim...
MockStore
python
Pylons__pyramid
src/pyramid/config/rendering.py
{ "start": 267, "end": 1897 }
class ____: def add_default_renderers(self): for name, renderer in DEFAULT_RENDERERS: self.add_renderer(name, renderer) @action_method def add_renderer(self, name, factory): """ Add a :app:`Pyramid` :term:`renderer` factory to the current configuration state. ...
RenderingConfiguratorMixin
python
keon__algorithms
algorithms/heap/merge_sorted_k_lists.py
{ "start": 228, "end": 2094 }
class ____(object): """ ListNode Class""" def __init__(self, val): self.val = val self.next = None def merge_k_lists(lists): """ Merge Lists """ dummy = node = ListNode(0) list_h = [(n.val, n) for n in lists if n] heapify(list_h) while list_h: _, n_val = list_h[0] ...
ListNode
python
pytorch__pytorch
torch/distributed/checkpoint/state_dict.py
{ "start": 4586, "end": 8310 }
class ____(StateDictOptions): fqn_param_mapping: dict[ Union[str, torch.Tensor], Union[FQNS_T, torch.Tensor], ] = field(default_factory=dict) shared_params_mapping: dict[ Union[str, torch.Tensor], Union[FQNS_T, torch.Tensor], ] = field(default_factory=dict) submodule_...
_StateDictInfo
python
run-llama__llama_index
llama-index-packs/llama-index-packs-llama-dataset-metadata/llama_index/packs/llama_dataset_metadata/base.py
{ "start": 2090, "end": 2242 }
class ____(BaseMetadata): """Baseline data class.""" name: str config: BaselineConfig metrics: BaselineMetrics code_url: str
Baseline
python
wandb__wandb
wandb/sdk/wandb_require_helpers.py
{ "start": 840, "end": 1331 }
class ____: requirement = "" def __init__(self) -> None: self._check_if_requirements_met() def __post_init__(self) -> None: self._check_if_requirements_met() def _check_if_requirements_met(self) -> None: env_var = requirement_env_var_mapping[self.requirement] if not os...
RequiresMixin
python
huggingface__transformers
tests/models/efficientloftr/test_modeling_efficientloftr.py
{ "start": 5183, "end": 18312 }
class ____(ModelTesterMixin, unittest.TestCase): all_model_classes = (EfficientLoFTRForKeypointMatching, EfficientLoFTRModel) if is_torch_available() else () test_resize_embeddings = False has_attentions = True def setUp(self): self.model_tester = EfficientLoFTRModelTester(self) self.c...
EfficientLoFTRModelTest
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_managers.py
{ "start": 357, "end": 5988 }
class ____(TestCase): def setUp(self): self.user = get(User) self.another_user = get(User) self.project = get( Project, privacy_level=PUBLIC, external_builds_privacy_level=PUBLIC, users=[self.user], main_language_project=None, ...
TestBuildManagerBase
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_autofilter01.py
{ "start": 315, "end": 1845 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("autofilter01.xlsx") self.set_text_file("autofilter_data.txt") def test_create_file(self): """ Test the creation of a simple...
TestCompareXLSXFiles
python
tensorflow__tensorflow
tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py
{ "start": 90890, "end": 93617 }
class ____(test.TestCase): def _npXent(self, features, labels, dim=-1): if dim == -1: dim = len(features.shape) - 1 print("dim ", dim) one_only_on_dim = list(features.shape) one_only_on_dim[dim] = 1 e = np.exp( features - np.reshape(np.amax(features, axis=dim), one_only_on_dim) ...
XentTest
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 61617, "end": 62164 }
class ____(PrefectFilterBaseModel): """Filter by `BlockDocument.block_type_id`.""" any_: Optional[list[UUID]] = Field( default=None, description="A list of block type ids to include" ) def _get_filter_list( self, db: "PrefectDBInterface" ) -> Iterable[sa.ColumnExpressionArgument[bo...
BlockDocumentFilterBlockTypeId
python
pytorch__pytorch
test/distributed/test_c10d_gloo.py
{ "start": 91888, "end": 96444 }
class ____(ProcessGroupGlooTest): def setUp(self): os.environ["TORCH_FR_BUFFER_SIZE"] = "10" super().setUp() def tearDown(self) -> None: del os.environ["TORCH_FR_BUFFER_SIZE"] return super().tearDown() def _verify_trace(self, t, is_json): ver = t["version"] ...
ProcessGroupGlooFRTest
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 53853, "end": 54701 }
class ____(DDLEventWCreateHarness, fixtures.TestBase): __sparse_driver_backend__ = True __only_on__ = "postgresql > 8.3" creates_implicitly_with_table = False drops_implicitly_with_table = False requires_table_to_exist = False @testing.fixture def produce_subject(self): return Enu...
EnumDDLEventTest
python
doocs__leetcode
solution/2300-2399/2365.Task Scheduler II/Solution.py
{ "start": 0, "end": 276 }
class ____: def taskSchedulerII(self, tasks: List[int], space: int) -> int: day = defaultdict(int) ans = 0 for task in tasks: ans += 1 ans = max(ans, day[task]) day[task] = ans + space + 1 return ans
Solution
python
apache__airflow
providers/hashicorp/src/airflow/providers/hashicorp/hooks/vault.py
{ "start": 1275, "end": 18089 }
class ____(BaseHook): """ Hook to Interact with HashiCorp Vault KeyValue Secret engine. HashiCorp hvac documentation: * https://hvac.readthedocs.io/en/stable/ You connect to the host specified as host in the connection. The login/password from the connection are used as credentials usually ...
VaultHook
python
plotly__plotly.py
plotly/graph_objs/choropleth/_legendgrouptitle.py
{ "start": 233, "end": 2960 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "choropleth" _path_str = "choropleth.legendgrouptitle" _valid_props = {"font", "text"} @property def font(self): """ Sets this legend group's title font. The 'font' property is an instance of Font that may be s...
Legendgrouptitle
python
apache__airflow
airflow-ctl/src/airflowctl/ctl/cli_config.py
{ "start": 10354, "end": 32801 }
class ____: """Factory class that creates 1-1 mapping with airflowctl/api/operations.""" datamodels_extended_map: dict[str, list[str]] operations: list[dict] args_map: dict[tuple, list[Arg]] func_map: dict[tuple, Callable] commands_map: dict[str, list[ActionCommand]] group_commands_list: li...
CommandFactory
python
openai__openai-python
src/openai/types/fine_tuning/job_create_params.py
{ "start": 3729, "end": 4333 }
class ____(TypedDict, total=False): batch_size: Union[Literal["auto"], int] """Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. """ learning_rate_multiplier: Union[Literal["auto"], float] """Scaling fact...
Hyperparameters
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/class_interval.py
{ "start": 1567, "end": 1681 }
class ____(B3): def m0(self, x): self.m1(x) def m2(self, x): _test_sink(x) # Issue here
C3
python
gevent__gevent
src/gevent/tests/test__ares_host_result.py
{ "start": 310, "end": 908 }
class ____(greentest.TestCase): # Issue 104: ares.ares_host_result unpickleable def _test(self, protocol): r = ares_host_result('family', ('arg1', 'arg2', )) dumped = pickle.dumps(r, protocol) loaded = pickle.loads(dumped) self.assertEqual(r, loaded) # pylint:disable=no-...
TestPickle
python
huggingface__transformers
tests/models/bertweet/test_tokenization_bertweet.py
{ "start": 792, "end": 2854 }
class ____(TokenizerTesterMixin, unittest.TestCase): from_pretrained_id = "vinai/bertweet-base" tokenizer_class = BertweetTokenizer test_rust_tokenizer = False @classmethod def setUpClass(cls): super().setUpClass() # Adapted from Sennrich et al. 2015 and https://github.com/rsennric...
BertweetTokenizationTest