blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
03ae2bde6d2339df564f2a8c78730f7151b698f8
[ "super().__init__(cost_func)\nself._status = None\nself.th_objective = None\nself.th_optim = None\nself.th_info = None\nself.th_cost_func = None\nself._param_names = self.problem.param_names\nself.th_inputs = None\nself.result = None", "x_tensor = torch.from_numpy(np.array([self.problem.data_x]))\ny_tensor = torc...
<|body_start_0|> super().__init__(cost_func) self._status = None self.th_objective = None self.th_optim = None self.th_info = None self.th_cost_func = None self._param_names = self.problem.param_names self.th_inputs = None self.result = None <|end_...
Controller for Theseus
TheseusController
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TheseusController: """Controller for Theseus""" def __init__(self, cost_func): """Initialises variables used for temporary storage. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostFunc`""...
stack_v2_sparse_classes_36k_train_027900
6,403
permissive
[ { "docstring": "Initialises variables used for temporary storage. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostFunc`", "name": "__init__", "signature": "def __init__(self, cost_func)" }, { "docstr...
4
null
Implement the Python class `TheseusController` described below. Class description: Controller for Theseus Method signatures and docstrings: - def __init__(self, cost_func): Initialises variables used for temporary storage. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :cla...
Implement the Python class `TheseusController` described below. Class description: Controller for Theseus Method signatures and docstrings: - def __init__(self, cost_func): Initialises variables used for temporary storage. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :cla...
5ee7e66d963ebe9296c0a62c24b9616f6c65537e
<|skeleton|> class TheseusController: """Controller for Theseus""" def __init__(self, cost_func): """Initialises variables used for temporary storage. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostFunc`""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TheseusController: """Controller for Theseus""" def __init__(self, cost_func): """Initialises variables used for temporary storage. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostFunc`""" sup...
the_stack_v2_python_sparse
fitbenchmarking/controllers/theseus_controller.py
fitbenchmarking/fitbenchmarking
train
15
a6815155d11b138ad5d10da9c5a91b52b714ccfb
[ "super(ActionValueFunction, self).__init__()\nself.values = nn.Parameter(torch.zeros((state_size, action_size), requires_grad=True))\nself.state_size = state_size\nself.action_size = action_size\nif init is not None:\n if isinstance(init, (float, int, torch.Tensor)):\n self.values.data.add_(init)\n els...
<|body_start_0|> super(ActionValueFunction, self).__init__() self.values = nn.Parameter(torch.zeros((state_size, action_size), requires_grad=True)) self.state_size = state_size self.action_size = action_size if init is not None: if isinstance(init, (float, int, torch....
<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, the returned values are differentiable and can be...
ActionValueFunction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionValueFunction: """<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, th...
stack_v2_sparse_classes_36k_train_027901
3,917
permissive
[ { "docstring": "## Arguments * `state_size` (int) - The number of states in the environment. * `action_size` (int) - The number of actions per state. * `init` (function, *optional*, default=None) - The initialization scheme for the values in the table. (Default is 0.)", "name": "__init__", "signature": ...
2
stack_v2_sparse_classes_30k_train_001211
Implement the Python class `ActionValueFunction` described below. Class description: <a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states an...
Implement the Python class `ActionValueFunction` described below. Class description: <a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states an...
f4164a53dcc762ac5ce53a761fb54f3f69847f90
<|skeleton|> class ActionValueFunction: """<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActionValueFunction: """<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, the returned va...
the_stack_v2_python_sparse
cherry/models/tabular.py
learnables/cherry
train
185
43981e2d81e06638b3f517528277bd7ad4959250
[ "ans = 0\nlast = {}\narr = []\nfor x in a:\n for y in b:\n if x[1] + y[1] < target:\n ans = max(ans, x[1] + y[1])\n if ans not in last:\n last[ans] = []\n last[ans].append([x[0], y[0]])\n elif x[1] + y[1] == target:\n arr.append([x[0], y[0]...
<|body_start_0|> ans = 0 last = {} arr = [] for x in a: for y in b: if x[1] + y[1] < target: ans = max(ans, x[1] + y[1]) if ans not in last: last[ans] = [] last[ans].append([x[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solution1(self, a, b, target): """Time Complexity - O(n2)""" <|body_0|> def solution2(self, a, b, target): """Time - O(n log n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = 0 last = {} arr = [] for x in...
stack_v2_sparse_classes_36k_train_027902
3,744
no_license
[ { "docstring": "Time Complexity - O(n2)", "name": "solution1", "signature": "def solution1(self, a, b, target)" }, { "docstring": "Time - O(n log n)", "name": "solution2", "signature": "def solution2(self, a, b, target)" } ]
2
stack_v2_sparse_classes_30k_train_002761
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solution1(self, a, b, target): Time Complexity - O(n2) - def solution2(self, a, b, target): Time - O(n log n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solution1(self, a, b, target): Time Complexity - O(n2) - def solution2(self, a, b, target): Time - O(n log n) <|skeleton|> class Solution: def solution1(self, a, b, tar...
340868ee1d16b8b933436ca55828671d8203c0c0
<|skeleton|> class Solution: def solution1(self, a, b, target): """Time Complexity - O(n2)""" <|body_0|> def solution2(self, a, b, target): """Time - O(n log n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def solution1(self, a, b, target): """Time Complexity - O(n2)""" ans = 0 last = {} arr = [] for x in a: for y in b: if x[1] + y[1] < target: ans = max(ans, x[1] + y[1]) if ans not in last: ...
the_stack_v2_python_sparse
OnlineAssessmentQuestions/N11_OptimalUtilizations.py
anuragpatil94/Python-Practice
train
1
d68d59000ec06311e17d7c2fac817326491c0eb4
[ "sigma_0 = (ScoremapFOVProjParams & 'proj_sigma < 0.00001').proj()\nlen_session = (ScoremapFOV & 'no_sessions > 0').proj()\nkeys = super().key_source & sigma_0 & len_session\nreturn keys", "params = (ScoremapFOVProjParams & key).fetch1()\nscore_map_dict, score_map_dict_shuff = (ScoremapFOV & key).fetch1('aligned_...
<|body_start_0|> sigma_0 = (ScoremapFOVProjParams & 'proj_sigma < 0.00001').proj() len_session = (ScoremapFOV & 'no_sessions > 0').proj() keys = super().key_source & sigma_0 & len_session return keys <|end_body_0|> <|body_start_1|> params = (ScoremapFOVProjParams & key).fetch1()...
ScoremapFOVMoran
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScoremapFOVMoran: def key_source(self): """For Moran's I calculation do NOT take any parameter sets (ScoremapFOVProjParams) that smooth the score maps. This will lead to wrong assumptions.""" <|body_0|> def make(self, key): """Perform Moran’s I global autocorrelation...
stack_v2_sparse_classes_36k_train_027903
42,527
permissive
[ { "docstring": "For Moran's I calculation do NOT take any parameter sets (ScoremapFOVProjParams) that smooth the score maps. This will lead to wrong assumptions.", "name": "key_source", "signature": "def key_source(self)" }, { "docstring": "Perform Moran’s I global autocorrelation statistic calc...
2
stack_v2_sparse_classes_30k_train_009880
Implement the Python class `ScoremapFOVMoran` described below. Class description: Implement the ScoremapFOVMoran class. Method signatures and docstrings: - def key_source(self): For Moran's I calculation do NOT take any parameter sets (ScoremapFOVProjParams) that smooth the score maps. This will lead to wrong assumpt...
Implement the Python class `ScoremapFOVMoran` described below. Class description: Implement the ScoremapFOVMoran class. Method signatures and docstrings: - def key_source(self): For Moran's I calculation do NOT take any parameter sets (ScoremapFOVProjParams) that smooth the score maps. This will lead to wrong assumpt...
83c2dfc8597f9b7f4918f27b735420c4a0cc3415
<|skeleton|> class ScoremapFOVMoran: def key_source(self): """For Moran's I calculation do NOT take any parameter sets (ScoremapFOVProjParams) that smooth the score maps. This will lead to wrong assumptions.""" <|body_0|> def make(self, key): """Perform Moran’s I global autocorrelation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScoremapFOVMoran: def key_source(self): """For Moran's I calculation do NOT take any parameter sets (ScoremapFOVProjParams) that smooth the score maps. This will lead to wrong assumptions.""" sigma_0 = (ScoremapFOVProjParams & 'proj_sigma < 0.00001').proj() len_session = (ScoremapFOV &...
the_stack_v2_python_sparse
dj_schemas/anatomical_alignment.py
kavli-ntnu/mini2p_topography
train
2
498cde9ae6a58951ac49be55226c54d4b7774693
[ "Parametre.__init__(self, 'éditer', 'edit')\nself.schema = '<texte_libre>'\nself.aide_courte = \"ouvre l'éditeur de modèle de navires\"\nself.aide_longue = \"Cette commande ouvre l'éditeur de prototype de navire. Le terme modèle est également utilisé. Vous devez préciser en paramètre la clé du modèle (par exemple |...
<|body_start_0|> Parametre.__init__(self, 'éditer', 'edit') self.schema = '<texte_libre>' self.aide_courte = "ouvre l'éditeur de modèle de navires" self.aide_longue = "Cette commande ouvre l'éditeur de prototype de navire. Le terme modèle est également utilisé. Vous devez préciser en par...
Commande 'navire éditer'.
PrmEditer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmEditer: """Commande 'navire éditer'.""" def __init__(self): """Constructeur de la commande""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|> <|body_start_0|> P...
stack_v2_sparse_classes_36k_train_027904
3,818
permissive
[ { "docstring": "Constructeur de la commande", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_006464
Implement the Python class `PrmEditer` described below. Class description: Commande 'navire éditer'. Method signatures and docstrings: - def __init__(self): Constructeur de la commande - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
Implement the Python class `PrmEditer` described below. Class description: Commande 'navire éditer'. Method signatures and docstrings: - def __init__(self): Constructeur de la commande - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande <|skeleton|> class PrmEditer: """Commande...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmEditer: """Commande 'navire éditer'.""" def __init__(self): """Constructeur de la commande""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmEditer: """Commande 'navire éditer'.""" def __init__(self): """Constructeur de la commande""" Parametre.__init__(self, 'éditer', 'edit') self.schema = '<texte_libre>' self.aide_courte = "ouvre l'éditeur de modèle de navires" self.aide_longue = "Cette commande ou...
the_stack_v2_python_sparse
src/secondaires/navigation/commandes/navire/editer.py
vincent-lg/tsunami
train
5
4113ae13e4596e8013842b920809d0a82e1cd66a
[ "self._port_pool = PortPool()\nself._total_allocations = 0\nself._denied_allocations = 0\nself._client_request_errors = 0\nfor port in ports_to_serve:\n self._port_pool.add_port_to_free_pool(port)", "try:\n pid = int(client_data)\nexcept ValueError as error:\n self._client_request_errors += 1\n loggin...
<|body_start_0|> self._port_pool = PortPool() self._total_allocations = 0 self._denied_allocations = 0 self._client_request_errors = 0 for port in ports_to_serve: self._port_pool.add_port_to_free_pool(port) <|end_body_0|> <|body_start_1|> try: pid...
A class to handle port allocation and status requests. Allocates ports to process ids via the dead simple port server protocol when the handle_port_request asyncio.coroutine handler has been registered. Statistics can be logged using the dump_stats method.
PortServerRequestHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortServerRequestHandler: """A class to handle port allocation and status requests. Allocates ports to process ids via the dead simple port server protocol when the handle_port_request asyncio.coroutine handler has been registered. Statistics can be logged using the dump_stats method.""" def...
stack_v2_sparse_classes_36k_train_027905
19,311
permissive
[ { "docstring": "Initialize a new port server. Args: ports_to_serve: Sequence[int]. A sequence of unique port numbers to test and offer up to clients.", "name": "__init__", "signature": "def __init__(self, ports_to_serve: Sequence[int]) -> None" }, { "docstring": "Given a port request body, parse...
3
null
Implement the Python class `PortServerRequestHandler` described below. Class description: A class to handle port allocation and status requests. Allocates ports to process ids via the dead simple port server protocol when the handle_port_request asyncio.coroutine handler has been registered. Statistics can be logged u...
Implement the Python class `PortServerRequestHandler` described below. Class description: A class to handle port allocation and status requests. Allocates ports to process ids via the dead simple port server protocol when the handle_port_request asyncio.coroutine handler has been registered. Statistics can be logged u...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class PortServerRequestHandler: """A class to handle port allocation and status requests. Allocates ports to process ids via the dead simple port server protocol when the handle_port_request asyncio.coroutine handler has been registered. Statistics can be logged using the dump_stats method.""" def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PortServerRequestHandler: """A class to handle port allocation and status requests. Allocates ports to process ids via the dead simple port server protocol when the handle_port_request asyncio.coroutine handler has been registered. Statistics can be logged using the dump_stats method.""" def __init__(sel...
the_stack_v2_python_sparse
scripts/run_portserver.py
oppia/oppia
train
6,172
455912b33abc587b0bd4ea135ce2da724d12d645
[ "r = station_diameter / 2\nfor i in range(strings_per_station):\n angle = 2 * np.pi * i / strings_per_station\n x_str = x + r * np.cos(angle)\n y_str = y + r * np.sin(angle)\n self.subsets.append(string_type(x_str, y_str, **string_kwargs))", "antennas_hit = sum((1 for ant in self if ant.is_hit))\nstri...
<|body_start_0|> r = station_diameter / 2 for i in range(strings_per_station): angle = 2 * np.pi * i / strings_per_station x_str = x + r * np.cos(angle) y_str = y + r * np.sin(angle) self.subsets.append(string_type(x_str, y_str, **string_kwargs)) <|end_bod...
Station geometry with a number of strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.
RegularStation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegularStation: """Station geometry with a number of strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.""" def set_positions(self, x, y, strings_per_station=4, station_diameter=50, string_type=IREXStri...
stack_v2_sparse_classes_36k_train_027906
6,416
permissive
[ { "docstring": "Generates string positions around the station.", "name": "set_positions", "signature": "def set_positions(self, x, y, strings_per_station=4, station_diameter=50, string_type=IREXString, **string_kwargs)" }, { "docstring": "Test whether the number of hit antennas meets the given a...
2
stack_v2_sparse_classes_30k_train_013254
Implement the Python class `RegularStation` described below. Class description: Station geometry with a number of strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class. Method signatures and docstrings: - def set_positions(self, x,...
Implement the Python class `RegularStation` described below. Class description: Station geometry with a number of strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class. Method signatures and docstrings: - def set_positions(self, x,...
80798ec2c4fd2e27f40843e37013765ee6a4e551
<|skeleton|> class RegularStation: """Station geometry with a number of strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.""" def set_positions(self, x, y, strings_per_station=4, station_diameter=50, string_type=IREXStri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegularStation: """Station geometry with a number of strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.""" def set_positions(self, x, y, strings_per_station=4, station_diameter=50, string_type=IREXString, **string_...
the_stack_v2_python_sparse
pyrex/custom/irex/detector.py
shrishabh/pyrex
train
0
29aac384c7fb4bbebbd017f6028445910ee02123
[ "nums = sorted(nums)\nres = []\nfor i in range(len(nums) - 2):\n if i == 0 or (i > 0 and nums[i] != nums[i - 1]):\n target = bigtarget - nums[i]\n target_supple = []\n left = i + 1\n right = len(nums) - 1\n while left < right:\n if left > i + 1 and nums[left] == nums...
<|body_start_0|> nums = sorted(nums) res = [] for i in range(len(nums) - 2): if i == 0 or (i > 0 and nums[i] != nums[i - 1]): target = bigtarget - nums[i] target_supple = [] left = i + 1 right = len(nums) - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums, bigtarget): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def fourSum(self, nums, bigtarget): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_027907
1,722
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums, bigtarget)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, bigtarget)"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums, bigtarget): :type nums: List[int] :rtype: List[List[int]] - def fourSum(self, nums, bigtarget): :type nums: List[int] :type target: int :rtype: List[List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums, bigtarget): :type nums: List[int] :rtype: List[List[int]] - def fourSum(self, nums, bigtarget): :type nums: List[int] :type target: int :rtype: List[List...
6b24a99e5ce87bca5ec487a996fea80991380293
<|skeleton|> class Solution: def threeSum(self, nums, bigtarget): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def fourSum(self, nums, bigtarget): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, nums, bigtarget): """:type nums: List[int] :rtype: List[List[int]]""" nums = sorted(nums) res = [] for i in range(len(nums) - 2): if i == 0 or (i > 0 and nums[i] != nums[i - 1]): target = bigtarget - nums[i] ...
the_stack_v2_python_sparse
18四数之和.py
Frodoooo/MyLeetCode
train
0
4054d0dc929504b9d4d455329935df2f2dfca7db
[ "if self.description is None:\n self.description = str(self)\nsuper(Action, self).save(*args, **kwargs)", "transport = self.create_request_handler(user=user)\ntransport.run(alert)\nreturn transport.record" ]
<|body_start_0|> if self.description is None: self.description = str(self) super(Action, self).save(*args, **kwargs) <|end_body_0|> <|body_start_1|> transport = self.create_request_handler(user=user) transport.run(alert) return transport.record <|end_body_1|>
Specifies the module and |Carrier| class that should be used to access an API endpoint of a |Destination|, such as JIRA. An |Action| can pass an |Alert| to the |Carrier|, which uses it to construct and send a request to the API endpoint. The |Action| then retrieves a |Dispatch| of the API response from the |Carrier|. A...
Action
[ "MIT", "LicenseRef-scancode-proprietary-license", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: """Specifies the module and |Carrier| class that should be used to access an API endpoint of a |Destination|, such as JIRA. An |Action| can pass an |Alert| to the |Carrier|, which uses it to construct and send a request to the API endpoint. The |Action| then retrieves a |Dispatch| of the ...
stack_v2_sparse_classes_36k_train_027908
4,058
permissive
[ { "docstring": "Overrides the save() method to assign a default description to a new Action using its other attributes.", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "Take action on an |Alert| and get a |Dispatch| of the API response. Parameters ---------- us...
2
null
Implement the Python class `Action` described below. Class description: Specifies the module and |Carrier| class that should be used to access an API endpoint of a |Destination|, such as JIRA. An |Action| can pass an |Alert| to the |Carrier|, which uses it to construct and send a request to the API endpoint. The |Acti...
Implement the Python class `Action` described below. Class description: Specifies the module and |Carrier| class that should be used to access an API endpoint of a |Destination|, such as JIRA. An |Action| can pass an |Alert| to the |Carrier|, which uses it to construct and send a request to the API endpoint. The |Acti...
a379a134c0c5af14df4ed2afa066c1626506b754
<|skeleton|> class Action: """Specifies the module and |Carrier| class that should be used to access an API endpoint of a |Destination|, such as JIRA. An |Action| can pass an |Alert| to the |Carrier|, which uses it to construct and send a request to the API endpoint. The |Action| then retrieves a |Dispatch| of the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Action: """Specifies the module and |Carrier| class that should be used to access an API endpoint of a |Destination|, such as JIRA. An |Action| can pass an |Alert| to the |Carrier|, which uses it to construct and send a request to the API endpoint. The |Action| then retrieves a |Dispatch| of the API response ...
the_stack_v2_python_sparse
Incident-Response/Tools/cyphon/cyphon/responder/actions/models.py
foss2cyber/Incident-Playbook
train
1
3da1423b1c3ba8be2c8a28dccd6e03f86bff986a
[ "if not types or (not isinstance(types, list) and types != 'all'):\n raise ValueError(\"Expected types = 'all' or a non-empty list of requested types, got {!r} instead.\".format(types))\nif not hasattr(cls, 'assessment_type'):\n raise AttributeError(\"Expected 'assessment_type' field defined for '{c.__name__}...
<|body_start_0|> if not types or (not isinstance(types, list) and types != 'all'): raise ValueError("Expected types = 'all' or a non-empty list of requested types, got {!r} instead.".format(types)) if not hasattr(cls, 'assessment_type'): raise AttributeError("Expected 'assessment...
Defines a routine to get similar object with mappings to same objects.
WithSimilarityScore
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WithSimilarityScore: """Defines a routine to get similar object with mappings to same objects.""" def get_similar_objects_query(cls, id_, types='all', relevant_types=None, threshold=1): """Get objects of types similar to cls instance by their mappings. Args: id_: the id of the object...
stack_v2_sparse_classes_36k_train_027909
10,076
permissive
[ { "docstring": "Get objects of types similar to cls instance by their mappings. Args: id_: the id of the object to which the search will be applied; types: a list of types of relevant objects (or \"all\" if you need to find objects of any type); relevant_types: use this parameter to override assessment_type; th...
3
null
Implement the Python class `WithSimilarityScore` described below. Class description: Defines a routine to get similar object with mappings to same objects. Method signatures and docstrings: - def get_similar_objects_query(cls, id_, types='all', relevant_types=None, threshold=1): Get objects of types similar to cls in...
Implement the Python class `WithSimilarityScore` described below. Class description: Defines a routine to get similar object with mappings to same objects. Method signatures and docstrings: - def get_similar_objects_query(cls, id_, types='all', relevant_types=None, threshold=1): Get objects of types similar to cls in...
9bdc0fc6ca9e252f4919db682d80e360d5581eb4
<|skeleton|> class WithSimilarityScore: """Defines a routine to get similar object with mappings to same objects.""" def get_similar_objects_query(cls, id_, types='all', relevant_types=None, threshold=1): """Get objects of types similar to cls instance by their mappings. Args: id_: the id of the object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WithSimilarityScore: """Defines a routine to get similar object with mappings to same objects.""" def get_similar_objects_query(cls, id_, types='all', relevant_types=None, threshold=1): """Get objects of types similar to cls instance by their mappings. Args: id_: the id of the object to which the...
the_stack_v2_python_sparse
src/ggrc/models/mixins/with_similarity_score.py
HLD/ggrc-core
train
0
97c4427cefd8ea10cf1ea0211dedf9f22a80dc70
[ "if use_filemanager is None:\n super().__init__()\nelse:\n super().__init__(use_filemanager)\nself.prefix = prefix\nself.name = 'predictions'", "for key in data_dict:\n df = data_dict[key].to_dataframe(name=self.name).reset_index()\n export = pd.DataFrame({**{'TIMESTAMP': pd.Series([], dtype='int'), '...
<|body_start_0|> if use_filemanager is None: super().__init__() else: super().__init__(use_filemanager) self.prefix = prefix self.name = 'predictions' <|end_body_0|> <|body_start_1|> for key in data_dict: df = data_dict[key].to_dataframe(name=...
Callback class to save csv files. :param BaseCallback: Base callback as parent class. :type BaseCallback: BaseCallback
MultiDimCSVCallback
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiDimCSVCallback: """Callback class to save csv files. :param BaseCallback: Base callback as parent class. :type BaseCallback: BaseCallback""" def __init__(self, prefix: str, use_filemanager: Optional[bool]=None): """Initialise csv callback class given a prefix and optional use_fi...
stack_v2_sparse_classes_36k_train_027910
2,465
no_license
[ { "docstring": "Initialise csv callback class given a prefix and optional use_filemanager flag. :param prefix: Prefix of the CSV file that should be written. :type prefix: str :param use_filemanager: Optional flag to set if the filemanager of the pipeline should be used. :type use_filemanager: Optional[bool]", ...
2
stack_v2_sparse_classes_30k_train_011313
Implement the Python class `MultiDimCSVCallback` described below. Class description: Callback class to save csv files. :param BaseCallback: Base callback as parent class. :type BaseCallback: BaseCallback Method signatures and docstrings: - def __init__(self, prefix: str, use_filemanager: Optional[bool]=None): Initial...
Implement the Python class `MultiDimCSVCallback` described below. Class description: Callback class to save csv files. :param BaseCallback: Base callback as parent class. :type BaseCallback: BaseCallback Method signatures and docstrings: - def __init__(self, prefix: str, use_filemanager: Optional[bool]=None): Initial...
626c967f6383666df666e8551925d431f55f8661
<|skeleton|> class MultiDimCSVCallback: """Callback class to save csv files. :param BaseCallback: Base callback as parent class. :type BaseCallback: BaseCallback""" def __init__(self, prefix: str, use_filemanager: Optional[bool]=None): """Initialise csv callback class given a prefix and optional use_fi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiDimCSVCallback: """Callback class to save csv files. :param BaseCallback: Base callback as parent class. :type BaseCallback: BaseCallback""" def __init__(self, prefix: str, use_filemanager: Optional[bool]=None): """Initialise csv callback class given a prefix and optional use_filemanager fla...
the_stack_v2_python_sparse
multi_dim_csv_callback.py
pavelzw/GEFCom14-S-comparison
train
3
d8f9cbbdd2cd224519603aa535f863b40799f92c
[ "URLPlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache)\nNamePlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache, disable_kw=disable_kw)\nself._iterable_list = []\nself.data = data\nself.datatype = datatype\nself.pl...
<|body_start_0|> URLPlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache) NamePlayer.__init__(self, show_lyrics=show_lyrics, dont_cache_search=dont_cache_search, no_cache=no_cache, disable_kw=disable_kw) self._iterable_list = [] self.data ...
Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname
Player
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Player: """Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname""" def __init__(self, data, on_repeat, datatype=None, playlisttype=None, show_lyrics=False, dont_cache_search=False, no_cac...
stack_v2_sparse_classes_36k_train_027911
12,182
permissive
[ { "docstring": "data can be anything of the above supported types. If playlist then it is iterated over, if it is some other type then its simply sent to be played according to the player. datatype supports the following types: - playlist - song - URL", "name": "__init__", "signature": "def __init__(sel...
6
stack_v2_sparse_classes_30k_val_001165
Implement the Python class `Player` described below. Class description: Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname Method signatures and docstrings: - def __init__(self, data, on_repeat, datatype=None, p...
Implement the Python class `Player` described below. Class description: Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname Method signatures and docstrings: - def __init__(self, data, on_repeat, datatype=None, p...
9050f0c5f9fef7b9c9b14a7f26a055684e260d4c
<|skeleton|> class Player: """Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname""" def __init__(self, data, on_repeat, datatype=None, playlisttype=None, show_lyrics=False, dont_cache_search=False, no_cac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Player: """Base class to play songs. Player will take different types of data, recognize them and play accordingly. Supported data types would be: Playlist URL Songname""" def __init__(self, data, on_repeat, datatype=None, playlisttype=None, show_lyrics=False, dont_cache_search=False, no_cache=False, no_...
the_stack_v2_python_sparse
playx/player.py
NISH1001/playx
train
229
0a0291028de639f901a404c06674e17841d4ea02
[ "device = torch.device('cpu') if device is None else device\nself.function = function.to(device)\nself.dim = function.dim\nself.bounds = torch.tensor([[0.0], [1.0]]).repeat(1, self.dim).to(device)\nself.original_bounds = torch.tensor(self.function._bounds).t().to(device)\nself.scale = self.original_bounds[1] - self...
<|body_start_0|> device = torch.device('cpu') if device is None else device self.function = function.to(device) self.dim = function.dim self.bounds = torch.tensor([[0.0], [1.0]]).repeat(1, self.dim).to(device) self.original_bounds = torch.tensor(self.function._bounds).t().to(devi...
the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.
StandardizedFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardizedFunction: """the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.""" def __init__(self, function: SyntheticTestFunction, negate: bool=True, device: Optional[torch.device]=None): """Initialize the function A...
stack_v2_sparse_classes_36k_train_027912
3,113
no_license
[ { "docstring": "Initialize the function Args: function: the function to sample from, the initialized object. negate: Whether to negate the function output. Many BoTorch test problems are intended for minimization, thus the default is True. device: The device to run the experiment on. Defaults to `cpu'.", "n...
4
stack_v2_sparse_classes_30k_train_014488
Implement the Python class `StandardizedFunction` described below. Class description: the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube. Method signatures and docstrings: - def __init__(self, function: SyntheticTestFunction, negate: bool=True, device...
Implement the Python class `StandardizedFunction` described below. Class description: the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube. Method signatures and docstrings: - def __init__(self, function: SyntheticTestFunction, negate: bool=True, device...
ac4a9a413290beee0d0f082d5b35d3a905c80f1e
<|skeleton|> class StandardizedFunction: """the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.""" def __init__(self, function: SyntheticTestFunction, negate: bool=True, device: Optional[torch.device]=None): """Initialize the function A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardizedFunction: """the SyntheticTestFunctions of BoTorch have various bounded domains. This class normalizes those to the unit hypercube.""" def __init__(self, function: SyntheticTestFunction, negate: bool=True, device: Optional[torch.device]=None): """Initialize the function Args: function...
the_stack_v2_python_sparse
parametric_bandit/test_functions/standardized_function.py
saitcakmak/parametric-bandit
train
0
1ea451a5a8d8f9d02d0298cedcbe881990989a39
[ "if isinstance(value, bool):\n return value\nif value is None:\n return False\nexpr = int(value)\nif 1 == expr:\n return True\nelif 0 == expr:\n return False\nelse:\n raise ValueError('Unable to deserialize boolean integer: %s' % value)", "if isinstance(value, six.integer_types):\n if int(value)...
<|body_start_0|> if isinstance(value, bool): return value if value is None: return False expr = int(value) if 1 == expr: return True elif 0 == expr: return False else: raise ValueError('Unable to deserialize bool...
BoolInt
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoolInt: def deserialize(cls, value): """Convert an integer to a boolean""" <|body_0|> def serialize(cls, value): """Convert a boolean to an integer""" <|body_1|> <|end_skeleton|> <|body_start_0|> if isinstance(value, bool): return value...
stack_v2_sparse_classes_36k_train_027913
1,405
permissive
[ { "docstring": "Convert an integer to a boolean", "name": "deserialize", "signature": "def deserialize(cls, value)" }, { "docstring": "Convert a boolean to an integer", "name": "serialize", "signature": "def serialize(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_021365
Implement the Python class `BoolInt` described below. Class description: Implement the BoolInt class. Method signatures and docstrings: - def deserialize(cls, value): Convert an integer to a boolean - def serialize(cls, value): Convert a boolean to an integer
Implement the Python class `BoolInt` described below. Class description: Implement the BoolInt class. Method signatures and docstrings: - def deserialize(cls, value): Convert an integer to a boolean - def serialize(cls, value): Convert a boolean to an integer <|skeleton|> class BoolInt: def deserialize(cls, val...
60d75438d71ffb7998f5dc407ffa890cc98d3171
<|skeleton|> class BoolInt: def deserialize(cls, value): """Convert an integer to a boolean""" <|body_0|> def serialize(cls, value): """Convert a boolean to an integer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoolInt: def deserialize(cls, value): """Convert an integer to a boolean""" if isinstance(value, bool): return value if value is None: return False expr = int(value) if 1 == expr: return True elif 0 == expr: return...
the_stack_v2_python_sparse
openstack/cdn/format.py
huaweicloudsdk/sdk-python
train
20
63d03962cc5ca0a857010074e0558b41063ea56a
[ "nx.DiGraph.__init__(self)\nself.agp_list = agps\nself.agp_sz = self.agp_list.size\nif skip == False:\n self._add_nodes()\n self._add_edges()", "logging.debug('adding edges.')\nfor i in range(self.agp_sz):\n if self.agp_list[i]['comp_type'] == 'N':\n if i + 1 >= self.agp_list.size:\n br...
<|body_start_0|> nx.DiGraph.__init__(self) self.agp_list = agps self.agp_sz = self.agp_list.size if skip == False: self._add_nodes() self._add_edges() <|end_body_0|> <|body_start_1|> logging.debug('adding edges.') for i in range(self.agp_sz): ...
ScaffAgp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaffAgp: def __init__(self, agps, skip=False): """Linear graph constructor.""" <|body_0|> def _add_edges(self): """grabs edges from directed graph.""" <|body_1|> def _add_nodes(self): """adds nodes from list.""" <|body_2|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_027914
1,634
no_license
[ { "docstring": "Linear graph constructor.", "name": "__init__", "signature": "def __init__(self, agps, skip=False)" }, { "docstring": "grabs edges from directed graph.", "name": "_add_edges", "signature": "def _add_edges(self)" }, { "docstring": "adds nodes from list.", "name...
3
stack_v2_sparse_classes_30k_train_020256
Implement the Python class `ScaffAgp` described below. Class description: Implement the ScaffAgp class. Method signatures and docstrings: - def __init__(self, agps, skip=False): Linear graph constructor. - def _add_edges(self): grabs edges from directed graph. - def _add_nodes(self): adds nodes from list.
Implement the Python class `ScaffAgp` described below. Class description: Implement the ScaffAgp class. Method signatures and docstrings: - def __init__(self, agps, skip=False): Linear graph constructor. - def _add_edges(self): grabs edges from directed graph. - def _add_nodes(self): adds nodes from list. <|skeleton...
5a1e07abb07ed0fb99241b21af5b0ba045299d22
<|skeleton|> class ScaffAgp: def __init__(self, agps, skip=False): """Linear graph constructor.""" <|body_0|> def _add_edges(self): """grabs edges from directed graph.""" <|body_1|> def _add_nodes(self): """adds nodes from list.""" <|body_2|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScaffAgp: def __init__(self, agps, skip=False): """Linear graph constructor.""" nx.DiGraph.__init__(self) self.agp_list = agps self.agp_sz = self.agp_list.size if skip == False: self._add_nodes() self._add_edges() def _add_edges(self): ...
the_stack_v2_python_sparse
SINAH/scripts/graphs/agp.py
jim-bo/SINAH
train
0
fb5a2369a71dc23fa36c310cbb8d682c0ec93213
[ "self.tweets = defaultdict(list)\nself.users = defaultdict(set)\nself.tweet_count = 0", "tid = self.tweet_count\nself.tweet_count += 1\nself.tweets[userId].append((tid, tweetId))", "followees = self.users[userId]\npool = self.tweets[userId][-10:]\nfor x in followees:\n pool.extend(self.tweets[x][-10:])\npool...
<|body_start_0|> self.tweets = defaultdict(list) self.users = defaultdict(set) self.tweet_count = 0 <|end_body_0|> <|body_start_1|> tid = self.tweet_count self.tweet_count += 1 self.tweets[userId].append((tid, tweetId)) <|end_body_1|> <|body_start_2|> followees ...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k_train_027915
2,167
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet. :type userId: int :type tweetId: int :rtype: void", "name": "postTweet", "signature": "def postTweet(self, userId, tweetId)" }, { "...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId, tweetId): Compose a new tweet. :type userId: int :type tweetId: int :rtype: void - def getNew...
c026f2969c784827fac702b34b07a9268b70b62a
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: void""" <|body_1|> def getNewsFeed(self, userId): """Ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.tweets = defaultdict(list) self.users = defaultdict(set) self.tweet_count = 0 def postTweet(self, userId, tweetId): """Compose a new tweet. :type userId: int :type tweetId: int :rtype: voi...
the_stack_v2_python_sparse
codes/contest/leetcode/design-twitter.py
jiluhu/dirtysalt.github.io
train
0
55d5c80f475978a4009e1af24d720b8a0c3ca0eb
[ "ctx.shift = shift\nctx.quantum_circuit = quantum_circuit\nresults = []\nfor batch in input:\n expectation_z = ctx.quantum_circuit.run(batch)\n results.append(expectation_z)\nresults = t.Tensor(results)\nctx.save_for_backward(input, results)\nreturn results", "input, expectation_z = ctx.saved_tensors\ninput...
<|body_start_0|> ctx.shift = shift ctx.quantum_circuit = quantum_circuit results = [] for batch in input: expectation_z = ctx.quantum_circuit.run(batch) results.append(expectation_z) results = t.Tensor(results) ctx.save_for_backward(input, results)...
Hybrid quantum - classical function definition
HybridFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HybridFunction: """Hybrid quantum - classical function definition""" def forward(ctx, input, quantum_circuit, shift): """Forward pass computation""" <|body_0|> def backward(ctx, grad_output): """Backward pass computation""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_027916
25,405
no_license
[ { "docstring": "Forward pass computation", "name": "forward", "signature": "def forward(ctx, input, quantum_circuit, shift)" }, { "docstring": "Backward pass computation", "name": "backward", "signature": "def backward(ctx, grad_output)" } ]
2
stack_v2_sparse_classes_30k_train_020459
Implement the Python class `HybridFunction` described below. Class description: Hybrid quantum - classical function definition Method signatures and docstrings: - def forward(ctx, input, quantum_circuit, shift): Forward pass computation - def backward(ctx, grad_output): Backward pass computation
Implement the Python class `HybridFunction` described below. Class description: Hybrid quantum - classical function definition Method signatures and docstrings: - def forward(ctx, input, quantum_circuit, shift): Forward pass computation - def backward(ctx, grad_output): Backward pass computation <|skeleton|> class H...
d87e5652085bcb1848f30aadde848fd530e984c2
<|skeleton|> class HybridFunction: """Hybrid quantum - classical function definition""" def forward(ctx, input, quantum_circuit, shift): """Forward pass computation""" <|body_0|> def backward(ctx, grad_output): """Backward pass computation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HybridFunction: """Hybrid quantum - classical function definition""" def forward(ctx, input, quantum_circuit, shift): """Forward pass computation""" ctx.shift = shift ctx.quantum_circuit = quantum_circuit results = [] for batch in input: expectation_z =...
the_stack_v2_python_sparse
src/partiqleDTR/pipelines/data_science/qftgnn.py
stroblme/partiqleDTR
train
0
0138a77c06865245c98d99bfcf47fb0b1ce9d11e
[ "super().__init__(device=device)\nxyz = _handle_input(x, y, z, dtype, device, 'Translate')\nN = xyz.shape[0]\nmat = torch.eye(4, dtype=dtype, device=device)\nmat = mat.view(1, 4, 4).repeat(N, 1, 1)\nmat[:, 3, :3] = xyz\nself._matrix = mat", "inv_mask = self._matrix.new_ones([1, 4, 4])\ninv_mask[0, 3, :3] = -1.0\n...
<|body_start_0|> super().__init__(device=device) xyz = _handle_input(x, y, z, dtype, device, 'Translate') N = xyz.shape[0] mat = torch.eye(4, dtype=dtype, device=device) mat = mat.view(1, 4, 4).repeat(N, 1, 1) mat[:, 3, :3] = xyz self._matrix = mat <|end_body_0|> ...
Translate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Translate: def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): """Create a new Transform3d representing 3D translations. Option I: Translate(xyz, dtype=torch.float32, device='cpu') xyz should be a tensor of shape (N, 3) Option II: Translate(x, y, z, dtype=torch.floa...
stack_v2_sparse_classes_36k_train_027917
43,607
permissive
[ { "docstring": "Create a new Transform3d representing 3D translations. Option I: Translate(xyz, dtype=torch.float32, device='cpu') xyz should be a tensor of shape (N, 3) Option II: Translate(x, y, z, dtype=torch.float32, device='cpu') Here x, y, and z will be broadcast against each other and concatenated to for...
2
stack_v2_sparse_classes_30k_train_017839
Implement the Python class `Translate` described below. Class description: Implement the Translate class. Method signatures and docstrings: - def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): Create a new Transform3d representing 3D translations. Option I: Translate(xyz, dtype=torch.float32, d...
Implement the Python class `Translate` described below. Class description: Implement the Translate class. Method signatures and docstrings: - def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): Create a new Transform3d representing 3D translations. Option I: Translate(xyz, dtype=torch.float32, d...
1d240f60a99682e8409363c5829aba14869ba140
<|skeleton|> class Translate: def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): """Create a new Transform3d representing 3D translations. Option I: Translate(xyz, dtype=torch.float32, device='cpu') xyz should be a tensor of shape (N, 3) Option II: Translate(x, y, z, dtype=torch.floa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Translate: def __init__(self, x, y=None, z=None, dtype=torch.float32, device='cpu'): """Create a new Transform3d representing 3D translations. Option I: Translate(xyz, dtype=torch.float32, device='cpu') xyz should be a tensor of shape (N, 3) Option II: Translate(x, y, z, dtype=torch.float32, device='c...
the_stack_v2_python_sparse
soft_intro_vae_3d/datasets/transforms3d.py
LearnerLYH/soft-intro-vae-pytorch
train
1
ad3e822a848fb09cb289c5f4a5df3359ac7a962e
[ "if self.request.method == 'GET':\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveApprovalRequest())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method in ('PUT', 'PATCH'):\n return (permissions.IsAuthenticated(), IsInAct...
<|body_start_0|> if self.request.method == 'GET': return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveApprovalRequest()) elif self.request.method == 'POST': return (permissions.IsAuthenticated(),) elif self.request.method in ('PUT', 'PATCH'): ...
Approval request view set
ApprovalRequestViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApprovalRequestViewSet: """Approval request view set""" def get_permissions(self): """Get permissions""" <|body_0|> def get_serializer_class(self): """Get serializer class""" <|body_1|> def list(self, request, *args, **kwargs): """List approv...
stack_v2_sparse_classes_36k_train_027918
27,778
permissive
[ { "docstring": "Get permissions", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Get serializer class", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "List approval requests", "name": "l...
4
stack_v2_sparse_classes_30k_train_006721
Implement the Python class `ApprovalRequestViewSet` described below. Class description: Approval request view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def get_serializer_class(self): Get serializer class - def list(self, request, *args, **kwargs): List approval requests - d...
Implement the Python class `ApprovalRequestViewSet` described below. Class description: Approval request view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def get_serializer_class(self): Get serializer class - def list(self, request, *args, **kwargs): List approval requests - d...
cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8
<|skeleton|> class ApprovalRequestViewSet: """Approval request view set""" def get_permissions(self): """Get permissions""" <|body_0|> def get_serializer_class(self): """Get serializer class""" <|body_1|> def list(self, request, *args, **kwargs): """List approv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApprovalRequestViewSet: """Approval request view set""" def get_permissions(self): """Get permissions""" if self.request.method == 'GET': return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToRetrieveApprovalRequest()) elif self.request.method == 'POST'...
the_stack_v2_python_sparse
membership/views.py
810Teams/clubs-and-events-backend
train
3
12938724e950f05f0bd0b87dfab8c700b0c916b5
[ "assert 0 <= start < n and 0 <= end < n\nself._n = n\nself._start = start\nself._end = end\nself._edges: List['Edge'] = []\nself._reGraph: List[List[int]] = [[] for _ in range(n)]\nself._dist = [INF] * n\nself._flow = [0] * n\nself._pre = [-1] * n", "self._edges.append(Edge(fromV, toV, cap, cost, 0))\nself._edges...
<|body_start_0|> assert 0 <= start < n and 0 <= end < n self._n = n self._start = start self._end = end self._edges: List['Edge'] = [] self._reGraph: List[List[int]] = [[] for _ in range(n)] self._dist = [INF] * n self._flow = [0] * n self._pre = [...
最小费用流的复杂度为流量*spfa的复杂度
MinCostMaxFlowEK
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinCostMaxFlowEK: """最小费用流的复杂度为流量*spfa的复杂度""" def __init__(self, n: int, start: int, end: int): """Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点""" <|body_0|> def addEdge(self, fromV: int, toV: int, cap: int, cost: int) -> None: """原边索引为i 反向边索引...
stack_v2_sparse_classes_36k_train_027919
9,685
no_license
[ { "docstring": "Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点", "name": "__init__", "signature": "def __init__(self, n: int, start: int, end: int)" }, { "docstring": "原边索引为i 反向边索引为i^1", "name": "addEdge", "signature": "def addEdge(self, fromV: int, toV: int, cap: int, ...
4
stack_v2_sparse_classes_30k_train_021098
Implement the Python class `MinCostMaxFlowEK` described below. Class description: 最小费用流的复杂度为流量*spfa的复杂度 Method signatures and docstrings: - def __init__(self, n: int, start: int, end: int): Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点 - def addEdge(self, fromV: int, toV: int, cap: int, cost: int) ...
Implement the Python class `MinCostMaxFlowEK` described below. Class description: 最小费用流的复杂度为流量*spfa的复杂度 Method signatures and docstrings: - def __init__(self, n: int, start: int, end: int): Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点 - def addEdge(self, fromV: int, toV: int, cap: int, cost: int) ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class MinCostMaxFlowEK: """最小费用流的复杂度为流量*spfa的复杂度""" def __init__(self, n: int, start: int, end: int): """Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点""" <|body_0|> def addEdge(self, fromV: int, toV: int, cap: int, cost: int) -> None: """原边索引为i 反向边索引...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinCostMaxFlowEK: """最小费用流的复杂度为流量*spfa的复杂度""" def __init__(self, n: int, start: int, end: int): """Args: n (int): 包含虚拟点在内的总点数 start (int): (虚拟)源点 end (int): (虚拟)汇点""" assert 0 <= start < n and 0 <= end < n self._n = n self._start = start self._end = end sel...
the_stack_v2_python_sparse
7_graph/网络流/4-费用流/MinCostMaxFlow.py
981377660LMT/algorithm-study
train
225
c83a126fcf82805e353bec8a36aaa4ac53092571
[ "if graph is None:\n self._qubit_number = 0\n return\nnode_number = len(graph.nodes)\nedge_number = len(graph.edges)\nif node_number < 2 ** 8:\n data_type = numpy.uint8\nelif node_number < 2 ** 16:\n data_type = numpy.uint16\nelse:\n data_type = numpy.uint32\nself._from_arr = numpy.zeros((edge_number...
<|body_start_0|> if graph is None: self._qubit_number = 0 return node_number = len(graph.nodes) edge_number = len(graph.edges) if node_number < 2 ** 8: data_type = numpy.uint8 elif node_number < 2 ** 16: data_type = numpy.uint16 ...
CompressedMultiDiGraph
[ "BSD-3-Clause", "CECILL-B", "MIT", "LicenseRef-scancode-cecill-b-en" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompressedMultiDiGraph: def __init__(self, graph: nx.MultiDiGraph=None) -> None: """Initialise the :py:class:`~.CompressedMultiDiGraph` instance. Instances of :py:class:`~.CompressedMultiDiGraph` are just storing a :py:class:`networkx.MultiDiGraph` in a more memory efficient format. :par...
stack_v2_sparse_classes_36k_train_027920
21,657
permissive
[ { "docstring": "Initialise the :py:class:`~.CompressedMultiDiGraph` instance. Instances of :py:class:`~.CompressedMultiDiGraph` are just storing a :py:class:`networkx.MultiDiGraph` in a more memory efficient format. :param graph: The graph to compress.", "name": "__init__", "signature": "def __init__(se...
3
stack_v2_sparse_classes_30k_train_014620
Implement the Python class `CompressedMultiDiGraph` described below. Class description: Implement the CompressedMultiDiGraph class. Method signatures and docstrings: - def __init__(self, graph: nx.MultiDiGraph=None) -> None: Initialise the :py:class:`~.CompressedMultiDiGraph` instance. Instances of :py:class:`~.Compr...
Implement the Python class `CompressedMultiDiGraph` described below. Class description: Implement the CompressedMultiDiGraph class. Method signatures and docstrings: - def __init__(self, graph: nx.MultiDiGraph=None) -> None: Initialise the :py:class:`~.CompressedMultiDiGraph` instance. Instances of :py:class:`~.Compr...
1e99bd7d3a143a327c3bb92595ea88ec12dbdb89
<|skeleton|> class CompressedMultiDiGraph: def __init__(self, graph: nx.MultiDiGraph=None) -> None: """Initialise the :py:class:`~.CompressedMultiDiGraph` instance. Instances of :py:class:`~.CompressedMultiDiGraph` are just storing a :py:class:`networkx.MultiDiGraph` in a more memory efficient format. :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompressedMultiDiGraph: def __init__(self, graph: nx.MultiDiGraph=None) -> None: """Initialise the :py:class:`~.CompressedMultiDiGraph` instance. Instances of :py:class:`~.CompressedMultiDiGraph` are just storing a :py:class:`networkx.MultiDiGraph` in a more memory efficient format. :param graph: The ...
the_stack_v2_python_sparse
qtoolkit/data_structures/quantum_circuit/quantum_circuit.py
nelimee/qtoolkit
train
4
7d35545b6372aec057a4a78c9d8a50f8c8eacd90
[ "try:\n selectionSortK([1, 2, 3], 2)\nexcept:\n self.fail('Error while calling selectionSortK')", "items = [3, 2, 4, 1, 5]\nselectionSortK(items, 0)\nself.assertEqual(items, [3, 2, 4, 1, 5], 'Calling selectionSortK with K=0 should do nothing!')", "items = [3, 2, 4, 1, 5]\nselectionSortK(items, 0)\nif item...
<|body_start_0|> try: selectionSortK([1, 2, 3], 2) except: self.fail('Error while calling selectionSortK') <|end_body_0|> <|body_start_1|> items = [3, 2, 4, 1, 5] selectionSortK(items, 0) self.assertEqual(items, [3, 2, 4, 1, 5], 'Calling selectionSortK wi...
TestProblem3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestProblem3: def test_API(self): """P3: Sanity Test: Is selectionSortK callable?""" <|body_0|> def test_doNothing(self): """P3: Does sorting the first k elements with k=0 do nothing?""" <|body_1|> def test_severalPasses(self): """P3: Sorting a d...
stack_v2_sparse_classes_36k_train_027921
11,207
no_license
[ { "docstring": "P3: Sanity Test: Is selectionSortK callable?", "name": "test_API", "signature": "def test_API(self)" }, { "docstring": "P3: Does sorting the first k elements with k=0 do nothing?", "name": "test_doNothing", "signature": "def test_doNothing(self)" }, { "docstring":...
4
stack_v2_sparse_classes_30k_train_013236
Implement the Python class `TestProblem3` described below. Class description: Implement the TestProblem3 class. Method signatures and docstrings: - def test_API(self): P3: Sanity Test: Is selectionSortK callable? - def test_doNothing(self): P3: Does sorting the first k elements with k=0 do nothing? - def test_several...
Implement the Python class `TestProblem3` described below. Class description: Implement the TestProblem3 class. Method signatures and docstrings: - def test_API(self): P3: Sanity Test: Is selectionSortK callable? - def test_doNothing(self): P3: Does sorting the first k elements with k=0 do nothing? - def test_several...
d4f32507a5f581ad8ee0ce84e6cd92daac0941d7
<|skeleton|> class TestProblem3: def test_API(self): """P3: Sanity Test: Is selectionSortK callable?""" <|body_0|> def test_doNothing(self): """P3: Does sorting the first k elements with k=0 do nothing?""" <|body_1|> def test_severalPasses(self): """P3: Sorting a d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestProblem3: def test_API(self): """P3: Sanity Test: Is selectionSortK callable?""" try: selectionSortK([1, 2, 3], 2) except: self.fail('Error while calling selectionSortK') def test_doNothing(self): """P3: Does sorting the first k elements with k=...
the_stack_v2_python_sparse
Homework5/hw5_test.py
pillowfication/ECS-32B
train
1
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__()\nself.spherical_cheb = SphericalChebConv(in_channels, out_channels, lap, kernel_size)\nself.batchnorm = nn.BatchNorm1d(out_channels)", "x = self.spherical_cheb(x)\nx = self.batchnorm(x.permute(0, 2, 1))\nx = F.relu(x.permute(0, 2, 1))\nreturn x" ]
<|body_start_0|> super().__init__() self.spherical_cheb = SphericalChebConv(in_channels, out_channels, lap, kernel_size) self.batchnorm = nn.BatchNorm1d(out_channels) <|end_body_0|> <|body_start_1|> x = self.spherical_cheb(x) x = self.batchnorm(x.permute(0, 2, 1)) x = F....
Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation.
SphericalChebBN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphericalChebBN: """Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation.""" def __init__(self, in_channels, out_channels, lap, kernel_size): """Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of c...
stack_v2_sparse_classes_36k_train_027922
41,403
no_license
[ { "docstring": "Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of channels. lap (:obj:`torch.sparse.FloatTensor`): laplacian. kernel_size (int, optional): polynomial degree. Defaults to 3.", "name": "__init__", "signature": "def __init__(self, in_c...
2
stack_v2_sparse_classes_30k_test_000053
Implement the Python class `SphericalChebBN` described below. Class description: Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int): initial n...
Implement the Python class `SphericalChebBN` described below. Class description: Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int): initial n...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class SphericalChebBN: """Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation.""" def __init__(self, in_channels, out_channels, lap, kernel_size): """Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SphericalChebBN: """Building Block with a Chebyshev Convolution, Batchnormalization, and ReLu activation.""" def __init__(self, in_channels, out_channels, lap, kernel_size): """Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of channels. lap ...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
dcb5300b85d0e1bb0c6203782462ce4297bed52f
[ "self.dns_zone_name = dns_zone_name\nself.dns_zone_resolved_vips = dns_zone_resolved_vips\nself.dns_zone_vips = dns_zone_vips", "if dictionary is None:\n return None\ndns_zone_name = dictionary.get('dnsZoneName')\ndns_zone_resolved_vips = dictionary.get('dnsZoneResolvedVips')\ndns_zone_vips = dictionary.get('d...
<|body_start_0|> self.dns_zone_name = dns_zone_name self.dns_zone_resolved_vips = dns_zone_resolved_vips self.dns_zone_vips = dns_zone_vips <|end_body_0|> <|body_start_1|> if dictionary is None: return None dns_zone_name = dictionary.get('dnsZoneName') dns_zo...
Implementation of the 'DnsDelegationZone' model. TODO: type description here. Attributes: dns_zone_name (string): Specifies the dns zone name. dns_zone_resolved_vips (list of string): Specifies list of vips that will be resolved to. dns_zone_vips (list of string): Specifies list of vips part of dns delegation zone.
DnsDelegationZone
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DnsDelegationZone: """Implementation of the 'DnsDelegationZone' model. TODO: type description here. Attributes: dns_zone_name (string): Specifies the dns zone name. dns_zone_resolved_vips (list of string): Specifies list of vips that will be resolved to. dns_zone_vips (list of string): Specifies ...
stack_v2_sparse_classes_36k_train_027923
2,027
permissive
[ { "docstring": "Constructor for the DnsDelegationZone class", "name": "__init__", "signature": "def __init__(self, dns_zone_name=None, dns_zone_resolved_vips=None, dns_zone_vips=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A diction...
2
stack_v2_sparse_classes_30k_train_004812
Implement the Python class `DnsDelegationZone` described below. Class description: Implementation of the 'DnsDelegationZone' model. TODO: type description here. Attributes: dns_zone_name (string): Specifies the dns zone name. dns_zone_resolved_vips (list of string): Specifies list of vips that will be resolved to. dns...
Implement the Python class `DnsDelegationZone` described below. Class description: Implementation of the 'DnsDelegationZone' model. TODO: type description here. Attributes: dns_zone_name (string): Specifies the dns zone name. dns_zone_resolved_vips (list of string): Specifies list of vips that will be resolved to. dns...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DnsDelegationZone: """Implementation of the 'DnsDelegationZone' model. TODO: type description here. Attributes: dns_zone_name (string): Specifies the dns zone name. dns_zone_resolved_vips (list of string): Specifies list of vips that will be resolved to. dns_zone_vips (list of string): Specifies ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DnsDelegationZone: """Implementation of the 'DnsDelegationZone' model. TODO: type description here. Attributes: dns_zone_name (string): Specifies the dns zone name. dns_zone_resolved_vips (list of string): Specifies list of vips that will be resolved to. dns_zone_vips (list of string): Specifies list of vips ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/dns_delegation_zone.py
cohesity/management-sdk-python
train
24
13f5823748aebb5abf21dd55f4d960ce70ecc4d3
[ "self.Bs = sy.symbols('Bx, By, Bz')\nself.εs = sy.symbols('εxx, εyy, εzz, εyz, εzx, εxy')\nself.indepvars = {s.name: s for s in self.Bs + self.εs}\nself.es = tuple((symutil.make_function(name, *self.εs) for name in ('exx', 'eyy', 'ezz', 'eyz', 'ezx', 'exy')))", "invalid_inputs = [q for q in qs if q not in self.in...
<|body_start_0|> self.Bs = sy.symbols('Bx, By, Bz') self.εs = sy.symbols('εxx, εyy, εzz, εyz, εzx, εxy') self.indepvars = {s.name: s for s in self.Bs + self.εs} self.es = tuple((symutil.make_function(name, *self.εs) for name in ('exx', 'eyy', 'ezz', 'eyz', 'ezx', 'exy'))) <|end_body_0|> ...
Abstract base class for scalar potential models using (B, ε).
PotentialModelBase
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PotentialModelBase: """Abstract base class for scalar potential models using (B, ε).""" def __init__(self): """Constructor. Sets up the independent variables B, ε, and the deviatoric strain e = e(ε).""" <|body_0|> def dφdq(self, qs, strip): """Differentiate the p...
stack_v2_sparse_classes_36k_train_027924
8,995
permissive
[ { "docstring": "Constructor. Sets up the independent variables B, ε, and the deviatoric strain e = e(ε).", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Differentiate the potential ϕ w.r.t. given independent variables. self.indepvars.keys() contains all valid independe...
4
stack_v2_sparse_classes_30k_train_020001
Implement the Python class `PotentialModelBase` described below. Class description: Abstract base class for scalar potential models using (B, ε). Method signatures and docstrings: - def __init__(self): Constructor. Sets up the independent variables B, ε, and the deviatoric strain e = e(ε). - def dφdq(self, qs, strip)...
Implement the Python class `PotentialModelBase` described below. Class description: Abstract base class for scalar potential models using (B, ε). Method signatures and docstrings: - def __init__(self): Constructor. Sets up the independent variables B, ε, and the deviatoric strain e = e(ε). - def dφdq(self, qs, strip)...
02d97557e08cbeb3d53470934f471a6ede723570
<|skeleton|> class PotentialModelBase: """Abstract base class for scalar potential models using (B, ε).""" def __init__(self): """Constructor. Sets up the independent variables B, ε, and the deviatoric strain e = e(ε).""" <|body_0|> def dφdq(self, qs, strip): """Differentiate the p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PotentialModelBase: """Abstract base class for scalar potential models using (B, ε).""" def __init__(self): """Constructor. Sets up the independent variables B, ε, and the deviatoric strain e = e(ε).""" self.Bs = sy.symbols('Bx, By, Bz') self.εs = sy.symbols('εxx, εyy, εzz, εyz, ε...
the_stack_v2_python_sparse
potentialmodelbase.py
TUTElectromechanics/mm-codegen
train
2
67da3ff5c04017f44933a0b9bb063363b03f96bc
[ "self.created_time_msecs = created_time_msecs\nself.description = description\nself.domain = domain\nself.is_smb_principal_only = is_smb_principal_only\nself.last_updated_time_msecs = last_updated_time_msecs\nself.name = name\nself.restricted = restricted\nself.roles = roles\nself.sid = sid\nself.smb_principals = s...
<|body_start_0|> self.created_time_msecs = created_time_msecs self.description = description self.domain = domain self.is_smb_principal_only = is_smb_principal_only self.last_updated_time_msecs = last_updated_time_msecs self.name = name self.restricted = restricte...
Implementation of the 'Group Details.' model. Specifies details about the group. Attributes: created_time_msecs (long|int): Specifies the epoch time in milliseconds when the group was created/added. description (string): Specifies a description of the group. domain (string): Specifies the domain of the group. is_smb_pr...
GroupDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupDetails: """Implementation of the 'Group Details.' model. Specifies details about the group. Attributes: created_time_msecs (long|int): Specifies the epoch time in milliseconds when the group was created/added. description (string): Specifies a description of the group. domain (string): Spec...
stack_v2_sparse_classes_36k_train_027925
5,298
permissive
[ { "docstring": "Constructor for the GroupDetails class", "name": "__init__", "signature": "def __init__(self, created_time_msecs=None, description=None, domain=None, is_smb_principal_only=None, last_updated_time_msecs=None, name=None, restricted=None, roles=None, sid=None, smb_principals=None, tenant_id...
2
stack_v2_sparse_classes_30k_train_017294
Implement the Python class `GroupDetails` described below. Class description: Implementation of the 'Group Details.' model. Specifies details about the group. Attributes: created_time_msecs (long|int): Specifies the epoch time in milliseconds when the group was created/added. description (string): Specifies a descript...
Implement the Python class `GroupDetails` described below. Class description: Implementation of the 'Group Details.' model. Specifies details about the group. Attributes: created_time_msecs (long|int): Specifies the epoch time in milliseconds when the group was created/added. description (string): Specifies a descript...
07c5adee58810979780679065250d82b4b2cdaab
<|skeleton|> class GroupDetails: """Implementation of the 'Group Details.' model. Specifies details about the group. Attributes: created_time_msecs (long|int): Specifies the epoch time in milliseconds when the group was created/added. description (string): Specifies a description of the group. domain (string): Spec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupDetails: """Implementation of the 'Group Details.' model. Specifies details about the group. Attributes: created_time_msecs (long|int): Specifies the epoch time in milliseconds when the group was created/added. description (string): Specifies a description of the group. domain (string): Specifies the dom...
the_stack_v2_python_sparse
cohesity_management_sdk/models/group_details.py
hemanshu-cohesity/management-sdk-python
train
0
4e2c01b0300565f53599bd4510f45f85c9259844
[ "with self.get('/v3/result/list') as res:\n code, body = (res.status, res.read())\n if code != 200:\n self.raise_error('List result table failed', res, body)\n js = self.checked_json(body, ['results'])\n return [(m['name'], m['url'], None) for m in js['results']]", "params = {} if params is Non...
<|body_start_0|> with self.get('/v3/result/list') as res: code, body = (res.status, res.read()) if code != 200: self.raise_error('List result table failed', res, body) js = self.checked_json(body, ['results']) return [(m['name'], m['url'], None) fo...
Access to Result API. This class is inherited by :class:`tdclient.api.API`.
ResultAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultAPI: """Access to Result API. This class is inherited by :class:`tdclient.api.API`.""" def list_result(self): """Get the list of all the available authentications. Returns: [(str, str, None)]: The list of tuple of name, Result output url, and organization name (always `None` fo...
stack_v2_sparse_classes_36k_train_027926
2,057
permissive
[ { "docstring": "Get the list of all the available authentications. Returns: [(str, str, None)]: The list of tuple of name, Result output url, and organization name (always `None` for api compatibility).", "name": "list_result", "signature": "def list_result(self)" }, { "docstring": "Create a new...
3
stack_v2_sparse_classes_30k_train_009167
Implement the Python class `ResultAPI` described below. Class description: Access to Result API. This class is inherited by :class:`tdclient.api.API`. Method signatures and docstrings: - def list_result(self): Get the list of all the available authentications. Returns: [(str, str, None)]: The list of tuple of name, R...
Implement the Python class `ResultAPI` described below. Class description: Access to Result API. This class is inherited by :class:`tdclient.api.API`. Method signatures and docstrings: - def list_result(self): Get the list of all the available authentications. Returns: [(str, str, None)]: The list of tuple of name, R...
aa6b1ffe886483cf4a41557d7e72063e49d6c787
<|skeleton|> class ResultAPI: """Access to Result API. This class is inherited by :class:`tdclient.api.API`.""" def list_result(self): """Get the list of all the available authentications. Returns: [(str, str, None)]: The list of tuple of name, Result output url, and organization name (always `None` fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResultAPI: """Access to Result API. This class is inherited by :class:`tdclient.api.API`.""" def list_result(self): """Get the list of all the available authentications. Returns: [(str, str, None)]: The list of tuple of name, Result output url, and organization name (always `None` for api compati...
the_stack_v2_python_sparse
tdclient/result_api.py
treasure-data/td-client-python
train
41
4c3e7c1c506846526fae1eaf40a41ea97df90015
[ "self.tweetlib = []\nself.size = 0\nself.follows = {}\nself.user = set()", "if userId not in self.user:\n self.user.add(userId)\n self.follows[userId] = set()\nself.tweetlib.append((userId, tweetId))\nself.size += 1\nreturn None", "if userId not in self.user:\n return []\nfollows = self.follows[userId]...
<|body_start_0|> self.tweetlib = [] self.size = 0 self.follows = {} self.user = set() <|end_body_0|> <|body_start_1|> if userId not in self.user: self.user.add(userId) self.follows[userId] = set() self.tweetlib.append((userId, tweetId)) se...
Twitter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int) -> List[int]: """Retrieve the 10 m...
stack_v2_sparse_classes_36k_train_027927
2,177
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compose a new tweet.", "name": "postTweet", "signature": "def postTweet(self, userId: int, tweetId: int) -> None" }, { "docstring": "Retrieve the 10 mos...
5
null
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int) -> List...
Implement the Python class `Twitter` described below. Class description: Implement the Twitter class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def postTweet(self, userId: int, tweetId: int) -> None: Compose a new tweet. - def getNewsFeed(self, userId: int) -> List...
f8ca46afdfbd67509dde63e9cdc5fd178b6f111b
<|skeleton|> class Twitter: def __init__(self): """Initialize your data structure here.""" <|body_0|> def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" <|body_1|> def getNewsFeed(self, userId: int) -> List[int]: """Retrieve the 10 m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Twitter: def __init__(self): """Initialize your data structure here.""" self.tweetlib = [] self.size = 0 self.follows = {} self.user = set() def postTweet(self, userId: int, tweetId: int) -> None: """Compose a new tweet.""" if userId not in self.use...
the_stack_v2_python_sparse
355. Design Twitter.py
alankrit03/LeetCode_Solutions
train
1
a9350fc02b9f84df6da085302526d76ea8656ae5
[ "self.model = models\nself.eval_dataset = eval_dataset\nself.steps_loss = steploss", "cb_params = run_context.original_args()\ncur_epoch = cb_params.cur_epoch_num\ncur_step = (cur_epoch - 1) * 1875 + cb_params.cur_step_num\nself.steps_loss['loss_value'].append(str(cb_params.net_outputs))\nself.steps_loss['step']....
<|body_start_0|> self.model = models self.eval_dataset = eval_dataset self.steps_loss = steploss <|end_body_0|> <|body_start_1|> cb_params = run_context.original_args() cur_epoch = cb_params.cur_epoch_num cur_step = (cur_epoch - 1) * 1875 + cb_params.cur_step_num ...
custom callback function
StepLossAccInfo
[ "Apache-2.0", "Libpng", "LGPL-3.0-only", "AGPL-3.0-only", "MPL-1.1", "BSD-3-Clause-Open-MPI", "LicenseRef-scancode-mit-nagy", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-python-cwi", "LGPL-2.1-only", "OpenSSL", "LicenseRef-scanco...
stack_v2_sparse_python_classes_v1
<|skeleton|> class StepLossAccInfo: """custom callback function""" def __init__(self, models, eval_dataset, steploss): """init model""" <|body_0|> def step_end(self, run_context): """step end""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.model = models ...
stack_v2_sparse_classes_36k_train_027928
4,582
permissive
[ { "docstring": "init model", "name": "__init__", "signature": "def __init__(self, models, eval_dataset, steploss)" }, { "docstring": "step end", "name": "step_end", "signature": "def step_end(self, run_context)" } ]
2
null
Implement the Python class `StepLossAccInfo` described below. Class description: custom callback function Method signatures and docstrings: - def __init__(self, models, eval_dataset, steploss): init model - def step_end(self, run_context): step end
Implement the Python class `StepLossAccInfo` described below. Class description: custom callback function Method signatures and docstrings: - def __init__(self, models, eval_dataset, steploss): init model - def step_end(self, run_context): step end <|skeleton|> class StepLossAccInfo: """custom callback function"...
9ec8bc233c76c9903a2f7be5dfc134992e4bf757
<|skeleton|> class StepLossAccInfo: """custom callback function""" def __init__(self, models, eval_dataset, steploss): """init model""" <|body_0|> def step_end(self, run_context): """step end""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StepLossAccInfo: """custom callback function""" def __init__(self, models, eval_dataset, steploss): """init model""" self.model = models self.eval_dataset = eval_dataset self.steps_loss = steploss def step_end(self, run_context): """step end""" cb_para...
the_stack_v2_python_sparse
model_zoo/research/hpc/sponge/train_mdnn.py
Ming-blue/mindspore
train
1
e5052b3e8de9ce4477920d5e426c0fa347c0468f
[ "self.config = config\nself.model = VBCAR(config['model'])\nuser_fea = torch.tensor(config['user_fea'], requires_grad=False, device=config['model']['device_str'], dtype=torch.float32)\nitem_fea = torch.tensor(config['item_fea'], requires_grad=False, device=config['model']['device_str'], dtype=torch.float32)\nself.m...
<|body_start_0|> self.config = config self.model = VBCAR(config['model']) user_fea = torch.tensor(config['user_fea'], requires_grad=False, device=config['model']['device_str'], dtype=torch.float32) item_fea = torch.tensor(config['item_fea'], requires_grad=False, device=config['model']['d...
Engine for training & evaluating GMF model.
VBCAREngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VBCAREngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize VBCAREngine Class.""" <|body_0|> def train_single_batch(self, batch_data, ratings=None): """Train the model in a single batch.""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_027929
11,137
permissive
[ { "docstring": "Initialize VBCAREngine Class.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Train the model in a single batch.", "name": "train_single_batch", "signature": "def train_single_batch(self, batch_data, ratings=None)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_011277
Implement the Python class `VBCAREngine` described below. Class description: Engine for training & evaluating GMF model. Method signatures and docstrings: - def __init__(self, config): Initialize VBCAREngine Class. - def train_single_batch(self, batch_data, ratings=None): Train the model in a single batch. - def trai...
Implement the Python class `VBCAREngine` described below. Class description: Engine for training & evaluating GMF model. Method signatures and docstrings: - def __init__(self, config): Initialize VBCAREngine Class. - def train_single_batch(self, batch_data, ratings=None): Train the model in a single batch. - def trai...
625189d5e1002a3edc27c3e3ce075fddf7ae1c92
<|skeleton|> class VBCAREngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize VBCAREngine Class.""" <|body_0|> def train_single_batch(self, batch_data, ratings=None): """Train the model in a single batch.""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VBCAREngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize VBCAREngine Class.""" self.config = config self.model = VBCAR(config['model']) user_fea = torch.tensor(config['user_fea'], requires_grad=False, device=config['model']['...
the_stack_v2_python_sparse
beta_rec/models/vbcar.py
beta-team/beta-recsys
train
156
d8d60c8924f65dfd9c30068aeb5530f2b7bba38b
[ "super(RNNDecoder, self).__init__()\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(vocab)", "attention = SelfAttention(s_prev.shape[1])\ncontext, ...
<|body_start_0|> super(RNNDecoder, self).__init__() self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) self.F = tf.keras.layers.Dense(vocab) <|end_body_0|> <...
Class RNNDecoder to decode for machine translation
RNNDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDecoder: """Class RNNDecoder to decode for machine translation""" def __init__(self, vocab, embedding, units, batch): """Class constructor Arguments: - vocab is an integer representing the size of the output vocabulary - embedding is an integer representing the dimensionality of t...
stack_v2_sparse_classes_36k_train_027930
2,681
no_license
[ { "docstring": "Class constructor Arguments: - vocab is an integer representing the size of the output vocabulary - embedding is an integer representing the dimensionality of the embedding vector - units is an integer representing the number of hidden units in the RNN cell - batch is an integer representing the...
2
stack_v2_sparse_classes_30k_train_010279
Implement the Python class `RNNDecoder` described below. Class description: Class RNNDecoder to decode for machine translation Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Class constructor Arguments: - vocab is an integer representing the size of the output vocabulary - emb...
Implement the Python class `RNNDecoder` described below. Class description: Class RNNDecoder to decode for machine translation Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Class constructor Arguments: - vocab is an integer representing the size of the output vocabulary - emb...
fc2cec306961f7ca2448965ddd3a2f656bbe10c7
<|skeleton|> class RNNDecoder: """Class RNNDecoder to decode for machine translation""" def __init__(self, vocab, embedding, units, batch): """Class constructor Arguments: - vocab is an integer representing the size of the output vocabulary - embedding is an integer representing the dimensionality of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNDecoder: """Class RNNDecoder to decode for machine translation""" def __init__(self, vocab, embedding, units, batch): """Class constructor Arguments: - vocab is an integer representing the size of the output vocabulary - embedding is an integer representing the dimensionality of the embedding ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/2-rnn_decoder.py
dalexach/holbertonschool-machine_learning
train
2
7f4d3dfb3b903db4bf4eca0db4759fb90b73db04
[ "mock_class_node_1 = create_mock_java_class(targets=[self.TEST_TARGET1])\nmock_class_node_2 = create_mock_java_class(targets=[self.TEST_TARGET1])\nmock_class_node_3 = create_mock_java_class(targets=[self.TEST_TARGET2])\nmock_class_graph = unittest.mock.Mock()\nmock_class_graph.nodes = [mock_class_node_1, mock_class...
<|body_start_0|> mock_class_node_1 = create_mock_java_class(targets=[self.TEST_TARGET1]) mock_class_node_2 = create_mock_java_class(targets=[self.TEST_TARGET1]) mock_class_node_3 = create_mock_java_class(targets=[self.TEST_TARGET2]) mock_class_graph = unittest.mock.Mock() mock_cl...
Unit tests for JavaTargetDependencyGraph. Full name: dependency_analysis.class_dependency.JavaTargetDependencyGraph.
TestJavaTargetDependencyGraph
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestJavaTargetDependencyGraph: """Unit tests for JavaTargetDependencyGraph. Full name: dependency_analysis.class_dependency.JavaTargetDependencyGraph.""" def test_initialization(self): """Tests that initialization collapses a class dependency graph.""" <|body_0|> def tes...
stack_v2_sparse_classes_36k_train_027931
6,462
permissive
[ { "docstring": "Tests that initialization collapses a class dependency graph.", "name": "test_initialization", "signature": "def test_initialization(self)" }, { "docstring": "Tests that a target with no external dependencies is included.", "name": "test_initialization_no_dependencies", "...
5
null
Implement the Python class `TestJavaTargetDependencyGraph` described below. Class description: Unit tests for JavaTargetDependencyGraph. Full name: dependency_analysis.class_dependency.JavaTargetDependencyGraph. Method signatures and docstrings: - def test_initialization(self): Tests that initialization collapses a c...
Implement the Python class `TestJavaTargetDependencyGraph` described below. Class description: Unit tests for JavaTargetDependencyGraph. Full name: dependency_analysis.class_dependency.JavaTargetDependencyGraph. Method signatures and docstrings: - def test_initialization(self): Tests that initialization collapses a c...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class TestJavaTargetDependencyGraph: """Unit tests for JavaTargetDependencyGraph. Full name: dependency_analysis.class_dependency.JavaTargetDependencyGraph.""" def test_initialization(self): """Tests that initialization collapses a class dependency graph.""" <|body_0|> def tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestJavaTargetDependencyGraph: """Unit tests for JavaTargetDependencyGraph. Full name: dependency_analysis.class_dependency.JavaTargetDependencyGraph.""" def test_initialization(self): """Tests that initialization collapses a class dependency graph.""" mock_class_node_1 = create_mock_java...
the_stack_v2_python_sparse
tools/android/dependency_analysis/target_dependency_unittest.py
chromium/chromium
train
17,408
534c4bd071961026b8b0922fdd3741cf27fc9872
[ "self.location = os.getenv('SLAM_LOCATION')\nself.username = os.getenv('SLAM_USERNAME')\nself.password = os.getenv('SLAM_PASSWORD')\nif os.getenv('SLAM_SSL_VERIFY') is not None and (not strtobool(os.getenv('SLAM_SSL_VERIFY'))):\n self.verify = False\nelse:\n self.verify = True\nif self.location is None:\n ...
<|body_start_0|> self.location = os.getenv('SLAM_LOCATION') self.username = os.getenv('SLAM_USERNAME') self.password = os.getenv('SLAM_PASSWORD') if os.getenv('SLAM_SSL_VERIFY') is not None and (not strtobool(os.getenv('SLAM_SSL_VERIFY'))): self.verify = False else: ...
Class config provide specific installation information
SlamAPIController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlamAPIController: """Class config provide specific installation information""" def __init__(self): """Define some default value""" <|body_0|> def login(self): """This method is used to signin slam-v2 REST api.""" <|body_1|> def get(self, plugin, ite...
stack_v2_sparse_classes_36k_train_027932
6,947
no_license
[ { "docstring": "Define some default value", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This method is used to signin slam-v2 REST api.", "name": "login", "signature": "def login(self)" }, { "docstring": "A standard way to retrieve all element into a ...
6
stack_v2_sparse_classes_30k_test_000749
Implement the Python class `SlamAPIController` described below. Class description: Class config provide specific installation information Method signatures and docstrings: - def __init__(self): Define some default value - def login(self): This method is used to signin slam-v2 REST api. - def get(self, plugin, item=No...
Implement the Python class `SlamAPIController` described below. Class description: Class config provide specific installation information Method signatures and docstrings: - def __init__(self): Define some default value - def login(self): This method is used to signin slam-v2 REST api. - def get(self, plugin, item=No...
4ddf6c603fd8e4d555d8e69203ae8e9837d85896
<|skeleton|> class SlamAPIController: """Class config provide specific installation information""" def __init__(self): """Define some default value""" <|body_0|> def login(self): """This method is used to signin slam-v2 REST api.""" <|body_1|> def get(self, plugin, ite...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlamAPIController: """Class config provide specific installation information""" def __init__(self): """Define some default value""" self.location = os.getenv('SLAM_LOCATION') self.username = os.getenv('SLAM_USERNAME') self.password = os.getenv('SLAM_PASSWORD') if o...
the_stack_v2_python_sparse
core/api.py
guillaume-philippon/slam-v2-cli
train
0
a45bd42e3b29a6af758443782d1d7d411982823b
[ "super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "...
<|body_start_0|> super(Decoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(target_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)] ...
Decoder class for machine translation
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decoder class for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([type]):...
stack_v2_sparse_classes_36k_train_027933
12,086
no_license
[ { "docstring": "[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([type]): [description] max_seq_len ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.", "name": "__init__", "signa...
2
stack_v2_sparse_classes_30k_train_009972
Implement the Python class `Decoder` described below. Class description: Decoder class for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [descripti...
Implement the Python class `Decoder` described below. Class description: Decoder class for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [descripti...
5f86dee95f4d1c32014d0d74a368f342ff3ce6f7
<|skeleton|> class Decoder: """Decoder class for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([type]):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """Decoder class for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([type]): [description...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
d1sd41n/holbertonschool-machine_learning
train
0
2ef5478f033fe7179f5043f4b05bafc011b55153
[ "options = super()._default_options()\noptions.plotter.set_figure_options(xlabel='Delay', ylabel='P(0)', xval_unit='s')\noptions.data_processor = DataProcessor(input_key='counts', data_actions=[Probability(outcome='0')])\noptions.bounds = {'amp': (0.0, 1.0), 'tau': (0.0, np.inf), 'base': (0.0, 1.0)}\noptions.result...
<|body_start_0|> options = super()._default_options() options.plotter.set_figure_options(xlabel='Delay', ylabel='P(0)', xval_unit='s') options.data_processor = DataProcessor(input_key='counts', data_actions=[Probability(outcome='0')]) options.bounds = {'amp': (0.0, 1.0), 'tau': (0.0, np....
A class to analyze T2Hahn experiments.
T2HahnAnalysis
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class T2HahnAnalysis: """A class to analyze T2Hahn experiments.""" def _default_options(cls) -> Options: """Default analysis options.""" <|body_0|> def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: """Algorithmic criteria for whether the ...
stack_v2_sparse_classes_36k_train_027934
2,515
permissive
[ { "docstring": "Default analysis options.", "name": "_default_options", "signature": "def _default_options(cls) -> Options" }, { "docstring": "Algorithmic criteria for whether the fit is good or bad. A good fit has: - a reduced chi-squared lower than three - absolute amp is within [0.4, 0.6] - b...
2
stack_v2_sparse_classes_30k_train_018140
Implement the Python class `T2HahnAnalysis` described below. Class description: A class to analyze T2Hahn experiments. Method signatures and docstrings: - def _default_options(cls) -> Options: Default analysis options. - def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: Algorithmic crit...
Implement the Python class `T2HahnAnalysis` described below. Class description: A class to analyze T2Hahn experiments. Method signatures and docstrings: - def _default_options(cls) -> Options: Default analysis options. - def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: Algorithmic crit...
a387675a3fe817cef05b968bbf3e05799a09aaae
<|skeleton|> class T2HahnAnalysis: """A class to analyze T2Hahn experiments.""" def _default_options(cls) -> Options: """Default analysis options.""" <|body_0|> def _evaluate_quality(self, fit_data: curve.CurveFitResult) -> Union[str, None]: """Algorithmic criteria for whether the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class T2HahnAnalysis: """A class to analyze T2Hahn experiments.""" def _default_options(cls) -> Options: """Default analysis options.""" options = super()._default_options() options.plotter.set_figure_options(xlabel='Delay', ylabel='P(0)', xval_unit='s') options.data_processor =...
the_stack_v2_python_sparse
qiskit_experiments/library/characterization/analysis/t2hahn_analysis.py
oliverdial/qiskit-experiments
train
0
9ef5e4d79b68d360745e38beee748a1e938f098f
[ "self.__encryptor = encryptor\nself.__registry = {}\nself.__exclusion = deque(maxlen=settings.Message.ExclusionLength)", "def _wrapper(function: Callable[[Any], Tuple[str, dict]]) -> Callable:\n self.__registry.update({typing: function})\nreturn _wrapper", "encrypted, message = url.verify(self.__encryptor, p...
<|body_start_0|> self.__encryptor = encryptor self.__registry = {} self.__exclusion = deque(maxlen=settings.Message.ExclusionLength) <|end_body_0|> <|body_start_1|> def _wrapper(function: Callable[[Any], Tuple[str, dict]]) -> Callable: self.__registry.update({typing: functio...
消息回复管理器: register - 注册消息回复函数 reply - 对给定的包进行回复(包含加/解密流程)
Message
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: """消息回复管理器: register - 注册消息回复函数 reply - 对给定的包进行回复(包含加/解密流程)""" def __init__(self, encryptor: Encrypt): """初始化一个消息回复管理器 以消息类型到用于处理消息函数的映射""" <|body_0|> def register(self, typing: str) -> Callable: """注册一种消息的回复函数 在微信发来的消息字段 MsgType 中定义的 字段参数不区分大小写, 调用示例: @...
stack_v2_sparse_classes_36k_train_027935
3,843
permissive
[ { "docstring": "初始化一个消息回复管理器 以消息类型到用于处理消息函数的映射", "name": "__init__", "signature": "def __init__(self, encryptor: Encrypt)" }, { "docstring": "注册一种消息的回复函数 在微信发来的消息字段 MsgType 中定义的 字段参数不区分大小写, 调用示例: @weixin.reply.register(\"text\") def text_reply(**kwargs): # 返回一样字符串 content = kwargs.get(\"content\...
3
stack_v2_sparse_classes_30k_test_000069
Implement the Python class `Message` described below. Class description: 消息回复管理器: register - 注册消息回复函数 reply - 对给定的包进行回复(包含加/解密流程) Method signatures and docstrings: - def __init__(self, encryptor: Encrypt): 初始化一个消息回复管理器 以消息类型到用于处理消息函数的映射 - def register(self, typing: str) -> Callable: 注册一种消息的回复函数 在微信发来的消息字段 MsgType 中定义...
Implement the Python class `Message` described below. Class description: 消息回复管理器: register - 注册消息回复函数 reply - 对给定的包进行回复(包含加/解密流程) Method signatures and docstrings: - def __init__(self, encryptor: Encrypt): 初始化一个消息回复管理器 以消息类型到用于处理消息函数的映射 - def register(self, typing: str) -> Callable: 注册一种消息的回复函数 在微信发来的消息字段 MsgType 中定义...
79e34f4b8fba8c6fd208b5a3049103dca2064ab5
<|skeleton|> class Message: """消息回复管理器: register - 注册消息回复函数 reply - 对给定的包进行回复(包含加/解密流程)""" def __init__(self, encryptor: Encrypt): """初始化一个消息回复管理器 以消息类型到用于处理消息函数的映射""" <|body_0|> def register(self, typing: str) -> Callable: """注册一种消息的回复函数 在微信发来的消息字段 MsgType 中定义的 字段参数不区分大小写, 调用示例: @...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Message: """消息回复管理器: register - 注册消息回复函数 reply - 对给定的包进行回复(包含加/解密流程)""" def __init__(self, encryptor: Encrypt): """初始化一个消息回复管理器 以消息类型到用于处理消息函数的映射""" self.__encryptor = encryptor self.__registry = {} self.__exclusion = deque(maxlen=settings.Message.ExclusionLength) def...
the_stack_v2_python_sparse
leaf/weixin/reply/message.py
guiqiqi/leaf
train
122
4f9c35d8881b7cd091baa7529122de4674195193
[ "base_params = super(Thompson2003Spatial, self).get_default_params()\nparams = {'radius': None, 'dropout': None, 'retinotopy': Curcio1990Map()}\nreturn {**base_params, **params}", "if not np.allclose([e.z for e in earray.electrode_objects], 0):\n msg = 'Nonzero electrode-retina distances do not have any effect...
<|body_start_0|> base_params = super(Thompson2003Spatial, self).get_default_params() params = {'radius': None, 'dropout': None, 'retinotopy': Curcio1990Map()} return {**base_params, **params} <|end_body_0|> <|body_start_1|> if not np.allclose([e.z for e in earray.electrode_objects], 0):...
Scoreboard model of [Thompson2003]_ (spatial module only) Implements the scoreboard model described in [Thompson2003]_, where all percepts are circular disks of a given size, and a fraction of electrodes may randomly drop out. .. note :: Use this class if you want to combine the spatial model with a temporal model. Use...
Thompson2003Spatial
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Thompson2003Spatial: """Scoreboard model of [Thompson2003]_ (spatial module only) Implements the scoreboard model described in [Thompson2003]_, where all percepts are circular disks of a given size, and a fraction of electrodes may randomly drop out. .. note :: Use this class if you want to combi...
stack_v2_sparse_classes_36k_train_027936
7,758
permissive
[ { "docstring": "Returns all settable parameters of the model", "name": "get_default_params", "signature": "def get_default_params(self)" }, { "docstring": "Predicts the brightness at spatial locations", "name": "_predict_spatial", "signature": "def _predict_spatial(self, earray, stim)" ...
2
stack_v2_sparse_classes_30k_val_000621
Implement the Python class `Thompson2003Spatial` described below. Class description: Scoreboard model of [Thompson2003]_ (spatial module only) Implements the scoreboard model described in [Thompson2003]_, where all percepts are circular disks of a given size, and a fraction of electrodes may randomly drop out. .. note...
Implement the Python class `Thompson2003Spatial` described below. Class description: Scoreboard model of [Thompson2003]_ (spatial module only) Implements the scoreboard model described in [Thompson2003]_, where all percepts are circular disks of a given size, and a fraction of electrodes may randomly drop out. .. note...
cb5989d134c6a4fed4723d24e0f2872033d2f5d2
<|skeleton|> class Thompson2003Spatial: """Scoreboard model of [Thompson2003]_ (spatial module only) Implements the scoreboard model described in [Thompson2003]_, where all percepts are circular disks of a given size, and a fraction of electrodes may randomly drop out. .. note :: Use this class if you want to combi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Thompson2003Spatial: """Scoreboard model of [Thompson2003]_ (spatial module only) Implements the scoreboard model described in [Thompson2003]_, where all percepts are circular disks of a given size, and a fraction of electrodes may randomly drop out. .. note :: Use this class if you want to combine the spatia...
the_stack_v2_python_sparse
pulse2percept/models/thompson2003.py
pulse2percept/pulse2percept
train
54
b944d90d4784de8c2f92b8ac1bae26e5718db186
[ "super(convEncoderNet, self).__init__()\nif len(in_dim) not in (1, 2, 3):\n raise ValueError('The input dimensions must be (length,) for 1D data and ' + '(height, width) or (height, width, channel) for 2D data')\ndim = 2 if len(in_dim) > 1 else 1\nc = in_dim[-1] if len(in_dim) > 2 else 1\nself.conv = ConvBlock(d...
<|body_start_0|> super(convEncoderNet, self).__init__() if len(in_dim) not in (1, 2, 3): raise ValueError('The input dimensions must be (length,) for 1D data and ' + '(height, width) or (height, width, channel) for 2D data') dim = 2 if len(in_dim) > 1 else 1 c = in_dim[-1] if...
Convolutional encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & translations by default) num_layers: numbe...
convEncoderNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class convEncoderNet: """Convolutional encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & ...
stack_v2_sparse_classes_36k_train_027937
28,462
permissive
[ { "docstring": "Initializes network parameters", "name": "__init__", "signature": "def __init__(self, in_dim: Tuple[int], latent_dim: int=2, num_layers: int=2, hidden_dim: int=32, **kwargs: Union[float, bool]) -> None" }, { "docstring": "Forward pass Args: x: Input tensor with channel (> 1) as t...
2
stack_v2_sparse_classes_30k_train_013172
Implement the Python class `convEncoderNet` described below. Class description: Convolutional encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the...
Implement the Python class `convEncoderNet` described below. Class description: Convolutional encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the...
6d187296074143d017ca8fc60302364cd946b180
<|skeleton|> class convEncoderNet: """Convolutional encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class convEncoderNet: """Convolutional encoder/inference network (for variational autoencoder) Args: in_dim: Input dimensions. For images, it is (height, width) or (height, width, channels). For spectra, it is (length,) latent_dim: number of latent dimensions (the first 3 latent dimensions are angle & translations ...
the_stack_v2_python_sparse
atomai/nets/ed.py
pycroscopy/atomai
train
157
7f5cdaa9916050ab64874a2e2b050855dcc59015
[ "try:\n self.__database_name = 'job_search'\n self.__db = sql.connect('localhost', 'root', pw, self.__database_name)\n self.__cursor = self.__db.cursor()\n self.__default_table = 'pythondeveloperjob'\n self.__defalut_struct = {'id': (int, 0), 'JobTitle': (str, 255), 'CompanyName': (str, 255), 'WorkPo...
<|body_start_0|> try: self.__database_name = 'job_search' self.__db = sql.connect('localhost', 'root', pw, self.__database_name) self.__cursor = self.__db.cursor() self.__default_table = 'pythondeveloperjob' self.__defalut_struct = {'id': (int, 0), 'Jo...
SQL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQL: def __init__(self, pw): """Args: pw:Password, used to connect to the database and handle exceptions.""" <|body_0|> def search(self): """Returns: Return the result of traversal search""" <|body_1|> def insert(self, JobTitle, CompanyName, WorkPosition...
stack_v2_sparse_classes_36k_train_027938
3,761
no_license
[ { "docstring": "Args: pw:Password, used to connect to the database and handle exceptions.", "name": "__init__", "signature": "def __init__(self, pw)" }, { "docstring": "Returns: Return the result of traversal search", "name": "search", "signature": "def search(self)" }, { "docstr...
6
null
Implement the Python class `SQL` described below. Class description: Implement the SQL class. Method signatures and docstrings: - def __init__(self, pw): Args: pw:Password, used to connect to the database and handle exceptions. - def search(self): Returns: Return the result of traversal search - def insert(self, JobT...
Implement the Python class `SQL` described below. Class description: Implement the SQL class. Method signatures and docstrings: - def __init__(self, pw): Args: pw:Password, used to connect to the database and handle exceptions. - def search(self): Returns: Return the result of traversal search - def insert(self, JobT...
9b1a9bbbbe69e14f5e7183ecd301f14b0e34b4b1
<|skeleton|> class SQL: def __init__(self, pw): """Args: pw:Password, used to connect to the database and handle exceptions.""" <|body_0|> def search(self): """Returns: Return the result of traversal search""" <|body_1|> def insert(self, JobTitle, CompanyName, WorkPosition...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQL: def __init__(self, pw): """Args: pw:Password, used to connect to the database and handle exceptions.""" try: self.__database_name = 'job_search' self.__db = sql.connect('localhost', 'root', pw, self.__database_name) self.__cursor = self.__db.cursor() ...
the_stack_v2_python_sparse
exe11/Problem7/findjob_python/findjob_python/sql/jobsql.py
WOWspring/pythonhomework
train
2
fd3d0ba8d599eb853c22977d2a9188b77f086def
[ "assert isinstance(form, MultiForm)\nself._data_dict = dict(columns=normalize_formset_dict(form.columns, ReportDesign._COLUMN_ATTRS))\nself._data_dict['union'] = self._normalize_union_mform(form.union)", "data_dict = dict(bools=normalize_form_dict(union_mform.bool, ReportDesign._BOOL_ATTRS), conds=normalize_forms...
<|body_start_0|> assert isinstance(form, MultiForm) self._data_dict = dict(columns=normalize_formset_dict(form.columns, ReportDesign._COLUMN_ATTRS)) self._data_dict['union'] = self._normalize_union_mform(form.union) <|end_body_0|> <|body_start_1|> data_dict = dict(bools=normalize_form_d...
Represents a report design, with methods to perform (de)serialization.
ReportDesign
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportDesign: """Represents a report design, with methods to perform (de)serialization.""" def __init__(self, form): """Initialize the design from form data. The form may be invalid.""" <|body_0|> def _normalize_union_mform(self, union_mform): """Normalize the su...
stack_v2_sparse_classes_36k_train_027939
4,666
permissive
[ { "docstring": "Initialize the design from form data. The form may be invalid.", "name": "__init__", "signature": "def __init__(self, form)" }, { "docstring": "Normalize the subunions in the MultiForm recursively. Returns a data dict.", "name": "_normalize_union_mform", "signature": "def...
6
stack_v2_sparse_classes_30k_train_009690
Implement the Python class `ReportDesign` described below. Class description: Represents a report design, with methods to perform (de)serialization. Method signatures and docstrings: - def __init__(self, form): Initialize the design from form data. The form may be invalid. - def _normalize_union_mform(self, union_mfo...
Implement the Python class `ReportDesign` described below. Class description: Represents a report design, with methods to perform (de)serialization. Method signatures and docstrings: - def __init__(self, form): Initialize the design from form data. The form may be invalid. - def _normalize_union_mform(self, union_mfo...
82f2de44789ff5a981ed725175bae7944832d1e9
<|skeleton|> class ReportDesign: """Represents a report design, with methods to perform (de)serialization.""" def __init__(self, form): """Initialize the design from form data. The form may be invalid.""" <|body_0|> def _normalize_union_mform(self, union_mform): """Normalize the su...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportDesign: """Represents a report design, with methods to perform (de)serialization.""" def __init__(self, form): """Initialize the design from form data. The form may be invalid.""" assert isinstance(form, MultiForm) self._data_dict = dict(columns=normalize_formset_dict(form.c...
the_stack_v2_python_sparse
apps/beeswax/src/beeswax/report/design.py
civascu/hue
train
0
c841197c500dd1c2fc1e8040b8ef581ff16198b5
[ "self.obj_name = obj.name\nself.obj_hide = obj.hide_get()\nself.obj_hide_viewport = obj.hide_viewport\nself.temp_coll = None\nif not obj.visible_get():\n obj.hide_set(False)\n obj.hide_viewport = False\nif not obj.visible_get():\n active_coll = bpy.context.collection\n coll_name = 'temp_visible'\n te...
<|body_start_0|> self.obj_name = obj.name self.obj_hide = obj.hide_get() self.obj_hide_viewport = obj.hide_viewport self.temp_coll = None if not obj.visible_get(): obj.hide_set(False) obj.hide_viewport = False if not obj.visible_get(): ...
Ensure an object is visible, then reset it to how it was before.
EnsureVisible
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnsureVisible: """Ensure an object is visible, then reset it to how it was before.""" def __init__(self, obj): """Ensure an object is visible, and create this small object to manage that object's visibility-ensured-ness.""" <|body_0|> def restore(self): """Restor...
stack_v2_sparse_classes_36k_train_027940
21,095
no_license
[ { "docstring": "Ensure an object is visible, and create this small object to manage that object's visibility-ensured-ness.", "name": "__init__", "signature": "def __init__(self, obj)" }, { "docstring": "Restore visibility settings to their original state.", "name": "restore", "signature"...
2
stack_v2_sparse_classes_30k_train_017032
Implement the Python class `EnsureVisible` described below. Class description: Ensure an object is visible, then reset it to how it was before. Method signatures and docstrings: - def __init__(self, obj): Ensure an object is visible, and create this small object to manage that object's visibility-ensured-ness. - def ...
Implement the Python class `EnsureVisible` described below. Class description: Ensure an object is visible, then reset it to how it was before. Method signatures and docstrings: - def __init__(self, obj): Ensure an object is visible, and create this small object to manage that object's visibility-ensured-ness. - def ...
5e4e6cf88487a24bd842edda45f7bed5ae2862e3
<|skeleton|> class EnsureVisible: """Ensure an object is visible, then reset it to how it was before.""" def __init__(self, obj): """Ensure an object is visible, and create this small object to manage that object's visibility-ensured-ness.""" <|body_0|> def restore(self): """Restor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnsureVisible: """Ensure an object is visible, then reset it to how it was before.""" def __init__(self, obj): """Ensure an object is visible, and create this small object to manage that object's visibility-ensured-ness.""" self.obj_name = obj.name self.obj_hide = obj.hide_get() ...
the_stack_v2_python_sparse
rigs/cloud_utils.py
intp1/CloudRig
train
0
8debfd1102c21856b970035936380611c8565090
[ "self.rule_spec = line\nself.rules = []\nself.delete_kws = []\nself.section_name = []", "if self.rules:\n return\nirules, sname = interpret_entry(self.rule_spec, hdr)\nif sname:\n self.section_name.append(sname)\nif irules:\n self.rules = irules" ]
<|body_start_0|> self.rule_spec = line self.rules = [] self.delete_kws = [] self.section_name = [] <|end_body_0|> <|body_start_1|> if self.rules: return irules, sname = interpret_entry(self.rule_spec, hdr) if sname: self.section_name.appen...
This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': 'meta.attribute'}} --or-- {'meta.at...
KwRule
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KwRule: """This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': '...
stack_v2_sparse_classes_36k_train_027941
17,429
permissive
[ { "docstring": "Initialize new keyword rule. Parameters ========== line : dict Line should be dict with attribute name as the key, and a dict as the value specifying 'rule' and (optionally)'output'.", "name": "__init__", "signature": "def __init__(self, line)" }, { "docstring": "Use metadata to ...
2
stack_v2_sparse_classes_30k_train_021638
Implement the Python class `KwRule` described below. Class description: This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.att...
Implement the Python class `KwRule` described below. Class description: This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.att...
a4a0e8ad2b88249f01445ee1dcf175229c51033f
<|skeleton|> class KwRule: """This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': '...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KwRule: """This class encapsulates the logic needed for interpreting a single keyword rule from a text file. Notes ----- The ``.rules`` attribute contains the interpreted set of rules that corresponds to this line. Example:: Interpreting rule from {'meta.attribute': { 'rule': 'first', 'output': 'meta.attribut...
the_stack_v2_python_sparse
jwst/model_blender/blendrules.py
spacetelescope/jwst
train
449
74de162db9882c8fc09c6dbaf72cd269c07c063a
[ "res = []\nmin_len_item = min(A, key=len)\nfor char in min_len_item:\n if all((char in i for i in A)):\n res.append(char)\n A = [i.replace(char, '', 1) for i in A]\nreturn res", "from collections import Counter\nans = Counter(A[0])\nfor i in A[1:]:\n ans &= Counter(i)\nreturn list(ans.elements...
<|body_start_0|> res = [] min_len_item = min(A, key=len) for char in min_len_item: if all((char in i for i in A)): res.append(char) A = [i.replace(char, '', 1) for i in A] return res <|end_body_0|> <|body_start_1|> from collections imp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] min_len_item = min(A, key=le...
stack_v2_sparse_classes_36k_train_027942
959
no_license
[ { "docstring": ":type A: List[str] :rtype: List[str]", "name": "commonChars", "signature": "def commonChars(self, A)" }, { "docstring": ":type A: List[str] :rtype: List[str]", "name": "commonChars", "signature": "def commonChars(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars(self, A): :type A: List[str] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars(self, A): :type A: List[str] :rtype: List[str] <|skeleton|> class Solution: def commonChars...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" res = [] min_len_item = min(A, key=len) for char in min_len_item: if all((char in i for i in A)): res.append(char) A = [i.replace(char, '', 1) for i in A] ...
the_stack_v2_python_sparse
1002_Find_Common_Characters.py
bingli8802/leetcode
train
0
9d1c2795f0a9bf3d8a64e65dbf49753e00a56502
[ "username = kwargs.get('username')\nUser = get_user_model()\ntry:\n queryset = User.objects.get(username=username)\nexcept User.DoesNotExist:\n raise Http404\nserializer = UserSerializer(queryset, context={'request': request, 'kwargs': kwargs})\nreturn Response(serializer.data)", "request_user = request.use...
<|body_start_0|> username = kwargs.get('username') User = get_user_model() try: queryset = User.objects.get(username=username) except User.DoesNotExist: raise Http404 serializer = UserSerializer(queryset, context={'request': request, 'kwargs': kwargs}) ...
Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).
UserDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetail: """Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).""" def get(self, request, *args, **kwargs): """Retrieve user information""" <|body_0|> def patch(self, request, *args, **kwargs): """Edit user info...
stack_v2_sparse_classes_36k_train_027943
19,438
no_license
[ { "docstring": "Retrieve user information", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Edit user information", "name": "patch", "signature": "def patch(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_test_000481
Implement the Python class `UserDetail` described below. Class description: Return user information. GET: return user information. PATCH: edit user information( fields: bio, ). Method signatures and docstrings: - def get(self, request, *args, **kwargs): Retrieve user information - def patch(self, request, *args, **kw...
Implement the Python class `UserDetail` described below. Class description: Return user information. GET: return user information. PATCH: edit user information( fields: bio, ). Method signatures and docstrings: - def get(self, request, *args, **kwargs): Retrieve user information - def patch(self, request, *args, **kw...
3e77877d1805ae2b361c9b3f564e73f698a3f4c6
<|skeleton|> class UserDetail: """Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).""" def get(self, request, *args, **kwargs): """Retrieve user information""" <|body_0|> def patch(self, request, *args, **kwargs): """Edit user info...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserDetail: """Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).""" def get(self, request, *args, **kwargs): """Retrieve user information""" username = kwargs.get('username') User = get_user_model() try: querys...
the_stack_v2_python_sparse
api/views.py
zagorboda/django-blog
train
0
2de27d0e7d6c9c9d98a7cd60b719b7a481c87feb
[ "self.uuid = str(uuid4())\nself.wf_meta = {'wf_uuid': self.uuid, 'wf_name': self.__class__.__name__, 'wf_version': __version__}\nordered_structures = [s for _, s in sorted(zip(energies, magnetic_structures), reverse=False)]\nordered_energies = sorted(energies, reverse=False)\nself.structures = ordered_structures\ns...
<|body_start_0|> self.uuid = str(uuid4()) self.wf_meta = {'wf_uuid': self.uuid, 'wf_name': self.__class__.__name__, 'wf_version': __version__} ordered_structures = [s for _, s in sorted(zip(energies, magnetic_structures), reverse=False)] ordered_energies = sorted(energies, reverse=False)...
ExchangeWF
[ "LicenseRef-scancode-hdf5", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExchangeWF: def __init__(self, magnetic_structures, energies, default_magmoms=None, db_file=DB_FILE, name='Exchange WF'): """Workflow for computing exchange parameters. This workflow takes a set of magnetic orderings and their energies from MagneticOrderingsWF and fits to a classical Hei...
stack_v2_sparse_classes_36k_train_027944
4,841
permissive
[ { "docstring": "Workflow for computing exchange parameters. This workflow takes a set of magnetic orderings and their energies from MagneticOrderingsWF and fits to a classical Heisenberg Hamiltonian to compute exchange parameters. The critical temperature can then be calculated with Monte Carlo. Optionally, onl...
2
stack_v2_sparse_classes_30k_train_020696
Implement the Python class `ExchangeWF` described below. Class description: Implement the ExchangeWF class. Method signatures and docstrings: - def __init__(self, magnetic_structures, energies, default_magmoms=None, db_file=DB_FILE, name='Exchange WF'): Workflow for computing exchange parameters. This workflow takes ...
Implement the Python class `ExchangeWF` described below. Class description: Implement the ExchangeWF class. Method signatures and docstrings: - def __init__(self, magnetic_structures, energies, default_magmoms=None, db_file=DB_FILE, name='Exchange WF'): Workflow for computing exchange parameters. This workflow takes ...
f4060e55ae3a22289fde9516ff0e8e4ac1d22190
<|skeleton|> class ExchangeWF: def __init__(self, magnetic_structures, energies, default_magmoms=None, db_file=DB_FILE, name='Exchange WF'): """Workflow for computing exchange parameters. This workflow takes a set of magnetic orderings and their energies from MagneticOrderingsWF and fits to a classical Hei...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExchangeWF: def __init__(self, magnetic_structures, energies, default_magmoms=None, db_file=DB_FILE, name='Exchange WF'): """Workflow for computing exchange parameters. This workflow takes a set of magnetic orderings and their energies from MagneticOrderingsWF and fits to a classical Heisenberg Hamilt...
the_stack_v2_python_sparse
atomate/vasp/workflows/base/exchange.py
hackingmaterials/atomate
train
217
c76832213a8521913e163b0f284e26b9fc1a213d
[ "self.batch_size = 128\nself.vocabulary_size = 200000\nself.embedding_size = 256\nself.num_sampled = 32\nself.learning_rate = 0.5\nself.valid_examples = valid_examples\nself.skipgram()", "tf.reset_default_graph()\nself.train_inputs = tf.placeholder(tf.int32, shape=[self.batch_size])\nself.train_labels = tf.placeh...
<|body_start_0|> self.batch_size = 128 self.vocabulary_size = 200000 self.embedding_size = 256 self.num_sampled = 32 self.learning_rate = 0.5 self.valid_examples = valid_examples self.skipgram() <|end_body_0|> <|body_start_1|> tf.reset_default_graph() ...
This class is created by zhanglei at 2019/06/10. The environment: python3.5 or later and tensorflow1.10 or later. The functions include set parameters,build skipgram model.
SkipgramModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkipgramModel: """This class is created by zhanglei at 2019/06/10. The environment: python3.5 or later and tensorflow1.10 or later. The functions include set parameters,build skipgram model.""" def __init__(self, valid_examples): """skipgram模型相关参数设置,并加载模型""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_027945
11,582
no_license
[ { "docstring": "skipgram模型相关参数设置,并加载模型", "name": "__init__", "signature": "def __init__(self, valid_examples)" }, { "docstring": "skipgram模型结构", "name": "skipgram", "signature": "def skipgram(self)" } ]
2
stack_v2_sparse_classes_30k_train_001894
Implement the Python class `SkipgramModel` described below. Class description: This class is created by zhanglei at 2019/06/10. The environment: python3.5 or later and tensorflow1.10 or later. The functions include set parameters,build skipgram model. Method signatures and docstrings: - def __init__(self, valid_examp...
Implement the Python class `SkipgramModel` described below. Class description: This class is created by zhanglei at 2019/06/10. The environment: python3.5 or later and tensorflow1.10 or later. The functions include set parameters,build skipgram model. Method signatures and docstrings: - def __init__(self, valid_examp...
76d39560d54da322595cc3be06e302ccebb61a3f
<|skeleton|> class SkipgramModel: """This class is created by zhanglei at 2019/06/10. The environment: python3.5 or later and tensorflow1.10 or later. The functions include set parameters,build skipgram model.""" def __init__(self, valid_examples): """skipgram模型相关参数设置,并加载模型""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkipgramModel: """This class is created by zhanglei at 2019/06/10. The environment: python3.5 or later and tensorflow1.10 or later. The functions include set parameters,build skipgram model.""" def __init__(self, valid_examples): """skipgram模型相关参数设置,并加载模型""" self.batch_size = 128 ...
the_stack_v2_python_sparse
src/word_embedding/word2vec/word2vec_tensorflow.py
WallaceLiu/word2vec_learn
train
0
d04078859519e46724648f30515c693a7a9b8e0b
[ "for letter in letters:\n if letter > target:\n return letter\nreturn letters[0]", "lo = 0\nhi = len(letters)\nwhile lo < hi:\n mid = lo + (hi - lo) / 2\n if letters[mid] <= target:\n lo = mid + 1\n else:\n hi = mid\nreturn letters[lo % len(letters)]" ]
<|body_start_0|> for letter in letters: if letter > target: return letter return letters[0] <|end_body_0|> <|body_start_1|> lo = 0 hi = len(letters) while lo < hi: mid = lo + (hi - lo) / 2 if letters[mid] <= target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreatestLetter(self, letters, target): """从头搜到尾 :type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter(self, letters, target): """二分查找 :type letters: List[str] :type target: str :rtype: str""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027946
1,942
no_license
[ { "docstring": "从头搜到尾 :type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter", "signature": "def nextGreatestLetter(self, letters, target)" }, { "docstring": "二分查找 :type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter", "signat...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter(self, letters, target): 从头搜到尾 :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter(self, letters, target): 二分查找 :type letters: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter(self, letters, target): 从头搜到尾 :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter(self, letters, target): 二分查找 :type letters: L...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def nextGreatestLetter(self, letters, target): """从头搜到尾 :type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter(self, letters, target): """二分查找 :type letters: List[str] :type target: str :rtype: str""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextGreatestLetter(self, letters, target): """从头搜到尾 :type letters: List[str] :type target: str :rtype: str""" for letter in letters: if letter > target: return letter return letters[0] def nextGreatestLetter(self, letters, target): ...
the_stack_v2_python_sparse
LeetCode/p0744/I/find-smallest-letter-greater-than-target.py
Ynjxsjmh/PracticeMakesPerfect
train
0
8dec117412f8275c66f7246110daf7d506cf2fcf
[ "DataMatrixGuiXYProbe.__init__(self, plot_title=plot_title, id_is_strain=id_is_strain)\nself.app1.set_title(plot_title)\nself.id2NA_mismatch_rate = id2NA_mismatch_rate\nself.plot_title = plot_title\nself.id2info = id2info\nself.id2index = id2index\nself.id_is_strain = id_is_strain\nself.header = header\nself.strain...
<|body_start_0|> DataMatrixGuiXYProbe.__init__(self, plot_title=plot_title, id_is_strain=id_is_strain) self.app1.set_title(plot_title) self.id2NA_mismatch_rate = id2NA_mismatch_rate self.plot_title = plot_title self.id2info = id2info self.id2index = id2index self....
2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py
QCVisualize
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QCVisualize: """2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py""" def __init__(self, id2NA_mismatch_rate...
stack_v2_sparse_classes_36k_train_027947
3,098
no_license
[ { "docstring": "2008-01-10 use a paned window to wrap the scrolledwindow and the canvas so that the relative size of canvas to the scrolledwindow could be adjusted by the user.", "name": "__init__", "signature": "def __init__(self, id2NA_mismatch_rate, plot_title='', id2info={}, id2index={}, id_is_strai...
2
stack_v2_sparse_classes_30k_train_004946
Implement the Python class `QCVisualize` described below. Class description: 2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py Method...
Implement the Python class `QCVisualize` described below. Class description: 2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py Method...
7b402496aae81665e6a915b5021b94d56e034c9d
<|skeleton|> class QCVisualize: """2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py""" def __init__(self, id2NA_mismatch_rate...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QCVisualize: """2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py""" def __init__(self, id2NA_mismatch_rate, plot_title=...
the_stack_v2_python_sparse
pymodule/trunk/QCVisualize.py
polyactis/repos
train
1
bf80fbf75a5f385eaa84053f0e2be6a0e24067b1
[ "try:\n quiz = Quiz.objects.get(id=pk)\nexcept Quiz.DoesNotExist:\n return InvalidQuizIdResponse\nif quiz.startTime <= timezone.now() <= quiz.endTime:\n if request.query_params.get('picture', False) == 'true':\n questions = Question.objects.filter(quiz_id=quiz)\n else:\n questions = Questi...
<|body_start_0|> try: quiz = Quiz.objects.get(id=pk) except Quiz.DoesNotExist: return InvalidQuizIdResponse if quiz.startTime <= timezone.now() <= quiz.endTime: if request.query_params.get('picture', False) == 'true': questions = Question.objec...
Create Quiz Question
QuestionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionView: """Create Quiz Question""" def get(self, request: Request, pk): """Get Quiz Questions""" <|body_0|> def post(self, request: Request, pk): """Create Quiz Question""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: quiz...
stack_v2_sparse_classes_36k_train_027948
9,462
no_license
[ { "docstring": "Get Quiz Questions", "name": "get", "signature": "def get(self, request: Request, pk)" }, { "docstring": "Create Quiz Question", "name": "post", "signature": "def post(self, request: Request, pk)" } ]
2
stack_v2_sparse_classes_30k_train_021019
Implement the Python class `QuestionView` described below. Class description: Create Quiz Question Method signatures and docstrings: - def get(self, request: Request, pk): Get Quiz Questions - def post(self, request: Request, pk): Create Quiz Question
Implement the Python class `QuestionView` described below. Class description: Create Quiz Question Method signatures and docstrings: - def get(self, request: Request, pk): Get Quiz Questions - def post(self, request: Request, pk): Create Quiz Question <|skeleton|> class QuestionView: """Create Quiz Question""" ...
da6cd01041bc268067295665b3a60fff772be865
<|skeleton|> class QuestionView: """Create Quiz Question""" def get(self, request: Request, pk): """Get Quiz Questions""" <|body_0|> def post(self, request: Request, pk): """Create Quiz Question""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionView: """Create Quiz Question""" def get(self, request: Request, pk): """Get Quiz Questions""" try: quiz = Quiz.objects.get(id=pk) except Quiz.DoesNotExist: return InvalidQuizIdResponse if quiz.startTime <= timezone.now() <= quiz.endTime: ...
the_stack_v2_python_sparse
nimbusBackend/quiz/views.py
moulikbhardwaj/nimbus2021
train
5
38f172223a716786e0022939705daa4506e8a35e
[ "self.res = 0\nself.depth(root)\nreturn self.res", "if not root:\n return 0\nl = self.depth(root.left)\nr = self.depth(root.right)\nself.res = max(self.res, l + r)\nreturn max(l, r) + 1" ]
<|body_start_0|> self.res = 0 self.depth(root) return self.res <|end_body_0|> <|body_start_1|> if not root: return 0 l = self.depth(root.left) r = self.depth(root.right) self.res = max(self.res, l + r) return max(l, r) + 1 <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: """Args: root: TreeNode Return: int""" <|body_0|> def depth(self, root): """Args: root: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.res = 0 self.depth(root) ...
stack_v2_sparse_classes_36k_train_027949
1,547
no_license
[ { "docstring": "Args: root: TreeNode Return: int", "name": "diameterOfBinaryTree", "signature": "def diameterOfBinaryTree(self, root: TreeNode) -> int" }, { "docstring": "Args: root: TreeNode", "name": "depth", "signature": "def depth(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def diameterOfBinaryTree(self, root: TreeNode) -> int: Args: root: TreeNode Return: int - def depth(self, root): Args: root: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def diameterOfBinaryTree(self, root: TreeNode) -> int: Args: root: TreeNode Return: int - def depth(self, root): Args: root: TreeNode <|skeleton|> class Solution: def diame...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: """Args: root: TreeNode Return: int""" <|body_0|> def depth(self, root): """Args: root: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: """Args: root: TreeNode Return: int""" self.res = 0 self.depth(root) return self.res def depth(self, root): """Args: root: TreeNode""" if not root: return 0 l = self.depth(...
the_stack_v2_python_sparse
code/543. 二叉树的直径.py
AiZhanghan/Leetcode
train
0
0c280059abd404e20e5e7206c86152c69d104ce4
[ "super().__init__(name=name)\nself.num_actions = num_actions\nself._width = width\nself._mode = mode\n\ndef _scale_width(n):\n return int(math.ceil(n * width))\nactivation_fn = tf.keras.activations.relu\nself.conv1 = tf.keras.layers.Conv2D(_scale_width(32), [8, 8], strides=4, padding='same', activation=activatio...
<|body_start_0|> super().__init__(name=name) self.num_actions = num_actions self._width = width self._mode = mode def _scale_width(n): return int(math.ceil(n * width)) activation_fn = tf.keras.activations.relu self.conv1 = tf.keras.layers.Conv2D(_scal...
The convolutional network used to compute the agent's Q-values.
NatureDQNNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NatureDQNNetwork: """The convolutional network used to compute the agent's Q-values.""" def __init__(self, num_actions, width=1, mode='dense', name=None): """Creates the layers used for calculating Q-values. Args: num_actions: int, number of actions. width: float, Scales the width of...
stack_v2_sparse_classes_36k_train_027950
18,416
permissive
[ { "docstring": "Creates the layers used for calculating Q-values. Args: num_actions: int, number of actions. width: float, Scales the width of the network uniformly. mode: str, one of LEARNER_MODES. name: str, used to create scope for network parameters.", "name": "__init__", "signature": "def __init__(...
2
stack_v2_sparse_classes_30k_train_001215
Implement the Python class `NatureDQNNetwork` described below. Class description: The convolutional network used to compute the agent's Q-values. Method signatures and docstrings: - def __init__(self, num_actions, width=1, mode='dense', name=None): Creates the layers used for calculating Q-values. Args: num_actions: ...
Implement the Python class `NatureDQNNetwork` described below. Class description: The convolutional network used to compute the agent's Q-values. Method signatures and docstrings: - def __init__(self, num_actions, width=1, mode='dense', name=None): Creates the layers used for calculating Q-values. Args: num_actions: ...
d39fc7d46505cb3196cb1edeb32ed0b6dd44c0f9
<|skeleton|> class NatureDQNNetwork: """The convolutional network used to compute the agent's Q-values.""" def __init__(self, num_actions, width=1, mode='dense', name=None): """Creates the layers used for calculating Q-values. Args: num_actions: int, number of actions. width: float, Scales the width of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NatureDQNNetwork: """The convolutional network used to compute the agent's Q-values.""" def __init__(self, num_actions, width=1, mode='dense', name=None): """Creates the layers used for calculating Q-values. Args: num_actions: int, number of actions. width: float, Scales the width of the network ...
the_stack_v2_python_sparse
rigl/rl/dqn_agents.py
google-research/rigl
train
324
50921705afe1449b9803d8cce99fad166a0d8b40
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsDeviceStartupProcess()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'managedDeviceId': lambda n: setattr(self, 'managed_device_id', n.get_str_value()), 'p...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsDeviceStartupProcess() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = {'m...
The user experience analytics device startup process details.
UserExperienceAnalyticsDeviceStartupProcess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsDeviceStartupProcess: """The user experience analytics device startup process details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDeviceStartupProcess: """Creates a new instance of the appropriate clas...
stack_v2_sparse_classes_36k_train_027951
3,485
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: UserExperienceAnalyticsDeviceStartupProcess", "name": "create_from_discriminator_value", "signature": "def c...
3
null
Implement the Python class `UserExperienceAnalyticsDeviceStartupProcess` described below. Class description: The user experience analytics device startup process details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDeviceStart...
Implement the Python class `UserExperienceAnalyticsDeviceStartupProcess` described below. Class description: The user experience analytics device startup process details. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDeviceStart...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsDeviceStartupProcess: """The user experience analytics device startup process details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDeviceStartupProcess: """Creates a new instance of the appropriate clas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsDeviceStartupProcess: """The user experience analytics device startup process details.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsDeviceStartupProcess: """Creates a new instance of the appropriate class based on di...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_device_startup_process.py
microsoftgraph/msgraph-sdk-python
train
135
05627b09aa732e7847a5642fccca6bafeda7192e
[ "for idx, val in enumerate(lst):\n if value > val and value < lst[idx + 1]:\n ps = tuple((float(p) * max_pts / 10 for p in CalcBase._interval_borders[idx:idx + 2]))\n return ps + lst[idx:idx + 2]", "if value <= lst[0]:\n explanation = _('The value (%s) is equal to or smaller than the first int...
<|body_start_0|> for idx, val in enumerate(lst): if value > val and value < lst[idx + 1]: ps = tuple((float(p) * max_pts / 10 for p in CalcBase._interval_borders[idx:idx + 2])) return ps + lst[idx:idx + 2] <|end_body_0|> <|body_start_1|> if value <= lst[0]: ...
CalcBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalcBase: def get_boundaries(value, lst, max_pts=10): """determines the position of the value in the provided list and returns the matching borders of the points list. p0 represents the lower boundary of the available points. p1 represents the upper boundary of the available points. i0 r...
stack_v2_sparse_classes_36k_train_027952
9,397
permissive
[ { "docstring": "determines the position of the value in the provided list and returns the matching borders of the points list. p0 represents the lower boundary of the available points. p1 represents the upper boundary of the available points. i0 represents the lower boundary of the criteria measure. i1 represen...
2
stack_v2_sparse_classes_30k_train_012886
Implement the Python class `CalcBase` described below. Class description: Implement the CalcBase class. Method signatures and docstrings: - def get_boundaries(value, lst, max_pts=10): determines the position of the value in the provided list and returns the matching borders of the points list. p0 represents the lower...
Implement the Python class `CalcBase` described below. Class description: Implement the CalcBase class. Method signatures and docstrings: - def get_boundaries(value, lst, max_pts=10): determines the position of the value in the provided list and returns the matching borders of the points list. p0 represents the lower...
10b5abcb8f5a47d4ba486b18991ffa13bcf60d8a
<|skeleton|> class CalcBase: def get_boundaries(value, lst, max_pts=10): """determines the position of the value in the provided list and returns the matching borders of the points list. p0 represents the lower boundary of the available points. p1 represents the upper boundary of the available points. i0 r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalcBase: def get_boundaries(value, lst, max_pts=10): """determines the position of the value in the provided list and returns the matching borders of the points list. p0 represents the lower boundary of the available points. p1 represents the upper boundary of the available points. i0 represents the ...
the_stack_v2_python_sparse
apps/muni_scales/calculator.py
schocco/mds-web
train
0
60128d1cbe14b799c29e2b920cd2a005d2785491
[ "search = self\nif document_pid:\n search = search.filter('term', document_pid=document_pid)\nelse:\n raise MissingRequiredParameterError(description='document_pid is required')\nif filter_states:\n search = search.filter('terms', status=filter_states)\nelif exclude_states:\n search = search.exclude('te...
<|body_start_0|> search = self if document_pid: search = search.filter('term', document_pid=document_pid) else: raise MissingRequiredParameterError(description='document_pid is required') if filter_states: search = search.filter('terms', status=filter_...
RecordsSearch for EItem.
EItemSearch
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EItemSearch: """RecordsSearch for EItem.""" def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): """Retrieve items based on the given document pid.""" <|body_0|> def search_by_bucket_id(self, bucket_id=None): """Search EIt...
stack_v2_sparse_classes_36k_train_027953
1,796
permissive
[ { "docstring": "Retrieve items based on the given document pid.", "name": "search_by_document_pid", "signature": "def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None)" }, { "docstring": "Search EItems by bucket id.", "name": "search_by_bucket_id", ...
2
null
Implement the Python class `EItemSearch` described below. Class description: RecordsSearch for EItem. Method signatures and docstrings: - def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): Retrieve items based on the given document pid. - def search_by_bucket_id(self, bucket...
Implement the Python class `EItemSearch` described below. Class description: RecordsSearch for EItem. Method signatures and docstrings: - def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): Retrieve items based on the given document pid. - def search_by_bucket_id(self, bucket...
1c36526e85510100c5f64059518d1b716d87ac10
<|skeleton|> class EItemSearch: """RecordsSearch for EItem.""" def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): """Retrieve items based on the given document pid.""" <|body_0|> def search_by_bucket_id(self, bucket_id=None): """Search EIt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EItemSearch: """RecordsSearch for EItem.""" def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): """Retrieve items based on the given document pid.""" search = self if document_pid: search = search.filter('term', document_pid=do...
the_stack_v2_python_sparse
invenio_app_ils/eitems/search.py
inveniosoftware/invenio-app-ils
train
64
c6013f131a6b3e35cb594c75e7cd391dcc7d983f
[ "try:\n user = self.get_user(request, username)\nexcept PermissionDenied:\n return redirect(reverse('login') + '?next=' + request.path)\nform = WordForm()\nwords = Word.objects.filter(user=user).order_by('-id')\nreturn render(request, 'dictionary.html', dict(profile_user=user, words=words, languages=settings....
<|body_start_0|> try: user = self.get_user(request, username) except PermissionDenied: return redirect(reverse('login') + '?next=' + request.path) form = WordForm() words = Word.objects.filter(user=user).order_by('-id') return render(request, 'dictionary.h...
DictionaryView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DictionaryView: def get(self, request, username=None): """Get form.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def put(self, request, username=None): """Word edit.""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_027954
30,576
permissive
[ { "docstring": "Get form.", "name": "get", "signature": "def get(self, request, username=None)" }, { "docstring": "Form submit.", "name": "post", "signature": "def post(self, request, username=None)" }, { "docstring": "Word edit.", "name": "put", "signature": "def put(sel...
3
stack_v2_sparse_classes_30k_train_014223
Implement the Python class `DictionaryView` described below. Class description: Implement the DictionaryView class. Method signatures and docstrings: - def get(self, request, username=None): Get form. - def post(self, request, username=None): Form submit. - def put(self, request, username=None): Word edit.
Implement the Python class `DictionaryView` described below. Class description: Implement the DictionaryView class. Method signatures and docstrings: - def get(self, request, username=None): Get form. - def post(self, request, username=None): Form submit. - def put(self, request, username=None): Word edit. <|skeleto...
51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0
<|skeleton|> class DictionaryView: def get(self, request, username=None): """Get form.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def put(self, request, username=None): """Word edit.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DictionaryView: def get(self, request, username=None): """Get form.""" try: user = self.get_user(request, username) except PermissionDenied: return redirect(reverse('login') + '?next=' + request.path) form = WordForm() words = Word.objects.filter...
the_stack_v2_python_sparse
tool/views/views.py
mikekeda/tools
train
0
8a3226e63734299e8f1f1476300cecd239ba6372
[ "def util(root, min_value, max_value):\n if not root:\n return True\n if not min_value < root.val < max_value:\n return False\n return util(root.left, min_value, root.val) and util(root.right, root.val, max_value)\nreturn util(root, float('-inf'), float('inf'))", "def util(root):\n if no...
<|body_start_0|> def util(root, min_value, max_value): if not root: return True if not min_value < root.val < max_value: return False return util(root.left, min_value, root.val) and util(root.right, root.val, max_value) return util(root...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST2(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> def isValidBST3(self, root): """:type root: TreeNode :rtype: bool""" ...
stack_v2_sparse_classes_36k_train_027955
2,311
permissive
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST2", "signature": "def isValidBST2(self, root)" }, { "docstring": ":type root: TreeNode :rt...
3
stack_v2_sparse_classes_30k_train_005384
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBST2(self, root): :type root: TreeNode :rtype: bool - def isValidBST3(self, root): :type root: TreeNode...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBST2(self, root): :type root: TreeNode :rtype: bool - def isValidBST3(self, root): :type root: TreeNode...
aec1ddd0c51b619c1bae1e05f940d9ed587aa82f
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST2(self, root): """:type root: TreeNode :rtype: bool""" <|body_1|> def isValidBST3(self, root): """:type root: TreeNode :rtype: bool""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" def util(root, min_value, max_value): if not root: return True if not min_value < root.val < max_value: return False return util(root.left, min_valu...
the_stack_v2_python_sparse
Python/leetcode/ValidateBinarySearchTree.py
darrencheng0817/AlgorithmLearning
train
2
2e1807e99ec96d781122749ee367b2e811837999
[ "t_set = set(t)\nhmp = {i: t.count(i) for i in t_set}\nfor sub in self.substring_SL(s):\n flag = False\n if len(sub) >= len(t):\n for i in t_set:\n if sub.count(i) < hmp[i]:\n flag = True\n if not flag:\n return sub\nreturn ''", "result = []\nfor lenth in r...
<|body_start_0|> t_set = set(t) hmp = {i: t.count(i) for i in t_set} for sub in self.substring_SL(s): flag = False if len(sub) >= len(t): for i in t_set: if sub.count(i) < hmp[i]: flag = True if n...
Solution_A
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_A: def minWindow(self, s: str, t: str) -> str: """Brutal force, check every substring maximum time limit exceeded""" <|body_0|> def substring_SL(self, iterable: str, startLength: int=1) -> List[str]: """Helper to get all substring from short to long""" ...
stack_v2_sparse_classes_36k_train_027956
8,712
permissive
[ { "docstring": "Brutal force, check every substring maximum time limit exceeded", "name": "minWindow", "signature": "def minWindow(self, s: str, t: str) -> str" }, { "docstring": "Helper to get all substring from short to long", "name": "substring_SL", "signature": "def substring_SL(self...
2
null
Implement the Python class `Solution_A` described below. Class description: Implement the Solution_A class. Method signatures and docstrings: - def minWindow(self, s: str, t: str) -> str: Brutal force, check every substring maximum time limit exceeded - def substring_SL(self, iterable: str, startLength: int=1) -> Lis...
Implement the Python class `Solution_A` described below. Class description: Implement the Solution_A class. Method signatures and docstrings: - def minWindow(self, s: str, t: str) -> str: Brutal force, check every substring maximum time limit exceeded - def substring_SL(self, iterable: str, startLength: int=1) -> Lis...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_A: def minWindow(self, s: str, t: str) -> str: """Brutal force, check every substring maximum time limit exceeded""" <|body_0|> def substring_SL(self, iterable: str, startLength: int=1) -> List[str]: """Helper to get all substring from short to long""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_A: def minWindow(self, s: str, t: str) -> str: """Brutal force, check every substring maximum time limit exceeded""" t_set = set(t) hmp = {i: t.count(i) for i in t_set} for sub in self.substring_SL(s): flag = False if len(sub) >= len(t): ...
the_stack_v2_python_sparse
LeetCode/LC076_minimum_window_substring.py
jxie0755/Learning_Python
train
0
3eadc13629bb681a5c00df0fcaad8a5a81eb3380
[ "try:\n df = pd.DataFrame()\n for dsx in dss:\n df = pd.concat([df, dsx.df], **kwargs)\n self.df = df\nexcept Exception as e:\n self.err(e, 'Can not concatenate data')", "try:\n df = pd.DataFrame()\n for dsx in dss:\n df = pd.concat([df, dsx.df], **kwargs)\n return self._duplica...
<|body_start_0|> try: df = pd.DataFrame() for dsx in dss: df = pd.concat([df, dsx.df], **kwargs) self.df = df except Exception as e: self.err(e, 'Can not concatenate data') <|end_body_0|> <|body_start_1|> try: df = pd.D...
Class to transform the dataframe
Dataframe
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataframe: """Class to transform the dataframe""" def concat(self, *dss, **kwargs): """Concatenate dataswim instances from and set it to the main dataframe :param dss: dataswim instances to concatenate :type dss: Ds :param kwargs: keyword arguments for ``pd.concat``""" <|body...
stack_v2_sparse_classes_36k_train_027957
2,569
permissive
[ { "docstring": "Concatenate dataswim instances from and set it to the main dataframe :param dss: dataswim instances to concatenate :type dss: Ds :param kwargs: keyword arguments for ``pd.concat``", "name": "concat", "signature": "def concat(self, *dss, **kwargs)" }, { "docstring": "Concatenate d...
4
stack_v2_sparse_classes_30k_train_013161
Implement the Python class `Dataframe` described below. Class description: Class to transform the dataframe Method signatures and docstrings: - def concat(self, *dss, **kwargs): Concatenate dataswim instances from and set it to the main dataframe :param dss: dataswim instances to concatenate :type dss: Ds :param kwar...
Implement the Python class `Dataframe` described below. Class description: Class to transform the dataframe Method signatures and docstrings: - def concat(self, *dss, **kwargs): Concatenate dataswim instances from and set it to the main dataframe :param dss: dataswim instances to concatenate :type dss: Ds :param kwar...
ea33a114cea6af046d50839a88ea1b2f3b8f895b
<|skeleton|> class Dataframe: """Class to transform the dataframe""" def concat(self, *dss, **kwargs): """Concatenate dataswim instances from and set it to the main dataframe :param dss: dataswim instances to concatenate :type dss: Ds :param kwargs: keyword arguments for ``pd.concat``""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataframe: """Class to transform the dataframe""" def concat(self, *dss, **kwargs): """Concatenate dataswim instances from and set it to the main dataframe :param dss: dataswim instances to concatenate :type dss: Ds :param kwargs: keyword arguments for ``pd.concat``""" try: df...
the_stack_v2_python_sparse
dataswim/data/transform/dataframe.py
synw/dataswim
train
11
967cf641c7b65ffef15fda09d38156a680080f04
[ "json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json...
<|body_start_0|> json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_id = json_dict.get('district_id') place = json_dict.get('place') mobile = jso...
修改和删除地址
UpdateDestroyAddressView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|> <|body_start_0|> json_dict = json.loads(request.body.decode()) ...
stack_v2_sparse_classes_36k_train_027958
28,395
permissive
[ { "docstring": "修改地址", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除地址", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
null
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址 <|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, addre...
42a7edf7ca3b43b59955505db854c73c6edf1f24
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址""" json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_...
the_stack_v2_python_sparse
meiduo_mall/apps/users/views.py
Gh-Helina/Git_meiduo
train
0
2a459b0f4455a0346366a90699df5505716f54aa
[ "if timezone is None:\n return\nvalue = 0\nif timezone.negative:\n value |= 1 << 7\nvalue |= timezone.hours << 2\nvalue |= timezone.minutes // 15\nreturn value", "if value is None:\n return\nnegative = bool(value & 1 << 7)\nhours = (value & 60) >> 2\nminutes = 15 * (value & 3)\nreturn Timezone(negative, ...
<|body_start_0|> if timezone is None: return value = 0 if timezone.negative: value |= 1 << 7 value |= timezone.hours << 2 value |= timezone.minutes // 15 return value <|end_body_0|> <|body_start_1|> if value is None: return ...
Database field that stores a timezone (UTC offset). Stores offsets as an SQLite tinyint (1 byte) as follows (most to least significant bits): 0 - Always a low bit. 1 - Low if the offset is below zero, high otherwise. 2 to 5 - The whole hour offset (a 4 bit integer). 6 - If high, add 30 minutes to the offset. 7 - If hig...
TimezoneField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimezoneField: """Database field that stores a timezone (UTC offset). Stores offsets as an SQLite tinyint (1 byte) as follows (most to least significant bits): 0 - Always a low bit. 1 - Low if the offset is below zero, high otherwise. 2 to 5 - The whole hour offset (a 4 bit integer). 6 - If high,...
stack_v2_sparse_classes_36k_train_027959
3,439
no_license
[ { "docstring": "Convert a timezone to a 7 bit number.", "name": "db_value", "signature": "def db_value(self, timezone: Timezone) -> int" }, { "docstring": "Convert a 7 bit number to a timezone.", "name": "python_value", "signature": "def python_value(self, value: int) -> Timezone" } ]
2
stack_v2_sparse_classes_30k_train_011085
Implement the Python class `TimezoneField` described below. Class description: Database field that stores a timezone (UTC offset). Stores offsets as an SQLite tinyint (1 byte) as follows (most to least significant bits): 0 - Always a low bit. 1 - Low if the offset is below zero, high otherwise. 2 to 5 - The whole hour...
Implement the Python class `TimezoneField` described below. Class description: Database field that stores a timezone (UTC offset). Stores offsets as an SQLite tinyint (1 byte) as follows (most to least significant bits): 0 - Always a low bit. 1 - Low if the offset is below zero, high otherwise. 2 to 5 - The whole hour...
05b2689fa191a10feea77afa94320f0b1d088dc0
<|skeleton|> class TimezoneField: """Database field that stores a timezone (UTC offset). Stores offsets as an SQLite tinyint (1 byte) as follows (most to least significant bits): 0 - Always a low bit. 1 - Low if the offset is below zero, high otherwise. 2 to 5 - The whole hour offset (a 4 bit integer). 6 - If high,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimezoneField: """Database field that stores a timezone (UTC offset). Stores offsets as an SQLite tinyint (1 byte) as follows (most to least significant bits): 0 - Always a low bit. 1 - Low if the offset is below zero, high otherwise. 2 to 5 - The whole hour offset (a 4 bit integer). 6 - If high, add 30 minut...
the_stack_v2_python_sparse
survive-the-square/bot/models/timezones.py
Artemis21/polybots
train
3
530df2c6b60f94112a00b02f7b6479138918929a
[ "self._cbapi_verify_hostname = verify_hostname\nself._cbapi_force_tls_1_2 = force_tls_1_2\nif force_tls_1_2 and (not REQUESTS_HAS_URLLIB_SSL_CONTEXT):\n raise ApiError('Cannot force the use of TLS1.2: Python, urllib3, and requests versions are too old.')\nsuper(CbAPISessionAdapter, self).__init__(max_retries=max...
<|body_start_0|> self._cbapi_verify_hostname = verify_hostname self._cbapi_force_tls_1_2 = force_tls_1_2 if force_tls_1_2 and (not REQUESTS_HAS_URLLIB_SSL_CONTEXT): raise ApiError('Cannot force the use of TLS1.2: Python, urllib3, and requests versions are too old.') super(CbA...
Adapter object used to handle TLS connections to the CB server.
CbAPISessionAdapter
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CbAPISessionAdapter: """Adapter object used to handle TLS connections to the CB server.""" def __init__(self, verify_hostname=True, force_tls_1_2=False, max_retries=DEFAULT_RETRIES, **pool_kwargs): """Initialize the CbAPISessionManager. Args: verify_hostname (boolean): True if we wan...
stack_v2_sparse_classes_36k_train_027960
23,188
permissive
[ { "docstring": "Initialize the CbAPISessionManager. Args: verify_hostname (boolean): True if we want to verify the hostname. force_tls_1_2 (boolean): True to force the use of TLS 1.2. max_retries (int): Maximum number of retries. **pool_kwargs: Additional arguments. Raises: ApiError: If the library versions are...
2
stack_v2_sparse_classes_30k_train_002778
Implement the Python class `CbAPISessionAdapter` described below. Class description: Adapter object used to handle TLS connections to the CB server. Method signatures and docstrings: - def __init__(self, verify_hostname=True, force_tls_1_2=False, max_retries=DEFAULT_RETRIES, **pool_kwargs): Initialize the CbAPISessio...
Implement the Python class `CbAPISessionAdapter` described below. Class description: Adapter object used to handle TLS connections to the CB server. Method signatures and docstrings: - def __init__(self, verify_hostname=True, force_tls_1_2=False, max_retries=DEFAULT_RETRIES, **pool_kwargs): Initialize the CbAPISessio...
32dd08d2185f7113f87834002e720db31c8c910e
<|skeleton|> class CbAPISessionAdapter: """Adapter object used to handle TLS connections to the CB server.""" def __init__(self, verify_hostname=True, force_tls_1_2=False, max_retries=DEFAULT_RETRIES, **pool_kwargs): """Initialize the CbAPISessionManager. Args: verify_hostname (boolean): True if we wan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CbAPISessionAdapter: """Adapter object used to handle TLS connections to the CB server.""" def __init__(self, verify_hostname=True, force_tls_1_2=False, max_retries=DEFAULT_RETRIES, **pool_kwargs): """Initialize the CbAPISessionManager. Args: verify_hostname (boolean): True if we want to verify t...
the_stack_v2_python_sparse
src/cbapi/connection.py
carbonblack/cbapi-python
train
158
6f46dd919218e3530aabd7cd8acb586103a3cb4c
[ "self.dataproc = dataproc\nself.execution_config_factory = execution_config_factory_override\nif not self.execution_config_factory:\n self.execution_config_factory = ecf.ExecutionConfigFactory(self.dataproc)\nself.peripherals_config_factory = peripherals_config_factory_override\nif not self.peripherals_config_fa...
<|body_start_0|> self.dataproc = dataproc self.execution_config_factory = execution_config_factory_override if not self.execution_config_factory: self.execution_config_factory = ecf.ExecutionConfigFactory(self.dataproc) self.peripherals_config_factory = peripherals_config_fac...
Factory for EnvironmentConfig message. Add arguments related to EnvironmentConfig to argument parser and create EnvironmentConfig message from parsed arguments.
EnvironmentConfigFactory
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentConfigFactory: """Factory for EnvironmentConfig message. Add arguments related to EnvironmentConfig to argument parser and create EnvironmentConfig message from parsed arguments.""" def __init__(self, dataproc, execution_config_factory_override=None, peripherals_config_factory_ove...
stack_v2_sparse_classes_36k_train_027961
3,047
permissive
[ { "docstring": "Factory for EnvironmentConfig message. Args: dataproc: A api_lib.dataproc.Dataproc instance. execution_config_factory_override: Override the default ExecutionConfigFactory instance. This is a keyword argument. peripherals_config_factory_override: Override the default PeripheralsConfigFactory ins...
2
null
Implement the Python class `EnvironmentConfigFactory` described below. Class description: Factory for EnvironmentConfig message. Add arguments related to EnvironmentConfig to argument parser and create EnvironmentConfig message from parsed arguments. Method signatures and docstrings: - def __init__(self, dataproc, ex...
Implement the Python class `EnvironmentConfigFactory` described below. Class description: Factory for EnvironmentConfig message. Add arguments related to EnvironmentConfig to argument parser and create EnvironmentConfig message from parsed arguments. Method signatures and docstrings: - def __init__(self, dataproc, ex...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class EnvironmentConfigFactory: """Factory for EnvironmentConfig message. Add arguments related to EnvironmentConfig to argument parser and create EnvironmentConfig message from parsed arguments.""" def __init__(self, dataproc, execution_config_factory_override=None, peripherals_config_factory_ove...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnvironmentConfigFactory: """Factory for EnvironmentConfig message. Add arguments related to EnvironmentConfig to argument parser and create EnvironmentConfig message from parsed arguments.""" def __init__(self, dataproc, execution_config_factory_override=None, peripherals_config_factory_override=None): ...
the_stack_v2_python_sparse
lib/googlecloudsdk/command_lib/dataproc/shared_messages/environment_config_factory.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
92cac41738f1ab4e4a3f3d4cf304875e09f1a385
[ "res = [1] * len(ratings)\nleft_base = right_base = 1\nfor i in xrange(1, len(ratings)):\n left_base = left_base + 1 if ratings[i] > ratings[i - 1] else 1\n res[i] = left_base\nfor i in xrange(len(ratings) - 2, -1, -1):\n right_base = right_base + 1 if ratings[i] > ratings[i + 1] else 1\n res[i] = max(r...
<|body_start_0|> res = [1] * len(ratings) left_base = right_base = 1 for i in xrange(1, len(ratings)): left_base = left_base + 1 if ratings[i] > ratings[i - 1] else 1 res[i] = left_base for i in xrange(len(ratings) - 2, -1, -1): right_base = right_base...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def candy(self, ratings): """:type ratings: List[int] :rtype: int use two pass scan from left to right and vice versa to keep the candy level up to now similar to like the Trapping Rain Water question @param {integer[]} ratings @return {integer} beats 47.64%""" <|body_0...
stack_v2_sparse_classes_36k_train_027962
3,230
no_license
[ { "docstring": ":type ratings: List[int] :rtype: int use two pass scan from left to right and vice versa to keep the candy level up to now similar to like the Trapping Rain Water question @param {integer[]} ratings @return {integer} beats 47.64%", "name": "candy", "signature": "def candy(self, ratings)"...
2
stack_v2_sparse_classes_30k_train_016952
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def candy(self, ratings): :type ratings: List[int] :rtype: int use two pass scan from left to right and vice versa to keep the candy level up to now similar to like the Trapping ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def candy(self, ratings): :type ratings: List[int] :rtype: int use two pass scan from left to right and vice versa to keep the candy level up to now similar to like the Trapping ...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def candy(self, ratings): """:type ratings: List[int] :rtype: int use two pass scan from left to right and vice versa to keep the candy level up to now similar to like the Trapping Rain Water question @param {integer[]} ratings @return {integer} beats 47.64%""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def candy(self, ratings): """:type ratings: List[int] :rtype: int use two pass scan from left to right and vice versa to keep the candy level up to now similar to like the Trapping Rain Water question @param {integer[]} ratings @return {integer} beats 47.64%""" res = [1] * len(rating...
the_stack_v2_python_sparse
LeetCode/135_candy.py
yao23/Machine_Learning_Playground
train
12
bf6f28549df628e48491abe0e634fc59acc3dda4
[ "if not self._IsAssociativeList(data):\n return [self._MakeCell(data, alignment=alignment)]\nif isinstance(data, dict):\n data = sorted(data.iteritems())\nif alignment == Alignment.AUTO:\n alignment = Alignment.LEFT\nreturn [(_Cell([' ' + self._Stringify(key)], alignment=Alignment.LEFT), _Cell([self._Stri...
<|body_start_0|> if not self._IsAssociativeList(data): return [self._MakeCell(data, alignment=alignment)] if isinstance(data, dict): data = sorted(data.iteritems()) if alignment == Alignment.AUTO: alignment = Alignment.LEFT return [(_Cell([' ' + self....
A class that can be used for displaying tabular data in detailed format. This class can produce tables like the following: +------------+---------------+ | Country | China | | Population | 1,354,040,000 | | Cities | Shanghai | | | Beijing | | | Tianjin | | | Guangzhou | +------------+---------------+ | Country | India ...
DetailedTable
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetailedTable: """A class that can be used for displaying tabular data in detailed format. This class can produce tables like the following: +------------+---------------+ | Country | China | | Population | 1,354,040,000 | | Cities | Shanghai | | | Beijing | | | Tianjin | | | Guangzhou | +-------...
stack_v2_sparse_classes_36k_train_027963
32,076
permissive
[ { "docstring": "Returns _Cell instances for non-column header data. Args: data: The data for the _Cell. alignment: The alignment policy. Returns: A list of _Cell instances. For associative data, the list will contain (key, value) _Cell tuples. For all other data, the list will contain exactly one _Cell. Raises:...
3
null
Implement the Python class `DetailedTable` described below. Class description: A class that can be used for displaying tabular data in detailed format. This class can produce tables like the following: +------------+---------------+ | Country | China | | Population | 1,354,040,000 | | Cities | Shanghai | | | Beijing |...
Implement the Python class `DetailedTable` described below. Class description: A class that can be used for displaying tabular data in detailed format. This class can produce tables like the following: +------------+---------------+ | Country | China | | Population | 1,354,040,000 | | Cities | Shanghai | | | Beijing |...
d379afa2db3582d5c3be652165f0e9e2e0c154c6
<|skeleton|> class DetailedTable: """A class that can be used for displaying tabular data in detailed format. This class can produce tables like the following: +------------+---------------+ | Country | China | | Population | 1,354,040,000 | | Cities | Shanghai | | | Beijing | | | Tianjin | | | Guangzhou | +-------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DetailedTable: """A class that can be used for displaying tabular data in detailed format. This class can produce tables like the following: +------------+---------------+ | Country | China | | Population | 1,354,040,000 | | Cities | Shanghai | | | Beijing | | | Tianjin | | | Guangzhou | +------------+-------...
the_stack_v2_python_sparse
y/google-cloud-sdk/.install/.backup/platform/gcutil/lib/google_compute_engine/gcutil_lib/table/table.py
ychen820/microblog
train
0
93328dcf8c46efa76ada56f70f66881342e6ecbc
[ "wx.Frame.__init__(self, parent, id, title)\nself.loop = asyncio.get_event_loop()\nself.reader, self.writer = (None, None)\nself.SetSize(size)\nself.Center()\nself.serverAddressLabel = wx.StaticText(self, label='Server Address', pos=(10, 50), size=(120, 25))\nself.userNameLabel = wx.StaticText(self, label='UserName...
<|body_start_0|> wx.Frame.__init__(self, parent, id, title) self.loop = asyncio.get_event_loop() self.reader, self.writer = (None, None) self.SetSize(size) self.Center() self.serverAddressLabel = wx.StaticText(self, label='Server Address', pos=(10, 50), size=(120, 25)) ...
登录窗口
LoginFrame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginFrame: """登录窗口""" def __init__(self, parent, id, title, size): """初始化,添加控件并绑定事件""" <|body_0|> async def login(self, event): """登录处理""" <|body_1|> <|end_skeleton|> <|body_start_0|> wx.Frame.__init__(self, parent, id, title) self.loop...
stack_v2_sparse_classes_36k_train_027964
8,599
no_license
[ { "docstring": "初始化,添加控件并绑定事件", "name": "__init__", "signature": "def __init__(self, parent, id, title, size)" }, { "docstring": "登录处理", "name": "login", "signature": "async def login(self, event)" } ]
2
stack_v2_sparse_classes_30k_test_000621
Implement the Python class `LoginFrame` described below. Class description: 登录窗口 Method signatures and docstrings: - def __init__(self, parent, id, title, size): 初始化,添加控件并绑定事件 - async def login(self, event): 登录处理
Implement the Python class `LoginFrame` described below. Class description: 登录窗口 Method signatures and docstrings: - def __init__(self, parent, id, title, size): 初始化,添加控件并绑定事件 - async def login(self, event): 登录处理 <|skeleton|> class LoginFrame: """登录窗口""" def __init__(self, parent, id, title, size): ...
85c5861fc7142b87896f7422824984d28b5682ec
<|skeleton|> class LoginFrame: """登录窗口""" def __init__(self, parent, id, title, size): """初始化,添加控件并绑定事件""" <|body_0|> async def login(self, event): """登录处理""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginFrame: """登录窗口""" def __init__(self, parent, id, title, size): """初始化,添加控件并绑定事件""" wx.Frame.__init__(self, parent, id, title) self.loop = asyncio.get_event_loop() self.reader, self.writer = (None, None) self.SetSize(size) self.Center() self.ser...
the_stack_v2_python_sparse
Multi_Chatroom/client.py
DemonXD/WXPython_Samples
train
0
da94067534fe0d909b4cddfb4a5d47467b9dd595
[ "global COMPANY_CONN\ncursor = None\ntry:\n cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True)\n sql = 'INSERT INTO lie_goods' + '(cat_id, items_id, goods_sn, goods_name, brand_id,' + 'min_buynum, goods_desc) ' + 'VALUES(%(cat_id)s, %(items_id)s, %(goods_sn)s,%(goods_name)s, %(brand_id)s, %(min_buyn...
<|body_start_0|> global COMPANY_CONN cursor = None try: cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'INSERT INTO lie_goods' + '(cat_id, items_id, goods_sn, goods_name, brand_id,' + 'min_buynum, goods_desc) ' + 'VALUES(%(cat_id)s, %(items_id)s, %(goo...
LieGoods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LieGoods: def addLieGoods(cls, lieGoods): """method: addLieGoods params: lieGoods-type: LieGoods""" <|body_0|> def get_goods_id_by_goods_sn(cls, goods_sn_md5): """method: get_goods_id_by_goods_sn params: goods_sn_md5-type: str return: goods_id return-type: int""" ...
stack_v2_sparse_classes_36k_train_027965
13,174
no_license
[ { "docstring": "method: addLieGoods params: lieGoods-type: LieGoods", "name": "addLieGoods", "signature": "def addLieGoods(cls, lieGoods)" }, { "docstring": "method: get_goods_id_by_goods_sn params: goods_sn_md5-type: str return: goods_id return-type: int", "name": "get_goods_id_by_goods_sn"...
2
stack_v2_sparse_classes_30k_train_000325
Implement the Python class `LieGoods` described below. Class description: Implement the LieGoods class. Method signatures and docstrings: - def addLieGoods(cls, lieGoods): method: addLieGoods params: lieGoods-type: LieGoods - def get_goods_id_by_goods_sn(cls, goods_sn_md5): method: get_goods_id_by_goods_sn params: go...
Implement the Python class `LieGoods` described below. Class description: Implement the LieGoods class. Method signatures and docstrings: - def addLieGoods(cls, lieGoods): method: addLieGoods params: lieGoods-type: LieGoods - def get_goods_id_by_goods_sn(cls, goods_sn_md5): method: get_goods_id_by_goods_sn params: go...
1e49a6e13ea4b11427f47999c13a609be9ae3ecf
<|skeleton|> class LieGoods: def addLieGoods(cls, lieGoods): """method: addLieGoods params: lieGoods-type: LieGoods""" <|body_0|> def get_goods_id_by_goods_sn(cls, goods_sn_md5): """method: get_goods_id_by_goods_sn params: goods_sn_md5-type: str return: goods_id return-type: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LieGoods: def addLieGoods(cls, lieGoods): """method: addLieGoods params: lieGoods-type: LieGoods""" global COMPANY_CONN cursor = None try: cursor = COMPANY_CONN.cursor(buffered=True, dictionary=True) sql = 'INSERT INTO lie_goods' + '(cat_id, items_id, go...
the_stack_v2_python_sparse
rsonline/server/db/company/mysql_client.py
yunhao-qing/PythonScrapy
train
0
155575c003e9a00b6a46078397fd349ceb4ef314
[ "self.data = {}\nself.sum = set()\nself.max = float('-inf')\nself.min = float('inf')", "if number in self.data:\n self.data[number] += 1\nelse:\n self.data[number] = 1\nself.max = max(self.max, number)\nself.min = min(self.min, number)", "if value > 2 * self.max or value < 2 * self.min:\n return False\...
<|body_start_0|> self.data = {} self.sum = set() self.max = float('-inf') self.min = float('inf') <|end_body_0|> <|body_start_1|> if number in self.data: self.data[number] += 1 else: self.data[number] = 1 self.max = max(self.max, number) ...
TwoSum2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoSum2: def __init__(self): """Initialize your data structure here.""" <|body_0|> def add(self, number): """Add the number to an internal data structure.. :type number: int :rtype: void""" <|body_1|> def find(self, value): """Find if there exist...
stack_v2_sparse_classes_36k_train_027966
3,700
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add the number to an internal data structure.. :type number: int :rtype: void", "name": "add", "signature": "def add(self, number)" }, { "docstring": "F...
3
null
Implement the Python class `TwoSum2` described below. Class description: Implement the TwoSum2 class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def add(self, number): Add the number to an internal data structure.. :type number: int :rtype: void - def find(self, val...
Implement the Python class `TwoSum2` described below. Class description: Implement the TwoSum2 class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def add(self, number): Add the number to an internal data structure.. :type number: int :rtype: void - def find(self, val...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class TwoSum2: def __init__(self): """Initialize your data structure here.""" <|body_0|> def add(self, number): """Add the number to an internal data structure.. :type number: int :rtype: void""" <|body_1|> def find(self, value): """Find if there exist...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoSum2: def __init__(self): """Initialize your data structure here.""" self.data = {} self.sum = set() self.max = float('-inf') self.min = float('inf') def add(self, number): """Add the number to an internal data structure.. :type number: int :rtype: void"...
the_stack_v2_python_sparse
HashTable/q170_two_sum_iii_data_structure_design.py
sevenhe716/LeetCode
train
0
84fdc216ac729bf8994f83bebcfbe0d1d5b566c5
[ "try:\n self.teaClass = []\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n if self.getTeaClass():\n self.write(json.dumps(self.teaClass) if len(self.teaClass) != 0 else '[]')\n self.finish()\n else:\n raise RuntimeError\ne...
<|body_start_0|> try: self.teaClass = [] self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return if self.getTeaClass(): self.write(json.dumps(self.teaClass) if len(self.teaClass) != 0 else '...
TeaGetClassListRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" <|body_0|> def getTeaClass(self): """返回老师的习题列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.teaClass = [] self.sqlhandler = None if...
stack_v2_sparse_classes_36k_train_027967
2,430
no_license
[ { "docstring": "获取练习题列表,返回给老师客户端", "name": "get", "signature": "def get(self)" }, { "docstring": "返回老师的习题列表", "name": "getTeaClass", "signature": "def getTeaClass(self)" } ]
2
stack_v2_sparse_classes_30k_train_004770
Implement the Python class `TeaGetClassListRequestHandler` described below. Class description: Implement the TeaGetClassListRequestHandler class. Method signatures and docstrings: - def get(self): 获取练习题列表,返回给老师客户端 - def getTeaClass(self): 返回老师的习题列表
Implement the Python class `TeaGetClassListRequestHandler` described below. Class description: Implement the TeaGetClassListRequestHandler class. Method signatures and docstrings: - def get(self): 获取练习题列表,返回给老师客户端 - def getTeaClass(self): 返回老师的习题列表 <|skeleton|> class TeaGetClassListRequestHandler: def get(self)...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" <|body_0|> def getTeaClass(self): """返回老师的习题列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" try: self.teaClass = [] self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return if self.getTeaClass(): ...
the_stack_v2_python_sparse
server/teacher/TeaGetClassListRequestHandler.py
lyh-ADT/edu-app
train
1
dd9bf306928f5cb5cc4ac537661e6a284ab1b507
[ "super().__init__()\nimport sklearn\nimport sklearn.linear_model\nself.model = sklearn.linear_model.LarsCV", "specs = super(LarsCV, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{LarsCV} is Cross-validated \\\\textit{Least Angle Regression model} model\\n is a regression...
<|body_start_0|> super().__init__() import sklearn import sklearn.linear_model self.model = sklearn.linear_model.LarsCV <|end_body_0|> <|body_start_1|> specs = super(LarsCV, cls).getInputSpecification() specs.description = 'The \\xmlNode{LarsCV} is Cross-validated \\text...
Cross-validated Least Angle Regression model.
LarsCV
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LarsCV: """Cross-validated Least Angle Regression model.""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a c...
stack_v2_sparse_classes_36k_train_027968
6,409
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
stack_v2_sparse_classes_30k_train_014502
Implement the Python class `LarsCV` described below. Class description: Cross-validated Least Angle Regression model. Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to g...
Implement the Python class `LarsCV` described below. Class description: Cross-validated Least Angle Regression model. Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to g...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class LarsCV: """Cross-validated Least Angle Regression model.""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LarsCV: """Cross-validated Least Angle Regression model.""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.linear_model self.model = sklea...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/LinearModel/LarsCV.py
idaholab/raven
train
201
8c3ca1adf6da96290f440693bcb619bed629612e
[ "HTMLParser.__init__(self)\nself.table_data = None\nself.data_list = []\nself.short_list = []\nhtml_count = 0\nself.start_tag = 0\nself.th = 0\nself.hr = 0\nfile_handle = open(file_name, 'r')\nself.feed(file_handle.read())\nfile_handle.close()\nself.data_list = tuple(self.data_list)", "if tag == 'hr':\n self.h...
<|body_start_0|> HTMLParser.__init__(self) self.table_data = None self.data_list = [] self.short_list = [] html_count = 0 self.start_tag = 0 self.th = 0 self.hr = 0 file_handle = open(file_name, 'r') self.feed(file_handle.read()) fi...
@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser
HtmlParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HtmlParser: """@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser""" def __init__(self, file_name): """@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_na...
stack_v2_sparse_classes_36k_train_027969
5,564
no_license
[ { "docstring": "@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_name: (String) The absolute path to the html file to be parsed. @Creator: Jesse Thomas", "name": "__init__", "signature": "def __init__(self, file_name)" }, { "docstring": "@Name: handle_startta...
4
stack_v2_sparse_classes_30k_train_000975
Implement the Python class `HtmlParser` described below. Class description: @Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser Method signatures and docstrings: - def __init__(self, file_name): @Name: __init__ @Description: T...
Implement the Python class `HtmlParser` described below. Class description: @Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser Method signatures and docstrings: - def __init__(self, file_name): @Name: __init__ @Description: T...
d24805456e5a0126c036c1688a5d112bdcf4467a
<|skeleton|> class HtmlParser: """@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser""" def __init__(self, file_name): """@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HtmlParser: """@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser""" def __init__(self, file_name): """@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_name: (String) ...
the_stack_v2_python_sparse
app/util/gvrhtmlparser.py
priyatam0509/Automation-Testing
train
0
33e548776cc0853b16741e70ac517fd549d35b84
[ "super(StackedGCN, self).__init__()\nself.args = args\nself.input_channels = input_channels\nself.output_channels = output_channels\nself.setup_layers()", "self.layers = []\nself.args.layers = [self.input_channels] + self.args.layers + [self.output_channels]\nfor i, _ in enumerate(self.args.layers[:-1]):\n sel...
<|body_start_0|> super(StackedGCN, self).__init__() self.args = args self.input_channels = input_channels self.output_channels = output_channels self.setup_layers() <|end_body_0|> <|body_start_1|> self.layers = [] self.args.layers = [self.input_channels] + self.a...
Multi-layer GCN model.
StackedGCN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StackedGCN: """Multi-layer GCN model.""" def __init__(self, args, input_channels, output_channels): """:param args: Arguments object. :input_channels: Number of features. :output_channels: Number of target features.""" <|body_0|> def setup_layers(self): """Creati...
stack_v2_sparse_classes_36k_train_027970
3,788
no_license
[ { "docstring": ":param args: Arguments object. :input_channels: Number of features. :output_channels: Number of target features.", "name": "__init__", "signature": "def __init__(self, args, input_channels, output_channels)" }, { "docstring": "Creating the layes based on the args.", "name": "...
3
null
Implement the Python class `StackedGCN` described below. Class description: Multi-layer GCN model. Method signatures and docstrings: - def __init__(self, args, input_channels, output_channels): :param args: Arguments object. :input_channels: Number of features. :output_channels: Number of target features. - def setup...
Implement the Python class `StackedGCN` described below. Class description: Multi-layer GCN model. Method signatures and docstrings: - def __init__(self, args, input_channels, output_channels): :param args: Arguments object. :input_channels: Number of features. :output_channels: Number of target features. - def setup...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class StackedGCN: """Multi-layer GCN model.""" def __init__(self, args, input_channels, output_channels): """:param args: Arguments object. :input_channels: Number of features. :output_channels: Number of target features.""" <|body_0|> def setup_layers(self): """Creati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StackedGCN: """Multi-layer GCN model.""" def __init__(self, args, input_channels, output_channels): """:param args: Arguments object. :input_channels: Number of features. :output_channels: Number of target features.""" super(StackedGCN, self).__init__() self.args = args se...
the_stack_v2_python_sparse
generated/test_benedekrozemberczki_ClusterGCN.py
jansel/pytorch-jit-paritybench
train
35
ed18dc549cac4a8f59c8cd89083adb4c5b6b1866
[ "login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics'\nheaders = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': GetToken().token()}\nresponse_data = requests.get(login_url, headers=headers).json()\nself.assertEqual(response_data['message'], 'SUCCESS')", "login_url = 'http://...
<|body_start_0|> login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics' headers = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': GetToken().token()} response_data = requests.get(login_url, headers=headers).json() self.assertEqual(response_data['messag...
TestGongDan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGongDan: def test1_gongzt(self): """工作台,工单统计接口,正常登录后请求""" <|body_0|> def test2_gongzt_notoken(self): """工作台,工单统计接口,不登录直接请求""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics' ...
stack_v2_sparse_classes_36k_train_027971
1,541
no_license
[ { "docstring": "工作台,工单统计接口,正常登录后请求", "name": "test1_gongzt", "signature": "def test1_gongzt(self)" }, { "docstring": "工作台,工单统计接口,不登录直接请求", "name": "test2_gongzt_notoken", "signature": "def test2_gongzt_notoken(self)" } ]
2
stack_v2_sparse_classes_30k_val_000665
Implement the Python class `TestGongDan` described below. Class description: Implement the TestGongDan class. Method signatures and docstrings: - def test1_gongzt(self): 工作台,工单统计接口,正常登录后请求 - def test2_gongzt_notoken(self): 工作台,工单统计接口,不登录直接请求
Implement the Python class `TestGongDan` described below. Class description: Implement the TestGongDan class. Method signatures and docstrings: - def test1_gongzt(self): 工作台,工单统计接口,正常登录后请求 - def test2_gongzt_notoken(self): 工作台,工单统计接口,不登录直接请求 <|skeleton|> class TestGongDan: def test1_gongzt(self): """工作台...
204856bd33c06d25f2970eba13799db75d4fd4fe
<|skeleton|> class TestGongDan: def test1_gongzt(self): """工作台,工单统计接口,正常登录后请求""" <|body_0|> def test2_gongzt_notoken(self): """工作台,工单统计接口,不登录直接请求""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestGongDan: def test1_gongzt(self): """工作台,工单统计接口,正常登录后请求""" login_url = 'http://uat-c2b.taoche.com/basegate/work/order/statistics' headers = {'Content-Type': 'application/json;charset=UTF-8', 'Authorization': GetToken().token()} response_data = requests.get(login_url, headers...
the_stack_v2_python_sparse
mc/xmdCW/testcase/test_gongzuotai.py
boeai/mc
train
0
9e8403ccdf668b6c45e29dff2036422fa79b965b
[ "count = 1\nsetG = set(G)\nwhile head:\n if head.val not in setG:\n count += 1\n head = head.next\nreturn count", "groups = []\nsetG = set(G)\ngroup = []\nwhile head:\n if head.val in setG:\n group.append(head.val)\n elif group:\n groups.append(group)\n group = []\n head...
<|body_start_0|> count = 1 setG = set(G) while head: if head.val not in setG: count += 1 head = head.next return count <|end_body_0|> <|body_start_1|> groups = [] setG = set(G) group = [] while head: if ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _numComponents(self, head, G): """:type head: ListNode :type G: List[int] :rtype: int""" <|body_0|> def __numComponents(self, head, G): """:type head: ListNode :type G: List[int] :rtype: int""" <|body_1|> def numComponents(self, head, G): ...
stack_v2_sparse_classes_36k_train_027972
3,285
permissive
[ { "docstring": ":type head: ListNode :type G: List[int] :rtype: int", "name": "_numComponents", "signature": "def _numComponents(self, head, G)" }, { "docstring": ":type head: ListNode :type G: List[int] :rtype: int", "name": "__numComponents", "signature": "def __numComponents(self, hea...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _numComponents(self, head, G): :type head: ListNode :type G: List[int] :rtype: int - def __numComponents(self, head, G): :type head: ListNode :type G: List[int] :rtype: int -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _numComponents(self, head, G): :type head: ListNode :type G: List[int] :rtype: int - def __numComponents(self, head, G): :type head: ListNode :type G: List[int] :rtype: int -...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _numComponents(self, head, G): """:type head: ListNode :type G: List[int] :rtype: int""" <|body_0|> def __numComponents(self, head, G): """:type head: ListNode :type G: List[int] :rtype: int""" <|body_1|> def numComponents(self, head, G): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _numComponents(self, head, G): """:type head: ListNode :type G: List[int] :rtype: int""" count = 1 setG = set(G) while head: if head.val not in setG: count += 1 head = head.next return count def __numComponents(...
the_stack_v2_python_sparse
817.linked-list-components.py
windard/leeeeee
train
0
6560ba37def48e912cf9b073b06f85e48ba63057
[ "super(UpdateDestEntityPoseWithSrcEntity, self).__init__(outcomes=['done', 'failed'])\nself._robot = robot\nds.check_type(src_entity_designator, Entity)\nds.check_type(dst_entity_designator, Entity, str)\nself._src_entity_designator = src_entity_designator\nself._dst_entity_designator = dst_entity_designator\nself....
<|body_start_0|> super(UpdateDestEntityPoseWithSrcEntity, self).__init__(outcomes=['done', 'failed']) self._robot = robot ds.check_type(src_entity_designator, Entity) ds.check_type(dst_entity_designator, Entity, str) self._src_entity_designator = src_entity_designator sel...
Update the pose of an entity from another entity
UpdateDestEntityPoseWithSrcEntity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestEntityPoseWithSrcEntity: """Update the pose of an entity from another entity""" def __init__(self, robot, src_entity_designator, dst_entity_designator, dst_entity_type='waypoint'): """Constructor :param robot: robot object :param src_entity_designator: (EdEntityDesignator) ...
stack_v2_sparse_classes_36k_train_027973
13,519
no_license
[ { "docstring": "Constructor :param robot: robot object :param src_entity_designator: (EdEntityDesignator) indicating the object from which the pose should be selected :param dst_entity_designator: (EdEntityDesignator) indicating the object of which the pose must be updated :param dst_entity_type: (str) Destinat...
2
null
Implement the Python class `UpdateDestEntityPoseWithSrcEntity` described below. Class description: Update the pose of an entity from another entity Method signatures and docstrings: - def __init__(self, robot, src_entity_designator, dst_entity_designator, dst_entity_type='waypoint'): Constructor :param robot: robot o...
Implement the Python class `UpdateDestEntityPoseWithSrcEntity` described below. Class description: Update the pose of an entity from another entity Method signatures and docstrings: - def __init__(self, robot, src_entity_designator, dst_entity_designator, dst_entity_type='waypoint'): Constructor :param robot: robot o...
092a354315b9b2c08e32cdc049791d82dfd47745
<|skeleton|> class UpdateDestEntityPoseWithSrcEntity: """Update the pose of an entity from another entity""" def __init__(self, robot, src_entity_designator, dst_entity_designator, dst_entity_type='waypoint'): """Constructor :param robot: robot object :param src_entity_designator: (EdEntityDesignator) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateDestEntityPoseWithSrcEntity: """Update the pose of an entity from another entity""" def __init__(self, robot, src_entity_designator, dst_entity_designator, dst_entity_type='waypoint'): """Constructor :param robot: robot object :param src_entity_designator: (EdEntityDesignator) indicating th...
the_stack_v2_python_sparse
robot_smach_states/src/robot_smach_states/world_model/world_model.py
tue-robotics/tue_robocup
train
39
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/booking/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/booking/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", ...
<|body_start_0|> url = '/booking/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/booking/' self.client.login(username=self.adminUN, password='pass') response = self.client.g...
BookingTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookingTestCase: def test_not_logged_in(self): """Test that the booking view will load whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the booking view will load whilst logged in as admin.""" <|body_1|> def test_logged_in...
stack_v2_sparse_classes_36k_train_027974
26,818
permissive
[ { "docstring": "Test that the booking view will load whilst not logged in.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the booking view will load whilst logged in as admin.", "name": "test_logged_in_admin", "signature": "def te...
3
null
Implement the Python class `BookingTestCase` described below. Class description: Implement the BookingTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the booking view will load whilst not logged in. - def test_logged_in_admin(self): Test that the booking view will load whil...
Implement the Python class `BookingTestCase` described below. Class description: Implement the BookingTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the booking view will load whilst not logged in. - def test_logged_in_admin(self): Test that the booking view will load whil...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class BookingTestCase: def test_not_logged_in(self): """Test that the booking view will load whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the booking view will load whilst logged in as admin.""" <|body_1|> def test_logged_in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookingTestCase: def test_not_logged_in(self): """Test that the booking view will load whilst not logged in.""" url = '/booking/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) def test_logged_in_admin(self): ...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
5d6f6476206b064d1a570186d7527ff88993fa20
[ "super(TopicRank, self).__init__()\nself.graph = nx.Graph()\n' The topic graph. '\nself.topics = []\n' The topic container. '", "if pos is None:\n pos = {'NOUN', 'PROPN', 'ADJ'}\nself.longest_pos_sequence_selection(valid_pos=pos)\nif stoplist is None:\n stoplist = self.stoplist\nself.candidate_filtering(sto...
<|body_start_0|> super(TopicRank, self).__init__() self.graph = nx.Graph() ' The topic graph. ' self.topics = [] ' The topic container. ' <|end_body_0|> <|body_start_1|> if pos is None: pos = {'NOUN', 'PROPN', 'ADJ'} self.longest_pos_sequence_selectio...
TopicRank keyphrase extraction model. Parameterized example:: import pke import string from nltk.corpus import stopwords # 1. create a TopicRank extractor. extractor = pke.unsupervised.TopicRank() # 2. load the content of the document. extractor.load_document(input='path/to/input.xml') # 3. select the longest sequences...
TopicRank
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopicRank: """TopicRank keyphrase extraction model. Parameterized example:: import pke import string from nltk.corpus import stopwords # 1. create a TopicRank extractor. extractor = pke.unsupervised.TopicRank() # 2. load the content of the document. extractor.load_document(input='path/to/input.xm...
stack_v2_sparse_classes_36k_train_027975
8,080
permissive
[ { "docstring": "Redefining initializer for TopicRank.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Selects longest sequences of nouns and adjectives as keyphrase candidates. Args: pos (set): the set of valid POS tags, defaults to ('NOUN', 'PROPN', 'ADJ'). stoplist (...
6
stack_v2_sparse_classes_30k_train_015032
Implement the Python class `TopicRank` described below. Class description: TopicRank keyphrase extraction model. Parameterized example:: import pke import string from nltk.corpus import stopwords # 1. create a TopicRank extractor. extractor = pke.unsupervised.TopicRank() # 2. load the content of the document. extracto...
Implement the Python class `TopicRank` described below. Class description: TopicRank keyphrase extraction model. Parameterized example:: import pke import string from nltk.corpus import stopwords # 1. create a TopicRank extractor. extractor = pke.unsupervised.TopicRank() # 2. load the content of the document. extracto...
d16bf09e21521a6854ff3c7fe6eb271412914960
<|skeleton|> class TopicRank: """TopicRank keyphrase extraction model. Parameterized example:: import pke import string from nltk.corpus import stopwords # 1. create a TopicRank extractor. extractor = pke.unsupervised.TopicRank() # 2. load the content of the document. extractor.load_document(input='path/to/input.xm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopicRank: """TopicRank keyphrase extraction model. Parameterized example:: import pke import string from nltk.corpus import stopwords # 1. create a TopicRank extractor. extractor = pke.unsupervised.TopicRank() # 2. load the content of the document. extractor.load_document(input='path/to/input.xml') # 3. sele...
the_stack_v2_python_sparse
onmt/keyphrase/pke/unsupervised/graph_based/topicrank.py
memray/OpenNMT-kpg-release
train
222
da4708d020c852337f1a7a47888e898f53352091
[ "msg = msg or 'List request successfully processed.'\ndata = {'header': response_header(msg=msg, username=username, api_status=constants.STATUS_OK), 'detail': serializer.data}\nif add_pagination:\n data['header']['pagination'] = dict()\nreturn data", "queryset = self.filter_queryset(self.get_queryset())\npage ...
<|body_start_0|> msg = msg or 'List request successfully processed.' data = {'header': response_header(msg=msg, username=username, api_status=constants.STATUS_OK), 'detail': serializer.data} if add_pagination: data['header']['pagination'] = dict() return data <|end_body_0|> ...
Django rest framework list model mixin class
DRFListModelMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DRFListModelMixin: """Django rest framework list model mixin class""" def build_list_data(self, serializer, username, msg=None, add_pagination=False): """build list data""" <|body_0|> def list(self, request, *args, **kwargs): """Fetch instance list Called on GET ...
stack_v2_sparse_classes_36k_train_027976
12,654
no_license
[ { "docstring": "build list data", "name": "build_list_data", "signature": "def build_list_data(self, serializer, username, msg=None, add_pagination=False)" }, { "docstring": "Fetch instance list Called on GET request for collection endpoint", "name": "list", "signature": "def list(self, ...
2
stack_v2_sparse_classes_30k_train_013412
Implement the Python class `DRFListModelMixin` described below. Class description: Django rest framework list model mixin class Method signatures and docstrings: - def build_list_data(self, serializer, username, msg=None, add_pagination=False): build list data - def list(self, request, *args, **kwargs): Fetch instanc...
Implement the Python class `DRFListModelMixin` described below. Class description: Django rest framework list model mixin class Method signatures and docstrings: - def build_list_data(self, serializer, username, msg=None, add_pagination=False): build list data - def list(self, request, *args, **kwargs): Fetch instanc...
974ff553d93823312df906e9986155422b9d730b
<|skeleton|> class DRFListModelMixin: """Django rest framework list model mixin class""" def build_list_data(self, serializer, username, msg=None, add_pagination=False): """build list data""" <|body_0|> def list(self, request, *args, **kwargs): """Fetch instance list Called on GET ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DRFListModelMixin: """Django rest framework list model mixin class""" def build_list_data(self, serializer, username, msg=None, add_pagination=False): """build list data""" msg = msg or 'List request successfully processed.' data = {'header': response_header(msg=msg, username=user...
the_stack_v2_python_sparse
src/ondalear/backend/api/base_views.py
ajaniv/document-management
train
0
943e008aff296322b31ee3558fe1c49fe8cf4acf
[ "super(ChromePolicyTest, self).setUp()\nsuper(ChromePolicyTest, self).setup_config()\nsuper(ChromePolicyTest, self).setup_auth()", "resp = self.client.post(flask.url_for('download_chrome_policy'))\njson_data = json.loads(resp.data)\nproxy_servers = json_data.get('validProxyServers')\nself.assertIsNotNone(proxy_se...
<|body_start_0|> super(ChromePolicyTest, self).setUp() super(ChromePolicyTest, self).setup_config() super(ChromePolicyTest, self).setup_auth() <|end_body_0|> <|body_start_1|> resp = self.client.post(flask.url_for('download_chrome_policy')) json_data = json.loads(resp.data) ...
Test chrome policy functionality.
ChromePolicyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromePolicyTest: """Test chrome policy functionality.""" def setUp(self): """Setup test app on which to call handlers and db to query.""" <|body_0|> def testChromePolicyDownload(self): """Test the chrome policy download handler downloads policy json.""" ...
stack_v2_sparse_classes_36k_train_027977
1,092
permissive
[ { "docstring": "Setup test app on which to call handlers and db to query.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the chrome policy download handler downloads policy json.", "name": "testChromePolicyDownload", "signature": "def testChromePolicyDownload(s...
2
stack_v2_sparse_classes_30k_train_013546
Implement the Python class `ChromePolicyTest` described below. Class description: Test chrome policy functionality. Method signatures and docstrings: - def setUp(self): Setup test app on which to call handlers and db to query. - def testChromePolicyDownload(self): Test the chrome policy download handler downloads pol...
Implement the Python class `ChromePolicyTest` described below. Class description: Test chrome policy functionality. Method signatures and docstrings: - def setUp(self): Setup test app on which to call handlers and db to query. - def testChromePolicyDownload(self): Test the chrome policy download handler downloads pol...
a9efb83cfa3a5aa26bf3c4012ca0ef99b6e67829
<|skeleton|> class ChromePolicyTest: """Test chrome policy functionality.""" def setUp(self): """Setup test app on which to call handlers and db to query.""" <|body_0|> def testChromePolicyDownload(self): """Test the chrome policy download handler downloads policy json.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromePolicyTest: """Test chrome policy functionality.""" def setUp(self): """Setup test app on which to call handlers and db to query.""" super(ChromePolicyTest, self).setUp() super(ChromePolicyTest, self).setup_config() super(ChromePolicyTest, self).setup_auth() def...
the_stack_v2_python_sparse
ufo/handlers/chrome_policy_test.py
UWNetworksLab/ufo-management-server-flask
train
0
a3fd39edfee72632abb52934bb0d03097ef61f11
[ "super().__init__()\nself.map = map_fun\nself.current_mapping = {}", "for cmd in command_list:\n ids = [qb.id for qr in cmd.qubits for qb in qr]\n ids += [qb.id for qb in cmd.control_qubits]\n for qubit_id in ids:\n if qubit_id not in self.current_mapping:\n self._current_mapping[qubit_...
<|body_start_0|> super().__init__() self.map = map_fun self.current_mapping = {} <|end_body_0|> <|body_start_1|> for cmd in command_list: ids = [qb.id for qr in cmd.qubits for qb in qr] ids += [qb.id for qb in cmd.control_qubits] for qubit_id in ids: ...
Manual Mapper which adds QubitPlacementTags to Allocate gate commands according to a user-specified mapping. Attributes: map (function): The function which maps a given qubit id to its location. It gets set when initializing the mapper.
ManualMapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManualMapper: """Manual Mapper which adds QubitPlacementTags to Allocate gate commands according to a user-specified mapping. Attributes: map (function): The function which maps a given qubit id to its location. It gets set when initializing the mapper.""" def __init__(self, map_fun=lambda x...
stack_v2_sparse_classes_36k_train_027978
2,134
permissive
[ { "docstring": "Initialize the mapper to a given mapping. If no mapping function is provided, the qubit id is used as the location. Args: map_fun (function): Function which, given the qubit id, returns an integer describing the physical location (must be constant).", "name": "__init__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_014051
Implement the Python class `ManualMapper` described below. Class description: Manual Mapper which adds QubitPlacementTags to Allocate gate commands according to a user-specified mapping. Attributes: map (function): The function which maps a given qubit id to its location. It gets set when initializing the mapper. Met...
Implement the Python class `ManualMapper` described below. Class description: Manual Mapper which adds QubitPlacementTags to Allocate gate commands according to a user-specified mapping. Attributes: map (function): The function which maps a given qubit id to its location. It gets set when initializing the mapper. Met...
67c660ca18725d23ab0b261a45e34873b6a58d03
<|skeleton|> class ManualMapper: """Manual Mapper which adds QubitPlacementTags to Allocate gate commands according to a user-specified mapping. Attributes: map (function): The function which maps a given qubit id to its location. It gets set when initializing the mapper.""" def __init__(self, map_fun=lambda x...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManualMapper: """Manual Mapper which adds QubitPlacementTags to Allocate gate commands according to a user-specified mapping. Attributes: map (function): The function which maps a given qubit id to its location. It gets set when initializing the mapper.""" def __init__(self, map_fun=lambda x: x): ...
the_stack_v2_python_sparse
projectq/cengines/_manualmapper.py
ProjectQ-Framework/ProjectQ
train
886
4f4b74f3060f99edecdeed09134188ecb06dc0d2
[ "try:\n Domain.from_path(source_path)\nexcept InvalidDomain:\n return False\nreturn True", "domain = Domain.from_path(source_path)\ndomain_dict = domain.as_dict()\ndomain_dict['actions'] = [normalize_utter_action(action) for action in domain_dict['actions']]\nnew_domain = Domain.from_dict(domain_dict)\noutp...
<|body_start_0|> try: Domain.from_path(source_path) except InvalidDomain: return False return True <|end_body_0|> <|body_start_1|> domain = Domain.from_path(source_path) domain_dict = domain.as_dict() domain_dict['actions'] = [normalize_utter_acti...
Converter responsible for ensuring that retrieval intent actions in domain start with `utter_` instead of `respond_`.
DomainResponsePrefixConverter
[ "LicenseRef-scancode-generic-cla", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DomainResponsePrefixConverter: """Converter responsible for ensuring that retrieval intent actions in domain start with `utter_` instead of `respond_`.""" def filter(cls, source_path: Path) -> bool: """Only accept domain files. Args: source_path: Path to a domain file. Returns: `True...
stack_v2_sparse_classes_36k_train_027979
3,889
permissive
[ { "docstring": "Only accept domain files. Args: source_path: Path to a domain file. Returns: `True` if the given file can is a valid domain file, `False` otherwise.", "name": "filter", "signature": "def filter(cls, source_path: Path) -> bool" }, { "docstring": "Migrate retrieval intent responses...
2
null
Implement the Python class `DomainResponsePrefixConverter` described below. Class description: Converter responsible for ensuring that retrieval intent actions in domain start with `utter_` instead of `respond_`. Method signatures and docstrings: - def filter(cls, source_path: Path) -> bool: Only accept domain files....
Implement the Python class `DomainResponsePrefixConverter` described below. Class description: Converter responsible for ensuring that retrieval intent actions in domain start with `utter_` instead of `respond_`. Method signatures and docstrings: - def filter(cls, source_path: Path) -> bool: Only accept domain files....
50857610bdf0c26dc61f3203a6cbb4bcf193768c
<|skeleton|> class DomainResponsePrefixConverter: """Converter responsible for ensuring that retrieval intent actions in domain start with `utter_` instead of `respond_`.""" def filter(cls, source_path: Path) -> bool: """Only accept domain files. Args: source_path: Path to a domain file. Returns: `True...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DomainResponsePrefixConverter: """Converter responsible for ensuring that retrieval intent actions in domain start with `utter_` instead of `respond_`.""" def filter(cls, source_path: Path) -> bool: """Only accept domain files. Args: source_path: Path to a domain file. Returns: `True` if the give...
the_stack_v2_python_sparse
rasa/core/training/converters/responses_prefix_converter.py
RasaHQ/rasa
train
13,167
62e9f97b44e7011383ece631c6ebb344b76eff66
[ "link_date_map = self._parse_link_date_map(response)\nmeeting_dt_list = self._parse_upcoming(response)\nmeeting_dates = [dt.date() for dt in meeting_dt_list]\nfor link_date in link_date_map.keys():\n if link_date not in meeting_dates:\n meeting_dt_list.append(datetime.combine(link_date, time(0)))\nfor mee...
<|body_start_0|> link_date_map = self._parse_link_date_map(response) meeting_dt_list = self._parse_upcoming(response) meeting_dates = [dt.date() for dt in meeting_dt_list] for link_date in link_date_map.keys(): if link_date not in meeting_dates: meeting_dt_lis...
ChiIlMedicalDistrictSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChiIlMedicalDistrictSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_title(self, links): """Parse or generate meeting title."...
stack_v2_sparse_classes_36k_train_027980
5,680
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse or generate meeting title.", "name": "_parse_title", "signa...
6
stack_v2_sparse_classes_30k_train_004521
Implement the Python class `ChiIlMedicalDistrictSpider` described below. Class description: Implement the ChiIlMedicalDistrictSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scr...
Implement the Python class `ChiIlMedicalDistrictSpider` described below. Class description: Implement the ChiIlMedicalDistrictSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scr...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class ChiIlMedicalDistrictSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_title(self, links): """Parse or generate meeting title."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChiIlMedicalDistrictSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" link_date_map = self._parse_link_date_map(response) meeting_dt_list = self._parse_upcoming(respon...
the_stack_v2_python_sparse
city_scrapers/spiders/chi_il_medical_district.py
City-Bureau/city-scrapers
train
308
4cf09e72ddf6d0c6a8930e089763d816d9acdbd5
[ "if instance.label:\n try:\n cable_same_serial = Cable.objects.get(label=instance.label)\n except Cable.DoesNotExist:\n return\n if instance.id and cable_same_serial.id == instance.id:\n return\n if self._get_site_slug(cable_same_serial) == self._get_site_slug(instance):\n se...
<|body_start_0|> if instance.label: try: cable_same_serial = Cable.objects.get(label=instance.label) except Cable.DoesNotExist: return if instance.id and cable_same_serial.id == instance.id: return if self._get_site_...
Main class referenced in the Netbox config
Main
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Main: """Main class referenced in the Netbox config""" def validate(self, instance): """Mandatory entry point""" <|body_0|> def _get_site_slug(self, cable): """Get a representative site slug given a cable. Since cables do not have their own site objects, we need ...
stack_v2_sparse_classes_36k_train_027981
2,652
permissive
[ { "docstring": "Mandatory entry point", "name": "validate", "signature": "def validate(self, instance)" }, { "docstring": "Get a representative site slug given a cable. Since cables do not have their own site objects, we need to get it from a subsidiary object, which, depending on the terminatio...
3
stack_v2_sparse_classes_30k_train_007477
Implement the Python class `Main` described below. Class description: Main class referenced in the Netbox config Method signatures and docstrings: - def validate(self, instance): Mandatory entry point - def _get_site_slug(self, cable): Get a representative site slug given a cable. Since cables do not have their own s...
Implement the Python class `Main` described below. Class description: Main class referenced in the Netbox config Method signatures and docstrings: - def validate(self, instance): Mandatory entry point - def _get_site_slug(self, cable): Get a representative site slug given a cable. Since cables do not have their own s...
0e58c08f75bb6fb17c2ce32eba6b49947c811dae
<|skeleton|> class Main: """Main class referenced in the Netbox config""" def validate(self, instance): """Mandatory entry point""" <|body_0|> def _get_site_slug(self, cable): """Get a representative site slug given a cable. Since cables do not have their own site objects, we need ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Main: """Main class referenced in the Netbox config""" def validate(self, instance): """Mandatory entry point""" if instance.label: try: cable_same_serial = Cable.objects.get(label=instance.label) except Cable.DoesNotExist: return ...
the_stack_v2_python_sparse
validators/dcim/cable.py
wikimedia/operations-software-netbox-extras
train
7
c762bfff5189176d65c3fbff3ce653647fc98a63
[ "self._data_context = data_context\nself._sequence_length = sequence_length\nself._num_outer_dims = num_outer_dims", "if isinstance(value, trajectory.Trajectory):\n pass\nelif isinstance(value, trajectory.Transition):\n value = trajectory.Trajectory(step_type=value.time_step.step_type, observation=value.tim...
<|body_start_0|> self._data_context = data_context self._sequence_length = sequence_length self._num_outer_dims = num_outer_dims <|end_body_0|> <|body_start_1|> if isinstance(value, trajectory.Trajectory): pass elif isinstance(value, trajectory.Transition): ...
Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during conversion. This non-strict checking allows...
AsTrajectory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsTrajectory: """Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during con...
stack_v2_sparse_classes_36k_train_027982
24,336
permissive
[ { "docstring": "Create the AsTrajectory converter. Args: data_context: An instance of `DataContext`, typically accessed from the `TFAgent.data_context` property. sequence_length: The required time dimension value (if any), typically determined by the subclass of `TFAgent`. num_outer_dims: Expected number of out...
2
null
Implement the Python class `AsTrajectory` described below. Class description: Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observat...
Implement the Python class `AsTrajectory` described below. Class description: Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observat...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class AsTrajectory: """Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsTrajectory: """Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during conversion. This...
the_stack_v2_python_sparse
tf_agents/agents/data_converter.py
tensorflow/agents
train
2,755
f1620989ed61be9a21630c9afabc0867551b62e2
[ "self.reporting = reporting\nself.github = GitHubService(ghName, ghToken)\nself.artifacts = ArtifactService()\nself.monitoring = MonitoringService()\nself.idle = True\nself.started = 0", "s = os.statvfs(config.prbuildsRoot)\nfreeSpaceMB = s.f_frsize * s.f_bavail / 1000 / 1000\nhealth = {'has free space': freeSpac...
<|body_start_0|> self.reporting = reporting self.github = GitHubService(ghName, ghToken) self.artifacts = ArtifactService() self.monitoring = MonitoringService() self.idle = True self.started = 0 <|end_body_0|> <|body_start_1|> s = os.statvfs(config.prbuildsRoot)...
Trousers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trousers: def __init__(self, reporting, ghName, ghToken): """constructor""" <|body_0|> def is_healthy(self): """we are healthy under these conditions""" <|body_1|> def process(self, action, bucket, metricService): """process a message coming off ...
stack_v2_sparse_classes_36k_train_027983
3,641
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, reporting, ghName, ghToken)" }, { "docstring": "we are healthy under these conditions", "name": "is_healthy", "signature": "def is_healthy(self)" }, { "docstring": "process a message coming off the...
4
stack_v2_sparse_classes_30k_train_013818
Implement the Python class `Trousers` described below. Class description: Implement the Trousers class. Method signatures and docstrings: - def __init__(self, reporting, ghName, ghToken): constructor - def is_healthy(self): we are healthy under these conditions - def process(self, action, bucket, metricService): proc...
Implement the Python class `Trousers` described below. Class description: Implement the Trousers class. Method signatures and docstrings: - def __init__(self, reporting, ghName, ghToken): constructor - def is_healthy(self): we are healthy under these conditions - def process(self, action, bucket, metricService): proc...
1dd8f0959fec8a3bb5e06ee0c4acdd43c509765b
<|skeleton|> class Trousers: def __init__(self, reporting, ghName, ghToken): """constructor""" <|body_0|> def is_healthy(self): """we are healthy under these conditions""" <|body_1|> def process(self, action, bucket, metricService): """process a message coming off ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trousers: def __init__(self, reporting, ghName, ghToken): """constructor""" self.reporting = reporting self.github = GitHubService(ghName, ghToken) self.artifacts = ArtifactService() self.monitoring = MonitoringService() self.idle = True self.started = 0...
the_stack_v2_python_sparse
trousers/trouserlib/trousers.py
guardian/prbuilds
train
6
7010ab9e510a09cd4a08a29ec9004c514cfc0ff5
[ "self.to_address = to_address\nself.from_address = from_address\nif template_type is None:\n self.content = content\n self.subject = subject\nelse:\n template = get_email_template(template_type)\n self.subject = template.subject\n self.content = template.content\n for key in parameters:\n i...
<|body_start_0|> self.to_address = to_address self.from_address = from_address if template_type is None: self.content = content self.subject = subject else: template = get_email_template(template_type) self.subject = template.subject ...
An email object that can be sent to a user Attributes: to_address: A string containing the address to send the email to from_address: A string containing the address the email is being sent from subject: A string containing the subject line of the email content: A string containing the content of the email Class Attrib...
SesEmail
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SesEmail: """An email object that can be sent to a user Attributes: to_address: A string containing the address to send the email to from_address: A string containing the address the email is being sent from subject: A string containing the subject line of the email content: A string containing t...
stack_v2_sparse_classes_36k_train_027984
3,877
permissive
[ { "docstring": "Creates an email object to be sent Args: to_address: Email is sent to this address from_address: This will appear as the sender, must be an address verified through S3 for cloud version content: Body of email subject: Subject line of email template_type: What type of template to use to fill in t...
2
stack_v2_sparse_classes_30k_train_017355
Implement the Python class `SesEmail` described below. Class description: An email object that can be sent to a user Attributes: to_address: A string containing the address to send the email to from_address: A string containing the address the email is being sent from subject: A string containing the subject line of t...
Implement the Python class `SesEmail` described below. Class description: An email object that can be sent to a user Attributes: to_address: A string containing the address to send the email to from_address: A string containing the address the email is being sent from subject: A string containing the subject line of t...
b12c73976fd7eb5728eda90e56e053759c733c35
<|skeleton|> class SesEmail: """An email object that can be sent to a user Attributes: to_address: A string containing the address to send the email to from_address: A string containing the address the email is being sent from subject: A string containing the subject line of the email content: A string containing t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SesEmail: """An email object that can be sent to a user Attributes: to_address: A string containing the address to send the email to from_address: A string containing the address the email is being sent from subject: A string containing the subject line of the email content: A string containing the content of...
the_stack_v2_python_sparse
dataactbroker/handlers/aws/sesEmail.py
fedspendingtransparency/data-act-broker-backend
train
55
a67fc76d6f5d38093377a239c617994c2d0c2bb4
[ "if len(nums) < 4:\n return []\nelse:\n res = {}\n nums.sort()\n for i in range(len(nums)):\n tmp = self.threeSum(nums[i + 1:], target - nums[i])\n if tmp != None:\n for x in tmp:\n x = (nums[i], x[0], x[1], x[2])\n res[x] = 1\n return [[k[0], k[...
<|body_start_0|> if len(nums) < 4: return [] else: res = {} nums.sort() for i in range(len(nums)): tmp = self.threeSum(nums[i + 1:], target - nums[i]) if tmp != None: for x in tmp: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def threeSum(self, nums, t): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027985
2,444
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums, t)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def threeSum(self, nums, t): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def threeSum(self, nums, t): :type nums: List[int] :rtype: List[List[int]] <|s...
b4da922c4e8406c486760639b71e3ec50283ca43
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def threeSum(self, nums, t): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" if len(nums) < 4: return [] else: res = {} nums.sort() for i in range(len(nums)): tmp = self.threeSum(nums[i ...
the_stack_v2_python_sparse
current_session/python/18.py
YJL33/LeetCode
train
3
a5aca745624ef6c32074c18a62eb7edfdf2169fa
[ "self.val_to_indices = defaultdict(list)\nfor i, val in enumerate(arr):\n self.val_to_indices[val].append(i)\nself.vals = sorted(self.val_to_indices.keys(), key=lambda x: len(self.val_to_indices[x]), reverse=True)", "for val in self.vals:\n if len(self.val_to_indices[val]) < threshold:\n break\n l...
<|body_start_0|> self.val_to_indices = defaultdict(list) for i, val in enumerate(arr): self.val_to_indices[val].append(i) self.vals = sorted(self.val_to_indices.keys(), key=lambda x: len(self.val_to_indices[x]), reverse=True) <|end_body_0|> <|body_start_1|> for val in self.v...
MajorityChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MajorityChecker: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, threshold): """:type left: int :type right: int :type threshold: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.val_to...
stack_v2_sparse_classes_36k_train_027986
2,056
no_license
[ { "docstring": ":type arr: List[int]", "name": "__init__", "signature": "def __init__(self, arr)" }, { "docstring": ":type left: int :type right: int :type threshold: int :rtype: int", "name": "query", "signature": "def query(self, left, right, threshold)" } ]
2
null
Implement the Python class `MajorityChecker` described below. Class description: Implement the MajorityChecker class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int
Implement the Python class `MajorityChecker` described below. Class description: Implement the MajorityChecker class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int <|skelet...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class MajorityChecker: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, threshold): """:type left: int :type right: int :type threshold: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MajorityChecker: def __init__(self, arr): """:type arr: List[int]""" self.val_to_indices = defaultdict(list) for i, val in enumerate(arr): self.val_to_indices[val].append(i) self.vals = sorted(self.val_to_indices.keys(), key=lambda x: len(self.val_to_indices[x]), re...
the_stack_v2_python_sparse
python_1001_to_2000/1157_Online_Majority_Element_In_Subarray.py
jakehoare/leetcode
train
58
87f7b41d136ff00e8bebfb02e7d46c84ec52facd
[ "\"\"\"\n 1.每次找出当前序列中最大的数值,把1到该数值位置进行一次翻转,在对全局进行一次翻转,这样最大的数值就会移动到最后\n 2.保持末尾不变,继续重复1的步骤. 2n次就可以完成,n为列表长度.\n 用时应该是O(n^2)\n example:\n [3, 2, 4, 1]\n 1.=>[4, 2, 3, 1]\n 2.=>[1, 3, 2, 4]\n 1.=>[3, 1, 2, 4]\n 2.=>[2, 1, 3, 4]\n 1.=>[1, 2, 3, 4] \...
<|body_start_0|> """ 1.每次找出当前序列中最大的数值,把1到该数值位置进行一次翻转,在对全局进行一次翻转,这样最大的数值就会移动到最后 2.保持末尾不变,继续重复1的步骤. 2n次就可以完成,n为列表长度. 用时应该是O(n^2) example: [3, 2, 4, 1] 1.=>[4, 2, 3, 1] 2.=>[1, 3, 2, 4] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pancakeSort(self, A): """:type A: List[int] :rtype: List[int] 40 ms 11.9 MB""" <|body_0|> def pancakeSort_1(self, A): """32 ms 12 MB :param A: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ 1.每次找出当前序列中最大的数...
stack_v2_sparse_classes_36k_train_027987
2,670
no_license
[ { "docstring": ":type A: List[int] :rtype: List[int] 40 ms 11.9 MB", "name": "pancakeSort", "signature": "def pancakeSort(self, A)" }, { "docstring": "32 ms 12 MB :param A: :return:", "name": "pancakeSort_1", "signature": "def pancakeSort_1(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pancakeSort(self, A): :type A: List[int] :rtype: List[int] 40 ms 11.9 MB - def pancakeSort_1(self, A): 32 ms 12 MB :param A: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pancakeSort(self, A): :type A: List[int] :rtype: List[int] 40 ms 11.9 MB - def pancakeSort_1(self, A): 32 ms 12 MB :param A: :return: <|skeleton|> class Solution: def p...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def pancakeSort(self, A): """:type A: List[int] :rtype: List[int] 40 ms 11.9 MB""" <|body_0|> def pancakeSort_1(self, A): """32 ms 12 MB :param A: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pancakeSort(self, A): """:type A: List[int] :rtype: List[int] 40 ms 11.9 MB""" """ 1.每次找出当前序列中最大的数值,把1到该数值位置进行一次翻转,在对全局进行一次翻转,这样最大的数值就会移动到最后 2.保持末尾不变,继续重复1的步骤. 2n次就可以完成,n为列表长度. 用时应该是O(n^2) example: ...
the_stack_v2_python_sparse
PancakeSorting_MID_969.py
953250587/leetcode-python
train
2
b991da4a6773bdc772ec887c753928770e656172
[ "self.evaluations = 0\nself.simulator = QwopSimulator(time_limit=time_limit)\nstart_qwop()", "try:\n num_strategies = len(strategies)\nexcept TypeError:\n strategies = [strategies]\n num_strategies = len(strategies)\nfitness_values = [(0, 0) for i in range(0, num_strategies)]\nfor index, strategy in enum...
<|body_start_0|> self.evaluations = 0 self.simulator = QwopSimulator(time_limit=time_limit) start_qwop() <|end_body_0|> <|body_start_1|> try: num_strategies = len(strategies) except TypeError: strategies = [strategies] num_strategies = len(str...
QwopEvaluator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QwopEvaluator: def __init__(self, time_limit): """Initialize a QwopEvaluator QwopEvaluator objects run QwopStrategy objects and report the distance run and time taken. Args: time_limit (float): time limit in seconds for each evaluation""" <|body_0|> def evaluate(self, strate...
stack_v2_sparse_classes_36k_train_027988
8,142
permissive
[ { "docstring": "Initialize a QwopEvaluator QwopEvaluator objects run QwopStrategy objects and report the distance run and time taken. Args: time_limit (float): time limit in seconds for each evaluation", "name": "__init__", "signature": "def __init__(self, time_limit)" }, { "docstring": "Evaluat...
2
stack_v2_sparse_classes_30k_train_008042
Implement the Python class `QwopEvaluator` described below. Class description: Implement the QwopEvaluator class. Method signatures and docstrings: - def __init__(self, time_limit): Initialize a QwopEvaluator QwopEvaluator objects run QwopStrategy objects and report the distance run and time taken. Args: time_limit (...
Implement the Python class `QwopEvaluator` described below. Class description: Implement the QwopEvaluator class. Method signatures and docstrings: - def __init__(self, time_limit): Initialize a QwopEvaluator QwopEvaluator objects run QwopStrategy objects and report the distance run and time taken. Args: time_limit (...
7ac9fe0302e1a499a661b11b771df22dd7bf5aad
<|skeleton|> class QwopEvaluator: def __init__(self, time_limit): """Initialize a QwopEvaluator QwopEvaluator objects run QwopStrategy objects and report the distance run and time taken. Args: time_limit (float): time limit in seconds for each evaluation""" <|body_0|> def evaluate(self, strate...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QwopEvaluator: def __init__(self, time_limit): """Initialize a QwopEvaluator QwopEvaluator objects run QwopStrategy objects and report the distance run and time taken. Args: time_limit (float): time limit in seconds for each evaluation""" self.evaluations = 0 self.simulator = QwopSimul...
the_stack_v2_python_sparse
totter/api/qwop.py
zachdj/totter
train
0
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._id_suffix = '_main'\nself._active = True", "if not self._active:\n return\ntry:\n await self.syncthru.update()\nexcept ValueError:\n _LOGGER.warning('Configured printer at %s does not support SyncThru. Consider changing your configuration', self.syncthru.url)\n ...
<|body_start_0|> super().__init__(syncthru, name) self._id_suffix = '_main' self._active = True <|end_body_0|> <|body_start_1|> if not self._active: return try: await self.syncthru.update() except ValueError: _LOGGER.warning('Configure...
Implementation of the main sensor, conducting the actual polling.
SyncThruMainSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruMainSensor: """Implementation of the main sensor, conducting the actual polling.""" def __init__(self, syncthru, name): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_36k_train_027989
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "async_update", "signature": "async def async_update(self)" } ]
2
stack_v2_sparse_classes_30k_val_000101
Implement the Python class `SyncThruMainSensor` described below. Class description: Implementation of the main sensor, conducting the actual polling. Method signatures and docstrings: - def __init__(self, syncthru, name): Initialize the sensor. - async def async_update(self): Get the latest data from SyncThru and upd...
Implement the Python class `SyncThruMainSensor` described below. Class description: Implementation of the main sensor, conducting the actual polling. Method signatures and docstrings: - def __init__(self, syncthru, name): Initialize the sensor. - async def async_update(self): Get the latest data from SyncThru and upd...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruMainSensor: """Implementation of the main sensor, conducting the actual polling.""" def __init__(self, syncthru, name): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyncThruMainSensor: """Implementation of the main sensor, conducting the actual polling.""" def __init__(self, syncthru, name): """Initialize the sensor.""" super().__init__(syncthru, name) self._id_suffix = '_main' self._active = True async def async_update(self): ...
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
2d9b5a2a11b4b00364cf6b322e06001133bc0c98
[ "qe = Queue.Queue(maxsize=0)\nqe.put(root)\ndata = []\nwhile not qe.empty():\n node = qe.get()\n if node:\n data.append(str(node.val))\n qe.put(node.left)\n qe.put(node.right)\n else:\n data.append('null')\nreturn ' '.join(data)", "myiter = iter(data.split())\nqe = Queue.Queue...
<|body_start_0|> qe = Queue.Queue(maxsize=0) qe.put(root) data = [] while not qe.empty(): node = qe.get() if node: data.append(str(node.val)) qe.put(node.left) qe.put(node.right) else: dat...
Codec
[ "MIT" ]
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_36k_train_027990
1,528
permissive
[ { "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
stack_v2_sparse_classes_30k_train_020625
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:...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" qe = Queue.Queue(maxsize=0) qe.put(root) data = [] while not qe.empty(): node = qe.get() if node: data.append(str(node.val...
the_stack_v2_python_sparse
201-300/291-300/297-serializeAndDeserializeBinaryTree/serializeAndDeserializeBinaryTree.py
xuychen/Leetcode
train
0
987d42df036be470f2e3fad417894d620094dcb2
[ "try:\n payload = jwt.decode(data, settings.SECRET_KEY, algorithms=['HS256'])\nexcept jwt.ExpiredSignatureError:\n raise serializers.ValidationError('Verification link has expired.')\nexcept jwt.PyJWTError:\n raise serializers.ValidationError('Invalid token')\nif payload['type'] != 'restore_password':\n ...
<|body_start_0|> try: payload = jwt.decode(data, settings.SECRET_KEY, algorithms=['HS256']) except jwt.ExpiredSignatureError: raise serializers.ValidationError('Verification link has expired.') except jwt.PyJWTError: raise serializers.ValidationError('Invalid ...
Restore user's password serializer.
RestorePasswordSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestorePasswordSerializer: """Restore user's password serializer.""" def validate_token(self, data): """Verify token is valid.""" <|body_0|> def save(self): """Update user's verified status.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_027991
8,178
no_license
[ { "docstring": "Verify token is valid.", "name": "validate_token", "signature": "def validate_token(self, data)" }, { "docstring": "Update user's verified status.", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_011817
Implement the Python class `RestorePasswordSerializer` described below. Class description: Restore user's password serializer. Method signatures and docstrings: - def validate_token(self, data): Verify token is valid. - def save(self): Update user's verified status.
Implement the Python class `RestorePasswordSerializer` described below. Class description: Restore user's password serializer. Method signatures and docstrings: - def validate_token(self, data): Verify token is valid. - def save(self): Update user's verified status. <|skeleton|> class RestorePasswordSerializer: ...
fae5c0b2e388239e2e32a3fbf52aa7cfd48a7cbb
<|skeleton|> class RestorePasswordSerializer: """Restore user's password serializer.""" def validate_token(self, data): """Verify token is valid.""" <|body_0|> def save(self): """Update user's verified status.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestorePasswordSerializer: """Restore user's password serializer.""" def validate_token(self, data): """Verify token is valid.""" try: payload = jwt.decode(data, settings.SECRET_KEY, algorithms=['HS256']) except jwt.ExpiredSignatureError: raise serializers....
the_stack_v2_python_sparse
facebook/app/users/serializers/users.py
ricagome/Api-Facebook-Clone
train
0
3b674af98196bfc08c62a0df7ea0d41d92e3977e
[ "a_int = int(a, 2)\nb_int = int(b, 2)\nresult = a_int + b_int\nreturn str(bin(result))", "if a == None or len(a) < 1:\n return b\nif b == None or len(b) < 1:\n return a\nshort_str = None\nlong_str = None\nif len(a) < len(b):\n short_str = a\n long_str = b\nelse:\n short_str = b\n long_str = a\ni...
<|body_start_0|> a_int = int(a, 2) b_int = int(b, 2) result = a_int + b_int return str(bin(result)) <|end_body_0|> <|body_start_1|> if a == None or len(a) < 1: return b if b == None or len(b) < 1: return a short_str = None long_str...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def add_binary(self, a: str, b: str) -> str: """对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数""" <|body_0|> def add_binary2(self, a: str, b: str) -> str: """对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_027992
2,372
permissive
[ { "docstring": "对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数", "name": "add_binary", "signature": "def add_binary(self, a: str, b: str) -> str" }, { "docstring": "对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数", "name": "add_binary2", "signature": "def add_binary2(self, a: str, b: str)...
2
stack_v2_sparse_classes_30k_train_013599
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def add_binary(self, a: str, b: str) -> str: 对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数 - def add_binary2(self, a: str, b: str) -> str: 对二进制字符串相加减 Args: a: 二进制a b: 二进制b Retur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def add_binary(self, a: str, b: str) -> str: 对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数 - def add_binary2(self, a: str, b: str) -> str: 对二进制字符串相加减 Args: a: 二进制a b: 二进制b Retur...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def add_binary(self, a: str, b: str) -> str: """对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数""" <|body_0|> def add_binary2(self, a: str, b: str) -> str: """对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def add_binary(self, a: str, b: str) -> str: """对二进制字符串相加减 Args: a: 二进制a b: 二进制b Returns: 二进制数""" a_int = int(a, 2) b_int = int(b, 2) result = a_int + b_int return str(bin(result)) def add_binary2(self, a: str, b: str) -> str: """对二进制字符串相加减 Args: ...
the_stack_v2_python_sparse
src/leetcodepython/string/add_binary_67.py
zhangyu345293721/leetcode
train
101
cf354902045860374c08fbe0cd0e7129238035bb
[ "self.match_list = match_list if match_list else {}\nself.match_operator_and = match_operator_and\nself.log = logging.getLogger(__name__)\nself.match_results = []", "if not self.match_list:\n return True\nif field not in self.match_list:\n return True\neval_result = self._test_field_value(field, payload_val...
<|body_start_0|> self.match_list = match_list if match_list else {} self.match_operator_and = match_operator_and self.log = logging.getLogger(__name__) self.match_results = [] <|end_body_0|> <|body_start_1|> if not self.match_list: return True if field not in...
this class handles the criteria for determining if an incident (and it's child objects) are synchronized
Filters
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Filters: """this class handles the criteria for determining if an incident (and it's child objects) are synchronized""" def __init__(self, match_list, match_operator_and): """save the filter criteria, if present :param match_list: list of tuples of (field, operator, value) :param fil...
stack_v2_sparse_classes_36k_train_027993
6,582
permissive
[ { "docstring": "save the filter criteria, if present :param match_list: list of tuples of (field, operator, value) :param filter_operator: any|all", "name": "__init__", "signature": "def __init__(self, match_list, match_operator_and)" }, { "docstring": "for a given payload value, determine if it...
4
null
Implement the Python class `Filters` described below. Class description: this class handles the criteria for determining if an incident (and it's child objects) are synchronized Method signatures and docstrings: - def __init__(self, match_list, match_operator_and): save the filter criteria, if present :param match_li...
Implement the Python class `Filters` described below. Class description: this class handles the criteria for determining if an incident (and it's child objects) are synchronized Method signatures and docstrings: - def __init__(self, match_list, match_operator_and): save the filter criteria, if present :param match_li...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class Filters: """this class handles the criteria for determining if an incident (and it's child objects) are synchronized""" def __init__(self, match_list, match_operator_and): """save the filter criteria, if present :param match_list: list of tuples of (field, operator, value) :param fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Filters: """this class handles the criteria for determining if an incident (and it's child objects) are synchronized""" def __init__(self, match_list, match_operator_and): """save the filter criteria, if present :param match_list: list of tuples of (field, operator, value) :param filter_operator:...
the_stack_v2_python_sparse
rc-data-feed-plugin-resilientfeed/data_feeder_plugins/resilientfeed/lib/filters.py
ibmresilient/resilient-community-apps
train
81
3eda32a0cdad8a6880f11ff57a63443b3bb1d116
[ "boundary, _ = self.get_or_create(org=org, rapidpro_uuid=temba_boundary.osm_id)\nboundary.name = temba_boundary.name\nboundary.level = temba_boundary.level\nboundary.geometry = json.dumps(temba_boundary.geometry.serialize())\nboundary.parent = self.filter(org=org, rapidpro_uuid=temba_boundary.parent).first()\nbound...
<|body_start_0|> boundary, _ = self.get_or_create(org=org, rapidpro_uuid=temba_boundary.osm_id) boundary.name = temba_boundary.name boundary.level = temba_boundary.level boundary.geometry = json.dumps(temba_boundary.geometry.serialize()) boundary.parent = self.filter(org=org, rap...
BoundaryManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoundaryManager: def from_temba(self, org, temba_boundary): """Get the existing or create a new corresponding Boundary instance. Assumes that the boundary's parent, if any, has already been created.""" <|body_0|> def sync(self, org): """Update org Boundaries from Rap...
stack_v2_sparse_classes_36k_train_027994
9,459
permissive
[ { "docstring": "Get the existing or create a new corresponding Boundary instance. Assumes that the boundary's parent, if any, has already been created.", "name": "from_temba", "signature": "def from_temba(self, org, temba_boundary)" }, { "docstring": "Update org Boundaries from RapidPro and dele...
2
null
Implement the Python class `BoundaryManager` described below. Class description: Implement the BoundaryManager class. Method signatures and docstrings: - def from_temba(self, org, temba_boundary): Get the existing or create a new corresponding Boundary instance. Assumes that the boundary's parent, if any, has already...
Implement the Python class `BoundaryManager` described below. Class description: Implement the BoundaryManager class. Method signatures and docstrings: - def from_temba(self, org, temba_boundary): Get the existing or create a new corresponding Boundary instance. Assumes that the boundary's parent, if any, has already...
a68a782a7ff9bb0ccee85368132d8847c280fea3
<|skeleton|> class BoundaryManager: def from_temba(self, org, temba_boundary): """Get the existing or create a new corresponding Boundary instance. Assumes that the boundary's parent, if any, has already been created.""" <|body_0|> def sync(self, org): """Update org Boundaries from Rap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoundaryManager: def from_temba(self, org, temba_boundary): """Get the existing or create a new corresponding Boundary instance. Assumes that the boundary's parent, if any, has already been created.""" boundary, _ = self.get_or_create(org=org, rapidpro_uuid=temba_boundary.osm_id) bound...
the_stack_v2_python_sparse
tracpro/groups/models.py
rapidpro/tracpro
train
5
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if request.version == 'v6':\n return self.post_impl_v6(request)\nelif request.version == 'v7':\n return self.post_impl_v6(request)\nraise Http404()", "configuration = rest_util.parse_dict(request, 'configuration')\nvalidation = Strike.objects.validate_strike_v6(configuration=configuration)\nresp_dict = {'i...
<|body_start_0|> if request.version == 'v6': return self.post_impl_v6(request) elif request.version == 'v7': return self.post_impl_v6(request) raise Http404() <|end_body_0|> <|body_start_1|> configuration = rest_util.parse_dict(request, 'configuration') v...
This view is the endpoint for validating a new Strike process before attempting to actually create it
StrikesValidationView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StrikesValidationView: """This view is the endpoint for validating a new Strike process before attempting to actually create it""" def post(self, request): """Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.re...
stack_v2_sparse_classes_36k_train_027995
30,689
permissive
[ { "docstring": "Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Response` :returns: the HTTP response to send back to the user", "name": "post", "signature": "def post(self...
2
stack_v2_sparse_classes_30k_train_012203
Implement the Python class `StrikesValidationView` described below. Class description: This view is the endpoint for validating a new Strike process before attempting to actually create it Method signatures and docstrings: - def post(self, request): Determine api version and call specific method :param request: the H...
Implement the Python class `StrikesValidationView` described below. Class description: This view is the endpoint for validating a new Strike process before attempting to actually create it Method signatures and docstrings: - def post(self, request): Determine api version and call specific method :param request: the H...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class StrikesValidationView: """This view is the endpoint for validating a new Strike process before attempting to actually create it""" def post(self, request): """Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StrikesValidationView: """This view is the endpoint for validating a new Strike process before attempting to actually create it""" def post(self, request): """Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
21ecc5119db1855689f6c4580a78adf4ddd825e7
[ "self.player = player\nself.item = item\nself.amount = amount\nself.confirm_response = ResponseDialogue('31', player, player, replace=[str(amount * item.sell_price)])\nself.is_dead = False\nself.sub_event = None", "if self.sub_event is not None:\n self.sub_event.draw(draw_surface)\nelse:\n self.confirm_resp...
<|body_start_0|> self.player = player self.item = item self.amount = amount self.confirm_response = ResponseDialogue('31', player, player, replace=[str(amount * item.sell_price)]) self.is_dead = False self.sub_event = None <|end_body_0|> <|body_start_1|> if self....
ConfirmSell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfirmSell: def __init__(self, player, item, amount): """Sub event which asks the user if they really want to go through with the sale.""" <|body_0|> def draw(self, draw_surface): """Draws the sub event if it exists. Otherwise draw the response dialogue.""" ...
stack_v2_sparse_classes_36k_train_027996
36,471
no_license
[ { "docstring": "Sub event which asks the user if they really want to go through with the sale.", "name": "__init__", "signature": "def __init__(self, player, item, amount)" }, { "docstring": "Draws the sub event if it exists. Otherwise draw the response dialogue.", "name": "draw", "signa...
4
stack_v2_sparse_classes_30k_train_008716
Implement the Python class `ConfirmSell` described below. Class description: Implement the ConfirmSell class. Method signatures and docstrings: - def __init__(self, player, item, amount): Sub event which asks the user if they really want to go through with the sale. - def draw(self, draw_surface): Draws the sub event...
Implement the Python class `ConfirmSell` described below. Class description: Implement the ConfirmSell class. Method signatures and docstrings: - def __init__(self, player, item, amount): Sub event which asks the user if they really want to go through with the sale. - def draw(self, draw_surface): Draws the sub event...
6718fdb6555d87f0b7b331c10d64a604431f8e81
<|skeleton|> class ConfirmSell: def __init__(self, player, item, amount): """Sub event which asks the user if they really want to go through with the sale.""" <|body_0|> def draw(self, draw_surface): """Draws the sub event if it exists. Otherwise draw the response dialogue.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfirmSell: def __init__(self, player, item, amount): """Sub event which asks the user if they really want to go through with the sale.""" self.player = player self.item = item self.amount = amount self.confirm_response = ResponseDialogue('31', player, player, replace=...
the_stack_v2_python_sparse
pokered/modules/events/poke_mart_event.py
surranc20/pokered
train
44
d72465be2f3a136cfc0f20c808267f6aedbad74b
[ "exact_user = UserModel.query.filter_by(id=get_jwt_identity().get('id')).first()\nif not exact_user:\n return error_response(message='No associated account ' + 'with this email. 😩', status=404)\nuser_data = UserSchema(exclude=['password']).dump(exact_user)\nreturn success_response(data=user_data)", "user_upda...
<|body_start_0|> exact_user = UserModel.query.filter_by(id=get_jwt_identity().get('id')).first() if not exact_user: return error_response(message='No associated account ' + 'with this email. 😩', status=404) user_data = UserSchema(exclude=['password']).dump(exact_user) return...
UserProfile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfile: def get(self): """Method to handle user profile retrieval""" <|body_0|> def put(self): """Method to handle user data update""" <|body_1|> <|end_skeleton|> <|body_start_0|> exact_user = UserModel.query.filter_by(id=get_jwt_identity().get...
stack_v2_sparse_classes_36k_train_027997
1,726
no_license
[ { "docstring": "Method to handle user profile retrieval", "name": "get", "signature": "def get(self)" }, { "docstring": "Method to handle user data update", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_002792
Implement the Python class `UserProfile` described below. Class description: Implement the UserProfile class. Method signatures and docstrings: - def get(self): Method to handle user profile retrieval - def put(self): Method to handle user data update
Implement the Python class `UserProfile` described below. Class description: Implement the UserProfile class. Method signatures and docstrings: - def get(self): Method to handle user profile retrieval - def put(self): Method to handle user data update <|skeleton|> class UserProfile: def get(self): """Me...
af51fbce01c800bef3d8ea70f2f7d81d1c4e1800
<|skeleton|> class UserProfile: def get(self): """Method to handle user profile retrieval""" <|body_0|> def put(self): """Method to handle user data update""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserProfile: def get(self): """Method to handle user profile retrieval""" exact_user = UserModel.query.filter_by(id=get_jwt_identity().get('id')).first() if not exact_user: return error_response(message='No associated account ' + 'with this email. 😩', status=404) u...
the_stack_v2_python_sparse
resources/user_resource.py
jesseinit/my-diary-flask
train
0
fca2a5f6d251aa17f67ada6e609437a8aefd06cd
[ "m, n = (len(grid), len(grid[0]))\n\n@lru_cache(None)\ndef dp(r, i, j):\n if r == m:\n return 0\n ret = grid[r][i] + (grid[r][j] if i != j else 0)\n sub = 0\n for di, dj in [(x, y) for x in [-1, 0, 1] for y in [-1, 0, 1]]:\n ni = i + di\n nj = j + dj\n if 0 <= ni < n and 0 <=...
<|body_start_0|> m, n = (len(grid), len(grid[0])) @lru_cache(None) def dp(r, i, j): if r == m: return 0 ret = grid[r][i] + (grid[r][j] if i != j else 0) sub = 0 for di, dj in [(x, y) for x in [-1, 0, 1] for y in [-1, 0, 1]]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def cherryPickup(self, grid: List[List[int]]) -> int: """Top down recursion Time complexity: O(m*n^2) Space complexity: O(m*n^2)""" <|body_0|> def cherryPickup(self, grid: List[List[int]]) -> int: """Bottom up dp Time complexity: O(m*n^2) Space complexity: ...
stack_v2_sparse_classes_36k_train_027998
3,616
no_license
[ { "docstring": "Top down recursion Time complexity: O(m*n^2) Space complexity: O(m*n^2)", "name": "cherryPickup", "signature": "def cherryPickup(self, grid: List[List[int]]) -> int" }, { "docstring": "Bottom up dp Time complexity: O(m*n^2) Space complexity: O(n^2)", "name": "cherryPickup", ...
2
stack_v2_sparse_classes_30k_train_005611
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cherryPickup(self, grid: List[List[int]]) -> int: Top down recursion Time complexity: O(m*n^2) Space complexity: O(m*n^2) - def cherryPickup(self, grid: List[List[int]]) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cherryPickup(self, grid: List[List[int]]) -> int: Top down recursion Time complexity: O(m*n^2) Space complexity: O(m*n^2) - def cherryPickup(self, grid: List[List[int]]) -> i...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def cherryPickup(self, grid: List[List[int]]) -> int: """Top down recursion Time complexity: O(m*n^2) Space complexity: O(m*n^2)""" <|body_0|> def cherryPickup(self, grid: List[List[int]]) -> int: """Bottom up dp Time complexity: O(m*n^2) Space complexity: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def cherryPickup(self, grid: List[List[int]]) -> int: """Top down recursion Time complexity: O(m*n^2) Space complexity: O(m*n^2)""" m, n = (len(grid), len(grid[0])) @lru_cache(None) def dp(r, i, j): if r == m: return 0 ret = gr...
the_stack_v2_python_sparse
leetcode/solved/1559_Cherry_Pickup_II/solution.py
sungminoh/algorithms
train
0
1e07285cf302a4296094a4b27b954284f8ea7179
[ "self.num_nodes = -1\nself.num_edges = -1\nself.adjacency_lists = []\nself.nodes = []", "with open(filename) as f:\n self.num_nodes = int(f.readline())\n self.num_edges = int(f.readline())\n for u in range(0, self.num_nodes):\n self.nodes.append(Node(u, *f.readline().strip().split('\\t')))\n ...
<|body_start_0|> self.num_nodes = -1 self.num_edges = -1 self.adjacency_lists = [] self.nodes = [] <|end_body_0|> <|body_start_1|> with open(filename) as f: self.num_nodes = int(f.readline()) self.num_edges = int(f.readline()) for u in range(0...
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: def __init__(self): """Create an empty directed graph.""" <|body_0|> def read(self, filename): """Read a graph from file. >>> g = Graph() >>> g.read('example.graph') >>> g [0->3|3, 1->0|1, 1->2|-2, 2->3|2, 3->2|5]""" <|body_1|> def __repr__(self):...
stack_v2_sparse_classes_36k_train_027999
2,335
no_license
[ { "docstring": "Create an empty directed graph.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Read a graph from file. >>> g = Graph() >>> g.read('example.graph') >>> g [0->3|3, 1->0|1, 1->2|-2, 2->3|2, 3->2|5]", "name": "read", "signature": "def read(self, fi...
3
stack_v2_sparse_classes_30k_train_016548
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self): Create an empty directed graph. - def read(self, filename): Read a graph from file. >>> g = Graph() >>> g.read('example.graph') >>> g [0->3|3, 1->0|1, 1->2|-2, 2->3...
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self): Create an empty directed graph. - def read(self, filename): Read a graph from file. >>> g = Graph() >>> g.read('example.graph') >>> g [0->3|3, 1->0|1, 1->2|-2, 2->3...
5e51c57c17ee8c233a0fe63f32942e80549040fd
<|skeleton|> class Graph: def __init__(self): """Create an empty directed graph.""" <|body_0|> def read(self, filename): """Read a graph from file. >>> g = Graph() >>> g.read('example.graph') >>> g [0->3|3, 1->0|1, 1->2|-2, 2->3|2, 3->2|5]""" <|body_1|> def __repr__(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: def __init__(self): """Create an empty directed graph.""" self.num_nodes = -1 self.num_edges = -1 self.adjacency_lists = [] self.nodes = [] def read(self, filename): """Read a graph from file. >>> g = Graph() >>> g.read('example.graph') >>> g [0->3|3...
the_stack_v2_python_sparse
semester_two/algoDat/public/code/vorlesung-10/vorlagen/python/graph.py
fkarg/uni-stuff
train
0