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
mlflow__mlflow
mlflow/genai/judges/tools/list_spans.py
{ "start": 1552, "end": 4462 }
class ____(JudgeTool): """ Tool for listing and analyzing spans within a trace. This tool provides functionality to extract and analyze span information from MLflow traces, including span names, types, durations, and metadata. """ @property def name(self) -> str: return "list_spans...
ListSpansTool
python
pypa__pip
src/pip/_vendor/rich/progress.py
{ "start": 19207, "end": 20964 }
class ____(ProgressColumn): """A column with a 'spinner' animation. Args: spinner_name (str, optional): Name of spinner animation. Defaults to "dots". style (StyleType, optional): Style of spinner. Defaults to "progress.spinner". speed (float, optional): Speed factor of spinner. Default...
SpinnerColumn
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 35150, "end": 35846 }
class ____(TestCase): @cached_property def runner(self) -> CliRunner: return CliRunner() @property def command(self): raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}") default_args: list[str] = [] def invoke(self, *args, **kwargs): ...
CliTestCase
python
squidfunk__mkdocs-material
material/plugins/blog/author.py
{ "start": 1425, "end": 1672 }
class ____(Config): name = Type(str) description = Type(str) avatar = Type(str) slug = Optional(Type(str)) url = Optional(Type(str)) # ----------------------------------------------------------------------------- # Authors
Author
python
streamlit__streamlit
lib/tests/streamlit/components_test.py
{ "start": 2618, "end": 10306 }
class ____(unittest.TestCase): """Test component declaration.""" def setUp(self) -> None: config = RuntimeConfig( script_path="mock/script/path.py", command_line=None, component_registry=LocalComponentRegistry(), media_file_storage=MemoryMediaFileStorage(...
DeclareComponentTest
python
pytorch__pytorch
torch/_dynamo/variables/lists.py
{ "start": 1672, "end": 12635 }
class ____(VariableTracker): @staticmethod def cls_for_instance(obj: Any) -> type["BaseListVariable"]: return BaseListVariable.cls_for(type(obj)) @staticmethod def cls_for(obj: Any) -> type: return { iter: ListIteratorVariable, list: ListVariable, sli...
BaseListVariable
python
dagster-io__dagster
python_modules/automation/automation/dagster_docs/watcher.py
{ "start": 2733, "end": 5060 }
class ____(FileSystemEventHandler): """File handler that respects .gitignore patterns.""" def __init__(self, root_path: Path, parent_watcher: "ChangedFilesWatcher"): self.root_path = root_path self.parent_watcher = parent_watcher self.gitignore_spec = self._load_gitignore_patterns() ...
GitignoreAwareHandler
python
doocs__leetcode
solution/2000-2099/2031.Count Subarrays With More Ones Than Zeros/Solution.py
{ "start": 0, "end": 390 }
class ____: __slots__ = ["n", "c"] def __init__(self, n: int): self.n = n self.c = [0] * (n + 1) def update(self, x: int, v: int): while x <= self.n: self.c[x] += v x += x & -x def query(self, x: int) -> int: s = 0 while x: s...
BinaryIndexedTree
python
django__django
tests/model_fields/models.py
{ "start": 3149, "end": 3250 }
class ____(models.Model): s = models.SlugField(max_length=255, allow_unicode=True)
UnicodeSlugField
python
davidhalter__parso
parso/python/tree.py
{ "start": 29563, "end": 29692 }
class ____(KeywordStatement): __slots__ = () @property def assertion(self): return self.children[1]
AssertStmt
python
walkccc__LeetCode
solutions/527. Word Abbreviation/527.py
{ "start": 0, "end": 925 }
class ____: def wordsAbbreviation(self, words: list[str]) -> list[str]: n = len(words) def getAbbrev(s: str, prefixIndex: int) -> str: n = len(s) num = n - (prefixIndex + 1) - 1 numLength = 1 if num < 10 else (2 if num < 100 else 3) abbrevLength = (prefixIndex + 1) + numLength + 1 ...
Solution
python
sphinx-doc__sphinx
sphinx/builders/linkcheck.py
{ "start": 1986, "end": 2144 }
class ____: def __repr__(self) -> str: return '_SENTINEL_LAR' def __reduce__(self) -> str: return self.__class__.__name__
_SENTINEL_LAR
python
numpy__numpy
numpy/lib/tests/test_recfunctions.py
{ "start": 32751, "end": 39991 }
class ____: def _create_arrays(self): a = np.array(list(zip(np.arange(10), np.arange(50, 60), np.arange(100, 110))), dtype=[('a', int), ('b', int), ('c', int)]) b = np.array(list(zip(np.arange(5, 15), np.arange(65, 75), ...
TestJoinBy
python
doocs__leetcode
solution/0000-0099/0090.Subsets II/Solution.py
{ "start": 0, "end": 462 }
class ____: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: def dfs(i: int): if i == len(nums): ans.append(t[:]) return t.append(nums[i]) dfs(i + 1) x = t.pop() while i + 1 < len(nums) and nums[i + 1] =...
Solution
python
pennersr__django-allauth
allauth/headless/mfa/inputs.py
{ "start": 1802, "end": 1886 }
class ____(AuthenticateWebAuthnForm, inputs.Input): pass
AuthenticateWebAuthnInput
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/events.py
{ "start": 5314, "end": 5379 }
class ____(CollectionEndEvent): __slots__ = ()
SequenceEndEvent
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 100585, "end": 100827 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.emb = torch.nn.Embedding(num_embeddings=10, embedding_dim=12) def forward(self, indices): return self.emb(indices)
EmbeddingModule
python
fastapi__sqlmodel
docs_src/tutorial/fastapi/teams/tutorial001_py39.py
{ "start": 1058, "end": 4871 }
class ____(SQLModel): name: Optional[str] = None secret_name: Optional[str] = None age: Optional[int] = None team_id: Optional[int] = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" connect_args = {"check_same_thread": False} engine = create_engine(sqlite_url, echo=...
HeroUpdate
python
GoogleCloudPlatform__python-docs-samples
dialogflow/streaming_transcription.py
{ "start": 1740, "end": 9488 }
class ____: """Opens a recording stream as a generator yielding the audio chunks.""" def __init__(self, rate, chunk_size): self._rate = rate self.chunk_size = chunk_size self._num_channels = 1 self._buff = queue.Queue() self.is_final = False self.closed = True ...
ResumableMicrophoneStream
python
pytorch__pytorch
torch/nn/modules/pooling.py
{ "start": 48874, "end": 51461 }
class ____(_LPPoolNd): r"""Applies a 3D power-average pooling over an input signal composed of several input planes. On each window, the function computed is: .. math:: f(X) = \sqrt[p]{\sum_{x \in X} x^{p}} - At p = :math:`\infty`, one gets Max Pooling - At p = 1, one gets Sum Pooling (wh...
LPPool3d
python
django__django
tests/postgres_tests/test_hstore.py
{ "start": 9945, "end": 12163 }
class ____(PostgreSQLSimpleTestCase): field_values = [ ({"a": "b"}, [{"a": "b"}, {"b": "a"}]), ( {"все": "Трурль и Клапауций"}, [{"Трурль": "Клапауций"}, {"Клапауций": "Трурль"}], ), ] @staticmethod def create_json_data(field_value, array_field_value): ...
TestSerialization
python
facebook__pyre-check
client/command_arguments.py
{ "start": 9299, "end": 9916 }
class ____: watchman_root: Optional[Path] = None project_name: Optional[str] = None preset: Optional[str] = None cache_critical_files: List[str] = field(default_factory=list) def serialize(self) -> Dict[str, Any]: return { "watchman_root": ( str(self.watchman_roo...
PysaSavedStateArguments
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 392798, "end": 393440 }
class ____(sgqlc.types.Interface): """Metadata for an audit entry containing enterprise account information. """ __schema__ = github_schema __field_names__ = ("enterprise_resource_path", "enterprise_slug", "enterprise_url") enterprise_resource_path = sgqlc.types.Field(URI, graphql_name="enterpr...
EnterpriseAuditEntryData
python
Textualize__textual
src/textual/widgets/_markdown.py
{ "start": 22573, "end": 22647 }
class ____(MarkdownBlock): """A table data Markdown block."""
MarkdownTD
python
sympy__sympy
sympy/core/tests/test_constructor_postprocessor.py
{ "start": 155, "end": 711 }
class ____(Symbol): # Test class for a symbol that can only appear once in a `Mul` expression. pass Basic._constructor_postprocessor_mapping[SymbolInMulOnce] = { "Mul": [lambda x: x], "Pow": [lambda x: x.base if isinstance(x.base, SymbolInMulOnce) else x], "Add": [lambda x: x], } def _postproces...
SymbolInMulOnce
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_embed_image10.py
{ "start": 381, "end": 1398 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("embed_image10.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with image(s).""" workbook = Wo...
TestCompareXLSXFiles
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/traditional_relationship.py
{ "start": 1114, "end": 3158 }
class ____(Base): __tablename__ = "address" id = mapped_column(Integer, primary_key=True) user_id = mapped_column(ForeignKey("user.id")) email = mapped_column(String, nullable=False) user_style_one = relationship(User) user_style_one_typed: Mapped[User] = relationship(User) user_style_tw...
Address
python
python-pillow__Pillow
Tests/test_imagefile.py
{ "start": 8113, "end": 8396 }
class ____(ImageFile.ImageFile): def _open(self) -> None: self.rawmode = "RGBA" self._mode = "RGBA" self._size = (200, 200) self.tile = [ ImageFile._Tile("MOCK", (xoff, yoff, xoff + xsize, yoff + ysize), 32, None) ]
MockImageFile
python
walkccc__LeetCode
solutions/3298. Count Substrings That Can Be Rearranged to Contain a String II/3298.py
{ "start": 0, "end": 661 }
class ____: # Same as 3297. Count Substrings That Can Be Rearranged to Contain a String I def validSubstringCount(self, word1: str, word2: str) -> int: ans = 0 count = collections.Counter(word2) required = len(word2) l = 0 for r, c in enumerate(word1): count[c] -= 1 if count[c] >= 0...
Solution
python
encode__django-rest-framework
tests/test_validators.py
{ "start": 581, "end": 681 }
class ____(models.Model): username = models.CharField(unique=True, max_length=100)
UniquenessModel
python
scrapy__scrapy
tests/test_addons.py
{ "start": 658, "end": 1032 }
class ____: def __init__(self, crawler: Crawler) -> None: super().__init__() self.crawler = crawler self.config = crawler.settings.getdict("MYADDON") @classmethod def from_crawler(cls, crawler: Crawler): return cls(crawler) def update_settings(self, settings): s...
CreateInstanceAddon
python
scipy__scipy
scipy/stats/tests/test_multivariate.py
{ "start": 167354, "end": 179328 }
class ____: @pytest.mark.parametrize("dim", [2, 3, 4, 6]) @pytest.mark.parametrize("size", [None, 1, 5, (5, 4)]) def test_samples(self, dim, size): # test that samples have correct shape and norm 1 rng = np.random.default_rng(2777937887058094419) mu = np.full((dim, ), 1/np.sqrt(dim))...
TestVonMises_Fisher
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 92704, "end": 94325 }
class ____(APITestCase): def setUp(self): super().setUp() self.user = self.create_user(is_staff=False, is_superuser=False) self.org = self.create_organization() self.team = self.create_team(organization=self.org) self.project = self.create_project(name="foo", organization=se...
SetRefsTestCase
python
scipy__scipy
scipy/stats/_discrete_distns.py
{ "start": 55357, "end": 57762 }
class ____(rv_discrete): r"""A Yule-Simon discrete random variable. %(before_notes)s Notes ----- The probability mass function for the `yulesimon` is: .. math:: f(k) = \alpha B(k, \alpha+1) for :math:`k=1,2,3,...`, where :math:`\alpha>0`. Here :math:`B` refers to the `scip...
yulesimon_gen
python
sqlalchemy__sqlalchemy
test/orm/test_options.py
{ "start": 25754, "end": 27301 }
class ____(PathTest, fixtures.DeclarativeMappedTest): # test for regression to #3963 run_setup_mappers = "once" run_inserts = "once" run_deletes = None @classmethod def setup_mappers(cls): Base = cls.DeclarativeBasic class BaseCls(Base): __tablename__ = "basecls" ...
FromSubclassOptionsTest
python
django__django
tests/model_fields/models.py
{ "start": 19126, "end": 19389 }
class ____(models.Model): a = models.IntegerField() a_squared = models.GeneratedField( expression=F("a") * F("a"), output_field=models.IntegerField(), db_persist=True, ) class Meta: abstract = True
GeneratedModelBase
python
doocs__leetcode
solution/2200-2299/2234.Maximum Total Beauty of the Gardens/Solution.py
{ "start": 0, "end": 951 }
class ____: def maximumBeauty( self, flowers: List[int], newFlowers: int, target: int, full: int, partial: int ) -> int: flowers.sort() n = len(flowers) s = list(accumulate(flowers, initial=0)) ans, i = 0, n - bisect_left(flowers, target) for x in range(i, n + 1):...
Solution
python
allegroai__clearml
clearml/backend_api/services/v2_20/projects.py
{ "start": 117203, "end": 119426 }
class ____(Response): """ Response of projects.get_project_tags endpoint. :param tags: The list of unique tag values :type tags: Sequence[str] :param system_tags: The list of unique system tag values. Returned only if 'include_system' is set to 'true' in the request :type system_tags: S...
GetProjectTagsResponse
python
numba__numba
numba/tests/test_parfors.py
{ "start": 4828, "end": 24725 }
class ____(TestCase): """ Base class for testing parfors. Provides functions for compilation and three way comparison between python functions, njit'd functions and parfor njit'd functions. """ _numba_parallel_test_ = False def _compile_this(self, func, sig, **flags): # This method...
TestParforsBase
python
numba__numba
numba/core/annotations/type_annotations.py
{ "start": 984, "end": 11184 }
class ____(object): # func_data dict stores annotation data for all functions that are # compiled. We store the data in the TypeAnnotation class since a new # TypeAnnotation instance is created for each function that is compiled. # For every function that is compiled, we add the type annotation data to...
TypeAnnotation
python
doocs__leetcode
solution/1900-1999/1952.Three Divisors/Solution.py
{ "start": 0, "end": 112 }
class ____: def isThree(self, n: int) -> bool: return sum(n % i == 0 for i in range(2, n)) == 1
Solution
python
huggingface__transformers
src/transformers/models/florence2/modeling_florence2.py
{ "start": 19684, "end": 21703 }
class ____(Florence2VisionPreTrainedModel): def __init__(self, config: Florence2VisionConfig): super().__init__(config) self.config = config self.embed_dim = config.embed_dim self.num_heads = config.num_heads self.num_groups = config.num_groups self.num_stages = len(...
Florence2VisionBackbone
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF053.py
{ "start": 2194, "end": 2268 }
class ____[T](Generic[*_As, _A]): ... from somewhere import APublicTypeVar
C
python
ray-project__ray
python/ray/_private/runtime_env/image_uri.py
{ "start": 4808, "end": 5923 }
class ____(RuntimeEnvPlugin): """Starts worker in a container of a custom image.""" name = "image_uri" @staticmethod def get_compatible_keys(): return {"image_uri", "config", "env_vars"} def __init__(self, ray_tmp_dir: str): self._ray_tmp_dir = ray_tmp_dir async def create( ...
ImageURIPlugin
python
doocs__leetcode
solution/3500-3599/3503.Longest Palindrome After Substring Concatenation I/Solution.py
{ "start": 0, "end": 968 }
class ____: def longestPalindrome(self, s: str, t: str) -> int: def expand(s: str, g: List[int], l: int, r: int): while l >= 0 and r < len(s) and s[l] == s[r]: g[l] = max(g[l], r - l + 1) l, r = l - 1, r + 1 def calc(s: str) -> List[int]: n = ...
Solution
python
doocs__leetcode
solution/1800-1899/1886.Determine Whether Matrix Can Be Obtained By Rotation/Solution2.py
{ "start": 0, "end": 262 }
class ____: def findRotation(self, mat: List[List[int]], target: List[List[int]]) -> bool: for _ in range(4): mat = [list(col) for col in zip(*mat[::-1])] if mat == target: return True return False
Solution
python
doocs__leetcode
solution/3600-3699/3690.Split and Merge Array Transformation/Solution.py
{ "start": 0, "end": 854 }
class ____: def minSplitMerge(self, nums1: List[int], nums2: List[int]) -> int: n = len(nums1) target = tuple(nums2) start = tuple(nums1) q = [start] vis = set() vis.add(start) for ans in count(0): t = q q = [] for cur in ...
Solution
python
chroma-core__chroma
chromadb/execution/expression/operator.py
{ "start": 11758, "end": 12003 }
class ____(Where): """Negative regular expression matching""" key: str pattern: str def to_dict(self) -> Dict[str, Any]: return {self.key: {"$not_regex": self.pattern}} # Field proxy for building Where conditions
NotRegex
python
apache__airflow
providers/google/tests/unit/google/cloud/triggers/test_vertex_ai.py
{ "start": 32868, "end": 39624 }
class ____: def test_serialize(self, custom_python_package_training_job_trigger): actual_data = custom_python_package_training_job_trigger.serialize() expected_data = ( "airflow.providers.google.cloud.triggers.vertex_ai.CustomPythonPackageTrainingJobTrigger", { ...
TestCustomPythonPackageTrainingJobTrigger
python
walkccc__LeetCode
solutions/145. Binary Tree Postorder Traversal/145.py
{ "start": 0, "end": 301 }
class ____: def postorderTraversal(self, root: TreeNode | None) -> list[int]: ans = [] def postorder(root: TreeNode | None) -> None: if not root: return postorder(root.left) postorder(root.right) ans.append(root.val) postorder(root) return ans
Solution
python
ray-project__ray
doc/source/serve/doc_code/aws_neuron_core_inference_serve_stable_diffusion.py
{ "start": 940, "end": 2049 }
class ____: def __init__(self): from optimum.neuron import NeuronStableDiffusionXLPipeline compiled_model_id = "aws-neuron/stable-diffusion-xl-base-1-0-1024x1024" self.pipe = NeuronStableDiffusionXLPipeline.from_pretrained( compiled_model_id, device_ids=[0, 1] ) asy...
StableDiffusionV2
python
jina-ai__jina
jina/helper.py
{ "start": 30200, "end": 31016 }
class ____: """The decorator to cache property of a class.""" def __init__(self, func): """ Create the :class:`cached_property`. :param func: Cached function. """ self.func = func def __get__(self, obj, cls): cached_value = obj.__dict__.get(f'CACHED_{self.f...
cached_property
python
pytorch__pytorch
test/functorch/test_eager_transforms.py
{ "start": 110334, "end": 122506 }
class ____(TestCase): def test_deprecation_vmap(self, device): # functorch version of the API is deprecated with self.assertWarnsRegex(FutureWarning, "Please use `torch.vmap`"): vmap(torch.sin) # the non-functorch version is not deprecated with warnings.catch_warnings():...
TestComposability
python
pypa__warehouse
tests/unit/test_views.py
{ "start": 13699, "end": 14518 }
class ____: def test_index(self, db_request): project = ProjectFactory.create() release1 = ReleaseFactory.create(project=project) release1.created = datetime.date(2011, 1, 1) release2 = ReleaseFactory.create(project=project) release2.created = datetime.date(2012, 1, 1) ...
TestIndex
python
kamyu104__LeetCode-Solutions
Python/check-if-all-the-integers-in-a-range-are-covered.py
{ "start": 1035, "end": 1325 }
class ____(object): def isCovered(self, ranges, left, right): """ :type ranges: List[List[int]] :type left: int :type right: int :rtype: bool """ return all(any(l <= i <= r for l, r in ranges) for i in xrange(left, right+1))
Solution3
python
tiangolo__fastapi
tests/test_pydantic_v1_v2_multifile/modelsv2b.py
{ "start": 65, "end": 115 }
class ____(BaseModel): dup_sub_name: str
SubItem
python
facebookresearch__faiss
tests/test_refine.py
{ "start": 4613, "end": 6261 }
class ____(unittest.TestCase): def do_test(self, factory_string): d = 32 radius = 8 ds = datasets.SyntheticDataset(d, 1024, 512, 256) index = faiss.index_factory(d, factory_string) index.train(ds.get_train()) index.add(ds.get_database()) xq = ds.get_queries...
TestIndexRefineRangeSearch
python
doocs__leetcode
lcof2/剑指 Offer II 119. 最长连续序列/Solution2.py
{ "start": 0, "end": 306 }
class ____: def longestConsecutive(self, nums: List[int]) -> int: s = set(nums) ans = 0 for x in nums: if x - 1 not in s: y = x + 1 while y in s: y += 1 ans = max(ans, y - x) return ans
Solution
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-lancedb/tests/test_vector_stores_lancedb.py
{ "start": 888, "end": 12714 }
class ____(MockEmbedding): async def _aget_text_embedding(self, text: str) -> list[float]: if text == "test1": return [0.1, 0.2, 0.3] elif text == "test2": return [0.4, 0.5, 0.7] elif text == "test3": return [0.6, 0.2, 0.1] return self._get_vector(...
TmpMockEmbedding
python
readthedocs__readthedocs.org
readthedocs/config/models.py
{ "start": 426, "end": 789 }
class ____(BaseModel): """ Base class for all the models used in the configuration object. Useful to define common configuration options for all the models. """ model_config = ConfigDict( # Don't allow extra fields in the models. # It will raise an error if there are extra fields. ...
ConfigBaseModel
python
redis__redis-py
redis/multidb/healthcheck.py
{ "start": 4124, "end": 5356 }
class ____(AbstractHealthCheckPolicy): """ Policy that returns True if at least one health check probe is successful. """ def __init__(self, health_check_probes: int, health_check_delay: float): super().__init__(health_check_probes, health_check_delay) def execute(self, health_checks: List...
HealthyAnyPolicy
python
bottlepy__bottle
test/test_importhook.py
{ "start": 70, "end": 1290 }
class ____(unittest.TestCase): def make_module(self, name, **args): mod = sys.modules.setdefault(name, bottle.new_module(name)) mod.__file__ = '<virtual %s>' % name mod.__dict__.update(**args) return mod def test_direkt_import(self): mod = self.make_module('bottle_test'...
TestImportHooks
python
huggingface__transformers
tests/models/eomt/test_modeling_eomt.py
{ "start": 3741, "end": 9222 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (EomtForUniversalSegmentation,) if is_torch_available() else () pipeline_model_mapping = {"image-segmentation": EomtForUniversalSegmentation} if is_torch_available() else {} is_encoder_decoder = False test_missing...
EomtForUniversalSegmentationTest
python
python__mypy
mypy/checker.py
{ "start": 392623, "end": 403043 }
class ____(TransformVisitor): def __init__(self, map: dict[TypeVarId, Type]) -> None: super().__init__() self.map = map def type(self, type: Type) -> Type: return expand_type(type, self.map) def are_argument_counts_overlapping(t: CallableType, s: CallableType) -> bool: """Can a si...
TypeTransformVisitor
python
eth-brownie__brownie
brownie/network/middlewares/ganache7.py
{ "start": 195, "end": 2056 }
class ____(BrownieMiddlewareABC): @classmethod def get_layer(cls, w3: Web3, network_type: str) -> Optional[int]: return -100 if w3.client_version.lower().startswith("ganache/v7") else None def process_request( self, make_request: Callable, method: RPCEndpoint, params...
Ganache7MiddleWare
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/elements.py
{ "start": 177693, "end": 177840 }
class ____(Executable, ClauseElement): __visit_name__ = "identified" def __init__(self, ident): self.ident = ident
_IdentifiedClause
python
keras-team__keras
keras/src/ops/nn.py
{ "start": 16125, "end": 17126 }
class ____(Operation): def __init__(self, alpha=1.0, *, name=None): super().__init__(name=name) self.alpha = alpha def call(self, x): return backend.nn.celu(x, self.alpha) def compute_output_spec(self, x): return KerasTensor(x.shape, dtype=x.dtype) @keras_export(["keras.o...
Celu
python
allegroai__clearml
clearml/backend_api/services/v2_23/queues.py
{ "start": 57426, "end": 58854 }
class ____(Response): """ Response of queues.get_default endpoint. :param id: Queue id :type id: str :param name: Queue name :type name: str """ _service = "queues" _action = "get_default" _version = "2.23" _schema = { "definitions": {}, "properties": { ...
GetDefaultResponse
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__init__.py
{ "start": 3586, "end": 5198 }
class ____(Trick): """Starts a long-running subprocess and restarts it on matched events. The command parameter is a list of command arguments, such as ['bin/myserver', '-c', 'etc/myconfig.ini']. Call start() after creating the Trick. Call stop() when stopping the process. """ def __init...
AutoRestartTrick
python
huggingface__transformers
src/transformers/models/sam/modeling_sam.py
{ "start": 46308, "end": 47126 }
class ____(SamPreTrainedModel): config: SamVisionConfig main_input_name = "pixel_values" def __init__(self, config: SamVisionConfig): super().__init__(config) self.vision_encoder = SamVisionEncoder(config) self.post_init() def get_input_embeddings(self) -> nn.Module: re...
SamVisionModel
python
RaRe-Technologies__gensim
gensim/test/test_text_analysis.py
{ "start": 292, "end": 3735 }
class ____: class TextAnalyzerTestBase(unittest.TestCase): texts = [ ['this', 'is', 'a'], ['test', 'document'], ['this', 'test', 'document'], ['test', 'test', 'this'] ] token2id = { 'this': 10, 'is': 15, 'a'...
BaseTestCases
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride3.py
{ "start": 446, "end": 490 }
class ____: def func1(self) -> int: ...
B1
python
run-llama__llama_index
llama-index-core/llama_index/core/node_parser/text/code.py
{ "start": 525, "end": 7102 }
class ____(TextSplitter): """ Split code using a AST parser. Thank you to Kevin Lu / SweepAI for suggesting this elegant code splitting solution. https://docs.sweep.dev/blogs/chunking-2m-files """ language: str = Field( description="The programming language of the code being split." ...
CodeSplitter
python
airbytehq__airbyte
airbyte-integrations/connectors/source-outbrain-amplify/source_outbrain_amplify/source.py
{ "start": 6673, "end": 8798 }
class ____(OutbrainAmplifyStream, HttpSubStream): primary_key = None def __init__(self, authenticator, config, parent: CampaignsByMarketers, **kwargs): super().__init__(parent=parent, **kwargs) self.config = config self._authenticator = authenticator self._session = requests.ses...
CampaignsGeoLocation
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol16.py
{ "start": 212, "end": 475 }
class ____(Protocol): def execute(self, stmt: Any, *args: Any, **kwargs: Any) -> None: ... def func1(arg: Session) -> None: ... def func2(x: CoolSession): # This should generate an error because "statement" and "stmt" don't match. func1(x)
CoolSession
python
pytorch__pytorch
torch/cuda/_sanitizer.py
{ "start": 22374, "end": 24179 }
class ____: """Manages the lifetime of a CUDASanitizer dispatch mode object. The CUDASanitizer class wraps the entering/exiting functions of the dispatch mode context manager in the enable function/destructor, respectively. This is to explicitly set the lifetime of the dispatch mode object to that of t...
CUDASanitizer
python
walkccc__LeetCode
solutions/770. Basic Calculator IV/770.py
{ "start": 1848, "end": 3775 }
class ____: def basicCalculatorIV( self, expression: str, evalvars: list[str], evalints: list[int], ) -> list[str]: tokens = list(self._getTokens(expression)) evalMap = {a: b for a, b in zip(evalvars, evalints)} for i, token in enumerate(tokens): if token in evalMap: ...
Solution
python
numpy__numpy
numpy/_core/_exceptions.py
{ "start": 945, "end": 1446 }
class ____(UFuncTypeError): """ Thrown when a ufunc loop cannot be found """ def __init__(self, ufunc, dtypes): super().__init__(ufunc) self.dtypes = tuple(dtypes) def __str__(self): return ( f"ufunc {self.ufunc.__name__!r} did not contain a loop with signature " ...
_UFuncNoLoopError
python
Netflix__metaflow
metaflow/exception.py
{ "start": 4059, "end": 4137 }
class ____(MetaflowException): headline = "Invalid command"
CommandException
python
openai__openai-python
tests/api_resources/beta/threads/test_runs.py
{ "start": 21999, "end": 44806 }
class ____: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @parametrize async def test_method_create_overload_1(self, async_client: AsyncOpenAI) -> None: with pytest.warns(DeprecationW...
TestAsyncRuns
python
django-crispy-forms__django-crispy-forms
crispy_forms/layout.py
{ "start": 3583, "end": 4833 }
class ____(LayoutObject): """ Form Layout. It is conformed by Layout objects: `Fieldset`, `Row`, `Column`, `MultiField`, `HTML`, `ButtonHolder`, `Button`, `Hidden`, `Reset`, `Submit` and fields. Form fields have to be strings. Layout objects `Fieldset`, `Row`, `Column`, `MultiField` and `ButtonHolde...
Layout
python
getsentry__sentry
src/sentry/api/bases/project.py
{ "start": 4039, "end": 4341 }
class ____(ProjectPermission): scope_map = { "GET": ["project:read", "project:write", "project:admin"], "POST": ["project:write", "project:admin"], "PUT": ["project:read", "project:write", "project:admin"], "DELETE": ["project:admin"], }
ProjectOwnershipPermission
python
python-pillow__Pillow
src/PIL/ImageMode.py
{ "start": 369, "end": 2395 }
class ____(NamedTuple): """Wrapper for mode strings.""" mode: str bands: tuple[str, ...] basemode: str basetype: str typestr: str def __str__(self) -> str: return self.mode @lru_cache def getmode(mode: str) -> ModeDescriptor: """Gets a mode descriptor for the given mode.""" ...
ModeDescriptor
python
tensorflow__tensorflow
tensorflow/python/eager/monitoring.py
{ "start": 12898, "end": 13508 }
class ____(Buckets): """Exponential bucketing strategy. Sets up buckets of the form: [-DBL_MAX, ..., scale * growth^i, scale * growth_factor^(i + 1), ..., DBL_MAX]. """ __slots__ = [] def __init__(self, scale, growth_factor, bucket_count): """Creates a new exponential Buckets. Args: ...
ExponentialBuckets
python
dagster-io__dagster
python_modules/dagster/dagster/_core/execution/asset_backfill.py
{ "start": 3342, "end": 3465 }
class ____(Enum): IN_PROGRESS = "IN_PROGRESS" MATERIALIZED = "MATERIALIZED" FAILED = "FAILED"
AssetBackfillStatus
python
pikepdf__pikepdf
src/pikepdf/models/image.py
{ "start": 29697, "end": 32339 }
class ____(PdfImage): """Support class for JPEG 2000 images. Implements the same API as :class:`PdfImage`. If you call PdfImage(object_that_is_actually_jpeg2000_image), pikepdf will return this class instead, due to the check in PdfImage.__new__. """ def __init__(self, obj): """Initialize ...
PdfJpxImage
python
sympy__sympy
sympy/stats/crv_types.py
{ "start": 94149, "end": 96337 }
class ____(SingleContinuousDistribution): _argnames = ('a', 'b') @property def set(self): return Interval(self.a, self.b) @staticmethod def check(a, b): _value_check(b > a, "Parameter b must be in range (%s, oo)."%(a)) def pdf(self, x): a, b = self.a, self.b al...
QuadraticUDistribution
python
python__mypy
mypy/nodes.py
{ "start": 69655, "end": 70307 }
class ____(RefExpr): """Member access expression x.y""" __slots__ = ("expr", "name", "def_var") __match_args__ = ("expr", "name", "node") def __init__(self, expr: Expression, name: str) -> None: super().__init__() self.expr = expr self.name = name # The variable node r...
MemberExpr
python
astropy__astropy
astropy/modeling/core.py
{ "start": 117240, "end": 183841 }
class ____(Model): """ Base class for compound models. While it can be used directly, the recommended way to combine models is through the model operators. """ def __init__(self, op, left, right, name=None, *, unit_change_composition=False): self.__dict__["_param_names"] = None ...
CompoundModel
python
coleifer__peewee
tests/sqlite.py
{ "start": 87587, "end": 90038 }
class ____(ModelTestCase): database = get_in_memory_db() requires = [Datum] def test_collated_fields(self): rows = ( (1, 'abc', 'abc', 'abc ', 'abc'), (2, 'abc', 'abc', 'abc', 'ABC'), (3, 'abc', 'abc', 'abc ', 'Abc'), (4, 'abc', 'abc ', 'ABC', ...
TestCollatedFieldDefinitions
python
doocs__leetcode
solution/2900-2999/2974.Minimum Number Game/Solution2.py
{ "start": 0, "end": 209 }
class ____: def numberGame(self, nums: List[int]) -> List[int]: nums.sort() for i in range(0, len(nums), 2): nums[i], nums[i + 1] = nums[i + 1], nums[i] return nums
Solution
python
huggingface__transformers
tests/test_tokenizers_backend_mixin.py
{ "start": 506, "end": 24576 }
class ____: """ Tests that specifically test the tokenizers-backend. These tests don't need to be run for every model, just once to verify the backend works correctly. """ tokenizer_class = None rust_tokenizer_class = None from_pretrained_id = None from_pretrained_kwargs = None @cl...
TokenizersBackendTesterMixin
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_U.py
{ "start": 80, "end": 1090 }
class ____(Benchmark): r""" Ursem 1 objective function. This class defines the Ursem 1 [1]_ global optimization problem. This is a unimodal minimization problem defined as follows: .. math:: f_{\text{Ursem01}}(x) = - \sin(2x_1 - 0.5 \pi) - 3 \cos(x_2) - 0.5 x_1 with :math:`x_1 \in [...
Ursem01
python
cython__cython
Cython/Compiler/PyrexTypes.py
{ "start": 15606, "end": 25277 }
class ____(BaseType): # # Pseudo-type defined with a ctypedef statement in a # 'cdef extern from' block. # Delegates most attribute lookups to the base type. # (Anything not defined here or in the BaseType is delegated.) # # qualified_name string # typedef_name string ...
CTypedefType
python
django__django
tests/utils_tests/test_encoding.py
{ "start": 4909, "end": 8768 }
class ____(unittest.TestCase): def test_filepath_to_uri(self): self.assertIsNone(filepath_to_uri(None)) self.assertEqual( filepath_to_uri("upload\\чубака.mp4"), "upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4", ) self.assertEqual(filepath_to_uri(Path("upload/...
TestRFC3987IEncodingUtils
python
doocs__leetcode
solution/3500-3599/3556.Sum of Largest Prime Substrings/Solution.py
{ "start": 0, "end": 475 }
class ____: def sumOfLargestPrimes(self, s: str) -> int: def is_prime(x: int) -> bool: if x < 2: return False return all(x % i for i in range(2, int(sqrt(x)) + 1)) st = set() n = len(s) for i in range(n): x = 0 for j in...
Solution
python
django__django
tests/forms_tests/field_tests/test_typedmultiplechoicefield.py
{ "start": 158, "end": 3696 }
class ____(SimpleTestCase): def test_typedmultiplechoicefield_1(self): f = TypedMultipleChoiceField(choices=[(1, "+1"), (-1, "-1")], coerce=int) self.assertEqual([1], f.clean(["1"])) msg = "'Select a valid choice. 2 is not one of the available choices.'" with self.assertRaisesMessage...
TypedMultipleChoiceFieldTest
python
lxml__lxml
src/lxml/tests/dummy_http_server.py
{ "start": 1126, "end": 1624 }
class ____(wsgiserver.WSGIRequestHandler): def get_stderr(self): # don't write to stderr return sys.stdout def log_message(self, format, *args): # message = "wsmock(%s) %s" % (self.address_string(), format % args) pass # don't log messages def build_web_server(app, port, host...
_RequestHandler
python
Textualize__textual
src/textual/widgets/_footer.py
{ "start": 3646, "end": 3755 }
class ____(Label): """Text displayed in the footer (used by binding groups).""" @rich.repr.auto
FooterLabel
python
kamyu104__LeetCode-Solutions
Python/sum-of-beautiful-subsequences.py
{ "start": 2093, "end": 2957 }
class ____(object): def totalBeauty(self, nums): """ :type nums: List[int] :rtype: int """ def count(arr): val_to_idx = {x:i for i, x in enumerate(sorted(set(arr)))} # coordinate compression bit = BIT(len(val_to_idx)) for x in arr: ...
Solution2