blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ceacf4537ea150c11f31e82ce90197139f985a83 | [
"def isMagic(i, j):\n s = set()\n for x in range(3):\n for y in range(3):\n s.add(grid[i + x][j + y])\n if len(s) == 9 and max(s) == 9 and (min(s) == 1):\n a = sum([grid[i + x][j + x] for x in range(3)])\n b = sum([grid[i + (2 - x)][j + x] for x in range(3)])\n if a !... | <|body_start_0|>
def isMagic(i, j):
s = set()
for x in range(3):
for y in range(3):
s.add(grid[i + x][j + y])
if len(s) == 9 and max(s) == 9 and (min(s) == 1):
a = sum([grid[i + x][j + x] for x in range(3)])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numMagicSquaresInside(self, grid):
""":type grid: List[List[int]] :rtype: int 43 ms"""
<|body_0|>
def numMagicSquaresInside_1(self, g):
"""36ms :param g: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def isMagic(i, j):
... | stack_v2_sparse_classes_36k_train_029900 | 2,335 | no_license | [
{
"docstring": ":type grid: List[List[int]] :rtype: int 43 ms",
"name": "numMagicSquaresInside",
"signature": "def numMagicSquaresInside(self, grid)"
},
{
"docstring": "36ms :param g: :return:",
"name": "numMagicSquaresInside_1",
"signature": "def numMagicSquaresInside_1(self, g)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017741 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numMagicSquaresInside(self, grid): :type grid: List[List[int]] :rtype: int 43 ms
- def numMagicSquaresInside_1(self, g): 36ms :param g: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numMagicSquaresInside(self, grid): :type grid: List[List[int]] :rtype: int 43 ms
- def numMagicSquaresInside_1(self, g): 36ms :param g: :return:
<|skeleton|>
class Solution:... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def numMagicSquaresInside(self, grid):
""":type grid: List[List[int]] :rtype: int 43 ms"""
<|body_0|>
def numMagicSquaresInside_1(self, g):
"""36ms :param g: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numMagicSquaresInside(self, grid):
""":type grid: List[List[int]] :rtype: int 43 ms"""
def isMagic(i, j):
s = set()
for x in range(3):
for y in range(3):
s.add(grid[i + x][j + y])
if len(s) == 9 and max(s) ==... | the_stack_v2_python_sparse | MagicSquaresInGrid_840.py | 953250587/leetcode-python | train | 2 | |
f59098d37c9d75f5838d1c95cb05601d8167acf8 | [
"dist_vect = []\nfor j in range(self._datalen):\n if inst != j:\n locator = [inst, j]\n if inst < j:\n locator.reverse()\n dist_vect.append(self._distance_array[locator[0]][locator[1]])\ndist_vect = np.array(dist_vect)\ninst_avg_dist = np.average(dist_vect)\ninst_std = np.std(dist... | <|body_start_0|>
dist_vect = []
for j in range(self._datalen):
if inst != j:
locator = [inst, j]
if inst < j:
locator.reverse()
dist_vect.append(self._distance_array[locator[0]][locator[1]])
dist_vect = np.array(dist... | Feature selection using data-mined expert knowledge. Based on the MultiSURF algorithm as introduced in: Moore, Jason et al. Multiple Threshold Spatially Uniform ReliefF for the Genetic Analysis of Complex Human Diseases. | MultiSURFstar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiSURFstar:
"""Feature selection using data-mined expert knowledge. Based on the MultiSURF algorithm as introduced in: Moore, Jason et al. Multiple Threshold Spatially Uniform ReliefF for the Genetic Analysis of Complex Human Diseases."""
def _find_neighbors(self, inst):
"""Identi... | stack_v2_sparse_classes_36k_train_029901 | 3,281 | no_license | [
{
"docstring": "Identify nearest as well as farthest hits and misses within radius defined by average distance and standard deviation of distances from target instanace. This works the same regardless of endpoint type.",
"name": "_find_neighbors",
"signature": "def _find_neighbors(self, inst)"
},
{
... | 2 | stack_v2_sparse_classes_30k_val_000671 | Implement the Python class `MultiSURFstar` described below.
Class description:
Feature selection using data-mined expert knowledge. Based on the MultiSURF algorithm as introduced in: Moore, Jason et al. Multiple Threshold Spatially Uniform ReliefF for the Genetic Analysis of Complex Human Diseases.
Method signatures ... | Implement the Python class `MultiSURFstar` described below.
Class description:
Feature selection using data-mined expert knowledge. Based on the MultiSURF algorithm as introduced in: Moore, Jason et al. Multiple Threshold Spatially Uniform ReliefF for the Genetic Analysis of Complex Human Diseases.
Method signatures ... | c2719345ed5016fae664275e3b913b9d4fc582f9 | <|skeleton|>
class MultiSURFstar:
"""Feature selection using data-mined expert knowledge. Based on the MultiSURF algorithm as introduced in: Moore, Jason et al. Multiple Threshold Spatially Uniform ReliefF for the Genetic Analysis of Complex Human Diseases."""
def _find_neighbors(self, inst):
"""Identi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiSURFstar:
"""Feature selection using data-mined expert knowledge. Based on the MultiSURF algorithm as introduced in: Moore, Jason et al. Multiple Threshold Spatially Uniform ReliefF for the Genetic Analysis of Complex Human Diseases."""
def _find_neighbors(self, inst):
"""Identify nearest as... | the_stack_v2_python_sparse | implementations-develop/algorithms/MultiSURFstar/reference_impl.py | jernejvivod/bachelors-thesis | train | 0 |
ea0e2b5ae05797d5666ca9f759aef662c84d2100 | [
"if field_name:\n self.source = field_name[:-len(self.field_name_suffix)]\nsuper().bind(field_name, parent)",
"list_kwargs = {'child_relation': cls(*args, **kwargs)}\nfor key in kwargs.keys():\n if key in MANY_RELATION_KWARGS:\n list_kwargs[key] = kwargs[key]\nreturn IdManyRelatedField(**list_kwargs)... | <|body_start_0|>
if field_name:
self.source = field_name[:-len(self.field_name_suffix)]
super().bind(field_name, parent)
<|end_body_0|>
<|body_start_1|>
list_kwargs = {'child_relation': cls(*args, **kwargs)}
for key in kwargs.keys():
if key in MANY_RELATION_KWARG... | Field, that renames the field name to FIELD_NAME_id. Only works together the our ModelSerializer. | IdPrimaryKeyRelatedField | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdPrimaryKeyRelatedField:
"""Field, that renames the field name to FIELD_NAME_id. Only works together the our ModelSerializer."""
def bind(self, field_name: str, parent: Any) -> None:
"""Called when the field is bound to the serializer. Changes the source so that the original field n... | stack_v2_sparse_classes_36k_train_029902 | 9,153 | permissive | [
{
"docstring": "Called when the field is bound to the serializer. Changes the source so that the original field name is used (removes the _id suffix).",
"name": "bind",
"signature": "def bind(self, field_name: str, parent: Any) -> None"
},
{
"docstring": "Method from rest_framework.relations.Rel... | 2 | stack_v2_sparse_classes_30k_train_013649 | Implement the Python class `IdPrimaryKeyRelatedField` described below.
Class description:
Field, that renames the field name to FIELD_NAME_id. Only works together the our ModelSerializer.
Method signatures and docstrings:
- def bind(self, field_name: str, parent: Any) -> None: Called when the field is bound to the se... | Implement the Python class `IdPrimaryKeyRelatedField` described below.
Class description:
Field, that renames the field name to FIELD_NAME_id. Only works together the our ModelSerializer.
Method signatures and docstrings:
- def bind(self, field_name: str, parent: Any) -> None: Called when the field is bound to the se... | 7dc35dce404339b41c7729eb3de29010ca63f9a0 | <|skeleton|>
class IdPrimaryKeyRelatedField:
"""Field, that renames the field name to FIELD_NAME_id. Only works together the our ModelSerializer."""
def bind(self, field_name: str, parent: Any) -> None:
"""Called when the field is bound to the serializer. Changes the source so that the original field n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdPrimaryKeyRelatedField:
"""Field, that renames the field name to FIELD_NAME_id. Only works together the our ModelSerializer."""
def bind(self, field_name: str, parent: Any) -> None:
"""Called when the field is bound to the serializer. Changes the source so that the original field name is used (... | the_stack_v2_python_sparse | server/openslides/utils/rest_api.py | FinnStutzenstein/OpenSlides | train | 0 |
1208f0390d0d3650b192dcd5158d5b94fcacbc98 | [
"self._engine = create_engine('sqlite:///a.db', echo=False)\nBase.metadata.drop_all(self._engine)\nBase.metadata.create_all(self._engine)\nself.__session = None",
"if self.__session is None:\n DBSession = sessionmaker(bind=self._engine)\n self.__session = DBSession()\nreturn self.__session",
"user = User(... | <|body_start_0|>
self._engine = create_engine('sqlite:///a.db', echo=False)
Base.metadata.drop_all(self._engine)
Base.metadata.create_all(self._engine)
self.__session = None
<|end_body_0|>
<|body_start_1|>
if self.__session is None:
DBSession = sessionmaker(bind=self... | Database class for SQLAlchemy | DB | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DB:
"""Database class for SQLAlchemy"""
def __init__(self):
"""creates engine"""
<|body_0|>
def _session(self):
"""creates a session"""
<|body_1|>
def add_user(self, email: str, hashed_password: str) -> User:
"""This method saves a new user t... | stack_v2_sparse_classes_36k_train_029903 | 2,314 | no_license | [
{
"docstring": "creates engine",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "creates a session",
"name": "_session",
"signature": "def _session(self)"
},
{
"docstring": "This method saves a new user to the database",
"name": "add_user",
"signa... | 5 | stack_v2_sparse_classes_30k_train_009606 | Implement the Python class `DB` described below.
Class description:
Database class for SQLAlchemy
Method signatures and docstrings:
- def __init__(self): creates engine
- def _session(self): creates a session
- def add_user(self, email: str, hashed_password: str) -> User: This method saves a new user to the database
... | Implement the Python class `DB` described below.
Class description:
Database class for SQLAlchemy
Method signatures and docstrings:
- def __init__(self): creates engine
- def _session(self): creates a session
- def add_user(self, email: str, hashed_password: str) -> User: This method saves a new user to the database
... | 2ab609541ff8b45cdc923c24d629f160ddc6f3cf | <|skeleton|>
class DB:
"""Database class for SQLAlchemy"""
def __init__(self):
"""creates engine"""
<|body_0|>
def _session(self):
"""creates a session"""
<|body_1|>
def add_user(self, email: str, hashed_password: str) -> User:
"""This method saves a new user t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DB:
"""Database class for SQLAlchemy"""
def __init__(self):
"""creates engine"""
self._engine = create_engine('sqlite:///a.db', echo=False)
Base.metadata.drop_all(self._engine)
Base.metadata.create_all(self._engine)
self.__session = None
def _session(self):
... | the_stack_v2_python_sparse | 0x08-user_authentication_service/db.py | MatriMariem/holbertonschool-web_back_end | train | 0 |
4c9ee25f0b8d73001f622259d06d2f8bb7ad3f00 | [
"super().__init__(columns=columns)\nself.offsets = offsets\nassert len(self.columns) == len(self.offsets), \"Number of offsets doesn't match the number of columns\"",
"offsets = -df[columns].min(axis=0)\nassert offsets is not None\nreturn cls(columns=columns, offsets=offsets)",
"df_res = df.drop(list(self.colum... | <|body_start_0|>
super().__init__(columns=columns)
self.offsets = offsets
assert len(self.columns) == len(self.offsets), "Number of offsets doesn't match the number of columns"
<|end_body_0|>
<|body_start_1|>
offsets = -df[columns].min(axis=0)
assert offsets is not None
... | Shifts (adds a given offset to) all values in a column. If constructed using the .from_df() constructor, the offset will be inferred as minus the min. of the values, such that the minimum of the transformed values is always 0. If combined with the MaxNormaliseTransform, these will normalise the range of the variables t... | ShiftTransform | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShiftTransform:
"""Shifts (adds a given offset to) all values in a column. If constructed using the .from_df() constructor, the offset will be inferred as minus the min. of the values, such that the minimum of the transformed values is always 0. If combined with the MaxNormaliseTransform, these w... | stack_v2_sparse_classes_36k_train_029904 | 31,072 | permissive | [
{
"docstring": "Args: columns, a sequence of columns offsets, a sequence of offsets",
"name": "__init__",
"signature": "def __init__(self, columns: Sequence[str], offsets: Sequence[float]) -> None"
},
{
"docstring": "Constructor method for creating a shift transform such that the ranges of the t... | 6 | null | Implement the Python class `ShiftTransform` described below.
Class description:
Shifts (adds a given offset to) all values in a column. If constructed using the .from_df() constructor, the offset will be inferred as minus the min. of the values, such that the minimum of the transformed values is always 0. If combined ... | Implement the Python class `ShiftTransform` described below.
Class description:
Shifts (adds a given offset to) all values in a column. If constructed using the .from_df() constructor, the offset will be inferred as minus the min. of the values, such that the minimum of the transformed values is always 0. If combined ... | 40bab526af6562653c42dbb32b174524c44ce2ba | <|skeleton|>
class ShiftTransform:
"""Shifts (adds a given offset to) all values in a column. If constructed using the .from_df() constructor, the offset will be inferred as minus the min. of the values, such that the minimum of the transformed values is always 0. If combined with the MaxNormaliseTransform, these w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShiftTransform:
"""Shifts (adds a given offset to) all values in a column. If constructed using the .from_df() constructor, the offset will be inferred as minus the min. of the values, such that the minimum of the transformed values is always 0. If combined with the MaxNormaliseTransform, these will normalise... | the_stack_v2_python_sparse | PyStationB/libraries/ABEX/abex/transforms.py | mebristo/station-b-libraries | train | 0 |
779b08f10a723058e61abf3d83301d8763d85038 | [
"if t not in cls.EMBED_MAPPER:\n raise DependencyEmbedderError('Type %s is not mapped! Types mapped: %s' % (t, cls.EMBED_MAPPER.keys()))\nreturn ['.'.join([base_path, e]) for e in cls.EMBED_MAPPER[t]]",
"if not isinstance(additional_embeds, list):\n raise DependencyEmbedderError('Invalid type for additional... | <|body_start_0|>
if t not in cls.EMBED_MAPPER:
raise DependencyEmbedderError('Type %s is not mapped! Types mapped: %s' % (t, cls.EMBED_MAPPER.keys()))
return ['.'.join([base_path, e]) for e in cls.EMBED_MAPPER[t]]
<|end_body_0|>
<|body_start_1|>
if not isinstance(additional_embeds, ... | Utility class intended to be used to produce the embedded list necessary for a default embed of a given type. This class is intended to be used by calling the `embed_defaults_for_type` method. Note that the type mappings are specified in EMBED_MAPPER and that 'compound' embeds are specified verbosely ie: bio_feature em... | DependencyEmbedder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DependencyEmbedder:
"""Utility class intended to be used to produce the embedded list necessary for a default embed of a given type. This class is intended to be used by calling the `embed_defaults_for_type` method. Note that the type mappings are specified in EMBED_MAPPER and that 'compound' emb... | stack_v2_sparse_classes_36k_train_029905 | 2,667 | permissive | [
{
"docstring": "Embeds the fields necessary for a default embed of the given type and base_path :param base_path: path to linkTo :param t: item type this embed is for :return: list of embeds",
"name": "embed_defaults_for_type",
"signature": "def embed_defaults_for_type(cls, *, base_path, t)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_020554 | Implement the Python class `DependencyEmbedder` described below.
Class description:
Utility class intended to be used to produce the embedded list necessary for a default embed of a given type. This class is intended to be used by calling the `embed_defaults_for_type` method. Note that the type mappings are specified ... | Implement the Python class `DependencyEmbedder` described below.
Class description:
Utility class intended to be used to produce the embedded list necessary for a default embed of a given type. This class is intended to be used by calling the `embed_defaults_for_type` method. Note that the type mappings are specified ... | 10d3f81776963b416488c8121c7e0db8b66727bf | <|skeleton|>
class DependencyEmbedder:
"""Utility class intended to be used to produce the embedded list necessary for a default embed of a given type. This class is intended to be used by calling the `embed_defaults_for_type` method. Note that the type mappings are specified in EMBED_MAPPER and that 'compound' emb... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DependencyEmbedder:
"""Utility class intended to be used to produce the embedded list necessary for a default embed of a given type. This class is intended to be used by calling the `embed_defaults_for_type` method. Note that the type mappings are specified in EMBED_MAPPER and that 'compound' embeds are speci... | the_stack_v2_python_sparse | src/encoded/types/dependencies.py | dbmi-bgm/cgap-portal | train | 7 |
165d6667ee71e686634141882b2b806e4a22a047 | [
"self.phys = phys\nself.forces = forces\nn = self.phys.numAtoms()\nself.q = []\nfor i in range(0, n):\n self.q.append(self.phys.charge(i + 1))",
"n = self.phys.numAtoms()\nfor i in range(0, n):\n for j in range(i + 1, n):\n rij = self.phys.positions[j * 3:j * 3 + 3] - self.phys.positions[i * 3:i * 3 ... | <|body_start_0|>
self.phys = phys
self.forces = forces
n = self.phys.numAtoms()
self.q = []
for i in range(0, n):
self.q.append(self.phys.charge(i + 1))
<|end_body_0|>
<|body_start_1|>
n = self.phys.numAtoms()
for i in range(0, n):
for j i... | Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2 | ElectrostaticForce | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElectrostaticForce:
"""Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2"""
def __init__(self, phys, forces):
"""Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces obje... | stack_v2_sparse_classes_36k_train_029906 | 1,304 | no_license | [
{
"docstring": "Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces object",
"name": "__init__",
"signature": "def __init__(self, phys, forces)"
},
{
"docstring": "Modify energy and force vector to include thi... | 2 | stack_v2_sparse_classes_30k_train_017061 | Implement the Python class `ElectrostaticForce` described below.
Class description:
Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2
Method signatures and docstrings:
- def __init__(self, phys, forces): Initialize an object of type HDForce @type phys: Physical @param phys: The physical sy... | Implement the Python class `ElectrostaticForce` described below.
Class description:
Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2
Method signatures and docstrings:
- def __init__(self, phys, forces): Initialize an object of type HDForce @type phys: Physical @param phys: The physical sy... | 78c96b72204e301d36f8cbe03397f2a02377279f | <|skeleton|>
class ElectrostaticForce:
"""Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2"""
def __init__(self, phys, forces):
"""Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces obje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElectrostaticForce:
"""Implement a harmonic dihedral constraining potential: U(x) = k*(phi - phi0)^2"""
def __init__(self, phys, forces):
"""Initialize an object of type HDForce @type phys: Physical @param phys: The physical system. @type forces: Forces @param forces: MDL Forces object"""
... | the_stack_v2_python_sparse | mdl/src/forces/ElectrostaticForce.py | kuangchen/ProtoMolAddon | train | 1 |
a107c5bd029ac846bbaa0bd4df15388109fd0165 | [
"self._ext_init = ext_init\nself.data_x_in = Signal(32)\nself.data_x_out = Signal(32)\nself.data_y_in = Signal(32)\nself.data_z_in = Signal(32)\nself.csr_num = Signal(CSRAddr)\nself.csr_to_x = Signal()\nself.z_to_csr = Signal()\nself.save_trap_csrs = Signal()\nself._mcause = Signal(32)\nself._mepc = Signal(32)\nsel... | <|body_start_0|>
self._ext_init = ext_init
self.data_x_in = Signal(32)
self.data_x_out = Signal(32)
self.data_y_in = Signal(32)
self.data_z_in = Signal(32)
self.csr_num = Signal(CSRAddr)
self.csr_to_x = Signal()
self.z_to_csr = Signal()
self.save_t... | Logic for the exception card. Attributes: data_x_in: The X bus, read from. data_x_out: The X bus, written to. data_y_in: The Y bus, always read from. data_z_in: The Z bus, always read from. csr_num: The CSR number for access. csr_to_x: Read the CSR (output to X). z_to_csr: Write the CSR (input from Z). save_trap_csrs: ... | ExcCard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExcCard:
"""Logic for the exception card. Attributes: data_x_in: The X bus, read from. data_x_out: The X bus, written to. data_y_in: The Y bus, always read from. data_z_in: The Z bus, always read from. csr_num: The CSR number for access. csr_to_x: Read the CSR (output to X). z_to_csr: Write the C... | stack_v2_sparse_classes_36k_train_029907 | 4,255 | no_license | [
{
"docstring": "Constructs an exception card.",
"name": "__init__",
"signature": "def __init__(self, ext_init: bool=False)"
},
{
"docstring": "Implements the logic of the exception card.",
"name": "elaborate",
"signature": "def elaborate(self, _: Platform) -> Module"
},
{
"docstr... | 3 | stack_v2_sparse_classes_30k_train_006693 | Implement the Python class `ExcCard` described below.
Class description:
Logic for the exception card. Attributes: data_x_in: The X bus, read from. data_x_out: The X bus, written to. data_y_in: The Y bus, always read from. data_z_in: The Z bus, always read from. csr_num: The CSR number for access. csr_to_x: Read the C... | Implement the Python class `ExcCard` described below.
Class description:
Logic for the exception card. Attributes: data_x_in: The X bus, read from. data_x_out: The X bus, written to. data_y_in: The Y bus, always read from. data_z_in: The Z bus, always read from. csr_num: The CSR number for access. csr_to_x: Read the C... | 9e652e1ca6dd5c2488ec30560b175d6d20ee003f | <|skeleton|>
class ExcCard:
"""Logic for the exception card. Attributes: data_x_in: The X bus, read from. data_x_out: The X bus, written to. data_y_in: The Y bus, always read from. data_z_in: The Z bus, always read from. csr_num: The CSR number for access. csr_to_x: Read the CSR (output to X). z_to_csr: Write the C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExcCard:
"""Logic for the exception card. Attributes: data_x_in: The X bus, read from. data_x_out: The X bus, written to. data_y_in: The Y bus, always read from. data_z_in: The Z bus, always read from. csr_num: The CSR number for access. csr_to_x: Read the CSR (output to X). z_to_csr: Write the CSR (input fro... | the_stack_v2_python_sparse | exc_card.py | ElMahdiElAnnabi/riscv-reboot | train | 0 |
ac0e61641049f092d7d61c965dea56bb3a3bd2a2 | [
"def backTrack(nums, tmp, res, used):\n if len(tmp) == len(nums):\n t = tmp.copy()\n res.append(t)\n else:\n for i in range(len(nums)):\n if used[i] or (i > 0 and nums[i] == nums[i - 1] and (not used[i - 1])):\n continue\n else:\n used[i... | <|body_start_0|>
def backTrack(nums, tmp, res, used):
if len(tmp) == len(nums):
t = tmp.copy()
res.append(t)
else:
for i in range(len(nums)):
if used[i] or (i > 0 and nums[i] == nums[i - 1] and (not used[i - 1])):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique0(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def backTrack(nu... | stack_v2_sparse_classes_36k_train_029908 | 1,404 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique",
"signature": "def permuteUnique(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique0",
"signature": "def permuteUnique0(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique0(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique0(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class S... | 9e49b2c6003b957276737005d4aaac276b44d251 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique0(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
def backTrack(nums, tmp, res, used):
if len(tmp) == len(nums):
t = tmp.copy()
res.append(t)
else:
for i in range(len(nums)):
... | the_stack_v2_python_sparse | PythonCode/src/0047_Permutations_II.py | oneyuan/CodeforFun | train | 0 | |
32f31b2c567502688938e0f41527ac10ebd8c6a3 | [
"if self.user_offset is not None:\n value = value - self.user_offset\nvalue /= self.scale\nreturn convert_unit(value, self.derived_units, self.original_units)",
"derived_value = convert_unit(value, self.original_units, self.derived_units)\nderived_value *= self.scale\nif self.user_offset is not None:\n deri... | <|body_start_0|>
if self.user_offset is not None:
value = value - self.user_offset
value /= self.scale
return convert_unit(value, self.derived_units, self.original_units)
<|end_body_0|>
<|body_start_1|>
derived_value = convert_unit(value, self.original_units, self.derived_un... | _ScaledUnitConversionDerivedSignal | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _ScaledUnitConversionDerivedSignal:
def forward(self, value):
"""Compute derived signal value -> original signal value"""
<|body_0|>
def inverse(self, value):
"""Compute original signal value -> derived signal value"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_029909 | 16,653 | permissive | [
{
"docstring": "Compute derived signal value -> original signal value",
"name": "forward",
"signature": "def forward(self, value)"
},
{
"docstring": "Compute original signal value -> derived signal value",
"name": "inverse",
"signature": "def inverse(self, value)"
}
] | 2 | null | Implement the Python class `_ScaledUnitConversionDerivedSignal` described below.
Class description:
Implement the _ScaledUnitConversionDerivedSignal class.
Method signatures and docstrings:
- def forward(self, value): Compute derived signal value -> original signal value
- def inverse(self, value): Compute original s... | Implement the Python class `_ScaledUnitConversionDerivedSignal` described below.
Class description:
Implement the _ScaledUnitConversionDerivedSignal class.
Method signatures and docstrings:
- def forward(self, value): Compute derived signal value -> original signal value
- def inverse(self, value): Compute original s... | 9d928b1466dd3714d38c703d7d07953a9f1b58f1 | <|skeleton|>
class _ScaledUnitConversionDerivedSignal:
def forward(self, value):
"""Compute derived signal value -> original signal value"""
<|body_0|>
def inverse(self, value):
"""Compute original signal value -> derived signal value"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _ScaledUnitConversionDerivedSignal:
def forward(self, value):
"""Compute derived signal value -> original signal value"""
if self.user_offset is not None:
value = value - self.user_offset
value /= self.scale
return convert_unit(value, self.derived_units, self.origin... | the_stack_v2_python_sparse | pcdsdevices/lxe.py | slactjohnson/pcdsdevices | train | 0 | |
74494fdb35ea2079f7140b73b4f5612d30f86369 | [
"super(LeNet, self).__init__()\nself.conv1 = nn.Conv2d(in_channels=3, out_channels=6, kernel_size=5, stride=1)\nself.conv2 = nn.Conv2d(in_channels=6, out_channels=16, kernel_size=5, stride=1)\nself.fc1 = nn.Linear(in_features=5 * 5 * 16, out_features=120)\nself.fc2 = nn.Linear(in_features=120, out_features=84)\nsel... | <|body_start_0|>
super(LeNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=6, kernel_size=5, stride=1)
self.conv2 = nn.Conv2d(in_channels=6, out_channels=16, kernel_size=5, stride=1)
self.fc1 = nn.Linear(in_features=5 * 5 * 16, out_features=120)
self.fc2 = ... | 自定义卷积神经网络 | LeNet | [
"LicenseRef-scancode-mulanpsl-2.0-en",
"MulanPSL-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeNet:
"""自定义卷积神经网络"""
def __init__(self, classes):
"""确定网络的各个层次结构 :param classes: 分类的类别数目"""
<|body_0|>
def forward(self, x):
"""正向传播 :param x: 一个批次的图片特征数据 :return: 对应的预测值"""
<|body_1|>
def initialize_weight(self):
"""初始化卷积神经网络参数 :return: No... | stack_v2_sparse_classes_36k_train_029910 | 4,131 | permissive | [
{
"docstring": "确定网络的各个层次结构 :param classes: 分类的类别数目",
"name": "__init__",
"signature": "def __init__(self, classes)"
},
{
"docstring": "正向传播 :param x: 一个批次的图片特征数据 :return: 对应的预测值",
"name": "forward",
"signature": "def forward(self, x)"
},
{
"docstring": "初始化卷积神经网络参数 :return: None... | 3 | null | Implement the Python class `LeNet` described below.
Class description:
自定义卷积神经网络
Method signatures and docstrings:
- def __init__(self, classes): 确定网络的各个层次结构 :param classes: 分类的类别数目
- def forward(self, x): 正向传播 :param x: 一个批次的图片特征数据 :return: 对应的预测值
- def initialize_weight(self): 初始化卷积神经网络参数 :return: None | Implement the Python class `LeNet` described below.
Class description:
自定义卷积神经网络
Method signatures and docstrings:
- def __init__(self, classes): 确定网络的各个层次结构 :param classes: 分类的类别数目
- def forward(self, x): 正向传播 :param x: 一个批次的图片特征数据 :return: 对应的预测值
- def initialize_weight(self): 初始化卷积神经网络参数 :return: None
<|skeleton|... | 6abcec4dcbe83a4c359418f44e7f8f1a3286a884 | <|skeleton|>
class LeNet:
"""自定义卷积神经网络"""
def __init__(self, classes):
"""确定网络的各个层次结构 :param classes: 分类的类别数目"""
<|body_0|>
def forward(self, x):
"""正向传播 :param x: 一个批次的图片特征数据 :return: 对应的预测值"""
<|body_1|>
def initialize_weight(self):
"""初始化卷积神经网络参数 :return: No... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LeNet:
"""自定义卷积神经网络"""
def __init__(self, classes):
"""确定网络的各个层次结构 :param classes: 分类的类别数目"""
super(LeNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=6, kernel_size=5, stride=1)
self.conv2 = nn.Conv2d(in_channels=6, out_channels=16, kernel_size=5, ... | the_stack_v2_python_sparse | day29-30-项目:RMB识别项目/lenet.py | wangfud/abc | train | 0 |
f65c362b60fea43c304948dc4fdb6578b7b99b1b | [
"self.adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(n)]\nself.adj_list_creator(mat)\nself.visited: List[bool] = [False] * n\nself.q: List[Tuple[int, int]] = []\nself.src: int = src\nself.D: List[int] = [MAXINT] * n",
"for i in range(len(mat)):\n v1, v2 = mat[i]\n self.adj_list[v1].append(v2)\n ... | <|body_start_0|>
self.adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(n)]
self.adj_list_creator(mat)
self.visited: List[bool] = [False] * n
self.q: List[Tuple[int, int]] = []
self.src: int = src
self.D: List[int] = [MAXINT] * n
<|end_body_0|>
<|body_start_1|>
... | Graph | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
def __init__(self, n: int, mat: List[List[int]], src: int=0):
"""Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)"""
<|body_0|>
def adj_list_creator(self, mat: List[List[int]]):
"""Creates the adjacency list... | stack_v2_sparse_classes_36k_train_029911 | 1,956 | permissive | [
{
"docstring": "Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)",
"name": "__init__",
"signature": "def __init__(self, n: int, mat: List[List[int]], src: int=0)"
},
{
"docstring": "Creates the adjacency list for given matrix in the format: [[... | 3 | stack_v2_sparse_classes_30k_train_004848 | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, n: int, mat: List[List[int]], src: int=0): Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)
- def adj_list_creat... | Implement the Python class `Graph` described below.
Class description:
Implement the Graph class.
Method signatures and docstrings:
- def __init__(self, n: int, mat: List[List[int]], src: int=0): Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)
- def adj_list_creat... | 92543c954801e5006a5059c1213d7b833b290e2e | <|skeleton|>
class Graph:
def __init__(self, n: int, mat: List[List[int]], src: int=0):
"""Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)"""
<|body_0|>
def adj_list_creator(self, mat: List[List[int]]):
"""Creates the adjacency list... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Graph:
def __init__(self, n: int, mat: List[List[int]], src: int=0):
"""Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)"""
self.adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(n)]
self.adj_list_creator(mat)
self.v... | the_stack_v2_python_sparse | Graphs/bfs.py | shreykhare/LeetCodeSolutions | train | 0 | |
7d5bc2f5393b30aec5a8dccda22a6f022009f48d | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ContactFolder()",
"from .contact import Contact\nfrom .entity import Entity\nfrom .multi_value_legacy_extended_property import MultiValueLegacyExtendedProperty\nfrom .single_value_legacy_extended_property import SingleValueLegacyExtend... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ContactFolder()
<|end_body_0|>
<|body_start_1|>
from .contact import Contact
from .entity import Entity
from .multi_value_legacy_extended_property import MultiValueLegacyExtended... | ContactFolder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContactFolder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContactFolder:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns... | stack_v2_sparse_classes_36k_train_029912 | 4,523 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ContactFolder",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value... | 3 | stack_v2_sparse_classes_30k_val_001152 | Implement the Python class `ContactFolder` described below.
Class description:
Implement the ContactFolder class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContactFolder: Creates a new instance of the appropriate class based on discriminator value... | Implement the Python class `ContactFolder` described below.
Class description:
Implement the ContactFolder class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContactFolder: Creates a new instance of the appropriate class based on discriminator value... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ContactFolder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContactFolder:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContactFolder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ContactFolder:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ContactFolde... | the_stack_v2_python_sparse | msgraph/generated/models/contact_folder.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
de1b565ab92f8b99e1e726f62cb4d87d2a621710 | [
"storage = get_storage()\nroles = storage.list_roles()\nreturn jsonify(RoleSchema(many=True).dump(roles))",
"data = request.get_json()\ntry:\n role = RolePostSchema().load(data)\nexcept ValidationError as err:\n raise BadAPIRequest(err.messages)\nstorage = get_storage()\nrole_id = storage.store_role(role)\n... | <|body_start_0|>
storage = get_storage()
roles = storage.list_roles()
return jsonify(RoleSchema(many=True).dump(roles))
<|end_body_0|>
<|body_start_1|>
data = request.get_json()
try:
role = RolePostSchema().load(data)
except ValidationError as err:
... | AllRolesView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllRolesView:
def get(self):
"""--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $r... | stack_v2_sparse_classes_36k_train_029913 | 5,492 | permissive | [
{
"docstring": "--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Unauthor... | 2 | stack_v2_sparse_classes_30k_train_003670 | Implement the Python class `AllRolesView` described below.
Class description:
Implement the AllRolesView class.
Method signatures and docstrings:
- def get(self): --- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. ... | Implement the Python class `AllRolesView` described below.
Class description:
Implement the AllRolesView class.
Method signatures and docstrings:
- def get(self): --- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. ... | 280800c73eb7cfd49029462b352887e78f1ff91b | <|skeleton|>
class AllRolesView:
def get(self):
"""--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AllRolesView:
def get(self):
"""--- summary: List Roles. description: List all Roles that the user has access to. tags: - Roles responses: 200: description: Retrieved roles successfully. content: applicaiton/json: schema: type: array items: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/compone... | the_stack_v2_python_sparse | sfa_api/roles.py | SolarArbiter/solarforecastarbiter-api | train | 9 | |
507d2b6e343bda046fe54286459879b2df0c4e40 | [
"def searchValidParentheses(s, last_i, last_j, p, result):\n count = 0\n for i in range(last_i, len(s)):\n if s[i] == p[0]:\n count += 1\n elif s[i] == p[1]:\n count -= 1\n if count >= 0:\n continue\n for j in range(last_j, i + 1):\n if s... | <|body_start_0|>
def searchValidParentheses(s, last_i, last_j, p, result):
count = 0
for i in range(last_i, len(s)):
if s[i] == p[0]:
count += 1
elif s[i] == p[1]:
count -= 1
if count >= 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def removeInvalidParenthesesBFS(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def searchValidParentheses(s... | stack_v2_sparse_classes_36k_train_029914 | 2,167 | no_license | [
{
"docstring": ":type s: str :rtype: List[str]",
"name": "removeInvalidParentheses",
"signature": "def removeInvalidParentheses(self, s)"
},
{
"docstring": ":type s: str :rtype: List[str]",
"name": "removeInvalidParenthesesBFS",
"signature": "def removeInvalidParenthesesBFS(self, s)"
}... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
- def removeInvalidParenthesesBFS(self, s): :type s: str :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
- def removeInvalidParenthesesBFS(self, s): :type s: str :rtype: List[str]
<|skeleton|>
class Solution:
... | 75aef2f6c42aeb51261b9450a24099957a084d51 | <|skeleton|>
class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def removeInvalidParenthesesBFS(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
def searchValidParentheses(s, last_i, last_j, p, result):
count = 0
for i in range(last_i, len(s)):
if s[i] == p[0]:
count += 1
elif... | the_stack_v2_python_sparse | Python/0301_RemoveInvalidParentheses/removeInvalidParentheses.py | mtmmy/Leetcode | train | 3 | |
bec1a20f5d61760917005ff69c85a57821f7b375 | [
"cnt = 0\nfor i in range(len(flowerbed)):\n if flowerbed[i] == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):\n flowerbed[i] = 1\n cnt += 1\nreturn cnt >= n",
"cnt = 0\nfor i in range(len(flowerbed)):\n if flowerbed[i] == 0 and (i == 0 or flower... | <|body_start_0|>
cnt = 0
for i in range(len(flowerbed)):
if flowerbed[i] == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):
flowerbed[i] = 1
cnt += 1
return cnt >= n
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_0|>
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_1|>
def canPlaceFlowers(se... | stack_v2_sparse_classes_36k_train_029915 | 1,373 | no_license | [
{
"docstring": ":type flowerbed: List[int] :type n: int :rtype: bool",
"name": "canPlaceFlowers",
"signature": "def canPlaceFlowers(self, flowerbed, n)"
},
{
"docstring": ":type flowerbed: List[int] :type n: int :rtype: bool",
"name": "canPlaceFlowers",
"signature": "def canPlaceFlowers(... | 3 | stack_v2_sparse_classes_30k_train_005399 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool
- def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool
- def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_0|>
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_1|>
def canPlaceFlowers(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
cnt = 0
for i in range(len(flowerbed)):
if flowerbed[i] == 0 and (i == 0 or flowerbed[i - 1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):
... | the_stack_v2_python_sparse | 0605_Can_Place_Flowers.py | bingli8802/leetcode | train | 0 | |
b73d1390053fc9cd35d32200043b46f180e1b913 | [
"super().__init__(None, SHARE_TITLE, INIT_CLOUD_GUI_SIZE, client)\nself.file_to_share = None\nself.static_txt = wx.StaticText(self.pnl, label=CHOOSE_FILE_TO_SHARE)\nself.next_btn = wx.Button(self.pnl, label=NEXT_BTN)\nself.next_btn.Bind(wx.EVT_BUTTON, self.on_next)\nself.browser = wx.FilePickerCtrl()\nself.browser.... | <|body_start_0|>
super().__init__(None, SHARE_TITLE, INIT_CLOUD_GUI_SIZE, client)
self.file_to_share = None
self.static_txt = wx.StaticText(self.pnl, label=CHOOSE_FILE_TO_SHARE)
self.next_btn = wx.Button(self.pnl, label=NEXT_BTN)
self.next_btn.Bind(wx.EVT_BUTTON, self.on_next)
... | opens a window with directory dialog and a Next button | ShareGUI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShareGUI:
"""opens a window with directory dialog and a Next button"""
def __init__(self, client):
""":param e: event handler"""
<|body_0|>
def position(self):
""":return: positions everything nicely"""
<|body_1|>
def on_next(self, e):
""":pa... | stack_v2_sparse_classes_36k_train_029916 | 2,085 | no_license | [
{
"docstring": ":param e: event handler",
"name": "__init__",
"signature": "def __init__(self, client)"
},
{
"docstring": ":return: positions everything nicely",
"name": "position",
"signature": "def position(self)"
},
{
"docstring": ":param e: event handler :return: opening new ... | 3 | stack_v2_sparse_classes_30k_train_003583 | Implement the Python class `ShareGUI` described below.
Class description:
opens a window with directory dialog and a Next button
Method signatures and docstrings:
- def __init__(self, client): :param e: event handler
- def position(self): :return: positions everything nicely
- def on_next(self, e): :param e: event ha... | Implement the Python class `ShareGUI` described below.
Class description:
opens a window with directory dialog and a Next button
Method signatures and docstrings:
- def __init__(self, client): :param e: event handler
- def position(self): :return: positions everything nicely
- def on_next(self, e): :param e: event ha... | b8e9ae3300a7fd79d72109bb3d7db5020fca55d8 | <|skeleton|>
class ShareGUI:
"""opens a window with directory dialog and a Next button"""
def __init__(self, client):
""":param e: event handler"""
<|body_0|>
def position(self):
""":return: positions everything nicely"""
<|body_1|>
def on_next(self, e):
""":pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShareGUI:
"""opens a window with directory dialog and a Next button"""
def __init__(self, client):
""":param e: event handler"""
super().__init__(None, SHARE_TITLE, INIT_CLOUD_GUI_SIZE, client)
self.file_to_share = None
self.static_txt = wx.StaticText(self.pnl, label=CHOOS... | the_stack_v2_python_sparse | Classes/ShareGUI.py | tomerbar2903/CloudProject | train | 0 |
6b9f314578c330d2d5bb937481033b46cec20ff6 | [
"ret = []\nif not root:\n return None\nQ = Queue()\nQ.put(root)\nwhile not Q.empty():\n count = Q.qsize()\n tmp = []\n for i in range(count):\n nd = Q.get()\n tmp.append(nd.val)\n if nd.left:\n Q.put(nd.left)\n if nd.right:\n Q.put(nd.right)\n ret.app... | <|body_start_0|>
ret = []
if not root:
return None
Q = Queue()
Q.put(root)
while not Q.empty():
count = Q.qsize()
tmp = []
for i in range(count):
nd = Q.get()
tmp.append(nd.val)
if nd.... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def averageOfLevels1(self, root):
""":type root: TreeNode :rtype: List[float]"""
<|body_0|>
def averageOfLevels2(self, root):
""":type root: TreeNode :rtype: List[float]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ret = []
if n... | stack_v2_sparse_classes_36k_train_029917 | 1,720 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[float]",
"name": "averageOfLevels1",
"signature": "def averageOfLevels1(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[float]",
"name": "averageOfLevels2",
"signature": "def averageOfLevels2(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002521 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def averageOfLevels1(self, root): :type root: TreeNode :rtype: List[float]
- def averageOfLevels2(self, root): :type root: TreeNode :rtype: List[float] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def averageOfLevels1(self, root): :type root: TreeNode :rtype: List[float]
- def averageOfLevels2(self, root): :type root: TreeNode :rtype: List[float]
<|skeleton|>
class Soluti... | d3e8669f932fc2e22711e8b7590d3365d020e189 | <|skeleton|>
class Solution:
def averageOfLevels1(self, root):
""":type root: TreeNode :rtype: List[float]"""
<|body_0|>
def averageOfLevels2(self, root):
""":type root: TreeNode :rtype: List[float]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def averageOfLevels1(self, root):
""":type root: TreeNode :rtype: List[float]"""
ret = []
if not root:
return None
Q = Queue()
Q.put(root)
while not Q.empty():
count = Q.qsize()
tmp = []
for i in range(co... | the_stack_v2_python_sparse | leetcode/637.py | liuweilin17/algorithm | train | 3 | |
139a3ba1b4ac2bb1331c96c70ab692c19d5f0f72 | [
"try:\n CEmuGeneral_Test.setUp(self)\nexcept Exception as e:\n CTRexScenario.emu_init_error = 'First setUp error: %s' % e\n raise",
"print('')\nCTRexScenario.emu_init_error = 'Unknown error'\nif not self.is_loopback:\n try:\n self.config_dut()\n except Exception as e:\n CTRexScenario.... | <|body_start_0|>
try:
CEmuGeneral_Test.setUp(self)
except Exception as e:
CTRexScenario.emu_init_error = 'First setUp error: %s' % e
raise
<|end_body_0|>
<|body_start_1|>
print('')
CTRexScenario.emu_init_error = 'Unknown error'
if not self.is_... | EmuBasic_Test | [
"GPL-1.0-or-later",
"GPL-2.0-or-later",
"GPL-2.0-only",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmuBasic_Test:
def setUp(self):
"""Set up for the basic test"""
<|body_0|>
def test_connectivity(self):
"""This is run at the beginning, needs to be called explicitly. It verifies that the router is connected properly"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_029918 | 5,621 | permissive | [
{
"docstring": "Set up for the basic test",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "This is run at the beginning, needs to be called explicitly. It verifies that the router is connected properly",
"name": "test_connectivity",
"signature": "def test_connectivity... | 2 | null | Implement the Python class `EmuBasic_Test` described below.
Class description:
Implement the EmuBasic_Test class.
Method signatures and docstrings:
- def setUp(self): Set up for the basic test
- def test_connectivity(self): This is run at the beginning, needs to be called explicitly. It verifies that the router is co... | Implement the Python class `EmuBasic_Test` described below.
Class description:
Implement the EmuBasic_Test class.
Method signatures and docstrings:
- def setUp(self): Set up for the basic test
- def test_connectivity(self): This is run at the beginning, needs to be called explicitly. It verifies that the router is co... | 564fb7ba2a003065270a9bcc9946e7a7473f668e | <|skeleton|>
class EmuBasic_Test:
def setUp(self):
"""Set up for the basic test"""
<|body_0|>
def test_connectivity(self):
"""This is run at the beginning, needs to be called explicitly. It verifies that the router is connected properly"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmuBasic_Test:
def setUp(self):
"""Set up for the basic test"""
try:
CEmuGeneral_Test.setUp(self)
except Exception as e:
CTRexScenario.emu_init_error = 'First setUp error: %s' % e
raise
def test_connectivity(self):
"""This is run at the ... | the_stack_v2_python_sparse | scripts/automation/regression/emu_tests/emu_general_test.py | ramakristipati/trex-core | train | 0 | |
46985e5ab6a8d9015ad350441ab218026e12e25c | [
"self.evManager = evManager\nevManager.RegisterListener(self)\nself.view = view",
"if isinstance(event, TickEvent):\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n self.evManager.Post(QuitEvent())\n elif event.type == pygame.KEYDOWN:\n if event.key == py... | <|body_start_0|>
self.evManager = evManager
evManager.RegisterListener(self)
self.view = view
<|end_body_0|>
<|body_start_1|>
if isinstance(event, TickEvent):
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.evManager.Po... | Handles keyboard and mouse input. | UserInput | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserInput:
"""Handles keyboard and mouse input."""
def __init__(self, evManager, view):
"""evManager (EventManager): Allows posting messages to the event queue. view (GraphicalView): a strong reference to the game view."""
<|body_0|>
def notify(self, event):
"""R... | stack_v2_sparse_classes_36k_train_029919 | 1,483 | no_license | [
{
"docstring": "evManager (EventManager): Allows posting messages to the event queue. view (GraphicalView): a strong reference to the game view.",
"name": "__init__",
"signature": "def __init__(self, evManager, view)"
},
{
"docstring": "Receive events posted to the message queue.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_005859 | Implement the Python class `UserInput` described below.
Class description:
Handles keyboard and mouse input.
Method signatures and docstrings:
- def __init__(self, evManager, view): evManager (EventManager): Allows posting messages to the event queue. view (GraphicalView): a strong reference to the game view.
- def n... | Implement the Python class `UserInput` described below.
Class description:
Handles keyboard and mouse input.
Method signatures and docstrings:
- def __init__(self, evManager, view): evManager (EventManager): Allows posting messages to the event queue. view (GraphicalView): a strong reference to the game view.
- def n... | 58643de5723140df0737522c45a2657c3ba7fc0c | <|skeleton|>
class UserInput:
"""Handles keyboard and mouse input."""
def __init__(self, evManager, view):
"""evManager (EventManager): Allows posting messages to the event queue. view (GraphicalView): a strong reference to the game view."""
<|body_0|>
def notify(self, event):
"""R... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserInput:
"""Handles keyboard and mouse input."""
def __init__(self, evManager, view):
"""evManager (EventManager): Allows posting messages to the event queue. view (GraphicalView): a strong reference to the game view."""
self.evManager = evManager
evManager.RegisterListener(self... | the_stack_v2_python_sparse | app/controller.py | Softhouse/gomoku_python | train | 1 |
19df810637609b79089d50692b1bba9a270daec9 | [
"res = ''\nn = len(s)\nk = 0\nwhile k < n:\n i = j = k\n while j + 1 < n and s[j + 1] == s[j]:\n j += 1\n while i - 1 >= 0 and j + 1 < n and (s[i - 1] == s[j + 1]):\n i -= 1\n j += 1\n if j + 1 - i > len(res):\n res = s[i:j + 1]\n k += 1\nreturn res",
"n = len(s)\ndp = [... | <|body_start_0|>
res = ''
n = len(s)
k = 0
while k < n:
i = j = k
while j + 1 < n and s[j + 1] == s[j]:
j += 1
while i - 1 >= 0 and j + 1 < n and (s[i - 1] == s[j + 1]):
i -= 1
j += 1
if j + 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome1(self, s: str) -> str:
"""执行用时 :936 ms, 在所有 Python3 提交中击败了81.31%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了9.26%的用户 思路:找到一个单词i从两边扩散,如果遇到重复的就向右边扩散j+1,最后判断i-1和j+1位置的元素是否相等 还可以优化:只保留每次的最大长度,而不用生成新的字符串"""
<|body_0|>
def longestPalindrome2(self, s: str) ... | stack_v2_sparse_classes_36k_train_029920 | 3,428 | no_license | [
{
"docstring": "执行用时 :936 ms, 在所有 Python3 提交中击败了81.31%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了9.26%的用户 思路:找到一个单词i从两边扩散,如果遇到重复的就向右边扩散j+1,最后判断i-1和j+1位置的元素是否相等 还可以优化:只保留每次的最大长度,而不用生成新的字符串",
"name": "longestPalindrome1",
"signature": "def longestPalindrome1(self, s: str) -> str"
},
{
"docstring": "思路:动... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome1(self, s: str) -> str: 执行用时 :936 ms, 在所有 Python3 提交中击败了81.31%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了9.26%的用户 思路:找到一个单词i从两边扩散,如果遇到重复的就向右边扩散j+1,最后判断i-1和j+1位置的元素... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome1(self, s: str) -> str: 执行用时 :936 ms, 在所有 Python3 提交中击败了81.31%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了9.26%的用户 思路:找到一个单词i从两边扩散,如果遇到重复的就向右边扩散j+1,最后判断i-1和j+1位置的元素... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def longestPalindrome1(self, s: str) -> str:
"""执行用时 :936 ms, 在所有 Python3 提交中击败了81.31%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了9.26%的用户 思路:找到一个单词i从两边扩散,如果遇到重复的就向右边扩散j+1,最后判断i-1和j+1位置的元素是否相等 还可以优化:只保留每次的最大长度,而不用生成新的字符串"""
<|body_0|>
def longestPalindrome2(self, s: str) ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestPalindrome1(self, s: str) -> str:
"""执行用时 :936 ms, 在所有 Python3 提交中击败了81.31%的用户 内存消耗 :13.7 MB, 在所有 Python3 提交中击败了9.26%的用户 思路:找到一个单词i从两边扩散,如果遇到重复的就向右边扩散j+1,最后判断i-1和j+1位置的元素是否相等 还可以优化:只保留每次的最大长度,而不用生成新的字符串"""
res = ''
n = len(s)
k = 0
while k < n:
... | the_stack_v2_python_sparse | LeetCode/字符串/5. Longest Palindromic Substring.py | yiming1012/MyLeetCode | train | 2 | |
9f44c8abe0207208145d35d42f21e4ddc455aa7e | [
"formattedResult = DBFormatter.formatDict(self, result)\nfor entry in formattedResult:\n if entry['bool_outcome'] == 0:\n entry['outcome'] = 'failure'\n else:\n entry['outcome'] = 'success'\n del entry['bool_outcome']\nif len(formattedResult) == 1:\n return formattedResult[0]\nelse:\n r... | <|body_start_0|>
formattedResult = DBFormatter.formatDict(self, result)
for entry in formattedResult:
if entry['bool_outcome'] == 0:
entry['outcome'] = 'failure'
else:
entry['outcome'] = 'success'
del entry['bool_outcome']
if le... | _LoadFromID_ Retrieve meta data for a job given it's ID. This includes the name, job group and last update time. | LoadFromID | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadFromID:
"""_LoadFromID_ Retrieve meta data for a job given it's ID. This includes the name, job group and last update time."""
def formatDict(self, result):
"""_formatDict_ Cast the id, jobgroup and last_update columns to integers because formatDict() turns everything into string... | stack_v2_sparse_classes_36k_train_029921 | 1,993 | permissive | [
{
"docstring": "_formatDict_ Cast the id, jobgroup and last_update columns to integers because formatDict() turns everything into strings.",
"name": "formatDict",
"signature": "def formatDict(self, result)"
},
{
"docstring": "_execute_ Execute the SQL for the given job ID and then format and ret... | 2 | stack_v2_sparse_classes_30k_train_012801 | Implement the Python class `LoadFromID` described below.
Class description:
_LoadFromID_ Retrieve meta data for a job given it's ID. This includes the name, job group and last update time.
Method signatures and docstrings:
- def formatDict(self, result): _formatDict_ Cast the id, jobgroup and last_update columns to i... | Implement the Python class `LoadFromID` described below.
Class description:
_LoadFromID_ Retrieve meta data for a job given it's ID. This includes the name, job group and last update time.
Method signatures and docstrings:
- def formatDict(self, result): _formatDict_ Cast the id, jobgroup and last_update columns to i... | de110ccf6fc63ef5589b4e871ef4d51d5bce7a25 | <|skeleton|>
class LoadFromID:
"""_LoadFromID_ Retrieve meta data for a job given it's ID. This includes the name, job group and last update time."""
def formatDict(self, result):
"""_formatDict_ Cast the id, jobgroup and last_update columns to integers because formatDict() turns everything into string... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadFromID:
"""_LoadFromID_ Retrieve meta data for a job given it's ID. This includes the name, job group and last update time."""
def formatDict(self, result):
"""_formatDict_ Cast the id, jobgroup and last_update columns to integers because formatDict() turns everything into strings."""
... | the_stack_v2_python_sparse | src/python/WMCore/WMBS/MySQL/Jobs/LoadFromID.py | vkuznet/WMCore | train | 0 |
f97e7309d3b6b685c2df70094f26ce46ade820db | [
"self.heap = []\nself.k = k\nmap(self.add, nums)",
"if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelif val > self.heap[0]:\n heapq.heapreplace(self.heap, val)\nreturn self.heap[0]"
] | <|body_start_0|>
self.heap = []
self.k = k
map(self.add, nums)
<|end_body_0|>
<|body_start_1|>
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
elif val > self.heap[0]:
heapq.heapreplace(self.heap, val)
return self.heap[0]
<|end_body_1|>... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.heap = []
self.k = k
map(self.add, nu... | stack_v2_sparse_classes_36k_train_029922 | 1,720 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002627 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | fe9fb43fca35ba493c2c57baa66f126571450ef9 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.heap = []
self.k = k
map(self.add, nums)
def add(self, val):
""":type val: int :rtype: int"""
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
... | the_stack_v2_python_sparse | Week_03/id_26/LeetCode_703_26.py | xiaoluome/algorithm | train | 1 | |
df424bd5883a46ec68471b9344bdaeb60e7f38dc | [
"u = usermanage(self.driver)\nu.open_usermanage()\nself.assertEqual(u.verify(), True)\nu.add()\nself.assertEqual(u.sub_tagname(), '用户管理-新增')\nu.add_user(Data.name, Data.email, Data.password, Data.password, Data.mobile)\nu.type()\nu.select_company()\nu.add_save()\nself.assertEqual(u.success(), True)\nfunction.screen... | <|body_start_0|>
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
u.add()
self.assertEqual(u.sub_tagname(), '用户管理-新增')
u.add_user(Data.name, Data.email, Data.password, Data.password, Data.mobile)
u.type()
u.select_company(... | Test009_User_Add_P1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test009_User_Add_P1:
def test_add_user(self):
"""添加用户"""
<|body_0|>
def test_back(self):
"""添加用户并返回"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
... | stack_v2_sparse_classes_36k_train_029923 | 1,287 | no_license | [
{
"docstring": "添加用户",
"name": "test_add_user",
"signature": "def test_add_user(self)"
},
{
"docstring": "添加用户并返回",
"name": "test_back",
"signature": "def test_back(self)"
}
] | 2 | null | Implement the Python class `Test009_User_Add_P1` described below.
Class description:
Implement the Test009_User_Add_P1 class.
Method signatures and docstrings:
- def test_add_user(self): 添加用户
- def test_back(self): 添加用户并返回 | Implement the Python class `Test009_User_Add_P1` described below.
Class description:
Implement the Test009_User_Add_P1 class.
Method signatures and docstrings:
- def test_add_user(self): 添加用户
- def test_back(self): 添加用户并返回
<|skeleton|>
class Test009_User_Add_P1:
def test_add_user(self):
"""添加用户"""
... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test009_User_Add_P1:
def test_add_user(self):
"""添加用户"""
<|body_0|>
def test_back(self):
"""添加用户并返回"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test009_User_Add_P1:
def test_add_user(self):
"""添加用户"""
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
u.add()
self.assertEqual(u.sub_tagname(), '用户管理-新增')
u.add_user(Data.name, Data.email, Data.password, Data.passwor... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/Manage_User/Test009_user_add_P1.py | rrmiracle/GlxssLive | train | 0 | |
711041dbc401089fa7ea6cb68b1be9e3f7203009 | [
"for vals in vals_list:\n new_vehicle = super(FleetVehicle, self.with_context(create_fleet_vehicle=True)).create(vals)\n if new_vehicle.product_id:\n new_vehicle.product_id.with_context(from_vehicle_create=True).write({'name': new_vehicle.name, 'image_1920': new_vehicle.image_128, 'is_vehicle': True, '... | <|body_start_0|>
for vals in vals_list:
new_vehicle = super(FleetVehicle, self.with_context(create_fleet_vehicle=True)).create(vals)
if new_vehicle.product_id:
new_vehicle.product_id.with_context(from_vehicle_create=True).write({'name': new_vehicle.name, 'image_1920': new... | Fleet Vehicle model. | FleetVehicle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FleetVehicle:
"""Fleet Vehicle model."""
def create(self, vals_list):
"""Overridden method to update the product information."""
<|body_0|>
def write(self, vals):
"""Overridden method to update the product information."""
<|body_1|>
def name_search(s... | stack_v2_sparse_classes_36k_train_029924 | 4,610 | no_license | [
{
"docstring": "Overridden method to update the product information.",
"name": "create",
"signature": "def create(self, vals_list)"
},
{
"docstring": "Overridden method to update the product information.",
"name": "write",
"signature": "def write(self, vals)"
},
{
"docstring": "T... | 3 | null | Implement the Python class `FleetVehicle` described below.
Class description:
Fleet Vehicle model.
Method signatures and docstrings:
- def create(self, vals_list): Overridden method to update the product information.
- def write(self, vals): Overridden method to update the product information.
- def name_search(self,... | Implement the Python class `FleetVehicle` described below.
Class description:
Fleet Vehicle model.
Method signatures and docstrings:
- def create(self, vals_list): Overridden method to update the product information.
- def write(self, vals): Overridden method to update the product information.
- def name_search(self,... | 7618a365ac78c0f59390a3a6b5fcdd9f76a5ddec | <|skeleton|>
class FleetVehicle:
"""Fleet Vehicle model."""
def create(self, vals_list):
"""Overridden method to update the product information."""
<|body_0|>
def write(self, vals):
"""Overridden method to update the product information."""
<|body_1|>
def name_search(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FleetVehicle:
"""Fleet Vehicle model."""
def create(self, vals_list):
"""Overridden method to update the product information."""
for vals in vals_list:
new_vehicle = super(FleetVehicle, self.with_context(create_fleet_vehicle=True)).create(vals)
if new_vehicle.produ... | the_stack_v2_python_sparse | vehicles_dealership/models/fleet_vehicle.py | JayVora-SerpentCS/fleet_management | train | 29 |
cebba61b976ffe7bfad4453a6a2522d5817a5094 | [
"data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]\nif not data['sure']:\n raise osv.except_osv(_('Error!'), _('Please confirm that you want to do this by checking the option'))\npartner_obj = self.pool.get('res.partner')\nname_partner = data['name']\npartner_obj.write(cr, uid, context['active_id'], {... | <|body_start_0|>
data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]
if not data['sure']:
raise osv.except_osv(_('Error!'), _('Please confirm that you want to do this by checking the option'))
partner_obj = self.pool.get('res.partner')
name_partner = data['name']
... | WizUpdatename | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WizUpdatename:
def set_name(self, cr, uid, ids, context):
"""Change value of the name field"""
<|body_0|>
def _get_name(self, cr, uid, context=None):
"""Get name field value"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = self.pool.get('wiz.u... | stack_v2_sparse_classes_36k_train_029925 | 2,749 | no_license | [
{
"docstring": "Change value of the name field",
"name": "set_name",
"signature": "def set_name(self, cr, uid, ids, context)"
},
{
"docstring": "Get name field value",
"name": "_get_name",
"signature": "def _get_name(self, cr, uid, context=None)"
}
] | 2 | null | Implement the Python class `WizUpdatename` described below.
Class description:
Implement the WizUpdatename class.
Method signatures and docstrings:
- def set_name(self, cr, uid, ids, context): Change value of the name field
- def _get_name(self, cr, uid, context=None): Get name field value | Implement the Python class `WizUpdatename` described below.
Class description:
Implement the WizUpdatename class.
Method signatures and docstrings:
- def set_name(self, cr, uid, ids, context): Change value of the name field
- def _get_name(self, cr, uid, context=None): Get name field value
<|skeleton|>
class WizUpda... | 718327d01e5b4408add58682c5ad1901fa35b450 | <|skeleton|>
class WizUpdatename:
def set_name(self, cr, uid, ids, context):
"""Change value of the name field"""
<|body_0|>
def _get_name(self, cr, uid, context=None):
"""Get name field value"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WizUpdatename:
def set_name(self, cr, uid, ids, context):
"""Change value of the name field"""
data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]
if not data['sure']:
raise osv.except_osv(_('Error!'), _('Please confirm that you want to do this by checking the opti... | the_stack_v2_python_sparse | l10n_ve_fiscal_requirements/wizard/wizard_update_name.py | Vauxoo/odoo-venezuela | train | 15 | |
4a926c80b5f76e733db721795e3f6e8561b1b3bd | [
"l = 0\nnode = root\nwhile node:\n l += 1\n node = node.next\nret = [[] for _ in range(k)]\nshort_chunk_l = l // k\nlong_chunk_l = short_chunk_l + 1\nn_long_chunk = l % k\nn_short_chunk = l - n_long_chunk\nchunk_counter = 0\ncur_l = 0\nnode = root\nwhile node:\n ret[chunk_counter].append(node.val)\n cur... | <|body_start_0|>
l = 0
node = root
while node:
l += 1
node = node.next
ret = [[] for _ in range(k)]
short_chunk_l = l // k
long_chunk_l = short_chunk_l + 1
n_long_chunk = l % k
n_short_chunk = l - n_long_chunk
chunk_counter ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
"""calculate the chunk/page size at a time [1,2,3,4,5,6,7] 3 [[1,2,3],[4,5,6],[7]] # output [[1,2,3],[4,5],[6,7]] # expected"""
<|body_0|>
def splitListToParts_2(self, root: ListNode, k: int) -> ... | stack_v2_sparse_classes_36k_train_029926 | 4,209 | no_license | [
{
"docstring": "calculate the chunk/page size at a time [1,2,3,4,5,6,7] 3 [[1,2,3],[4,5,6],[7]] # output [[1,2,3],[4,5],[6,7]] # expected",
"name": "splitListToParts",
"signature": "def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]"
},
{
"docstring": "[1,2,3,4,5,6,7] 3 [[1,2,3... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: calculate the chunk/page size at a time [1,2,3,4,5,6,7] 3 [[1,2,3],[4,5,6],[7]] # output [[1,2,3],[4,5],[6,7... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: calculate the chunk/page size at a time [1,2,3,4,5,6,7] 3 [[1,2,3],[4,5,6],[7]] # output [[1,2,3],[4,5],[6,7... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
"""calculate the chunk/page size at a time [1,2,3,4,5,6,7] 3 [[1,2,3],[4,5,6],[7]] # output [[1,2,3],[4,5],[6,7]] # expected"""
<|body_0|>
def splitListToParts_2(self, root: ListNode, k: int) -> ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]:
"""calculate the chunk/page size at a time [1,2,3,4,5,6,7] 3 [[1,2,3],[4,5,6],[7]] # output [[1,2,3],[4,5],[6,7]] # expected"""
l = 0
node = root
while node:
l += 1
node = no... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/725 Split Linked List in Parts.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
fdff46e721fd4449c2292766e56afd86c66c1f5b | [
"self._attribute = attribute\nself.item = item\nself.next = next\nself.precede = precede",
"if self.item != None:\n output = str(self.item.__dict__[self._attribute])\nelse:\n return 'Empty node'\nif self.next != None:\n output += ', ' + str(self.next)\nreturn output"
] | <|body_start_0|>
self._attribute = attribute
self.item = item
self.next = next
self.precede = precede
<|end_body_0|>
<|body_start_1|>
if self.item != None:
output = str(self.item.__dict__[self._attribute])
else:
return 'Empty node'
if self... | Class Node used in the linked chain. | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
"""Class Node used in the linked chain."""
def __init__(self, attribute, item=None, next=None, precede=None):
"""Standard python initializer, works with an attribute. This is the searchkey of the object."""
<|body_0|>
def __str__(self):
"""Basic visual repr... | stack_v2_sparse_classes_36k_train_029927 | 6,461 | no_license | [
{
"docstring": "Standard python initializer, works with an attribute. This is the searchkey of the object.",
"name": "__init__",
"signature": "def __init__(self, attribute, item=None, next=None, precede=None)"
},
{
"docstring": "Basic visual representation of a node.",
"name": "__str__",
... | 2 | stack_v2_sparse_classes_30k_train_006171 | Implement the Python class `Node` described below.
Class description:
Class Node used in the linked chain.
Method signatures and docstrings:
- def __init__(self, attribute, item=None, next=None, precede=None): Standard python initializer, works with an attribute. This is the searchkey of the object.
- def __str__(sel... | Implement the Python class `Node` described below.
Class description:
Class Node used in the linked chain.
Method signatures and docstrings:
- def __init__(self, attribute, item=None, next=None, precede=None): Standard python initializer, works with an attribute. This is the searchkey of the object.
- def __str__(sel... | 51790aaa91c4229379c883cfefe4ffe597d5e2ac | <|skeleton|>
class Node:
"""Class Node used in the linked chain."""
def __init__(self, attribute, item=None, next=None, precede=None):
"""Standard python initializer, works with an attribute. This is the searchkey of the object."""
<|body_0|>
def __str__(self):
"""Basic visual repr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Node:
"""Class Node used in the linked chain."""
def __init__(self, attribute, item=None, next=None, precede=None):
"""Standard python initializer, works with an attribute. This is the searchkey of the object."""
self._attribute = attribute
self.item = item
self.next = nex... | the_stack_v2_python_sparse | v2/kinepolis/structures/uslinkedchain.py | evertheylen/kinepolis | train | 0 |
30fc70590cbe446265c98b20da4c707a9b32f658 | [
"self.api_key = api_key\nself.api_secret = api_secret\nself.access_token = access_token\nself.access_token_secret = access_token_secret\nself.listener = listener\nself.auth = None\nself.source_addr = source_addr\nself.stream = None\nself.track_list = []\nself.doAuth()",
"log.debug('doAuth')\nself.auth = tweepy.OA... | <|body_start_0|>
self.api_key = api_key
self.api_secret = api_secret
self.access_token = access_token
self.access_token_secret = access_token_secret
self.listener = listener
self.auth = None
self.source_addr = source_addr
self.stream = None
self.tr... | Streamer class. | Streamer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Streamer:
"""Streamer class."""
def __init__(self, listener, api_key, api_secret, access_token, access_token_secret, source_addr=None):
"""initialize the streamer object."""
<|body_0|>
def doAuth(self):
"""perform authorization."""
<|body_1|>
def sta... | stack_v2_sparse_classes_36k_train_029928 | 3,950 | no_license | [
{
"docstring": "initialize the streamer object.",
"name": "__init__",
"signature": "def __init__(self, listener, api_key, api_secret, access_token, access_token_secret, source_addr=None)"
},
{
"docstring": "perform authorization.",
"name": "doAuth",
"signature": "def doAuth(self)"
},
... | 5 | stack_v2_sparse_classes_30k_train_002150 | Implement the Python class `Streamer` described below.
Class description:
Streamer class.
Method signatures and docstrings:
- def __init__(self, listener, api_key, api_secret, access_token, access_token_secret, source_addr=None): initialize the streamer object.
- def doAuth(self): perform authorization.
- def start(s... | Implement the Python class `Streamer` described below.
Class description:
Streamer class.
Method signatures and docstrings:
- def __init__(self, listener, api_key, api_secret, access_token, access_token_secret, source_addr=None): initialize the streamer object.
- def doAuth(self): perform authorization.
- def start(s... | 96b24dae671e4dd1948decdb0d84ff3c5ce6981c | <|skeleton|>
class Streamer:
"""Streamer class."""
def __init__(self, listener, api_key, api_secret, access_token, access_token_secret, source_addr=None):
"""initialize the streamer object."""
<|body_0|>
def doAuth(self):
"""perform authorization."""
<|body_1|>
def sta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Streamer:
"""Streamer class."""
def __init__(self, listener, api_key, api_secret, access_token, access_token_secret, source_addr=None):
"""initialize the streamer object."""
self.api_key = api_key
self.api_secret = api_secret
self.access_token = access_token
self.a... | the_stack_v2_python_sparse | streamer.py | geosoco/twitter_capture_client | train | 1 |
f0446c1b57e18f9a60175d1c17e03413616cdffa | [
"static_shapes = collections.OrderedDict({key: tensor.get_shape() for key, tensor in tensor_dict.items()})\nruntime_shapes = collections.OrderedDict({key + rt_shape_str: tf.shape(tensor) for key, tensor in tensor_dict.items()})\nall_tensors = tensor_dict\nall_tensors.update(runtime_shapes)\nbatched_tensors = tf.tra... | <|body_start_0|>
static_shapes = collections.OrderedDict({key: tensor.get_shape() for key, tensor in tensor_dict.items()})
runtime_shapes = collections.OrderedDict({key + rt_shape_str: tf.shape(tensor) for key, tensor in tensor_dict.items()})
all_tensors = tensor_dict
all_tensors.update(... | BatchQueue class. This class creates a batch queue to asynchronously enqueue tensors_dict. It also adds a FIFO prefetcher so that the batches are readily available for the consumers. Dequeue ops for a BatchQueue object can be created via the Dequeue method which evaluates to a batch of tensor_dict. Example input pipeli... | BatchQueue | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchQueue:
"""BatchQueue class. This class creates a batch queue to asynchronously enqueue tensors_dict. It also adds a FIFO prefetcher so that the batches are readily available for the consumers. Dequeue ops for a BatchQueue object can be created via the Dequeue method which evaluates to a batc... | stack_v2_sparse_classes_36k_train_029929 | 5,765 | permissive | [
{
"docstring": "Constructs a batch queue holding tensor_dict. Args: tensor_dict: dictionary of tensors to batch. batch_size: batch size. batch_queue_capacity: max capacity of the queue from which the tensors are batched. num_batch_queue_threads: number of threads to use for batching. prefetch_queue_capacity: ma... | 2 | null | Implement the Python class `BatchQueue` described below.
Class description:
BatchQueue class. This class creates a batch queue to asynchronously enqueue tensors_dict. It also adds a FIFO prefetcher so that the batches are readily available for the consumers. Dequeue ops for a BatchQueue object can be created via the D... | Implement the Python class `BatchQueue` described below.
Class description:
BatchQueue class. This class creates a batch queue to asynchronously enqueue tensors_dict. It also adds a FIFO prefetcher so that the batches are readily available for the consumers. Dequeue ops for a BatchQueue object can be created via the D... | 06531dae14365986c86baf735fd149317f4bb67a | <|skeleton|>
class BatchQueue:
"""BatchQueue class. This class creates a batch queue to asynchronously enqueue tensors_dict. It also adds a FIFO prefetcher so that the batches are readily available for the consumers. Dequeue ops for a BatchQueue object can be created via the Dequeue method which evaluates to a batc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BatchQueue:
"""BatchQueue class. This class creates a batch queue to asynchronously enqueue tensors_dict. It also adds a FIFO prefetcher so that the batches are readily available for the consumers. Dequeue ops for a BatchQueue object can be created via the Dequeue method which evaluates to a batch of tensor_d... | the_stack_v2_python_sparse | inference_api/src/main/object_detection/core/batcher.py | BMW-InnovationLab/BMW-TensorFlow-Training-GUI | train | 1,030 |
614c80d75e09278418f8146482eb1eaa0bd96f05 | [
"self.dict = {}\nfor i, word in enumerate(words):\n self.dict[word] = self.dict.get(word, []) + [i]",
"index1, index2 = (self.dict[word1], self.dict[word2])\ni, j, distance = (0, 0, float('inf'))\nwhile i < len(index1) and j < len(index2):\n distance = min(abs(index1[i] - index2[j]), distance)\n if index... | <|body_start_0|>
self.dict = {}
for i, word in enumerate(words):
self.dict[word] = self.dict.get(word, []) + [i]
<|end_body_0|>
<|body_start_1|>
index1, index2 = (self.dict[word1], self.dict[word2])
i, j, distance = (0, 0, float('inf'))
while i < len(index1) and j < ... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dict = {}
for i, word in... | stack_v2_sparse_classes_36k_train_029930 | 849 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | null | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | 435323a9fcea6a4d09266785e88fb78735e0cc3e | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.dict = {}
for i, word in enumerate(words):
self.dict[word] = self.dict.get(word, []) + [i]
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
i... | the_stack_v2_python_sparse | 244. Shortest Word Distance II.py | AlexWufan/leetcode-python | train | 0 | |
05a10c77d306e8e0370df84770ad35c62403ec94 | [
"self.conf = conf\nif not isinstance(section, str):\n raise TypeError('In DataCatalog.__init__, section must be a string.')\nself.section = section\nself.anltime = to_datetime(anltime)",
"if isinstance(self.anltime, datetime.datetime):\n stime = self.anltime.strftime('%Y%m%d%H')\nelse:\n stime = str(self... | <|body_start_0|>
self.conf = conf
if not isinstance(section, str):
raise TypeError('In DataCatalog.__init__, section must be a string.')
self.section = section
self.anltime = to_datetime(anltime)
<|end_body_0|>
<|body_start_1|>
if isinstance(self.anltime, datetime.da... | !Provides the location of a file in an archive, on disk or on a remote server via sftp or ftp. This class is a collection of functions that know how to provide the location of a file in either an archive or a filesystem. It does not know how to actually obtain the file. This serves as the underlying "where is that file... | DataCatalog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataCatalog:
"""!Provides the location of a file in an archive, on disk or on a remote server via sftp or ftp. This class is a collection of functions that know how to provide the location of a file in either an archive or a filesystem. It does not know how to actually obtain the file. This serve... | stack_v2_sparse_classes_36k_train_029931 | 48,880 | no_license | [
{
"docstring": "!DataCatalog constructor @param conf the configuration object, an hafs.config.HAFSConfig @param section the section that provides location information @param anltime the default analysis time",
"name": "__init__",
"signature": "def __init__(self, conf, section, anltime)"
},
{
"do... | 5 | stack_v2_sparse_classes_30k_val_001026 | Implement the Python class `DataCatalog` described below.
Class description:
!Provides the location of a file in an archive, on disk or on a remote server via sftp or ftp. This class is a collection of functions that know how to provide the location of a file in either an archive or a filesystem. It does not know how ... | Implement the Python class `DataCatalog` described below.
Class description:
!Provides the location of a file in an archive, on disk or on a remote server via sftp or ftp. This class is a collection of functions that know how to provide the location of a file in either an archive or a filesystem. It does not know how ... | cba6b3649eb7a25bb8be392db1901f47d3287c93 | <|skeleton|>
class DataCatalog:
"""!Provides the location of a file in an archive, on disk or on a remote server via sftp or ftp. This class is a collection of functions that know how to provide the location of a file in either an archive or a filesystem. It does not know how to actually obtain the file. This serve... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataCatalog:
"""!Provides the location of a file in an archive, on disk or on a remote server via sftp or ftp. This class is a collection of functions that know how to provide the location of a file in either an archive or a filesystem. It does not know how to actually obtain the file. This serves as the unde... | the_stack_v2_python_sparse | ush/hafs/input.py | hafs-community/HAFS | train | 22 |
33d5145b2e3284f763ef5e5bdd74cf58a5f6be0d | [
"self.text = text\nself.x = x\nself.y = y\nself.width = width\nself.arrow = arrow",
"elem = OrderedXMLElement('text')\nelem.children = [OrderedXMLElement('x', self.x), OrderedXMLElement('y', self.y)]\nif self.width is not None:\n elem.children.append(OrderedXMLElement('width', self.width.strip()))\nif self.arr... | <|body_start_0|>
self.text = text
self.x = x
self.y = y
self.width = width
self.arrow = arrow
<|end_body_0|>
<|body_start_1|>
elem = OrderedXMLElement('text')
elem.children = [OrderedXMLElement('x', self.x), OrderedXMLElement('y', self.y)]
if self.width i... | TextBox | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextBox:
def __init__(self, text, x, y, width='20%', arrow=None):
"""A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'cent... | stack_v2_sparse_classes_36k_train_029932 | 4,714 | permissive | [
{
"docstring": "A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'centered'. y (str): The position of the text box's top. width (str): The width of... | 3 | stack_v2_sparse_classes_30k_val_000373 | Implement the Python class `TextBox` described below.
Class description:
Implement the TextBox class.
Method signatures and docstrings:
- def __init__(self, text, x, y, width='20%', arrow=None): A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the tex... | Implement the Python class `TextBox` described below.
Class description:
Implement the TextBox class.
Method signatures and docstrings:
- def __init__(self, text, x, y, width='20%', arrow=None): A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the tex... | d27011c304ec5203e7b067e1456a26d8232cffdc | <|skeleton|>
class TextBox:
def __init__(self, text, x, y, width='20%', arrow=None):
"""A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'cent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextBox:
def __init__(self, text, x, y, width='20%', arrow=None):
"""A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'centered'. y (str)... | the_stack_v2_python_sparse | opponents/monika/helper-scripts/csv2xml/epilogue.py | cometchuck/spnati | train | 1 | |
a4d98f5d57b730590af14185b984e342a0cef813 | [
"x = self.lrelu(self.conv1(x_in))\nx = self.lrelu(self.conv2(x))\nx = self.lrelu(self.conv3(x))\nx = self.conv4(x)\nreturn x",
"super(MidNet2, self).__init__()\nself.lrelu = nn.LeakyReLU()\nself.conv1 = nn.Conv2d(in_channels, 64, 3, 1, 2, 2)\nself.conv2 = nn.Conv2d(64, 64, 3, 1, 2, 2)\nself.conv3 = nn.Conv2d(64, ... | <|body_start_0|>
x = self.lrelu(self.conv1(x_in))
x = self.lrelu(self.conv2(x))
x = self.lrelu(self.conv3(x))
x = self.conv4(x)
return x
<|end_body_0|>
<|body_start_1|>
super(MidNet2, self).__init__()
self.lrelu = nn.LeakyReLU()
self.conv1 = nn.Conv2d(in_... | MidNet2 | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MidNet2:
def forward(self, x_in):
"""Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor"""
<|body_0|>
def __init__(self, in_channels=16):
"""FIXME! briefly describe function :param in_chann... | stack_v2_sparse_classes_36k_train_029933 | 8,922 | permissive | [
{
"docstring": "Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor",
"name": "forward",
"signature": "def forward(self, x_in)"
},
{
"docstring": "FIXME! briefly describe function :param in_channels: Input channels :ret... | 2 | null | Implement the Python class `MidNet2` described below.
Class description:
Implement the MidNet2 class.
Method signatures and docstrings:
- def forward(self, x_in): Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor
- def __init__(self, in_ch... | Implement the Python class `MidNet2` described below.
Class description:
Implement the MidNet2 class.
Method signatures and docstrings:
- def forward(self, x_in): Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor
- def __init__(self, in_ch... | 82c49c36b76987a46dec8479793f7cf0150839c6 | <|skeleton|>
class MidNet2:
def forward(self, x_in):
"""Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor"""
<|body_0|>
def __init__(self, in_channels=16):
"""FIXME! briefly describe function :param in_chann... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MidNet2:
def forward(self, x_in):
"""Network with dilation rate 2 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor"""
x = self.lrelu(self.conv1(x_in))
x = self.lrelu(self.conv2(x))
x = self.lrelu(self.conv3(x))
x = self... | the_stack_v2_python_sparse | CURL/rgb_ted.py | huawei-noah/noah-research | train | 816 | |
5479b9f91c9160c693e6abb0a365136f97cb39be | [
"super().__init__(**kwargs)\nself._process = None\nself._hasToFinish = False\nself._lock = Lock()",
"self._lock.acquire()\nself._hasToFinish = True\nself._lock.release()",
"self._lock.acquire()\nt = self._hasToFinish\nself._lock.release()\nreturn t",
"st = False\nself._lock.acquire()\nif self._process is not ... | <|body_start_0|>
super().__init__(**kwargs)
self._process = None
self._hasToFinish = False
self._lock = Lock()
<|end_body_0|>
<|body_start_1|>
self._lock.acquire()
self._hasToFinish = True
self._lock.release()
<|end_body_1|>
<|body_start_2|>
self._lock.a... | Wrapper class for Thread This class provides some facilities for the management of subprocesses spawned by threads: it allows for safe monitoring and termination by the main process, handling mutual exclusion issues as well | ThreadWrapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreadWrapper:
"""Wrapper class for Thread This class provides some facilities for the management of subprocesses spawned by threads: it allows for safe monitoring and termination by the main process, handling mutual exclusion issues as well"""
def __init__(self, **kwargs):
"""Constr... | stack_v2_sparse_classes_36k_train_029934 | 24,629 | permissive | [
{
"docstring": "Constructor for the class :param kwargs: All of the arguments supported by Thread",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Flags the thread for termination",
"name": "terminate",
"signature": "def terminate(self)"
},
{
"... | 6 | stack_v2_sparse_classes_30k_train_012063 | Implement the Python class `ThreadWrapper` described below.
Class description:
Wrapper class for Thread This class provides some facilities for the management of subprocesses spawned by threads: it allows for safe monitoring and termination by the main process, handling mutual exclusion issues as well
Method signatur... | Implement the Python class `ThreadWrapper` described below.
Class description:
Wrapper class for Thread This class provides some facilities for the management of subprocesses spawned by threads: it allows for safe monitoring and termination by the main process, handling mutual exclusion issues as well
Method signatur... | 787b3b060d6a431810c1a29279251cbe9292351b | <|skeleton|>
class ThreadWrapper:
"""Wrapper class for Thread This class provides some facilities for the management of subprocesses spawned by threads: it allows for safe monitoring and termination by the main process, handling mutual exclusion issues as well"""
def __init__(self, **kwargs):
"""Constr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ThreadWrapper:
"""Wrapper class for Thread This class provides some facilities for the management of subprocesses spawned by threads: it allows for safe monitoring and termination by the main process, handling mutual exclusion issues as well"""
def __init__(self, **kwargs):
"""Constructor for the... | the_stack_v2_python_sparse | fault_injector/injection/thread_pool.py | igabriel85/fault_injector | train | 0 |
2cb35aac59d9a424a2a053067c0aa675a1459f7c | [
"if n == 0:\n return []\nreturn self.gen(1, n)",
"if start > end:\n return [None]\nif start == end:\n return [TreeNode(start)]\nresult = []\nfor i in range(start, end + 1):\n left_trees = self.gen(start, i - 1)\n right_trees = self.gen(i + 1, end)\n for left_tree in left_trees:\n for righ... | <|body_start_0|>
if n == 0:
return []
return self.gen(1, n)
<|end_body_0|>
<|body_start_1|>
if start > end:
return [None]
if start == end:
return [TreeNode(start)]
result = []
for i in range(start, end + 1):
left_trees = se... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generateTrees(self, n: int) -> List[TreeNode]:
"""Generate trees :param n: :return:"""
<|body_0|>
def gen(self, start, end):
"""Different from prob 96, in this problem we need start and end to generate all trees, other than just count So we cannot use t... | stack_v2_sparse_classes_36k_train_029935 | 1,786 | no_license | [
{
"docstring": "Generate trees :param n: :return:",
"name": "generateTrees",
"signature": "def generateTrees(self, n: int) -> List[TreeNode]"
},
{
"docstring": "Different from prob 96, in this problem we need start and end to generate all trees, other than just count So we cannot use tmp to acce... | 2 | stack_v2_sparse_classes_30k_train_020347 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateTrees(self, n: int) -> List[TreeNode]: Generate trees :param n: :return:
- def gen(self, start, end): Different from prob 96, in this problem we need start and end to... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateTrees(self, n: int) -> List[TreeNode]: Generate trees :param n: :return:
- def gen(self, start, end): Different from prob 96, in this problem we need start and end to... | a3b1e97838e510041060561459d1401f662adaeb | <|skeleton|>
class Solution:
def generateTrees(self, n: int) -> List[TreeNode]:
"""Generate trees :param n: :return:"""
<|body_0|>
def gen(self, start, end):
"""Different from prob 96, in this problem we need start and end to generate all trees, other than just count So we cannot use t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generateTrees(self, n: int) -> List[TreeNode]:
"""Generate trees :param n: :return:"""
if n == 0:
return []
return self.gen(1, n)
def gen(self, start, end):
"""Different from prob 96, in this problem we need start and end to generate all trees, ot... | the_stack_v2_python_sparse | 95. Unique Binary Search Trees II.py | HaoboGu/LeetCode | train | 0 | |
0e45c25a2cb8f865b3ce3572bf3a7f3560265afd | [
"image_bytes = decoded_tensors[self._image_field_key]\nif self._decode_jpeg_only:\n image_shape = tf.image.extract_jpeg_shape(image_bytes)\n cropped_image = preprocess_ops.random_crop_image_v2(image_bytes, image_shape)\n image = tf.cond(tf.reduce_all(tf.equal(tf.shape(cropped_image), image_shape)), lambda:... | <|body_start_0|>
image_bytes = decoded_tensors[self._image_field_key]
if self._decode_jpeg_only:
image_shape = tf.image.extract_jpeg_shape(image_bytes)
cropped_image = preprocess_ops.random_crop_image_v2(image_bytes, image_shape)
image = tf.cond(tf.reduce_all(tf.equal... | Parser to parse an image and its annotations into a dictionary of tensors. | Parser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser:
"""Parser to parse an image and its annotations into a dictionary of tensors."""
def _parse_train_image(self, decoded_tensors):
"""Parses image data for training."""
<|body_0|>
def _parse_eval_image(self, decoded_tensors):
"""Parses image data for evaluat... | stack_v2_sparse_classes_36k_train_029936 | 3,279 | permissive | [
{
"docstring": "Parses image data for training.",
"name": "_parse_train_image",
"signature": "def _parse_train_image(self, decoded_tensors)"
},
{
"docstring": "Parses image data for evaluation.",
"name": "_parse_eval_image",
"signature": "def _parse_eval_image(self, decoded_tensors)"
}... | 2 | stack_v2_sparse_classes_30k_train_014810 | Implement the Python class `Parser` described below.
Class description:
Parser to parse an image and its annotations into a dictionary of tensors.
Method signatures and docstrings:
- def _parse_train_image(self, decoded_tensors): Parses image data for training.
- def _parse_eval_image(self, decoded_tensors): Parses i... | Implement the Python class `Parser` described below.
Class description:
Parser to parse an image and its annotations into a dictionary of tensors.
Method signatures and docstrings:
- def _parse_train_image(self, decoded_tensors): Parses image data for training.
- def _parse_eval_image(self, decoded_tensors): Parses i... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class Parser:
"""Parser to parse an image and its annotations into a dictionary of tensors."""
def _parse_train_image(self, decoded_tensors):
"""Parses image data for training."""
<|body_0|>
def _parse_eval_image(self, decoded_tensors):
"""Parses image data for evaluat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parser:
"""Parser to parse an image and its annotations into a dictionary of tensors."""
def _parse_train_image(self, decoded_tensors):
"""Parses image data for training."""
image_bytes = decoded_tensors[self._image_field_key]
if self._decode_jpeg_only:
image_shape = t... | the_stack_v2_python_sparse | official/projects/yolo/dataloaders/classification_input.py | jianzhnie/models | train | 2 |
314df25700f87375ea3d1405f29271416f7bbbdd | [
"TFBaseLayer.__init__(self)\nself.in_hidden = in_hidden\nself.hidden_sizes = hidden_sizes\nself.att_size = attention_size\nself.keep_prob = keep_prob\nself.training = training\nself.rnn_type = rnn_type\nself.scope = scope",
"layer_hidden = self.in_hidden\nfor idx, hidden_size in enumerate(self.hidden_sizes):\n ... | <|body_start_0|>
TFBaseLayer.__init__(self)
self.in_hidden = in_hidden
self.hidden_sizes = hidden_sizes
self.att_size = attention_size
self.keep_prob = keep_prob
self.training = training
self.rnn_type = rnn_type
self.scope = scope
<|end_body_0|>
<|body_st... | 多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。 | TFBILSTMAttLayer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TFBILSTMAttLayer:
"""多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。"""
def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'):
"""Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐... | stack_v2_sparse_classes_36k_train_029937 | 3,762 | permissive | [
{
"docstring": "Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐层维数大小 attention_size: 注意力矩阵宽度 keep_prob: 多层lstm之间dropout输出时激活概率 training: 是否训练模式 rnn_type: 可选择LSTM或GRU",
"name": "__init__",
"signature": "def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=T... | 3 | stack_v2_sparse_classes_30k_train_009576 | Implement the Python class `TFBILSTMAttLayer` described below.
Class description:
多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。
Method signatures and docstrings:
- def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): Bi-LSTM-ATT... | Implement the Python class `TFBILSTMAttLayer` described below.
Class description:
多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。
Method signatures and docstrings:
- def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'): Bi-LSTM-ATT... | c4423c2625c398f5a93c747f3516f378b31ece46 | <|skeleton|>
class TFBILSTMAttLayer:
"""多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。"""
def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'):
"""Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TFBILSTMAttLayer:
"""多层bi-lstm加attention层封装 底层可以多个双向lstm,顶层是SoftAttention加权隐层表示。"""
def __init__(self, in_hidden, hidden_sizes, attention_size, keep_prob, training=True, rnn_type='GRU', scope='bilstm_attention'):
"""Bi-LSTM-ATTENTION初始化 Args: in_hidden: 输入层 hidden_sizes: 多层BILSTM中每层隐层维数大小 attenti... | the_stack_v2_python_sparse | layers/tf_bilstm_att_layer.py | snowhws/deeplearning | train | 10 |
11394e351de827dd2c17e127ba0f4a2e914118fe | [
"frequencies = {}\nself.findTreeSum(root, frequencies)\nres = []\nmost_freq = 0\nfor val, freq in frequencies.iteritems():\n if freq > most_freq:\n res = [val]\n most_freq = freq\n elif freq == most_freq:\n res.append(val)\nreturn res",
"if not root:\n return 0\nleft_sum = self.findT... | <|body_start_0|>
frequencies = {}
self.findTreeSum(root, frequencies)
res = []
most_freq = 0
for val, freq in frequencies.iteritems():
if freq > most_freq:
res = [val]
most_freq = freq
elif freq == most_freq:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findFrequentTreeSum(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def findTreeSum(self, root, frequencies):
"""Recursively finds sum for each subtree in the tree rooted at `root`"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_029938 | 1,978 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "findFrequentTreeSum",
"signature": "def findFrequentTreeSum(self, root)"
},
{
"docstring": "Recursively finds sum for each subtree in the tree rooted at `root`",
"name": "findTreeSum",
"signature": "def findTreeSum(self, r... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findFrequentTreeSum(self, root): :type root: TreeNode :rtype: List[int]
- def findTreeSum(self, root, frequencies): Recursively finds sum for each subtree in the tree rooted ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findFrequentTreeSum(self, root): :type root: TreeNode :rtype: List[int]
- def findTreeSum(self, root, frequencies): Recursively finds sum for each subtree in the tree rooted ... | b7c22210c2a892b51a3397e51095614ea6fe5d8a | <|skeleton|>
class Solution:
def findFrequentTreeSum(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def findTreeSum(self, root, frequencies):
"""Recursively finds sum for each subtree in the tree rooted at `root`"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findFrequentTreeSum(self, root):
""":type root: TreeNode :rtype: List[int]"""
frequencies = {}
self.findTreeSum(root, frequencies)
res = []
most_freq = 0
for val, freq in frequencies.iteritems():
if freq > most_freq:
res... | the_stack_v2_python_sparse | trees/frequent_subtree_sum.py | manthan787/algo-practice | train | 1 | |
2bb855a3d7f5bc9fd694dd4c61ae17dc624cc0af | [
"if not p:\n return not s\nfirst_match = bool(s) and p[0] in {s[0], '.'}\nif len(p) >= 2 and p[1] == '*':\n return self.isMatch(s, p[2:]) or (first_match and self.isMatch(s[1:], p))\nelse:\n return first_match and self.isMatch(s[1:], p[1:])",
"def charMatch(i, j):\n if i < 0:\n return False\n ... | <|body_start_0|>
if not p:
return not s
first_match = bool(s) and p[0] in {s[0], '.'}
if len(p) >= 2 and p[1] == '*':
return self.isMatch(s, p[2:]) or (first_match and self.isMatch(s[1:], p))
else:
return first_match and self.isMatch(s[1:], p[1:])
<|en... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
<|body_0|>
def otherIsMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not p:
return not s
... | stack_v2_sparse_classes_36k_train_029939 | 1,239 | no_license | [
{
"docstring": ":type s: str :type p: str :rtype: bool",
"name": "isMatch",
"signature": "def isMatch(self, s, p)"
},
{
"docstring": ":type s: str :type p: str :rtype: bool",
"name": "otherIsMatch",
"signature": "def otherIsMatch(self, s, p)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017460 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMatch(self, s, p): :type s: str :type p: str :rtype: bool
- def otherIsMatch(self, s, p): :type s: str :type p: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMatch(self, s, p): :type s: str :type p: str :rtype: bool
- def otherIsMatch(self, s, p): :type s: str :type p: str :rtype: bool
<|skeleton|>
class Solution:
def isMa... | e178f91ebffff06977e8c231de12786a72b3b13d | <|skeleton|>
class Solution:
def isMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
<|body_0|>
def otherIsMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isMatch(self, s, p):
""":type s: str :type p: str :rtype: bool"""
if not p:
return not s
first_match = bool(s) and p[0] in {s[0], '.'}
if len(p) >= 2 and p[1] == '*':
return self.isMatch(s, p[2:]) or (first_match and self.isMatch(s[1:], p))... | the_stack_v2_python_sparse | iamsochun/Leetcode10.py | moonlight035/algorithm | train | 0 | |
b68a7ce0369336d9d492433bd45042b962077c06 | [
"def check(codename):\n r = check_object_permission(user_obj, codename, obj)\n if r is None:\n return True\n return r\nif not isinstance(codenames, (list, tuple)):\n codenames = (codenames,)\nreturn any((check(codename) for codename in codenames))",
"if perm not in ('stars.add_star', 'stars.cha... | <|body_start_0|>
def check(codename):
r = check_object_permission(user_obj, codename, obj)
if r is None:
return True
return r
if not isinstance(codenames, (list, tuple)):
codenames = (codenames,)
return any((check(codename) for code... | StarPermissionLogic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StarPermissionLogic:
def _check_object_permissions(self, user_obj, codenames, obj):
"""指定されたユーザーが指定された省略形パーミッションのどれか一つでも 対象オブジェクトに対して持つか調べる Args: user_obj (user instance): 対象ユーザー codenames (list or tuple): 省略形パーミッションリスト obj (model instance): 対象オブジェクト Returns: bool"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_029940 | 5,638 | no_license | [
{
"docstring": "指定されたユーザーが指定された省略形パーミッションのどれか一つでも 対象オブジェクトに対して持つか調べる Args: user_obj (user instance): 対象ユーザー codenames (list or tuple): 省略形パーミッションリスト obj (model instance): 対象オブジェクト Returns: bool",
"name": "_check_object_permissions",
"signature": "def _check_object_permissions(self, user_obj, codenames, ... | 2 | null | Implement the Python class `StarPermissionLogic` described below.
Class description:
Implement the StarPermissionLogic class.
Method signatures and docstrings:
- def _check_object_permissions(self, user_obj, codenames, obj): 指定されたユーザーが指定された省略形パーミッションのどれか一つでも 対象オブジェクトに対して持つか調べる Args: user_obj (user instance): 対象ユーザー c... | Implement the Python class `StarPermissionLogic` described below.
Class description:
Implement the StarPermissionLogic class.
Method signatures and docstrings:
- def _check_object_permissions(self, user_obj, codenames, obj): 指定されたユーザーが指定された省略形パーミッションのどれか一つでも 対象オブジェクトに対して持つか調べる Args: user_obj (user instance): 対象ユーザー c... | 8f9a850c4df41b0fc1da5b73189772552d5cd531 | <|skeleton|>
class StarPermissionLogic:
def _check_object_permissions(self, user_obj, codenames, obj):
"""指定されたユーザーが指定された省略形パーミッションのどれか一つでも 対象オブジェクトに対して持つか調べる Args: user_obj (user instance): 対象ユーザー codenames (list or tuple): 省略形パーミッションリスト obj (model instance): 対象オブジェクト Returns: bool"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StarPermissionLogic:
def _check_object_permissions(self, user_obj, codenames, obj):
"""指定されたユーザーが指定された省略形パーミッションのどれか一つでも 対象オブジェクトに対して持つか調べる Args: user_obj (user instance): 対象ユーザー codenames (list or tuple): 省略形パーミッションリスト obj (model instance): 対象オブジェクト Returns: bool"""
def check(codename):
... | the_stack_v2_python_sparse | src/kawaz/apps/stars/perms.py | kawazrepos/Kawaz3rd | train | 7 | |
34b946d9f4373fa25d7394b081ddaee87c81c99c | [
"expanded_groups = []\nfor group in match_object.groups():\n try:\n place_holder_number = int(group, 10) - 1\n expanded_group = '{{{0:d}:s}}'.format(place_holder_number)\n except ValueError:\n expanded_group = group\n expanded_groups.append(expanded_group)\nreturn ''.join(expanded_grou... | <|body_start_0|>
expanded_groups = []
for group in match_object.groups():
try:
place_holder_number = int(group, 10) - 1
expanded_group = '{{{0:d}:s}}'.format(place_holder_number)
except ValueError:
expanded_group = group
... | Windows PE/COFF resource file helper. | WindowsResourceFileHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsResourceFileHelper:
"""Windows PE/COFF resource file helper."""
def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object):
"""Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str:... | stack_v2_sparse_classes_36k_train_029941 | 2,148 | permissive | [
{
"docstring": "Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str: message string with Python format() style place holders.",
"name": "_MessageStringPlaceHolderSpecifierReplacer",
"signature": "def _MessageStrin... | 2 | stack_v2_sparse_classes_30k_val_000537 | Implement the Python class `WindowsResourceFileHelper` described below.
Class description:
Windows PE/COFF resource file helper.
Method signatures and docstrings:
- def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): Replaces message string place holders into Python format() style. Args: match_object (... | Implement the Python class `WindowsResourceFileHelper` described below.
Class description:
Windows PE/COFF resource file helper.
Method signatures and docstrings:
- def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object): Replaces message string place holders into Python format() style. Args: match_object (... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class WindowsResourceFileHelper:
"""Windows PE/COFF resource file helper."""
def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object):
"""Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WindowsResourceFileHelper:
"""Windows PE/COFF resource file helper."""
def _MessageStringPlaceHolderSpecifierReplacer(cls, match_object):
"""Replaces message string place holders into Python format() style. Args: match_object (re.Match): regular expression match object. Returns: str: message stri... | the_stack_v2_python_sparse | plaso/helpers/windows/resource_files.py | log2timeline/plaso | train | 1,506 |
4880c4ec6aedda01753fb907e133501d10badef7 | [
"if (d, f, target) in self.memo:\n return self.memo[d, f, target]\nmod = 10 ** 9 + 7\nif target < d or target > d * f:\n return 0\nif d == 0:\n return 1 if target == 0 else 0\nself.memo[d, f, target] = sum((self.numRollsToTarget(d - 1, f, target - x) for x in range(1, f + 1))) % mod\nreturn self.memo[d, f,... | <|body_start_0|>
if (d, f, target) in self.memo:
return self.memo[d, f, target]
mod = 10 ** 9 + 7
if target < d or target > d * f:
return 0
if d == 0:
return 1 if target == 0 else 0
self.memo[d, f, target] = sum((self.numRollsToTarget(d - 1, f,... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numRollsToTarget(self, d, f, target):
""":type d: int :type f: int :type target: int :rtype: int"""
<|body_0|>
def numRollsToTarget_1(self, d, f, target):
""":type d: int :type f: int :type target: int :rtype: int"""
<|body_1|>
def numRolls... | stack_v2_sparse_classes_36k_train_029942 | 4,009 | no_license | [
{
"docstring": ":type d: int :type f: int :type target: int :rtype: int",
"name": "numRollsToTarget",
"signature": "def numRollsToTarget(self, d, f, target)"
},
{
"docstring": ":type d: int :type f: int :type target: int :rtype: int",
"name": "numRollsToTarget_1",
"signature": "def numRo... | 3 | stack_v2_sparse_classes_30k_train_017429 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numRollsToTarget(self, d, f, target): :type d: int :type f: int :type target: int :rtype: int
- def numRollsToTarget_1(self, d, f, target): :type d: int :type f: int :type ta... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numRollsToTarget(self, d, f, target): :type d: int :type f: int :type target: int :rtype: int
- def numRollsToTarget_1(self, d, f, target): :type d: int :type f: int :type ta... | 3d9e0ad2f6ed92ec969556f75d97c51ea4854719 | <|skeleton|>
class Solution:
def numRollsToTarget(self, d, f, target):
""":type d: int :type f: int :type target: int :rtype: int"""
<|body_0|>
def numRollsToTarget_1(self, d, f, target):
""":type d: int :type f: int :type target: int :rtype: int"""
<|body_1|>
def numRolls... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numRollsToTarget(self, d, f, target):
""":type d: int :type f: int :type target: int :rtype: int"""
if (d, f, target) in self.memo:
return self.memo[d, f, target]
mod = 10 ** 9 + 7
if target < d or target > d * f:
return 0
if d == 0... | the_stack_v2_python_sparse | Solutions/1155_numRollsToTarget.py | YoupengLi/leetcode-sorting | train | 3 | |
948465607d5d900b53e50bf6d6c5af150c9f8456 | [
"super(Discriminator, self).__init__()\nassert method in ['wasserstein', 'least_squares', 'binary_cross_entropy']\nself.method = method\nself.input_size = np.prod(design_shape)\nself.embed_0 = tfkl.Dense(hidden)\nself.embed_0.build((None, 1))\nself.dense_0 = tfkl.Dense(hidden)\nself.dense_0.build((None, self.input_... | <|body_start_0|>
super(Discriminator, self).__init__()
assert method in ['wasserstein', 'least_squares', 'binary_cross_entropy']
self.method = method
self.input_size = np.prod(design_shape)
self.embed_0 = tfkl.Dense(hidden)
self.embed_0.build((None, 1))
self.dense... | A Fully Connected Network conditioned on a score | Discriminator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discriminator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, hidden=50, method='wasserstein'):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] ... | stack_v2_sparse_classes_36k_train_029943 | 30,757 | permissive | [
{
"docstring": "Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple of integers that represents the shape of a single design for a particular task hidden: int the number of hidden units in every layer of ... | 4 | stack_v2_sparse_classes_30k_test_000365 | Implement the Python class `Discriminator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, hidden=50, method='wasserstein'): Create a fully connected architecture using keras that can process several parallel str... | Implement the Python class `Discriminator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, hidden=50, method='wasserstein'): Create a fully connected architecture using keras that can process several parallel str... | d46ff40d8b665953afb64a3332ddf1953b8a0766 | <|skeleton|>
class Discriminator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, hidden=50, method='wasserstein'):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Discriminator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, hidden=50, method='wasserstein'):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tup... | the_stack_v2_python_sparse | design_baselines/mins/nets.py | stjordanis/design-baselines | train | 0 |
166ba87e877767ad1e94d1d98447b9d1631b4da5 | [
"args = get_args.parse_args()\nnow = datetime.utcnow()\nfilter_time = now - timedelta(minutes=args['minutes'])\ntry:\n query = SensorDataModel.query.filter(SensorDataModel.sensor_id.in_(args['sensor_ids']), SensorDataModel.created > filter_time)\n response_data = defaultdict(list)\n for result in query.all... | <|body_start_0|>
args = get_args.parse_args()
now = datetime.utcnow()
filter_time = now - timedelta(minutes=args['minutes'])
try:
query = SensorDataModel.query.filter(SensorDataModel.sensor_id.in_(args['sensor_ids']), SensorDataModel.created > filter_time)
respons... | SensorData | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SensorData:
def get(self):
"""Get sensor readings for a list of sensor_ids and X amount of minutes."""
<|body_0|>
def post(self):
"""Create a new record for a sensor reading."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
args = get_args.parse_args... | stack_v2_sparse_classes_36k_train_029944 | 2,713 | permissive | [
{
"docstring": "Get sensor readings for a list of sensor_ids and X amount of minutes.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a new record for a sensor reading.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015406 | Implement the Python class `SensorData` described below.
Class description:
Implement the SensorData class.
Method signatures and docstrings:
- def get(self): Get sensor readings for a list of sensor_ids and X amount of minutes.
- def post(self): Create a new record for a sensor reading. | Implement the Python class `SensorData` described below.
Class description:
Implement the SensorData class.
Method signatures and docstrings:
- def get(self): Get sensor readings for a list of sensor_ids and X amount of minutes.
- def post(self): Create a new record for a sensor reading.
<|skeleton|>
class SensorDat... | 4ddf5cd60d5e0e87e7641e97c9fbe78965c4b522 | <|skeleton|>
class SensorData:
def get(self):
"""Get sensor readings for a list of sensor_ids and X amount of minutes."""
<|body_0|>
def post(self):
"""Create a new record for a sensor reading."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SensorData:
def get(self):
"""Get sensor readings for a list of sensor_ids and X amount of minutes."""
args = get_args.parse_args()
now = datetime.utcnow()
filter_time = now - timedelta(minutes=args['minutes'])
try:
query = SensorDataModel.query.filter(Senso... | the_stack_v2_python_sparse | api/api/endpoints/sensor_data.py | andschneider/soil_sense | train | 0 | |
668bd620b40609cb39110ea06904fecbe86bfd42 | [
"if isinstance(key, int):\n return Group(key)\nif key not in Group._member_map_:\n return extend_enum(Group, key, default)\nreturn Group[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 12 <= value <= 255:\n return ex... | <|body_start_0|>
if isinstance(key, int):
return Group(key)
if key not in Group._member_map_:
return extend_enum(Group, key, default)
return Group[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 255):
raise ValueE... | [Group] Group IDs | Group | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Group:
"""[Group] Group IDs"""
def get(key: 'int | str', default: 'int'=-1) -> 'Group':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, value: 'int') -> 'Group':... | stack_v2_sparse_classes_36k_train_029945 | 2,247 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'Group'"
},
{
"docstring": "Lookup function used when value is not found. Args:... | 2 | stack_v2_sparse_classes_30k_train_004020 | Implement the Python class `Group` described below.
Class description:
[Group] Group IDs
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'Group': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:
- def _missing... | Implement the Python class `Group` described below.
Class description:
[Group] Group IDs
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'Group': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:
- def _missing... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class Group:
"""[Group] Group IDs"""
def get(key: 'int | str', default: 'int'=-1) -> 'Group':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, value: 'int') -> 'Group':... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Group:
"""[Group] Group IDs"""
def get(key: 'int | str', default: 'int'=-1) -> 'Group':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, int):
return Group(key)
if key not... | the_stack_v2_python_sparse | pcapkit/const/hip/group.py | JarryShaw/PyPCAPKit | train | 204 |
62d2c738cb751f66a796306da800e3e4e83bbb92 | [
"self.communicator = communicator\nself.loop = asyncio.get_event_loop()\nsuper().__init__(**kwargs)",
"try:\n asyncio.run_coroutine_threadsafe(self.communicator.log(self.format(record)), self.loop)\nexcept Exception as e:\n print(e)"
] | <|body_start_0|>
self.communicator = communicator
self.loop = asyncio.get_event_loop()
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
try:
asyncio.run_coroutine_threadsafe(self.communicator.log(self.format(record)), self.loop)
except Exception as e:
... | Publish messages to Redis channel. | ZeromqHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZeromqHandler:
"""Publish messages to Redis channel."""
def __init__(self, communicator, **kwargs):
"""Construct a handler instance."""
<|body_0|>
def emit(self, record):
"""Send log message to the listener. Log all possible exceptions as warnings."""
<|b... | stack_v2_sparse_classes_36k_train_029946 | 2,128 | permissive | [
{
"docstring": "Construct a handler instance.",
"name": "__init__",
"signature": "def __init__(self, communicator, **kwargs)"
},
{
"docstring": "Send log message to the listener. Log all possible exceptions as warnings.",
"name": "emit",
"signature": "def emit(self, record)"
}
] | 2 | null | Implement the Python class `ZeromqHandler` described below.
Class description:
Publish messages to Redis channel.
Method signatures and docstrings:
- def __init__(self, communicator, **kwargs): Construct a handler instance.
- def emit(self, record): Send log message to the listener. Log all possible exceptions as war... | Implement the Python class `ZeromqHandler` described below.
Class description:
Publish messages to Redis channel.
Method signatures and docstrings:
- def __init__(self, communicator, **kwargs): Construct a handler instance.
- def emit(self, record): Send log message to the listener. Log all possible exceptions as war... | 25c0c45235ef37beb45c1af4c917fbbae6282016 | <|skeleton|>
class ZeromqHandler:
"""Publish messages to Redis channel."""
def __init__(self, communicator, **kwargs):
"""Construct a handler instance."""
<|body_0|>
def emit(self, record):
"""Send log message to the listener. Log all possible exceptions as warnings."""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZeromqHandler:
"""Publish messages to Redis channel."""
def __init__(self, communicator, **kwargs):
"""Construct a handler instance."""
self.communicator = communicator
self.loop = asyncio.get_event_loop()
super().__init__(**kwargs)
def emit(self, record):
"""... | the_stack_v2_python_sparse | resolwe/flow/executors/logger.py | genialis/resolwe | train | 35 |
20d7f9803f787611c1580c0df141ed3f9fa59e6a | [
"self.assertEqual(start_point(52), (50, 5))\nself.assertEqual(start_point(61), (50, 5))\nself.assertEqual(start_point(31), (26, 4))\nself.assertEqual(start_point(47), (26, 4))\nself.assertEqual(start_point(19), (10, 3))\nself.assertEqual(start_point(3), (2, 2))\nself.assertEqual(start_point(1), (1, 1))",
"self.as... | <|body_start_0|>
self.assertEqual(start_point(52), (50, 5))
self.assertEqual(start_point(61), (50, 5))
self.assertEqual(start_point(31), (26, 4))
self.assertEqual(start_point(47), (26, 4))
self.assertEqual(start_point(19), (10, 3))
self.assertEqual(start_point(3), (2, 2))... | Unist tests for actual day | MyTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyTest:
"""Unist tests for actual day"""
def test_start(self):
"""Test start point"""
<|body_0|>
def test_y(self):
"""Test y value"""
<|body_1|>
def test_side(self):
"""Test side position"""
<|body_2|>
def test_match(self):
... | stack_v2_sparse_classes_36k_train_029947 | 1,777 | permissive | [
{
"docstring": "Test start point",
"name": "test_start",
"signature": "def test_start(self)"
},
{
"docstring": "Test y value",
"name": "test_y",
"signature": "def test_y(self)"
},
{
"docstring": "Test side position",
"name": "test_side",
"signature": "def test_side(self)"... | 4 | null | Implement the Python class `MyTest` described below.
Class description:
Unist tests for actual day
Method signatures and docstrings:
- def test_start(self): Test start point
- def test_y(self): Test y value
- def test_side(self): Test side position
- def test_match(self): The basic test cases | Implement the Python class `MyTest` described below.
Class description:
Unist tests for actual day
Method signatures and docstrings:
- def test_start(self): Test start point
- def test_y(self): Test y value
- def test_side(self): Test side position
- def test_match(self): The basic test cases
<|skeleton|>
class MyTe... | 635be485ec691f9c0cdeb83f944de190f51c1ba3 | <|skeleton|>
class MyTest:
"""Unist tests for actual day"""
def test_start(self):
"""Test start point"""
<|body_0|>
def test_y(self):
"""Test y value"""
<|body_1|>
def test_side(self):
"""Test side position"""
<|body_2|>
def test_match(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyTest:
"""Unist tests for actual day"""
def test_start(self):
"""Test start point"""
self.assertEqual(start_point(52), (50, 5))
self.assertEqual(start_point(61), (50, 5))
self.assertEqual(start_point(31), (26, 4))
self.assertEqual(start_point(47), (26, 4))
... | the_stack_v2_python_sparse | 2017/03_1/code.test.py | budavariam/advent_of_code | train | 1 |
bf37fb402b0884c911d6e576f1b6b0c1abfc35db | [
"found_item = plotter.plots.meshes.get(item_key_name, None)\nif found_item is None:\n plotter.plots.meshes[item_key_name] = render_item\n plotter.ui.plt += render_item\n found_item = render_item\n if not defer_render:\n plotter.ui.plt.render()\nreturn found_item",
"found_item = plotter.plots.me... | <|body_start_0|>
found_item = plotter.plots.meshes.get(item_key_name, None)
if found_item is None:
plotter.plots.meshes[item_key_name] = render_item
plotter.ui.plt += render_item
found_item = render_item
if not defer_render:
plotter.ui.plt.... | docstring for VedoHelpers. Import with: from pyphoplacecellanalysis.GUI.Vedo.VedoMeshManipulatable import VedoPlotterHelpers | VedoPlotterHelpers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VedoPlotterHelpers:
"""docstring for VedoHelpers. Import with: from pyphoplacecellanalysis.GUI.Vedo.VedoMeshManipulatable import VedoPlotterHelpers"""
def vedo_create_if_needed(cls, plotter, item_key_name, render_item, defer_render=False):
"""Creates a new mesh if it exists in spike_... | stack_v2_sparse_classes_36k_train_029948 | 3,367 | permissive | [
{
"docstring": "Creates a new mesh if it exists in spike_raster_plt_3d_vedo plotter: Spike3DRaster_Vedo the main 3d plotter. item_key_name: str - like 'new_active_axes' render_item: a valid vedo object that can be added to the plotter, like a Mesh or Text3D defer_render: bool - whether to immediately render aft... | 2 | stack_v2_sparse_classes_30k_train_016431 | Implement the Python class `VedoPlotterHelpers` described below.
Class description:
docstring for VedoHelpers. Import with: from pyphoplacecellanalysis.GUI.Vedo.VedoMeshManipulatable import VedoPlotterHelpers
Method signatures and docstrings:
- def vedo_create_if_needed(cls, plotter, item_key_name, render_item, defer... | Implement the Python class `VedoPlotterHelpers` described below.
Class description:
docstring for VedoHelpers. Import with: from pyphoplacecellanalysis.GUI.Vedo.VedoMeshManipulatable import VedoPlotterHelpers
Method signatures and docstrings:
- def vedo_create_if_needed(cls, plotter, item_key_name, render_item, defer... | 212399d826284b394fce8894ff1a93133aef783f | <|skeleton|>
class VedoPlotterHelpers:
"""docstring for VedoHelpers. Import with: from pyphoplacecellanalysis.GUI.Vedo.VedoMeshManipulatable import VedoPlotterHelpers"""
def vedo_create_if_needed(cls, plotter, item_key_name, render_item, defer_render=False):
"""Creates a new mesh if it exists in spike_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VedoPlotterHelpers:
"""docstring for VedoHelpers. Import with: from pyphoplacecellanalysis.GUI.Vedo.VedoMeshManipulatable import VedoPlotterHelpers"""
def vedo_create_if_needed(cls, plotter, item_key_name, render_item, defer_render=False):
"""Creates a new mesh if it exists in spike_raster_plt_3d... | the_stack_v2_python_sparse | src/pyphoplacecellanalysis/GUI/Vedo/VedoMeshManipulatable.py | CommanderPho/pyPhoPlaceCellAnalysis | train | 1 |
acaf830c80d28d3f5028a205a87269b8fc0d69cd | [
"if flt.shape != msk.shape:\n raise Exception('model and data must have same shape')\nmsk[:] = flt[:]\nmsk[0] = 0.0",
"if flt.shape != msk.shape:\n raise Exception('model and data must have same shape')\nflt[:] = msk[:]\nflt[0] = 0.0"
] | <|body_start_0|>
if flt.shape != msk.shape:
raise Exception('model and data must have same shape')
msk[:] = flt[:]
msk[0] = 0.0
<|end_body_0|>
<|body_start_1|>
if flt.shape != msk.shape:
raise Exception('model and data must have same shape')
flt[:] = msk[... | Mask operator for not updating the zero lag coefficient | pef1dmask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pef1dmask:
"""Mask operator for not updating the zero lag coefficient"""
def forward(self, add, flt, msk):
"""Applies the mask to the filter"""
<|body_0|>
def adjoint(self, add, flt, msk):
"""Applies adjoint mask"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_029949 | 7,358 | no_license | [
{
"docstring": "Applies the mask to the filter",
"name": "forward",
"signature": "def forward(self, add, flt, msk)"
},
{
"docstring": "Applies adjoint mask",
"name": "adjoint",
"signature": "def adjoint(self, add, flt, msk)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015932 | Implement the Python class `pef1dmask` described below.
Class description:
Mask operator for not updating the zero lag coefficient
Method signatures and docstrings:
- def forward(self, add, flt, msk): Applies the mask to the filter
- def adjoint(self, add, flt, msk): Applies adjoint mask | Implement the Python class `pef1dmask` described below.
Class description:
Mask operator for not updating the zero lag coefficient
Method signatures and docstrings:
- def forward(self, add, flt, msk): Applies the mask to the filter
- def adjoint(self, add, flt, msk): Applies adjoint mask
<|skeleton|>
class pef1dmask... | db8c81f6a98cd665a493b54099eae1d28ee092e7 | <|skeleton|>
class pef1dmask:
"""Mask operator for not updating the zero lag coefficient"""
def forward(self, add, flt, msk):
"""Applies the mask to the filter"""
<|body_0|>
def adjoint(self, add, flt, msk):
"""Applies adjoint mask"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class pef1dmask:
"""Mask operator for not updating the zero lag coefficient"""
def forward(self, add, flt, msk):
"""Applies the mask to the filter"""
if flt.shape != msk.shape:
raise Exception('model and data must have same shape')
msk[:] = flt[:]
msk[0] = 0.0
d... | the_stack_v2_python_sparse | adf/adf/stat/pef1d.py | ke0m/process_f3_data | train | 1 |
7081b6d93e05a98e9b78d828d114d8497b57b3b9 | [
"n = len(nums)\nval = [1] + nums + [1]\n\ndef solve(left: int, right: int) -> int:\n if left >= right - 1:\n return 0\n best = 0\n for i in range(left + 1, right):\n total = val[left] * val[i] * val[right]\n total += solve(left, i) + solve(i, right)\n best = max(best, total)\n ... | <|body_start_0|>
n = len(nums)
val = [1] + nums + [1]
def solve(left: int, right: int) -> int:
if left >= right - 1:
return 0
best = 0
for i in range(left + 1, right):
total = val[left] * val[i] * val[right]
tot... | Solution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxCoins_1(self, nums: List[int]) -> int:
"""方法一:记忆化搜索 时间复杂度:O(n^3),其中 n 是气球数量。区间数为 n^2,区间迭代复杂度为 O(n),最终复杂度为 O(n^2 x n) = O(n^3) 空间复杂度:O(n^2),其中 n 是气球数量。缓存大小为区间的个数。 :return:"""
<|body_0|>
def maxCoins_2(self, nums: List[int]) -> int:
"""方法二:动态规划 时间复杂度:O... | stack_v2_sparse_classes_36k_train_029950 | 2,612 | permissive | [
{
"docstring": "方法一:记忆化搜索 时间复杂度:O(n^3),其中 n 是气球数量。区间数为 n^2,区间迭代复杂度为 O(n),最终复杂度为 O(n^2 x n) = O(n^3) 空间复杂度:O(n^2),其中 n 是气球数量。缓存大小为区间的个数。 :return:",
"name": "maxCoins_1",
"signature": "def maxCoins_1(self, nums: List[int]) -> int"
},
{
"docstring": "方法二:动态规划 时间复杂度:O(n^3),其中 n 是气球数量。状态数为 n^2,状态转移复杂... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxCoins_1(self, nums: List[int]) -> int: 方法一:记忆化搜索 时间复杂度:O(n^3),其中 n 是气球数量。区间数为 n^2,区间迭代复杂度为 O(n),最终复杂度为 O(n^2 x n) = O(n^3) 空间复杂度:O(n^2),其中 n 是气球数量。缓存大小为区间的个数。 :return:
- d... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxCoins_1(self, nums: List[int]) -> int: 方法一:记忆化搜索 时间复杂度:O(n^3),其中 n 是气球数量。区间数为 n^2,区间迭代复杂度为 O(n),最终复杂度为 O(n^2 x n) = O(n^3) 空间复杂度:O(n^2),其中 n 是气球数量。缓存大小为区间的个数。 :return:
- d... | 62419b49000e79962bcdc99cd98afd2fb82ea345 | <|skeleton|>
class Solution:
def maxCoins_1(self, nums: List[int]) -> int:
"""方法一:记忆化搜索 时间复杂度:O(n^3),其中 n 是气球数量。区间数为 n^2,区间迭代复杂度为 O(n),最终复杂度为 O(n^2 x n) = O(n^3) 空间复杂度:O(n^2),其中 n 是气球数量。缓存大小为区间的个数。 :return:"""
<|body_0|>
def maxCoins_2(self, nums: List[int]) -> int:
"""方法二:动态规划 时间复杂度:O... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxCoins_1(self, nums: List[int]) -> int:
"""方法一:记忆化搜索 时间复杂度:O(n^3),其中 n 是气球数量。区间数为 n^2,区间迭代复杂度为 O(n),最终复杂度为 O(n^2 x n) = O(n^3) 空间复杂度:O(n^2),其中 n 是气球数量。缓存大小为区间的个数。 :return:"""
n = len(nums)
val = [1] + nums + [1]
def solve(left: int, right: int) -> int:
... | the_stack_v2_python_sparse | LeetCode 热题 HOT 100/maxCoins.py | MaoningGuan/LeetCode | train | 3 | |
4ee43d75b7619b50e1ab89aba5eac4aa7a9c76e7 | [
"if x < 0:\n return False\nelse:\n return x == self.reverseInt(x)",
"reverse = 0\nwhile x:\n reverse *= 10\n reverse += x % 10\n x //= 10\nreturn reverse"
] | <|body_start_0|>
if x < 0:
return False
else:
return x == self.reverseInt(x)
<|end_body_0|>
<|body_start_1|>
reverse = 0
while x:
reverse *= 10
reverse += x % 10
x //= 10
return reverse
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, x):
"""Time: O(log(x)) Space: O(1)"""
<|body_0|>
def reverseInt(self, x):
"""Return the reversed version of a positive int."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x < 0:
return False
e... | stack_v2_sparse_classes_36k_train_029951 | 680 | no_license | [
{
"docstring": "Time: O(log(x)) Space: O(1)",
"name": "isPalindrome",
"signature": "def isPalindrome(self, x)"
},
{
"docstring": "Return the reversed version of a positive int.",
"name": "reverseInt",
"signature": "def reverseInt(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011312 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x): Time: O(log(x)) Space: O(1)
- def reverseInt(self, x): Return the reversed version of a positive int. | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x): Time: O(log(x)) Space: O(1)
- def reverseInt(self, x): Return the reversed version of a positive int.
<|skeleton|>
class Solution:
def isPalindro... | dfe4aa136fe57913e5c0bac091262ad451a57703 | <|skeleton|>
class Solution:
def isPalindrome(self, x):
"""Time: O(log(x)) Space: O(1)"""
<|body_0|>
def reverseInt(self, x):
"""Return the reversed version of a positive int."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isPalindrome(self, x):
"""Time: O(log(x)) Space: O(1)"""
if x < 0:
return False
else:
return x == self.reverseInt(x)
def reverseInt(self, x):
"""Return the reversed version of a positive int."""
reverse = 0
while x:
... | the_stack_v2_python_sparse | LeetCode/src/009 - Palindrome Number.py | Rudra-Patil/Programming-Exercises | train | 1 | |
e5c985594fd7c781250e91b09ffbc396856cb7d8 | [
"self._synapse_client = syn\nself._project = syn.get(project_id)\nself.entitylist = entitylist\nself.center = center\nself._format_registry = format_registry\nself.file_type = self.determine_filetype() if file_type is None else file_type\nself.genie_config = genie_config\nself.ancillary_files = ancillary_files",
... | <|body_start_0|>
self._synapse_client = syn
self._project = syn.get(project_id)
self.entitylist = entitylist
self.center = center
self._format_registry = format_registry
self.file_type = self.determine_filetype() if file_type is None else file_type
self.genie_conf... | ValidationHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidationHelper:
def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type: Optional[str]=None, genie_config: Optional[Dict]=None, ancillary_files: Optional[list]=None):
"""A validat... | stack_v2_sparse_classes_36k_train_029952 | 12,242 | permissive | [
{
"docstring": "A validator helper class for a center's files. Args: syn: a synapseclient.Synapse object project_id: Synapse Project ID where files are stored and configured. center: The participating center name. entitylist: a list of file paths. format_registry: A dictionary mapping file format name to the fo... | 3 | stack_v2_sparse_classes_30k_train_012216 | Implement the Python class `ValidationHelper` described below.
Class description:
Implement the ValidationHelper class.
Method signatures and docstrings:
- def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type... | Implement the Python class `ValidationHelper` described below.
Class description:
Implement the ValidationHelper class.
Method signatures and docstrings:
- def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type... | 1513cc2fcb5aa3867fce810d0db9b5479e962f05 | <|skeleton|>
class ValidationHelper:
def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type: Optional[str]=None, genie_config: Optional[Dict]=None, ancillary_files: Optional[list]=None):
"""A validat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidationHelper:
def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type: Optional[str]=None, genie_config: Optional[Dict]=None, ancillary_files: Optional[list]=None):
"""A validator helper clas... | the_stack_v2_python_sparse | genie/validate.py | Sage-Bionetworks/Genie | train | 12 | |
d5d78f20a198a3fca4fa87082b57fb6678f0e63d | [
"for member in [self.team2_admin, self.team2_member]:\n self.client.force_login(member)\n response = self.client.get(self.detail_url)\n self.assertContains(response, '%s is an Item in the Category %s.' % (self.item.name, self.item.category.name), status_code=200)",
"self.client.force_login(self.team1_mem... | <|body_start_0|>
for member in [self.team2_admin, self.team2_member]:
self.client.force_login(member)
response = self.client.get(self.detail_url)
self.assertContains(response, '%s is an Item in the Category %s.' % (self.item.name, self.item.category.name), status_code=200)
<|... | Test ItemDetailView | ItemDetailViewTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemDetailViewTest:
"""Test ItemDetailView"""
def test_item_detail_member(self):
"""Assert that item details are shown to an admin and member"""
<|body_0|>
def test_item_detail_nonmember(self):
"""Assert that item details denied for a non-member"""
<|body... | stack_v2_sparse_classes_36k_train_029953 | 9,594 | permissive | [
{
"docstring": "Assert that item details are shown to an admin and member",
"name": "test_item_detail_member",
"signature": "def test_item_detail_member(self)"
},
{
"docstring": "Assert that item details denied for a non-member",
"name": "test_item_detail_nonmember",
"signature": "def te... | 2 | null | Implement the Python class `ItemDetailViewTest` described below.
Class description:
Test ItemDetailView
Method signatures and docstrings:
- def test_item_detail_member(self): Assert that item details are shown to an admin and member
- def test_item_detail_nonmember(self): Assert that item details denied for a non-mem... | Implement the Python class `ItemDetailViewTest` described below.
Class description:
Test ItemDetailView
Method signatures and docstrings:
- def test_item_detail_member(self): Assert that item details are shown to an admin and member
- def test_item_detail_nonmember(self): Assert that item details denied for a non-mem... | b3a61462d46d33de25fb96c029b2bd822001b669 | <|skeleton|>
class ItemDetailViewTest:
"""Test ItemDetailView"""
def test_item_detail_member(self):
"""Assert that item details are shown to an admin and member"""
<|body_0|>
def test_item_detail_nonmember(self):
"""Assert that item details denied for a non-member"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ItemDetailViewTest:
"""Test ItemDetailView"""
def test_item_detail_member(self):
"""Assert that item details are shown to an admin and member"""
for member in [self.team2_admin, self.team2_member]:
self.client.force_login(member)
response = self.client.get(self.det... | the_stack_v2_python_sparse | src/item/tests.py | tykling/socialrating | train | 3 |
d147be66a46875d93ef743b65b1917f1fec7292a | [
"try:\n games = {}\n query = 'search *\"{}\"*;fields id, name, genres.name, first_release_date,platforms.name, summary, dlcs.name,expansions.name,total_rating, keywords.name, age_ratings.synopsis, similar_games.name,similar_games.cover.url, cover.url, screenshots.url,videos.video_id, websites.url;limit 20;'.f... | <|body_start_0|>
try:
games = {}
query = 'search *"{}"*;fields id, name, genres.name, first_release_date,platforms.name, summary, dlcs.name,expansions.name,total_rating, keywords.name, age_ratings.synopsis, similar_games.name,similar_games.cover.url, cover.url, screenshots.url,videos.vid... | Utilities for the service of games. | UtilsGames | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UtilsGames:
"""Utilities for the service of games."""
def search_all(self, data):
"""Search by all items."""
<|body_0|>
def search_date(self, data):
"""Search by date."""
<|body_1|>
def search_uuid(self, data):
"""Search by uuid."""
<... | stack_v2_sparse_classes_36k_train_029954 | 11,622 | no_license | [
{
"docstring": "Search by all items.",
"name": "search_all",
"signature": "def search_all(self, data)"
},
{
"docstring": "Search by date.",
"name": "search_date",
"signature": "def search_date(self, data)"
},
{
"docstring": "Search by uuid.",
"name": "search_uuid",
"signa... | 4 | stack_v2_sparse_classes_30k_train_001784 | Implement the Python class `UtilsGames` described below.
Class description:
Utilities for the service of games.
Method signatures and docstrings:
- def search_all(self, data): Search by all items.
- def search_date(self, data): Search by date.
- def search_uuid(self, data): Search by uuid.
- def search_coming_soon(se... | Implement the Python class `UtilsGames` described below.
Class description:
Utilities for the service of games.
Method signatures and docstrings:
- def search_all(self, data): Search by all items.
- def search_date(self, data): Search by date.
- def search_uuid(self, data): Search by uuid.
- def search_coming_soon(se... | cd8767b5eeaef3a09d77c936781b4126fd8591de | <|skeleton|>
class UtilsGames:
"""Utilities for the service of games."""
def search_all(self, data):
"""Search by all items."""
<|body_0|>
def search_date(self, data):
"""Search by date."""
<|body_1|>
def search_uuid(self, data):
"""Search by uuid."""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UtilsGames:
"""Utilities for the service of games."""
def search_all(self, data):
"""Search by all items."""
try:
games = {}
query = 'search *"{}"*;fields id, name, genres.name, first_release_date,platforms.name, summary, dlcs.name,expansions.name,total_rating, key... | the_stack_v2_python_sparse | api/services/utils.py | ignite7/backproject | train | 0 |
26785751065b87146ccd135f98b0c68a1ef80a91 | [
"url = '/api/v1.2/graph-connections/%d/job-manager/%d/upload-file/token' % (graph_id, job_id)\ncode, res = Request().request(method='get', path=url, params=param, types='hubble')\nreturn (code, res)",
"url = '/api/v1.2/graph-connections/%d/job-manager/%d/upload-file' % (graph_id, job_id)\ncode, res = Request().re... | <|body_start_0|>
url = '/api/v1.2/graph-connections/%d/job-manager/%d/upload-file/token' % (graph_id, job_id)
code, res = Request().request(method='get', path=url, params=param, types='hubble')
return (code, res)
<|end_body_0|>
<|body_start_1|>
url = '/api/v1.2/graph-connections/%d/job-... | 导入功能 | File | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class File:
"""导入功能"""
def get_loadfile_token(graph_id, job_id, param=None, auth=None):
"""获取文件token :param auth: :param graph_id: :param job_id:导入任务ID :param param: :return: ?names=movie.csv"""
<|body_0|>
def upload_file(graph_id, job_id, files, param, auth=None):
"""... | stack_v2_sparse_classes_36k_train_029955 | 26,078 | no_license | [
{
"docstring": "获取文件token :param auth: :param graph_id: :param job_id:导入任务ID :param param: :return: ?names=movie.csv",
"name": "get_loadfile_token",
"signature": "def get_loadfile_token(graph_id, job_id, param=None, auth=None)"
},
{
"docstring": "上传文件 :param auth: :param graph_id: :param files:需... | 3 | stack_v2_sparse_classes_30k_train_009081 | Implement the Python class `File` described below.
Class description:
导入功能
Method signatures and docstrings:
- def get_loadfile_token(graph_id, job_id, param=None, auth=None): 获取文件token :param auth: :param graph_id: :param job_id:导入任务ID :param param: :return: ?names=movie.csv
- def upload_file(graph_id, job_id, files... | Implement the Python class `File` described below.
Class description:
导入功能
Method signatures and docstrings:
- def get_loadfile_token(graph_id, job_id, param=None, auth=None): 获取文件token :param auth: :param graph_id: :param job_id:导入任务ID :param param: :return: ?names=movie.csv
- def upload_file(graph_id, job_id, files... | 89e5b34ab925bcc0bbc4ad63302e96c62a420399 | <|skeleton|>
class File:
"""导入功能"""
def get_loadfile_token(graph_id, job_id, param=None, auth=None):
"""获取文件token :param auth: :param graph_id: :param job_id:导入任务ID :param param: :return: ?names=movie.csv"""
<|body_0|>
def upload_file(graph_id, job_id, files, param, auth=None):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class File:
"""导入功能"""
def get_loadfile_token(graph_id, job_id, param=None, auth=None):
"""获取文件token :param auth: :param graph_id: :param job_id:导入任务ID :param param: :return: ?names=movie.csv"""
url = '/api/v1.2/graph-connections/%d/job-manager/%d/upload-file/token' % (graph_id, job_id)
... | the_stack_v2_python_sparse | src/common/hubble_api.py | hugegraph/hugegraph-test | train | 1 |
d1bde0dcdb01cd09e9af91a7f2905509f1992e09 | [
"super().__init__(app)\nself._client_public_key = client_public_key\nlogger.info(f'pub: {self._client_public_key}')\nself._verification_key = VerifyKey(bytes.fromhex(self._client_public_key))\nself._skip_verification_of_key = testing_skip_verification_of_key\nif self._skip_verification_of_key:\n logger.warning('... | <|body_start_0|>
super().__init__(app)
self._client_public_key = client_public_key
logger.info(f'pub: {self._client_public_key}')
self._verification_key = VerifyKey(bytes.fromhex(self._client_public_key))
self._skip_verification_of_key = testing_skip_verification_of_key
i... | Main middleware for verifying requests are signed by Discord. Per documentation. You should not need to import this directly. | DiscordVerificationMiddleware | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscordVerificationMiddleware:
"""Main middleware for verifying requests are signed by Discord. Per documentation. You should not need to import this directly."""
def __init__(self, app: 'FastAPI', *, client_public_key: str, testing_skip_verification_of_key: bool=False):
"""Initializ... | stack_v2_sparse_classes_36k_train_029956 | 4,146 | permissive | [
{
"docstring": "Initialize middleware Args: app (FastAPI): A valid, initialized FastAPI object client_public_key (str): a valid client public key",
"name": "__init__",
"signature": "def __init__(self, app: 'FastAPI', *, client_public_key: str, testing_skip_verification_of_key: bool=False)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_013858 | Implement the Python class `DiscordVerificationMiddleware` described below.
Class description:
Main middleware for verifying requests are signed by Discord. Per documentation. You should not need to import this directly.
Method signatures and docstrings:
- def __init__(self, app: 'FastAPI', *, client_public_key: str,... | Implement the Python class `DiscordVerificationMiddleware` described below.
Class description:
Main middleware for verifying requests are signed by Discord. Per documentation. You should not need to import this directly.
Method signatures and docstrings:
- def __init__(self, app: 'FastAPI', *, client_public_key: str,... | bd3ffb28fc03307077d647ee233f4f0e5c594434 | <|skeleton|>
class DiscordVerificationMiddleware:
"""Main middleware for verifying requests are signed by Discord. Per documentation. You should not need to import this directly."""
def __init__(self, app: 'FastAPI', *, client_public_key: str, testing_skip_verification_of_key: bool=False):
"""Initializ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiscordVerificationMiddleware:
"""Main middleware for verifying requests are signed by Discord. Per documentation. You should not need to import this directly."""
def __init__(self, app: 'FastAPI', *, client_public_key: str, testing_skip_verification_of_key: bool=False):
"""Initialize middleware ... | the_stack_v2_python_sparse | dispike/middlewares/verification.py | ryuuzake/dispike | train | 0 |
335b880191e9349a66646dd97b2e29674e73e486 | [
"self.text = text\nself.left = left\nself.right = right\nself.fill = fill\nself.show_percentage = show_percentage\nself.show_count = show_count\nself.align = {'left': 'ljust', 'right': 'rjust', 'center': 'center'}.get(align, 'ljust')\nself.todo_color = todo_color\nself.done_color = done_color",
"left, marked, rig... | <|body_start_0|>
self.text = text
self.left = left
self.right = right
self.fill = fill
self.show_percentage = show_percentage
self.show_count = show_count
self.align = {'left': 'ljust', 'right': 'rjust', 'center': 'center'}.get(align, 'ljust')
self.todo_co... | A progress bar which displays specified text in the background. | LabeledBar | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabeledBar:
"""A progress bar which displays specified text in the background."""
def __init__(self, text, left='|', right='|', fill=' ', align='left', show_percentage=False, show_count=False, todo_color='\x1b[0;0m', done_color='\x1b[;7m'):
"""Creates a customizable progress bar. tex... | stack_v2_sparse_classes_36k_train_029957 | 13,457 | permissive | [
{
"docstring": "Creates a customizable progress bar. text - string to display in Bar. left - string or updatable object to use as a left border. right - string or updatable object to use as a right border. align - one of 'left', 'right', 'center'. fill - character to pad with. show_percentage - whether to displ... | 2 | stack_v2_sparse_classes_30k_val_000600 | Implement the Python class `LabeledBar` described below.
Class description:
A progress bar which displays specified text in the background.
Method signatures and docstrings:
- def __init__(self, text, left='|', right='|', fill=' ', align='left', show_percentage=False, show_count=False, todo_color='\x1b[0;0m', done_co... | Implement the Python class `LabeledBar` described below.
Class description:
A progress bar which displays specified text in the background.
Method signatures and docstrings:
- def __init__(self, text, left='|', right='|', fill=' ', align='left', show_percentage=False, show_count=False, todo_color='\x1b[0;0m', done_co... | aa56ad1db9b53c0cd33d41e06303293817640047 | <|skeleton|>
class LabeledBar:
"""A progress bar which displays specified text in the background."""
def __init__(self, text, left='|', right='|', fill=' ', align='left', show_percentage=False, show_count=False, todo_color='\x1b[0;0m', done_color='\x1b[;7m'):
"""Creates a customizable progress bar. tex... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LabeledBar:
"""A progress bar which displays specified text in the background."""
def __init__(self, text, left='|', right='|', fill=' ', align='left', show_percentage=False, show_count=False, todo_color='\x1b[0;0m', done_color='\x1b[;7m'):
"""Creates a customizable progress bar. text - string to... | the_stack_v2_python_sparse | src/pyunicorn/utils/progressbar/widgets.py | pik-copan/pyunicorn | train | 194 |
9e457d6e528e81c34ab09c8a715b958410ec7684 | [
"IO_files = {}\nfile_names = set()\nfor fl in in_dir.files:\n if self.name not in fl.users:\n if utils.splitext(fl.name)[-1] in self.input_types:\n IO_files['--!i'] = os.path.join(in_dir.path, fl.name)\n command_ids = [utils.infer_path_id(IO_files['--!i'])]\n in_dir.use_fi... | <|body_start_0|>
IO_files = {}
file_names = set()
for fl in in_dir.files:
if self.name not in fl.users:
if utils.splitext(fl.name)[-1] in self.input_types:
IO_files['--!i'] = os.path.join(in_dir.path, fl.name)
command_ids = [uti... | Class for creating command lines for samtools index. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name of the function. input_type: ... | samtools_index | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class samtools_index:
"""Class for creating command lines for samtools index. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes... | stack_v2_sparse_classes_36k_train_029958 | 7,774 | permissive | [
{
"docstring": "Infers the input and output file paths. This method must keep the directory objects up to date of the file edits! Parameters: in_cmd: A dict containing the command line. in_dir: Input directory (instance of filetypes.Directory). out_dir: Output directory (instance of filetypes.Directory). Return... | 2 | stack_v2_sparse_classes_30k_train_016500 | Implement the Python class `samtools_index` described below.
Class description:
Class for creating command lines for samtools index. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects ... | Implement the Python class `samtools_index` described below.
Class description:
Class for creating command lines for samtools index. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects ... | fd83eee4be0bb78c67a111fd1c1c1dff4c16aefe | <|skeleton|>
class samtools_index:
"""Class for creating command lines for samtools index. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class samtools_index:
"""Class for creating command lines for samtools index. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name ... | the_stack_v2_python_sparse | modules/samtools.py | tyrmi/STAPLER | train | 4 |
58ce0c0b0ceba180d5ce5b7946362922d4014a2f | [
"iv = key[::-1]\ncipher = AES.new(key.encode('utf-8'), mode, iv.encode('utf-8'))\nenc = cipher.encrypt(pad(raw))\nreturn str(base64.b64encode(enc), encoding='utf-8')",
"iv = key[::-1]\nprint(enc)\ndecode = base64.b64decode(bytes(enc, encoding='utf-8'))\ncipher = AES.new(key.encode('utf-8'), mode, iv.encode('utf-8... | <|body_start_0|>
iv = key[::-1]
cipher = AES.new(key.encode('utf-8'), mode, iv.encode('utf-8'))
enc = cipher.encrypt(pad(raw))
return str(base64.b64encode(enc), encoding='utf-8')
<|end_body_0|>
<|body_start_1|>
iv = key[::-1]
print(enc)
decode = base64.b64decode(... | AES/CBC/PKCS5Padding | AesCipher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AesCipher:
"""AES/CBC/PKCS5Padding"""
def encrypt(raw: str, key: str, mode: int=AES.MODE_CBC) -> str:
"""加密方法 @param key: aes秘钥 @param raw: 明文 @param mode: 加密模式,默认CBC @return: 密文"""
<|body_0|>
def decrypt(enc: str, key: str, mode: int=AES.MODE_CBC) -> str:
"""解密方... | stack_v2_sparse_classes_36k_train_029959 | 2,243 | no_license | [
{
"docstring": "加密方法 @param key: aes秘钥 @param raw: 明文 @param mode: 加密模式,默认CBC @return: 密文",
"name": "encrypt",
"signature": "def encrypt(raw: str, key: str, mode: int=AES.MODE_CBC) -> str"
},
{
"docstring": "解密方法 @param enc: 密文 @param key: 秘钥 @param mode: 加密模式,默认CBC @return: 明文",
"name": "de... | 2 | stack_v2_sparse_classes_30k_train_008760 | Implement the Python class `AesCipher` described below.
Class description:
AES/CBC/PKCS5Padding
Method signatures and docstrings:
- def encrypt(raw: str, key: str, mode: int=AES.MODE_CBC) -> str: 加密方法 @param key: aes秘钥 @param raw: 明文 @param mode: 加密模式,默认CBC @return: 密文
- def decrypt(enc: str, key: str, mode: int=AES.... | Implement the Python class `AesCipher` described below.
Class description:
AES/CBC/PKCS5Padding
Method signatures and docstrings:
- def encrypt(raw: str, key: str, mode: int=AES.MODE_CBC) -> str: 加密方法 @param key: aes秘钥 @param raw: 明文 @param mode: 加密模式,默认CBC @return: 密文
- def decrypt(enc: str, key: str, mode: int=AES.... | 99079579b4117685c7bbe23d69049769e916e826 | <|skeleton|>
class AesCipher:
"""AES/CBC/PKCS5Padding"""
def encrypt(raw: str, key: str, mode: int=AES.MODE_CBC) -> str:
"""加密方法 @param key: aes秘钥 @param raw: 明文 @param mode: 加密模式,默认CBC @return: 密文"""
<|body_0|>
def decrypt(enc: str, key: str, mode: int=AES.MODE_CBC) -> str:
"""解密方... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AesCipher:
"""AES/CBC/PKCS5Padding"""
def encrypt(raw: str, key: str, mode: int=AES.MODE_CBC) -> str:
"""加密方法 @param key: aes秘钥 @param raw: 明文 @param mode: 加密模式,默认CBC @return: 密文"""
iv = key[::-1]
cipher = AES.new(key.encode('utf-8'), mode, iv.encode('utf-8'))
enc = cipher... | the_stack_v2_python_sparse | fcore/base/util/cipher/cipher.py | Suyghur/fast-auto | train | 0 |
8d8515bf8a5aceea7b95a52ee632ca9eac95fa12 | [
"self.name = username\nself.userPageURL = 'https://news.ycombinator.com/user?id=' + self.name\nself.threadsPageURL = 'https://news.ycombinator.com/threads?id=' + self.name\nself.refreshKarma()",
"hn = HackerNewsAPI()\nsource = hn.getSource(self.userPageURL)\nkarmaStart = source.find('<td valign=top>karma:</td><td... | <|body_start_0|>
self.name = username
self.userPageURL = 'https://news.ycombinator.com/user?id=' + self.name
self.threadsPageURL = 'https://news.ycombinator.com/threads?id=' + self.name
self.refreshKarma()
<|end_body_0|>
<|body_start_1|>
hn = HackerNewsAPI()
source = hn.... | A class representing a user on Hacker News. | HackerNewsUser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HackerNewsUser:
"""A class representing a user on Hacker News."""
def __init__(self, username):
"""Constructor for the user class."""
<|body_0|>
def refreshKarma(self):
"""Gets the karma count of a user from the source of their 'user' page."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_029960 | 45,709 | no_license | [
{
"docstring": "Constructor for the user class.",
"name": "__init__",
"signature": "def __init__(self, username)"
},
{
"docstring": "Gets the karma count of a user from the source of their 'user' page.",
"name": "refreshKarma",
"signature": "def refreshKarma(self)"
}
] | 2 | null | Implement the Python class `HackerNewsUser` described below.
Class description:
A class representing a user on Hacker News.
Method signatures and docstrings:
- def __init__(self, username): Constructor for the user class.
- def refreshKarma(self): Gets the karma count of a user from the source of their 'user' page. | Implement the Python class `HackerNewsUser` described below.
Class description:
A class representing a user on Hacker News.
Method signatures and docstrings:
- def __init__(self, username): Constructor for the user class.
- def refreshKarma(self): Gets the karma count of a user from the source of their 'user' page.
... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class HackerNewsUser:
"""A class representing a user on Hacker News."""
def __init__(self, username):
"""Constructor for the user class."""
<|body_0|>
def refreshKarma(self):
"""Gets the karma count of a user from the source of their 'user' page."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HackerNewsUser:
"""A class representing a user on Hacker News."""
def __init__(self, username):
"""Constructor for the user class."""
self.name = username
self.userPageURL = 'https://news.ycombinator.com/user?id=' + self.name
self.threadsPageURL = 'https://news.ycombinator... | the_stack_v2_python_sparse | repoData/socketubs-pyhn/allPythonContent.py | aCoffeeYin/pyreco | train | 0 |
967e522cddcdf970208656dbc00c05ecafcffdce | [
"self.dp = []\nfor i in xrange(len(matrix)):\n self.dp.append([0])\n for n in matrix[i]:\n self.dp[i].append(self.dp[i][-1] + n)",
"res = 0\nfor i in xrange(row1, row2 + 1):\n res += self.dp[i][col2 + 1] - self.dp[i][col1]\nreturn res"
] | <|body_start_0|>
self.dp = []
for i in xrange(len(matrix)):
self.dp.append([0])
for n in matrix[i]:
self.dp[i].append(self.dp[i][-1] + n)
<|end_body_0|>
<|body_start_1|>
res = 0
for i in xrange(row1, row2 + 1):
res += self.dp[i][col2 +... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_36k_train_029961 | 1,712 | no_license | [
{
"docstring": "initialize your data structure here. :type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp... | 2 | stack_v2_sparse_classes_30k_train_011557 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | b4da922c4e8406c486760639b71e3ec50283ca43 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
self.dp = []
for i in xrange(len(matrix)):
self.dp.append([0])
for n in matrix[i]:
self.dp[i].append(self.dp[i][-1] + n)
def sumR... | the_stack_v2_python_sparse | old_session/session_1/_304/_304_range_sum_query_2D.py | YJL33/LeetCode | train | 3 | |
71e3d0c8d8f005f7e20bd56419bd3cedd0ea05e0 | [
"self.pool_name = pool_name\nself.subnet = subnet\nself.use_smart_connect = use_smart_connect",
"if dictionary is None:\n return None\npool_name = dictionary.get('poolName')\nsubnet = dictionary.get('subnet')\nuse_smart_connect = dictionary.get('useSmartConnect')\nreturn cls(pool_name, subnet, use_smart_connec... | <|body_start_0|>
self.pool_name = pool_name
self.subnet = subnet
self.use_smart_connect = use_smart_connect
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
pool_name = dictionary.get('poolName')
subnet = dictionary.get('subnet')
use... | Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name of the subnet the network pool belongs to. us... | NetworkPoolConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetworkPoolConfig:
"""Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name ... | stack_v2_sparse_classes_36k_train_029962 | 2,126 | permissive | [
{
"docstring": "Constructor for the NetworkPoolConfig class",
"name": "__init__",
"signature": "def __init__(self, pool_name=None, subnet=None, use_smart_connect=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representati... | 2 | stack_v2_sparse_classes_30k_train_010500 | Implement the Python class `NetworkPoolConfig` described below.
Class description:
Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network poo... | Implement the Python class `NetworkPoolConfig` described below.
Class description:
Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network poo... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NetworkPoolConfig:
"""Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NetworkPoolConfig:
"""Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name of the subnet... | the_stack_v2_python_sparse | cohesity_management_sdk/models/network_pool_config.py | cohesity/management-sdk-python | train | 24 |
b2879c600ab105783e91d71c04aef7231f75b07c | [
"try:\n score1 = self.pong_segment_score(trajectory_segment1)\n score2 = self.pong_segment_score(trajectory_segment2)\n if None in [score1, score2]:\n raise\nexcept:\n return 'n/a'\nif abs(score1 - score2) < 2:\n return '1=2'\nif score1 > score2:\n return '1>2'\nif score1 < score2:\n ret... | <|body_start_0|>
try:
score1 = self.pong_segment_score(trajectory_segment1)
score2 = self.pong_segment_score(trajectory_segment2)
if None in [score1, score2]:
raise
except:
return 'n/a'
if abs(score1 - score2) < 2:
retur... | does automated comparisons between trajectory segments of a pong game. | Human | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Human:
"""does automated comparisons between trajectory segments of a pong game."""
def judge_pong_segments(self, trajectory_segment1, trajectory_segment2):
"""given two trajectory_segments (a list of Pong-Atari2600 observations), judges which is better based on a simple rule defined... | stack_v2_sparse_classes_36k_train_029963 | 1,932 | no_license | [
{
"docstring": "given two trajectory_segments (a list of Pong-Atari2600 observations), judges which is better based on a simple rule defined in self.pong_segment_score()",
"name": "judge_pong_segments",
"signature": "def judge_pong_segments(self, trajectory_segment1, trajectory_segment2)"
},
{
"... | 2 | stack_v2_sparse_classes_30k_train_007387 | Implement the Python class `Human` described below.
Class description:
does automated comparisons between trajectory segments of a pong game.
Method signatures and docstrings:
- def judge_pong_segments(self, trajectory_segment1, trajectory_segment2): given two trajectory_segments (a list of Pong-Atari2600 observation... | Implement the Python class `Human` described below.
Class description:
does automated comparisons between trajectory segments of a pong game.
Method signatures and docstrings:
- def judge_pong_segments(self, trajectory_segment1, trajectory_segment2): given two trajectory_segments (a list of Pong-Atari2600 observation... | 4758f2f5bcf2e5f92bed5d0ed5f996b887cdbf82 | <|skeleton|>
class Human:
"""does automated comparisons between trajectory segments of a pong game."""
def judge_pong_segments(self, trajectory_segment1, trajectory_segment2):
"""given two trajectory_segments (a list of Pong-Atari2600 observations), judges which is better based on a simple rule defined... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Human:
"""does automated comparisons between trajectory segments of a pong game."""
def judge_pong_segments(self, trajectory_segment1, trajectory_segment2):
"""given two trajectory_segments (a list of Pong-Atari2600 observations), judges which is better based on a simple rule defined in self.pong... | the_stack_v2_python_sparse | human_simulator.py | emc031/AISafety_GroupProject | train | 0 |
c934bd7d138f20028253bfccbbaa108b5109ef05 | [
"mod = 10 ** 9 + 7\nm, n = (len(grid), len(grid[0]))\ndpmin = [[1] * n for _ in range(m)]\ndpmax = [[1] * n for _ in range(m)]\ndpmin[0][0] = grid[0][0]\ndpmax[0][0] = grid[0][0]\nfor i in range(1, m):\n dpmin[i][0] = dpmin[i - 1][0] * grid[i][0]\n dpmax[i][0] = dpmax[i - 1][0] * grid[i][0]\nfor j in range(1,... | <|body_start_0|>
mod = 10 ** 9 + 7
m, n = (len(grid), len(grid[0]))
dpmin = [[1] * n for _ in range(m)]
dpmax = [[1] * n for _ in range(m)]
dpmin[0][0] = grid[0][0]
dpmax[0][0] = grid[0][0]
for i in range(1, m):
dpmin[i][0] = dpmin[i - 1][0] * grid[i][... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProductPath1(self, grid: List[List[int]]) -> int:
"""思路:动态规划法 1. 求乘法最大值,可能出现负数乘上负数变为正数,所以需要同时记录当前的正数最大值和最小值 @param grid: @return:"""
<|body_0|>
def maxProductPath2(self, grid: List[List[int]]) -> int:
"""思路:dfs超时 @param grid: @return:"""
<|bo... | stack_v2_sparse_classes_36k_train_029964 | 3,861 | no_license | [
{
"docstring": "思路:动态规划法 1. 求乘法最大值,可能出现负数乘上负数变为正数,所以需要同时记录当前的正数最大值和最小值 @param grid: @return:",
"name": "maxProductPath1",
"signature": "def maxProductPath1(self, grid: List[List[int]]) -> int"
},
{
"docstring": "思路:dfs超时 @param grid: @return:",
"name": "maxProductPath2",
"signature": "de... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProductPath1(self, grid: List[List[int]]) -> int: 思路:动态规划法 1. 求乘法最大值,可能出现负数乘上负数变为正数,所以需要同时记录当前的正数最大值和最小值 @param grid: @return:
- def maxProductPath2(self, grid: List[List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProductPath1(self, grid: List[List[int]]) -> int: 思路:动态规划法 1. 求乘法最大值,可能出现负数乘上负数变为正数,所以需要同时记录当前的正数最大值和最小值 @param grid: @return:
- def maxProductPath2(self, grid: List[List[... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def maxProductPath1(self, grid: List[List[int]]) -> int:
"""思路:动态规划法 1. 求乘法最大值,可能出现负数乘上负数变为正数,所以需要同时记录当前的正数最大值和最小值 @param grid: @return:"""
<|body_0|>
def maxProductPath2(self, grid: List[List[int]]) -> int:
"""思路:dfs超时 @param grid: @return:"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProductPath1(self, grid: List[List[int]]) -> int:
"""思路:动态规划法 1. 求乘法最大值,可能出现负数乘上负数变为正数,所以需要同时记录当前的正数最大值和最小值 @param grid: @return:"""
mod = 10 ** 9 + 7
m, n = (len(grid), len(grid[0]))
dpmin = [[1] * n for _ in range(m)]
dpmax = [[1] * n for _ in range(m... | the_stack_v2_python_sparse | LeetCode/动态规划法(dp)/5521. 矩阵的最大非负积.py | yiming1012/MyLeetCode | train | 2 | |
6663752f62680241550ae676a8b2a1fbe323a31e | [
"self.coverage = coverage\nself.config = config\nself.file_reporters = []\nself.directory = None",
"reporters = self.coverage._get_file_reporters(morfs)\nif self.config.include:\n matcher = FnmatchMatcher(prep_patterns(self.config.include))\n reporters = [fr for fr in reporters if matcher.match(fr.filename)... | <|body_start_0|>
self.coverage = coverage
self.config = config
self.file_reporters = []
self.directory = None
<|end_body_0|>
<|body_start_1|>
reporters = self.coverage._get_file_reporters(morfs)
if self.config.include:
matcher = FnmatchMatcher(prep_patterns(s... | A base class for all reporters. | Reporter | [
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reporter:
"""A base class for all reporters."""
def __init__(self, coverage, config):
"""Create a reporter. `coverage` is the coverage instance. `config` is an instance of CoverageConfig, for controlling all sorts of behavior."""
<|body_0|>
def find_file_reporters(self, ... | stack_v2_sparse_classes_36k_train_029965 | 2,872 | permissive | [
{
"docstring": "Create a reporter. `coverage` is the coverage instance. `config` is an instance of CoverageConfig, for controlling all sorts of behavior.",
"name": "__init__",
"signature": "def __init__(self, coverage, config)"
},
{
"docstring": "Find the FileReporters we'll report on. `morfs` i... | 3 | null | Implement the Python class `Reporter` described below.
Class description:
A base class for all reporters.
Method signatures and docstrings:
- def __init__(self, coverage, config): Create a reporter. `coverage` is the coverage instance. `config` is an instance of CoverageConfig, for controlling all sorts of behavior.
... | Implement the Python class `Reporter` described below.
Class description:
A base class for all reporters.
Method signatures and docstrings:
- def __init__(self, coverage, config): Create a reporter. `coverage` is the coverage instance. `config` is an instance of CoverageConfig, for controlling all sorts of behavior.
... | 53102de187a48ac2cfc241fef54dcbc29c453a8e | <|skeleton|>
class Reporter:
"""A base class for all reporters."""
def __init__(self, coverage, config):
"""Create a reporter. `coverage` is the coverage instance. `config` is an instance of CoverageConfig, for controlling all sorts of behavior."""
<|body_0|>
def find_file_reporters(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Reporter:
"""A base class for all reporters."""
def __init__(self, coverage, config):
"""Create a reporter. `coverage` is the coverage instance. `config` is an instance of CoverageConfig, for controlling all sorts of behavior."""
self.coverage = coverage
self.config = config
... | the_stack_v2_python_sparse | third_party/coverage/coverage/report.py | catapult-project/catapult | train | 2,032 |
e2f8c8789b650ce4ac31e9cbcd814935457be016 | [
"super().__init__(algo_class=algo_class or AlphaStar)\nself.replay_buffer_capacity = 20\nself.replay_buffer_replay_ratio = 0.5\nself.max_requests_in_flight_per_sampler_worker = 2\nself.max_requests_in_flight_per_learner_worker = 2\nself.timeout_s_sampler_manager = 0.0\nself.timeout_s_learner_manager = 0.0\nself.lea... | <|body_start_0|>
super().__init__(algo_class=algo_class or AlphaStar)
self.replay_buffer_capacity = 20
self.replay_buffer_replay_ratio = 0.5
self.max_requests_in_flight_per_sampler_worker = 2
self.max_requests_in_flight_per_learner_worker = 2
self.timeout_s_sampler_manage... | Defines a configuration class from which an AlphaStar Algorithm can be built. Example: >>> from ray.rllib.algorithms.alpha_star import AlphaStarConfig >>> config = AlphaStarConfig().training(lr=0.0003, train_batch_size=512) ... .resources(num_gpus=4) ... .rollouts(num_rollout_workers=64) >>> print(config.to_dict()) # d... | AlphaStarConfig | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlphaStarConfig:
"""Defines a configuration class from which an AlphaStar Algorithm can be built. Example: >>> from ray.rllib.algorithms.alpha_star import AlphaStarConfig >>> config = AlphaStarConfig().training(lr=0.0003, train_batch_size=512) ... .resources(num_gpus=4) ... .rollouts(num_rollout_... | stack_v2_sparse_classes_36k_train_029966 | 27,779 | permissive | [
{
"docstring": "Initializes a AlphaStarConfig instance.",
"name": "__init__",
"signature": "def __init__(self, algo_class=None)"
},
{
"docstring": "Sets the training related configuration. Args: replay_buffer_capacity: This is num batches held at any time for each policy. replay_buffer_replay_ra... | 2 | null | Implement the Python class `AlphaStarConfig` described below.
Class description:
Defines a configuration class from which an AlphaStar Algorithm can be built. Example: >>> from ray.rllib.algorithms.alpha_star import AlphaStarConfig >>> config = AlphaStarConfig().training(lr=0.0003, train_batch_size=512) ... .resources... | Implement the Python class `AlphaStarConfig` described below.
Class description:
Defines a configuration class from which an AlphaStar Algorithm can be built. Example: >>> from ray.rllib.algorithms.alpha_star import AlphaStarConfig >>> config = AlphaStarConfig().training(lr=0.0003, train_batch_size=512) ... .resources... | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | <|skeleton|>
class AlphaStarConfig:
"""Defines a configuration class from which an AlphaStar Algorithm can be built. Example: >>> from ray.rllib.algorithms.alpha_star import AlphaStarConfig >>> config = AlphaStarConfig().training(lr=0.0003, train_batch_size=512) ... .resources(num_gpus=4) ... .rollouts(num_rollout_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlphaStarConfig:
"""Defines a configuration class from which an AlphaStar Algorithm can be built. Example: >>> from ray.rllib.algorithms.alpha_star import AlphaStarConfig >>> config = AlphaStarConfig().training(lr=0.0003, train_batch_size=512) ... .resources(num_gpus=4) ... .rollouts(num_rollout_workers=64) >... | the_stack_v2_python_sparse | rllib/algorithms/alpha_star/alpha_star.py | ray-project/ray | train | 29,482 |
f9459571eb87e957df89eb1796c9a42d77506896 | [
"base.Layer.__init__(self, **kwargs)\nself._num_output = self.spec.get('num_output', 0)\nif self._num_output <= 0:\n raise base.InvalidLayerError('Incorrect or unspecified num_output for %s' % self.name)\nself._reg = self.spec.get('reg', None)\nself._filler = self.spec.get('filler', None)\nself._weight = base.Bl... | <|body_start_0|>
base.Layer.__init__(self, **kwargs)
self._num_output = self.spec.get('num_output', 0)
if self._num_output <= 0:
raise base.InvalidLayerError('Incorrect or unspecified num_output for %s' % self.name)
self._reg = self.spec.get('reg', None)
self._filler ... | A layer that implements the inner product. | InnerProductLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InnerProductLayer:
"""A layer that implements the inner product."""
def __init__(self, **kwargs):
"""Initializes an inner product layer. kwargs: num_output: the number of outputs. reg: the regularizer to be used to add regularization terms. should be a decaf.base.Regularizer instance... | stack_v2_sparse_classes_36k_train_029967 | 3,377 | no_license | [
{
"docstring": "Initializes an inner product layer. kwargs: num_output: the number of outputs. reg: the regularizer to be used to add regularization terms. should be a decaf.base.Regularizer instance. Default None. filler: a filler to initialize the weights. Should be a decaf.base.Filler instance. Default None.... | 4 | stack_v2_sparse_classes_30k_train_006874 | Implement the Python class `InnerProductLayer` described below.
Class description:
A layer that implements the inner product.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes an inner product layer. kwargs: num_output: the number of outputs. reg: the regularizer to be used to add regulari... | Implement the Python class `InnerProductLayer` described below.
Class description:
A layer that implements the inner product.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initializes an inner product layer. kwargs: num_output: the number of outputs. reg: the regularizer to be used to add regulari... | 6fa4cdfbd0d0b8d486d7146bf1e32edd3662fec4 | <|skeleton|>
class InnerProductLayer:
"""A layer that implements the inner product."""
def __init__(self, **kwargs):
"""Initializes an inner product layer. kwargs: num_output: the number of outputs. reg: the regularizer to be used to add regularization terms. should be a decaf.base.Regularizer instance... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InnerProductLayer:
"""A layer that implements the inner product."""
def __init__(self, **kwargs):
"""Initializes an inner product layer. kwargs: num_output: the number of outputs. reg: the regularizer to be used to add regularization terms. should be a decaf.base.Regularizer instance. Default Non... | the_stack_v2_python_sparse | decaf/layers/innerproduct.py | UCBAIR/decaf-release | train | 62 |
65c6dbc2cb47fb1a241b755383d29e710bb82586 | [
"g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US09', 'US09_Birth_After_Death_Mom_Bad.ged')])\ncapturedOutput = io.StringIO()\nsys.stdout = capturedOutput\ng.check_bday()\nsys.stdout = sys.__stdout__\noutput_str1 = 'US09 - Jimmy /John_3/ birthday after mom death date on line 21\\n'\nself.assertEqual(ca... | <|body_start_0|>
g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US09', 'US09_Birth_After_Death_Mom_Bad.ged')])
capturedOutput = io.StringIO()
sys.stdout = capturedOutput
g.check_bday()
sys.stdout = sys.__stdout__
output_str1 = 'US09 - Jimmy /John_3/ birthday a... | Tests that the check_bday function throws when expected. | Test_US09 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_US09:
"""Tests that the check_bday function throws when expected."""
def test_check_bday1(self):
"""Tests that check_bday rejects illegitimate birthdays by throwing a ValueError."""
<|body_0|>
def test_check_bday2(self):
"""Tests that check_bday rejects ille... | stack_v2_sparse_classes_36k_train_029968 | 2,578 | no_license | [
{
"docstring": "Tests that check_bday rejects illegitimate birthdays by throwing a ValueError.",
"name": "test_check_bday1",
"signature": "def test_check_bday1(self)"
},
{
"docstring": "Tests that check_bday rejects illegitimate birthdays by throwing a ValueError.",
"name": "test_check_bday2... | 4 | null | Implement the Python class `Test_US09` described below.
Class description:
Tests that the check_bday function throws when expected.
Method signatures and docstrings:
- def test_check_bday1(self): Tests that check_bday rejects illegitimate birthdays by throwing a ValueError.
- def test_check_bday2(self): Tests that ch... | Implement the Python class `Test_US09` described below.
Class description:
Tests that the check_bday function throws when expected.
Method signatures and docstrings:
- def test_check_bday1(self): Tests that check_bday rejects illegitimate birthdays by throwing a ValueError.
- def test_check_bday2(self): Tests that ch... | ccfc3b5e11a48a93c53ff745cb254c4c79fab95f | <|skeleton|>
class Test_US09:
"""Tests that the check_bday function throws when expected."""
def test_check_bday1(self):
"""Tests that check_bday rejects illegitimate birthdays by throwing a ValueError."""
<|body_0|>
def test_check_bday2(self):
"""Tests that check_bday rejects ille... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_US09:
"""Tests that the check_bday function throws when expected."""
def test_check_bday1(self):
"""Tests that check_bday rejects illegitimate birthdays by throwing a ValueError."""
g = GED_Repo([os.path.join(os.getcwd(), 'test_directory', 'US09', 'US09_Birth_After_Death_Mom_Bad.ged'... | the_stack_v2_python_sparse | test_directory/US09/US09_Test.py | AkshayLavhagale/SSW555A_GEDCOM_analyzer | train | 0 |
1587f0ace4c8fc36607ed087de103ec764c7412c | [
"super().__init__(config, {'object_masks'})\nself.save_memory()\nself.fc_projector_lang = nn.Sequential(nn.Linear(512, 128), nn.ReLU(), nn.Linear(128, 128))\nself.fc_projector_spatial = nn.Sequential(nn.Linear(256, 128), nn.ReLU(), nn.Linear(128, 128))",
"embeddings = torch.cat((self.fc_subject(subj_embs), self.f... | <|body_start_0|>
super().__init__(config, {'object_masks'})
self.save_memory()
self.fc_projector_lang = nn.Sequential(nn.Linear(512, 128), nn.ReLU(), nn.Linear(128, 128))
self.fc_projector_spatial = nn.Sequential(nn.Linear(256, 128), nn.ReLU(), nn.Linear(128, 128))
<|end_body_0|>
<|body... | Extends PyTorch nn.Module. | LangSpatProjector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LangSpatProjector:
"""Extends PyTorch nn.Module."""
def __init__(self, config):
"""Initialize layers."""
<|body_0|>
def _forward(self, subj_embs, obj_embs, deltas, subj_masks, obj_masks):
"""Forward pass, returns output scores."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_029969 | 1,982 | no_license | [
{
"docstring": "Initialize layers.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Forward pass, returns output scores.",
"name": "_forward",
"signature": "def _forward(self, subj_embs, obj_embs, deltas, subj_masks, obj_masks)"
}
] | 2 | null | Implement the Python class `LangSpatProjector` described below.
Class description:
Extends PyTorch nn.Module.
Method signatures and docstrings:
- def __init__(self, config): Initialize layers.
- def _forward(self, subj_embs, obj_embs, deltas, subj_masks, obj_masks): Forward pass, returns output scores. | Implement the Python class `LangSpatProjector` described below.
Class description:
Extends PyTorch nn.Module.
Method signatures and docstrings:
- def __init__(self, config): Initialize layers.
- def _forward(self, subj_embs, obj_embs, deltas, subj_masks, obj_masks): Forward pass, returns output scores.
<|skeleton|>
... | 810c79541a8584de3fe37943d244af366d361689 | <|skeleton|>
class LangSpatProjector:
"""Extends PyTorch nn.Module."""
def __init__(self, config):
"""Initialize layers."""
<|body_0|>
def _forward(self, subj_embs, obj_embs, deltas, subj_masks, obj_masks):
"""Forward pass, returns output scores."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LangSpatProjector:
"""Extends PyTorch nn.Module."""
def __init__(self, config):
"""Initialize layers."""
super().__init__(config, {'object_masks'})
self.save_memory()
self.fc_projector_lang = nn.Sequential(nn.Linear(512, 128), nn.ReLU(), nn.Linear(128, 128))
self.f... | the_stack_v2_python_sparse | common/models/sg_projector/lang_spat_projector.py | bgzu/zs-vrd-bmvc20 | train | 0 |
c013b7c228da4be298afd12062704f6fe54e4fee | [
"tle = leop_utils.create_object_tle(object_id, callsign, tle_l1, tle_l2)\nsc = leop_utils.create_object_spacecraft(admin, launch_id, object_id, callsign, tle.identifier)\nreturn super(IdentifiedObjectsManager, self).create(identifier=object_id, spacecraft=sc, **kwargs)",
"ufo = self.get(identifier=object_id)\nif ... | <|body_start_0|>
tle = leop_utils.create_object_tle(object_id, callsign, tle_l1, tle_l2)
sc = leop_utils.create_object_spacecraft(admin, launch_id, object_id, callsign, tle.identifier)
return super(IdentifiedObjectsManager, self).create(identifier=object_id, spacecraft=sc, **kwargs)
<|end_body_0... | LEOP database manager Manages the common opererations with the underlaying IdentifyObjects. | IdentifiedObjectsManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentifiedObjectsManager:
"""LEOP database manager Manages the common opererations with the underlaying IdentifyObjects."""
def create(self, admin, launch_id, object_id, callsign, tle_l1, tle_l2, **kwargs):
"""Manager method Convenience method for creating a new identified object. :p... | stack_v2_sparse_classes_36k_train_029970 | 4,797 | permissive | [
{
"docstring": "Manager method Convenience method for creating a new identified object. :param admin: Administrator of the cluster :param launch_id: Identifier of the launch :param object_id: Identifier for the identified object :param callsign: Callsign for the identified object :param tle_l1: First line of th... | 3 | stack_v2_sparse_classes_30k_train_019009 | Implement the Python class `IdentifiedObjectsManager` described below.
Class description:
LEOP database manager Manages the common opererations with the underlaying IdentifyObjects.
Method signatures and docstrings:
- def create(self, admin, launch_id, object_id, callsign, tle_l1, tle_l2, **kwargs): Manager method Co... | Implement the Python class `IdentifiedObjectsManager` described below.
Class description:
LEOP database manager Manages the common opererations with the underlaying IdentifyObjects.
Method signatures and docstrings:
- def create(self, admin, launch_id, object_id, callsign, tle_l1, tle_l2, **kwargs): Manager method Co... | 3bb15f4d4dcd543d6f95d1fda2cb737de0bb9a9b | <|skeleton|>
class IdentifiedObjectsManager:
"""LEOP database manager Manages the common opererations with the underlaying IdentifyObjects."""
def create(self, admin, launch_id, object_id, callsign, tle_l1, tle_l2, **kwargs):
"""Manager method Convenience method for creating a new identified object. :p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdentifiedObjectsManager:
"""LEOP database manager Manages the common opererations with the underlaying IdentifyObjects."""
def create(self, admin, launch_id, object_id, callsign, tle_l1, tle_l2, **kwargs):
"""Manager method Convenience method for creating a new identified object. :param admin: A... | the_stack_v2_python_sparse | services/leop/models/ufos.py | satnet-project/server | train | 4 |
8ce3b2fbb084bc6f71691afb43803d49e56379cf | [
"group_id = request.GET['id']\nimages = []\nfor image in mall_models.Image.objects.filter(group_id=group_id):\n images.append({'id': image.id, 'src': image.url, 'width': image.width, 'height': image.height})\nresponse = create_response(200)\nresponse.data = images\nreturn response.get_response()",
"name = requ... | <|body_start_0|>
group_id = request.GET['id']
images = []
for image in mall_models.Image.objects.filter(group_id=group_id):
images.append({'id': image.id, 'src': image.url, 'width': image.width, 'height': image.height})
response = create_response(200)
response.data = ... | ImageGroup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageGroup:
def api_get(request):
"""获取图片分组中的图片集合 Args: id: 图片分组id Return json: data(list): [{ "id": 1, "src": "http://upyun.com/a/1.jpg", "width": "100", "height": "100, }, { "id": 2, "src": "http://upyun.com/a/2.jpg", "width": "100", "height": "100, }, { ...... }]"""
<|body_0|>... | stack_v2_sparse_classes_36k_train_029971 | 5,963 | no_license | [
{
"docstring": "获取图片分组中的图片集合 Args: id: 图片分组id Return json: data(list): [{ \"id\": 1, \"src\": \"http://upyun.com/a/1.jpg\", \"width\": \"100\", \"height\": \"100, }, { \"id\": 2, \"src\": \"http://upyun.com/a/2.jpg\", \"width\": \"100\", \"height\": \"100, }, { ...... }]",
"name": "api_get",
"signature"... | 4 | null | Implement the Python class `ImageGroup` described below.
Class description:
Implement the ImageGroup class.
Method signatures and docstrings:
- def api_get(request): 获取图片分组中的图片集合 Args: id: 图片分组id Return json: data(list): [{ "id": 1, "src": "http://upyun.com/a/1.jpg", "width": "100", "height": "100, }, { "id": 2, "src... | Implement the Python class `ImageGroup` described below.
Class description:
Implement the ImageGroup class.
Method signatures and docstrings:
- def api_get(request): 获取图片分组中的图片集合 Args: id: 图片分组id Return json: data(list): [{ "id": 1, "src": "http://upyun.com/a/1.jpg", "width": "100", "height": "100, }, { "id": 2, "src... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class ImageGroup:
def api_get(request):
"""获取图片分组中的图片集合 Args: id: 图片分组id Return json: data(list): [{ "id": 1, "src": "http://upyun.com/a/1.jpg", "width": "100", "height": "100, }, { "id": 2, "src": "http://upyun.com/a/2.jpg", "width": "100", "height": "100, }, { ...... }]"""
<|body_0|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageGroup:
def api_get(request):
"""获取图片分组中的图片集合 Args: id: 图片分组id Return json: data(list): [{ "id": 1, "src": "http://upyun.com/a/1.jpg", "width": "100", "height": "100, }, { "id": 2, "src": "http://upyun.com/a/2.jpg", "width": "100", "height": "100, }, { ...... }]"""
group_id = request.GET['... | the_stack_v2_python_sparse | weapp/mall/product/image_group.py | chengdg/weizoom | train | 1 | |
641f85d7dd52738d08b90edd66689f7e5db3d0f9 | [
"n = int(''.join([str(i) for i in digits]))\nn += 1\nreturn [int(i) for i in str(n)]",
"p = len(digits) - 1\nup = 1\nwhile p >= 0 and up > 0:\n digits[p] += up\n up = digits[p] // 10\n digits[p] %= 10\n p -= 1\nif up:\n digits.insert(0, up)\nreturn digits"
] | <|body_start_0|>
n = int(''.join([str(i) for i in digits]))
n += 1
return [int(i) for i in str(n)]
<|end_body_0|>
<|body_start_1|>
p = len(digits) - 1
up = 1
while p >= 0 and up > 0:
digits[p] += up
up = digits[p] // 10
digits[p] %= 10... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def plusOne(self, digits: list):
""":type digits: List[int] :rtype: List[int]"""
<|body_0|>
def plusOneB(self, digits: list):
""":type digits: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = int(''.join([str... | stack_v2_sparse_classes_36k_train_029972 | 1,074 | no_license | [
{
"docstring": ":type digits: List[int] :rtype: List[int]",
"name": "plusOne",
"signature": "def plusOne(self, digits: list)"
},
{
"docstring": ":type digits: List[int] :rtype: List[int]",
"name": "plusOneB",
"signature": "def plusOneB(self, digits: list)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def plusOne(self, digits: list): :type digits: List[int] :rtype: List[int]
- def plusOneB(self, digits: list): :type digits: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def plusOne(self, digits: list): :type digits: List[int] :rtype: List[int]
- def plusOneB(self, digits: list): :type digits: List[int] :rtype: List[int]
<|skeleton|>
class Solut... | 387074588c50973b6fb8645f859ae9ca29b4df4c | <|skeleton|>
class Solution:
def plusOne(self, digits: list):
""":type digits: List[int] :rtype: List[int]"""
<|body_0|>
def plusOneB(self, digits: list):
""":type digits: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def plusOne(self, digits: list):
""":type digits: List[int] :rtype: List[int]"""
n = int(''.join([str(i) for i in digits]))
n += 1
return [int(i) for i in str(n)]
def plusOneB(self, digits: list):
""":type digits: List[int] :rtype: List[int]"""
p ... | the_stack_v2_python_sparse | Coding/Algorithm/Code/LeetCodeCn/Primary/007.py | bovenson/notes | train | 8 | |
6096e372e76eb63a4164831121e2e16d888753a9 | [
"if len(s) <= 1:\n return s\nmax_length = 0\nmax_pos = 0\nfor pos in range(0, len(s) - 1):\n odd_pos, odd_length = self._center_palindrome(s, pos, pos)\n even_pos, even_length = self._center_palindrome(s, pos, pos + 1)\n if even_length > max_length:\n max_length = even_length\n max_pos = e... | <|body_start_0|>
if len(s) <= 1:
return s
max_length = 0
max_pos = 0
for pos in range(0, len(s) - 1):
odd_pos, odd_length = self._center_palindrome(s, pos, pos)
even_pos, even_length = self._center_palindrome(s, pos, pos + 1)
if even_length... | Center_Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Center_Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def _center_palindrome(self, s, i, j):
"""从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) <= 1:
return s
... | stack_v2_sparse_classes_36k_train_029973 | 1,359 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "longestPalindrome",
"signature": "def longestPalindrome(self, s)"
},
{
"docstring": "从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度",
"name": "_center_palindrome",
"signature": "def _center_palindrome(self, s, i, j)"
}
] | 2 | null | Implement the Python class `Center_Solution` described below.
Class description:
Implement the Center_Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): :type s: str :rtype: str
- def _center_palindrome(self, s, i, j): 从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度 | Implement the Python class `Center_Solution` described below.
Class description:
Implement the Center_Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): :type s: str :rtype: str
- def _center_palindrome(self, s, i, j): 从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度
<|skeleton|>
class Center_Solution:
... | 14a56b5eca8d292c823a028b196fe0c780a57e10 | <|skeleton|>
class Center_Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def _center_palindrome(self, s, i, j):
"""从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Center_Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
if len(s) <= 1:
return s
max_length = 0
max_pos = 0
for pos in range(0, len(s) - 1):
odd_pos, odd_length = self._center_palindrome(s, pos, pos)
even_pos, ... | the_stack_v2_python_sparse | dynamic_program/q5_longestPalindrome/center_solution.py | ttomchy/LeetCodeInAction | train | 0 | |
236e095119e026f3d122a24d26c154997b812528 | [
"super(Atom_Wise_Convolution, self).__init__()\nself.conv_weights = nn.Linear(input_feature, output_feature)\nself.batch_norm = nn.LayerNorm(output_feature)\nself.UseBN = UseBN\nself.activation = Shifted_softplus()\nself.dropout = nn.Dropout(p=dropout)",
"node_feats = self.conv_weights(node_feats)\nif self.UseBN:... | <|body_start_0|>
super(Atom_Wise_Convolution, self).__init__()
self.conv_weights = nn.Linear(input_feature, output_feature)
self.batch_norm = nn.LayerNorm(output_feature)
self.UseBN = UseBN
self.activation = Shifted_softplus()
self.dropout = nn.Dropout(p=dropout)
<|end_bo... | Performs self convolution to each node | Atom_Wise_Convolution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Atom_Wise_Convolution:
"""Performs self convolution to each node"""
def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True):
"""Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature siz... | stack_v2_sparse_classes_36k_train_029974 | 18,579 | permissive | [
{
"docstring": "Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature size dropout: float, defult 0.2 p value for dropout between 0.0 to 1.0 UseBN: bool Setting it to True will perform Batch Normalisation",
"name": "__init__",
"signature": "def __... | 2 | stack_v2_sparse_classes_30k_train_021267 | Implement the Python class `Atom_Wise_Convolution` described below.
Class description:
Performs self convolution to each node
Method signatures and docstrings:
- def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): Parameters ---------- input_feature: int Size of input fe... | Implement the Python class `Atom_Wise_Convolution` described below.
Class description:
Performs self convolution to each node
Method signatures and docstrings:
- def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): Parameters ---------- input_feature: int Size of input fe... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class Atom_Wise_Convolution:
"""Performs self convolution to each node"""
def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True):
"""Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature siz... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Atom_Wise_Convolution:
"""Performs self convolution to each node"""
def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True):
"""Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature size dropout: fl... | the_stack_v2_python_sparse | deepchem/models/torch_models/lcnn.py | deepchem/deepchem | train | 4,876 |
3fa1f2f35d28d427665ab3d1fb968fa667084618 | [
"self.write_dict = {}\nif logdir:\n self.logdir = logdir\nelse:\n self.logdir = './visual_log'",
"logging.debug('{phase} log: steps {steps}, metrics: {metrics}'.format(phase=tag, steps=steps, metrics=metrics_output))\ntry:\n if metrics_output and len(metrics_output) != 0:\n for key, value in metri... | <|body_start_0|>
self.write_dict = {}
if logdir:
self.logdir = logdir
else:
self.logdir = './visual_log'
<|end_body_0|>
<|body_start_1|>
logging.debug('{phase} log: steps {steps}, metrics: {metrics}'.format(phase=tag, steps=steps, metrics=metrics_output))
... | VisualManager | VisualManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VisualManager:
"""VisualManager"""
def __init__(self, logdir=None):
"""init"""
<|body_0|>
def show_metric(self, metrics_output, steps, tag):
"""评估指标展示 :param metrics_output: 需要展示的指标,按dict方式存储 :param steps: :param tag: :return:"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_029975 | 1,805 | permissive | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self, logdir=None)"
},
{
"docstring": "评估指标展示 :param metrics_output: 需要展示的指标,按dict方式存储 :param steps: :param tag: :return:",
"name": "show_metric",
"signature": "def show_metric(self, metrics_output, steps, tag)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003721 | Implement the Python class `VisualManager` described below.
Class description:
VisualManager
Method signatures and docstrings:
- def __init__(self, logdir=None): init
- def show_metric(self, metrics_output, steps, tag): 评估指标展示 :param metrics_output: 需要展示的指标,按dict方式存储 :param steps: :param tag: :return: | Implement the Python class `VisualManager` described below.
Class description:
VisualManager
Method signatures and docstrings:
- def __init__(self, logdir=None): init
- def show_metric(self, metrics_output, steps, tag): 评估指标展示 :param metrics_output: 需要展示的指标,按dict方式存储 :param steps: :param tag: :return:
<|skeleton|>
c... | 610f759a8488c94134bf77cff30fa1190e8df414 | <|skeleton|>
class VisualManager:
"""VisualManager"""
def __init__(self, logdir=None):
"""init"""
<|body_0|>
def show_metric(self, metrics_output, steps, tag):
"""评估指标展示 :param metrics_output: 需要展示的指标,按dict方式存储 :param steps: :param tag: :return:"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VisualManager:
"""VisualManager"""
def __init__(self, logdir=None):
"""init"""
self.write_dict = {}
if logdir:
self.logdir = logdir
else:
self.logdir = './visual_log'
def show_metric(self, metrics_output, steps, tag):
"""评估指标展示 :param m... | the_stack_v2_python_sparse | erniekit/utils/visual_manager.py | Kennycao123/ERNIE | train | 0 |
d6b0951d56090710b977a15731c4a71573c82f0d | [
"if result is None:\n return {'code': code, 'error': error}\nelse:\n return {'code': code, 'error': error, 'result': result}",
"if api_code is None:\n return {'code': code, 'error': error, 'api_response': api_response}\nelse:\n return {'code': code, 'error': error, 'api_code': api_code, 'api_error': a... | <|body_start_0|>
if result is None:
return {'code': code, 'error': error}
else:
return {'code': code, 'error': error, 'result': result}
<|end_body_0|>
<|body_start_1|>
if api_code is None:
return {'code': code, 'error': error, 'api_response': api_response}
... | HttpResponse | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HttpResponse:
def normal(code, error='', result=None):
"""通用的相应格式"""
<|body_0|>
def third_party(code, error='', api_code=None, api_error=None, api_response=None):
"""第三方API响应格式 Args: code: 0代表正常返回,消息合法。-1代表异常,超时、断开、拒绝 error: code -1 error 不空 api_code: api返回的错误码 api_e... | stack_v2_sparse_classes_36k_train_029976 | 5,683 | no_license | [
{
"docstring": "通用的相应格式",
"name": "normal",
"signature": "def normal(code, error='', result=None)"
},
{
"docstring": "第三方API响应格式 Args: code: 0代表正常返回,消息合法。-1代表异常,超时、断开、拒绝 error: code -1 error 不空 api_code: api返回的错误码 api_error: api返回的错误消息 api_response: api返回的原始消息",
"name": "third_party",
"s... | 2 | stack_v2_sparse_classes_30k_train_017682 | Implement the Python class `HttpResponse` described below.
Class description:
Implement the HttpResponse class.
Method signatures and docstrings:
- def normal(code, error='', result=None): 通用的相应格式
- def third_party(code, error='', api_code=None, api_error=None, api_response=None): 第三方API响应格式 Args: code: 0代表正常返回,消息合法。... | Implement the Python class `HttpResponse` described below.
Class description:
Implement the HttpResponse class.
Method signatures and docstrings:
- def normal(code, error='', result=None): 通用的相应格式
- def third_party(code, error='', api_code=None, api_error=None, api_response=None): 第三方API响应格式 Args: code: 0代表正常返回,消息合法。... | 59df7e469009aca346b292f63cf466fb58caa7d2 | <|skeleton|>
class HttpResponse:
def normal(code, error='', result=None):
"""通用的相应格式"""
<|body_0|>
def third_party(code, error='', api_code=None, api_error=None, api_response=None):
"""第三方API响应格式 Args: code: 0代表正常返回,消息合法。-1代表异常,超时、断开、拒绝 error: code -1 error 不空 api_code: api返回的错误码 api_e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HttpResponse:
def normal(code, error='', result=None):
"""通用的相应格式"""
if result is None:
return {'code': code, 'error': error}
else:
return {'code': code, 'error': error, 'result': result}
def third_party(code, error='', api_code=None, api_error=None, api_re... | the_stack_v2_python_sparse | src/app/common/utils/http_util.py | eckoq/gold-digger-server | train | 1 | |
2146a1e5aaf644e8787addbe31072513716d26d3 | [
"passwd = data['password']\npasswd_conf = data['password_confirmation']\nif passwd != passwd_conf:\n raise serializers.ValidationError(\"Passwords don't match.\")\npassword_validation.validate_password(passwd)\nreturn data",
"data.pop('password_confirmation')\nuser = User.objects.create_user(**data, is_verifie... | <|body_start_0|>
passwd = data['password']
passwd_conf = data['password_confirmation']
if passwd != passwd_conf:
raise serializers.ValidationError("Passwords don't match.")
password_validation.validate_password(passwd)
return data
<|end_body_0|>
<|body_start_1|>
... | User sign up serializer. Handle sign up data validation and user creation | UserSignUpModelSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSignUpModelSerializer:
"""User sign up serializer. Handle sign up data validation and user creation"""
def validate(self, data):
"""Verify passwords match."""
<|body_0|>
def create(self, data):
"""Handle user and profile creation."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_029977 | 4,226 | no_license | [
{
"docstring": "Verify passwords match.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Handle user and profile creation.",
"name": "create",
"signature": "def create(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007819 | Implement the Python class `UserSignUpModelSerializer` described below.
Class description:
User sign up serializer. Handle sign up data validation and user creation
Method signatures and docstrings:
- def validate(self, data): Verify passwords match.
- def create(self, data): Handle user and profile creation. | Implement the Python class `UserSignUpModelSerializer` described below.
Class description:
User sign up serializer. Handle sign up data validation and user creation
Method signatures and docstrings:
- def validate(self, data): Verify passwords match.
- def create(self, data): Handle user and profile creation.
<|skel... | 1cbe9094d528a5e9cefdb4cccaf8b836e185dd74 | <|skeleton|>
class UserSignUpModelSerializer:
"""User sign up serializer. Handle sign up data validation and user creation"""
def validate(self, data):
"""Verify passwords match."""
<|body_0|>
def create(self, data):
"""Handle user and profile creation."""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserSignUpModelSerializer:
"""User sign up serializer. Handle sign up data validation and user creation"""
def validate(self, data):
"""Verify passwords match."""
passwd = data['password']
passwd_conf = data['password_confirmation']
if passwd != passwd_conf:
ra... | the_stack_v2_python_sparse | cct_art_gallery_api/cctart/users/serializers/users.py | Panchop10/cct-art-gallery-backend | train | 0 |
03e4efd2d337ecf6a4e6418d1e51ff089c6d3a3c | [
"self._connected_callback = connected_callback\nself._update_callback = update_callback\nself._queries = {}\nsuper(Agent, self).__init__(wss, proxy)\nself.initialize()",
"if self._connected_callback:\n await asyncio.sleep(0.1)\n await self._connected_callback()",
"request_id = tools.get_uuid1()\ndata = {'... | <|body_start_0|>
self._connected_callback = connected_callback
self._update_callback = update_callback
self._queries = {}
super(Agent, self).__init__(wss, proxy)
self.initialize()
<|end_body_0|>
<|body_start_1|>
if self._connected_callback:
await asyncio.slee... | websocket长连接代理 | Agent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Agent:
"""websocket长连接代理"""
def __init__(self, wss, proxy=None, connected_callback=None, update_callback=None):
"""初始化 @param wss websocket地址 @param proxy HTTP代理 @param connected_callback websocket连接建立成功回调 @param update_callback websocket数据更新回调"""
<|body_0|>
async def co... | stack_v2_sparse_classes_36k_train_029978 | 2,133 | permissive | [
{
"docstring": "初始化 @param wss websocket地址 @param proxy HTTP代理 @param connected_callback websocket连接建立成功回调 @param update_callback websocket数据更新回调",
"name": "__init__",
"signature": "def __init__(self, wss, proxy=None, connected_callback=None, update_callback=None)"
},
{
"docstring": "websocket连接... | 4 | stack_v2_sparse_classes_30k_train_010974 | Implement the Python class `Agent` described below.
Class description:
websocket长连接代理
Method signatures and docstrings:
- def __init__(self, wss, proxy=None, connected_callback=None, update_callback=None): 初始化 @param wss websocket地址 @param proxy HTTP代理 @param connected_callback websocket连接建立成功回调 @param update_callbac... | Implement the Python class `Agent` described below.
Class description:
websocket长连接代理
Method signatures and docstrings:
- def __init__(self, wss, proxy=None, connected_callback=None, update_callback=None): 初始化 @param wss websocket地址 @param proxy HTTP代理 @param connected_callback websocket连接建立成功回调 @param update_callbac... | 52fb22f5df20d43cb275a08adad81dc97f25a712 | <|skeleton|>
class Agent:
"""websocket长连接代理"""
def __init__(self, wss, proxy=None, connected_callback=None, update_callback=None):
"""初始化 @param wss websocket地址 @param proxy HTTP代理 @param connected_callback websocket连接建立成功回调 @param update_callback websocket数据更新回调"""
<|body_0|>
async def co... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Agent:
"""websocket长连接代理"""
def __init__(self, wss, proxy=None, connected_callback=None, update_callback=None):
"""初始化 @param wss websocket地址 @param proxy HTTP代理 @param connected_callback websocket连接建立成功回调 @param update_callback websocket数据更新回调"""
self._connected_callback = connected_call... | the_stack_v2_python_sparse | quant/utils/agent.py | cdpzyafk/thenextquant | train | 1 |
e14f5f493f1270683ae216a11c4bef6faf33476c | [
"completed_activities = user_domain.CompletedActivities('user_id0', ['exp_id0'], ['collect_id0'])\nself.assertEqual('user_id0', completed_activities.id)\nself.assertListEqual(completed_activities.exploration_ids, ['exp_id0'])\nself.assertListEqual(completed_activities.collection_ids, ['collect_id0'])",
"completed... | <|body_start_0|>
completed_activities = user_domain.CompletedActivities('user_id0', ['exp_id0'], ['collect_id0'])
self.assertEqual('user_id0', completed_activities.id)
self.assertListEqual(completed_activities.exploration_ids, ['exp_id0'])
self.assertListEqual(completed_activities.collec... | Testing domain object for the activities completed. | CompletedActivitiesTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompletedActivitiesTests:
"""Testing domain object for the activities completed."""
def test_initialization(self):
"""Testing init method."""
<|body_0|>
def test_add_exploration_id(self):
"""Testing add_exploration_id."""
<|body_1|>
def test_remove_e... | stack_v2_sparse_classes_36k_train_029979 | 14,816 | permissive | [
{
"docstring": "Testing init method.",
"name": "test_initialization",
"signature": "def test_initialization(self)"
},
{
"docstring": "Testing add_exploration_id.",
"name": "test_add_exploration_id",
"signature": "def test_add_exploration_id(self)"
},
{
"docstring": "Testing remov... | 5 | null | Implement the Python class `CompletedActivitiesTests` described below.
Class description:
Testing domain object for the activities completed.
Method signatures and docstrings:
- def test_initialization(self): Testing init method.
- def test_add_exploration_id(self): Testing add_exploration_id.
- def test_remove_explo... | Implement the Python class `CompletedActivitiesTests` described below.
Class description:
Testing domain object for the activities completed.
Method signatures and docstrings:
- def test_initialization(self): Testing init method.
- def test_add_exploration_id(self): Testing add_exploration_id.
- def test_remove_explo... | 899b9755a6b795a8991e596055ac24065a8435e0 | <|skeleton|>
class CompletedActivitiesTests:
"""Testing domain object for the activities completed."""
def test_initialization(self):
"""Testing init method."""
<|body_0|>
def test_add_exploration_id(self):
"""Testing add_exploration_id."""
<|body_1|>
def test_remove_e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompletedActivitiesTests:
"""Testing domain object for the activities completed."""
def test_initialization(self):
"""Testing init method."""
completed_activities = user_domain.CompletedActivities('user_id0', ['exp_id0'], ['collect_id0'])
self.assertEqual('user_id0', completed_act... | the_stack_v2_python_sparse | core/domain/user_domain_test.py | import-keshav/oppia | train | 4 |
7ab37ab224045abd7cee10ff3e0815e662abc1af | [
"self.frame = frame\nsuper().__init__(self.frame)\nself.give_shape()\nself.brick_matrix = self.make_brick_matrix(self.frame)",
"for r in range(len(self.location_n_type_matrix)):\n for c in range(len(self.location_n_type_matrix[r])):\n if r == len(self.location_n_type_matrix) - 1:\n self.locat... | <|body_start_0|>
self.frame = frame
super().__init__(self.frame)
self.give_shape()
self.brick_matrix = self.make_brick_matrix(self.frame)
<|end_body_0|>
<|body_start_1|>
for r in range(len(self.location_n_type_matrix)):
for c in range(len(self.location_n_type_matrix[... | BrickLayout for stage2 | LayoutStage2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LayoutStage2:
"""BrickLayout for stage2"""
def __init__(self, frame: Frame):
"""constructor for this class"""
<|body_0|>
def give_shape(self):
"""This function is from the parrent class. Now overriding it to give"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_029980 | 8,421 | no_license | [
{
"docstring": "constructor for this class",
"name": "__init__",
"signature": "def __init__(self, frame: Frame)"
},
{
"docstring": "This function is from the parrent class. Now overriding it to give",
"name": "give_shape",
"signature": "def give_shape(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006708 | Implement the Python class `LayoutStage2` described below.
Class description:
BrickLayout for stage2
Method signatures and docstrings:
- def __init__(self, frame: Frame): constructor for this class
- def give_shape(self): This function is from the parrent class. Now overriding it to give | Implement the Python class `LayoutStage2` described below.
Class description:
BrickLayout for stage2
Method signatures and docstrings:
- def __init__(self, frame: Frame): constructor for this class
- def give_shape(self): This function is from the parrent class. Now overriding it to give
<|skeleton|>
class LayoutSta... | c4cd10f631aba51d290395dec446850a0fbfe1b5 | <|skeleton|>
class LayoutStage2:
"""BrickLayout for stage2"""
def __init__(self, frame: Frame):
"""constructor for this class"""
<|body_0|>
def give_shape(self):
"""This function is from the parrent class. Now overriding it to give"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LayoutStage2:
"""BrickLayout for stage2"""
def __init__(self, frame: Frame):
"""constructor for this class"""
self.frame = frame
super().__init__(self.frame)
self.give_shape()
self.brick_matrix = self.make_brick_matrix(self.frame)
def give_shape(self):
... | the_stack_v2_python_sparse | v1/brick_layout.py | ayushsharma-crypto/Brick-Breaker-Terminal-Based-Game | train | 0 |
926921f65421199debff8f5465ea38e83d722fb0 | [
"new_stmts = []\nfor stmt in body:\n stmts = self.visit(stmt)\n if isinstance(stmts, list):\n new_stmts.extend(stmts)\n else:\n new_stmts.append(stmts)\nreturn new_stmts",
"for func in recognized_idiom_variants:\n ret_tuple = func(node.test)\n if ret_tuple[0]:\n node.test = rec... | <|body_start_0|>
new_stmts = []
for stmt in body:
stmts = self.visit(stmt)
if isinstance(stmts, list):
new_stmts.extend(stmts)
else:
new_stmts.append(stmts)
return new_stmts
<|end_body_0|>
<|body_start_1|>
for func in r... | This transformer ensures that all the idiom variants that are recognized by stypy are transformed to its base equivalent form, in order to process them accordingly without spawning repeated code for each recognized code pattern. This means that we have set a canonical form for each idiom and all the possible variants a... | IdiomConversionVisitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdiomConversionVisitor:
"""This transformer ensures that all the idiom variants that are recognized by stypy are transformed to its base equivalent form, in order to process them accordingly without spawning repeated code for each recognized code pattern. This means that we have set a canonical f... | stack_v2_sparse_classes_36k_train_029981 | 32,554 | no_license | [
{
"docstring": "Visit the if body, applying the idiom on Ifs that are inside If bodies. :param body: :return:",
"name": "__visit_instruction_body",
"signature": "def __visit_instruction_body(self, body)"
},
{
"docstring": "Check if conditions to search for recognized idiom patterns. :param node:... | 2 | null | Implement the Python class `IdiomConversionVisitor` described below.
Class description:
This transformer ensures that all the idiom variants that are recognized by stypy are transformed to its base equivalent form, in order to process them accordingly without spawning repeated code for each recognized code pattern. Th... | Implement the Python class `IdiomConversionVisitor` described below.
Class description:
This transformer ensures that all the idiom variants that are recognized by stypy are transformed to its base equivalent form, in order to process them accordingly without spawning repeated code for each recognized code pattern. Th... | be66ae846c82ac40ba7b48f9880d6e3990681a5b | <|skeleton|>
class IdiomConversionVisitor:
"""This transformer ensures that all the idiom variants that are recognized by stypy are transformed to its base equivalent form, in order to process them accordingly without spawning repeated code for each recognized code pattern. This means that we have set a canonical f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdiomConversionVisitor:
"""This transformer ensures that all the idiom variants that are recognized by stypy are transformed to its base equivalent form, in order to process them accordingly without spawning repeated code for each recognized code pattern. This means that we have set a canonical form for each ... | the_stack_v2_python_sparse | stypy/visitor/type_inference/desugaring/idiom_conversion_visitor.py | ComputationalReflection/stypy | train | 2 |
0fda43b41181acbc181034010d6aecaab7d1d5d7 | [
"self.count = 0\nself.prefix = prefix\nself.name = name\nself.f5 = f5",
"if self.f5 is not None:\n file = self.name + '%03d.f5' % self.count\n filename = os.path.join(self.prefix, file)\n self.f5.writeToFile(filename)\nself.count += 1\nreturn"
] | <|body_start_0|>
self.count = 0
self.prefix = prefix
self.name = name
self.f5 = f5
<|end_body_0|>
<|body_start_1|>
if self.f5 is not None:
file = self.name + '%03d.f5' % self.count
filename = os.path.join(self.prefix, file)
self.f5.writeToFile... | TacsOutputGenerator | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TacsOutputGenerator:
def __init__(self, prefix, name='tacs_output_file', f5=None):
"""Store information about how to write TACS output files"""
<|body_0|>
def __call__(self):
"""Generate the output from TACS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_029982 | 41,127 | permissive | [
{
"docstring": "Store information about how to write TACS output files",
"name": "__init__",
"signature": "def __init__(self, prefix, name='tacs_output_file', f5=None)"
},
{
"docstring": "Generate the output from TACS",
"name": "__call__",
"signature": "def __call__(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000349 | Implement the Python class `TacsOutputGenerator` described below.
Class description:
Implement the TacsOutputGenerator class.
Method signatures and docstrings:
- def __init__(self, prefix, name='tacs_output_file', f5=None): Store information about how to write TACS output files
- def __call__(self): Generate the outp... | Implement the Python class `TacsOutputGenerator` described below.
Class description:
Implement the TacsOutputGenerator class.
Method signatures and docstrings:
- def __init__(self, prefix, name='tacs_output_file', f5=None): Store information about how to write TACS output files
- def __call__(self): Generate the outp... | 4c11b61397100f9d8b455f7d20cf3b507a15c1e9 | <|skeleton|>
class TacsOutputGenerator:
def __init__(self, prefix, name='tacs_output_file', f5=None):
"""Store information about how to write TACS output files"""
<|body_0|>
def __call__(self):
"""Generate the output from TACS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TacsOutputGenerator:
def __init__(self, prefix, name='tacs_output_file', f5=None):
"""Store information about how to write TACS output files"""
self.count = 0
self.prefix = prefix
self.name = name
self.f5 = f5
def __call__(self):
"""Generate the output from... | the_stack_v2_python_sparse | funtofem/interface/tacs_interface.py | gjkennedy/funtofem | train | 0 | |
5a403f3f865a754ebb4c94f4d47bce3498329daa | [
"results = []\nprop_type = props.get('Type')\ntry:\n if prop_type in ['List']:\n if isinstance(value, list):\n for i, item in enumerate(value):\n results.extend(self.check_type(item, path[:] + [i], {'Type': props.get('ItemType')}))\n else:\n message = 'Property ... | <|body_start_0|>
results = []
prop_type = props.get('Type')
try:
if prop_type in ['List']:
if isinstance(value, list):
for i, item in enumerate(value):
results.extend(self.check_type(item, path[:] + [i], {'Type': props.get('... | Check if Parameters are configured correctly | Configuration | [
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Configuration:
"""Check if Parameters are configured correctly"""
def check_type(self, value, path, props):
"""Check the type and handle recursion with lists"""
<|body_0|>
def match(self, cfn):
"""Check CloudFormation Parameters"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_029983 | 5,302 | permissive | [
{
"docstring": "Check the type and handle recursion with lists",
"name": "check_type",
"signature": "def check_type(self, value, path, props)"
},
{
"docstring": "Check CloudFormation Parameters",
"name": "match",
"signature": "def match(self, cfn)"
}
] | 2 | null | Implement the Python class `Configuration` described below.
Class description:
Check if Parameters are configured correctly
Method signatures and docstrings:
- def check_type(self, value, path, props): Check the type and handle recursion with lists
- def match(self, cfn): Check CloudFormation Parameters | Implement the Python class `Configuration` described below.
Class description:
Check if Parameters are configured correctly
Method signatures and docstrings:
- def check_type(self, value, path, props): Check the type and handle recursion with lists
- def match(self, cfn): Check CloudFormation Parameters
<|skeleton|>... | 5176573c2f4cb7313998b4bc0bcb0716b58ea380 | <|skeleton|>
class Configuration:
"""Check if Parameters are configured correctly"""
def check_type(self, value, path, props):
"""Check the type and handle recursion with lists"""
<|body_0|>
def match(self, cfn):
"""Check CloudFormation Parameters"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Configuration:
"""Check if Parameters are configured correctly"""
def check_type(self, value, path, props):
"""Check the type and handle recursion with lists"""
results = []
prop_type = props.get('Type')
try:
if prop_type in ['List']:
if isinsta... | the_stack_v2_python_sparse | src/cfnlint/rules/parameters/Configuration.py | rene84/cfn-python-lint | train | 1 |
c62c2f563f3c36428319d5c13bb0644237e3ebd4 | [
"super(LoopyBeliefUpdateInference, self).__init__(model)\nself._update_order = update_order\nself._damping = damping\nself._callback = callback",
"old_separator = self._separator_potential[edge]\nvariables_to_keep = old_separator.variable_set\nbelief0 = self.beliefs[edge[0]]\nbelief1 = self.beliefs[edge[1]]\nnew_... | <|body_start_0|>
super(LoopyBeliefUpdateInference, self).__init__(model)
self._update_order = update_order
self._damping = damping
self._callback = callback
<|end_body_0|>
<|body_start_1|>
old_separator = self._separator_potential[edge]
variables_to_keep = old_separator.... | An inference object to calibrate the potentials. | LoopyBeliefUpdateInference | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoopyBeliefUpdateInference:
"""An inference object to calibrate the potentials."""
def __init__(self, model, update_order=None, damping=0.0, callback=None):
"""Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used.... | stack_v2_sparse_classes_36k_train_029984 | 18,882 | permissive | [
{
"docstring": "Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used. :param damping: The damping to use on each iteration. :param callback: A function to call with (the inference object, update order object) as parameters whenever the updat... | 3 | stack_v2_sparse_classes_30k_train_002195 | Implement the Python class `LoopyBeliefUpdateInference` described below.
Class description:
An inference object to calibrate the potentials.
Method signatures and docstrings:
- def __init__(self, model, update_order=None, damping=0.0, callback=None): Constructor. :param model: The model. :param update_order: A messag... | Implement the Python class `LoopyBeliefUpdateInference` described below.
Class description:
An inference object to calibrate the potentials.
Method signatures and docstrings:
- def __init__(self, model, update_order=None, damping=0.0, callback=None): Constructor. :param model: The model. :param update_order: A messag... | 445b2cf8736a4a28cff2b074a32afe8fe6986d53 | <|skeleton|>
class LoopyBeliefUpdateInference:
"""An inference object to calibrate the potentials."""
def __init__(self, model, update_order=None, damping=0.0, callback=None):
"""Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoopyBeliefUpdateInference:
"""An inference object to calibrate the potentials."""
def __init__(self, model, update_order=None, damping=0.0, callback=None):
"""Constructor. :param model: The model. :param update_order: A message update protocol. If `None`, `FloodingProtocol` is used. :param dampi... | the_stack_v2_python_sparse | Statistical_methods/LoopyBeliefPropagation/pyugm/infer_message.py | WN1695173791/Background-Subtraction-Unsupervised-Learning | train | 1 |
fe1a36e4c30fe9144eb4a0c821777f731cd90a76 | [
"clusters = ['a0370', 'a1689', 'a1835', 'a2218', 'a2219', 'a2390', 'cl0024', 'ms0451', 'ms1054', 'ms1358', 'rxj0152', 'rxj1347']\nself.beam = [get_spire_beam_fwhm('PSW'), get_spire_beam_fwhm('PMW'), get_spire_beam_fwhm('PLW')]\nself.verbose = verbose\nself.saveplot = saveplot\nself.maketf = maketf\nself.sgen = sgen... | <|body_start_0|>
clusters = ['a0370', 'a1689', 'a1835', 'a2218', 'a2219', 'a2390', 'cl0024', 'ms0451', 'ms1054', 'ms1358', 'rxj0152', 'rxj1347']
self.beam = [get_spire_beam_fwhm('PSW'), get_spire_beam_fwhm('PMW'), get_spire_beam_fwhm('PLW')]
self.verbose = verbose
self.saveplot = saveplo... | Catsrc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Catsrc:
def __init__(self, clusname, isim=None, saveplot=1, maketf=0, sgen=None, verbose=1, resolution='nr', superplot=0, testflag=2, lense_only=0):
"""initializing function for catsrc class Purpose: read in arguments to be passed to functions in catsrc. Inputs : Clusname - the name of t... | stack_v2_sparse_classes_36k_train_029985 | 10,865 | no_license | [
{
"docstring": "initializing function for catsrc class Purpose: read in arguments to be passed to functions in catsrc. Inputs : Clusname - the name of the galaxy cluster saveplot - flag to set if you want to save plots to a file maketf - make transfer function flag (currently not used) sgen - flag for looking a... | 4 | null | Implement the Python class `Catsrc` described below.
Class description:
Implement the Catsrc class.
Method signatures and docstrings:
- def __init__(self, clusname, isim=None, saveplot=1, maketf=0, sgen=None, verbose=1, resolution='nr', superplot=0, testflag=2, lense_only=0): initializing function for catsrc class Pu... | Implement the Python class `Catsrc` described below.
Class description:
Implement the Catsrc class.
Method signatures and docstrings:
- def __init__(self, clusname, isim=None, saveplot=1, maketf=0, sgen=None, verbose=1, resolution='nr', superplot=0, testflag=2, lense_only=0): initializing function for catsrc class Pu... | a74894cb06e50d5d5db9a253455fe9df3f0c0dc4 | <|skeleton|>
class Catsrc:
def __init__(self, clusname, isim=None, saveplot=1, maketf=0, sgen=None, verbose=1, resolution='nr', superplot=0, testflag=2, lense_only=0):
"""initializing function for catsrc class Purpose: read in arguments to be passed to functions in catsrc. Inputs : Clusname - the name of t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Catsrc:
def __init__(self, clusname, isim=None, saveplot=1, maketf=0, sgen=None, verbose=1, resolution='nr', superplot=0, testflag=2, lense_only=0):
"""initializing function for catsrc class Purpose: read in arguments to be passed to functions in catsrc. Inputs : Clusname - the name of the galaxy clus... | the_stack_v2_python_sparse | catsrc.py | rit-rsz/rsz | train | 4 | |
e384b9757934b2ba1d6764900c3f609ad2cad077 | [
"if team_id != settings.SLACK_TEAM_ID:\n raise serializers.ValidationError(_('[Invalid Request] Wrong workspace.'), code='invalid_request')\nreturn team_id",
"self.user = User.objects.filter(slack_id=user_id).first()\nif not self.user:\n raise serializers.ValidationError(_('[Invalid Request] Requestor is no... | <|body_start_0|>
if team_id != settings.SLACK_TEAM_ID:
raise serializers.ValidationError(_('[Invalid Request] Wrong workspace.'), code='invalid_request')
return team_id
<|end_body_0|>
<|body_start_1|>
self.user = User.objects.filter(slack_id=user_id).first()
if not self.user... | standup serializer | StandupSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StandupSerializer:
"""standup serializer"""
def validate_team_id(self, team_id):
"""validate if the team source of the request came from the right team. (swiftkind) if not, deny access."""
<|body_0|>
def validate_user_id(self, user_id):
"""validate if the user is... | stack_v2_sparse_classes_36k_train_029986 | 7,961 | no_license | [
{
"docstring": "validate if the team source of the request came from the right team. (swiftkind) if not, deny access.",
"name": "validate_team_id",
"signature": "def validate_team_id(self, team_id)"
},
{
"docstring": "validate if the user is a valid member of the workspace.",
"name": "valida... | 4 | stack_v2_sparse_classes_30k_train_018310 | Implement the Python class `StandupSerializer` described below.
Class description:
standup serializer
Method signatures and docstrings:
- def validate_team_id(self, team_id): validate if the team source of the request came from the right team. (swiftkind) if not, deny access.
- def validate_user_id(self, user_id): va... | Implement the Python class `StandupSerializer` described below.
Class description:
standup serializer
Method signatures and docstrings:
- def validate_team_id(self, team_id): validate if the team source of the request came from the right team. (swiftkind) if not, deny access.
- def validate_user_id(self, user_id): va... | 0ba8848f54f29d9586f854a1746ca70f38341cf6 | <|skeleton|>
class StandupSerializer:
"""standup serializer"""
def validate_team_id(self, team_id):
"""validate if the team source of the request came from the right team. (swiftkind) if not, deny access."""
<|body_0|>
def validate_user_id(self, user_id):
"""validate if the user is... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StandupSerializer:
"""standup serializer"""
def validate_team_id(self, team_id):
"""validate if the team source of the request came from the right team. (swiftkind) if not, deny access."""
if team_id != settings.SLACK_TEAM_ID:
raise serializers.ValidationError(_('[Invalid Requ... | the_stack_v2_python_sparse | history/serializers.py | Swiftkind/workflow | train | 0 |
7e9bb487978070a94bb50c02b69fe24294e9a02f | [
"if prob_win > 1 or prob_win < 0:\n raise AttributeError('prob_win must be between 0 and 1')\nself.prob_win = prob_win",
"draw = random()\ndraw = draw * (player1.elo / player1.elo)\ndraw = draw * (player2.elo / player2.elo)\nif draw < self.prob_win:\n return 1\nreturn 0"
] | <|body_start_0|>
if prob_win > 1 or prob_win < 0:
raise AttributeError('prob_win must be between 0 and 1')
self.prob_win = prob_win
<|end_body_0|>
<|body_start_1|>
draw = random()
draw = draw * (player1.elo / player1.elo)
draw = draw * (player2.elo / player2.elo)
... | Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1). | CoinFlipEngine | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoinFlipEngine:
"""Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1)."""
def __init__(self, prob_win=0.5):
"""Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (be... | stack_v2_sparse_classes_36k_train_029987 | 1,361 | permissive | [
{
"docstring": "Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (between 0 and 1). Default is 0.5.",
"name": "__init__",
"signature": "def __init__(self, prob_win=0.5)"
},
{
"docstring": "Run the game, in this case draw from U... | 2 | stack_v2_sparse_classes_30k_train_021239 | Implement the Python class `CoinFlipEngine` described below.
Class description:
Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1).
Method signatures and docstrings:
- def __init__(self, prob_win=0.5): Initialize a random Coin Flip Engine, winner decided by a coin f... | Implement the Python class `CoinFlipEngine` described below.
Class description:
Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1).
Method signatures and docstrings:
- def __init__(self, prob_win=0.5): Initialize a random Coin Flip Engine, winner decided by a coin f... | c7365a2face3ba10f5cb502d8bd964b60990a9f5 | <|skeleton|>
class CoinFlipEngine:
"""Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1)."""
def __init__(self, prob_win=0.5):
"""Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (be... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoinFlipEngine:
"""Engine to run coin flip game. Attributes: prob_win (float): Probability player1 wins (between 0 and 1)."""
def __init__(self, prob_win=0.5):
"""Initialize a random Coin Flip Engine, winner decided by a coin flip. Args: prob_win (float): Probability player1 wins (between 0 and 1... | the_stack_v2_python_sparse | battle_engine/coinflip.py | aturfah/cmplxsys530-final | train | 4 |
473ebf02b088a30017df06bee6a95232ada766bf | [
"url = reverse('api_mdt')\nresponse = self.client.get(url, {'docrule_id': '10000'})\nself.assertEqual(response.status_code, 401)",
"url = reverse('api_mdt')\nresponse = self.client.get(url, {'docrule_id': '10000'})\nself.assertEqual(response.status_code, 401)",
"mdt = json.dumps(template)\nurl = reverse('api_md... | <|body_start_0|>
url = reverse('api_mdt')
response = self.client.get(url, {'docrule_id': '10000'})
self.assertEqual(response.status_code, 401)
<|end_body_0|>
<|body_start_1|>
url = reverse('api_mdt')
response = self.client.get(url, {'docrule_id': '10000'})
self.assertEqu... | MetadataTemplateExternalUser | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetadataTemplateExternalUser:
def test_mdt_remove_not_logged_in(self):
"""Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests..."""
<|body_0|>
def test_mdt_getting_not_logged_in(self):
"""Fetches Example MDT's... | stack_v2_sparse_classes_36k_train_029988 | 7,429 | permissive | [
{
"docstring": "Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests...",
"name": "test_mdt_remove_not_logged_in",
"signature": "def test_mdt_remove_not_logged_in(self)"
},
{
"docstring": "Fetches Example MDT's from CouchDB through API Tes... | 3 | stack_v2_sparse_classes_30k_train_005743 | Implement the Python class `MetadataTemplateExternalUser` described below.
Class description:
Implement the MetadataTemplateExternalUser class.
Method signatures and docstrings:
- def test_mdt_remove_not_logged_in(self): Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail... | Implement the Python class `MetadataTemplateExternalUser` described below.
Class description:
Implement the MetadataTemplateExternalUser class.
Method signatures and docstrings:
- def test_mdt_remove_not_logged_in(self): Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail... | 96ce41b5699e2ea58e3ca560d46d481e954f17a4 | <|skeleton|>
class MetadataTemplateExternalUser:
def test_mdt_remove_not_logged_in(self):
"""Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests..."""
<|body_0|>
def test_mdt_getting_not_logged_in(self):
"""Fetches Example MDT's... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MetadataTemplateExternalUser:
def test_mdt_remove_not_logged_in(self):
"""Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests..."""
url = reverse('api_mdt')
response = self.client.get(url, {'docrule_id': '10000'})
self.a... | the_stack_v2_python_sparse | adlibre_dms/couchapps/mdtcouch/tests.py | adlibre/Adlibre-DMS | train | 59 | |
761272e4bae642101536d2b152537f144ed6d25c | [
"reply = await message.get_reply_message()\nif not reply or not reply.message:\n await message.edit('<b>Reply to text!</b>')\n return\ntext = bytes(reply.raw_text, 'utf8')\nfname = utils.get_args_raw(message) or str(message.id + reply.id) + '.txt'\nfile = io.BytesIO(text)\nfile.name = fname\nfile.seek(0)\nawa... | <|body_start_0|>
reply = await message.get_reply_message()
if not reply or not reply.message:
await message.edit('<b>Reply to text!</b>')
return
text = bytes(reply.raw_text, 'utf8')
fname = utils.get_args_raw(message) or str(message.id + reply.id) + '.txt'
... | send Message as file | MTFMod | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MTFMod:
"""send Message as file"""
async def mtfcmd(self, message):
""".mtf <reply to text>"""
<|body_0|>
async def ftmcmd(self, message):
""".ftm <reply to file>"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
reply = await message.get_reply_me... | stack_v2_sparse_classes_36k_train_029989 | 1,000 | no_license | [
{
"docstring": ".mtf <reply to text>",
"name": "mtfcmd",
"signature": "async def mtfcmd(self, message)"
},
{
"docstring": ".ftm <reply to file>",
"name": "ftmcmd",
"signature": "async def ftmcmd(self, message)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012007 | Implement the Python class `MTFMod` described below.
Class description:
send Message as file
Method signatures and docstrings:
- async def mtfcmd(self, message): .mtf <reply to text>
- async def ftmcmd(self, message): .ftm <reply to file> | Implement the Python class `MTFMod` described below.
Class description:
send Message as file
Method signatures and docstrings:
- async def mtfcmd(self, message): .mtf <reply to text>
- async def ftmcmd(self, message): .ftm <reply to file>
<|skeleton|>
class MTFMod:
"""send Message as file"""
async def mtfcm... | d9d859ea0ed7f66bb23a6a06d1efa4c8bce9b846 | <|skeleton|>
class MTFMod:
"""send Message as file"""
async def mtfcmd(self, message):
""".mtf <reply to text>"""
<|body_0|>
async def ftmcmd(self, message):
""".ftm <reply to file>"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MTFMod:
"""send Message as file"""
async def mtfcmd(self, message):
""".mtf <reply to text>"""
reply = await message.get_reply_message()
if not reply or not reply.message:
await message.edit('<b>Reply to text!</b>')
return
text = bytes(reply.raw_tex... | the_stack_v2_python_sparse | MTF.py | abdula2003/modules | train | 0 |
604e16896e47b5999535528882e63df848260ea7 | [
"self._snmp_params = {}\nself._context_name = context_name\nself._snmp_params = snmp_parameters\nif snmp_parameters['snmp_version'] is None:\n log_message = 'SNMP version is \"None\". Non existent host? - {}'.format(snmp_parameters['snmp_hostname'])\n log.log2die(1004, log_message)\nif not snmp_parameters:\n ... | <|body_start_0|>
self._snmp_params = {}
self._context_name = context_name
self._snmp_params = snmp_parameters
if snmp_parameters['snmp_version'] is None:
log_message = 'SNMP version is "None". Non existent host? - {}'.format(snmp_parameters['snmp_hostname'])
log.l... | Class to create an SNMP session with a device. | _Session | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Session:
"""Class to create an SNMP session with a device."""
def __init__(self, snmp_parameters, context_name=''):
"""Initialize the class. Args: snmp_parameters: Dict of SNMP paramerters context_name: Name of context Returns: session: SNMP session"""
<|body_0|>
def _s... | stack_v2_sparse_classes_36k_train_029990 | 27,844 | permissive | [
{
"docstring": "Initialize the class. Args: snmp_parameters: Dict of SNMP paramerters context_name: Name of context Returns: session: SNMP session",
"name": "__init__",
"signature": "def __init__(self, snmp_parameters, context_name='')"
},
{
"docstring": "Create an SNMP session for queries. Args... | 5 | null | Implement the Python class `_Session` described below.
Class description:
Class to create an SNMP session with a device.
Method signatures and docstrings:
- def __init__(self, snmp_parameters, context_name=''): Initialize the class. Args: snmp_parameters: Dict of SNMP paramerters context_name: Name of context Returns... | Implement the Python class `_Session` described below.
Class description:
Class to create an SNMP session with a device.
Method signatures and docstrings:
- def __init__(self, snmp_parameters, context_name=''): Initialize the class. Args: snmp_parameters: Dict of SNMP paramerters context_name: Name of context Returns... | ae82589fbbab77fef6d6be09c1fcca5846f595a8 | <|skeleton|>
class _Session:
"""Class to create an SNMP session with a device."""
def __init__(self, snmp_parameters, context_name=''):
"""Initialize the class. Args: snmp_parameters: Dict of SNMP paramerters context_name: Name of context Returns: session: SNMP session"""
<|body_0|>
def _s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Session:
"""Class to create an SNMP session with a device."""
def __init__(self, snmp_parameters, context_name=''):
"""Initialize the class. Args: snmp_parameters: Dict of SNMP paramerters context_name: Name of context Returns: session: SNMP session"""
self._snmp_params = {}
self... | the_stack_v2_python_sparse | switchmap/snmp/snmp_manager.py | PalisadoesFoundation/switchmap-ng | train | 8 |
3ea0bada27377532a8b0a3b08853c5ec84737962 | [
"self.show_progress = False\nself.config_dir = None\nreturn",
"args = self._parse_command_line()\nself.config_dir = args.config_dir\nself.show_progress = args.show_progress\nif args.cplusplus:\n self._reformat_cplusplus(args.cplusplus)\nif args.python:\n self._reformat_python(args.python)\nreturn",
"forma... | <|body_start_0|>
self.show_progress = False
self.config_dir = None
return
<|end_body_0|>
<|body_start_1|>
args = self._parse_command_line()
self.config_dir = args.config_dir
self.show_progress = args.show_progress
if args.cplusplus:
self._reformat_cpl... | Application to reformat C++ and Python source code. | App | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class App:
"""Application to reformat C++ and Python source code."""
def __init__(self):
"""Constructor."""
<|body_0|>
def main(self):
"""Application driver."""
<|body_1|>
def _reformat_cplusplus(self, flags):
"""Reformat C++ files. :param flags: F... | stack_v2_sparse_classes_36k_train_029991 | 6,906 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Application driver.",
"name": "main",
"signature": "def main(self)"
},
{
"docstring": "Reformat C++ files. :param flags: Flags indicating what files to reformat [\"all\", FILE,... | 6 | stack_v2_sparse_classes_30k_train_001339 | Implement the Python class `App` described below.
Class description:
Application to reformat C++ and Python source code.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def main(self): Application driver.
- def _reformat_cplusplus(self, flags): Reformat C++ files. :param flags: Flags indicating... | Implement the Python class `App` described below.
Class description:
Application to reformat C++ and Python source code.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def main(self): Application driver.
- def _reformat_cplusplus(self, flags): Reformat C++ files. :param flags: Flags indicating... | c5f872c6afff004a06311d36ac078133a30abd99 | <|skeleton|>
class App:
"""Application to reformat C++ and Python source code."""
def __init__(self):
"""Constructor."""
<|body_0|>
def main(self):
"""Application driver."""
<|body_1|>
def _reformat_cplusplus(self, flags):
"""Reformat C++ files. :param flags: F... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class App:
"""Application to reformat C++ and Python source code."""
def __init__(self):
"""Constructor."""
self.show_progress = False
self.config_dir = None
return
def main(self):
"""Application driver."""
args = self._parse_command_line()
self.conf... | the_stack_v2_python_sparse | developer/format_source.py | rwalkerlewis/pylith | train | 0 |
8b4319838ed70326f9cab77ff3ee28036876bfde | [
"self.prefix = model.prefix\nself.text_token_ids_key = model.text_token_ids_key\nself.text_valid_length_key = model.text_valid_length_key\nself.text_segment_ids_key = model.text_segment_ids_key\nself.text_token_word_mapping_key = model.text_token_word_mapping_key\nself.text_word_offsets_key = model.text_word_offset... | <|body_start_0|>
self.prefix = model.prefix
self.text_token_ids_key = model.text_token_ids_key
self.text_valid_length_key = model.text_valid_length_key
self.text_segment_ids_key = model.text_segment_ids_key
self.text_token_word_mapping_key = model.text_token_word_mapping_key
... | Prepare NER data for the model specified by "prefix". | NerProcessor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NerProcessor:
"""Prepare NER data for the model specified by "prefix"."""
def __init__(self, model: nn.Module, max_len: Optional[int]=None, entity_map: Optional[DictConfig]=None):
"""Parameters ---------- model The NER model. max_len The max length of the tokenizer. entity_map The ma... | stack_v2_sparse_classes_36k_train_029992 | 6,072 | permissive | [
{
"docstring": "Parameters ---------- model The NER model. max_len The max length of the tokenizer. entity_map The map between tags and tag indexes. e.g., {\"PER\":2, \"LOC\":3}.",
"name": "__init__",
"signature": "def __init__(self, model: nn.Module, max_len: Optional[int]=None, entity_map: Optional[Di... | 4 | stack_v2_sparse_classes_30k_train_020287 | Implement the Python class `NerProcessor` described below.
Class description:
Prepare NER data for the model specified by "prefix".
Method signatures and docstrings:
- def __init__(self, model: nn.Module, max_len: Optional[int]=None, entity_map: Optional[DictConfig]=None): Parameters ---------- model The NER model. m... | Implement the Python class `NerProcessor` described below.
Class description:
Prepare NER data for the model specified by "prefix".
Method signatures and docstrings:
- def __init__(self, model: nn.Module, max_len: Optional[int]=None, entity_map: Optional[DictConfig]=None): Parameters ---------- model The NER model. m... | 6af92e149491f6e5062495d87306b3625d12d992 | <|skeleton|>
class NerProcessor:
"""Prepare NER data for the model specified by "prefix"."""
def __init__(self, model: nn.Module, max_len: Optional[int]=None, entity_map: Optional[DictConfig]=None):
"""Parameters ---------- model The NER model. max_len The max length of the tokenizer. entity_map The ma... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NerProcessor:
"""Prepare NER data for the model specified by "prefix"."""
def __init__(self, model: nn.Module, max_len: Optional[int]=None, entity_map: Optional[DictConfig]=None):
"""Parameters ---------- model The NER model. max_len The max length of the tokenizer. entity_map The map between tag... | the_stack_v2_python_sparse | multimodal/src/autogluon/multimodal/data/process_ner.py | stjordanis/autogluon | train | 0 |
15ed22f7fffd066270fb8d0534cc859287a9c769 | [
"super().__init__(x, y)\nself.fill_color = QtCore.Qt.black\nself.line_color = QtCore.Qt.black\nself.center_x = self.x\nself.center_y = self.y\nself.time = random.randint(0, 360)\nself.radius = random.randint(64, 128)",
"self.time += 1\nself.x = math.sin(math.radians(self.time)) * self.radius + self.center_x\nself... | <|body_start_0|>
super().__init__(x, y)
self.fill_color = QtCore.Qt.black
self.line_color = QtCore.Qt.black
self.center_x = self.x
self.center_y = self.y
self.time = random.randint(0, 360)
self.radius = random.randint(64, 128)
<|end_body_0|>
<|body_start_1|>
... | Class to represent a Vulture. | Vulture | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vulture:
"""Class to represent a Vulture."""
def __init__(self, x, y):
"""Create a new Vulture with the given x and y values. :param int x: The x-coordinate; default is zero. :param int y: The y-coordinate; default is zero."""
<|body_0|>
def move(self, w, h):
"""... | stack_v2_sparse_classes_36k_train_029993 | 13,878 | no_license | [
{
"docstring": "Create a new Vulture with the given x and y values. :param int x: The x-coordinate; default is zero. :param int y: The y-coordinate; default is zero.",
"name": "__init__",
"signature": "def __init__(self, x, y)"
},
{
"docstring": "A Vulture flies in a circle centered around it's ... | 2 | stack_v2_sparse_classes_30k_train_015248 | Implement the Python class `Vulture` described below.
Class description:
Class to represent a Vulture.
Method signatures and docstrings:
- def __init__(self, x, y): Create a new Vulture with the given x and y values. :param int x: The x-coordinate; default is zero. :param int y: The y-coordinate; default is zero.
- d... | Implement the Python class `Vulture` described below.
Class description:
Class to represent a Vulture.
Method signatures and docstrings:
- def __init__(self, x, y): Create a new Vulture with the given x and y values. :param int x: The x-coordinate; default is zero. :param int y: The y-coordinate; default is zero.
- d... | 0e3470085083012f893adb22aa46d46039016965 | <|skeleton|>
class Vulture:
"""Class to represent a Vulture."""
def __init__(self, x, y):
"""Create a new Vulture with the given x and y values. :param int x: The x-coordinate; default is zero. :param int y: The y-coordinate; default is zero."""
<|body_0|>
def move(self, w, h):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vulture:
"""Class to represent a Vulture."""
def __init__(self, x, y):
"""Create a new Vulture with the given x and y values. :param int x: The x-coordinate; default is zero. :param int y: The y-coordinate; default is zero."""
super().__init__(x, y)
self.fill_color = QtCore.Qt.bla... | the_stack_v2_python_sparse | CS_210 (Introduction to Programming)/Labs/Lab34_AviaryApp.py | JacobOrner/USAFA | train | 0 |
2944cbb400878fc586fe188d7fbc7d4e65bf5ac8 | [
"aws.apply_to_regions(self.operation)\nredirect_url = reverse('geonet')\nreturn HttpResponseRedirect(redirect_url)",
"context = super(AWSStatus, self).get_context_data(**kwargs)\ncontext['dashboard'] = 'geonet'\ncontext.update(self.get_aws_status())\nreturn context",
"try:\n return BotoCache.objects.get(oper... | <|body_start_0|>
aws.apply_to_regions(self.operation)
redirect_url = reverse('geonet')
return HttpResponseRedirect(redirect_url)
<|end_body_0|>
<|body_start_1|>
context = super(AWSStatus, self).get_context_data(**kwargs)
context['dashboard'] = 'geonet'
context.update(sel... | AWSStatus | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AWSStatus:
def post(self, request, *args, **kwargs):
"""Refresh the AWS instance list when a request is posted."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Called from a GET request -- display instances from the cache."""
<|body_1|>
def get_bo... | stack_v2_sparse_classes_36k_train_029994 | 3,834 | permissive | [
{
"docstring": "Refresh the AWS instance list when a request is posted.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Called from a GET request -- display instances from the cache.",
"name": "get_context_data",
"signature": "def get_context_... | 5 | stack_v2_sparse_classes_30k_train_011979 | Implement the Python class `AWSStatus` described below.
Class description:
Implement the AWSStatus class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Refresh the AWS instance list when a request is posted.
- def get_context_data(self, **kwargs): Called from a GET request -- display i... | Implement the Python class `AWSStatus` described below.
Class description:
Implement the AWSStatus class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Refresh the AWS instance list when a request is posted.
- def get_context_data(self, **kwargs): Called from a GET request -- display i... | 57a2ba417d545a57a987b3620e46e56f023134d6 | <|skeleton|>
class AWSStatus:
def post(self, request, *args, **kwargs):
"""Refresh the AWS instance list when a request is posted."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Called from a GET request -- display instances from the cache."""
<|body_1|>
def get_bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AWSStatus:
def post(self, request, *args, **kwargs):
"""Refresh the AWS instance list when a request is posted."""
aws.apply_to_regions(self.operation)
redirect_url = reverse('geonet')
return HttpResponseRedirect(redirect_url)
def get_context_data(self, **kwargs):
... | the_stack_v2_python_sparse | geonet/views.py | bbengfort/kahu | train | 1 | |
374ddb0a5cedf29a556d296713e528965e190400 | [
"self.app_data = {}\nfor pkg_index in app_dict:\n result = defaultdict(int)\n keywords = app_dict[pkg_index][0]\n for occupation, words_list in job_tags.items():\n for word in words_list:\n if keywords.find(word) >= 0:\n result[occupation] += 1\n break\n i... | <|body_start_0|>
self.app_data = {}
for pkg_index in app_dict:
result = defaultdict(int)
keywords = app_dict[pkg_index][0]
for occupation, words_list in job_tags.items():
for word in words_list:
if keywords.find(word) >= 0:
... | 职业预测 | JobPredict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobPredict:
"""职业预测"""
def __init__(self, job_tags, app_dict):
"""初始化 :param job_tags: {"sale": [], ....... "driver": []} :param app_dict: {pkg_index: [app_name, app_tags, word, ...], ...}"""
<|body_0|>
def check_user(self, user_pkg_index_list):
"""检查一个用户的职业 :ret... | stack_v2_sparse_classes_36k_train_029995 | 1,656 | no_license | [
{
"docstring": "初始化 :param job_tags: {\"sale\": [], ....... \"driver\": []} :param app_dict: {pkg_index: [app_name, app_tags, word, ...], ...}",
"name": "__init__",
"signature": "def __init__(self, job_tags, app_dict)"
},
{
"docstring": "检查一个用户的职业 :return result: job",
"name": "check_user",
... | 2 | stack_v2_sparse_classes_30k_train_012548 | Implement the Python class `JobPredict` described below.
Class description:
职业预测
Method signatures and docstrings:
- def __init__(self, job_tags, app_dict): 初始化 :param job_tags: {"sale": [], ....... "driver": []} :param app_dict: {pkg_index: [app_name, app_tags, word, ...], ...}
- def check_user(self, user_pkg_index_... | Implement the Python class `JobPredict` described below.
Class description:
职业预测
Method signatures and docstrings:
- def __init__(self, job_tags, app_dict): 初始化 :param job_tags: {"sale": [], ....... "driver": []} :param app_dict: {pkg_index: [app_name, app_tags, word, ...], ...}
- def check_user(self, user_pkg_index_... | 2693b1262a15b66365ec6f1ffc3b6673a9d9760d | <|skeleton|>
class JobPredict:
"""职业预测"""
def __init__(self, job_tags, app_dict):
"""初始化 :param job_tags: {"sale": [], ....... "driver": []} :param app_dict: {pkg_index: [app_name, app_tags, word, ...], ...}"""
<|body_0|>
def check_user(self, user_pkg_index_list):
"""检查一个用户的职业 :ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobPredict:
"""职业预测"""
def __init__(self, job_tags, app_dict):
"""初始化 :param job_tags: {"sale": [], ....... "driver": []} :param app_dict: {pkg_index: [app_name, app_tags, word, ...], ...}"""
self.app_data = {}
for pkg_index in app_dict:
result = defaultdict(int)
... | the_stack_v2_python_sparse | predict/predict_job.py | walleleung/DemoGraphy | train | 0 |
8e4a01dee87eba5e3bc2f6cc2e4ec5eec5e4511e | [
"t = _TimeEvent()\nt.type = 'once'\nt.next = datetime.datetime.now() + delay\nt.action = action\nself.time_events.append(t)",
"t = _TimeEvent()\nt.type = 'periodic'\nif delay:\n t.next = datetime.datetime.now() + delay\nelse:\n t.next = datetime.datetime.now() + interval\nt.interval = interval\nt.action = a... | <|body_start_0|>
t = _TimeEvent()
t.type = 'once'
t.next = datetime.datetime.now() + delay
t.action = action
self.time_events.append(t)
<|end_body_0|>
<|body_start_1|>
t = _TimeEvent()
t.type = 'periodic'
if delay:
t.next = datetime.datetime.n... | Class to manage timed events | TimeManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeManager:
"""Class to manage timed events"""
def register_once(self, action, delay):
""":param action: function to be executed :type action: function :param delay: Delay until action :type delay: datetime.timedelta Register an event to be executed once"""
<|body_0|>
d... | stack_v2_sparse_classes_36k_train_029996 | 2,705 | no_license | [
{
"docstring": ":param action: function to be executed :type action: function :param delay: Delay until action :type delay: datetime.timedelta Register an event to be executed once",
"name": "register_once",
"signature": "def register_once(self, action, delay)"
},
{
"docstring": ":param action: ... | 4 | stack_v2_sparse_classes_30k_train_003636 | Implement the Python class `TimeManager` described below.
Class description:
Class to manage timed events
Method signatures and docstrings:
- def register_once(self, action, delay): :param action: function to be executed :type action: function :param delay: Delay until action :type delay: datetime.timedelta Register ... | Implement the Python class `TimeManager` described below.
Class description:
Class to manage timed events
Method signatures and docstrings:
- def register_once(self, action, delay): :param action: function to be executed :type action: function :param delay: Delay until action :type delay: datetime.timedelta Register ... | 3e65f20adbc29d38529f41a4e839c554be3c7691 | <|skeleton|>
class TimeManager:
"""Class to manage timed events"""
def register_once(self, action, delay):
""":param action: function to be executed :type action: function :param delay: Delay until action :type delay: datetime.timedelta Register an event to be executed once"""
<|body_0|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeManager:
"""Class to manage timed events"""
def register_once(self, action, delay):
""":param action: function to be executed :type action: function :param delay: Delay until action :type delay: datetime.timedelta Register an event to be executed once"""
t = _TimeEvent()
t.typ... | the_stack_v2_python_sparse | src/timemanager.py | varesa/mustikkaBot | train | 0 |
3c94feec86e1352f793c633e31cfd0c4d7ce0313 | [
"self.driver.get(sellcar_url)\nsellcar_title = self.driver.find_element(SellCar_Locator.SELL_CAR_TITLE).text\ntt_check.assertEqual('卖车', sellcar_title, '我要卖车区域的title,期望是卖车,实际是%s' % sellcar_title)",
"test_login.Login.login(self)\nsleep(3)\nself.driver.find_element(SellCar_Locator.SELL_CAR_TAB).click()\nsleep(2)\ns... | <|body_start_0|>
self.driver.get(sellcar_url)
sellcar_title = self.driver.find_element(SellCar_Locator.SELL_CAR_TITLE).text
tt_check.assertEqual('卖车', sellcar_title, '我要卖车区域的title,期望是卖车,实际是%s' % sellcar_title)
<|end_body_0|>
<|body_start_1|>
test_login.Login.login(self)
sleep(3)... | SellCar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SellCar:
def test_sellcar_title(self):
"""测试我要卖车区域Title显示的是否正确@author:zhangyanli"""
<|body_0|>
def test_sellcar_submitclue(self):
"""测试提交卖车线索是否成功@author:zhangyanli"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.driver.get(sellcar_url)
... | stack_v2_sparse_classes_36k_train_029997 | 1,612 | no_license | [
{
"docstring": "测试我要卖车区域Title显示的是否正确@author:zhangyanli",
"name": "test_sellcar_title",
"signature": "def test_sellcar_title(self)"
},
{
"docstring": "测试提交卖车线索是否成功@author:zhangyanli",
"name": "test_sellcar_submitclue",
"signature": "def test_sellcar_submitclue(self)"
}
] | 2 | null | Implement the Python class `SellCar` described below.
Class description:
Implement the SellCar class.
Method signatures and docstrings:
- def test_sellcar_title(self): 测试我要卖车区域Title显示的是否正确@author:zhangyanli
- def test_sellcar_submitclue(self): 测试提交卖车线索是否成功@author:zhangyanli | Implement the Python class `SellCar` described below.
Class description:
Implement the SellCar class.
Method signatures and docstrings:
- def test_sellcar_title(self): 测试我要卖车区域Title显示的是否正确@author:zhangyanli
- def test_sellcar_submitclue(self): 测试提交卖车线索是否成功@author:zhangyanli
<|skeleton|>
class SellCar:
def test_... | 204856bd33c06d25f2970eba13799db75d4fd4fe | <|skeleton|>
class SellCar:
def test_sellcar_title(self):
"""测试我要卖车区域Title显示的是否正确@author:zhangyanli"""
<|body_0|>
def test_sellcar_submitclue(self):
"""测试提交卖车线索是否成功@author:zhangyanli"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SellCar:
def test_sellcar_title(self):
"""测试我要卖车区域Title显示的是否正确@author:zhangyanli"""
self.driver.get(sellcar_url)
sellcar_title = self.driver.find_element(SellCar_Locator.SELL_CAR_TITLE).text
tt_check.assertEqual('卖车', sellcar_title, '我要卖车区域的title,期望是卖车,实际是%s' % sellcar_title)
... | the_stack_v2_python_sparse | mc/taocheM/test_sellcar/test_sellcar.py | boeai/mc | train | 0 | |
edc06ce2aab9d882a9685ef01bbc52c50681b51b | [
"super().__init__(FILTER_NAME_RANGE, DEFAULT_WINDOW_SIZE, precision=precision, entity=entity)\nself._lower_bound = lower_bound\nself._upper_bound = upper_bound\nself._stats_internal: Counter = Counter()",
"new_state_value = cast(float, new_state.state)\nif self._upper_bound is not None and new_state_value > self.... | <|body_start_0|>
super().__init__(FILTER_NAME_RANGE, DEFAULT_WINDOW_SIZE, precision=precision, entity=entity)
self._lower_bound = lower_bound
self._upper_bound = upper_bound
self._stats_internal: Counter = Counter()
<|end_body_0|>
<|body_start_1|>
new_state_value = cast(float, n... | Range filter. Determines if new state is in the range of upper_bound and lower_bound. If not inside, lower or upper bound is returned instead. | RangeFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangeFilter:
"""Range filter. Determines if new state is in the range of upper_bound and lower_bound. If not inside, lower or upper bound is returned instead."""
def __init__(self, *, entity: str, precision: int | None=None, lower_bound: float | None=None, upper_bound: float | None=None) -> ... | stack_v2_sparse_classes_36k_train_029998 | 23,958 | permissive | [
{
"docstring": "Initialize Filter. :param upper_bound: band upper bound :param lower_bound: band lower bound",
"name": "__init__",
"signature": "def __init__(self, *, entity: str, precision: int | None=None, lower_bound: float | None=None, upper_bound: float | None=None) -> None"
},
{
"docstring... | 2 | null | Implement the Python class `RangeFilter` described below.
Class description:
Range filter. Determines if new state is in the range of upper_bound and lower_bound. If not inside, lower or upper bound is returned instead.
Method signatures and docstrings:
- def __init__(self, *, entity: str, precision: int | None=None,... | Implement the Python class `RangeFilter` described below.
Class description:
Range filter. Determines if new state is in the range of upper_bound and lower_bound. If not inside, lower or upper bound is returned instead.
Method signatures and docstrings:
- def __init__(self, *, entity: str, precision: int | None=None,... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class RangeFilter:
"""Range filter. Determines if new state is in the range of upper_bound and lower_bound. If not inside, lower or upper bound is returned instead."""
def __init__(self, *, entity: str, precision: int | None=None, lower_bound: float | None=None, upper_bound: float | None=None) -> ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RangeFilter:
"""Range filter. Determines if new state is in the range of upper_bound and lower_bound. If not inside, lower or upper bound is returned instead."""
def __init__(self, *, entity: str, precision: int | None=None, lower_bound: float | None=None, upper_bound: float | None=None) -> None:
... | the_stack_v2_python_sparse | homeassistant/components/filter/sensor.py | home-assistant/core | train | 35,501 |
8e051b3a36a08fa15d64215dd816bad80e649fb4 | [
"self.node = head\nself.lens = 0\nwhile head:\n self.lens += 1\n head = head.next",
"import random\nidx = random.randint(0, self.lens - 1)\ncur_node = self.node\nwhile idx:\n idx -= 1\n cur_node = cur_node.next\nreturn cur_node.val"
] | <|body_start_0|>
self.node = head
self.lens = 0
while head:
self.lens += 1
head = head.next
<|end_body_0|>
<|body_start_1|>
import random
idx = random.randint(0, self.lens - 1)
cur_node = self.node
while idx:
idx -= 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, head):
"""@param head the linked list's head. Note that the head is guaranteed to be not null,so it contains at least one node. :type head:ListNode"""
<|body_0|>
def getRandom(self):
"""returns a random node's values. :rtype:int"""
... | stack_v2_sparse_classes_36k_train_029999 | 3,733 | no_license | [
{
"docstring": "@param head the linked list's head. Note that the head is guaranteed to be not null,so it contains at least one node. :type head:ListNode",
"name": "__init__",
"signature": "def __init__(self, head)"
},
{
"docstring": "returns a random node's values. :rtype:int",
"name": "get... | 2 | stack_v2_sparse_classes_30k_train_011927 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head): @param head the linked list's head. Note that the head is guaranteed to be not null,so it contains at least one node. :type head:ListNode
- def getRando... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head): @param head the linked list's head. Note that the head is guaranteed to be not null,so it contains at least one node. :type head:ListNode
- def getRando... | a74013c1704559f6907f8e5e9866428d8f3e5336 | <|skeleton|>
class Solution:
def __init__(self, head):
"""@param head the linked list's head. Note that the head is guaranteed to be not null,so it contains at least one node. :type head:ListNode"""
<|body_0|>
def getRandom(self):
"""returns a random node's values. :rtype:int"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, head):
"""@param head the linked list's head. Note that the head is guaranteed to be not null,so it contains at least one node. :type head:ListNode"""
self.node = head
self.lens = 0
while head:
self.lens += 1
head = head.next... | the_stack_v2_python_sparse | 382-Linked List Random Node.py | heruohan/Algorithm-Problem | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.