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
pyqtgraph__pyqtgraph
pyqtgraph/examples/console_exception_inspection.py
{ "start": 2689, "end": 5554 }
class ____(pg.QtCore.QObject): signal = pg.QtCore.Signal(object, object) def __init__(self, queued): pg.QtCore.QObject.__init__(self) if queued: self.signal.connect(self.run, pg.QtCore.Qt.ConnectionType.QueuedConnection) else: self.signal.connect(self.run) def...
SignalEmitter
python
wireservice__csvkit
tests/test_utilities/test_csvcut.py
{ "start": 191, "end": 3050 }
class ____(CSVKitTestCase, ColumnsTests, EmptyFileTests, NamesTests): Utility = CSVCut def test_launch_new_instance(self): with patch.object(sys, 'argv', [self.Utility.__name__.lower(), 'examples/dummy.csv']): launch_new_instance() def test_skip_lines(self): self.assertRows(['-...
TestCSVCut
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_theme02.py
{ "start": 340, "end": 5550 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("theme02.xlsx") def test_create_file_from_theme_xml(self): """Test the addition of a theme file.""" workbook = Workbook( ...
TestCompareXLSXFiles
python
dagster-io__dagster
python_modules/dagster/dagster/_config/field_utils.py
{ "start": 1252, "end": 3236 }
class ____(ConfigType): def __init__(self, fields, **kwargs): self.fields = expand_fields_dict(fields) super().__init__(**kwargs) def type_iterator(self) -> Iterator["ConfigType"]: for field in self.fields.values(): yield from field.config_type.type_iterator() yield ...
_ConfigHasFields
python
walkccc__LeetCode
solutions/2096. Step-By-Step Directions From a Binary Tree Node to Another/2096-2.py
{ "start": 0, "end": 820 }
class ____: def getDirections( self, root: TreeNode | None, startValue: int, destValue: int, ) -> str: def dfs(root: TreeNode | None, val: int, path: list[str]) -> bool: """Builds the string in reverse order to avoid creating a new copy.""" if root.val == val: return ...
Solution
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/lu_op_test.py
{ "start": 1486, "end": 9449 }
class ____(test.TestCase): @property def float_types(self): return set((np.float64, np.float32, np.complex64, np.complex128)) def _verifyLuBase(self, x, lower, upper, perm, verification, output_idx_type): lower_np, upper_np, perm_np, verification_np = self.evaluate( [lower, u...
LuOpTest
python
google__pytype
pytype/tools/xref/testdata/class_def.py
{ "start": 592, "end": 757 }
class ____( #- @A ref ClassA A, #- @B ref ClassB B): pass #- @Baz defines/binding ClassBaz #- ClassBaz.node/kind record #- ClassBaz.subkind class
Bar
python
getsentry__sentry
tests/sentry/integrations/slack/threads/activity_notifications/test_external_issue_created_activity_notification.py
{ "start": 209, "end": 3311 }
class ____(BaseTestCase): def test_basic_case(self) -> None: provider = "Github" label = "ABC-123" location = "www.example.com" self.activity.data = {"provider": provider, "label": label, "location": location} notification = ExternalIssueCreatedActivityNotification(self.acti...
TestGetDescription
python
apache__airflow
task-sdk/src/airflow/sdk/exceptions.py
{ "start": 9651, "end": 9778 }
class ____(AirflowException): """Raise when a Task with duplicate task_id is defined in the same DAG."""
DuplicateTaskIdFound
python
docker__docker-py
tests/integration/base.py
{ "start": 2022, "end": 3971 }
class ____(BaseIntegrationTest): """ A test case for `APIClient` integration tests. It sets up an `APIClient` as `self.client`. """ def setUp(self): super().setUp() self.client = self.get_client_instance() def tearDown(self): super().tearDown() self.client.close...
BaseAPIIntegrationTest
python
squidfunk__mkdocs-material
material/plugins/info/plugin.py
{ "start": 1875, "end": 23793 }
class ____(BasePlugin[InfoConfig]): # Initialize plugin def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Initialize incremental builds self.is_serve = False # Initialize empty members self.exclusion_patterns = [] self.excluded_entries = ...
InfoPlugin
python
sphinx-doc__sphinx
sphinx/domains/c/_ast.py
{ "start": 8353, "end": 8998 }
class ____(ASTLiteral): def __init__(self, data: str) -> None: self.data = data def __eq__(self, other: object) -> bool: if not isinstance(other, ASTNumberLiteral): return NotImplemented return self.data == other.data def __hash__(self) -> int: return hash(self....
ASTNumberLiteral
python
getsentry__sentry
src/sentry/api/serializers/models/organization_member/response.py
{ "start": 487, "end": 564 }
class ____(TypedDict): primary: bool value: str type: str
SCIMEmail
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/concepts/io_management/filesystem_io_manager.py
{ "start": 807, "end": 1120 }
class ____(ConfigurableIOManagerFactory): base_path: Optional[str] = None def create_io_manager(self, context) -> PandasParquetIOManager: base_path = UPath(self.base_path or context.instance.storage_directory()) return PandasParquetIOManager(base_path=base_path)
LocalPandasParquetIOManager
python
psf__black
tests/data/miscellaneous/debug_visitor.py
{ "start": 11, "end": 1193 }
class ____(Visitor[T]): tree_depth: int = 0 def visit_default(self, node: LN) -> Iterator[T]: indent = ' ' * (2 * self.tree_depth) if isinstance(node, Node): _type = type_repr(node.type) out(f'{indent}{_type}', fg='yellow') self.tree_depth += 1 fo...
DebugVisitor
python
getsentry__sentry
src/sentry/migrations/1002_group_history_prev_history_remove_db_constraint.py
{ "start": 222, "end": 1740 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
pytorch__pytorch
test/test_fx_passes.py
{ "start": 14113, "end": 14246 }
class ____: match_output: bool match_placeholder: bool num_matches: int remove_overlapping_matches: bool = True
TestCase
python
tensorflow__tensorflow
tensorflow/python/distribute/sharded_variable.py
{ "start": 9487, "end": 30532 }
class ____(trackable.Trackable): """Mixin for ShardedVariable.""" # TODO(b/170877138): Remove this mixin once fixed. This mixin is required # since TPUEmbeddingVariable can't be a CompositeTensor. def __init__(self, variables, name='ShardedVariable'): """Treats `variables` as shards of a larger Variable. ...
ShardedVariableMixin
python
huggingface__transformers
examples/pytorch/image-pretraining/run_mae.py
{ "start": 1825, "end": 4236 }
class ____: """ Arguments pertaining to what data we are going to input our model for training and eval. Using `HfArgumentParser` we can turn this class into argparse arguments to be able to specify them on the command line. """ dataset_name: Optional[str] = field( default="cifar10"...
DataTrainingArguments
python
plotly__plotly.py
plotly/graph_objs/waterfall/_connector.py
{ "start": 233, "end": 3578 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "waterfall" _path_str = "waterfall.connector" _valid_props = {"line", "mode", "visible"} @property def line(self): """ The 'line' property is an instance of Line that may be specified as: - An instance of :cla...
Connector
python
huggingface__transformers
src/transformers/models/aria/modular_aria.py
{ "start": 55578, "end": 55646 }
class ____(LlavaModelOutputWithPast): pass
AriaModelOutputWithPast
python
python-pillow__Pillow
src/PIL/ImageFont.py
{ "start": 1347, "end": 1467 }
class ____(TypedDict): minimum: int | None default: int | None maximum: int | None name: bytes | None
Axis
python
django__django
tests/handlers/tests.py
{ "start": 3868, "end": 6074 }
class ____(TransactionTestCase): available_apps = [] def test_no_transaction(self): response = self.client.get("/in_transaction/") self.assertContains(response, "False") def test_auto_transaction(self): old_atomic_requests = connection.settings_dict["ATOMIC_REQUESTS"] try: ...
TransactionsPerRequestTests
python
numba__numba
numba/tests/pdlike_usecase.py
{ "start": 4068, "end": 8780 }
class ____(models.StructModel): def __init__(self, dmm, fe_type): members = [ ('index', fe_type.index), ('values', fe_type.as_array), ] models.StructModel.__init__(self, dmm, fe_type, members) make_attribute_wrapper(IndexType, 'data', '_data') make_attribute_wrap...
SeriesModel
python
scipy__scipy
scipy/fftpack/tests/test_basic.py
{ "start": 2324, "end": 3626 }
class ____: def setup_method(self): self.cdt = None self.rdt = None np.random.seed(1234) def test_definition(self): x = np.array([1,2,3,4+1j,1,2,3,4+2j], dtype=self.cdt) y = fft(x) assert_equal(y.dtype, self.cdt) y1 = direct_dft(x) assert_array_al...
_TestFFTBase
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_member_invite_details.py
{ "start": 1332, "end": 2583 }
class ____(OrganizationMemberInviteTestBase): def test_simple(self) -> None: invited_member = self.create_member_invite( organization=self.organization, email="matcha@latte.com" ) response = self.get_success_response(self.organization.slug, invited_member.id) assert respo...
GetOrganizationMemberInviteTest
python
pytorch__pytorch
tools/test/test_upload_gate.py
{ "start": 89, "end": 979 }
class ____(unittest.TestCase): def test_main_branch_on_pytorch_repo(self) -> None: self.assertTrue(should_upload_full_test_run("main", "pytorch/pytorch")) def test_trunk_tag_valid_sha_on_pytorch_repo(self) -> None: sha = "a" * 40 self.assertTrue(should_upload_full_test_run(f"trunk/{sha}...
TestUploadGate
python
PyCQA__pylint
tests/functional/i/invalid/invalid_getnewargs/invalid_getnewargs_ex_returned.py
{ "start": 1843, "end": 2049 }
class ____: """ __getnewargs_ex__ returns tuple with wrong type for second arg """ def __getnewargs_ex__(self): # [invalid-getnewargs-ex-returned] return ((1, ), (1, ))
FourthBadGetNewArgsEx
python
tensorflow__tensorflow
tensorflow/python/compiler/xla/xla.py
{ "start": 4962, "end": 20716 }
class ____(control_flow_ops.XLAControlFlowContext): """A `ControlFlowContext` for nodes inside an XLA computation cluster. THIS IS ONLY FOR TENSORFLOW INTERNAL IMPLEMENTATION, DO NO USE DIRECTLY. The primary role of `XLACompileContext` is to mark operators inside a xla.compile() computation with attribute "_x...
XLACompileContext
python
pyca__cryptography
tests/hazmat/primitives/test_aead.py
{ "start": 44123, "end": 53871 }
class ____: @pytest.mark.skipif( sys.platform not in {"linux", "darwin"} or sys.maxsize < 2**31, reason="mmap and 64-bit platform required", ) def test_data_too_large(self): key = AESGCMSIV.generate_key(256) nonce = os.urandom(12) aesgcmsiv = AESGCMSIV(key) l...
TestAESGCMSIV
python
pytorch__pytorch
torch/_library/utils.py
{ "start": 535, "end": 14637 }
class ____: """Does something when someone calls .destroy() on it""" def __init__(self, on_destroy: Callable): self._on_destroy = on_destroy def destroy(self) -> None: self._on_destroy() def get_source(stacklevel: int) -> str: """Get a string that represents the caller. Example:...
RegistrationHandle
python
huggingface__transformers
tests/models/apertus/test_modeling_apertus.py
{ "start": 1463, "end": 1941 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = ApertusModelTester # Need to use `0.8` instead of `0.9` for `test_cpu_offload` # This is because we are hitting edge cases with the causal_mask buffer model_split_percents = [0.5, 0.7, 0.8] # used in `test_torch_compile_for_tra...
ApertusModelTest
python
scrapy__scrapy
tests/test_feedexport.py
{ "start": 21726, "end": 21986 }
class ____(FileFeedStorage, FromCrawlerMixin): @classmethod def from_crawler(cls, crawler, *args, feed_options=None, **kwargs): cls.init_with_crawler = True return cls(*args, feed_options=feed_options, **kwargs)
FromCrawlerFileFeedStorage
python
google__pytype
pytype/vm_test.py
{ "start": 1156, "end": 1428 }
class ____(test_base.BaseTest, test_utils.MakeCodeMixin): """Base for VM tests.""" def setUp(self): super().setUp() self.ctx = self.make_context() def make_context(self): return context.Context(options=self.options, loader=self.loader, src="")
VmTestBase
python
getsentry__sentry
tests/sentry/issues/endpoints/test_organization_group_search_views.py
{ "start": 10267, "end": 17833 }
class ____(APITestCase): endpoint = "sentry-api-0-organization-group-search-views" method = "post" def setUp(self) -> None: self.login_as(user=self.user) self.project1 = self.create_project(organization=self.organization, slug="project-a") self.project2 = self.create_project(organiz...
OrganizationGroupSearchViewsPostTest
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/config.py
{ "start": 183, "end": 278 }
class ____(TypedDict): mysql_url: str mysql_db: "MySqlStorageConfigDb"
MySqlStorageConfig
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/pyproject_hooks/_impl.py
{ "start": 2906, "end": 11920 }
class ____: """A wrapper to call the build backend hooks for a source directory. """ def __init__( self, source_dir, build_backend, backend_path=None, runner=None, python_executable=None, ): """ :param source_dir: T...
BuildBackendHookCaller
python
qdrant__qdrant-client
qdrant_client/http/api/points_api.py
{ "start": 1311, "end": 16182 }
class ____: def __init__(self, api_client: "Union[ApiClient, AsyncApiClient]"): self.api_client = api_client def _build_for_batch_update( self, collection_name: str, wait: bool = None, ordering: WriteOrdering = None, update_operations: m.UpdateOperations = None, ...
_PointsApi
python
huggingface__transformers
src/transformers/pipelines/deprecated/text2text_generation.py
{ "start": 10295, "end": 14273 }
class ____(Text2TextGenerationPipeline): """ Summarize news articles and other documents. This summarizing pipeline can currently be loaded from [`pipeline`] using the following task identifier: `"summarization"`. The models that this pipeline can use are models that have been fine-tuned on a summ...
SummarizationPipeline
python
PrefectHQ__prefect
src/integrations/prefect-dbt/tests/core/test_runner.py
{ "start": 14047, "end": 15649 }
class ____: """Test CLI argument handling functionality.""" def test_extract_flag_value_finds_flag(self): """Test that flag value extraction works correctly.""" runner = PrefectDbtRunner() args = ["--target-path", "/custom/path", "run"] result_args, result_value = runner._extra...
TestPrefectDbtRunnerCLIArgumentHandling
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/schema.py
{ "start": 229594, "end": 233279 }
class ____(FetchedValue, SchemaItem): """Defines a generated column, i.e. "GENERATED ALWAYS AS" syntax. The :class:`.Computed` construct is an inline construct added to the argument list of a :class:`_schema.Column` object:: from sqlalchemy import Computed Table( "square", ...
Computed
python
walkccc__LeetCode
solutions/2067. Number of Equal Count Substrings/2067.py
{ "start": 0, "end": 601 }
class ____: def equalCountSubstrings(self, s: str, count: int) -> int: maxUnique = len(set(s)) ans = 0 for unique in range(1, maxUnique + 1): windowSize = unique * count lettersCount = collections.Counter() uniqueCount = 0 for i, c in enumerate(s): lettersCount[c] += 1 ...
Solution
python
google__jax
jax/_src/debugger/core.py
{ "start": 2020, "end": 4719 }
class ____: """Encapsulates Python frame information.""" filename: str locals: dict[str, Any] globals: dict[str, Any] code_context: str source: list[str] lineno: int offset: int | None def tree_flatten(self): flat_locals, locals_tree = _safe_flatten_dict(self.locals) flat_globals, globals_tre...
DebuggerFrame
python
huggingface__transformers
tests/models/minimax/test_modeling_minimax.py
{ "start": 1142, "end": 1449 }
class ____(CausalLMModelTester): if is_torch_available(): base_model_class = MiniMaxModel def __init__(self, parent, layer_types=None, block_size=3): super().__init__(parent) self.layer_types = layer_types self.block_size = block_size @require_torch
MiniMaxModelTester
python
PyCQA__pyflakes
pyflakes/test/test_doctests.py
{ "start": 12469, "end": 12600 }
class ____(_DoctestMixin, TestUndefinedNames): """Run TestUndefinedNames with each test wrapped in a doctest."""
TestUndefinedNames
python
airbytehq__airbyte
airbyte-integrations/connectors/source-faker/source_faker/streams.py
{ "start": 415, "end": 2059 }
class ____(Stream, IncrementalMixin): primary_key = "id" cursor_field = "updated_at" def __init__(self, count: int, seed: int, parallelism: int, records_per_slice: int, always_updated: bool, **kwargs): super().__init__(**kwargs) self.count = count self.seed = seed self.recor...
Products
python
huggingface__transformers
tests/models/roc_bert/test_tokenization_roc_bert.py
{ "start": 1043, "end": 11589 }
class ____(TokenizerTesterMixin, unittest.TestCase): from_pretrained_id = "weiweishi/roc-bert-base-zh" tokenizer_class = RoCBertTokenizer rust_tokenizer_class = None test_rust_tokenizer = False space_between_special_tokens = True from_pretrained_filter = filter_non_english @classmethod ...
BertTokenizationTest
python
kamyu104__LeetCode-Solutions
Python/generate-a-string-with-characters-that-have-odd-counts.py
{ "start": 29, "end": 257 }
class ____(object): def generateTheString(self, n): """ :type n: int :rtype: str """ result = ['a']*(n-1) result.append('a' if n%2 else 'b') return "".join(result)
Solution
python
doocs__leetcode
lcof2/剑指 Offer II 060. 出现频率最高的 k 个数字/Solution2.py
{ "start": 0, "end": 292 }
class ____: def topKFrequent(self, nums: List[int], k: int) -> List[int]: cnt = Counter(nums) hp = [] for num, freq in cnt.items(): heappush(hp, (freq, num)) if len(hp) > k: heappop(hp) return [v[1] for v in hp]
Solution
python
huggingface__transformers
src/transformers/models/xlm/modeling_xlm.py
{ "start": 40450, "end": 41980 }
class ____(nn.Module): """ Prediction layer (cross_entropy or adaptive_softmax). """ def __init__(self, config): super().__init__() self.asm = config.asm self.n_words = config.n_words self.pad_index = config.pad_index dim = config.emb_dim if config.asm i...
XLMPredLayer
python
lepture__authlib
tests/django/test_oauth2/models.py
{ "start": 4044, "end": 4930 }
class ____: def query_authorization_code(self, code, client): try: item = OAuth2Code.objects.get(code=code, client_id=client.client_id) except OAuth2Code.DoesNotExist: return None if not item.is_expired(): return item def delete_authorization_code(se...
CodeGrantMixin
python
networkx__networkx
networkx/algorithms/tree/tests/test_mst.py
{ "start": 9876, "end": 10825 }
class ____(MinimumSpanningTreeTestBase): # Abstract class def test_multigraph_keys_min(self): """Tests that the minimum spanning edges of a multigraph preserves edge keys. """ G = nx.MultiGraph() G.add_edge(0, 1, key="a", weight=2) G.add_edge(0, 1, key="b", weigh...
MultigraphMSTTestBase
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0086_fix_cron_to_cron_workflow_links.py
{ "start": 7622, "end": 9026 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_bic_belong_to_country.py
{ "start": 746, "end": 1732 }
class ____(ColumnMapMetricProvider): condition_metric_name = "column_values.bic_belong_to_country" condition_value_keys = ("country_code",) @column_condition_partial(engine=PandasExecutionEngine) def _pandas(cls, column, country_code, **kwargs): return column.apply(partial(bic_belong_to_country...
ColumnValuesBicBelongToCountry
python
davidhalter__jedi
jedi/inference/compiled/value.py
{ "start": 10565, "end": 12294 }
class ____(AbstractNameDefinition): def __init__(self, inference_state, parent_value, name, is_descriptor): self._inference_state = inference_state self.parent_context = parent_value.as_context() self._parent_value = parent_value self.string_name = name self.is_descriptor = i...
CompiledName
python
plotly__plotly.py
plotly/graph_objs/scattermap/_unselected.py
{ "start": 233, "end": 2467 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattermap" _path_str = "scattermap.unselected" _valid_props = {"marker"} @property def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instance of :class:`plot...
Unselected
python
sympy__sympy
sympy/diffgeom/diffgeom.py
{ "start": 26918, "end": 29826 }
class ____(Expr): """Base scalar field over a manifold for a given coordinate system. Explanation =========== A scalar field takes a point as an argument and returns a scalar. A base scalar field of a coordinate system takes a point and returns one of the coordinates of that point in the coord...
BaseScalarField
python
scikit-learn__scikit-learn
sklearn/utils/_set_output.py
{ "start": 822, "end": 3017 }
class ____(Protocol): container_lib: str def create_container(self, X_output, X_original, columns, inplace=False): """Create container from `X_output` with additional metadata. Parameters ---------- X_output : {ndarray, dataframe} Data to wrap. X_original :...
ContainerAdapterProtocol
python
kamyu104__LeetCode-Solutions
Python/find-target-indices-after-sorting-array.py
{ "start": 29, "end": 311 }
class ____(object): def targetIndices(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ less = sum(x < target for x in nums) return range(less, less+sum(x == target for x in nums))
Solution
python
walkccc__LeetCode
solutions/70. Climbing Stairs/70-2.py
{ "start": 0, "end": 221 }
class ____: def climbStairs(self, n: int) -> int: prev1 = 1 # dp[i - 1] prev2 = 1 # dp[i - 2] for _ in range(2, n + 1): dp = prev1 + prev2 prev2 = prev1 prev1 = dp return prev1
Solution
python
astropy__astropy
astropy/modeling/tests/test_fitters.py
{ "start": 24416, "end": 26635 }
class ____: """Tests population of fitting with entry point fitters""" def successfulimport(self): # This should work class goodclass(Fitter): __name__ = "GoodClass" return goodclass def raiseimporterror(self): # This should fail as it raises an Import Error ...
TestEntryPoint
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_connecticut_zip.py
{ "start": 762, "end": 1775 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_connecticut_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _p...
ColumnValuesToBeValidConnecticutZip
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol1.py
{ "start": 960, "end": 1358 }
class ____: attr: int var: Proto[float] another_var: Proto[int] = Proto_Impl() # This should generate an error because T is invariant. var = another_var another_var2: NotProto2 = NotProto2() # This should generate an error because T is invariant. var = another_var2 # This should generate an error because "Pr...
NotProto2
python
joke2k__faker
faker/providers/person/sk_SK/__init__.py
{ "start": 81, "end": 44090 }
class ____(PersonProvider): formats_female = OrderedDict( ( ("{{first_name_female}} {{last_name_female}}", 0.97), ("{{prefix_female}} {{first_name_female}} {{last_name_female}}", 0.015), ("{{first_name_female}} {{last_name_female}} {{suffix}}", 0.02), ( ...
Provider
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
{ "start": 4268, "end": 4447 }
class ____(BIT): def result_processor(self, dialect: Any, coltype: Any) -> None: """MySQL-connector already converts mysql bits, so.""" return None
_myconnpyBIT
python
sympy__sympy
sympy/matrices/common.py
{ "start": 88069, "end": 91949 }
class ____: """Class providing the minimum functionality for a matrix-like object and implementing every method required for a `MatrixRequired`. This class does not have everything needed to become a full-fledged SymPy object, but it will satisfy the requirements of anything inheriting from `Matrix...
_MinimalMatrix
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/integrations/sigma/customize_upstream_dependencies.py
{ "start": 438, "end": 1231 }
class ____(DagsterSigmaTranslator): def get_asset_spec( self, data: Union[SigmaDatasetTranslatorData, SigmaWorkbookTranslatorData] ) -> dg.AssetSpec: # We create the default asset spec using super() default_spec = super().get_asset_spec(data) # We customize upstream dependencies ...
MyCustomSigmaTranslator
python
python__mypy
mypy/server/astdiff.py
{ "start": 14010, "end": 21362 }
class ____(TypeVisitor[SnapshotItem]): """Creates a read-only, self-contained snapshot of a type object. Properties of a snapshot: - Contains (nested) tuples and other immutable primitive objects only. - References to AST nodes are replaced with full names of targets. - Has no references to mutabl...
SnapshotTypeVisitor
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 35283, "end": 35452 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ("PRIVATE", "PUBLIC")
RepositoryPrivacy
python
astropy__astropy
astropy/coordinates/tests/test_transformations.py
{ "start": 2080, "end": 7489 }
class ____(ICRS): pass def test_transform_classes(): """ Tests the class-based/OO syntax for creating transforms """ def tfun(c, f): return f.__class__(ra=c.ra, dec=c.dec) _ = FunctionTransform(tfun, TCoo1, TCoo2, register_graph=frame_transform_graph) c1 = TCoo1(ra=1 * u.radian,...
TCoo3
python
pypa__virtualenv
src/virtualenv/run/session.py
{ "start": 103, "end": 2248 }
class ____: """Represents a virtual environment creation session.""" def __init__(self, verbosity, app_data, interpreter, creator, seeder, activators) -> None: # noqa: PLR0913 self._verbosity = verbosity self._app_data = app_data self._interpreter = interpreter self._creator = ...
Session
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_compute.py
{ "start": 43399, "end": 58908 }
class ____: @mock.patch(COMPUTE_ENGINE_HOOK_PATH) def test_copy_template_should_execute_successfully(self, mock_hook): get_template_obj_mock = mock.MagicMock() get_template_obj_mock.__class__ = InstanceTemplate mock_hook.return_value.get_instance_template.side_effect = [ NotF...
TestGceInstanceTemplateCopy
python
huggingface__transformers
src/transformers/models/glpn/modeling_glpn.py
{ "start": 15698, "end": 15912 }
class ____(PreTrainedModel): config: GLPNConfig base_model_prefix = "glpn" main_input_name = "pixel_values" input_modalities = ("image",) _no_split_modules = [] @auto_docstring
GLPNPreTrainedModel
python
kamyu104__LeetCode-Solutions
Python/count-k-reducible-numbers-less-than-n.py
{ "start": 48, "end": 828 }
class ____(object): def countKReducibleNumbers(self, s, k): """ :type s: str :type k: int :rtype: int """ MOD = 10**9+7 def popcount(x): return bin(x).count('1') while len(s)-1 >= len(cnt): # cached cnt.append(cnt[popcount(len...
Solution
python
getsentry__sentry
src/sentry/discover/models.py
{ "start": 2282, "end": 5047 }
class ____(Model): """ A saved Discover query """ __relocation_scope__ = RelocationScope.Excluded projects = models.ManyToManyField("sentry.Project", through=DiscoverSavedQueryProject) organization = FlexibleForeignKey("sentry.Organization") created_by_id = HybridCloudForeignKey("sentry.Us...
DiscoverSavedQuery
python
streamlit__streamlit
lib/streamlit/errors.py
{ "start": 20286, "end": 20842 }
class ____(LocalizableStreamlitException): """Exception raised when an invalid width value is provided.""" def __init__(self, width: Any, allow_content: bool = False) -> None: valid_values = "an integer (pixels) or 'stretch'" if allow_content: valid_values = "an integer (pixels), 's...
StreamlitInvalidWidthError
python
pytorch__pytorch
tools/linter/adapters/_linter/sets.py
{ "start": 285, "end": 2308 }
class ____: """A logical line of Python tokens, terminated by a NEWLINE or the end of file""" tokens: list[TokenInfo] @cached_property def sets(self) -> list[TokenInfo]: """A list of tokens which use the built-in set symbol""" return [t for i, t in enumerate(self.tokens) if self.is_set...
LineWithSets
python
google__pytype
pytype/overlays/flax_overlay.py
{ "start": 1003, "end": 1666 }
class ____(dataclass_overlay.Dataclass): """Implements the @dataclass decorator.""" def decorate(self, node, cls): super().decorate(node, cls) if not isinstance(cls, abstract.InterpreterClass): return cls.members["replace"] = classgen.make_replace_method(self.ctx, node, cls) # NOTE: flax.linen....
Dataclass
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 319073, "end": 333059 }
class ____(ExternKernel): """The IR node for while_loop and while_loop_stack_output. It supports input mutation.""" carried_inputs: Optional[Sequence[IRNode]] = None additional_inputs: Optional[Sequence[IRNode]] = None cond_subgraph: Optional[Subgraph] = None body_subgraph: Optional[Subgraph] = Non...
WhileLoop
python
dagster-io__dagster
python_modules/libraries/dagster-databricks/dagster_databricks/components/databricks_asset_bundle/configs.py
{ "start": 21272, "end": 21364 }
class ____(Resolvable, Model): is_serverless: bool = True
ResolvedDatabricksServerlessConfig
python
PrefectHQ__prefect
src/integrations/prefect-snowflake/prefect_snowflake/experimental/workers/spcs.py
{ "start": 16501, "end": 30823 }
class ____(BaseWorker): """A Prefect worker that runs flows as service jobs in Snowpark Container Services.""" type: str = "snowpark-container-service" job_configuration = SPCSWorkerConfiguration job_configuration_variables = SPCSServiceTemplateVariables _description = "Execute flow runs within con...
SPCSWorker
python
pytorch__pytorch
test/distributed/elastic/agent/server/test/api_test.py
{ "start": 4320, "end": 5666 }
class ____(SimpleElasticAgent): def __init__(self, spec): super().__init__(spec) self.stop_workers_call_count = 0 self.start_workers_call_count = 0 def _stop_workers(self, worker_group: WorkerGroup) -> None: # workers are fake, nothing to stop; just clear the rdzv info w...
TestAgent
python
ansible__ansible
lib/ansible/_internal/_templating/_jinja_plugins.py
{ "start": 1326, "end": 6246 }
class ____(c.MutableMapping): """ Simulated dict class that loads Jinja2Plugins at request otherwise all plugins would need to be loaded a priori. NOTE: plugin_loader still loads all 'builtin/legacy' at start so only collection plugins are really at request. """ def __init__(self, jinja_bu...
JinjaPluginIntercept
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/decorators/setup_teardown.py
{ "start": 3197, "end": 4339 }
class ____(list): """A list subclass that has a context manager that pushes setup/teardown tasks to the context.""" def __init__(self, tasks: list[BaseOperator | XComArg]): self.tasks = tasks super().__init__(tasks) def __enter__(self): operators = [] for task in self.tasks...
ContextWrapper
python
PrefectHQ__prefect
src/prefect/futures.py
{ "start": 12360, "end": 16628 }
class ____(PrefectFuture[R]): """ A Prefect future that represents the eventual execution of a flow run. """ def __init__(self, flow_run_id: uuid.UUID): self._flow_run_id = flow_run_id self._final_state: State[R] | None = None @property def flow_run_id(self) -> uuid.UUID: ...
PrefectFlowRunFuture
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/loop7.py
{ "start": 122, "end": 297 }
class ____: name: Optional[str] def method1(self): if self.name is not None: for _ in []: self.name = self.name.replace("", "")
ClassA
python
getsentry__sentry
tests/sentry/integrations/msteams/test_client.py
{ "start": 816, "end": 7378 }
class ____(TestCase): @pytest.fixture(autouse=True) def _setup_metric_patch(self) -> Generator[None]: with mock.patch("sentry.shared_integrations.client.base.metrics") as self.metrics: yield def setUp(self) -> None: self.expires_at = 1594768808 self.organization = self.c...
MsTeamsClientTest
python
pytransitions__transitions
transitions/extensions/states.py
{ "start": 4750, "end": 6387 }
class ____(State): """Adds scopes/temporal variables to the otherwise persistent state objects. Attributes: volatile_cls (cls): Class of the temporal object to be initiated. volatile_hook (str): Model attribute name which will contain the volatile instance. """ def __init__(self, *args,...
Volatile
python
kamyu104__LeetCode-Solutions
Python/count-the-number-of-inversions.py
{ "start": 3696, "end": 4556 }
class ____(object): def numberOfPermutations(self, n, requirements): """ :type n: int :type requirements: List[List[int]] :rtype: int """ MOD = 10**9+7 lookup = [-1]*n for i, c in requirements: lookup[i] = c dp = [[] for _ in xrange...
Solution_ConstructPermutation
python
django__django
tests/flatpages_tests/test_forms.py
{ "start": 399, "end": 5325 }
class ____(TestCase): @classmethod def setUpTestData(cls): # don't use the manager because we want to ensure the site exists # with pk=1, regardless of whether or not it already exists. cls.site1 = Site(pk=1, domain="example.com", name="example.com") cls.site1.save() def set...
FlatpageAdminFormTests
python
PyCQA__pylint
tests/functional/ext/docparams/parameter/missing_param_doc_required_Numpy.py
{ "start": 3144, "end": 3537 }
class ____: """test_constr_params_and_attributes_in_class_numpy Example of a class with correct constructor parameter documentation and an attributes section (Numpy style) Parameters ---------- foobar : str Something. Attributes ---------- barfoor : str Something. ...
ClassFoo
python
pyqtgraph__pyqtgraph
pyqtgraph/multiprocess/parallelizer.py
{ "start": 270, "end": 9714 }
class ____(object): """ Class for ultra-simple inline parallelization on multi-core CPUs Example:: ## Here is the serial (single-process) task: tasks = [1, 2, 4, 8] results = [] for task in tasks: result = processTask(task) results.a...
Parallelize
python
doocs__leetcode
solution/0700-0799/0720.Longest Word in Dictionary/Solution.py
{ "start": 0, "end": 689 }
class ____: def __init__(self): self.children: List[Optional[Trie]] = [None] * 26 self.is_end = False def insert(self, w: str): node = self for c in w: idx = ord(c) - ord("a") if node.children[idx] is None: node.children[idx] = Trie() ...
Trie
python
sqlalchemy__sqlalchemy
test/dialect/mysql/test_compiler.py
{ "start": 47046, "end": 53815 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = mysql.dialect() def setup_test(self): self.table = Table( "foos", MetaData(), Column("id", Integer, primary_key=True), Column("bar", String(10)), Column("baz", String(10)), ...
InsertOnDuplicateTest
python
huggingface__transformers
src/transformers/models/cohere2/modular_cohere2.py
{ "start": 14468, "end": 15775 }
class ____(CohereDecoderLayer): def __init__(self, config: Cohere2Config, layer_idx: int): super().__init__(config, layer_idx) self.attention_type = config.layer_types[layer_idx] def forward( self, hidden_states: torch.Tensor, position_embeddings: Optional[tuple[torch.Te...
Cohere2DecoderLayer
python
google__python-fire
fire/test_components.py
{ "start": 1496, "end": 1630 }
class ____: def __init__(self, value='value'): self.value = value raise ValueError('Error in constructor')
ErrorInConstructor
python
numpy__numpy
numpy/lib/tests/test_io.py
{ "start": 46624, "end": 49012 }
class ____: def test_record(self): c = TextIO() c.write('1.312 foo\n1.534 bar\n4.444 qux') c.seek(0) dt = [('num', np.float64), ('val', 'S3')] x = np.fromregex(c, r"([0-9.]+)\s+(...)", dt) a = np.array([(1.312, 'foo'), (1.534, 'bar'), (4.444, 'qux')], ...
Testfromregex
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/solver14.py
{ "start": 285, "end": 405 }
class ____(Protocol, Generic[_X_contra, _X_co]): def __divmod__(self, __other: _X_contra) -> _X_co: ...
SupportsDivMod
python
pyparsing__pyparsing
examples/mongodb_query_expression.py
{ "start": 667, "end": 20118 }
class ____(pp.ParseFatalException): pass def key_phrase(expr: Union[str, pp.ParserElement]) -> pp.ParserElement: if isinstance(expr, str): expr = pp.And(pp.CaselessKeyword.using_each(expr.split())) return pp.Combine(expr, adjacent=False, join_string=" ") def unique(seq): yield from dict.from...
InvalidExpressionException
python
pytorch__pytorch
torch/nn/modules/loss.py
{ "start": 81864, "end": 87856 }
class ____(_Loss): r"""Creates a criterion that measures the triplet loss given input tensors :math:`a`, :math:`p`, and :math:`n` (representing anchor, positive, and negative examples, respectively), and a nonnegative, real-valued function ("distance function") used to compute the relationship betwe...
TripletMarginWithDistanceLoss