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
95ccbca9ab4511ef0d7eb02966dfdef1d11030fb
[ "res = []\nif not root:\n return []\nqueue = [root]\nwhile queue:\n n = len(queue)\n i = 0\n while i < n:\n node = queue.pop(0)\n if node:\n node_val = node.val\n res.append(str(node_val))\n queue.append(node.left)\n queue.append(node.right)\n ...
<|body_start_0|> res = [] if not root: return [] queue = [root] while queue: n = len(queue) i = 0 while i < n: node = queue.pop(0) if node: node_val = node.val res.appe...
My own bfs solution after optimization; similar to https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度分析 时间复杂度:O(n) 空间复杂度:O(n)
Codec3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec3: """My own bfs solution after optimization; similar to https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度分析 时间复杂度:O(n) 空间复杂度:O(n)""" def serialize(self, root): """Encodes a tree to a single st...
stack_v2_sparse_classes_36k_train_009500
7,655
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec3` described below. Class description: My own bfs solution after optimization; similar to https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度分析 时间复杂度:O(n) 空间复杂度:O(n) Method signatures and docstrings: -...
Implement the Python class `Codec3` described below. Class description: My own bfs solution after optimization; similar to https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度分析 时间复杂度:O(n) 空间复杂度:O(n) Method signatures and docstrings: -...
3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6
<|skeleton|> class Codec3: """My own bfs solution after optimization; similar to https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度分析 时间复杂度:O(n) 空间复杂度:O(n)""" def serialize(self, root): """Encodes a tree to a single st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec3: """My own bfs solution after optimization; similar to https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/solution/shou-hui-tu-jie-gei-chu-dfshe-bfsliang-chong-jie-f/ 复杂度分析 时间复杂度:O(n) 空间复杂度:O(n)""" def serialize(self, root): """Encodes a tree to a single string. :type r...
the_stack_v2_python_sparse
Serialize_and_Deserialize_Binary_Tree_297.py
jay6413682/Leetcode
train
0
a9dce177d3cd3af959eb9335d171e07a4e86adef
[ "self._engine = create_engine('sqlite:///a.db')\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", "n_user = User(email=emai...
<|body_start_0|> self._engine = create_engine('sqlite:///a.db') 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._engine) ...
Data Base with SQLAlchemy
DB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DB: """Data Base with SQLAlchemy""" def __init__(self): """auto call""" <|body_0|> def _session(self): """Create session""" <|body_1|> def add_user(self, email: str, hashed_password: str) -> User: """Add a user instance to the session DB""" ...
stack_v2_sparse_classes_36k_train_009501
1,908
no_license
[ { "docstring": "auto call", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create session", "name": "_session", "signature": "def _session(self)" }, { "docstring": "Add a user instance to the session DB", "name": "add_user", "signature": "def add...
5
stack_v2_sparse_classes_30k_train_002814
Implement the Python class `DB` described below. Class description: Data Base with SQLAlchemy Method signatures and docstrings: - def __init__(self): auto call - def _session(self): Create session - def add_user(self, email: str, hashed_password: str) -> User: Add a user instance to the session DB - def find_user_by(...
Implement the Python class `DB` described below. Class description: Data Base with SQLAlchemy Method signatures and docstrings: - def __init__(self): auto call - def _session(self): Create session - def add_user(self, email: str, hashed_password: str) -> User: Add a user instance to the session DB - def find_user_by(...
251d28c9b555096c61a7112ada43dc65576d03c5
<|skeleton|> class DB: """Data Base with SQLAlchemy""" def __init__(self): """auto call""" <|body_0|> def _session(self): """Create session""" <|body_1|> def add_user(self, email: str, hashed_password: str) -> User: """Add a user instance to the session DB""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DB: """Data Base with SQLAlchemy""" def __init__(self): """auto call""" self._engine = create_engine('sqlite:///a.db') Base.metadata.drop_all(self._engine) Base.metadata.create_all(self._engine) self.__session = None def _session(self): """Create sessi...
the_stack_v2_python_sparse
0x08-user_authentication_service/db.py
dgquintero/holbertonschool-web_back_end
train
0
af8fb2d9920cd62d2588263f6da3699b5709dc9d
[ "rs1 = FinanceAction.test_org_getOrgs()\nAssertion.verity(json.loads(rs1)['code'], 'F2000')\nAssertion.verity(json.loads(rs1)['message'], '请求成功')", "rs1 = FinanceAction.test_org_getCurrentOrgs()\nAssertion.verity(json.loads(rs1)['code'], 'F2000')\nAssertion.verity(json.loads(rs1)['message'], '请求成功')\nglobal org_i...
<|body_start_0|> rs1 = FinanceAction.test_org_getOrgs() Assertion.verity(json.loads(rs1)['code'], 'F2000') Assertion.verity(json.loads(rs1)['message'], '请求成功') <|end_body_0|> <|body_start_1|> rs1 = FinanceAction.test_org_getCurrentOrgs() Assertion.verity(json.loads(rs1)['code'],...
test_002_Finance_org
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_002_Finance_org: def test_001_org_getOrgs(self): """Time :2019-06-18 author : 罗林 desc :获取当前用户能操作的组织机构""" <|body_0|> def test_002_org_getCurrentOrgs(self): """Time :2019-04-03 author : 罗林 desc :获取当前用户能操作的组织机构""" <|body_1|> def test_003_org_addOrg(sel...
stack_v2_sparse_classes_36k_train_009502
4,090
no_license
[ { "docstring": "Time :2019-06-18 author : 罗林 desc :获取当前用户能操作的组织机构", "name": "test_001_org_getOrgs", "signature": "def test_001_org_getOrgs(self)" }, { "docstring": "Time :2019-04-03 author : 罗林 desc :获取当前用户能操作的组织机构", "name": "test_002_org_getCurrentOrgs", "signature": "def test_002_org_g...
6
null
Implement the Python class `test_002_Finance_org` described below. Class description: Implement the test_002_Finance_org class. Method signatures and docstrings: - def test_001_org_getOrgs(self): Time :2019-06-18 author : 罗林 desc :获取当前用户能操作的组织机构 - def test_002_org_getCurrentOrgs(self): Time :2019-04-03 author : 罗林 de...
Implement the Python class `test_002_Finance_org` described below. Class description: Implement the test_002_Finance_org class. Method signatures and docstrings: - def test_001_org_getOrgs(self): Time :2019-06-18 author : 罗林 desc :获取当前用户能操作的组织机构 - def test_002_org_getCurrentOrgs(self): Time :2019-04-03 author : 罗林 de...
028c9f7fe0d321db2af7f1cb936c403194db850c
<|skeleton|> class test_002_Finance_org: def test_001_org_getOrgs(self): """Time :2019-06-18 author : 罗林 desc :获取当前用户能操作的组织机构""" <|body_0|> def test_002_org_getCurrentOrgs(self): """Time :2019-04-03 author : 罗林 desc :获取当前用户能操作的组织机构""" <|body_1|> def test_003_org_addOrg(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_002_Finance_org: def test_001_org_getOrgs(self): """Time :2019-06-18 author : 罗林 desc :获取当前用户能操作的组织机构""" rs1 = FinanceAction.test_org_getOrgs() Assertion.verity(json.loads(rs1)['code'], 'F2000') Assertion.verity(json.loads(rs1)['message'], '请求成功') def test_002_org_get...
the_stack_v2_python_sparse
api-test/finance/test2/test_002_Finance_org.py
RomySaber/api-test
train
0
4b59a9503e216f4df438d2e045ae4309881b8321
[ "self._uenv = uenv\nif sys.version_info[0] >= 3:\n self._keys = list(uenv.env.keys())\nelse:\n self._keys = uenv.env.keys()\nself._index = 0", "if self._index < len(self._keys):\n key = self._keys[self._index]\n value = self._uenv.env[key]\n self._index += 1\n return (key, value)\nraise StopIter...
<|body_start_0|> self._uenv = uenv if sys.version_info[0] >= 3: self._keys = list(uenv.env.keys()) else: self._keys = uenv.env.keys() self._index = 0 <|end_body_0|> <|body_start_1|> if self._index < len(self._keys): key = self._keys[self._inde...
Uenv Iterator class
UenvIterator
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UenvIterator: """Uenv Iterator class""" def __init__(self, uenv): """Init Uenv iterator""" <|body_0|> def __next__(self): """Python 3 next (key, value) of environment""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._uenv = uenv if s...
stack_v2_sparse_classes_36k_train_009503
4,104
permissive
[ { "docstring": "Init Uenv iterator", "name": "__init__", "signature": "def __init__(self, uenv)" }, { "docstring": "Python 3 next (key, value) of environment", "name": "__next__", "signature": "def __next__(self)" } ]
2
stack_v2_sparse_classes_30k_train_011788
Implement the Python class `UenvIterator` described below. Class description: Uenv Iterator class Method signatures and docstrings: - def __init__(self, uenv): Init Uenv iterator - def __next__(self): Python 3 next (key, value) of environment
Implement the Python class `UenvIterator` described below. Class description: Uenv Iterator class Method signatures and docstrings: - def __init__(self, uenv): Init Uenv iterator - def __next__(self): Python 3 next (key, value) of environment <|skeleton|> class UenvIterator: """Uenv Iterator class""" def __...
f50104a4ee9c83af207a2de1aef46e2f1ec67379
<|skeleton|> class UenvIterator: """Uenv Iterator class""" def __init__(self, uenv): """Init Uenv iterator""" <|body_0|> def __next__(self): """Python 3 next (key, value) of environment""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UenvIterator: """Uenv Iterator class""" def __init__(self, uenv): """Init Uenv iterator""" self._uenv = uenv if sys.version_info[0] >= 3: self._keys = list(uenv.env.keys()) else: self._keys = uenv.env.keys() self._index = 0 def __next__...
the_stack_v2_python_sparse
udocker/utils/uenv.py
indigo-dc/udocker
train
1,121
5e5131fc36127519aac6e979c4c37d66a168b8d9
[ "candidate_plant = None\nplants = self.filter(last_seen=day_date, partner_short_name=partner_name, include=True)\nif len(plants) > 0:\n candidate_plant = plants[0]\nelif day_date > date.today():\n candidate_plant = None\nelse:\n plants = self.filter(last_seen__isnull=True, partner_short_name=partner_name, ...
<|body_start_0|> candidate_plant = None plants = self.filter(last_seen=day_date, partner_short_name=partner_name, include=True) if len(plants) > 0: candidate_plant = plants[0] elif day_date > date.today(): candidate_plant = None else: plants = ...
Custom model manager for getting Plant of the Day records by date.
PlantOfTheDayManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlantOfTheDayManager: """Custom model manager for getting Plant of the Day records by date.""" def _pick_candidate_plant(self, day_date, partner_name): """Pick a candidate Plant of the Day for a given day and partner.""" <|body_0|> def for_day(self, day_date, partner_nam...
stack_v2_sparse_classes_36k_train_009504
5,522
no_license
[ { "docstring": "Pick a candidate Plant of the Day for a given day and partner.", "name": "_pick_candidate_plant", "signature": "def _pick_candidate_plant(self, day_date, partner_name)" }, { "docstring": "Return the Plant of the Day for a given day and partner site.", "name": "for_day", "...
2
stack_v2_sparse_classes_30k_train_009891
Implement the Python class `PlantOfTheDayManager` described below. Class description: Custom model manager for getting Plant of the Day records by date. Method signatures and docstrings: - def _pick_candidate_plant(self, day_date, partner_name): Pick a candidate Plant of the Day for a given day and partner. - def for...
Implement the Python class `PlantOfTheDayManager` described below. Class description: Custom model manager for getting Plant of the Day records by date. Method signatures and docstrings: - def _pick_candidate_plant(self, day_date, partner_name): Pick a candidate Plant of the Day for a given day and partner. - def for...
9030d08b9a1b8bdb0f897c6e482c09ef78cc4d3d
<|skeleton|> class PlantOfTheDayManager: """Custom model manager for getting Plant of the Day records by date.""" def _pick_candidate_plant(self, day_date, partner_name): """Pick a candidate Plant of the Day for a given day and partner.""" <|body_0|> def for_day(self, day_date, partner_nam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlantOfTheDayManager: """Custom model manager for getting Plant of the Day records by date.""" def _pick_candidate_plant(self, day_date, partner_name): """Pick a candidate Plant of the Day for a given day and partner.""" candidate_plant = None plants = self.filter(last_seen=day_da...
the_stack_v2_python_sparse
gobotany/plantoftheday/models.py
newfs/gobotany-app
train
10
27fe09b7cb917c800936f92418e336a711280fa4
[ "if not is_all(eids):\n gidx = gidx.edge_subgraph([eids], True).graph\nif norm_by == 'src':\n gidx = gidx.reverse()\nu_len = gidx.number_of_ntypes()\ne_len = gidx.number_of_etypes()\nlhs = [None] * u_len\nfeats = tuple(lhs + list(score))\nscore_max = _gspmm_hetero(gidx, 'copy_rhs', 'max', u_len, feats)[0]\nou...
<|body_start_0|> if not is_all(eids): gidx = gidx.edge_subgraph([eids], True).graph if norm_by == 'src': gidx = gidx.reverse() u_len = gidx.number_of_ntypes() e_len = gidx.number_of_etypes() lhs = [None] * u_len feats = tuple(lhs + list(score)) ...
EdgeSoftmax_hetero
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdgeSoftmax_hetero: def forward(ctx, gidx, eids, norm_by, *score): """Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type ...
stack_v2_sparse_classes_36k_train_009505
40,333
permissive
[ { "docstring": "Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type dgl.NData out = score / score_sum # edge_div_dst, ret dgl.EData return out.dat...
2
stack_v2_sparse_classes_30k_val_000255
Implement the Python class `EdgeSoftmax_hetero` described below. Class description: Implement the EdgeSoftmax_hetero class. Method signatures and docstrings: - def forward(ctx, gidx, eids, norm_by, *score): Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of ty...
Implement the Python class `EdgeSoftmax_hetero` described below. Class description: Implement the EdgeSoftmax_hetero class. Method signatures and docstrings: - def forward(ctx, gidx, eids, norm_by, *score): Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of ty...
bbc8ff6261f2e0d2b5982e992b6fbe545e2a4aa1
<|skeleton|> class EdgeSoftmax_hetero: def forward(ctx, gidx, eids, norm_by, *score): """Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EdgeSoftmax_hetero: def forward(ctx, gidx, eids, norm_by, *score): """Forward function. Pseudo-code: .. code:: python score = dgl.EData(g, score) score_max = score.dst_max() # of type dgl.NData score = score - score_max # edge_sub_dst, ret dgl.EData score_sum = score.dst_sum() # of type dgl.NData out ...
the_stack_v2_python_sparse
python/dgl/backend/pytorch/sparse.py
dmlc/dgl
train
12,631
929aa653d83a342be327f24bcc2350f5c6d9b74e
[ "try:\n timestamp = self._ReadStructureFromByteStream(registry_value, 0, self._GetDataTypeMap('filetime'))\nexcept (ValueError, errors.ParseError) as exception:\n raise errors.ParseError('Unable to parse timestamp with error: {0!s}'.format(exception))\nreturn timestamp", "sid_keys = registry_key.GetSubkeys(...
<|body_start_0|> try: timestamp = self._ReadStructureFromByteStream(registry_value, 0, self._GetDataTypeMap('filetime')) except (ValueError, errors.ParseError) as exception: raise errors.ParseError('Unable to parse timestamp with error: {0!s}'.format(exception)) return ti...
Background Activity Moderator data Windows Registry plugin.
BackgroundActivityModeratorWindowsRegistryPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackgroundActivityModeratorWindowsRegistryPlugin: """Background Activity Moderator data Windows Registry plugin.""" def _ParseValue(self, registry_value): """Parses the registry value. Args: registry_value (bytes): value data. Returns: int: timestamp. Raises: ParseError: if the value...
stack_v2_sparse_classes_36k_train_009506
3,373
permissive
[ { "docstring": "Parses the registry value. Args: registry_value (bytes): value data. Returns: int: timestamp. Raises: ParseError: if the value data could not be parsed.", "name": "_ParseValue", "signature": "def _ParseValue(self, registry_value)" }, { "docstring": "Extracts events from a Windows...
2
null
Implement the Python class `BackgroundActivityModeratorWindowsRegistryPlugin` described below. Class description: Background Activity Moderator data Windows Registry plugin. Method signatures and docstrings: - def _ParseValue(self, registry_value): Parses the registry value. Args: registry_value (bytes): value data. ...
Implement the Python class `BackgroundActivityModeratorWindowsRegistryPlugin` described below. Class description: Background Activity Moderator data Windows Registry plugin. Method signatures and docstrings: - def _ParseValue(self, registry_value): Parses the registry value. Args: registry_value (bytes): value data. ...
c69b2952b608cfce47ff8fd0d1409d856be35cb1
<|skeleton|> class BackgroundActivityModeratorWindowsRegistryPlugin: """Background Activity Moderator data Windows Registry plugin.""" def _ParseValue(self, registry_value): """Parses the registry value. Args: registry_value (bytes): value data. Returns: int: timestamp. Raises: ParseError: if the value...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackgroundActivityModeratorWindowsRegistryPlugin: """Background Activity Moderator data Windows Registry plugin.""" def _ParseValue(self, registry_value): """Parses the registry value. Args: registry_value (bytes): value data. Returns: int: timestamp. Raises: ParseError: if the value data could n...
the_stack_v2_python_sparse
plaso/parsers/winreg_plugins/bam.py
cyb3rfox/plaso
train
3
3e98ba37830e772e36162804798aab579d129bd4
[ "super().__init__()\nself.autoscaleX1d = False\nself.x1dMinimum = 0\nself.x1dMaximum = 1000\nself.autoscaleY1d = False\nself.y1dMinimum = 0\nself.y1dMaximum = 1000\nself.numWaterfallBins = 25\nself.waterfallColorMap = 'viridis'", "self.autoscaleX1d = config['xPSD']['autoscaleY']\nself.x1dMaximum = config['xPSD'][...
<|body_start_0|> super().__init__() self.autoscaleX1d = False self.x1dMinimum = 0 self.x1dMaximum = 1000 self.autoscaleY1d = False self.y1dMinimum = 0 self.y1dMaximum = 1000 self.numWaterfallBins = 25 self.waterfallColorMap = 'viridis' <|end_body_0...
Class that handles the configuration of the Power Spectrum Distribution plots (1D and waterfall). Attributes ---------- autoscaleX1d : bool Set autoscaling on the x component 1D PSD plot. autoscaleY1d : bool Set autoscaling on the y component 1D PSD plot. numWaterfallBins : int Set the number of vertical bins for the w...
PsdPlotConfig
[ "Python-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PsdPlotConfig: """Class that handles the configuration of the Power Spectrum Distribution plots (1D and waterfall). Attributes ---------- autoscaleX1d : bool Set autoscaling on the x component 1D PSD plot. autoscaleY1d : bool Set autoscaling on the y component 1D PSD plot. numWaterfallBins : int ...
stack_v2_sparse_classes_36k_train_009507
3,094
permissive
[ { "docstring": "Initialize the class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Translate config to class attributes. Parameters ---------- config : dict The configuration to translate.", "name": "fromDict", "signature": "def fromDict(self, config)" }, ...
3
null
Implement the Python class `PsdPlotConfig` described below. Class description: Class that handles the configuration of the Power Spectrum Distribution plots (1D and waterfall). Attributes ---------- autoscaleX1d : bool Set autoscaling on the x component 1D PSD plot. autoscaleY1d : bool Set autoscaling on the y compone...
Implement the Python class `PsdPlotConfig` described below. Class description: Class that handles the configuration of the Power Spectrum Distribution plots (1D and waterfall). Attributes ---------- autoscaleX1d : bool Set autoscaling on the x component 1D PSD plot. autoscaleY1d : bool Set autoscaling on the y compone...
3d0242276198126240667ba13e95b7bdf901d053
<|skeleton|> class PsdPlotConfig: """Class that handles the configuration of the Power Spectrum Distribution plots (1D and waterfall). Attributes ---------- autoscaleX1d : bool Set autoscaling on the x component 1D PSD plot. autoscaleY1d : bool Set autoscaling on the y component 1D PSD plot. numWaterfallBins : int ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PsdPlotConfig: """Class that handles the configuration of the Power Spectrum Distribution plots (1D and waterfall). Attributes ---------- autoscaleX1d : bool Set autoscaling on the x component 1D PSD plot. autoscaleY1d : bool Set autoscaling on the y component 1D PSD plot. numWaterfallBins : int Set the numbe...
the_stack_v2_python_sparse
spot_motion_monitor/config/psd_plot_config.py
lsst-sitcom/spot_motion_monitor
train
0
3be0d40650a73f873ef70a5d6e8b73caeed5895b
[ "fun = f(x)\nnrow, ncol = x.shape\ngrad_ = np.ones([nrow, ncol])\nfor i in range(ncol):\n for j in range(nrow):\n x1 = x.copy()\n x1[j, i] = x1[j, i] + delta\n grad_[j, i] = f(x1)\ngrad_ = (grad_ - fun) / delta\nreturn grad_", "fun = f(x)\nnrow = x.shape[0]\nhess_ = np.ones([nrow, nrow])\n...
<|body_start_0|> fun = f(x) nrow, ncol = x.shape grad_ = np.ones([nrow, ncol]) for i in range(ncol): for j in range(nrow): x1 = x.copy() x1[j, i] = x1[j, i] + delta grad_[j, i] = f(x1) grad_ = (grad_ - fun) / delta ...
optimize
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class optimize: def grad(self, f, x, delta): """Desc: Get gradient vector of function f in x0 Parameters: f: A function x: A columns vector representing vector of x delta: A float indicating delta of x Return: A vector containing partial derivatives of each elements formula: df(x)/dx = (f(x+h)...
stack_v2_sparse_classes_36k_train_009508
4,270
no_license
[ { "docstring": "Desc: Get gradient vector of function f in x0 Parameters: f: A function x: A columns vector representing vector of x delta: A float indicating delta of x Return: A vector containing partial derivatives of each elements formula: df(x)/dx = (f(x+h) - f(x))/h 当h很小时,约等于导数", "name": "grad", "...
4
stack_v2_sparse_classes_30k_train_000355
Implement the Python class `optimize` described below. Class description: Implement the optimize class. Method signatures and docstrings: - def grad(self, f, x, delta): Desc: Get gradient vector of function f in x0 Parameters: f: A function x: A columns vector representing vector of x delta: A float indicating delta ...
Implement the Python class `optimize` described below. Class description: Implement the optimize class. Method signatures and docstrings: - def grad(self, f, x, delta): Desc: Get gradient vector of function f in x0 Parameters: f: A function x: A columns vector representing vector of x delta: A float indicating delta ...
20fa401fedb3b92cee6cae8e9f5a4f096f811b53
<|skeleton|> class optimize: def grad(self, f, x, delta): """Desc: Get gradient vector of function f in x0 Parameters: f: A function x: A columns vector representing vector of x delta: A float indicating delta of x Return: A vector containing partial derivatives of each elements formula: df(x)/dx = (f(x+h)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class optimize: def grad(self, f, x, delta): """Desc: Get gradient vector of function f in x0 Parameters: f: A function x: A columns vector representing vector of x delta: A float indicating delta of x Return: A vector containing partial derivatives of each elements formula: df(x)/dx = (f(x+h) - f(x))/h 当h很...
the_stack_v2_python_sparse
core/optim.py
bboyGit/statsLearning
train
6
4173cc006c8bc9e487f596880e64ced68cbefd5d
[ "histories = instance.audit.history.all().order_by('history_date')\nhistory_line = '<table><tr><th>Date and Time</th><th>Field</th><th>Changed From</th><th>Changed To</th><th>User</th></tr>'\nfor new_record, old_record in self._get_history_pairs(histories):\n if new_record:\n delta = new_record.diff_again...
<|body_start_0|> histories = instance.audit.history.all().order_by('history_date') history_line = '<table><tr><th>Date and Time</th><th>Field</th><th>Changed From</th><th>Changed To</th><th>User</th></tr>' for new_record, old_record in self._get_history_pairs(histories): if new_recor...
MessageAdmin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageAdmin: def get_history(self, instance): """Returns an html representation of the MessageAudit's history. Not every change is important date_processed is a change but doesn't give anymore information than is revealed by the Date and Time column. :param instance: MessageAudit :retur...
stack_v2_sparse_classes_36k_train_009509
7,321
permissive
[ { "docstring": "Returns an html representation of the MessageAudit's history. Not every change is important date_processed is a change but doesn't give anymore information than is revealed by the Date and Time column. :param instance: MessageAudit :return: SafeString", "name": "get_history", "signature"...
2
stack_v2_sparse_classes_30k_train_010172
Implement the Python class `MessageAdmin` described below. Class description: Implement the MessageAdmin class. Method signatures and docstrings: - def get_history(self, instance): Returns an html representation of the MessageAudit's history. Not every change is important date_processed is a change but doesn't give a...
Implement the Python class `MessageAdmin` described below. Class description: Implement the MessageAdmin class. Method signatures and docstrings: - def get_history(self, instance): Returns an html representation of the MessageAudit's history. Not every change is important date_processed is a change but doesn't give a...
7fc2c179f1baee85c4b95cdf64a2d5d690d2482e
<|skeleton|> class MessageAdmin: def get_history(self, instance): """Returns an html representation of the MessageAudit's history. Not every change is important date_processed is a change but doesn't give anymore information than is revealed by the Date and Time column. :param instance: MessageAudit :retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageAdmin: def get_history(self, instance): """Returns an html representation of the MessageAudit's history. Not every change is important date_processed is a change but doesn't give anymore information than is revealed by the Date and Time column. :param instance: MessageAudit :return: SafeString"...
the_stack_v2_python_sparse
core/admin.py
StateArchivesOfNorthCarolina/ratom-server
train
2
33dd6597dc36645bf9b6f23b878c80d4f009ee67
[ "super().__init__()\nself._uniform_generator = uniform_generator\nself._tied_generator = tied_generator\nself._tied_embeddings = tied_embeddings\nself._disallow_correct = disallow_correct\nself._temperature = temperature\nself._gumbel_eps = gumbel_eps\nself._dtype = dtype\nself.disc_cfg = disc_cfg\nself.vocab_size ...
<|body_start_0|> super().__init__() self._uniform_generator = uniform_generator self._tied_generator = tied_generator self._tied_embeddings = tied_embeddings self._disallow_correct = disallow_correct self._temperature = temperature self._gumbel_eps = gumbel_eps ...
An integrated model combined with a generator and a discriminator. Generator here produces a corrupted tokens playing as fake data to fool a discriminator whose objective is to distinguish whether each token in the input sentence it accepts is the same as the original. It is a classification task instead of prediction ...
ElectraForPretrain
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectraForPretrain: """An integrated model combined with a generator and a discriminator. Generator here produces a corrupted tokens playing as fake data to fool a discriminator whose objective is to distinguish whether each token in the input sentence it accepts is the same as the original. It i...
stack_v2_sparse_classes_36k_train_009510
45,388
permissive
[ { "docstring": "Parameters ---------- disc_cfg : Config for discriminator model including scaled size for generator uniform_generator : Wether to get a generator with uniform weights, the mlm_scores from which are totally random. In this case , a discriminator learns from a random 15% of the input tokens distin...
3
null
Implement the Python class `ElectraForPretrain` described below. Class description: An integrated model combined with a generator and a discriminator. Generator here produces a corrupted tokens playing as fake data to fool a discriminator whose objective is to distinguish whether each token in the input sentence it ac...
Implement the Python class `ElectraForPretrain` described below. Class description: An integrated model combined with a generator and a discriminator. Generator here produces a corrupted tokens playing as fake data to fool a discriminator whose objective is to distinguish whether each token in the input sentence it ac...
1df42c561ae9552960e3f8b5f22e74de812a29c6
<|skeleton|> class ElectraForPretrain: """An integrated model combined with a generator and a discriminator. Generator here produces a corrupted tokens playing as fake data to fool a discriminator whose objective is to distinguish whether each token in the input sentence it accepts is the same as the original. It i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElectraForPretrain: """An integrated model combined with a generator and a discriminator. Generator here produces a corrupted tokens playing as fake data to fool a discriminator whose objective is to distinguish whether each token in the input sentence it accepts is the same as the original. It is a classific...
the_stack_v2_python_sparse
src/gluonnlp/models/electra.py
akshatgui/gluon-nlp
train
0
72e31d633b11055db9dbb8a030d45ec3dd004408
[ "super(Response, self).__init__(None, True)\nself.name = str(name)\nself.description = str(description)", "try:\n if 'name' in kwargs:\n self.name = str(kwargs['name'])\n if 'description' in kwargs:\n self.description = str(kwargs['description'])\nexcept Exception as e:\n raise e" ]
<|body_start_0|> super(Response, self).__init__(None, True) self.name = str(name) self.description = str(description) <|end_body_0|> <|body_start_1|> try: if 'name' in kwargs: self.name = str(kwargs['name']) if 'description' in kwargs: ...
Response
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Response: def __init__(self, name, description=''): """Initiate parent class Response. Attributes ---------- name : str the name of the response description : str the description of the response""" <|body_0|> def edit(self, **kwargs): """Allow edition of name and des...
stack_v2_sparse_classes_36k_train_009511
4,739
no_license
[ { "docstring": "Initiate parent class Response. Attributes ---------- name : str the name of the response description : str the description of the response", "name": "__init__", "signature": "def __init__(self, name, description='')" }, { "docstring": "Allow edition of name and description.", ...
2
stack_v2_sparse_classes_30k_train_019119
Implement the Python class `Response` described below. Class description: Implement the Response class. Method signatures and docstrings: - def __init__(self, name, description=''): Initiate parent class Response. Attributes ---------- name : str the name of the response description : str the description of the respo...
Implement the Python class `Response` described below. Class description: Implement the Response class. Method signatures and docstrings: - def __init__(self, name, description=''): Initiate parent class Response. Attributes ---------- name : str the name of the response description : str the description of the respo...
1429b795366b2fd326f9144ba4190ac87bff6dac
<|skeleton|> class Response: def __init__(self, name, description=''): """Initiate parent class Response. Attributes ---------- name : str the name of the response description : str the description of the response""" <|body_0|> def edit(self, **kwargs): """Allow edition of name and des...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Response: def __init__(self, name, description=''): """Initiate parent class Response. Attributes ---------- name : str the name of the response description : str the description of the response""" super(Response, self).__init__(None, True) self.name = str(name) self.descriptio...
the_stack_v2_python_sparse
curVersion/optkit/workflow/response.py
zhangyuchao23/MT_optimizer
train
0
516575087f346c3e20e5b85c5951c96540254f49
[ "instr2 = self.rm.open_resource(str(self.rname))\ninstr3 = self.rm.open_resource(str(self.rname))\nkey = self.instr.lock()\ninstr2.lock(requested_key=key)\nassert self.instr.query('*IDN?')\nassert instr2.query('*IDN?')\nwith pytest.raises(errors.VisaIOError):\n instr3.query('*IDN?')\nwith instr3.lock_context(req...
<|body_start_0|> instr2 = self.rm.open_resource(str(self.rname)) instr3 = self.rm.open_resource(str(self.rname)) key = self.instr.lock() instr2.lock(requested_key=key) assert self.instr.query('*IDN?') assert instr2.query('*IDN?') with pytest.raises(errors.VisaIOEr...
Mixing for message based resources supporting locking.
LockableMessagedBasedResourceTestCaseMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockableMessagedBasedResourceTestCaseMixin: """Mixing for message based resources supporting locking.""" def test_shared_locking(self): """Test locking/unlocking a resource.""" <|body_0|> def test_exclusive_locking(self): """Test locking/unlocking a resource.""" ...
stack_v2_sparse_classes_36k_train_009512
34,742
permissive
[ { "docstring": "Test locking/unlocking a resource.", "name": "test_shared_locking", "signature": "def test_shared_locking(self)" }, { "docstring": "Test locking/unlocking a resource.", "name": "test_exclusive_locking", "signature": "def test_exclusive_locking(self)" } ]
2
stack_v2_sparse_classes_30k_train_016930
Implement the Python class `LockableMessagedBasedResourceTestCaseMixin` described below. Class description: Mixing for message based resources supporting locking. Method signatures and docstrings: - def test_shared_locking(self): Test locking/unlocking a resource. - def test_exclusive_locking(self): Test locking/unlo...
Implement the Python class `LockableMessagedBasedResourceTestCaseMixin` described below. Class description: Mixing for message based resources supporting locking. Method signatures and docstrings: - def test_shared_locking(self): Test locking/unlocking a resource. - def test_exclusive_locking(self): Test locking/unlo...
071fa6d5a8e7703f1b38d4c0b0cccd0952a5972f
<|skeleton|> class LockableMessagedBasedResourceTestCaseMixin: """Mixing for message based resources supporting locking.""" def test_shared_locking(self): """Test locking/unlocking a resource.""" <|body_0|> def test_exclusive_locking(self): """Test locking/unlocking a resource.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockableMessagedBasedResourceTestCaseMixin: """Mixing for message based resources supporting locking.""" def test_shared_locking(self): """Test locking/unlocking a resource.""" instr2 = self.rm.open_resource(str(self.rname)) instr3 = self.rm.open_resource(str(self.rname)) ...
the_stack_v2_python_sparse
pyvisa/testsuite/keysight_assisted_tests/messagebased_resource_utils.py
pyvisa/pyvisa
train
543
e3fabc37457a8961945bd6e373ac2c9f6ed0c5c7
[ "self.__filename = filename\nself.__inline = inline\nself.inline_start = '<!--'\nself.inline_end = '-->'\nself.link_format = '<!-- %s -->'", "if self.__inline == LINK:\n return self.link_format % self.__filename + '\\n'\nelse:\n try:\n text = '<!-- Inline content from ' + self.__filename + ' -->\\n'\...
<|body_start_0|> self.__filename = filename self.__inline = inline self.inline_start = '<!--' self.inline_end = '-->' self.link_format = '<!-- %s -->' <|end_body_0|> <|body_start_1|> if self.__inline == LINK: return self.link_format % self.__filename + '\n' ...
External file reference Use this as a base class for referencing external files that can be linked or inlined within the document.
ExternalFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalFile: """External file reference Use this as a base class for referencing external files that can be linked or inlined within the document.""" def __init__(self, filename, inline): """Initialise the ExternalFile object Subclasses should invoke this and then override the 'inli...
stack_v2_sparse_classes_36k_train_009513
45,525
permissive
[ { "docstring": "Initialise the ExternalFile object Subclasses should invoke this and then override the 'inline_start' and 'inline_end' attributes (text that is printed before and after inline content) and the 'link_format' attribute (a format string which should contain a %s placeholder into which the filename ...
2
null
Implement the Python class `ExternalFile` described below. Class description: External file reference Use this as a base class for referencing external files that can be linked or inlined within the document. Method signatures and docstrings: - def __init__(self, filename, inline): Initialise the ExternalFile object ...
Implement the Python class `ExternalFile` described below. Class description: External file reference Use this as a base class for referencing external files that can be linked or inlined within the document. Method signatures and docstrings: - def __init__(self, filename, inline): Initialise the ExternalFile object ...
77d66c719b5746f37af51ad593e2941ed6fbba17
<|skeleton|> class ExternalFile: """External file reference Use this as a base class for referencing external files that can be linked or inlined within the document.""" def __init__(self, filename, inline): """Initialise the ExternalFile object Subclasses should invoke this and then override the 'inli...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternalFile: """External file reference Use this as a base class for referencing external files that can be linked or inlined within the document.""" def __init__(self, filename, inline): """Initialise the ExternalFile object Subclasses should invoke this and then override the 'inline_start' and...
the_stack_v2_python_sparse
modules/xia2/Modules/Xia2html/Canary.py
jorgediazjr/dials-dev20191018
train
0
cfa6330606b58bd22cade80d7c4b893927d94067
[ "self.num_v = num_v\nself.level = [0] * num_v\nself.graph = [[] for _ in range(num_v)]", "forward = Edge(v, cap, len(self.graph[v]))\nback = Edge(u, 0, len(self.graph[u]))\nself.graph[u].append(forward)\nself.graph[v].append(back)", "self.level = [-1] * self.num_v\nself.level[s] = 0\nq = Queue()\nq.enqueue(s)\n...
<|body_start_0|> self.num_v = num_v self.level = [0] * num_v self.graph = [[] for _ in range(num_v)] <|end_body_0|> <|body_start_1|> forward = Edge(v, cap, len(self.graph[v])) back = Edge(u, 0, len(self.graph[u])) self.graph[u].append(forward) self.graph[v].appen...
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: def __init__(self, num_v: int): """:param num_v: number of vertex""" <|body_0|> def add_edge(self, u: int, v: int, cap: int): """add edge :param u: from :param v: to :param cap: capacity""" <|body_1|> def __bfs(self, s: int, t: int) -> bool: ...
stack_v2_sparse_classes_36k_train_009514
4,451
no_license
[ { "docstring": ":param num_v: number of vertex", "name": "__init__", "signature": "def __init__(self, num_v: int)" }, { "docstring": "add edge :param u: from :param v: to :param cap: capacity", "name": "add_edge", "signature": "def add_edge(self, u: int, v: int, cap: int)" }, { "...
5
stack_v2_sparse_classes_30k_train_017703
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self, num_v: int): :param num_v: number of vertex - def add_edge(self, u: int, v: int, cap: int): add edge :param u: from :param v: to :param cap: capacity - def __bfs(sel...
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self, num_v: int): :param num_v: number of vertex - def add_edge(self, u: int, v: int, cap: int): add edge :param u: from :param v: to :param cap: capacity - def __bfs(sel...
879d0e43e3fac0aadc4d772dc57374ae72571fe6
<|skeleton|> class Graph: def __init__(self, num_v: int): """:param num_v: number of vertex""" <|body_0|> def add_edge(self, u: int, v: int, cap: int): """add edge :param u: from :param v: to :param cap: capacity""" <|body_1|> def __bfs(self, s: int, t: int) -> bool: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: def __init__(self, num_v: int): """:param num_v: number of vertex""" self.num_v = num_v self.level = [0] * num_v self.graph = [[] for _ in range(num_v)] def add_edge(self, u: int, v: int, cap: int): """add edge :param u: from :param v: to :param cap: capacit...
the_stack_v2_python_sparse
beginner/010/D.py
cry999/AtCoder
train
0
3374a531aa2cfe6ed74982eddff281bc7f23fbfe
[ "super().__init__(name, env, location)\nself.classical_routing_table = {}\nself.quantum_routing_table = {}\nrouting = QKDRouting(f'QKDRouting_{self.name}')\nself.protocol_stack.build(routing)\nself.load_protocol(self.protocol_stack)", "key_gen_proto = super().set_key_generation(peer, **kwargs)\nif key_gen_proto i...
<|body_start_0|> super().__init__(name, env, location) self.classical_routing_table = {} self.quantum_routing_table = {} routing = QKDRouting(f'QKDRouting_{self.name}') self.protocol_stack.build(routing) self.load_protocol(self.protocol_stack) <|end_body_0|> <|body_start...
Class for the simulation of a trusted repeater node. Attributes: classical_routing_table (Dict[Node, Node]): classical routing table the trusted repeater holds quantum_routing_table (Dict[Node, Node]): quantum routing table the trusted repeater holds
TrustedRepeaterNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrustedRepeaterNode: """Class for the simulation of a trusted repeater node. Attributes: classical_routing_table (Dict[Node, Node]): classical routing table the trusted repeater holds quantum_routing_table (Dict[Node, Node]): quantum routing table the trusted repeater holds""" def __init__(s...
stack_v2_sparse_classes_36k_train_009515
13,868
permissive
[ { "docstring": "Constructor for TrustedRepeaterNode class. Args: name (str): name of the trusted repeater env (DESEnv): related discrete-event simulation environment location (Tuple): geographical location of the trusted repeater", "name": "__init__", "signature": "def __init__(self, name: str, env=None...
2
null
Implement the Python class `TrustedRepeaterNode` described below. Class description: Class for the simulation of a trusted repeater node. Attributes: classical_routing_table (Dict[Node, Node]): classical routing table the trusted repeater holds quantum_routing_table (Dict[Node, Node]): quantum routing table the truste...
Implement the Python class `TrustedRepeaterNode` described below. Class description: Class for the simulation of a trusted repeater node. Attributes: classical_routing_table (Dict[Node, Node]): classical routing table the trusted repeater holds quantum_routing_table (Dict[Node, Node]): quantum routing table the truste...
8bc3c7238b5b6825eb63ded8d65afb08b389941f
<|skeleton|> class TrustedRepeaterNode: """Class for the simulation of a trusted repeater node. Attributes: classical_routing_table (Dict[Node, Node]): classical routing table the trusted repeater holds quantum_routing_table (Dict[Node, Node]): quantum routing table the trusted repeater holds""" def __init__(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrustedRepeaterNode: """Class for the simulation of a trusted repeater node. Attributes: classical_routing_table (Dict[Node, Node]): classical routing table the trusted repeater holds quantum_routing_table (Dict[Node, Node]): quantum routing table the trusted repeater holds""" def __init__(self, name: st...
the_stack_v2_python_sparse
Extensions/QuantumNetwork/qcompute_qnet/models/qkd/node.py
baidu/QCompute
train
86
81ab3825e7542001974c3fdf03ce105bec001aff
[ "name = rule['name']\nif not 'data' in rule or not rule['data'] or (not isinstance(rule['data'], str)):\n err = 'invalid data field for rule %s' % name\n TermColor.Error(err)\n raise Error(err)\ndata_path = rule['data']\nif not os.path.exists(data_path):\n err = 'data path does NOT exist: %s' % data_pat...
<|body_start_0|> name = rule['name'] if not 'data' in rule or not rule['data'] or (not isinstance(rule['data'], str)): err = 'invalid data field for rule %s' % name TermColor.Error(err) raise Error(err) data_path = rule['data'] if not os.path.exists(da...
PkgRules
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PkgRules: def make_package(cls, rule): """@override""" <|body_0|> def _extract_basename(cls, path): """Returns the basename of the path""" <|body_1|> def _write_control_yaml(cls, name, data_path, workingdir): """Writes the yaml for the control sc...
stack_v2_sparse_classes_36k_train_009516
3,558
permissive
[ { "docstring": "@override", "name": "make_package", "signature": "def make_package(cls, rule)" }, { "docstring": "Returns the basename of the path", "name": "_extract_basename", "signature": "def _extract_basename(cls, path)" }, { "docstring": "Writes the yaml for the control scr...
3
null
Implement the Python class `PkgRules` described below. Class description: Implement the PkgRules class. Method signatures and docstrings: - def make_package(cls, rule): @override - def _extract_basename(cls, path): Returns the basename of the path - def _write_control_yaml(cls, name, data_path, workingdir): Writes th...
Implement the Python class `PkgRules` described below. Class description: Implement the PkgRules class. Method signatures and docstrings: - def make_package(cls, rule): @override - def _extract_basename(cls, path): Returns the basename of the path - def _write_control_yaml(cls, name, data_path, workingdir): Writes th...
70280110ec342a6f6db1c102e96756fcc3c3c01b
<|skeleton|> class PkgRules: def make_package(cls, rule): """@override""" <|body_0|> def _extract_basename(cls, path): """Returns the basename of the path""" <|body_1|> def _write_control_yaml(cls, name, data_path, workingdir): """Writes the yaml for the control sc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PkgRules: def make_package(cls, rule): """@override""" name = rule['name'] if not 'data' in rule or not rule['data'] or (not isinstance(rule['data'], str)): err = 'invalid data field for rule %s' % name TermColor.Error(err) raise Error(err) d...
the_stack_v2_python_sparse
pylib/mps/packager/pkg_rules.py
room77/py77
train
0
249349012227fdd072a102dafc935680d2d2e0c9
[ "handler = format_handler.FormatHandler(pecan.request.security_context)\nraw_format = handler.get(format_name)\nif not raw_format:\n core.abort(404, '%s is not a format resource' % format_name)\nhost_url = pecan.request.application_url.rstrip('/')\nreturn raw_format.fix_uris(host_url)", "host_url = pecan.reque...
<|body_start_0|> handler = format_handler.FormatHandler(pecan.request.security_context) raw_format = handler.get(format_name) if not raw_format: core.abort(404, '%s is not a format resource' % format_name) host_url = pecan.request.application_url.rstrip('/') return ra...
Manages operations on CAMP's formats resource.
FormatsController
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatsController: """Manages operations on CAMP's formats resource.""" def get_one(self, format_name): """Return the appropriate format resource.""" <|body_0|> def get(self): """Return the formats resource.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_009517
2,405
permissive
[ { "docstring": "Return the appropriate format resource.", "name": "get_one", "signature": "def get_one(self, format_name)" }, { "docstring": "Return the formats resource.", "name": "get", "signature": "def get(self)" } ]
2
null
Implement the Python class `FormatsController` described below. Class description: Manages operations on CAMP's formats resource. Method signatures and docstrings: - def get_one(self, format_name): Return the appropriate format resource. - def get(self): Return the formats resource.
Implement the Python class `FormatsController` described below. Class description: Manages operations on CAMP's formats resource. Method signatures and docstrings: - def get_one(self, format_name): Return the appropriate format resource. - def get(self): Return the formats resource. <|skeleton|> class FormatsControl...
7077d1f602031dace92916f14e36b124f474de15
<|skeleton|> class FormatsController: """Manages operations on CAMP's formats resource.""" def get_one(self, format_name): """Return the appropriate format resource.""" <|body_0|> def get(self): """Return the formats resource.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormatsController: """Manages operations on CAMP's formats resource.""" def get_one(self, format_name): """Return the appropriate format resource.""" handler = format_handler.FormatHandler(pecan.request.security_context) raw_format = handler.get(format_name) if not raw_for...
the_stack_v2_python_sparse
solum-6.0.0/solum/api/controllers/camp/v1_1/formats.py
scottwedge/OpenStack-Stein
train
0
f108b7014ce5bdd688cb09064b24ca8f36ee7574
[ "for i in DAO.todos[0]:\n if i['id'] == id:\n return i\nreturn Api.abort(404)", "res, todos = DAO.delete(id)\nif res['message'] == 'No todo present!':\n return ('', 406)\nelse:\n return ('', 204)", "print(id, api.payload)\nres = DAO.update(id, api.payload)\nif res == 'Failure':\n Api.abort(40...
<|body_start_0|> for i in DAO.todos[0]: if i['id'] == id: return i return Api.abort(404) <|end_body_0|> <|body_start_1|> res, todos = DAO.delete(id) if res['message'] == 'No todo present!': return ('', 406) else: return ('', 20...
Show a single todo item and lets you delete them
TodoAdd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TodoAdd: """Show a single todo item and lets you delete them""" def get(self, id): """Fetch a given resource""" <|body_0|> def delete(self, id): """Delete a task given its identifier""" <|body_1|> def put(self, id): """Update a task given its...
stack_v2_sparse_classes_36k_train_009518
5,030
no_license
[ { "docstring": "Fetch a given resource", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Delete a task given its identifier", "name": "delete", "signature": "def delete(self, id)" }, { "docstring": "Update a task given its identifier", "name": "put", "s...
3
stack_v2_sparse_classes_30k_train_000009
Implement the Python class `TodoAdd` described below. Class description: Show a single todo item and lets you delete them Method signatures and docstrings: - def get(self, id): Fetch a given resource - def delete(self, id): Delete a task given its identifier - def put(self, id): Update a task given its identifier
Implement the Python class `TodoAdd` described below. Class description: Show a single todo item and lets you delete them Method signatures and docstrings: - def get(self, id): Fetch a given resource - def delete(self, id): Delete a task given its identifier - def put(self, id): Update a task given its identifier <|...
9556423a93f39af3208b48f8841f1722a9ceb3df
<|skeleton|> class TodoAdd: """Show a single todo item and lets you delete them""" def get(self, id): """Fetch a given resource""" <|body_0|> def delete(self, id): """Delete a task given its identifier""" <|body_1|> def put(self, id): """Update a task given its...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TodoAdd: """Show a single todo item and lets you delete them""" def get(self, id): """Fetch a given resource""" for i in DAO.todos[0]: if i['id'] == id: return i return Api.abort(404) def delete(self, id): """Delete a task given its identif...
the_stack_v2_python_sparse
app.py
lokeshn011101/TODO-backend
train
0
2b9c10bb38dc33c14dc98a09d9a1f6248ce03461
[ "n = len(nums)\nself.dp = [0] * n\nfor i in range(len(nums)):\n if i == 0:\n self.dp[i] = nums[i]\n else:\n self.dp[i] = self.dp[i - 1] + nums[i]", "if i != 0:\n return self.dp[j] - self.dp[i - 1]\nelse:\n return self.dp[j]" ]
<|body_start_0|> n = len(nums) self.dp = [0] * n for i in range(len(nums)): if i == 0: self.dp[i] = nums[i] else: self.dp[i] = self.dp[i - 1] + nums[i] <|end_body_0|> <|body_start_1|> if i != 0: return self.dp[j] - self...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) self.dp = [0] * n for i in ra...
stack_v2_sparse_classes_36k_train_009519
1,359
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_test_001016
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
e4c02084f26384cedbd87c4c60e9bdfbf77228cc
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" n = len(nums) self.dp = [0] * n for i in range(len(nums)): if i == 0: self.dp[i] = nums[i] else: self.dp[i] = self.dp[i - 1] + nums[i] def sumRange(self,...
the_stack_v2_python_sparse
Dynamic Programming/303. Range Sum Query - Immutable Easy.py
dongbo910220/leetcode_
train
0
952285a1e4b540700db6b28055fcb686b15938a5
[ "raster_path = os.path.join(TESTDATA_DIR, raster_name)\npath_exists = os.path.isfile(raster_path)\nself.assertTrue(path_exists, msg=raster_path)\nreturn raster_path", "selection_data = get_json_testdata(filename='test_cm_input_no_count.json')\nselection = selection_data['selection']\nraster = self.get_raster_path...
<|body_start_0|> raster_path = os.path.join(TESTDATA_DIR, raster_name) path_exists = os.path.isfile(raster_path) self.assertTrue(path_exists, msg=raster_path) return raster_path <|end_body_0|> <|body_start_1|> selection_data = get_json_testdata(filename='test_cm_input_no_count.j...
TestSelectionValidation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSelectionValidation: def get_raster_path(self, raster_name: str): """Returns the path to the raster file based on the raster name.""" <|body_0|> def testNoCountDetected(self): """Check the validity for selection without any count.""" <|body_1|> def t...
stack_v2_sparse_classes_36k_train_009520
3,351
permissive
[ { "docstring": "Returns the path to the raster file based on the raster name.", "name": "get_raster_path", "signature": "def get_raster_path(self, raster_name: str)" }, { "docstring": "Check the validity for selection without any count.", "name": "testNoCountDetected", "signature": "def ...
4
null
Implement the Python class `TestSelectionValidation` described below. Class description: Implement the TestSelectionValidation class. Method signatures and docstrings: - def get_raster_path(self, raster_name: str): Returns the path to the raster file based on the raster name. - def testNoCountDetected(self): Check th...
Implement the Python class `TestSelectionValidation` described below. Class description: Implement the TestSelectionValidation class. Method signatures and docstrings: - def get_raster_path(self, raster_name: str): Returns the path to the raster file based on the raster name. - def testNoCountDetected(self): Check th...
bb336e434afcc11463b53880558d9c314f309c0e
<|skeleton|> class TestSelectionValidation: def get_raster_path(self, raster_name: str): """Returns the path to the raster file based on the raster name.""" <|body_0|> def testNoCountDetected(self): """Check the validity for selection without any count.""" <|body_1|> def t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSelectionValidation: def get_raster_path(self, raster_name: str): """Returns the path to the raster file based on the raster name.""" raster_path = os.path.join(TESTDATA_DIR, raster_name) path_exists = os.path.isfile(raster_path) self.assertTrue(path_exists, msg=raster_path...
the_stack_v2_python_sparse
cm/base/BaseCM/test.py
sfrias/enermaps
train
0
2311290fd8070f98bd2bc73422fff66f816e7eb4
[ "if not await self._is_allowed_to_send_to_support(MetaSlugs.EMAIL_SUPPORT_HOT_WALLET_BALANCE_LACK):\n logging.info('Skipped message sending to support')\n return None\nawait Email().support_hot_wallet_balance_lack(**kwargs)\nawait self._update_sent_at(MetaSlugs.EMAIL_SUPPORT_HOT_WALLET_BALANCE_LACK)\nreturn",...
<|body_start_0|> if not await self._is_allowed_to_send_to_support(MetaSlugs.EMAIL_SUPPORT_HOT_WALLET_BALANCE_LACK): logging.info('Skipped message sending to support') return None await Email().support_hot_wallet_balance_lack(**kwargs) await self._update_sent_at(MetaSlugs....
SupportNotifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupportNotifier: async def hot_wallet_balance_lack(self, **kwargs) -> None: """Checks if email can be send and sends it :return:""" <|body_0|> async def invoice_stucked(self, **kwargs) -> None: """Checks if email can be send and sends it :return:""" <|body_1|...
stack_v2_sparse_classes_36k_train_009521
2,208
no_license
[ { "docstring": "Checks if email can be send and sends it :return:", "name": "hot_wallet_balance_lack", "signature": "async def hot_wallet_balance_lack(self, **kwargs) -> None" }, { "docstring": "Checks if email can be send and sends it :return:", "name": "invoice_stucked", "signature": "...
2
null
Implement the Python class `SupportNotifier` described below. Class description: Implement the SupportNotifier class. Method signatures and docstrings: - async def hot_wallet_balance_lack(self, **kwargs) -> None: Checks if email can be send and sends it :return: - async def invoice_stucked(self, **kwargs) -> None: Ch...
Implement the Python class `SupportNotifier` described below. Class description: Implement the SupportNotifier class. Method signatures and docstrings: - async def hot_wallet_balance_lack(self, **kwargs) -> None: Checks if email can be send and sends it :return: - async def invoice_stucked(self, **kwargs) -> None: Ch...
d07682c2a3071dcf5045d3781876f8d81cb24775
<|skeleton|> class SupportNotifier: async def hot_wallet_balance_lack(self, **kwargs) -> None: """Checks if email can be send and sends it :return:""" <|body_0|> async def invoice_stucked(self, **kwargs) -> None: """Checks if email can be send and sends it :return:""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupportNotifier: async def hot_wallet_balance_lack(self, **kwargs) -> None: """Checks if email can be send and sends it :return:""" if not await self._is_allowed_to_send_to_support(MetaSlugs.EMAIL_SUPPORT_HOT_WALLET_BALANCE_LACK): logging.info('Skipped message sending to support') ...
the_stack_v2_python_sparse
backend/core/mechanics/notifier/notifier.py
amosov00/simba
train
0
a4f6933d8a31c561a887a4a696b1f3a3c72d1fe6
[ "result = []\nfor config in pipeline_config:\n if isinstance(config, str):\n config = {config: {}}\n assert isinstance(config, dict)\n assert len(config) == 1\n annotator_type, config = next(iter(config.items()))\n if not isinstance(config, dict):\n assert isinstance(config, str)\n ...
<|body_start_0|> result = [] for config in pipeline_config: if isinstance(config, str): config = {config: {}} assert isinstance(config, dict) assert len(config) == 1 annotator_type, config = next(iter(config.items())) if not isi...
Parser for annotation configuration.
AnnotationConfigParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnotationConfigParser: """Parser for annotation configuration.""" def normalize(pipeline_config: List[Any]) -> List[Dict]: """Return a normalized annotation pipeline configuration.""" <|body_0|> def parse_raw(pipeline_raw_config: Optional[list[dict[str, Any]]]) -> list[...
stack_v2_sparse_classes_36k_train_009522
14,846
permissive
[ { "docstring": "Return a normalized annotation pipeline configuration.", "name": "normalize", "signature": "def normalize(pipeline_config: List[Any]) -> List[Dict]" }, { "docstring": "Parse raw dictionary annotation pipeline configuration.", "name": "parse_raw", "signature": "def parse_r...
6
stack_v2_sparse_classes_30k_test_000821
Implement the Python class `AnnotationConfigParser` described below. Class description: Parser for annotation configuration. Method signatures and docstrings: - def normalize(pipeline_config: List[Any]) -> List[Dict]: Return a normalized annotation pipeline configuration. - def parse_raw(pipeline_raw_config: Optional...
Implement the Python class `AnnotationConfigParser` described below. Class description: Parser for annotation configuration. Method signatures and docstrings: - def normalize(pipeline_config: List[Any]) -> List[Dict]: Return a normalized annotation pipeline configuration. - def parse_raw(pipeline_raw_config: Optional...
21c8d4d32f632431704556f8bcb158f9bb686239
<|skeleton|> class AnnotationConfigParser: """Parser for annotation configuration.""" def normalize(pipeline_config: List[Any]) -> List[Dict]: """Return a normalized annotation pipeline configuration.""" <|body_0|> def parse_raw(pipeline_raw_config: Optional[list[dict[str, Any]]]) -> list[...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnnotationConfigParser: """Parser for annotation configuration.""" def normalize(pipeline_config: List[Any]) -> List[Dict]: """Return a normalized annotation pipeline configuration.""" result = [] for config in pipeline_config: if isinstance(config, str): ...
the_stack_v2_python_sparse
dae/dae/annotation/annotation_factory.py
iossifovlab/gpf
train
5
070c0c8d1da30a65411c8740ddd2ee6c225de478
[ "if crn is None:\n raise ValueError('crn must be provided')\nif zone_identifier is None:\n raise ValueError('zone_identifier must be provided')\nauthenticator = get_authenticator_from_environment(service_name)\nservice = cls(crn, zone_identifier, authenticator)\nservice.configure_service(service_name)\nreturn...
<|body_start_0|> if crn is None: raise ValueError('crn must be provided') if zone_identifier is None: raise ValueError('zone_identifier must be provided') authenticator = get_authenticator_from_environment(service_name) service = cls(crn, zone_identifier, authenti...
The DNS Record Bulk V1 service.
DnsRecordBulkV1
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DnsRecordBulkV1: """The DNS Record Bulk V1 service.""" def new_instance(cls, crn: str, zone_identifier: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'DnsRecordBulkV1': """Return a new client for the DNS Record Bulk service using the specified parameters and external configuration....
stack_v2_sparse_classes_36k_train_009523
17,557
permissive
[ { "docstring": "Return a new client for the DNS Record Bulk service using the specified parameters and external configuration. :param str crn: Full url-encoded CRN of the service instance. :param str zone_identifier: Identifier of zone.", "name": "new_instance", "signature": "def new_instance(cls, crn: ...
4
stack_v2_sparse_classes_30k_train_011352
Implement the Python class `DnsRecordBulkV1` described below. Class description: The DNS Record Bulk V1 service. Method signatures and docstrings: - def new_instance(cls, crn: str, zone_identifier: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'DnsRecordBulkV1': Return a new client for the DNS Record Bulk service u...
Implement the Python class `DnsRecordBulkV1` described below. Class description: The DNS Record Bulk V1 service. Method signatures and docstrings: - def new_instance(cls, crn: str, zone_identifier: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'DnsRecordBulkV1': Return a new client for the DNS Record Bulk service u...
7eed5185f1e93a57e43d0d7a1e83ee8c708179e0
<|skeleton|> class DnsRecordBulkV1: """The DNS Record Bulk V1 service.""" def new_instance(cls, crn: str, zone_identifier: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'DnsRecordBulkV1': """Return a new client for the DNS Record Bulk service using the specified parameters and external configuration....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DnsRecordBulkV1: """The DNS Record Bulk V1 service.""" def new_instance(cls, crn: str, zone_identifier: str, service_name: str=DEFAULT_SERVICE_NAME) -> 'DnsRecordBulkV1': """Return a new client for the DNS Record Bulk service using the specified parameters and external configuration. :param str c...
the_stack_v2_python_sparse
ibm_cloud_networking_services/dns_record_bulk_v1.py
mauriceDevsM/networking-python-sdk
train
0
8beeb73e99f0a1dfd05b1ea7c5b5402b21e91303
[ "if root is not None:\n self.inOrder(root.left)\n print(root.val)\n self.inOrder(root.right)", "if root is not None:\n print(root.val)\n self.preOrder(root.left)\n self.preOrder(root.right)", "if root is not None:\n self.postOrder(root.left)\n self.postOrder(root.right)\n print(root.v...
<|body_start_0|> if root is not None: self.inOrder(root.left) print(root.val) self.inOrder(root.right) <|end_body_0|> <|body_start_1|> if root is not None: print(root.val) self.preOrder(root.left) self.preOrder(root.right) <|end_bo...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inOrder(self, root): """:param root: :return:""" <|body_0|> def preOrder(self, root): """:param root: :return:""" <|body_1|> def postOrder(self, root): """:param root: :return:""" <|body_2|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_009524
1,407
permissive
[ { "docstring": ":param root: :return:", "name": "inOrder", "signature": "def inOrder(self, root)" }, { "docstring": ":param root: :return:", "name": "preOrder", "signature": "def preOrder(self, root)" }, { "docstring": ":param root: :return:", "name": "postOrder", "signat...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inOrder(self, root): :param root: :return: - def preOrder(self, root): :param root: :return: - def postOrder(self, root): :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inOrder(self, root): :param root: :return: - def preOrder(self, root): :param root: :return: - def postOrder(self, root): :param root: :return: <|skeleton|> class Solution: ...
980af3442afeef459468b381ec3a5505a4275a2e
<|skeleton|> class Solution: def inOrder(self, root): """:param root: :return:""" <|body_0|> def preOrder(self, root): """:param root: :return:""" <|body_1|> def postOrder(self, root): """:param root: :return:""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def inOrder(self, root): """:param root: :return:""" if root is not None: self.inOrder(root.left) print(root.val) self.inOrder(root.right) def preOrder(self, root): """:param root: :return:""" if root is not None: p...
the_stack_v2_python_sparse
TreeTraversals/TreeTraversal.py
anilpai/leetcode
train
0
60eecbc9886dc6e7e022d5c87830e49e1975c31f
[ "self.quark = quark\nself.nucleon = nucleon\nself.ip = input_dict", "if self.nucleon == 'p':\n if self.quark == 'u':\n return self.ip['mu_at_2GeV'] * self.ip['gTu']\n if self.quark == 'd':\n return self.ip['md_at_2GeV'] * self.ip['gTd']\n if self.quark == 's':\n return self.ip['ms_at...
<|body_start_0|> self.quark = quark self.nucleon = nucleon self.ip = input_dict <|end_body_0|> <|body_start_1|> if self.nucleon == 'p': if self.quark == 'u': return self.ip['mu_at_2GeV'] * self.ip['gTu'] if self.quark == 'd': retur...
FT0
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FT0: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictio...
stack_v2_sparse_classes_36k_train_009525
18,337
permissive
[ { "docstring": "The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadronic input parameters (default is Num_input().input_...
2
stack_v2_sparse_classes_30k_train_005831
Implement the Python class `FT0` described below. Class description: Implement the FT0 class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, stra...
Implement the Python class `FT0` described below. Class description: Implement the FT0 class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, stra...
4a714e4701f817fdc96e10e461eef7c4756ef71d
<|skeleton|> class FT0: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FT0: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadron...
the_stack_v2_python_sparse
directdm/num/single_nucleon_form_factors.py
DirectDM/directdm-py
train
6
a36a352da270474bd6d4b4382c58d4ebb4b943a9
[ "if not app.secret_key:\n return None\noptions = {'key_derivation': self.key_derivation, 'digest_method': self.digest_method}\nreturn URLSafeTimedSerializer(app.secret_key, salt=self.salt, serializer=self.serializer, signer_kwargs=options)", "signer = self.get_signing_serializer(app)\nif signer is None:\n r...
<|body_start_0|> if not app.secret_key: return None options = {'key_derivation': self.key_derivation, 'digest_method': self.digest_method} return URLSafeTimedSerializer(app.secret_key, salt=self.salt, serializer=self.serializer, signer_kwargs=options) <|end_body_0|> <|body_start_1|>...
A Session interface that uses cookies as storage. This will store the data on the cookie in plain text, but with a signature to prevent modification.
SecureCookieSessionInterface
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecureCookieSessionInterface: """A Session interface that uses cookies as storage. This will store the data on the cookie in plain text, but with a signature to prevent modification.""" def get_signing_serializer(self, app: 'Quart') -> Optional[URLSafeTimedSerializer]: """Return a se...
stack_v2_sparse_classes_36k_train_009526
10,201
permissive
[ { "docstring": "Return a serializer for the session that also signs data. This will return None if the app is not configured for secrets.", "name": "get_signing_serializer", "signature": "def get_signing_serializer(self, app: 'Quart') -> Optional[URLSafeTimedSerializer]" }, { "docstring": "Open ...
3
stack_v2_sparse_classes_30k_train_004976
Implement the Python class `SecureCookieSessionInterface` described below. Class description: A Session interface that uses cookies as storage. This will store the data on the cookie in plain text, but with a signature to prevent modification. Method signatures and docstrings: - def get_signing_serializer(self, app: ...
Implement the Python class `SecureCookieSessionInterface` described below. Class description: A Session interface that uses cookies as storage. This will store the data on the cookie in plain text, but with a signature to prevent modification. Method signatures and docstrings: - def get_signing_serializer(self, app: ...
536cf22da6f9594fb971ca0955d4e2319c38a225
<|skeleton|> class SecureCookieSessionInterface: """A Session interface that uses cookies as storage. This will store the data on the cookie in plain text, but with a signature to prevent modification.""" def get_signing_serializer(self, app: 'Quart') -> Optional[URLSafeTimedSerializer]: """Return a se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecureCookieSessionInterface: """A Session interface that uses cookies as storage. This will store the data on the cookie in plain text, but with a signature to prevent modification.""" def get_signing_serializer(self, app: 'Quart') -> Optional[URLSafeTimedSerializer]: """Return a serializer for ...
the_stack_v2_python_sparse
src/quart/sessions.py
pgjones/quart
train
10
d29e9d9caa306fa9ecdf502a9a4b7203fdc637e2
[ "self.logger = Log()\nself.logger.info('########################### TestCertification START ###########################')\nconfig = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()\napp_package = config['appPackage_chezhu']\napp_activity = config['appActivity_chezhu']\nself.db = DbOperation...
<|body_start_0|> self.logger = Log() self.logger.info('########################### TestCertification START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() app_package = config['appPackage_chezhu'] app_activity = con...
凯京车主APP 身份认证
TestCertification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCertification: """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" <|body_0|> def tearDown(self): """测试环境重置""" <|body_1|> def test_bvt_certification(self): """身份认证""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.logger...
stack_v2_sparse_classes_36k_train_009527
2,842
no_license
[ { "docstring": "前置条件准备", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "测试环境重置", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "身份认证", "name": "test_bvt_certification", "signature": "def test_bvt_certification(self)" } ]
3
stack_v2_sparse_classes_30k_train_009059
Implement the Python class `TestCertification` described below. Class description: 凯京车主APP 身份认证 Method signatures and docstrings: - def setUp(self): 前置条件准备 - def tearDown(self): 测试环境重置 - def test_bvt_certification(self): 身份认证
Implement the Python class `TestCertification` described below. Class description: 凯京车主APP 身份认证 Method signatures and docstrings: - def setUp(self): 前置条件准备 - def tearDown(self): 测试环境重置 - def test_bvt_certification(self): 身份认证 <|skeleton|> class TestCertification: """凯京车主APP 身份认证""" def setUp(self): ...
4112ee34827a68289ba95a30518c4b1ecf38a3b2
<|skeleton|> class TestCertification: """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" <|body_0|> def tearDown(self): """测试环境重置""" <|body_1|> def test_bvt_certification(self): """身份认证""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCertification: """凯京车主APP 身份认证""" def setUp(self): """前置条件准备""" self.logger = Log() self.logger.info('########################### TestCertification START ###########################') config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue() ...
the_stack_v2_python_sparse
BVT/chezhuAPP/driver_unregister/test_case/test_certification_chezhu.py
penny1205/AppUI
train
0
feb09d1445307d4621d1c5a4fbe2f64530463523
[ "a = re.split('\\\\s+', s)\ni = 0\nj = len(a) - 1\nwhile i < j:\n a[i], a[j] = (a[j], a[i])\n i += 1\n j -= 1\nretval = ' '.join(a)\nreturn retval", "def reverse(a, i, j):\n while i < j:\n a[i], a[j] = (a[j], a[i])\n i += 1\n j -= 1\na = list(s)\ni = 0\nn = len(a)\nwhile i < n:\n ...
<|body_start_0|> a = re.split('\\s+', s) i = 0 j = len(a) - 1 while i < j: a[i], a[j] = (a[j], a[i]) i += 1 j -= 1 retval = ' '.join(a) return retval <|end_body_0|> <|body_start_1|> def reverse(a, i, j): while i < j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse_v1(self, s): """Convert to a word list first. Time is O(n). Space is O(n)""" <|body_0|> def reverse_v2(self, s): """Word reverse followed by a sentence reverse. Time is O(n). Space is O(1).""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_009528
1,941
no_license
[ { "docstring": "Convert to a word list first. Time is O(n). Space is O(n)", "name": "reverse_v1", "signature": "def reverse_v1(self, s)" }, { "docstring": "Word reverse followed by a sentence reverse. Time is O(n). Space is O(1).", "name": "reverse_v2", "signature": "def reverse_v2(self,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_v1(self, s): Convert to a word list first. Time is O(n). Space is O(n) - def reverse_v2(self, s): Word reverse followed by a sentence reverse. Time is O(n). Space is ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_v1(self, s): Convert to a word list first. Time is O(n). Space is O(n) - def reverse_v2(self, s): Word reverse followed by a sentence reverse. Time is O(n). Space is ...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def reverse_v1(self, s): """Convert to a word list first. Time is O(n). Space is O(n)""" <|body_0|> def reverse_v2(self, s): """Word reverse followed by a sentence reverse. Time is O(n). Space is O(1).""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse_v1(self, s): """Convert to a word list first. Time is O(n). Space is O(n)""" a = re.split('\\s+', s) i = 0 j = len(a) - 1 while i < j: a[i], a[j] = (a[j], a[i]) i += 1 j -= 1 retval = ' '.join(a) ...
the_stack_v2_python_sparse
python3/string_array/word_reverse.py
victorchu/algorithms
train
0
d92ab1de6ef77d4b45aa812543a1c7cb896a94a8
[ "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_dataStage02QuantificationAnalysis(data.data)\ndata.clear_data()", "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.update_dataStage02QuantificationAnalysis(data.data)\ndata.clear_data()" ]
<|body_start_0|> data = base_importData() data.read_csv(filename) data.format_data() self.add_dataStage02QuantificationAnalysis(data.data) data.clear_data() <|end_body_0|> <|body_start_1|> data = base_importData() data.read_csv(filename) data.format_data(...
stage02_quantification_analysis_io
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stage02_quantification_analysis_io: def import_dataStage02QuantificationAnalysis_add(self, filename): """table adds""" <|body_0|> def import_dataStage02QuantificationAnalysis_update(self, filename): """table adds""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_009529
1,035
permissive
[ { "docstring": "table adds", "name": "import_dataStage02QuantificationAnalysis_add", "signature": "def import_dataStage02QuantificationAnalysis_add(self, filename)" }, { "docstring": "table adds", "name": "import_dataStage02QuantificationAnalysis_update", "signature": "def import_dataSta...
2
null
Implement the Python class `stage02_quantification_analysis_io` described below. Class description: Implement the stage02_quantification_analysis_io class. Method signatures and docstrings: - def import_dataStage02QuantificationAnalysis_add(self, filename): table adds - def import_dataStage02QuantificationAnalysis_up...
Implement the Python class `stage02_quantification_analysis_io` described below. Class description: Implement the stage02_quantification_analysis_io class. Method signatures and docstrings: - def import_dataStage02QuantificationAnalysis_add(self, filename): table adds - def import_dataStage02QuantificationAnalysis_up...
cb380c01d2425d0db7e305cad8bad2b3fb38cd9d
<|skeleton|> class stage02_quantification_analysis_io: def import_dataStage02QuantificationAnalysis_add(self, filename): """table adds""" <|body_0|> def import_dataStage02QuantificationAnalysis_update(self, filename): """table adds""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stage02_quantification_analysis_io: def import_dataStage02QuantificationAnalysis_add(self, filename): """table adds""" data = base_importData() data.read_csv(filename) data.format_data() self.add_dataStage02QuantificationAnalysis(data.data) data.clear_data() ...
the_stack_v2_python_sparse
SBaaS_statistics/stage02_quantification_analysis_io.py
dmccloskey/SBaaS_statistics
train
0
301bd3655edc5ec124668013961399884400fc42
[ "Model.__init__(self, model_path, device, extensions, threshold)\nself.model_name = 'Head Pose Estimation Model'\nself.input_name = next(iter(self.model.inputs))\nself.input_shape = self.model.inputs[self.input_name].shape\nself.output_name = next(iter(self.model.outputs))\nself.output_shape = self.model.outputs[se...
<|body_start_0|> Model.__init__(self, model_path, device, extensions, threshold) self.model_name = 'Head Pose Estimation Model' self.input_name = next(iter(self.model.inputs)) self.input_shape = self.model.inputs[self.input_name].shape self.output_name = next(iter(self.model.outp...
This is a class for the operation of Head Pose Estimation Model
HeadPoseEstimationModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeadPoseEstimationModel: """This is a class for the operation of Head Pose Estimation Model""" def __init__(self, model_path, device='CPU', extensions=None, threshold=0.6): """This will initiate Head Pose Estimation Model class object""" <|body_0|> def predict(self, imag...
stack_v2_sparse_classes_36k_train_009530
2,056
no_license
[ { "docstring": "This will initiate Head Pose Estimation Model class object", "name": "__init__", "signature": "def __init__(self, model_path, device='CPU', extensions=None, threshold=0.6)" }, { "docstring": "This method will take image as a input and does all the preprocessing, postprocessing", ...
3
stack_v2_sparse_classes_30k_train_011181
Implement the Python class `HeadPoseEstimationModel` described below. Class description: This is a class for the operation of Head Pose Estimation Model Method signatures and docstrings: - def __init__(self, model_path, device='CPU', extensions=None, threshold=0.6): This will initiate Head Pose Estimation Model class...
Implement the Python class `HeadPoseEstimationModel` described below. Class description: This is a class for the operation of Head Pose Estimation Model Method signatures and docstrings: - def __init__(self, model_path, device='CPU', extensions=None, threshold=0.6): This will initiate Head Pose Estimation Model class...
b51d64d7d8f94684395bfb04eed6b7eb111ba98e
<|skeleton|> class HeadPoseEstimationModel: """This is a class for the operation of Head Pose Estimation Model""" def __init__(self, model_path, device='CPU', extensions=None, threshold=0.6): """This will initiate Head Pose Estimation Model class object""" <|body_0|> def predict(self, imag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeadPoseEstimationModel: """This is a class for the operation of Head Pose Estimation Model""" def __init__(self, model_path, device='CPU', extensions=None, threshold=0.6): """This will initiate Head Pose Estimation Model class object""" Model.__init__(self, model_path, device, extensions...
the_stack_v2_python_sparse
project/Bhadresh Savani/src/head_pose_estimation_model.py
dinaAbdelrahman/MicrosoftML-ProjectShowcasing
train
1
9becb4a634b1e7fabd5aa329cb7572f5456e5b19
[ "self.filename = filename\nself.sheetname = sheetname\nself.data_list = []\nself.wb = load_workbook(self.filename)\nself.ws = self.wb[sheetname] if sheetname != '' else self.wb.active\nself.max_col = max_col\nself.data_header = tuple(self.ws.iter_rows(max_row=1, max_col=self.max_col, values_only=True))[0]\nself.Cas...
<|body_start_0|> self.filename = filename self.sheetname = sheetname self.data_list = [] self.wb = load_workbook(self.filename) self.ws = self.wb[sheetname] if sheetname != '' else self.wb.active self.max_col = max_col self.data_header = tuple(self.ws.iter_rows(ma...
封装读写excel的操作
ExcelHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExcelHandler: """封装读写excel的操作""" def __init__(self, filename, sheetname='', max_col=do_config('excel', 'max_column')): """初始化 :param filename: excel文件路径名 :param sheetname: 需要定位的表单名 :param max_col: 读取的最大列数(扣除待写的列)""" <|body_0|> def write_excel(self, row, *data_tuple): ...
stack_v2_sparse_classes_36k_train_009531
3,767
permissive
[ { "docstring": "初始化 :param filename: excel文件路径名 :param sheetname: 需要定位的表单名 :param max_col: 读取的最大列数(扣除待写的列)", "name": "__init__", "signature": "def __init__(self, filename, sheetname='', max_col=do_config('excel', 'max_column'))" }, { "docstring": "写入excel :param row: 单元格的行号 int :param data_tuple...
3
stack_v2_sparse_classes_30k_train_005425
Implement the Python class `ExcelHandler` described below. Class description: 封装读写excel的操作 Method signatures and docstrings: - def __init__(self, filename, sheetname='', max_col=do_config('excel', 'max_column')): 初始化 :param filename: excel文件路径名 :param sheetname: 需要定位的表单名 :param max_col: 读取的最大列数(扣除待写的列) - def write_ex...
Implement the Python class `ExcelHandler` described below. Class description: 封装读写excel的操作 Method signatures and docstrings: - def __init__(self, filename, sheetname='', max_col=do_config('excel', 'max_column')): 初始化 :param filename: excel文件路径名 :param sheetname: 需要定位的表单名 :param max_col: 读取的最大列数(扣除待写的列) - def write_ex...
8ed884d0e0cb0dac14e26856be19a9a341bef0c0
<|skeleton|> class ExcelHandler: """封装读写excel的操作""" def __init__(self, filename, sheetname='', max_col=do_config('excel', 'max_column')): """初始化 :param filename: excel文件路径名 :param sheetname: 需要定位的表单名 :param max_col: 读取的最大列数(扣除待写的列)""" <|body_0|> def write_excel(self, row, *data_tuple): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExcelHandler: """封装读写excel的操作""" def __init__(self, filename, sheetname='', max_col=do_config('excel', 'max_column')): """初始化 :param filename: excel文件路径名 :param sheetname: 需要定位的表单名 :param max_col: 读取的最大列数(扣除待写的列)""" self.filename = filename self.sheetname = sheetname self....
the_stack_v2_python_sparse
TestMaster/scripts/excelhandler.py
allblue2025/learn_git
train
0
ae282fea0f16f0670d5f5cc9e90ba07afdfc8623
[ "def count(root):\n if not root:\n return 0\n return count(root.left) + count(root.right) + 1\nsizeOfLSubtree = count(root.left)\nif sizeOfLSubtree == k - 1:\n return root.val\nelif sizeOfLSubtree < k - 1:\n return self.kthSmallest(root.right, k - sizeOfLSubtree - 1)\nelse:\n return self.kthSm...
<|body_start_0|> def count(root): if not root: return 0 return count(root.left) + count(root.right) + 1 sizeOfLSubtree = count(root.left) if sizeOfLSubtree == k - 1: return root.val elif sizeOfLSubtree < k - 1: return self.k...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> def kthSmallest(self, root, k): """:type root:...
stack_v2_sparse_classes_36k_train_009532
2,367
no_license
[ { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, root, k)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: int", "name": "kthSmallest", "signature": "def kthSmallest(self, root, k)" }, { "docst...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthSmallest(se...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthSmallest(self, root, k): :type root: TreeNode :type k: int :rtype: int - def kthSmallest(se...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_0|> def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" <|body_1|> def kthSmallest(self, root, k): """:type root:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest(self, root, k): """:type root: TreeNode :type k: int :rtype: int""" def count(root): if not root: return 0 return count(root.left) + count(root.right) + 1 sizeOfLSubtree = count(root.left) if sizeOfLSubtree == k ...
the_stack_v2_python_sparse
Python_leetcode/230_kth_smallest_in_BST.py
xiangcao/Leetcode
train
0
e7d919c3a46bcc166181f9232d37f477209c23d9
[ "if board == [] or board == [[]]:\n return\nwidth = len(board[0])\nheight = len(board)\ni = 0\nwhile i < width:\n if board[0][i] == 'O':\n self.combine_node(0, i, width, height, board)\n if board[height - 1][i] == 'O':\n self.combine_node(height - 1, i, width, height, board)\n i += 1\nj = ...
<|body_start_0|> if board == [] or board == [[]]: return width = len(board[0]) height = len(board) i = 0 while i < width: if board[0][i] == 'O': self.combine_node(0, i, width, height, board) if board[height - 1][i] == 'O': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solve(self, board): """:type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead.""" <|body_0|> def combine_node(self, row, column, width, height, board): """:type row: int :type column: int :type width: int :type h...
stack_v2_sparse_classes_36k_train_009533
2,714
no_license
[ { "docstring": ":type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead.", "name": "solve", "signature": "def solve(self, board)" }, { "docstring": ":type row: int :type column: int :type width: int :type height: int :type board: List[List[str]] dfs", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solve(self, board): :type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead. - def combine_node(self, row, column, width, height, boar...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solve(self, board): :type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead. - def combine_node(self, row, column, width, height, boar...
f832227c4d0e0b1c0cc326561187004ef24e2a68
<|skeleton|> class Solution: def solve(self, board): """:type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead.""" <|body_0|> def combine_node(self, row, column, width, height, board): """:type row: int :type column: int :type width: int :type h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def solve(self, board): """:type board: List[List[str]] :rtype: void Do not return anything, modify board in-place instead.""" if board == [] or board == [[]]: return width = len(board[0]) height = len(board) i = 0 while i < width: ...
the_stack_v2_python_sparse
130.py
Gackle/leetcode_practice
train
0
3bd69ed6e03f6bcdc0d9e51131c5bbbb42fd79be
[ "source = yaml.get('source', None)\nself.source: Optional[SourceName] = None if source is None else SourceName(source)\nself.remote: Optional[str] = yaml.get('remote', None)", "yaml = {}\nif self.remote is not None:\n yaml['remote'] = self.remote\nif self.source is not None:\n yaml['source'] = self.source\n...
<|body_start_0|> source = yaml.get('source', None) self.source: Optional[SourceName] = None if source is None else SourceName(source) self.remote: Optional[str] = yaml.get('remote', None) <|end_body_0|> <|body_start_1|> yaml = {} if self.remote is not None: yaml['rem...
clowder yaml UpstreamDefaults model class :ivar Optional[SourceName] source: Default source name :ivar Optional[str] remote: Default remote name
UpstreamDefaults
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpstreamDefaults: """clowder yaml UpstreamDefaults model class :ivar Optional[SourceName] source: Default source name :ivar Optional[str] remote: Default remote name""" def __init__(self, yaml: dict): """Defaults __init__ :param dict yaml: Parsed YAML python object for upstream defau...
stack_v2_sparse_classes_36k_train_009534
1,046
permissive
[ { "docstring": "Defaults __init__ :param dict yaml: Parsed YAML python object for upstream defaults", "name": "__init__", "signature": "def __init__(self, yaml: dict)" }, { "docstring": "Return python object representation for saving yaml :return: YAML python object", "name": "get_yaml", ...
2
stack_v2_sparse_classes_30k_train_017898
Implement the Python class `UpstreamDefaults` described below. Class description: clowder yaml UpstreamDefaults model class :ivar Optional[SourceName] source: Default source name :ivar Optional[str] remote: Default remote name Method signatures and docstrings: - def __init__(self, yaml: dict): Defaults __init__ :para...
Implement the Python class `UpstreamDefaults` described below. Class description: clowder yaml UpstreamDefaults model class :ivar Optional[SourceName] source: Default source name :ivar Optional[str] remote: Default remote name Method signatures and docstrings: - def __init__(self, yaml: dict): Defaults __init__ :para...
1438fc8b1bb7379de66142ffcb0e20b459b59159
<|skeleton|> class UpstreamDefaults: """clowder yaml UpstreamDefaults model class :ivar Optional[SourceName] source: Default source name :ivar Optional[str] remote: Default remote name""" def __init__(self, yaml: dict): """Defaults __init__ :param dict yaml: Parsed YAML python object for upstream defau...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpstreamDefaults: """clowder yaml UpstreamDefaults model class :ivar Optional[SourceName] source: Default source name :ivar Optional[str] remote: Default remote name""" def __init__(self, yaml: dict): """Defaults __init__ :param dict yaml: Parsed YAML python object for upstream defaults""" ...
the_stack_v2_python_sparse
clowder/model/upstream_defaults.py
JrGoodle/clowder
train
17
b967848bf311d91733393b1b88c1569a112e579f
[ "event = events.ProblemInteraction({})\nevent.set_data_attr('correctness', 'incorrect')\nself.assertEqual(0, event.get_success())\nevent.set_data_attr('correctness', 'correct')\nself.assertEqual(1, event.get_success())\nevent.set_data_attr('correctness', 'incomplete')\nself.assertEqual(-1, event.get_success())", ...
<|body_start_0|> event = events.ProblemInteraction({}) event.set_data_attr('correctness', 'incorrect') self.assertEqual(0, event.get_success()) event.set_data_attr('correctness', 'correct') self.assertEqual(1, event.get_success()) event.set_data_attr('correctness', 'incom...
Tester for the ProblemInteraction subclass
ProblemInteractionTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemInteractionTest: """Tester for the ProblemInteraction subclass""" def test_get_success(self): """Check complete coverage for all supported correctness values""" <|body_0|> def test_get_is_submitted(self): """Check complete coverage for all supported event ...
stack_v2_sparse_classes_36k_train_009535
16,264
permissive
[ { "docstring": "Check complete coverage for all supported correctness values", "name": "test_get_success", "signature": "def test_get_success(self)" }, { "docstring": "Check complete coverage for all supported event types mapping to submission statuses.", "name": "test_get_is_submitted", ...
4
null
Implement the Python class `ProblemInteractionTest` described below. Class description: Tester for the ProblemInteraction subclass Method signatures and docstrings: - def test_get_success(self): Check complete coverage for all supported correctness values - def test_get_is_submitted(self): Check complete coverage for...
Implement the Python class `ProblemInteractionTest` described below. Class description: Tester for the ProblemInteraction subclass Method signatures and docstrings: - def test_get_success(self): Check complete coverage for all supported correctness values - def test_get_is_submitted(self): Check complete coverage for...
ad5ae27476c1dc02b1a06d2d90d4c8b7ada97c02
<|skeleton|> class ProblemInteractionTest: """Tester for the ProblemInteraction subclass""" def test_get_success(self): """Check complete coverage for all supported correctness values""" <|body_0|> def test_get_is_submitted(self): """Check complete coverage for all supported event ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProblemInteractionTest: """Tester for the ProblemInteraction subclass""" def test_get_success(self): """Check complete coverage for all supported correctness values""" event = events.ProblemInteraction({}) event.set_data_attr('correctness', 'incorrect') self.assertEqual(0,...
the_stack_v2_python_sparse
edx_pipe/qpipe/events_test.py
johnding1996/MOOC-Learner-Curated
train
0
530c3caf382aea00d488095b7433da047e1bf838
[ "home_page = login[1]\nprofile_page = login[3]\nhome_page.select_menu(menu='settings')\nprofile_page.add_worker(name, phone, department)\nactual = profile_page.get_add_text()\nprint('expect:{},actual:{}'.format(expect, actual))\nassert expect in actual, '添加成功, 断言失败'", "profile_page = login[3]\nprofile_page.add_wo...
<|body_start_0|> home_page = login[1] profile_page = login[3] home_page.select_menu(menu='settings') profile_page.add_worker(name, phone, department) actual = profile_page.get_add_text() print('expect:{},actual:{}'.format(expect, actual)) assert expect in actual, ...
添加业务员
TestAddworker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAddworker: """添加业务员""" def test_a_add_success(self, login, refresh_page, name, phone, department, expect): """验证添加业务员""" <|body_0|> def test_b_add_fail(self, login, refresh_page, name, phone, department, expect): """验证添加业务员唯一""" <|body_1|> def te...
stack_v2_sparse_classes_36k_train_009536
2,739
no_license
[ { "docstring": "验证添加业务员", "name": "test_a_add_success", "signature": "def test_a_add_success(self, login, refresh_page, name, phone, department, expect)" }, { "docstring": "验证添加业务员唯一", "name": "test_b_add_fail", "signature": "def test_b_add_fail(self, login, refresh_page, name, phone, de...
4
stack_v2_sparse_classes_30k_train_002055
Implement the Python class `TestAddworker` described below. Class description: 添加业务员 Method signatures and docstrings: - def test_a_add_success(self, login, refresh_page, name, phone, department, expect): 验证添加业务员 - def test_b_add_fail(self, login, refresh_page, name, phone, department, expect): 验证添加业务员唯一 - def test_c...
Implement the Python class `TestAddworker` described below. Class description: 添加业务员 Method signatures and docstrings: - def test_a_add_success(self, login, refresh_page, name, phone, department, expect): 验证添加业务员 - def test_b_add_fail(self, login, refresh_page, name, phone, department, expect): 验证添加业务员唯一 - def test_c...
0024e3dbc50f95d13a145460bbf8ff151be7e6a6
<|skeleton|> class TestAddworker: """添加业务员""" def test_a_add_success(self, login, refresh_page, name, phone, department, expect): """验证添加业务员""" <|body_0|> def test_b_add_fail(self, login, refresh_page, name, phone, department, expect): """验证添加业务员唯一""" <|body_1|> def te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAddworker: """添加业务员""" def test_a_add_success(self, login, refresh_page, name, phone, department, expect): """验证添加业务员""" home_page = login[1] profile_page = login[3] home_page.select_menu(menu='settings') profile_page.add_worker(name, phone, department) ...
the_stack_v2_python_sparse
TestCases/test_ProfileCase.py
zlj1124/UITestFrameWork
train
3
5a807b4167d0d3283e082e1519e31c18a108b47a
[ "super().__init__(test_case=test_case, name=name, subdir=subdir)\nself.cell_width = cell_width\nself.opts.hfun_scal = 'absolute'\nself.opts.hfun_hmax = float('inf')\nself.opts.hfun_hmin = 0.0\nself.opts.mesh_dims = 2\nself.opts.optm_qlim = 0.9375\nself.opts.verbosity = 1", "section = self.config['spherical_mesh']...
<|body_start_0|> super().__init__(test_case=test_case, name=name, subdir=subdir) self.cell_width = cell_width self.opts.hfun_scal = 'absolute' self.opts.hfun_hmax = float('inf') self.opts.hfun_hmin = 0.0 self.opts.mesh_dims = 2 self.opts.optm_qlim = 0.9375 ...
A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. Subclasses can override the ``build_cell_width_lat_lon()`` method to define a lon/lat map of cell width. They can override the ``make_jigsaw_mesh()`` method to change how the jigsaw mesh is generated. Attributes ---------- cell_widt...
QuasiUniformSphericalMeshStep
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuasiUniformSphericalMeshStep: """A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. Subclasses can override the ``build_cell_width_lat_lon()`` method to define a lon/lat map of cell width. They can override the ``make_jigsaw_mesh()`` method to change how the ...
stack_v2_sparse_classes_36k_train_009537
17,773
permissive
[ { "docstring": "Create a new step Parameters ---------- test_case : compass.testcase.TestCase The test case this step belongs to name : str, optional the name of the step subdir : {str, None}, optional the subdirectory for the step cell_width : float, optional The approximate cell width in km of the mesh if con...
5
stack_v2_sparse_classes_30k_train_010760
Implement the Python class `QuasiUniformSphericalMeshStep` described below. Class description: A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. Subclasses can override the ``build_cell_width_lat_lon()`` method to define a lon/lat map of cell width. They can override the ``make_ji...
Implement the Python class `QuasiUniformSphericalMeshStep` described below. Class description: A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. Subclasses can override the ``build_cell_width_lat_lon()`` method to define a lon/lat map of cell width. They can override the ``make_ji...
0b7440f0aa77c1ae052922a39e646bd35c267661
<|skeleton|> class QuasiUniformSphericalMeshStep: """A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. Subclasses can override the ``build_cell_width_lat_lon()`` method to define a lon/lat map of cell width. They can override the ``make_jigsaw_mesh()`` method to change how the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuasiUniformSphericalMeshStep: """A step for creating a quasi-uniform JIGSAW mesh with a constant approximate cell width. Subclasses can override the ``build_cell_width_lat_lon()`` method to define a lon/lat map of cell width. They can override the ``make_jigsaw_mesh()`` method to change how the jigsaw mesh i...
the_stack_v2_python_sparse
compass/mesh/spherical.py
MPAS-Dev/compass
train
10
99e08a642eeb29c436915ae0d2d1ca3b54fc45e8
[ "try:\n from safetlib.transport import all_transports\nexcept ImportError:\n transports = []\n try:\n from safetlib.transport_hid import HidTransport\n transports.append(HidTransport)\n except BaseException:\n pass\n try:\n from safetlib.transport_webusb import WebUsbTrans...
<|body_start_0|> try: from safetlib.transport import all_transports except ImportError: transports = [] try: from safetlib.transport_hid import HidTransport transports.append(HidTransport) except BaseException: ...
SafeTTransport
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafeTTransport: def all_transports(): """Reimplemented safetlib.transport.all_transports so that we can enable/disable specific transports.""" <|body_0|> def enumerate_devices(self): """Just like safetlib.transport.enumerate_devices, but with exception catching, so t...
stack_v2_sparse_classes_36k_train_009538
3,566
permissive
[ { "docstring": "Reimplemented safetlib.transport.all_transports so that we can enable/disable specific transports.", "name": "all_transports", "signature": "def all_transports()" }, { "docstring": "Just like safetlib.transport.enumerate_devices, but with exception catching, so that transports ca...
3
stack_v2_sparse_classes_30k_train_015963
Implement the Python class `SafeTTransport` described below. Class description: Implement the SafeTTransport class. Method signatures and docstrings: - def all_transports(): Reimplemented safetlib.transport.all_transports so that we can enable/disable specific transports. - def enumerate_devices(self): Just like safe...
Implement the Python class `SafeTTransport` described below. Class description: Implement the SafeTTransport class. Method signatures and docstrings: - def all_transports(): Reimplemented safetlib.transport.all_transports so that we can enable/disable specific transports. - def enumerate_devices(self): Just like safe...
a740a20fc2677d54e99fa981b7968b877a7b53a3
<|skeleton|> class SafeTTransport: def all_transports(): """Reimplemented safetlib.transport.all_transports so that we can enable/disable specific transports.""" <|body_0|> def enumerate_devices(self): """Just like safetlib.transport.enumerate_devices, but with exception catching, so t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SafeTTransport: def all_transports(): """Reimplemented safetlib.transport.all_transports so that we can enable/disable specific transports.""" try: from safetlib.transport import all_transports except ImportError: transports = [] try: ...
the_stack_v2_python_sparse
electrum/plugins/safe_t/transport.py
spesmilo/electrum
train
7,132
0999d53004b338a7f628448d206e02e93949c757
[ "if name.startswith('_') and hasattr(self, name[1:]):\n name = name[1:]\nreturn name", "if attr in self.__class__.__dict__:\n return isinstance(self.__class__.__dict__[attr], _SkipEncodingDecoding)\nreturn False", "request_data = {}\nfor attr, value in self.__dict__.items():\n if value is not None:\n ...
<|body_start_0|> if name.startswith('_') and hasattr(self, name[1:]): name = name[1:] return name <|end_body_0|> <|body_start_1|> if attr in self.__class__.__dict__: return isinstance(self.__class__.__dict__[attr], _SkipEncodingDecoding) return False <|end_body_1...
Provide a default behavior for to_request_dict method.
_DefaultToRequestDict
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _DefaultToRequestDict: """Provide a default behavior for to_request_dict method.""" def _clean_descriptor_name(self, name: str): """Update the attribute name to be the same as schema. Args: name (str): attribute name.""" <|body_0|> def _skip_encoding(self, attr: str): ...
stack_v2_sparse_classes_36k_train_009539
16,025
permissive
[ { "docstring": "Update the attribute name to be the same as schema. Args: name (str): attribute name.", "name": "_clean_descriptor_name", "signature": "def _clean_descriptor_name(self, name: str)" }, { "docstring": "Skip encoding if the attribute is an instance of _SkipEncodingDecoding descripto...
3
stack_v2_sparse_classes_30k_train_009625
Implement the Python class `_DefaultToRequestDict` described below. Class description: Provide a default behavior for to_request_dict method. Method signatures and docstrings: - def _clean_descriptor_name(self, name: str): Update the attribute name to be the same as schema. Args: name (str): attribute name. - def _sk...
Implement the Python class `_DefaultToRequestDict` described below. Class description: Provide a default behavior for to_request_dict method. Method signatures and docstrings: - def _clean_descriptor_name(self, name: str): Update the attribute name to be the same as schema. Args: name (str): attribute name. - def _sk...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class _DefaultToRequestDict: """Provide a default behavior for to_request_dict method.""" def _clean_descriptor_name(self, name: str): """Update the attribute name to be the same as schema. Args: name (str): attribute name.""" <|body_0|> def _skip_encoding(self, attr: str): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _DefaultToRequestDict: """Provide a default behavior for to_request_dict method.""" def _clean_descriptor_name(self, name: str): """Update the attribute name to be the same as schema. Args: name (str): attribute name.""" if name.startswith('_') and hasattr(self, name[1:]): nam...
the_stack_v2_python_sparse
src/sagemaker/model_card/helpers.py
aws/sagemaker-python-sdk
train
2,050
4a46935bcb251de4345cfdfd8c6880447373f1fa
[ "try:\n apps = list(apps.items())\nexcept AttributeError:\n pass\n\ndef by_path_len(app):\n return len(app[0])\napps.sort(key=by_path_len, reverse=True)\nself.apps = [(p.rstrip('/'), a) for p, a in apps]", "path = environ['PATH_INFO'] or '/'\nfor p, app in self.apps:\n if path.startswith('{path!s}/'.f...
<|body_start_0|> try: apps = list(apps.items()) except AttributeError: pass def by_path_len(app): return len(app[0]) apps.sort(key=by_path_len, reverse=True) self.apps = [(p.rstrip('/'), a) for p, a in apps] <|end_body_0|> <|body_start_1|> ...
A WSGI dispatcher for dispatch based on the PATH_INFO.
PathInfoDispatcher
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PathInfoDispatcher: """A WSGI dispatcher for dispatch based on the PATH_INFO.""" def __init__(self, apps): """Initialize path info WSGI app dispatcher. Args: apps (dict[str,object]|list[tuple[str,object]]): URI prefix and WSGI app pairs""" <|body_0|> def __call__(self, e...
stack_v2_sparse_classes_36k_train_009540
14,239
permissive
[ { "docstring": "Initialize path info WSGI app dispatcher. Args: apps (dict[str,object]|list[tuple[str,object]]): URI prefix and WSGI app pairs", "name": "__init__", "signature": "def __init__(self, apps)" }, { "docstring": "Process incoming WSGI request. Ref: :pep:`3333` Args: environ (Mapping):...
2
stack_v2_sparse_classes_30k_train_021395
Implement the Python class `PathInfoDispatcher` described below. Class description: A WSGI dispatcher for dispatch based on the PATH_INFO. Method signatures and docstrings: - def __init__(self, apps): Initialize path info WSGI app dispatcher. Args: apps (dict[str,object]|list[tuple[str,object]]): URI prefix and WSGI ...
Implement the Python class `PathInfoDispatcher` described below. Class description: A WSGI dispatcher for dispatch based on the PATH_INFO. Method signatures and docstrings: - def __init__(self, apps): Initialize path info WSGI app dispatcher. Args: apps (dict[str,object]|list[tuple[str,object]]): URI prefix and WSGI ...
00c3cc3e5331fbaa10c44e5080899f1f3d9da6e7
<|skeleton|> class PathInfoDispatcher: """A WSGI dispatcher for dispatch based on the PATH_INFO.""" def __init__(self, apps): """Initialize path info WSGI app dispatcher. Args: apps (dict[str,object]|list[tuple[str,object]]): URI prefix and WSGI app pairs""" <|body_0|> def __call__(self, e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PathInfoDispatcher: """A WSGI dispatcher for dispatch based on the PATH_INFO.""" def __init__(self, apps): """Initialize path info WSGI app dispatcher. Args: apps (dict[str,object]|list[tuple[str,object]]): URI prefix and WSGI app pairs""" try: apps = list(apps.items()) ...
the_stack_v2_python_sparse
cheroot/wsgi.py
cherrypy/cheroot
train
181
ff0aae6b93ace098cbfa28de8d594479a8b6a597
[ "super().__init__(hs)\npool = HTTPConnectionPool(self.reactor)\npool.maxPersistentPerHost = 5\npool.cachedConnectionTimeout = 2 * 60\nself.agent: IAgent = ReplicationAgent(hs.get_reactor(), hs.config.worker.instance_map, contextFactory=hs.get_http_client_context_factory(), pool=pool)", "outgoing_requests_counter....
<|body_start_0|> super().__init__(hs) pool = HTTPConnectionPool(self.reactor) pool.maxPersistentPerHost = 5 pool.cachedConnectionTimeout = 2 * 60 self.agent: IAgent = ReplicationAgent(hs.get_reactor(), hs.config.worker.instance_map, contextFactory=hs.get_http_client_context_facto...
Client for connecting to replication endpoints via HTTP and HTTPS. Attributes: agent: The custom Twisted Agent used for constructing the connection.
ReplicationClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplicationClient: """Client for connecting to replication endpoints via HTTP and HTTPS. Attributes: agent: The custom Twisted Agent used for constructing the connection.""" def __init__(self, hs: 'HomeServer'): """Args: hs: The HomeServer instance to pass in""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_009541
40,370
permissive
[ { "docstring": "Args: hs: The HomeServer instance to pass in", "name": "__init__", "signature": "def __init__(self, hs: 'HomeServer')" }, { "docstring": "Make a request, differs from BaseHttpClient.request in that it does not use treq. Args: method: HTTP method to use. uri: URI to query. data: D...
2
null
Implement the Python class `ReplicationClient` described below. Class description: Client for connecting to replication endpoints via HTTP and HTTPS. Attributes: agent: The custom Twisted Agent used for constructing the connection. Method signatures and docstrings: - def __init__(self, hs: 'HomeServer'): Args: hs: Th...
Implement the Python class `ReplicationClient` described below. Class description: Client for connecting to replication endpoints via HTTP and HTTPS. Attributes: agent: The custom Twisted Agent used for constructing the connection. Method signatures and docstrings: - def __init__(self, hs: 'HomeServer'): Args: hs: Th...
d35bed8369514fe727b4fe1afb68f48cc8b2655a
<|skeleton|> class ReplicationClient: """Client for connecting to replication endpoints via HTTP and HTTPS. Attributes: agent: The custom Twisted Agent used for constructing the connection.""" def __init__(self, hs: 'HomeServer'): """Args: hs: The HomeServer instance to pass in""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReplicationClient: """Client for connecting to replication endpoints via HTTP and HTTPS. Attributes: agent: The custom Twisted Agent used for constructing the connection.""" def __init__(self, hs: 'HomeServer'): """Args: hs: The HomeServer instance to pass in""" super().__init__(hs) ...
the_stack_v2_python_sparse
synapse/http/client.py
matrix-org/synapse
train
12,215
14ffce6d2708c2d36983f614fab4cd3256ce597d
[ "self.universe = universe\nself.typetable = typetable\nself.handler_table = handler_table", "if type(value) in self.typetable:\n return self.typetable[type(value)]\nelif type(value) in self.handler_table:\n return self.handler_table[type(value)](self.universe, value)\nelse:\n for cls in self.handler_tabl...
<|body_start_0|> self.universe = universe self.typetable = typetable self.handler_table = handler_table <|end_body_0|> <|body_start_1|> if type(value) in self.typetable: return self.typetable[type(value)] elif type(value) in self.handler_table: return sel...
ConstantTyper
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConstantTyper: def __init__(self, universe, typetable, handler_table): """Initialize to the given type universe""" <|body_0|> def typeof(self, value): """Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant""" <|...
stack_v2_sparse_classes_36k_train_009542
10,580
permissive
[ { "docstring": "Initialize to the given type universe", "name": "__init__", "signature": "def __init__(self, universe, typetable, handler_table)" }, { "docstring": "Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant", "name": "typeof", "si...
2
stack_v2_sparse_classes_30k_train_015996
Implement the Python class `ConstantTyper` described below. Class description: Implement the ConstantTyper class. Method signatures and docstrings: - def __init__(self, universe, typetable, handler_table): Initialize to the given type universe - def typeof(self, value): Get a concrete type given a python value. Retur...
Implement the Python class `ConstantTyper` described below. Class description: Implement the ConstantTyper class. Method signatures and docstrings: - def __init__(self, universe, typetable, handler_table): Initialize to the given type universe - def typeof(self, value): Get a concrete type given a python value. Retur...
35546517b27764a9120f6dfcd82eba7f4dd858cb
<|skeleton|> class ConstantTyper: def __init__(self, universe, typetable, handler_table): """Initialize to the given type universe""" <|body_0|> def typeof(self, value): """Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConstantTyper: def __init__(self, universe, typetable, handler_table): """Initialize to the given type universe""" self.universe = universe self.typetable = typetable self.handler_table = handler_table def typeof(self, value): """Get a concrete type given a python ...
the_stack_v2_python_sparse
oldnumba/typesystem/itypesystem.py
laserson/numba
train
1
fe1736d58ff20135fbff7b9d3dbfa107631da497
[ "nrows, ncols = criterion_matrix.shape\nassert len(taxon_list) == nrows == ncols == len(eigenvector)\nself.taxon_list = taxon_list\nself.criterion_matrix = criterion_matrix\nself.eigenvector = list(eigenvector)", "assert set(taxon_to_domain.values()) <= set(['eukaryota', 'bacteria', 'archaea'])\ncolumns = []\ncol...
<|body_start_0|> nrows, ncols = criterion_matrix.shape assert len(taxon_list) == nrows == ncols == len(eigenvector) self.taxon_list = taxon_list self.criterion_matrix = criterion_matrix self.eigenvector = list(eigenvector) <|end_body_0|> <|body_start_1|> assert set(taxon...
Each object of this class is associated with a spreadsheet. The supplementary data for my paper will include some spreadsheets.
SupplementarySpreadsheetObject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupplementarySpreadsheetObject: """Each object of this class is associated with a spreadsheet. The supplementary data for my paper will include some spreadsheets.""" def __init__(self, taxon_list, criterion_matrix, eigenvector): """@param taxon_list: an ordered list of taxon names @p...
stack_v2_sparse_classes_36k_train_009543
24,951
no_license
[ { "docstring": "@param taxon_list: an ordered list of taxon names @param criterion_matrix: a laplacian matrix as a numpy array @param eigenvector: the fiedler-like eigenvector for the criterion matrix", "name": "__init__", "signature": "def __init__(self, taxon_list, criterion_matrix, eigenvector)" },...
2
null
Implement the Python class `SupplementarySpreadsheetObject` described below. Class description: Each object of this class is associated with a spreadsheet. The supplementary data for my paper will include some spreadsheets. Method signatures and docstrings: - def __init__(self, taxon_list, criterion_matrix, eigenvect...
Implement the Python class `SupplementarySpreadsheetObject` described below. Class description: Each object of this class is associated with a spreadsheet. The supplementary data for my paper will include some spreadsheets. Method signatures and docstrings: - def __init__(self, taxon_list, criterion_matrix, eigenvect...
91c6f8331f18c914eb3dfc51bc166915998c5081
<|skeleton|> class SupplementarySpreadsheetObject: """Each object of this class is associated with a spreadsheet. The supplementary data for my paper will include some spreadsheets.""" def __init__(self, taxon_list, criterion_matrix, eigenvector): """@param taxon_list: an ordered list of taxon names @p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupplementarySpreadsheetObject: """Each object of this class is associated with a spreadsheet. The supplementary data for my paper will include some spreadsheets.""" def __init__(self, taxon_list, criterion_matrix, eigenvector): """@param taxon_list: an ordered list of taxon names @param criterio...
the_stack_v2_python_sparse
20090802a.py
argriffing/xgcode
train
1
ba28ecd2c4f99542cfa2330745801482f67ad76f
[ "main.input = MagicMock(return_value='1234')\nmain.FULL_INVENTORY = {'1234': {'product_code': '1234', 'description': 'Pen', 'market_price': 24, 'rental_price': '$0.50'}}\nwith StringIO() as captured_output:\n sys.stdout = captured_output\n try:\n main.item_info()\n finally:\n sys.stdout = sys...
<|body_start_0|> main.input = MagicMock(return_value='1234') main.FULL_INVENTORY = {'1234': {'product_code': '1234', 'description': 'Pen', 'market_price': 24, 'rental_price': '$0.50'}} with StringIO() as captured_output: sys.stdout = captured_output try: m...
Unit tests the main file
MainTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainTest: """Unit tests the main file""" def test_item_info_in_inventory(self): """unit tests the intem_info functon when the item is in the inventory""" <|body_0|> def test_item_info_not_in_inventory(self): """unit tests the intem_info functon when the item is n...
stack_v2_sparse_classes_36k_train_009544
10,292
no_license
[ { "docstring": "unit tests the intem_info functon when the item is in the inventory", "name": "test_item_info_in_inventory", "signature": "def test_item_info_in_inventory(self)" }, { "docstring": "unit tests the intem_info functon when the item is not in the inventory", "name": "test_item_in...
6
null
Implement the Python class `MainTest` described below. Class description: Unit tests the main file Method signatures and docstrings: - def test_item_info_in_inventory(self): unit tests the intem_info functon when the item is in the inventory - def test_item_info_not_in_inventory(self): unit tests the intem_info funct...
Implement the Python class `MainTest` described below. Class description: Unit tests the main file Method signatures and docstrings: - def test_item_info_in_inventory(self): unit tests the intem_info functon when the item is in the inventory - def test_item_info_not_in_inventory(self): unit tests the intem_info funct...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class MainTest: """Unit tests the main file""" def test_item_info_in_inventory(self): """unit tests the intem_info functon when the item is in the inventory""" <|body_0|> def test_item_info_not_in_inventory(self): """unit tests the intem_info functon when the item is n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainTest: """Unit tests the main file""" def test_item_info_in_inventory(self): """unit tests the intem_info functon when the item is in the inventory""" main.input = MagicMock(return_value='1234') main.FULL_INVENTORY = {'1234': {'product_code': '1234', 'description': 'Pen', 'mark...
the_stack_v2_python_sparse
students/David_Baylor/lesson01/Assignment/test_unit.py
JavaRod/SP_Python220B_2019
train
1
0d1a602b4c5f2719e0139fdd185efe31deafeed5
[ "nums1.extend(nums2)\nmerge(nums1, 0, len(nums1) - len(nums2) - 1, len(nums1) - 1)\nif len(nums1) % 2 == 1:\n return nums1[len(nums1) // 2]\nelse:\n return (nums1[len(nums1) // 2] + nums1[len(nums1) // 2 - 1]) / 2.0", "m = len(nums1)\nn = len(nums2)\ni = 0\nleft, right = (-1, -1)\np1, p2 = (0, 0)\nwhile i <...
<|body_start_0|> nums1.extend(nums2) merge(nums1, 0, len(nums1) - len(nums2) - 1, len(nums1) - 1) if len(nums1) % 2 == 1: return nums1[len(nums1) // 2] else: return (nums1[len(nums1) // 2] + nums1[len(nums1) // 2 - 1]) / 2.0 <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findMedianSortedArrays_2(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_1...
stack_v2_sparse_classes_36k_train_009545
1,886
permissive
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays_2", ...
2
stack_v2_sparse_classes_30k_train_015519
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findMedianSortedArrays_2(self, nums1, nums2): :type nums1: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findMedianSortedArrays_2(self, nums1, nums2): :type nums1: List[...
a5dd1d785c054de200cafcdde1e25623d6b832ff
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findMedianSortedArrays_2(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" nums1.extend(nums2) merge(nums1, 0, len(nums1) - len(nums2) - 1, len(nums1) - 1) if len(nums1) % 2 == 1: return nums1[len(nums1) // 2] ...
the_stack_v2_python_sparse
leetcode/top100/midnumof2list.py
blackox626/python_learn
train
0
cb2b2f32c8400864b02c33e63e486e035441d2ee
[ "tab_size = self.view.settings().get('tab_size', 4)\nindents = re.compile('^(?:\\\\t| {%d}| *)((?:\\\\t| {%d}| )*)([\\\\s\\\\S]*)' % (tab_size, tab_size))\nif not self.single_line:\n for x in reversed(range(row_first, row_last + 1)):\n line = self.view.full_line(self.view.text_point(x, 0))\n text =...
<|body_start_0|> tab_size = self.view.settings().get('tab_size', 4) indents = re.compile('^(?:\\t| {%d}| *)((?:\\t| {%d}| )*)([\\s\\S]*)' % (tab_size, tab_size)) if not self.single_line: for x in reversed(range(row_first, row_last + 1)): line = self.view.full_line(sel...
Bracket remove plugin.
BracketRemove
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BracketRemove: """Bracket remove plugin.""" def decrease_indent_level(self, edit, row_first, row_last): """Decrease indent level on removal.""" <|body_0|> def run(self, edit, name, remove_content=False, remove_indent=False, remove_block=False): """Remove the give...
stack_v2_sparse_classes_36k_train_009546
2,075
permissive
[ { "docstring": "Decrease indent level on removal.", "name": "decrease_indent_level", "signature": "def decrease_indent_level(self, edit, row_first, row_last)" }, { "docstring": "Remove the given bracket and adjust its indentation if desired.", "name": "run", "signature": "def run(self, e...
2
stack_v2_sparse_classes_30k_train_009381
Implement the Python class `BracketRemove` described below. Class description: Bracket remove plugin. Method signatures and docstrings: - def decrease_indent_level(self, edit, row_first, row_last): Decrease indent level on removal. - def run(self, edit, name, remove_content=False, remove_indent=False, remove_block=Fa...
Implement the Python class `BracketRemove` described below. Class description: Bracket remove plugin. Method signatures and docstrings: - def decrease_indent_level(self, edit, row_first, row_last): Decrease indent level on removal. - def run(self, edit, name, remove_content=False, remove_indent=False, remove_block=Fa...
6bab50cfd41afdb2b09e961be78f2436a84796a1
<|skeleton|> class BracketRemove: """Bracket remove plugin.""" def decrease_indent_level(self, edit, row_first, row_last): """Decrease indent level on removal.""" <|body_0|> def run(self, edit, name, remove_content=False, remove_indent=False, remove_block=False): """Remove the give...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BracketRemove: """Bracket remove plugin.""" def decrease_indent_level(self, edit, row_first, row_last): """Decrease indent level on removal.""" tab_size = self.view.settings().get('tab_size', 4) indents = re.compile('^(?:\\t| {%d}| *)((?:\\t| {%d}| )*)([\\s\\S]*)' % (tab_size, tab...
the_stack_v2_python_sparse
bh_modules/bracketremove.py
facelessuser/BracketHighlighter
train
1,137
94f5513d3e226b092c22ca7fad1a029a2118da58
[ "freq = dict()\nfor i in range(len(s)):\n ch = s[i]\n if ch not in freq:\n freq[ch] = i\n else:\n freq[ch] = -1\nvalid_freq = [f for ch, f in freq.items() if f != -1]\nreturn min(valid_freq) if valid_freq else -1", "count = dict()\nfor ch in s:\n count[ch] = count.get(ch, 0) + 1\nfor i i...
<|body_start_0|> freq = dict() for i in range(len(s)): ch = s[i] if ch not in freq: freq[ch] = i else: freq[ch] = -1 valid_freq = [f for ch, f in freq.items() if f != -1] return min(valid_freq) if valid_freq else -1 <|en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstUniqChar1(self, s): """:type s: str :rtype: int""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> freq = dict() for i in range(len(s)): ch = ...
stack_v2_sparse_classes_36k_train_009547
720
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "firstUniqChar1", "signature": "def firstUniqChar1(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "firstUniqChar2", "signature": "def firstUniqChar2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_002622
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar1(self, s): :type s: str :rtype: int - def firstUniqChar2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar1(self, s): :type s: str :rtype: int - def firstUniqChar2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def firstUniqChar1(self, s): ...
8fb6c1d947046dabd58ff8482b2c0b41f39aa988
<|skeleton|> class Solution: def firstUniqChar1(self, s): """:type s: str :rtype: int""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstUniqChar1(self, s): """:type s: str :rtype: int""" freq = dict() for i in range(len(s)): ch = s[i] if ch not in freq: freq[ch] = i else: freq[ch] = -1 valid_freq = [f for ch, f in freq.items(...
the_stack_v2_python_sparse
Python/LeetCode/387.py
czx94/Algorithms-Collection
train
2
30bb77e3b34fb8c69385bfc2a43feb26ce1eb929
[ "super().__init__(cfg, use_gt_categories, embedder, count_per_class)\nself.confidence_channel = confidence_channel\nself.search_count_multiplier = search_count_multiplier\nself.search_proportion = search_proportion\nassert search_count_multiplier is None or search_proportion is None, f'Cannot specify both search_co...
<|body_start_0|> super().__init__(cfg, use_gt_categories, embedder, count_per_class) self.confidence_channel = confidence_channel self.search_count_multiplier = search_count_multiplier self.search_proportion = search_proportion assert search_count_multiplier is None or search_pro...
Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.
DensePoseCSEConfidenceBasedSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DensePoseCSEConfidenceBasedSampler: """Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.""" def __init__(self, cfg: CfgNode, use_gt_categories: bool, embedder: torch.nn.Module, confidence_channel: str, count_per_class: int=8...
stack_v2_sparse_classes_36k_train_009548
5,154
permissive
[ { "docstring": "Constructor Args: cfg (CfgNode): the config of the model embedder (torch.nn.Module): necessary to compute mesh vertex embeddings confidence_channel (str): confidence channel to use for sampling; possible values: \"coarse_segm_confidence\": confidences for coarse segmentation (default: \"coarse_s...
3
stack_v2_sparse_classes_30k_train_014457
Implement the Python class `DensePoseCSEConfidenceBasedSampler` described below. Class description: Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates. Method signatures and docstrings: - def __init__(self, cfg: CfgNode, use_gt_categories: bool, embedd...
Implement the Python class `DensePoseCSEConfidenceBasedSampler` described below. Class description: Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates. Method signatures and docstrings: - def __init__(self, cfg: CfgNode, use_gt_categories: bool, embedd...
80307d2d5e06f06a8a677cc2653f23a4c56402ac
<|skeleton|> class DensePoseCSEConfidenceBasedSampler: """Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.""" def __init__(self, cfg: CfgNode, use_gt_categories: bool, embedder: torch.nn.Module, confidence_channel: str, count_per_class: int=8...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DensePoseCSEConfidenceBasedSampler: """Samples DensePose data from DensePose predictions. Samples for each class are drawn using confidence value estimates.""" def __init__(self, cfg: CfgNode, use_gt_categories: bool, embedder: torch.nn.Module, confidence_channel: str, count_per_class: int=8, search_coun...
the_stack_v2_python_sparse
projects/DensePose/densepose/data/samplers/densepose_cse_confidence_based.py
facebookresearch/detectron2
train
27,469
636fd53ed3cd4e8b949e594860a86c62c631a9bf
[ "ret = {}\nfor name in dir(self):\n if not name.startswith('_') and name.lower() != 'metadata':\n ret[name] = getattr(self, name)\nreturn ret", "try:\n db_session.add(self)\n if refresh:\n db_session.flush()\n db_session.refresh(self)\n db_session.commit()\nexcept Exception as ex:...
<|body_start_0|> ret = {} for name in dir(self): if not name.startswith('_') and name.lower() != 'metadata': ret[name] = getattr(self, name) return ret <|end_body_0|> <|body_start_1|> try: db_session.add(self) if refresh: ...
抽象基类, 用于封装常用工具.
BasicBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicBase: """抽象基类, 用于封装常用工具.""" def __to_dict__(self): """类实例对象转为dict.""" <|body_0|> def __save(self, db_session, refresh=True): """自保存, 暂不可用. :parameter db_session :parameter refresh""" <|body_1|> def __batch_save(db_session, entities_list): ...
stack_v2_sparse_classes_36k_train_009549
1,745
no_license
[ { "docstring": "类实例对象转为dict.", "name": "__to_dict__", "signature": "def __to_dict__(self)" }, { "docstring": "自保存, 暂不可用. :parameter db_session :parameter refresh", "name": "__save", "signature": "def __save(self, db_session, refresh=True)" }, { "docstring": "批量保存, 暂不可用. :paramete...
3
stack_v2_sparse_classes_30k_train_008862
Implement the Python class `BasicBase` described below. Class description: 抽象基类, 用于封装常用工具. Method signatures and docstrings: - def __to_dict__(self): 类实例对象转为dict. - def __save(self, db_session, refresh=True): 自保存, 暂不可用. :parameter db_session :parameter refresh - def __batch_save(db_session, entities_list): 批量保存, 暂不可用...
Implement the Python class `BasicBase` described below. Class description: 抽象基类, 用于封装常用工具. Method signatures and docstrings: - def __to_dict__(self): 类实例对象转为dict. - def __save(self, db_session, refresh=True): 自保存, 暂不可用. :parameter db_session :parameter refresh - def __batch_save(db_session, entities_list): 批量保存, 暂不可用...
40faf78b2365137b9da0cc67f511248b390b4c13
<|skeleton|> class BasicBase: """抽象基类, 用于封装常用工具.""" def __to_dict__(self): """类实例对象转为dict.""" <|body_0|> def __save(self, db_session, refresh=True): """自保存, 暂不可用. :parameter db_session :parameter refresh""" <|body_1|> def __batch_save(db_session, entities_list): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicBase: """抽象基类, 用于封装常用工具.""" def __to_dict__(self): """类实例对象转为dict.""" ret = {} for name in dir(self): if not name.startswith('_') and name.lower() != 'metadata': ret[name] = getattr(self, name) return ret def __save(self, db_session, r...
the_stack_v2_python_sparse
discuzx_tools/libs/models/base.py
BabyMelvin/discuzx-tools
train
0
607bd387822ab318d85022b5ada1ea5eb80e5852
[ "GleanTable.__init__(self)\nself.no_init = True\nself.per_app_id_enabled = False\nself.per_app_enabled = True", "release_app = app_info[0]\ntarget_dataset = release_app['app_name']\nrepo = next((r for r in GleanPing.get_repos() if r['name'] == release_app['v1_name']))\nif repo['app_id'] == release_app['app_name']...
<|body_start_0|> GleanTable.__init__(self) self.no_init = True self.per_app_id_enabled = False self.per_app_enabled = True <|end_body_0|> <|body_start_1|> release_app = app_info[0] target_dataset = release_app['app_name'] repo = next((r for r in GleanPing.get_rep...
Represents generated events_unnested table.
GleanAppPingViews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GleanAppPingViews: """Represents generated events_unnested table.""" def __init__(self): """Initialize events_unnested table.""" <|body_0|> def generate_per_app(self, project_id, app_info, output_dir=None): """Generate per-app ping views. For the release channel ...
stack_v2_sparse_classes_36k_train_009550
3,746
no_license
[ { "docstring": "Initialize events_unnested table.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Generate per-app ping views. For the release channel of a glean app *only*, generate a pointer view to the app-id specific view for that channel/app combination", "nam...
2
stack_v2_sparse_classes_30k_train_009621
Implement the Python class `GleanAppPingViews` described below. Class description: Represents generated events_unnested table. Method signatures and docstrings: - def __init__(self): Initialize events_unnested table. - def generate_per_app(self, project_id, app_info, output_dir=None): Generate per-app ping views. For...
Implement the Python class `GleanAppPingViews` described below. Class description: Represents generated events_unnested table. Method signatures and docstrings: - def __init__(self): Initialize events_unnested table. - def generate_per_app(self, project_id, app_info, output_dir=None): Generate per-app ping views. For...
640f588357c7be7d33e14f0da622dfe25ce1a27c
<|skeleton|> class GleanAppPingViews: """Represents generated events_unnested table.""" def __init__(self): """Initialize events_unnested table.""" <|body_0|> def generate_per_app(self, project_id, app_info, output_dir=None): """Generate per-app ping views. For the release channel ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GleanAppPingViews: """Represents generated events_unnested table.""" def __init__(self): """Initialize events_unnested table.""" GleanTable.__init__(self) self.no_init = True self.per_app_id_enabled = False self.per_app_enabled = True def generate_per_app(self...
the_stack_v2_python_sparse
bigquery_etl/glean_usage/glean_app_ping_views.py
pombredanne/bigquery-etl
train
0
eda308e80ef9f67f76eb58bcff984e82e9b8b21f
[ "super(lsf_sm, self).check()\nif 'WALLTIME' not in PAR:\n setattr(PAR, 'WALLTIME', 30.0)\nif 'LSFARGS' not in PAR:\n setattr(PAR, 'LSFARGS', '')", "unix.mkdir(PATH.OUTPUT)\nunix.cd(PATH.OUTPUT)\nunix.mkdir(PATH.SUBMIT + '/' + 'output.lsf')\nself.checkpoint()\nunix.run('bsub ' + '%s ' % PAR.LSFARGS + '-J %s ...
<|body_start_0|> super(lsf_sm, self).check() if 'WALLTIME' not in PAR: setattr(PAR, 'WALLTIME', 30.0) if 'LSFARGS' not in PAR: setattr(PAR, 'LSFARGS', '') <|end_body_0|> <|body_start_1|> unix.mkdir(PATH.OUTPUT) unix.cd(PATH.OUTPUT) unix.mkdir(PATH...
An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files are written to a global scratch p...
lsf_sm
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lsf_sm: """An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files...
stack_v2_sparse_classes_36k_train_009551
2,039
permissive
[ { "docstring": "Checks parameters and paths", "name": "check", "signature": "def check(self)" }, { "docstring": "Submits workflow", "name": "submit", "signature": "def submit(self, workflow)" } ]
2
stack_v2_sparse_classes_30k_train_015222
Implement the Python class `lsf_sm` described below. Class description: An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different com...
Implement the Python class `lsf_sm` described below. Class description: An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different com...
47725866ac516767c9eb536f4a0e86c7c0b97482
<|skeleton|> class lsf_sm: """An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lsf_sm: """An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files are written ...
the_stack_v2_python_sparse
seisflows/system/lsf_sm.py
yanhuay/seisflows
train
1
5e62a48b82047f8a1b5702eb76b812be70a9edb5
[ "stk1, stk2 = ([], [])\nwhile l1:\n stk1.append(l1.val)\n l1 = l1.next\nwhile l2:\n stk2.append(l2.val)\n l2 = l2.next\nprev, head = (None, None)\nsum = 0\nwhile stk1 or stk2:\n sum /= 10\n if stk1:\n sum += stk1.pop()\n if stk2:\n sum += stk2.pop()\n head = ListNode(sum % 10)\...
<|body_start_0|> stk1, stk2 = ([], []) while l1: stk1.append(l1.val) l1 = l1.next while l2: stk2.append(l2.val) l2 = l2.next prev, head = (None, None) sum = 0 while stk1 or stk2: sum /= 10 if stk1: ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers2(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_009552
3,406
permissive
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers2", "signature": "def addTwoNumbers2(self, l1...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode...
0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers2(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" stk1, stk2 = ([], []) while l1: stk1.append(l1.val) l1 = l1.next while l2: stk2.append(l2.val) l2 = l2.next prev, head...
the_stack_v2_python_sparse
cs15211/AddTwoNumbersII.py
JulyKikuAkita/PythonPrac
train
1
95c6adab8521e2afe072897e167315599fa7cb00
[ "self.store = {}\nself.random_set = set()\nself.random_store = {}\nself.count = 1", "if self.store.get(val):\n return False\nself.store[val] = self.count\nself.random_store[self.count] = val\nself.count += 1\nreturn True", "if not val in self.store:\n return False\ncount = self.store[val]\ndel self.store[...
<|body_start_0|> self.store = {} self.random_set = set() self.random_store = {} self.count = 1 <|end_body_0|> <|body_start_1|> if self.store.get(val): return False self.store[val] = self.count self.random_store[self.count] = val self.count += ...
RandomizedSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_36k_train_009553
1,387
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.", "name": "insert", "signature": "def insert(self, val: int) ...
4
null
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
ddef96b5ecc699a590376a892a804c143fe18034
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.store = {} self.random_set = set() self.random_store = {} self.count = 1 def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not al...
the_stack_v2_python_sparse
leetcode/medium/insert-delete-getrandom-o1.py
vtemian/interviews-prep
train
8
27f9cdad439ebf131b58723dd5264b3a0970a9ef
[ "result = 0.0\nfor i in range(0, old_centroids.shape[0]):\n result += cls.calculate_euclidean_distance(old_centroids[i], new_centroids[i])\nreturn result / old_centroids.shape[0]", "norm = 0.0\nfor i in range(0, first.shape[0]):\n norm += pow(first[i] - second[i], 2)\nreturn sqrt(norm)" ]
<|body_start_0|> result = 0.0 for i in range(0, old_centroids.shape[0]): result += cls.calculate_euclidean_distance(old_centroids[i], new_centroids[i]) return result / old_centroids.shape[0] <|end_body_0|> <|body_start_1|> norm = 0.0 for i in range(0, first.shape[0])...
A service class for all kind of convergence calculations.
ConvergenceCalculationService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvergenceCalculationService: """A service class for all kind of convergence calculations.""" def calculate_averaged_euclidean_distance(cls, old_centroids, new_centroids): """Calculates the pairwise distance of the old and new centroid location, sum them up and divide by the amount ...
stack_v2_sparse_classes_36k_train_009554
977
no_license
[ { "docstring": "Calculates the pairwise distance of the old and new centroid location, sum them up and divide by the amount of centroids.", "name": "calculate_averaged_euclidean_distance", "signature": "def calculate_averaged_euclidean_distance(cls, old_centroids, new_centroids)" }, { "docstring...
2
stack_v2_sparse_classes_30k_train_020261
Implement the Python class `ConvergenceCalculationService` described below. Class description: A service class for all kind of convergence calculations. Method signatures and docstrings: - def calculate_averaged_euclidean_distance(cls, old_centroids, new_centroids): Calculates the pairwise distance of the old and new...
Implement the Python class `ConvergenceCalculationService` described below. Class description: A service class for all kind of convergence calculations. Method signatures and docstrings: - def calculate_averaged_euclidean_distance(cls, old_centroids, new_centroids): Calculates the pairwise distance of the old and new...
ee78db14c0d5fc37d9990cf8ad634f5e264c161b
<|skeleton|> class ConvergenceCalculationService: """A service class for all kind of convergence calculations.""" def calculate_averaged_euclidean_distance(cls, old_centroids, new_centroids): """Calculates the pairwise distance of the old and new centroid location, sum them up and divide by the amount ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvergenceCalculationService: """A service class for all kind of convergence calculations.""" def calculate_averaged_euclidean_distance(cls, old_centroids, new_centroids): """Calculates the pairwise distance of the old and new centroid location, sum them up and divide by the amount of centroids....
the_stack_v2_python_sparse
qhana_openapi/clustering/convergenceCalculationService.py
IndikaKuma/quantum
train
0
ff850c1ae77a6d3bacbdc5b57a4c494642a4ce4c
[ "if not root:\n return (0, 0)\nleft = self.robUtil(root.left)\nright = self.robUtil(root.right)\nexc = max(left[0], left[1]) + max(right[0], right[1])\ninc = root.val + left[0] + right[0]\nreturn (exc, inc)", "if not root:\n return 0\nexc, inc = self.robUtil(root)\nreturn max(exc, inc)" ]
<|body_start_0|> if not root: return (0, 0) left = self.robUtil(root.left) right = self.robUtil(root.right) exc = max(left[0], left[1]) + max(right[0], right[1]) inc = root.val + left[0] + right[0] return (exc, inc) <|end_body_0|> <|body_start_1|> if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def robUtil(self, root): """:type root: TreeNode :rtype: (included, excluded)""" <|body_0|> def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return (0, 0) ...
stack_v2_sparse_classes_36k_train_009555
900
no_license
[ { "docstring": ":type root: TreeNode :rtype: (included, excluded)", "name": "robUtil", "signature": "def robUtil(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "rob", "signature": "def rob(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_017052
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def robUtil(self, root): :type root: TreeNode :rtype: (included, excluded) - def rob(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def robUtil(self, root): :type root: TreeNode :rtype: (included, excluded) - def rob(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def robUtil(...
962803824b4173d553cb76940750dc249927b972
<|skeleton|> class Solution: def robUtil(self, root): """:type root: TreeNode :rtype: (included, excluded)""" <|body_0|> def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def robUtil(self, root): """:type root: TreeNode :rtype: (included, excluded)""" if not root: return (0, 0) left = self.robUtil(root.left) right = self.robUtil(root.right) exc = max(left[0], left[1]) + max(right[0], right[1]) inc = root.val...
the_stack_v2_python_sparse
HouseRobber3.py
divyanshk/algorithms-and-data-structures
train
0
02218ccf72a877ac3a49dcb97ec945ec7a50b509
[ "if len(input_shape) != 3:\n raise ValueError(\"Length of 'input_shape' must 3.\" + ' Got {}.'.format(len(input_shape)))\nsuper().__init__(input_shape)\nif how not in ('+', '*', '.'):\n raise ValueError(\"Argument 'how' must be one of following values: \" + \"'+', '*', '.'. Got {}.\".format(how))\nif not isin...
<|body_start_0|> if len(input_shape) != 3: raise ValueError("Length of 'input_shape' must 3." + ' Got {}.'.format(len(input_shape))) super().__init__(input_shape) if how not in ('+', '*', '.'): raise ValueError("Argument 'how' must be one of following values: " + "'+', '*...
GCNBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GCNBlock: def __init__(self, input_shape, filters, kernel_size=11, layout='cc', how='+', block=None): """Build Global Convolutional Block. Implementation of global convolutional block from http://arxiv.org/abs/1703.02719. Parameters ---------- input_shape : Tuple[int], List[int] or NDArr...
stack_v2_sparse_classes_36k_train_009556
3,419
no_license
[ { "docstring": "Build Global Convolutional Block. Implementation of global convolutional block from http://arxiv.org/abs/1703.02719. Parameters ---------- input_shape : Tuple[int], List[int] or NDArray[int] shape of the input tensor. filters : int number of output channels for all convolutional operations. kern...
3
stack_v2_sparse_classes_30k_train_003587
Implement the Python class `GCNBlock` described below. Class description: Implement the GCNBlock class. Method signatures and docstrings: - def __init__(self, input_shape, filters, kernel_size=11, layout='cc', how='+', block=None): Build Global Convolutional Block. Implementation of global convolutional block from ht...
Implement the Python class `GCNBlock` described below. Class description: Implement the GCNBlock class. Method signatures and docstrings: - def __init__(self, input_shape, filters, kernel_size=11, layout='cc', how='+', block=None): Build Global Convolutional Block. Implementation of global convolutional block from ht...
9554e0f96703a37a9a41fc70dc8e70e45c6181a2
<|skeleton|> class GCNBlock: def __init__(self, input_shape, filters, kernel_size=11, layout='cc', how='+', block=None): """Build Global Convolutional Block. Implementation of global convolutional block from http://arxiv.org/abs/1703.02719. Parameters ---------- input_shape : Tuple[int], List[int] or NDArr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GCNBlock: def __init__(self, input_shape, filters, kernel_size=11, layout='cc', how='+', block=None): """Build Global Convolutional Block. Implementation of global convolutional block from http://arxiv.org/abs/1703.02719. Parameters ---------- input_shape : Tuple[int], List[int] or NDArray[int] shape ...
the_stack_v2_python_sparse
dnn_backend/radio_dep/models/models/pytorch/blocks/gcn.py
theVmagnificient/radiology_web
train
0
b71e35a5d49323ceed5ccebbaa0c7e675c207e7b
[ "self.name = x[0]\nself.tbls = x[1]\nself.wts = x[2]\nsum = 0.0\nfor i in range(len(self.wts)):\n self.wts[i] *= 0.01\n sum += self.wts[i]\nif abs(sum - 1.0) > 0.0001:\n print('Weights add up to {0:.5f}'.format(sum))", "sum = 0.0\nfor i in range(len(self.tbls)):\n key = self.tbls[i].strip()\n \"if ...
<|body_start_0|> self.name = x[0] self.tbls = x[1] self.wts = x[2] sum = 0.0 for i in range(len(self.wts)): self.wts[i] *= 0.01 sum += self.wts[i] if abs(sum - 1.0) > 0.0001: print('Weights add up to {0:.5f}'.format(sum)) <|end_body_0|>...
cost escalator class - computes weighted sum of different PPI_tables
Escalator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Escalator: """cost escalator class - computes weighted sum of different PPI_tables""" def __init__(self, x): """x is a list""" <|body_0|> def compute(self, ppitbls, sy, sm, ey, em): """returns cost escalator between start_yr/start_mon and end_yr/end_mon ppitbls i...
stack_v2_sparse_classes_36k_train_009557
15,625
permissive
[ { "docstring": "x is a list", "name": "__init__", "signature": "def __init__(self, x)" }, { "docstring": "returns cost escalator between start_yr/start_mon and end_yr/end_mon ppitbls is a dictionary of PPITbl objects, indexed by NAICS code", "name": "compute", "signature": "def compute(s...
2
stack_v2_sparse_classes_30k_train_019232
Implement the Python class `Escalator` described below. Class description: cost escalator class - computes weighted sum of different PPI_tables Method signatures and docstrings: - def __init__(self, x): x is a list - def compute(self, ppitbls, sy, sm, ey, em): returns cost escalator between start_yr/start_mon and end...
Implement the Python class `Escalator` described below. Class description: cost escalator class - computes weighted sum of different PPI_tables Method signatures and docstrings: - def __init__(self, x): x is a list - def compute(self, ppitbls, sy, sm, ey, em): returns cost escalator between start_yr/start_mon and end...
052ccae2abcfe88e7937c0d077367eff5b00e22c
<|skeleton|> class Escalator: """cost escalator class - computes weighted sum of different PPI_tables""" def __init__(self, x): """x is a list""" <|body_0|> def compute(self, ppitbls, sy, sm, ey, em): """returns cost escalator between start_yr/start_mon and end_yr/end_mon ppitbls i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Escalator: """cost escalator class - computes weighted sum of different PPI_tables""" def __init__(self, x): """x is a list""" self.name = x[0] self.tbls = x[1] self.wts = x[2] sum = 0.0 for i in range(len(self.wts)): self.wts[i] *= 0.01 ...
the_stack_v2_python_sparse
wisdem/nrelcsm/csmPPI.py
Ben-Mertz/WISDEM
train
1
d39a093379cfd9fec06586e11c2cebae76e882b7
[ "category = current_user.categories.filter(id=category_id).first()\nif category is None:\n return ({'success': False}, 400)\nreturn query_util.fix_ids(category)", "category = current_user.categories.filter(id=category_id).first()\nif category is None:\n return ({'message': 'Invalid image id'}, 400)\nif not ...
<|body_start_0|> category = current_user.categories.filter(id=category_id).first() if category is None: return ({'success': False}, 400) return query_util.fix_ids(category) <|end_body_0|> <|body_start_1|> category = current_user.categories.filter(id=category_id).first() ...
Category
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Category: def get(self, category_id): """Returns a category by ID""" <|body_0|> def delete(self, category_id): """Deletes a category by ID""" <|body_1|> def put(self, category_id): """Updates a category name by ID""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_36k_train_009558
7,050
permissive
[ { "docstring": "Returns a category by ID", "name": "get", "signature": "def get(self, category_id)" }, { "docstring": "Deletes a category by ID", "name": "delete", "signature": "def delete(self, category_id)" }, { "docstring": "Updates a category name by ID", "name": "put", ...
3
stack_v2_sparse_classes_30k_train_005325
Implement the Python class `Category` described below. Class description: Implement the Category class. Method signatures and docstrings: - def get(self, category_id): Returns a category by ID - def delete(self, category_id): Deletes a category by ID - def put(self, category_id): Updates a category name by ID
Implement the Python class `Category` described below. Class description: Implement the Category class. Method signatures and docstrings: - def get(self, category_id): Returns a category by ID - def delete(self, category_id): Deletes a category by ID - def put(self, category_id): Updates a category name by ID <|skel...
9cce5d2f64944e2aa7ca829ca4032624e3305138
<|skeleton|> class Category: def get(self, category_id): """Returns a category by ID""" <|body_0|> def delete(self, category_id): """Deletes a category by ID""" <|body_1|> def put(self, category_id): """Updates a category name by ID""" <|body_2|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Category: def get(self, category_id): """Returns a category by ID""" category = current_user.categories.filter(id=category_id).first() if category is None: return ({'success': False}, 400) return query_util.fix_ids(category) def delete(self, category_id): ...
the_stack_v2_python_sparse
backend/webserver/api/categories.py
jsbroks/coco-annotator
train
1,987
d55907702c44ca9531fabefddf017aa9af3da6a1
[ "md5 = hashlib.md5()\nwith open(file_path, 'rb') as xml_file:\n md5.update(xml_file.read())\n return md5.hexdigest()", "md5_1 = HashLibUtil.get_file_md5(file_path_1)\nmd5_2 = HashLibUtil.get_file_md5(file_path_2)\nif md5_1 == md5_2:\n return True\nelse:\n return False", "file_md5 = {}\nres = []\nfor...
<|body_start_0|> md5 = hashlib.md5() with open(file_path, 'rb') as xml_file: md5.update(xml_file.read()) return md5.hexdigest() <|end_body_0|> <|body_start_1|> md5_1 = HashLibUtil.get_file_md5(file_path_1) md5_2 = HashLibUtil.get_file_md5(file_path_2) if ...
HashLibUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashLibUtil: def get_file_md5(file_path): """获取文件的 MD5 值""" <|body_0|> def is_the_same_file(file_path_1, file_path_2): """判断两个文件是否是一个文件""" <|body_1|> def duplicate_checking(file_path_list): """文件查重,输出重复的文件,放在一个列表里面 DS : [[file_path_1, file_path_2...
stack_v2_sparse_classes_36k_train_009559
2,768
no_license
[ { "docstring": "获取文件的 MD5 值", "name": "get_file_md5", "signature": "def get_file_md5(file_path)" }, { "docstring": "判断两个文件是否是一个文件", "name": "is_the_same_file", "signature": "def is_the_same_file(file_path_1, file_path_2)" }, { "docstring": "文件查重,输出重复的文件,放在一个列表里面 DS : [[file_path_...
3
stack_v2_sparse_classes_30k_train_017197
Implement the Python class `HashLibUtil` described below. Class description: Implement the HashLibUtil class. Method signatures and docstrings: - def get_file_md5(file_path): 获取文件的 MD5 值 - def is_the_same_file(file_path_1, file_path_2): 判断两个文件是否是一个文件 - def duplicate_checking(file_path_list): 文件查重,输出重复的文件,放在一个列表里面 DS ...
Implement the Python class `HashLibUtil` described below. Class description: Implement the HashLibUtil class. Method signatures and docstrings: - def get_file_md5(file_path): 获取文件的 MD5 值 - def is_the_same_file(file_path_1, file_path_2): 判断两个文件是否是一个文件 - def duplicate_checking(file_path_list): 文件查重,输出重复的文件,放在一个列表里面 DS ...
32e64be10a6cd2856850f6720d70b4c6e7033f4e
<|skeleton|> class HashLibUtil: def get_file_md5(file_path): """获取文件的 MD5 值""" <|body_0|> def is_the_same_file(file_path_1, file_path_2): """判断两个文件是否是一个文件""" <|body_1|> def duplicate_checking(file_path_list): """文件查重,输出重复的文件,放在一个列表里面 DS : [[file_path_1, file_path_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HashLibUtil: def get_file_md5(file_path): """获取文件的 MD5 值""" md5 = hashlib.md5() with open(file_path, 'rb') as xml_file: md5.update(xml_file.read()) return md5.hexdigest() def is_the_same_file(file_path_1, file_path_2): """判断两个文件是否是一个文件""" md...
the_stack_v2_python_sparse
BuiltinModule/Hashlib/HashlibUtil.py
newjokker/PyUtil
train
0
162d0fdc1f6466634341acc039c5baca02ec03f3
[ "if isinstance(size, (tuple, list)):\n assert len(size) == 3, 'Size must contain THREE number when it is a tuple or list, got {}.'.format(len(size))\n self.size = size\nelif isinstance(size, int):\n self.size = (size, size, size)\nelse:\n print('Size must be a list or tuple, got {}.'.format(type(size)))...
<|body_start_0|> if isinstance(size, (tuple, list)): assert len(size) == 3, 'Size must contain THREE number when it is a tuple or list, got {}.'.format(len(size)) self.size = size elif isinstance(size, int): self.size = (size, size, size) else: pri...
RandomCrop至预设尺寸 scale: 切出cube的体积与原图体积的比值范围 ratio: 切出cube的每一边长的抖动范围 size: resize的目标尺寸 interpolation: [1-5], skimage.zoom的order数。注意分割模式下label的order统一为0 pre_crop: bool,如果为True,则先切一个目标尺寸左右的cube,再resize,通常用于滑窗模式; 如果为False,则从原图上扣一个与原图接近的cube,再resize至目标尺寸 nonzero_mask,如果为True,则只在label mask有效(非0)区域内进行滑窗 如果为False,则在image整个区域内进行...
RandomCrop4D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomCrop4D: """RandomCrop至预设尺寸 scale: 切出cube的体积与原图体积的比值范围 ratio: 切出cube的每一边长的抖动范围 size: resize的目标尺寸 interpolation: [1-5], skimage.zoom的order数。注意分割模式下label的order统一为0 pre_crop: bool,如果为True,则先切一个目标尺寸左右的cube,再resize,通常用于滑窗模式; 如果为False,则从原图上扣一个与原图接近的cube,再resize至目标尺寸 nonzero_mask,如果为True,则只在label m...
stack_v2_sparse_classes_36k_train_009560
34,927
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, size, scale=(0.8, 1.2), ratio=(3.0 / 4.0, 4.0 / 3.0), interpolation=1, pre_crop=False, nonzero_mask=False)" }, { "docstring": "Get parameters for ``crop`` for a random sized crop. Args: img (numpy ndarray): Image to be c...
3
stack_v2_sparse_classes_30k_train_005731
Implement the Python class `RandomCrop4D` described below. Class description: RandomCrop至预设尺寸 scale: 切出cube的体积与原图体积的比值范围 ratio: 切出cube的每一边长的抖动范围 size: resize的目标尺寸 interpolation: [1-5], skimage.zoom的order数。注意分割模式下label的order统一为0 pre_crop: bool,如果为True,则先切一个目标尺寸左右的cube,再resize,通常用于滑窗模式; 如果为False,则从原图上扣一个与原图接近的cube,再resi...
Implement the Python class `RandomCrop4D` described below. Class description: RandomCrop至预设尺寸 scale: 切出cube的体积与原图体积的比值范围 ratio: 切出cube的每一边长的抖动范围 size: resize的目标尺寸 interpolation: [1-5], skimage.zoom的order数。注意分割模式下label的order统一为0 pre_crop: bool,如果为True,则先切一个目标尺寸左右的cube,再resize,通常用于滑窗模式; 如果为False,则从原图上扣一个与原图接近的cube,再resi...
2c8c35a8949fef74599f5ec557d340a14415f20d
<|skeleton|> class RandomCrop4D: """RandomCrop至预设尺寸 scale: 切出cube的体积与原图体积的比值范围 ratio: 切出cube的每一边长的抖动范围 size: resize的目标尺寸 interpolation: [1-5], skimage.zoom的order数。注意分割模式下label的order统一为0 pre_crop: bool,如果为True,则先切一个目标尺寸左右的cube,再resize,通常用于滑窗模式; 如果为False,则从原图上扣一个与原图接近的cube,再resize至目标尺寸 nonzero_mask,如果为True,则只在label m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomCrop4D: """RandomCrop至预设尺寸 scale: 切出cube的体积与原图体积的比值范围 ratio: 切出cube的每一边长的抖动范围 size: resize的目标尺寸 interpolation: [1-5], skimage.zoom的order数。注意分割模式下label的order统一为0 pre_crop: bool,如果为True,则先切一个目标尺寸左右的cube,再resize,通常用于滑窗模式; 如果为False,则从原图上扣一个与原图接近的cube,再resize至目标尺寸 nonzero_mask,如果为True,则只在label mask有效(非0)区域内进...
the_stack_v2_python_sparse
contrib/MedicalSeg/medicalseg/transforms/transform.py
PaddlePaddle/PaddleSeg
train
8,531
e12ce8e941cb0e5863d2e3cf48fb2ea160fd0d42
[ "info = self.api.query_device_id()\nif fail_on_null_jedec_id and info == (255, 65535, 255):\n raise IOError(\"spiflash: this target lacks a JEDEC ID, or DO/MISO appears to be stuck at '1'; check your connections?\")\nif info == (0, 0, 0):\n raise IOError(\"spiflash: DO/MISO appears to be stuck at '0'; check y...
<|body_start_0|> info = self.api.query_device_id() if fail_on_null_jedec_id and info == (255, 65535, 255): raise IOError("spiflash: this target lacks a JEDEC ID, or DO/MISO appears to be stuck at '1'; check your connections?") if info == (0, 0, 0): raise IOError("spiflash...
Class representing an SPI flash connected to the GreatFET.
SPIFlash
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SPIFlash: """Class representing an SPI flash connected to the GreatFET.""" def _stuck_signal_check(self, fail_on_null_jedec_id=True): """Attempts to detect a stuck MISO value; raises an IOError if one is detected.""" <|body_0|> def _parse_jedec_id(self): """Attem...
stack_v2_sparse_classes_36k_train_009561
6,655
permissive
[ { "docstring": "Attempts to detect a stuck MISO value; raises an IOError if one is detected.", "name": "_stuck_signal_check", "signature": "def _stuck_signal_check(self, fail_on_null_jedec_id=True)" }, { "docstring": "Attempts to extract manufacturer name and string from JEDEC information.", ...
3
null
Implement the Python class `SPIFlash` described below. Class description: Class representing an SPI flash connected to the GreatFET. Method signatures and docstrings: - def _stuck_signal_check(self, fail_on_null_jedec_id=True): Attempts to detect a stuck MISO value; raises an IOError if one is detected. - def _parse_...
Implement the Python class `SPIFlash` described below. Class description: Class representing an SPI flash connected to the GreatFET. Method signatures and docstrings: - def _stuck_signal_check(self, fail_on_null_jedec_id=True): Attempts to detect a stuck MISO value; raises an IOError if one is detected. - def _parse_...
2409575d28fc7c9cae44c9085c7457ddfb54f893
<|skeleton|> class SPIFlash: """Class representing an SPI flash connected to the GreatFET.""" def _stuck_signal_check(self, fail_on_null_jedec_id=True): """Attempts to detect a stuck MISO value; raises an IOError if one is detected.""" <|body_0|> def _parse_jedec_id(self): """Attem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SPIFlash: """Class representing an SPI flash connected to the GreatFET.""" def _stuck_signal_check(self, fail_on_null_jedec_id=True): """Attempts to detect a stuck MISO value; raises an IOError if one is detected.""" info = self.api.query_device_id() if fail_on_null_jedec_id and i...
the_stack_v2_python_sparse
host/greatfet/programmers/spi_flash.py
greatscottgadgets/greatfet
train
273
a46a06505a40525d2d6c4008e73f6e9976625917
[ "self.l = []\n\ndef rest(node, n):\n node.val = n\n self.l.append(n)\n if node.left != None:\n rest(node.left, 2 * n + 1)\n if node.right != None:\n rest(node.right, 2 * n + 2)\nroot.val = 0\nnum = root.val\nself.l.append(num)\nif root.left != None:\n rest(root.left, 2 * num + 1)\nif ro...
<|body_start_0|> self.l = [] def rest(node, n): node.val = n self.l.append(n) if node.left != None: rest(node.left, 2 * n + 1) if node.right != None: rest(node.right, 2 * n + 2) root.val = 0 num = root.val ...
FindElements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindElements: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def find(self, target): """:type target: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.l = [] def rest(node, n): node.val = n ...
stack_v2_sparse_classes_36k_train_009562
1,813
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":type target: int :rtype: bool", "name": "find", "signature": "def find(self, target)" } ]
2
null
Implement the Python class `FindElements` described below. Class description: Implement the FindElements class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def find(self, target): :type target: int :rtype: bool
Implement the Python class `FindElements` described below. Class description: Implement the FindElements class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def find(self, target): :type target: int :rtype: bool <|skeleton|> class FindElements: def __init__(self, root): ...
78e6e87c01848a1dc71b7dc0716029ece5f35863
<|skeleton|> class FindElements: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def find(self, target): """:type target: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindElements: def __init__(self, root): """:type root: TreeNode""" self.l = [] def rest(node, n): node.val = n self.l.append(n) if node.left != None: rest(node.left, 2 * n + 1) if node.right != None: rest(...
the_stack_v2_python_sparse
Contest/weekly-contest-163/B.py
LuoJiaji/LeetCode-Demo
train
0
b0abfe2d46fcc754b6e2fddb63554cee42990925
[ "res = []\nqueue = []\nn = len(nums)\nif n == 0 or k < 1 or n < k:\n return res\nif k == 1:\n return nums\nfor i in range(len(nums)):\n while queue and queue[0] < i - k + 1:\n queue.pop(0)\n while queue and queue[0] < nums[i]:\n queue.pop()\n queue.append(nums[i])\n if i >= k - 1:\n ...
<|body_start_0|> res = [] queue = [] n = len(nums) if n == 0 or k < 1 or n < k: return res if k == 1: return nums for i in range(len(nums)): while queue and queue[0] < i - k + 1: queue.pop(0) while queue and ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxSlidingWindow1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_009563
1,111
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxSlidingWindow1", "signature": "def maxSlidingWindow1...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxSlidingWindow1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxSlidingWindow1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[...
56730ff8cf432dda08bb56a0e783400d0375af69
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxSlidingWindow1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" res = [] queue = [] n = len(nums) if n == 0 or k < 1 or n < k: return res if k == 1: return nums for i in range(len(nums)): ...
the_stack_v2_python_sparse
239-滑动窗口最大值.py
kt8506/Leetcode
train
0
122c588d57997f9321217bfeded4ff5641c1fb71
[ "rospy.init_node('mapper')\nself._map = Map()\nrospy.Subscriber('scan', LaserScan, self.scan_callback, queue_size=1)\nself._map_pub = rospy.Publisher('map', OccupancyGrid, latch=True)\nself._map_data_pub = rospy.Publisher('map_metadata', MapMetaData, latch=True)\nrospy.spin()", "self._map.grid[0, 0] = 1.0\nself._...
<|body_start_0|> rospy.init_node('mapper') self._map = Map() rospy.Subscriber('scan', LaserScan, self.scan_callback, queue_size=1) self._map_pub = rospy.Publisher('map', OccupancyGrid, latch=True) self._map_data_pub = rospy.Publisher('map_metadata', MapMetaData, latch=True) ...
The Mapper class creates a map from laser scan data.
Mapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mapper: """The Mapper class creates a map from laser scan data.""" def __init__(self): """Start the mapper.""" <|body_0|> def scan_callback(self, scan): """Update the map on every scan callback.""" <|body_1|> def publish_map(self): """Publish...
stack_v2_sparse_classes_36k_train_009564
5,549
permissive
[ { "docstring": "Start the mapper.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Update the map on every scan callback.", "name": "scan_callback", "signature": "def scan_callback(self, scan)" }, { "docstring": "Publish the map.", "name": "publish_m...
3
stack_v2_sparse_classes_30k_train_010246
Implement the Python class `Mapper` described below. Class description: The Mapper class creates a map from laser scan data. Method signatures and docstrings: - def __init__(self): Start the mapper. - def scan_callback(self, scan): Update the map on every scan callback. - def publish_map(self): Publish the map.
Implement the Python class `Mapper` described below. Class description: The Mapper class creates a map from laser scan data. Method signatures and docstrings: - def __init__(self): Start the mapper. - def scan_callback(self, scan): Update the map on every scan callback. - def publish_map(self): Publish the map. <|sk...
43387024c313e40596dd49f1686d2bb1e7f7e319
<|skeleton|> class Mapper: """The Mapper class creates a map from laser scan data.""" def __init__(self): """Start the mapper.""" <|body_0|> def scan_callback(self, scan): """Update the map on every scan callback.""" <|body_1|> def publish_map(self): """Publish...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mapper: """The Mapper class creates a map from laser scan data.""" def __init__(self): """Start the mapper.""" rospy.init_node('mapper') self._map = Map() rospy.Subscriber('scan', LaserScan, self.scan_callback, queue_size=1) self._map_pub = rospy.Publisher('map', O...
the_stack_v2_python_sparse
crazyflie_demo/scripts/mapping/mapper.py
GalBrandwine/crazyflie_ros
train
3
d2f3d49bf5f78ff8cb305248996145feb19f8f8a
[ "commission_df = self.capital.commission.commission_df\ncommission_df['commission'] = commission_df.commission.astype(float)\ncommission_df['cumsum'] = commission_df.commission.cumsum()\n'\\n eg:\\n type\\tdate\\tsymbol\\tcommission\\tcumsum\\n 0\\tbuy\\t20141024\\tusAAPL\\t19.0...
<|body_start_0|> commission_df = self.capital.commission.commission_df commission_df['commission'] = commission_df.commission.astype(float) commission_df['cumsum'] = commission_df.commission.cumsum() '\n eg:\n type\tdate\tsymbol\tcommission\tcumsum\n ...
扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()
MetricsDemo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricsDemo: """扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()""" def _metrics_extend_stats(self): """子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比""" <|body_0|> def plot_commission(self): ""...
stack_v2_sparse_classes_36k_train_009565
27,337
permissive
[ { "docstring": "子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比", "name": "_metrics_extend_stats", "signature": "def _metrics_extend_stats(self)" }, { "docstring": "使用计算好的首先费cumsum序列和策略收益cumsum序列进行可视化对比 可视化收益曲线和手续费曲线之前的关系", "name": "plot_commission", "signature": "def plot_c...
2
stack_v2_sparse_classes_30k_train_013060
Implement the Python class `MetricsDemo` described below. Class description: 扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission() Method signatures and docstrings: - def _metrics_extend_stats(self): 子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比 - def p...
Implement the Python class `MetricsDemo` described below. Class description: 扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission() Method signatures and docstrings: - def _metrics_extend_stats(self): 子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比 - def p...
2e5ab17f2d20deb3c68c927f6208ea89db7c639d
<|skeleton|> class MetricsDemo: """扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()""" def _metrics_extend_stats(self): """子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比""" <|body_0|> def plot_commission(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetricsDemo: """扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()""" def _metrics_extend_stats(self): """子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比""" commission_df = self.capital.commission.commission_df comm...
the_stack_v2_python_sparse
abupy/MetricsBu/ABuMetricsBase.py
luqin/firefly
train
1
f8487547fda2de67d1e7941cf9aaf7709a45c0f5
[ "errors = []\nif not PY3:\n errors.append('Pyats and Genie require Python 3')\nif not HAS_GENIE:\n errors.append(missing_required_lib('genie'))\nif not HAS_PYATS:\n errors.append(missing_required_lib('pyats'))\nreturn errors", "errors = []\nif not self._task_args.get('parser').get('command'):\n errors...
<|body_start_0|> errors = [] if not PY3: errors.append('Pyats and Genie require Python 3') if not HAS_GENIE: errors.append(missing_required_lib('genie')) if not HAS_PYATS: errors.append(missing_required_lib('pyats')) return errors <|end_body_0|...
The pyats parser class Convert raw text to structured data using pyats/genie
CliParser
[ "MIT", "GPL-3.0-or-later", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CliParser: """The pyats parser class Convert raw text to structured data using pyats/genie""" def _check_reqs(): """Check the prerequisites are installed for pyats/genie :return dict: A dict with a list of errors""" <|body_0|> def _check_vars(self): """Ensure spe...
stack_v2_sparse_classes_36k_train_009566
3,777
permissive
[ { "docstring": "Check the prerequisites are installed for pyats/genie :return dict: A dict with a list of errors", "name": "_check_reqs", "signature": "def _check_reqs()" }, { "docstring": "Ensure specific args are set :return: A dict with a list of errors :rtype: dict", "name": "_check_vars...
4
null
Implement the Python class `CliParser` described below. Class description: The pyats parser class Convert raw text to structured data using pyats/genie Method signatures and docstrings: - def _check_reqs(): Check the prerequisites are installed for pyats/genie :return dict: A dict with a list of errors - def _check_v...
Implement the Python class `CliParser` described below. Class description: The pyats parser class Convert raw text to structured data using pyats/genie Method signatures and docstrings: - def _check_reqs(): Check the prerequisites are installed for pyats/genie :return dict: A dict with a list of errors - def _check_v...
2ea7d4f00212f502bc684ac257371ada73da1ca9
<|skeleton|> class CliParser: """The pyats parser class Convert raw text to structured data using pyats/genie""" def _check_reqs(): """Check the prerequisites are installed for pyats/genie :return dict: A dict with a list of errors""" <|body_0|> def _check_vars(self): """Ensure spe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CliParser: """The pyats parser class Convert raw text to structured data using pyats/genie""" def _check_reqs(): """Check the prerequisites are installed for pyats/genie :return dict: A dict with a list of errors""" errors = [] if not PY3: errors.append('Pyats and Geni...
the_stack_v2_python_sparse
intro-ansible/venv3/lib/python3.8/site-packages/ansible_collections/ansible/netcommon/plugins/cli_parsers/pyats_parser.py
SimonFangCisco/dne-dna-code
train
0
50c65f4e0d4b1239c3c352e993931fa3e4e5048e
[ "existing = User.objects.filter(username__iexact=self.cleaned_data['username'])\nif existing.exists():\n raise forms.ValidationError(_('A user with that username already exists.'))\nelse:\n return self.cleaned_data['username']", "if User.objects.filter(email__iexact=self.cleaned_data['email']):\n raise f...
<|body_start_0|> existing = User.objects.filter(username__iexact=self.cleaned_data['username']) if existing.exists(): raise forms.ValidationError(_('A user with that username already exists.')) else: return self.cleaned_data['username'] <|end_body_0|> <|body_start_1|> ...
Base class with common methods for all those forms that deal with the UserProfile model.
BaseUserProfileForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUserProfileForm: """Base class with common methods for all those forms that deal with the UserProfile model.""" def clean_username(self): """Validate that the username is not already in use.""" <|body_0|> def clean_email(self): """Validate that the email is u...
stack_v2_sparse_classes_36k_train_009567
5,500
permissive
[ { "docstring": "Validate that the username is not already in use.", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Validate that the email is unique in the database and that it is not part of a free email provider.", "name": "clean_email", "signature...
3
null
Implement the Python class `BaseUserProfileForm` described below. Class description: Base class with common methods for all those forms that deal with the UserProfile model. Method signatures and docstrings: - def clean_username(self): Validate that the username is not already in use. - def clean_email(self): Validat...
Implement the Python class `BaseUserProfileForm` described below. Class description: Base class with common methods for all those forms that deal with the UserProfile model. Method signatures and docstrings: - def clean_username(self): Validate that the username is not already in use. - def clean_email(self): Validat...
3bb15f4d4dcd543d6f95d1fda2cb737de0bb9a9b
<|skeleton|> class BaseUserProfileForm: """Base class with common methods for all those forms that deal with the UserProfile model.""" def clean_username(self): """Validate that the username is not already in use.""" <|body_0|> def clean_email(self): """Validate that the email is u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseUserProfileForm: """Base class with common methods for all those forms that deal with the UserProfile model.""" def clean_username(self): """Validate that the username is not already in use.""" existing = User.objects.filter(username__iexact=self.cleaned_data['username']) if e...
the_stack_v2_python_sparse
services/accounts/forms.py
satnet-project/server
train
4
875b5417d9c706049f4e5c536a9252b64aa93c63
[ "s = 1\nmemory = set()\nwhile s <= 10 ** 9:\n a = sorted(list(str(s)))\n stt = ''.join(a)\n memory.add(stt)\n s *= 2\nif ''.join(sorted(list(str(N)))) in memory:\n return True\nelse:\n return False", "pows = []\nfor q in range(0, 31):\n pows.append(2 ** q)\ncandidates = []\ndim = len(str(N))\...
<|body_start_0|> s = 1 memory = set() while s <= 10 ** 9: a = sorted(list(str(s))) stt = ''.join(a) memory.add(stt) s *= 2 if ''.join(sorted(list(str(N)))) in memory: return True else: return False <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reorderedPowerOf2(self, N): """:type N: int :rtype: bool 24 ms""" <|body_0|> def reorderedPowerOf2_1(self, N): """24ms :param N: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = 1 memory = set() while s <= 1...
stack_v2_sparse_classes_36k_train_009568
1,537
no_license
[ { "docstring": ":type N: int :rtype: bool 24 ms", "name": "reorderedPowerOf2", "signature": "def reorderedPowerOf2(self, N)" }, { "docstring": "24ms :param N: :return:", "name": "reorderedPowerOf2_1", "signature": "def reorderedPowerOf2_1(self, N)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderedPowerOf2(self, N): :type N: int :rtype: bool 24 ms - def reorderedPowerOf2_1(self, N): 24ms :param N: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderedPowerOf2(self, N): :type N: int :rtype: bool 24 ms - def reorderedPowerOf2_1(self, N): 24ms :param N: :return: <|skeleton|> class Solution: def reorderedPowerO...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def reorderedPowerOf2(self, N): """:type N: int :rtype: bool 24 ms""" <|body_0|> def reorderedPowerOf2_1(self, N): """24ms :param N: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reorderedPowerOf2(self, N): """:type N: int :rtype: bool 24 ms""" s = 1 memory = set() while s <= 10 ** 9: a = sorted(list(str(s))) stt = ''.join(a) memory.add(stt) s *= 2 if ''.join(sorted(list(str(N)))) in ...
the_stack_v2_python_sparse
ReorderedPowerOf2_MID_869.py
953250587/leetcode-python
train
2
534837d0f7bf9977c629f194c52f99eb17ae3824
[ "C = self.COEFFS[imt]\nmagML = ghasemi_bl_mw2ml(rup.mag)\nc0 = 0.0\nR = np.sqrt(dists.rhypo ** 2 + c0 ** 2)\nmean = C['a'] * np.exp(C['b'] * magML) * R ** (-1 * C['c'])\nif isinstance(imt, PGA):\n mean = np.log(mean / g)\nelse:\n mean = np.log(mean / 10.0)\nstddevs = self._get_stddevs(C, stddev_types, dists.r...
<|body_start_0|> C = self.COEFFS[imt] magML = ghasemi_bl_mw2ml(rup.mag) c0 = 0.0 R = np.sqrt(dists.rhypo ** 2 + c0 ** 2) mean = C['a'] * np.exp(C['b'] * magML) * R ** (-1 * C['c']) if isinstance(imt, PGA): mean = np.log(mean / g) else: mean...
Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps of Australia, Aust. J. Earth. Sci. 37, 169-187, doi...
GaullEtAL1990PGA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaullEtAL1990PGA: """Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps of Aust...
stack_v2_sparse_classes_36k_train_009569
14,553
no_license
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Return total standa...
2
null
Implement the Python class `GaullEtAL1990PGA` described below. Class description: Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Pro...
Implement the Python class `GaullEtAL1990PGA` described below. Class description: Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Pro...
86a3af0b52fe51470754291700f9a985b5177e2a
<|skeleton|> class GaullEtAL1990PGA: """Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps of Aust...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaullEtAL1990PGA: """Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps of Australia, Aust. ...
the_stack_v2_python_sparse
ground_motion/gaull_1990.py
GeoscienceAustralia/NSHA2018
train
7
295679ff012c1affd66b34ce090d1566772f469d
[ "self.validate_parameters(content_type=content_type, body=body)\n_url_path = '/aggregation/v2/partners/authentication'\n_query_builder = Configuration.get_base_uri()\n_query_builder += _url_path\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'Finicity-App-Key': Configuration.finicity_app_key, 'Conte...
<|body_start_0|> self.validate_parameters(content_type=content_type, body=body) _url_path = '/aggregation/v2/partners/authentication' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_url = APIHelper.clean_url(_query_builder) _headers = {'Fi...
A Controller to access Endpoints in the finicityapi API.
AuthenticationController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationController: """A Controller to access Endpoints in the finicityapi API.""" def modify_partner_secret(self, content_type, body): """Does a PUT request to /aggregation/v2/partners/authentication. Change the partner secret that is used to authenticate this partner. The sec...
stack_v2_sparse_classes_36k_train_009570
5,124
permissive
[ { "docstring": "Does a PUT request to /aggregation/v2/partners/authentication. Change the partner secret that is used to authenticate this partner. The secret does not expire, but can be changed by calling Modify Partner Secret. A valid partner secret may contain upper- and lowercase characters, numbers, and th...
2
null
Implement the Python class `AuthenticationController` described below. Class description: A Controller to access Endpoints in the finicityapi API. Method signatures and docstrings: - def modify_partner_secret(self, content_type, body): Does a PUT request to /aggregation/v2/partners/authentication. Change the partner ...
Implement the Python class `AuthenticationController` described below. Class description: A Controller to access Endpoints in the finicityapi API. Method signatures and docstrings: - def modify_partner_secret(self, content_type, body): Does a PUT request to /aggregation/v2/partners/authentication. Change the partner ...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class AuthenticationController: """A Controller to access Endpoints in the finicityapi API.""" def modify_partner_secret(self, content_type, body): """Does a PUT request to /aggregation/v2/partners/authentication. Change the partner secret that is used to authenticate this partner. The sec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticationController: """A Controller to access Endpoints in the finicityapi API.""" def modify_partner_secret(self, content_type, body): """Does a PUT request to /aggregation/v2/partners/authentication. Change the partner secret that is used to authenticate this partner. The secret does not ...
the_stack_v2_python_sparse
finicityapi/controllers/authentication_controller.py
monarchmoney/finicity-python
train
0
42b7a0649aa3139970e87a4a25ab0400c011e289
[ "query = {}\nif related_rule_id:\n query['rule__id'] = related_rule_id\nqueryset = ScheduledTask.filter(**query).prefetch_related('rule').offset(offset).limit(limit).order_by('-created_at')\nreturn await ScheduledTask_Pydantic.from_queryset(queryset)", "task = await ScheduledTask.get(id=task_id)\nif task is No...
<|body_start_0|> query = {} if related_rule_id: query['rule__id'] = related_rule_id queryset = ScheduledTask.filter(**query).prefetch_related('rule').offset(offset).limit(limit).order_by('-created_at') return await ScheduledTask_Pydantic.from_queryset(queryset) <|end_body_0|>...
ScheduledTaskRepository
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduledTaskRepository: async def get(offset: int, limit: int, related_rule_id: int=None) -> List[ScheduledTask]: """Get the list of scheduled tasks. :return: list of scheduled tasks""" <|body_0|> async def delete(task_id): """Delete a scheduled task. :return: None"...
stack_v2_sparse_classes_36k_train_009571
1,095
permissive
[ { "docstring": "Get the list of scheduled tasks. :return: list of scheduled tasks", "name": "get", "signature": "async def get(offset: int, limit: int, related_rule_id: int=None) -> List[ScheduledTask]" }, { "docstring": "Delete a scheduled task. :return: None", "name": "delete", "signat...
2
stack_v2_sparse_classes_30k_train_009096
Implement the Python class `ScheduledTaskRepository` described below. Class description: Implement the ScheduledTaskRepository class. Method signatures and docstrings: - async def get(offset: int, limit: int, related_rule_id: int=None) -> List[ScheduledTask]: Get the list of scheduled tasks. :return: list of schedule...
Implement the Python class `ScheduledTaskRepository` described below. Class description: Implement the ScheduledTaskRepository class. Method signatures and docstrings: - async def get(offset: int, limit: int, related_rule_id: int=None) -> List[ScheduledTask]: Get the list of scheduled tasks. :return: list of schedule...
ac3a15014ad3c3bdac523a6550934a06653cfba1
<|skeleton|> class ScheduledTaskRepository: async def get(offset: int, limit: int, related_rule_id: int=None) -> List[ScheduledTask]: """Get the list of scheduled tasks. :return: list of scheduled tasks""" <|body_0|> async def delete(task_id): """Delete a scheduled task. :return: None"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScheduledTaskRepository: async def get(offset: int, limit: int, related_rule_id: int=None) -> List[ScheduledTask]: """Get the list of scheduled tasks. :return: list of scheduled tasks""" query = {} if related_rule_id: query['rule__id'] = related_rule_id queryset = S...
the_stack_v2_python_sparse
packages/task-scheduler/task_scheduler/repositories/scheduled_task_handler.py
matiasbavera/romi-dashboard
train
0
d868ea090a733a04664cb48ed4c09b2648e6326b
[ "pygame.sprite.Sprite.__init__(self)\nself.image = energy_source\nself.rect = self.image.get_rect()\nself.rect.bottom = 0\nself.rect.left = left_coordinate\nif energy_source in config.fossil_fuel_types:\n self.type = 'fossil fuel'\nelif energy_source in config.green_energy_types:\n self.type = 'green energy'\...
<|body_start_0|> pygame.sprite.Sprite.__init__(self) self.image = energy_source self.rect = self.image.get_rect() self.rect.bottom = 0 self.rect.left = left_coordinate if energy_source in config.fossil_fuel_types: self.type = 'fossil fuel' elif energy_...
Icon
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Icon: def __init__(self, energy_source, left_coordinate): """Each icon has an image, an energy source, an energy type, and an x-coordinate. Newly generated icons always start at the top of the screen, i.e. their initial y-coordinates are always 0.""" <|body_0|> def update(se...
stack_v2_sparse_classes_36k_train_009572
13,592
permissive
[ { "docstring": "Each icon has an image, an energy source, an energy type, and an x-coordinate. Newly generated icons always start at the top of the screen, i.e. their initial y-coordinates are always 0.", "name": "__init__", "signature": "def __init__(self, energy_source, left_coordinate)" }, { ...
2
stack_v2_sparse_classes_30k_train_003959
Implement the Python class `Icon` described below. Class description: Implement the Icon class. Method signatures and docstrings: - def __init__(self, energy_source, left_coordinate): Each icon has an image, an energy source, an energy type, and an x-coordinate. Newly generated icons always start at the top of the sc...
Implement the Python class `Icon` described below. Class description: Implement the Icon class. Method signatures and docstrings: - def __init__(self, energy_source, left_coordinate): Each icon has an image, an energy source, an energy type, and an x-coordinate. Newly generated icons always start at the top of the sc...
3c2a1d1937aeed89bb891f5b6f93a6ce053af42a
<|skeleton|> class Icon: def __init__(self, energy_source, left_coordinate): """Each icon has an image, an energy source, an energy type, and an x-coordinate. Newly generated icons always start at the top of the screen, i.e. their initial y-coordinates are always 0.""" <|body_0|> def update(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Icon: def __init__(self, energy_source, left_coordinate): """Each icon has an image, an energy source, an energy type, and an x-coordinate. Newly generated icons always start at the top of the screen, i.e. their initial y-coordinates are always 0.""" pygame.sprite.Sprite.__init__(self) ...
the_stack_v2_python_sparse
just_jaguars/main.py
python-discord/code-jam-5
train
32
02c91f2467e94ca1593e9720b4ffaa832584372c
[ "self.workspace_dir = workspace_dir\nself.taskgraph = taskgraph\nself._perfdocs_tree = []\nself._test_list = []\nself.framework_gatherers = {}", "if self._perfdocs_tree:\n return self._perfdocs_tree\nelse:\n self.fetch_perfdocs_tree()\n return self._perfdocs_tree", "exclude_dir = [str(pathlib.Path(self...
<|body_start_0|> self.workspace_dir = workspace_dir self.taskgraph = taskgraph self._perfdocs_tree = [] self._test_list = [] self.framework_gatherers = {} <|end_body_0|> <|body_start_1|> if self._perfdocs_tree: return self._perfdocs_tree else: ...
Gatherer produces the tree of the perfdoc's entries found and can obtain manifest-based test lists. Used by the Verifier.
Gatherer
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gatherer: """Gatherer produces the tree of the perfdoc's entries found and can obtain manifest-based test lists. Used by the Verifier.""" def __init__(self, workspace_dir, taskgraph=None): """Initialzie the Gatherer. :param str workspace_dir: Path to the gecko checkout.""" <|...
stack_v2_sparse_classes_36k_train_009573
5,170
permissive
[ { "docstring": "Initialzie the Gatherer. :param str workspace_dir: Path to the gecko checkout.", "name": "__init__", "signature": "def __init__(self, workspace_dir, taskgraph=None)" }, { "docstring": "Returns the perfdocs_tree, and computes it if it doesn't exist. :return dict: The perfdocs tree...
4
stack_v2_sparse_classes_30k_train_017187
Implement the Python class `Gatherer` described below. Class description: Gatherer produces the tree of the perfdoc's entries found and can obtain manifest-based test lists. Used by the Verifier. Method signatures and docstrings: - def __init__(self, workspace_dir, taskgraph=None): Initialzie the Gatherer. :param str...
Implement the Python class `Gatherer` described below. Class description: Gatherer produces the tree of the perfdoc's entries found and can obtain manifest-based test lists. Used by the Verifier. Method signatures and docstrings: - def __init__(self, workspace_dir, taskgraph=None): Initialzie the Gatherer. :param str...
304e9eaa3d7dbfab38d5b5401cbae227b20efe37
<|skeleton|> class Gatherer: """Gatherer produces the tree of the perfdoc's entries found and can obtain manifest-based test lists. Used by the Verifier.""" def __init__(self, workspace_dir, taskgraph=None): """Initialzie the Gatherer. :param str workspace_dir: Path to the gecko checkout.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gatherer: """Gatherer produces the tree of the perfdoc's entries found and can obtain manifest-based test lists. Used by the Verifier.""" def __init__(self, workspace_dir, taskgraph=None): """Initialzie the Gatherer. :param str workspace_dir: Path to the gecko checkout.""" self.workspace_...
the_stack_v2_python_sparse
tools/lint/perfdocs/gatherer.py
mozilla/gecko-dev
train
3,025
a5d2a01592fa38f7a771156c5f4db5ad4217b7d0
[ "locks = []\nwith sqla_session() as session:\n for lock in session.query(Joblock).all():\n locks.append(lock.as_dict())\nreturn empty_result('success', data={'locks': locks})", "json_data = request.get_json()\nif 'name' not in json_data or not json_data['name']:\n return (empty_result('error', 'No lo...
<|body_start_0|> locks = [] with sqla_session() as session: for lock in session.query(Joblock).all(): locks.append(lock.as_dict()) return empty_result('success', data={'locks': locks}) <|end_body_0|> <|body_start_1|> json_data = request.get_json() if ...
JobLockApi
[ "BSD-2-Clause-Views", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobLockApi: def get(self): """Get job locks""" <|body_0|> def delete(self): """Remove job locks""" <|body_1|> <|end_skeleton|> <|body_start_0|> locks = [] with sqla_session() as session: for lock in session.query(Joblock).all(): ...
stack_v2_sparse_classes_36k_train_009574
7,253
permissive
[ { "docstring": "Get job locks", "name": "get", "signature": "def get(self)" }, { "docstring": "Remove job locks", "name": "delete", "signature": "def delete(self)" } ]
2
null
Implement the Python class `JobLockApi` described below. Class description: Implement the JobLockApi class. Method signatures and docstrings: - def get(self): Get job locks - def delete(self): Remove job locks
Implement the Python class `JobLockApi` described below. Class description: Implement the JobLockApi class. Method signatures and docstrings: - def get(self): Get job locks - def delete(self): Remove job locks <|skeleton|> class JobLockApi: def get(self): """Get job locks""" <|body_0|> def ...
d755dfed69bebe0c7bea66ad1802cba2cd89fec8
<|skeleton|> class JobLockApi: def get(self): """Get job locks""" <|body_0|> def delete(self): """Remove job locks""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobLockApi: def get(self): """Get job locks""" locks = [] with sqla_session() as session: for lock in session.query(Joblock).all(): locks.append(lock.as_dict()) return empty_result('success', data={'locks': locks}) def delete(self): """R...
the_stack_v2_python_sparse
src/cnaas_nms/api/jobs.py
SUNET/cnaas-nms
train
67
699564b8c3cc39e4de4f8d63af6b78ecdf31862a
[ "self.optimizer = optimizer\nself.decay_rate = decay_rate\nself.minimum_lr = minimum_lr\nself.epoch_cnt = 0\nself.epoch_start_decay = epoch_start_decay", "self.epoch_cnt += 1\nif self.epoch_cnt >= self.epoch_start_decay:\n for param_group in self.optimizer.param_groups:\n if param_group['lr'] * self.dec...
<|body_start_0|> self.optimizer = optimizer self.decay_rate = decay_rate self.minimum_lr = minimum_lr self.epoch_cnt = 0 self.epoch_start_decay = epoch_start_decay <|end_body_0|> <|body_start_1|> self.epoch_cnt += 1 if self.epoch_cnt >= self.epoch_start_decay: ...
LRScheduler
[ "MIT", "BSD-3-Clause", "LGPL-2.1-or-later", "GPL-3.0-only", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRScheduler: def __init__(self, optimizer, decay_rate=1, minimum_lr=0, epoch_start_decay=1): """Args: optimizer: decay_rate: minimum_lr: if lr < minimum_lr, stop lr decay""" <|body_0|> def step(self): """adjust learning rate Args: optimizer: decay_rate: minimum_lr: R...
stack_v2_sparse_classes_36k_train_009575
1,425
permissive
[ { "docstring": "Args: optimizer: decay_rate: minimum_lr: if lr < minimum_lr, stop lr decay", "name": "__init__", "signature": "def __init__(self, optimizer, decay_rate=1, minimum_lr=0, epoch_start_decay=1)" }, { "docstring": "adjust learning rate Args: optimizer: decay_rate: minimum_lr: Returns:...
3
null
Implement the Python class `LRScheduler` described below. Class description: Implement the LRScheduler class. Method signatures and docstrings: - def __init__(self, optimizer, decay_rate=1, minimum_lr=0, epoch_start_decay=1): Args: optimizer: decay_rate: minimum_lr: if lr < minimum_lr, stop lr decay - def step(self):...
Implement the Python class `LRScheduler` described below. Class description: Implement the LRScheduler class. Method signatures and docstrings: - def __init__(self, optimizer, decay_rate=1, minimum_lr=0, epoch_start_decay=1): Args: optimizer: decay_rate: minimum_lr: if lr < minimum_lr, stop lr decay - def step(self):...
47e03e09589e86d16c609511bf875bd3e3ff3a3e
<|skeleton|> class LRScheduler: def __init__(self, optimizer, decay_rate=1, minimum_lr=0, epoch_start_decay=1): """Args: optimizer: decay_rate: minimum_lr: if lr < minimum_lr, stop lr decay""" <|body_0|> def step(self): """adjust learning rate Args: optimizer: decay_rate: minimum_lr: R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRScheduler: def __init__(self, optimizer, decay_rate=1, minimum_lr=0, epoch_start_decay=1): """Args: optimizer: decay_rate: minimum_lr: if lr < minimum_lr, stop lr decay""" self.optimizer = optimizer self.decay_rate = decay_rate self.minimum_lr = minimum_lr self.epoch_...
the_stack_v2_python_sparse
core/LRScheduler.py
microsoft/NeuronBlocks
train
1,308
d4cc121dc4da2ca81e100bf2acb364ed55606185
[ "queryset = Like.objects.all()\nif self.action == 'destroy':\n return queryset.filter(id=self.kwargs['pk'])\nreturn queryset", "if self.action in ['destroy']:\n permissions = [IsAuthenticated, IsObjectOwner]\nelse:\n permissions = [IsAuthenticated]\nreturn [p() for p in permissions]", "queryset = Like....
<|body_start_0|> queryset = Like.objects.all() if self.action == 'destroy': return queryset.filter(id=self.kwargs['pk']) return queryset <|end_body_0|> <|body_start_1|> if self.action in ['destroy']: permissions = [IsAuthenticated, IsObjectOwner] else: ...
LikeViewSet Handle create, delete, list of photos.
LikeViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LikeViewSet: """LikeViewSet Handle create, delete, list of photos.""" def get_queryset(self): """Restrict list to public-only.""" <|body_0|> def get_permissions(self): """Assign permissions based on action.""" <|body_1|> def list(self, request, photo...
stack_v2_sparse_classes_36k_train_009576
2,329
permissive
[ { "docstring": "Restrict list to public-only.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Assign permissions based on action.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Show all the likes of a ph...
5
stack_v2_sparse_classes_30k_train_009227
Implement the Python class `LikeViewSet` described below. Class description: LikeViewSet Handle create, delete, list of photos. Method signatures and docstrings: - def get_queryset(self): Restrict list to public-only. - def get_permissions(self): Assign permissions based on action. - def list(self, request, photo_pk=...
Implement the Python class `LikeViewSet` described below. Class description: LikeViewSet Handle create, delete, list of photos. Method signatures and docstrings: - def get_queryset(self): Restrict list to public-only. - def get_permissions(self): Assign permissions based on action. - def list(self, request, photo_pk=...
83b79ed62e21c654d0945decaaf6571e19c8c12a
<|skeleton|> class LikeViewSet: """LikeViewSet Handle create, delete, list of photos.""" def get_queryset(self): """Restrict list to public-only.""" <|body_0|> def get_permissions(self): """Assign permissions based on action.""" <|body_1|> def list(self, request, photo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LikeViewSet: """LikeViewSet Handle create, delete, list of photos.""" def get_queryset(self): """Restrict list to public-only.""" queryset = Like.objects.all() if self.action == 'destroy': return queryset.filter(id=self.kwargs['pk']) return queryset def ge...
the_stack_v2_python_sparse
ig_clone_api/photos/views/likes.py
whosgriffith/ig-clone-api
train
0
40a09b99a7c2006ccc96eb2d335de2e5e8420b6f
[ "export = ExportValues(expression)\nexport_values = export.result()\nresults = []\nfor dep_var in self.DEPRECATED_SOLIDITY_VARIABLE:\n if SolidityVariableComposed(dep_var[0]) in export_values:\n results.append(dep_var)\nfor dep_func in self.DEPRECATED_SOLIDITY_FUNCTIONS:\n if SolidityFunction(dep_func[...
<|body_start_0|> export = ExportValues(expression) export_values = export.result() results = [] for dep_var in self.DEPRECATED_SOLIDITY_VARIABLE: if SolidityVariableComposed(dep_var[0]) in export_values: results.append(dep_var) for dep_func in self.DEP...
Use of Deprecated Standards
DeprecatedStandards
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeprecatedStandards: """Use of Deprecated Standards""" def detect_deprecation_in_expression(self, expression): """Detects if an expression makes use of any deprecated standards. Returns: list of tuple: (detecting_signature, original_text, recommended_text)""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_009577
6,810
no_license
[ { "docstring": "Detects if an expression makes use of any deprecated standards. Returns: list of tuple: (detecting_signature, original_text, recommended_text)", "name": "detect_deprecation_in_expression", "signature": "def detect_deprecation_in_expression(self, expression)" }, { "docstring": "De...
4
stack_v2_sparse_classes_30k_train_011119
Implement the Python class `DeprecatedStandards` described below. Class description: Use of Deprecated Standards Method signatures and docstrings: - def detect_deprecation_in_expression(self, expression): Detects if an expression makes use of any deprecated standards. Returns: list of tuple: (detecting_signature, ori...
Implement the Python class `DeprecatedStandards` described below. Class description: Use of Deprecated Standards Method signatures and docstrings: - def detect_deprecation_in_expression(self, expression): Detects if an expression makes use of any deprecated standards. Returns: list of tuple: (detecting_signature, ori...
7a55877bdde0d6adabe3ce9c4f92e8ba20b4b3cc
<|skeleton|> class DeprecatedStandards: """Use of Deprecated Standards""" def detect_deprecation_in_expression(self, expression): """Detects if an expression makes use of any deprecated standards. Returns: list of tuple: (detecting_signature, original_text, recommended_text)""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeprecatedStandards: """Use of Deprecated Standards""" def detect_deprecation_in_expression(self, expression): """Detects if an expression makes use of any deprecated standards. Returns: list of tuple: (detecting_signature, original_text, recommended_text)""" export = ExportValues(express...
the_stack_v2_python_sparse
fortress/detectors/statements/deprecated_calls.py
bydolson/fortress-security-audit-engine
train
0
2cf9d6a1def75647a33cbe39020e3bce23df08c9
[ "self.is_classification = is_classification\nif is_classification:\n from sklearn.feature_selection import chi2\n score_func = chi2\n super().__init__(score_func=score_func)\nelse:\n self.error = 'Cannot generate for continuous dependant variable'", "if self.is_classification:\n try:\n self....
<|body_start_0|> self.is_classification = is_classification if is_classification: from sklearn.feature_selection import chi2 score_func = chi2 super().__init__(score_func=score_func) else: self.error = 'Cannot generate for continuous dependant vari...
Returns a bar plot of Chi-square test scores for IDVs. Chi-squared test is used to determine whether there is a statistically significant difference (i.e., a magnitude of difference that is unlikely to be due to chance alone) between the expected frequencies and the observed frequencies in one or more categories of a s...
Chi2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chi2: """Returns a bar plot of Chi-square test scores for IDVs. Chi-squared test is used to determine whether there is a statistically significant difference (i.e., a magnitude of difference that is unlikely to be due to chance alone) between the expected frequencies and the observed frequencies ...
stack_v2_sparse_classes_36k_train_009578
7,737
no_license
[ { "docstring": "Class initializer. Parameters ---------- is_classification: `bool` whether the model you're using is classification or regression. or if the target is `categorical` or `numerical`.", "name": "__init__", "signature": "def __init__(self, is_classification)" }, { "docstring": "Fits ...
3
null
Implement the Python class `Chi2` described below. Class description: Returns a bar plot of Chi-square test scores for IDVs. Chi-squared test is used to determine whether there is a statistically significant difference (i.e., a magnitude of difference that is unlikely to be due to chance alone) between the expected fr...
Implement the Python class `Chi2` described below. Class description: Returns a bar plot of Chi-square test scores for IDVs. Chi-squared test is used to determine whether there is a statistically significant difference (i.e., a magnitude of difference that is unlikely to be due to chance alone) between the expected fr...
be5d8cca769c7e267cfee1932eb82b70c2855bc1
<|skeleton|> class Chi2: """Returns a bar plot of Chi-square test scores for IDVs. Chi-squared test is used to determine whether there is a statistically significant difference (i.e., a magnitude of difference that is unlikely to be due to chance alone) between the expected frequencies and the observed frequencies ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chi2: """Returns a bar plot of Chi-square test scores for IDVs. Chi-squared test is used to determine whether there is a statistically significant difference (i.e., a magnitude of difference that is unlikely to be due to chance alone) between the expected frequencies and the observed frequencies in one or mor...
the_stack_v2_python_sparse
src/ta_lib/_vendor/tigerml/eda/plotters/key_drivers/scoring.py
Seemant-tiger/housing-price-prediction
train
0
81bc2620df61bf6ef4cce9c1ff5c164ab7a0a095
[ "try:\n log = LogInfo({'user_id': user_id, 'client_ip': client_ip, 'action_cn': action_cn, 'action_en': action_en, 'result_cn': result_cn, 'result_en': result_en, 'reason': reason})\n db.session.add(log)\n db.session.commit()\nexcept Exception as ex:\n print(ex)", "log_list = LogInfo.query.desc(LogInf...
<|body_start_0|> try: log = LogInfo({'user_id': user_id, 'client_ip': client_ip, 'action_cn': action_cn, 'action_en': action_en, 'result_cn': result_cn, 'result_en': result_en, 'reason': reason}) db.session.add(log) db.session.commit() except Exception as ex: ...
用于操作日志
LogService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogService: """用于操作日志""" def write_log(client_ip, action_cn, action_en, result_cn, result_en, reason=None, user_id=None): """写操作日志 :param user_id: 用户id :param client_ip: 客户端IP :param action_cn: 操作内容中文 :param action_en: 操作内容英文 :param result_cn: 结果中文 :param result_en: 结果英文 :param reaso...
stack_v2_sparse_classes_36k_train_009579
2,744
no_license
[ { "docstring": "写操作日志 :param user_id: 用户id :param client_ip: 客户端IP :param action_cn: 操作内容中文 :param action_en: 操作内容英文 :param result_cn: 结果中文 :param result_en: 结果英文 :param reason: 失败原因 :return:", "name": "write_log", "signature": "def write_log(client_ip, action_cn, action_en, result_cn, result_en, reason...
2
stack_v2_sparse_classes_30k_train_001853
Implement the Python class `LogService` described below. Class description: 用于操作日志 Method signatures and docstrings: - def write_log(client_ip, action_cn, action_en, result_cn, result_en, reason=None, user_id=None): 写操作日志 :param user_id: 用户id :param client_ip: 客户端IP :param action_cn: 操作内容中文 :param action_en: 操作内容英文 :...
Implement the Python class `LogService` described below. Class description: 用于操作日志 Method signatures and docstrings: - def write_log(client_ip, action_cn, action_en, result_cn, result_en, reason=None, user_id=None): 写操作日志 :param user_id: 用户id :param client_ip: 客户端IP :param action_cn: 操作内容中文 :param action_en: 操作内容英文 :...
efd7a533dc7702ac99f181e2d871f92213e6c067
<|skeleton|> class LogService: """用于操作日志""" def write_log(client_ip, action_cn, action_en, result_cn, result_en, reason=None, user_id=None): """写操作日志 :param user_id: 用户id :param client_ip: 客户端IP :param action_cn: 操作内容中文 :param action_en: 操作内容英文 :param result_cn: 结果中文 :param result_en: 结果英文 :param reaso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogService: """用于操作日志""" def write_log(client_ip, action_cn, action_en, result_cn, result_en, reason=None, user_id=None): """写操作日志 :param user_id: 用户id :param client_ip: 客户端IP :param action_cn: 操作内容中文 :param action_en: 操作内容英文 :param result_cn: 结果中文 :param result_en: 结果英文 :param reason: 失败原因 :retu...
the_stack_v2_python_sparse
Src/services/service.py
AlexYangLong/NIA
train
0
83bbcf4648a55d6e84c5f8ee27b27ce040b290e1
[ "extra_data = {}\nif instance.profile:\n extra_data.update(SocialAuthProfileSerializer(instance.profile).data)\nreturn extra_data", "if 'next' in data:\n backend = self.context['backend']\n redirect_uri = data['next']\n if backend.setting('SANITIZE_REDIRECTS', True):\n allowed_hosts = backend.s...
<|body_start_0|> extra_data = {} if instance.profile: extra_data.update(SocialAuthProfileSerializer(instance.profile).data) return extra_data <|end_body_0|> <|body_start_1|> if 'next' in data: backend = self.context['backend'] redirect_uri = data['nex...
Serializer for social auth
SocialAuthSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialAuthSerializer: """Serializer for social auth""" def get_extra_data(self, instance): """Serialize extra_data""" <|body_0|> def _save_next(self, data): """Persists the next url to the session""" <|body_1|> def _authenticate(self, flow): ...
stack_v2_sparse_classes_36k_train_009580
11,156
permissive
[ { "docstring": "Serialize extra_data", "name": "get_extra_data", "signature": "def get_extra_data(self, instance)" }, { "docstring": "Persists the next url to the session", "name": "_save_next", "signature": "def _save_next(self, data)" }, { "docstring": "Authenticate the current...
4
null
Implement the Python class `SocialAuthSerializer` described below. Class description: Serializer for social auth Method signatures and docstrings: - def get_extra_data(self, instance): Serialize extra_data - def _save_next(self, data): Persists the next url to the session - def _authenticate(self, flow): Authenticate...
Implement the Python class `SocialAuthSerializer` described below. Class description: Serializer for social auth Method signatures and docstrings: - def get_extra_data(self, instance): Serialize extra_data - def _save_next(self, data): Persists the next url to the session - def _authenticate(self, flow): Authenticate...
ba7442482da97d463302658c0aac989567ee1241
<|skeleton|> class SocialAuthSerializer: """Serializer for social auth""" def get_extra_data(self, instance): """Serialize extra_data""" <|body_0|> def _save_next(self, data): """Persists the next url to the session""" <|body_1|> def _authenticate(self, flow): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SocialAuthSerializer: """Serializer for social auth""" def get_extra_data(self, instance): """Serialize extra_data""" extra_data = {} if instance.profile: extra_data.update(SocialAuthProfileSerializer(instance.profile).data) return extra_data def _save_nex...
the_stack_v2_python_sparse
authentication/serializers.py
mitodl/open-discussions
train
13
9dfcac45aea7d6e9e1556106642ada5c49855415
[ "if not edges:\n return 0\ngraph = collections.defaultdict(list)\nindegree = [-1] * (len(edges) + 1)\nfor i, j in edges:\n graph[i].append(j)\n graph[j].append(i)\n indegree[i] += 1\n indegree[j] += 1\ncurr_layer = [i for i, d in enumerate(indegree) if d == 0]\ndiameter = 0\nwhile len(curr_layer) > 1...
<|body_start_0|> if not edges: return 0 graph = collections.defaultdict(list) indegree = [-1] * (len(edges) + 1) for i, j in edges: graph[i].append(j) graph[j].append(i) indegree[i] += 1 indegree[j] += 1 curr_layer = [i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def treeDiameter1(self, edges: List[List[int]]) -> int: """topological sort & bfs""" <|body_0|> def treeDiameter2(self, edges: List[List[int]]) -> int: """dfs""" <|body_1|> def treeDiameter3(self, edges: List[List[int]]) -> int: """bfs"...
stack_v2_sparse_classes_36k_train_009581
3,216
no_license
[ { "docstring": "topological sort & bfs", "name": "treeDiameter1", "signature": "def treeDiameter1(self, edges: List[List[int]]) -> int" }, { "docstring": "dfs", "name": "treeDiameter2", "signature": "def treeDiameter2(self, edges: List[List[int]]) -> int" }, { "docstring": "bfs",...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def treeDiameter1(self, edges: List[List[int]]) -> int: topological sort & bfs - def treeDiameter2(self, edges: List[List[int]]) -> int: dfs - def treeDiameter3(self, edges: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def treeDiameter1(self, edges: List[List[int]]) -> int: topological sort & bfs - def treeDiameter2(self, edges: List[List[int]]) -> int: dfs - def treeDiameter3(self, edges: List...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def treeDiameter1(self, edges: List[List[int]]) -> int: """topological sort & bfs""" <|body_0|> def treeDiameter2(self, edges: List[List[int]]) -> int: """dfs""" <|body_1|> def treeDiameter3(self, edges: List[List[int]]) -> int: """bfs"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def treeDiameter1(self, edges: List[List[int]]) -> int: """topological sort & bfs""" if not edges: return 0 graph = collections.defaultdict(list) indegree = [-1] * (len(edges) + 1) for i, j in edges: graph[i].append(j) graph...
the_stack_v2_python_sparse
Leetcode 1245. Tree Diameter.py
Chaoran-sjsu/leetcode
train
0
7955fe32508e29afac0628346fe447ab0a61423a
[ "super(OperationMap, self).__init__({})\nif new_list is None:\n self['add'] = []\n self['remove'] = []\nelif type(new_list) is list and old_list is None:\n self['add'] = copy.deepcopy(new_list)\n self['remove'] = []\nelif type(new_list) is list and type(old_list) is list:\n self['add'] = []\n self...
<|body_start_0|> super(OperationMap, self).__init__({}) if new_list is None: self['add'] = [] self['remove'] = [] elif type(new_list) is list and old_list is None: self['add'] = copy.deepcopy(new_list) self['remove'] = [] elif type(new_list...
Simple operation map
OperationMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperationMap: """Simple operation map""" def __init__(self, new_list=None, old_list=None): """Operation map can be initialized in 3 ways: 1. without any parameters: build empty operation map 2. with new list given, and old list not provided: build operation map with one list 3. with ...
stack_v2_sparse_classes_36k_train_009582
12,234
no_license
[ { "docstring": "Operation map can be initialized in 3 ways: 1. without any parameters: build empty operation map 2. with new list given, and old list not provided: build operation map with one list 3. with new list and old list provided: build operation map with two lists", "name": "__init__", "signatur...
3
stack_v2_sparse_classes_30k_train_006172
Implement the Python class `OperationMap` described below. Class description: Simple operation map Method signatures and docstrings: - def __init__(self, new_list=None, old_list=None): Operation map can be initialized in 3 ways: 1. without any parameters: build empty operation map 2. with new list given, and old list...
Implement the Python class `OperationMap` described below. Class description: Simple operation map Method signatures and docstrings: - def __init__(self, new_list=None, old_list=None): Operation map can be initialized in 3 ways: 1. without any parameters: build empty operation map 2. with new list given, and old list...
dcc3c3adcaefe55db45da7f8410084ca369f309a
<|skeleton|> class OperationMap: """Simple operation map""" def __init__(self, new_list=None, old_list=None): """Operation map can be initialized in 3 ways: 1. without any parameters: build empty operation map 2. with new list given, and old list not provided: build operation map with one list 3. with ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OperationMap: """Simple operation map""" def __init__(self, new_list=None, old_list=None): """Operation map can be initialized in 3 ways: 1. without any parameters: build empty operation map 2. with new list given, and old list not provided: build operation map with one list 3. with new list and ...
the_stack_v2_python_sparse
crawler/utils/format.py
tickleliu/webcrawler-nlp
train
0
3cf6c6bae7e049f9383abe3e2ccba296248b6a9f
[ "super(CrystalGraphConvNet, self).__init__()\nself.classification = classification\nself.embedding = nn.Linear(orig_atom_fea_len, atom_fea_len)\nself.convs = nn.ModuleList([ConvLayer(atom_fea_len=atom_fea_len, nbr_fea_len=nbr_fea_len) for _ in range(n_conv)])\nself.conv_to_fc = nn.Linear(atom_fea_len, h_fea_len)\ns...
<|body_start_0|> super(CrystalGraphConvNet, self).__init__() self.classification = classification self.embedding = nn.Linear(orig_atom_fea_len, atom_fea_len) self.convs = nn.ModuleList([ConvLayer(atom_fea_len=atom_fea_len, nbr_fea_len=nbr_fea_len) for _ in range(n_conv)]) self.co...
Create a crystal graph convolutional neural network for predicting total material properties. See Also: [CGCNN]_. .. [CGCNN] `Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties`__ __ https://doi.org/10.1103/PhysRevLett.120.145301
CrystalGraphConvNet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrystalGraphConvNet: """Create a crystal graph convolutional neural network for predicting total material properties. See Also: [CGCNN]_. .. [CGCNN] `Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties`__ __ https://doi.org/10.1103/PhysR...
stack_v2_sparse_classes_36k_train_009583
6,960
permissive
[ { "docstring": "Initialize CrystalGraphConvNet. Parameters ---------- orig_atom_fea_len: int Number of atom features in the input. nbr_fea_len: int Number of bond features. atom_fea_len: int Number of hidden atom features in the convolutional layers n_conv: int Number of convolutional layers h_fea_len: int Numb...
3
stack_v2_sparse_classes_30k_test_000981
Implement the Python class `CrystalGraphConvNet` described below. Class description: Create a crystal graph convolutional neural network for predicting total material properties. See Also: [CGCNN]_. .. [CGCNN] `Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Propert...
Implement the Python class `CrystalGraphConvNet` described below. Class description: Create a crystal graph convolutional neural network for predicting total material properties. See Also: [CGCNN]_. .. [CGCNN] `Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Propert...
a1e733e4451706fc751699be884b1e1d318b3d56
<|skeleton|> class CrystalGraphConvNet: """Create a crystal graph convolutional neural network for predicting total material properties. See Also: [CGCNN]_. .. [CGCNN] `Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties`__ __ https://doi.org/10.1103/PhysR...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrystalGraphConvNet: """Create a crystal graph convolutional neural network for predicting total material properties. See Also: [CGCNN]_. .. [CGCNN] `Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties`__ __ https://doi.org/10.1103/PhysRevLett.120.14...
the_stack_v2_python_sparse
xenonpy/model/cgcnn.py
yoshida-lab/XenonPy
train
122
b706369ef24144e3799794161ded0d97f4332de5
[ "self._num_tasks = num_tasks\nself._load_fn = load_fn\nself._ps_loads = np.zeros(num_tasks)", "task = np.argmin(self._ps_loads)\nself._ps_loads[task] += self._load_fn(op)\nreturn task" ]
<|body_start_0|> self._num_tasks = num_tasks self._load_fn = load_fn self._ps_loads = np.zeros(num_tasks) <|end_body_0|> <|body_start_1|> task = np.argmin(self._ps_loads) self._ps_loads[task] += self._load_fn(op) return task <|end_body_1|>
Returns the least-loaded ps task for op placement. The load is calculated by a user-specified load function passed in at construction. There are no units for load, and the load function is responsible for providing an internally consistent measure. Note that this strategy is very sensitive to the exact order in which p...
GreedyLoadBalancingStrategy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GreedyLoadBalancingStrategy: """Returns the least-loaded ps task for op placement. The load is calculated by a user-specified load function passed in at construction. There are no units for load, and the load function is responsible for providing an internally consistent measure. Note that this s...
stack_v2_sparse_classes_36k_train_009584
4,938
permissive
[ { "docstring": "Create a new `LoadBalancingStrategy`. Args: num_tasks: Number of ps tasks to cycle among. load_fn: A callable that takes an `Operation` and returns a numeric load value for that op.", "name": "__init__", "signature": "def __init__(self, num_tasks, load_fn)" }, { "docstring": "Cho...
2
null
Implement the Python class `GreedyLoadBalancingStrategy` described below. Class description: Returns the least-loaded ps task for op placement. The load is calculated by a user-specified load function passed in at construction. There are no units for load, and the load function is responsible for providing an internal...
Implement the Python class `GreedyLoadBalancingStrategy` described below. Class description: Returns the least-loaded ps task for op placement. The load is calculated by a user-specified load function passed in at construction. There are no units for load, and the load function is responsible for providing an internal...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class GreedyLoadBalancingStrategy: """Returns the least-loaded ps task for op placement. The load is calculated by a user-specified load function passed in at construction. There are no units for load, and the load function is responsible for providing an internally consistent measure. Note that this s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GreedyLoadBalancingStrategy: """Returns the least-loaded ps task for op placement. The load is calculated by a user-specified load function passed in at construction. There are no units for load, and the load function is responsible for providing an internally consistent measure. Note that this strategy is ve...
the_stack_v2_python_sparse
Tensorflow/source/tensorflow/contrib/training/python/training/device_setter.py
ryfeus/lambda-packs
train
1,283
9d8d308307823a5e580f7dccb5e5167e55fdf3d5
[ "super(Overlay, self).__init__(parent=parent)\nself.setObjectName('overlay')\nself.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Plain)\napplication = QtCore.QCoreApplication.instance()\napplication.installEventFilter(self)", "if visible:\n parent = self.parent()\n if parent.hasFocus():\n ...
<|body_start_0|> super(Overlay, self).__init__(parent=parent) self.setObjectName('overlay') self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Plain) application = QtCore.QCoreApplication.instance() application.installEventFilter(self) <|end_body_0|> <|body_start...
Display a transparent overlay over another widget. Customise the background colour using stylesheets. The widget has an object name of "overlay". While the overlay is active, the target widget and its children will not receive interaction events from the user (e.g. focus).
Overlay
[ "Apache-2.0", "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Overlay: """Display a transparent overlay over another widget. Customise the background colour using stylesheets. The widget has an object name of "overlay". While the overlay is active, the target widget and its children will not receive interaction events from the user (e.g. focus).""" def...
stack_v2_sparse_classes_36k_train_009585
8,378
permissive
[ { "docstring": "Initialise overlay for target *parent*.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Set whether *visible* or not.", "name": "setVisible", "signature": "def setVisible(self, visible)" }, { "docstring": "Filter *event* sent to ...
3
stack_v2_sparse_classes_30k_train_012435
Implement the Python class `Overlay` described below. Class description: Display a transparent overlay over another widget. Customise the background colour using stylesheets. The widget has an object name of "overlay". While the overlay is active, the target widget and its children will not receive interaction events ...
Implement the Python class `Overlay` described below. Class description: Display a transparent overlay over another widget. Customise the background colour using stylesheets. The widget has an object name of "overlay". While the overlay is active, the target widget and its children will not receive interaction events ...
f55f52787484fcf931c4653e7e241791f052c04f
<|skeleton|> class Overlay: """Display a transparent overlay over another widget. Customise the background colour using stylesheets. The widget has an object name of "overlay". While the overlay is active, the target widget and its children will not receive interaction events from the user (e.g. focus).""" def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Overlay: """Display a transparent overlay over another widget. Customise the background colour using stylesheets. The widget has an object name of "overlay". While the overlay is active, the target widget and its children will not receive interaction events from the user (e.g. focus).""" def __init__(sel...
the_stack_v2_python_sparse
source/ftrack_connect/ui/widget/overlay.py
IngenuityEngine/ftrack-connect
train
0
ce95eb12dbc3cb587d1f028a01af10e4757bcae6
[ "self.name = name\nself.text = text\nself.type_name = type_name\nself.ordered = ordered if notnull(ordered) else None\nself.expression = expression if notnull(expression) else None\nself.loop_variables = loop_variables if loop_variables else []\nself.loop_expression = loop_expression", "question_metadatas: List[Q...
<|body_start_0|> self.name = name self.text = text self.type_name = type_name self.ordered = ordered if notnull(ordered) else None self.expression = expression if notnull(expression) else None self.loop_variables = loop_variables if loop_variables else [] self.loo...
QuestionMetadata
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionMetadata: def __init__(self, name: str, text: str, type_name: str, ordered: bool=None, expression: str=None, loop_variables: List[str]=None, loop_expression: Optional[str]=None): """Create a new QuestionMetadata. :param name: Name of the question - should be a valid python variab...
stack_v2_sparse_classes_36k_train_009586
3,109
permissive
[ { "docstring": "Create a new QuestionMetadata. :param name: Name of the question - should be a valid python variable name. :param text: The actual text of the question asked. :param type_name: The type of the question. One of `['Count', 'FreeText', 'Likert', 'MultiChoice', 'PositiveMeasure', 'RankedChoice', 'Si...
2
null
Implement the Python class `QuestionMetadata` described below. Class description: Implement the QuestionMetadata class. Method signatures and docstrings: - def __init__(self, name: str, text: str, type_name: str, ordered: bool=None, expression: str=None, loop_variables: List[str]=None, loop_expression: Optional[str]=...
Implement the Python class `QuestionMetadata` described below. Class description: Implement the QuestionMetadata class. Method signatures and docstrings: - def __init__(self, name: str, text: str, type_name: str, ordered: bool=None, expression: str=None, loop_variables: List[str]=None, loop_expression: Optional[str]=...
1a0fcf0c22e2c7306cba0218f82d24c97d28ee1f
<|skeleton|> class QuestionMetadata: def __init__(self, name: str, text: str, type_name: str, ordered: bool=None, expression: str=None, loop_variables: List[str]=None, loop_expression: Optional[str]=None): """Create a new QuestionMetadata. :param name: Name of the question - should be a valid python variab...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionMetadata: def __init__(self, name: str, text: str, type_name: str, ordered: bool=None, expression: str=None, loop_variables: List[str]=None, loop_expression: Optional[str]=None): """Create a new QuestionMetadata. :param name: Name of the question - should be a valid python variable name. :para...
the_stack_v2_python_sparse
survey/surveys/metadata/question_metadata.py
vahndi/quant-survey
train
2
662b8a407c6d6b1050f1a85a54564417cc339699
[ "cfac = 2 / np.sqrt(3)\nself.pnt = cfac * np.array([[0.5, 0.5, 0.5], [0.5, 0.5, -0.5], [0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, -0.5, -0.5], [-0.5, 0.5, -0.5], [-0.5, -0.5, 0.5], [-0.5, -0.5, -0.5], [1.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.0, -1.0]])\nself.plan...
<|body_start_0|> cfac = 2 / np.sqrt(3) self.pnt = cfac * np.array([[0.5, 0.5, 0.5], [0.5, 0.5, -0.5], [0.5, -0.5, 0.5], [-0.5, 0.5, 0.5], [0.5, -0.5, -0.5], [-0.5, 0.5, -0.5], [-0.5, -0.5, 0.5], [-0.5, -0.5, -0.5], [1.0, 0.0, 0.0], [-1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0], [0...
Defines points that fall within the unit cell of a bcc lattice
NanoBcc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NanoBcc: """Defines points that fall within the unit cell of a bcc lattice""" def __init__(self, radius): """The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell""" <|body_0|> def check_point(self...
stack_v2_sparse_classes_36k_train_009587
4,924
no_license
[ { "docstring": "The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell", "name": "__init__", "signature": "def __init__(self, radius)" }, { "docstring": "Checks whether a point is within the unit cell :param pnt: given poin...
2
stack_v2_sparse_classes_30k_train_009620
Implement the Python class `NanoBcc` described below. Class description: Defines points that fall within the unit cell of a bcc lattice Method signatures and docstrings: - def __init__(self, radius): The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of ...
Implement the Python class `NanoBcc` described below. Class description: Defines points that fall within the unit cell of a bcc lattice Method signatures and docstrings: - def __init__(self, radius): The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of ...
351fde195f54d9af205e8abad217751121b25e6c
<|skeleton|> class NanoBcc: """Defines points that fall within the unit cell of a bcc lattice""" def __init__(self, radius): """The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell""" <|body_0|> def check_point(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NanoBcc: """Defines points that fall within the unit cell of a bcc lattice""" def __init__(self, radius): """The constructor particles are assumed to have diameter 1. All units are relative to this one :param radius: radius of unit cell""" cfac = 2 / np.sqrt(3) self.pnt = cfac * n...
the_stack_v2_python_sparse
build/particles/nanoparticle_core.py
nathanhorst/MD
train
0
e527c2db8b182bbe208f446d07b5c47c1dd77d08
[ "self.__screen = screen\nself.__msg = INSTALLATION_COMPLETED.localize() + REBOOT_MSG.localize()\nself.__buttonsBar = ButtonBar(self.__screen, [(REBOOT.localize(), 'reboot')])\nself.__grid = GridForm(self.__screen, IBM_ZKVM.localize() % STR_VERSION, 1, 2)\nself.__grid.add(self.__buttonsBar, 0, 1, (0, 1, 0, 0))", "...
<|body_start_0|> self.__screen = screen self.__msg = INSTALLATION_COMPLETED.localize() + REBOOT_MSG.localize() self.__buttonsBar = ButtonBar(self.__screen, [(REBOOT.localize(), 'reboot')]) self.__grid = GridForm(self.__screen, IBM_ZKVM.localize() % STR_VERSION, 1, 2) self.__grid....
Last screen for the installer application
RebootSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RebootSystem: """Last screen for the installer application""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def run(self, error=False): """Draws the screen @type error: boolean @param error:...
stack_v2_sparse_classes_36k_train_009588
1,427
no_license
[ { "docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance", "name": "__init__", "signature": "def __init__(self, screen)" }, { "docstring": "Draws the screen @type error: boolean @param error: reboot due to error @rtype: integer @returns: sucess status", "name...
2
stack_v2_sparse_classes_30k_train_015271
Implement the Python class `RebootSystem` described below. Class description: Last screen for the installer application Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def run(self, error=False): Draws the screen @type error: ...
Implement the Python class `RebootSystem` described below. Class description: Last screen for the installer application Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def run(self, error=False): Draws the screen @type error: ...
1c738fd5e6ee3f8fd4f47acf2207038f20868212
<|skeleton|> class RebootSystem: """Last screen for the installer application""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def run(self, error=False): """Draws the screen @type error: boolean @param error:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RebootSystem: """Last screen for the installer application""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" self.__screen = screen self.__msg = INSTALLATION_COMPLETED.localize() + REBOOT_MSG.localize() self.__bu...
the_stack_v2_python_sparse
zfrobisher-installer/src/viewer/newt/rebootsystem.py
fedosu85nce/work
train
2
47d16eeb748e349095bc5441d7639003bc621299
[ "self.rows = height\nself.cols = width\nself.food = food\ninitial = self.Position(0, 0)\nself.snake = deque([initial])\nself.length = 0", "curr = self.Position(self.snake[0].x, self.snake[0].y)\nif direction == 'U':\n curr.x -= 1\nif direction == 'D':\n curr.x += 1\nif direction == 'L':\n curr.y -= 1\nif...
<|body_start_0|> self.rows = height self.cols = width self.food = food initial = self.Position(0, 0) self.snake = deque([initial]) self.length = 0 <|end_body_0|> <|body_start_1|> curr = self.Position(self.snake[0].x, self.snake[0].y) if direction == 'U': ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_009589
2,301
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
e42ec45d98f990d446bbf4f1a568b70855af5380
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
designSnakeGame.py
LYoung-Hub/Algorithm-Data-Structure
train
0
3697122412021458a9ae6bb21182823dad06c6ef
[ "all_posts = Post.get_all_post()\nmessage = 'Post list fetched successfully'\nreturn {'status': True, 'message': message, 'data': posts_schema.dump(all_posts)}", "try:\n verify_jwt_in_request()\n title = request.form['title']\n content = request.form['content']\n try:\n post = Post(title=title,...
<|body_start_0|> all_posts = Post.get_all_post() message = 'Post list fetched successfully' return {'status': True, 'message': message, 'data': posts_schema.dump(all_posts)} <|end_body_0|> <|body_start_1|> try: verify_jwt_in_request() title = request.form['title'...
Post Create & List
PostResources
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostResources: """Post Create & List""" def get(self): """List all posts""" <|body_0|> def post(self): """List all posts""" <|body_1|> <|end_skeleton|> <|body_start_0|> all_posts = Post.get_all_post() message = 'Post list fetched success...
stack_v2_sparse_classes_36k_train_009590
1,818
no_license
[ { "docstring": "List all posts", "name": "get", "signature": "def get(self)" }, { "docstring": "List all posts", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003248
Implement the Python class `PostResources` described below. Class description: Post Create & List Method signatures and docstrings: - def get(self): List all posts - def post(self): List all posts
Implement the Python class `PostResources` described below. Class description: Post Create & List Method signatures and docstrings: - def get(self): List all posts - def post(self): List all posts <|skeleton|> class PostResources: """Post Create & List""" def get(self): """List all posts""" ...
1aecc325ccdf738f8b7de689104c9c58e88430f5
<|skeleton|> class PostResources: """Post Create & List""" def get(self): """List all posts""" <|body_0|> def post(self): """List all posts""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostResources: """Post Create & List""" def get(self): """List all posts""" all_posts = Post.get_all_post() message = 'Post list fetched successfully' return {'status': True, 'message': message, 'data': posts_schema.dump(all_posts)} def post(self): """List all...
the_stack_v2_python_sparse
article/apiv1/PostResources.py
iamnaran/articles
train
0
077013df129ffcae6b9c3fc3e927e4fe65bfb7f5
[ "if not SharedBuffer.__instance:\n SharedBuffer()\nreturn SharedBuffer.__instance", "if SharedBuffer.__instance:\n raise Exception('This class is a singleton!')\nelse:\n self.buffer = []\n self.shared_semaphore = threading.Semaphore()\n SharedBuffer.__instance = self" ]
<|body_start_0|> if not SharedBuffer.__instance: SharedBuffer() return SharedBuffer.__instance <|end_body_0|> <|body_start_1|> if SharedBuffer.__instance: raise Exception('This class is a singleton!') else: self.buffer = [] self.shared_sem...
Shared class between leshan_monitor and kafka_consumer_thread
SharedBuffer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedBuffer: """Shared class between leshan_monitor and kafka_consumer_thread""" def get_instance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if...
stack_v2_sparse_classes_36k_train_009591
680
permissive
[ { "docstring": "Static access method.", "name": "get_instance", "signature": "def get_instance()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_009556
Implement the Python class `SharedBuffer` described below. Class description: Shared class between leshan_monitor and kafka_consumer_thread Method signatures and docstrings: - def get_instance(): Static access method. - def __init__(self): Virtually private constructor.
Implement the Python class `SharedBuffer` described below. Class description: Shared class between leshan_monitor and kafka_consumer_thread Method signatures and docstrings: - def get_instance(): Static access method. - def __init__(self): Virtually private constructor. <|skeleton|> class SharedBuffer: """Shared...
c7a1f6bb69099797e2136522dbdda94c2e6a4895
<|skeleton|> class SharedBuffer: """Shared class between leshan_monitor and kafka_consumer_thread""" def get_instance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SharedBuffer: """Shared class between leshan_monitor and kafka_consumer_thread""" def get_instance(): """Static access method.""" if not SharedBuffer.__instance: SharedBuffer() return SharedBuffer.__instance def __init__(self): """Virtually private constru...
the_stack_v2_python_sparse
IoT_Monitor/shared_buffer.py
ertis-research/reliable-iot
train
1
6daef8de29fa40d9023c403e559c4e991692add3
[ "result = []\n\ndef helper(node):\n result.append(str(node.val))\n if node.children:\n result.append('[')\n for kid in node.children:\n helper(kid)\n result.append(']')\nhelper(root)\nprint(' '.join(result))\nreturn ' '.join(result)", "if not data:\n return\n\ndef helper(n...
<|body_start_0|> result = [] def helper(node): result.append(str(node.val)) if node.children: result.append('[') for kid in node.children: helper(kid) result.append(']') helper(root) print(' '.jo...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_009592
2,248
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
df2ce669049ca040631dc6cc05cf5b5e8d2cc376
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" result = [] def helper(node): result.append(str(node.val)) if node.children: result.append('[') for kid in node.children: ...
the_stack_v2_python_sparse
leetcode_2018/428_serialize_deser_N_ary_tree.py
changediyasunny/Challenges
train
0
114153d53207976669032450fd46630da6b8c20a
[ "assert sampling_type in ['gaussian', 'uniform']\nname_to_transform_func = name_to_transform_func or _NAME_TO_TRANSFORM_FUNC\nlevel_to_arg = level_to_arg or _LEVEL_TO_ARG\ntransform_max_paras = transform_max_paras or _TRANSFORM_MAX_PARAMS\nself.transform_hparas = transform_hparas or TRANSFORM_DEFAULT_HPARAS\nself.s...
<|body_start_0|> assert sampling_type in ['gaussian', 'uniform'] name_to_transform_func = name_to_transform_func or _NAME_TO_TRANSFORM_FUNC level_to_arg = level_to_arg or _LEVEL_TO_ARG transform_max_paras = transform_max_paras or _TRANSFORM_MAX_PARAMS self.transform_hparas = tran...
AugmentTransform
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AugmentTransform: def __init__(self, transform_name: str, magnitude: int=10, prob: float=0.5, name_to_transform_func: Optional[Dict[str, Callable]]=None, level_to_arg: Optional[Dict[str, Callable]]=None, transform_max_paras: Optional[Dict[str, Tuple]]=None, transform_hparas: Optional[Dict[str, A...
stack_v2_sparse_classes_36k_train_009593
17,662
permissive
[ { "docstring": "The AugmentTransform composes a video transform that performs augmentation based on a maximum magnitude. AugmentTransform also offers flexible ways to generate augmentation magnitude based on different sampling strategies. Args: transform_name (str): The name of the video transform function. mag...
3
stack_v2_sparse_classes_30k_train_000539
Implement the Python class `AugmentTransform` described below. Class description: Implement the AugmentTransform class. Method signatures and docstrings: - def __init__(self, transform_name: str, magnitude: int=10, prob: float=0.5, name_to_transform_func: Optional[Dict[str, Callable]]=None, level_to_arg: Optional[Dic...
Implement the Python class `AugmentTransform` described below. Class description: Implement the AugmentTransform class. Method signatures and docstrings: - def __init__(self, transform_name: str, magnitude: int=10, prob: float=0.5, name_to_transform_func: Optional[Dict[str, Callable]]=None, level_to_arg: Optional[Dic...
16f2abf2f8aa174915316007622bbb260215dee8
<|skeleton|> class AugmentTransform: def __init__(self, transform_name: str, magnitude: int=10, prob: float=0.5, name_to_transform_func: Optional[Dict[str, Callable]]=None, level_to_arg: Optional[Dict[str, Callable]]=None, transform_max_paras: Optional[Dict[str, Tuple]]=None, transform_hparas: Optional[Dict[str, A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AugmentTransform: def __init__(self, transform_name: str, magnitude: int=10, prob: float=0.5, name_to_transform_func: Optional[Dict[str, Callable]]=None, level_to_arg: Optional[Dict[str, Callable]]=None, transform_max_paras: Optional[Dict[str, Tuple]]=None, transform_hparas: Optional[Dict[str, Any]]=None, sam...
the_stack_v2_python_sparse
pytorchvideo/transforms/augmentations.py
xchani/pytorchvideo
train
0
4bca3d154293c09970035725a214dbddc7362607
[ "self.measurements = []\nif self.data.get('level_measurement', None):\n for measurement in self.data['level_measurement']:\n if not measurement['time']:\n return\n obj = WellLevelMeasurement.objects.get(id=measurement['id']) if measurement['id'] else WellLevelMeasurement()\n self....
<|body_start_0|> self.measurements = [] if self.data.get('level_measurement', None): for measurement in self.data['level_measurement']: if not measurement['time']: return obj = WellLevelMeasurement.objects.get(id=measurement['id']) if measu...
Collection form for general information section
LevelMeasurementCreateForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LevelMeasurementCreateForm: """Collection form for general information section""" def create(self): """create form from data""" <|body_0|> def save(self): """save all available data""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.measuremen...
stack_v2_sparse_classes_36k_train_009594
2,015
no_license
[ { "docstring": "create form from data", "name": "create", "signature": "def create(self)" }, { "docstring": "save all available data", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_000176
Implement the Python class `LevelMeasurementCreateForm` described below. Class description: Collection form for general information section Method signatures and docstrings: - def create(self): create form from data - def save(self): save all available data
Implement the Python class `LevelMeasurementCreateForm` described below. Class description: Collection form for general information section Method signatures and docstrings: - def create(self): create form from data - def save(self): save all available data <|skeleton|> class LevelMeasurementCreateForm: """Colle...
fc036f9f8346dee2d40287d08375a6c2af0a1a12
<|skeleton|> class LevelMeasurementCreateForm: """Collection form for general information section""" def create(self): """create form from data""" <|body_0|> def save(self): """save all available data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LevelMeasurementCreateForm: """Collection form for general information section""" def create(self): """create form from data""" self.measurements = [] if self.data.get('level_measurement', None): for measurement in self.data['level_measurement']: if not...
the_stack_v2_python_sparse
views/form_group/level_measurement.py
Alexia-Water/IGRAC-WellAndMonitoringDatabase
train
0
108a67e0e9824e5d8b6081eafa5764b5fe80617e
[ "if len(nums) == 0:\n return 0\nresult = tmp = nums[0]\nfor i in range(1, len(nums)):\n if tmp > 0:\n tmp += nums[i]\n else:\n tmp = nums[i]\n if result < tmp:\n result = tmp\n return result", "result = tmp = nums[0]\nstart, end = (0, 0)\nfor i in range(1, len(nums)):\n if t...
<|body_start_0|> if len(nums) == 0: return 0 result = tmp = nums[0] for i in range(1, len(nums)): if tmp > 0: tmp += nums[i] else: tmp = nums[i] if result < tmp: result = tmp return result...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums: List) -> List: """作业帮面试题: 返回的是最大的子序列,不只是需要求得最大值 :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums)...
stack_v2_sparse_classes_36k_train_009595
1,008
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": "作业帮面试题: 返回的是最大的子序列,不只是需要求得最大值 :param nums: :return:", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums: List) -> List" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums: List) -> List: 作业帮面试题: 返回的是最大的子序列,不只是需要求得最大值 :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums: List) -> List: 作业帮面试题: 返回的是最大的子序列,不只是需要求得最大值 :param nums: :return: <|skeleton|> cla...
a916423eca1256c63e24139b58e5fd3e28da8433
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums: List) -> List: """作业帮面试题: 返回的是最大的子序列,不只是需要求得最大值 :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 0: return 0 result = tmp = nums[0] for i in range(1, len(nums)): if tmp > 0: tmp += nums[i] else: tmp = nums[i] ...
the_stack_v2_python_sparse
53-maxSubArray.py
TiAMoEM/LeetCode
train
0
0a91946433d464744d81b68e3e92c9d8efe9102d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AttributeMapping()", "from .attribute_flow_behavior import AttributeFlowBehavior\nfrom .attribute_flow_type import AttributeFlowType\nfrom .attribute_mapping_source import AttributeMappingSource\nfrom .attribute_flow_behavior import At...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AttributeMapping() <|end_body_0|> <|body_start_1|> from .attribute_flow_behavior import AttributeFlowBehavior from .attribute_flow_type import AttributeFlowType from .attribute_m...
AttributeMapping
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttributeMapping: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttributeMapping: """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 R...
stack_v2_sparse_classes_36k_train_009596
5,238
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: AttributeMapping", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_va...
3
stack_v2_sparse_classes_30k_train_000644
Implement the Python class `AttributeMapping` described below. Class description: Implement the AttributeMapping class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttributeMapping: Creates a new instance of the appropriate class based on discrimina...
Implement the Python class `AttributeMapping` described below. Class description: Implement the AttributeMapping class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttributeMapping: Creates a new instance of the appropriate class based on discrimina...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AttributeMapping: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttributeMapping: """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 R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttributeMapping: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttributeMapping: """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: Attrib...
the_stack_v2_python_sparse
msgraph/generated/models/attribute_mapping.py
microsoftgraph/msgraph-sdk-python
train
135
113ee2fc3c555b764ebeb7f7599f299d57a023e0
[ "super().__init__(screen_width, screen_height, State.MENU, screen, 0, 0, debug)\nself.write(self.title_font, WHITE, 'Space Invaders', self.screen_width // 2, self.screen_height // 5)\nself.rect_play = self.write(self.end_font, WHITE, 'Play', self.screen_width // 2, self.screen_height // 2)\nself.rect_highscore = se...
<|body_start_0|> super().__init__(screen_width, screen_height, State.MENU, screen, 0, 0, debug) self.write(self.title_font, WHITE, 'Space Invaders', self.screen_width // 2, self.screen_height // 5) self.rect_play = self.write(self.end_font, WHITE, 'Play', self.screen_width // 2, self.screen_heig...
MenuScreen
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MenuScreen: def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): """Constructor for the Main Menu screen""" <|body_0|> def update_keypresses(self) -> State: """Track the keypress for the menu""" <|body_1|> def check_mouse...
stack_v2_sparse_classes_36k_train_009597
3,083
permissive
[ { "docstring": "Constructor for the Main Menu screen", "name": "__init__", "signature": "def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False)" }, { "docstring": "Track the keypress for the menu", "name": "update_keypresses", "signature": "def update_keypre...
4
stack_v2_sparse_classes_30k_train_010394
Implement the Python class `MenuScreen` described below. Class description: Implement the MenuScreen class. Method signatures and docstrings: - def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): Constructor for the Main Menu screen - def update_keypresses(self) -> State: Track the k...
Implement the Python class `MenuScreen` described below. Class description: Implement the MenuScreen class. Method signatures and docstrings: - def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): Constructor for the Main Menu screen - def update_keypresses(self) -> State: Track the k...
6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9
<|skeleton|> class MenuScreen: def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): """Constructor for the Main Menu screen""" <|body_0|> def update_keypresses(self) -> State: """Track the keypress for the menu""" <|body_1|> def check_mouse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MenuScreen: def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): """Constructor for the Main Menu screen""" super().__init__(screen_width, screen_height, State.MENU, screen, 0, 0, debug) self.write(self.title_font, WHITE, 'Space Invaders', self.screen_w...
the_stack_v2_python_sparse
gym_invaders/gym_game/envs/classes/Game/Screens/MenuScreen.py
Jh123x/Orbital
train
4
d6a1b10239710e84255053a1949b25a24290514c
[ "lo, hi = (0, len(nums) - 1)\nwhile lo <= hi:\n mid = (lo + hi) // 2\n if nums[mid] == target:\n return True\n elif nums[mid] < target:\n lo = mid + 1\n elif nums[mid] > target:\n hi = mid - 1\nreturn False", "if len(set(nums)) <= 1:\n return True\nelif nums[0] < nums[-1]:\n ...
<|body_start_0|> lo, hi = (0, len(nums) - 1) while lo <= hi: mid = (lo + hi) // 2 if nums[mid] == target: return True elif nums[mid] < target: lo = mid + 1 elif nums[mid] > target: hi = mid - 1 return...
Solution_A1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_A1: def binarySearch(self, nums: List[int], target: int) -> bool: """Helper regular binary search if a value is in sorted list""" <|body_0|> def isSortedQuick(self, nums: List[int]) -> bool: """Helper function specialized for this question Quickly tell wheth...
stack_v2_sparse_classes_36k_train_009598
6,122
permissive
[ { "docstring": "Helper regular binary search if a value is in sorted list", "name": "binarySearch", "signature": "def binarySearch(self, nums: List[int], target: int) -> bool" }, { "docstring": "Helper function specialized for this question Quickly tell whether an array is sorted on two conditio...
3
stack_v2_sparse_classes_30k_train_013170
Implement the Python class `Solution_A1` described below. Class description: Implement the Solution_A1 class. Method signatures and docstrings: - def binarySearch(self, nums: List[int], target: int) -> bool: Helper regular binary search if a value is in sorted list - def isSortedQuick(self, nums: List[int]) -> bool: ...
Implement the Python class `Solution_A1` described below. Class description: Implement the Solution_A1 class. Method signatures and docstrings: - def binarySearch(self, nums: List[int], target: int) -> bool: Helper regular binary search if a value is in sorted list - def isSortedQuick(self, nums: List[int]) -> bool: ...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_A1: def binarySearch(self, nums: List[int], target: int) -> bool: """Helper regular binary search if a value is in sorted list""" <|body_0|> def isSortedQuick(self, nums: List[int]) -> bool: """Helper function specialized for this question Quickly tell wheth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_A1: def binarySearch(self, nums: List[int], target: int) -> bool: """Helper regular binary search if a value is in sorted list""" lo, hi = (0, len(nums) - 1) while lo <= hi: mid = (lo + hi) // 2 if nums[mid] == target: return True ...
the_stack_v2_python_sparse
LeetCode/LC081_search_in_rotated_sorted_array_ii.py
jxie0755/Learning_Python
train
0
b48093fd46576645ea8d51f9fe496fab1ef1cc78
[ "super(BuildSteps, self)._pre_put_hook()\nassert self.step_container_bytes is not None\nassert len(self.step_container_bytes) <= self.MAX_STEPS_LEN", "assert build_proto.id\nbuild_key = ndb.Key(Build, build_proto.id)\nret = cls(key=cls.key_for(build_key))\nret.write_steps(build_proto)\nreturn ret", "container =...
<|body_start_0|> super(BuildSteps, self)._pre_put_hook() assert self.step_container_bytes is not None assert len(self.step_container_bytes) <= self.MAX_STEPS_LEN <|end_body_0|> <|body_start_1|> assert build_proto.id build_key = ndb.Key(Build, build_proto.id) ret = cls(ke...
Stores buildbucket.v2.Build.steps.
BuildSteps
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildSteps: """Stores buildbucket.v2.Build.steps.""" def _pre_put_hook(self): """Checks BuildSteps invariants before putting.""" <|body_0|> def make(cls, build_proto): """Creates BuildSteps for the build_proto. Does not verify step size.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_009599
23,989
permissive
[ { "docstring": "Checks BuildSteps invariants before putting.", "name": "_pre_put_hook", "signature": "def _pre_put_hook(self)" }, { "docstring": "Creates BuildSteps for the build_proto. Does not verify step size.", "name": "make", "signature": "def make(cls, build_proto)" }, { "d...
5
null
Implement the Python class `BuildSteps` described below. Class description: Stores buildbucket.v2.Build.steps. Method signatures and docstrings: - def _pre_put_hook(self): Checks BuildSteps invariants before putting. - def make(cls, build_proto): Creates BuildSteps for the build_proto. Does not verify step size. - de...
Implement the Python class `BuildSteps` described below. Class description: Stores buildbucket.v2.Build.steps. Method signatures and docstrings: - def _pre_put_hook(self): Checks BuildSteps invariants before putting. - def make(cls, build_proto): Creates BuildSteps for the build_proto. Does not verify step size. - de...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class BuildSteps: """Stores buildbucket.v2.Build.steps.""" def _pre_put_hook(self): """Checks BuildSteps invariants before putting.""" <|body_0|> def make(cls, build_proto): """Creates BuildSteps for the build_proto. Does not verify step size.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildSteps: """Stores buildbucket.v2.Build.steps.""" def _pre_put_hook(self): """Checks BuildSteps invariants before putting.""" super(BuildSteps, self)._pre_put_hook() assert self.step_container_bytes is not None assert len(self.step_container_bytes) <= self.MAX_STEPS_LEN...
the_stack_v2_python_sparse
appengine/cr-buildbucket/model.py
xinghun61/infra
train
2