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": 964354, "end": 964634 }
class ____(sgqlc.types.Type): """A GitHub Security Advisory Reference""" __schema__ = github_schema __field_names__ = ("url",) url = sgqlc.types.Field(sgqlc.types.non_null(URI), graphql_name="url") """A publicly accessible reference"""
SecurityAdvisoryReference
python
celery__celery
t/unit/backends/test_base.py
{ "start": 1584, "end": 1744 }
class ____: def test_nulldict(self): x = _nulldict() x['foo'] = 1 x.update(foo=1, bar=2) x.setdefault('foo', 3)
test_nulldict
python
xlwings__xlwings
xlwings/constants.py
{ "start": 122128, "end": 122296 }
class ____: xlThemeFontMajor = 1 # from enum XlThemeFont xlThemeFontMinor = 2 # from enum XlThemeFont xlThemeFontNone = 0 # from enum XlThemeFont
ThemeFont
python
keras-team__keras
keras/src/saving/saving_api_test.py
{ "start": 4262, "end": 7837 }
class ____(test_case.TestCase): def get_model(self, dtype=None): return Sequential( [ layers.Dense(5, input_shape=(3,), dtype=dtype), layers.Softmax(), ] ) @parameterized.named_parameters( [ {"testcase_name": "bfloat16"...
LoadModelTests
python
pennersr__django-allauth
tests/apps/socialaccount/providers/tumblr_oauth2/tests.py
{ "start": 253, "end": 1121 }
class ____(OAuth2TestsMixin, TestCase): provider_id = TumblrOAuth2Provider.id def get_mocked_response(self): return [ MockedResponse( HTTPStatus.OK, """ { "meta": { "status": 200, "msg": "OK" }, "response": { "user": { "follow...
TumblrTests
python
wandb__wandb
wandb/sdk/lib/retry.py
{ "start": 10980, "end": 12026 }
class ____(Backoff): """Jittered exponential backoff: sleep times increase ~exponentially up to some limit.""" def __init__( self, initial_sleep: datetime.timedelta, max_sleep: datetime.timedelta, max_retries: Optional[int] = None, timeout_at: Optional[datetime.datetime]...
ExponentialBackoff
python
scipy__scipy
scipy/linalg/tests/test_fblas.py
{ "start": 4590, "end": 4740 }
class ____(BaseScal): blas_func = fblas.zscal dtype = complex128 ################################################## # Test blas ?copy
TestZscal
python
django__django
tests/annotations/models.py
{ "start": 2029, "end": 2233 }
class ____(models.Model): data = models.JSONField(default=dict, blank=True) id = models.IntegerField(primary_key=True) class Meta: required_db_features = {"supports_json_field"}
JsonModel
python
kamyu104__LeetCode-Solutions
Python/minimum-sum-of-four-digit-number-after-splitting-digits.py
{ "start": 1141, "end": 1419 }
class ____(object): def minimumSum(self, num): """ :type num: int :rtype: int """ nums = sorted(map(int, list(str(num)))) a = b = 0 for x in nums: a = a*10+x a, b = b, a return a+b
Solution2
python
scipy__scipy
benchmarks/benchmarks/test_functions.py
{ "start": 294, "end": 517 }
class ____: def fun(self, x): return np.dot(x, x) + x[0] def der(self, x): d = 2. * x d[0] += 1 return d def hess(self, x): return 2. * np.eye(x.size)
AsymmetricQuadratic
python
dagster-io__dagster
python_modules/automation/python_modules/automation/automation_tests/dagster_dev_tests/ai_review_tests/test_ai_review_cache_comprehensive.py
{ "start": 180, "end": 16108 }
class ____: """Comprehensive test coverage for ai-review-cache command.""" def test_import_and_basic_structure(self): """Test that command can be imported and has expected structure.""" from automation.dagster_dev.commands.ai_review_cache import ai_review_cache assert ai_review_cache i...
TestAiReviewCacheComprehensive
python
python-openxml__python-docx
src/docx/oxml/text/font.py
{ "start": 726, "end": 1007 }
class ____(BaseOxmlElement): """`w:color` element, specifying the color of a font and perhaps other objects.""" val: RGBColor | str = RequiredAttribute("w:val", ST_HexColor) themeColor: MSO_THEME_COLOR | None = OptionalAttribute("w:themeColor", MSO_THEME_COLOR)
CT_Color
python
tensorflow__tensorflow
tensorflow/python/ops/weak_tensor_math_ops_test.py
{ "start": 11963, "end": 12766 }
class ____(test_util.TensorFlowTestCase): allowed_dtypes = [dtypes.float32, dtypes.float64, dtypes.complex128] def testBasic(self): for dtype in self.allowed_dtypes: x = _get_weak_tensor([1.0, 2.0, 0.0, 4.0], dtype=dtype) y = math_ops.reciprocal_no_nan(x) target = _get_weak_tensor([1.0, 0....
ReciprocalNoNanTest
python
realpython__materials
python-inherit-list-userlist/custom_list1.py
{ "start": 0, "end": 384 }
class ____(list): def join(self, separator=" "): return separator.join(str(item) for item in self) def map(self, action): return type(self)(action(item) for item in self) def filter(self, predicate): return type(self)(item for item in self if predicate(item)) def for_each(self...
CustomList
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 183157, "end": 183737 }
class ____(Operation): def call(self, x): return backend.numpy.sign(x) def compute_output_spec(self, x): sparse = getattr(x, "sparse", False) return KerasTensor(x.shape, dtype=x.dtype, sparse=sparse) @keras_export(["keras.ops.sign", "keras.ops.numpy.sign"]) def sign(x): """Returns...
Sign
python
scipy__scipy
scipy/stats/tests/test_distributions.py
{ "start": 126925, "end": 127785 }
class ____: def setup_method(self): self.rng = np.random.default_rng(2444103536) def test_rvs(self): vals = stats.zipf.rvs(1.5, size=(2, 50), random_state=self.rng) assert np.all(vals >= 1) assert np.shape(vals) == (2, 50) assert vals.dtype.char in typecodes['AllInteger'...
TestZipf
python
doocs__leetcode
solution/1600-1699/1616.Split Two Strings to Make Palindrome/Solution.py
{ "start": 0, "end": 451 }
class ____: def checkPalindromeFormation(self, a: str, b: str) -> bool: def check1(a: str, b: str) -> bool: i, j = 0, len(b) - 1 while i < j and a[i] == b[j]: i, j = i + 1, j - 1 return i >= j or check2(a, i, j) or check2(b, i, j) def check2(a: st...
Solution
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 42313, "end": 43095 }
class ____(Operation): def call(self, x): return backend.numpy.bartlett(x) def compute_output_spec(self, x): return KerasTensor(x.shape, dtype=backend.floatx()) @keras_export(["keras.ops.bartlett", "keras.ops.numpy.bartlett"]) def bartlett(x): """Bartlett window function. The Bartlett...
Bartlett
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/libtool_deletion/package.py
{ "start": 221, "end": 637 }
class ____(autotools.AutotoolsPackage): """Mock AutotoolsPackage to check proper deletion of libtool archives. """ homepage = "https://www.gnu.org/software/make/" url = "http://www.example.com/libtool-deletion-1.0.tar.gz" version("4.2.1", sha256="e40b8f018c1da64edd1cc9a6fce5fa63b2e707e404e20cad...
LibtoolDeletion
python
pytorch__pytorch
test/test_meta.py
{ "start": 37979, "end": 44568 }
class ____(torch.utils._python_dispatch.TorchDispatchMode): test_case: TestCase device: torch.device dtype: torch.dtype aten_olp_no_out_overload: set = set() def __init__(self, test_case, *, device, dtype, symbolic_meta: bool, inplace: bool, supports_out: bool): self.test_case = test_case ...
MetaCrossRefDispatchMode
python
langchain-ai__langchain
libs/langchain/tests/unit_tests/chains/test_base.py
{ "start": 1048, "end": 7090 }
class ____(Chain): """Fake chain class for testing purposes.""" be_correct: bool = True the_input_keys: list[str] = ["foo"] the_output_keys: list[str] = ["bar"] @property def input_keys(self) -> list[str]: """Input keys.""" return self.the_input_keys @property def outp...
FakeChain
python
streamlit__streamlit
lib/tests/streamlit/runtime/state/session_state_test.py
{ "start": 34126, "end": 35691 }
class ____(unittest.TestCase): def test_is_stale_widget_metadata_is_None(self): assert _is_stale_widget(None, {}, {}) def test_is_stale_widget_active_id(self): metadata = WidgetMetadata( id="widget_id_1", deserializer=lambda x: str(x), serializer=lambda x: in...
IsStaleWidgetTests
python
pytorch__pytorch
test/dynamo/test_aot_autograd_cache.py
{ "start": 84419, "end": 93464 }
class ____(torch._dynamo.test_case.TestCase): @property def device_type(self) -> str: return "cuda" if torch.cuda.is_available() else "cpu" def default_config(self): return AOTConfig( fw_compiler=None, bw_compiler=None, inference_compiler=None, ...
AOTAutogradCachePicklerTests
python
google__jax
jaxlib/mosaic/python/tpu.py
{ "start": 1151, "end": 1580 }
class ____(_tpu_gen.TraceOp): # noqa: F405 """An extension to the automatically generated TraceOp bindings.""" def __init__(self, results, message, level, *, loc=None, ip=None): super().__init__(results, message, level, loc=loc, ip=ip) self.regions[0].blocks.append(*[]) # Append the block. @property ...
TraceOp
python
hynek__structlog
tests/processors/test_renderers.py
{ "start": 3354, "end": 8660 }
class ____: def test_sort_keys(self, event_dict): """ Keys are sorted if sort_keys is set. """ rv = LogfmtRenderer(sort_keys=True)(None, None, event_dict) assert r'a=<A(\o/)> b="[3, 4]" x=7 y=test z="(1, 2)"' == rv def test_order_complete(self, event_dict): """ ...
TestLogfmtRenderer
python
Textualize__textual
src/textual/_segment_tools.py
{ "start": 624, "end": 8708 }
class ____(Exception): pass def index_to_cell_position(segments: Iterable[Segment], index: int) -> int: """Given a character index, return the cell position of that character within an Iterable of Segments. This is the sum of the cell lengths of all the characters *before* the character at `index`. ...
NoCellPositionForIndex
python
scikit-learn__scikit-learn
sklearn/utils/_param_validation.py
{ "start": 18670, "end": 19373 }
class ____(_Constraint): """Constraint representing random states. Convenience class for [Interval(Integral, 0, 2**32 - 1, closed="both"), np.random.RandomState, None] """ def __init__(self): super().__init__() self._constraints = [ Interval(Integral, 0, 2**32 - 1, clos...
_RandomStates
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/memberAccess1.py
{ "start": 1173, "end": 1364 }
class ____(Generic[_T]): value: _T def __get__(self, instance: object | None, cls: type[object]) -> _T: ... def __set__(self, instance: object, value: _T) -> None: ...
DescriptorD
python
django__django
tests/delete_regress/models.py
{ "start": 2051, "end": 2133 }
class ____(models.Model): policy_number = models.CharField(max_length=10)
Policy
python
python__mypy
mypy/suggestions.py
{ "start": 30892, "end": 34297 }
class ____(TypeStrVisitor): """Visitor used to format types""" # TODO: Probably a lot def __init__(self, module: str | None, graph: Graph, options: Options) -> None: super().__init__(options=options) self.module = module self.graph = graph def visit_any(self, t: AnyType) -> str...
TypeFormatter
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 29560, "end": 52432 }
class ____(Module): r"""Allows the model to jointly attend to information from different representation subspaces. This MultiheadAttention layer implements the original architecture described in the `Attention Is All You Need <https://arxiv.org/abs/1706.03762>`_ paper. The intent of this layer is as a ...
MultiheadAttention
python
spyder-ide__spyder
external-deps/spyder-kernels/spyder_kernels/utils/iofuncs.py
{ "start": 901, "end": 17648 }
class ____(dict): """ Matlab style struct, enhanced. Supports dictionary and attribute style access. Can be pickled, and supports code completion in a REPL. Examples ======== >>> from spyder_kernels.utils.iofuncs import MatlabStruct >>> a = MatlabStruct() >>> a.b = 'spam' # a["b"...
MatlabStruct
python
getsentry__sentry
fixtures/safe_migrations_apps/safe_run_sql_app/migrations/0001_initial.py
{ "start": 153, "end": 659 }
class ____(CheckedMigration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="TestTable", fields=[ ( "id", models.AutoField( auto_created=True, ...
Migration
python
pyca__cryptography
src/cryptography/hazmat/primitives/asymmetric/ec.py
{ "start": 8998, "end": 9151 }
class ____(EllipticCurve): name = "secp224r1" key_size = 224 group_order = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D
SECP224R1
python
google__pytype
pytype/pytd/pytd_visitors.py
{ "start": 2634, "end": 3042 }
class ____(base_visitor.Visitor): """Visitor that accumulates type parameters in its "params" attribute.""" def __init__(self): super().__init__() self._seen = set() self.params = [] def EnterTypeParameter(self, p): if p.name not in self._seen: self.params.append(p) self._seen.add(p....
CollectTypeParameters
python
pytorch__pytorch
test/jit/test_tracer.py
{ "start": 1176, "end": 72485 }
class ____(JitTestCase): @unittest.skipIf(not RUN_CUDA, "requires CUDA") def test_large_nbr_kernel_args(self): class Recurrence(nn.Module): def __init__(self, seq_len): super().__init__() self.seq_len = seq_len def forward(self, input): ...
TestTracer
python
great-expectations__great_expectations
tests/metrics/test_metric.py
{ "start": 1635, "end": 2001 }
class ____: @pytest.mark.unit def test_instantiation_success(self): ColumnValuesAbove( column=COLUMN, min_value=42, ) @pytest.mark.unit def test_instantiation_missing_domain_parameters_raises(self): with pytest.raises(ValidationError): ColumnV...
TestMetricInstantiation
python
coleifer__peewee
tests/transactions.py
{ "start": 875, "end": 7365 }
class ____(BaseTransactionTestCase): def test_simple(self): self.assertFalse(db.in_transaction()) with db.atomic(): self.assertTrue(db.in_transaction()) self._save(1) self.assertFalse(db.in_transaction()) self.assertRegister([1]) # Explicit rollback,...
TestTransaction
python
jazzband__prettytable
tests/test_prettytable.py
{ "start": 6469, "end": 8242 }
class ____: def test_delete_column(self, col_prettytable: PrettyTable) -> None: col_prettytable.del_column("Area") assert ( col_prettytable.get_string() == """+-----------+------------+-----------------+ | City name | Population | Annual Rainfall | +-----------+------------+...
TestDelete
python
Pylons__pyramid
tests/test_traversal.py
{ "start": 32986, "end": 35919 }
class ____(unittest.TestCase): def _makeOne(self, context, url): return self._getTargetClass()(context, url) def _getTargetClass(self): from pyramid.traversal import ResourceURL return ResourceURL def test_instance_conforms_to_IResourceURL(self): from zope.interface.verify...
ResourceURLTests
python
pytorch__pytorch
torch/cuda/_utils.py
{ "start": 10466, "end": 19139 }
class ____: """ Represents a compiled CUDA kernel that can be called with PyTorch tensors. """ def __init__(self, func: ctypes.c_void_p, module: ctypes.c_void_p) -> None: self.func = func self.module = module self._max_shared_mem_bytes = 0 def __call__( self, ...
_CudaKernel
python
doocs__leetcode
lcof/ι’θ―•ι’˜49. δΈ‘ζ•°/Solution2.py
{ "start": 0, "end": 437 }
class ____: def nthUglyNumber(self, n: int) -> int: dp = [1] * n p2 = p3 = p5 = 0 for i in range(1, n): next2, next3, next5 = dp[p2] * 2, dp[p3] * 3, dp[p5] * 5 dp[i] = min(next2, next3, next5) if dp[i] == next2: p2 += 1 if dp[i...
Solution
python
python__mypy
mypy/suggestions.py
{ "start": 2387, "end": 2473 }
class ____(TypedDict): return_type: str arg_types: list[str]
PyAnnotateSignature
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 877927, "end": 878325 }
class ____(sgqlc.types.Type): """An edge in a connection.""" __schema__ = github_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node = sgqlc.types.Field("PullRequestReview", graph...
PullRequestReviewEdge
python
doocs__leetcode
solution/1400-1499/1499.Max Value of Equation/Solution2.py
{ "start": 0, "end": 432 }
class ____: def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int: ans = -inf q = deque() for x, y in points: while q and x - q[0][0] > k: q.popleft() if q: ans = max(ans, x + y + q[0][1] - q[0][0]) while ...
Solution
python
getsentry__sentry
src/sentry/ratelimits/redis.py
{ "start": 790, "end": 4450 }
class ____(RateLimiter): def __init__(self, **options: Any) -> None: cluster_key = settings.SENTRY_RATE_LIMIT_REDIS_CLUSTER self.client = redis.redis_clusters.get(cluster_key) def _construct_redis_key( self, key: str, project: Project | None = None, window: int |...
RedisRateLimiter
python
kamyu104__LeetCode-Solutions
Python/find-maximum-number-of-non-intersecting-substrings.py
{ "start": 51, "end": 448 }
class ____(object): def maxSubstrings(self, word): """ :type word: str :rtype: int """ L = 4 result = 0 lookup = {} for i, c in enumerate(word): if c not in lookup: lookup[c] = i elif i-lookup[c]+1 >= L: ...
Solution
python
readthedocs__readthedocs.org
readthedocs/api/v3/views.py
{ "start": 10456, "end": 12191 }
class ____( APIv3Settings, NestedViewSetMixin, ProjectQuerySetMixin, FlexFieldsMixin, CreateModelMixin, DestroyModelMixin, ReadOnlyModelViewSet, ): # The main query is done via the ``NestedViewSetMixin`` using the # ``parents_query_lookups`` defined when registering the urls. mo...
SubprojectRelationshipViewSet
python
sphinx-doc__sphinx
sphinx/ext/autodoc/_legacy_class_based/_documenters.py
{ "start": 76373, "end": 77996 }
class ____(DataDocumenterMixinBase): """Mixin for DataDocumenter to provide the feature for supporting uninitialized (type annotation only) global variables. """ def import_object(self, raiseerror: bool = False) -> bool: try: return super().import_object(raiseerror=True) # type: ig...
UninitializedGlobalVariableMixin
python
dagster-io__dagster
python_modules/libraries/dagster-aws/dagster_aws/redshift/resources.py
{ "start": 798, "end": 9056 }
class ____(BaseRedshiftClient): def __init__(self, conn_args: dict[str, Any], autocommit: Optional[bool], log: Logger): # Extract parameters from resource config self.conn_args = conn_args self.autocommit = autocommit self.log = log def execute_query(self, query, fetch_results=...
RedshiftClient
python
pikepdf__pikepdf
tests/test_pdf.py
{ "start": 4440, "end": 5812 }
class ____: def test_stream(self, resources): with (resources / 'pal-1bit-trivial.pdf').open('rb') as stream: with Pdf.open(stream) as pdf: assert pdf.Root.Pages.Count == 1 def test_no_text_stream(self, resources): with pytest.raises(TypeError): with (res...
TestStreams
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 169144, "end": 174471 }
class ____(rv_continuous): r"""A Normal Inverse Gaussian continuous random variable. %(before_notes)s Notes ----- The probability density function for `norminvgauss` is: .. math:: f(x, a, b) = \frac{a \, K_1(a \sqrt{1 + x^2})}{\pi \sqrt{1 + x^2}} \, \exp(\sqrt{a^...
norminvgauss_gen
python
dagster-io__dagster
python_modules/libraries/dagster-pandas/dagster_pandas/constraints.py
{ "start": 14165, "end": 15724 }
class ____(DataFrameConstraint): """A dataframe constraint that validates the expected count of rows. Args: num_allowed_rows (int): The number of allowed rows in your dataframe. error_tolerance (Optional[int]): The acceptable threshold if you are not completely certain. Defaults to 0. """ ...
RowCountConstraint
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/metadata.py
{ "start": 1719, "end": 1924 }
class ____(graphene.ObjectType): jsonString = graphene.NonNull(graphene.String) class Meta: interfaces = (GrapheneMetadataEntry,) name = "JsonMetadataEntry"
GrapheneJsonMetadataEntry
python
airbytehq__airbyte
airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py
{ "start": 10483, "end": 13132 }
class ____(GoogleAdsStream): """ Customer Client stream: https://developers.google.com/google-ads/api/fields/v20/customer_client """ primary_key = ["customer_client.id"] def __init__(self, customer_status_filter: List[str], **kwargs): self.customer_status_filter = customer_status_filter ...
CustomerClient
python
ray-project__ray
doc/source/serve/doc_code/app_builder.py
{ "start": 1383, "end": 1663 }
class ____(BaseModel): model1_uri: str model2_uri: str def composed_app_builder(args: ComposedArgs) -> Application: return IngressDeployment.bind( Model1.bind(args.model1_uri), Model2.bind(args.model2_uri), ) # __end_composed_builder__
ComposedArgs
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 44695, "end": 45859 }
class ____(PipesBlobStoreMessageWriterChannel): """Message writer channel for writing messages by periodically writing message chunks to a GCS bucket. Args: client (google.cloud.storage.Client): A google.cloud.storage.Client object. bucket (str): The name of the GCS bucket to write to. ...
PipesGCSMessageWriterChannel
python
optuna__optuna
optuna/exceptions.py
{ "start": 1943, "end": 2135 }
class ____(OptunaError): """Exception for a duplicated study name. This error is raised when a specified study name already exists in the storage. """ pass
DuplicatedStudyError
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/ndb/properties/snippets.py
{ "start": 3072, "end": 3166 }
class ____(messages.Message): notes = messages.MessageField(Note, 1, repeated=True)
Notebook
python
google__jax
jax/_src/pallas/mosaic/sc_primitives.py
{ "start": 28851, "end": 36578 }
class ____(enum.Enum): #: [a0, a1], [b0, b1] -> [[a0, a1], [b0, b1]] COMPRESSED = "compressed" #: [a0, a1], [b0, b1] -> [a0, b0, a1, b1] INTERLEAVED = "interleaved" def _format_to_ir_attribute(format: PackFormat) -> ir.Attribute: return ir.Attribute.parse(f"#tpu.pack_format<{format.value}>") pack_p = jax_...
PackFormat
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 619076, "end": 619742 }
class ____(ExprNode): # Extracts the docstring of the body element subexprs = ['body'] type = py_object_type is_temp = True def __init__(self, pos, body): ExprNode.__init__(self, pos) assert body.type.is_pyobject self.body = body def analyse_types(self, env): r...
DocstringRefNode
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/router/base.py
{ "start": 544, "end": 1657 }
class ____(Chain, ABC): """Chain that outputs the name of a destination chain and the inputs to it.""" @property @override def output_keys(self) -> list[str]: return ["destination", "next_inputs"] def route(self, inputs: dict[str, Any], callbacks: Callbacks = None) -> Route: """Rou...
RouterChain
python
aio-libs__aiohttp
aiohttp/_websocket/models.py
{ "start": 869, "end": 1038 }
class ____(NamedTuple): data: bytes size: int extra: str | None = None type: Literal[WSMsgType.CONTINUATION] = WSMsgType.CONTINUATION
WSMessageContinuation
python
aimacode__aima-python
text.py
{ "start": 14286, "end": 15207 }
class ____(search.Problem): def __init__(self, initial=None, goal=None, decoder=None): super().__init__(initial or hashabledict(), goal) self.decoder = decoder def actions(self, state): search_list = [c for c in self.decoder.chardomain if c not in state] target_list = [c for c ...
PermutationDecoderProblem
python
dask__dask
dask/dataframe/dask_expr/_rolling.py
{ "start": 4888, "end": 4942 }
class ____(RollingReduction): how = "sum"
RollingSum
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/distributions/uniform_test.py
{ "start": 1541, "end": 10453 }
class ____(test.TestCase): @test_util.run_in_graph_and_eager_modes def testUniformRange(self): a = 3.0 b = 10.0 uniform = uniform_lib.Uniform(low=a, high=b) self.assertAllClose(a, self.evaluate(uniform.low)) self.assertAllClose(b, self.evaluate(uniform.high)) self.assertAllClose(b - a, self...
UniformTest
python
getsentry__sentry
tests/relay_integration/lang/java/test_plugin.py
{ "start": 32401, "end": 84922 }
class ____(RelayStoreHelper, TransactionTestCase): @pytest.fixture(autouse=True) def initialize(self, set_sentry_option, live_server): with set_sentry_option("system.url-prefix", live_server.url): # Run test case yield def upload_proguard_mapping(self, uuid, mapping_file_con...
BasicResolvingIntegrationTest
python
urllib3__urllib3
test/test_exceptions.py
{ "start": 2420, "end": 2649 }
class ____: def test_header_parsing_errors(self) -> None: hpe = HeaderParsingError([MessageDefect("defects")], "unparsed_data") assert "defects" in str(hpe) assert "unparsed_data" in str(hpe)
TestFormat
python
bokeh__bokeh
src/bokeh/models/glyphs.py
{ "start": 30439, "end": 32149 }
class ____(Glyph, LineGlyph, FillGlyph, HatchGlyph): ''' Render several MultiPolygon. Modeled on geoJSON - the data for the ``MultiPolygons`` glyph is different in that the vector of values is not a vector of scalars. Rather, it is a "list of lists of lists of lists". During box selection only mul...
MultiPolygons
python
PyCQA__pylint
tests/functional/i/invalid/invalid_str_returned.py
{ "start": 192, "end": 303 }
class ____: """__str__ returns <type 'str'>""" def __str__(self): return "some str"
FirstGoodStr
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 61015, "end": 61617 }
class ____(PrefectFilterBaseModel): """Filter by `BlockDocument.is_anonymous`.""" eq_: Optional[bool] = Field( default=None, description=( "Filter block documents for only those that are or are not anonymous." ), ) def _get_filter_list( self, db: "PrefectDBI...
BlockDocumentFilterIsAnonymous
python
doocs__leetcode
solution/2300-2399/2302.Count Subarrays With Score Less Than K/Solution.py
{ "start": 0, "end": 435 }
class ____: def countSubarrays(self, nums: List[int], k: int) -> int: s = list(accumulate(nums, initial=0)) ans = 0 for i in range(1, len(s)): l, r = 0, i while l < r: mid = (l + r + 1) >> 1 if (s[i] - s[i - mid]) * mid < k: ...
Solution
python
scipy__scipy
scipy/stats/_axis_nan_policy.py
{ "start": 1614, "end": 32644 }
class ____(RuntimeWarning): pass def _broadcast_arrays(arrays, axis=None, xp=None): """ Broadcast shapes of arrays, ignoring incompatibility of specified axes """ arrays = tuple(arrays) if not arrays: return arrays xp = array_namespace(*arrays) if xp is None else xp arrays = [x...
SmallSampleWarning
python
getsentry__sentry
src/sentry/hybridcloud/rpc/sig.py
{ "start": 482, "end": 656 }
class ____(_SerializableFunctionSignatureException): """Indicate that a function signature can't be set up for serialization."""
SerializableFunctionSignatureSetupException
python
getsentry__sentry
src/sentry/api/serializers/models/group_stream.py
{ "start": 9670, "end": 11634 }
class ____(TypedDict): id: str # from base response shareId: NotRequired[str] shortId: NotRequired[str] title: NotRequired[str] culprit: NotRequired[str | None] permalink: NotRequired[str] logger: NotRequired[str | None] level: NotRequired[str] status: NotRequired[str] status...
StreamGroupSerializerSnubaResponse
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_florida_zip.py
{ "start": 742, "end": 1743 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_florida_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _panda...
ColumnValuesToBeValidFloridaZip
python
pytorch__pytorch
tools/test/test_create_alerts.py
{ "start": 1471, "end": 2772 }
class ____(TestCase): # Should fail when jobs are ? ? Fail Fail def test_alert(self) -> None: modified_data: list[Any] = [{}] modified_data.append({}) modified_data.extend(MOCK_TEST_DATA) status = JobStatus(JOB_NAME, modified_data) self.assertTrue(status.should_alert()) ...
TestGitHubPR
python
walkccc__LeetCode
solutions/1712. Ways to Split Array Into Three Subarrays/1712.py
{ "start": 0, "end": 1135 }
class ____: def waysToSplit(self, nums: list[int]) -> int: MOD = 1_000_000_007 n = len(nums) ans = 0 prefix = list(itertools.accumulate(nums)) def firstGreaterEqual(i: int) -> int: """Finds the first index j s.t. Mid = prefix[j] - prefix[i] >= left = prefix[i] """ l = i...
Solution
python
pandas-dev__pandas
pandas/tests/indexes/multi/test_get_level_values.py
{ "start": 174, "end": 4308 }
class ____: def test_get_level_values_box_datetime64(self): dates = date_range("1/1/2000", periods=4) levels = [dates, [0, 1]] codes = [[0, 0, 1, 1, 2, 2, 3, 3], [0, 1, 0, 1, 0, 1, 0, 1]] index = MultiIndex(levels=levels, codes=codes) assert isinstance(index.get_level_value...
TestGetLevelValues
python
has2k1__plotnine
plotnine/scales/scale_color.py
{ "start": 15501, "end": 15558 }
class ____(scale_color_cmap_d): pass
scale_colour_ordinal
python
astropy__astropy
astropy/modeling/powerlaws.py
{ "start": 2136, "end": 4582 }
class ____(Fittable1DModel): """ One dimensional power law model with a break. Parameters ---------- amplitude : float Model amplitude at the break point. x_break : float Break point. alpha_1 : float Power law index for x < x_break. alpha_2 : float Power ...
BrokenPowerLaw1D
python
getsentry__sentry
src/sentry/notifications/migrations/0002_notificationmessage_jsonfield.py
{ "start": 188, "end": 1536 }
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
tensorflow__tensorflow
tensorflow/python/keras/layers/core.py
{ "start": 59322, "end": 60908 }
class ____(Layer): """Wraps an instance property access (e.g. `x.foo`) in a Keras Layer. This layer takes an attribute name `attr_name` in the constructor and, when called on input tensor `obj` returns `obj.attr_name`. KerasTensors specialized for specific extension types use it to represent instance proper...
InstanceProperty
python
getsentry__sentry
src/sentry/apidocs/parameters.py
{ "start": 13852, "end": 15074 }
class ____: DETECTOR_ID = OpenApiParameter( name="detector_id", location="path", required=True, type=int, description="The ID of the detector you'd like to query.", ) QUERY = OpenApiParameter( name="query", location="query", required=False, ...
DetectorParams
python
TheAlgorithms__Python
data_structures/binary_tree/segment_tree_other.py
{ "start": 244, "end": 607 }
class ____: def __init__(self, start, end, val, left=None, right=None): self.start = start self.end = end self.val = val self.mid = (start + end) // 2 self.left = left self.right = right def __repr__(self): return f"SegmentTreeNode(start={self.start}, end...
SegmentTreeNode
python
kubernetes-client__python
kubernetes/client/models/v1beta1_volume_attributes_class_list.py
{ "start": 383, "end": 7305 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1beta1VolumeAttributesClassList
python
getsentry__sentry
src/sentry/api/serializers/models/environment.py
{ "start": 359, "end": 584 }
class ____(Serializer): def serialize(self, obj: Environment, attrs, user, **kwargs) -> EnvironmentSerializerResponse: return {"id": str(obj.id), "name": obj.name} @register(EnvironmentProject)
EnvironmentSerializer
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/canfail/package.py
{ "start": 227, "end": 939 }
class ____(Package): """Package which fails install unless a special attribute is set""" homepage = "http://www.example.com" url = "http://www.example.com/a-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") def set_install_succeed(self): os.environ["CANFAIL_SUCCEED"] = "1...
Canfail
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_south_dakota_zip.py
{ "start": 767, "end": 1782 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_south_dakota_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _...
ColumnValuesToBeValidSouthDakotaZip
python
scrapy__scrapy
scrapy/logformatter.py
{ "start": 1035, "end": 1145 }
class ____(TypedDict): level: int msg: str args: dict[str, Any] | tuple[Any, ...]
LogFormatterResult
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/Terminal.py
{ "start": 269, "end": 10616 }
class ____(object): def __init__(self, node, name, io, optional=False, multi=False, pos=None, renamable=False, removable=False, multiable=False, bypass=None): """ Construct a new terminal. ============== =============================================================================...
Terminal
python
getsentry__sentry
src/sentry/unmerge.py
{ "start": 2867, "end": 4487 }
class ____(UnmergeReplacement): """ The "classical unmerge": Moving events out of the group based on primary_hash. """ fingerprints: Collection[str] def get_unmerge_key( self, event: GroupEvent, locked_primary_hashes: Collection[str] ) -> str | None: primary_hash = event.get_pr...
PrimaryHashUnmergeReplacement
python
pytorch__pytorch
torch/_inductor/template_heuristics/triton.py
{ "start": 3634, "end": 3865 }
class ____(FlexConfig): """ ROCm subclass for FlexAttn, with AMD backend specific tuneable kernargs """ matrix_instr_nonkdim: int = 0 waves_per_eu: int = 0 kpack: int = 2 @dataclasses.dataclass
ROCmFlexConfig
python
joke2k__faker
faker/providers/phone_number/es_AR/__init__.py
{ "start": 49, "end": 2070 }
class ____(PhoneNumberProvider): """ According to official specs: https://es.wikipedia.org/wiki/N%C3%BAmeros_telef%C3%B3nicos_en_Argentina https://www.argentina.gob.ar/pais/codigo-telefonia """ formats = ( "+54 15 2%## ####", # National telephone to mobile phone "+54 9 3%## ###...
Provider
python
ansible__ansible
lib/ansible/_internal/ansible_collections/ansible/_protomatter/plugins/test/tagged.py
{ "start": 206, "end": 319 }
class ____: @staticmethod def tests() -> dict[str, t.Callable]: return dict(tagged=tagged)
TestModule
python
PyCQA__pylint
doc/data/messages/t/too-many-function-args/good.py
{ "start": 0, "end": 134 }
class ____: def __init__(self, color, name): self.color = color self.name = name apple = Fruit("red", "apple")
Fruit
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/ragged_size_op_test.py
{ "start": 1023, "end": 1776 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): @parameterized.parameters([ {'size': 1, 'test_input': 1}, {'size': 0, 'test_input': []}, {'size': 0, 'test_input': [], 'ragged_rank': 1}, {'size': 3, 'test_input': [1, 1, 1]}, {'size': 3, 'test_inpu...
RaggedSizeOpTest
python
ansible__ansible
lib/ansible/modules/service_facts.py
{ "start": 17869, "end": 21408 }
class ____(BaseService): _pid_regex = r'.+ is running as pid (\d+)\.' def get_info(self, service): service_info = {'status': 'unknown'} rc, stdout, stderr = self.module.run_command("%s %s describe" % (self.service, service)) if rc == 0: service_info['description'] = stdout...
FreeBSDScanService
python
pytorch__pytorch
torch/jit/quantized.py
{ "start": 1754, "end": 2025 }
class ____(torch.jit.ScriptModule): def __init__(self, other, dtype=torch.int8): raise RuntimeError( "torch.jit.QuantizedRNNBase is no longer supported. " "Please use the torch.ao.nn.quantized.dynamic instead." )
QuantizedRNNBase
python
keras-team__keras
keras/src/layers/normalization/layer_normalization.py
{ "start": 285, "end": 8622 }
class ____(Layer): """Layer normalization layer (Ba et al., 2016). Normalize the activations of the previous layer for each given example in a batch independently, rather than across a batch like Batch Normalization. i.e. applies a transformation that maintains the mean activation within each examp...
LayerNormalization