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
getsentry__sentry
src/sentry/monitors/migrations/0008_fix_processing_error_keys.py
{ "start": 888, "end": 2473 }
class ____: """ Represents a check-in to be processed """ ts: datetime """ The timestamp the check-in was produced into the kafka topic. This differs from the start_time that is part of the CheckIn """ partition: int """ The kafka partition id the check-in was produced into...
CheckinItem
python
django__django
django/contrib/admin/helpers.py
{ "start": 2597, "end": 3482 }
class ____: def __init__( self, form, name=None, readonly_fields=(), fields=(), classes=(), description=None, model_admin=None, ): self.form = form self.name, self.fields = name, fields self.classes = " ".join(classes) ...
Fieldset
python
great-expectations__great_expectations
tests/integration/fluent/test_databricks_datasource.py
{ "start": 2846, "end": 6125 }
class ____: """Test column expectations for Databricks datasources""" @parameterize_batch_for_data_sources( data_source_configs=[ DatabricksDatasourceTestConfig(table_name=TEST_TABLE_NAME.lower()), ], data=pd.DataFrame({"unquoted_lower_col": ["test_value"]}), ) def t...
TestDatabricksColumnExpectations
python
kamyu104__LeetCode-Solutions
Python/find-the-number-of-ways-to-place-people-i.py
{ "start": 45, "end": 622 }
class ____(object): def numberOfPairs(self, points): """ :type points: List[List[int]] :rtype: int """ points.sort(key=lambda x: (x[0], -x[1])) result = 0 for i in xrange(len(points)): y = float("-inf") for j in xrange(i+1, len(points))...
Solution
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-operations-to-sort-a-binary-tree-by-level.py
{ "start": 138, "end": 826 }
class ____(object): def minimumOperations(self, root): """ :type root: Optional[TreeNode] :rtype: int """ result = 0 q = [root] while q: new_q = [] for node in q: if node.left: new_q.append(node.left)...
Solution
python
huggingface__transformers
src/transformers/utils/dummy_music_objects.py
{ "start": 129, "end": 298 }
class ____(metaclass=DummyObject): _backends = ["music"] def __init__(self, *args, **kwargs): requires_backends(self, ["music"])
Pop2PianoFeatureExtractor
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-adapter/llama_index/embeddings/adapter/utils.py
{ "start": 3050, "end": 5516 }
class ____(BaseAdapter): """ Two-layer transformation. Args: in_features (int): Input dimension. hidden_features (int): Hidden dimension. out_features (int): Output dimension. bias (bool): Whether to use bias. Defaults to False. activation_fn_str (str): Name of activ...
TwoLayerNN
python
Netflix__metaflow
metaflow/plugins/airflow/airflow_utils.py
{ "start": 1437, "end": 4182 }
class ____(Exception): headline = "Sensor package not found" def create_absolute_version_number(version): abs_version = None # For all digits if all(v.isdigit() for v in version.split(".")): abs_version = sum( [ (10 ** (3 - idx)) * i for idx, i in en...
AirflowSensorNotFound
python
numba__numba
numba/tests/test_ir_inlining.py
{ "start": 38100, "end": 38911 }
class ____(TestCase): def test_basic(self): always = InlineOptions('always') self.assertTrue(always.is_always_inline) self.assertFalse(always.is_never_inline) self.assertFalse(always.has_cost_model) self.assertEqual(always.value, 'always') never = InlineOptions('nev...
TestInlineOptions
python
openai__openai-python
src/openai/types/eval_create_response.py
{ "start": 2635, "end": 3531 }
class ____(BaseModel): id: str """Unique identifier for the evaluation.""" created_at: int """The Unix timestamp (in seconds) for when the eval was created.""" data_source_config: DataSourceConfig """Configuration of data sources used in runs of the evaluation.""" metadata: Optional[Metad...
EvalCreateResponse
python
automl__auto-sklearn
test/test_pipeline/components/feature_preprocessing/test_select_percentile_classification.py
{ "start": 312, "end": 4573 }
class ____(unittest.TestCase): def test_default_configuration(self): transformation, original = _test_preprocessing(SelectPercentileClassification) self.assertEqual(transformation.shape[0], original.shape[0]) self.assertEqual(transformation.shape[1], int(original.shape[1] / 2)) self....
SelectPercentileClassificationTest
python
pyca__cryptography
tests/hazmat/primitives/decrepit/test_algorithms.py
{ "start": 690, "end": 1966 }
class ____: @pytest.mark.parametrize( ("key", "keysize"), [ (b"0" * 10, 40), (b"0" * 14, 56), (b"0" * 16, 64), (b"0" * 20, 80), (b"0" * 32, 128), (b"0" * 48, 192), (b"0" * 64, 256), ], ) def test_key_...
TestARC4
python
walkccc__LeetCode
solutions/1072. Flip Columns For Maximum Number of Equal Rows/1072.py
{ "start": 0, "end": 193 }
class ____: def maxEqualRowsAfterFlips(self, matrix: list[list[int]]) -> int: patterns = [tuple(a ^ row[0] for a in row) for row in matrix] return max(Counter(patterns).values())
Solution
python
doocs__leetcode
solution/0600-0699/0654.Maximum Binary Tree/Solution.py
{ "start": 192, "end": 590 }
class ____: def constructMaximumBinaryTree(self, nums: List[int]) -> Optional[TreeNode]: def dfs(nums): if not nums: return None val = max(nums) i = nums.index(val) root = TreeNode(val) root.left = dfs(nums[:i]) root.rig...
Solution
python
django__django
tests/defer_regress/models.py
{ "start": 697, "end": 973 }
class ____(models.Model): name = models.CharField(max_length=10) child = models.ForeignKey(Child, models.CASCADE) second_child = models.ForeignKey( Child, models.SET_NULL, related_name="other", null=True ) value = models.IntegerField(default=42)
Leaf
python
airbytehq__airbyte
airbyte-integrations/connectors/source-marketo/source_marketo/source.py
{ "start": 18266, "end": 19610 }
class ____(YamlDeclarativeSource): """ Source Marketo fetch data of personalized multichannel programs and campaigns to prospects and customers. """ def __init__(self) -> None: super().__init__(**{"path_to_yaml": "manifest.yaml"}) def _get_declarative_streams(self, config: Mapping[str, Any...
SourceMarketo
python
altair-viz__altair
altair/jupyter/jupyter_chart.py
{ "start": 1292, "end": 3026 }
class ____(traitlets.HasTraits): """Traitlet class storing a JupyterChart's selections.""" def __init__(self, trait_values): super().__init__() for key, value in trait_values.items(): if isinstance(value, IndexSelection): traitlet_type = traitlets.Instance(IndexSele...
Selections
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/asyncpg.py
{ "start": 9212, "end": 9842 }
class ____(BIT): render_bind_cast = True def bind_processor(self, dialect): asyncpg_BitString = dialect.dbapi.asyncpg.BitString def to_bind(value): if isinstance(value, str): value = BitString(value) value = asyncpg_BitString.from_int(int(value), len...
AsyncpgBit
python
python__mypy
mypy/find_sources.py
{ "start": 3030, "end": 9630 }
class ____: def __init__(self, fscache: FileSystemCache, options: Options) -> None: self.fscache = fscache self.explicit_package_bases = get_explicit_package_bases(options) self.namespace_packages = options.namespace_packages self.exclude = options.exclude self.exclude_gitign...
SourceFinder
python
sqlalchemy__sqlalchemy
test/sql/test_compiler.py
{ "start": 289608, "end": 291629 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = "default" def test_order_by_list(self): """Test standalone OrderByList with various operators""" col1 = Column("x", Integer) col2 = Column("y", Integer) # Test basic OrderByList creation order_list = Order...
OrderByListTest
python
walkccc__LeetCode
solutions/2768. Number of Black Blocks/2768.py
{ "start": 0, "end": 689 }
class ____: def countBlackBlocks( self, m: int, n: int, coordinates: list[list[int]], ) -> list[int]: ans = [0] * 5 # count[i * n + j] := the number of black cells in # (i - 1, j - 1), (i - 1, j), (i, j - 1), (i, j) count = collections.Counter() for x, y in coordinates: ...
Solution
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/concepts/ops_jobs_graphs/unit_tests.py
{ "start": 2795, "end": 2908 }
class ____: def __init__(self, api_key): self._api_key = api_key def query(self, body): ...
Client
python
wandb__wandb
wandb/apis/public/integrations.py
{ "start": 2695, "end": 2984 }
class ____(Integrations): """A lazy iterator of `SlackIntegration` objects. <!-- lazydoc-ignore-class: internal --> """ def _convert(self, node: IntegrationFields) -> SlackIntegration: return node if (node.typename__ == "SlackIntegration") else None
SlackIntegrations
python
dagster-io__dagster
helm/dagster/schema/schema/charts/dagster/subschema/webserver.py
{ "start": 364, "end": 1873 }
class ____(BaseModel, extra="forbid"): replicaCount: int image: kubernetes.Image nameOverride: str pathPrefix: Optional[str] = None service: kubernetes.Service workspace: Workspace env: Union[dict[str, str], list[kubernetes.EnvVar]] envConfigMaps: list[kubernetes.ConfigMapEnvSource] ...
Webserver
python
h5py__h5py
h5py/tests/test_base.py
{ "start": 990, "end": 1591 }
class ____(BaseTest): """ test the parent group of the high-level interface objects """ def test_object_parent_anonymous(self): # Anonymous objects grp = self.f.create_group(None) # Parent of an anonymous object is undefined with self.assertRaises(ValueError): ...
TestParent
python
weaviate__weaviate-python-client
weaviate/collections/classes/grpc.py
{ "start": 7537, "end": 7709 }
class ____: # replace with ClassVar[base_search_pb2.SearchOperatorOptions.Operator] once python 3.10 is removed operator: ClassVar[Any] @dataclass
BM25OperatorOptions
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol40.py
{ "start": 251, "end": 315 }
class ____(Protocol[S]): def f0(self, /) -> Self: ...
P1Parent
python
ansible__ansible
test/lib/ansible_test/_internal/host_profiles.py
{ "start": 62934, "end": 63468 }
class ____(ControllerHostProfile[OriginConfig]): """Host profile for origin.""" @property def name(self) -> str: """The name of the host profile.""" return 'origin' def get_origin_controller_connection(self) -> LocalConnection: """Return a connection for accessing the host as a...
OriginProfile
python
scipy__scipy
scipy/integrate/tests/test_quadrature.py
{ "start": 1899, "end": 3322 }
class ____: def test_newton_cotes(self): """Test the first few degrees, for evenly spaced points.""" n = 1 wts, errcoff = newton_cotes(n, 1) assert_equal(wts, n*np.array([0.5, 0.5])) assert_almost_equal(errcoff, -n**3/12.0) n = 2 wts, errcoff = newton_cotes(n...
TestNewtonCotes
python
PyCQA__pylint
tests/functional/u/unused/unused_import_class_def_keyword.py
{ "start": 413, "end": 476 }
class ____(Child, domain=DOMAIN): pass # Alternative 1
Parent
python
numba__numba
numba/tests/test_sets.py
{ "start": 6313, "end": 7255 }
class ____(BaseTest): def check(self, pyfunc): cfunc = njit(pyfunc) expected = pyfunc() got = cfunc() self.assertPreciseEqual(expected, got) return got, expected def test_build_set(self): pyfunc = set_literal_return_usecase((1, 2, 3, 2)) self.check(pyfun...
TestSetLiterals
python
pypa__warehouse
tests/unit/subscriptions/test_services.py
{ "start": 2801, "end": 14763 }
class ____: def test_verify_service(self): assert verifyClass(IBillingService, MockStripeBillingService) def test_basic_init(self): api = pretend.stub() billing_service = MockStripeBillingService( api=api, publishable_key="secret_to_everybody", webho...
TestMockStripeBillingService
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/functions.py
{ "start": 67435, "end": 68803 }
class ____(GenericFunction[str]): """Implement a generic string aggregation function. This function will concatenate non-null values into a string and separate the values by a delimiter. This function is compiled on a per-backend basis, into functions such as ``group_concat()``, ``string_agg()``, ...
aggregate_strings
python
doocs__leetcode
solution/2700-2799/2747.Count Zero Request Servers/Solution.py
{ "start": 0, "end": 675 }
class ____: def countServers( self, n: int, logs: List[List[int]], x: int, queries: List[int] ) -> List[int]: cnt = Counter() logs.sort(key=lambda x: x[1]) ans = [0] * len(queries) j = k = 0 for r, i in sorted(zip(queries, count())): l = r - x ...
Solution
python
donnemartin__interactive-coding-challenges
graphs_trees/tree_dfs/test_dfs.py
{ "start": 18, "end": 1531 }
class ____(unittest.TestCase): def __init__(self, *args, **kwargs): super(TestDfs, self).__init__() self.results = Results() def test_dfs(self): bst = BstDfs(Node(5)) bst.insert(2) bst.insert(8) bst.insert(1) bst.insert(3) bst.in_order_traversal...
TestDfs
python
pytorch__pytorch
test/export/test_tree_utils.py
{ "start": 301, "end": 1863 }
class ____(TestCase): def test_reorder_kwargs(self): original_kwargs = {"a": torch.tensor(0), "b": torch.tensor(1)} user_kwargs = {"b": torch.tensor(2), "a": torch.tensor(3)} orig_spec = tree_structure(((), original_kwargs)) reordered_kwargs = reorder_kwargs(user_kwargs, orig_spec) ...
TestTreeUtils
python
pypa__warehouse
warehouse/packaging/services.py
{ "start": 9721, "end": 10150 }
class ____(GenericS3BlobStorage): @classmethod def create_service(cls, context, request): session = request.find_service(name="aws.session") s3 = session.resource("s3") bucket = s3.Bucket(request.registry.settings["archive_files.bucket"]) prefix = request.registry.settings.get("a...
S3ArchiveFileStorage
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/event_log/polling_event_watcher.py
{ "start": 416, "end": 812 }
class ____(NamedTuple): """Callback passed from Observer class in event polling. cursor (str): Only process EventLogEntrys after the given cursor callback (Callable[[EventLogEntry], None]): callback passed from Observer to call on new EventLogEntrys, with a string cursor """ cursor: Option...
CallbackAfterCursor
python
zarr-developers__zarr-python
tests/test_group.py
{ "start": 73575, "end": 85946 }
class ____: """ Tests for the function that parses dicts of str : Metadata pairs, ensuring that the output models a valid Zarr hierarchy """ @staticmethod def test_normed_keys() -> None: """ Test that keys get normalized properly """ nodes = { "a": G...
TestParseHierarchyDict
python
matplotlib__matplotlib
lib/matplotlib/patches.py
{ "start": 884, "end": 22990 }
class ____(artist.Artist): """ A patch is a 2D artist with a face color and an edge color. If any of *edgecolor*, *facecolor*, *linewidth*, or *antialiased* are *None*, they default to their rc params setting. """ zorder = 1 # Whether to draw an edge by default. Set on a # subclass-by...
Patch
python
Pylons__pyramid
tests/test_authentication.py
{ "start": 64543, "end": 67311 }
class ____(unittest.TestCase): def _get_func(self): from pyramid.authentication import extract_http_basic_credentials return extract_http_basic_credentials def test_no_auth_header(self): request = testing.DummyRequest() fn = self._get_func() self.assertIsNone(fn(reques...
TestExtractHTTPBasicCredentials
python
allegroai__clearml
clearml/backend_interface/task/log.py
{ "start": 7676, "end": 14514 }
class ____(BufferingHandler): __flush_max_history_seconds = 30.0 __wait_for_flush_timeout = 10.0 __once = False __offline_filename = "log.jsonl" @property def task_id(self) -> Any: return self._task_id @task_id.setter def task_id(self, value: Any) -> None: self._task_id...
TaskHandler
python
PrefectHQ__prefect
tests/server/orchestration/api/test_flows.py
{ "start": 2508, "end": 4144 }
class ____: async def test_update_flow_succeeds(self, session, client): flow = await models.flows.create_flow( session=session, flow=schemas.core.Flow(name="my-flow-1", tags=["db", "blue"]), ) await session.commit() current_time = now("UTC") response ...
TestUpdateFlow
python
kamyu104__LeetCode-Solutions
Python/find-the-number-of-good-pairs-i.py
{ "start": 90, "end": 564 }
class ____(object): def numberOfPairs(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: int """ cnt = [0]*(max(nums1)+1) for x, c in collections.Counter(k*x for x in nums2).iteritems(): for i in ...
Solution
python
huggingface__transformers
src/transformers/models/fastspeech2_conformer/configuration_fastspeech2_conformer.py
{ "start": 17435, "end": 21732 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`FastSpeech2ConformerHifiGanModel`]. It is used to instantiate a FastSpeech2Conformer HiFi-GAN vocoder model according to the specified arguments, defining the model architecture. Instantiating a configur...
FastSpeech2ConformerHifiGanConfig
python
vyperlang__vyper
vyper/codegen/context.py
{ "start": 976, "end": 2179 }
class ____: name: str pos: int typ: VyperType mutable: bool encoding: Encoding = Encoding.VYPER location: AddrSpace = MEMORY size: Optional[int] = None # allocated size blockscopes: Optional[list] = None defined_at: Any = None is_internal: bool = False alloca: Optional[Alloc...
VariableRecord
python
ray-project__ray
python/ray/_private/arrow_serialization.py
{ "start": 7821, "end": 27723 }
class ____: """Picklable array payload, holding data buffers and array metadata. This is a helper container for pickling and reconstructing nested Arrow Arrays while ensuring that the buffers that underly zero-copy slice views are properly truncated. """ # Array type. type: "pyarrow.DataType" ...
PicklableArrayPayload
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/io_ops/save_restore_ops_test.py
{ "start": 2593, "end": 3605 }
class ____(test.TestCase, parameterized.TestCase): @parameterized.parameters(_TEST_DTYPES) def testRestoreV2WithSliceInput(self, dtype): with ops.Graph().as_default(): op = io_ops.restore_v2( "model", ["var1", "var2"], ["", "3 4 0,1:-"], [dtype, dtype] ) self.assertEqual(2, len(op))...
ShapeInferenceTest
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/bump_version/pipeline.py
{ "start": 497, "end": 4756 }
class ____(Step): context: ConnectorContext title = "Restore original version state" def __init__(self, context: ConnectorContext) -> None: super().__init__(context) connector = context.connector if connector.metadata_file_path.is_file(): self.metadata_content = connect...
RestoreVersionState
python
bokeh__bokeh
tests/unit/bokeh/application/test_application.py
{ "start": 1414, "end": 1477 }
class ____(Model): baar = Int(1)
AnotherModelInTestApplication
python
PyCQA__pylint
tests/functional/r/regression/regression_4680.py
{ "start": 149, "end": 223 }
class ____(metaclass=ab.ABCMeta): # [undefined-variable] pass
FailedTwo
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 64970, "end": 65569 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.qconfig = default_qconfig self.conv = torch.nn.Conv2d(3, 5, 3, bias=False).to(dtype=torch.float) self.bn = torch.nn.BatchNorm2d(5).to(dtype=torch.float) self.quant = QuantStub() self.dequ...
AnnotatedConvBnModel
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/comparison2.py
{ "start": 1825, "end": 2455 }
class ____: ... def func8(x: A): # This should generate an error if reportUnnecessaryComparison is enabled. if x is True: pass # This should generate an error if reportUnnecessaryComparison is enabled. if x is False: pass # This should generate an error if reportUnnecessaryCompar...
A
python
sqlalchemy__sqlalchemy
test/orm/test_dataclasses.py
{ "start": 11790, "end": 15714 }
class ____(FieldEmbeddedDeclarativeDataclassesTest): @classmethod def setup_classes(cls): declarative = cls.DeclarativeBasic.registry.mapped @dataclasses.dataclass class SurrogateWidgetPK: __sa_dataclass_metadata_key__ = "sa" widget_id: int = dataclasses.field( ...
FieldEmbeddedWMixinTest
python
gevent__gevent
src/greentest/3.14/test_smtplib.py
{ "start": 59965, "end": 62001 }
class ____(unittest.TestCase): def setUp(self): self.thread_key = threading_helper.threading_setup() self.real_getfqdn = socket.getfqdn socket.getfqdn = mock_socket.getfqdn self.serv_evt = threading.Event() self.client_evt = threading.Event() # Pick a random unused po...
SMTPAUTHInitialResponseSimTests
python
pypa__pipenv
pipenv/vendor/dotenv/variables.py
{ "start": 588, "end": 1104 }
class ____(Atom): def __init__(self, value: str) -> None: self.value = value def __repr__(self) -> str: return f"Literal(value={self.value})" def __eq__(self, other: object) -> bool: if not isinstance(other, self.__class__): return NotImplemented return self.val...
Literal
python
allegroai__clearml
clearml/backend_api/services/v2_23/tasks.py
{ "start": 533787, "end": 535516 }
class ____(Response): """ Response of tasks.update endpoint. :param updated: Number of tasks updated (0 or 1) :type updated: int :param fields: Updated fields names and values :type fields: dict """ _service = "tasks" _action = "update" _version = "2.23" _schema = { ...
UpdateResponse
python
EpistasisLab__tpot
tpot/builtin_modules/arithmetictransformer.py
{ "start": 6670, "end": 7309 }
class ____(TransformerMixin, BaseEstimator): def __init__(self): """ A transformer that multiplies all elements along axis 1. """ pass def fit(self, X, y=None): return self def transform(self, X): transformed_X = np.array(self.transform_helper(np.array(X)))...
MulTransformer
python
keras-team__keras
keras/src/metrics/regression_metrics.py
{ "start": 7225, "end": 9091 }
class ____(reduction_metrics.MeanMetricWrapper): """Computes the cosine similarity between the labels and predictions. Formula: ```python loss = sum(l2_norm(y_true) * l2_norm(y_pred)) ``` See: [Cosine Similarity](https://en.wikipedia.org/wiki/Cosine_similarity). This metric keeps the avera...
CosineSimilarity
python
falconry__falcon
examples/recipes/header_name_case_mw.py
{ "start": 0, "end": 861 }
class ____: def __init__(self, app, title_case=True, custom_capitalization=None): self._app = app self._title_case = title_case self._capitalization = custom_capitalization or {} def __call__(self, environ, start_response): def start_response_wrapper(status, response_headers, ex...
CustomHeadersMiddleware
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_values_geometry_to_overlap.py
{ "start": 513, "end": 1841 }
class ____(ColumnAggregateMetricProvider): # This is the id string that will be used to reference your metric. metric_name = "column_values.geometry_overlap" # This method implements the core logic for the PandasExecutionEngine @column_aggregate_value(engine=PandasExecutionEngine) def _pandas(cls, ...
ColumnValuesToCheckOverlap
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 271226, "end": 271763 }
class ____(sgqlc.types.Input): """Autogenerated input type of RegenerateVerifiableDomainToken""" __schema__ = github_schema __field_names__ = ("id", "client_mutation_id") id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="id") """The ID of the verifiable domain to regenerate the verific...
RegenerateVerifiableDomainTokenInput
python
modin-project__modin
modin/core/execution/dask/implementations/pandas_on_dask/partitioning/virtual_partition.py
{ "start": 8164, "end": 8322 }
class ____(PandasOnDaskDataframeVirtualPartition): axis = 0 @_inherit_docstrings(PandasOnDaskDataframeVirtualPartition)
PandasOnDaskDataframeColumnPartition
python
cherrypy__cherrypy
cherrypy/lib/locking.py
{ "start": 926, "end": 1037 }
class ____(Exception): """Exception when a lock could not be acquired before a timeout period."""
LockTimeout
python
simonw__datasette
datasette/views/base.py
{ "start": 2247, "end": 5579 }
class ____: ds = None has_json_alternate = True def __init__(self, datasette): self.ds = datasette async def head(self, *args, **kwargs): response = await self.get(*args, **kwargs) response.body = b"" return response async def method_not_allowed(self, request): ...
BaseView
python
pytorch__pytorch
test/torch_np/numpy_tests/lib/test_shape_base_.py
{ "start": 1801, "end": 3857 }
class ____(TestCase): def test_argequivalent(self): """Test it translates from arg<func> to <func>""" a = rand(3, 4, 5) funcs = [ (np.sort, np.argsort, {}), (_add_keepdims(np.min), _add_keepdims(np.argmin), {}), (_add_keepdims(np.max), _add_keepdims(np.ar...
TestTakeAlongAxis
python
numba__numba
numba/cuda/tests/cudapy/test_multigpu.py
{ "start": 138, "end": 4140 }
class ____(CUDATestCase): @unittest.skipIf(len(cuda.gpus) < 2, "need more than 1 gpus") def test_multigpu_context(self): @cuda.jit("void(float64[:], float64[:])") def copy_plus_1(inp, out): i = cuda.grid(1) if i < out.size: out[i] = inp[i] + 1 def...
TestMultiGPUContext
python
django__django
tests/i18n/tests.py
{ "start": 83409, "end": 86052 }
class ____(SimpleTestCase): rf = RequestFactory() def test_check_for_language(self): self.assertTrue(check_for_language("en")) self.assertTrue(check_for_language("en-us")) self.assertTrue(check_for_language("en-US")) self.assertFalse(check_for_language("en_US")) self.ass...
CountrySpecificLanguageTests
python
optuna__optuna
optuna/samplers/nsgaii/_sampler.py
{ "start": 1056, "end": 12909 }
class ____(BaseGASampler): """Multi-objective sampler using the NSGA-II algorithm. NSGA-II stands for "Nondominated Sorting Genetic Algorithm II", which is a well known, fast and elitist multi-objective genetic algorithm. For further information about NSGA-II, please refer to the following paper: ...
NSGAIISampler
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/auto_materialize_asset_evaluations.py
{ "start": 1201, "end": 1496 }
class ____(graphene.ObjectType): updatedAssetKeys = graphene.List(graphene.NonNull(GrapheneAssetKey)) willUpdateAssetKeys = graphene.List(graphene.NonNull(GrapheneAssetKey)) class Meta: name = "ParentMaterializedRuleEvaluationData"
GrapheneParentMaterializedRuleEvaluationData
python
airbytehq__airbyte
airbyte-ci/connectors/connectors_qa/src/connectors_qa/checks/documentation/documentation.py
{ "start": 4763, "end": 5595 }
class ____(DocumentationCheck): name = "Connectors must have user facing documentation" description = ( "The user facing connector documentation should be stored under `./docs/integrations/<connector-type>s/<connector-name>.md`." ) def _run(self, connector: Connector) -> CheckResult: if...
CheckDocumentationExists
python
RaRe-Technologies__gensim
gensim/test/test_corpora.py
{ "start": 15342, "end": 16093 }
class ____(CorpusTestCase): def setUp(self): self.corpus_class = svmlightcorpus.SvmLightCorpus self.file_extension = '.svmlight' def test_serialization(self): path = get_tmpfile("svml.corpus") labels = [1] * len(common_corpus) second_corpus = [(0, 1.0), (3, 1.0), (4, 1.0...
TestSvmLightCorpus
python
sqlalchemy__sqlalchemy
test/orm/test_joins.py
{ "start": 74618, "end": 78521 }
class ____(fixtures.MappedTest, AssertsCompiledSQL): run_setup_mappers = "once" __dialect__ = default.DefaultDialect() @classmethod def define_tables(cls, metadata): Table( "nodes", metadata, Column( "id", Integer, primary_key=True, test_needs...
SelfRefMixedTest
python
walkccc__LeetCode
solutions/508. Most Frequent Subtree Sum/508.py
{ "start": 0, "end": 443 }
class ____: def findFrequentTreeSum(self, root: TreeNode | None) -> list[int]: if not root: return [] count = collections.Counter() def dfs(root: TreeNode | None) -> int: if not root: return 0 summ = root.val + dfs(root.left) + dfs(root.right) count[summ] += 1 retu...
Solution
python
huggingface__transformers
tests/models/poolformer/test_image_processing_poolformer.py
{ "start": 3023, "end": 4846 }
class ____(ImageProcessingTestMixin, unittest.TestCase): image_processing_class = PoolFormerImageProcessor if is_vision_available() else None fast_image_processing_class = PoolFormerImageProcessorFast if is_torchvision_available() else None def setUp(self): super().setUp() self.image_proces...
PoolFormerImageProcessingTest
python
doocs__leetcode
solution/0600-0699/0688.Knight Probability in Chessboard/Solution.py
{ "start": 0, "end": 618 }
class ____: def knightProbability(self, n: int, k: int, row: int, column: int) -> float: f = [[[0] * n for _ in range(n)] for _ in range(k + 1)] for i in range(n): for j in range(n): f[0][i][j] = 1 for h in range(1, k + 1): for i in range(n): ...
Solution
python
pandas-dev__pandas
pandas/tests/arithmetic/test_period.py
{ "start": 6147, "end": 15032 }
class ____: # TODO: parameterize over boxes def test_pi_cmp_period(self): idx = period_range("2007-01", periods=20, freq="M") per = idx[10] result = idx < per exp = idx.values < idx.values[10] tm.assert_numpy_array_equal(result, exp) # Tests Period.__richcmp__ ...
TestPeriodIndexComparisons
python
kamyu104__LeetCode-Solutions
Python/digit-operations-to-make-two-integers-equal.py
{ "start": 86, "end": 1644 }
class ____(object): def minOperations(self, n, m): """ :type n: int :type m: int :rtype: int """ def linear_sieve_of_eratosthenes(n): # Time: O(n), Space: O(n) primes = [] spf = [-1]*(n+1) # the smallest prime factor for i in xran...
Solution
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_hex_color.py
{ "start": 1603, "end": 3915 }
class ____(ColumnMapExpectation): """Expect column values to be valid hexadecimal color codes.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "well_formed_hexcolor": [...
ExpectColumnValuesToBeValidHexColor
python
sqlalchemy__sqlalchemy
test/orm/declarative/test_typed_mapping.py
{ "start": 38819, "end": 62169 }
class ____(fixtures.TestBase, testing.AssertsCompiledSQL): __dialect__ = "default" def test_extract_from_pep593(self, decl_base): # anno only: global Address @dataclasses.dataclass class Address: street: str state: str zip_: str class User(d...
Pep593InterpretationTests
python
pytorch__pytorch
test/test_public_bindings.py
{ "start": 434, "end": 25902 }
class ____(TestCase): def test_no_new_reexport_callables(self): """ This test aims to stop the introduction of new re-exported callables into torch whose names do not start with _. Such callables are made available as torch.XXX, which may not be desirable. """ reexpor...
TestPublicBindings
python
Lightning-AI__lightning
src/lightning/fabric/loggers/tensorboard.py
{ "start": 1752, "end": 13049 }
class ____(Logger): r"""Log to local file system in `TensorBoard <https://www.tensorflow.org/tensorboard>`_ format. Implemented using :class:`~tensorboardX.SummaryWriter`. Logs are saved to ``os.path.join(root_dir, name, version)``. This is the recommended logger in Lightning Fabric. Args: roo...
TensorBoardLogger
python
pytest-dev__pytest-xdist
testing/util.py
{ "start": 18, "end": 131 }
class ____(UserWarning): pass def generate_warning() -> None: warnings.warn(MyWarning2("hello"))
MyWarning2
python
coleifer__peewee
peewee.py
{ "start": 187538, "end": 187636 }
class ____(Field): column_name = default = model = name = None primary_key = False
MetaField
python
tensorflow__tensorflow
tensorflow/python/data/util/structure_test.py
{ "start": 42415, "end": 42782 }
class ____(collections_abc.Mapping): """Custom, immutable map.""" def __init__(self, *args, **kwargs): self.__dict__.update(dict(*args, **kwargs)) def __getitem__(self, x): return self.__dict__[x] def __iter__(self): return iter(self.__dict__) def __len__(self): return len(self.__dict__) ...
CustomMap
python
tensorflow__tensorflow
tensorflow/python/eager/polymorphic_function/function_spec_test.py
{ "start": 21697, "end": 22226 }
class ____(test.TestCase): def test_same_structure(self): self.assertTrue( function_type_utils.is_same_structure([1, 2, 3], [1, 2, 3], True) ) self.assertTrue( function_type_utils.is_same_structure([1, 2, 3], [1, 2, 4], False) ) self.assertFalse( function_type_utils.is_sa...
SameStructureTest
python
python-pillow__Pillow
src/PIL/ImtImagePlugin.py
{ "start": 594, "end": 2665 }
class ____(ImageFile.ImageFile): format = "IMT" format_description = "IM Tools" def _open(self) -> None: # Quick rejection: if there's not a LF among the first # 100 bytes, this is (probably) not a text header. assert self.fp is not None buffer = self.fp.read(100) ...
ImtImageFile
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_parse_filter_expression.py
{ "start": 301, "end": 3210 }
class ____(unittest.TestCase): """ Test the Worksheet _parse_filter_expression() method. """ def setUp(self): self.fh = StringIO() self.worksheet = Worksheet() self.worksheet._set_filehandle(self.fh) def test_parse_filter_expression(self): """Test the _parse_filter...
TestParseFilterExpression
python
kamyu104__LeetCode-Solutions
Python/count-prime-gap-balanced-subarrays.py
{ "start": 588, "end": 1688 }
class ____(object): def primeSubarray(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ idxs, max_dq, min_dq = collections.deque(), collections.deque(), collections.deque() result = left = 0 for right in xrange(len(nums)): ...
Solution
python
PyCQA__pylint
tests/functional/u/unused/unused_argument.py
{ "start": 3238, "end": 3526 }
class ____: def __init__(self, argA, argB): self.argA = argA self.argB = argB def __new__(cls, argA, argB): return object.__new__(cls) # Test that `__new__` method is checked for unused arguments # when `__init__` is not in the Class
TestClassWithInitAndNew
python
pydantic__pydantic
pydantic-core/python/pydantic_core/core_schema.py
{ "start": 28747, "end": 30008 }
class ____(TypedDict, total=False): type: Required[Literal['complex']] strict: bool ref: str metadata: dict[str, Any] serialization: SerSchema def complex_schema( *, strict: bool | None = None, ref: str | None = None, metadata: dict[str, Any] | None = None, serialization: SerSc...
ComplexSchema
python
has2k1__plotnine
plotnine/stats/stat_density.py
{ "start": 492, "end": 10384 }
class ____(stat): """ Compute density estimate {usage} Parameters ---------- {common_parameters} kernel : str, default="gaussian" Kernel used for density estimation. One of: ```python "biweight" "cosine" "cosine2" "epanechnikov" "gaus...
stat_density
python
great-expectations__great_expectations
great_expectations/execution_engine/redshift_execution_engine.py
{ "start": 2708, "end": 7737 }
class ____(BaseColumnTypes): """MetricProvider Class for Aggregate Column Types metric for Redshift databases.""" @override @metric_value(engine=RedshiftExecutionEngine) def _sqlalchemy( cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: dict, metric...
ColumnTypes
python
charliermarsh__ruff
crates/ruff_python_formatter/resources/test/fixtures/ruff/docstring.py
{ "start": 2720, "end": 2995 }
class ____: """Browse module classes and functions in IDLE.""" # This class is also the base class for pathbrowser.PathBrowser. def f(): """Browse module classes and functions in IDLE.""" # ^ Do not insert a newline above here pass
CommentAfterDocstring5
python
huggingface__transformers
src/transformers/models/auto/modeling_auto.py
{ "start": 83975, "end": 84238 }
class ____(_BaseAutoModelClass): _model_mapping = MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING AutoModelForSequenceClassification = auto_class_update( AutoModelForSequenceClassification, head_doc="sequence classification" )
AutoModelForSequenceClassification
python
numba__numba
numba/core/typing/builtins.py
{ "start": 14518, "end": 14585 }
class ____(TupleCompare): pass @infer_global(operator.ne)
TupleEq
python
tensorflow__tensorflow
tensorflow/python/util/tf_stack.py
{ "start": 2527, "end": 3065 }
class ____(StackTraceTransform): """Allows remapping traceback information to different source code.""" _stack_dict = _source_mapper_stacks def __init__(self): self.internal_map = _tf_stack.PyBindSourceMap() def update(self): self.internal_map.update_to(tuple(self.get_effective_source_map().items())) ...
StackTraceMapper
python
Netflix__metaflow
metaflow/_vendor/importlib_metadata/__init__.py
{ "start": 998, "end": 1257 }
class ____(ModuleNotFoundError): """The package was not found.""" def __str__(self): return f"No package metadata was found for {self.name}" @property def name(self): (name,) = self.args return name
PackageNotFoundError
python
tensorflow__tensorflow
tensorflow/tools/common/traverse_test.py
{ "start": 926, "end": 1096 }
class ____(object): def __init__(self): self.call_log = [] def __call__(self, path, parent, children): self.call_log += [(path, parent, children)]
TestVisitor
python
huggingface__transformers
src/transformers/models/ernie4_5/modeling_ernie4_5.py
{ "start": 9361, "end": 12423 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: Ernie4_5Config, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", config.hidden_siz...
Ernie4_5Attention