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
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1242997, "end": 1243651 }
class ____(sgqlc.types.Type, Node): """Represents a 'moved_columns_in_project' event on a given issue or pull request. """ __schema__ = github_schema __field_names__ = ("actor", "created_at", "database_id") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the actor who p...
MovedColumnsInProjectEvent
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/multi_sink_ports.py
{ "start": 582, "end": 1102 }
class ____(QueryBase): _params = None def send(self): return splitwrapper(self) def params(self, data): self._params = data return self def log_call(params, response): sinkA(params) sinkA(response) def wrapper2(x: Query): params = x._params response = None t...
Query
python
pytorch__pytorch
test/quantization/pt2e/test_numeric_debugger.py
{ "start": 1065, "end": 14877 }
class ____(TestCase): def _assert_each_node_has_debug_handle(self, model) -> None: def _assert_node_has_debug_handle(node): self.assertTrue( CUSTOM_KEY in node.meta and NUMERIC_DEBUG_HANDLE_KEY in node.meta[CUSTOM_KEY], f"Node {node} doesn't have d...
TestNumericDebugger
python
Netflix__metaflow
metaflow/client/filecache.py
{ "start": 15475, "end": 15978 }
class ____(BlobCache): def __init__(self, filecache, cache_id): self._filecache = filecache self._cache_id = cache_id def _path(self, key): key_dir = key[:2] return os.path.join( self._filecache.cache_dir, self._cache_id, key_dir, "%s.blob" % key ) def l...
FileBlobCache
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py
{ "start": 12932, "end": 13024 }
class ____(AdsInsights): action_breakdowns = ["action_reaction"]
AdsInsightsActionReaction
python
tensorflow__tensorflow
tensorflow/python/framework/extension_type.py
{ "start": 40574, "end": 43615 }
class ____(ExtensionType): """Fallback used to decode `tf.ExtensionType` when the original type is unavailable. When a SavedModel is serialized, the signatures of any functions in the SavedModel can include `tf.ExtensionType` subclasses. These subclasses are usually registered, so they can be restored when ...
AnonymousExtensionType
python
docker__docker-py
docker/transport/unixconn.py
{ "start": 222, "end": 716 }
class ____(urllib3.connection.HTTPConnection): def __init__(self, base_url, unix_socket, timeout=60): super().__init__( 'localhost', timeout=timeout ) self.base_url = base_url self.unix_socket = unix_socket self.timeout = timeout def connect(self): s...
UnixHTTPConnection
python
tiangolo__fastapi
docs_src/dataclasses/tutorial001.py
{ "start": 101, "end": 312 }
class ____: name: str price: float description: Union[str, None] = None tax: Union[float, None] = None app = FastAPI() @app.post("/items/") async def create_item(item: Item): return item
Item
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_annotations/mypy_init_return.py
{ "start": 633, "end": 686 }
class ____: def __init__(self, *arg): ...
Foo
python
facebook__pyre-check
client/json_rpc.py
{ "start": 6678, "end": 7929 }
class ____(JSONRPC): id: Union[int, str, None] @staticmethod def from_json(response_json: JSON) -> "Response": """ Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed. """ if "result" in response_json: r...
Response
python
doocs__leetcode
solution/2700-2799/2772.Apply Operations to Make All Array Elements Equal to Zero/Solution.py
{ "start": 0, "end": 392 }
class ____: def checkArray(self, nums: List[int], k: int) -> bool: n = len(nums) d = [0] * (n + 1) s = 0 for i, x in enumerate(nums): s += d[i] x += s if x == 0: continue if x < 0 or i + k > n: return Fal...
Solution
python
apache__airflow
airflow-core/tests/unit/core/test_stats.py
{ "start": 1479, "end": 1690 }
class ____: """ This custom Statsd class is invalid because it does not subclass statsd.StatsClient. """ def __init__(self, host=None, port=None, prefix=None): pass
InvalidCustomStatsd
python
django__django
django/utils/functional.py
{ "start": 7671, "end": 12281 }
class ____: """ A wrapper for another class that can be used to delay instantiation of the wrapped class. By subclassing, you have the opportunity to intercept and alter the instantiation. If you don't need to do that, use SimpleLazyObject. """ # Avoid infinite recursion when tracing __ini...
LazyObject
python
kennethreitz__tablib
src/tablib/packages/dbfpy/fields.py
{ "start": 9182, "end": 9621 }
class ____(DbfFieldDef): """Definition of the currency field.""" typeCode = "Y" length = 8 defaultValue = 0.0 def decodeValue(self, value): """Return float number decoded from ``value``.""" return struct.unpack("<q", value)[0] / 10000. def encodeValue(self, value): """...
DbfCurrencyFieldDef
python
etianen__django-reversion
tests/test_app/tests/test_admin.py
{ "start": 2322, "end": 4606 }
class ____(LoginMixin, AdminMixin, TestBase): def setUp(self): super().setUp() with reversion.create_revision(): self.obj = TestModelParent.objects.create() with reversion.create_revision(): self.obj.name = "v2" self.obj.parent_name = "parent v2" ...
AdminRevisionViewTest
python
bokeh__bokeh
src/bokeh/protocol/messages/pull_doc_reply.py
{ "start": 1635, "end": 3167 }
class ____(Message[PullDoc]): ''' Define the ``PULL-DOC-REPLY`` message for replying to Document pull requests from clients The ``content`` fragment of for this message is has the form: .. code-block:: python { 'doc' : <Document JSON> } ''' msgtype = 'PULL-DOC-RE...
pull_doc_reply
python
django__django
django/contrib/postgres/functions.py
{ "start": 154, "end": 252 }
class ____(Func): template = "CURRENT_TIMESTAMP" output_field = DateTimeField()
TransactionNow
python
huggingface__transformers
src/transformers/models/deepseek_vl_hybrid/modeling_deepseek_vl_hybrid.py
{ "start": 7243, "end": 8187 }
class ____(nn.Module): def __init__(self, config, output_size: int = 24): super().__init__() self.config = config self.output_size = output_size self.conv1 = nn.Conv2d( config.output_channels, config.output_channels * 2, kernel_size=3, stride=2, padding=1, bias=False ...
DeepseekVLSamVisionProj
python
doocs__leetcode
solution/2200-2299/2242.Maximum Score of a Node Sequence/Solution.py
{ "start": 0, "end": 572 }
class ____: def maximumScore(self, scores: List[int], edges: List[List[int]]) -> int: g = defaultdict(list) for a, b in edges: g[a].append(b) g[b].append(a) for k in g.keys(): g[k] = nlargest(3, g[k], key=lambda x: scores[x]) ans = -1 for a...
Solution
python
pytorch__pytorch
test/distributed/test_dist2.py
{ "start": 8654, "end": 9428 }
class ____(Dist2MultiProcessTestCase): @property def device(self) -> torch.device: return torch.device("cuda", self.rank) @requires_nccl() @skip_if_lt_x_gpu(2) def new_group(self) -> torch.distributed.ProcessGroup: os.environ["RANK"] = str(self.rank) os.environ["WORLD_SIZE"]...
ProcessGroupNCCLTest
python
allegroai__clearml
clearml/backend_api/services/v2_23/projects.py
{ "start": 79019, "end": 79895 }
class ____(Request): """ :param project: Project id :type project: str """ _service = "projects" _action = "get_by_id" _version = "2.23" _schema = { "definitions": {}, "properties": {"project": {"description": "Project id", "type": "string"}}, "required": ["proje...
GetByIdRequest
python
PyCQA__pydocstyle
src/tests/test_cases/sections.py
{ "start": 6703, "end": 10152 }
class ____: # noqa: D203 """Test class.""" def test_method(self, test, another_test, _): # noqa: D213, D407 """Test a valid args section. Args: test: A parameter. another_test: Another parameter. """ def test_detailed_description(self, test, another_test...
TestGoogle
python
doocs__leetcode
solution/3000-3099/3029.Minimum Time to Revert Word to Initial State I/Solution2.py
{ "start": 480, "end": 797 }
class ____: def minimumTimeToInitialState(self, word: str, k: int) -> int: hashing = Hashing(word, 13331, 998244353) n = len(word) for i in range(k, n, k): if hashing.query(1, n - i) == hashing.query(i + 1, n): return i // k return (n + k - 1) // k
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-my-hours/components.py
{ "start": 554, "end": 3325 }
class ____(NoAuth): config: Config email: Union[InterpolatedString, str] password: Union[InterpolatedString, str] _access_token = None _refreshToken = None def __post_init__(self, parameters: Mapping[str, Any]): self._email = InterpolatedString.create(self.email, parameters=parameters)...
CustomAuthenticator
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/solids.py
{ "start": 14083, "end": 14588 }
class ____(graphene.Interface): name = graphene.NonNull(graphene.String) description = graphene.String() metadata = non_null_list(GrapheneMetadataItemDefinition) input_definitions = non_null_list(GrapheneInputDefinition) output_definitions = non_null_list(GrapheneOutputDefinition) assetNodes = n...
GrapheneISolidDefinition
python
bokeh__bokeh
src/bokeh/util/tornado.py
{ "start": 2262, "end": 4419 }
class ____: ''' Like ioloop.PeriodicCallback except the 'func' can be async and return a Future. Will wait for func to finish each time before we call it again. (Plain ioloop.PeriodicCallback can "pile up" invocations if they are taking too long.) ''' _loop: IOLoop _period: int _s...
_AsyncPeriodic
python
getsentry__sentry
src/sentry/utils/arroyo.py
{ "start": 6999, "end": 7896 }
class ____(ProcessingStrategy[TStrategyPayload]): """ A strategy for setting and re-setting the join timeout for individual sub-sections of the processing chain. This way one can granularly disable join() for steps that are idempotent anyway, making rebalancing faster and simpler. """ def __ini...
SetJoinTimeout
python
google__jax
tests/pallas/tpu_pallas_test.py
{ "start": 92128, "end": 92767 }
class ____(PallasBaseTest): def test_mlir_location(self): # Make sure that MLIR locations are correctly propagated to primitives. args = (jax.ShapeDtypeStruct((8, 128), jnp.float32),) f = example_kernel.double as_tpu_kernel = mosaic.as_tpu_kernel def capture_as_tpu_kernel(module, *args, **kwargs)...
PallasUXTest
python
pytorch__pytorch
torch/testing/_comparison.py
{ "start": 15922, "end": 16719 }
class ____(Pair): """Pair for any type of inputs that will be compared with the `==` operator. .. note:: Since this will instantiate for any kind of inputs, it should only be used as fallback after all other pairs couldn't handle the inputs. """ def compare(self) -> None: try...
ObjectPair
python
pytorch__pytorch
test/inductor/test_ordered_set.py
{ "start": 31289, "end": 31852 }
class ____(TestBasicOps, TestCase): def setUp(self): super().setUp() self.case = "unit OrderedSet (tuple)" self.values = [(0, "zero")] self.OrderedSet = OrderedSet(self.values) self.dup = OrderedSet(self.values) self.length = 1 self.repr = "{(0, 'zero')}" ...
TestBasicOpsTuple
python
pallets__jinja
src/jinja2/bccache.py
{ "start": 11058, "end": 13986 }
class ____(BytecodeCache): """This class implements a bytecode cache that uses a memcache cache for storing the information. It does not enforce a specific memcache library (tummy's memcache or cmemcache) but will accept any class that provides the minimal interface required. Libraries compatible ...
MemcachedBytecodeCache
python
walkccc__LeetCode
solutions/2772. Apply Operations to Make All Array Elements Equal to Zero/2772.py
{ "start": 0, "end": 498 }
class ____: def checkArray(self, nums: list[int], k: int) -> bool: if k == 1: return True needDecrease = 0 # Store nums[i - k + 1..i] with decreasing nums[i - k + 1]. dq = collections.deque() for i, num in enumerate(nums): if i >= k: needDecrease -= dq.popleft() if nums...
Solution
python
numba__numba
numba/core/typing/npydecl.py
{ "start": 24548, "end": 25027 }
class ____(AbstractTemplate): def generic(self, args, kws): assert not kws if len(args) != 1: return arrays, = args if isinstance(arrays, types.BaseTuple): if not arrays: return arrays = list(arrays) else: arra...
NdIter
python
getsentry__sentry
src/flagpole/conditions.py
{ "start": 1311, "end": 4359 }
class ____: property: str """The evaluation context property to match against.""" value: Any """The value to compare against the condition's evaluation context property.""" operator: str = dataclasses.field(default="") """ The name of the operator to use when comparing the evaluation conte...
ConditionBase
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_query.py
{ "start": 60115, "end": 65741 }
class ____(fixtures.TablesTest): """round trip tests related to using JSON and JSONB in UPDATE statements with PG-specific features """ __only_on__ = "postgresql" __backend__ = True @classmethod def define_tables(cls, metadata): Table( "t", metadata, ...
JSONUpdateTest
python
getsentry__sentry
src/sentry/models/grouphistory.py
{ "start": 5773, "end": 6509 }
class ____(BaseManager["GroupHistory"]): def filter_to_team(self, team: Team) -> QuerySet[GroupHistory]: from sentry.models.groupassignee import GroupAssignee from sentry.models.project import Project project_list = Project.objects.get_for_team_ids(team_ids=[team.id]) user_ids = lis...
GroupHistoryManager
python
Textualize__textual
tests/input/test_input_clear.py
{ "start": 79, "end": 456 }
class ____(App): def compose(self) -> ComposeResult: yield Input("Hello, World!") async def test_input_clear(): async with InputApp().run_test() as pilot: input_widget = pilot.app.query_one(Input) assert input_widget.value == "Hello, World!" input_widget.clear() await p...
InputApp
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-faiss/llama_index/readers/faiss/base.py
{ "start": 176, "end": 2515 }
class ____(BaseReader): """ Faiss reader. Retrieves documents through an existing in-memory Faiss index. These documents can then be used in a downstream LlamaIndex data structure. If you wish use Faiss itself as an index to to organize documents, insert documents, and perform queries on them, ...
FaissReader
python
django__django
django/contrib/gis/db/backends/mysql/features.py
{ "start": 219, "end": 876 }
class ____(BaseSpatialFeatures, MySQLDatabaseFeatures): empty_intersection_returns_none = False has_spatialrefsys_table = False supports_add_srs_entry = False supports_distance_geodetic = False supports_length_geodetic = False supports_area_geodetic = False supports_transform = False sup...
DatabaseFeatures
python
scipy__scipy
benchmarks/benchmarks/stats_sampling.py
{ "start": 1158, "end": 1886 }
class ____: def __init__(self, shift=0.): self.shift = shift self.mode = shift def pdf(self, x): x -= self.shift y = 1. / (abs(x) + 1.) return y * y def dpdf(self, x): x -= self.shift y = 1. / (abs(x) + 1.) y = 2. * y * y * y return y...
contdist3
python
GoogleCloudPlatform__python-docs-samples
pubsub/streaming-analytics/PubSubToGCS.py
{ "start": 2068, "end": 2477 }
class ____(DoFn): def process(self, element, publish_time=DoFn.TimestampParam): """Processes each windowed element by extracting the message body and its publish time into a tuple. """ yield ( element.decode("utf-8"), datetime.utcfromtimestamp(float(publish_ti...
AddTimestamp
python
encode__django-rest-framework
rest_framework/generics.py
{ "start": 9428, "end": 10163 }
class ____(mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin, GenericAPIView): """ Concrete view for retrieving, updating or deleting a model instance. """ def get(self, re...
RetrieveUpdateDestroyAPIView
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 288508, "end": 292116 }
class ____(rv_continuous): r"""A loguniform or reciprocal continuous random variable. %(before_notes)s Notes ----- The probability density function for this class is: .. math:: f(x, a, b) = \frac{1}{x \log(b/a)} for :math:`a \le x \le b`, :math:`b > a > 0`. This class takes ...
reciprocal_gen
python
kamyu104__LeetCode-Solutions
Python/longest-square-streak-in-an-array.py
{ "start": 46, "end": 648 }
class ____(object): def longestSquareStreak(self, nums): """ :type nums: List[int] :rtype: int """ sorted_nums = sorted(set(nums)) squares = {x for x in sorted_nums if x%2 < 2} # squared_num % 4 in [0, 1] result = 0 for x in sorted_nums: ...
Solution
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_qt.py
{ "start": 44466, "end": 44788 }
class ____(backend_tools.ConfigureSubplotsBase): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._subplot_dialog = None def trigger(self, *args): NavigationToolbar2QT.configure_subplots(self) @backend_tools._register_tool_class(FigureCanvasQT)
ConfigureSubplotsQt
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 531979, "end": 532475 }
class ____(sgqlc.types.Type): """Autogenerated return type of ConvertProjectCardNoteToIssue""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "project_card") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client pe...
ConvertProjectCardNoteToIssuePayload
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_version_querysets.py
{ "start": 8146, "end": 11868 }
class ____(TestVersionQuerySetWithManagerBase): """ Queries using External Manager should only include External Versions. It will only include pull/merge request Version in the queries. """ def test_all(self): query = Version.external.all() versions = { self.external_v...
VersionQuerySetWithExternalManagerTest
python
vyperlang__vyper
vyper/ast/nodes.py
{ "start": 44325, "end": 45329 }
class ____(Stmt): """ An `implements` declaration. Attributes ---------- children : List of (Name | Attribute)s Name nodes for the interfaces to be implemented """ __slots__ = ("children",) _only_empty_fields = ("value",) def __init__(self, *args, **kwargs): tmp = ...
ImplementsDecl
python
mlflow__mlflow
mlflow/entities/trace_data.py
{ "start": 244, "end": 3531 }
class ____: """A container object that holds the spans data of a trace. Args: spans: List of spans that are part of the trace. """ spans: list[Span] = field(default_factory=list) # NB: Custom constructor to allow passing additional kwargs for backward compatibility for # DBX agent eva...
TraceData
python
PyCQA__pylint
doc/data/messages/s/subclassed-final-class/good.py
{ "start": 34, "end": 288 }
class ____: """General Platypus data.""" average_length = 46 average_body_temperature = 32 def print_average_length_platypus(): output = f"The average length of a platypus is: {PlatypusData.average_length}cm" print(output)
PlatypusData
python
huggingface__transformers
src/transformers/models/gemma3/modular_gemma3.py
{ "start": 32957, "end": 37117 }
class ____(nn.Module): def __init__(self, config: Gemma3Config): super().__init__() self.mm_input_projection_weight = nn.Parameter( torch.zeros(config.vision_config.hidden_size, config.text_config.hidden_size) ) self.mm_soft_emb_norm = Gemma3RMSNorm( config....
Gemma3MultiModalProjector
python
tensorflow__tensorflow
tensorflow/compiler/tests/proximal_adagrad_test.py
{ "start": 1102, "end": 6738 }
class ____(xla_test.XLATestCase): def testResourceProximalAdagradwithoutRegularization(self): with self.session(), self.test_scope(): var0 = resource_variable_ops.ResourceVariable([0.0, 0.0]) var1 = resource_variable_ops.ResourceVariable([0.0, 0.0]) grads0 = constant_op.constant([0.1, 0.2]) ...
ProximalAdagradOptimizerTest
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/contrib/completers/system.py
{ "start": 311, "end": 2057 }
class ____(GrammarCompleter): """ Completer for system commands. """ def __init__(self) -> None: # Compile grammar. g = compile( r""" # First we have an executable. (?P<executable>[^\s]+) # Ignore literals in between. ...
SystemCompleter
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride2.py
{ "start": 2261, "end": 2410 }
class ____: def method1(self, x: Self) -> Self: ... def method2(self, x: Self) -> Self: ... def method3(self, x: Self) -> Self: ...
Base3
python
openai__openai-python
src/openai/types/batch_create_params.py
{ "start": 2053, "end": 2519 }
class ____(TypedDict, total=False): anchor: Required[Literal["created_at"]] """Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created. """ seconds: Required[int] """The n...
OutputExpiresAfter
python
google__jax
jax/_src/pallas/core.py
{ "start": 7455, "end": 8297 }
class ____(enum.Enum): """Logical, device-agnostic memory spaces. Each memory space will be translated to a device-specific memory type during lowering. """ ANY = "any" # Unrestricted memory space (usually HBM) ERROR = "error" # Memory space for checkify errors. INDEX = "index" # Memory space for scal...
MemorySpace
python
django__django
tests/introspection/tests.py
{ "start": 495, "end": 18258 }
class ____(TransactionTestCase): available_apps = ["introspection"] def test_table_names(self): tl = connection.introspection.table_names() self.assertEqual(tl, sorted(tl)) self.assertIn( Reporter._meta.db_table, tl, "'%s' isn't in table_list()." % Re...
IntrospectionTests
python
kamyu104__LeetCode-Solutions
Python/special-permutations.py
{ "start": 71, "end": 875 }
class ____(object): def specialPerm(self, nums): """ :type nums: List[int] :rtype: int """ MOD = 10**9+7 def backtracking(i, mask): if mask == (1<<len(nums))-1: return 1 if lookup[i+1][mask] == -1: total = 0 ...
Solution
python
walkccc__LeetCode
solutions/2931. Maximum Spending After Buying Items/2931.py
{ "start": 0, "end": 194 }
class ____: def maxSpending(self, values: list[list[int]]) -> int: items = sorted(item for shop in values for item in shop) return sum(item * d for d, item in enumerate(items, 1))
Solution
python
getsentry__sentry
src/sentry/seer/explorer/client_models.py
{ "start": 564, "end": 781 }
class ____(BaseModel): """A block in the Explorer agent's conversation/memory.""" id: str message: Message timestamp: str loading: bool = False class Config: extra = "allow"
MemoryBlock
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/pg8000.py
{ "start": 5564, "end": 5653 }
class ____(ENUM): def get_dbapi_type(self, dbapi): return dbapi.UNKNOWN
_PGEnum
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 61632, "end": 61918 }
class ____(BiffRecord): """ This record represents a cell that contains a boolean or error value. """ _REC_ID = 0x0205 def __init__(self, row, col, xf_index, number, is_error): self._rec_data = pack('<3HBB', row, col, xf_index, number, is_error)
BoolErrRecord
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/_typing.py
{ "start": 2673, "end": 2870 }
class ____(Protocol, Generic[_T_co]): """indicates a class that has a __clause_element__() method""" def __clause_element__(self) -> roles.ExpressionElementRole[_T_co]: ...
_HasClauseElement
python
automl__auto-sklearn
autosklearn/util/single_thread_client.py
{ "start": 90, "end": 690 }
class ____(dask.distributed.Future): """ A class that mimics a distributed Future, the outcome of performing submit on a distributed client. """ def __init__(self, result: typing.Any) -> None: self._result = result # type: typing.Any def result(self, timeout: typing.Optional[int] = No...
DummyFuture
python
automl__auto-sklearn
autosklearn/metalearning/metafeatures/metafeatures.py
{ "start": 32690, "end": 35232 }
class ____(MetaFeature): def _calculate(self, X, y, logger, feat_type): import sklearn.tree if type(y) in ("binary", "multiclass"): kf = sklearn.model_selection.StratifiedKFold(n_splits=5) else: kf = sklearn.model_selection.KFold(n_splits=5) accuracy = 0.0 ...
LandmarkRandomNodeLearner
python
kamyu104__LeetCode-Solutions
Python/minimum-operations-to-make-a-uni-value-grid.py
{ "start": 63, "end": 1566 }
class ____(object): def minOperations(self, grid, x): """ :type grid: List[List[int]] :type x: int :rtype: int """ def nth_element(nums, n, compare=lambda a, b: a < b): def tri_partition(nums, left, right, target, compare): mid = left ...
Solution
python
getsentry__sentry
src/sentry/integrations/cursor/models.py
{ "start": 576, "end": 843 }
class ____(BaseModel): prompt: CursorAgentLaunchRequestPrompt source: CursorAgentSource model: str | None = None target: CursorAgentLaunchRequestTarget | None = None webhook: CursorAgentLaunchRequestWebhook | None = None
CursorAgentLaunchRequestBody
python
sympy__sympy
sympy/printing/lambdarepr.py
{ "start": 2114, "end": 7451 }
class ____(LambdaPrinter): # key, value pairs correspond to SymPy name and numexpr name # functions not appearing in this dict will raise a TypeError printmethod = "_numexprcode" _numexpr_functions = { 'sin' : 'sin', 'cos' : 'cos', 'tan' : 'tan', 'asin': 'arcsin', ...
NumExprPrinter
python
google__jax
jaxlib/triton/dialect.py
{ "start": 1069, "end": 1482 }
class ____(ReduceOp): # type: ignore def __init__( self, operands: Sequence[ir.Value], axis: int, *, loc: ir.Location | None = None, ip: ir.InsertionPoint | None = None, ): return_types = _infer_reduce_op_return_types(operands, axis) super().__init__(return_types, opera...
ReduceOp
python
davidhalter__jedi
test/completion/classes.py
{ "start": 9472, "end": 9832 }
class ____(): default = 3 def x(self, arg=default): #? str() default return arg def y(self): return default #? int() DefaultArg().x() #? str() DefaultArg().y() #? int() DefaultArg.x() #? str() DefaultArg.y() # ----------------- # Error Recovery # ----------------- from im...
DefaultArg
python
python-excel__xlwt
xlwt/antlr.py
{ "start": 74307, "end": 75903 }
class ____(BaseAST): def __init__(self,token=None): super(CommonAST,self).__init__() self.ttype = INVALID_TYPE self.text = "<no text>" self.line = 0 self.column= 0 self.initialize(token) #assert self.text ### Get the token text for this node def get...
CommonAST
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 174451, "end": 175573 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "id", "title", "body", "assignee_ids", "milestone_id", "label_ids", "state", "project_ids", "client_mutation_...
UpdateIssueInput
python
cython__cython
docs/examples/tutorial/pure/pep_526.py
{ "start": 499, "end": 612 }
class ____: a: cython.int b: cython.int def __init__(self, b=0): self.a = 3 self.b = b
A
python
kamyu104__LeetCode-Solutions
Python/detect-pattern-of-length-m-repeated-k-or-more-times.py
{ "start": 29, "end": 449 }
class ____(object): def containsPattern(self, arr, m, k): """ :type arr: List[int] :type m: int :type k: int :rtype: bool """ cnt = 0 for i in xrange(len(arr)-m): if arr[i] != arr[i+m]: cnt = 0 continue ...
Solution
python
allegroai__clearml
clearml/utilities/pigar/modules.py
{ "start": 375, "end": 539 }
class ____(dict): """Modules object will be used to store modules information.""" def __init__(self) -> None: super(Modules, self).__init__()
Modules
python
great-expectations__great_expectations
contrib/capitalone_dataprofiler_expectations/capitalone_dataprofiler_expectations/expectations/expect_column_values_confidence_for_data_label_to_be_greater_than_or_equal_to_threshold.py
{ "start": 2571, "end": 7949 }
class ____( ColumnMapExpectation ): """Expect the column values to have a DataProfiler confidence threshold greater than or equal to the specified threshold for the data label. This function builds upon the custom column map expectations of Great Expectations. This function asks the question a yes/no quest...
ExpectColumnValuesConfidenceForDataLabelToBeGreaterThanOrEqualToThreshold
python
apache__airflow
helm-tests/tests/helm_tests/webserver/test_webserver.py
{ "start": 48853, "end": 50458 }
class ____: """Tests webserver service account.""" def test_should_add_component_specific_labels(self): docs = render_chart( values={ "airflowVersion": "2.10.5", "webserver": { "serviceAccount": {"create": True}, "label...
TestWebserverServiceAccount
python
sphinx-doc__sphinx
sphinx/builders/_epub_base.py
{ "start": 2391, "end": 2804 }
class ____(NamedTuple): navpoint: str playorder: int text: str refuri: str children: list[NavPoint] def sphinx_smarty_pants(t: str, language: str = 'en') -> str: t = t.replace('&quot;', '"') t = smartquotes.educateDashesOldSchool(t) t = smartquotes.educateQuotes(t, language) t = t....
NavPoint
python
ray-project__ray
python/ray/serve/_private/proxy_request_response.py
{ "start": 5441, "end": 5750 }
class ____: code: Union[str, grpc.StatusCode] # Must be convertible to a string. is_error: bool = False message: str = "" # Yields protocol-specific messages followed by a final `ResponseStatus`. ResponseGenerator = AsyncIterator[Union[Any, ResponseStatus]] @dataclass(frozen=True)
ResponseStatus
python
pydantic__pydantic
tests/mypy/modules/plugin_strict_fields.py
{ "start": 556, "end": 723 }
class ____(ModelStrictMode): b: int = Field(strict=False) c: int = Field(strict=True) # expected error: a, c ModelOverride2(a='1', b='2', c='3')
ModelOverride2
python
tox-dev__tox
src/tox/execute/pep517_backend.py
{ "start": 4063, "end": 5260 }
class ____(ExecuteInstance): """A backend invocation.""" def __init__( self, request: ExecuteRequest, options: ExecuteOptions, out: SyncWrite, err: SyncWrite, instance_status: tuple[LocalSubProcessExecuteInstance, ExecuteStatus], ) -> None: super().__...
LocalSubProcessPep517ExecuteInstance
python
great-expectations__great_expectations
tests/core/test__docs_decorators.py
{ "start": 19383, "end": 19902 }
class ____: """Docstring summary. Longer description. Args: some_arg: some_arg description. other_arg: other_arg description. """ def __init__(self, some_arg, other_arg) -> None: self.some_arg = some_arg self.other_arg = other_arg @deprecated_argument(argument_na...
_ClassFullDocstringDeprecatedAndNewAtClassLevel
python
tensorflow__tensorflow
tensorflow/python/data/experimental/kernel_tests/auto_shard_dataset_test.py
{ "start": 24437, "end": 28230 }
class ____(tf_record_test_base.TFRecordTestBase, parameterized.TestCase): def _setUpFiles(self, num_files, num_records_per_file): self._num_files = num_files self._num_records = num_records_per_file self._filenames = self._createFiles() @combinations.generate(test...
AutoShardWithRebatchDatasetTest
python
Lightning-AI__lightning
tests/tests_pytorch/checkpointing/test_model_checkpoint.py
{ "start": 40860, "end": 41062 }
class ____(Callback): def on_train_batch_end(self, trainer, pl_module, outputs, batch, batch_idx): if batch_idx == 1: raise RuntimeError("Trouble!")
TroubledCallbackOnTrainBatchEnd
python
celery__celery
t/smoke/tests/failover/test_broker_failover.py
{ "start": 1077, "end": 2451 }
class ____: def test_killing_first_broker(self, celery_setup: CeleryTestSetup): assert len(celery_setup.broker_cluster) > 1 celery_setup.broker.kill() expected = "test_broker_failover" res = identity.s(expected).apply_async(queue=celery_setup.worker.worker_queue) assert res.g...
test_broker_failover
python
encode__starlette
starlette/datastructures.py
{ "start": 6505, "end": 6988 }
class ____: """ Holds a string value that should not be revealed in tracebacks etc. You should cast the value to `str` at the point it is required. """ def __init__(self, value: str): self._value = value def __repr__(self) -> str: class_name = self.__class__.__name__ re...
Secret
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/triggers/bigquery.py
{ "start": 16012, "end": 23271 }
class ____(BigQueryInsertJobTrigger): """ BigQueryIntervalCheckTrigger run on the trigger worker, inherits from BigQueryInsertJobTrigger class. :param conn_id: Reference to google cloud connection id :param first_job_id: The ID of the job 1 performed :param second_job_id: The ID of the job 2 perf...
BigQueryIntervalCheckTrigger
python
django__django
tests/staticfiles_tests/storage.py
{ "start": 204, "end": 594 }
class ____(storage.Storage): """ A storage class that implements get_modified_time() but raises NotImplementedError for path(). """ def _save(self, name, content): return "dummy" def delete(self, name): pass def exists(self, name): pass def get_modified_time(s...
DummyStorage
python
getsentry__sentry
src/bitfield/types.py
{ "start": 2657, "end": 6742 }
class ____: """ Represents an array of bits, each as a ``Bit`` object. """ def __init__(self, value, keys, labels=None): # TODO: change to bitarray? if value: self._value = int(value) else: self._value = 0 self._keys = keys self._labels = ...
BitHandler
python
buildout__buildout
src/zc/buildout/easy_install.py
{ "start": 65817, "end": 66505 }
class ____(zc.buildout.UserError): def __init__(self, err, ws): ws = list(ws) ws.sort() self.err, self.ws = err, ws def __str__(self): result = ["There is a version conflict."] if len(self.err.args) == 2: existing_dist, req = self.err.args result...
VersionConflict
python
huggingface__transformers
src/transformers/models/xlm/modeling_xlm.py
{ "start": 4789, "end": 6084 }
class ____(nn.Module): """ Compute SQuAD start logits from sequence hidden states. Args: config ([`XLMConfig`]): The config used by the model, will be used to grab the `hidden_size` of the model. """ def __init__(self, config: XLMConfig): super().__init__() self...
XLMPoolerStartLogits
python
huggingface__transformers
tests/models/parakeet/test_modeling_parakeet.py
{ "start": 8880, "end": 11406 }
class ____(ModelTesterMixin, unittest.TestCase): all_model_classes = (ParakeetForCTC,) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": ParakeetEncoder, "automatic-speech-recognition": ParakeetForCTC, } if is_torch_available() ...
ParakeetForCTCModelTest
python
Pylons__pyramid
tests/test_config/test_views.py
{ "start": 148329, "end": 148521 }
class ____: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} def __init__(self, request): pass def __call__(self): return 'OK'
DummyViewDefaultsClass
python
huggingface__transformers
src/transformers/models/deepseek_vl/modeling_deepseek_vl.py
{ "start": 3492, "end": 5007 }
class ____(ModelOutput): r""" loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction). logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the lan...
DeepseekVLCausalLMOutputWithPast
python
huggingface__transformers
src/transformers/models/mm_grounding_dino/configuration_mm_grounding_dino.py
{ "start": 1405, "end": 14486 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`MMGroundingDinoModel`]. It is used to instantiate a MM Grounding DINO model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yie...
MMGroundingDinoConfig
python
ray-project__ray
rllib/models/tests/test_catalog.py
{ "start": 2169, "end": 2329 }
class ____(MultiActionDistribution): @override(MultiActionDistribution) def entropy(self): raise NotImplementedError
CustomMultiActionDistribution
python
ethereum__web3.py
web3/_utils/module_testing/net_module.py
{ "start": 676, "end": 1296 }
class ____: @pytest.mark.asyncio async def test_net_version(self, async_w3: "AsyncWeb3[Any]") -> None: version = await async_w3.net.version assert is_string(version) assert version.isdigit() @pytest.mark.asyncio async def test_net_listening(self, async_w3: "AsyncWeb3[Any]") -> ...
AsyncNetModuleTest
python
bokeh__bokeh
src/bokeh/protocol/messages/push_doc.py
{ "start": 1596, "end": 2786 }
class ____(Message[PushDoc]): ''' Define the ``PUSH-DOC`` message for pushing Documents from clients to a Bokeh server. The ``content`` fragment of for this message is has the form: .. code-block:: python { 'doc' : <Document JSON> } ''' msgtype = 'PUSH-DOC' ...
push_doc
python
pytorch__pytorch
torch/_dynamo/source.py
{ "start": 21672, "end": 23068 }
class ____(ChainedSource): idx_key: Union[int, str] is_kw: bool = False field: str = dataclasses.field(init=False, repr=False, compare=False) _name: str = dataclasses.field(init=False, repr=False, compare=False) def __post_init__(self) -> None: assert self.base, ( "Base must be ...
DefaultsSource
python
huggingface__transformers
src/transformers/models/seggpt/modeling_seggpt.py
{ "start": 9416, "end": 16183 }
class ____(nn.Module): """Multi-head Attention block with relative position embeddings.""" def __init__(self, config): super().__init__() image_size, patch_size = config.image_size, config.patch_size image_size = image_size if isinstance(image_size, collections.abc.Iterable) else (image...
SegGptAttention