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
pytoolz__toolz
tlz/_build_tlz.py
{ "start": 118, "end": 3144 }
class ____: """ Finds and loads ``tlz`` modules when added to sys.meta_path""" def __init__(self): self.always_from_toolz = { toolz.pipe, } def _load_toolz(self, fullname): rv = {} package, dot, submodules = fullname.partition('.') try: modul...
TlzLoader
python
ray-project__ray
python/ray/data/_internal/execution/operators/map_operator.py
{ "start": 1635, "end": 2672 }
class ____(ABC): """Interface for the rebundling behavior of the MapOperator.""" @abstractmethod def num_blocks(self) -> int: """Return the total number of blocks buffered inside the bundler.""" pass @abstractmethod def add_bundle(self, bundle: RefBundle): """Add a new inpu...
BaseRefBundler
python
pyqtgraph__pyqtgraph
pyqtgraph/opengl/GLViewWidget.py
{ "start": 21555, "end": 22516 }
class ____(GLViewMixin, QtWidgets.QOpenGLWidget): def __init__(self, *args, devicePixelRatio=None, **kwargs): """ Basic widget for displaying 3D data - Rotation/scale controls - Axis/grid display - Export options ================ ===============================...
GLViewWidget
python
giampaolo__psutil
tests/test_linux.py
{ "start": 85182, "end": 88125 }
class ____(PsutilTestCase): """/proc/pid/stat and /proc/pid/status have many values in common. Whenever possible, psutil uses /proc/pid/stat (it's faster). For all those cases we check that the value found in /proc/pid/stat (by psutil) matches the one found in /proc/pid/status. """ @classme...
TestProcessAgainstStatus
python
google__jax
tests/mosaic/gpu_test.py
{ "start": 42418, "end": 95266 }
class ____(TestCase): def setUp(self): super().setUp() capabilities = ("10.0", "10.1") if not any(jtu.is_cuda_compute_capability_equal(sm) for sm in capabilities): self.skipTest("Only works on GPU with capability sm_100a or sm_101a") @parameterized.product( jax_dtype_packing=[(jnp.float32,...
TCGen05Test
python
numba__numba
numba/core/typing/npydecl.py
{ "start": 21561, "end": 24251 }
class ____(object): def matmul_typer(self, a, b, out=None): """ Typer function for Numpy matrix multiplication. """ if not isinstance(a, types.Array) or not isinstance(b, types.Array): return if not all(x.ndim in (1, 2) for x in (a, b)): raise TypingE...
MatMulTyperMixin
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/refurb/FURB180.py
{ "start": 411, "end": 485 }
class ____(B0, before_metaclass=1, metaclass=abc.ABCMeta): pass # OK
A3
python
apache__airflow
airflow-core/tests/unit/dag_processing/bundles/test_base.py
{ "start": 6458, "end": 9011 }
class ____: @pytest.mark.parametrize( ("threshold_hours", "min_versions", "when_hours", "expected_remaining"), [ (3, 0, 3, 5), (3, 0, 6, 2), (10, 0, 3, 5), (10, 0, 6, 5), (0, 0, 3, 2), # two of them are in future (0, 0, 6, 0), ...
TestBundleUsageTrackingManager
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 222275, "end": 223124 }
class ____(Operation): def call(self, x): x = backend.convert_to_tensor(x) return backend.numpy.sqrt(x) def compute_output_spec(self, x): dtype = ( backend.floatx() if backend.standardize_dtype(x.dtype) == "int64" else dtypes.result_type(x.dtype, floa...
Sqrt
python
PrefectHQ__prefect
src/integrations/prefect-email/tests/conftest.py
{ "start": 227, "end": 661 }
class ____: def __enter__(self): return self def __exit__(self, *exc): return False def send_message(self, message): return message @pytest.fixture def email_server_credentials(): email_server_credentials = MagicMock(username="someone@email.com") email_server_credentials....
EmailServerMethodsMock
python
ZoranPandovski__al-go-rithms
search/ternary_search/python/ternary_sr.py
{ "start": 0, "end": 148 }
class ____: def __init__(self, data=None): self.data = data self.right = None self.left = None self.eq = None
Node
python
apache__avro
lang/py/avro/test/test_protocol.py
{ "start": 14974, "end": 15919 }
class ____(unittest.TestCase): """Enable generating error protocol test cases across all the valid test protocols.""" def __init__(self, test_proto): """Ignore the normal signature for unittest.TestCase because we are generating many test cases from this one class. This is safe as long as the a...
ErrorProtocolTestCase
python
spyder-ide__spyder
spyder/plugins/statusbar/widgets/status.py
{ "start": 1115, "end": 2087 }
class ____(BaseTimerStatus): """"Add clock to statusbar in a fullscreen mode.""" ID = 'clock_status' def get_value(self): """Return the time.""" from time import localtime, strftime text = strftime("%H:%M", localtime()) return text.rjust(3) def get_tooltip(self): ...
ClockStatus
python
modin-project__modin
modin/tests/pandas/dataframe/test_map_metadata.py
{ "start": 19829, "end": 64285 }
class ____: """This class contains test and test usilities for the ``LazyProxyCategoricalDtype`` class.""" @staticmethod def _get_lazy_proxy(): """ Build a dataframe containing a column that has a proxy type and return this proxy together with an original dtype that this proxy is em...
TestCategoricalProxyDtype
python
apache__airflow
providers/apache/pig/tests/unit/apache/pig/operators/test_pig.py
{ "start": 1075, "end": 2615 }
class ____: def test_prepare_template(self): pig = "sh echo $DATE;" task_id = TEST_TASK_ID operator = PigOperator(pig=pig, task_id=task_id) operator.prepare_template() assert pig == operator.pig # converts when pigparams_jinja_translate = true operator = Pig...
TestPigOperator
python
cython__cython
Cython/Compiler/PyrexTypes.py
{ "start": 59150, "end": 64768 }
class ____(PyObjectType): # # A Python extension type. # # name string # scope CClassScope Attribute namespace # typedef_flag boolean # base_type PyExtensionType or None # module_name string or None Qualified name of defining module ...
PyExtensionType
python
pytorch__pytorch
torch/_numpy/_dtypes.py
{ "start": 2414, "end": 2513 }
class ____(floating): name = "float64" typecode = "d" torch_dtype = torch.float64
float64
python
apache__airflow
task-sdk/src/airflow/sdk/execution_time/comms.py
{ "start": 24503, "end": 24645 }
class ____(TIRetryStatePayload): """Update a task instance state to up_for_retry.""" type: Literal["RetryTask"] = "RetryTask"
RetryTask
python
pypa__warehouse
tests/unit/admin/views/test_organizations.py
{ "start": 950, "end": 2877 }
class ____: def test_validate_success(self): form_data = MultiDict( { "display_name": "My Organization", "link_url": "https://example.com", "description": "A test organization", "orgtype": "Company", } ) ...
TestOrganizationForm
python
huggingface__transformers
tests/models/zoedepth/test_modeling_zoedepth.py
{ "start": 1398, "end": 4926 }
class ____: def __init__( self, parent, batch_size=2, num_channels=3, image_size=32, patch_size=16, use_labels=True, num_labels=3, is_training=True, hidden_size=4, num_hidden_layers=2, num_attention_heads=2, inte...
ZoeDepthModelTester
python
scipy__scipy
scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py
{ "start": 15707, "end": 18754 }
class ____(TestCase): def test_cauchypoint_equalsto_newtonpoint(self): A = np.array([[1, 8]]) b = np.array([-16]) _, _, Y = projections(A) newton_point = np.array([0.24615385, 1.96923077]) # Newton point inside boundaries x = modified_dogleg(A, Y, b, 2, [-np.inf, -n...
TestModifiedDogleg
python
encode__django-rest-framework
rest_framework/fields.py
{ "start": 23330, "end": 24922 }
class ____(Field): default_error_messages = { 'invalid': _('Must be a valid boolean.') } default_empty_html = False initial = False TRUE_VALUES = { 't', 'y', 'yes', 'true', 'on', '1', 1, True, } FALSE_VALUES = { ...
BooleanField
python
ansible__ansible
test/units/utils/test_serialization_profiles.py
{ "start": 10204, "end": 15013 }
class ____: def __init__(self, profile_name: str) -> None: self.profile_name = profile_name profile = _serialization.get_serialization_profile(profile_name) supported_tags = {obj: None for obj in profile.serialize_map if issubclass(obj, AnsibleDatatagBase)} if supported_tags: ...
ProfileHelper
python
kamyu104__LeetCode-Solutions
Python/count-number-of-possible-root-nodes.py
{ "start": 1408, "end": 2495 }
class ____(object): def rootCount(self, edges, guesses, k): """ :type edges: List[List[int]] :type guesses: List[List[int]] :type k: int :rtype: int """ def dfs(u, p): cnt = int((p, u) in lookup) for v in adj[u]: if v ==...
Solution2
python
arrow-py__arrow
arrow/locales.py
{ "start": 115497, "end": 117215 }
class ____(Locale): names = ["se", "se-fi", "se-no", "se-se"] past = "{0} dassái" future = "{0} " # NOTE: couldn't find preposition for Sami here, none needed? timeframes: ClassVar[Mapping[TimeFrameLiteral, Union[str, Mapping[str, str]]]] = { "now": "dál", "second": "sekunda", ...
SamiLocale
python
pytorch__pytorch
torch/testing/_internal/common_pruning.py
{ "start": 1527, "end": 2214 }
class ____(nn.Module): r"""Model with only Linear layers without biases, some wrapped in a Sequential, some following the Sequential. Used to test basic pruned Linear-Linear fusion.""" def __init__(self) -> None: super().__init__() self.seq = nn.Sequential( nn.Linear(7, 5, bias=...
SimpleLinear
python
jazzband__django-waffle
waffle/tests/test_testutils.py
{ "start": 12115, "end": 12440 }
class ____(OverrideSampleOnClassTestCase): """ Extend ``OverrideSampleOnClassTestCase`` and make sure ``override_sample`` change still works. """ def test_child_undecorated_method_is_set_properly_for_sample(self): self.assertFalse(waffle.sample_is_active('foo'))
InheritanceOverrideSampleOnClassTests
python
tensorflow__tensorflow
tensorflow/python/autograph/operators/logical_test.py
{ "start": 928, "end": 3138 }
class ____(test.TestCase): def assertNotCalled(self): self.fail('this should not be called') def _tf_true(self): return constant_op.constant(True) def _tf_false(self): return constant_op.constant(False) def test_and_python(self): self.assertTrue(logical.and_(lambda: True, lambda: True)) ...
LogicalOperatorsTest
python
PyCQA__pylint
pylint/typing.py
{ "start": 1347, "end": 1540 }
class ____(TypedDict): """Represents data about errors collected during checking of a module.""" key: Literal["fatal"] mod: str ex: ImportError | SyntaxError
ErrorDescriptionDict
python
pydantic__pydantic
pydantic-core/tests/validators/test_dataclasses.py
{ "start": 47019, "end": 47113 }
class ____(FooDataclassSlots): c: str @dataclasses.dataclass(**kwargs)
FooDataclassMoreSlots
python
sympy__sympy
sympy/utilities/matchpy_connector.py
{ "start": 3949, "end": 5710 }
class ____(Wildcard, Symbol): min_length: int # abstract field required in subclasses fixed_size: bool # abstract field required in subclasses def __init__(self, variable_name=None, optional=None, **assumptions): min_length = self.min_length fixed_size = self.fixed_size if optiona...
_WildAbstract
python
huggingface__transformers
src/transformers/pipelines/zero_shot_image_classification.py
{ "start": 629, "end": 7956 }
class ____(Pipeline): """ Zero shot image classification pipeline using `CLIPModel`. This pipeline predicts the class of an image when you provide an image and a set of `candidate_labels`. Example: ```python >>> from transformers import pipeline >>> classifier = pipeline(model="google/sig...
ZeroShotImageClassificationPipeline
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclassNamedTuple1.py
{ "start": 119, "end": 197 }
class ____: pass def standalone(obj: object) -> None: print(obj)
Other
python
kamyu104__LeetCode-Solutions
Python/count-the-number-of-inversions.py
{ "start": 137, "end": 1266 }
class ____(object): def numberOfPermutations(self, n, requirements): """ :type n: int :type requirements: List[List[int]] :rtype: int """ MOD = 10**9+7 lookup = [-1]*n for i, c in requirements: lookup[i] = c dp = [1] prev = ...
Solution
python
ethereum__web3.py
web3/exceptions.py
{ "start": 1774, "end": 1886 }
class ____(Web3Exception): """ Raised when unable to connect to a provider """
ProviderConnectionError
python
tensorflow__tensorflow
tensorflow/python/framework/convert_to_constants_test.py
{ "start": 3080, "end": 6440 }
class ____(object): """GraphDef merging methods for testing purposes.""" @staticmethod def merge_any(x1, x2, empty_fn): """Merges two values using the message's CopyFrom/MergeFrom methods.""" merged = empty_fn() merged.CopyFrom(x1) merged.MergeFrom(x2) return merged @staticmethod def mer...
_GraphMerger
python
tensorflow__tensorflow
tensorflow/dtensor/python/tests/device_test.py
{ "start": 1934, "end": 16711 }
class ____(test_util.DTensorBaseTest, parameterized.TestCase): def setUp(self): super(DTensorDeviceTest, self).setUp() device_ids = test_util.create_device_ids_array((2,)) local_device_ids = np.ravel(device_ids).tolist() mesh_dict = { # pylint: disable=g-complex-comprehension device: Mesh( ...
DTensorDeviceTest
python
django__django
django/db/models/fields/related_lookups.py
{ "start": 4109, "end": 5682 }
class ____: def get_prep_lookup(self): if not isinstance(self.lhs, ColPairs) and not hasattr( self.rhs, "resolve_expression" ): # If we get here, we are dealing with single-column relations. self.rhs = get_normalized_value(self.rhs, self.lhs)[0] # We n...
RelatedLookupMixin
python
altair-viz__altair
sphinxext/code_ref.py
{ "start": 9407, "end": 12089 }
class ____(SphinxDirective): """ Formatted code block, referencing the contents of a function definition. Options: .. altair-code-ref:: :output: [code, plot] :fold: flag :summary: str Examples -------- Reference a function, generating a code block: ...
CodeRefDirective
python
getsentry__sentry
tests/sentry/integrations/slack/notifications/test_deploy.py
{ "start": 339, "end": 2898 }
class ____(SlackActivityNotificationTest): def test_deploy_block(self) -> None: """ Test that a Slack message is sent with the expected payload when a deploy happens. and block kit is enabled. """ release = self.create_release( version="meow" * 10, dat...
SlackDeployNotificationTest
python
doocs__leetcode
solution/0900-0999/0906.Super Palindromes/Solution.py
{ "start": 148, "end": 533 }
class ____: def superpalindromesInRange(self, left: str, right: str) -> int: def is_palindrome(x: int) -> bool: y, t = 0, x while t: y = y * 10 + t % 10 t //= 10 return x == y l, r = int(left), int(right) return sum(l <= x ...
Solution
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_textbox40.py
{ "start": 315, "end": 1612 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("textbox40.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with textbox(s).""" workbook = Workb...
TestCompareXLSXFiles
python
spack__spack
lib/spack/spack/vendor/pyrsistent/_plist.py
{ "start": 107, "end": 883 }
class ____(object): """ Helper class to allow construction of a list without having to reverse it in the end. """ __slots__ = ('_head', '_tail') def __init__(self): self._head = _EMPTY_PLIST self._tail = _EMPTY_PLIST def _append(self, elem, constructor): if not self...
_PListBuilder
python
facelessuser__pymdown-extensions
tests/test_extensions/test_superfences.py
{ "start": 7211, "end": 8209 }
class ____(util.MdCase): """Test highlight line wraps.""" extension = ['pymdownx.highlight', 'pymdownx.superfences'] extension_configs = { 'pymdownx.highlight': { 'line_spans': '__my_span', 'linenums_style': 'table' } } def test_linespans(self): """T...
TestHighlightLineWrapsPymdownsTable
python
huggingface__transformers
src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py
{ "start": 130173, "end": 144297 }
class ____(SeamlessM4Tv2PreTrainedModel, GenerationMixin): input_modalities = "audio" _keys_to_ignore_on_load_missing = ["text_encoder", "t2u_model", "vocoder"] main_input_name = "input_features" _tied_weights_keys = { "lm_head.weight": "shared.weight", "text_decoder.embed_tokens.weight...
SeamlessM4Tv2ForSpeechToText
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 43849, "end": 44206 }
class ____(sgqlc.types.Enum): """The permissions available to members on an Organization. Enumeration Choices: * `ADMIN`: Can read, clone, push, and add collaborators to repositories. * `READ`: Can read and clone repositories. """ __schema__ = github_schema __choices__ = ("ADMIN", "...
OrgAddMemberAuditEntryPermission
python
pandas-dev__pandas
pandas/tests/series/methods/test_matmul.py
{ "start": 132, "end": 2767 }
class ____: def test_matmul(self): # matmul test is for GH#10259 a = Series( np.random.default_rng(2).standard_normal(4), index=["p", "q", "r", "s"] ) b = DataFrame( np.random.default_rng(2).standard_normal((3, 4)), index=["1", "2", "3"], ...
TestMatmul
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/resources.py
{ "start": 8323, "end": 8488 }
class ____(graphene.ObjectType): results = non_null_list(GrapheneResourceDetails) class Meta: name = "ResourceDetailsList"
GrapheneResourceDetailsList
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/images/api/blobstore.py
{ "start": 881, "end": 1633 }
class ____(webapp2.RequestHandler): def get(self): blob_key = self.request.get("blob_key") if blob_key: blob_info = blobstore.get(blob_key) if blob_info: img = images.Image(blob_key=blob_key) img.resize(width=80, height=100) im...
Thumbnailer
python
walkccc__LeetCode
solutions/2905. Find Indices With Index and Value Difference II/2905.py
{ "start": 0, "end": 788 }
class ____: def findIndices( self, nums: list[int], indexDifference: int, valueDifference: int, ) -> list[int]: # nums[minIndex] := the minimum number with enough index different from the current number minIndex = 0 # nums[maxIndex] := the maximum number with enough index differe...
Solution
python
walkccc__LeetCode
solutions/791. Custom Sort String/791.py
{ "start": 0, "end": 397 }
class ____: def customSortString(self, order: str, s: str) -> str: ans = "" count = [0] * 26 for c in s: count[ord(c) - ord('a')] += 1 for c in order: while count[ord(c) - ord('a')] > 0: ans += c count[ord(c) - ord('a')] -= 1 for c in string.ascii_lowercase: fo...
Solution
python
crytic__slither
slither/tools/upgradeability/checks/variables_order.py
{ "start": 1849, "end": 4749 }
class ____(AbstractCheck): ARGUMENT = "order-vars-proxy" IMPACT = CheckClassification.HIGH HELP = "Incorrect vars order with the proxy" WIKI = "https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-proxy" WIKI_TITLE = "Incorrect variables with the proxy" # r...
DifferentVariableContractProxy
python
pytransitions__transitions
transitions/extensions/nesting.py
{ "start": 6137, "end": 6484 }
class ____(EventData): """Collection of relevant data related to the ongoing nested transition attempt.""" def __init__(self, state, event, machine, model, args, kwargs): super(NestedEventData, self).__init__(state, event, machine, model, args, kwargs) self.source_path = None self.sourc...
NestedEventData
python
huggingface__transformers
src/transformers/models/falcon_mamba/modeling_falcon_mamba.py
{ "start": 30275, "end": 31233 }
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...
FalconMambaCausalLMOutput
python
PrefectHQ__prefect
tests/test_tasks.py
{ "start": 72931, "end": 74356 }
class ____: async def test_task_timeouts_actually_timeout(self, timeout_test_flow): flow_state = timeout_test_flow(return_state=True) timed_out, _, _ = await flow_state.result(raise_on_failure=False) assert timed_out.name == "TimedOut" assert timed_out.is_failed() async def test...
TestTaskTimeouts
python
sympy__sympy
sympy/stats/drv_types.py
{ "start": 18577, "end": 19865 }
class ____(SingleDiscreteDistribution): _argnames = ('s',) set = S.Naturals @staticmethod def check(s): _value_check(s > 1, 's should be greater than 1') def pdf(self, k): s = self.s return 1 / (k**s * zeta(s)) def _characteristic_function(self, t): return poly...
ZetaDistribution
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_icd_ten_category_or_subcategory.py
{ "start": 2008, "end": 5194 }
class ____(ColumnMapExpectation): """Expect column values to consist only of ICD-10 categories or subcategories.""" examples = [ { "data": { "all_valid_categories_or_subcategories": [ "C00", "C00.1", "C002", ...
ExpectColumnValuesToBeIcdTenCategoryOrSubcategory
python
pennersr__django-allauth
allauth/mfa/recovery_codes/views.py
{ "start": 1997, "end": 3030 }
class ____(TemplateView): template_name = "mfa/recovery_codes/download.txt" content_type = "text/plain" def dispatch(self, request, *args, **kwargs): self.authenticator = flows.view_recovery_codes(self.request) if not self.authenticator: raise Http404() self.unused_codes...
DownloadRecoveryCodesView
python
coleifer__peewee
tests/mysql_ext.py
{ "start": 1112, "end": 2692 }
class ____(ModelTestCase): database = mysql_ext_db requires = [Person, Note] def test_basic_operations(self): with self.database.atomic(): charlie, huey, zaizee = [Person.create(first=f, last='leifer') for f in ('charlie', 'huey', 'zaizee')] ...
TestMySQLConnector
python
django__django
django/contrib/auth/password_validation.py
{ "start": 9127, "end": 9629 }
class ____: """ Validate that the password is not entirely numeric. """ def validate(self, password, user=None): if password.isdigit(): raise ValidationError( self.get_error_message(), code="password_entirely_numeric", ) def get_error...
NumericPasswordValidator
python
openai__openai-python
src/openai/_exceptions.py
{ "start": 2237, "end": 2724 }
class ____(APIError): """Raised when an API response has a status code of 4xx or 5xx.""" response: httpx.Response status_code: int request_id: str | None def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None: super().__init__(message, response.request, ...
APIStatusError
python
tensorflow__tensorflow
tensorflow/python/feature_column/feature_column.py
{ "start": 116545, "end": 122945 }
class ____(_DenseColumn, _SequenceDenseColumn, collections.namedtuple('_IndicatorColumn', ['categorical_column'])): """Represents a one-hot column for use in deep networks. Args: categorical_column: A `_CategoricalColumn` which is created by ...
_IndicatorColumn
python
openai__openai-python
src/openai/resources/fine_tuning/checkpoints/checkpoints.py
{ "start": 2980, "end": 3284 }
class ____: def __init__(self, checkpoints: Checkpoints) -> None: self._checkpoints = checkpoints @cached_property def permissions(self) -> PermissionsWithStreamingResponse: return PermissionsWithStreamingResponse(self._checkpoints.permissions)
CheckpointsWithStreamingResponse
python
sqlalchemy__sqlalchemy
test/orm/test_query.py
{ "start": 207117, "end": 216628 }
class ____(QueryTest, AssertsCompiledSQL): __dialect__ = "default" def test_no_strings(self): User = self.classes.User sess = fixture_session() q = sess.query(User) u1 = q.filter_by(name="jack").one() with expect_raises_message( sa_exc.ArgumentError, ...
ParentTest
python
geekcomputers__Python
nitkarshchourasia/to_sort/one_rep_max_calculator/one_rep_max_calculator_gui.py
{ "start": 23, "end": 2356 }
class ____: """ A class used to calculate the estimated one-repetition maximum (1RM) for a weightlifting exercise. Attributes ---------- window : tk.Tk The main window of the application. weight_entry : tk.Entry Entry field to input the weight lifted. rep_entry : tk.Entry ...
OneRepMaxCalculator
python
numpy__numpy
numpy/_core/_internal.py
{ "start": 17416, "end": 29437 }
class ____: def __init__(self, s): self.s = s self.byteorder = '@' def advance(self, n): res = self.s[:n] self.s = self.s[n:] return res def consume(self, c): if self.s[:len(c)] == c: self.advance(len(c)) return True return Fa...
_Stream
python
pypa__pipenv
pipenv/vendor/dotenv/variables.py
{ "start": 1104, "end": 2348 }
class ____(Atom): def __init__(self, name: str, default: Optional[str]) -> None: self.name = name self.default = default def __repr__(self) -> str: return f"Variable(name={self.name}, default={self.default})" def __eq__(self, other: object) -> bool: if not isinstance(other,...
Variable
python
tensorflow__tensorflow
tensorflow/python/module/module_test.py
{ "start": 18801, "end": 19500 }
class ____(module.Module): def __init__(self): super().__init__() self._trainable_variables = [ variables.Variable(1., name="a"), variables.Variable(2., name="b"), ] self._non_trainable_variables = [ variables.Variable(3., name="c"), variables.Variable(4., name="d"), ...
LayerModule
python
encode__httpx
httpx/_models.py
{ "start": 3936, "end": 12179 }
class ____(typing.MutableMapping[str, str]): """ HTTP headers, as a case-insensitive multi-dict. """ def __init__( self, headers: HeaderTypes | None = None, encoding: str | None = None, ) -> None: self._list = [] # type: typing.List[typing.Tuple[bytes, bytes, bytes]...
Headers
python
tensorflow__tensorflow
tensorflow/python/saved_model/load_optimizer_test.py
{ "start": 878, "end": 1339 }
class ____(test.TestCase): def test_load_optimizer_without_keras(self): # Make sure that a SavedModel w/ optimizer can be loaded without the Keras # module imported. save_path = test.test_src_dir_path( "cc/saved_model/testdata/OptimizerSlotVariableModule") loaded = load.load(save_path) se...
LoadOptimizerTest
python
ijl__orjson
test/test_fake.py
{ "start": 372, "end": 1108 }
class ____: @pytest.mark.skipif(Faker is None, reason="faker not available") def test_faker(self): fake = Faker(FAKER_LOCALES) profile_keys = list( set(fake.profile().keys()) - {"birthdate", "current_location"}, ) for _ in range(NUM_LOOPS): data = [ ...
TestFaker
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 795005, "end": 795552 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("actor", "created_at", "lock_reason", "lockable") actor = sgqlc.types.Field(Actor, graphql_name="actor") created_at = sgqlc.types.Field( sgqlc.types.non_null(Dat...
LockedEvent
python
django-extensions__django-extensions
tests/testapp/models.py
{ "start": 14237, "end": 14447 }
class ____(models.Model): field_to_update = models.BooleanField(default=True) modified = ModificationDateTimeField() class Meta: app_label = "django_extensions"
ModelModificationDateTimeField
python
spyder-ide__spyder
spyder/api/plugin_registration/registry.py
{ "start": 1493, "end": 27053 }
class ____(QObject, PreferencesAdapter): """ Global plugin registry. This class handles a plugin initialization/teardown lifetime, including notifications when a plugin is available or not. This registry alleviates the limitations of a topological sort-based plugin initialization by enabling p...
SpyderPluginRegistry
python
HypothesisWorks__hypothesis
hypothesis-python/tests/nocover/test_stateful.py
{ "start": 2282, "end": 2654 }
class ____(RuleBasedStateMachine): charges = Bundle("charges") @rule(targets=(charges,), child=charges) def charge(self, child): return DepthCharge(child) @rule(targets=(charges,)) def none_charge(self): return DepthCharge(None) @rule(check=charges) def is_not_too_deep(sel...
DepthMachine
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pydocstyle/D208.py
{ "start": 771, "end": 887 }
class ____: """Over indented last line with content Args: Some content on the last line """
Platform
python
pytorch__pytorch
torch/_inductor/memory.py
{ "start": 680, "end": 801 }
class ____: order: list[BaseSchedulerNode] peak_memory: int method: str @dataclasses.dataclass
PeakMemoryResult
python
PrefectHQ__prefect
src/prefect/server/utilities/messaging/__init__.py
{ "start": 4029, "end": 5825 }
class ____(Protocol): Publisher: type[Publisher] Consumer: type[Consumer] ephemeral_subscription: Callable[ [str], AbstractAsyncContextManager[Mapping[str, Any]] ] # Used for testing: a context manager that breaks the topic in a way that raises # a ValueError("oops") when attempting to ...
BrokerModule
python
django__django
tests/requests_tests/test_data_upload_settings.py
{ "start": 3503, "end": 4379 }
class ____(SimpleTestCase): def setUp(self): self.request = WSGIRequest( { "REQUEST_METHOD": "GET", "wsgi.input": BytesIO(b""), "CONTENT_LENGTH": 3, } ) def test_data_upload_max_memory_size_exceeded(self): with self...
DataUploadMaxMemorySizeGetTests
python
getsentry__sentry
src/sentry/grouping/component.py
{ "start": 8657, "end": 8752 }
class ____(BaseGroupingComponent[str]): id: str = "context_line"
ContextLineGroupingComponent
python
allegroai__clearml
clearml/backend_api/services/v2_23/dataviews.py
{ "start": 145238, "end": 148373 }
class ____(Response): """ Response of dataviews.unarchive_many endpoint. :param succeeded: :type succeeded: Sequence[dict] :param failed: :type failed: Sequence[dict] """ _service = "dataviews" _action = "unarchive_many" _version = "2.23" _schema = { "definitions":...
UnarchiveManyResponse
python
astropy__astropy
astropy/io/ascii/ecsv.py
{ "start": 1600, "end": 9979 }
class ____(basic.BasicHeader): """Header class for which the column definition line starts with the comment character. See the :class:`CommentedHeader` class for an example. """ splitter_class = ECSVHeaderSplitter def process_lines(self, lines): """Return only non-blank lines that start ...
EcsvHeader
python
pytorch__pytorch
benchmarks/dynamo/genai_layers/kernels.py
{ "start": 20337, "end": 23406 }
class ____(BenchmarkKernel): def __init__(self, script_args): super().__init__(script_args) self.available_backends = ["eager", "compiled", "liger"] def get_shapes(self) -> tuple[tuple[int, ...], ...]: # OOM for (16384, 131072), (8192, 262144) return ( (32768, 256), ...
LayerNormBackward
python
huggingface__transformers
src/transformers/models/hunyuan_v1_moe/modeling_hunyuan_v1_moe.py
{ "start": 16802, "end": 17690 }
class ____(PreTrainedModel): config: HunYuanMoEV1Config base_model_prefix = "model" supports_gradient_checkpointing = True _no_split_modules = ["HunYuanMoEV1DecoderLayer"] _skip_keys_device_placement = ["past_key_values"] _supports_flash_attn = True _supports_sdpa = True _supports_flex_a...
HunYuanMoEV1PreTrainedModel
python
getsentry__sentry
src/sentry/releases/endpoints/organization_release_file_details.py
{ "start": 694, "end": 4200 }
class ____( OrganizationReleasesBaseEndpoint, ReleaseFileDetailsMixin ): publish_status = { "DELETE": ApiPublishStatus.UNKNOWN, "GET": ApiPublishStatus.UNKNOWN, "PUT": ApiPublishStatus.UNKNOWN, } def get(self, request: Request, organization, version, file_id) -> Response: ...
OrganizationReleaseFileDetailsEndpoint
python
spack__spack
lib/spack/spack/util/environment.py
{ "start": 7545, "end": 8326 }
class ____: """Base class for modifiers that act on the environment variable as a whole, and thus store just its name """ __slots__ = ("name", "separator", "trace") def __init__(self, name: str, *, separator: str = os.pathsep, trace: Optional[Trace] = None): self.name = name.upper() if sys...
NameModifier
python
rq__rq
tests/test_spawn_worker.py
{ "start": 2257, "end": 2757 }
class ____: def setUp(self): # we want tests to fail if signal are ignored and the work remain # running, so set a signal to kill them after X seconds self.killtimeout = 15 signal.signal(signal.SIGALRM, self._timeout) signal.alarm(self.killtimeout) def _timeout(self, sig...
TimeoutTestCase
python
cloudpipe__cloudpickle
tests/cloudpickle_test.py
{ "start": 2959, "end": 112176 }
class ____(unittest.TestCase): protocol = cloudpickle.DEFAULT_PROTOCOL def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix="tmp_cloudpickle_test_") def tearDown(self): shutil.rmtree(self.tmpdir) @pytest.mark.skipif( platform.python_implementation() != "CPython" or sys.versi...
CloudPickleTest
python
sqlalchemy__sqlalchemy
test/base/test_events.py
{ "start": 593, "end": 946 }
class ____: def teardown_test(self): classes = set() for entry in event.base._registrars.values(): for evt_cls in entry: if evt_cls.__module__ == __name__: classes.add(evt_cls) for evt_cls in classes: event.base._remove_dispatcher(...
TearDownLocalEventsFixture
python
realpython__materials
python-class/counter.py
{ "start": 0, "end": 106 }
class ____: num_instances = 0 def __init__(self): type(self).num_instances += 1
ObjectCounter
python
django__django
tests/postgres_tests/test_array.py
{ "start": 54552, "end": 57741 }
class ____(PostgreSQLWidgetTestCase): def test_get_context(self): self.assertEqual( SplitArrayWidget(forms.TextInput(), size=2).get_context( "name", ["val1", "val2"] ), { "widget": { "name": "name", "...
TestSplitFormWidget
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/expression2.py
{ "start": 51, "end": 149 }
class ____: def do_something1(self): pass def do_something2(self): pass
Foo
python
ansible__ansible
test/units/module_utils/facts/test_ansible_collector.py
{ "start": 17099, "end": 17390 }
class ____(TestCollectedFacts): expected_facts = [] min_fact_count = 0 def _collectors(self, module, all_collector_classes=None, minimal_gather_subset=None): return [NoneReturningCollector(namespace='ansible')]
TestOnlyNoneCollector
python
django-debug-toolbar__django-debug-toolbar
tests/panels/test_custom.py
{ "start": 322, "end": 1532 }
class ____(IntegrationTestCase): def test_escapes_panel_title(self): response = self.client.get("/regular/basic/") self.assertContains( response, """ <li id="djdt-CustomPanel" class="djDebugPanelButton"> <input type="checkbox" checked title="Disable fo...
CustomPanelTestCase
python
bokeh__bokeh
tests/unit/bokeh/embed/test_util__embed.py
{ "start": 2227, "end": 2570 }
class ____: def __init__(self) -> None: self.last_name = None self.last_old = None self.last_new = None def __call__(self, event): self.method(event) def method(self, event): self.event = event def partially_good(self, arg, event): pass # Taken from te...
_GoodEventCallback
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-pinecone/destination_pinecone/destination.py
{ "start": 891, "end": 3746 }
class ____(Destination): indexer: Indexer embedder: Embedder def _init_indexer(self, config: ConfigModel): try: self.embedder = create_from_config(config.embedding, config.processing) self.indexer = PineconeIndexer(config.indexing, self.embedder.embedding_dimensions) ...
DestinationPinecone
python
tiangolo__fastapi
docs_src/custom_request_and_route/tutorial001.py
{ "start": 139, "end": 451 }
class ____(Request): async def body(self) -> bytes: if not hasattr(self, "_body"): body = await super().body() if "gzip" in self.headers.getlist("Content-Encoding"): body = gzip.decompress(body) self._body = body return self._body
GzipRequest
python
tensorflow__tensorflow
tensorflow/python/keras/layers/core.py
{ "start": 26394, "end": 39135 }
class ____(Layer): """Wraps arbitrary expressions as a `Layer` object. The `Lambda` layer exists so that arbitrary expressions can be used as a `Layer` when constructing `Sequential` and Functional API models. `Lambda` layers are best suited for simple operations or quick experimentation. For more advanced u...
Lambda
python
tornadoweb__tornado
tornado/test/routing_test.py
{ "start": 3939, "end": 4997 }
class ____(AsyncHTTPTestCase): def get_app(self): router = CustomRouter() class CustomApplication(Application): def reverse_url(self, name, *args): return router.reverse_url(name, *args) app1 = CustomApplication(app_name="app1") app2 = CustomApplication(...
CustomRouterTestCase
python
encode__django-rest-framework
tests/test_pagination.py
{ "start": 36098, "end": 38817 }
class ____(CursorPaginationTestsMixin): """ Unit tests for `pagination.CursorPagination`. """ def setup_method(self): class MockObject: def __init__(self, idx): self.created = idx class MockQuerySet: def __init__(self, items): sel...
TestCursorPagination