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 | plotly__plotly.py | plotly/graph_objs/cone/_hoverlabel.py | {
"start": 233,
"end": 11220
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "cone"
_path_str = "cone.hoverlabel"
_valid_props = {
"align",
"alignsrc",
"bgcolor",
"bgcolorsrc",
"bordercolor",
"bordercolorsrc",
"font",
"namelength",
"namelengthsrc",
... | Hoverlabel |
python | kamyu104__LeetCode-Solutions | Python/find-the-original-typed-string-i.py | {
"start": 37,
"end": 288
} | class ____(object):
def possibleStringCount(self, word):
"""
:type word: str
:rtype: int
"""
return len(word)-sum(word[i] != word[i+1] for i in xrange(len(word)-1))
# Time: O(n)
# Space: O(1)
# array
| Solution |
python | catalyst-team__catalyst | catalyst/callbacks/metrics/accuracy.py | {
"start": 190,
"end": 3939
} | class ____(BatchMetricCallback):
"""Accuracy metric callback.
Computes multiclass accuracy@topk for the specified values of `topk`.
Args:
input_key: input key to use for metric calculation, specifies our `y_pred`
target_key: output key to use for metric calculation, specifies our `y_true`
... | AccuracyCallback |
python | huggingface__transformers | src/transformers/models/pixtral/modeling_pixtral.py | {
"start": 14849,
"end": 18219
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.layers = torch.nn.ModuleList()
for _ in range(config.num_hidden_layers):
self.layers.append(PixtralAttentionLayer(config))
self.gradient_checkpointing = False
def ... | PixtralTransformer |
python | catalyst-team__catalyst | examples/detection/models/centernet.py | {
"start": 559,
"end": 1053
} | class ____(nn.Module):
"""(conv => BN => ReLU) * 2"""
def __init__(self, in_ch, out_ch):
super().__init__()
self.conv = nn.Sequential(
nn.Conv2d(in_ch, out_ch, 3, padding=1),
nn.BatchNorm2d(out_ch),
nn.ReLU(inplace=True),
nn.Conv2d(out_ch, out_ch,... | DoubleConv |
python | langchain-ai__langchain | libs/langchain/langchain_classic/agents/output_parsers/react_single_input.py | {
"start": 695,
"end": 3341
} | class ____(AgentOutputParser):
"""Parses ReAct-style LLM calls that have a single tool input.
Expects output to be in one of two formats.
If the output signals that an action should be taken,
should be in the below format. This will result in an AgentAction
being returned.
```
Thought: ag... | ReActSingleInputOutputParser |
python | coleifer__peewee | tests/reflection.py | {
"start": 1428,
"end": 1553
} | class ____(TestModel):
category_id = ForeignKeyField(Category, column_name='category_id')
category = CharField()
| Nugget |
python | hyperopt__hyperopt | hyperopt/tests/integration/test_mongoexp.py | {
"start": 4319,
"end": 7957
} | class ____(hyperopt.tests.test_base.TestTrials):
def setUp(self):
self.temp_mongo = TempMongo()
self.temp_mongo.__enter__()
self.trials = MongoTrials(
self.temp_mongo.connection_string("foo"), exp_key=None
)
def tearDown(self, *args):
self.temp_mongo.__exit__... | TestMongoTrials |
python | bokeh__bokeh | tests/unit/bokeh/server/test_auth_provider.py | {
"start": 2508,
"end": 3259
} | class ____:
def test_no_endpoints(self) -> None:
def func(filename: str):
am = bsa.AuthModule(filename)
assert am.endpoints == []
with_file_contents("""
def get_user(): pass
def get_login_url(): pass
""", func, suffix='.py')
with_file_contents("""
def get_us... | TestAuthModule_properties |
python | doocs__leetcode | solution/3200-3299/3208.Alternating Groups II/Solution.py | {
"start": 0,
"end": 353
} | class ____:
def numberOfAlternatingGroups(self, colors: List[int], k: int) -> int:
n = len(colors)
ans = cnt = 0
for i in range(n << 1):
if i and colors[i % n] == colors[(i - 1) % n]:
cnt = 1
else:
cnt += 1
ans += i >= n and... | Solution |
python | wandb__wandb | tests/system_tests/test_functional/dspy/dspy_callback_unexpected.py | {
"start": 27,
"end": 997
} | class ____(dspy.Module):
def __init__(self) -> None:
super().__init__()
self.predict = dspy.Predict("question: str -> answer: str")
def main() -> None:
from wandb.integration.dspy import WandbDSPyCallback
with wandb.init(project="dspy-system-test-unexpected") as run:
cb = WandbDSP... | MinimalProgram |
python | cherrypy__cherrypy | cherrypy/tutorial/tut05_derived_objects.py | {
"start": 102,
"end": 343
} | class ____ wish. In most real-world applications, you will probably
want to create a central base class used for all your pages, which takes
care of things like printing a common page header and footer.
"""
import os.path
import cherrypy
| you |
python | apache__avro | lang/py/avro/tool.py | {
"start": 1770,
"end": 5888
} | class ____(http.server.BaseHTTPRequestHandler):
def do_POST(self) -> None:
self.responder = responder
call_request_reader = avro.ipc.FramedReader(self.rfile)
call_request = call_request_reader.read_framed_message()
resp_body = self.responder.respond(call_request)
self.send_re... | GenericHandler |
python | apache__airflow | airflow-ctl/src/airflowctl/api/datamodels/generated.py | {
"start": 52872,
"end": 53153
} | class ____(BaseModel):
"""
Backfill collection serializer for responses in dry-run mode.
"""
backfills: Annotated[list[DryRunBackfillResponse], Field(title="Backfills")]
total_entries: Annotated[int, Field(title="Total Entries")]
| DryRunBackfillCollectionResponse |
python | modin-project__modin | modin/core/dataframe/algebra/groupby.py | {
"start": 1327,
"end": 33074
} | class ____(TreeReduce):
"""
Builder class for GroupBy aggregation functions.
Attributes
----------
ID_LEVEL_NAME : str
It's supposed that implementations may produce multiple temporary
columns per one source column in an intermediate phase. In order
for these columns to be p... | GroupByReduce |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py | {
"start": 77905,
"end": 79140
} | class ____(GeneratedAirbyteSource):
@public
def __init__(
self,
name: str,
domain: str,
client_id: str,
client_secret: str,
run_look_ids: Optional[list[str]] = None,
):
"""Airbyte Source for Looker.
Documentation can be found at https://docs.a... | LookerSource |
python | joblib__joblib | joblib/memory.py | {
"start": 10855,
"end": 33811
} | class ____(Logger):
"""Callable object decorating a function for caching its return value
each time it is called.
Methods are provided to inspect the cache or clean it.
Attributes
----------
func: callable
The original, undecorated, function.
location: string
The location ... | MemorizedFunc |
python | sqlalchemy__sqlalchemy | examples/association/dict_of_sets_with_default.py | {
"start": 2388,
"end": 3150
} | class ____(Base):
__tablename__ = "c"
b_id: Mapped[int] = mapped_column(ForeignKey("b.id"))
value: Mapped[int]
def __init__(self, value: int) -> None:
self.value = value
if __name__ == "__main__":
engine = create_engine("sqlite://", echo=True)
Base.metadata.create_all(engine)
sess... | C |
python | getsentry__sentry | src/sentry/workflow_engine/models/data_condition_group.py | {
"start": 455,
"end": 617
} | class ____(TypedDict):
id: int
logic_type: DataConditionGroup.Type
conditions: list[DataConditionSnapshot]
@region_silo_model
| DataConditionGroupSnapshot |
python | google__jax | tests/tree_util_test.py | {
"start": 2941,
"end": 3388
} | class ____:
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return f"Special(x={self.x}, y={self.y})"
def tree_flatten(self):
return ((self.x, self.y), None)
@classmethod
def tree_unflatten(cls, aux_data, children):
return cls(*children)
def __eq__(self, other):
... | Special |
python | ray-project__ray | python/ray/data/_internal/execution/progress_manager.py | {
"start": 2768,
"end": 5485
} | class ____(AbstractProgressBar):
"""Thin wrapper to provide identical interface to the ProgressBar.
Updates RichExecutionProgressManager internally.
"""
# If the name/description of the progress bar exceeds this length,
# it will be truncated.
MAX_NAME_LENGTH = 100
def __init__(
s... | SubProgressBar |
python | Netflix__metaflow | metaflow/tutorials/01-playlist/playlist.py | {
"start": 382,
"end": 4106
} | class ____(FlowSpec):
"""
A flow to help you build your favorite movie playlist.
The flow performs the following steps:
1) Ingests a CSV file containing metadata about movies.
2) Loads two of the columns from the CSV into python lists.
3) In parallel branches:
- A) Filters movies by the ... | PlayListFlow |
python | huggingface__transformers | src/transformers/models/mra/modeling_mra.py | {
"start": 30795,
"end": 31487
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = MraPredictionHeadTransform(config)
# The output weights are the same as the input embeddings, but there is
# an output-only bias for each token.
self.decoder = nn.Linear(config.hidden_size... | MraLMPredictionHead |
python | anthropics__anthropic-sdk-python | src/anthropic/types/beta/beta_tool_search_tool_result_block_param.py | {
"start": 668,
"end": 981
} | class ____(TypedDict, total=False):
content: Required[Content]
tool_use_id: Required[str]
type: Required[Literal["tool_search_tool_result"]]
cache_control: Optional[BetaCacheControlEphemeralParam]
"""Create a cache control breakpoint at this content block."""
| BetaToolSearchToolResultBlockParam |
python | falconry__falcon | examples/things_asgi.py | {
"start": 227,
"end": 988
} | class ____:
async def on_get(self, req, resp):
"""Handles GET requests"""
resp.status = falcon.HTTP_200 # This is the default status
resp.content_type = falcon.MEDIA_TEXT # Default is JSON, so override
resp.text = (
'\nTwo things awe me most, the starry sky '
... | ThingsResource |
python | huggingface__transformers | src/transformers/models/idefics3/modeling_idefics3.py | {
"start": 12962,
"end": 14310
} | class ____(GradientCheckpointingLayer):
def __init__(self, config: Idefics3VisionConfig):
super().__init__()
self.embed_dim = config.hidden_size
self.self_attn = Idefics3VisionAttention(config)
self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps)
self.ml... | Idefics3EncoderLayer |
python | pytorch__pytorch | test/jit/test_decorator.py | {
"start": 146,
"end": 834
} | class ____(JitTestCase):
def test_decorator(self):
# Note: JitTestCase.checkScript() does not work with decorators
# self.checkScript(my_function_a, (1.0,))
# Error:
# RuntimeError: expected def but found '@' here:
# @my_decorator
# ~ <--- HERE
# def m... | TestDecorator |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_background01.py | {
"start": 315,
"end": 851
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("background01.xlsx")
def test_create_file(self):
"""Test the creation of an XlsxWriter file with a background image."""
workbook = ... | TestCompareXLSXFiles |
python | google__pytype | pytype/directors/parser.py | {
"start": 1387,
"end": 1493
} | class ____(LineRange):
name: str
annotation: str
@dataclasses.dataclass(frozen=True)
| _VariableAnnotation |
python | getsentry__sentry | src/sentry/explore/endpoints/explore_saved_query_detail.py | {
"start": 5786,
"end": 6771
} | class ____(ExploreSavedQueryBase):
publish_status = {
"POST": ApiPublishStatus.PRIVATE,
}
def has_feature(self, organization, request):
return features.has(
"organizations:visibility-explore-view", organization, actor=request.user
)
def post(self, request: Request, ... | ExploreSavedQueryVisitEndpoint |
python | great-expectations__great_expectations | great_expectations/datasource/fluent/snowflake_datasource.py | {
"start": 11442,
"end": 12526
} | class ____(FluentBaseModel):
"""
Information needed to connect to a Snowflake database.
Alternative to a connection string.
https://docs.snowflake.com/en/developer-guide/python-connector/sqlalchemy#additional-connection-parameters
"""
account: AccountIdentifier
user: str
password: Unio... | ConnectionDetails |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-outbrain-amplify/source_outbrain_amplify/source.py | {
"start": 38394,
"end": 41271
} | class ____(OutbrainAmplifyStream, HttpSubStream):
primary_key = None
def __init__(self, authenticator, config, parent: Marketers, **kwargs):
super().__init__(parent=parent, **kwargs)
self.config = config
self._authenticator = authenticator
self._session = requests.sessions.Sessi... | PerformanceReportMarketersByGeoPerformance |
python | django__django | tests/custom_managers/models.py | {
"start": 2542,
"end": 2671
} | class ____(models.Manager):
def get_queryset(self):
return super().get_queryset().filter(fun=False)
| BoringPeopleManager |
python | apache__airflow | providers/amazon/tests/system/amazon/aws/tests/test_aws_auth_manager.py | {
"start": 5510,
"end": 7203
} | class ____:
"""
Run tests on Airflow using AWS auth manager with real credentials
"""
@classmethod
def teardown_class(cls):
cls.delete_avp_policy_store()
@classmethod
def delete_avp_policy_store(cls):
client = boto3.client("verifiedpermissions")
paginator = client.... | TestAwsAuthManager |
python | aio-libs__aiohttp | aiohttp/tracing.py | {
"start": 9609,
"end": 9776
} | class ____:
"""Parameters sent by the `on_request_headers_sent` signal"""
method: str
url: URL
headers: "CIMultiDict[str]"
| TraceRequestHeadersSentParams |
python | django__django | tests/custom_managers/models.py | {
"start": 717,
"end": 950
} | class ____(models.Manager):
def get_queryset(self):
return (
super()
.get_queryset()
.annotate(favorite_avg=models.Avg("favorite_books__favorite_thing_id"))
)
| AnnotatedBookManager |
python | doocs__leetcode | solution/0100-0199/0126.Word Ladder II/Solution.py | {
"start": 0,
"end": 1554
} | class ____:
def findLadders(
self, beginWord: str, endWord: str, wordList: List[str]
) -> List[List[str]]:
def dfs(path, cur):
if cur == beginWord:
ans.append(path[::-1])
return
for precursor in prev[cur]:
path.append(precur... | Solution |
python | huggingface__transformers | src/transformers/models/vivit/modeling_vivit.py | {
"start": 7752,
"end": 10140
} | class ____(nn.Module):
def __init__(self, config: VivitConfig):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"):
raise ValueError(
f"The hidden size {config.hidden_size} is not a multiple of the number o... | VivitSelfAttention |
python | jazzband__django-simple-history | simple_history/models.py | {
"start": 35630,
"end": 36542
} | class ____(ForeignKey):
"""
Allows foreign keys to work properly from a historic instance.
If you use as_of queries to extract historical instances from
a model, and you have other models that are related by foreign
key and also historic, changing them to a HistoricForeignKey
field type will al... | HistoricForeignKey |
python | allegroai__clearml | clearml/backend_api/services/v2_13/queues.py | {
"start": 50408,
"end": 51836
} | class ____(Response):
"""
Response of queues.get_default endpoint.
:param id: Queue id
:type id: str
:param name: Queue name
:type name: str
"""
_service = "queues"
_action = "get_default"
_version = "2.13"
_schema = {
"definitions": {},
"properties": {
... | GetDefaultResponse |
python | numpy__numpy | numpy/distutils/system_info.py | {
"start": 24259,
"end": 24434
} | class ____(NotFoundError):
"""
Numeric (https://www.numpy.org/) module not found.
Get it from above location, install it, and retry setup.py."""
| NumericNotFoundError |
python | ipython__ipython | tests/test_interactiveshell.py | {
"start": 28021,
"end": 28531
} | class ____(ast.NodeTransformer):
"""Wraps all integers in a call to Integer()"""
# for Python 3.7 and earlier
def visit_Num(self, node):
if isinstance(node.value, int):
return ast.Call(
func=ast.Name(id="Integer", ctx=ast.Load()), args=[node], keywords=[]
)
... | IntegerWrapper |
python | great-expectations__great_expectations | great_expectations/datasource/fluent/pandas_filesystem_datasource.py | {
"start": 720,
"end": 3175
} | class ____(_PandasFilePathDatasource):
"""Pandas based Datasource for filesystem based data assets."""
# class attributes
data_connector_type: ClassVar[Type[FilesystemDataConnector]] = FilesystemDataConnector
# these fields should not be passed to the execution engine
_EXTRA_EXCLUDED_EXEC_ENG_ARGS:... | PandasFilesystemDatasource |
python | donnemartin__system-design-primer | solutions/system_design/sales_rank/sales_rank_mapreduce.py | {
"start": 55,
"end": 1921
} | class ____(MRJob):
def within_past_week(self, timestamp):
"""Return True if timestamp is within past week, False otherwise."""
...
def mapper(self, _, line):
"""Parse each log line, extract and transform relevant lines.
Emit key value pairs of the form:
(foo, p1), 2
... | SalesRanker |
python | jina-ai__jina | tests/unit/yaml/dummy_gateway.py | {
"start": 361,
"end": 1654
} | class ____(Gateway):
def __init__(
self, arg1: str = None, arg2: str = None, arg3: str = 'default-arg3', **kwargs
):
super().__init__(**kwargs)
self.arg1 = arg1
self.arg2 = arg2
self.arg3 = arg3
async def setup_server(self):
from fastapi import FastAPI
... | DummyGateway |
python | google__pytype | pytype/pyc/opcodes.py | {
"start": 5470,
"end": 5666
} | class ____(OpcodeWithArg):
_FLAGS = HAS_JREL | HAS_ARGUMENT | STORE_JUMP | PUSHES_BLOCK
__slots__ = ("stack_depth",)
# --------------------------------------------------------
| SETUP_EXCEPT_311 |
python | getsentry__sentry | tests/sentry/manager/test_group_manager.py | {
"start": 245,
"end": 1568
} | class ____(TestCase):
def test_get_groups_by_external_issue(self) -> None:
external_issue_key = "api-123"
group = self.create_group()
integration_model, _ = self.create_provider_integration_for(
group.organization,
self.user,
provider="jira",
e... | SentryManagerTest |
python | pydantic__pydantic | pydantic-core/tests/serializers/test_bytes.py | {
"start": 4809,
"end": 6041
} | class ____:
def __init__(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)
def test_bytes_mode_set_via_model_config_not_serializer_config():
s = SchemaSerializer(
core_schema.model_schema(
BasicModel,
core_schema.model_fields_schem... | BasicModel |
python | coleifer__peewee | tests/db_tests.py | {
"start": 25418,
"end": 28096
} | class ____(BaseTestCase):
def test_proxy_context_manager(self):
db = Proxy()
class User(Model):
username = TextField()
class Meta:
database = db
self.assertRaises(AttributeError, User.create_table)
sqlite_db = SqliteDatabase(':memory:')
... | TestDBProxy |
python | numpy__numpy | numpy/distutils/cpuinfo.py | {
"start": 11191,
"end": 12915
} | class ____(CPUInfoBase):
info = None
def __init__(self):
if self.info is not None:
return
info = command_info(arch='arch',
machine='machine')
info['sysctl_hw'] = key_value_from_command('sysctl hw', sep='=')
self.__class__.info = info
... | DarwinCPUInfo |
python | tensorflow__tensorflow | tensorflow/dtensor/python/tests/collective_test.py | {
"start": 13481,
"end": 23008
} | class ____(test_util.DTensorBaseTest):
# Create two independent global AllReduce ops that should get combined.
def testGlobalAllReduceCombiner(self):
self.skipForDeviceType(['TPU'],
'This test requires 8 TPU cores.',
unless_device_count_equals_to=8)
# ... | CollectiveTestWithCustomMesh |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pep8_naming/N802.py | {
"start": 852,
"end": 1023
} | class ____(BaseHTTPRequestHandler):
def do_GET(self):
pass
def dont_GET(self):
pass
from http.server import CGIHTTPRequestHandler
| MyRequestHandler |
python | cython__cython | Cython/Shadow.py | {
"start": 2536,
"end": 2721
} | class ____:
def __call__(self, x):
return x
def __enter__(self):
pass
def __exit__(self, exc_type, exc_value, traceback):
pass
| _EmptyDecoratorAndManager |
python | tensorflow__tensorflow | tensorflow/python/checkpoint/checkpoint_test.py | {
"start": 2665,
"end": 6197
} | class ____(test.TestCase):
@test_util.run_in_graph_and_eager_modes(assert_no_eager_garbage=True)
def testAddVariable(self):
obj = NonLayerTrackable()
with self.assertRaisesRegex(ValueError, "do not specify shape"):
trackable_utils.add_variable(
obj, name="shape_specified_twice", shape=[], i... | InterfaceTests |
python | sqlalchemy__sqlalchemy | test/base/test_utils.py | {
"start": 59652,
"end": 59722
} | class ____(IdentitySetTest):
obj_type = NoHash
| NoHashIdentitySetTest |
python | doocs__leetcode | lcof2/剑指 Offer II 059. 数据流的第 K 大数值/Solution.py | {
"start": 0,
"end": 437
} | class ____:
def __init__(self, k: int, nums: List[int]):
self.q = []
self.size = k
for num in nums:
self.add(num)
def add(self, val: int) -> int:
heappush(self.q, val)
if len(self.q) > self.size:
heappop(self.q)
return self.q[0]
# Your K... | KthLargest |
python | protocolbuffers__protobuf | python/google/protobuf/internal/proto_test.py | {
"start": 4152,
"end": 5083
} | class ____(unittest.TestCase):
def test_serialize_length_prefixed(self, message_module, expected):
number_of_messages = 3
out = io.BytesIO()
for index in range(0, number_of_messages):
msg = message_module.TestAllTypes(
optional_int32=index, optional_string='hi'
)
proto.serial... | LengthPrefixedWithGolden |
python | dagster-io__dagster | python_modules/libraries/dagster-azure/dagster_azure/blob/compute_log_manager.py | {
"start": 1132,
"end": 16735
} | class ____(TruncatingCloudStorageComputeLogManager, ConfigurableClass):
"""Logs op compute function stdout and stderr to Azure Blob Storage.
This is also compatible with Azure Data Lake Storage.
Users should not instantiate this class directly. Instead, use a YAML block in ``dagster.yaml``. Examples provi... | AzureBlobComputeLogManager |
python | kamyu104__LeetCode-Solutions | Python/count-number-of-possible-root-nodes.py | {
"start": 2495,
"end": 3313
} | class ____(object):
def rootCount(self, edges, guesses, k):
"""
:type edges: List[List[int]]
:type guesses: List[List[int]]
:type k: int
:rtype: int
"""
cnt = [0]
def memoization(u, p):
if (u, p) not in memo:
memo[u, p] = in... | Solution3 |
python | walkccc__LeetCode | solutions/2214. Minimum Health to Beat Game/2214.py | {
"start": 0,
"end": 134
} | class ____:
def minimumHealth(self, damage: list[int], armor: int) -> int:
return 1 + sum(damage) - min(max(damage), armor)
| Solution |
python | google__jax | tests/mesh_utils_test.py | {
"start": 7687,
"end": 28986
} | class ____(test_util.JaxTestCase):
@parameterized.named_parameters(
('1x2x1_t', (1, 2, 1), True),
('4x4x4_t', (4, 4, 4), True),
('4x4x4_f', (4, 4, 4), False),
('8x8x16_t', (8, 8, 16), True),
('8x8x16_f', (8, 8, 16), False),
)
def test_get_physical_tpu_mesh(self, xyz, reorder):
x... | MeshUtilsTest |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 69324,
"end": 69724
} | class ____(sgqlc.types.Enum):
"""The possible subject types of a pull request review comment.
Enumeration Choices:
* `FILE`: A comment that has been made against the file of a pull
request
* `LINE`: A comment that has been made against the line of a pull
request
"""
__schema__ = g... | PullRequestReviewThreadSubjectType |
python | apache__airflow | devel-common/src/sphinx_exts/operators_and_hooks_ref.py | {
"start": 18589,
"end": 18959
} | class ____(BaseJinjaReferenceDirective):
"""Generate list of queues"""
def render_content(
self, *, tags: set[str] | None, header_separator: str = DEFAULT_HEADER_SEPARATOR
) -> str:
return _common_render_list_content(
header_separator=header_separator, resource_type="queues", te... | QueuesDirective |
python | joke2k__faker | faker/providers/color/he_IL/__init__.py | {
"start": 98,
"end": 1555
} | class ____(ColorProvider):
"""Implement color provider for ``he_IL`` locale."""
"""Source : https://he.wikipedia.org/wiki/%D7%95%D7%99%D7%A7%D7%99%D7%A4%D7%93%D7%99%D7%94:%D7%A2%D7%A8%D7%9B%D7%AA_%D7%A6%D7%91%D7%A2%D7%99%D7%9D#%D7%98%D7%91%D7%9C%D7%94_%D7%96%D7%95_%D7%9E%D7%A8%D7%90%D7%94_%D7%90%D7%AA_%D7%98%D... | Provider |
python | openai__openai-python | src/openai/types/responses/tool_choice_apply_patch.py | {
"start": 197,
"end": 319
} | class ____(BaseModel):
type: Literal["apply_patch"]
"""The tool to call. Always `apply_patch`."""
| ToolChoiceApplyPatch |
python | sqlalchemy__sqlalchemy | test/sql/test_types.py | {
"start": 17226,
"end": 17308
} | class ____(TypeDecorator):
impl = String()
cache_ok = True
| SomeTypeDecorator |
python | pytorch__pytorch | test/dynamo/test_functions.py | {
"start": 118342,
"end": 154366
} | class ____(torch._dynamo.test_case.TestCaseWithNestedGraphBreaks):
def test_func_default_tensor_args(self):
"""
Tests that we indeed reference (and mutate) "the one" default tensor arg
stored on the globally allocated function object, both from the orig and
compiled function
... | DefaultsTests |
python | graphql-python__graphene | graphene/tests/issues/test_313.py | {
"start": 75,
"end": 140
} | class ____(graphene.ObjectType):
rand = graphene.String()
| Query |
python | marshmallow-code__marshmallow | src/marshmallow/fields.py | {
"start": 2481,
"end": 15900
} | class ____(typing.Generic[_InternalT]):
"""Base field from which all other fields inherit.
This class should not be used directly within Schemas.
:param dump_default: If set, this value will be used during serialization if the
input value is missing. If not set, the field will be excluded from the
... | Field |
python | pytorch__pytorch | torch/_dynamo/variables/misc.py | {
"start": 59579,
"end": 65990
} | class ____(VariableTracker):
"""
Wrapper around `numpy.*`. Currently, is able to trace a small subset of numpy functions as well as numpy dtypes.
"""
constant_fold_functions = (tnp.issubdtype,)
def __init__(self, value, **kwargs) -> None:
super().__init__(**kwargs)
self.value = val... | NumpyVariable |
python | ray-project__ray | python/ray/llm/_internal/serve/core/configs/openai_api_models.py | {
"start": 1602,
"end": 1734
} | class ____(vLLMChatCompletionStreamResponse):
model_config = ConfigDict(arbitrary_types_allowed=True)
| ChatCompletionStreamResponse |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/flake8_annotations/annotation_presence.py | {
"start": 2774,
"end": 2925
} | class ____:
@decorator()
def __init__(self: "Foo", foo: int):
...
# Regression test for: https://github.com/astral-sh/ruff/issues/7711
| Foo |
python | celery__celery | t/unit/app/test_schedules.py | {
"start": 3356,
"end": 8966
} | class ____:
def crontab(self, *args, **kwargs):
return crontab(*args, **dict(kwargs, app=self.app))
def test_crontab_reduce(self):
c = self.crontab('*')
assert c == loads(dumps(c))
c = self.crontab(
minute='1',
hour='2',
day_of_week='3',
... | test_crontab_parser |
python | pypa__pipenv | pipenv/patched/pip/_internal/commands/inspect.py | {
"start": 697,
"end": 3324
} | class ____(Command):
"""
Inspect the content of a Python environment and produce a report in JSON format.
"""
ignore_require_venv = True
usage = """
%prog [options]"""
def add_options(self) -> None:
self.cmd_opts.add_option(
"--local",
action="store_true",... | InspectCommand |
python | bokeh__bokeh | tests/unit/bokeh/embed/test_wrappers__embed.py | {
"start": 1619,
"end": 1796
} | class ____:
def test_render(self) -> None:
assert bew.wrap_in_safely("code\nmorecode") == """\
Bokeh.safely(function() {
code
morecode
});\
"""
| Test_wrap_in_safely |
python | vyperlang__vyper | vyper/exceptions.py | {
"start": 9125,
"end": 9197
} | class ____(VyperException):
"""Illegal function call."""
| CallViolation |
python | pytorch__pytorch | torch/_inductor/template_heuristics/triton.py | {
"start": 90831,
"end": 91593
} | class ____(
MMPlusMMTemplateConfigMixin, CPUConfigHeuristic
):
"""MM Plus MM template heuristic for CPU"""
def __init__(self) -> None:
super().__init__()
# Override mm_configs to use mm_plus_mm_configs
self.mm_configs = self.mm_plus_mm_configs
# NOTE: overriding exhaustive c... | CPUMMPlusMMTemplateConfigHeuristic |
python | anthropics__anthropic-sdk-python | src/anthropic/types/beta/beta_mcp_tool_result_block.py | {
"start": 273,
"end": 439
} | class ____(BaseModel):
content: Union[str, List[BetaTextBlock]]
is_error: bool
tool_use_id: str
type: Literal["mcp_tool_result"]
| BetaMCPToolResultBlock |
python | django__django | django/db/migrations/operations/fields.py | {
"start": 245,
"end": 2638
} | class ____(Operation):
def __init__(self, model_name, name, field=None):
self.model_name = model_name
self.name = name
self.field = field
@cached_property
def model_name_lower(self):
return self.model_name.lower()
@cached_property
def name_lower(self):
retur... | FieldOperation |
python | huggingface__transformers | src/transformers/models/gemma2/modular_gemma2.py | {
"start": 18807,
"end": 22231
} | class ____(GemmaModel):
def __init__(self, config: Gemma2Config):
super().__init__(config)
self.layers = nn.ModuleList(
[Gemma2DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
)
self.rotary_emb = Gemma2RotaryEmbedding(config)
def forw... | Gemma2Model |
python | joke2k__faker | faker/providers/date_time/hy_AM/__init__.py | {
"start": 46,
"end": 791
} | class ____(DateTimeProvider):
DAY_NAMES = {
"0": "Կիրակի",
"1": "Երկուշաբթի",
"2": "Երեքշաբթի",
"3": "Չորեքշաբթի",
"4": "Հինգշաբթի",
"5": "Ուրբաթ",
"6": "Շաբաթ",
}
MONTH_NAMES = {
"01": "Հունվար",
"02": "Փետրվար",
"03": "Մարտ",... | Provider |
python | getsentry__sentry | tests/sentry/notifications/notification_action/test_issue_alert_registry_handlers.py | {
"start": 2377,
"end": 11729
} | class ____(BaseWorkflowTest):
def setUp(self) -> None:
super().setUp()
self.project = self.create_project()
self.detector = self.create_detector(project=self.project)
self.workflow = self.create_workflow(environment=self.environment)
self.rule = self.create_project_rule(proje... | TestBaseIssueAlertHandler |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 253653,
"end": 254009
} | class ____(sgqlc.types.Type):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = ("check_suite", "client_mutation_id")
check_suite = sgqlc.types.Field("CheckSuite", graphql_name="checkSuite")
client_mutation_id = sgqlc.types.Field(String, graphql_name="clie... | CreateCheckSuitePayload |
python | PrefectHQ__prefect | src/prefect/exceptions.py | {
"start": 11230,
"end": 11341
} | class ____(PrefectException):
"""Raised when attempting to unpause a run that isn't paused."""
| NotPausedError |
python | huggingface__transformers | src/transformers/models/roformer/modeling_roformer.py | {
"start": 26870,
"end": 27581
} | class ____(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = RoFormerPredictionHeadTransform(config)
# The output weights are the same as the input embeddings, but there is
# an output-only bias for each token.
self.decoder = nn.Linear(config.embedd... | RoFormerLMPredictionHead |
python | django__django | tests/admin_inlines/models.py | {
"start": 2283,
"end": 2403
} | class ____(models.Model):
dummy = models.IntegerField()
holder = models.ForeignKey(Holder2, models.CASCADE)
| Inner2 |
python | weaviate__weaviate-python-client | weaviate/collections/classes/config.py | {
"start": 61931,
"end": 62077
} | class ____(_ConfigBase):
encoding: Optional[_MuveraConfig]
aggregation: str
MultiVector = _MultiVectorConfig
@dataclass
| _MultiVectorConfig |
python | scipy__scipy | scipy/signal/tests/test_peak_finding.py | {
"start": 32211,
"end": 36023
} | class ____:
def test_find_peaks_exact(self):
"""
Generate a series of gaussians and attempt to find the peak locations.
"""
sigmas = [5.0, 3.0, 10.0, 20.0, 10.0, 50.0]
num_points = 500
test_data, act_locs = _gen_gaussians_even(sigmas, num_points)
widths = np.... | TestFindPeaksCwt |
python | huggingface__transformers | src/transformers/models/conditional_detr/modeling_conditional_detr.py | {
"start": 44619,
"end": 46285
} | class ____(PreTrainedModel):
config: ConditionalDetrConfig
base_model_prefix = "model"
main_input_name = "pixel_values"
input_modalities = ("image",)
_no_split_modules = [r"ConditionalDetrConvEncoder", r"ConditionalDetrEncoderLayer", r"ConditionalDetrDecoderLayer"]
@torch.no_grad()
def _ini... | ConditionalDetrPreTrainedModel |
python | cython__cython | Demos/benchmarks/bm_richards_cclass.py | {
"start": 6443,
"end": 6916
} | class ____(Task):
def __init__(self,i,p,w,s,r):
Task.__init__(self,i,0,None,s,r)
def fn(self, pkt: Packet | None, r: IdleTaskRec):
i = r
i.count -= 1
if i.count == 0:
return self.hold()
elif i.control & 1 == 0:
i.control //= 2
return s... | IdleTask |
python | dagster-io__dagster | python_modules/libraries/dagster-dlt/dagster_dlt/components/dlt_load_collection/scaffolder.py | {
"start": 626,
"end": 3347
} | class ____(NamedTuple):
imports: list[str]
pipelines_and_sources: Mapping[str, PipelineAndSource]
def _extract_pipeline_and_source_from_init_file(
node: ast.FunctionDef,
) -> PipelineAndSource:
"""Given a function body AST node, extracts the source code for the
local Pipeline and DltSource objects... | ParsedPipelineAndSource |
python | ApeWorX__ape | src/ape/types/coverage.py | {
"start": 9675,
"end": 12440
} | class ____(BaseModel):
"""
An individual source file with coverage collected.
"""
source_id: str
"""
The ID of the source covered.
"""
contracts: list[ContractCoverage] = []
"""
Coverage for each contract in the source file.
"""
@property
def statements(self) -> li... | ContractSourceCoverage |
python | getsentry__sentry | tests/sentry/workflow_engine/processors/test_data_condition_group.py | {
"start": 11712,
"end": 13780
} | class ____(TestEvaluationConditionCase):
def setUp(self) -> None:
super().setUp()
self.data_condition_group.logic_type = DataConditionGroup.Type.NONE
def test_evaluate_data_conditions__all_conditions_pass__fails(self) -> None:
result = evaluate_data_conditions(
self.get_cond... | TestEvaluateConditionGroupTypeNone |
python | pytorch__pytorch | test/test_fx_passes.py | {
"start": 6399,
"end": 6828
} | class ____(OperatorSupport):
def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
return (node.op == "call_function" and
node.target in {operator.add, operator.getitem,
torch.ops.aten.view,
torch.ops.aten.permut... | MockOperatorSupport |
python | PyCQA__pyflakes | pyflakes/messages.py | {
"start": 5993,
"end": 6163
} | class ____(Message):
"""
Indicates an except: block as not the last exception handler.
"""
message = 'default \'except:\' must be last'
| DefaultExceptNotLast |
python | django__django | tests/one_to_one/models.py | {
"start": 814,
"end": 977
} | class ____(models.Model):
place = models.OneToOneField(Place, models.SET_NULL, null=True)
serves_cocktails = models.BooleanField(default=True)
| UndergroundBar |
python | huggingface__transformers | tests/models/speecht5/test_processing_speecht5.py | {
"start": 1202,
"end": 7063
} | class ____(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.tmpdirname = tempfile.mkdtemp()
tokenizer = SpeechT5Tokenizer(SAMPLE_VOCAB)
tokenizer.save_pretrained(cls.tmpdirname)
feature_extractor_map = {
"feature_size": 1,
"padding_value": 0.0,
... | SpeechT5ProcessorTest |
python | neetcode-gh__leetcode | python/0802-find-eventual-safe-states.py | {
"start": 0,
"end": 496
} | class ____:
def eventualSafeNodes(self, graph: List[List[int]]) -> List[int]:
n = len(graph)
safe = {}
res = []
def dfs(i):
if i in safe:
return safe[i]
safe[i] = False
for nei in graph[i]:
if not dfs(nei):
... | Solution |
python | pydata__xarray | xarray/tests/test_backends.py | {
"start": 189566,
"end": 193917
} | class ____(NetCDF3Only, CFEncodedBase):
# verify that we can read and write netCDF3 files as long as we have scipy
# or netCDF4-python installed
file_format: T_NetcdfTypes = "NETCDF3_64BIT"
def test_write_store(self) -> None:
# there's no specific store to test here
pass
@requires_... | TestGenericNetCDFData |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-service-now/tests/test_snow_kb_reader.py | {
"start": 1933,
"end": 3619
} | class ____:
"""Mock password grant flow for ServiceNow authentication."""
def __init__(self, *args, **kwargs):
pass
@pytest.fixture
def mock_pysnc_imports():
"""Mock pysnc imports for testing."""
with patch.dict("sys.modules", {"pysnc": MagicMock(), "pysnc.auth": MagicMock()}):
sys.mo... | MockPasswordGrantFlow |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.