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
allegroai__clearml
clearml/backend_api/services/v2_23/frames.py
{ "start": 403493, "end": 428496 }
class ____(Response): """ Response of frames.get_snippets_for_dataview2 endpoint. :param frames: List of frames for the requested page. The amount of frames returned is not guaranteed to be equal to the requested page size. :type frames: Sequence[Snippet] :param frames_total: The total numb...
GetSnippetsForDataview2Response
python
cherrypy__cherrypy
cherrypy/test/test_tools.py
{ "start": 449, "end": 16246 }
class ____(helper.CPWebCase): @staticmethod def setup_server(): # Put check_access in a custom toolbox with its own namespace myauthtools = cherrypy._cptools.Toolbox('myauth') def check_access(default=False): if not getattr(cherrypy.request, 'userid', default): ...
ToolTests
python
kamyu104__LeetCode-Solutions
Python/minimum-time-takes-to-reach-destination-without-drowning.py
{ "start": 55, "end": 1394 }
class ____(object): def minimumSeconds(self, land): """ :type land: List[List[str]] :rtype: int """ DIRECTIONS = ((1, 0), (0, 1), (-1, 0), (0, -1)) lookup = [[-1 if land[i][j] == "*" else 0 for j in xrange(len(land[0]))] for i in xrange(len(land))] q = [(i, j,...
Solution
python
facebookresearch__faiss
tests/test_index_binary_from_float.py
{ "start": 4548, "end": 5663 }
class ____(unittest.TestCase): def test_override(self): d = 256 nt = 3500 nb = 10000 nq = 500 (xt, xb, xq) = make_binary_dataset(d, nb, nt, nq) def train_and_get_centroids(override_kmeans_index): index = faiss.index_binary_factory(d, "BIVF10") ...
TestOverrideKmeansQuantizer
python
getsentry__sentry
src/sentry/grouping/fingerprinting/matchers.py
{ "start": 908, "end": 4713 }
class ____: def __init__( self, key: str, # The event attribute on which to match pattern: str, # The value to match (or to not match, depending on `negated`) negated: bool = False, # If True, match when `event[key]` does NOT equal `pattern` ) -> None: if key.startswit...
FingerprintMatcher
python
mlflow__mlflow
tests/gateway/tools.py
{ "start": 3392, "end": 4068 }
class ____: def __init__(self, data: list[bytes], headers: dict[str, str] | None = None, status: int = 200): self.status = status self.headers = headers self._content = data def raise_for_status(self) -> None: if 400 <= self.status < 600: raise aiohttp.ClientResponse...
MockAsyncStreamingResponse
python
jazzband__django-model-utils
model_utils/managers.py
{ "start": 7301, "end": 8459 }
class ____(InheritanceQuerySetMixin[ModelT], QuerySet[ModelT]): # type: ignore[misc] def instance_of(self, *models: type[ModelT]) -> InheritanceQuerySet[ModelT]: """ Fetch only objects that are instances of the provided model(s). """ # If we aren't already selecting the subclasses, ...
InheritanceQuerySet
python
cherrypy__cherrypy
cherrypy/test/test_wsgi_unix_socket.py
{ "start": 1045, "end": 2196 }
class ____(helper.CPWebCase): """ Test basic behavior on a cherrypy wsgi server listening on a unix socket. It exercises the config option `server.socket_file`. """ HTTP_CONN = USocketHTTPConnection(USOCKET_PATH) @staticmethod def setup_server(): class Root(object): ...
WSGI_UnixSocket_Test
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 822670, "end": 823424 }
class ____(sgqlc.types.relay.Connection): """A list of organizations managed by an enterprise.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("OrganizationEdge"), graphql_name="edges") """A list of edges."...
OrganizationConnection
python
ethereum__web3.py
ens/exceptions.py
{ "start": 97, "end": 257 }
class ____(ENSException, ValueError): """ An ENS exception wrapper for `ValueError`, for better control over exception handling. """
ENSValueError
python
xlwings__xlwings
xlwings/constants.py
{ "start": 111786, "end": 111964 }
class ____: xlExclusive = 3 # from enum XlSaveAsAccessMode xlNoChange = 1 # from enum XlSaveAsAccessMode xlShared = 2 # from enum XlSaveAsAccessMode
SaveAsAccessMode
python
doocs__leetcode
solution/1700-1799/1734.Decode XORed Permutation/Solution.py
{ "start": 0, "end": 390 }
class ____: def decode(self, encoded: List[int]) -> List[int]: n = len(encoded) + 1 a = b = 0 for i in range(0, n - 1, 2): a ^= encoded[i] for i in range(1, n + 1): b ^= i perm = [0] * n perm[-1] = a ^ b for i in range(n - 2, -1, -1): ...
Solution
python
lxml__lxml
src/lxml/html/_html5builder.py
{ "start": 353, "end": 516 }
class ____: def __init__(self, name, publicId, systemId): self.name = name self.publicId = publicId self.systemId = systemId
DocumentType
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/links/test_ec2.py
{ "start": 1189, "end": 2144 }
class ____(BaseAwsLinksTestCase): link_class = EC2InstanceLink INSTANCE_ID = "i-xxxxxxxxxxxx" def test_extra_link(self, mock_supervisor_comms): if AIRFLOW_V_3_0_PLUS and mock_supervisor_comms: mock_supervisor_comms.send.return_value = XComResult( key=self.link_class.key...
TestEC2InstanceLink
python
doocs__leetcode
solution/3100-3199/3100.Water Bottles II/Solution.py
{ "start": 0, "end": 290 }
class ____: def maxBottlesDrunk(self, numBottles: int, numExchange: int) -> int: ans = numBottles while numBottles >= numExchange: numBottles -= numExchange numExchange += 1 ans += 1 numBottles += 1 return ans
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/hashability1.py
{ "start": 475, "end": 1010 }
class ____(list[str]): def __hash__(self) -> int: ... s3 = {StrList()} # This should generate two errors because {} and [] are not hashable. d1 = {{}: None, None: 2, dict: 3, frozenset(): 4, []: ""} # This should generate two errors because {} and [] are not hashable. d2: dict[Any, Any] = {{}: None, None: 2, d...
StrList
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents2.py
{ "start": 8862, "end": 9043 }
class ____(BaseObserver): def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT): BaseObserver.__init__(self, emitter_class=FSEventsEmitter, timeout=timeout)
FSEventsObserver2
python
pypa__warehouse
tests/unit/organizations/test_services.py
{ "start": 1552, "end": 39304 }
class ____: def test_verify_service(self): assert verifyClass(IOrganizationService, services.DatabaseOrganizationService) def test_service_creation(self): session = pretend.stub() service = services.DatabaseOrganizationService(session) assert service.db is session def test...
TestDatabaseOrganizationService
python
google__python-fire
fire/console/platforms.py
{ "start": 8218, "end": 12551 }
class ____(object): """Holds an operating system and architecture.""" def __init__(self, operating_system, architecture): """Constructs a new platform. Args: operating_system: OperatingSystem, The OS architecture: Architecture, The machine architecture. """ self.operating_system = oper...
Platform
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_wx.py
{ "start": 1460, "end": 2160 }
class ____(TimerBase): """Subclass of `.TimerBase` using wx.Timer events.""" def __init__(self, *args, **kwargs): self._timer = wx.Timer() self._timer.Notify = self._on_timer super().__init__(*args, **kwargs) def _timer_start(self): self._timer.Start(self._interval, self._s...
TimerWx
python
django__django
tests/generic_inline_admin/tests.py
{ "start": 11631, "end": 17215 }
class ____(SimpleTestCase): def setUp(self): self.site = AdminSite() def test_get_formset_kwargs(self): media_inline = MediaInline(Media, AdminSite()) # Create a formset with default arguments formset = media_inline.get_formset(request) self.assertEqual(formset.max_num,...
GenericInlineModelAdminTest
python
apache__airflow
providers/google/src/airflow/providers/google/suite/operators/sheets.py
{ "start": 1017, "end": 3440 }
class ____(BaseOperator): """ Creates a new spreadsheet. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:GoogleSheetsCreateSpreadsheetOperator` :param spreadsheet: an instance of Spreadsheet https://developers.google...
GoogleSheetsCreateSpreadsheetOperator
python
numpy__numpy
numpy/_core/tests/test_numeric.py
{ "start": 127787, "end": 135117 }
class ____: '''Test ones_like, zeros_like, empty_like and full_like''' def compare_array_value(self, dz, value, fill_value): if value is not None: if fill_value: # Conversion is close to what np.full_like uses # but we may want to convert directly in the fut...
TestLikeFuncs
python
pypa__warehouse
warehouse/utils/static.py
{ "start": 112, "end": 619 }
class ____(_ManifestCacheBuster): def __init__(self, *args, strict=True, **kwargs): super().__init__(*args, **kwargs) self.strict = strict def __call__(self, request, subpath, kw): try: return self.manifest[subpath], kw except KeyError: # If we're not in...
ManifestCacheBuster
python
lazyprogrammer__machine_learning_examples
ab_testing/comparing_epsilons.py
{ "start": 386, "end": 2156 }
class ____: def __init__(self, m): self.m = m self.m_estimate = 0 self.N = 0 def pull(self): return np.random.randn() + self.m def update(self, x): self.N += 1 self.m_estimate = (1 - 1.0/self.N)*self.m_estimate + 1.0/self.N*x def run_experiment(m1, m2, m3, eps, N): bandits = [BanditA...
BanditArm
python
numpy__numpy
numpy/distutils/fcompiler/lahey.py
{ "start": 92, "end": 1327 }
class ____(FCompiler): compiler_type = 'lahey' description = 'Lahey/Fujitsu Fortran 95 Compiler' version_pattern = r'Lahey/Fujitsu Fortran 95 Compiler Release (?P<version>[^\s*]*)' executables = { 'version_cmd' : ["<F90>", "--version"], 'compiler_f77' : ["lf95", "--fix"], 'co...
LaheyFCompiler
python
RaRe-Technologies__gensim
gensim/models/ldamodel.py
{ "start": 10882, "end": 75341 }
class ____(interfaces.TransformationABC, basemodel.BaseTopicModel): """Train and use Online Latent Dirichlet Allocation model as presented in `'Online Learning for LDA' by Hoffman et al.`_ Examples ------- Initialize a model using a Gensim corpus .. sourcecode:: pycon >>> from gensim....
LdaModel
python
jackfrued__Python-100-Days
公开课/年薪50W+的Python程序员如何写代码/code/Python/opencourse/part01/example09.py
{ "start": 14, "end": 239 }
class ____(type): def __init__(cls, *args, **kwargs): super().__init__(*args, **kwargs) cls.clone = lambda self, is_deep=True: \ copy.deepcopy(self) if is_deep else copy.copy(self)
PrototypeMeta
python
pytorch__pytorch
test/inductor/extension_backends/triton/extension_codegen_backend.py
{ "start": 314, "end": 991 }
class ____(BaseScheduling): def __init__(self, scheduler): super().__init__(scheduler) self._triton_scheduling = triton.TritonScheduling(scheduler) def can_fuse_vertical(self, node1, node2): return True def can_fuse_horizontal(self, node1, node2): return True def group...
ExtensionScheduling
python
pyca__cryptography
src/cryptography/x509/extensions.py
{ "start": 75493, "end": 76968 }
class ____(ExtensionType): oid = ExtensionOID.ADMISSIONS def __init__( self, authority: GeneralName | None, admissions: Iterable[Admission], ) -> None: if authority is not None and not isinstance(authority, GeneralName): raise TypeError("authority must be a Gener...
Admissions
python
walkccc__LeetCode
solutions/693. Binary Number with Alternating Bits/693.py
{ "start": 0, "end": 262 }
class ____: def hasAlternatingBits(self, n: int) -> bool: # n = 0b010101 # n >> 2 = 0b000101 # n ^ (n >> 2) = 0b010000 = a # a - 1 = 0b001111 # a & (a - 1) = 0 a = n ^ (n >> 2) return (a & (a - 1)) == 0
Solution
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/data_structures/lookup_ops_test.py
{ "start": 165947, "end": 166233 }
class ____(MutableHashTableBenchmark): def _create_table(self): return lookup_ops.DenseHashTable( dtypes.int64, dtypes.float32, default_value=0.0, empty_key=-1, deleted_key=-2) if __name__ == "__main__": test.main()
DenseHashTableBenchmark
python
huggingface__transformers
src/transformers/models/deberta_v2/modeling_deberta_v2.py
{ "start": 36008, "end": 36414 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.lm_head = DebertaV2LMPredictionHead(config) # note that the input embeddings must be passed as an argument def forward(self, sequence_output, word_embeddings): prediction_scores = self.lm_head(sequence_output...
DebertaV2OnlyMLMHead
python
pydantic__pydantic
tests/test_json_schema.py
{ "start": 92950, "end": 94424 }
class ____(BaseModel): c: float """ ) # All validation keys_map, schema = models_json_schema( [(module.ModelOne, 'validation'), (module.ModelTwo, 'validation'), (module.NestedModel, 'validation')] ) model_names = set(schema['$defs'].keys()) expected_model_names = { '...
NestedModel
python
huggingface__transformers
src/transformers/models/ernie/modular_ernie.py
{ "start": 4874, "end": 4932 }
class ____(BertCrossAttention): pass
ErnieCrossAttention
python
tiangolo__fastapi
scripts/notify_translations.py
{ "start": 3086, "end": 3166 }
class ____(BaseModel): repository: AllDiscussionsRepository
AllDiscussionsData
python
Textualize__textual
docs/examples/widgets/link.py
{ "start": 78, "end": 435 }
class ____(App): AUTO_FOCUS = None CSS = """ Screen { align: center middle; } """ def compose(self) -> ComposeResult: yield Link( "Go to textualize.io", url="https://textualize.io", tooltip="Click me", ) if __name__ == "__main__": ...
LabelApp
python
ray-project__ray
python/ray/dag/tests/experimental/test_execution_schedule.py
{ "start": 27117, "end": 54232 }
class ____: """ Test whether `_generate_actor_to_execution_schedule` function generates the correct execution schedule for each actor. """ def add_edge_between_read_compute_write( self, operations: Dict[_DAGNodeOperationType, _DAGOperationGraphNode] ): """ Add edges betw...
TestGenerateActorToExecutionSchedule
python
tensorflow__tensorflow
tensorflow/python/ops/array_ops_test.py
{ "start": 1234, "end": 5845 }
class ____(test.TestCase): def testGatherGradHasPartialStaticShape(self): # Create a tensor with an unknown dim 1. x = random_ops.random_normal([4, 10, 10]) x = array_ops.gather( x, array_ops.reshape(array_ops.where_v2(x[0, :, 0] > 0.5), [-1]), axis=1 ) x.shape.assert_is_compatible_with([...
ArrayOpTest
python
dagster-io__dagster
python_modules/dagster/dagster/_core/snap/job_snapshot.py
{ "start": 1767, "end": 3333 }
class ____(RecordSerializer["JobSnap"]): # v0 # v1: # - lineage added # v2: # - graph_def_name # v3: # - metadata added # v4: # - add kwargs so that if future versions add new args, this version of deserialization will # be able to ignore them. previously, new...
JobSnapSerializer
python
django__django
django/middleware/locale.py
{ "start": 344, "end": 3442 }
class ____(MiddlewareMixin): """ Parse a request and decide what translation object to install in the current thread context. This allows pages to be dynamically translated to the language the user desires (if the language is available). """ response_redirect_class = HttpResponseRedirect d...
LocaleMiddleware
python
great-expectations__great_expectations
great_expectations/expectations/sql_tokens_and_types.py
{ "start": 2651, "end": 5948 }
class ____(str, Enum): SELECT = "SELECT" CLUSTER = "CLUSTER" ALTER = "ALTER" DATABASE = "DATABASE" TABLE = "TABLE" VIEW = "VIEW" FUNCTION = "FUNCTION" DROP = "DROP" REPAIR = "REPAIR" TRUNCATE = "TRUNCATE" USE = "USE" INSERT = "INSERT" LOAD = "LOAD" OVERWRITE = "OV...
ValidSparkSqlTokens
python
pytorch__pytorch
torchgen/_autoheuristic/pad_mm/train_regression_pad_mm.py
{ "start": 237, "end": 714 }
class ____(AHTrainRegressionTree): def __init__(self): super().__init__() def add_new_features(self, results): ops = pad_mm_operations() for op in ops: results[op.name] = results.apply(op.func, axis=1) added_categorical_features = [op.name for op in ops if op.is_cate...
AHTrainPadMM
python
PrefectHQ__prefect
tests/utilities/test_collections.py
{ "start": 518, "end": 596 }
class ____(AutoEnum): RED = AutoEnum.auto() BLUE = AutoEnum.auto()
Color
python
doocs__leetcode
solution/2000-2099/2061.Number of Spaces Cleaning Robot Cleaned/Solution.py
{ "start": 0, "end": 605 }
class ____: def numberOfCleanRooms(self, room: List[List[int]]) -> int: def dfs(i, j, k): if (i, j, k) in vis: return nonlocal ans ans += room[i][j] == 0 room[i][j] = -1 vis.add((i, j, k)) x, y = i + dirs[k], j + dirs[k ...
Solution
python
sympy__sympy
sympy/printing/tensorflow.py
{ "start": 472, "end": 8161 }
class ____(ArrayPrinter, AbstractPythonCodePrinter): """ Tensorflow printer which handles vectorized piecewise functions, logical operators, max/min, and relational operators. """ printmethod = "_tensorflowcode" mapping = { sympy.Abs: "tensorflow.math.abs", sympy.sign: "tensorfl...
TensorflowPrinter
python
facebook__pyre-check
client/json_rpc.py
{ "start": 1683, "end": 1852 }
class ____(JSONRPCException): """ The method does not exist / is not available. """ def error_code(self) -> int: return -32601
MethodNotFoundError
python
falconry__falcon
falcon/errors.py
{ "start": 105818, "end": 107801 }
class ____(MediaMalformedError): """Represents a multipart form parsing error. This error may refer to a malformed or truncated form, usage of deprecated or unsupported features, or form parameters exceeding limits configured in :class:`~.media.multipart.MultipartParseOptions`. :class:`MultipartPa...
MultipartParseError
python
plotly__plotly.py
plotly/io/_orca.py
{ "start": 21648, "end": 50705 }
class ____(object): """ Class to store information about the current status of the orca server. """ _props = { "state": "unvalidated", # or 'validated' or 'running' "executable_list": None, "version": None, "pid": None, "port": None, "command": None, ...
OrcaStatus
python
redis__redis-py
redis/multidb/client.py
{ "start": 949, "end": 11254 }
class ____(RedisModuleCommands, CoreCommands): """ Client that operates on multiple logical Redis databases. Should be used in Active-Active database setups. """ def __init__(self, config: MultiDbConfig): self._databases = config.databases() self._health_checks = ( confi...
MultiDBClient
python
ray-project__ray
python/ray/dashboard/utils.py
{ "start": 1408, "end": 2364 }
class ____(abc.ABC): def __init__(self, dashboard_agent): """ Initialize current module when DashboardAgent loading modules. :param dashboard_agent: The DashboardAgent instance. """ self._dashboard_agent = dashboard_agent self.session_name = dashboard_agent.session_na...
DashboardAgentModule
python
pypa__pipenv
pipenv/patched/pip/_internal/exceptions.py
{ "start": 11057, "end": 11363 }
class ____(InstallationError): """Metadata is invalid.""" def __init__(self, ireq: "InstallRequirement", error: str) -> None: self.ireq = ireq self.error = error def __str__(self) -> str: return f"Requested {self.ireq} has invalid metadata: {self.error}"
MetadataInvalid
python
numpy__numpy
numpy/_core/tests/test_conversion_utils.py
{ "start": 5084, "end": 5696 }
class ____(StringConverterTestCase): """ Tests of PyArray_CastingConverter """ conv = mt.run_casting_converter case_insensitive = False exact_match = True def test_valid(self): self._check("no", "NPY_NO_CASTING") self._check("equiv", "NPY_EQUIV_CASTING") self._check("safe", ...
TestCastingConverter
python
sympy__sympy
sympy/functions/special/polynomials.py
{ "start": 22351, "end": 23541 }
class ____(DefinedFunction): r""" ``chebyshev_root(n, k)`` returns the $k$th root (indexed from zero) of the $n$th Chebyshev polynomial of the first kind; that is, if $0 \le k < n$, ``chebyshevt(n, chebyshevt_root(n, k)) == 0``. Examples ======== >>> from sympy import chebyshevt, chebyshev...
chebyshevt_root
python
kamyu104__LeetCode-Solutions
Python/design-circular-deque.py
{ "start": 29, "end": 2374 }
class ____(object): def __init__(self, k): """ Initialize your data structure here. Set the size of the deque to be k. :type k: int """ self.__start = 0 self.__size = 0 self.__buffer = [0] * k def insertFront(self, value): """ Adds an ite...
MyCircularDeque
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchClass3.py
{ "start": 1059, "end": 1135 }
class ____(Protocol): __match_args__ = ("x",) x: int @dataclass
ProtoE
python
huggingface__transformers
src/transformers/models/ovis2/processing_ovis2.py
{ "start": 1145, "end": 7833 }
class ____(ProcessorMixin): r""" Constructs a Ovis2 processor which wraps Ovis2 image processor and a Qwen2 tokenizer into a single processor. [`Ovis2Processor`] offers all the functionalities of [`Ovis2VideoProcessor`], [`Ovis2ImageProcessor`] and [`Qwen2TokenizerFast`]. See the [`~Ovis2Processor.__ca...
Ovis2Processor
python
huggingface__transformers
src/transformers/models/cohere2_vision/image_processing_cohere2_vision_fast.py
{ "start": 4936, "end": 13351 }
class ____(BaseImageProcessorFast): resample = PILImageResampling.BICUBIC image_mean = OPENAI_CLIP_MEAN image_std = OPENAI_CLIP_STD size = {"height": 512, "width": 512} do_resize = True do_rescale = True do_normalize = True do_convert_rgb = True crop_to_patches = True min_patches...
Cohere2VisionImageProcessorFast
python
apache__airflow
providers/fab/tests/unit/fab/auth_manager/api_endpoints/test_role_and_permission_endpoint.py
{ "start": 7094, "end": 8375 }
class ____(TestRoleEndpoint): def test_should_response_200(self): response = self.client.get("/fab/v1/permissions", environ_overrides={"REMOTE_USER": "test"}) actions = {i[0] for i in self.app.appbuilder.sm.get_all_permissions() if i} assert response.status_code == 200 assert respons...
TestGetPermissionsEndpoint
python
huggingface__transformers
tests/models/wav2vec2/test_tokenization_wav2vec2.py
{ "start": 1567, "end": 14834 }
class ____(unittest.TestCase): tokenizer_class = Wav2Vec2Tokenizer @classmethod def setUpClass(cls): super().setUpClass() vocab = "<pad> <s> </s> <unk> | E T A O N I H S R D L U M W C F G Y P B V K ' X J Q Z".split(" ") vocab_tokens = dict(zip(vocab, range(len(vocab)))) cl...
Wav2Vec2TokenizerTest
python
cookiecutter__cookiecutter
cookiecutter/exceptions.py
{ "start": 643, "end": 942 }
class ____(CookiecutterException): """ Exception for ambiguous project template directory. Raised when Cookiecutter cannot determine which directory is the project template, e.g. more than one dir appears to be a template dir. """ # unused locally
UnknownTemplateDirException
python
scipy__scipy
benchmarks/benchmarks/spatial.py
{ "start": 17047, "end": 17515 }
class ____(Benchmark): params = ([10, 100, 1000, 5000, 10000], [False, True]) param_names = ['num_points', 'furthest_site'] def setup(self, num_points, furthest_site): rng = np.random.default_rng(123) self.points = rng.random((num_points, 3)) def time_voronoi_calculation(self, num_poin...
VoronoiBench
python
bottlepy__bottle
bottle.py
{ "start": 139428, "end": 140154 }
class ____(ServerAdapter): """ Untested. Options: * See gevent.wsgi.WSGIServer() documentation for more options. """ def run(self, handler): from gevent import pywsgi, local if not isinstance(threading.local(), local.local): msg = "Bottle requires gevent.monkey.patch_al...
GeventServer
python
plotly__plotly.py
plotly/graph_objs/barpolar/_unselected.py
{ "start": 233, "end": 3367 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "barpolar" _path_str = "barpolar.unselected" _valid_props = {"marker", "textfont"} @property def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instance of :cla...
Unselected
python
astropy__astropy
astropy/units/core.py
{ "start": 60125, "end": 66287 }
class ____(UnitBase): """ The base class of units that have a name. Parameters ---------- st : str, list of str, 2-tuple The name of the unit. If a list of strings, the first element is the canonical (short) name, and the rest of the elements are aliases. If a tuple of lis...
NamedUnit
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/testing/suite/test_select.py
{ "start": 57176, "end": 57754 }
class ____(AssertsCompiledSQL, fixtures.TablesTest): __sparse_driver_backend__ = True @testing.fails_if(testing.requires.supports_distinct_on) def test_distinct_on(self): with testing.expect_deprecated( "Passing expression to ``distinct`` to generate " ): stm = selec...
DistinctOnTest
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_vision.py
{ "start": 9490, "end": 10284 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.vision.CloudVisionHook") def test_minimal_green_path(self, mock_hook): mock_hook.return_value.delete_product.return_value = {} op = CloudVisionDeleteProductOperator( location=LOCATION_TEST, product_id=PRODUCT_ID_TEST, ...
TestCloudVisionProductDelete
python
sqlalchemy__sqlalchemy
test/base/test_utils.py
{ "start": 13676, "end": 14625 }
class ____(fixtures.TestBase): @combinations(util.immutabledict({1: 2, 3: 4}), util.FacadeDict({2: 3})) def test_immutable(self, d): calls = ( lambda: d.__delitem__(1), lambda: d.__setitem__(2, 3), lambda: d.__setattr__(2, 3), d.clear, lambda: ...
ImmutableTest
python
django__django
tests/admin_views/admin.py
{ "start": 24290, "end": 24493 }
class ____(admin.ModelAdmin): def change_view(self, *args, **kwargs): kwargs["extra_context"] = {"show_delete": False} return super().change_view(*args, **kwargs)
UndeletableObjectAdmin
python
huggingface__transformers
tests/models/edgetam/test_modeling_edgetam.py
{ "start": 1488, "end": 2546 }
class ____: def __init__( self, hidden_size=32, input_image_size=128, patch_size=16, mask_input_channels=8, num_point_embeddings=4, hidden_act="gelu", ): self.hidden_size = hidden_size self.input_image_size = input_image_size self.p...
EdgeTamPromptEncoderTester
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/no_self_use.py
{ "start": 1055, "end": 1097 }
class ____: def foo(self): ...
A
python
sphinx-doc__sphinx
tests/roots/test-ext-autodoc/target/__init__.py
{ "start": 812, "end": 2250 }
class ____: """Class to document.""" def meth(self): """Function.""" def undocmeth(self): pass def skipmeth(self): """Method that should be skipped.""" def excludemeth(self): """Method that should be excluded.""" # should not be documented skipattr = 'foo...
Class
python
pyca__cryptography
src/cryptography/hazmat/primitives/asymmetric/padding.py
{ "start": 1520, "end": 2087 }
class ____(AsymmetricPadding): name = "EME-OAEP" def __init__( self, mgf: MGF, algorithm: hashes.HashAlgorithm, label: bytes | None, ): if not isinstance(algorithm, hashes.HashAlgorithm): raise TypeError("Expected instance of hashes.HashAlgorithm.") ...
OAEP
python
getsentry__sentry
src/sentry/sentry_apps/utils/errors.py
{ "start": 332, "end": 1771 }
class ____(Exception): error_type: SentryAppErrorType status_code: int def __init__( self, message: str, status_code: int | None = None, public_context: dict[str, Any] | None = None, webhook_context: dict[str, Any] | None = None, ) -> None: self.status_co...
SentryAppBaseError
python
coleifer__peewee
tests/keys.py
{ "start": 14402, "end": 15989 }
class ____(ModelTestCase): requires = [FK_A, FK_B] def test_fk_to_non_pk_field(self): a1 = FK_A.create(key='a1') a2 = FK_A.create(key='a2') b1 = FK_B.create(fk_a=a1) b2 = FK_B.create(fk_a=a2) args = (b1.fk_a, b1.fk_a_id, a1, a1.key) for arg in args: ...
TestFKtoNonPKField
python
getsentry__sentry
src/sentry/search/events/builder/errors.py
{ "start": 4078, "end": 5386 }
class ____(ErrorsQueryBuilderMixin, DiscoverQueryBuilder): def get_snql_query(self) -> Request: self.validate_having_clause() return Request( dataset=self.dataset.value, app_id="errors", query=Query( match=self.match, select=self.co...
ErrorsQueryBuilder
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-points-from-grid-queries.py
{ "start": 110, "end": 1248 }
class ____(object): def maxPoints(self, grid, queries): """ :type grid: List[List[int]] :type queries: List[int] :rtype: List[int] """ directions = [(0, 1), (0, -1), (1, 0), (-1, 0)] min_heap = [(grid[0][0], 0, 0)] lookup = [[False]*len(grid[0]) for _ ...
Solution
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 17862, "end": 19076 }
class ____(FitError): """ Raised when a solver fails to converge while fitting a distribution. """ # This exception is raised by, for example, beta_gen.fit when # optimize.fsolve returns with ier != 1. def __init__(self, mesg): emsg = "Solver for the MLE equations failed to converge: " ...
FitSolverError
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_oauth_tasks.py
{ "start": 1370, "end": 7849 }
class ____(TestCase): def setUp(self): self.user = get(User) self.project = get(Project, users=[self.user]) self.version = get(Version, project=self.project) self.socialaccount_gh = get( SocialAccount, user=self.user, provider=GitHubOAuth2Adapter.p...
SyncRemoteRepositoriesTests
python
numpy__numpy
numpy/matrixlib/tests/test_masked_matrix.py
{ "start": 346, "end": 813 }
class ____(MaskedArray, np.matrix,): def __new__(cls, data, mask=nomask): mat = np.matrix(data) _data = MaskedArray.__new__(cls, data=mat, mask=mask) return _data def __array_finalize__(self, obj): np.matrix.__array_finalize__(self, obj) MaskedArray.__array_finalize__(s...
MMatrix
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 42653, "end": 43795 }
class ____(ASTExpression): def __init__(self, typ: ASTType, expr: ASTExpression) -> None: self.typ = typ self.expr = expr def __eq__(self, other: object) -> bool: if not isinstance(other, ASTCastExpr): return NotImplemented return self.typ == other.typ and self.expr ...
ASTCastExpr
python
pypa__hatch
tests/backend/builders/plugin/test_interface.py
{ "start": 5201, "end": 14906 }
class ____: @pytest.mark.requires_unix def test_infinite_loop_prevention(self, temp_dir): project_dir = temp_dir / "project" project_dir.ensure_dir_exists() with project_dir.as_cwd(): config = {"tool": {"hatch": {"build": {"include": ["foo", "README.md"]}}}} buil...
TestDirectoryRecursion
python
allegroai__clearml
clearml/backend_api/services/v2_23/events.py
{ "start": 70692, "end": 72400 }
class ____(Request): """ Delete all task events. *This cannot be undone!* :param task: Task ID :type task: str :param allow_locked: Allow deleting events even if the task is locked :type allow_locked: bool """ _service = "events" _action = "delete_for_task" _version = "2.23" ...
DeleteForTaskRequest
python
huggingface__transformers
src/transformers/models/ibert/modeling_ibert.py
{ "start": 14050, "end": 15074 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.quant_mode = config.quant_mode self.self = IBertSelfAttention(config) self.output = IBertSelfOutput(config) def forward( self, hidden_states, hidden_states_scaling_factor, ...
IBertAttention
python
pytorch__pytorch
test/inductor/test_mix_order_reduction.py
{ "start": 2124, "end": 16516 }
class ____(TestBase): @parametrize( "name", [ "sum", "prod", "mean", ], ) @parametrize("swap", (False, True)) @parametrize("split_reductions", (False, True)) @parametrize("shape", ((32768, 768), (32769, 768), (32, 1024, 768))) def test_...
MixOrderReductionTest
python
gevent__gevent
src/greentest/3.12/test_signal.py
{ "start": 2647, "end": 7102 }
class ____(unittest.TestCase): def trivial_signal_handler(self, *args): pass def create_handler_with_partial(self, argument): return functools.partial(self.trivial_signal_handler, argument) def test_out_of_range_signal_number_raises_error(self): self.assertRaises(ValueError, signal...
PosixTests
python
keon__algorithms
tests/test_backtrack.py
{ "start": 7497, "end": 7993 }
class ____(unittest.TestCase): def test_generate_parenthesis(self): self.assertEqual(generate_parenthesis_v1(2), ['()()', '(())']) self.assertEqual(generate_parenthesis_v1(3), ['()()()', '()(())', '(())()', '(()())', '((()))']) self.assertEqual(generate_parenthesis_...
TestGenerateParenthesis
python
PrefectHQ__prefect
tests/server/orchestration/api/test_workers.py
{ "start": 15315, "end": 16440 }
class ____: async def test_delete_work_pool(self, client, work_pool, session): work_pool_id = work_pool.id response = await client.delete(f"/work_pools/{work_pool.name}") assert response.status_code == status.HTTP_204_NO_CONTENT, response.text assert not await models.workers.read_wor...
TestDeleteWorkPool
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_date02.py
{ "start": 342, "end": 2113 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_date02.xlsx") self.ignore_elements = {"xl/charts/chart1.xml": ["<c:formatCode"]} def test_create_file(self): """Test the cre...
TestCompareXLSXFiles
python
kubernetes-client__python
kubernetes/client/models/v1alpha1_mutating_admission_policy.py
{ "start": 383, "end": 6971 }
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...
V1alpha1MutatingAdmissionPolicy
python
celery__celery
t/smoke/workers/other.py
{ "start": 251, "end": 1813 }
class ____(SmokeWorkerContainer): """Alternative worker with different name and queue, but same configurations for the rest.""" @classmethod def worker_name(cls) -> str: return "other_smoke_tests_worker" @classmethod def worker_queue(cls) -> str: return "other_smoke_tests_queue" ...
OtherSmokeWorkerContainer
python
mlflow__mlflow
mlflow/pytorch/_lightning_autolog.py
{ "start": 15321, "end": 29798 }
class ____(pl.Callback, MlflowModelCheckpointCallbackBase): """Callback for auto-logging pytorch-lightning model checkpoints to MLflow. This callback implementation only supports pytorch-lightning >= 1.6.0. Args: monitor: In automatic model checkpointing, the metric name to monitor if y...
MlflowModelCheckpointCallback
python
huggingface__transformers
src/transformers/models/owlvit/processing_owlvit.py
{ "start": 1258, "end": 1529 }
class ____(ProcessingKwargs, total=False): images_kwargs: OwlViTImagesKwargs _defaults = { "text_kwargs": { "padding": "max_length", }, "common_kwargs": { "return_tensors": "pt", }, }
OwlViTProcessorKwargs
python
astropy__astropy
astropy/io/ascii/basic.py
{ "start": 959, "end": 1630 }
class ____(core.BaseReader): r"""Character-delimited table with a single header line at the top. Lines beginning with a comment character (default='#') as the first non-whitespace character are comments. Example table:: # Column definition is the first uncommented line # Default delimiter...
Basic
python
python__mypy
mypy/report.py
{ "start": 22654, "end": 26673 }
class ____(AbstractReporter): """Reporter for generating Cobertura compliant XML.""" def __init__(self, reports: Reports, output_dir: str) -> None: super().__init__(reports, output_dir) self.root = etree.Element("coverage", timestamp=str(int(time.time())), version=__version__) self.doc...
CoberturaXmlReporter
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF049.py
{ "start": 191, "end": 225 }
class ____(Flag): ... @dataclass()
E
python
django__django
tests/conditional_processing/tests.py
{ "start": 653, "end": 12863 }
class ____(SimpleTestCase): def assertFullResponse(self, response, check_last_modified=True, check_etag=True): self.assertEqual(response.status_code, 200) self.assertEqual(response.content, FULL_RESPONSE.encode()) if response.request["REQUEST_METHOD"] in ("GET", "HEAD"): if check...
ConditionalGet
python
lepture__mistune
src/mistune/core.py
{ "start": 3657, "end": 6047 }
class ____(Generic[ST]): sc_flag: "re._FlagsType" = re.M state_cls: Type[ST] SPECIFICATION: ClassVar[Dict[str, str]] = {} DEFAULT_RULES: ClassVar[Iterable[str]] = [] def __init__(self) -> None: self.specification = self.SPECIFICATION.copy() self.rules = list(self.DEFAULT_RULES) ...
Parser
python
mwaskom__seaborn
seaborn/_core/properties.py
{ "start": 11226, "end": 11345 }
class ____(IntervalProperty): """Thickness of lines that define point glyphs.""" _default_range = .25, 2.5
Stroke
python
zarr-developers__zarr-python
src/zarr/core/common.py
{ "start": 1860, "end": 7602 }
class ____(TypedDict, Generic[TName, TConfig]): """ A typed dictionary representing an object with a name and configuration, where the configuration is a mapping of string keys to values, e.g. another typed dictionary or a JSON object. This class is generic with two type parameters: the type of the nam...
NamedRequiredConfig