blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
c79cf61afcfd06cb3761980662f5a548fa9b1760
[ "if not root:\n return ''\nleft_str = self.serialize(root.left)\nright_str = self.serialize(root.right)\nreturn str(root.val) + ' ' + left_str + ' ' + right_str", "q = [int(x) for x in data.split(' ') if x]\n\ndef dfs(q, min_, max_):\n if not q:\n return None\n if q[0] > min_ and q[0] < max_:\n ...
<|body_start_0|> if not root: return '' left_str = self.serialize(root.left) right_str = self.serialize(root.right) return str(root.val) + ' ' + left_str + ' ' + right_str <|end_body_0|> <|body_start_1|> q = [int(x) for x in data.split(' ') if x] def dfs(q, ...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_001800
2,234
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_001001
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
26fa64525c92e01dfbcdd7851f5b3a91f6ec203b
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '' left_str = self.serialize(root.left) right_str = self.serialize(root.right) return str(root.val) + ' ' + left_str + ' ' + right_str def de...
the_stack_v2_python_sparse
daily_coding_challenge/october_2020/serialize_and_deserialize_BST_449.py
anjaligopi/leetcode
train
0
71ce71839005959f906fa4da46af607b4be67f9e
[ "super(BinaryCrossEntropyLoss, self).__init__()\nself.weight = weight\nself.ignore_index = ignore_index\nself.reduction = reduction", "targets = [t for target in targets for t in target['targets']]\ntargets = torch.stack(targets).float()\nlogits = torch.stack([torch.sum(cost * alignment) for cost, alignment in lo...
<|body_start_0|> super(BinaryCrossEntropyLoss, self).__init__() self.weight = weight self.ignore_index = ignore_index self.reduction = reduction <|end_body_0|> <|body_start_1|> targets = [t for target in targets for t in target['targets']] targets = torch.stack(targets)....
Computes the hinge loss between aligned and un-aligned document pairs (for AskUbuntu). For each document, the loss is sum_ij |negative_similarity_i - positive_similarity_j + margin| i.e. sum over all positive/negative pairs
BinaryCrossEntropyLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryCrossEntropyLoss: """Computes the hinge loss between aligned and un-aligned document pairs (for AskUbuntu). For each document, the loss is sum_ij |negative_similarity_i - positive_similarity_j + margin| i.e. sum over all positive/negative pairs""" def __init__(self, weight: Optional[to...
stack_v2_sparse_classes_10k_train_001801
2,776
permissive
[ { "docstring": "Initialize the MultiLabelNLLLoss. Parameters ---------- weight : Optional[torch.Tensor] A manual rescaling weight given to each class. If given, has to be a Tensor of size N, where N is the number of classes. ignore_index : Optional[int], optional Specifies a target value that is ignored and doe...
2
stack_v2_sparse_classes_30k_train_003426
Implement the Python class `BinaryCrossEntropyLoss` described below. Class description: Computes the hinge loss between aligned and un-aligned document pairs (for AskUbuntu). For each document, the loss is sum_ij |negative_similarity_i - positive_similarity_j + margin| i.e. sum over all positive/negative pairs Method...
Implement the Python class `BinaryCrossEntropyLoss` described below. Class description: Computes the hinge loss between aligned and un-aligned document pairs (for AskUbuntu). For each document, the loss is sum_ij |negative_similarity_i - positive_similarity_j + margin| i.e. sum over all positive/negative pairs Method...
8d2bf06ba4c121863833094d5d4896bf34a9a73e
<|skeleton|> class BinaryCrossEntropyLoss: """Computes the hinge loss between aligned and un-aligned document pairs (for AskUbuntu). For each document, the loss is sum_ij |negative_similarity_i - positive_similarity_j + margin| i.e. sum over all positive/negative pairs""" def __init__(self, weight: Optional[to...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BinaryCrossEntropyLoss: """Computes the hinge loss between aligned and un-aligned document pairs (for AskUbuntu). For each document, the loss is sum_ij |negative_similarity_i - positive_similarity_j + margin| i.e. sum over all positive/negative pairs""" def __init__(self, weight: Optional[torch.Tensor]=N...
the_stack_v2_python_sparse
classify/metric/loss/bce.py
ManHieu/rationale-alignment
train
0
6d2ae52ab67cbbead0a4a8d76e3caf238532b57c
[ "filters = dict(request.args)\npage = int(filters.pop('page', 1))\nlimit = int(filters.pop('limit', 2))\npaginated_users = UserModel.query.paginate(page, limit, error_out=False)\nresponse = create_pagination(items=paginated_users, schema=user_short_list_schema, page=page, limit=limit, query_params=filters, base_url...
<|body_start_0|> filters = dict(request.args) page = int(filters.pop('page', 1)) limit = int(filters.pop('limit', 2)) paginated_users = UserModel.query.paginate(page, limit, error_out=False) response = create_pagination(items=paginated_users, schema=user_short_list_schema, page=p...
Resource for retrieving exists and adding new users
UserList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserList: """Resource for retrieving exists and adding new users""" def get(cls) -> Tuple[Dict, int]: """Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code""" <|body_0|> def post(cls): """Method for creating ...
stack_v2_sparse_classes_10k_train_001802
5,979
no_license
[ { "docstring": "Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code", "name": "get", "signature": "def get(cls) -> Tuple[Dict, int]" }, { "docstring": "Method for creating new User Returns ------- Tuple[Dict, int] Response message and status ...
2
stack_v2_sparse_classes_30k_train_006158
Implement the Python class `UserList` described below. Class description: Resource for retrieving exists and adding new users Method signatures and docstrings: - def get(cls) -> Tuple[Dict, int]: Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code - def post(cls):...
Implement the Python class `UserList` described below. Class description: Resource for retrieving exists and adding new users Method signatures and docstrings: - def get(cls) -> Tuple[Dict, int]: Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code - def post(cls):...
51e4d69f88c120cfc587fd007f21528a7bd661a0
<|skeleton|> class UserList: """Resource for retrieving exists and adding new users""" def get(cls) -> Tuple[Dict, int]: """Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code""" <|body_0|> def post(cls): """Method for creating ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserList: """Resource for retrieving exists and adding new users""" def get(cls) -> Tuple[Dict, int]: """Method for retrieving list of all Users Returns ------- Tuple[Dict, int] Response message and status code""" filters = dict(request.args) page = int(filters.pop('page', 1)) ...
the_stack_v2_python_sparse
flask_app/resources/user.py
Kyrylo-Kotelevets/Flask_Events
train
0
7dedab78759d8415f084868b70514a3c0dfd694e
[ "wordDict = set(wordDict)\nn = len(s)\n\n@lru_cache(None)\ndef dfs(i):\n if i == n:\n return True\n for j in range(i + 1, n + 1):\n if s[i:j] in wordDict:\n if dfs(j):\n return True\n return False\nreturn dfs(0)", "n = len(s)\nif len(s) == 0:\n return False\nwor...
<|body_start_0|> wordDict = set(wordDict) n = len(s) @lru_cache(None) def dfs(i): if i == n: return True for j in range(i + 1, n + 1): if s[i:j] in wordDict: if dfs(j): return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s: str, wordDict) -> bool: """DFS + Memorization""" <|body_0|> def wordBreak(self, s: str, wordDict) -> bool: """Down Top DP, Time: O(m + n^2), Space: O(n+m), n: len(s), m: len(wordDict)""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_001803
1,753
no_license
[ { "docstring": "DFS + Memorization", "name": "wordBreak", "signature": "def wordBreak(self, s: str, wordDict) -> bool" }, { "docstring": "Down Top DP, Time: O(m + n^2), Space: O(n+m), n: len(s), m: len(wordDict)", "name": "wordBreak", "signature": "def wordBreak(self, s: str, wordDict) -...
2
stack_v2_sparse_classes_30k_train_003796
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s: str, wordDict) -> bool: DFS + Memorization - def wordBreak(self, s: str, wordDict) -> bool: Down Top DP, Time: O(m + n^2), Space: O(n+m), n: len(s), m: len...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s: str, wordDict) -> bool: DFS + Memorization - def wordBreak(self, s: str, wordDict) -> bool: Down Top DP, Time: O(m + n^2), Space: O(n+m), n: len(s), m: len...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def wordBreak(self, s: str, wordDict) -> bool: """DFS + Memorization""" <|body_0|> def wordBreak(self, s: str, wordDict) -> bool: """Down Top DP, Time: O(m + n^2), Space: O(n+m), n: len(s), m: len(wordDict)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s: str, wordDict) -> bool: """DFS + Memorization""" wordDict = set(wordDict) n = len(s) @lru_cache(None) def dfs(i): if i == n: return True for j in range(i + 1, n + 1): if s[i:j] in ...
the_stack_v2_python_sparse
python/139-Word Break.py
cwza/leetcode
train
0
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return IngestStatusSerializerV6\nelif self.request.version == 'v7':\n return IngestStatusSerializerV6", "if request.version == 'v6' or request.version == 'v7':\n return self.list_impl(request)\nraise Http404()", "started = rest_util.parse_timestamp(request, 'started'...
<|body_start_0|> if self.request.version == 'v6': return IngestStatusSerializerV6 elif self.request.version == 'v7': return IngestStatusSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6' or request.version == 'v7': return self.list_impl(r...
This view is the endpoint for retrieving summarized ingest status.
IngestsStatusView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IngestsStatusView: """This view is the endpoint for retrieving summarized ingest status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Determine ap...
stack_v2_sparse_classes_10k_train_001804
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Determine api version and call specific method :param request: the HTTP POST request :type request:...
3
null
Implement the Python class `IngestsStatusView` described below. Class description: This view is the endpoint for retrieving summarized ingest status. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, r...
Implement the Python class `IngestsStatusView` described below. Class description: This view is the endpoint for retrieving summarized ingest status. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, r...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class IngestsStatusView: """This view is the endpoint for retrieving summarized ingest status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Determine ap...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IngestsStatusView: """This view is the endpoint for retrieving summarized ingest status.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" if self.request.version == 'v6': return IngestStatusSerializerV6 ...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
472da661567a0e09553063aaa774ee2069f700af
[ "if divid == 'scratch_div_id':\n divid += '_%s' % str(uuid.uuid4()).replace('-', '')\nself.filename = filename\nself.divid = divid if divid else str(uuid.uuid4()).replace('-', '')\nself.width = width\nself.height = height", "w = self.width\nh = self.height\ndivid = self.divid\njs_path = os.path.dirname(locatio...
<|body_start_0|> if divid == 'scratch_div_id': divid += '_%s' % str(uuid.uuid4()).replace('-', '') self.filename = filename self.divid = divid if divid else str(uuid.uuid4()).replace('-', '') self.width = width self.height = height <|end_body_0|> <|body_start_1|> ...
Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.
RenderSnapRaw
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RenderSnapRaw: """Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.""" def __init__(self, width='1000', height='600', divid=None, filename=None): """initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|...
stack_v2_sparse_classes_10k_train_001805
2,981
permissive
[ { "docstring": "initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|None) filename", "name": "__init__", "signature": "def __init__(self, width='1000', height='600', divid=None, filename=None)" }, { "docstring": "Return a coup...
2
stack_v2_sparse_classes_30k_train_006133
Implement the Python class `RenderSnapRaw` described below. Class description: Renders `Snap <https://snap.berkeley.edu/>`_ using javascript. Method signatures and docstrings: - def __init__(self, width='1000', height='600', divid=None, filename=None): initialize @param width (str) width @param height (str) height @p...
Implement the Python class `RenderSnapRaw` described below. Class description: Renders `Snap <https://snap.berkeley.edu/>`_ using javascript. Method signatures and docstrings: - def __init__(self, width='1000', height='600', divid=None, filename=None): initialize @param width (str) width @param height (str) height @p...
e39f8ae416c23940c1a227c11c667c19104b2ff4
<|skeleton|> class RenderSnapRaw: """Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.""" def __init__(self, width='1000', height='600', divid=None, filename=None): """initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RenderSnapRaw: """Renders `Snap <https://snap.berkeley.edu/>`_ using javascript.""" def __init__(self, width='1000', height='600', divid=None, filename=None): """initialize @param width (str) width @param height (str) height @param divid (str|None) id of the div @param filename (str|None) filenam...
the_stack_v2_python_sparse
src/code_beatrix/jsscripts/nbsnap.py
sdpython/code_beatrix
train
1
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTriggerRegion, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._min_x = min_x\nself._max_x = max_x\nself._min_y = min_y\nself._max_y = max_y", "new_status = py_trees.common.Status.RUNNING\nlocation = CarlaDataProvider.get_location(self._actor)...
<|body_start_0|> super(InTriggerRegion, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._min_x = min_x self._max_x = max_x self._min_y = min_y self._max_y = max_y <|end_body_0|> <|body_start_1|> n...
This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the actor reached the target region
InTriggerRegion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerRegion: """This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the ac...
stack_v2_sparse_classes_10k_train_001806
18,494
permissive
[ { "docstring": "Setup trigger region (rectangle provided by [min_x,min_y] and [max_x,max_y]", "name": "__init__", "signature": "def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion')" }, { "docstring": "Check if the _actor location is within trigger region", "name": "upd...
2
stack_v2_sparse_classes_30k_train_001377
Implement the Python class `InTriggerRegion` described below. Class description: This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The conditi...
Implement the Python class `InTriggerRegion` described below. Class description: This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The conditi...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTriggerRegion: """This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the ac...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InTriggerRegion: """This class contains the trigger region (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - min_x, max_x, min_y, max_y: bounding box of the trigger region The condition terminates with SUCCESS, when the actor reached t...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
2f835e30641a7176346e906f0c71ccb04e46bc27
[ "\"\"\"\n self.golden_ratio = 1.618\n self.table_size = 65536\n self.table = [[] for _ in range(self.table_size)]\n self.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size\n \"\"\"\nself.dict = {}", "\"\"\"\n self.remove(key) # use the ...
<|body_start_0|> """ self.golden_ratio = 1.618 self.table_size = 65536 self.table = [[] for _ in range(self.table_size)] self.hash = lambda i: i * math.ceil(self.golden_ratio * self.table_size) % self.table_size """ self.dic...
MyHashMap
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key: int, value: int) -> None: """value will always be non-negative.""" <|body_1|> def get(self, key: int) -> int: """Returns the value to which th...
stack_v2_sparse_classes_10k_train_001807
3,048
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "value will always be non-negative.", "name": "put", "signature": "def put(self, key: int, value: int) -> None" }, { "docstring": "Returns the value to w...
4
stack_v2_sparse_classes_30k_train_000019
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key: int, value: int) -> None: value will always be non-negative. - def get(self, key: int) -> int: Ret...
Implement the Python class `MyHashMap` described below. Class description: Implement the MyHashMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def put(self, key: int, value: int) -> None: value will always be non-negative. - def get(self, key: int) -> int: Ret...
4ea4c1579c28308455be4dfa02bd45ebd88b2d0a
<|skeleton|> class MyHashMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def put(self, key: int, value: int) -> None: """value will always be non-negative.""" <|body_1|> def get(self, key: int) -> int: """Returns the value to which th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyHashMap: def __init__(self): """Initialize your data structure here.""" """ self.golden_ratio = 1.618 self.table_size = 65536 self.table = [[] for _ in range(self.table_size)] self.hash = lambda i: i * math.ceil(self.golden_rati...
the_stack_v2_python_sparse
src/integers/myHashMap.py
way2arun/datastructures_algorithms
train
1
edbc0a6dd17a9328f386a10ad5496d3c02ef4c38
[ "sql = \" select s.student_id, pbc.full_name as student_name, s.up_station_id, s.off_station_id, s1.bus_station_name as up_station_name, s2.bus_station_name as off_station_name, aa.up_station_id as original_up_station_id, aa.off_station_id as original_off_station_id, s3.bus_station_name as original_up_station_na...
<|body_start_0|> sql = " select s.student_id, pbc.full_name as student_name, s.up_station_id, s.off_station_id, s1.bus_station_name as up_station_name, s2.bus_station_name as off_station_name, aa.up_station_id as original_up_station_id, aa.off_station_id as original_off_station_id, s3.bus_station_name as ori...
StudentLineSeatLog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentLineSeatLog: def query_sa_line_tooltips(self, login_user_id, create_dt): """获取有无学生调整线路 :param login_user_id :param create_dt :return:""" <|body_0|> def add_student_line_seat_log(self, student_obj, login_user_id, now_time): """插入一条学生座位日志 :return:""" <|b...
stack_v2_sparse_classes_10k_train_001808
4,377
no_license
[ { "docstring": "获取有无学生调整线路 :param login_user_id :param create_dt :return:", "name": "query_sa_line_tooltips", "signature": "def query_sa_line_tooltips(self, login_user_id, create_dt)" }, { "docstring": "插入一条学生座位日志 :return:", "name": "add_student_line_seat_log", "signature": "def add_stud...
2
stack_v2_sparse_classes_30k_train_002269
Implement the Python class `StudentLineSeatLog` described below. Class description: Implement the StudentLineSeatLog class. Method signatures and docstrings: - def query_sa_line_tooltips(self, login_user_id, create_dt): 获取有无学生调整线路 :param login_user_id :param create_dt :return: - def add_student_line_seat_log(self, st...
Implement the Python class `StudentLineSeatLog` described below. Class description: Implement the StudentLineSeatLog class. Method signatures and docstrings: - def query_sa_line_tooltips(self, login_user_id, create_dt): 获取有无学生调整线路 :param login_user_id :param create_dt :return: - def add_student_line_seat_log(self, st...
a7cf5a0b6daa372ed860dc43d92c55fcde764eb9
<|skeleton|> class StudentLineSeatLog: def query_sa_line_tooltips(self, login_user_id, create_dt): """获取有无学生调整线路 :param login_user_id :param create_dt :return:""" <|body_0|> def add_student_line_seat_log(self, student_obj, login_user_id, now_time): """插入一条学生座位日志 :return:""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StudentLineSeatLog: def query_sa_line_tooltips(self, login_user_id, create_dt): """获取有无学生调整线路 :param login_user_id :param create_dt :return:""" sql = " select s.student_id, pbc.full_name as student_name, s.up_station_id, s.off_station_id, s1.bus_station_name as up_station_name, s2.bus_station...
the_stack_v2_python_sparse
python_project/smart_schoolBus_project/app/schoolbus_situation/models/student_line_seat_log_model.py
malqch/aibus
train
0
94738d0dd4bd733307056b3e8f31ca059734579b
[ "nr_rows, _ = data_frame.shape\nif not nr_rows:\n return '*<empty table>*'\nif nr_rows <= self._DATAFRAM_HEADER_ROWS + self._DATAFRAM_TAIL_ROWS:\n return tabulate.tabulate(data_frame, tablefmt='pipe', headers='keys')\nreturn_lines = []\nreturn_lines.append(tabulate.tabulate(data_frame[:self._DATAFRAM_HEADER_R...
<|body_start_0|> nr_rows, _ = data_frame.shape if not nr_rows: return '*<empty table>*' if nr_rows <= self._DATAFRAM_HEADER_ROWS + self._DATAFRAM_TAIL_ROWS: return tabulate.tabulate(data_frame, tablefmt='pipe', headers='keys') return_lines = [] return_line...
Markdown story exporter.
MarkdownStoryExporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarkdownStoryExporter: """Markdown story exporter.""" def _dataframe_to_markdown(self, data_frame): """Returns a markdown formatted string from a pandas DataFrame.""" <|body_0|> def export_story(self): """Export the story as a markdown.""" <|body_1|> <|e...
stack_v2_sparse_classes_10k_train_001809
3,234
permissive
[ { "docstring": "Returns a markdown formatted string from a pandas DataFrame.", "name": "_dataframe_to_markdown", "signature": "def _dataframe_to_markdown(self, data_frame)" }, { "docstring": "Export the story as a markdown.", "name": "export_story", "signature": "def export_story(self)" ...
2
stack_v2_sparse_classes_30k_train_007328
Implement the Python class `MarkdownStoryExporter` described below. Class description: Markdown story exporter. Method signatures and docstrings: - def _dataframe_to_markdown(self, data_frame): Returns a markdown formatted string from a pandas DataFrame. - def export_story(self): Export the story as a markdown.
Implement the Python class `MarkdownStoryExporter` described below. Class description: Markdown story exporter. Method signatures and docstrings: - def _dataframe_to_markdown(self, data_frame): Returns a markdown formatted string from a pandas DataFrame. - def export_story(self): Export the story as a markdown. <|sk...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class MarkdownStoryExporter: """Markdown story exporter.""" def _dataframe_to_markdown(self, data_frame): """Returns a markdown formatted string from a pandas DataFrame.""" <|body_0|> def export_story(self): """Export the story as a markdown.""" <|body_1|> <|e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MarkdownStoryExporter: """Markdown story exporter.""" def _dataframe_to_markdown(self, data_frame): """Returns a markdown formatted string from a pandas DataFrame.""" nr_rows, _ = data_frame.shape if not nr_rows: return '*<empty table>*' if nr_rows <= self._DAT...
the_stack_v2_python_sparse
timesketch/lib/stories/markdown.py
google/timesketch
train
2,263
ecc3be5a2b181f74b4e1fe0bdcb3588478a0684f
[ "if isinstance(waitkeyval, tuple):\n waitkeyval = waitkeyval[0]\nif is_raw:\n i = waitkeyval & 255\nreturn KeyBoardInput._key_dic[i]", "if isinstance(waitkeyval, (tuple, dict, set)):\n for x in waitkeyval:\n if isinstance(waitkeyval, int):\n waitkeyval = x\n break\nspecial = ...
<|body_start_0|> if isinstance(waitkeyval, tuple): waitkeyval = waitkeyval[0] if is_raw: i = waitkeyval & 255 return KeyBoardInput._key_dic[i] <|end_body_0|> <|body_start_1|> if isinstance(waitkeyval, (tuple, dict, set)): for x in waitkeyval: ...
user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'
KeyBoardInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyBoardInput: """user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'""" def get_pressed_key(waitkeyval, is_raw=True): """(int, bool) -> s...
stack_v2_sparse_classes_10k_train_001810
2,605
no_license
[ { "docstring": "(int, bool) -> str Pass in waitkey result, returning the string representation of the key. i: return value of waitkey is_raw: if true, is the raw return value otherwise assumes already converted to the character ord value, e.g. from view.show() Returns: string representation of keypress, also: '...
2
stack_v2_sparse_classes_30k_test_000109
Implement the Python class `KeyBoardInput` described below. Class description: user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none' Method signatures and docstrings: - def g...
Implement the Python class `KeyBoardInput` described below. Class description: user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none' Method signatures and docstrings: - def g...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class KeyBoardInput: """user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'""" def get_pressed_key(waitkeyval, is_raw=True): """(int, bool) -> s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KeyBoardInput: """user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'""" def get_pressed_key(waitkeyval, is_raw=True): """(int, bool) -> str Pass in wa...
the_stack_v2_python_sparse
opencvlib/display_utils.py
gmonkman/python
train
0
95d76f3adc9cde5140c1759f6b2c72ac92f9cea5
[ "results = search_fn(species=species, locations=locations, inlet=inlet, instrument=instrument, start_datetime=start_datetime, end_datetime=end_datetime)\nself._results = results\nreturn results", "if not isinstance(selected_keys, list):\n selected_keys = [selected_keys]\nkey_dict = {key: self._results[key]['ke...
<|body_start_0|> results = search_fn(species=species, locations=locations, inlet=inlet, instrument=instrument, start_datetime=start_datetime, end_datetime=end_datetime) self._results = results return results <|end_body_0|> <|body_start_1|> if not isinstance(selected_keys, list): ...
Used to search and download data from the object store
Search
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species ...
stack_v2_sparse_classes_10k_train_001811
2,647
permissive
[ { "docstring": "This is just a wrapper for the search function that allows easy access through LocalClient Args: species (str or list): Terms to search for in Datasources locations (str or list): Where to search for the terms in species inlet (str, default=None): Inlet height such as 100m instrument (str, defau...
2
stack_v2_sparse_classes_30k_train_000004
Implement the Python class `Search` described below. Class description: Used to search and download data from the object store Method signatures and docstrings: - def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): This is just a wrapper for the search function t...
Implement the Python class `Search` described below. Class description: Used to search and download data from the object store Method signatures and docstrings: - def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): This is just a wrapper for the search function t...
93c58c9e0381f453a604f39141f73022d4003322
<|skeleton|> class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species (str or list)...
the_stack_v2_python_sparse
HUGS/LocalClient/_search.py
hugs-cloud/hugs
train
0
2662eab3094ce1b4b0db9369edac940ffe9ada52
[ "arg_dict = req.environ['wsgiorg.routing_args'][1]\naction = arg_dict['action']\nmethod = getattr(self, action)\ndel arg_dict['controller']\ndel arg_dict['action']\nif 'format' in arg_dict:\n del arg_dict['format']\narg_dict['request'] = req\nresult = method(**arg_dict)\nif isinstance(result, dict) or result is ...
<|body_start_0|> arg_dict = req.environ['wsgiorg.routing_args'][1] action = arg_dict['action'] method = getattr(self, action) del arg_dict['controller'] del arg_dict['action'] if 'format' in arg_dict: del arg_dict['format'] arg_dict['request'] = req ...
WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. They raise a webob.exc exception, or r...
Controller
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. ...
stack_v2_sparse_classes_10k_train_001812
29,625
permissive
[ { "docstring": "Call the method specified in req.environ by RoutesMiddleware.", "name": "__call__", "signature": "def __call__(self, req)" }, { "docstring": "Serialize the given dict to the provided content_type. Uses self._serialization_metadata if it exists, which is a dict mapping MIME types ...
3
null
Implement the Python class `Controller` described below. Class description: WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argume...
Implement the Python class `Controller` described below. Class description: WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argume...
dde31aae392b80341f6440eb38db1583563d7d1f
<|skeleton|> class Controller: """WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Controller: """WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. They raise a ...
the_stack_v2_python_sparse
neutron/wsgi.py
openstack/neutron
train
1,174
2bb76b879c283eefc51750ffa292312b2bbef3c5
[ "self.start_time = get_start_time(run_history)\nself.metric = metric\nself.search_results = SearchResults(metric=metric, run_history=run_history, scoring_functions=[], order_by_endtime=True)\nself.ensemble_results = EnsembleResults(metric=metric, ensemble_performance_history=ensemble_performance_history, order_by_e...
<|body_start_0|> self.start_time = get_start_time(run_history) self.metric = metric self.search_results = SearchResults(metric=metric, run_history=run_history, scoring_functions=[], order_by_endtime=True) self.ensemble_results = EnsembleResults(metric=metric, ensemble_performance_history...
MetricResults
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-philippe-de-muyter" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricResults: def __init__(self, metric: autoPyTorchMetric, run_history: RunHistory, ensemble_performance_history: List[Dict[str, Any]]): """The wrapper class for ensemble_performance_history. This class extracts the information from ensemble_performance_history and allows other class t...
stack_v2_sparse_classes_10k_train_001813
30,202
permissive
[ { "docstring": "The wrapper class for ensemble_performance_history. This class extracts the information from ensemble_performance_history and allows other class to easily handle the history. Note that all the data is sorted by endtime! Attributes: start_time (float): The timestamp at the very beginning of the o...
3
stack_v2_sparse_classes_30k_test_000376
Implement the Python class `MetricResults` described below. Class description: Implement the MetricResults class. Method signatures and docstrings: - def __init__(self, metric: autoPyTorchMetric, run_history: RunHistory, ensemble_performance_history: List[Dict[str, Any]]): The wrapper class for ensemble_performance_h...
Implement the Python class `MetricResults` described below. Class description: Implement the MetricResults class. Method signatures and docstrings: - def __init__(self, metric: autoPyTorchMetric, run_history: RunHistory, ensemble_performance_history: List[Dict[str, Any]]): The wrapper class for ensemble_performance_h...
56a2ac1d69c7c61a847c678879a67f5d3672b3e8
<|skeleton|> class MetricResults: def __init__(self, metric: autoPyTorchMetric, run_history: RunHistory, ensemble_performance_history: List[Dict[str, Any]]): """The wrapper class for ensemble_performance_history. This class extracts the information from ensemble_performance_history and allows other class t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetricResults: def __init__(self, metric: autoPyTorchMetric, run_history: RunHistory, ensemble_performance_history: List[Dict[str, Any]]): """The wrapper class for ensemble_performance_history. This class extracts the information from ensemble_performance_history and allows other class to easily handl...
the_stack_v2_python_sparse
autoPyTorch/utils/results_manager.py
automl/Auto-PyTorch
train
2,214
8cc1c8a2dae587a063583e1e4e18d86634c71db1
[ "if not kwargs.get('no_django', False):\n overrides = dict([(k, getattr(middleware, k, None)) for k in django_variables])\n overrides['lookup'] = overrides['lookup']['main']\n kwargs.update(overrides)\nsuper(Template, self).__init__(*args, **kwargs)", "context_dictionary = {}\nif middleware.requestcontex...
<|body_start_0|> if not kwargs.get('no_django', False): overrides = dict([(k, getattr(middleware, k, None)) for k in django_variables]) overrides['lookup'] = overrides['lookup']['main'] kwargs.update(overrides) super(Template, self).__init__(*args, **kwargs) <|end_bod...
This bridges the gap between a Mako template and a djano template. It can be rendered like it is a django template because the arguments are transformed in a way that MakoTemplate can understand.
Template
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Template: """This bridges the gap between a Mako template and a djano template. It can be rendered like it is a django template because the arguments are transformed in a way that MakoTemplate can understand.""" def __init__(self, *args, **kwargs): """Overrides base __init__ to provi...
stack_v2_sparse_classes_10k_train_001814
2,563
no_license
[ { "docstring": "Overrides base __init__ to provide django variable overrides", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "This takes a render call with a context (from Django) and translates it to a render call on the mako template.", "name": "r...
2
stack_v2_sparse_classes_30k_train_005256
Implement the Python class `Template` described below. Class description: This bridges the gap between a Mako template and a djano template. It can be rendered like it is a django template because the arguments are transformed in a way that MakoTemplate can understand. Method signatures and docstrings: - def __init__...
Implement the Python class `Template` described below. Class description: This bridges the gap between a Mako template and a djano template. It can be rendered like it is a django template because the arguments are transformed in a way that MakoTemplate can understand. Method signatures and docstrings: - def __init__...
5fa3a818c3d41bd9c3eb25122e1d376c8910269c
<|skeleton|> class Template: """This bridges the gap between a Mako template and a djano template. It can be rendered like it is a django template because the arguments are transformed in a way that MakoTemplate can understand.""" def __init__(self, *args, **kwargs): """Overrides base __init__ to provi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Template: """This bridges the gap between a Mako template and a djano template. It can be rendered like it is a django template because the arguments are transformed in a way that MakoTemplate can understand.""" def __init__(self, *args, **kwargs): """Overrides base __init__ to provide django var...
the_stack_v2_python_sparse
ExtractFeatures/Data/pratik98/template.py
vivekaxl/LexisNexis
train
9
a16bd30e87bfbe53fbdf046a723fe64414623bab
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TimeOffRequest()", "from .schedule_change_request import ScheduleChangeRequest\nfrom .schedule_change_request import ScheduleChangeRequest\nfields: Dict[str, Callable[[Any], None]] = {'endDateTime': lambda n: setattr(self, 'end_date_ti...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TimeOffRequest() <|end_body_0|> <|body_start_1|> from .schedule_change_request import ScheduleChangeRequest from .schedule_change_request import ScheduleChangeRequest fields: Dic...
TimeOffRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeOffRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeOffRequest: """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 Retur...
stack_v2_sparse_classes_10k_train_001815
2,982
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: TimeOffRequest", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
stack_v2_sparse_classes_30k_train_004091
Implement the Python class `TimeOffRequest` described below. Class description: Implement the TimeOffRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeOffRequest: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `TimeOffRequest` described below. Class description: Implement the TimeOffRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeOffRequest: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TimeOffRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeOffRequest: """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 Retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TimeOffRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeOffRequest: """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: TimeOffReq...
the_stack_v2_python_sparse
msgraph/generated/models/time_off_request.py
microsoftgraph/msgraph-sdk-python
train
135
532eafccbe97f5e7d7ea95e5bed5b0db32561816
[ "from datasource import DataSource\nself.corot = DataSource(database='wifsip', user='sro', host='pina.aip.de')\nif type(param) is str:\n try:\n values = self._byname(param)[0]\n except IndexError:\n values = [None, None, None, None, None, None, None, None, None, None]\nif type(param) is tuple:\n...
<|body_start_0|> from datasource import DataSource self.corot = DataSource(database='wifsip', user='sro', host='pina.aip.de') if type(param) is str: try: values = self._byname(param)[0] except IndexError: values = [None, None, None, None, N...
Class to inference the PPMXL table in the wifsip database on pina
Ppmxl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ppmxl: """Class to inference the PPMXL table in the wifsip database on pina""" def __init__(self, param): """Constructor: initialize the database and query it according the parameter, if a string is given, then we assume, it is the name, if it is a tuple, then we take them as coordin...
stack_v2_sparse_classes_10k_train_001816
2,163
no_license
[ { "docstring": "Constructor: initialize the database and query it according the parameter, if a string is given, then we assume, it is the name, if it is a tuple, then we take them as coordinates", "name": "__init__", "signature": "def __init__(self, param)" }, { "docstring": "query the table by...
3
stack_v2_sparse_classes_30k_train_003112
Implement the Python class `Ppmxl` described below. Class description: Class to inference the PPMXL table in the wifsip database on pina Method signatures and docstrings: - def __init__(self, param): Constructor: initialize the database and query it according the parameter, if a string is given, then we assume, it is...
Implement the Python class `Ppmxl` described below. Class description: Class to inference the PPMXL table in the wifsip database on pina Method signatures and docstrings: - def __init__(self, param): Constructor: initialize the database and query it according the parameter, if a string is given, then we assume, it is...
c2df6b5de8e94c3935768a8fb40b4f046c21afb4
<|skeleton|> class Ppmxl: """Class to inference the PPMXL table in the wifsip database on pina""" def __init__(self, param): """Constructor: initialize the database and query it according the parameter, if a string is given, then we assume, it is the name, if it is a tuple, then we take them as coordin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ppmxl: """Class to inference the PPMXL table in the wifsip database on pina""" def __init__(self, param): """Constructor: initialize the database and query it according the parameter, if a string is given, then we assume, it is the name, if it is a tuple, then we take them as coordinates""" ...
the_stack_v2_python_sparse
src/ppmxl.py
weingrill/SOCS
train
0
20d42b7157317b34797d9b02e37422aed6a157b6
[ "def _is_valid(act):\n return act.get('text', '') in quick_replies if quick_replies else True\nact = None\ncurr_time = time.time()\nallowed_timeout = timeout\nwhile act is None and time.time() - curr_time < allowed_timeout:\n act = agent.act()\n if act is not None and (not _is_valid(act)):\n agent.o...
<|body_start_0|> def _is_valid(act): return act.get('text', '') in quick_replies if quick_replies else True act = None curr_time = time.time() allowed_timeout = timeout while act is None and time.time() - curr_time < allowed_timeout: act = agent.act() ...
Provide interface for getting an agent's act with timeout.
TimeoutUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeoutUtils: """Provide interface for getting an agent's act with timeout.""" def get_timeout_act(agent: Agent, timeout: int=DEFAULT_TIMEOUT, quick_replies: Optional[List[str]]=None) -> Optional[Message]: """Return an agent's act, with a specified timeout. :param agent: Agent who is...
stack_v2_sparse_classes_10k_train_001817
2,763
permissive
[ { "docstring": "Return an agent's act, with a specified timeout. :param agent: Agent who is acting :param timeout: how long to wait :param quick_replies: If given, agent's message *MUST* be one of the quick replies :return: An act dictionary if no timeout; else, None", "name": "get_timeout_act", "signat...
2
stack_v2_sparse_classes_30k_train_001227
Implement the Python class `TimeoutUtils` described below. Class description: Provide interface for getting an agent's act with timeout. Method signatures and docstrings: - def get_timeout_act(agent: Agent, timeout: int=DEFAULT_TIMEOUT, quick_replies: Optional[List[str]]=None) -> Optional[Message]: Return an agent's ...
Implement the Python class `TimeoutUtils` described below. Class description: Provide interface for getting an agent's act with timeout. Method signatures and docstrings: - def get_timeout_act(agent: Agent, timeout: int=DEFAULT_TIMEOUT, quick_replies: Optional[List[str]]=None) -> Optional[Message]: Return an agent's ...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class TimeoutUtils: """Provide interface for getting an agent's act with timeout.""" def get_timeout_act(agent: Agent, timeout: int=DEFAULT_TIMEOUT, quick_replies: Optional[List[str]]=None) -> Optional[Message]: """Return an agent's act, with a specified timeout. :param agent: Agent who is...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TimeoutUtils: """Provide interface for getting an agent's act with timeout.""" def get_timeout_act(agent: Agent, timeout: int=DEFAULT_TIMEOUT, quick_replies: Optional[List[str]]=None) -> Optional[Message]: """Return an agent's act, with a specified timeout. :param agent: Agent who is acting :para...
the_stack_v2_python_sparse
parlai/chat_service/utils/timeout.py
facebookresearch/ParlAI
train
10,943
bf52cdb366bf2827c2168f9a33a80c59443be497
[ "super().__init__()\nself._mask = mask\nself._use_condition = use_condition\nself._log_scale = tf.keras.Sequential([tf.keras.layers.Dense(hidden_size, activation='relu'), tf.keras.layers.Dense(hidden_size, activation='relu'), tf.keras.layers.Dense(784, activation='tanh')])\nself._shift = tf.keras.Sequential([tf.ker...
<|body_start_0|> super().__init__() self._mask = mask self._use_condition = use_condition self._log_scale = tf.keras.Sequential([tf.keras.layers.Dense(hidden_size, activation='relu'), tf.keras.layers.Dense(hidden_size, activation='relu'), tf.keras.layers.Dense(784, activation='tanh')]) ...
Class conditioned convolutional affine coupling layer. Attributes: _mask _use_condition: _log_scale: _shift:
ClassConditionedAffineCouplingLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassConditionedAffineCouplingLayer: """Class conditioned convolutional affine coupling layer. Attributes: _mask _use_condition: _log_scale: _shift:""" def __init__(self, hidden_size, mask, use_condition): """Initializes the object. Args: hidden_size: mask: use_condition:""" ...
stack_v2_sparse_classes_10k_train_001818
12,897
no_license
[ { "docstring": "Initializes the object. Args: hidden_size: mask: use_condition:", "name": "__init__", "signature": "def __init__(self, hidden_size, mask, use_condition)" }, { "docstring": "Applies the layer to the inputs. Args: image: embedding: reverse: Returns:", "name": "call", "signa...
2
stack_v2_sparse_classes_30k_test_000187
Implement the Python class `ClassConditionedAffineCouplingLayer` described below. Class description: Class conditioned convolutional affine coupling layer. Attributes: _mask _use_condition: _log_scale: _shift: Method signatures and docstrings: - def __init__(self, hidden_size, mask, use_condition): Initializes the ob...
Implement the Python class `ClassConditionedAffineCouplingLayer` described below. Class description: Class conditioned convolutional affine coupling layer. Attributes: _mask _use_condition: _log_scale: _shift: Method signatures and docstrings: - def __init__(self, hidden_size, mask, use_condition): Initializes the ob...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class ClassConditionedAffineCouplingLayer: """Class conditioned convolutional affine coupling layer. Attributes: _mask _use_condition: _log_scale: _shift:""" def __init__(self, hidden_size, mask, use_condition): """Initializes the object. Args: hidden_size: mask: use_condition:""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassConditionedAffineCouplingLayer: """Class conditioned convolutional affine coupling layer. Attributes: _mask _use_condition: _log_scale: _shift:""" def __init__(self, hidden_size, mask, use_condition): """Initializes the object. Args: hidden_size: mask: use_condition:""" super().__ini...
the_stack_v2_python_sparse
flow.py
gaotianxiang/text-to-image-synthesis
train
0
9055c64e01fbf07b3a5f0b17d7e16f4148140538
[ "\"\"\"\n Input: \"ab\"\n \"aa\"\n Output: true\n Expected: false \n \"\"\"\nmapping = {}\ntarget = set()\nif len(s) != len(t):\n return False\nfor index in range(len(s)):\n firstL = s[index]\n secondL = t[index]\n if firstL not in mapping:\n if secon...
<|body_start_0|> """ Input: "ab" "aa" Output: true Expected: false """ mapping = {} target = set() if len(s) != len(t): return False for index in range(len(s)): fir...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_0|> def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ Input: "ab" ...
stack_v2_sparse_classes_10k_train_001819
2,113
no_license
[ { "docstring": ":type s: str :type t: str :rtype: bool", "name": "isIsomorphic", "signature": "def isIsomorphic(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: bool", "name": "isIsomorphic", "signature": "def isIsomorphic(self, s, t)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool - def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool <|skeleton|> class Solution: def...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_0|> def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isIsomorphic(self, s, t): """:type s: str :type t: str :rtype: bool""" """ Input: "ab" "aa" Output: true Expected: false """ mapping = {} target = set() if len(s) !...
the_stack_v2_python_sparse
Python_leetcode/205_isomorphic_strings.py
xiangcao/Leetcode
train
0
5553ca2491752d544383be876a85cc5a399cb482
[ "self.id = id\nself.callback_url = callback_url\nself.publish_permissions = publish_permissions\nself.sessions = sessions\nself.subscriptions = subscriptions\nself.tag = tag\nself.device_api_version = device_api_version", "if dictionary is None:\n return None\nid = dictionary.get('id')\ncallback_url = dictiona...
<|body_start_0|> self.id = id self.callback_url = callback_url self.publish_permissions = publish_permissions self.sessions = sessions self.subscriptions = subscriptions self.tag = tag self.device_api_version = device_api_version <|end_body_0|> <|body_start_1|> ...
Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this participant can publish audio or video sessi...
Participant
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Participant: """Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this parti...
stack_v2_sparse_classes_10k_train_001820
3,403
permissive
[ { "docstring": "Constructor for the Participant class", "name": "__init__", "signature": "def __init__(self, id=None, callback_url=None, publish_permissions=None, sessions=None, subscriptions=None, tag=None, device_api_version='V2')" }, { "docstring": "Creates an instance of this model from a di...
2
stack_v2_sparse_classes_30k_train_000699
Implement the Python class `Participant` described below. Class description: Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of Publis...
Implement the Python class `Participant` described below. Class description: Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of Publis...
447df3cc8cb7acaf3361d842630c432a9c31ce6e
<|skeleton|> class Participant: """Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this parti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Participant: """Implementation of the 'Participant' model. A participant object Attributes: id (string): Unique id of the participant callback_url (string): Full callback url to use for notifications about this participant publish_permissions (list of PublishPermissionEnum): Defines if this participant can pu...
the_stack_v2_python_sparse
bandwidth/webrtc/models/participant.py
Bandwidth/python-sdk
train
10
08dd77656cb692b79a43a89a11e05b28fd667fc4
[ "self.events1 = events1\nself.events2 = events2\nself.fields_to_compare = {}\nself.match_field = match_field\nfor field_name1, field_name2 in list(fields_to_compare.items()):\n try:\n _ = self.get_subfield(self.events1[0], field_name1)\n _ = self.get_subfield(self.events2[0], field_name2)\n ...
<|body_start_0|> self.events1 = events1 self.events2 = events2 self.fields_to_compare = {} self.match_field = match_field for field_name1, field_name2 in list(fields_to_compare.items()): try: _ = self.get_subfield(self.events1[0], field_name1) ...
Similar to EventComparator, but specifically for stimulation events, as it requires field/subfield comparison
StimComparator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StimComparator: """Similar to EventComparator, but specifically for stimulation events, as it requires field/subfield comparison""" def __init__(self, events1, events2, fields_to_compare, exceptions, match_field='mstime'): """:param events1: :param events2: :param fields_to_compare: ...
stack_v2_sparse_classes_10k_train_001821
42,123
no_license
[ { "docstring": ":param events1: :param events2: :param fields_to_compare: {'field1.subfield1' -> 'field2.subfield2'} :param exceptions: function that defines okay mismatches :param match_field: which field to match events based upon", "name": "__init__", "signature": "def __init__(self, events1, events2...
4
stack_v2_sparse_classes_30k_train_004596
Implement the Python class `StimComparator` described below. Class description: Similar to EventComparator, but specifically for stimulation events, as it requires field/subfield comparison Method signatures and docstrings: - def __init__(self, events1, events2, fields_to_compare, exceptions, match_field='mstime'): :...
Implement the Python class `StimComparator` described below. Class description: Similar to EventComparator, but specifically for stimulation events, as it requires field/subfield comparison Method signatures and docstrings: - def __init__(self, events1, events2, fields_to_compare, exceptions, match_field='mstime'): :...
0c457fdf95416c3256bd01dea9dcae62ccb7d4dc
<|skeleton|> class StimComparator: """Similar to EventComparator, but specifically for stimulation events, as it requires field/subfield comparison""" def __init__(self, events1, events2, fields_to_compare, exceptions, match_field='mstime'): """:param events1: :param events2: :param fields_to_compare: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StimComparator: """Similar to EventComparator, but specifically for stimulation events, as it requires field/subfield comparison""" def __init__(self, events1, events2, fields_to_compare, exceptions, match_field='mstime'): """:param events1: :param events2: :param fields_to_compare: {'field1.subf...
the_stack_v2_python_sparse
event_creation/submission/parsers/base_log_parser.py
pennmem/event_creation
train
5
448c8b2f20d61a4da6f0c5a3a6880ddcbd9e0be0
[ "self.data = data\nself.regression_function = regression_test_function\nself.test_name = regression_test_name\nself.covars = covars\nself.pheno = pheno\nself.cpgnames = cpgnames", "output = []\nfor i, site in enumerate(self.data):\n coefs, tstats, p_value = self.regression_function(self.pheno, site, covars=sel...
<|body_start_0|> self.data = data self.regression_function = regression_test_function self.test_name = regression_test_name self.covars = covars self.pheno = pheno self.cpgnames = cpgnames <|end_body_0|> <|body_start_1|> output = [] for i, site in enumera...
regression_test_function - a function that return the coefs, tstats, p_value such that: the value at index -1 describes the site under test the value at index 0 describes the intercept all other values describe the coefficients
Regression
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regression: """regression_test_function - a function that return the coefs, tstats, p_value such that: the value at index -1 describes the site under test the value at index 0 describes the intercept all other values describe the coefficients""" def __init__(self, data, regression_test_name,...
stack_v2_sparse_classes_10k_train_001822
15,952
no_license
[ { "docstring": "data - the methylation data matrix site by samples cpgnames - the list of cpgnames (sites) in the same order as in data pheno - the phenotypes vector (1D) to use (samples in the same order as in data) covars - the covariates matrix (can be more then 1 covariates) to use, if None- no covariates w...
2
stack_v2_sparse_classes_30k_train_004529
Implement the Python class `Regression` described below. Class description: regression_test_function - a function that return the coefs, tstats, p_value such that: the value at index -1 describes the site under test the value at index 0 describes the intercept all other values describe the coefficients Method signatu...
Implement the Python class `Regression` described below. Class description: regression_test_function - a function that return the coefs, tstats, p_value such that: the value at index -1 describes the site under test the value at index 0 describes the intercept all other values describe the coefficients Method signatu...
13ac554041a3b12ec7990e98452a44a4109904cb
<|skeleton|> class Regression: """regression_test_function - a function that return the coefs, tstats, p_value such that: the value at index -1 describes the site under test the value at index 0 describes the intercept all other values describe the coefficients""" def __init__(self, data, regression_test_name,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Regression: """regression_test_function - a function that return the coefs, tstats, p_value such that: the value at index -1 describes the site under test the value at index 0 describes the intercept all other values describe the coefficients""" def __init__(self, data, regression_test_name, regression_t...
the_stack_v2_python_sparse
ewas/GLINT_1/modules/ewas.py
moqri/era_old
train
1
6c6ac057635eebd1df8111204b50153a6dd79733
[ "n = len(heights)\nif n == 0:\n return 0\narea = 0\nfor i in range(n):\n curr_height = heights[i]\n left = i\n while left > 0 and heights[left - 1] >= curr_height:\n left -= 1\n right = i\n while right < n - 1 and heights[right + 1] >= curr_height:\n right += 1\n curr_area = (righ...
<|body_start_0|> n = len(heights) if n == 0: return 0 area = 0 for i in range(n): curr_height = heights[i] left = i while left > 0 and heights[left - 1] >= curr_height: left -= 1 right = i while right...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def largest_rectangle_area(self, heights: List[int]) -> int: """暴力解法(两边扩散)。""" <|body_0|> def largest_rectangle_area_2(self, heights: List[int]) -> int: """单调栈(递增)。""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(heights) ...
stack_v2_sparse_classes_10k_train_001823
4,345
no_license
[ { "docstring": "暴力解法(两边扩散)。", "name": "largest_rectangle_area", "signature": "def largest_rectangle_area(self, heights: List[int]) -> int" }, { "docstring": "单调栈(递增)。", "name": "largest_rectangle_area_2", "signature": "def largest_rectangle_area_2(self, heights: List[int]) -> int" } ]
2
null
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def largest_rectangle_area(self, heights: List[int]) -> int: 暴力解法(两边扩散)。 - def largest_rectangle_area_2(self, heights: List[int]) -> int: 单调栈(递增)。
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def largest_rectangle_area(self, heights: List[int]) -> int: 暴力解法(两边扩散)。 - def largest_rectangle_area_2(self, heights: List[int]) -> int: 单调栈(递增)。 <|skeleton|> c...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def largest_rectangle_area(self, heights: List[int]) -> int: """暴力解法(两边扩散)。""" <|body_0|> def largest_rectangle_area_2(self, heights: List[int]) -> int: """单调栈(递增)。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OfficialSolution: def largest_rectangle_area(self, heights: List[int]) -> int: """暴力解法(两边扩散)。""" n = len(heights) if n == 0: return 0 area = 0 for i in range(n): curr_height = heights[i] left = i while left > 0 and heights...
the_stack_v2_python_sparse
0084_largest-rectangle-in-histogram.py
Nigirimeshi/leetcode
train
0
457696dbf9305fb2ccb0ba48472035f52276cab8
[ "assert isinstance(node, nuke.Node), 'Expect a node, got: {}'.format(node)\nknob_name = cls.knob_name\nknobs = node.knobs()\nif knob_name not in knobs:\n n = node.input(1)\n raw_hash = cls.hash(n)\n k = nuke.Int_Knob(knob_name)\n k.setValue(raw_hash)\n node.addKnob(k)\nelse:\n k = knobs[knob_name]...
<|body_start_0|> assert isinstance(node, nuke.Node), 'Expect a node, got: {}'.format(node) knob_name = cls.knob_name knobs = node.knobs() if knob_name not in knobs: n = node.input(1) raw_hash = cls.hash(n) k = nuke.Int_Knob(knob_name) k.set...
Modified switch node for precomp.
__PrecompSwitch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class __PrecompSwitch: """Modified switch node for precomp.""" def init(cls, node): """Add necessary knobs.""" <|body_0|> def hash(cls, node): """Node hash result of @node up to upstream start.""" <|body_1|> def get_which(cls, node): """Return auto...
stack_v2_sparse_classes_10k_train_001824
10,392
no_license
[ { "docstring": "Add necessary knobs.", "name": "init", "signature": "def init(cls, node)" }, { "docstring": "Node hash result of @node up to upstream start.", "name": "hash", "signature": "def hash(cls, node)" }, { "docstring": "Return auto input choice for @node.", "name": "...
3
stack_v2_sparse_classes_30k_train_005722
Implement the Python class `__PrecompSwitch` described below. Class description: Modified switch node for precomp. Method signatures and docstrings: - def init(cls, node): Add necessary knobs. - def hash(cls, node): Node hash result of @node up to upstream start. - def get_which(cls, node): Return auto input choice f...
Implement the Python class `__PrecompSwitch` described below. Class description: Modified switch node for precomp. Method signatures and docstrings: - def init(cls, node): Add necessary knobs. - def hash(cls, node): Node hash result of @node up to upstream start. - def get_which(cls, node): Return auto input choice f...
e346c61db83397da1a8d80ed3a0e33aa7f677533
<|skeleton|> class __PrecompSwitch: """Modified switch node for precomp.""" def init(cls, node): """Add necessary knobs.""" <|body_0|> def hash(cls, node): """Node hash result of @node up to upstream start.""" <|body_1|> def get_which(cls, node): """Return auto...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class __PrecompSwitch: """Modified switch node for precomp.""" def init(cls, node): """Add necessary knobs.""" assert isinstance(node, nuke.Node), 'Expect a node, got: {}'.format(node) knob_name = cls.knob_name knobs = node.knobs() if knob_name not in knobs: ...
the_stack_v2_python_sparse
lib/comp/precomp.py
tws0002/Nuke-2
train
1
5edf793862bb5091737a8be1284e2d91c0dde783
[ "super(QDockRubberBand, self).__init__(parent)\nself.setWindowFlags(Qt.ToolTip | Qt.FramelessWindowHint)\nself.setAttribute(Qt.WA_TranslucentBackground)", "painter = QPainter(self)\nopt = QStyleOption()\nopt.initFrom(self)\nself.style().drawPrimitive(QStyle.PE_Widget, opt, painter, self)" ]
<|body_start_0|> super(QDockRubberBand, self).__init__(parent) self.setWindowFlags(Qt.ToolTip | Qt.FramelessWindowHint) self.setAttribute(Qt.WA_TranslucentBackground) <|end_body_0|> <|body_start_1|> painter = QPainter(self) opt = QStyleOption() opt.initFrom(self) ...
A custom rubber band widget for use with the dock overlay. This class is stylable from Qt style sheets.
QDockRubberBand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QDockRubberBand: """A custom rubber band widget for use with the dock overlay. This class is stylable from Qt style sheets.""" def __init__(self, parent=None): """Initialize a QDockRubberBand. Parameters ---------- parent : QWidget, optional The parent of the dock rubber band.""" ...
stack_v2_sparse_classes_10k_train_001825
18,455
permissive
[ { "docstring": "Initialize a QDockRubberBand. Parameters ---------- parent : QWidget, optional The parent of the dock rubber band.", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Handle the paint event for the dock rubber band.", "name": "paintEvent", ...
2
stack_v2_sparse_classes_30k_train_005219
Implement the Python class `QDockRubberBand` described below. Class description: A custom rubber band widget for use with the dock overlay. This class is stylable from Qt style sheets. Method signatures and docstrings: - def __init__(self, parent=None): Initialize a QDockRubberBand. Parameters ---------- parent : QWi...
Implement the Python class `QDockRubberBand` described below. Class description: A custom rubber band widget for use with the dock overlay. This class is stylable from Qt style sheets. Method signatures and docstrings: - def __init__(self, parent=None): Initialize a QDockRubberBand. Parameters ---------- parent : QWi...
1544e7fb371b8f941cfa2fde682795e479380284
<|skeleton|> class QDockRubberBand: """A custom rubber band widget for use with the dock overlay. This class is stylable from Qt style sheets.""" def __init__(self, parent=None): """Initialize a QDockRubberBand. Parameters ---------- parent : QWidget, optional The parent of the dock rubber band.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QDockRubberBand: """A custom rubber band widget for use with the dock overlay. This class is stylable from Qt style sheets.""" def __init__(self, parent=None): """Initialize a QDockRubberBand. Parameters ---------- parent : QWidget, optional The parent of the dock rubber band.""" super(QD...
the_stack_v2_python_sparse
enaml/qt/docking/dock_overlay.py
MatthieuDartiailh/enaml
train
26
ced5f55568d1bf3a6451b0bca5176f21a02b01c1
[ "amount = -1\nwhile amount <= 0:\n amount = float(input(f'Enter {budget_category.value} budget: '))\n if amount <= 0:\n print('Budget amount must be greater than 0! Please enter again!')\nreturn Budget(budget_category, amount)", "manager = BudgetManager()\nfor category in list(BudgetCategory):\n b...
<|body_start_0|> amount = -1 while amount <= 0: amount = float(input(f'Enter {budget_category.value} budget: ')) if amount <= 0: print('Budget amount must be greater than 0! Please enter again!') return Budget(budget_category, amount) <|end_body_0|> <|bod...
An utility class that helps create Budget and BudgetManager.
BudgetCreator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BudgetCreator: """An utility class that helps create Budget and BudgetManager.""" def create_budget(budget_category: BudgetCategory) -> Budget: """Creates and returns a budget from user input for the given budget category. :param budget_category: a string :return: a Budget""" ...
stack_v2_sparse_classes_10k_train_001826
5,756
no_license
[ { "docstring": "Creates and returns a budget from user input for the given budget category. :param budget_category: a string :return: a Budget", "name": "create_budget", "signature": "def create_budget(budget_category: BudgetCategory) -> Budget" }, { "docstring": "Prompts the user for the amount...
4
stack_v2_sparse_classes_30k_train_001449
Implement the Python class `BudgetCreator` described below. Class description: An utility class that helps create Budget and BudgetManager. Method signatures and docstrings: - def create_budget(budget_category: BudgetCategory) -> Budget: Creates and returns a budget from user input for the given budget category. :par...
Implement the Python class `BudgetCreator` described below. Class description: An utility class that helps create Budget and BudgetManager. Method signatures and docstrings: - def create_budget(budget_category: BudgetCategory) -> Budget: Creates and returns a budget from user input for the given budget category. :par...
e86956c69006f96221349fe9bd4925ad2255601e
<|skeleton|> class BudgetCreator: """An utility class that helps create Budget and BudgetManager.""" def create_budget(budget_category: BudgetCategory) -> Budget: """Creates and returns a budget from user input for the given budget category. :param budget_category: a string :return: a Budget""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BudgetCreator: """An utility class that helps create Budget and BudgetManager.""" def create_budget(budget_category: BudgetCategory) -> Budget: """Creates and returns a budget from user input for the given budget category. :param budget_category: a string :return: a Budget""" amount = -1 ...
the_stack_v2_python_sparse
assignment-1-the-f-a-m-lizhiquan/budget.py
lizhiquan/learning-python
train
0
18e5561eab74af2f4a66d42c479c093b5de3113e
[ "first, boards_raw = parse(filename)\nboards = [Board(board_raw) for board_raw in boards_raw]\nnums = ints(first)\nfor num in nums:\n for board in boards:\n winner = board.mark(num)\n if winner:\n return num * board.unmarked_sum()\nraise ValueError", "first, boards_raw = parse(filename...
<|body_start_0|> first, boards_raw = parse(filename) boards = [Board(board_raw) for board_raw in boards_raw] nums = ints(first) for num in nums: for board in boards: winner = board.mark(num) if winner: return num * board.unm...
AoC 2021 Day 04
Day04
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day04: """AoC 2021 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 04 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2021 day 04 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001827
3,100
no_license
[ { "docstring": "Given a filename, solve 2021 day 04 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2021 day 04 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
null
Implement the Python class `Day04` described below. Class description: AoC 2021 Day 04 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2021 day 04 part 1 - def part2(filename: str) -> int: Given a filename, solve 2021 day 04 part 2
Implement the Python class `Day04` described below. Class description: AoC 2021 Day 04 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2021 day 04 part 1 - def part2(filename: str) -> int: Given a filename, solve 2021 day 04 part 2 <|skeleton|> class Day04: """AoC 202...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day04: """AoC 2021 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 04 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2021 day 04 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Day04: """AoC 2021 Day 04""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 04 part 1""" first, boards_raw = parse(filename) boards = [Board(board_raw) for board_raw in boards_raw] nums = ints(first) for num in nums: for board in b...
the_stack_v2_python_sparse
2021/python2021/aoc/day04.py
mreishus/aoc
train
16
7c1ca75a4f218e02e1c9b99c1c60a43e56d3f8f6
[ "super().__init__(game, mode_label=mode_selector_ui)\nself.mode_selector_ui = mode_selector_ui\nself.mission_selector_ui = mission_selector_ui\nself.mission_selector_label_ui = mission_selector_label_ui\nself.stage_selector_ui = stage_selector_ui\nself.mode_name = stage_name if stage_name else self.stage_selector_u...
<|body_start_0|> super().__init__(game, mode_label=mode_selector_ui) self.mode_selector_ui = mode_selector_ui self.mission_selector_ui = mission_selector_ui self.mission_selector_label_ui = mission_selector_label_ui self.stage_selector_ui = stage_selector_ui self.mode_nam...
Class for working with Epic Quests with 10 stages (usual missions without difficulty).
TenStageEpicQuest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenStageEpicQuest: """Class for working with Epic Quests with 10 stages (usual missions without difficulty).""" def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, stage_name=None): """Class initialization. :param lib.game.gam...
stack_v2_sparse_classes_10k_train_001828
26,035
permissive
[ { "docstring": "Class initialization. :param lib.game.game.Game game: instance of the game. :param ui.UIElement mode_selector_ui: UI element of Epic Quest selector. :param ui.UIElement mission_selector_ui: UI element of Epic Quest's mission selector. :param ui.UIElement mission_selector_label_ui: UI element of ...
6
stack_v2_sparse_classes_30k_train_005092
Implement the Python class `TenStageEpicQuest` described below. Class description: Class for working with Epic Quests with 10 stages (usual missions without difficulty). Method signatures and docstrings: - def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, st...
Implement the Python class `TenStageEpicQuest` described below. Class description: Class for working with Epic Quests with 10 stages (usual missions without difficulty). Method signatures and docstrings: - def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, st...
fd3f0bd45aea45e2e8ad8e8fc73a8953c96d350a
<|skeleton|> class TenStageEpicQuest: """Class for working with Epic Quests with 10 stages (usual missions without difficulty).""" def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, stage_name=None): """Class initialization. :param lib.game.gam...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TenStageEpicQuest: """Class for working with Epic Quests with 10 stages (usual missions without difficulty).""" def __init__(self, game, mode_selector_ui, mission_selector_ui, mission_selector_label_ui, stage_selector_ui, stage_name=None): """Class initialization. :param lib.game.game.Game game: ...
the_stack_v2_python_sparse
lib/game/missions/epic_quest.py
th3f1v3/mff_auto
train
0
11feda41ff47fb8a291ff8ba82f45a346d47ed86
[ "if longUrl in long2short:\n return prefix + long2short[longUrl]\nelse:\n gen_letter = ''.join([letters[random.randint(0, 61)] for i in range(6)])\n long2short[longUrl] = gen_letter\n short2long[gen_letter] = longUrl\n return prefix + gen_letter", "short = shortUrl.split('/')[-1]\nif short in short...
<|body_start_0|> if longUrl in long2short: return prefix + long2short[longUrl] else: gen_letter = ''.join([letters[random.randint(0, 61)] for i in range(6)]) long2short[longUrl] = gen_letter short2long[gen_letter] = longUrl return prefix + gen_...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, longUrl: str) -> str: """Encodes a URL to a shortened URL.""" <|body_0|> def decode(self, shortUrl: str) -> str: """Decodes a shortened URL to its original URL.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if longUrl in lo...
stack_v2_sparse_classes_10k_train_001829
933
no_license
[ { "docstring": "Encodes a URL to a shortened URL.", "name": "encode", "signature": "def encode(self, longUrl: str) -> str" }, { "docstring": "Decodes a shortened URL to its original URL.", "name": "decode", "signature": "def decode(self, shortUrl: str) -> str" } ]
2
stack_v2_sparse_classes_30k_train_001300
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, longUrl: str) -> str: Encodes a URL to a shortened URL. - def decode(self, shortUrl: str) -> str: Decodes a shortened URL to its original URL.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, longUrl: str) -> str: Encodes a URL to a shortened URL. - def decode(self, shortUrl: str) -> str: Decodes a shortened URL to its original URL. <|skeleton|> class Code...
5ed070f22f4bc29777ee5cbb01bb9583726d8799
<|skeleton|> class Codec: def encode(self, longUrl: str) -> str: """Encodes a URL to a shortened URL.""" <|body_0|> def decode(self, shortUrl: str) -> str: """Decodes a shortened URL to its original URL.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, longUrl: str) -> str: """Encodes a URL to a shortened URL.""" if longUrl in long2short: return prefix + long2short[longUrl] else: gen_letter = ''.join([letters[random.randint(0, 61)] for i in range(6)]) long2short[longUrl] = g...
the_stack_v2_python_sparse
535_encode_and_decode_tinyurl.py
zdadadaz/coding_practice
train
0
aaa8a371f8bf8e2b655cf49b00976257b53247ca
[ "error_checking.assert_is_numpy_array(binary_region_matrix, num_dimensions=2)\nerror_checking.assert_is_integer_numpy_array(binary_region_matrix)\nerror_checking.assert_is_geq_numpy_array(binary_region_matrix, 0)\nerror_checking.assert_is_leq_numpy_array(binary_region_matrix, 1)\nsetattr(self, NUM_GRID_ROWS_KEY, bi...
<|body_start_0|> error_checking.assert_is_numpy_array(binary_region_matrix, num_dimensions=2) error_checking.assert_is_integer_numpy_array(binary_region_matrix) error_checking.assert_is_geq_numpy_array(binary_region_matrix, 0) error_checking.assert_is_leq_numpy_array(binary_region_matrix...
Allows A-star to search through a physical grid. Each node is a grid cell at location (column, row)*** or (c, r). The goal is to navigate from the start node (first grid cell) to the end node (last grid cell), using only grid cells that are part of a connected region. There may be no path through the connected region, ...
GridSearch
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GridSearch: """Allows A-star to search through a physical grid. Each node is a grid cell at location (column, row)*** or (c, r). The goal is to navigate from the start node (first grid cell) to the end node (last grid cell), using only grid cells that are part of a connected region. There may be ...
stack_v2_sparse_classes_10k_train_001830
6,630
permissive
[ { "docstring": "Creates new instance. :param binary_region_matrix: M-by-N numpy array of integers in 0...1. If binary_region_matrix[i, j] = 1, grid cell [i, j] is part of the connected region.", "name": "__init__", "signature": "def __init__(self, binary_region_matrix)" }, { "docstring": "Return...
4
stack_v2_sparse_classes_30k_train_004607
Implement the Python class `GridSearch` described below. Class description: Allows A-star to search through a physical grid. Each node is a grid cell at location (column, row)*** or (c, r). The goal is to navigate from the start node (first grid cell) to the end node (last grid cell), using only grid cells that are pa...
Implement the Python class `GridSearch` described below. Class description: Allows A-star to search through a physical grid. Each node is a grid cell at location (column, row)*** or (c, r). The goal is to navigate from the start node (first grid cell) to the end node (last grid cell), using only grid cells that are pa...
95b99a16fdaa67dae69586c7f7c76e27ccd4b89a
<|skeleton|> class GridSearch: """Allows A-star to search through a physical grid. Each node is a grid cell at location (column, row)*** or (c, r). The goal is to navigate from the start node (first grid cell) to the end node (last grid cell), using only grid cells that are part of a connected region. There may be ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GridSearch: """Allows A-star to search through a physical grid. Each node is a grid cell at location (column, row)*** or (c, r). The goal is to navigate from the start node (first grid cell) to the end node (last grid cell), using only grid cells that are part of a connected region. There may be no path throu...
the_stack_v2_python_sparse
generalexam/ge_utils/a_star_search.py
thunderhoser/GeneralExam
train
4
6641253a39e23c071aa98b6f7d64ad9b788a9da8
[ "epm = self.getOrDefault(self.estimatorParamMaps)\nnumModels = len(epm)\nnFolds = self.getOrDefault(self.numFolds)\nsplit_ratio = 1.0 / nFolds\npasses = dataset[dataset['label'] == 1]\nfails = dataset[dataset['label'] == 0]\npass_splits = passes.randomSplit([split_ratio for i in range(nFolds)])\nfail_splits = fails...
<|body_start_0|> epm = self.getOrDefault(self.estimatorParamMaps) numModels = len(epm) nFolds = self.getOrDefault(self.numFolds) split_ratio = 1.0 / nFolds passes = dataset[dataset['label'] == 1] fails = dataset[dataset['label'] == 0] pass_splits = passes.randomSp...
Spark by default does not have Stratified folding so extending cross validator
StratifiedCrossValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StratifiedCrossValidator: """Spark by default does not have Stratified folding so extending cross validator""" def stratify_data(self, dataset): """Returns an array of dataframes with the same ratio of passes and failures. Currently only supports binary classification problems.""" ...
stack_v2_sparse_classes_10k_train_001831
2,328
no_license
[ { "docstring": "Returns an array of dataframes with the same ratio of passes and failures. Currently only supports binary classification problems.", "name": "stratify_data", "signature": "def stratify_data(self, dataset)" }, { "docstring": "Fits dataset", "name": "_fit", "signature": "de...
2
stack_v2_sparse_classes_30k_train_007073
Implement the Python class `StratifiedCrossValidator` described below. Class description: Spark by default does not have Stratified folding so extending cross validator Method signatures and docstrings: - def stratify_data(self, dataset): Returns an array of dataframes with the same ratio of passes and failures. Curr...
Implement the Python class `StratifiedCrossValidator` described below. Class description: Spark by default does not have Stratified folding so extending cross validator Method signatures and docstrings: - def stratify_data(self, dataset): Returns an array of dataframes with the same ratio of passes and failures. Curr...
6eb21f9ffe3440a96904ce7946113dbad18c0e66
<|skeleton|> class StratifiedCrossValidator: """Spark by default does not have Stratified folding so extending cross validator""" def stratify_data(self, dataset): """Returns an array of dataframes with the same ratio of passes and failures. Currently only supports binary classification problems.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StratifiedCrossValidator: """Spark by default does not have Stratified folding so extending cross validator""" def stratify_data(self, dataset): """Returns an array of dataframes with the same ratio of passes and failures. Currently only supports binary classification problems.""" epm = s...
the_stack_v2_python_sparse
pyspark/common/stratified_cross_validator.py
jazz0829/dsci-contractprediction
train
1
15affd7f845f256010f1b5713a2bec46068da839
[ "if not root:\n return []\nreturn self.postorderTraversal(root.left) + self.postorderTraversal(root.right) + [root.val]", "if not root:\n return []\nans: List[int] = []\nstack: List[TreeNode] = [root]\nwhile stack:\n node = stack.pop()\n if not node:\n continue\n ans.append(node.val)\n if...
<|body_start_0|> if not root: return [] return self.postorderTraversal(root.left) + self.postorderTraversal(root.right) + [root.val] <|end_body_0|> <|body_start_1|> if not root: return [] ans: List[int] = [] stack: List[TreeNode] = [root] while st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorderTraversal(self, root: TreeNode) -> List[int]: """递归。""" <|body_0|> def postorderTraversal2(self, root: TreeNode) -> List[int]: """迭代(栈)。 修改前序遍历的代码,修改左右子树入栈的顺序,并将结果集取反即可。""" <|body_1|> def postorderTraversal3(self, root: TreeNode) -...
stack_v2_sparse_classes_10k_train_001832
2,520
no_license
[ { "docstring": "递归。", "name": "postorderTraversal", "signature": "def postorderTraversal(self, root: TreeNode) -> List[int]" }, { "docstring": "迭代(栈)。 修改前序遍历的代码,修改左右子树入栈的顺序,并将结果集取反即可。", "name": "postorderTraversal2", "signature": "def postorderTraversal2(self, root: TreeNode) -> List[int...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root: TreeNode) -> List[int]: 递归。 - def postorderTraversal2(self, root: TreeNode) -> List[int]: 迭代(栈)。 修改前序遍历的代码,修改左右子树入栈的顺序,并将结果集取反即可。 - def postord...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root: TreeNode) -> List[int]: 递归。 - def postorderTraversal2(self, root: TreeNode) -> List[int]: 迭代(栈)。 修改前序遍历的代码,修改左右子树入栈的顺序,并将结果集取反即可。 - def postord...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class Solution: def postorderTraversal(self, root: TreeNode) -> List[int]: """递归。""" <|body_0|> def postorderTraversal2(self, root: TreeNode) -> List[int]: """迭代(栈)。 修改前序遍历的代码,修改左右子树入栈的顺序,并将结果集取反即可。""" <|body_1|> def postorderTraversal3(self, root: TreeNode) -...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def postorderTraversal(self, root: TreeNode) -> List[int]: """递归。""" if not root: return [] return self.postorderTraversal(root.left) + self.postorderTraversal(root.right) + [root.val] def postorderTraversal2(self, root: TreeNode) -> List[int]: """迭代(...
the_stack_v2_python_sparse
0145_binnay-tree-postorder-traversal.py
Nigirimeshi/leetcode
train
0
7e94e739a81a6c91335204b8d05115c1be7e26c9
[ "if annotation_file and gt_dataset or (not annotation_file and (not gt_dataset)):\n raise ValueError('One and only one of `annotation_file` and `gt_dataset` needs to be specified.')\nif eval_type not in ['box', 'mask']:\n raise ValueError('The `eval_type` can only be either `box` or `mask`.')\ncoco.COCO.__ini...
<|body_start_0|> if annotation_file and gt_dataset or (not annotation_file and (not gt_dataset)): raise ValueError('One and only one of `annotation_file` and `gt_dataset` needs to be specified.') if eval_type not in ['box', 'mask']: raise ValueError('The `eval_type` can only be e...
COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the external annotation dictionary.
COCOWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class COCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the ...
stack_v2_sparse_classes_10k_train_001833
16,692
permissive
[ { "docstring": "Instantiates a COCO-style API object. Args: eval_type: either 'box' or 'mask'. annotation_file: a JSON file that stores annotations of the eval dataset. This is required if `gt_dataset` is not provided. gt_dataset: the groundtruth eval datatset in COCO API format.", "name": "__init__", "...
2
stack_v2_sparse_classes_30k_train_002929
Implement the Python class `COCOWrapper` described below. Class description: COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support lo...
Implement the Python class `COCOWrapper` described below. Class description: COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support lo...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class COCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class COCOWrapper: """COCO wrapper class. This class wraps COCO API object, which provides the following additional functionalities: 1. Support string type image id. 2. Support loading the groundtruth dataset using the external annotation dictionary. 3. Support loading the prediction results using the external anno...
the_stack_v2_python_sparse
models/official/detection/evaluation/coco_utils.py
tensorflow/tpu
train
5,627
26dd01fc7464fa5f25199bb74be568bb4abc301a
[ "self.ranges = ranges = [0]\nself.rects = rects\nfor x1, y1, x2, y2 in rects:\n ranges.append(ranges[-1] + (y2 - y1 + 1) * (x2 - x1 + 1))", "ranges, rects = (self.ranges, self.rects)\nareaPt = random.randint(1, ranges[-1])\nx1, y1, x2, y2 = rects[bisect.bisect_left(ranges, areaPt) - 1]\nreturn [random.randint(...
<|body_start_0|> self.ranges = ranges = [0] self.rects = rects for x1, y1, x2, y2 in rects: ranges.append(ranges[-1] + (y2 - y1 + 1) * (x2 - x1 + 1)) <|end_body_0|> <|body_start_1|> ranges, rects = (self.ranges, self.rects) areaPt = random.randint(1, ranges[-1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ranges = ranges = [0] self.rects = rects for x1, y1, x2, y2 ...
stack_v2_sparse_classes_10k_train_001834
4,116
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_006910
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
d2037e521a3ee6fdcc14fd5228ea1fd32d57d637
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.ranges = ranges = [0] self.rects = rects for x1, y1, x2, y2 in rects: ranges.append(ranges[-1] + (y2 - y1 + 1) * (x2 - x1 + 1)) def pick(self): """:rtype: List[int]""" ...
the_stack_v2_python_sparse
monthlyChallenge/2020-08(augustchallenge)/8_22(***)RandNonOverlappedRect.py
phu-n-tran/LeetCode
train
2
77083dd974c78be3daf2458088c7adc21127226c
[ "scaled = self.sun * scale + self.bbn * (1 - scale)\nif scale > 1.0:\n jj, = np.argwhere(scaled.iso == isotope.ion('He4'))\n bbn = self.sun * 0 + self.bbn\n for j in np.argwhere(scaled.abu < self.sun.abu).flat:\n scaled.abu[jj] += scaled.abu[j]\n scaled.abu[j] = self.sun.abu[j] * np.exp((scal...
<|body_start_0|> scaled = self.sun * scale + self.bbn * (1 - scale) if scale > 1.0: jj, = np.argwhere(scaled.iso == isotope.ion('He4')) bbn = self.sun * 0 + self.bbn for j in np.argwhere(scaled.abu < self.sun.abu).flat: scaled.abu[jj] += scaled.abu[j] ...
Special abundance set created from scaled solar abundance set.
ScaledSolar
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaledSolar: """Special abundance set created from scaled solar abundance set.""" def _abu_massfrac_raw(self, scale): """Raw scaled solar abundances""" <|body_0|> def __init__(self, scale=1, Z=None, **kw): """Create abundance from set name. Use simple algorithm: ...
stack_v2_sparse_classes_10k_train_001835
14,741
permissive
[ { "docstring": "Raw scaled solar abundances", "name": "_abu_massfrac_raw", "signature": "def _abu_massfrac_raw(self, scale)" }, { "docstring": "Create abundance from set name. Use simple algorithm: X = X_sun * scale + X_BBN * (1 - scale) If Z is provided, overwrite scale by Z/Zsun. For stuff tha...
2
null
Implement the Python class `ScaledSolar` described below. Class description: Special abundance set created from scaled solar abundance set. Method signatures and docstrings: - def _abu_massfrac_raw(self, scale): Raw scaled solar abundances - def __init__(self, scale=1, Z=None, **kw): Create abundance from set name. U...
Implement the Python class `ScaledSolar` described below. Class description: Special abundance set created from scaled solar abundance set. Method signatures and docstrings: - def _abu_massfrac_raw(self, scale): Raw scaled solar abundances - def __init__(self, scale=1, Z=None, **kw): Create abundance from set name. U...
98fc181bab054619d12ffa4173ad5c469803c2ec
<|skeleton|> class ScaledSolar: """Special abundance set created from scaled solar abundance set.""" def _abu_massfrac_raw(self, scale): """Raw scaled solar abundances""" <|body_0|> def __init__(self, scale=1, Z=None, **kw): """Create abundance from set name. Use simple algorithm: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScaledSolar: """Special abundance set created from scaled solar abundance set.""" def _abu_massfrac_raw(self, scale): """Raw scaled solar abundances""" scaled = self.sun * scale + self.bbn * (1 - scale) if scale > 1.0: jj, = np.argwhere(scaled.iso == isotope.ion('He4')...
the_stack_v2_python_sparse
kepler_python_packages/python_scripts/abusets.py
adam-m-jcbs/xrb-sens-datashare
train
1
344e378fa957de55fa8d9165a576cc0ef116a934
[ "if model._meta.app_label in self.route_app_labels:\n return self.db_entry\nreturn None", "if model._meta.app_label in self.route_app_labels:\n return self.db_entry\nreturn None", "if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:\n return True\nreturn N...
<|body_start_0|> if model._meta.app_label in self.route_app_labels: return self.db_entry return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.route_app_labels: return self.db_entry return None <|end_body_1|> <|body_start_2|> if ob...
A router to control all database operations on models in the auth application.
ProductionPortalRouter
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductionPortalRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to...
stack_v2_sparse_classes_10k_train_001836
2,942
permissive
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
stack_v2_sparse_classes_30k_train_001250
Implement the Python class `ProductionPortalRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, ...
Implement the Python class `ProductionPortalRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, ...
3b31e13b9cef9a805f9d517efc9449068b829fcb
<|skeleton|> class ProductionPortalRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProductionPortalRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if model._meta.app_label in self.route_app_labels: return self.db_entry ...
the_stack_v2_python_sparse
src/ensembl/production/portal/routers.py
Ensembl/ensembl-production-services
train
4
0a404c1421be4c6d39a1a7333cc6bd83b07ac0be
[ "n = self.xdim\nx = x.detach()\nx.requires_grad_(True)\nnx = self.step(t, x, u)\njac_x = torch.stack([torch.autograd.grad(nx[:, :, i].sum(), x, retain_graph=True)[0] for i in range(n)], dim=2)\nreturn jac_x", "n = self.xdim\nu = u.detach()\nu.requires_grad_(True)\nnx = self.step(t, x, u)\njac_u = torch.stack([tor...
<|body_start_0|> n = self.xdim x = x.detach() x.requires_grad_(True) nx = self.step(t, x, u) jac_x = torch.stack([torch.autograd.grad(nx[:, :, i].sum(), x, retain_graph=True)[0] for i in range(n)], dim=2) return jac_x <|end_body_0|> <|body_start_1|> n = self.xdim...
Mixin for computing jacobians of dynamics. Defaults to using autograd.
DynJacMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynJacMixin: """Mixin for computing jacobians of dynamics. Defaults to using autograd.""" def jac_step_x(self, t, x, u=None): """Returns the Jacobian of step at time t Args: t (torch.tensor): (B, T,) shaped time indices x (torch.tensor): (B, T, n) shaped system states u (torch.tensor...
stack_v2_sparse_classes_10k_train_001837
11,101
permissive
[ { "docstring": "Returns the Jacobian of step at time t Args: t (torch.tensor): (B, T,) shaped time indices x (torch.tensor): (B, T, n) shaped system states u (torch.tensor): (B, T, m) shaped control inputs Returns jac_x_t (torch.tensor): (B, T, n, n) shaped jacobian of the next state", "name": "jac_step_x",...
3
stack_v2_sparse_classes_30k_train_002145
Implement the Python class `DynJacMixin` described below. Class description: Mixin for computing jacobians of dynamics. Defaults to using autograd. Method signatures and docstrings: - def jac_step_x(self, t, x, u=None): Returns the Jacobian of step at time t Args: t (torch.tensor): (B, T,) shaped time indices x (torc...
Implement the Python class `DynJacMixin` described below. Class description: Mixin for computing jacobians of dynamics. Defaults to using autograd. Method signatures and docstrings: - def jac_step_x(self, t, x, u=None): Returns the Jacobian of step at time t Args: t (torch.tensor): (B, T,) shaped time indices x (torc...
6154587fe3cdb92e8b7f70eedb1262caa1553cc8
<|skeleton|> class DynJacMixin: """Mixin for computing jacobians of dynamics. Defaults to using autograd.""" def jac_step_x(self, t, x, u=None): """Returns the Jacobian of step at time t Args: t (torch.tensor): (B, T,) shaped time indices x (torch.tensor): (B, T, n) shaped system states u (torch.tensor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DynJacMixin: """Mixin for computing jacobians of dynamics. Defaults to using autograd.""" def jac_step_x(self, t, x, u=None): """Returns the Jacobian of step at time t Args: t (torch.tensor): (B, T,) shaped time indices x (torch.tensor): (B, T, n) shaped system states u (torch.tensor): (B, T, m) ...
the_stack_v2_python_sparse
ceem/dynamics.py
sisl/CEEM
train
6
16cc7584e376ca79edc9f9970a09cfb46c4fe1ec
[ "review_request = context['review_request']\ndraft = review_request.get_draft(context['request'].user)\nif draft and draft.diffset or review_request.has_diffsets:\n return _('Update Diff')\nelse:\n return _('Upload Diff')", "request = context['request']\nreview_request = context.get('review_request')\nperms...
<|body_start_0|> review_request = context['review_request'] draft = review_request.get_draft(context['request'].user) if draft and draft.diffset or review_request.has_diffsets: return _('Update Diff') else: return _('Upload Diff') <|end_body_0|> <|body_start_1|> ...
The action to update or upload a diff. Version Added: 6.0
UploadDiffAction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadDiffAction: """The action to update or upload a diff. Version Added: 6.0""" def get_label(self, *, context: Context) -> _StrOrPromise: """Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for ...
stack_v2_sparse_classes_10k_train_001838
36,416
permissive
[ { "docstring": "Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for the action.", "name": "get_label", "signature": "def get_label(self, *, context: Context) -> _StrOrPromise" }, { "docstring": "Return whethe...
2
stack_v2_sparse_classes_30k_train_000884
Implement the Python class `UploadDiffAction` described below. Class description: The action to update or upload a diff. Version Added: 6.0 Method signatures and docstrings: - def get_label(self, *, context: Context) -> _StrOrPromise: Return the label for the action. Args: context (django.template.Context): The curre...
Implement the Python class `UploadDiffAction` described below. Class description: The action to update or upload a diff. Version Added: 6.0 Method signatures and docstrings: - def get_label(self, *, context: Context) -> _StrOrPromise: Return the label for the action. Args: context (django.template.Context): The curre...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class UploadDiffAction: """The action to update or upload a diff. Version Added: 6.0""" def get_label(self, *, context: Context) -> _StrOrPromise: """Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UploadDiffAction: """The action to update or upload a diff. Version Added: 6.0""" def get_label(self, *, context: Context) -> _StrOrPromise: """Return the label for the action. Args: context (django.template.Context): The current rendering context. Returns: str: The label to use for the action.""...
the_stack_v2_python_sparse
reviewboard/reviews/actions.py
reviewboard/reviewboard
train
1,141
e96945fababa77d483574550ab01855da9d66d98
[ "request_data = request.get_json()\nplan = request_data['plan']\nsuccess_url = request_data.get('success_url')\ncancel_url = request_data.get('cancel_url')\nif not success_url or not cancel_url:\n raise InvalidRequest()\nuser = get_authenticated_user()\nif not user.stripe_id:\n try:\n cus = billing.Cus...
<|body_start_0|> request_data = request.get_json() plan = request_data['plan'] success_url = request_data.get('success_url') cancel_url = request_data.get('cancel_url') if not success_url or not cancel_url: raise InvalidRequest() user = get_authenticated_user(...
Resource for managing a user's subscription.
UserPlan
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPlan: """Resource for managing a user's subscription.""" def post(self): """Create the user's subscription. Returns a Stripe checkout session.""" <|body_0|> def put(self): """Update the user's existing subscription.""" <|body_1|> def get(self): ...
stack_v2_sparse_classes_10k_train_001839
33,890
permissive
[ { "docstring": "Create the user's subscription. Returns a Stripe checkout session.", "name": "post", "signature": "def post(self)" }, { "docstring": "Update the user's existing subscription.", "name": "put", "signature": "def put(self)" }, { "docstring": "Fetch any existing subsc...
3
stack_v2_sparse_classes_30k_train_002251
Implement the Python class `UserPlan` described below. Class description: Resource for managing a user's subscription. Method signatures and docstrings: - def post(self): Create the user's subscription. Returns a Stripe checkout session. - def put(self): Update the user's existing subscription. - def get(self): Fetch...
Implement the Python class `UserPlan` described below. Class description: Resource for managing a user's subscription. Method signatures and docstrings: - def post(self): Create the user's subscription. Returns a Stripe checkout session. - def put(self): Update the user's existing subscription. - def get(self): Fetch...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class UserPlan: """Resource for managing a user's subscription.""" def post(self): """Create the user's subscription. Returns a Stripe checkout session.""" <|body_0|> def put(self): """Update the user's existing subscription.""" <|body_1|> def get(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserPlan: """Resource for managing a user's subscription.""" def post(self): """Create the user's subscription. Returns a Stripe checkout session.""" request_data = request.get_json() plan = request_data['plan'] success_url = request_data.get('success_url') cancel_...
the_stack_v2_python_sparse
endpoints/api/billing.py
quay/quay
train
2,363
e25ad4244721aaa79efc43d16399f417a46154d9
[ "self._app.route('/api/autoconf', methods=['GET'], endpoint='api_autoconf')(self.entrypoint)\nself._app.route('/api/autoconf/<string:session_id>', methods=['GET', 'POST', 'DELETE'], endpoint='api_autoconf_status')(self.entrypoint)\nself._app.route('/api/autoconf/rgc', methods=['POST', 'DELETE', 'GET', 'PATCH'], end...
<|body_start_0|> self._app.route('/api/autoconf', methods=['GET'], endpoint='api_autoconf')(self.entrypoint) self._app.route('/api/autoconf/<string:session_id>', methods=['GET', 'POST', 'DELETE'], endpoint='api_autoconf_status')(self.entrypoint) self._app.route('/api/autoconf/rgc', methods=['POS...
AutoConfHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoConfHandler: def create_routes(self): """Creates all pertinent routes to for the API resource""" <|body_0|> def process_request(self, *args, **kwargs): """Processes an API request Returns: Flask.Response""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001840
2,927
no_license
[ { "docstring": "Creates all pertinent routes to for the API resource", "name": "create_routes", "signature": "def create_routes(self)" }, { "docstring": "Processes an API request Returns: Flask.Response", "name": "process_request", "signature": "def process_request(self, *args, **kwargs)...
2
stack_v2_sparse_classes_30k_train_000572
Implement the Python class `AutoConfHandler` described below. Class description: Implement the AutoConfHandler class. Method signatures and docstrings: - def create_routes(self): Creates all pertinent routes to for the API resource - def process_request(self, *args, **kwargs): Processes an API request Returns: Flask....
Implement the Python class `AutoConfHandler` described below. Class description: Implement the AutoConfHandler class. Method signatures and docstrings: - def create_routes(self): Creates all pertinent routes to for the API resource - def process_request(self, *args, **kwargs): Processes an API request Returns: Flask....
7338e189f0e33fa6ab7e30cf95034bc5faa99462
<|skeleton|> class AutoConfHandler: def create_routes(self): """Creates all pertinent routes to for the API resource""" <|body_0|> def process_request(self, *args, **kwargs): """Processes an API request Returns: Flask.Response""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutoConfHandler: def create_routes(self): """Creates all pertinent routes to for the API resource""" self._app.route('/api/autoconf', methods=['GET'], endpoint='api_autoconf')(self.entrypoint) self._app.route('/api/autoconf/<string:session_id>', methods=['GET', 'POST', 'DELETE'], endpo...
the_stack_v2_python_sparse
mapadroid/madmin/api/autoconf/autoconfHandler.py
cecpk/MAD
train
1
651f5aa5df5a0983bd999071d16c2b936ad25145
[ "if not root:\n return '[]'\nqueue = deque()\nqueue.append(root)\nres = []\nwhile queue:\n node = queue.popleft()\n if node:\n res.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\n else:\n res.append('null')\nreturn '[' + ','.join(res) + ']'", "if...
<|body_start_0|> if not root: return '[]' queue = deque() queue.append(root) res = [] while queue: node = queue.popleft() if node: res.append(str(node.val)) queue.append(node.left) queue.append(no...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_001841
1,786
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 `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: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
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: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
5cd8a6c99c463ce01f512379bcb265b7f0b99885
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '[]' queue = deque() queue.append(root) res = [] while queue: node = queue.popleft() if node: ...
the_stack_v2_python_sparse
jianzhi_offer/37.py
jingxiufenghua/algorithm_homework
train
0
7735d0f1280b12d0e40d1491c659c7ad4aae22b4
[ "pattern = '^M?M?M?$'\npattern = '^M{0,3}$'\nfor t in self.case_values[0]:\n r = re.search(pattern, t)\n i = len(t)\n if i < 4:\n assert r is not None, 'ERROR: pattern %s should match %s' % (pattern, t)\n else:\n assert r is None, 'ERROR: pattern %s should NOT match %s' % (pattern, t)", ...
<|body_start_0|> pattern = '^M?M?M?$' pattern = '^M{0,3}$' for t in self.case_values[0]: r = re.search(pattern, t) i = len(t) if i < 4: assert r is not None, 'ERROR: pattern %s should match %s' % (pattern, t) else: a...
RegexMatch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegexMatch: def testMatchM2N(self): """match 0 - 3 M only""" <|body_0|> def testMatchXorY(self): """match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> pattern = '^M?M?M?$' pattern = '...
stack_v2_sparse_classes_10k_train_001842
1,205
no_license
[ { "docstring": "match 0 - 3 M only", "name": "testMatchM2N", "signature": "def testMatchM2N(self)" }, { "docstring": "match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:", "name": "testMatchXorY", "signature": "def testMatchXorY(self)" } ]
2
stack_v2_sparse_classes_30k_train_004124
Implement the Python class `RegexMatch` described below. Class description: Implement the RegexMatch class. Method signatures and docstrings: - def testMatchM2N(self): match 0 - 3 M only - def testMatchXorY(self): match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:
Implement the Python class `RegexMatch` described below. Class description: Implement the RegexMatch class. Method signatures and docstrings: - def testMatchM2N(self): match 0 - 3 M only - def testMatchXorY(self): match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return: <|skeleton|> class RegexMatch: def te...
eb171b45bbf2f29cd1307aefd8e4609b683773d8
<|skeleton|> class RegexMatch: def testMatchM2N(self): """match 0 - 3 M only""" <|body_0|> def testMatchXorY(self): """match any of these cases: CM CD 0 - 3 C D + 0 - 3 C :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegexMatch: def testMatchM2N(self): """match 0 - 3 M only""" pattern = '^M?M?M?$' pattern = '^M{0,3}$' for t in self.case_values[0]: r = re.search(pattern, t) i = len(t) if i < 4: assert r is not None, 'ERROR: pattern %s shoul...
the_stack_v2_python_sparse
library-demos/regex/regex_m2n.py
lostsquirrel/python_test
train
0
aab8f7787cd53135202d7158683af3e58d28e57a
[ "self.wx_menu = wx.Menu()\nparent = self.parent\nwhile parent and parent.widget_name != 'window':\n parent = parent.parent\nparent.wx_menus.append(self)", "parent = self.parent\nif parent.widget_name in ('context', 'menu'):\n parent.wx_menu.AppendSubMenu(self.wx_menu, self.generic.name)\nelse:\n parent.w...
<|body_start_0|> self.wx_menu = wx.Menu() parent = self.parent while parent and parent.widget_name != 'window': parent = parent.parent parent.wx_menus.append(self) <|end_body_0|> <|body_start_1|> parent = self.parent if parent.widget_name in ('context', 'menu...
WX4Menu
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WX4Menu: def _init(self): """Initialize the menu.""" <|body_0|> def _complete(self, window): """Complete the menu.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.wx_menu = wx.Menu() parent = self.parent while parent and parent....
stack_v2_sparse_classes_10k_train_001843
789
permissive
[ { "docstring": "Initialize the menu.", "name": "_init", "signature": "def _init(self)" }, { "docstring": "Complete the menu.", "name": "_complete", "signature": "def _complete(self, window)" } ]
2
stack_v2_sparse_classes_30k_train_000286
Implement the Python class `WX4Menu` described below. Class description: Implement the WX4Menu class. Method signatures and docstrings: - def _init(self): Initialize the menu. - def _complete(self, window): Complete the menu.
Implement the Python class `WX4Menu` described below. Class description: Implement the WX4Menu class. Method signatures and docstrings: - def _init(self): Initialize the menu. - def _complete(self, window): Complete the menu. <|skeleton|> class WX4Menu: def _init(self): """Initialize the menu.""" ...
2ff2a0f38119f22ac292aa533dbee3fb4fa04a41
<|skeleton|> class WX4Menu: def _init(self): """Initialize the menu.""" <|body_0|> def _complete(self, window): """Complete the menu.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WX4Menu: def _init(self): """Initialize the menu.""" self.wx_menu = wx.Menu() parent = self.parent while parent and parent.widget_name != 'window': parent = parent.parent parent.wx_menus.append(self) def _complete(self, window): """Complete the ...
the_stack_v2_python_sparse
bui/specific/wx4/menu.py
vincent-lg/bui
train
4
8be088dda6bf281c0a914a1d9b5ca899b01e3fc0
[ "self.k = k\nself.hash_func = hash_func\nself.elements = {}\nself.advice_obj = advice_obj\nself.func_of_freq = lambda x: x ** p", "sorted_elements = sorted(self.elements.items(), key=lambda x: x[1][0])\nfor i in range(self.k, len(sorted_elements)):\n del self.elements[sorted_elements[i][0]]", "if key in self...
<|body_start_0|> self.k = k self.hash_func = hash_func self.elements = {} self.advice_obj = advice_obj self.func_of_freq = lambda x: x ** p <|end_body_0|> <|body_start_1|> sorted_elements = sorted(self.elements.items(), key=lambda x: x[1][0]) for i in range(self....
Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always contains the k keys with lowest seed. For each key x...
MomentEstimatorSketch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MomentEstimatorSketch: """Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always con...
stack_v2_sparse_classes_10k_train_001844
24,996
permissive
[ { "docstring": "Initializes an empty sketch/sample of specified size. Args: k: Sample size hash_func: The randomness used for the sample (a hash function that maps each key into a supposedly independent exponential random variable with parameter 1) p: The moment estimated by the sketch advice_obj: An object tha...
4
stack_v2_sparse_classes_30k_train_004859
Implement the Python class `MomentEstimatorSketch` described below. Class description: Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of element...
Implement the Python class `MomentEstimatorSketch` described below. Class description: Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of element...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class MomentEstimatorSketch: """Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always con...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MomentEstimatorSketch: """Sketch for estimating frequency moments using advice. The sketch maintains a sample of at most k keys. For each key, we store its seed, which is computed using a hash function, and its frequency so far (the sum of weights of elements with that key). The sample always contains the k k...
the_stack_v2_python_sparse
moment_advice/moment_advice.py
Ayoob7/google-research
train
2
33d5145b2e3284f763ef5e5bdd74cf58a5f6be0d
[ "self.text = text\nself.x = x\nself.y = y\nself.width = width\nself.arrow = arrow", "elem = OrderedXMLElement('text')\nelem.children = [OrderedXMLElement('x', self.x), OrderedXMLElement('y', self.y)]\nif self.width is not None:\n elem.children.append(OrderedXMLElement('width', self.width.strip()))\nif self.arr...
<|body_start_0|> self.text = text self.x = x self.y = y self.width = width self.arrow = arrow <|end_body_0|> <|body_start_1|> elem = OrderedXMLElement('text') elem.children = [OrderedXMLElement('x', self.x), OrderedXMLElement('y', self.y)] if self.width i...
TextBox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextBox: def __init__(self, text, x, y, width='20%', arrow=None): """A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'cent...
stack_v2_sparse_classes_10k_train_001845
4,714
permissive
[ { "docstring": "A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'centered'. y (str): The position of the text box's top. width (str): The width of...
3
stack_v2_sparse_classes_30k_train_002213
Implement the Python class `TextBox` described below. Class description: Implement the TextBox class. Method signatures and docstrings: - def __init__(self, text, x, y, width='20%', arrow=None): A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the tex...
Implement the Python class `TextBox` described below. Class description: Implement the TextBox class. Method signatures and docstrings: - def __init__(self, text, x, y, width='20%', arrow=None): A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the tex...
d27011c304ec5203e7b067e1456a26d8232cffdc
<|skeleton|> class TextBox: def __init__(self, text, x, y, width='20%', arrow=None): """A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'cent...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextBox: def __init__(self, text, x, y, width='20%', arrow=None): """A text box within an epilogue screen. Attributes: text (str): The content of the text box. x (str): The position of the text box's left side. Technically any CSS value, but usually either a percentage, or the word 'centered'. y (str)...
the_stack_v2_python_sparse
opponents/monika/helper-scripts/csv2xml/epilogue.py
cometchuck/spnati
train
1
a4ac8be9c867a8b47f6a7f025a5bed327b6e6dc9
[ "s = sum((i for i in A if i % 2 == 0))\nres = []\nfor val, index in queries:\n if A[index] % 2 == 0:\n s -= A[index]\n A[index] += val\n if A[index] % 2 == 0:\n s += A[index]\n res.append(s)\nreturn res", "nsum = sum((i for i in A if i & 1 == 0))\nres = []\nfor value, key in queries:\n ...
<|body_start_0|> s = sum((i for i in A if i % 2 == 0)) res = [] for val, index in queries: if A[index] % 2 == 0: s -= A[index] A[index] += val if A[index] % 2 == 0: s += A[index] res.append(s) return res <|en...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumEvenAfterQueries(self, A, queries): """:type A: List[int] :type queries: List[List[int]] :rtype: List[int]""" <|body_0|> def sumEvenAfterQueries(self, A, queries): """:type A: List[int] :type queries: List[List[int]] :rtype: List[int]""" <|bo...
stack_v2_sparse_classes_10k_train_001846
2,334
no_license
[ { "docstring": ":type A: List[int] :type queries: List[List[int]] :rtype: List[int]", "name": "sumEvenAfterQueries", "signature": "def sumEvenAfterQueries(self, A, queries)" }, { "docstring": ":type A: List[int] :type queries: List[List[int]] :rtype: List[int]", "name": "sumEvenAfterQueries"...
3
stack_v2_sparse_classes_30k_test_000309
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumEvenAfterQueries(self, A, queries): :type A: List[int] :type queries: List[List[int]] :rtype: List[int] - def sumEvenAfterQueries(self, A, queries): :type A: List[int] :ty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumEvenAfterQueries(self, A, queries): :type A: List[int] :type queries: List[List[int]] :rtype: List[int] - def sumEvenAfterQueries(self, A, queries): :type A: List[int] :ty...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def sumEvenAfterQueries(self, A, queries): """:type A: List[int] :type queries: List[List[int]] :rtype: List[int]""" <|body_0|> def sumEvenAfterQueries(self, A, queries): """:type A: List[int] :type queries: List[List[int]] :rtype: List[int]""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sumEvenAfterQueries(self, A, queries): """:type A: List[int] :type queries: List[List[int]] :rtype: List[int]""" s = sum((i for i in A if i % 2 == 0)) res = [] for val, index in queries: if A[index] % 2 == 0: s -= A[index] A...
the_stack_v2_python_sparse
0985_Sum_of_Even_Numbers_After_Queries.py
bingli8802/leetcode
train
0
e999dbeee8b7d3b8c609be050e9be82f0785ce24
[ "self.dist = dist\nsamples_ = chaospy.generate_samples(2 * samples, domain=len(dist), rule=rule)\nself.samples1 = samples_.T[:samples].T\nself.samples2 = samples_.T[samples:].T\nself.poly = poly\nself.buffer = {}", "new = numpy.empty(self.samples1.shape)\nfor idx in range(len(indices)):\n if indices[idx]:\n ...
<|body_start_0|> self.dist = dist samples_ = chaospy.generate_samples(2 * samples, domain=len(dist), rule=rule) self.samples1 = samples_.T[:samples].T self.samples2 = samples_.T[samples:].T self.poly = poly self.buffer = {} <|end_body_0|> <|body_start_1|> new = n...
Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> generator[False, False].round(4) array([...
Saltelli
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Saltelli: """Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> gene...
stack_v2_sparse_classes_10k_train_001847
8,039
permissive
[ { "docstring": "Initialize the matrix generator. dist (chaopy.Distribution): distribution to sample from. samples (int): The number of samples to draw for each matrix. poly (numpoly.ndpoly): If provided, evaluated samples through polynomials before returned. rule (str): Scheme for generating random samples.", ...
3
stack_v2_sparse_classes_30k_train_000809
Implement the Python class `Saltelli` described below. Class description: Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Sa...
Implement the Python class `Saltelli` described below. Class description: Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Sa...
b5959a24e0bd9b214c292485919d7ce58795f5dc
<|skeleton|> class Saltelli: """Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> gene...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Saltelli: """Buffer class to be able to retrieve Saltelli matrices. The core of the method relies on cross-combining the columns of two random matrices as part of a double expectation. Examples: >>> dist = chaospy.Iid(chaospy.Uniform(), 2) >>> generator = Saltelli(dist, 3, rule="halton") >>> generator[False, ...
the_stack_v2_python_sparse
chaospy/saltelli.py
jonathf/chaospy
train
405
0e9ffe02893a0e2712fa4c2fe0a32ea2f806f9d8
[ "if len(prices) < 2:\n return 0\ndp = [[0 for _ in range(3)] for _ in range(len(prices))]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\ndp[0][2] = 0\nfor i in range(1, len(prices)):\n dp[i][0] = max(dp[i - 1][2], dp[i - 1][1] + prices[i])\n dp[i][1] = max(dp[i - 1][2] - prices[i], dp[i - 1][1])\n dp[i][2] = max...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[0 for _ in range(3)] for _ in range(len(prices))] dp[0][0] = 0 dp[0][1] = -prices[0] dp[0][2] = 0 for i in range(1, len(prices)): dp[i][0] = max(dp[i - 1][2], dp[i - 1][1] + prices[i]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][...
stack_v2_sparse_classes_10k_train_001848
3,831
no_license
[ { "docstring": "动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][1], dp[i - 1][2] - prices[i]) dp[i][2] 未持有股票并未冻结的情况: 1. 昨天未持有但被冻结 2....
3
stack_v2_sparse_classes_30k_train_005057
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划: dp[i][0] 表示第i天 未持有股票,dp[i][1] 表示第i天 持有股票 dp[i][0] 未持有并冻结股票有2种情况: 1. 昨天未持有,今天未持有 2. 昨天持有,今天卖出 dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i]) dp[i][1] 持有股票有2种情况: 1. 昨天持有,今天继续持有 2. 前天未持有,今天买入 dp[i][1] = max(dp[i - 1][1], dp[i - 1][...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit4.py
yinhuax/leet_code
train
0
50fc075c8b03b337eda35200a954205dbf5df24a
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
定义算术服务
ArithServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): """定义相加方法""" <|body_0|> def XiangJian(self, request, context): """定义相减方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) co...
stack_v2_sparse_classes_10k_train_001849
3,524
no_license
[ { "docstring": "定义相加方法", "name": "XiangJia", "signature": "def XiangJia(self, request, context)" }, { "docstring": "定义相减方法", "name": "XiangJian", "signature": "def XiangJian(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_000615
Implement the Python class `ArithServicer` described below. Class description: 定义算术服务 Method signatures and docstrings: - def XiangJia(self, request, context): 定义相加方法 - def XiangJian(self, request, context): 定义相减方法
Implement the Python class `ArithServicer` described below. Class description: 定义算术服务 Method signatures and docstrings: - def XiangJia(self, request, context): 定义相加方法 - def XiangJian(self, request, context): 定义相减方法 <|skeleton|> class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): ...
c2389b6d9c47d9a1a2e63c8e0dc3fc132943b444
<|skeleton|> class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): """定义相加方法""" <|body_0|> def XiangJian(self, request, context): """定义相减方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArithServicer: """定义算术服务""" def XiangJia(self, request, context): """定义相加方法""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def XiangJian(self, request, context): ...
the_stack_v2_python_sparse
micro/proto/grpc/arith_pb2_grpc.py
jstang9527/buoy
train
2
6c445198cfccb2e214c3bb7286632e461508d610
[ "if kwargs.get('instance'):\n kwargs.update(initial={'projects': kwargs['instance'].project_set.all()})\nsuper().__init__(*args, **kwargs)", "super()._save_m2m(*args, **kwargs)\nproject_ids = []\nif hasattr(self.data, 'getlist'):\n project_ids = self.data.getlist('projects')\nelif self.data.get('projects'):...
<|body_start_0|> if kwargs.get('instance'): kwargs.update(initial={'projects': kwargs['instance'].project_set.all()}) super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> super()._save_m2m(*args, **kwargs) project_ids = [] if hasattr(self.data, 'getlist'...
PowerPlantForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerPlantForm: def __init__(self, *args, **kwargs): """Display all of the PowerPlant's current projects as initial data.""" <|body_0|> def _save_m2m(self, *args, **kwargs): """Save the PowerPlant's Projects. All of the other uses of Django-Select2 are for Many-To-Ma...
stack_v2_sparse_classes_10k_train_001850
8,772
no_license
[ { "docstring": "Display all of the PowerPlant's current projects as initial data.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Save the PowerPlant's Projects. All of the other uses of Django-Select2 are for Many-To-Many fields, but since the project...
2
stack_v2_sparse_classes_30k_train_000143
Implement the Python class `PowerPlantForm` described below. Class description: Implement the PowerPlantForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Display all of the PowerPlant's current projects as initial data. - def _save_m2m(self, *args, **kwargs): Save the PowerPlant's P...
Implement the Python class `PowerPlantForm` described below. Class description: Implement the PowerPlantForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Display all of the PowerPlant's current projects as initial data. - def _save_m2m(self, *args, **kwargs): Save the PowerPlant's P...
f45fa2718ac8a0a852449fcb58cbcde20dd7a7ff
<|skeleton|> class PowerPlantForm: def __init__(self, *args, **kwargs): """Display all of the PowerPlant's current projects as initial data.""" <|body_0|> def _save_m2m(self, *args, **kwargs): """Save the PowerPlant's Projects. All of the other uses of Django-Select2 are for Many-To-Ma...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PowerPlantForm: def __init__(self, *args, **kwargs): """Display all of the PowerPlant's current projects as initial data.""" if kwargs.get('instance'): kwargs.update(initial={'projects': kwargs['instance'].project_set.all()}) super().__init__(*args, **kwargs) def _save...
the_stack_v2_python_sparse
infrastructure/forms.py
CSIS-iLab/new-silk-road
train
8
1bc07a6437a36aa4e4fb099fcf8dfeca68d30917
[ "self.web_address = ip\nself.web_port = port\nself.httpd = None\nself.bind_url = url", "HttpServers.signal.signal(HttpServers.signal.SIGINT, self.shutdown)\nself.httpd = HttpServers.Server((self.web_address, self.web_port), SimpleHTTPRequestHandler)\nif not self.bind_url:\n self.bind_url = 'http://' + self.web...
<|body_start_0|> self.web_address = ip self.web_port = port self.httpd = None self.bind_url = url <|end_body_0|> <|body_start_1|> HttpServers.signal.signal(HttpServers.signal.SIGINT, self.shutdown) self.httpd = HttpServers.Server((self.web_address, self.web_port), Simple...
HttpServers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpServers: def __init__(self, ip='localhost', port=8000, url=''): """http服务类初始化 HTTP service class initialization :param ip: 绑定的ip :param port: 端口 :param url: 对外显示的访问url""" <|body_0|> def start(self): """开启http服务 Start the HTTP service :return: None""" <|bo...
stack_v2_sparse_classes_10k_train_001851
1,716
permissive
[ { "docstring": "http服务类初始化 HTTP service class initialization :param ip: 绑定的ip :param port: 端口 :param url: 对外显示的访问url", "name": "__init__", "signature": "def __init__(self, ip='localhost', port=8000, url='')" }, { "docstring": "开启http服务 Start the HTTP service :return: None", "name": "start", ...
3
stack_v2_sparse_classes_30k_train_001153
Implement the Python class `HttpServers` described below. Class description: Implement the HttpServers class. Method signatures and docstrings: - def __init__(self, ip='localhost', port=8000, url=''): http服务类初始化 HTTP service class initialization :param ip: 绑定的ip :param port: 端口 :param url: 对外显示的访问url - def start(self...
Implement the Python class `HttpServers` described below. Class description: Implement the HttpServers class. Method signatures and docstrings: - def __init__(self, ip='localhost', port=8000, url=''): http服务类初始化 HTTP service class initialization :param ip: 绑定的ip :param port: 端口 :param url: 对外显示的访问url - def start(self...
93df83dbdccd9b2bb3e64c870b4a00c7073f1cc9
<|skeleton|> class HttpServers: def __init__(self, ip='localhost', port=8000, url=''): """http服务类初始化 HTTP service class initialization :param ip: 绑定的ip :param port: 端口 :param url: 对外显示的访问url""" <|body_0|> def start(self): """开启http服务 Start the HTTP service :return: None""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HttpServers: def __init__(self, ip='localhost', port=8000, url=''): """http服务类初始化 HTTP service class initialization :param ip: 绑定的ip :param port: 端口 :param url: 对外显示的访问url""" self.web_address = ip self.web_port = port self.httpd = None self.bind_url = url def start...
the_stack_v2_python_sparse
QuickStart_Rhy/NetTools/HttpServer.py
Slian22/QuickStart
train
0
4d302e147b019574635ba482bca66722d7046862
[ "self._x0 = x0\nself._y0 = y0\nself._x1 = x1\nself._y1 = y1\nself._rsquared = r * r", "if collision:\n return (-1.0, False)\nax = x - self._x0\nay = y - self._y0\nbx = self._x1 - self._x0\nby = self._y1 - self._y0\nda = ax * ax + ay * ay\ndot = ax * bx + ay * by\nif dot <= 0.0:\n return (0.0, False)\ndb = b...
<|body_start_0|> self._x0 = x0 self._y0 = y0 self._x1 = x1 self._y1 = y1 self._rsquared = r * r <|end_body_0|> <|body_start_1|> if collision: return (-1.0, False) ax = x - self._x0 ay = y - self._y0 bx = self._x1 - self._x0 by ...
Represents a driving task as a rectangle that the agent's car must enter.
Task
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Task: """Represents a driving task as a rectangle that the agent's car must enter.""" def __init__(self, x0, y0, x1, y1, r): """Initializes the task. The goal region is defined by a vector, and a distance to the vector that the car must be within to complete the task. Intuitively, ea...
stack_v2_sparse_classes_10k_train_001852
1,677
no_license
[ { "docstring": "Initializes the task. The goal region is defined by a vector, and a distance to the vector that the car must be within to complete the task. Intuitively, each task specifies a lane the car must enter. :param x0: the first x coordinate of the vector :param y0: the first y coordinate of the vector...
2
stack_v2_sparse_classes_30k_train_002926
Implement the Python class `Task` described below. Class description: Represents a driving task as a rectangle that the agent's car must enter. Method signatures and docstrings: - def __init__(self, x0, y0, x1, y1, r): Initializes the task. The goal region is defined by a vector, and a distance to the vector that the...
Implement the Python class `Task` described below. Class description: Represents a driving task as a rectangle that the agent's car must enter. Method signatures and docstrings: - def __init__(self, x0, y0, x1, y1, r): Initializes the task. The goal region is defined by a vector, and a distance to the vector that the...
381c019a3c930d943672a65ae651e5a4f52686f8
<|skeleton|> class Task: """Represents a driving task as a rectangle that the agent's car must enter.""" def __init__(self, x0, y0, x1, y1, r): """Initializes the task. The goal region is defined by a vector, and a distance to the vector that the car must be within to complete the task. Intuitively, ea...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Task: """Represents a driving task as a rectangle that the agent's car must enter.""" def __init__(self, x0, y0, x1, y1, r): """Initializes the task. The goal region is defined by a vector, and a distance to the vector that the car must be within to complete the task. Intuitively, each task speci...
the_stack_v2_python_sparse
domains/driving/tasks.py
rtloftin/HAL
train
0
84b3312c8f555f26119986091fe2ce41c6fa87d6
[ "try:\n import elasticsearch\nexcept ImportError:\n raise ValueError('Could not import elasticsearch python package. Please install it with `pip install elasticsearch`.')\nself.embedding = embedding\nself.index_name = index_name\ntry:\n es_client = elasticsearch.Elasticsearch(elasticsearch_url)\nexcept Val...
<|body_start_0|> try: import elasticsearch except ImportError: raise ValueError('Could not import elasticsearch python package. Please install it with `pip install elasticsearch`.') self.embedding = embedding self.index_name = index_name try: e...
Wrapper around Elasticsearch as a vector database. To connect to an Elasticsearch instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. Example: .. code-block:: python from langchain import ElasticVectorSearch from langchain.embed...
ElasticVectorSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticVectorSearch: """Wrapper around Elasticsearch as a vector database. To connect to an Elasticsearch instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. Example: .. code-block:: python from langchain ...
stack_v2_sparse_classes_10k_train_001853
10,618
no_license
[ { "docstring": "Initialize with necessary components.", "name": "__init__", "signature": "def __init__(self, elasticsearch_url: str, index_name: str, embedding: Embeddings)" }, { "docstring": "Run more texts through the embeddings and add to the vectorstore. Args: texts: Iterable of strings to a...
4
stack_v2_sparse_classes_30k_train_002098
Implement the Python class `ElasticVectorSearch` described below. Class description: Wrapper around Elasticsearch as a vector database. To connect to an Elasticsearch instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. Example:...
Implement the Python class `ElasticVectorSearch` described below. Class description: Wrapper around Elasticsearch as a vector database. To connect to an Elasticsearch instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. Example:...
b7aaa920a52613e3f1f04fa5cd7568ad37302d11
<|skeleton|> class ElasticVectorSearch: """Wrapper around Elasticsearch as a vector database. To connect to an Elasticsearch instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. Example: .. code-block:: python from langchain ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElasticVectorSearch: """Wrapper around Elasticsearch as a vector database. To connect to an Elasticsearch instance that does not require login credentials, pass the Elasticsearch URL and index name along with the embedding object to the constructor. Example: .. code-block:: python from langchain import Elasti...
the_stack_v2_python_sparse
openai/venv/lib64/python3.10/site-packages/langchain/vectorstores/elastic_vector_search.py
henrymendez/garage
train
0
588b1e7ec922834ad5143bae0e228b55142a06a4
[ "self.cell = cell\nself.shape = shape\nself.dimension = cell.dimension\nself.Nsites = np.prod(shape) * self.cell.Nsites\nself.sites = np.zeros(self.shape + [self.cell.Nsites], dtype='object')\nself.bonds = []\nself.build_sites()\nself.build_bonds()", "for i in range(self.shape[0]):\n for j in range(self.shape[...
<|body_start_0|> self.cell = cell self.shape = shape self.dimension = cell.dimension self.Nsites = np.prod(shape) * self.cell.Nsites self.sites = np.zeros(self.shape + [self.cell.Nsites], dtype='object') self.bonds = [] self.build_sites() self.build_bonds(...
Class for lattice
Lattice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lattice: """Class for lattice""" def __init__(self, cell, shape): """Initialize of lattice instance Parameters ---------- cell : Cell Cell class shape : list a list of three integer dimension : int dimension of the lattice, which can be one two or three Nsites : int number of sites i...
stack_v2_sparse_classes_10k_train_001854
7,577
permissive
[ { "docstring": "Initialize of lattice instance Parameters ---------- cell : Cell Cell class shape : list a list of three integer dimension : int dimension of the lattice, which can be one two or three Nsites : int number of sites in the lattice sites : numpy array numpy array for element of site object bonds : ...
6
stack_v2_sparse_classes_30k_train_000330
Implement the Python class `Lattice` described below. Class description: Class for lattice Method signatures and docstrings: - def __init__(self, cell, shape): Initialize of lattice instance Parameters ---------- cell : Cell Cell class shape : list a list of three integer dimension : int dimension of the lattice, whi...
Implement the Python class `Lattice` described below. Class description: Class for lattice Method signatures and docstrings: - def __init__(self, cell, shape): Initialize of lattice instance Parameters ---------- cell : Cell Cell class shape : list a list of three integer dimension : int dimension of the lattice, whi...
9b6323857fc27b17056ad6c8520d4a10a23dad4b
<|skeleton|> class Lattice: """Class for lattice""" def __init__(self, cell, shape): """Initialize of lattice instance Parameters ---------- cell : Cell Cell class shape : list a list of three integer dimension : int dimension of the lattice, which can be one two or three Nsites : int number of sites i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Lattice: """Class for lattice""" def __init__(self, cell, shape): """Initialize of lattice instance Parameters ---------- cell : Cell Cell class shape : list a list of three integer dimension : int dimension of the lattice, which can be one two or three Nsites : int number of sites in the lattice...
the_stack_v2_python_sparse
moha/modelsystem/lattice.py
xujunyao0928/moha
train
0
0ab478141249279c398718e0b7c15a11d98d35f6
[ "if not email:\n raise ValueError(_('The Email must be set'))\nemail = self.normalize_email(email)\nuser = self.model(email=email, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user", "extra_fields.setdefault('is_staff', True)\nextra_fields.setdefault('is_superuser', True)\nextra_fields.set...
<|body_start_0|> if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save() return user <|end_body_0|> <|body_start_1|> extra_fi...
Custom user model manager where email is the unique identifiers for authentication instead of usernames.
CustomUserManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password, **extra_fields): """Create and save a User with the given email and password.""" <|body_0|> def create...
stack_v2_sparse_classes_10k_train_001855
12,722
permissive
[ { "docstring": "Create and save a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password, **extra_fields)" }, { "docstring": "Create and save a SuperUser with the given email and password.", "name": "create_superuser", "signat...
2
null
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where email is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, email, password, **extra_fields): Create and save a User with the given ...
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where email is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, email, password, **extra_fields): Create and save a User with the given ...
ed957485c14aa8831e5a119d14849ddb0e1e6ec8
<|skeleton|> class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password, **extra_fields): """Create and save a User with the given email and password.""" <|body_0|> def create...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password, **extra_fields): """Create and save a User with the given email and password.""" if not email: raise ValueEr...
the_stack_v2_python_sparse
LAMBDA_LABS/backend-vbb-portal/vbb_backend/users/models.py
Bryan-Guner-Backup/DOWN_ARCHIVE_V2
train
0
2c194804dbc9b47fe347a9fc64f23402b0fa51d9
[ "if context is None:\n context = {}\nprod = self.pool.get('mrp.production').browse(cr, uid, context.get('active_id', False), context=context)\nsn = prod.serialno\nif not sn:\n sn = self.pool.get('ir.sequence').get(cr, uid, 'lot.sn.seq', context=None)\nreturn sn", "production_id = context.get('active_id', Fa...
<|body_start_0|> if context is None: context = {} prod = self.pool.get('mrp.production').browse(cr, uid, context.get('active_id', False), context=context) sn = prod.serialno if not sn: sn = self.pool.get('ir.sequence').get(cr, uid, 'lot.sn.seq', context=None) ...
mrp_product_produce
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mrp_product_produce: def _get_lot_sn(self, cr, uid, context=None): """To obtain MO SN @return: prod_lot""" <|body_0|> def do_produce(self, cr, uid, ids, context=None): """To create and add prod_lot in moves @param ids: The wizard id @return: Execute production with c...
stack_v2_sparse_classes_10k_train_001856
1,519
no_license
[ { "docstring": "To obtain MO SN @return: prod_lot", "name": "_get_lot_sn", "signature": "def _get_lot_sn(self, cr, uid, context=None)" }, { "docstring": "To create and add prod_lot in moves @param ids: The wizard id @return: Execute production with current MO's lot_id", "name": "do_produce",...
2
stack_v2_sparse_classes_30k_train_006763
Implement the Python class `mrp_product_produce` described below. Class description: Implement the mrp_product_produce class. Method signatures and docstrings: - def _get_lot_sn(self, cr, uid, context=None): To obtain MO SN @return: prod_lot - def do_produce(self, cr, uid, ids, context=None): To create and add prod_l...
Implement the Python class `mrp_product_produce` described below. Class description: Implement the mrp_product_produce class. Method signatures and docstrings: - def _get_lot_sn(self, cr, uid, context=None): To obtain MO SN @return: prod_lot - def do_produce(self, cr, uid, ids, context=None): To create and add prod_l...
c5a5678379649ccdf57a9d55b09b30436428b430
<|skeleton|> class mrp_product_produce: def _get_lot_sn(self, cr, uid, context=None): """To obtain MO SN @return: prod_lot""" <|body_0|> def do_produce(self, cr, uid, ids, context=None): """To create and add prod_lot in moves @param ids: The wizard id @return: Execute production with c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class mrp_product_produce: def _get_lot_sn(self, cr, uid, context=None): """To obtain MO SN @return: prod_lot""" if context is None: context = {} prod = self.pool.get('mrp.production').browse(cr, uid, context.get('active_id', False), context=context) sn = prod.serialno ...
the_stack_v2_python_sparse
bpkdomino/mrp_barcode/wizard/product_produce.py
adahra/addons
train
1
fa3de8a9ccaae415fbcf60dc9553c8daa6d1c070
[ "super(CreateVendorPartForm, self).__init__(*args, **kwargs)\nsettings = Settings.get_settings()\nif settings:\n self.owner.get_label = operator.attrgetter(settings.name_order)", "initial_validation = super(CreateVendorPartForm, self).validate()\nerrors = False\nif not initial_validation:\n errors = True\nv...
<|body_start_0|> super(CreateVendorPartForm, self).__init__(*args, **kwargs) settings = Settings.get_settings() if settings: self.owner.get_label = operator.attrgetter(settings.name_order) <|end_body_0|> <|body_start_1|> initial_validation = super(CreateVendorPartForm, self)...
CreateVendorPartForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateVendorPartForm: def __init__(self, *args, **kwargs): """Create instance.""" <|body_0|> def validate(self): """Validate the form.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(CreateVendorPartForm, self).__init__(*args, **kwargs) ...
stack_v2_sparse_classes_10k_train_001857
2,184
permissive
[ { "docstring": "Create instance.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Validate the form.", "name": "validate", "signature": "def validate(self)" } ]
2
stack_v2_sparse_classes_30k_train_004551
Implement the Python class `CreateVendorPartForm` described below. Class description: Implement the CreateVendorPartForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create instance. - def validate(self): Validate the form.
Implement the Python class `CreateVendorPartForm` described below. Class description: Implement the CreateVendorPartForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create instance. - def validate(self): Validate the form. <|skeleton|> class CreateVendorPartForm: def __init__...
ecb146cc26c6ade2863bcdc6d271ead3cbcbbe40
<|skeleton|> class CreateVendorPartForm: def __init__(self, *args, **kwargs): """Create instance.""" <|body_0|> def validate(self): """Validate the form.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateVendorPartForm: def __init__(self, *args, **kwargs): """Create instance.""" super(CreateVendorPartForm, self).__init__(*args, **kwargs) settings = Settings.get_settings() if settings: self.owner.get_label = operator.attrgetter(settings.name_order) def val...
the_stack_v2_python_sparse
pid/vendorpart/forms.py
PlanetaryResources/pid
train
3
3d727342e706e426f0caaedef1cae0e7363776b9
[ "self.avg_speed = avg_speed\nself.margin = 1000\nself.motors = {}\nself.inverted = inverted\nself.attach_motors()", "speed += self.avg_speed\nif self.inverted:\n speed = -speed\nif speed > self.margin:\n speed = self.margin\nelif speed < -self.margin:\n speed = self.margin\nfor p in ports:\n if self.m...
<|body_start_0|> self.avg_speed = avg_speed self.margin = 1000 self.motors = {} self.inverted = inverted self.attach_motors() <|end_body_0|> <|body_start_1|> speed += self.avg_speed if self.inverted: speed = -speed if speed > self.margin: ...
Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)
MotorControl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MotorControl: """Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)""" def __init__(self, avg_speed, inverted=False, **kwargs): """INI...
stack_v2_sparse_classes_10k_train_001858
8,924
no_license
[ { "docstring": "INIT-Argument: avg_speed: Mittlere Geschwindigkeit an den Motoren inverted: falls die Motoren sich anders herum drehen sollen zusaetzliche Keywordargumente der Motoren sh ev3dev Dokumentation", "name": "__init__", "signature": "def __init__(self, avg_speed, inverted=False, **kwargs)" }...
5
stack_v2_sparse_classes_30k_train_001721
Implement the Python class `MotorControl` described below. Class description: Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key) Method signatures and docstrings: - def...
Implement the Python class `MotorControl` described below. Class description: Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key) Method signatures and docstrings: - def...
a9a7160bf7fb3b528716ebabd4c16b4482d8d9cf
<|skeleton|> class MotorControl: """Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)""" def __init__(self, avg_speed, inverted=False, **kwargs): """INI...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MotorControl: """Klasse zum Verbinden und Ansteueren mehrere Motoren gleichzeitg Attribute: margin: Maximalwert Geschwindigkeit (mit Speedregulation) motors: Dictionary mit den jeweiligen Motoren(value) und Ports(key)""" def __init__(self, avg_speed, inverted=False, **kwargs): """INIT-Argument: a...
the_stack_v2_python_sparse
node/ev3con/linienverfolgung/control.py
Fuzzyma/network-controlled-line-follower
train
0
7b5e374dde9bf5526b854f6cf27ff495af92c394
[ "super(GANLoss, self).__init__()\nself.register_buffer('real_label', torch.tensor(target_real_label))\nself.register_buffer('fake_label', torch.tensor(target_fake_label))\nself.gan_mode = gan_mode\nif gan_mode == 'lsgan':\n self.loss = nn.MSELoss()\nelif gan_mode == 'vanilla':\n self.loss = nn.BCEWithLogitsLo...
<|body_start_0|> super(GANLoss, self).__init__() self.register_buffer('real_label', torch.tensor(target_real_label)) self.register_buffer('fake_label', torch.tensor(target_fake_label)) self.gan_mode = gan_mode if gan_mode == 'lsgan': self.loss = nn.MSELoss() e...
Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.
GANLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_10k_train_001859
16,766
no_license
[ { "docstring": "Initialize the GANLoss class. Parameters: gan_mode (str) - - the type of GAN objective. It currently supports vanilla, lsgan, and wgangp. target_real_label (bool) - - label for a real image target_fake_label (bool) - - label of a fake image Note: Do not use sigmoid as the last layer of Discrimin...
3
stack_v2_sparse_classes_30k_train_001198
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
Implement the Python class `GANLoss` described below. Class description: Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. Method signatures and docstrings: - def __init__(self, gan_mode, target_real_label=1.0, target_fake...
1af2ea3a0787a3f38742dceb39afc39d0825f370
<|skeleton|> class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: ga...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GANLoss: """Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.""" def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0): """Initialize the GANLoss class. Parameters: gan_mode (str) ...
the_stack_v2_python_sparse
hand_pose_estimators/CVPR2020_hpm3d/models/networks/blocks.py
Whiskysu/mm-hand
train
0
99368df4560221cdbc93856c68f303cb88bccb36
[ "self.main_window = QtGui.QWidget()\nself.gui = Gui()\nself.gui.setupUi(self.main_window)\nself.gui.button_1.clicked.connect(lambda: self.make_move(1, self.gui.button_1))\nself.gui.button_2.clicked.connect(lambda: self.make_move(2, self.gui.button_2))\nself.gui.button_3.clicked.connect(lambda: self.make_move(3, sel...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) self.gui.button_1.clicked.connect(lambda: self.make_move(1, self.gui.button_1)) self.gui.button_2.clicked.connect(lambda: self.make_move(2, self.gui.button_2)) self.gui...
Application class to create and control the gui. This version implements the Tic Tac Toe game using a grid of buttons.
App
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a grid of buttons.""" def __init__(self): """Initialize the gui.""" <|body_0|> def make_move(self, square, button): """Called when one of the buttons is cl...
stack_v2_sparse_classes_10k_train_001860
4,030
no_license
[ { "docstring": "Initialize the gui.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Called when one of the buttons is clicked. :param int square: Integer value indicating a square on the board. :param QtGui.QPushButton button: The button that was clicked. :return: None...
2
stack_v2_sparse_classes_30k_val_000022
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a grid of buttons. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def make_move(self, square, button): Called when one...
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a grid of buttons. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def make_move(self, square, button): Called when one...
0e3470085083012f893adb22aa46d46039016965
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a grid of buttons.""" def __init__(self): """Initialize the gui.""" <|body_0|> def make_move(self, square, button): """Called when one of the buttons is cl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a grid of buttons.""" def __init__(self): """Initialize the gui.""" self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) se...
the_stack_v2_python_sparse
CS_210 (Introduction to Programming)/TicTacToe/ButtonsApp.py
JacobOrner/USAFA
train
0
8646305231138426c8f84f194405b45dedd8ec38
[ "fin = open(filein, 'r')\nfout = open(fileout, 'w')\nl_cnt = 0\nfor line in fin:\n l_List = line.rstrip('|').lstrip('|').split('|')\n l_List = [el.strip() for el in l_List]\n if l_cnt == 0:\n l_cnt += 1\n line_o = ','.join(l_List).rstrip(',') + '\\n'\n fout.write(line_o)\n conti...
<|body_start_0|> fin = open(filein, 'r') fout = open(fileout, 'w') l_cnt = 0 for line in fin: l_List = line.rstrip('|').lstrip('|').split('|') l_List = [el.strip() for el in l_List] if l_cnt == 0: l_cnt += 1 line_o = ','...
SAPFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SAPFile: def fixLines1(self, filein, fileout): """This class takes a sap file from ZSE16 on a DSO in unconverted format. It reformats the data so that it can be loaded back via a flat file data source to the same DSO a) fixes quantities by removing trailing minus and adding to the front ...
stack_v2_sparse_classes_10k_train_001861
3,793
no_license
[ { "docstring": "This class takes a sap file from ZSE16 on a DSO in unconverted format. It reformats the data so that it can be loaded back via a flat file data source to the same DSO a) fixes quantities by removing trailing minus and adding to the front b) Puts dates in the correct format dd.mm.yyyy -> YYYYMMDD...
4
stack_v2_sparse_classes_30k_train_005035
Implement the Python class `SAPFile` described below. Class description: Implement the SAPFile class. Method signatures and docstrings: - def fixLines1(self, filein, fileout): This class takes a sap file from ZSE16 on a DSO in unconverted format. It reformats the data so that it can be loaded back via a flat file dat...
Implement the Python class `SAPFile` described below. Class description: Implement the SAPFile class. Method signatures and docstrings: - def fixLines1(self, filein, fileout): This class takes a sap file from ZSE16 on a DSO in unconverted format. It reformats the data so that it can be loaded back via a flat file dat...
553f5e4da3c68856159664cb56408ffcc470cb97
<|skeleton|> class SAPFile: def fixLines1(self, filein, fileout): """This class takes a sap file from ZSE16 on a DSO in unconverted format. It reformats the data so that it can be loaded back via a flat file data source to the same DSO a) fixes quantities by removing trailing minus and adding to the front ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SAPFile: def fixLines1(self, filein, fileout): """This class takes a sap file from ZSE16 on a DSO in unconverted format. It reformats the data so that it can be loaded back via a flat file data source to the same DSO a) fixes quantities by removing trailing minus and adding to the front b) Puts dates ...
the_stack_v2_python_sparse
Utilities.py
JonathanWaterhouse/FileManipulation
train
0
fb25f86d4956d0617e8e8b9df02a666e9f948b18
[ "declared = []\nfor obj in Rt.objective:\n var_list = split('[+*/-]', obj)\n for v in var_list:\n if v not in declared:\n self.add_input(v)\n declared.append(v)\n self.add_output('Objective function ' + obj)", "cpacs = CPACS(Rt.modules[-1].cpacs_out)\nupdate_dict(cpacs.tixi, ...
<|body_start_0|> declared = [] for obj in Rt.objective: var_list = split('[+*/-]', obj) for v in var_list: if v not in declared: self.add_input(v) declared.append(v) self.add_output('Objective function ' + obj) <...
Class to compute the objective function(s)
Objective
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Compute the objective expression""" <|body_1|> <|end_skeleton|> <|body_start_0|> declar...
stack_v2_sparse_classes_10k_train_001862
20,064
permissive
[ { "docstring": "Setup inputs and outputs", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Compute the objective expression", "name": "compute", "signature": "def compute(self, inputs, outputs)" } ]
2
stack_v2_sparse_classes_30k_train_004623
Implement the Python class `Objective` described below. Class description: Class to compute the objective function(s) Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Compute the objective expression
Implement the Python class `Objective` described below. Class description: Class to compute the objective function(s) Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Compute the objective expression <|skeleton|> class Objective: """Class to comp...
30ca55b39dc14e3f8ec1e00a475f76024d1b5fef
<|skeleton|> class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Compute the objective expression""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" declared = [] for obj in Rt.objective: var_list = split('[+*/-]', obj) for v in var_list: if v not in declared: s...
the_stack_v2_python_sparse
ceasiompy/Optimisation/optimisation.py
cfsengineering/CEASIOMpy
train
60
122dc14c3630ef281f91bcdf46677b4d920a59d1
[ "authors = ','.join([x['name'] for x in doc.artists])\nauthor = re.sub('[\\\\\\\\/:*?\"<>|]', '', authors.strip())\nmp3_name = re.sub('[\\\\\\\\/:*?\"<>|]', '', doc['name'])\nname = os.path.join(author, '%s - %s.mp4' % (author, mp3_name))\nreturn name", "try:\n target_r = get_target_r(doc, Config().get_mv_reso...
<|body_start_0|> authors = ','.join([x['name'] for x in doc.artists]) author = re.sub('[\\\\/:*?"<>|]', '', authors.strip()) mp3_name = re.sub('[\\\\/:*?"<>|]', '', doc['name']) name = os.path.join(author, '%s - %s.mp4' % (author, mp3_name)) return name <|end_body_0|> <|body_sta...
Video
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Video: def download_filename_full(self, doc): """implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str""" <|body_0|> def url_load(self, doc): """implement pls :param doc: :return: :rtype: str""" <|b...
stack_v2_sparse_classes_10k_train_001863
1,545
permissive
[ { "docstring": "implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str", "name": "download_filename_full", "signature": "def download_filename_full(self, doc)" }, { "docstring": "implement pls :param doc: :return: :rtype: str", "nam...
2
stack_v2_sparse_classes_30k_train_005683
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def download_filename_full(self, doc): implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str - def url_load(self, doc): imp...
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def download_filename_full(self, doc): implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str - def url_load(self, doc): imp...
68e588c0612d0ab2af3a820ff88ca24d698ceeb7
<|skeleton|> class Video: def download_filename_full(self, doc): """implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str""" <|body_0|> def url_load(self, doc): """implement pls :param doc: :return: :rtype: str""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Video: def download_filename_full(self, doc): """implement pls get a path to save file, by relative path need be complete by child :param doc: :return: :rtype: str""" authors = ','.join([x['name'] for x in doc.artists]) author = re.sub('[\\\\/:*?"<>|]', '', authors.strip()) mp3...
the_stack_v2_python_sparse
NXSpider/spider/video.py
Z-Shuming/NXSpider
train
0
1bd825ce613bad884564da9386dde28c53bf75f6
[ "if model._meta.app_label is 'manejador_contenido':\n return 'contenido'\nreturn None", "if model._meta.app_label is 'manejador_contenido':\n return 'contenido'\nreturn None", "if obj1._meta.app_label is 'manejador_contenido' or obj2._meta.app_label is 'manejador_contenido':\n return True\nreturn None"...
<|body_start_0|> if model._meta.app_label is 'manejador_contenido': return 'contenido' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label is 'manejador_contenido': return 'contenido' return None <|end_body_1|> <|body_start_2|> if obj1._...
ContenidoRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContenidoRouter: def db_for_read(self, model, **hints): """Lee de la base de datos contenido""" <|body_0|> def db_for_write(self, model, **hints): """Escribe la base de datos contenido""" <|body_1|> def allow_relation(self, obj1, obj2, **hints): ...
stack_v2_sparse_classes_10k_train_001864
1,007
no_license
[ { "docstring": "Lee de la base de datos contenido", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Escribe la base de datos contenido", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_007082
Implement the Python class `ContenidoRouter` described below. Class description: Implement the ContenidoRouter class. Method signatures and docstrings: - def db_for_read(self, model, **hints): Lee de la base de datos contenido - def db_for_write(self, model, **hints): Escribe la base de datos contenido - def allow_re...
Implement the Python class `ContenidoRouter` described below. Class description: Implement the ContenidoRouter class. Method signatures and docstrings: - def db_for_read(self, model, **hints): Lee de la base de datos contenido - def db_for_write(self, model, **hints): Escribe la base de datos contenido - def allow_re...
42956cf7ffcb121a4e0da9cf8d4e7d1b68820838
<|skeleton|> class ContenidoRouter: def db_for_read(self, model, **hints): """Lee de la base de datos contenido""" <|body_0|> def db_for_write(self, model, **hints): """Escribe la base de datos contenido""" <|body_1|> def allow_relation(self, obj1, obj2, **hints): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContenidoRouter: def db_for_read(self, model, **hints): """Lee de la base de datos contenido""" if model._meta.app_label is 'manejador_contenido': return 'contenido' return None def db_for_write(self, model, **hints): """Escribe la base de datos contenido""" ...
the_stack_v2_python_sparse
manejador_estadisticas/manejador_estadisticas/db_routers/contenido_router.py
imsarmiento/ISIS2503-202020-S3-DISCigners
train
0
ceacf4537ea150c11f31e82ce90197139f985a83
[ "def isMagic(i, j):\n s = set()\n for x in range(3):\n for y in range(3):\n s.add(grid[i + x][j + y])\n if len(s) == 9 and max(s) == 9 and (min(s) == 1):\n a = sum([grid[i + x][j + x] for x in range(3)])\n b = sum([grid[i + (2 - x)][j + x] for x in range(3)])\n if a !...
<|body_start_0|> def isMagic(i, j): s = set() for x in range(3): for y in range(3): s.add(grid[i + x][j + y]) if len(s) == 9 and max(s) == 9 and (min(s) == 1): a = sum([grid[i + x][j + x] for x in range(3)]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numMagicSquaresInside(self, grid): """:type grid: List[List[int]] :rtype: int 43 ms""" <|body_0|> def numMagicSquaresInside_1(self, g): """36ms :param g: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> def isMagic(i, j): ...
stack_v2_sparse_classes_10k_train_001865
2,335
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int 43 ms", "name": "numMagicSquaresInside", "signature": "def numMagicSquaresInside(self, grid)" }, { "docstring": "36ms :param g: :return:", "name": "numMagicSquaresInside_1", "signature": "def numMagicSquaresInside_1(self, g)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMagicSquaresInside(self, grid): :type grid: List[List[int]] :rtype: int 43 ms - def numMagicSquaresInside_1(self, g): 36ms :param g: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMagicSquaresInside(self, grid): :type grid: List[List[int]] :rtype: int 43 ms - def numMagicSquaresInside_1(self, g): 36ms :param g: :return: <|skeleton|> class Solution:...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def numMagicSquaresInside(self, grid): """:type grid: List[List[int]] :rtype: int 43 ms""" <|body_0|> def numMagicSquaresInside_1(self, g): """36ms :param g: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numMagicSquaresInside(self, grid): """:type grid: List[List[int]] :rtype: int 43 ms""" def isMagic(i, j): s = set() for x in range(3): for y in range(3): s.add(grid[i + x][j + y]) if len(s) == 9 and max(s) ==...
the_stack_v2_python_sparse
MagicSquaresInGrid_840.py
953250587/leetcode-python
train
2
5c4ff38e214af7583e8f31e460d1d19bfa9fd382
[ "if len(rating) < 3:\n return 0\nres = 0\nfor i in range(len(rating) - 2):\n for j in range(i + 1, len(rating) - 1):\n for k in range(j + 1, len(rating)):\n if rating[i] < rating[j] and rating[j] < rating[k] or (rating[i] > rating[j] and rating[j] > rating[k]):\n res += 1\nret...
<|body_start_0|> if len(rating) < 3: return 0 res = 0 for i in range(len(rating) - 2): for j in range(i + 1, len(rating) - 1): for k in range(j + 1, len(rating)): if rating[i] < rating[j] and rating[j] < rating[k] or (rating[i] > rating...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTeams(self, rating): """:type rating: List[int] :rtype: int""" <|body_0|> def numTeams(self, rating): """:type rating: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(rating) < 3: return 0 ...
stack_v2_sparse_classes_10k_train_001866
1,057
no_license
[ { "docstring": ":type rating: List[int] :rtype: int", "name": "numTeams", "signature": "def numTeams(self, rating)" }, { "docstring": ":type rating: List[int] :rtype: int", "name": "numTeams", "signature": "def numTeams(self, rating)" } ]
2
stack_v2_sparse_classes_30k_train_004667
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTeams(self, rating): :type rating: List[int] :rtype: int - def numTeams(self, rating): :type rating: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTeams(self, rating): :type rating: List[int] :rtype: int - def numTeams(self, rating): :type rating: List[int] :rtype: int <|skeleton|> class Solution: def numTeams(...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def numTeams(self, rating): """:type rating: List[int] :rtype: int""" <|body_0|> def numTeams(self, rating): """:type rating: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numTeams(self, rating): """:type rating: List[int] :rtype: int""" if len(rating) < 3: return 0 res = 0 for i in range(len(rating) - 2): for j in range(i + 1, len(rating) - 1): for k in range(j + 1, len(rating)): ...
the_stack_v2_python_sparse
1395_Count_Number_of_Teams.py
bingli8802/leetcode
train
0
5b5dffc8ad78d5d85b770d04227ac521029b698b
[ "api = python_otbr_api.OTBR(otbr_url, async_get_clientsession(self.hass), 10)\nif await api.get_active_dataset_tlvs() is None:\n allowed_channel = await get_allowed_channel(self.hass, otbr_url)\n thread_dataset_channel = None\n thread_dataset_tlv = await async_get_preferred_dataset(self.hass)\n if threa...
<|body_start_0|> api = python_otbr_api.OTBR(otbr_url, async_get_clientsession(self.hass), 10) if await api.get_active_dataset_tlvs() is None: allowed_channel = await get_allowed_channel(self.hass, otbr_url) thread_dataset_channel = None thread_dataset_tlv = await asyn...
Handle a config flow for Open Thread Border Router.
OTBRConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OTBRConfigFlow: """Handle a config flow for Open Thread Border Router.""" async def _connect_and_set_dataset(self, otbr_url: str) -> None: """Connect to the OTBR and create or apply a dataset if it doesn't have one.""" <|body_0|> async def async_step_user(self, user_inpu...
stack_v2_sparse_classes_10k_train_001867
6,444
permissive
[ { "docstring": "Connect to the OTBR and create or apply a dataset if it doesn't have one.", "name": "_connect_and_set_dataset", "signature": "async def _connect_and_set_dataset(self, otbr_url: str) -> None" }, { "docstring": "Set up by user.", "name": "async_step_user", "signature": "asy...
3
null
Implement the Python class `OTBRConfigFlow` described below. Class description: Handle a config flow for Open Thread Border Router. Method signatures and docstrings: - async def _connect_and_set_dataset(self, otbr_url: str) -> None: Connect to the OTBR and create or apply a dataset if it doesn't have one. - async def...
Implement the Python class `OTBRConfigFlow` described below. Class description: Handle a config flow for Open Thread Border Router. Method signatures and docstrings: - async def _connect_and_set_dataset(self, otbr_url: str) -> None: Connect to the OTBR and create or apply a dataset if it doesn't have one. - async def...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OTBRConfigFlow: """Handle a config flow for Open Thread Border Router.""" async def _connect_and_set_dataset(self, otbr_url: str) -> None: """Connect to the OTBR and create or apply a dataset if it doesn't have one.""" <|body_0|> async def async_step_user(self, user_inpu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OTBRConfigFlow: """Handle a config flow for Open Thread Border Router.""" async def _connect_and_set_dataset(self, otbr_url: str) -> None: """Connect to the OTBR and create or apply a dataset if it doesn't have one.""" api = python_otbr_api.OTBR(otbr_url, async_get_clientsession(self.hass...
the_stack_v2_python_sparse
homeassistant/components/otbr/config_flow.py
home-assistant/core
train
35,501
b73cfe03513586c7e61535f4ead89d8d2deae389
[ "def decorator(func):\n\n @api.expect((model, description))\n @api.response(ValidationError)\n @wraps(func)\n def wrapper(*args, **kwargs):\n payload = request.json\n try:\n schema = schema_override if schema_override else model.__schema__\n errors = process_config(co...
<|body_start_0|> def decorator(func): @api.expect((model, description)) @api.response(ValidationError) @wraps(func) def wrapper(*args, **kwargs): payload = request.json try: schema = schema_override if schema_ov...
Extends a flask restx :class:`flask_restx.Api` with: - methods to make using json schemas easier - methods to auto document and handle :class:`ApiError` responses
API
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class API: """Extends a flask restx :class:`flask_restx.Api` with: - methods to make using json schemas easier - methods to auto document and handle :class:`ApiError` responses""" def validate(self, model: Model, schema_override: Optional[Dict[str, List[Dict[str, str]]]]=None, description=None): ...
stack_v2_sparse_classes_10k_train_001868
15,675
permissive
[ { "docstring": "When a method is decorated with this, json data submitted to the endpoint will be validated with the given `model`. This also auto-documents the expected model, as well as the possible :class:`ValidationError` response.", "name": "validate", "signature": "def validate(self, model: Model,...
3
stack_v2_sparse_classes_30k_train_001224
Implement the Python class `API` described below. Class description: Extends a flask restx :class:`flask_restx.Api` with: - methods to make using json schemas easier - methods to auto document and handle :class:`ApiError` responses Method signatures and docstrings: - def validate(self, model: Model, schema_override: ...
Implement the Python class `API` described below. Class description: Extends a flask restx :class:`flask_restx.Api` with: - methods to make using json schemas easier - methods to auto document and handle :class:`ApiError` responses Method signatures and docstrings: - def validate(self, model: Model, schema_override: ...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class API: """Extends a flask restx :class:`flask_restx.Api` with: - methods to make using json schemas easier - methods to auto document and handle :class:`ApiError` responses""" def validate(self, model: Model, schema_override: Optional[Dict[str, List[Dict[str, str]]]]=None, description=None): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class API: """Extends a flask restx :class:`flask_restx.Api` with: - methods to make using json schemas easier - methods to auto document and handle :class:`ApiError` responses""" def validate(self, model: Model, schema_override: Optional[Dict[str, List[Dict[str, str]]]]=None, description=None): """Whe...
the_stack_v2_python_sparse
flexget/api/app.py
BrutuZ/Flexget
train
1
797ff33b719b1a72a4fa852e6dc2d80006447f78
[ "zh_login(self=self, driver=self.driver)\nself.driver.press_keycode(4)\nmylogger.info('返回home page')", "test_name = '地图上发送默认地点'\nmylogger.debug('%s start' % test_name)\nself.driver.implicitly_wait(10)\nmainChat_element(self.driver)\nfirst_chat_element(self.driver)\nmylogger.info('进入与第一个联系人交互界面')\nself.driver.impl...
<|body_start_0|> zh_login(self=self, driver=self.driver) self.driver.press_keycode(4) mylogger.info('返回home page') <|end_body_0|> <|body_start_1|> test_name = '地图上发送默认地点' mylogger.debug('%s start' % test_name) self.driver.implicitly_wait(10) mainChat_element(self...
Message_share
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message_share: def test1(self): """zh login""" <|body_0|> def test2_share_software(self): """message share software""" <|body_1|> def test3_send_file(self): """message share file""" <|body_2|> def test4_send_voice_1(self): ""...
stack_v2_sparse_classes_10k_train_001869
3,752
no_license
[ { "docstring": "zh login", "name": "test1", "signature": "def test1(self)" }, { "docstring": "message share software", "name": "test2_share_software", "signature": "def test2_share_software(self)" }, { "docstring": "message share file", "name": "test3_send_file", "signatu...
6
stack_v2_sparse_classes_30k_train_004024
Implement the Python class `Message_share` described below. Class description: Implement the Message_share class. Method signatures and docstrings: - def test1(self): zh login - def test2_share_software(self): message share software - def test3_send_file(self): message share file - def test4_send_voice_1(self): messa...
Implement the Python class `Message_share` described below. Class description: Implement the Message_share class. Method signatures and docstrings: - def test1(self): zh login - def test2_share_software(self): message share software - def test3_send_file(self): message share file - def test4_send_voice_1(self): messa...
5924b88c5bc2a41d62807cc665bb3a76dfe0f3d3
<|skeleton|> class Message_share: def test1(self): """zh login""" <|body_0|> def test2_share_software(self): """message share software""" <|body_1|> def test3_send_file(self): """message share file""" <|body_2|> def test4_send_voice_1(self): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Message_share: def test1(self): """zh login""" zh_login(self=self, driver=self.driver) self.driver.press_keycode(4) mylogger.info('返回home page') def test2_share_software(self): """message share software""" test_name = '地图上发送默认地点' mylogger.debug('%s ...
the_stack_v2_python_sparse
testsuite/test4_chat_share.py
Lkamanda/LT
train
2
f2371f15e53fb26d50b309fbd40a8b338781cf6b
[ "logger.info('Validationing FastQ file')\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)", "output_files_generated = {}\noutput_metadata = {}\nlogger.info('Generating validation report for FastQ file')\nfastqc_handle = fastqcTool()\nlogger.progress('FASTQC Validation',...
<|body_start_0|> logger.info('Validationing FastQ file') if configuration is None: configuration = {} self.configuration.update(configuration) <|end_body_0|> <|body_start_1|> output_files_generated = {} output_metadata = {} logger.info('Generating validation ...
Workflow to download and pre-index a given genome
process_fastqc
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class process_fastqc: """Workflow to download and pre-index a given genome""" def __init__(self, configuration=None): """Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specifi...
stack_v2_sparse_classes_10k_train_001870
4,873
permissive
[ { "docstring": "Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.", "name": "__init__", "signature": "def __init__(self, configuration=None)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_val_000008
Implement the Python class `process_fastqc` described below. Class description: Workflow to download and pre-index a given genome Method signatures and docstrings: - def __init__(self, configuration=None): Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define h...
Implement the Python class `process_fastqc` described below. Class description: Workflow to download and pre-index a given genome Method signatures and docstrings: - def __init__(self, configuration=None): Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define h...
50c7115c0c1a6af48dc34f275e469d1b9eb02999
<|skeleton|> class process_fastqc: """Workflow to download and pre-index a given genome""" def __init__(self, configuration=None): """Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specifi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class process_fastqc: """Workflow to download and pre-index a given genome""" def __init__(self, configuration=None): """Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Too...
the_stack_v2_python_sparse
process_fastqc.py
Multiscale-Genomics/mg-process-fastq
train
2
b665ffe3a4cb15944105358fda19bd84cd90dc33
[ "self.stop = stop\nself.route = route\nself.info = [{ATTR_DUE_AT: 'n/a', ATTR_ROUTE: self.route, ATTR_DUE_IN: 'n/a'}]", "params = {}\nparams['stopid'] = self.stop\nif self.route:\n params['routeid'] = self.route\nparams['maxresults'] = 2\nparams['format'] = 'json'\nresponse = requests.get(_RESOURCE, params, ti...
<|body_start_0|> self.stop = stop self.route = route self.info = [{ATTR_DUE_AT: 'n/a', ATTR_ROUTE: self.route, ATTR_DUE_IN: 'n/a'}] <|end_body_0|> <|body_start_1|> params = {} params['stopid'] = self.stop if self.route: params['routeid'] = self.route ...
The Class for handling the data retrieval.
PublicTransportData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicTransportData: """The Class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from opendata.ch.""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_10k_train_001871
5,470
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, stop, route)" }, { "docstring": "Get the latest data from opendata.ch.", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `PublicTransportData` described below. Class description: The Class for handling the data retrieval. Method signatures and docstrings: - def __init__(self, stop, route): Initialize the data object. - def update(self): Get the latest data from opendata.ch.
Implement the Python class `PublicTransportData` described below. Class description: The Class for handling the data retrieval. Method signatures and docstrings: - def __init__(self, stop, route): Initialize the data object. - def update(self): Get the latest data from opendata.ch. <|skeleton|> class PublicTransport...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PublicTransportData: """The Class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from opendata.ch.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PublicTransportData: """The Class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" self.stop = stop self.route = route self.info = [{ATTR_DUE_AT: 'n/a', ATTR_ROUTE: self.route, ATTR_DUE_IN: 'n/a'}] def update(self)...
the_stack_v2_python_sparse
homeassistant/components/dublin_bus_transport/sensor.py
home-assistant/core
train
35,501
0a84b4b2b81fc0a0568cbaae984cdb85159c8a34
[ "if attrs['password'] != attrs['password2']:\n raise serializers.ValidationError('两次密码不一致')\nallow = User.check_set_password_token(attrs['access_token'], self.context['view'].kwargs['pk'])\nif not allow:\n raise serializers.ValidationError('无效的access token')\nreturn attrs", "instance.set_password(validated_...
<|body_start_0|> if attrs['password'] != attrs['password2']: raise serializers.ValidationError('两次密码不一致') allow = User.check_set_password_token(attrs['access_token'], self.context['view'].kwargs['pk']) if not allow: raise serializers.ValidationError('无效的access token') ...
重置密码序列化器
CheckPasswordTokenSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckPasswordTokenSerializer: """重置密码序列化器""" def validate(self, attrs): """校验数据""" <|body_0|> def update(self, instance, validated_data): """更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_001872
19,382
no_license
[ { "docstring": "校验数据", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_004536
Implement the Python class `CheckPasswordTokenSerializer` described below. Class description: 重置密码序列化器 Method signatures and docstrings: - def validate(self, attrs): 校验数据 - def update(self, instance, validated_data): 更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:
Implement the Python class `CheckPasswordTokenSerializer` described below. Class description: 重置密码序列化器 Method signatures and docstrings: - def validate(self, attrs): 校验数据 - def update(self, instance, validated_data): 更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return: <|skeleton|> class C...
c4d9b124a50e96ce01dfd83073cbe4435cb07266
<|skeleton|> class CheckPasswordTokenSerializer: """重置密码序列化器""" def validate(self, attrs): """校验数据""" <|body_0|> def update(self, instance, validated_data): """更新密码 :param instance: 根据pk对应的User模型对象 :param validated_data: 验证完成以后的数据 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheckPasswordTokenSerializer: """重置密码序列化器""" def validate(self, attrs): """校验数据""" if attrs['password'] != attrs['password2']: raise serializers.ValidationError('两次密码不一致') allow = User.check_set_password_token(attrs['access_token'], self.context['view'].kwargs['pk']) ...
the_stack_v2_python_sparse
apps/users/serializer/serializers_front.py
wuhaihua1989/magic1
train
0
62ce2b5f4bd57ee67ad5ee567cdb4febfc4e029e
[ "self.name = brickname\nself.ops = []\nself.trainable_weights = []", "description = self.name + '\\n'\ndescription += '-' * len(self.name) + '\\n'\nfor op in self.ops:\n description += op.__str__() + '\\n'\nreturn description", "w = []\nfor op in self.ops:\n w += op.trainable_weights\nreturn w", "with t...
<|body_start_0|> self.name = brickname self.ops = [] self.trainable_weights = [] <|end_body_0|> <|body_start_1|> description = self.name + '\n' description += '-' * len(self.name) + '\n' for op in self.ops: description += op.__str__() + '\n' return de...
Neuralizer elementary brick.
Brick
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Brick: """Neuralizer elementary brick.""" def __init__(self, brickname): """Arguments: - brickname: a string to create the namescope of the brick.""" <|body_0|> def __str__(self): """Returns string representation of operations in the brick.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001873
6,948
no_license
[ { "docstring": "Arguments: - brickname: a string to create the namescope of the brick.", "name": "__init__", "signature": "def __init__(self, brickname)" }, { "docstring": "Returns string representation of operations in the brick.", "name": "__str__", "signature": "def __str__(self)" }...
4
stack_v2_sparse_classes_30k_train_004046
Implement the Python class `Brick` described below. Class description: Neuralizer elementary brick. Method signatures and docstrings: - def __init__(self, brickname): Arguments: - brickname: a string to create the namescope of the brick. - def __str__(self): Returns string representation of operations in the brick. -...
Implement the Python class `Brick` described below. Class description: Neuralizer elementary brick. Method signatures and docstrings: - def __init__(self, brickname): Arguments: - brickname: a string to create the namescope of the brick. - def __str__(self): Returns string representation of operations in the brick. -...
fc49204441ea2de3496b1781e88d87dd74d47bd3
<|skeleton|> class Brick: """Neuralizer elementary brick.""" def __init__(self, brickname): """Arguments: - brickname: a string to create the namescope of the brick.""" <|body_0|> def __str__(self): """Returns string representation of operations in the brick.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Brick: """Neuralizer elementary brick.""" def __init__(self, brickname): """Arguments: - brickname: a string to create the namescope of the brick.""" self.name = brickname self.ops = [] self.trainable_weights = [] def __str__(self): """Returns string represent...
the_stack_v2_python_sparse
neuralyzer/archi/bricks.py
ArnaudAbreu/neuralyzer
train
2
f3796b5ce9e7e3df872886bef92f085c57425ddc
[ "if self.action == 'retrieve':\n permission_classes = [IsAuthenticated]\nelse:\n permission_classes = [IsAdminUser]\nreturn [permission() for permission in permission_classes]", "if pk == 'i':\n return response.Response(UserSerializer(request.user, context={'request': request}).data)\nreturn super(UserVi...
<|body_start_0|> if self.action == 'retrieve': permission_classes = [IsAuthenticated] else: permission_classes = [IsAdminUser] return [permission() for permission in permission_classes] <|end_body_0|> <|body_start_1|> if pk == 'i': return response.Res...
UserViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserViewSet: def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def retrieve(self, request, pk=None): """este metodo serve para retornar informacoes do usuario logado e so retorna informacao se o id p...
stack_v2_sparse_classes_10k_train_001874
42,051
permissive
[ { "docstring": "Instantiates and returns the list of permissions that this view requires.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "este metodo serve para retornar informacoes do usuario logado e so retorna informacao se o id passado por 'i'", "...
2
stack_v2_sparse_classes_30k_train_006319
Implement the Python class `UserViewSet` described below. Class description: Implement the UserViewSet class. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def retrieve(self, request, pk=None): este metodo serve para retornar...
Implement the Python class `UserViewSet` described below. Class description: Implement the UserViewSet class. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def retrieve(self, request, pk=None): este metodo serve para retornar...
54c63d84c81cc3d2ca12485f932f12b46d0603e1
<|skeleton|> class UserViewSet: def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def retrieve(self, request, pk=None): """este metodo serve para retornar informacoes do usuario logado e so retorna informacao se o id p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserViewSet: def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" if self.action == 'retrieve': permission_classes = [IsAuthenticated] else: permission_classes = [IsAdminUser] return [permission() for...
the_stack_v2_python_sparse
core_admin/tno/views.py
linea-it/tno
train
1
bb91cbc762751f307b2ddc76f1a358afd5daa74d
[ "rset = ResultSet(names=('uuid', 'provider_id', 'av_zone', 'addresses'), types=(str, str, str, str))\nif not skip_store:\n if generic_filters or meta_filters:\n raise _errors.ConfigurationError(\"Filters are only supported when the 'skip_store' option is set.\")\n provider = _retrieve_provider(provider...
<|body_start_0|> rset = ResultSet(names=('uuid', 'provider_id', 'av_zone', 'addresses'), types=(str, str, str, str)) if not skip_store: if generic_filters or meta_filters: raise _errors.ConfigurationError("Filters are only supported when the 'skip_store' option is set.") ...
Return information on existing machine(s) created by a provider.
MachineLookup
[ "Apache-2.0", "LicenseRef-scancode-python-cwi", "LGPL-2.0-or-later", "BSD-3-Clause", "bzip2-1.0.6", "LicenseRef-scancode-free-unknown", "GPL-2.0-only", "LicenseRef-scancode-other-copyleft", "Sleepycat", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference", ...
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineLookup: """Return information on existing machine(s) created by a provider.""" def execute(self, provider_id, generic_filters=None, meta_filters=None, skip_store=False): """Return information on existing machine(s). :param provider_id: Provider's Id. :param generic_filters: Fi...
stack_v2_sparse_classes_10k_train_001875
19,734
permissive
[ { "docstring": "Return information on existing machine(s). :param provider_id: Provider's Id. :param generic_filters: Filter returned machines by some properites but metadata properties. :param meta_filters: Filter returned machines by metadata properties. :param skip_store: Proceed anyway if there is no inform...
2
stack_v2_sparse_classes_30k_train_005955
Implement the Python class `MachineLookup` described below. Class description: Return information on existing machine(s) created by a provider. Method signatures and docstrings: - def execute(self, provider_id, generic_filters=None, meta_filters=None, skip_store=False): Return information on existing machine(s). :par...
Implement the Python class `MachineLookup` described below. Class description: Return information on existing machine(s) created by a provider. Method signatures and docstrings: - def execute(self, provider_id, generic_filters=None, meta_filters=None, skip_store=False): Return information on existing machine(s). :par...
1e912fd87282be3b3bed48487e6beb0ecb1de339
<|skeleton|> class MachineLookup: """Return information on existing machine(s) created by a provider.""" def execute(self, provider_id, generic_filters=None, meta_filters=None, skip_store=False): """Return information on existing machine(s). :param provider_id: Provider's Id. :param generic_filters: Fi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MachineLookup: """Return information on existing machine(s) created by a provider.""" def execute(self, provider_id, generic_filters=None, meta_filters=None, skip_store=False): """Return information on existing machine(s). :param provider_id: Provider's Id. :param generic_filters: Filter returned...
the_stack_v2_python_sparse
mysql-utilities-1.6.0/mysql/fabric/services/machine.py
scavarda/mysql-dbcompare
train
2
b5d82ea0e76bed4a3ff1776d22f9d61046db1387
[ "@sync_performer\ndef succeed(dispatcher, intent):\n return intent\ndispatcher = lambda _: succeed\nresult = sync_perform(dispatcher, Effect('foo'))\nself.assertEqual(result, 'foo')", "@sync_performer\ndef fail(dispatcher, intent):\n raise intent\ndispatcher = lambda _: fail\nself.assertThat(sync_perform(di...
<|body_start_0|> @sync_performer def succeed(dispatcher, intent): return intent dispatcher = lambda _: succeed result = sync_perform(dispatcher, Effect('foo')) self.assertEqual(result, 'foo') <|end_body_0|> <|body_start_1|> @sync_performer def fail(di...
Tests for :func:`sync_performer`.
SyncPerformerTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncPerformerTests: """Tests for :func:`sync_performer`.""" def test_success(self): """Return value of the performer becomes the result of the Effect.""" <|body_0|> def test_failure(self): """Errors are caught and cause the effect to fail with the exception info....
stack_v2_sparse_classes_10k_train_001876
4,009
permissive
[ { "docstring": "Return value of the performer becomes the result of the Effect.", "name": "test_success", "signature": "def test_success(self)" }, { "docstring": "Errors are caught and cause the effect to fail with the exception info.", "name": "test_failure", "signature": "def test_fail...
6
stack_v2_sparse_classes_30k_train_005079
Implement the Python class `SyncPerformerTests` described below. Class description: Tests for :func:`sync_performer`. Method signatures and docstrings: - def test_success(self): Return value of the performer becomes the result of the Effect. - def test_failure(self): Errors are caught and cause the effect to fail wit...
Implement the Python class `SyncPerformerTests` described below. Class description: Tests for :func:`sync_performer`. Method signatures and docstrings: - def test_success(self): Return value of the performer becomes the result of the Effect. - def test_failure(self): Errors are caught and cause the effect to fail wit...
cd21859ad2babebcbf12fa372aef34b9cd25a10e
<|skeleton|> class SyncPerformerTests: """Tests for :func:`sync_performer`.""" def test_success(self): """Return value of the performer becomes the result of the Effect.""" <|body_0|> def test_failure(self): """Errors are caught and cause the effect to fail with the exception info....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SyncPerformerTests: """Tests for :func:`sync_performer`.""" def test_success(self): """Return value of the performer becomes the result of the Effect.""" @sync_performer def succeed(dispatcher, intent): return intent dispatcher = lambda _: succeed resul...
the_stack_v2_python_sparse
effect/test_sync.py
python-effect/effect
train
289
bcd179fedb8ea25f61981434b181ab2728a44edc
[ "super().__init__(*args, **kwargs)\nself.author = author\nself.instance.startup = startup", "if not self.author.is_anonymous:\n self.instance.author = self.author\nelse:\n raise ValidationError('Sign in to post comments.')\nsuper().clean()" ]
<|body_start_0|> super().__init__(*args, **kwargs) self.author = author self.instance.startup = startup <|end_body_0|> <|body_start_1|> if not self.author.is_anonymous: self.instance.author = self.author else: raise ValidationError('Sign in to post commen...
Form to add new comment.
CommentForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentForm: """Form to add new comment.""" def __init__(self, author, startup, *args, **kwargs): """Set fields using parameters from view.""" <|body_0|> def clean(self): """Raise validation error if anonymous user try to post comment.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k_train_001877
796
no_license
[ { "docstring": "Set fields using parameters from view.", "name": "__init__", "signature": "def __init__(self, author, startup, *args, **kwargs)" }, { "docstring": "Raise validation error if anonymous user try to post comment.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_006863
Implement the Python class `CommentForm` described below. Class description: Form to add new comment. Method signatures and docstrings: - def __init__(self, author, startup, *args, **kwargs): Set fields using parameters from view. - def clean(self): Raise validation error if anonymous user try to post comment.
Implement the Python class `CommentForm` described below. Class description: Form to add new comment. Method signatures and docstrings: - def __init__(self, author, startup, *args, **kwargs): Set fields using parameters from view. - def clean(self): Raise validation error if anonymous user try to post comment. <|ske...
0879ade24685b628624dce06698f8a0afd042000
<|skeleton|> class CommentForm: """Form to add new comment.""" def __init__(self, author, startup, *args, **kwargs): """Set fields using parameters from view.""" <|body_0|> def clean(self): """Raise validation error if anonymous user try to post comment.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommentForm: """Form to add new comment.""" def __init__(self, author, startup, *args, **kwargs): """Set fields using parameters from view.""" super().__init__(*args, **kwargs) self.author = author self.instance.startup = startup def clean(self): """Raise vali...
the_stack_v2_python_sparse
camp-python-2021-cofounders-finder-develop/apps/comments/forms.py
rhanmar/oi_projects_summer_2021
train
0
f6c57e30a470dbffce4d734f9d22a6ac9e7a5305
[ "self.kids = [{}]\nself.root = 0\nself.vocabular = set([])", "flag = key in self.vocabular\ncurr = self.root\nself.vocabular.add(key)\nif flag:\n for ch in key:\n index = self.kids[curr][ch][1]\n self.kids[curr][ch] = [val, index]\n curr = index\nelse:\n curr = self.root\n for ch in ...
<|body_start_0|> self.kids = [{}] self.root = 0 self.vocabular = set([]) <|end_body_0|> <|body_start_1|> flag = key in self.vocabular curr = self.root self.vocabular.add(key) if flag: for ch in key: index = self.kids[curr][ch][1] ...
MapSum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapSum: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, key, val): """:type key: str :type val: int :rtype: void""" <|body_1|> def sum(self, prefix): """:type prefix: str :rtype: int""" <|body_2|...
stack_v2_sparse_classes_10k_train_001878
1,449
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type key: str :type val: int :rtype: void", "name": "insert", "signature": "def insert(self, key, val)" }, { "docstring": ":type prefix: str :rtype: in...
3
stack_v2_sparse_classes_30k_train_003815
Implement the Python class `MapSum` described below. Class description: Implement the MapSum class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, key, val): :type key: str :type val: int :rtype: void - def sum(self, prefix): :type prefix: str :rtype: i...
Implement the Python class `MapSum` described below. Class description: Implement the MapSum class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, key, val): :type key: str :type val: int :rtype: void - def sum(self, prefix): :type prefix: str :rtype: i...
c1b083733543e05b9f1e86ddcea1b4c6d0330aaa
<|skeleton|> class MapSum: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, key, val): """:type key: str :type val: int :rtype: void""" <|body_1|> def sum(self, prefix): """:type prefix: str :rtype: int""" <|body_2|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MapSum: def __init__(self): """Initialize your data structure here.""" self.kids = [{}] self.root = 0 self.vocabular = set([]) def insert(self, key, val): """:type key: str :type val: int :rtype: void""" flag = key in self.vocabular curr = self.root...
the_stack_v2_python_sparse
solved/P677.py
lgdxiaobobo/Leetcoce
train
0
9aa5098c2c2343f309200f5ab9c701ace3aec329
[ "self.phase_diagram = phase_diagram\nself.mpcontribs = mpcontribs\nself.missing_compositions = missing_compositions\nself.query = query\nself.kwargs = kwargs\nself.phase_diagram.key = 'phase_diagram_id'\nself.missing_compositions.key = 'chemical_system'\nsuper().__init__(sources=[phase_diagram, mpcontribs], targets...
<|body_start_0|> self.phase_diagram = phase_diagram self.mpcontribs = mpcontribs self.missing_compositions = missing_compositions self.query = query self.kwargs = kwargs self.phase_diagram.key = 'phase_diagram_id' self.missing_compositions.key = 'chemical_system' ...
Builder that finds compositions not found in the Materials Project for each chemical system. Based on the Text Mining project in MPContribs.
MissingCompositionsBuilder
[ "LicenseRef-scancode-hdf5", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MissingCompositionsBuilder: """Builder that finds compositions not found in the Materials Project for each chemical system. Based on the Text Mining project in MPContribs.""" def __init__(self, phase_diagram: S3Store, mpcontribs: MongoURIStore, missing_compositions: MongoStore, query: Option...
stack_v2_sparse_classes_10k_train_001879
8,663
permissive
[ { "docstring": "Arguments: phase_diagram: source store for chemsys data matsholar_store: source store for matscholar data missing_compositions: Target store to save the missing compositions query: dictionary to query the phase diagram store **kwargs: Additional keyword arguments", "name": "__init__", "s...
6
stack_v2_sparse_classes_30k_train_003772
Implement the Python class `MissingCompositionsBuilder` described below. Class description: Builder that finds compositions not found in the Materials Project for each chemical system. Based on the Text Mining project in MPContribs. Method signatures and docstrings: - def __init__(self, phase_diagram: S3Store, mpcont...
Implement the Python class `MissingCompositionsBuilder` described below. Class description: Builder that finds compositions not found in the Materials Project for each chemical system. Based on the Text Mining project in MPContribs. Method signatures and docstrings: - def __init__(self, phase_diagram: S3Store, mpcont...
90e121d5cf1b6b57a33233c927e1044c59354bc5
<|skeleton|> class MissingCompositionsBuilder: """Builder that finds compositions not found in the Materials Project for each chemical system. Based on the Text Mining project in MPContribs.""" def __init__(self, phase_diagram: S3Store, mpcontribs: MongoURIStore, missing_compositions: MongoStore, query: Option...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MissingCompositionsBuilder: """Builder that finds compositions not found in the Materials Project for each chemical system. Based on the Text Mining project in MPContribs.""" def __init__(self, phase_diagram: S3Store, mpcontribs: MongoURIStore, missing_compositions: MongoStore, query: Optional[Dict]=None...
the_stack_v2_python_sparse
emmet-builders/emmet/builders/matscholar/missing_compositions.py
materialsproject/emmet
train
37
69afe462d9997aa28ce30701029fcd2af5069468
[ "if not grid or not grid[0]:\n return 0\nrows = len(grid)\ncols = len(grid[0])\nres = 0\nfor row in xrange(rows):\n for col in xrange(cols):\n if grid[row][col] == '1':\n res += 1\n queue = [(row, col)]\n while queue:\n r, c = queue.pop(0)\n ...
<|body_start_0|> if not grid or not grid[0]: return 0 rows = len(grid) cols = len(grid[0]) res = 0 for row in xrange(rows): for col in xrange(cols): if grid[row][col] == '1': res += 1 queue = [(row, c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_0|> def numIslands2(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not grid or not grid[0]: ...
stack_v2_sparse_classes_10k_train_001880
2,357
no_license
[ { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslands", "signature": "def numIslands(self, grid)" }, { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslands2", "signature": "def numIslands2(self, grid)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int - def numIslands2(self, grid): :type grid: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int - def numIslands2(self, grid): :type grid: List[List[str]] :rtype: int <|skeleton|> class Solution: def ...
dbdb227e12f329e4ca064b338f1fbdca42f3a848
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_0|> def numIslands2(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" if not grid or not grid[0]: return 0 rows = len(grid) cols = len(grid[0]) res = 0 for row in xrange(rows): for col in xrange(cols): if gri...
the_stack_v2_python_sparse
LC200.py
Qiao-Liang/LeetCode
train
0
9131dd94f7147d2ae5c0456635c85662bb7b7b73
[ "self._domain = domain\nself._title = title\nself._description_placeholder = description_placeholder\nself._allow_multiple = allow_multiple", "if not self._allow_multiple and self._async_current_entries():\n return self.async_abort(reason='single_instance_allowed')\nif user_input is None:\n return self.asyn...
<|body_start_0|> self._domain = domain self._title = title self._description_placeholder = description_placeholder self._allow_multiple = allow_multiple <|end_body_0|> <|body_start_1|> if not self._allow_multiple and self._async_current_entries(): return self.async_a...
Handle a webhook config flow.
WebhookFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebhookFlowHandler: """Handle a webhook config flow.""" def __init__(self, domain: str, title: str, description_placeholder: dict, allow_multiple: bool) -> None: """Initialize the discovery config flow.""" <|body_0|> async def async_step_user(self, user_input: dict[str, ...
stack_v2_sparse_classes_10k_train_001881
9,319
permissive
[ { "docstring": "Initialize the discovery config flow.", "name": "__init__", "signature": "def __init__(self, domain: str, title: str, description_placeholder: dict, allow_multiple: bool) -> None" }, { "docstring": "Handle a user initiated set up flow to create a webhook.", "name": "async_ste...
2
null
Implement the Python class `WebhookFlowHandler` described below. Class description: Handle a webhook config flow. Method signatures and docstrings: - def __init__(self, domain: str, title: str, description_placeholder: dict, allow_multiple: bool) -> None: Initialize the discovery config flow. - async def async_step_u...
Implement the Python class `WebhookFlowHandler` described below. Class description: Handle a webhook config flow. Method signatures and docstrings: - def __init__(self, domain: str, title: str, description_placeholder: dict, allow_multiple: bool) -> None: Initialize the discovery config flow. - async def async_step_u...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class WebhookFlowHandler: """Handle a webhook config flow.""" def __init__(self, domain: str, title: str, description_placeholder: dict, allow_multiple: bool) -> None: """Initialize the discovery config flow.""" <|body_0|> async def async_step_user(self, user_input: dict[str, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WebhookFlowHandler: """Handle a webhook config flow.""" def __init__(self, domain: str, title: str, description_placeholder: dict, allow_multiple: bool) -> None: """Initialize the discovery config flow.""" self._domain = domain self._title = title self._description_placeho...
the_stack_v2_python_sparse
homeassistant/helpers/config_entry_flow.py
home-assistant/core
train
35,501
db670d2e7a76904bab5e226b1e3e4e92db484354
[ "self.X = X\nself.U_int = U[0]\nself.U_ext = U[1]\nself.P = P if P is not None else uc.UncertaintySet()", "u_max = self.U_ext.V[np.argmax([la.norm(u) for u in self.U_ext.V])]\nx_max = self.X.V[np.argmax([la.norm(x) for x in self.X.V])]\nR = np.eye(0)\nr = np.array([])\nj = 0\nfor i in range(len(self.P.sets)):\n ...
<|body_start_0|> self.X = X self.U_int = U[0] self.U_ext = U[1] self.P = P if P is not None else uc.UncertaintySet() <|end_body_0|> <|body_start_1|> u_max = self.U_ext.V[np.argmax([la.norm(u) for u in self.U_ext.V])] x_max = self.X.V[np.argmax([la.norm(x) for x in self.X...
Control problem specifications.
Specifications
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Specifications: """Control problem specifications.""" def __init__(self, X, U, P=None): """Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\in U_ext \\setminus U_int. Both U_int and U_ext are ass...
stack_v2_sparse_classes_10k_train_001882
2,232
no_license
[ { "docstring": "Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\\\in U_ext \\\\setminus U_int. Both U_int and U_ext are assumed to be Polytope type. P : UncertaintySet, optional Set of uncertainties. If ommitted, an empty ...
2
stack_v2_sparse_classes_30k_val_000067
Implement the Python class `Specifications` described below. Class description: Control problem specifications. Method signatures and docstrings: - def __init__(self, X, U, P=None): Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are ...
Implement the Python class `Specifications` described below. Class description: Control problem specifications. Method signatures and docstrings: - def __init__(self, X, U, P=None): Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are ...
858f2b673bedbec39fca9bdc9c825a3c2fefe513
<|skeleton|> class Specifications: """Control problem specifications.""" def __init__(self, X, U, P=None): """Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\in U_ext \\setminus U_int. Both U_int and U_ext are ass...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Specifications: """Control problem specifications.""" def __init__(self, X, U, P=None): """Parameters ---------- X : Polytope Set of allowed states. U : tuple of Polytope Tuple (U_int,U_ext) such that the admissible inputs are \\in U_ext \\setminus U_int. Both U_int and U_ext are assumed to be Po...
the_stack_v2_python_sparse
lib/specifications.py
roguextech/DanyloMalyuta-explicit_hybrid_mpc
train
0
128089cc38cf0a59d8634b10e2ec91922dccebca
[ "super().__init__()\nassert len(weights) == 2, f'Only 2 weight elements are required for BCE-Dice loss combo, found: {len(weights)}'\nself.weights = weights\nself.bce_with_logits = nn.BCEWithLogitsLoss()\nself.dice_loss = BinaryDiceLoss(apply_sigmoid=True)", "bce_loss = self.bce_with_logits(detail_out, detail_tar...
<|body_start_0|> super().__init__() assert len(weights) == 2, f'Only 2 weight elements are required for BCE-Dice loss combo, found: {len(weights)}' self.weights = weights self.bce_with_logits = nn.BCEWithLogitsLoss() self.dice_loss = BinaryDiceLoss(apply_sigmoid=True) <|end_body_...
STDC DetailLoss applied on details features from higher resolution and ground-truth details map. Loss combination of BCE loss and BinaryDice loss
DetailLoss
[ "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetailLoss: """STDC DetailLoss applied on details features from higher resolution and ground-truth details map. Loss combination of BCE loss and BinaryDice loss""" def __init__(self, weights: list=[1.0, 1.0]): """:param weights: weight to apply for each part of the loss contributions...
stack_v2_sparse_classes_10k_train_001883
9,721
permissive
[ { "docstring": ":param weights: weight to apply for each part of the loss contributions, [BCE, Dice] respectively.", "name": "__init__", "signature": "def __init__(self, weights: list=[1.0, 1.0])" }, { "docstring": ":param detail_out: predicted detail map. :param detail_target: ground-truth deta...
2
null
Implement the Python class `DetailLoss` described below. Class description: STDC DetailLoss applied on details features from higher resolution and ground-truth details map. Loss combination of BCE loss and BinaryDice loss Method signatures and docstrings: - def __init__(self, weights: list=[1.0, 1.0]): :param weights...
Implement the Python class `DetailLoss` described below. Class description: STDC DetailLoss applied on details features from higher resolution and ground-truth details map. Loss combination of BCE loss and BinaryDice loss Method signatures and docstrings: - def __init__(self, weights: list=[1.0, 1.0]): :param weights...
7240726cf6425b53a26ed2faec03672f30fee6be
<|skeleton|> class DetailLoss: """STDC DetailLoss applied on details features from higher resolution and ground-truth details map. Loss combination of BCE loss and BinaryDice loss""" def __init__(self, weights: list=[1.0, 1.0]): """:param weights: weight to apply for each part of the loss contributions...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DetailLoss: """STDC DetailLoss applied on details features from higher resolution and ground-truth details map. Loss combination of BCE loss and BinaryDice loss""" def __init__(self, weights: list=[1.0, 1.0]): """:param weights: weight to apply for each part of the loss contributions, [BCE, Dice]...
the_stack_v2_python_sparse
src/super_gradients/training/losses/stdc_loss.py
Deci-AI/super-gradients
train
3,237
546293c0e1c5c4cad1fdb179d54019c5dfc89714
[ "self.filename = filename\nself.subclass = subclass\nself.allow_mmap = allow_mmap", "filename = os.path.join(unpickler._dirname, self.filename)\nnp_ver = [int(x) for x in unpickler.np.__version__.split('.', 2)[:2]]\nallow_mmap = getattr(self, 'allow_mmap', True)\nmemmap_kwargs = {} if not allow_mmap else {'mmap_m...
<|body_start_0|> self.filename = filename self.subclass = subclass self.allow_mmap = allow_mmap <|end_body_0|> <|body_start_1|> filename = os.path.join(unpickler._dirname, self.filename) np_ver = [int(x) for x in unpickler.np.__version__.split('.', 2)[:2]] allow_mmap = g...
An object to be persisted instead of numpy arrays. The only thing this object does, is to carry the filename in which the array has been persisted, and the array subclass.
NDArrayWrapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NDArrayWrapper: """An object to be persisted instead of numpy arrays. The only thing this object does, is to carry the filename in which the array has been persisted, and the array subclass.""" def __init__(self, filename, subclass, allow_mmap=True): """Store the useful information f...
stack_v2_sparse_classes_10k_train_001884
17,419
permissive
[ { "docstring": "Store the useful information for later", "name": "__init__", "signature": "def __init__(self, filename, subclass, allow_mmap=True)" }, { "docstring": "Reconstruct the array", "name": "read", "signature": "def read(self, unpickler)" } ]
2
stack_v2_sparse_classes_30k_train_001866
Implement the Python class `NDArrayWrapper` described below. Class description: An object to be persisted instead of numpy arrays. The only thing this object does, is to carry the filename in which the array has been persisted, and the array subclass. Method signatures and docstrings: - def __init__(self, filename, s...
Implement the Python class `NDArrayWrapper` described below. Class description: An object to be persisted instead of numpy arrays. The only thing this object does, is to carry the filename in which the array has been persisted, and the array subclass. Method signatures and docstrings: - def __init__(self, filename, s...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class NDArrayWrapper: """An object to be persisted instead of numpy arrays. The only thing this object does, is to carry the filename in which the array has been persisted, and the array subclass.""" def __init__(self, filename, subclass, allow_mmap=True): """Store the useful information f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NDArrayWrapper: """An object to be persisted instead of numpy arrays. The only thing this object does, is to carry the filename in which the array has been persisted, and the array subclass.""" def __init__(self, filename, subclass, allow_mmap=True): """Store the useful information for later""" ...
the_stack_v2_python_sparse
Sklearn_scipy_numpy/source/sklearn/externals/joblib/numpy_pickle.py
ryfeus/lambda-packs
train
1,283
f012624da3d3c51b57055a66c85e430f80f9bb90
[ "self._entry_id = entry_id\nself._device_id = device_id\nself.sonarr = sonarr", "if self._device_id is None:\n return None\nreturn {ATTR_IDENTIFIERS: {(DOMAIN, self._device_id)}, ATTR_NAME: 'Activity Sensor', ATTR_MANUFACTURER: 'Sonarr', ATTR_SOFTWARE_VERSION: self.sonarr.app.info.version, 'entry_type': 'servi...
<|body_start_0|> self._entry_id = entry_id self._device_id = device_id self.sonarr = sonarr <|end_body_0|> <|body_start_1|> if self._device_id is None: return None return {ATTR_IDENTIFIERS: {(DOMAIN, self._device_id)}, ATTR_NAME: 'Activity Sensor', ATTR_MANUFACTURER:...
Defines a base Sonarr entity.
SonarrEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SonarrEntity: """Defines a base Sonarr entity.""" def __init__(self, *, sonarr: Sonarr, entry_id: str, device_id: str) -> None: """Initialize the Sonarr entity.""" <|body_0|> def device_info(self) -> DeviceInfo | None: """Return device information about the appli...
stack_v2_sparse_classes_10k_train_001885
1,083
permissive
[ { "docstring": "Initialize the Sonarr entity.", "name": "__init__", "signature": "def __init__(self, *, sonarr: Sonarr, entry_id: str, device_id: str) -> None" }, { "docstring": "Return device information about the application.", "name": "device_info", "signature": "def device_info(self)...
2
null
Implement the Python class `SonarrEntity` described below. Class description: Defines a base Sonarr entity. Method signatures and docstrings: - def __init__(self, *, sonarr: Sonarr, entry_id: str, device_id: str) -> None: Initialize the Sonarr entity. - def device_info(self) -> DeviceInfo | None: Return device inform...
Implement the Python class `SonarrEntity` described below. Class description: Defines a base Sonarr entity. Method signatures and docstrings: - def __init__(self, *, sonarr: Sonarr, entry_id: str, device_id: str) -> None: Initialize the Sonarr entity. - def device_info(self) -> DeviceInfo | None: Return device inform...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SonarrEntity: """Defines a base Sonarr entity.""" def __init__(self, *, sonarr: Sonarr, entry_id: str, device_id: str) -> None: """Initialize the Sonarr entity.""" <|body_0|> def device_info(self) -> DeviceInfo | None: """Return device information about the appli...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SonarrEntity: """Defines a base Sonarr entity.""" def __init__(self, *, sonarr: Sonarr, entry_id: str, device_id: str) -> None: """Initialize the Sonarr entity.""" self._entry_id = entry_id self._device_id = device_id self.sonarr = sonarr def device_info(self) -> Devi...
the_stack_v2_python_sparse
homeassistant/components/sonarr/entity.py
BenWoodford/home-assistant
train
11
731459b199e2c2390cab8894330e0f288dcdc830
[ "self.hashtable = collections.defaultdict()\nself.size = capacity\nself.dlist = DlinkedList()", "if key in self.hashtable:\n n = self.hashtable.get(key)\n self.dlist.removeNode(n)\n self.dlist.addNode(n)\n return n.val\nelse:\n return -1", "if key in self.hashtable:\n n = self.hashtable.get(ke...
<|body_start_0|> self.hashtable = collections.defaultdict() self.size = capacity self.dlist = DlinkedList() <|end_body_0|> <|body_start_1|> if key in self.hashtable: n = self.hashtable.get(key) self.dlist.removeNode(n) self.dlist.addNode(n) ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_10k_train_001886
3,021
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
e278ae6ded32f6a2d054ae11ad8fcc45e7bd0f86
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.hashtable = collections.defaultdict() self.size = capacity self.dlist = DlinkedList() def get(self, key): """:type key: int :rtype: int""" if key in self.hashtable: n = self....
the_stack_v2_python_sparse
146. LRU Cache.py
NiuNiu-jupiter/Leetcode
train
0
62da1c75cfc3b08a5c306e4bee070e1e3de30cf2
[ "self.foodIndex = 0\nself.snake = collections.deque()\nself.snake.append((0, 0))\nself.body = {(0, 0)}\nself.foods = food\nself.width = width\nself.height = height\nself.moves = {'U': (0, -1), 'L': (-1, 0), 'R': (1, 0), 'D': (0, 1)}", "tail = self.snake.popleft()\nself.body.remove(tail)\nif not self.snake:\n h...
<|body_start_0|> self.foodIndex = 0 self.snake = collections.deque() self.snake.append((0, 0)) self.body = {(0, 0)} self.foods = food self.width = width self.height = height self.moves = {'U': (0, -1), 'L': (-1, 0), 'R': (1, 0), 'D': (0, 1)} <|end_body_0|>...
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_10k_train_001887
15,245
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...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|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_10k
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
leetcode_python/Design/design-snake-game.py
yennanliu/CS_basics
train
64
18351b102250c725708807d91ec94f88fba7a31f
[ "from collections import Counter\ncounter = Counter(s)\nodd = 0\nfor value in counter.values():\n if value % 2 == 1:\n odd += 1\n if odd > 1:\n return False\nreturn True", "cur = []\nfor char in s:\n if char in cur:\n cur.remove(char)\n else:\n cur.append(char)\nreturn len(...
<|body_start_0|> from collections import Counter counter = Counter(s) odd = 0 for value in counter.values(): if value % 2 == 1: odd += 1 if odd > 1: return False return True <|end_body_0|> <|body_start_1|> cur = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPermutePalindrome(self, s: str) -> bool: """借助hashmap数据结构""" <|body_0|> def canPermutePalindrome_2(self, s: str) -> bool: """借助数组""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collections import Counter counter = Coun...
stack_v2_sparse_classes_10k_train_001888
1,670
no_license
[ { "docstring": "借助hashmap数据结构", "name": "canPermutePalindrome", "signature": "def canPermutePalindrome(self, s: str) -> bool" }, { "docstring": "借助数组", "name": "canPermutePalindrome_2", "signature": "def canPermutePalindrome_2(self, s: str) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_001601
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPermutePalindrome(self, s: str) -> bool: 借助hashmap数据结构 - def canPermutePalindrome_2(self, s: str) -> bool: 借助数组
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPermutePalindrome(self, s: str) -> bool: 借助hashmap数据结构 - def canPermutePalindrome_2(self, s: str) -> bool: 借助数组 <|skeleton|> class Solution: def canPermutePalindrome...
13e7ec9fe7a92ab13b247bd4edeb1ada5de81a08
<|skeleton|> class Solution: def canPermutePalindrome(self, s: str) -> bool: """借助hashmap数据结构""" <|body_0|> def canPermutePalindrome_2(self, s: str) -> bool: """借助数组""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canPermutePalindrome(self, s: str) -> bool: """借助hashmap数据结构""" from collections import Counter counter = Counter(s) odd = 0 for value in counter.values(): if value % 2 == 1: odd += 1 if odd > 1: retu...
the_stack_v2_python_sparse
Interview/01_04.py
lirui-ML/my_leetcode
train
1
e027a9183c2c149dd94aeeaa48900e5a483960bd
[ "super().__init__()\nself._feature_dim = config[0]\nself._hidden_dim = config[1]\nself._output_dim = config[2]\nself._layer_count = config[3]\nself._layers = nn.ModuleList([])\nfor i in range(self._layer_count):\n layer = None\n if i == 0:\n layer = Stochastic_FC(self._feature_dim, self._hidden_dim)\n ...
<|body_start_0|> super().__init__() self._feature_dim = config[0] self._hidden_dim = config[1] self._output_dim = config[2] self._layer_count = config[3] self._layers = nn.ModuleList([]) for i in range(self._layer_count): layer = None if i ...
Deterministic_Conv_Encoder
Stochastic_FC_Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stochastic_FC_Encoder: """Deterministic_Conv_Encoder""" def __init__(self, config): """NP""" <|body_0|> def forward(self, inputs): """Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_001889
18,202
no_license
[ { "docstring": "NP", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :", "name": "forward", "signature": "def forward(self, inputs)" } ]
2
stack_v2_sparse_classes_30k_test_000297
Implement the Python class `Stochastic_FC_Encoder` described below. Class description: Deterministic_Conv_Encoder Method signatures and docstrings: - def __init__(self, config): NP - def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :
Implement the Python class `Stochastic_FC_Encoder` described below. Class description: Deterministic_Conv_Encoder Method signatures and docstrings: - def __init__(self, config): NP - def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output : <|skeleton|> class Stochasti...
c7e1bfb49ebaec6937ed7b186689227f95a43e0f
<|skeleton|> class Stochastic_FC_Encoder: """Deterministic_Conv_Encoder""" def __init__(self, config): """NP""" <|body_0|> def forward(self, inputs): """Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Stochastic_FC_Encoder: """Deterministic_Conv_Encoder""" def __init__(self, config): """NP""" super().__init__() self._feature_dim = config[0] self._hidden_dim = config[1] self._output_dim = config[2] self._layer_count = config[3] self._layers = nn.M...
the_stack_v2_python_sparse
model/MAML/Part/encoder.py
MingyuKim87/MLwM
train
0
1cc63622bf211cd68929c7d9fe26c52de86e52f5
[ "try:\n this_record = ProfileImages.objects.get(pk=self.pk)\n if this_record.image != self.image:\n this_record.image.delete(save=False)\n this_record.image_thumb.delete(save=False)\nexcept:\n pass\nself.create_thumbnail(width=300, height=300, from_img=self.image, to_img=self.image_thumb)\nfo...
<|body_start_0|> try: this_record = ProfileImages.objects.get(pk=self.pk) if this_record.image != self.image: this_record.image.delete(save=False) this_record.image_thumb.delete(save=False) except: pass self.create_thumbnail(wid...
Изображения пользователя
ProfileImages
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileImages: """Изображения пользователя""" def save(self, *args, **kwargs): """Сохранение фото""" <|body_0|> def delete(self, *args, **kwargs): """Удаление фото""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: this_record = Pr...
stack_v2_sparse_classes_10k_train_001890
6,955
no_license
[ { "docstring": "Сохранение фото", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "Удаление фото", "name": "delete", "signature": "def delete(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_005292
Implement the Python class `ProfileImages` described below. Class description: Изображения пользователя Method signatures and docstrings: - def save(self, *args, **kwargs): Сохранение фото - def delete(self, *args, **kwargs): Удаление фото
Implement the Python class `ProfileImages` described below. Class description: Изображения пользователя Method signatures and docstrings: - def save(self, *args, **kwargs): Сохранение фото - def delete(self, *args, **kwargs): Удаление фото <|skeleton|> class ProfileImages: """Изображения пользователя""" def...
23b9102913b67f2e5fdc92c7ef1e85fa52492834
<|skeleton|> class ProfileImages: """Изображения пользователя""" def save(self, *args, **kwargs): """Сохранение фото""" <|body_0|> def delete(self, *args, **kwargs): """Удаление фото""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProfileImages: """Изображения пользователя""" def save(self, *args, **kwargs): """Сохранение фото""" try: this_record = ProfileImages.objects.get(pk=self.pk) if this_record.image != self.image: this_record.image.delete(save=False) th...
the_stack_v2_python_sparse
pages/userprofile/models.py
snakent/faunamira
train
0
2ae0e3ed21a64fbd0800600ab74e85a7735b2cbb
[ "self.cassandra_additional_params = cassandra_additional_params\nself.cassandra_connect_params = cassandra_connect_params\nself.couchbase_connect_params = couchbase_connect_params\nself.hbase_connect_params = hbase_connect_params\nself.hdfs_connect_params = hdfs_connect_params\nself.hive_connect_params = hive_conne...
<|body_start_0|> self.cassandra_additional_params = cassandra_additional_params self.cassandra_connect_params = cassandra_connect_params self.couchbase_connect_params = couchbase_connect_params self.hbase_connect_params = hbase_connect_params self.hdfs_connect_params = hdfs_conne...
Implementation of the 'NoSqlConnectParams' model. TODO: type description here. Attributes: cassandra_additional_params (CassandraAdditionalParams): Additional params required for cassandra backup. cassandra_connect_params (CassandraConnectParams): Connect params for connecting to cassandra cluster. Set only if env_type...
NoSqlConnectParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoSqlConnectParams: """Implementation of the 'NoSqlConnectParams' model. TODO: type description here. Attributes: cassandra_additional_params (CassandraAdditionalParams): Additional params required for cassandra backup. cassandra_connect_params (CassandraConnectParams): Connect params for connect...
stack_v2_sparse_classes_10k_train_001891
6,130
permissive
[ { "docstring": "Constructor for the NoSqlConnectParams class", "name": "__init__", "signature": "def __init__(self, cassandra_additional_params=None, cassandra_connect_params=None, couchbase_connect_params=None, hbase_connect_params=None, hdfs_connect_params=None, hive_connect_params=None, mongodb_addit...
2
null
Implement the Python class `NoSqlConnectParams` described below. Class description: Implementation of the 'NoSqlConnectParams' model. TODO: type description here. Attributes: cassandra_additional_params (CassandraAdditionalParams): Additional params required for cassandra backup. cassandra_connect_params (CassandraCon...
Implement the Python class `NoSqlConnectParams` described below. Class description: Implementation of the 'NoSqlConnectParams' model. TODO: type description here. Attributes: cassandra_additional_params (CassandraAdditionalParams): Additional params required for cassandra backup. cassandra_connect_params (CassandraCon...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NoSqlConnectParams: """Implementation of the 'NoSqlConnectParams' model. TODO: type description here. Attributes: cassandra_additional_params (CassandraAdditionalParams): Additional params required for cassandra backup. cassandra_connect_params (CassandraConnectParams): Connect params for connect...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NoSqlConnectParams: """Implementation of the 'NoSqlConnectParams' model. TODO: type description here. Attributes: cassandra_additional_params (CassandraAdditionalParams): Additional params required for cassandra backup. cassandra_connect_params (CassandraConnectParams): Connect params for connecting to cassan...
the_stack_v2_python_sparse
cohesity_management_sdk/models/no_sql_connect_params.py
cohesity/management-sdk-python
train
24
99ca3583a8826d6aba548d8085265594e7991784
[ "if self.dialog is None:\n self.dialog = MemoryViewerDialog()\nreturn self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaulth=400, defaultw=400)", "if self.dialog is None:\n self.dialog = MemoryViewerDialog()\nreturn self.dialog.Restore(pluginid=PLUGIN_ID, secret=sec_ref)" ]
<|body_start_0|> if self.dialog is None: self.dialog = MemoryViewerDialog() return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaulth=400, defaultw=400) <|end_body_0|> <|body_start_1|> if self.dialog is None: self.dialog = MemoryViewerDialog() ...
Command Data class that holds the MemoryViewerDialog instance.
MemoryViewerCommandData
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemoryViewerCommandData: """Command Data class that holds the MemoryViewerDialog instance.""" def Execute(self, doc): """Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu). Args: doc (c4d.documents.BaseDocument): the current active ...
stack_v2_sparse_classes_10k_train_001892
8,722
permissive
[ { "docstring": "Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu). Args: doc (c4d.documents.BaseDocument): the current active document Returns: True if the command success", "name": "Execute", "signature": "def Execute(self, doc)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_004045
Implement the Python class `MemoryViewerCommandData` described below. Class description: Command Data class that holds the MemoryViewerDialog instance. Method signatures and docstrings: - def Execute(self, doc): Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu). Ar...
Implement the Python class `MemoryViewerCommandData` described below. Class description: Command Data class that holds the MemoryViewerDialog instance. Method signatures and docstrings: - def Execute(self, doc): Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu). Ar...
b1ea3fce533df34094bc3d0bd6460dfb84306e53
<|skeleton|> class MemoryViewerCommandData: """Command Data class that holds the MemoryViewerDialog instance.""" def Execute(self, doc): """Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu). Args: doc (c4d.documents.BaseDocument): the current active ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MemoryViewerCommandData: """Command Data class that holds the MemoryViewerDialog instance.""" def Execute(self, doc): """Called when the user Execute the command (CallCommand or a clicks on the Command from the plugin menu). Args: doc (c4d.documents.BaseDocument): the current active document Retu...
the_stack_v2_python_sparse
plugins/py-memory_viewer_r12/py-memory_viewer_r12.pyp
PluginCafe/cinema4d_py_sdk_extended
train
112
a0630817ed9b516e896730f1efb6b407226e8978
[ "l, r = (0, len(numbers) - 1)\nwhile l < r:\n s = numbers[l] + numbers[r]\n if s == target:\n return [l + 1, r + 1]\n elif s < target:\n l += 1\n else:\n r -= 1", "dic = {}\nfor i, num in enumerate(numbers):\n if target - num in dic:\n return [dic[target - num] + 1, i + ...
<|body_start_0|> l, r = (0, len(numbers) - 1) while l < r: s = numbers[l] + numbers[r] if s == target: return [l + 1, r + 1] elif s < target: l += 1 else: r -= 1 <|end_body_0|> <|body_start_1|> dic =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, numbers, target): """two Pointer O(n) time and O(1) space :type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_dictionary(self, numbers, target): """Dictionary O(n) time and O(n) space :type numbers: List[in...
stack_v2_sparse_classes_10k_train_001893
1,727
no_license
[ { "docstring": "two Pointer O(n) time and O(1) space :type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": "Dictionary O(n) time and O(n) space :type numbers: List[int] :type target: int :rtype: List[in...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): two Pointer O(n) time and O(1) space :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum_dictionary(self, numbers, target...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): two Pointer O(n) time and O(1) space :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum_dictionary(self, numbers, target...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def twoSum(self, numbers, target): """two Pointer O(n) time and O(1) space :type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_dictionary(self, numbers, target): """Dictionary O(n) time and O(n) space :type numbers: List[in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, numbers, target): """two Pointer O(n) time and O(1) space :type numbers: List[int] :type target: int :rtype: List[int]""" l, r = (0, len(numbers) - 1) while l < r: s = numbers[l] + numbers[r] if s == target: return [l +...
the_stack_v2_python_sparse
LeetCode/BinarySearch/167_two_sum_ii_input_array_is_sorted.py
XyK0907/for_work
train
0
d609e01f6e915ca8e050b5c402d04d3fa94858cc
[ "super().__init__(**kwargs)\nself.base_url = 'https://www.filmweb.pl'\nquery_part = '/search?q={title}'\nself.output = output\nself.start_urls.append(self.base_url + query_part.format(title=title))", "href = response.xpath(\"//div[@id='searchResult']/descendant::a[@class='poster__link'][1]/@href\").get()\nif href...
<|body_start_0|> super().__init__(**kwargs) self.base_url = 'https://www.filmweb.pl' query_part = '/search?q={title}' self.output = output self.start_urls.append(self.base_url + query_part.format(title=title)) <|end_body_0|> <|body_start_1|> href = response.xpath("//div[...
Movie spider for parsing basic information about movies. Attributes ---------- name : str name of the spider custom_settings : dict custom settings for the spider base_url : str base url of the site from which data will be parsed output : list list for holding parse result start_urls : list list for holding site urls t...
MovieSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieSpider: """Movie spider for parsing basic information about movies. Attributes ---------- name : str name of the spider custom_settings : dict custom settings for the spider base_url : str base url of the site from which data will be parsed output : list list for holding parse result start_u...
stack_v2_sparse_classes_10k_train_001894
4,494
no_license
[ { "docstring": "Constructs all the necessary attributes for the spider. Parameters ---------- title : str title of the movie to be parsed output : list used for storing parse result", "name": "__init__", "signature": "def __init__(self, title, output, **kwargs)" }, { "docstring": "Parses informa...
4
stack_v2_sparse_classes_30k_test_000268
Implement the Python class `MovieSpider` described below. Class description: Movie spider for parsing basic information about movies. Attributes ---------- name : str name of the spider custom_settings : dict custom settings for the spider base_url : str base url of the site from which data will be parsed output : lis...
Implement the Python class `MovieSpider` described below. Class description: Movie spider for parsing basic information about movies. Attributes ---------- name : str name of the spider custom_settings : dict custom settings for the spider base_url : str base url of the site from which data will be parsed output : lis...
16e327e0e4d23f43410ead5426cf5a6caea7a12f
<|skeleton|> class MovieSpider: """Movie spider for parsing basic information about movies. Attributes ---------- name : str name of the spider custom_settings : dict custom settings for the spider base_url : str base url of the site from which data will be parsed output : list list for holding parse result start_u...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovieSpider: """Movie spider for parsing basic information about movies. Attributes ---------- name : str name of the spider custom_settings : dict custom settings for the spider base_url : str base url of the site from which data will be parsed output : list list for holding parse result start_urls : list li...
the_stack_v2_python_sparse
lab-4/util/scraper/movie_spider.py
WuTolas/pjwstk-nai
train
0
f61b5f4d60bdc36754b30f7c4c836fe2e0398117
[ "result_particles = []\nnd_timestamp, non_data, non_start, non_end = self._chunker.get_next_non_data_with_index(clean=False)\ntimestamp, chunk, start, end = self._chunker.get_next_data_with_index()\nself.handle_non_data(non_data, non_end, start)\nwhile chunk is not None:\n header_match = SIO_HEADER_MATCHER.match...
<|body_start_0|> result_particles = [] nd_timestamp, non_data, non_start, non_end = self._chunker.get_next_non_data_with_index(clean=False) timestamp, chunk, start, end = self._chunker.get_next_data_with_index() self.handle_non_data(non_data, non_end, start) while chunk is not No...
FlortDjSioParser
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlortDjSioParser: def parse_chunks(self): """Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle, update the position and timestamp. Go until the chunker has no more valid data. @retval a list of tuples with sample particles encountered in this...
stack_v2_sparse_classes_10k_train_001895
9,506
permissive
[ { "docstring": "Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle, update the position and timestamp. Go until the chunker has no more valid data. @retval a list of tuples with sample particles encountered in this parsing, plus the state. An empty list of nothing wa...
2
null
Implement the Python class `FlortDjSioParser` described below. Class description: Implement the FlortDjSioParser class. Method signatures and docstrings: - def parse_chunks(self): Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle, update the position and timestamp. Go unt...
Implement the Python class `FlortDjSioParser` described below. Class description: Implement the FlortDjSioParser class. Method signatures and docstrings: - def parse_chunks(self): Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle, update the position and timestamp. Go unt...
bdbf01f5614e7188ce19596704794466e5683b30
<|skeleton|> class FlortDjSioParser: def parse_chunks(self): """Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle, update the position and timestamp. Go until the chunker has no more valid data. @retval a list of tuples with sample particles encountered in this...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlortDjSioParser: def parse_chunks(self): """Parse out any pending data chunks in the chunker. If it is a valid data piece, build a particle, update the position and timestamp. Go until the chunker has no more valid data. @retval a list of tuples with sample particles encountered in this parsing, plus...
the_stack_v2_python_sparse
mi/dataset/parser/flort_dj_sio.py
oceanobservatories/mi-instrument
train
1
6686b9ffc6573f146a957b5eb063297d49c57622
[ "result = {'result': 'NG', 'content': ''}\nsec_data = CtrlDSSection().get_sub_by_usecase(usecase_id, sec_type)\nif sec_data:\n result['result'] = 'OK'\n result['content'] = {'usecase_id': usecase_id, 'sec_type': sec_type, 'section_list': sec_data}\nreturn result", "data_json = request.get_json()\nresult = {...
<|body_start_0|> result = {'result': 'NG', 'content': ''} sec_data = CtrlDSSection().get_sub_by_usecase(usecase_id, sec_type) if sec_data: result['result'] = 'OK' result['content'] = {'usecase_id': usecase_id, 'sec_type': sec_type, 'section_list': sec_data} return...
ApiDsUcSub
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiDsUcSub: def get(self, usecase_id, sec_type): """取usecase下的sequence :return:""" <|body_0|> def post(self): """編輯usecase下的usecase :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG', 'content': ''} sec_data = ...
stack_v2_sparse_classes_10k_train_001896
31,026
no_license
[ { "docstring": "取usecase下的sequence :return:", "name": "get", "signature": "def get(self, usecase_id, sec_type)" }, { "docstring": "編輯usecase下的usecase :return:", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `ApiDsUcSub` described below. Class description: Implement the ApiDsUcSub class. Method signatures and docstrings: - def get(self, usecase_id, sec_type): 取usecase下的sequence :return: - def post(self): 編輯usecase下的usecase :return:
Implement the Python class `ApiDsUcSub` described below. Class description: Implement the ApiDsUcSub class. Method signatures and docstrings: - def get(self, usecase_id, sec_type): 取usecase下的sequence :return: - def post(self): 編輯usecase下的usecase :return: <|skeleton|> class ApiDsUcSub: def get(self, usecase_id, ...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiDsUcSub: def get(self, usecase_id, sec_type): """取usecase下的sequence :return:""" <|body_0|> def post(self): """編輯usecase下的usecase :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApiDsUcSub: def get(self, usecase_id, sec_type): """取usecase下的sequence :return:""" result = {'result': 'NG', 'content': ''} sec_data = CtrlDSSection().get_sub_by_usecase(usecase_id, sec_type) if sec_data: result['result'] = 'OK' result['content'] = {'use...
the_stack_v2_python_sparse
Source/collaboration_2/app/api_1_0/api_ds_doc.py
lsn1183/web_project
train
0
7e77df16a663ed6ff725875b8d2746d7cd9ba258
[ "args = rejected_parser.parse_args()\npage = args['page']\nper_page = args['per_page']\nsort_by = args['sort_by']\nsort_order = args['order']\nif per_page > 100:\n per_page = 100\ndescending = sort_order == 'desc'\nif per_page > 100:\n per_page = 100\nstart = per_page * (page - 1)\nstop = start + per_page\nkw...
<|body_start_0|> args = rejected_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] if per_page > 100: per_page = 100 descending = sort_order == 'desc' if per_page > 100: ...
Rejected
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rejected: def get(self, session=None): """List all rejected entries""" <|body_0|> def delete(self, session=None): """Clears all rejected entries""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = rejected_parser.parse_args() page = args[...
stack_v2_sparse_classes_10k_train_001897
5,092
permissive
[ { "docstring": "List all rejected entries", "name": "get", "signature": "def get(self, session=None)" }, { "docstring": "Clears all rejected entries", "name": "delete", "signature": "def delete(self, session=None)" } ]
2
null
Implement the Python class `Rejected` described below. Class description: Implement the Rejected class. Method signatures and docstrings: - def get(self, session=None): List all rejected entries - def delete(self, session=None): Clears all rejected entries
Implement the Python class `Rejected` described below. Class description: Implement the Rejected class. Method signatures and docstrings: - def get(self, session=None): List all rejected entries - def delete(self, session=None): Clears all rejected entries <|skeleton|> class Rejected: def get(self, session=None...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class Rejected: def get(self, session=None): """List all rejected entries""" <|body_0|> def delete(self, session=None): """Clears all rejected entries""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rejected: def get(self, session=None): """List all rejected entries""" args = rejected_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] if per_page > 100: per_page = 100 ...
the_stack_v2_python_sparse
flexget/components/rejected/api.py
BrutuZ/Flexget
train
1
c54e494bde8431da383e56609a14e252bee0e4b3
[ "for i in range(len(nums)):\n if i and nums[i - 1] < nums[i]:\n break\nelse:\n for i in range(len(nums) / 2):\n nums[i], nums[len(nums) - 1 - i] = (nums[len(nums) - 1 - i], nums[i])\n return\nfor i in range(len(nums) - 2, -1, -1):\n for j in range(i, len(nums)):\n if j < len(nums) -...
<|body_start_0|> for i in range(len(nums)): if i and nums[i - 1] < nums[i]: break else: for i in range(len(nums) / 2): nums[i], nums[len(nums) - 1 - i] = (nums[len(nums) - 1 - i], nums[i]) return for i in range(len(nums) - 2, -1...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place i...
stack_v2_sparse_classes_10k_train_001898
3,024
permissive
[ { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "_nextPermutation", "signature": "def _nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _nextPermutation(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums): :type nums: List[int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _nextPermutation(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums): :type nums: List[int...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def _nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" for i in range(len(nums)): if i and nums[i - 1] < nums[i]: break else: for i in range(len(nums) / 2): ...
the_stack_v2_python_sparse
31.next-permutation.py
windard/leeeeee
train
0
44597edfb77c5122191b344429c6d006fa72212e
[ "super().__init__(name='CP2K_INPUT', subsections={})\nself.structure = structure\nself.charge = structure.charge\nself.potential_and_basis = potential_and_basis\nself.multiplicity = multiplicity\nself.override_default_params = override_default_params\nself.project_name = project_name\nself.kwargs = kwargs\nfor s in...
<|body_start_0|> super().__init__(name='CP2K_INPUT', subsections={}) self.structure = structure self.charge = structure.charge self.potential_and_basis = potential_and_basis self.multiplicity = multiplicity self.override_default_params = override_default_params se...
The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. FORCE_EVAL is the largest section usually...
Cp2kInputSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cp2kInputSet: """The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. F...
stack_v2_sparse_classes_10k_train_001899
48,942
permissive
[ { "docstring": "Args: structure: (Structure or Molecule) pymatgen structure or molecule object used to define the lattice, coordinates, and elements. This structure object cannot contain \"special\" species like the Dummy species, e.g. X, or fractional occupations, e.g. Fe0.2, etc. potential_and_basis: (dict) S...
4
stack_v2_sparse_classes_30k_train_006460
Implement the Python class `Cp2kInputSet` described below. Class description: The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like...
Implement the Python class `Cp2kInputSet` described below. Class description: The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like...
6dd3b42f569397fa1a86a16fcfaaa29534abb8ca
<|skeleton|> class Cp2kInputSet: """The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. F...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cp2kInputSet: """The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. FORCE_EVAL is ...
the_stack_v2_python_sparse
pymatgen/io/cp2k/sets.py
Zhuoying/pymatgen
train
2