blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
bfdeb5361db702beebbe017c4450f5f4e094b533
[ "if logdir is None:\n raise ValueError('A logdir is required')\nif directory_loader_factory is None:\n raise ValueError('A directory loader factory is required')\nself._logdir = logdir\nself._directory_loader_factory = directory_loader_factory\nself._directory_loaders = {}", "logger.info('Starting logdir tr...
<|body_start_0|> if logdir is None: raise ValueError('A logdir is required') if directory_loader_factory is None: raise ValueError('A directory loader factory is required') self._logdir = logdir self._directory_loader_factory = directory_loader_factory sel...
Loader for a root log directory, maintaining multiple DirectoryLoaders. This class takes a root log directory and a factory for DirectoryLoaders, and maintains one DirectoryLoader per "logdir subdirectory" of the root logdir. Note that this class is not thread-safe.
LogdirLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogdirLoader: """Loader for a root log directory, maintaining multiple DirectoryLoaders. This class takes a root log directory and a factory for DirectoryLoaders, and maintains one DirectoryLoader per "logdir subdirectory" of the root logdir. Note that this class is not thread-safe.""" def _...
stack_v2_sparse_classes_10k_train_007700
4,418
permissive
[ { "docstring": "Constructs a new LogdirLoader. Args: logdir: The root log directory to load from. directory_loader_factory: A factory for creating DirectoryLoaders. The factory should take a path and return a DirectoryLoader. Raises: ValueError: If logdir or directory_loader_factory are None.", "name": "__i...
4
null
Implement the Python class `LogdirLoader` described below. Class description: Loader for a root log directory, maintaining multiple DirectoryLoaders. This class takes a root log directory and a factory for DirectoryLoaders, and maintains one DirectoryLoader per "logdir subdirectory" of the root logdir. Note that this ...
Implement the Python class `LogdirLoader` described below. Class description: Loader for a root log directory, maintaining multiple DirectoryLoaders. This class takes a root log directory and a factory for DirectoryLoaders, and maintains one DirectoryLoader per "logdir subdirectory" of the root logdir. Note that this ...
5961c76dca0fb9bb40d146f5ce13834ac29d8ddb
<|skeleton|> class LogdirLoader: """Loader for a root log directory, maintaining multiple DirectoryLoaders. This class takes a root log directory and a factory for DirectoryLoaders, and maintains one DirectoryLoader per "logdir subdirectory" of the root logdir. Note that this class is not thread-safe.""" def _...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LogdirLoader: """Loader for a root log directory, maintaining multiple DirectoryLoaders. This class takes a root log directory and a factory for DirectoryLoaders, and maintains one DirectoryLoader per "logdir subdirectory" of the root logdir. Note that this class is not thread-safe.""" def __init__(self,...
the_stack_v2_python_sparse
tensorboard/uploader/logdir_loader.py
tensorflow/tensorboard
train
6,766
d8b37a686ef9e8dad507b9c0e276acbd212d1e67
[ "try:\n resource, authorized, user = view_utils.authorize(request, pk, needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE, raises_exception=False)\nexcept NotFound as ex:\n return Response(str(ex), status=status.HTTP_404_NOT_FOUND)\nif not authorized:\n return Response('Insufficient permission', status=st...
<|body_start_0|> try: resource, authorized, user = view_utils.authorize(request, pk, needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE, raises_exception=False) except NotFound as ex: return Response(str(ex), status=status.HTTP_404_NOT_FOUND) if not authorized: ...
list or delete a ticket Methods: GET, DELETE Returns: HTTP 200, 400, 403, 403 Example of a correct list request: GET /hsapi/resource/28f87079ceaf440588e7866a0f4b6c57/ticket/info/pwYwPanpnwdDZa9/ This returns HTTP_200_OK with content: {u'expires': u'2017-07-26.00:17:00', u'filename': u'28f87079ceaf440588e7866a0f4b6c57.z...
ManageResourceTicket
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageResourceTicket: """list or delete a ticket Methods: GET, DELETE Returns: HTTP 200, 400, 403, 403 Example of a correct list request: GET /hsapi/resource/28f87079ceaf440588e7866a0f4b6c57/ticket/info/pwYwPanpnwdDZa9/ This returns HTTP_200_OK with content: {u'expires': u'2017-07-26.00:17:00', u...
stack_v2_sparse_classes_10k_train_007701
9,855
permissive
[ { "docstring": "list a ticket", "name": "get", "signature": "def get(self, request, pk, ticket)" }, { "docstring": "Delete a ticket.", "name": "delete", "signature": "def delete(self, request, pk, ticket)" } ]
2
null
Implement the Python class `ManageResourceTicket` described below. Class description: list or delete a ticket Methods: GET, DELETE Returns: HTTP 200, 400, 403, 403 Example of a correct list request: GET /hsapi/resource/28f87079ceaf440588e7866a0f4b6c57/ticket/info/pwYwPanpnwdDZa9/ This returns HTTP_200_OK with content:...
Implement the Python class `ManageResourceTicket` described below. Class description: list or delete a ticket Methods: GET, DELETE Returns: HTTP 200, 400, 403, 403 Example of a correct list request: GET /hsapi/resource/28f87079ceaf440588e7866a0f4b6c57/ticket/info/pwYwPanpnwdDZa9/ This returns HTTP_200_OK with content:...
69855813052243c702c9b0108d2eac3f4f1a768f
<|skeleton|> class ManageResourceTicket: """list or delete a ticket Methods: GET, DELETE Returns: HTTP 200, 400, 403, 403 Example of a correct list request: GET /hsapi/resource/28f87079ceaf440588e7866a0f4b6c57/ticket/info/pwYwPanpnwdDZa9/ This returns HTTP_200_OK with content: {u'expires': u'2017-07-26.00:17:00', u...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManageResourceTicket: """list or delete a ticket Methods: GET, DELETE Returns: HTTP 200, 400, 403, 403 Example of a correct list request: GET /hsapi/resource/28f87079ceaf440588e7866a0f4b6c57/ticket/info/pwYwPanpnwdDZa9/ This returns HTTP_200_OK with content: {u'expires': u'2017-07-26.00:17:00', u'filename': u...
the_stack_v2_python_sparse
hs_core/views/resource_ticket_rest_api.py
hydroshare/hydroshare
train
207
da3e17185f9575429b96e8f1cd541f1bc9a45d9f
[ "mini, maxa = (0, len(S))\nret = []\nfor c in S:\n if c == 'I':\n ret.append(mini)\n mini += 1\n else:\n ret.append(maxa)\n maxa -= 1\nret.append(mini)\nreturn ret", "ret = [0]\nfor c in S:\n if c == 'I':\n ret.append(ret[-1] + 1)\n else:\n ret.append(ret[-1] ...
<|body_start_0|> mini, maxa = (0, len(S)) ret = [] for c in S: if c == 'I': ret.append(mini) mini += 1 else: ret.append(maxa) maxa -= 1 ret.append(mini) return ret <|end_body_0|> <|body_start...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def diStringMatch(self, S: str) -> List[int]: """Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decrese from the max""" <|body_0|> def diStringMatchErrror(self, S: str) -> List[int]: ...
stack_v2_sparse_classes_10k_train_007702
1,464
no_license
[ { "docstring": "Looking at prev rather than cur If \"I\", then put smallest as prev. Increase from the min If \"D\", then put the largest as prev. Decrese from the max", "name": "diStringMatch", "signature": "def diStringMatch(self, S: str) -> List[int]" }, { "docstring": "start with 0, then add...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def diStringMatch(self, S: str) -> List[int]: Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decre...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def diStringMatch(self, S: str) -> List[int]: Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decre...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def diStringMatch(self, S: str) -> List[int]: """Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decrese from the max""" <|body_0|> def diStringMatchErrror(self, S: str) -> List[int]: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def diStringMatch(self, S: str) -> List[int]: """Looking at prev rather than cur If "I", then put smallest as prev. Increase from the min If "D", then put the largest as prev. Decrese from the max""" mini, maxa = (0, len(S)) ret = [] for c in S: if c == 'I...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/942 DI String Match.py
syurskyi/Algorithms_and_Data_Structure
train
4
1889934b14d1cee0ce13c5c48692522caac2fe78
[ "ws = set(wordDict)\nif s in ws:\n return True\ndp = [False for _ in range(len(s) + 1)]\ndp[0] = True\nfor end in range(len(dp)):\n for start in range(end):\n if dp[start] and s[start:end] in ws:\n dp[end] = True\nreturn dp[-1]", "ws = set(wordDict)\nif s in ws:\n return True\nstack = [...
<|body_start_0|> ws = set(wordDict) if s in ws: return True dp = [False for _ in range(len(s) + 1)] dp[0] = True for end in range(len(dp)): for start in range(end): if dp[start] and s[start:end] in ws: dp[end] = True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak2(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_007703
2,198
no_license
[ { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak2", "signature": "def wordBreak2(self, s, wordDict)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" } ]
2
stack_v2_sparse_classes_30k_train_001416
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak2(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak2(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool <|...
b4da922c4e8406c486760639b71e3ec50283ca43
<|skeleton|> class Solution: def wordBreak2(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak2(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" ws = set(wordDict) if s in ws: return True dp = [False for _ in range(len(s) + 1)] dp[0] = True for end in range(len(dp)): for start in...
the_stack_v2_python_sparse
current_session/python/139_redo2.py
YJL33/LeetCode
train
3
b5256b0fe198c2c8832405b53ac4a10fd5b8be39
[ "from core.tracing import get_tracer\nself.__tracer = get_tracer('CSVDevice')\nself.__tracer.info('Initializing CSVDevice')\nself.name = name\nself.core = core_services\nself.tracer = get_tracer(name)\nself.tdict = {}\nself.prop_names = []\nself.dm = self.core.get_service('device_driver_manager')\nself.channel_mana...
<|body_start_0|> from core.tracing import get_tracer self.__tracer = get_tracer('CSVDevice') self.__tracer.info('Initializing CSVDevice') self.name = name self.core = core_services self.tracer = get_tracer(name) self.tdict = {} self.prop_names = [] ...
- name: CSVDevice driver: devices.csv_device:CSVDevice settings: channel_pattern: "*.csv_input" delimiter: ',' column_names: - "timestamp" - "status" - "error_msg" CSVDevice is a virtual device that parsed a delimited stream of data. The delimited data is then returned to the source's parent driver as new properties na...
CSVDevice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVDevice: """- name: CSVDevice driver: devices.csv_device:CSVDevice settings: channel_pattern: "*.csv_input" delimiter: ',' column_names: - "timestamp" - "status" - "error_msg" CSVDevice is a virtual device that parsed a delimited stream of data. The delimited data is then returned to the source...
stack_v2_sparse_classes_10k_train_007704
9,108
no_license
[ { "docstring": "Standard device init function.", "name": "__init__", "signature": "def __init__(self, name, core_services)" }, { "docstring": "This procedure processes that match the pattern, then subscribes to those channels to continue processing upon updates.", "name": "start", "signa...
5
null
Implement the Python class `CSVDevice` described below. Class description: - name: CSVDevice driver: devices.csv_device:CSVDevice settings: channel_pattern: "*.csv_input" delimiter: ',' column_names: - "timestamp" - "status" - "error_msg" CSVDevice is a virtual device that parsed a delimited stream of data. The delimi...
Implement the Python class `CSVDevice` described below. Class description: - name: CSVDevice driver: devices.csv_device:CSVDevice settings: channel_pattern: "*.csv_input" delimiter: ',' column_names: - "timestamp" - "status" - "error_msg" CSVDevice is a virtual device that parsed a delimited stream of data. The delimi...
f36ba29ef883d70f94b8609ff734b5dcde786c66
<|skeleton|> class CSVDevice: """- name: CSVDevice driver: devices.csv_device:CSVDevice settings: channel_pattern: "*.csv_input" delimiter: ',' column_names: - "timestamp" - "status" - "error_msg" CSVDevice is a virtual device that parsed a delimited stream of data. The delimited data is then returned to the source...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CSVDevice: """- name: CSVDevice driver: devices.csv_device:CSVDevice settings: channel_pattern: "*.csv_input" delimiter: ',' column_names: - "timestamp" - "status" - "error_msg" CSVDevice is a virtual device that parsed a delimited stream of data. The delimited data is then returned to the source's parent dri...
the_stack_v2_python_sparse
src/devices/csv_device.py
bernhara/DigiGateway4Raph
train
0
8f364b2151b821d8ce85ebe1ce3a3d4ffed67940
[ "n = len(arr)\nleft = [float('inf') for _ in range(n)]\nright = [float('inf') for _ in range(n)]\npresum = {0: -1}\ncurr = 0\nfor i in range(n):\n curr += arr[i]\n if i > 0:\n left[i] = left[i - 1]\n if curr - target in presum:\n left[i] = min(left[i], i - presum[curr - target])\n presum[c...
<|body_start_0|> n = len(arr) left = [float('inf') for _ in range(n)] right = [float('inf') for _ in range(n)] presum = {0: -1} curr = 0 for i in range(n): curr += arr[i] if i > 0: left[i] = left[i - 1] if curr - target ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSumOfLengths(self, arr: List[int], target: int) -> int: """left: left[i] is min subarr len to the left of i right: right[i] is min subarr len to the right of i return min(left[i] + right[i + 1] for i: 0 to n - 2)""" <|body_0|> def minSumOfLengths(self, arr: ...
stack_v2_sparse_classes_10k_train_007705
3,270
no_license
[ { "docstring": "left: left[i] is min subarr len to the left of i right: right[i] is min subarr len to the right of i return min(left[i] + right[i + 1] for i: 0 to n - 2)", "name": "minSumOfLengths", "signature": "def minSumOfLengths(self, arr: List[int], target: int) -> int" }, { "docstring": "d...
2
stack_v2_sparse_classes_30k_train_006202
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSumOfLengths(self, arr: List[int], target: int) -> int: left: left[i] is min subarr len to the left of i right: right[i] is min subarr len to the right of i return min(lef...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSumOfLengths(self, arr: List[int], target: int) -> int: left: left[i] is min subarr len to the left of i right: right[i] is min subarr len to the right of i return min(lef...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def minSumOfLengths(self, arr: List[int], target: int) -> int: """left: left[i] is min subarr len to the left of i right: right[i] is min subarr len to the right of i return min(left[i] + right[i + 1] for i: 0 to n - 2)""" <|body_0|> def minSumOfLengths(self, arr: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minSumOfLengths(self, arr: List[int], target: int) -> int: """left: left[i] is min subarr len to the left of i right: right[i] is min subarr len to the right of i return min(left[i] + right[i + 1] for i: 0 to n - 2)""" n = len(arr) left = [float('inf') for _ in range(n)] ...
the_stack_v2_python_sparse
Leetcode 1477. Find Two Non-overlapping Sub-arrays Each With Target Sum.py
Chaoran-sjsu/leetcode
train
0
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTriggerDistanceToVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._other_actor = other_actor\nself._actor = actor\nself._distance = distance", "new_status = py_trees.common.Status.RUNNING\nego_location = CarlaDataProvider.get_location(self._actor)\nother_l...
<|body_start_0|> super(InTriggerDistanceToVehicle, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._other_actor = other_actor self._actor = actor self._distance = distance <|end_body_0|> <|body_start_1|> new_status = py_trees.common...
This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two actors in meters The condition terminates with SUCCESS, ...
InTriggerDistanceToVehicle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerDistanceToVehicle: """This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two ac...
stack_v2_sparse_classes_10k_train_007706
18,494
permissive
[ { "docstring": "Setup trigger distance", "name": "__init__", "signature": "def __init__(self, other_actor, actor, distance, name='TriggerDistanceToVehicle')" }, { "docstring": "Check if the ego vehicle is within trigger distance to other actor", "name": "update", "signature": "def update...
2
stack_v2_sparse_classes_30k_train_000985
Implement the Python class `InTriggerDistanceToVehicle` described below. Class description: This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distan...
Implement the Python class `InTriggerDistanceToVehicle` described below. Class description: This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distan...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTriggerDistanceToVehicle: """This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two ac...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InTriggerDistanceToVehicle: """This class contains the trigger distance (condition) between to actors of a scenario Important parameters: - actor: CARLA actor to execute the behavior - other_actor: Reference CARLA actor - name: Name of the condition - distance: Trigger distance between the two actors in meter...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
cc17d071b4a5186f64619792d23a41a1018ffd9c
[ "self.clustering = clustering\nself.cluster_stabilities = cluster_stabilities\nself._descendant_cache = dict()", "cache_id = (cluster_id_1, cluster_id_2)\nif cache_id in self._descendant_cache:\n return self._descendant_cache[cache_id]\ncluster_intersection = self.clustering[cluster_id_1] & self.clustering[clu...
<|body_start_0|> self.clustering = clustering self.cluster_stabilities = cluster_stabilities self._descendant_cache = dict() <|end_body_0|> <|body_start_1|> cache_id = (cluster_id_1, cluster_id_2) if cache_id in self._descendant_cache: return self._descendant_cache[c...
Finds child-parent relationships and removes children if parent is better than worse child, otherwise it removes parent.
ClusterDeduper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterDeduper: """Finds child-parent relationships and removes children if parent is better than worse child, otherwise it removes parent.""" def __init__(self, clustering, cluster_stabilities): """:param clustering: cluster_id -> set of points :type clustering: dict[int, set[collec...
stack_v2_sparse_classes_10k_train_007707
4,546
permissive
[ { "docstring": ":param clustering: cluster_id -> set of points :type clustering: dict[int, set[collections.Hashable]] :param cluster_stabilities: :type cluster_stabilities: dict[int, numbers.Real]", "name": "__init__", "signature": "def __init__(self, clustering, cluster_stabilities)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_001207
Implement the Python class `ClusterDeduper` described below. Class description: Finds child-parent relationships and removes children if parent is better than worse child, otherwise it removes parent. Method signatures and docstrings: - def __init__(self, clustering, cluster_stabilities): :param clustering: cluster_i...
Implement the Python class `ClusterDeduper` described below. Class description: Finds child-parent relationships and removes children if parent is better than worse child, otherwise it removes parent. Method signatures and docstrings: - def __init__(self, clustering, cluster_stabilities): :param clustering: cluster_i...
bbf24fa7b80d32fae4b8c973a8fc3654eb63cadf
<|skeleton|> class ClusterDeduper: """Finds child-parent relationships and removes children if parent is better than worse child, otherwise it removes parent.""" def __init__(self, clustering, cluster_stabilities): """:param clustering: cluster_id -> set of points :type clustering: dict[int, set[collec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClusterDeduper: """Finds child-parent relationships and removes children if parent is better than worse child, otherwise it removes parent.""" def __init__(self, clustering, cluster_stabilities): """:param clustering: cluster_id -> set of points :type clustering: dict[int, set[collections.Hashabl...
the_stack_v2_python_sparse
python/analysis/ClusterDeduper.py
nog642/himag-release-asonam
train
0
eb640963f9ed25f83d8df1698d6f0f5713419449
[ "if 'modifier' in kwargs:\n self.modifier = kwargs['modifier']\nelif len(args) > 2:\n self.modifier = args[2]\n args = args[:2]\nelse:\n self.modifier = lambda x: x\nif not six.callable(self.modifier):\n raise TypeError('itermod(o, modifier): modifier must be callable')\nsuper(itermod, self).__init__...
<|body_start_0|> if 'modifier' in kwargs: self.modifier = kwargs['modifier'] elif len(args) > 2: self.modifier = args[2] args = args[:2] else: self.modifier = lambda x: x if not six.callable(self.modifier): raise TypeError('iter...
An iterator object that supports modifying items as they are returned. >>> a = [" A list ", ... " of strings ", ... " with ", ... " extra ", ... " whitespace. "] >>> modifier = lambda s: s.strip().replace('with', 'without') >>> for s in itermod(a, modifier=modifier): ... print('"%s"' % s) "A list" "of strings" "without...
itermod
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class itermod: """An iterator object that supports modifying items as they are returned. >>> a = [" A list ", ... " of strings ", ... " with ", ... " extra ", ... " whitespace. "] >>> modifier = lambda s: s.strip().replace('with', 'without') >>> for s in itermod(a, modifier=modifier): ... print('"%s"' ...
stack_v2_sparse_classes_10k_train_007708
8,468
permissive
[ { "docstring": "__init__(o, sentinel=None, modifier=lambda x: x)", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Cache `n` modified items. If `n` is 0 or None, 1 item is cached. Each item returned by the iterator is passed through the `itermod.modified...
2
null
Implement the Python class `itermod` described below. Class description: An iterator object that supports modifying items as they are returned. >>> a = [" A list ", ... " of strings ", ... " with ", ... " extra ", ... " whitespace. "] >>> modifier = lambda s: s.strip().replace('with', 'without') >>> for s in itermod(a...
Implement the Python class `itermod` described below. Class description: An iterator object that supports modifying items as they are returned. >>> a = [" A list ", ... " of strings ", ... " with ", ... " extra ", ... " whitespace. "] >>> modifier = lambda s: s.strip().replace('with', 'without') >>> for s in itermod(a...
05dbd4575d01a213f3f4d69aa4968473f2536142
<|skeleton|> class itermod: """An iterator object that supports modifying items as they are returned. >>> a = [" A list ", ... " of strings ", ... " with ", ... " extra ", ... " whitespace. "] >>> modifier = lambda s: s.strip().replace('with', 'without') >>> for s in itermod(a, modifier=modifier): ... print('"%s"' ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class itermod: """An iterator object that supports modifying items as they are returned. >>> a = [" A list ", ... " of strings ", ... " with ", ... " extra ", ... " whitespace. "] >>> modifier = lambda s: s.strip().replace('with', 'without') >>> for s in itermod(a, modifier=modifier): ... print('"%s"' % s) "A list"...
the_stack_v2_python_sparse
python/helpers/pockets/iterators.py
JetBrains/intellij-community
train
16,288
d4bf322be501cd9bfbf4c71d03cc1afaa6da019b
[ "self._path = path\nself._summary_dirs: List[Path] = []\nevent_files = self._discover_event_files(self._path)\ncb_summaries = self._discover_cerebras_summary_dirs(event_files)\nself._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries)\nif not self._summary_dirs:\n logging.warning(f'Could not find any...
<|body_start_0|> self._path = path self._summary_dirs: List[Path] = [] event_files = self._discover_event_files(self._path) cb_summaries = self._discover_cerebras_summary_dirs(event_files) self._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries) if not self._...
Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live run. As more data becomes available, calling the ...
TensorSummaryReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorSummaryReader: """Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live ru...
stack_v2_sparse_classes_10k_train_007709
16,325
permissive
[ { "docstring": "Constructs a `TensorSummaryReader` instance. Args: path: Path to a Tensorboard events file or a directory containing Tensorboard events files. Location of tensor summaries are inferred from these events files as there is a one-to-one mapping from Tensorboard events files and tensor summary direc...
6
stack_v2_sparse_classes_30k_train_005550
Implement the Python class `TensorSummaryReader` described below. Class description: Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching....
Implement the Python class `TensorSummaryReader` described below. Class description: Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching....
97bdaf4460ace1681ad437b07ba33f0e179f5ca4
<|skeleton|> class TensorSummaryReader: """Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live ru...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TensorSummaryReader: """Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live run. As more da...
the_stack_v2_python_sparse
modelzoo/common/pytorch/summaries/tensor_summary.py
Cerebras/modelzoo
train
644
dafeb5ffc6685f724a581d5e9d23054b7d161d71
[ "self.bbox_roi_extractor = build_roi_extractor(bbox_roi_extractor)\nif bbox_head.type == 'Shared2FCBBoxHead':\n bbox_head.type = 'CustomConvFCBBoxHead'\nself.bbox_head = build_head(bbox_head)", "rois = bbox2roi([res.bboxes for res in sampling_results])\nbbox_results = self._bbox_forward(x, rois)\nlabels, label...
<|body_start_0|> self.bbox_roi_extractor = build_roi_extractor(bbox_roi_extractor) if bbox_head.type == 'Shared2FCBBoxHead': bbox_head.type = 'CustomConvFCBBoxHead' self.bbox_head = build_head(bbox_head) <|end_body_0|> <|body_start_1|> rois = bbox2roi([res.bboxes for res in ...
CustomROIHead class for OTX.
CustomRoIHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomRoIHead: """CustomROIHead class for OTX.""" def init_bbox_head(self, bbox_roi_extractor, bbox_head): """Initialize ``bbox_head``.""" <|body_0|> def _bbox_forward_train(self, x, sampling_results, gt_bboxes, gt_labels, img_metas): """Run forward function and ...
stack_v2_sparse_classes_10k_train_007710
8,559
permissive
[ { "docstring": "Initialize ``bbox_head``.", "name": "init_bbox_head", "signature": "def init_bbox_head(self, bbox_roi_extractor, bbox_head)" }, { "docstring": "Run forward function and calculate loss for box head in training.", "name": "_bbox_forward_train", "signature": "def _bbox_forwa...
2
null
Implement the Python class `CustomRoIHead` described below. Class description: CustomROIHead class for OTX. Method signatures and docstrings: - def init_bbox_head(self, bbox_roi_extractor, bbox_head): Initialize ``bbox_head``. - def _bbox_forward_train(self, x, sampling_results, gt_bboxes, gt_labels, img_metas): Run ...
Implement the Python class `CustomRoIHead` described below. Class description: CustomROIHead class for OTX. Method signatures and docstrings: - def init_bbox_head(self, bbox_roi_extractor, bbox_head): Initialize ``bbox_head``. - def _bbox_forward_train(self, x, sampling_results, gt_bboxes, gt_labels, img_metas): Run ...
80454808b38727e358e8b880043eeac0f18152fb
<|skeleton|> class CustomRoIHead: """CustomROIHead class for OTX.""" def init_bbox_head(self, bbox_roi_extractor, bbox_head): """Initialize ``bbox_head``.""" <|body_0|> def _bbox_forward_train(self, x, sampling_results, gt_bboxes, gt_labels, img_metas): """Run forward function and ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomRoIHead: """CustomROIHead class for OTX.""" def init_bbox_head(self, bbox_roi_extractor, bbox_head): """Initialize ``bbox_head``.""" self.bbox_roi_extractor = build_roi_extractor(bbox_roi_extractor) if bbox_head.type == 'Shared2FCBBoxHead': bbox_head.type = 'Cust...
the_stack_v2_python_sparse
src/otx/algorithms/detection/adapters/mmdet/models/heads/custom_roi_head.py
openvinotoolkit/training_extensions
train
397
a6fd5a79e0892cbf08161f34eed2ade38d5f07fd
[ "v1 = Vector(v1, copy=False)\nv2 = Vector(v2, copy=False)\nn1 = v1.norm()\nn2 = v2.norm()\nif n1 == 0 or n2 == 0:\n raise ValueError(\"Can't calculate angle between zero length vectors !\")\ncos_a = v1.dot(v2) / (n1 * n2)\ncos_a = max(-1.0, min(1.0, cos_a))\nreturn math.acos(cos_a)", "p1 = Vector(p1, copy=Fals...
<|body_start_0|> v1 = Vector(v1, copy=False) v2 = Vector(v2, copy=False) n1 = v1.norm() n2 = v2.norm() if n1 == 0 or n2 == 0: raise ValueError("Can't calculate angle between zero length vectors !") cos_a = v1.dot(v2) / (n1 * n2) cos_a = max(-1.0, min(1...
Represents a triangle constructed from different other geometrical entities.
Triangle
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triangle: """Represents a triangle constructed from different other geometrical entities.""" def angle_between_vectors(v1, v2): """Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError."...
stack_v2_sparse_classes_10k_train_007711
1,355
permissive
[ { "docstring": "Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError.", "name": "angle_between_vectors", "signature": "def angle_between_vectors(v1, v2)" }, { "docstring": "Calculates the angle p1-...
2
stack_v2_sparse_classes_30k_train_006557
Implement the Python class `Triangle` described below. Class description: Represents a triangle constructed from different other geometrical entities. Method signatures and docstrings: - def angle_between_vectors(v1, v2): Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate inp...
Implement the Python class `Triangle` described below. Class description: Represents a triangle constructed from different other geometrical entities. Method signatures and docstrings: - def angle_between_vectors(v1, v2): Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate inp...
43cceabf5fd4ddf6dbfd8c6d5329b9a4bba4ecb7
<|skeleton|> class Triangle: """Represents a triangle constructed from different other geometrical entities.""" def angle_between_vectors(v1, v2): """Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError."...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Triangle: """Represents a triangle constructed from different other geometrical entities.""" def angle_between_vectors(v1, v2): """Calculates the angle between <v1> and <v2>. The result is in the range [0, pi] On degenerate input (any of the vectors of norm 0) will raise ValueError.""" v1...
the_stack_v2_python_sparse
brlcad/vmath/triangle.py
kanzure/python-brlcad
train
6
9290f3a963fc0ba881cc178c29b9f4bbc46c3b9d
[ "create_empty_db()\nadd_customer(**user_1)\nquery = Customer.get(Customer.customer_id == user_1['customer_id'])\nself.assertEqual(user_1['name'], query.customer_name)\nself.assertEqual(user_1['lastname'], query.customer_last_name)\nself.assertEqual(user_1['home_address'], query.customer_address)\nself.assertEqual(u...
<|body_start_0|> create_empty_db() add_customer(**user_1) query = Customer.get(Customer.customer_id == user_1['customer_id']) self.assertEqual(user_1['name'], query.customer_name) self.assertEqual(user_1['lastname'], query.customer_last_name) self.assertEqual(user_1['home...
Tests basic_operations program, along with customer_model
BasicOperationsTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicOperationsTest: """Tests basic_operations program, along with customer_model""" def test_add_customer(self): """Tests if a new customer is added to database""" <|body_0|> def test_search_customer(self): """Tests customer search function""" <|body_1|>...
stack_v2_sparse_classes_10k_train_007712
5,205
no_license
[ { "docstring": "Tests if a new customer is added to database", "name": "test_add_customer", "signature": "def test_add_customer(self)" }, { "docstring": "Tests customer search function", "name": "test_search_customer", "signature": "def test_search_customer(self)" }, { "docstring...
6
stack_v2_sparse_classes_30k_train_004233
Implement the Python class `BasicOperationsTest` described below. Class description: Tests basic_operations program, along with customer_model Method signatures and docstrings: - def test_add_customer(self): Tests if a new customer is added to database - def test_search_customer(self): Tests customer search function ...
Implement the Python class `BasicOperationsTest` described below. Class description: Tests basic_operations program, along with customer_model Method signatures and docstrings: - def test_add_customer(self): Tests if a new customer is added to database - def test_search_customer(self): Tests customer search function ...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class BasicOperationsTest: """Tests basic_operations program, along with customer_model""" def test_add_customer(self): """Tests if a new customer is added to database""" <|body_0|> def test_search_customer(self): """Tests customer search function""" <|body_1|>...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BasicOperationsTest: """Tests basic_operations program, along with customer_model""" def test_add_customer(self): """Tests if a new customer is added to database""" create_empty_db() add_customer(**user_1) query = Customer.get(Customer.customer_id == user_1['customer_id'])...
the_stack_v2_python_sparse
students/njschafi/Lesson04/assignment/test_basic_operations.py
JavaRod/SP_Python220B_2019
train
1
de1a59e11cf5e04112c8a67b84e527ba273b8d34
[ "if not nums:\n return 0\nmydict = {}\nres = 1\nfor num in nums:\n if num in mydict.keys():\n continue\n mydict[num] = 1\n ll = num\n rr = num\n val = 1\n if num - 1 in mydict.keys():\n ll = num - mydict[num - 1]\n val += mydict[num - 1]\n if num + 1 in mydict.keys():\n ...
<|body_start_0|> if not nums: return 0 mydict = {} res = 1 for num in nums: if num in mydict.keys(): continue mydict[num] = 1 ll = num rr = num val = 1 if num - 1 in mydict.keys(): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def longestConsecutive3(self, nums): """:type nums: List[int]...
stack_v2_sparse_classes_10k_train_007713
2,537
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive2", "signature": "def longestConsecutive2(self, nums)" }, { "docst...
3
stack_v2_sparse_classes_30k_val_000002
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive2(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive3(self, num...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive2(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive3(self, num...
690b685048c8e89d26047b6bc48b5f9af7d59cbb
<|skeleton|> class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def longestConsecutive3(self, nums): """:type nums: List[int]...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 mydict = {} res = 1 for num in nums: if num in mydict.keys(): continue mydict[num] = 1 ll = num ...
the_stack_v2_python_sparse
数组/128. 最长连续序列.py
SimmonsChen/LeetCode
train
0
620040f16423e947db1c5e7c291bb39f196554cf
[ "self.students = []\nself.grades = {}\nself.isSorted = True", "if student in self.students:\n raise ValueError('Duplicate Error')\nself.students.append(student)\nself.grades[student.getIdNum()] = []\nself.isSorted = False", "try:\n self.grades[student.getIdNum()].append(grade)\nexcept KeyError:\n raise...
<|body_start_0|> self.students = [] self.grades = {} self.isSorted = True <|end_body_0|> <|body_start_1|> if student in self.students: raise ValueError('Duplicate Error') self.students.append(student) self.grades[student.getIdNum()] = [] self.isSorted...
A mapping from students to a list of grades
Grades
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creates empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type student Add student to the grade book.""" <|body_1|> def addGrades(s...
stack_v2_sparse_classes_10k_train_007714
2,545
no_license
[ { "docstring": "Creates empty grade book", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Assumes: student is of type student Add student to the grade book.", "name": "addStudent", "signature": "def addStudent(self, student)" }, { "docstring": "Assumes: ...
6
stack_v2_sparse_classes_30k_train_004679
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Creates empty grade book - def addStudent(self, student): Assumes: student is of type student Add student to the grade book. - def addGrades(self,...
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Creates empty grade book - def addStudent(self, student): Assumes: student is of type student Add student to the grade book. - def addGrades(self,...
93e5e2a5e9355b4dc94ce2071351ee4bf280b9a8
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creates empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type student Add student to the grade book.""" <|body_1|> def addGrades(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creates empty grade book""" self.students = [] self.grades = {} self.isSorted = True def addStudent(self, student): """Assumes: student is of type student Add student to the grade...
the_stack_v2_python_sparse
python_programming_exercise/classHierarchy/Grades.py
dskeshav/python_practise
train
0
a3e8c17507840336812204f68276dbf8d6dbf2c0
[ "intervals.append(new_interval)\nintervals = sorted(intervals, cmp_interval)\nreturn self.merge(intervals)", "if len(intervals) <= 1:\n return intervals\ni = 0\nmerge_intervals = []\nwhile i < len(intervals) - 1:\n interval = intervals[i]\n interval_next = intervals[i + 1]\n start = interval.start\n ...
<|body_start_0|> intervals.append(new_interval) intervals = sorted(intervals, cmp_interval) return self.merge(intervals) <|end_body_0|> <|body_start_1|> if len(intervals) <= 1: return intervals i = 0 merge_intervals = [] while i < len(intervals) - 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insert(self, intervals, new_interval): """:param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]""" <|body_0|> def merge(self, intervals): """:param intervals: List[Interval] :return: List[Interval]""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_007715
1,647
no_license
[ { "docstring": ":param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]", "name": "insert", "signature": "def insert(self, intervals, new_interval)" }, { "docstring": ":param intervals: List[Interval] :return: List[Interval]", "name": "merge", "signature": ...
2
stack_v2_sparse_classes_30k_train_004113
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, new_interval): :param intervals: List[Interval] :param new_interval: Interval :return: List[Interval] - def merge(self, intervals): :param intervals: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, new_interval): :param intervals: List[Interval] :param new_interval: Interval :return: List[Interval] - def merge(self, intervals): :param intervals: ...
c1c5ee72b8fe608b278ca20a58bc240fdc62b599
<|skeleton|> class Solution: def insert(self, intervals, new_interval): """:param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]""" <|body_0|> def merge(self, intervals): """:param intervals: List[Interval] :return: List[Interval]""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def insert(self, intervals, new_interval): """:param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]""" intervals.append(new_interval) intervals = sorted(intervals, cmp_interval) return self.merge(intervals) def merge(self, interva...
the_stack_v2_python_sparse
57_insert_interval.py
eazow/leetcode
train
5
a8a14cc306ad15a2bec7353415321668c425c07c
[ "self.event_str = event_str\nself.date = calendar_util.convert_str_to_date(date_str)\nself.start_time_str = start_time_str\nself.end_time_str = end_time_str", "date_str = datetime.datetime.strftime(self.date, calendar_util.DATE_STR_FMT)\nret = ' '.join([self.event_str, 'on', date_str])\nif self.start_time_str:\n ...
<|body_start_0|> self.event_str = event_str self.date = calendar_util.convert_str_to_date(date_str) self.start_time_str = start_time_str self.end_time_str = end_time_str <|end_body_0|> <|body_start_1|> date_str = datetime.datetime.strftime(self.date, calendar_util.DATE_STR_FMT) ...
Class for storing calendar event information.
CalendarEvent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarEvent: """Class for storing calendar event information.""" def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): """Initialize this CalendarEvent instance.""" <|body_0|> def __str__(self): """Returns the st...
stack_v2_sparse_classes_10k_train_007716
1,047
permissive
[ { "docstring": "Initialize this CalendarEvent instance.", "name": "__init__", "signature": "def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str='')" }, { "docstring": "Returns the string representation of this CalendarEvent.", "name": "__str__", ...
2
stack_v2_sparse_classes_30k_train_000284
Implement the Python class `CalendarEvent` described below. Class description: Class for storing calendar event information. Method signatures and docstrings: - def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): Initialize this CalendarEvent instance. - def __str__(...
Implement the Python class `CalendarEvent` described below. Class description: Class for storing calendar event information. Method signatures and docstrings: - def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): Initialize this CalendarEvent instance. - def __str__(...
9fdf2f2b4861450fbed64b90b8c7c69b0173e052
<|skeleton|> class CalendarEvent: """Class for storing calendar event information.""" def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): """Initialize this CalendarEvent instance.""" <|body_0|> def __str__(self): """Returns the st...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CalendarEvent: """Class for storing calendar event information.""" def __init__(self, event_str: str='', date_str: str='', start_time_str: str='', end_time_str: str=''): """Initialize this CalendarEvent instance.""" self.event_str = event_str self.date = calendar_util.convert_str_...
the_stack_v2_python_sparse
LTUAssistantPlus/services/calendar/calendar_event.py
Xyaneon/LTUAssistantPlus
train
0
7b96d74e4a927b8f9d62078d8796131a3efa8fad
[ "test_map = dict(working_map)\nabs_rooms = []\nfor i in range(100):\n generator_pos = GeneratorUtil.random_pos(map_size, False)\n room = RoomGenerator.__generate_room(map_size)\n abs_room = GeneratorUtil.offset(generator_pos, room)\n room_clear = GeneratorUtil.check_clearance(test_map, abs_room)\n if...
<|body_start_0|> test_map = dict(working_map) abs_rooms = [] for i in range(100): generator_pos = GeneratorUtil.random_pos(map_size, False) room = RoomGenerator.__generate_room(map_size) abs_room = GeneratorUtil.offset(generator_pos, room) room_cle...
RoomGenerator
[ "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoomGenerator: def generate_rooms(working_map, map_size): """Generate a list of absoulte-positioned rooms""" <|body_0|> def __generate_room(map_size): """Generate a room, and return it. A room is defined as a 2D list with MapTileTypes.Floor.""" <|body_1|> <|...
stack_v2_sparse_classes_10k_train_007717
1,518
permissive
[ { "docstring": "Generate a list of absoulte-positioned rooms", "name": "generate_rooms", "signature": "def generate_rooms(working_map, map_size)" }, { "docstring": "Generate a room, and return it. A room is defined as a 2D list with MapTileTypes.Floor.", "name": "__generate_room", "signa...
2
stack_v2_sparse_classes_30k_train_005851
Implement the Python class `RoomGenerator` described below. Class description: Implement the RoomGenerator class. Method signatures and docstrings: - def generate_rooms(working_map, map_size): Generate a list of absoulte-positioned rooms - def __generate_room(map_size): Generate a room, and return it. A room is defin...
Implement the Python class `RoomGenerator` described below. Class description: Implement the RoomGenerator class. Method signatures and docstrings: - def generate_rooms(working_map, map_size): Generate a list of absoulte-positioned rooms - def __generate_room(map_size): Generate a room, and return it. A room is defin...
bce8c262bc80912045a9e5394447b937f9b08f83
<|skeleton|> class RoomGenerator: def generate_rooms(working_map, map_size): """Generate a list of absoulte-positioned rooms""" <|body_0|> def __generate_room(map_size): """Generate a room, and return it. A room is defined as a 2D list with MapTileTypes.Floor.""" <|body_1|> <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoomGenerator: def generate_rooms(working_map, map_size): """Generate a list of absoulte-positioned rooms""" test_map = dict(working_map) abs_rooms = [] for i in range(100): generator_pos = GeneratorUtil.random_pos(map_size, False) room = RoomGenerator._...
the_stack_v2_python_sparse
ageofwinds/map/mapGenerator/roomGenerator.py
pbrn46/ageofwinds
train
0
e3f1e91a022165a526299378047d7249c65a6eaa
[ "username = request.GET.get('username', None)\nif username is not None:\n cm = get_object_or_404(CM, user__username=username)\n serializer = CMSerializer(cm)\n return JsonResponse({'cms': [serializer.data]}, safe=False)\nelse:\n cms = CM.objects.all()\n serializer = CMSerializer(cms, many=True)\n ...
<|body_start_0|> username = request.GET.get('username', None) if username is not None: cm = get_object_or_404(CM, user__username=username) serializer = CMSerializer(cm) return JsonResponse({'cms': [serializer.data]}, safe=False) else: cms = CM.obje...
课程负责人view
CMs
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" <|body_0|> def post(self, request): """增加课程负责人""" <|body_1|> def delete(self, request): """删除课程负责人""" <|body_2|> <|end_skeleton|> <|body_start_0|> username = request...
stack_v2_sparse_classes_10k_train_007718
16,053
permissive
[ { "docstring": "查询课程负责人", "name": "get", "signature": "def get(self, request)" }, { "docstring": "增加课程负责人", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除课程负责人", "name": "delete", "signature": "def delete(self, request)" } ]
3
stack_v2_sparse_classes_30k_train_006995
Implement the Python class `CMs` described below. Class description: 课程负责人view Method signatures and docstrings: - def get(self, request): 查询课程负责人 - def post(self, request): 增加课程负责人 - def delete(self, request): 删除课程负责人
Implement the Python class `CMs` described below. Class description: 课程负责人view Method signatures and docstrings: - def get(self, request): 查询课程负责人 - def post(self, request): 增加课程负责人 - def delete(self, request): 删除课程负责人 <|skeleton|> class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" ...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" <|body_0|> def post(self, request): """增加课程负责人""" <|body_1|> def delete(self, request): """删除课程负责人""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" username = request.GET.get('username', None) if username is not None: cm = get_object_or_404(CM, user__username=username) serializer = CMSerializer(cm) return JsonResponse({'cms': [seria...
the_stack_v2_python_sparse
user/views.py
MIXISAMA/MIS-backend
train
0
85e805c14e8b7a3c966c67e06320c6e74c26b8cd
[ "self.dist = dist\nself.accel = accel\nself.decel = decel\nd0 = dist * decel / (accel + decel)\nd1 = 0\nt0 = sqrt(2 * d0 / accel)\nt1 = 0\nt2 = accel / decel * t0\nvc = accel * t0\nif vc > max_speed:\n t0 = max_speed / accel\n t2 = max_speed / decel\n d0 = max_speed * t0 / 2\n d1 = dist - 0.5 * (accel *...
<|body_start_0|> self.dist = dist self.accel = accel self.decel = decel d0 = dist * decel / (accel + decel) d1 = 0 t0 = sqrt(2 * d0 / accel) t1 = 0 t2 = accel / decel * t0 vc = accel * t0 if vc > max_speed: t0 = max_speed / acce...
The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.
AToBConstAccel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AToBConstAccel: """The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.""" def __init__(self, dist, accel, decel, max_speed=inf): """dist: The distance between A to B; accel: The rate of acceleration; decel: The ...
stack_v2_sparse_classes_10k_train_007719
1,724
no_license
[ { "docstring": "dist: The distance between A to B; accel: The rate of acceleration; decel: The rate of deceleration; max_speed: Optional. The max speed of movement.", "name": "__init__", "signature": "def __init__(self, dist, accel, decel, max_speed=inf)" }, { "docstring": "Calculating the curre...
2
stack_v2_sparse_classes_30k_val_000021
Implement the Python class `AToBConstAccel` described below. Class description: The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant. Method signatures and docstrings: - def __init__(self, dist, accel, decel, max_speed=inf): dist: The distance bet...
Implement the Python class `AToBConstAccel` described below. Class description: The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant. Method signatures and docstrings: - def __init__(self, dist, accel, decel, max_speed=inf): dist: The distance bet...
3945ef235ac8e7a7a66fec018597aa9b34b0a4e6
<|skeleton|> class AToBConstAccel: """The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.""" def __init__(self, dist, accel, decel, max_speed=inf): """dist: The distance between A to B; accel: The rate of acceleration; decel: The ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AToBConstAccel: """The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.""" def __init__(self, dist, accel, decel, max_speed=inf): """dist: The distance between A to B; accel: The rate of acceleration; decel: The rate of decel...
the_stack_v2_python_sparse
wavesynlib/formulae/motion.py
xialulee/WaveSyn
train
9
8bb053396bfc84bed1b2e1f9f358852fc1435138
[ "super(LabelSmoothingLoss, self).__init__()\nself.confidence = 1.0 - smoothing\nself.smoothing = smoothing\nself.dim = dim", "with torch.no_grad():\n true_dist = torch.zeros_like(pred)\n true_dist.fill_(self.smoothing / (pred.shape[-1] - 1))\n true_dist.scatter_(1, target.data.unsqueeze(1), self.confiden...
<|body_start_0|> super(LabelSmoothingLoss, self).__init__() self.confidence = 1.0 - smoothing self.smoothing = smoothing self.dim = dim <|end_body_0|> <|body_start_1|> with torch.no_grad(): true_dist = torch.zeros_like(pred) true_dist.fill_(self.smoothing...
Create a NLL loss but by employing label smoothing. Particularly useful when the data is not 100% reliable, and there is a probability that other labels can actually be the real one. Credits to github users @ https://github.com/pytorch/pytorch/issues/7455
LabelSmoothingLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelSmoothingLoss: """Create a NLL loss but by employing label smoothing. Particularly useful when the data is not 100% reliable, and there is a probability that other labels can actually be the real one. Credits to github users @ https://github.com/pytorch/pytorch/issues/7455""" def __init...
stack_v2_sparse_classes_10k_train_007720
17,400
permissive
[ { "docstring": "Create the label smoothing loss :param smoothing: smooting probability (0 for no smoothing, 1 for full smoothing) :param dim: dimension to apply the loss sum", "name": "__init__", "signature": "def __init__(self, smoothing=0.0, dim=-1)" }, { "docstring": "Compute the forward pass...
2
stack_v2_sparse_classes_30k_train_003234
Implement the Python class `LabelSmoothingLoss` described below. Class description: Create a NLL loss but by employing label smoothing. Particularly useful when the data is not 100% reliable, and there is a probability that other labels can actually be the real one. Credits to github users @ https://github.com/pytorch...
Implement the Python class `LabelSmoothingLoss` described below. Class description: Create a NLL loss but by employing label smoothing. Particularly useful when the data is not 100% reliable, and there is a probability that other labels can actually be the real one. Credits to github users @ https://github.com/pytorch...
1b9fbe6c89c74dc706fd8d3b11ea08977ba2c1d3
<|skeleton|> class LabelSmoothingLoss: """Create a NLL loss but by employing label smoothing. Particularly useful when the data is not 100% reliable, and there is a probability that other labels can actually be the real one. Credits to github users @ https://github.com/pytorch/pytorch/issues/7455""" def __init...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LabelSmoothingLoss: """Create a NLL loss but by employing label smoothing. Particularly useful when the data is not 100% reliable, and there is a probability that other labels can actually be the real one. Credits to github users @ https://github.com/pytorch/pytorch/issues/7455""" def __init__(self, smoo...
the_stack_v2_python_sparse
models/interaction_modules/train_aux.py
pedro-mgb/pedestrian-arc-lstm-smf
train
4
f9d783542e5f8bbbe8ab5d55bf4f8462eebf5804
[ "left, right = (0, len(height) - 1)\narea_max = (right - left) * min(height[left], height[right])\nwhile left < right:\n if height[left] <= height[right]:\n index = left + 1\n while height[index] <= height[left]:\n index += 1\n if index >= right:\n return area_m...
<|body_start_0|> left, right = (0, len(height) - 1) area_max = (right - left) * min(height[left], height[right]) while left < right: if height[left] <= height[right]: index = left + 1 while height[index] <= height[left]: index += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea1(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left, right = (0, len(height) - 1) a...
stack_v2_sparse_classes_10k_train_007721
3,634
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea1", "signature": "def maxArea1(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_000646
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea1(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea1(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea1(s...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def maxArea1(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea1(self, height): """:type height: List[int] :rtype: int""" left, right = (0, len(height) - 1) area_max = (right - left) * min(height[left], height[right]) while left < right: if height[left] <= height[right]: index = left + 1 ...
the_stack_v2_python_sparse
TwoPointers/q011_container_with_most_water.py
sevenhe716/LeetCode
train
0
ecd2e3126d92251a593524cb4db28a282df66a96
[ "n = len(g)\ndp = [0] * (1 << n)\nfor i in range(1 << n):\n s = 0\n for j in range(n):\n if i >> j & 1:\n s += g[j]\n for j in range(n):\n if i & 1 << j == 0:\n dp[i | 1 << j] = max(dp[i | 1 << j], dp[i] + int(s % b == 0))\nreturn dp[-1]", "arr = [0] * b\nfor gg in g:\...
<|body_start_0|> n = len(g) dp = [0] * (1 << n) for i in range(1 << n): s = 0 for j in range(n): if i >> j & 1: s += g[j] for j in range(n): if i & 1 << j == 0: dp[i | 1 << j] = max(dp[i |...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxHappyGroups(self, b: int, g: List[int]) -> int: """常规做法:二进制枚举(超时) 1. 本代码可帮助理解题目意思 @param b: @param g: @return:""" <|body_0|> def maxHappyGroups(self, b: int, g: List[int]) -> int: """如果用2进制枚举会超时,由于客户数量最多30组,采用31进制 @param b: @param g: @return:""" ...
stack_v2_sparse_classes_10k_train_007722
2,946
no_license
[ { "docstring": "常规做法:二进制枚举(超时) 1. 本代码可帮助理解题目意思 @param b: @param g: @return:", "name": "maxHappyGroups", "signature": "def maxHappyGroups(self, b: int, g: List[int]) -> int" }, { "docstring": "如果用2进制枚举会超时,由于客户数量最多30组,采用31进制 @param b: @param g: @return:", "name": "maxHappyGroups", "signatu...
2
stack_v2_sparse_classes_30k_train_002448
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxHappyGroups(self, b: int, g: List[int]) -> int: 常规做法:二进制枚举(超时) 1. 本代码可帮助理解题目意思 @param b: @param g: @return: - def maxHappyGroups(self, b: int, g: List[int]) -> int: 如果用2进制...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxHappyGroups(self, b: int, g: List[int]) -> int: 常规做法:二进制枚举(超时) 1. 本代码可帮助理解题目意思 @param b: @param g: @return: - def maxHappyGroups(self, b: int, g: List[int]) -> int: 如果用2进制...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def maxHappyGroups(self, b: int, g: List[int]) -> int: """常规做法:二进制枚举(超时) 1. 本代码可帮助理解题目意思 @param b: @param g: @return:""" <|body_0|> def maxHappyGroups(self, b: int, g: List[int]) -> int: """如果用2进制枚举会超时,由于客户数量最多30组,采用31进制 @param b: @param g: @return:""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxHappyGroups(self, b: int, g: List[int]) -> int: """常规做法:二进制枚举(超时) 1. 本代码可帮助理解题目意思 @param b: @param g: @return:""" n = len(g) dp = [0] * (1 << n) for i in range(1 << n): s = 0 for j in range(n): if i >> j & 1: ...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/状态压缩DP/1815. 得到新鲜甜甜圈的最多组数.py
yiming1012/MyLeetCode
train
2
c1a88f411645e2bf0ff79f37e8a793e670cd24df
[ "if grid[0][0] == 1 or grid[-1][-1] == 1 or (not grid):\n return -1\nqueue = [(0, 0, 1)]\ngrid[0][0] = 1\nn = len(grid)\nif n == 1:\n return 1\ndirections = [(-1, 0), (1, 0), (0, -1), (0, 1), (1, 1), (1, -1), (-1, 1), (-1, -1)]\nwhile len(queue) > 0:\n size = len(queue)\n for k in range(size):\n ...
<|body_start_0|> if grid[0][0] == 1 or grid[-1][-1] == 1 or (not grid): return -1 queue = [(0, 0, 1)] grid[0][0] = 1 n = len(grid) if n == 1: return 1 directions = [(-1, 0), (1, 0), (0, -1), (0, 1), (1, 1), (1, -1), (-1, 1), (-1, -1)] while...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestPathBinaryMatrix_standard(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def shortestPathBinaryMatrix(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_007723
4,024
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "shortestPathBinaryMatrix_standard", "signature": "def shortestPathBinaryMatrix_standard(self, grid)" }, { "docstring": ":type grid: List[List[int]] :rtype: int", "name": "shortestPathBinaryMatrix", "signature": "def short...
2
stack_v2_sparse_classes_30k_train_003901
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPathBinaryMatrix_standard(self, grid): :type grid: List[List[int]] :rtype: int - def shortestPathBinaryMatrix(self, grid): :type grid: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPathBinaryMatrix_standard(self, grid): :type grid: List[List[int]] :rtype: int - def shortestPathBinaryMatrix(self, grid): :type grid: List[List[int]] :rtype: int <|...
d36655924edb9e364c956f912ba4797fb962be7e
<|skeleton|> class Solution: def shortestPathBinaryMatrix_standard(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_0|> def shortestPathBinaryMatrix(self, grid): """:type grid: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def shortestPathBinaryMatrix_standard(self, grid): """:type grid: List[List[int]] :rtype: int""" if grid[0][0] == 1 or grid[-1][-1] == 1 or (not grid): return -1 queue = [(0, 0, 1)] grid[0][0] = 1 n = len(grid) if n == 1: return...
the_stack_v2_python_sparse
1091.BfsShortestPath.py
casssie-zhang/LeetcodeNotes
train
2
7f92d059921dbd85a167d832d012e59feff551e9
[ "if not email:\n raise ValueError('Users must have an email address')\nif not username:\n raise ValueError('Users must have an username')\nuser = self.model(username=username, email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(u...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') if not username: raise ValueError('Users must have an username') user = self.model(username=username, email=self.normalize_email(email)) user.set_password(password) user.sa...
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the give...
stack_v2_sparse_classes_10k_train_007724
4,781
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, username, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name"...
2
stack_v2_sparse_classes_30k_train_001930
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, u...
Implement the Python class `CustomUserManager` described below. Class description: Implement the CustomUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, u...
95c22374f42e8156e43e31de3b6062f41258824b
<|skeleton|> class CustomUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the give...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') if not username: raise ValueError('Users...
the_stack_v2_python_sparse
core/models.py
josben/flo
train
0
7d7949773446700a155e07f6aa166ae5d99027da
[ "n = len(A)\ncmp = [0] * n\nm = 10 ** 6 + 1\nfor i in range(n - 1, -1, -1):\n cmp[i] = m = min(m, A[i])\nm = -1\nfor i, x in enumerate(A):\n m = max(m, x)\n if m <= cmp[i + 1]:\n return i + 1", "lm = m = A[0]\nres = 0\nfor i in range(1, len(A)):\n m = max(m, A[i])\n if A[i] < lm:\n lm...
<|body_start_0|> n = len(A) cmp = [0] * n m = 10 ** 6 + 1 for i in range(n - 1, -1, -1): cmp[i] = m = min(m, A[i]) m = -1 for i, x in enumerate(A): m = max(m, x) if m <= cmp[i + 1]: return i + 1 <|end_body_0|> <|body_st...
[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)""" def partitionDisjoint(self, A: List[int]) -> int: """思路:找到第一个max(left)<=min(right)位置""" <|body_0|> def partitionDisjoint2(self, A: List[int]) -> int: """思路:优化,保...
stack_v2_sparse_classes_10k_train_007725
1,343
no_license
[ { "docstring": "思路:找到第一个max(left)<=min(right)位置", "name": "partitionDisjoint", "signature": "def partitionDisjoint(self, A: List[int]) -> int" }, { "docstring": "思路:优化,保存一个左边最大值,后面的遍历过程中比这个值还小的,一定要被划分到left中,相等不用。", "name": "partitionDisjoint2", "signature": "def partitionDisjoint2(self, ...
2
null
Implement the Python class `Solution` described below. Class description: [915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/) Method signatures and docstrings: - def partitionDisjoint(self, A: List[int]) -> int: 思路:找到第一个max(left)<=min(right)位置 - def partitionDisjoint2(self, A: List[...
Implement the Python class `Solution` described below. Class description: [915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/) Method signatures and docstrings: - def partitionDisjoint(self, A: List[int]) -> int: 思路:找到第一个max(left)<=min(right)位置 - def partitionDisjoint2(self, A: List[...
dbe8eb449e5b112a71bc1cd4eabfd138304de4a3
<|skeleton|> class Solution: """[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)""" def partitionDisjoint(self, A: List[int]) -> int: """思路:找到第一个max(left)<=min(right)位置""" <|body_0|> def partitionDisjoint2(self, A: List[int]) -> int: """思路:优化,保...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)""" def partitionDisjoint(self, A: List[int]) -> int: """思路:找到第一个max(left)<=min(right)位置""" n = len(A) cmp = [0] * n m = 10 ** 6 + 1 for i in range(n - 1, -1, -1): ...
the_stack_v2_python_sparse
leetcode/901-1200/915.py
Rivarrl/leetcode_python
train
3
493dec1c31ec298c00c77ebc95713a1444c2314f
[ "if request.COOKIES.get('site_language'):\n if request.COOKIES['site_language'] == '':\n language = 'fr'\n else:\n language = request.COOKIES['site_language']\n translation.activate(language)\n request.LANGUAGE_CODE = translation.get_language()", "if not request.COOKIES.get('site_languag...
<|body_start_0|> if request.COOKIES.get('site_language'): if request.COOKIES['site_language'] == '': language = 'fr' else: language = request.COOKIES['site_language'] translation.activate(language) request.LANGUAGE_CODE = translatio...
LanguageCookieMiddleware
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageCookieMiddleware: def process_request(self, request): """Sets language from the cookie value.""" <|body_0|> def process_response(self, request, response): """Create cookie if not there already. Also deactivates language. (See http://stackoverflow.com/a/130312...
stack_v2_sparse_classes_10k_train_007726
1,353
no_license
[ { "docstring": "Sets language from the cookie value.", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "Create cookie if not there already. Also deactivates language. (See http://stackoverflow.com/a/13031239/388835 )", "name": "process_response"...
2
stack_v2_sparse_classes_30k_train_004691
Implement the Python class `LanguageCookieMiddleware` described below. Class description: Implement the LanguageCookieMiddleware class. Method signatures and docstrings: - def process_request(self, request): Sets language from the cookie value. - def process_response(self, request, response): Create cookie if not the...
Implement the Python class `LanguageCookieMiddleware` described below. Class description: Implement the LanguageCookieMiddleware class. Method signatures and docstrings: - def process_request(self, request): Sets language from the cookie value. - def process_response(self, request, response): Create cookie if not the...
d5aff19e4557fe1eb9e0765e40337df99d5e1935
<|skeleton|> class LanguageCookieMiddleware: def process_request(self, request): """Sets language from the cookie value.""" <|body_0|> def process_response(self, request, response): """Create cookie if not there already. Also deactivates language. (See http://stackoverflow.com/a/130312...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LanguageCookieMiddleware: def process_request(self, request): """Sets language from the cookie value.""" if request.COOKIES.get('site_language'): if request.COOKIES['site_language'] == '': language = 'fr' else: language = request.COOKIES[...
the_stack_v2_python_sparse
visualexpcode/visualexpcode/middleware/languages/language_cookie.py
mlemaire79/visualexp
train
0
41cf2a8a364fe9efc69f720ea53eee1bcea41def
[ "entries = self.model_cls.published.none()\nif self.request.GET:\n self.pattern = self.request.GET.get('q', '')\n if len(self.pattern) < 3:\n self.error = _('The pattern is too short')\n else:\n query_parsed = QUERY.parseString(self.pattern)\n entries = self.model_cls.published.filter(...
<|body_start_0|> entries = self.model_cls.published.none() if self.request.GET: self.pattern = self.request.GET.get('q', '') if len(self.pattern) < 3: self.error = _('The pattern is too short') else: query_parsed = QUERY.parseString(sel...
Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.
EntrySearchMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntrySearchMixin: """Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.""" def get_queryset(self): """Overridde the ...
stack_v2_sparse_classes_10k_train_007727
3,025
no_license
[ { "docstring": "Overridde the get_queryset method to do some validations and build the search queryset.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Add error and pattern in context.", "name": "get_context_data", "signature": "def get_context_data(se...
2
stack_v2_sparse_classes_30k_train_003889
Implement the Python class `EntrySearchMixin` described below. Class description: Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern. Method signatures...
Implement the Python class `EntrySearchMixin` described below. Class description: Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern. Method signatures...
80e5a36154d1e2ffdc08c7f0563e8e887efb017d
<|skeleton|> class EntrySearchMixin: """Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.""" def get_queryset(self): """Overridde the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EntrySearchMixin: """Mixin providing the behavior of the entry search view, by returning in the context the pattern searched, the error if something wrong has happened and finally the the queryset of published entries matching the pattern.""" def get_queryset(self): """Overridde the get_queryset ...
the_stack_v2_python_sparse
apps/mp_blog/views/mixins.py
ivansons/mp_cms
train
0
7821c114132cad6bbbae204cb605867db2f677af
[ "PlotCanvas1D.__init__(self, parent, id, xlabel, ylabel, xscale, yscale)\nself.bank = FilterBank()\npub.subscribe(self.PostProcess, 'filter.change')\nself.Bind(wx.EVT_WINDOW_DESTROY, self.OnDelete)", "PlotCanvas1D.OnDelete(self, event)\npub.unsubscribe(self.PostProcess, 'filter.change')\nevent.Skip()", "event.S...
<|body_start_0|> PlotCanvas1D.__init__(self, parent, id, xlabel, ylabel, xscale, yscale) self.bank = FilterBank() pub.subscribe(self.PostProcess, 'filter.change') self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDelete) <|end_body_0|> <|body_start_1|> PlotCanvas1D.OnDelete(self, event) ...
Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str)
PlotCanvasF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotCanvasF: """Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str...
stack_v2_sparse_classes_10k_train_007728
5,257
no_license
[ { "docstring": "Initialization. Parameters: parent - parent window (wx.Window) id - id (int) xlabel - label and units of abscissa axis ([str,quantities]) ylabel - label and units of ordinate axis ([str,quantities]) xscale - abscissa scale type (linear or log) yscale - ordinate scale type (linear or log)", "...
6
stack_v2_sparse_classes_30k_val_000296
Implement the Python class `PlotCanvasF` described below. Class description: Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canva...
Implement the Python class `PlotCanvasF` described below. Class description: Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canva...
712accd3534ca35ae4c5c7f1c9c33fc935552ca6
<|skeleton|> class PlotCanvasF: """Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PlotCanvasF: """Canvas class for 1D post-processed data plots Properties: is_data - False, canvas is not meant to display raw measurement data is_filter - True, canvas is meant to display post-processed data dim=1 - dimension of plots displayed on this canvas (int) name - name of canvas type (str)""" def...
the_stack_v2_python_sparse
terapy_2/plot/canvasF.py
dawidgadziala/terapy
train
0
24d5ddfd705fde1f8a464200e71837453262d8dd
[ "neuron.Neuron.__init__(self, size)\nself.tau_rc = tau_rc\nself.tau_ref = tau_ref", "x = 1.0 / (1 - TT.exp((self.tau_ref - 1.0 / max_rates) / self.tau_rc))\nalpha = (1 - z2) / (intercepts - 1.0)\nj_bias = 1 - alpha * intercepts\nreturn (alpha, j_bias)", "rate = self.tau_ref - self.tau_rc * TT.log(1 - 1.0 / TT.m...
<|body_start_0|> neuron.Neuron.__init__(self, size) self.tau_rc = tau_rc self.tau_ref = tau_ref <|end_body_0|> <|body_start_1|> x = 1.0 / (1 - TT.exp((self.tau_ref - 1.0 / max_rates) / self.tau_rc)) alpha = (1 - z2) / (intercepts - 1.0) j_bias = 1 - alpha * intercepts ...
LIFRateNeuron
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LIFRateNeuron: def __init__(self, size, tau_rc=0.02, tau_ref=0.002): """Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)""" <|body_0|> def make_alpha_...
stack_v2_sparse_classes_10k_train_007729
1,938
permissive
[ { "docstring": "Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)", "name": "__init__", "signature": "def __init__(self, size, tau_rc=0.02, tau_ref=0.002)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_007101
Implement the Python class `LIFRateNeuron` described below. Class description: Implement the LIFRateNeuron class. Method signatures and docstrings: - def __init__(self, size, tau_rc=0.02, tau_ref=0.002): Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time ...
Implement the Python class `LIFRateNeuron` described below. Class description: Implement the LIFRateNeuron class. Method signatures and docstrings: - def __init__(self, size, tau_rc=0.02, tau_ref=0.002): Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time ...
9067f897d4bf3d1a01ceb03e1b1f044cde580a19
<|skeleton|> class LIFRateNeuron: def __init__(self, size, tau_rc=0.02, tau_ref=0.002): """Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)""" <|body_0|> def make_alpha_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LIFRateNeuron: def __init__(self, size, tau_rc=0.02, tau_ref=0.002): """Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)""" neuron.Neuron.__init__(self, size) se...
the_stack_v2_python_sparse
nengo_theano/lif_rate.py
ctn-archive/nengo_theano
train
0
5dea14c4eaad8b138fdd760667df9439dee73689
[ "super(ListWebhooks, cls).setUpClass()\nwebhook1_response = cls.autoscale_client.create_webhook(cls.group.id, cls.policy['id'], 'webhook1').entity\ncls.webhook1 = cls.autoscale_behaviors.get_webhooks_properties(webhook1_response)\nwebhook2_response = cls.autoscale_client.create_webhook(cls.group.id, cls.policy['id'...
<|body_start_0|> super(ListWebhooks, cls).setUpClass() webhook1_response = cls.autoscale_client.create_webhook(cls.group.id, cls.policy['id'], 'webhook1').entity cls.webhook1 = cls.autoscale_behaviors.get_webhooks_properties(webhook1_response) webhook2_response = cls.autoscale_client.cre...
Verify list webhooks
ListWebhooks
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListWebhooks: """Verify list webhooks""" def setUpClass(cls): """Creates a scaling group with a policy and 3 webhooks on the policy""" <|body_0|> def test_list_webhooks(self): """Verify the list webhooks call for response code 201, headers and data""" <|b...
stack_v2_sparse_classes_10k_train_007730
1,861
permissive
[ { "docstring": "Creates a scaling group with a policy and 3 webhooks on the policy", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Verify the list webhooks call for response code 201, headers and data", "name": "test_list_webhooks", "signature": "def test_li...
2
stack_v2_sparse_classes_30k_train_005628
Implement the Python class `ListWebhooks` described below. Class description: Verify list webhooks Method signatures and docstrings: - def setUpClass(cls): Creates a scaling group with a policy and 3 webhooks on the policy - def test_list_webhooks(self): Verify the list webhooks call for response code 201, headers an...
Implement the Python class `ListWebhooks` described below. Class description: Verify list webhooks Method signatures and docstrings: - def setUpClass(cls): Creates a scaling group with a policy and 3 webhooks on the policy - def test_list_webhooks(self): Verify the list webhooks call for response code 201, headers an...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class ListWebhooks: """Verify list webhooks""" def setUpClass(cls): """Creates a scaling group with a policy and 3 webhooks on the policy""" <|body_0|> def test_list_webhooks(self): """Verify the list webhooks call for response code 201, headers and data""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ListWebhooks: """Verify list webhooks""" def setUpClass(cls): """Creates a scaling group with a policy and 3 webhooks on the policy""" super(ListWebhooks, cls).setUpClass() webhook1_response = cls.autoscale_client.create_webhook(cls.group.id, cls.policy['id'], 'webhook1').entity ...
the_stack_v2_python_sparse
autoscale_cloudroast/test_repo/autoscale/functional/webhooks/test_list_webhooks.py
rackerlabs/otter
train
20
a3d1f411e1f95b350666d1f935f0106b81a2ddf9
[ "self.temp = arr[0]\nfor values in range(len(arr) - 1):\n arr[values] = arr[values + 1]\narr[-1] = self.temp", "self.temp = arr[-1]\nfor values in range(len(arr) - 1, -1, -1):\n arr[values] = arr[values - 1]\narr[0] = self.temp", "self.aux = len(arr) * [0]\nfor i in range(len(arr)):\n self.aux[(i + k) ...
<|body_start_0|> self.temp = arr[0] for values in range(len(arr) - 1): arr[values] = arr[values + 1] arr[-1] = self.temp <|end_body_0|> <|body_start_1|> self.temp = arr[-1] for values in range(len(arr) - 1, -1, -1): arr[values] = arr[values - 1] a...
Rotation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rotation: def rotate_left_by_One(self, arr): """Rotate the array left by one""" <|body_0|> def rotate_right_by_One(self, arr): """Rotate the array right by one""" <|body_1|> def rotate_right(self, arr, k): """We use an extra array in which we pla...
stack_v2_sparse_classes_10k_train_007731
3,090
no_license
[ { "docstring": "Rotate the array left by one", "name": "rotate_left_by_One", "signature": "def rotate_left_by_One(self, arr)" }, { "docstring": "Rotate the array right by one", "name": "rotate_right_by_One", "signature": "def rotate_right_by_One(self, arr)" }, { "docstring": "We ...
5
null
Implement the Python class `Rotation` described below. Class description: Implement the Rotation class. Method signatures and docstrings: - def rotate_left_by_One(self, arr): Rotate the array left by one - def rotate_right_by_One(self, arr): Rotate the array right by one - def rotate_right(self, arr, k): We use an ex...
Implement the Python class `Rotation` described below. Class description: Implement the Rotation class. Method signatures and docstrings: - def rotate_left_by_One(self, arr): Rotate the array left by one - def rotate_right_by_One(self, arr): Rotate the array right by one - def rotate_right(self, arr, k): We use an ex...
0892f41fe055de4361aae950fb60b0e3c2f96505
<|skeleton|> class Rotation: def rotate_left_by_One(self, arr): """Rotate the array left by one""" <|body_0|> def rotate_right_by_One(self, arr): """Rotate the array right by one""" <|body_1|> def rotate_right(self, arr, k): """We use an extra array in which we pla...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rotation: def rotate_left_by_One(self, arr): """Rotate the array left by one""" self.temp = arr[0] for values in range(len(arr) - 1): arr[values] = arr[values + 1] arr[-1] = self.temp def rotate_right_by_One(self, arr): """Rotate the array right by one"...
the_stack_v2_python_sparse
DataStructures/v1/code/Geeks/arrayRotation.py
acemodou/Working-Copy
train
0
2e75f3f70ab13799d3b163d4f2873035a0de5839
[ "name = ''.join(filter(str.isalnum, label)).lower()\nif background_color is None:\n background_color = BACKGROUND_COLOR\nLabel.__init__(self, name, label, rect, background_color)\nself.left_click_callback = callback\nself.clicked_counter = 0\nself.redraw()\nreturn", "Label.redraw(self)\nself.image.lock()\npyga...
<|body_start_0|> name = ''.join(filter(str.isalnum, label)).lower() if background_color is None: background_color = BACKGROUND_COLOR Label.__init__(self, name, label, rect, background_color) self.left_click_callback = callback self.clicked_counter = 0 self.red...
A clickndrag plane which displays a text and reacts on mouse clicks. Additional attributes: Button.callback The callback function to be called upon clicking. Button.clicked_counter Counted down when the button is clicked and displays a different color
Button
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Button: """A clickndrag plane which displays a text and reacts on mouse clicks. Additional attributes: Button.callback The callback function to be called upon clicking. Button.clicked_counter Counted down when the button is clicked and displays a different color""" def __init__(self, label, ...
stack_v2_sparse_classes_10k_train_007732
27,668
permissive
[ { "docstring": "Initialise the Button. label is the Text to be written on the button. rect is an instance of pygame.Rect giving the dimensions. callback is the function to be called when the Button is clicked with the left mouse button.", "name": "__init__", "signature": "def __init__(self, label, rect,...
4
stack_v2_sparse_classes_30k_train_003429
Implement the Python class `Button` described below. Class description: A clickndrag plane which displays a text and reacts on mouse clicks. Additional attributes: Button.callback The callback function to be called upon clicking. Button.clicked_counter Counted down when the button is clicked and displays a different c...
Implement the Python class `Button` described below. Class description: A clickndrag plane which displays a text and reacts on mouse clicks. Additional attributes: Button.callback The callback function to be called upon clicking. Button.clicked_counter Counted down when the button is clicked and displays a different c...
c2fc3d4e9beedb8487cfa4bfa13bdf55ec36af97
<|skeleton|> class Button: """A clickndrag plane which displays a text and reacts on mouse clicks. Additional attributes: Button.callback The callback function to be called upon clicking. Button.clicked_counter Counted down when the button is clicked and displays a different color""" def __init__(self, label, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Button: """A clickndrag plane which displays a text and reacts on mouse clicks. Additional attributes: Button.callback The callback function to be called upon clicking. Button.clicked_counter Counted down when the button is clicked and displays a different color""" def __init__(self, label, rect, callbac...
the_stack_v2_python_sparse
reference_scripts/clickndrag-0.4.1/clickndrag/gui.py
stivosaurus/rpi-snippets
train
1
9361a03824c0138cb41ec7f82cabc2fc4137cdd2
[ "dummy_head = ListNode(0)\ncurrent_node = dummy_head\nfor i in list:\n current_node.next = ListNode(i)\n current_node = current_node.next\nreturn dummy_head.next", "curr = list\nans = []\nwhile curr:\n ans.append(curr.val)\n curr = curr.next\nreturn ans" ]
<|body_start_0|> dummy_head = ListNode(0) current_node = dummy_head for i in list: current_node.next = ListNode(i) current_node = current_node.next return dummy_head.next <|end_body_0|> <|body_start_1|> curr = list ans = [] while curr: ...
LinkListHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkListHelper: def listToLinkList(self, list): """:type list: List[int] :rtype: ListNode""" <|body_0|> def linkListToList(self, list): """:type list: ListNode :rtype: List""" <|body_1|> <|end_skeleton|> <|body_start_0|> dummy_head = ListNode(0) ...
stack_v2_sparse_classes_10k_train_007733
3,744
no_license
[ { "docstring": ":type list: List[int] :rtype: ListNode", "name": "listToLinkList", "signature": "def listToLinkList(self, list)" }, { "docstring": ":type list: ListNode :rtype: List", "name": "linkListToList", "signature": "def linkListToList(self, list)" } ]
2
stack_v2_sparse_classes_30k_train_004280
Implement the Python class `LinkListHelper` described below. Class description: Implement the LinkListHelper class. Method signatures and docstrings: - def listToLinkList(self, list): :type list: List[int] :rtype: ListNode - def linkListToList(self, list): :type list: ListNode :rtype: List
Implement the Python class `LinkListHelper` described below. Class description: Implement the LinkListHelper class. Method signatures and docstrings: - def listToLinkList(self, list): :type list: List[int] :rtype: ListNode - def linkListToList(self, list): :type list: ListNode :rtype: List <|skeleton|> class LinkLis...
a57282895fb213b68e5d81db301903721a92d80f
<|skeleton|> class LinkListHelper: def listToLinkList(self, list): """:type list: List[int] :rtype: ListNode""" <|body_0|> def linkListToList(self, list): """:type list: ListNode :rtype: List""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinkListHelper: def listToLinkList(self, list): """:type list: List[int] :rtype: ListNode""" dummy_head = ListNode(0) current_node = dummy_head for i in list: current_node.next = ListNode(i) current_node = current_node.next return dummy_head.next...
the_stack_v2_python_sparse
Python/helper.py
antonylu/leetcode2
train
0
dcad37a8101e1054ceb0404e5dcec42041a1f2a3
[ "BaseController.__init__(self, veh_id, car_following_params, delay=delay, fail_safe=fail_safe, noise=noise)\nself.v_desired = v0\nself.acc = acc\nself.b = b\nself.b_l = b_l\nself.s0 = s0\nself.tau = tau", "v = env.k.vehicle.get_speed(self.veh_id)\nh = env.k.vehicle.get_headway(self.veh_id)\nv_l = env.k.vehicle.ge...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=delay, fail_safe=fail_safe, noise=noise) self.v_desired = v0 self.acc = acc self.b = b self.b_l = b_l self.s0 = s0 self.tau = tau <|end_body_0|> <|body_start_1|> v = env.k....
Gipps' Model controller. For more information on this controller, see: Traffic Flow Dynamics written by M.Treiber and A.Kesting By courtesy of Springer publisher, http://www.springer.com http://www.traffic-flow-dynamics.org/res/SampleChapter11.pdf Usage ----- See BaseController for usage example. Attributes ---------- ...
GippsController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GippsController: """Gipps' Model controller. For more information on this controller, see: Traffic Flow Dynamics written by M.Treiber and A.Kesting By courtesy of Springer publisher, http://www.springer.com http://www.traffic-flow-dynamics.org/res/SampleChapter11.pdf Usage ----- See BaseControlle...
stack_v2_sparse_classes_10k_train_007734
17,548
permissive
[ { "docstring": "Instantiate a Gipps' controller.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params=None, v0=30, acc=1.5, b=-1, b_l=-1, s0=2, tau=1, delay=0, noise=0, fail_safe=None)" }, { "docstring": "See parent class.", "name": "get_accel", "signature"...
2
stack_v2_sparse_classes_30k_train_006704
Implement the Python class `GippsController` described below. Class description: Gipps' Model controller. For more information on this controller, see: Traffic Flow Dynamics written by M.Treiber and A.Kesting By courtesy of Springer publisher, http://www.springer.com http://www.traffic-flow-dynamics.org/res/SampleChap...
Implement the Python class `GippsController` described below. Class description: Gipps' Model controller. For more information on this controller, see: Traffic Flow Dynamics written by M.Treiber and A.Kesting By courtesy of Springer publisher, http://www.springer.com http://www.traffic-flow-dynamics.org/res/SampleChap...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class GippsController: """Gipps' Model controller. For more information on this controller, see: Traffic Flow Dynamics written by M.Treiber and A.Kesting By courtesy of Springer publisher, http://www.springer.com http://www.traffic-flow-dynamics.org/res/SampleChapter11.pdf Usage ----- See BaseControlle...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GippsController: """Gipps' Model controller. For more information on this controller, see: Traffic Flow Dynamics written by M.Treiber and A.Kesting By courtesy of Springer publisher, http://www.springer.com http://www.traffic-flow-dynamics.org/res/SampleChapter11.pdf Usage ----- See BaseController for usage e...
the_stack_v2_python_sparse
flow/controllers/car_following_models.py
parthjaggi/flow
train
6
91397f7ddc1e148835a57ddbc130e7cb8464f66f
[ "self.instance = instance\nself.schema = None\nif self.instance:\n self.schema = SurveySchema(self.instance.survey)", "for name, field in self.fields.items():\n yield (field.verbose_name, getattr(self.instance, name))\nif self.schema:\n for field in self.schema:\n field_id = field.getFieldName()\n...
<|body_start_0|> self.instance = instance self.schema = None if self.instance: self.schema = SurveySchema(self.instance.survey) <|end_body_0|> <|body_start_1|> for name, field in self.fields.items(): yield (field.verbose_name, getattr(self.instance, name)) ...
A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.
SurveyRecordReadOnlyTemplate
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=Non...
stack_v2_sparse_classes_10k_train_007735
6,916
permissive
[ { "docstring": "Constructor to initialize the model instance. The readonly template will be rendered for the data in this model instance.", "name": "__init__", "signature": "def __init__(self, instance=None)" }, { "docstring": "Iterator yielding groups of record instance's properties to be rende...
3
stack_v2_sparse_classes_30k_train_003171
Implement the Python class `SurveyRecordReadOnlyTemplate` described below. Class description: A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. ...
Implement the Python class `SurveyRecordReadOnlyTemplate` described below. Class description: A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. ...
6bbd1674c99fe285596e46e738856a82afe036af
<|skeleton|> class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=Non...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SurveyRecordReadOnlyTemplate: """A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.""" def __init__(self, instance=None): "...
the_stack_v2_python_sparse
app/soc/views/readonly_template.py
adviti/melange
train
0
dc3a85c1ac874b68486994abf0ab05a85bfb7b50
[ "memo = {coins: 0}\nfor cost in costs:\n _memo = {}\n for coin, n in memo.items():\n _memo.setdefault(coin, 0)\n _memo[coin] = max(_memo[coin], n)\n if coin >= cost:\n _memo.setdefault(coin - cost, 0)\n _memo[coin - cost] = max(_memo[coin - cost], n + 1)\n memo = ...
<|body_start_0|> memo = {coins: 0} for cost in costs: _memo = {} for coin, n in memo.items(): _memo.setdefault(coin, 0) _memo[coin] = max(_memo[coin], n) if coin >= cost: _memo.setdefault(coin - cost, 0) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxIceCream(self, costs: List[int], coins: int) -> int: """Mar 04, 2023 21:28 TLE""" <|body_0|> def maxIceCream(self, costs: List[int], coins: int) -> int: """Mar 04, 2023 21:31""" <|body_1|> <|end_skeleton|> <|body_start_0|> memo = {c...
stack_v2_sparse_classes_10k_train_007736
6,815
no_license
[ { "docstring": "Mar 04, 2023 21:28 TLE", "name": "maxIceCream", "signature": "def maxIceCream(self, costs: List[int], coins: int) -> int" }, { "docstring": "Mar 04, 2023 21:31", "name": "maxIceCream", "signature": "def maxIceCream(self, costs: List[int], coins: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxIceCream(self, costs: List[int], coins: int) -> int: Mar 04, 2023 21:28 TLE - def maxIceCream(self, costs: List[int], coins: int) -> int: Mar 04, 2023 21:31
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxIceCream(self, costs: List[int], coins: int) -> int: Mar 04, 2023 21:28 TLE - def maxIceCream(self, costs: List[int], coins: int) -> int: Mar 04, 2023 21:31 <|skeleton|> ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxIceCream(self, costs: List[int], coins: int) -> int: """Mar 04, 2023 21:28 TLE""" <|body_0|> def maxIceCream(self, costs: List[int], coins: int) -> int: """Mar 04, 2023 21:31""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxIceCream(self, costs: List[int], coins: int) -> int: """Mar 04, 2023 21:28 TLE""" memo = {coins: 0} for cost in costs: _memo = {} for coin, n in memo.items(): _memo.setdefault(coin, 0) _memo[coin] = max(_memo[coin...
the_stack_v2_python_sparse
leetcode/solved/1961_Maximum_Ice_Cream_Bars/solution.py
sungminoh/algorithms
train
0
5176b32a3cd5a6a151c5f0076d5d9e4e5946c101
[ "if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nself.mean = np.mean(data, axis=1).reshape((data.shape[0], 1))\ndata_t = data.T\nmean = np.mean(data_t, axis=0)...
<|body_start_0|> if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data points') self.mean = np.mean(data, axis=1).reshape((data.shape[0], 1)) ...
class
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """class""" def __init__(self, data): """initializer""" <|body_0|> def pdf(self, x): """method""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError(...
stack_v2_sparse_classes_10k_train_007737
1,296
no_license
[ { "docstring": "initializer", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "method", "name": "pdf", "signature": "def pdf(self, x)" } ]
2
stack_v2_sparse_classes_30k_test_000353
Implement the Python class `MultiNormal` described below. Class description: class Method signatures and docstrings: - def __init__(self, data): initializer - def pdf(self, x): method
Implement the Python class `MultiNormal` described below. Class description: class Method signatures and docstrings: - def __init__(self, data): initializer - def pdf(self, x): method <|skeleton|> class MultiNormal: """class""" def __init__(self, data): """initializer""" <|body_0|> def ...
b5e8f1253309567ca7be71b9575a150de1be3820
<|skeleton|> class MultiNormal: """class""" def __init__(self, data): """initializer""" <|body_0|> def pdf(self, x): """method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiNormal: """class""" def __init__(self, data): """initializer""" if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data poin...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
jadsm98/holbertonschool-machine_learning
train
0
2d71d5032e29b772e4a23624cd052d97ef8f7248
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "self.inst_lbl = Label(self, text='Input password to longevity secret.')\nself.inst_lbl.grid(row=0, column=0, columnspan=2, sticky=W)\nself.pw_lbl = Label(self, text='Password: ')\nself.pw_lbl.grid(row=1, column=0, sticky=W)\nself.pw...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> self.inst_lbl = Label(self, text='Input password to longevity secret.') self.inst_lbl.grid(row=0, column=0, columnspan=2, sticky=W) self.pw_lbl = ...
Application with GUI, which can revealed secret of longevity.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application with GUI, which can revealed secret of longevity.""" def __init__(self, master): """Initialize frame.""" <|body_0|> def create_widgets(self): """Create widgets Button, Text and Entry.""" <|body_1|> def reveal(self): ...
stack_v2_sparse_classes_10k_train_007738
2,625
no_license
[ { "docstring": "Initialize frame.", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Create widgets Button, Text and Entry.", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "Print message depends of password val...
3
stack_v2_sparse_classes_30k_train_004535
Implement the Python class `Application` described below. Class description: Application with GUI, which can revealed secret of longevity. Method signatures and docstrings: - def __init__(self, master): Initialize frame. - def create_widgets(self): Create widgets Button, Text and Entry. - def reveal(self): Print mess...
Implement the Python class `Application` described below. Class description: Application with GUI, which can revealed secret of longevity. Method signatures and docstrings: - def __init__(self, master): Initialize frame. - def create_widgets(self): Create widgets Button, Text and Entry. - def reveal(self): Print mess...
120e2d62468a085424ec71a22effe27d6b38b548
<|skeleton|> class Application: """Application with GUI, which can revealed secret of longevity.""" def __init__(self, master): """Initialize frame.""" <|body_0|> def create_widgets(self): """Create widgets Button, Text and Entry.""" <|body_1|> def reveal(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Application: """Application with GUI, which can revealed secret of longevity.""" def __init__(self, master): """Initialize frame.""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Create widgets Button,...
the_stack_v2_python_sparse
Chapter 10/longevity.py
MartaSzuran/Python-for-the-Absolute-Beginner-M.Dawson
train
1
12dcd5f7096e4684a91a188a73df5dbe52febc66
[ "self.name = name\nself.desired_species = desired_species\nself.feared_species = feared_species", "adopter_score = float(adoption_center.get_number_of_species(self.desired_species))\nnum_feared = float(adoption_center.get_number_of_species(self.feared_species))\nresult = adopter_score - 0.3 * num_feared\nif resul...
<|body_start_0|> self.name = name self.desired_species = desired_species self.feared_species = feared_species <|end_body_0|> <|body_start_1|> adopter_score = float(adoption_center.get_number_of_species(self.desired_species)) num_feared = float(adoption_center.get_number_of_speci...
A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the number of feared species
FearfulAdopter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FearfulAdopter: """A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the num...
stack_v2_sparse_classes_10k_train_007739
4,359
no_license
[ { "docstring": "Initializes FearfulAdopter, a subclass of Adopter object class feared_species - a string that is the name of the feared species. All of the inputs are the same as the Adopter", "name": "__init__", "signature": "def __init__(self, name, desired_species, feared_species)" }, { "docs...
2
stack_v2_sparse_classes_30k_train_001863
Implement the Python class `FearfulAdopter` described below. Class description: A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x ...
Implement the Python class `FearfulAdopter` described below. Class description: A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x ...
d8750a5d78f042477f6577af67cc46d584f4aede
<|skeleton|> class FearfulAdopter: """A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the num...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FearfulAdopter: """A FearfulAdopter is afraid of a particular species of animal. If the adoption center has one or more of those animals in it, they will be a bit more reluctant to go there due to the presence of the feared species. Their score should be 1x number of desired species - .3x the number of feared...
the_stack_v2_python_sparse
ProblemSets/ProblemSet07c.py
Greatdane/MITx-6.00.1x
train
0
ac8f1088a3937cca7f7feb9fd92e28771525e2c8
[ "super(ResetServerStateTests, cls).setUpClass()\nkey_resp = cls.keypairs_client.create_keypair(rand_name('key'))\nassert key_resp.status_code is 200\ncls.key = key_resp.entity\ncls.resources.add(cls.key.name, cls.keypairs_client.delete_keypair)\ncls.server = cls.server_behaviors.create_active_server(key_name=cls.ke...
<|body_start_0|> super(ResetServerStateTests, cls).setUpClass() key_resp = cls.keypairs_client.create_keypair(rand_name('key')) assert key_resp.status_code is 200 cls.key = key_resp.entity cls.resources.add(cls.key.name, cls.keypairs_client.delete_keypair) cls.server = cl...
ResetServerStateTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetServerStateTests: def setUpClass(cls): """Perform actions that setup the necessary resources for testing. The following resources are created during the setup: - Create a server in active state.""" <|body_0|> def test_set_server_state(self): """Verify that the s...
stack_v2_sparse_classes_10k_train_007740
2,988
permissive
[ { "docstring": "Perform actions that setup the necessary resources for testing. The following resources are created during the setup: - Create a server in active state.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Verify that the state of a server can be set manu...
2
null
Implement the Python class `ResetServerStateTests` described below. Class description: Implement the ResetServerStateTests class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing. The following resources are created during the setup: - Create a se...
Implement the Python class `ResetServerStateTests` described below. Class description: Implement the ResetServerStateTests class. Method signatures and docstrings: - def setUpClass(cls): Perform actions that setup the necessary resources for testing. The following resources are created during the setup: - Create a se...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class ResetServerStateTests: def setUpClass(cls): """Perform actions that setup the necessary resources for testing. The following resources are created during the setup: - Create a server in active state.""" <|body_0|> def test_set_server_state(self): """Verify that the s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResetServerStateTests: def setUpClass(cls): """Perform actions that setup the necessary resources for testing. The following resources are created during the setup: - Create a server in active state.""" super(ResetServerStateTests, cls).setUpClass() key_resp = cls.keypairs_client.creat...
the_stack_v2_python_sparse
cloudroast/compute/instance_actions/admin_api/test_reset_server_state.py
RULCSoft/cloudroast
train
1
2a10f57ed56afdc6547a2676766c68e3f2b2e074
[ "query = query.strip().lower().replace(' ', '+')\nsoup = self.get_soup(search_url % query)\nresults = []\nfor div in soup.select('#list-page .archive .list-truyen > .row'):\n a = div.select_one('.truyen-title a')\n info = div.select_one('.text-info a .chapter-text')\n results.append({'title': a.text.strip(...
<|body_start_0|> query = query.strip().lower().replace(' ', '+') soup = self.get_soup(search_url % query) results = [] for div in soup.select('#list-page .archive .list-truyen > .row'): a = div.select_one('.truyen-title a') info = div.select_one('.text-info a .cha...
NovelFullCrawler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NovelFullCrawler: def search_novel(self, query): """Gets a list of (title, url) matching the given query""" <|body_0|> def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_1|> def download_chapter_list(self, page): """Downloa...
stack_v2_sparse_classes_10k_train_007741
4,420
permissive
[ { "docstring": "Gets a list of (title, url) matching the given query", "name": "search_novel", "signature": "def search_novel(self, query)" }, { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring":...
4
stack_v2_sparse_classes_30k_train_006196
Implement the Python class `NovelFullCrawler` described below. Class description: Implement the NovelFullCrawler class. Method signatures and docstrings: - def search_novel(self, query): Gets a list of (title, url) matching the given query - def read_novel_info(self): Get novel title, autor, cover etc - def download_...
Implement the Python class `NovelFullCrawler` described below. Class description: Implement the NovelFullCrawler class. Method signatures and docstrings: - def search_novel(self, query): Gets a list of (title, url) matching the given query - def read_novel_info(self): Get novel title, autor, cover etc - def download_...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class NovelFullCrawler: def search_novel(self, query): """Gets a list of (title, url) matching the given query""" <|body_0|> def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_1|> def download_chapter_list(self, page): """Downloa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NovelFullCrawler: def search_novel(self, query): """Gets a list of (title, url) matching the given query""" query = query.strip().lower().replace(' ', '+') soup = self.get_soup(search_url % query) results = [] for div in soup.select('#list-page .archive .list-truyen > ....
the_stack_v2_python_sparse
lncrawl/sources/novelfull.py
NNTin/lightnovel-crawler
train
2
64535387923dab6c9b6dd9b235680647e52ff975
[ "Thread.__init__(self)\nself.command = command\nself.process = None", "self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\ntry:\n _stream_output(self.process)\nexcept RuntimeError as e:\n msg = 'Failed to run: %s, %s' % (self.command, str(e))\n raise RuntimeErro...
<|body_start_0|> Thread.__init__(self) self.command = command self.process = None <|end_body_0|> <|body_start_1|> self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: _stream_output(self.process) except RuntimeErr...
Placeholder docstring.
_HostingContainer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _HostingContainer: """Placeholder docstring.""" def __init__(self, command): """Creates a new threaded hosting container. Args: command:""" <|body_0|> def run(self): """Placeholder docstring""" <|body_1|> def down(self): """Placeholder docstr...
stack_v2_sparse_classes_10k_train_007742
43,196
permissive
[ { "docstring": "Creates a new threaded hosting container. Args: command:", "name": "__init__", "signature": "def __init__(self, command)" }, { "docstring": "Placeholder docstring", "name": "run", "signature": "def run(self)" }, { "docstring": "Placeholder docstring", "name": ...
3
stack_v2_sparse_classes_30k_test_000100
Implement the Python class `_HostingContainer` described below. Class description: Placeholder docstring. Method signatures and docstrings: - def __init__(self, command): Creates a new threaded hosting container. Args: command: - def run(self): Placeholder docstring - def down(self): Placeholder docstring
Implement the Python class `_HostingContainer` described below. Class description: Placeholder docstring. Method signatures and docstrings: - def __init__(self, command): Creates a new threaded hosting container. Args: command: - def run(self): Placeholder docstring - def down(self): Placeholder docstring <|skeleton...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class _HostingContainer: """Placeholder docstring.""" def __init__(self, command): """Creates a new threaded hosting container. Args: command:""" <|body_0|> def run(self): """Placeholder docstring""" <|body_1|> def down(self): """Placeholder docstr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _HostingContainer: """Placeholder docstring.""" def __init__(self, command): """Creates a new threaded hosting container. Args: command:""" Thread.__init__(self) self.command = command self.process = None def run(self): """Placeholder docstring""" self...
the_stack_v2_python_sparse
src/sagemaker/local/image.py
aws/sagemaker-python-sdk
train
2,050
8fcbeecd123fec46ddf01cd121c7407624b27954
[ "request_user = User.get_by_id(token_auth.current_user())\nif request_user.role != 1:\n return ({'Error': 'Only admin users can create organisations.', 'SubCode': 'OnlyAdminAccess'}, 403)\ntry:\n organisation_dto = NewOrganisationDTO(request.get_json())\n if request_user.username not in organisation_dto.ma...
<|body_start_0|> request_user = User.get_by_id(token_auth.current_user()) if request_user.role != 1: return ({'Error': 'Only admin users can create organisations.', 'SubCode': 'OnlyAdminAccess'}, 403) try: organisation_dto = NewOrganisationDTO(request.get_json()) ...
OrganisationsRestAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganisationsRestAPI: def post(self): """Creates a new organisation --- tags: - organisations produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: body name:...
stack_v2_sparse_classes_10k_train_007743
15,215
permissive
[ { "docstring": "Creates a new organisation --- tags: - organisations produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: body name: body required: true description: JSON object for...
4
stack_v2_sparse_classes_30k_train_004435
Implement the Python class `OrganisationsRestAPI` described below. Class description: Implement the OrganisationsRestAPI class. Method signatures and docstrings: - def post(self): Creates a new organisation --- tags: - organisations produces: - application/json parameters: - in: header name: Authorization description...
Implement the Python class `OrganisationsRestAPI` described below. Class description: Implement the OrganisationsRestAPI class. Method signatures and docstrings: - def post(self): Creates a new organisation --- tags: - organisations produces: - application/json parameters: - in: header name: Authorization description...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class OrganisationsRestAPI: def post(self): """Creates a new organisation --- tags: - organisations produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: body name:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrganisationsRestAPI: def post(self): """Creates a new organisation --- tags: - organisations produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - in: body name: body required...
the_stack_v2_python_sparse
backend/api/organisations/resources.py
hotosm/tasking-manager
train
526
c965cb91f7b05716a5d80b4568d14490f75c0b48
[ "try:\n logger.info('测试登录用户的信息是否正确')\n self.login()\n self.click(self.userbtn)\n self.assertEqual(self.gettext(self.user_name), 'admin')\n self.assertEqual(self.gettext(self.user_type), '管理员')\nexcept Exception as msg:\n logger.error(u'异常原因:%s' % msg)\n self.driver.get_screenshot_as_file(os.pat...
<|body_start_0|> try: logger.info('测试登录用户的信息是否正确') self.login() self.click(self.userbtn) self.assertEqual(self.gettext(self.user_name), 'admin') self.assertEqual(self.gettext(self.user_type), '管理员') except Exception as msg: logger.e...
首页的相关测试
ManageTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageTest: """首页的相关测试""" def test1_check_user(self): """测试登录用户的信息是否正确""" <|body_0|> def test2_logout(self): """退出系统测试""" <|body_1|> def test5_interaction_constraints1(self): """在录制过程中限制进入互动模块的测试""" <|body_2|> def test6_interacti...
stack_v2_sparse_classes_10k_train_007744
4,309
no_license
[ { "docstring": "测试登录用户的信息是否正确", "name": "test1_check_user", "signature": "def test1_check_user(self)" }, { "docstring": "退出系统测试", "name": "test2_logout", "signature": "def test2_logout(self)" }, { "docstring": "在录制过程中限制进入互动模块的测试", "name": "test5_interaction_constraints1", ...
4
stack_v2_sparse_classes_30k_train_006620
Implement the Python class `ManageTest` described below. Class description: 首页的相关测试 Method signatures and docstrings: - def test1_check_user(self): 测试登录用户的信息是否正确 - def test2_logout(self): 退出系统测试 - def test5_interaction_constraints1(self): 在录制过程中限制进入互动模块的测试 - def test6_interaction_constraints2(self): 在直播过程中限制进入互动模块的测试
Implement the Python class `ManageTest` described below. Class description: 首页的相关测试 Method signatures and docstrings: - def test1_check_user(self): 测试登录用户的信息是否正确 - def test2_logout(self): 退出系统测试 - def test5_interaction_constraints1(self): 在录制过程中限制进入互动模块的测试 - def test6_interaction_constraints2(self): 在直播过程中限制进入互动模块的测试...
fd552eeb47fd4838c2c5caef4deea7480ab75ce9
<|skeleton|> class ManageTest: """首页的相关测试""" def test1_check_user(self): """测试登录用户的信息是否正确""" <|body_0|> def test2_logout(self): """退出系统测试""" <|body_1|> def test5_interaction_constraints1(self): """在录制过程中限制进入互动模块的测试""" <|body_2|> def test6_interacti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManageTest: """首页的相关测试""" def test1_check_user(self): """测试登录用户的信息是否正确""" try: logger.info('测试登录用户的信息是否正确') self.login() self.click(self.userbtn) self.assertEqual(self.gettext(self.user_name), 'admin') self.assertEqual(self.gette...
the_stack_v2_python_sparse
test_case/D001_manage_test.py
luhuifnag/AVA_UIauto_test
train
0
536850eb042f24c979af6e9d0d2d5ca5597fd22f
[ "purls = request.data.get('purls', []) or []\npurl_only = request.data.get('purl_only', False)\nplain_purl = request.data.get('plain_purl', False)\nif not purls or not isinstance(purls, list):\n return Response(status=400, data={'Error': \"A non-empty 'purls' list of PURLs is required.\"})\nif plain_purl:\n p...
<|body_start_0|> purls = request.data.get('purls', []) or [] purl_only = request.data.get('purl_only', False) plain_purl = request.data.get('plain_purl', False) if not purls or not isinstance(purls, list): return Response(status=400, data={'Error': "A non-empty 'purls' list o...
Lookup for vulnerable packages by Package URL.
PackageViewSet
[ "Apache-2.0", "CC-BY-SA-4.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageViewSet: """Lookup for vulnerable packages by Package URL.""" def bulk_search(self, request): """Lookup for vulnerable packages using many Package URLs at once.""" <|body_0|> def all(self, request): """Return the Package URLs of all packages known to be vu...
stack_v2_sparse_classes_10k_train_007745
13,956
permissive
[ { "docstring": "Lookup for vulnerable packages using many Package URLs at once.", "name": "bulk_search", "signature": "def bulk_search(self, request)" }, { "docstring": "Return the Package URLs of all packages known to be vulnerable.", "name": "all", "signature": "def all(self, request)"...
2
stack_v2_sparse_classes_30k_train_002816
Implement the Python class `PackageViewSet` described below. Class description: Lookup for vulnerable packages by Package URL. Method signatures and docstrings: - def bulk_search(self, request): Lookup for vulnerable packages using many Package URLs at once. - def all(self, request): Return the Package URLs of all pa...
Implement the Python class `PackageViewSet` described below. Class description: Lookup for vulnerable packages by Package URL. Method signatures and docstrings: - def bulk_search(self, request): Lookup for vulnerable packages using many Package URLs at once. - def all(self, request): Return the Package URLs of all pa...
eec05bb0f796d743e408a1b402df8abfc8344669
<|skeleton|> class PackageViewSet: """Lookup for vulnerable packages by Package URL.""" def bulk_search(self, request): """Lookup for vulnerable packages using many Package URLs at once.""" <|body_0|> def all(self, request): """Return the Package URLs of all packages known to be vu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PackageViewSet: """Lookup for vulnerable packages by Package URL.""" def bulk_search(self, request): """Lookup for vulnerable packages using many Package URLs at once.""" purls = request.data.get('purls', []) or [] purl_only = request.data.get('purl_only', False) plain_pur...
the_stack_v2_python_sparse
vulnerabilities/api.py
nexB/vulnerablecode
train
371
f5629e682fd4bc02a02a90ffed28960461a4f6c6
[ "event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_BREAK_GLASS_REQUEST', client=self.client_id, description=self.args.reason)\nflow.Events.PublishEvent('Audit', event, token=self.token)\nreturn self.ApprovalUrnBuilder(self.client_id.Path(), self.token.username, self.args.reason)", "cli...
<|body_start_0|> event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_BREAK_GLASS_REQUEST', client=self.client_id, description=self.args.reason) flow.Events.PublishEvent('Audit', event, token=self.token) return self.ApprovalUrnBuilder(self.client_id.Path(), self.token.us...
Grant an approval in an emergency.
BreakGlassGrantClientApprovalFlow
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BreakGlassGrantClientApprovalFlow: """Grant an approval in an emergency.""" def BuildApprovalUrn(self): """Builds approval object urn.""" <|body_0|> def BuildSubjectTitle(self): """Returns the string with subject's title.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_007746
28,119
permissive
[ { "docstring": "Builds approval object urn.", "name": "BuildApprovalUrn", "signature": "def BuildApprovalUrn(self)" }, { "docstring": "Returns the string with subject's title.", "name": "BuildSubjectTitle", "signature": "def BuildSubjectTitle(self)" } ]
2
stack_v2_sparse_classes_30k_train_005473
Implement the Python class `BreakGlassGrantClientApprovalFlow` described below. Class description: Grant an approval in an emergency. Method signatures and docstrings: - def BuildApprovalUrn(self): Builds approval object urn. - def BuildSubjectTitle(self): Returns the string with subject's title.
Implement the Python class `BreakGlassGrantClientApprovalFlow` described below. Class description: Grant an approval in an emergency. Method signatures and docstrings: - def BuildApprovalUrn(self): Builds approval object urn. - def BuildSubjectTitle(self): Returns the string with subject's title. <|skeleton|> class ...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class BreakGlassGrantClientApprovalFlow: """Grant an approval in an emergency.""" def BuildApprovalUrn(self): """Builds approval object urn.""" <|body_0|> def BuildSubjectTitle(self): """Returns the string with subject's title.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BreakGlassGrantClientApprovalFlow: """Grant an approval in an emergency.""" def BuildApprovalUrn(self): """Builds approval object urn.""" event = rdfvalue.AuditEvent(user=self.token.username, action='CLIENT_APPROVAL_BREAK_GLASS_REQUEST', client=self.client_id, description=self.args.reason...
the_stack_v2_python_sparse
lib/aff4_objects/security.py
defaultnamehere/grr
train
3
88c10e162d8c9e4f32954becb73f9742e39f2479
[ "super(AdbShellConnectionBuilder, self).__init__()\nself._connection = None\nreturn", "if self._connection is None:\n self.logger.debug('Creating the adb shell connection')\n self._connection = adbconnection.ADBShellConnection()\nreturn self._connection" ]
<|body_start_0|> super(AdbShellConnectionBuilder, self).__init__() self._connection = None return <|end_body_0|> <|body_start_1|> if self._connection is None: self.logger.debug('Creating the adb shell connection') self._connection = adbconnection.ADBShellConnecti...
Use this to get an adb shell connection
AdbShellConnectionBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdbShellConnectionBuilder: """Use this to get an adb shell connection""" def __init__(self, parameters=None): """AdbShellConnectionBuilder Constructor :param: - `parameters`: Not used, just here to keep the interface uniform""" <|body_0|> def connection(self): ""...
stack_v2_sparse_classes_10k_train_007747
10,538
permissive
[ { "docstring": "AdbShellConnectionBuilder Constructor :param: - `parameters`: Not used, just here to keep the interface uniform", "name": "__init__", "signature": "def __init__(self, parameters=None)" }, { "docstring": "The ADB Shell Connection :rtype: ADBShellConnection :return: A built ADB she...
2
stack_v2_sparse_classes_30k_train_000702
Implement the Python class `AdbShellConnectionBuilder` described below. Class description: Use this to get an adb shell connection Method signatures and docstrings: - def __init__(self, parameters=None): AdbShellConnectionBuilder Constructor :param: - `parameters`: Not used, just here to keep the interface uniform - ...
Implement the Python class `AdbShellConnectionBuilder` described below. Class description: Use this to get an adb shell connection Method signatures and docstrings: - def __init__(self, parameters=None): AdbShellConnectionBuilder Constructor :param: - `parameters`: Not used, just here to keep the interface uniform - ...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class AdbShellConnectionBuilder: """Use this to get an adb shell connection""" def __init__(self, parameters=None): """AdbShellConnectionBuilder Constructor :param: - `parameters`: Not used, just here to keep the interface uniform""" <|body_0|> def connection(self): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdbShellConnectionBuilder: """Use this to get an adb shell connection""" def __init__(self, parameters=None): """AdbShellConnectionBuilder Constructor :param: - `parameters`: Not used, just here to keep the interface uniform""" super(AdbShellConnectionBuilder, self).__init__() sel...
the_stack_v2_python_sparse
apetools/builders/subbuilders/connectionbuilder.py
russell-n/oldape
train
0
538d445e457171953756acf0f1e21677ba0b26a1
[ "self.width, self.height = dim\nself.width = self.width // 2\nself.height = self.height // 2\nself.ruleset = ruleset\nself.surface = pygame.Surface(dim)\nself.generation = [0] + [random.randint(0, 1) for i in range(self.width - 1)] + [0]", "number = left * 4 + center * 2 + right\nif number == 7:\n if self.rule...
<|body_start_0|> self.width, self.height = dim self.width = self.width // 2 self.height = self.height // 2 self.ruleset = ruleset self.surface = pygame.Surface(dim) self.generation = [0] + [random.randint(0, 1) for i in range(self.width - 1)] + [0] <|end_body_0|> <|body_...
simple Cellular Automata - Wolfram Elementary
WolframElementary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WolframElementary: """simple Cellular Automata - Wolfram Elementary""" def __init__(self, dim: tuple, ruleset: int): """:param dim: dimension of surface to draw on :param ruleset: ruleset to use""" <|body_0|> def rule(self, left: int, center: int, right: int) -> int: ...
stack_v2_sparse_classes_10k_train_007748
3,015
no_license
[ { "docstring": ":param dim: dimension of surface to draw on :param ruleset: ruleset to use", "name": "__init__", "signature": "def __init__(self, dim: tuple, ruleset: int)" }, { "docstring": "apply ruleset", "name": "rule", "signature": "def rule(self, left: int, center: int, right: int)...
3
stack_v2_sparse_classes_30k_train_000792
Implement the Python class `WolframElementary` described below. Class description: simple Cellular Automata - Wolfram Elementary Method signatures and docstrings: - def __init__(self, dim: tuple, ruleset: int): :param dim: dimension of surface to draw on :param ruleset: ruleset to use - def rule(self, left: int, cent...
Implement the Python class `WolframElementary` described below. Class description: simple Cellular Automata - Wolfram Elementary Method signatures and docstrings: - def __init__(self, dim: tuple, ruleset: int): :param dim: dimension of surface to draw on :param ruleset: ruleset to use - def rule(self, left: int, cent...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class WolframElementary: """simple Cellular Automata - Wolfram Elementary""" def __init__(self, dim: tuple, ruleset: int): """:param dim: dimension of surface to draw on :param ruleset: ruleset to use""" <|body_0|> def rule(self, left: int, center: int, right: int) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WolframElementary: """simple Cellular Automata - Wolfram Elementary""" def __init__(self, dim: tuple, ruleset: int): """:param dim: dimension of surface to draw on :param ruleset: ruleset to use""" self.width, self.height = dim self.width = self.width // 2 self.height = se...
the_stack_v2_python_sparse
effects/WolframElementary.py
gunny26/pygame
train
5
d63fbf23d3fc1c8e3be519a34145c3ddfcc26580
[ "if x <= 1:\n return x\nlow, high = (0, x)\nprint('low\\tmid\\thigh')\nwhile low <= high:\n mid = low + (high - low) // 2\n est = mid ** 2\n if est > x:\n print('{}\\t{}\\t{}, 答案比 mid 小, 要往左邊走'.format(low, mid, high))\n high = mid - 1\n else:\n print('{}\\t{}\\t{}, 答案比 mid 大, 要往右...
<|body_start_0|> if x <= 1: return x low, high = (0, x) print('low\tmid\thigh') while low <= high: mid = low + (high - low) // 2 est = mid ** 2 if est > x: print('{}\t{}\t{}, 答案比 mid 小, 要往左邊走'.format(low, mid, high)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrtOld(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x <= 1: return x low, high = (0, x) print('lo...
stack_v2_sparse_classes_10k_train_007749
1,320
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "mySqrt", "signature": "def mySqrt(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "mySqrtOld", "signature": "def mySqrtOld(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_005467
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrtOld(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrtOld(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrtOld(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" if x <= 1: return x low, high = (0, x) print('low\tmid\thigh') while low <= high: mid = low + (high - low) // 2 est = mid ** 2 if est > x: print...
the_stack_v2_python_sparse
cs_notes/binary_search/sqrt_x.py
hwc1824/LeetCodeSolution
train
0
3667aa5cec6bbab2d040f4484ac3839be9397ce7
[ "super(DGCNNCls, self).__init__()\nself.cfg = cfg\nself.k = cfg.get('k')\nself.emb_dims = cfg.get('emb_dims')\nself.dropout = cfg.get('dropout', 0.5)\nself.bn1 = nn.BatchNorm2d(64)\nself.bn2 = nn.BatchNorm2d(64)\nself.bn3 = nn.BatchNorm2d(128)\nself.bn4 = nn.BatchNorm2d(256)\nself.bn5 = nn.BatchNorm1d(self.emb_dims...
<|body_start_0|> super(DGCNNCls, self).__init__() self.cfg = cfg self.k = cfg.get('k') self.emb_dims = cfg.get('emb_dims') self.dropout = cfg.get('dropout', 0.5) self.bn1 = nn.BatchNorm2d(64) self.bn2 = nn.BatchNorm2d(64) self.bn3 = nn.BatchNorm2d(128) ...
DGCNNCls
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DGCNNCls: def __init__(self, cfg, output_channels=40): """Author: shi.xian dgcnn classification network Args: k (int): [Num of nearest neighbors] emb_dims (int): [Dimension of embeddings] dropout (List[int], optional): [layers to apply dropout]""" <|body_0|> def forward(self...
stack_v2_sparse_classes_10k_train_007750
4,296
permissive
[ { "docstring": "Author: shi.xian dgcnn classification network Args: k (int): [Num of nearest neighbors] emb_dims (int): [Dimension of embeddings] dropout (List[int], optional): [layers to apply dropout]", "name": "__init__", "signature": "def __init__(self, cfg, output_channels=40)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_005705
Implement the Python class `DGCNNCls` described below. Class description: Implement the DGCNNCls class. Method signatures and docstrings: - def __init__(self, cfg, output_channels=40): Author: shi.xian dgcnn classification network Args: k (int): [Num of nearest neighbors] emb_dims (int): [Dimension of embeddings] dro...
Implement the Python class `DGCNNCls` described below. Class description: Implement the DGCNNCls class. Method signatures and docstrings: - def __init__(self, cfg, output_channels=40): Author: shi.xian dgcnn classification network Args: k (int): [Num of nearest neighbors] emb_dims (int): [Dimension of embeddings] dro...
9987806185a4e1619bc15ceecb8a1755e764ff68
<|skeleton|> class DGCNNCls: def __init__(self, cfg, output_channels=40): """Author: shi.xian dgcnn classification network Args: k (int): [Num of nearest neighbors] emb_dims (int): [Dimension of embeddings] dropout (List[int], optional): [layers to apply dropout]""" <|body_0|> def forward(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DGCNNCls: def __init__(self, cfg, output_channels=40): """Author: shi.xian dgcnn classification network Args: k (int): [Num of nearest neighbors] emb_dims (int): [Dimension of embeddings] dropout (List[int], optional): [layers to apply dropout]""" super(DGCNNCls, self).__init__() self....
the_stack_v2_python_sparse
gorilla3d/nn/models/dgcnn/dgcnn_cls.py
SijanNeupane49/gorilla-3d
train
0
af6a21cd3f5eaa521ebc79959376af218c55a2e0
[ "sql = ['-- Insert State Seed Data ({})'.format(country.alpha_2_code), 'INSERT INTO postaddr.states(code, country, alpha_code,' + 'subdivision_category, name)', 'VALUES']\nstates_sql = [(\"('{code}', '{country}', '{alpha_2_code}', \" + \"'{subdivision_category}', '{name}')\").format(code=s.code, country=s.country.a...
<|body_start_0|> sql = ['-- Insert State Seed Data ({})'.format(country.alpha_2_code), 'INSERT INTO postaddr.states(code, country, alpha_code,' + 'subdivision_category, name)', 'VALUES'] states_sql = [("('{code}', '{country}', '{alpha_2_code}', " + "'{subdivision_category}', '{name}')").format(code=s.co...
Use a SQL generator to produce Cooper SQL commands from data objects.
CooperSqlGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CooperSqlGenerator: """Use a SQL generator to produce Cooper SQL commands from data objects.""" def states(self, country: Country) -> SqlOutput: """Generate a cooper SQL statement for a set of states. :param country: the country for which you want to generate the States SQL INSERT co...
stack_v2_sparse_classes_10k_train_007751
11,561
permissive
[ { "docstring": "Generate a cooper SQL statement for a set of states. :param country: the country for which you want to generate the States SQL INSERT command :return: a SQL INSERT command string", "name": "states", "signature": "def states(self, country: Country) -> SqlOutput" }, { "docstring": ...
6
stack_v2_sparse_classes_30k_train_006162
Implement the Python class `CooperSqlGenerator` described below. Class description: Use a SQL generator to produce Cooper SQL commands from data objects. Method signatures and docstrings: - def states(self, country: Country) -> SqlOutput: Generate a cooper SQL statement for a set of states. :param country: the countr...
Implement the Python class `CooperSqlGenerator` described below. Class description: Use a SQL generator to produce Cooper SQL commands from data objects. Method signatures and docstrings: - def states(self, country: Country) -> SqlOutput: Generate a cooper SQL statement for a set of states. :param country: the countr...
f0750799eade79405e3f52e1a2a61dfd4e88dd4f
<|skeleton|> class CooperSqlGenerator: """Use a SQL generator to produce Cooper SQL commands from data objects.""" def states(self, country: Country) -> SqlOutput: """Generate a cooper SQL statement for a set of states. :param country: the country for which you want to generate the States SQL INSERT co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CooperSqlGenerator: """Use a SQL generator to produce Cooper SQL commands from data objects.""" def states(self, country: Country) -> SqlOutput: """Generate a cooper SQL statement for a set of states. :param country: the country for which you want to generate the States SQL INSERT command :return...
the_stack_v2_python_sparse
Python_lib/cliff/sql.py
mndarren/Code-Lib
train
8
e03bb58b24774d695efaaa1e9efd72944748a01d
[ "if environment is not None and utils.version_lt(self._version, '1.25'):\n raise errors.InvalidVersion('Setting environment for exec is not supported in API < 1.25')\nif isinstance(cmd, str):\n cmd = utils.split_command(cmd)\nif isinstance(environment, dict):\n environment = utils.utils.format_environment(...
<|body_start_0|> if environment is not None and utils.version_lt(self._version, '1.25'): raise errors.InvalidVersion('Setting environment for exec is not supported in API < 1.25') if isinstance(cmd, str): cmd = utils.split_command(cmd) if isinstance(environment, dict): ...
ExecApiMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecApiMixin: def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): """Sets up an exec instance in a running container. Args: container (str): Target container where exec insta...
stack_v2_sparse_classes_10k_train_007752
6,224
permissive
[ { "docstring": "Sets up an exec instance in a running container. Args: container (str): Target container where exec instance will be created cmd (str or list): Command to be executed stdout (bool): Attach to stdout. Default: ``True`` stderr (bool): Attach to stderr. Default: ``True`` stdin (bool): Attach to std...
4
stack_v2_sparse_classes_30k_train_001238
Implement the Python class `ExecApiMixin` described below. Class description: Implement the ExecApiMixin class. Method signatures and docstrings: - def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): Sets...
Implement the Python class `ExecApiMixin` described below. Class description: Implement the ExecApiMixin class. Method signatures and docstrings: - def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): Sets...
c38656dc7894363f32317affecc3e4279e1163f8
<|skeleton|> class ExecApiMixin: def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): """Sets up an exec instance in a running container. Args: container (str): Target container where exec insta...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExecApiMixin: def exec_create(self, container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None): """Sets up an exec instance in a running container. Args: container (str): Target container where exec instance will be cr...
the_stack_v2_python_sparse
docker/api/exec_api.py
docker/docker-py
train
6,473
efc4e932b29cfe6f5458d8f2b041269ce01a64e7
[ "returnSql = ''\nif filter:\n grouptype = ''\n grouptype, list = SearchFilter.GetSearchList(filter)\n if urlDecode:\n returnSql = SearchFilter.ToSql(list, grouptype)\n returnSql = urllib.parse.unquote(returnSql)\n else:\n returnSql = SearchFilter.ToSql(list, grouptype)\nreturn retur...
<|body_start_0|> returnSql = '' if filter: grouptype = '' grouptype, list = SearchFilter.GetSearchList(filter) if urlDecode: returnSql = SearchFilter.ToSql(list, grouptype) returnSql = urllib.parse.unquote(returnSql) else: ...
SearchFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchFilter: def TransfromFilterToSql(filter, urlDecode=True): """转换EasyUi分页时的条件Filters为Sql Args: filter (string): Filters urlDecode (bool): Returns: returnValue (string): 字段值字符串""" <|body_0|> def GetSearchList(jsons): """将JSON字符串转换为LIST Args: jsons (string): json 串...
stack_v2_sparse_classes_10k_train_007753
3,094
no_license
[ { "docstring": "转换EasyUi分页时的条件Filters为Sql Args: filter (string): Filters urlDecode (bool): Returns: returnValue (string): 字段值字符串", "name": "TransfromFilterToSql", "signature": "def TransfromFilterToSql(filter, urlDecode=True)" }, { "docstring": "将JSON字符串转换为LIST Args: jsons (string): json 串 Retur...
3
stack_v2_sparse_classes_30k_train_000504
Implement the Python class `SearchFilter` described below. Class description: Implement the SearchFilter class. Method signatures and docstrings: - def TransfromFilterToSql(filter, urlDecode=True): 转换EasyUi分页时的条件Filters为Sql Args: filter (string): Filters urlDecode (bool): Returns: returnValue (string): 字段值字符串 - def G...
Implement the Python class `SearchFilter` described below. Class description: Implement the SearchFilter class. Method signatures and docstrings: - def TransfromFilterToSql(filter, urlDecode=True): 转换EasyUi分页时的条件Filters为Sql Args: filter (string): Filters urlDecode (bool): Returns: returnValue (string): 字段值字符串 - def G...
24689b359ee225c8678b33766e51a045fa5d50c9
<|skeleton|> class SearchFilter: def TransfromFilterToSql(filter, urlDecode=True): """转换EasyUi分页时的条件Filters为Sql Args: filter (string): Filters urlDecode (bool): Returns: returnValue (string): 字段值字符串""" <|body_0|> def GetSearchList(jsons): """将JSON字符串转换为LIST Args: jsons (string): json 串...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SearchFilter: def TransfromFilterToSql(filter, urlDecode=True): """转换EasyUi分页时的条件Filters为Sql Args: filter (string): Filters urlDecode (bool): Returns: returnValue (string): 字段值字符串""" returnSql = '' if filter: grouptype = '' grouptype, list = SearchFilter.GetSear...
the_stack_v2_python_sparse
apps/utilities/publiclibrary/SearchFilter.py
seesky/hpwf
train
32
d5b188cf33941b0f248c596f975c6cc85397fcd9
[ "self.nums = {}\nfor i, v in enumerate(nums):\n self.nums[i] = v", "sum = 0\nfor x in range(i, j + 1):\n sum += self.nums[x]\nreturn sum" ]
<|body_start_0|> self.nums = {} for i, v in enumerate(nums): self.nums[i] = v <|end_body_0|> <|body_start_1|> sum = 0 for x in range(i, j + 1): sum += self.nums[x] return sum <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_007754
1,287
no_license
[ { "docstring": "initialize your data structure here. :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, ...
2
stack_v2_sparse_classes_30k_train_004622
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
6de551327f96ec4d4b63d0045281b65bbb4f5d0f
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" self.nums = {} for i, v in enumerate(nums): self.nums[i] = v def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtyp...
the_stack_v2_python_sparse
sumRange.py
JingweiTu/leetcode
train
0
edba1402e44e984f36352b564538403c60656216
[ "from collections import Counter\ncounter = Counter(nums)\ni = 0\nfor color in range(3):\n for _ in range(counter[color]):\n nums[i] = color\n i += 1", "\"\"\"https://leetcode.com/problems/sort-colors/discuss/26481/Python-O(n)-1-pass-in-place-solution-with-explanation\"\"\"\nn = len(nums)\nl, r =...
<|body_start_0|> from collections import Counter counter = Counter(nums) i = 0 for color in range(3): for _ in range(counter[color]): nums[i] = color i += 1 <|end_body_0|> <|body_start_1|> """https://leetcode.com/problems/sort-colors/d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortColors(self, nums: List[int]) -> None: """Counting Sort, Time: O(n), Space: O(n)""" <|body_0|> def sortColors(self, nums: List[int]) -> None: """Two Pointer, Time: O(n), Space: O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> f...
stack_v2_sparse_classes_10k_train_007755
1,275
no_license
[ { "docstring": "Counting Sort, Time: O(n), Space: O(n)", "name": "sortColors", "signature": "def sortColors(self, nums: List[int]) -> None" }, { "docstring": "Two Pointer, Time: O(n), Space: O(1)", "name": "sortColors", "signature": "def sortColors(self, nums: List[int]) -> None" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums: List[int]) -> None: Counting Sort, Time: O(n), Space: O(n) - def sortColors(self, nums: List[int]) -> None: Two Pointer, Time: O(n), Space: O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums: List[int]) -> None: Counting Sort, Time: O(n), Space: O(n) - def sortColors(self, nums: List[int]) -> None: Two Pointer, Time: O(n), Space: O(1) <|ske...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def sortColors(self, nums: List[int]) -> None: """Counting Sort, Time: O(n), Space: O(n)""" <|body_0|> def sortColors(self, nums: List[int]) -> None: """Two Pointer, Time: O(n), Space: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sortColors(self, nums: List[int]) -> None: """Counting Sort, Time: O(n), Space: O(n)""" from collections import Counter counter = Counter(nums) i = 0 for color in range(3): for _ in range(counter[color]): nums[i] = color ...
the_stack_v2_python_sparse
python/75-Sort Colors.py
cwza/leetcode
train
0
029fd7c4aabe1ebcfd683db2b9668d059f5f4785
[ "B = []\nlength = len(A)\nfor i in range(length):\n B.append(int(str(A[i])[-k]))\nreturn B", "C = []\nB = _deepcopy(A)\nk = 27\nfor i in range(k):\n C.append(0)\nlength = len(A)\nfor j in range(length):\n C[A[j]] = C[A[j]] + 1\nfor i in range(1, k):\n C[i] = C[i] + C[i - 1]\nfor i in range(length):\n ...
<|body_start_0|> B = [] length = len(A) for i in range(length): B.append(int(str(A[i])[-k])) return B <|end_body_0|> <|body_start_1|> C = [] B = _deepcopy(A) k = 27 for i in range(k): C.append(0) length = len(A) for...
chpater8.3 note and function
Chapter8_3
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chapter8_3: """chpater8.3 note and function""" def getarraystr_subarray(self, A, k): """取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] `...
stack_v2_sparse_classes_10k_train_007756
18,569
permissive
[ { "docstring": "取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] ```", "name": "getarraystr_subarray", "signature": "def getarraystr_subarray(self, A, k)" }...
4
stack_v2_sparse_classes_30k_train_006857
Implement the Python class `Chapter8_3` described below. Class description: chpater8.3 note and function Method signatures and docstrings: - def getarraystr_subarray(self, A, k): 取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarra...
Implement the Python class `Chapter8_3` described below. Class description: chpater8.3 note and function Method signatures and docstrings: - def getarraystr_subarray(self, A, k): 取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarra...
33662f46dc346203b220d7481d1a4439feda05d2
<|skeleton|> class Chapter8_3: """chpater8.3 note and function""" def getarraystr_subarray(self, A, k): """取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] `...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Chapter8_3: """chpater8.3 note and function""" def getarraystr_subarray(self, A, k): """取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] ```""" ...
the_stack_v2_python_sparse
src/chapter8/chapter8note.py
HideLakitu/IntroductionToAlgorithm.Python
train
1
716598e54713fde901b3625461d59204dc4e9cb7
[ "self.input_size = input_size\nself.output_size = output_size\nself.X = tf.placeholder(tf.float32, shape=[None, self.input_size])\nself.Y = tf.placeholder(tf.float32, shape=[None, self.output_size])\nself.weights = tf.Variable(tf.glorot_uniform_initializer()((self.input_size, self.output_size)))\nself.biases = tf.V...
<|body_start_0|> self.input_size = input_size self.output_size = output_size self.X = tf.placeholder(tf.float32, shape=[None, self.input_size]) self.Y = tf.placeholder(tf.float32, shape=[None, self.output_size]) self.weights = tf.Variable(tf.glorot_uniform_initializer()((self.inp...
SoftmaxRegression
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftmaxRegression: def __init__(self, input_size, output_size, dropout=False, BN=False): """Function: Initialization of all variables""" <|body_0|> def Regression(self): """Function: Define softmax function as y = sigmoid(A * x + b) Using tf function tf.layers.BatchN...
stack_v2_sparse_classes_10k_train_007757
19,475
no_license
[ { "docstring": "Function: Initialization of all variables", "name": "__init__", "signature": "def __init__(self, input_size, output_size, dropout=False, BN=False)" }, { "docstring": "Function: Define softmax function as y = sigmoid(A * x + b) Using tf function tf.layers.BatchNormalization()", ...
5
stack_v2_sparse_classes_30k_train_001853
Implement the Python class `SoftmaxRegression` described below. Class description: Implement the SoftmaxRegression class. Method signatures and docstrings: - def __init__(self, input_size, output_size, dropout=False, BN=False): Function: Initialization of all variables - def Regression(self): Function: Define softmax...
Implement the Python class `SoftmaxRegression` described below. Class description: Implement the SoftmaxRegression class. Method signatures and docstrings: - def __init__(self, input_size, output_size, dropout=False, BN=False): Function: Initialization of all variables - def Regression(self): Function: Define softmax...
929e28c3ea5aec63bc655035c48d96d2d3cff5bc
<|skeleton|> class SoftmaxRegression: def __init__(self, input_size, output_size, dropout=False, BN=False): """Function: Initialization of all variables""" <|body_0|> def Regression(self): """Function: Define softmax function as y = sigmoid(A * x + b) Using tf function tf.layers.BatchN...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SoftmaxRegression: def __init__(self, input_size, output_size, dropout=False, BN=False): """Function: Initialization of all variables""" self.input_size = input_size self.output_size = output_size self.X = tf.placeholder(tf.float32, shape=[None, self.input_size]) self.Y...
the_stack_v2_python_sparse
Ao_Zhang/assignment2/assignment2_question3.py
ZhangAoCanada/CSI5138_Assignments
train
1
879ffbc10241dc43f05e36ca9cfd1218cf97d636
[ "self._recursive = recursive\nnop = lambda: None\nskip = lambda arg: None\nself.link_callback = skip\nself.link_content_callback = skip\nself.ext_link_callback = skip\nself.redirect_callback = skip\nself.error_callback = skip\nself.nonhtml_callback = skip\nself.stop_callback = nop\nself.ext_link_test = have_same_ba...
<|body_start_0|> self._recursive = recursive nop = lambda: None skip = lambda arg: None self.link_callback = skip self.link_content_callback = skip self.ext_link_callback = skip self.redirect_callback = skip self.error_callback = skip self.nonhtml_...
URL-redirects crawler
LinkCrawler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkCrawler: """URL-redirects crawler""" def __init__(self, recursive=True): """Constructor""" <|body_0|> def process(self, url): """Iterate the external links from url""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._recursive = recursive ...
stack_v2_sparse_classes_10k_train_007758
2,502
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, recursive=True)" }, { "docstring": "Iterate the external links from url", "name": "process", "signature": "def process(self, url)" } ]
2
stack_v2_sparse_classes_30k_train_002157
Implement the Python class `LinkCrawler` described below. Class description: URL-redirects crawler Method signatures and docstrings: - def __init__(self, recursive=True): Constructor - def process(self, url): Iterate the external links from url
Implement the Python class `LinkCrawler` described below. Class description: URL-redirects crawler Method signatures and docstrings: - def __init__(self, recursive=True): Constructor - def process(self, url): Iterate the external links from url <|skeleton|> class LinkCrawler: """URL-redirects crawler""" def...
aab6927de8424f0a8e9eb9b9a462a775555a80d5
<|skeleton|> class LinkCrawler: """URL-redirects crawler""" def __init__(self, recursive=True): """Constructor""" <|body_0|> def process(self, url): """Iterate the external links from url""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinkCrawler: """URL-redirects crawler""" def __init__(self, recursive=True): """Constructor""" self._recursive = recursive nop = lambda: None skip = lambda arg: None self.link_callback = skip self.link_content_callback = skip self.ext_link_callback ...
the_stack_v2_python_sparse
lib/core/crawler.py
Silentsoul04/gtta-scripts
train
0
86367a1d88a19de1f9555d5703d705fba9ca793d
[ "try:\n with transaction.atomic():\n self.create(user=user, group=group, project=group.project, is_active=True, reason=reason)\nexcept IntegrityError:\n pass", "from sentry.models import User, UserOption, UserOptionValue\nusers = User.objects.filter(sentry_orgmember_set__teams=group.project.team, is_...
<|body_start_0|> try: with transaction.atomic(): self.create(user=user, group=group, project=group.project, is_active=True, reason=reason) except IntegrityError: pass <|end_body_0|> <|body_start_1|> from sentry.models import User, UserOption, UserOptionVa...
GroupSubscriptionManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupSubscriptionManager: def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): """Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.""" <|body_0|> def get_participants(self, group): """Identify all users who are p...
stack_v2_sparse_classes_10k_train_007759
5,262
permissive
[ { "docstring": "Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.", "name": "subscribe", "signature": "def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown)" }, { "docstring": "Identify all users who are participating with a given issue.", ...
2
stack_v2_sparse_classes_30k_train_003809
Implement the Python class `GroupSubscriptionManager` described below. Class description: Implement the GroupSubscriptionManager class. Method signatures and docstrings: - def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): Subscribe a user to an issue, but only if the user has not explicitly un...
Implement the Python class `GroupSubscriptionManager` described below. Class description: Implement the GroupSubscriptionManager class. Method signatures and docstrings: - def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): Subscribe a user to an issue, but only if the user has not explicitly un...
b937615079d7b24dc225a83b99b1b65da932fc66
<|skeleton|> class GroupSubscriptionManager: def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): """Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.""" <|body_0|> def get_participants(self, group): """Identify all users who are p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupSubscriptionManager: def subscribe(self, group, user, reason=GroupSubscriptionReason.unknown): """Subscribe a user to an issue, but only if the user has not explicitly unsubscribed.""" try: with transaction.atomic(): self.create(user=user, group=group, project=...
the_stack_v2_python_sparse
src/sentry/models/groupsubscription.py
atlassian/sentry
train
1
f03440f4918b1cf3bddc4044ae371b24da2e5d5b
[ "username = attrs['username']\npassword = attrs['password']\ntry:\n user = User.objects.get(username=username, is_staff=True)\nexcept User.DoesNotExit:\n raise serializers.ValidationError('手机号或密码错误')\nif not user.check_password(password):\n raise serializers.ValidationError('手机号或密码错误')\nattrs['user'] = use...
<|body_start_0|> username = attrs['username'] password = attrs['password'] try: user = User.objects.get(username=username, is_staff=True) except User.DoesNotExit: raise serializers.ValidationError('手机号或密码错误') if not user.check_password(password): ...
验证序列化器类
AuthorizationSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthorizationSerializer: """验证序列化器类""" def validate(self, attrs): """自定义验证用户名和密码""" <|body_0|> def create(self, validated_data): """重新增加一个jwt""" <|body_1|> <|end_skeleton|> <|body_start_0|> username = attrs['username'] password = attrs['...
stack_v2_sparse_classes_10k_train_007760
3,173
permissive
[ { "docstring": "自定义验证用户名和密码", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "重新增加一个jwt", "name": "create", "signature": "def create(self, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_003602
Implement the Python class `AuthorizationSerializer` described below. Class description: 验证序列化器类 Method signatures and docstrings: - def validate(self, attrs): 自定义验证用户名和密码 - def create(self, validated_data): 重新增加一个jwt
Implement the Python class `AuthorizationSerializer` described below. Class description: 验证序列化器类 Method signatures and docstrings: - def validate(self, attrs): 自定义验证用户名和密码 - def create(self, validated_data): 重新增加一个jwt <|skeleton|> class AuthorizationSerializer: """验证序列化器类""" def validate(self, attrs): ...
d3ce2185ec3c68325e8becddce07d0a9da144325
<|skeleton|> class AuthorizationSerializer: """验证序列化器类""" def validate(self, attrs): """自定义验证用户名和密码""" <|body_0|> def create(self, validated_data): """重新增加一个jwt""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuthorizationSerializer: """验证序列化器类""" def validate(self, attrs): """自定义验证用户名和密码""" username = attrs['username'] password = attrs['password'] try: user = User.objects.get(username=username, is_staff=True) except User.DoesNotExit: raise seria...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/meiduo_admin/serializers/users.py
qls7/dianshanghoutai
train
0
53e6f621be4a62d35f4dbc3298cbb5842d8bf325
[ "super(PdCateInput, self).__init__(parent=parent)\nself.mainEngine = mainEngine\nself.eventEngine = eventEngine\nself.initUi()", "self.setWindowTitle('输入协存项目')\nself.setMinimumSize(500, 200)\nself.setFont(BASIC_FONT)\nself.initInput()", "pd_project_name_Label = QLabel('协存项目名称')\npd_project_rate_Label = QLabel('...
<|body_start_0|> super(PdCateInput, self).__init__(parent=parent) self.mainEngine = mainEngine self.eventEngine = eventEngine self.initUi() <|end_body_0|> <|body_start_1|> self.setWindowTitle('输入协存项目') self.setMinimumSize(500, 200) self.setFont(BASIC_FONT) ...
协存输入
PdCateInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PdCateInput: """协存输入""" def __init__(self, mainEngine, eventEngine=None, parent=None): """Constructor""" <|body_0|> def initUi(self): """初始化界面""" <|body_1|> def initInput(self): """设置输入框""" <|body_2|> def insertDB(self): ...
stack_v2_sparse_classes_10k_train_007761
3,686
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, mainEngine, eventEngine=None, parent=None)" }, { "docstring": "初始化界面", "name": "initUi", "signature": "def initUi(self)" }, { "docstring": "设置输入框", "name": "initInput", "signature": "def in...
4
stack_v2_sparse_classes_30k_train_002156
Implement the Python class `PdCateInput` described below. Class description: 协存输入 Method signatures and docstrings: - def __init__(self, mainEngine, eventEngine=None, parent=None): Constructor - def initUi(self): 初始化界面 - def initInput(self): 设置输入框 - def insertDB(self): 增加数据
Implement the Python class `PdCateInput` described below. Class description: 协存输入 Method signatures and docstrings: - def __init__(self, mainEngine, eventEngine=None, parent=None): Constructor - def initUi(self): 初始化界面 - def initInput(self): 设置输入框 - def insertDB(self): 增加数据 <|skeleton|> class PdCateInput: """协存输...
aa0274650a6f16ee52dfac491eb520029d3dd846
<|skeleton|> class PdCateInput: """协存输入""" def __init__(self, mainEngine, eventEngine=None, parent=None): """Constructor""" <|body_0|> def initUi(self): """初始化界面""" <|body_1|> def initInput(self): """设置输入框""" <|body_2|> def insertDB(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PdCateInput: """协存输入""" def __init__(self, mainEngine, eventEngine=None, parent=None): """Constructor""" super(PdCateInput, self).__init__(parent=parent) self.mainEngine = mainEngine self.eventEngine = eventEngine self.initUi() def initUi(self): """初始化...
the_stack_v2_python_sparse
view/protocolView/PdCateInput.py
zhnlk/feeCalculate
train
0
784ba2c982c389a3f7ca834225c5691aae21508b
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. Th...
StorageRegistryServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageRegistryServiceServicer: """Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this d...
stack_v2_sparse_classes_10k_train_007762
5,403
no_license
[ { "docstring": "Returns the storage provider that is reponsible for the given resource reference. MUST return CODE_NOT_FOUND if the reference does not exist.", "name": "GetStorageProvider", "signature": "def GetStorageProvider(self, request, context)" }, { "docstring": "Returns a list of the ava...
3
stack_v2_sparse_classes_30k_train_000365
Implement the Python class `StorageRegistryServiceServicer` described below. Class description: Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMM...
Implement the Python class `StorageRegistryServiceServicer` described below. Class description: Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMM...
dad1a042b38db5f8bedcac3b6af25066f4d6eef9
<|skeleton|> class StorageRegistryServiceServicer: """Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StorageRegistryServiceServicer: """Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are t...
the_stack_v2_python_sparse
cs3/storageregistry/v0alpha/storageregistry_pb2_grpc.py
SamuAlfageme/python-cs3apis
train
0
e450095e7de6421b5f6d3828ebbdc25a03ee1493
[ "[teams] = valuelist\nteams = [team.splitlines() for team in re.split('(?:\\r\\n|\\n){2,}', teams.strip())]\nif len(teams) == 1:\n teams = [[trainer] for trainer in teams[0]]\nself.data = teams", "if not self.data:\n return ''\nelif all((len(team) == 1 for team in self.data)):\n return '\\n'.join((traine...
<|body_start_0|> [teams] = valuelist teams = [team.splitlines() for team in re.split('(?:\r\n|\n){2,}', teams.strip())] if len(teams) == 1: teams = [[trainer] for trainer in teams[0]] self.data = teams <|end_body_0|> <|body_start_1|> if not self.data: ret...
A field for entering trainers who will participate in a battle.
BattleTrainerField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BattleTrainerField: """A field for entering trainers who will participate in a battle.""" def process_formdata(self, valuelist): """Split the input into lists of names.""" <|body_0|> def _value(self): """Re-join all the lists of names into one string.""" ...
stack_v2_sparse_classes_10k_train_007763
21,218
no_license
[ { "docstring": "Split the input into lists of names.", "name": "process_formdata", "signature": "def process_formdata(self, valuelist)" }, { "docstring": "Re-join all the lists of names into one string.", "name": "_value", "signature": "def _value(self)" }, { "docstring": "Do som...
4
stack_v2_sparse_classes_30k_train_003651
Implement the Python class `BattleTrainerField` described below. Class description: A field for entering trainers who will participate in a battle. Method signatures and docstrings: - def process_formdata(self, valuelist): Split the input into lists of names. - def _value(self): Re-join all the lists of names into on...
Implement the Python class `BattleTrainerField` described below. Class description: A field for entering trainers who will participate in a battle. Method signatures and docstrings: - def process_formdata(self, valuelist): Split the input into lists of names. - def _value(self): Re-join all the lists of names into on...
872c0b21ed8d45a4c88d51969d3531b8b7913e71
<|skeleton|> class BattleTrainerField: """A field for entering trainers who will participate in a battle.""" def process_formdata(self, valuelist): """Split the input into lists of names.""" <|body_0|> def _value(self): """Re-join all the lists of names into one string.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BattleTrainerField: """A field for entering trainers who will participate in a battle.""" def process_formdata(self, valuelist): """Split the input into lists of names.""" [teams] = valuelist teams = [team.splitlines() for team in re.split('(?:\r\n|\n){2,}', teams.strip())] ...
the_stack_v2_python_sparse
asb/views/battle.py
CatTrinket/tcod-asb
train
1
dfc5681b10b8d6eb3b321d6b91ff592ee23f1880
[ "if amount < 1:\n return 0\nreturn self.coin_change(coins, amount, [0] * (amount + 1))", "if remainder < 0:\n return -1\n'\\n NOTE: BASE CASE\\n The minimum coins needed to make change for 0 is always 0\\n coins no matter what coins we have.\\n '\nif remainder == 0:\n return 0...
<|body_start_0|> if amount < 1: return 0 return self.coin_change(coins, amount, [0] * (amount + 1)) <|end_body_0|> <|body_start_1|> if remainder < 0: return -1 '\n NOTE: BASE CASE\n The minimum coins needed to make change for 0 is always 0\n ...
TopDownSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopDownSolution: def leastCoins(self, coins, amount): """Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are ...
stack_v2_sparse_classes_10k_train_007764
5,135
no_license
[ { "docstring": "Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are the base cases? - When the remainder is less then 0 - When the re...
2
null
Implement the Python class `TopDownSolution` described below. Class description: Implement the TopDownSolution class. Method signatures and docstrings: - def leastCoins(self, coins, amount): Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each s...
Implement the Python class `TopDownSolution` described below. Class description: Implement the TopDownSolution class. Method signatures and docstrings: - def leastCoins(self, coins, amount): Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each s...
c0d49423885832b616ae3c7cd58e8f24c17cfd4d
<|skeleton|> class TopDownSolution: def leastCoins(self, coins, amount): """Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TopDownSolution: def leastCoins(self, coins, amount): """Interface ---- :type coins: list of int :type amount: int :rtype: int Approach ---- 1. We use a recursive approach 2. At each stack frame we consider what choices do we have to make and how does this get us to our goal 3. What are the base cases...
the_stack_v2_python_sparse
dynamicProgramming/min_coins_make_change.py
miaviles/Data-Structures-Algorithms-Python
train
0
ad5481e9b26a8ea9f9d56a19ed369ce6fad3ce59
[ "user = request.user\ncheck_user_status(user)\nuser_id = user.id\nvalidate(instance=request.data, schema=schemas.food_insert_edit_schema)\nbody = request.data\nPendingFood.field_validate(body)\nrestaurant = PendingRestaurant.get_by_owner(user_id)\ndish = PendingFood.edit_dish(dish_id, body, restaurant._id)\nreturn ...
<|body_start_0|> user = request.user check_user_status(user) user_id = user.id validate(instance=request.data, schema=schemas.food_insert_edit_schema) body = request.data PendingFood.field_validate(body) restaurant = PendingRestaurant.get_by_owner(user_id) ...
PendingDish view for updating or deleting
PendingDishModifyDeleteView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PendingDishModifyDeleteView: """PendingDish view for updating or deleting""" def put(self, request, dish_id): """Updates dish data""" <|body_0|> def delete(self, request, dish_id): """Deletes dish from database""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_10k_train_007765
19,356
no_license
[ { "docstring": "Updates dish data", "name": "put", "signature": "def put(self, request, dish_id)" }, { "docstring": "Deletes dish from database", "name": "delete", "signature": "def delete(self, request, dish_id)" } ]
2
stack_v2_sparse_classes_30k_train_003026
Implement the Python class `PendingDishModifyDeleteView` described below. Class description: PendingDish view for updating or deleting Method signatures and docstrings: - def put(self, request, dish_id): Updates dish data - def delete(self, request, dish_id): Deletes dish from database
Implement the Python class `PendingDishModifyDeleteView` described below. Class description: PendingDish view for updating or deleting Method signatures and docstrings: - def put(self, request, dish_id): Updates dish data - def delete(self, request, dish_id): Deletes dish from database <|skeleton|> class PendingDish...
2707062c9a9a8bb4baca955e8a60ba08cc9f8953
<|skeleton|> class PendingDishModifyDeleteView: """PendingDish view for updating or deleting""" def put(self, request, dish_id): """Updates dish data""" <|body_0|> def delete(self, request, dish_id): """Deletes dish from database""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PendingDishModifyDeleteView: """PendingDish view for updating or deleting""" def put(self, request, dish_id): """Updates dish data""" user = request.user check_user_status(user) user_id = user.id validate(instance=request.data, schema=schemas.food_insert_edit_schem...
the_stack_v2_python_sparse
backend/restaurant/views.py
MochiTarts/Find-Dining-The-Bridge
train
1
c1dc2f0df073027de820071920a43badb81bb84d
[ "super().__init__(dynamic=True, **kwargs)\nself.max_edge = maximum_edge_length\nself.dimensions = homology_dimensions\nself.min_persistence = min_persistence if min_persistence is not None else [0.0 for _ in range(len(self.dimensions))]\nself.hcf = homology_coeff_field\nassert len(self.min_persistence) == len(self....
<|body_start_0|> super().__init__(dynamic=True, **kwargs) self.max_edge = maximum_edge_length self.dimensions = homology_dimensions self.min_persistence = min_persistence if min_persistence is not None else [0.0 for _ in range(len(self.dimensions))] self.hcf = homology_coeff_fiel...
TensorFlow layer for computing Rips persistence out of a point cloud
RipsLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RipsLayer: """TensorFlow layer for computing Rips persistence out of a point cloud""" def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): """Constructor for the RipsLayer class Parameters: maximum_edge_length (...
stack_v2_sparse_classes_10k_train_007766
4,886
permissive
[ { "docstring": "Constructor for the RipsLayer class Parameters: maximum_edge_length (float): maximum edge length for the Rips complex homology_dimensions (List[int]): list of homology dimensions min_persistence (List[float]): minimum distance-to-diagonal of the points in the output persistence diagrams (default...
2
stack_v2_sparse_classes_30k_train_003124
Implement the Python class `RipsLayer` described below. Class description: TensorFlow layer for computing Rips persistence out of a point cloud Method signatures and docstrings: - def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): Constructor ...
Implement the Python class `RipsLayer` described below. Class description: TensorFlow layer for computing Rips persistence out of a point cloud Method signatures and docstrings: - def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): Constructor ...
2f76d9416e145282adcd8264438480008bd59f77
<|skeleton|> class RipsLayer: """TensorFlow layer for computing Rips persistence out of a point cloud""" def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): """Constructor for the RipsLayer class Parameters: maximum_edge_length (...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RipsLayer: """TensorFlow layer for computing Rips persistence out of a point cloud""" def __init__(self, homology_dimensions, maximum_edge_length=np.inf, min_persistence=None, homology_coeff_field=11, **kwargs): """Constructor for the RipsLayer class Parameters: maximum_edge_length (float): maxim...
the_stack_v2_python_sparse
src/python/gudhi/tensorflow/rips_layer.py
GUDHI/gudhi-devel
train
212
f1fee2d533d9cfda0b03ba19ff00cf989b7c1732
[ "if not prices:\n return 0\nmax_profit, min_price = (0, prices[0])\nfor i in range(1, len(prices)):\n if prices[i] < min_price:\n min_price = prices[i]\n else:\n max_profit = max(max_profit, prices[i] - min_price)\nreturn max_profit", "max_profit, max_curr = (0, 0)\nfor i in range(1, len(pr...
<|body_start_0|> if not prices: return 0 max_profit, min_price = (0, prices[0]) for i in range(1, len(prices)): if prices[i] < min_price: min_price = prices[i] else: max_profit = max(max_profit, prices[i] - min_price) re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit_MK1(self, prices: List[int]) -> int: """Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def maxProfit_MK2(self, prices: List[int]) -> int: """My solution. Time complexity: O(n). Space complexity: O(1...
stack_v2_sparse_classes_10k_train_007767
1,295
no_license
[ { "docstring": "Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)", "name": "maxProfit_MK1", "signature": "def maxProfit_MK1(self, prices: List[int]) -> int" }, { "docstring": "My solution. Time complexity: O(n). Space complexity: O(1). Calculate the difference array ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_MK1(self, prices: List[int]) -> int: Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1) - def maxProfit_MK2(self, prices: List[int]) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_MK1(self, prices: List[int]) -> int: Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1) - def maxProfit_MK2(self, prices: List[int]) -> i...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def maxProfit_MK1(self, prices: List[int]) -> int: """Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def maxProfit_MK2(self, prices: List[int]) -> int: """My solution. Time complexity: O(n). Space complexity: O(1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit_MK1(self, prices: List[int]) -> int: """Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)""" if not prices: return 0 max_profit, min_price = (0, prices[0]) for i in range(1, len(prices)): if prices[i] <...
the_stack_v2_python_sparse
0121. Best Time to Buy and Sell Stock/Solution.py
faterazer/LeetCode
train
4
681706c9b63dfeea3a60d738a3f91124a7691063
[ "super().__init__(**kwargs)\nself._model_directory = self._options['model_directory']\nself._half_precision_model = self._options.get('half_precision_model', False)\nself._model = BertModel.from_pretrained(self._model_directory)\nif self._half_precision_model:\n self._model = self._model.half()\nself._model = se...
<|body_start_0|> super().__init__(**kwargs) self._model_directory = self._options['model_directory'] self._half_precision_model = self._options.get('half_precision_model', False) self._model = BertModel.from_pretrained(self._model_directory) if self._half_precision_model: ...
ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225
ProtTransBertBFDEmbedder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtTransBertBFDEmbedder: """ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225"...
stack_v2_sparse_classes_10k_train_007768
1,793
permissive
[ { "docstring": "Initialize Bert embedder. :param model_directory: :param half_precision_model:", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Returns the CPU model", "name": "_get_fallback_model", "signature": "def _get_fallback_model(self) -> BertMo...
2
stack_v2_sparse_classes_30k_train_003039
Implement the Python class `ProtTransBertBFDEmbedder` described below. Class description: ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2...
Implement the Python class `ProtTransBertBFDEmbedder` described below. Class description: ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2...
efb9801f0de9b9d51d19b741088763a7d2d0c3a2
<|skeleton|> class ProtTransBertBFDEmbedder: """ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProtTransBertBFDEmbedder: """ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225""" def _...
the_stack_v2_python_sparse
bio_embeddings/embed/prottrans_bert_bfd_embedder.py
sacdallago/bio_embeddings
train
383
538c0e52ddba115234f80f951a8bc2548f169540
[ "super(NewlineSentenceSplitter, self).__init__(**kwargs)\nif 'create_empty' in kwargs:\n self.create_empty = True\nelse:\n self.create_empty = False\nif kwargs.get('use_universal_newline', 'true').lower() == 'true':\n self.use_universal_newline = True\nelse:\n self.use_universal_newline = False", "add...
<|body_start_0|> super(NewlineSentenceSplitter, self).__init__(**kwargs) if 'create_empty' in kwargs: self.create_empty = True else: self.create_empty = False if kwargs.get('use_universal_newline', 'true').lower() == 'true': self.use_universal_newline ...
This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline
NewlineSentenceSplitter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewlineSentenceSplitter: """This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline""" def __init__(self, **kwargs): """:param kwargs: create_empty: This is very useful if you want to strictly as...
stack_v2_sparse_classes_10k_train_007769
2,412
permissive
[ { "docstring": ":param kwargs: create_empty: This is very useful if you want to strictly assume number of sentences matches with your input for alignment purpose. When specified, it will create empty sentence as place holders for empty lines. Usage: ``` SENTENCE_SPLITTING_MODEL NewlineSentenceSplitter create_em...
2
null
Implement the Python class `NewlineSentenceSplitter` described below. Class description: This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline Method signatures and docstrings: - def __init__(self, **kwargs): :param kwargs: cre...
Implement the Python class `NewlineSentenceSplitter` described below. Class description: This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline Method signatures and docstrings: - def __init__(self, **kwargs): :param kwargs: cre...
b486a66339a330e94d81850e6acb3a7e34df746e
<|skeleton|> class NewlineSentenceSplitter: """This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline""" def __init__(self, **kwargs): """:param kwargs: create_empty: This is very useful if you want to strictly as...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NewlineSentenceSplitter: """This should be used when each sentence is on a separate line of document -- useful for converting pre-tokenized corpora to serifxml via pipeline""" def __init__(self, **kwargs): """:param kwargs: create_empty: This is very useful if you want to strictly assume number o...
the_stack_v2_python_sparse
src/python/serif/model/impl/sentence_splitter/newline_sentence_splitter.py
BBN-E/text-open
train
2
2a0f4c5cb475a8861c8564158531d8a211415176
[ "paginator = client.get_paginator('describe_load_balancers')\nload_balancers = {}\nfor resp in paginator.paginate():\n for lb in resp.get('LoadBalancers', []):\n resource_arn = lb['LoadBalancerArn']\n try:\n lb_attrs = cls.get_lb_attrs(client, resource_arn)\n lb.update(lb_attr...
<|body_start_0|> paginator = client.get_paginator('describe_load_balancers') load_balancers = {} for resp in paginator.paginate(): for lb in resp.get('LoadBalancers', []): resource_arn = lb['LoadBalancerArn'] try: lb_attrs = cls.get...
Resource for load balancer
LoadBalancerResourceSpec
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadBalancerResourceSpec: """Resource for load balancer""" def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: """Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...}...
stack_v2_sparse_classes_10k_train_007770
4,379
permissive
[ { "docstring": "Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...} Where the dicts represent results from describe_load_balancers.", "name": "list_from_aws", "signature": "def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: ...
2
stack_v2_sparse_classes_30k_train_003174
Implement the Python class `LoadBalancerResourceSpec` described below. Class description: Resource for load balancer Method signatures and docstrings: - def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: Return a dict of dicts of the format...
Implement the Python class `LoadBalancerResourceSpec` described below. Class description: Resource for load balancer Method signatures and docstrings: - def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: Return a dict of dicts of the format...
eb7d5d18f3d177973c4105c21be9d251250ca8d6
<|skeleton|> class LoadBalancerResourceSpec: """Resource for load balancer""" def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: """Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...}...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LoadBalancerResourceSpec: """Resource for load balancer""" def list_from_aws(cls: Type['LoadBalancerResourceSpec'], client: BaseClient, account_id: str, region: str) -> ListFromAWSResult: """Return a dict of dicts of the format: {'lb_1_arn': {lb_1_dict}, 'lb_2_arn': {lb_2_dict}, ...} Where the di...
the_stack_v2_python_sparse
altimeter/aws/resource/elbv2/load_balancer.py
tableau/altimeter
train
75
2b5718603423712bade7ba9528f3b40731036501
[ "acting_user = UserFactory.create()\norder = OrderFactory.create()\noriginal_before_json = serialize_model_object(order)\noriginal_before_json['lines'] = []\nassert OrderAudit.objects.count() == 0\norder.save_and_log(acting_user)\nassert OrderAudit.objects.count() == 1\noriginal_after_json = serialize_model_object(...
<|body_start_0|> acting_user = UserFactory.create() order = OrderFactory.create() original_before_json = serialize_model_object(order) original_before_json['lines'] = [] assert OrderAudit.objects.count() == 0 order.save_and_log(acting_user) assert OrderAudit.objec...
Tests for abstract models
ModelsTests
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelsTests: """Tests for abstract models""" def test_save_and_log(self): """Tests that save_and_log() creates an audit record with the correct information.""" <|body_0|> def test_to_dict(self): """assert output of to_dict""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_007771
2,214
permissive
[ { "docstring": "Tests that save_and_log() creates an audit record with the correct information.", "name": "test_save_and_log", "signature": "def test_save_and_log(self)" }, { "docstring": "assert output of to_dict", "name": "test_to_dict", "signature": "def test_to_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_004457
Implement the Python class `ModelsTests` described below. Class description: Tests for abstract models Method signatures and docstrings: - def test_save_and_log(self): Tests that save_and_log() creates an audit record with the correct information. - def test_to_dict(self): assert output of to_dict
Implement the Python class `ModelsTests` described below. Class description: Tests for abstract models Method signatures and docstrings: - def test_save_and_log(self): Tests that save_and_log() creates an audit record with the correct information. - def test_to_dict(self): assert output of to_dict <|skeleton|> class...
339c67b84b661a37ffe32580da72383d95666c5c
<|skeleton|> class ModelsTests: """Tests for abstract models""" def test_save_and_log(self): """Tests that save_and_log() creates an audit record with the correct information.""" <|body_0|> def test_to_dict(self): """assert output of to_dict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelsTests: """Tests for abstract models""" def test_save_and_log(self): """Tests that save_and_log() creates an audit record with the correct information.""" acting_user = UserFactory.create() order = OrderFactory.create() original_before_json = serialize_model_object(or...
the_stack_v2_python_sparse
main/models_test.py
mitodl/bootcamp-ecommerce
train
6
5c72bb73dea124923ef1165d8cb06029ae08a7d9
[ "sleep(2)\ndriver.find_element_by_id('qqLoginTab').click()\nsleep(1)\ndriver.switch_to.frame('login_frame')\nsleep(1)\ndriver.find_element_by_id('switcher_plogin').click()\nsleep(1)\ndriver.find_element_by_name('u').clear()\ndriver.find_element_by_name('u').send_keys(username)\ndriver.find_element_by_name('p').clea...
<|body_start_0|> sleep(2) driver.find_element_by_id('qqLoginTab').click() sleep(1) driver.switch_to.frame('login_frame') sleep(1) driver.find_element_by_id('switcher_plogin').click() sleep(1) driver.find_element_by_name('u').clear() driver.find_ele...
def __int__(self, driver): self.driver = driver
Mail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mail: """def __int__(self, driver): self.driver = driver""" def login(self, username, password): """登录""" <|body_0|> def logout(self): """退出""" <|body_1|> <|end_skeleton|> <|body_start_0|> sleep(2) driver.find_element_by_id('qqLoginTab')...
stack_v2_sparse_classes_10k_train_007772
1,085
no_license
[ { "docstring": "登录", "name": "login", "signature": "def login(self, username, password)" }, { "docstring": "退出", "name": "logout", "signature": "def logout(self)" } ]
2
stack_v2_sparse_classes_30k_train_005258
Implement the Python class `Mail` described below. Class description: def __int__(self, driver): self.driver = driver Method signatures and docstrings: - def login(self, username, password): 登录 - def logout(self): 退出
Implement the Python class `Mail` described below. Class description: def __int__(self, driver): self.driver = driver Method signatures and docstrings: - def login(self, username, password): 登录 - def logout(self): 退出 <|skeleton|> class Mail: """def __int__(self, driver): self.driver = driver""" def login(se...
e6d51de7fbb08b69e7985a0e9b962cae7def7844
<|skeleton|> class Mail: """def __int__(self, driver): self.driver = driver""" def login(self, username, password): """登录""" <|body_0|> def logout(self): """退出""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mail: """def __int__(self, driver): self.driver = driver""" def login(self, username, password): """登录""" sleep(2) driver.find_element_by_id('qqLoginTab').click() sleep(1) driver.switch_to.frame('login_frame') sleep(1) driver.find_element_by_id('swi...
the_stack_v2_python_sparse
selenium_20190727/test_day_02/module.py
wangcaicai-666/PythonDemo
train
0
8bcd795a9f88132501d8b487be49fe075728c5c6
[ "if not flags.FLAGS.is_parsed():\n flags.FLAGS.mark_as_parsed()\nself.fake_data_dir = os.path.join(platforms_util.get_test_data_dir(), 'fake_tf_record_data')\nself.output_dir = output_dir\nif root_data_dir is None:\n self.data_dir = '/readahead/200M/placer/prod/home/distbelief/imagenet-tensorflow/imagenet-201...
<|body_start_0|> if not flags.FLAGS.is_parsed(): flags.FLAGS.mark_as_parsed() self.fake_data_dir = os.path.join(platforms_util.get_test_data_dir(), 'fake_tf_record_data') self.output_dir = output_dir if root_data_dir is None: self.data_dir = '/readahead/200M/place...
Base class for all benchmarks in this file.
BenchmarkBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BenchmarkBase: """Base class for all benchmarks in this file.""" def __init__(self, output_dir=None, root_data_dir=None, **kwargs): """Base class for all benchmarks in this file. Args: output_dir: directory where to output e.g. log files root_data_dir: directory under which to look f...
stack_v2_sparse_classes_10k_train_007773
36,235
permissive
[ { "docstring": "Base class for all benchmarks in this file. Args: output_dir: directory where to output e.g. log files root_data_dir: directory under which to look for dataset **kwargs: arbitrary named arguments. This is needed to make the constructor forward compatible in case PerfZero provides more named argu...
4
stack_v2_sparse_classes_30k_train_000746
Implement the Python class `BenchmarkBase` described below. Class description: Base class for all benchmarks in this file. Method signatures and docstrings: - def __init__(self, output_dir=None, root_data_dir=None, **kwargs): Base class for all benchmarks in this file. Args: output_dir: directory where to output e.g....
Implement the Python class `BenchmarkBase` described below. Class description: Base class for all benchmarks in this file. Method signatures and docstrings: - def __init__(self, output_dir=None, root_data_dir=None, **kwargs): Base class for all benchmarks in this file. Args: output_dir: directory where to output e.g....
c8e97df0d4d3d0c1020b98391c526df12371fc30
<|skeleton|> class BenchmarkBase: """Base class for all benchmarks in this file.""" def __init__(self, output_dir=None, root_data_dir=None, **kwargs): """Base class for all benchmarks in this file. Args: output_dir: directory where to output e.g. log files root_data_dir: directory under which to look f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BenchmarkBase: """Base class for all benchmarks in this file.""" def __init__(self, output_dir=None, root_data_dir=None, **kwargs): """Base class for all benchmarks in this file. Args: output_dir: directory where to output e.g. log files root_data_dir: directory under which to look for dataset **...
the_stack_v2_python_sparse
scripts/tf_cnn_benchmarks/leading_indicators_test.py
tensorflow/benchmarks
train
1,182
5885c8fa06047d5b38e48bf7e02aaeec5e59840e
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CalendarGroup()", "from .calendar import Calendar\nfrom .entity import Entity\nfrom .calendar import Calendar\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'calendars': lambda n: setattr(self, 'calendars', n....
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return CalendarGroup() <|end_body_0|> <|body_start_1|> from .calendar import Calendar from .entity import Entity from .calendar import Calendar from .entity import Entity ...
CalendarGroup
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarGroup: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k_train_007774
2,971
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: CalendarGroup", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
null
Implement the Python class `CalendarGroup` described below. Class description: Implement the CalendarGroup class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `CalendarGroup` described below. Class description: Implement the CalendarGroup class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CalendarGroup: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CalendarGroup: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarGroup: """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: CalendarGrou...
the_stack_v2_python_sparse
msgraph/generated/models/calendar_group.py
microsoftgraph/msgraph-sdk-python
train
135
d0565f83db422e3d3436761b64934a05366ebf17
[ "value = '<div>'\nclase = 'actions'\nurl_cont = '/roles/'\nperm_mod = PoseePermiso('modificar rol')\nperm_del = PoseePermiso('eliminar rol')\nif perm_mod.is_met(request.environ):\n value += '<div>' + '<a href=\"' + url_cont + str(obj.id_rol) + '/edit' + '\" class=\"' + clase + '\">Modificar</a>' + '</div><br />'...
<|body_start_0|> value = '<div>' clase = 'actions' url_cont = '/roles/' perm_mod = PoseePermiso('modificar rol') perm_del = PoseePermiso('eliminar rol') if perm_mod.is_met(request.environ): value += '<div>' + '<a href="' + url_cont + str(obj.id_rol) + '/edit' ...
RolTableFiller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RolTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" <|body_0|> def _do_get_provider_count_and_objs(self, **kw): """Se muestra la lista de rol si se tiene un permiso necesario. Caso contrario le muestra sus roles.""" <|bod...
stack_v2_sparse_classes_10k_train_007775
31,597
no_license
[ { "docstring": "Links de acciones para un registro dado", "name": "__actions__", "signature": "def __actions__(self, obj)" }, { "docstring": "Se muestra la lista de rol si se tiene un permiso necesario. Caso contrario le muestra sus roles.", "name": "_do_get_provider_count_and_objs", "si...
2
stack_v2_sparse_classes_30k_train_005415
Implement the Python class `RolTableFiller` described below. Class description: Implement the RolTableFiller class. Method signatures and docstrings: - def __actions__(self, obj): Links de acciones para un registro dado - def _do_get_provider_count_and_objs(self, **kw): Se muestra la lista de rol si se tiene un permi...
Implement the Python class `RolTableFiller` described below. Class description: Implement the RolTableFiller class. Method signatures and docstrings: - def __actions__(self, obj): Links de acciones para un registro dado - def _do_get_provider_count_and_objs(self, **kw): Se muestra la lista de rol si se tiene un permi...
997531e130d1951b483f4a6a67f2df7467cd9fd1
<|skeleton|> class RolTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" <|body_0|> def _do_get_provider_count_and_objs(self, **kw): """Se muestra la lista de rol si se tiene un permiso necesario. Caso contrario le muestra sus roles.""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RolTableFiller: def __actions__(self, obj): """Links de acciones para un registro dado""" value = '<div>' clase = 'actions' url_cont = '/roles/' perm_mod = PoseePermiso('modificar rol') perm_del = PoseePermiso('eliminar rol') if perm_mod.is_met(request.e...
the_stack_v2_python_sparse
lpm/controllers/rol.py
jorgeramirez/LPM
train
1
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTimeToArrivalToVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._other_actor = other_actor\nself._actor = actor\nself._time = time", "new_status = py_trees.common.Status.RUNNING\ncurrent_location = CarlaDataProvider.get_location(self._actor)\ntarget_locati...
<|body_start_0|> super(InTimeToArrivalToVehicle, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._other_actor = other_actor self._actor = actor self._time = time <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status.RU...
This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_actor: Reference actor used in this behavior The conditi...
InTimeToArrivalToVehicle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_acto...
stack_v2_sparse_classes_10k_train_007776
18,494
permissive
[ { "docstring": "Setup parameters", "name": "__init__", "signature": "def __init__(self, other_actor, actor, time, name='TimeToArrival')" }, { "docstring": "Check if the ego vehicle can arrive at other actor within time", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_007330
Implement the Python class `InTimeToArrivalToVehicle` described below. Class description: This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is l...
Implement the Python class `InTimeToArrivalToVehicle` described below. Class description: This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is l...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_acto...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_actor: Reference ...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
a41d8b96ccdfb544605222bcef69cd6cb18564cd
[ "for key in params.keys():\n if key not in SequenceType:\n raise ValueError(f'{key} is not a supported SequenceType.')\nself._params = params", "for key, transforms in self._params.items():\n data[key] = VideoAugmentor.MAP[key](data[key], transforms)\nreturn data" ]
<|body_start_0|> for key in params.keys(): if key not in SequenceType: raise ValueError(f'{key} is not a supported SequenceType.') self._params = params <|end_body_0|> <|body_start_1|> for key, transforms in self._params.items(): data[key] = VideoAugmento...
Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augmented.
VideoAugmentor
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoAugmentor: """Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augm...
stack_v2_sparse_classes_10k_train_007777
4,197
permissive
[ { "docstring": "Constructor. Args: params: Raises: ValueError: If params contains an unsupported data augmentation.", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Iterate and transform the data values. Currently, data augmentation is only applied to video fram...
2
null
Implement the Python class `VideoAugmentor` described below. Class description: Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. Seq...
Implement the Python class `VideoAugmentor` described below. Class description: Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. Seq...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class VideoAugmentor: """Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augm...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VideoAugmentor: """Data augmentation for videos. Augmentor consistently augments data across the time dimension (i.e. dim 0). In other words, the same transformation is applied to every single frame in a video sequence. Currently, only image frames, i.e. SequenceType.FRAMES in a video can be augmented.""" ...
the_stack_v2_python_sparse
xirl/xirl/transforms.py
Jimmy-INL/google-research
train
1
2bf9372a29a8401b64bf725faf0bcf6e2811db27
[ "with open(pkl_path, 'r') as f:\n dd = pickle.load(f)\nself.v_template = tf.Variable(undo_chumpy(dd['v_template']), name='v_template', dtype=dtype, trainable=False)\nself.size = [self.v_template.shape[0].value, 3]\nself.num_betas = dd['shapedirs'].shape[-1]\nshapedir = np.reshape(undo_chumpy(dd['shapedirs']), [-...
<|body_start_0|> with open(pkl_path, 'r') as f: dd = pickle.load(f) self.v_template = tf.Variable(undo_chumpy(dd['v_template']), name='v_template', dtype=dtype, trainable=False) self.size = [self.v_template.shape[0].value, 3] self.num_betas = dd['shapedirs'].shape[-1] ...
SMPL
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMPL: def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): """pkl_path is the path to a SMPL model""" <|body_0|> def __call__(self, beta, theta, get_skin=False, name=None): """Obtain SMPL with shape (beta) & pose (theta) inputs. Theta includes the g...
stack_v2_sparse_classes_10k_train_007778
5,935
permissive
[ { "docstring": "pkl_path is the path to a SMPL model", "name": "__init__", "signature": "def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32)" }, { "docstring": "Obtain SMPL with shape (beta) & pose (theta) inputs. Theta includes the global rotation. Args: beta: N x 10 theta: N ...
2
stack_v2_sparse_classes_30k_train_003857
Implement the Python class `SMPL` described below. Class description: Implement the SMPL class. Method signatures and docstrings: - def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): pkl_path is the path to a SMPL model - def __call__(self, beta, theta, get_skin=False, name=None): Obtain SMPL with...
Implement the Python class `SMPL` described below. Class description: Implement the SMPL class. Method signatures and docstrings: - def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): pkl_path is the path to a SMPL model - def __call__(self, beta, theta, get_skin=False, name=None): Obtain SMPL with...
6ff7fc867e9e185d547ada11713a60fbf3caa902
<|skeleton|> class SMPL: def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): """pkl_path is the path to a SMPL model""" <|body_0|> def __call__(self, beta, theta, get_skin=False, name=None): """Obtain SMPL with shape (beta) & pose (theta) inputs. Theta includes the g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SMPL: def __init__(self, pkl_path, joint_type='cocoplus', dtype=tf.float32): """pkl_path is the path to a SMPL model""" with open(pkl_path, 'r') as f: dd = pickle.load(f) self.v_template = tf.Variable(undo_chumpy(dd['v_template']), name='v_template', dtype=dtype, trainable=...
the_stack_v2_python_sparse
src/tf_smpl/batch_smpl.py
akanazawa/motion_reconstruction
train
297
d8c3ec2856565c7c3d6dc5ffdb82bbc44b2bec8f
[ "self.students = []\nself.grades = {}\nself.isSorted = True", "if student in self.students:\n raise ValueError('Duplicate student')\nself.students.append(student)\nself.grades[student.getNum()] = []\nself.isSorted = False", "try:\n self.grades[student.getNum()].append(grade)\nexcept KeyError:\n raise V...
<|body_start_0|> self.students = [] self.grades = {} self.isSorted = True <|end_body_0|> <|body_start_1|> if student in self.students: raise ValueError('Duplicate student') self.students.append(student) self.grades[student.getNum()] = [] self.isSorted...
A mapping from students to a list of grades
Grades
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creat empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type Student Add student to the grade book""" <|body_1|> def addGrade(self,...
stack_v2_sparse_classes_10k_train_007779
4,596
no_license
[ { "docstring": "Creat empty grade book", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Assumes: student is of type Student Add student to the grade book", "name": "addStudent", "signature": "def addStudent(self, student)" }, { "docstring": "Assumes: gra...
5
stack_v2_sparse_classes_30k_train_003256
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Creat empty grade book - def addStudent(self, student): Assumes: student is of type Student Add student to the grade book - def addGrade(self, stu...
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Creat empty grade book - def addStudent(self, student): Assumes: student is of type Student Add student to the grade book - def addGrade(self, stu...
b72144c258d07915936908214ec0a1bcd8a0c56a
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creat empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type Student Add student to the grade book""" <|body_1|> def addGrade(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creat empty grade book""" self.students = [] self.grades = {} self.isSorted = True def addStudent(self, student): """Assumes: student is of type Student Add student to the grade b...
the_stack_v2_python_sparse
class_inheritance.py
aduxhi/learnpython
train
0
446f93db141f6f425732417fb84e211bbd69465d
[ "super().__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.ffn = point_wise_feed_forward_network(dm, hidden)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm3 = tf.ke...
<|body_start_0|> super().__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.ffn = point_wise_feed_forward_network(dm, hidden) self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06) self.layernorm2 = tf.keras.layers.Lay...
class DecoderBlock
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """class DecoderBlock""" def __init__(self, dm, h, hidden, drop_rate=0.1): """* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public ins...
stack_v2_sparse_classes_10k_train_007780
18,002
no_license
[ { "docstring": "* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public instance attributes: * mha1 - the first MultiHeadAttention layer * mha2 - the second MultiHeadAttention lay...
2
stack_v2_sparse_classes_30k_train_006429
Implement the Python class `DecoderBlock` described below. Class description: class DecoderBlock Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * d...
Implement the Python class `DecoderBlock` described below. Class description: class DecoderBlock Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * d...
8ad4c2594ff78b345dbd92e9d54d2a143ac4071a
<|skeleton|> class DecoderBlock: """class DecoderBlock""" def __init__(self, dm, h, hidden, drop_rate=0.1): """* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public ins...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """class DecoderBlock""" def __init__(self, dm, h, hidden, drop_rate=0.1): """* dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * drop_rate - the dropout rate Sets the following public instance attribu...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer.py
jorgezafra94/holbertonschool-machine_learning
train
1
a6fe174c99fcd417755167f97fcddc8b3f87413e
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DirectoryRole()", "from .directory_object import DirectoryObject\nfrom .scoped_role_membership import ScopedRoleMembership\nfrom .directory_object import DirectoryObject\nfrom .scoped_role_membership import ScopedRoleMembership\nfields...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DirectoryRole() <|end_body_0|> <|body_start_1|> from .directory_object import DirectoryObject from .scoped_role_membership import ScopedRoleMembership from .directory_object impo...
DirectoryRole
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectoryRole: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k_train_007781
3,845
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: DirectoryRole", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
null
Implement the Python class `DirectoryRole` described below. Class description: Implement the DirectoryRole class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `DirectoryRole` described below. Class description: Implement the DirectoryRole class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DirectoryRole: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DirectoryRole: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DirectoryRole: """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: DirectoryRol...
the_stack_v2_python_sparse
msgraph/generated/models/directory_role.py
microsoftgraph/msgraph-sdk-python
train
135
06bdb34f3ffc77a71db13eed330ae21a129c0a1f
[ "self.body_spec = body_spec\nself.nn_spec = nn_spec\nself.body_decoder = BodyDecoder(body_spec)\nself.brain_decoder = NeuralNetworkDecoder(nn_spec, body_spec)", "obj = yaml.load(stream)\nrobot = Robot()\nrobot.id = obj.get('id', 0)\nrobot.body.CopyFrom(self.body_decoder.decode(obj))\nrobot.brain.CopyFrom(self.bra...
<|body_start_0|> self.body_spec = body_spec self.nn_spec = nn_spec self.body_decoder = BodyDecoder(body_spec) self.brain_decoder = NeuralNetworkDecoder(nn_spec, body_spec) <|end_body_0|> <|body_start_1|> obj = yaml.load(stream) robot = Robot() robot.id = obj.get(...
Sample converter creates a Robot protobuf message from a YAML stream and a body / neural net spec.
YamlToRobot
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YamlToRobot: """Sample converter creates a Robot protobuf message from a YAML stream and a body / neural net spec.""" def __init__(self, body_spec, nn_spec): """:param body_spec: :type body_spec: BodyImplementation :param nn_spec: :type nn_spec: NeuralNetImplementation""" <|b...
stack_v2_sparse_classes_10k_train_007782
3,202
permissive
[ { "docstring": ":param body_spec: :type body_spec: BodyImplementation :param nn_spec: :type nn_spec: NeuralNetImplementation", "name": "__init__", "signature": "def __init__(self, body_spec, nn_spec)" }, { "docstring": "Returns a protobuf `Robot` for the given stream. :param stream: :type stream...
2
stack_v2_sparse_classes_30k_train_000946
Implement the Python class `YamlToRobot` described below. Class description: Sample converter creates a Robot protobuf message from a YAML stream and a body / neural net spec. Method signatures and docstrings: - def __init__(self, body_spec, nn_spec): :param body_spec: :type body_spec: BodyImplementation :param nn_sp...
Implement the Python class `YamlToRobot` described below. Class description: Sample converter creates a Robot protobuf message from a YAML stream and a body / neural net spec. Method signatures and docstrings: - def __init__(self, body_spec, nn_spec): :param body_spec: :type body_spec: BodyImplementation :param nn_sp...
70e65320a28fe04e121145b2cdde289d3052728a
<|skeleton|> class YamlToRobot: """Sample converter creates a Robot protobuf message from a YAML stream and a body / neural net spec.""" def __init__(self, body_spec, nn_spec): """:param body_spec: :type body_spec: BodyImplementation :param nn_spec: :type nn_spec: NeuralNetImplementation""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YamlToRobot: """Sample converter creates a Robot protobuf message from a YAML stream and a body / neural net spec.""" def __init__(self, body_spec, nn_spec): """:param body_spec: :type body_spec: BodyImplementation :param nn_spec: :type nn_spec: NeuralNetImplementation""" self.body_spec =...
the_stack_v2_python_sparse
revolve/convert/yaml.py
ElteHupkes/revolve
train
0
894afbec7420c31c65df42d3e367218c3ff39e16
[ "self._momentum = momentum\nself._epsilon = epsilon\nself._trainable = trainable\nself._use_sync_bn = use_sync_bn\nif activation == 'relu':\n self._activation = tf.nn.relu\nelif activation == 'swish':\n self._activation = tf.nn.swish\nelse:\n raise ValueError('Activation {} not implemented.'.format(activat...
<|body_start_0|> self._momentum = momentum self._epsilon = epsilon self._trainable = trainable self._use_sync_bn = use_sync_bn if activation == 'relu': self._activation = tf.nn.relu elif activation == 'swish': self._activation = tf.nn.swish ...
Combined Batch Normalization and ReLU layers.
BatchNormActivation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchNormActivation: """Combined Batch Normalization and ReLU layers.""" def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): """A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for...
stack_v2_sparse_classes_10k_train_007783
26,918
permissive
[ { "docstring": "A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for the moving average. epsilon: small float added to variance to avoid dividing by zero. trainable: `boolean`, if True also add variables to the graph collection GraphKeys.TRAINABLE_VARIABLES. If ...
2
null
Implement the Python class `BatchNormActivation` described below. Class description: Combined Batch Normalization and ReLU layers. Method signatures and docstrings: - def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): A class to construct layers for a batch norma...
Implement the Python class `BatchNormActivation` described below. Class description: Combined Batch Normalization and ReLU layers. Method signatures and docstrings: - def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): A class to construct layers for a batch norma...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class BatchNormActivation: """Combined Batch Normalization and ReLU layers.""" def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): """A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BatchNormActivation: """Combined Batch Normalization and ReLU layers.""" def __init__(self, momentum=0.997, epsilon=0.0001, trainable=True, use_sync_bn=False, activation='relu'): """A class to construct layers for a batch normalization followed by a ReLU. Args: momentum: momentum for the moving a...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/nn_ops.py
tensorflow/tpu
train
5,627
363cfab6a7232de52da4615c8fe4e4366b11c20d
[ "if model is not None:\n try:\n return (get_framework_by_class_name(model=model), {})\n except mlrun.errors.MLRunInvalidArgumentError:\n return (get_framework_by_instance(model=model), {})\nif model_path is not None:\n model_file, model_artifact, extra_data = get_model(model_path)\n if mod...
<|body_start_0|> if model is not None: try: return (get_framework_by_class_name(model=model), {}) except mlrun.errors.MLRunInvalidArgumentError: return (get_framework_by_instance(model=model), {}) if model_path is not None: model_file, ...
A library of automatic functions for managing models using MLRun's frameworks package.
AutoMLRun
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoMLRun: """A library of automatic functions for managing models using MLRun's frameworks package.""" def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: """Try to get the framework from the model or model path provided. The frame...
stack_v2_sparse_classes_10k_train_007784
24,099
permissive
[ { "docstring": "Try to get the framework from the model or model path provided. The framework can be read from the model path only if the model path is of a logged model artifact (store object uri). :param model: The model instance to get its framework. :param model_path: The store object uri of a model artifac...
3
null
Implement the Python class `AutoMLRun` described below. Class description: A library of automatic functions for managing models using MLRun's frameworks package. Method signatures and docstrings: - def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: Try to get the f...
Implement the Python class `AutoMLRun` described below. Class description: A library of automatic functions for managing models using MLRun's frameworks package. Method signatures and docstrings: - def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: Try to get the f...
b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77
<|skeleton|> class AutoMLRun: """A library of automatic functions for managing models using MLRun's frameworks package.""" def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: """Try to get the framework from the model or model path provided. The frame...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AutoMLRun: """A library of automatic functions for managing models using MLRun's frameworks package.""" def _get_framework(model: CommonTypes.ModelType=None, model_path: str=None) -> Union[Tuple[str, dict]]: """Try to get the framework from the model or model path provided. The framework can be r...
the_stack_v2_python_sparse
mlrun/frameworks/auto_mlrun/auto_mlrun.py
mlrun/mlrun
train
1,093
3077088e5e3a6ce5ab65a0e1aaa97dc97975f27a
[ "super(TwoLayerNet, self).__init__()\nself.linear1 = torch.nn.Linear(D_in, H)\nself.linear2 = torch.nn.Linear(H, D_out)", "h_relu = self.linear1(x).clamp(min=0)\ny_pred = self.linear2(h_relu)\nreturn y_pred" ]
<|body_start_0|> super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.linear1(x).clamp(min=0) y_pred = self.linear2(h_relu) return y_pred <|end_body_1|>
TwoLayerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。""" <|body_0|> def forward(self, x): """在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_10k_train_007785
16,194
no_license
[ { "docstring": "在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_000671
Implement the Python class `TwoLayerNet` described below. Class description: Implement the TwoLayerNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。 - def forward(self, x): 在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。
Implement the Python class `TwoLayerNet` described below. Class description: Implement the TwoLayerNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。 - def forward(self, x): 在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。 <|...
272e0b674f2d8ebdca9eea0a35909d2c420212ae
<|skeleton|> class TwoLayerNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。""" <|body_0|> def forward(self, x): """在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TwoLayerNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。""" super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) def forward(self, x): """在前向传播的函数中,我们接收一个输入的张量,也必须返回一个...
the_stack_v2_python_sparse
PyTorch/quick_start_2/function_try.py
StarkTan/Python
train
0
c71644522a117565d1d18ffb59609d832583402f
[ "paddle.set_device('cpu')\n[batch_size, d_model, n_head, dim_feedforward, dropout, _, _, source_length, target_length] = generate_basic_params(mode='decoder_layer')\ntgt = np.random.rand(batch_size, target_length, d_model).astype('float32')\nmemory = np.random.rand(batch_size, source_length, d_model).astype('float3...
<|body_start_0|> paddle.set_device('cpu') [batch_size, d_model, n_head, dim_feedforward, dropout, _, _, source_length, target_length] = generate_basic_params(mode='decoder_layer') tgt = np.random.rand(batch_size, target_length, d_model).astype('float32') memory = np.random.rand(batch_siz...
test
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: """test""" def test_decoder(self): """test_decoder""" <|body_0|> def test(self): """test""" <|body_1|> <|end_skeleton|> <|body_start_0|> paddle.set_device('cpu') [batch_size, d_model, n_head, dim_feedforward, dropout, _, _, source_...
stack_v2_sparse_classes_10k_train_007786
3,236
no_license
[ { "docstring": "test_decoder", "name": "test_decoder", "signature": "def test_decoder(self)" }, { "docstring": "test", "name": "test", "signature": "def test(self)" } ]
2
null
Implement the Python class `Test` described below. Class description: test Method signatures and docstrings: - def test_decoder(self): test_decoder - def test(self): test
Implement the Python class `Test` described below. Class description: test Method signatures and docstrings: - def test_decoder(self): test_decoder - def test(self): test <|skeleton|> class Test: """test""" def test_decoder(self): """test_decoder""" <|body_0|> def test(self): ""...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class Test: """test""" def test_decoder(self): """test_decoder""" <|body_0|> def test(self): """test""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test: """test""" def test_decoder(self): """test_decoder""" paddle.set_device('cpu') [batch_size, d_model, n_head, dim_feedforward, dropout, _, _, source_length, target_length] = generate_basic_params(mode='decoder_layer') tgt = np.random.rand(batch_size, target_length, d_...
the_stack_v2_python_sparse
framework/api/nn/test_TransformerDecoder.py
PaddlePaddle/PaddleTest
train
42
7bc1783af65e3191d92d49d03a6a53ff5acd504c
[ "super().__init__()\nself.pre_ln_attn = nn.LayerNorm(n_hidden)\nself.pre_ln_ffn = nn.LayerNorm(n_hidden)\nself.attention = AttentionLayer(n_hidden, n_heads)\nself.ffn = FFNLayer(n_hidden)", "residual = x\nattn = self.attention(self.pre_ln_attn(x))\nffn = self.ffn(self.pre_ln_ffn(x))\nreturn attn + ffn + residual"...
<|body_start_0|> super().__init__() self.pre_ln_attn = nn.LayerNorm(n_hidden) self.pre_ln_ffn = nn.LayerNorm(n_hidden) self.attention = AttentionLayer(n_hidden, n_heads) self.ffn = FFNLayer(n_hidden) <|end_body_0|> <|body_start_1|> residual = x attn = self.attent...
## Transformer Layer
TransformerLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerLayer: """## Transformer Layer""" def __init__(self, n_hidden: int=6144, n_heads: int=64): """:param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.""" <|body_0|> def forward(self, x: torch.T...
stack_v2_sparse_classes_10k_train_007787
13,522
no_license
[ { "docstring": ":param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.", "name": "__init__", "signature": "def __init__(self, n_hidden: int=6144, n_heads: int=64)" }, { "docstring": ":param x: are the embeddings of shape `[batc...
3
null
Implement the Python class `TransformerLayer` described below. Class description: ## Transformer Layer Method signatures and docstrings: - def __init__(self, n_hidden: int=6144, n_heads: int=64): :param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*...
Implement the Python class `TransformerLayer` described below. Class description: ## Transformer Layer Method signatures and docstrings: - def __init__(self, n_hidden: int=6144, n_heads: int=64): :param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class TransformerLayer: """## Transformer Layer""" def __init__(self, n_hidden: int=6144, n_heads: int=64): """:param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.""" <|body_0|> def forward(self, x: torch.T...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformerLayer: """## Transformer Layer""" def __init__(self, n_hidden: int=6144, n_heads: int=64): """:param n_hidden: is the embedding size :param n_heads: is the number of heads *Out implementation doesn't include dropout*.""" super().__init__() self.pre_ln_attn = nn.LayerNor...
the_stack_v2_python_sparse
generated/test_labmlai_neox.py
jansel/pytorch-jit-paritybench
train
35
5e7b52ecb441c4972fd4855ac4edcc1747d8f79f
[ "super(SegNet, self).__init__()\nself.layer_1 = SegnetLayer_Encoder(in_channels, 64, 2)\nself.layer_2 = SegnetLayer_Encoder(64, 128, 2)\nself.layer_3 = SegnetLayer_Encoder(128, 256, 3)\nself.layer_4 = SegnetLayer_Encoder(256, 512, 3)\nself.layer_5 = SegnetLayer_Encoder(512, 512, 3)\nself.layer_6 = SegnetLayer_Decod...
<|body_start_0|> super(SegNet, self).__init__() self.layer_1 = SegnetLayer_Encoder(in_channels, 64, 2) self.layer_2 = SegnetLayer_Encoder(64, 128, 2) self.layer_3 = SegnetLayer_Encoder(128, 256, 3) self.layer_4 = SegnetLayer_Encoder(256, 512, 3) self.layer_5 = SegnetLayer...
Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrinarayanan, Alex Kendall, Roberto Ci...
SegNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegNet: """Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrin...
stack_v2_sparse_classes_10k_train_007788
20,094
no_license
[ { "docstring": "Sequential Instanciation of the different Layers", "name": "__init__", "signature": "def __init__(self, in_channels=3, n_classes=21)" }, { "docstring": "Sequential Computation, see nn.Module.forward methods PyTorch", "name": "forward", "signature": "def forward(self, inpu...
3
stack_v2_sparse_classes_30k_train_001399
Implement the Python class `SegNet` described below. Class description: Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architect...
Implement the Python class `SegNet` described below. Class description: Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architect...
3b63f360e67013d5962082e57fb36ebfb37d8920
<|skeleton|> class SegNet: """Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SegNet: """Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrinarayanan, Ale...
the_stack_v2_python_sparse
segmentation/models/nn.py
Kivo0/vibotorch
train
0
4f8053e55731d705a95bf665509f4fc40e187df0
[ "status = ErrorCode.SUCCESS\ntry:\n tid = self.get_argument('tid')\nexcept Exception as e:\n status = ErrorCode.ILLEGAL_DATA_FORMAT\n self.write_ret(status)\ntry:\n res = QueryHelper.get_mileage_notification_by_tid(tid, self.db)\n self.write_ret(status, dict_=DotDict(res=res))\nexcept Exception as e:...
<|body_start_0|> status = ErrorCode.SUCCESS try: tid = self.get_argument('tid') except Exception as e: status = ErrorCode.ILLEGAL_DATA_FORMAT self.write_ret(status) try: res = QueryHelper.get_mileage_notification_by_tid(tid, self.db) ...
Mileage notification: distance of per day
MileageNotificationHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MileageNotificationHandler: """Mileage notification: distance of per day""" def get(self): """Get mileage notifiction of a terminal. @params: tid, is required""" <|body_0|> def put(self): """Modify some settings about mileage notification.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_007789
3,606
no_license
[ { "docstring": "Get mileage notifiction of a terminal. @params: tid, is required", "name": "get", "signature": "def get(self)" }, { "docstring": "Modify some settings about mileage notification.", "name": "put", "signature": "def put(self)" } ]
2
null
Implement the Python class `MileageNotificationHandler` described below. Class description: Mileage notification: distance of per day Method signatures and docstrings: - def get(self): Get mileage notifiction of a terminal. @params: tid, is required - def put(self): Modify some settings about mileage notification.
Implement the Python class `MileageNotificationHandler` described below. Class description: Mileage notification: distance of per day Method signatures and docstrings: - def get(self): Get mileage notifiction of a terminal. @params: tid, is required - def put(self): Modify some settings about mileage notification. <...
3b095a325581b1fc48497c234f0ad55e928586a1
<|skeleton|> class MileageNotificationHandler: """Mileage notification: distance of per day""" def get(self): """Get mileage notifiction of a terminal. @params: tid, is required""" <|body_0|> def put(self): """Modify some settings about mileage notification.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MileageNotificationHandler: """Mileage notification: distance of per day""" def get(self): """Get mileage notifiction of a terminal. @params: tid, is required""" status = ErrorCode.SUCCESS try: tid = self.get_argument('tid') except Exception as e: s...
the_stack_v2_python_sparse
apps/uweb/handlers/mileagenotification.py
jcsy521/ydws
train
0
36b7d7396db6d1295406598de4598b75d73465db
[ "self.arduino = Serial(config)\nself.arduino.add_listener(self.parse_data)\nObservableComponent.__init__(self, self.arduino)", "if len(reading) == 5:\n try:\n packet = TrollPacket.from_binary_packet(reading)\n self.update_listeners(packet)\n except KeyError as e:\n err_msg = 'Arduino me...
<|body_start_0|> self.arduino = Serial(config) self.arduino.add_listener(self.parse_data) ObservableComponent.__init__(self, self.arduino) <|end_body_0|> <|body_start_1|> if len(reading) == 5: try: packet = TrollPacket.from_binary_packet(reading) ...
Arduino layer for handling data inconsistensies.
Arduino
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arduino: """Arduino layer for handling data inconsistensies.""" def __init__(self, config): """:param config: Dictionary containing connection headers :type config: dict""" <|body_0|> def parse_data(self, reading): """Arduino sends data incosistently sometimes. T...
stack_v2_sparse_classes_10k_train_007790
10,572
permissive
[ { "docstring": ":param config: Dictionary containing connection headers :type config: dict", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Arduino sends data incosistently sometimes. This implementation assumes a format when receiving from arduino: - First byte...
2
stack_v2_sparse_classes_30k_train_000210
Implement the Python class `Arduino` described below. Class description: Arduino layer for handling data inconsistensies. Method signatures and docstrings: - def __init__(self, config): :param config: Dictionary containing connection headers :type config: dict - def parse_data(self, reading): Arduino sends data incos...
Implement the Python class `Arduino` described below. Class description: Arduino layer for handling data inconsistensies. Method signatures and docstrings: - def __init__(self, config): :param config: Dictionary containing connection headers :type config: dict - def parse_data(self, reading): Arduino sends data incos...
d554403dc73e8de43e723c08994b3dae08ac0c1c
<|skeleton|> class Arduino: """Arduino layer for handling data inconsistensies.""" def __init__(self, config): """:param config: Dictionary containing connection headers :type config: dict""" <|body_0|> def parse_data(self, reading): """Arduino sends data incosistently sometimes. T...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Arduino: """Arduino layer for handling data inconsistensies.""" def __init__(self, config): """:param config: Dictionary containing connection headers :type config: dict""" self.arduino = Serial(config) self.arduino.add_listener(self.parse_data) ObservableComponent.__init_...
the_stack_v2_python_sparse
backend/endpoints.py
trolllabs/trollsim
train
0
6a143293e3b168d679bc5c10d4ec7f30d379c03d
[ "super(FuncAwsGuarddutyPoller, self).__init__(opts)\nself.options = opts.get('fn_aws_guardduty', {})\nself.opts = opts\nif int(self.options.get('aws_gd_polling_interval', POLLING_INTERVAL_DEFAULT)) == 0:\n LOG.info('Polling for findings in AWS GuardDuty not enabled')\nelse:\n validate_fields(config.REQUIRED_C...
<|body_start_0|> super(FuncAwsGuarddutyPoller, self).__init__(opts) self.options = opts.get('fn_aws_guardduty', {}) self.opts = opts if int(self.options.get('aws_gd_polling_interval', POLLING_INTERVAL_DEFAULT)) == 0: LOG.info('Polling for findings in AWS GuardDuty not enabled...
Component that polls for new findings from AWS GuardDuty
FuncAwsGuarddutyPoller
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuncAwsGuarddutyPoller: """Component that polls for new findings from AWS GuardDuty""" def __init__(self, opts): """constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration options have changed, save ...
stack_v2_sparse_classes_10k_train_007791
3,403
permissive
[ { "docstring": "constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Configuration options have changed, save new values", "name": "_reload", "signature": "def _reload(self, event, opts)" }, { "d...
3
null
Implement the Python class `FuncAwsGuarddutyPoller` described below. Class description: Component that polls for new findings from AWS GuardDuty Method signatures and docstrings: - def __init__(self, opts): constructor provides access to the configuration options - def _reload(self, event, opts): Configuration option...
Implement the Python class `FuncAwsGuarddutyPoller` described below. Class description: Component that polls for new findings from AWS GuardDuty Method signatures and docstrings: - def __init__(self, opts): constructor provides access to the configuration options - def _reload(self, event, opts): Configuration option...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class FuncAwsGuarddutyPoller: """Component that polls for new findings from AWS GuardDuty""" def __init__(self, opts): """constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration options have changed, save ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FuncAwsGuarddutyPoller: """Component that polls for new findings from AWS GuardDuty""" def __init__(self, opts): """constructor provides access to the configuration options""" super(FuncAwsGuarddutyPoller, self).__init__(opts) self.options = opts.get('fn_aws_guardduty', {}) ...
the_stack_v2_python_sparse
fn_aws_guardduty/fn_aws_guardduty/components/func_aws_guardduty_poller.py
ibmresilient/resilient-community-apps
train
81
1c0620022b2b7864d4bff3526252bc6e5325886d
[ "if not nums or len(nums) <= 0:\n return\nres = 0\nfor i in nums:\n res = res ^ i\nindex = self.findFirstBit(res)\nres1 = 0\nres2 = 0\nfor j in nums:\n if j >> index & 1 == 1:\n res1 = res1 ^ j\n else:\n res2 = res2 ^ j\nreturn [res1, res2]", "indexBit = 0\nwhile num & 1 == 0 and indexBi...
<|body_start_0|> if not nums or len(nums) <= 0: return res = 0 for i in nums: res = res ^ i index = self.findFirstBit(res) res1 = 0 res2 = 0 for j in nums: if j >> index & 1 == 1: res1 = res1 ^ j else...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def findNumsAppearOnce(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findFirstBit(self, num): """找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums or len...
stack_v2_sparse_classes_10k_train_007792
3,672
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findNumsAppearOnce", "signature": "def findNumsAppearOnce(self, nums)" }, { "docstring": "找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:", "name": "findFirstBit", "signature": "def findFirstBit(self, num)" } ]
2
stack_v2_sparse_classes_30k_train_001635
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def findNumsAppearOnce(self, nums): :type nums: List[int] :rtype: List[int] - def findFirstBit(self, num): 找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def findNumsAppearOnce(self, nums): :type nums: List[int] :rtype: List[int] - def findFirstBit(self, num): 找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return: <|skeleton|> class So...
1db60502acb208f22d2149a4824e1219d8938225
<|skeleton|> class Solution1: def findNumsAppearOnce(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findFirstBit(self, num): """找到异或结果从右往左(低位到高位)第一个为1的位置 :param num: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution1: def findNumsAppearOnce(self, nums): """:type nums: List[int] :rtype: List[int]""" if not nums or len(nums) <= 0: return res = 0 for i in nums: res = res ^ i index = self.findFirstBit(res) res1 = 0 res2 = 0 for j...
the_stack_v2_python_sparse
code_with_name/test55_prob56_数组中只出现一次的两个数字.py
Binjer/jianzhi_offer
train
2
0e68a2594dc66fa9cf8c9491b0f8d6dafc876ca6
[ "extra = ctypes.c_ulong(0)\nii_ = Input_I()\nii_.ki = KeyBdInput(keyCode, 72, 0, 0, ctypes.pointer(extra))\nx = Input(ctypes.c_ulong(1), ii_)\nSendInput(1, ctypes.pointer(x), ctypes.sizeof(x))", "extra = ctypes.c_ulong(0)\nii_ = Input_I()\nii_.ki = KeyBdInput(keyCode, 72, 2, 0, ctypes.pointer(extra))\nx = Input(c...
<|body_start_0|> extra = ctypes.c_ulong(0) ii_ = Input_I() ii_.ki = KeyBdInput(keyCode, 72, 0, 0, ctypes.pointer(extra)) x = Input(ctypes.c_ulong(1), ii_) SendInput(1, ctypes.pointer(x), ctypes.sizeof(x)) <|end_body_0|> <|body_start_1|> extra = ctypes.c_ulong(0) ...
Class Keyboard :author: Paradoxis <luke@paradoxis.nl> :description: Keyboard methods to trigger fake key events
Keyboard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Keyboard: """Class Keyboard :author: Paradoxis <luke@paradoxis.nl> :description: Keyboard methods to trigger fake key events""" def keyDown(keyCode): """Key down wrapper :param keyCode: int :return: void""" <|body_0|> def keyUp(keyCode): """Key up wrapper :param ...
stack_v2_sparse_classes_10k_train_007793
5,030
no_license
[ { "docstring": "Key down wrapper :param keyCode: int :return: void", "name": "keyDown", "signature": "def keyDown(keyCode)" }, { "docstring": "Key up wrapper :param keyCode: int :return: void", "name": "keyUp", "signature": "def keyUp(keyCode)" }, { "docstring": "Type a key :para...
3
stack_v2_sparse_classes_30k_train_003934
Implement the Python class `Keyboard` described below. Class description: Class Keyboard :author: Paradoxis <luke@paradoxis.nl> :description: Keyboard methods to trigger fake key events Method signatures and docstrings: - def keyDown(keyCode): Key down wrapper :param keyCode: int :return: void - def keyUp(keyCode): K...
Implement the Python class `Keyboard` described below. Class description: Class Keyboard :author: Paradoxis <luke@paradoxis.nl> :description: Keyboard methods to trigger fake key events Method signatures and docstrings: - def keyDown(keyCode): Key down wrapper :param keyCode: int :return: void - def keyUp(keyCode): K...
5c03f77893ae98a49805fb15fbf48fed688dc714
<|skeleton|> class Keyboard: """Class Keyboard :author: Paradoxis <luke@paradoxis.nl> :description: Keyboard methods to trigger fake key events""" def keyDown(keyCode): """Key down wrapper :param keyCode: int :return: void""" <|body_0|> def keyUp(keyCode): """Key up wrapper :param ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Keyboard: """Class Keyboard :author: Paradoxis <luke@paradoxis.nl> :description: Keyboard methods to trigger fake key events""" def keyDown(keyCode): """Key down wrapper :param keyCode: int :return: void""" extra = ctypes.c_ulong(0) ii_ = Input_I() ii_.ki = KeyBdInput(keyC...
the_stack_v2_python_sparse
software/non_ai/systemcontrols/keyboard.py
SGNetworksIndia/J.A.R.V.I.S
train
7
e7b498e474050ea71bdd96a303b23022c8f1da2a
[ "self.stack_size = stack_size\nself.arr = [None] * stack_size * 3\nself.bottoms = [i * stack_size for i in range(3)]\nself.tops = [i * stack_size for i in range(3)]", "i = stackno - 1\nif self.tops[i] - self.bottoms[i] == self.stack_size:\n raise Exception('push called on full stack {stackno}')\nself.arr[self....
<|body_start_0|> self.stack_size = stack_size self.arr = [None] * stack_size * 3 self.bottoms = [i * stack_size for i in range(3)] self.tops = [i * stack_size for i in range(3)] <|end_body_0|> <|body_start_1|> i = stackno - 1 if self.tops[i] - self.bottoms[i] == self.sta...
Class implementing three stacks with one array
ThreeStacks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreeStacks: """Class implementing three stacks with one array""" def __init__(self, stack_size: int=10): """Init three stacks, each with initial allocated size `stack_size`""" <|body_0|> def push(self, stackno: int, val) -> None: """Push `val` onto stack number ...
stack_v2_sparse_classes_10k_train_007794
2,829
no_license
[ { "docstring": "Init three stacks, each with initial allocated size `stack_size`", "name": "__init__", "signature": "def __init__(self, stack_size: int=10)" }, { "docstring": "Push `val` onto stack number `stackno` (1, 2, or 3)", "name": "push", "signature": "def push(self, stackno: int,...
3
stack_v2_sparse_classes_30k_train_004916
Implement the Python class `ThreeStacks` described below. Class description: Class implementing three stacks with one array Method signatures and docstrings: - def __init__(self, stack_size: int=10): Init three stacks, each with initial allocated size `stack_size` - def push(self, stackno: int, val) -> None: Push `va...
Implement the Python class `ThreeStacks` described below. Class description: Class implementing three stacks with one array Method signatures and docstrings: - def __init__(self, stack_size: int=10): Init three stacks, each with initial allocated size `stack_size` - def push(self, stackno: int, val) -> None: Push `va...
12200cf58378bb858d1113a12c3f54054df91937
<|skeleton|> class ThreeStacks: """Class implementing three stacks with one array""" def __init__(self, stack_size: int=10): """Init three stacks, each with initial allocated size `stack_size`""" <|body_0|> def push(self, stackno: int, val) -> None: """Push `val` onto stack number ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThreeStacks: """Class implementing three stacks with one array""" def __init__(self, stack_size: int=10): """Init three stacks, each with initial allocated size `stack_size`""" self.stack_size = stack_size self.arr = [None] * stack_size * 3 self.bottoms = [i * stack_size f...
the_stack_v2_python_sparse
chapter3/1_three_in_one.py
adityabads/cracking-coding-interview
train
0
c32e53468161fbe3f4bbb7580d9b790278b22aeb
[ "super().__init__(name)\nself.reg_seqr = None\nself.adapter = None\nself.model = None\nself.parent_select = LOCAL\nself.upstream_parent = None", "if self.m_sequencer is None:\n uvm_fatal('NO_SEQR', 'Sequence executing as translation sequence, ' + 'but is not associated with a sequencer (m_sequencer == null)')\...
<|body_start_0|> super().__init__(name) self.reg_seqr = None self.adapter = None self.model = None self.parent_select = LOCAL self.upstream_parent = None <|end_body_0|> <|body_start_1|> if self.m_sequencer is None: uvm_fatal('NO_SEQR', 'Sequence execu...
UVMRegSequence
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UVMRegSequence: def __init__(self, name='uvm_reg_sequence_inst'): """Function: new Create a new instance, giving it the optional `name`. Args: name:""" <|body_0|> async def body(self): """Task: body Continually gets a register transaction from the configured upstream...
stack_v2_sparse_classes_10k_train_007795
21,775
permissive
[ { "docstring": "Function: new Create a new instance, giving it the optional `name`. Args: name:", "name": "__init__", "signature": "def __init__(self, name='uvm_reg_sequence_inst')" }, { "docstring": "Task: body Continually gets a register transaction from the configured upstream sequencer, `reg...
3
null
Implement the Python class `UVMRegSequence` described below. Class description: Implement the UVMRegSequence class. Method signatures and docstrings: - def __init__(self, name='uvm_reg_sequence_inst'): Function: new Create a new instance, giving it the optional `name`. Args: name: - async def body(self): Task: body C...
Implement the Python class `UVMRegSequence` described below. Class description: Implement the UVMRegSequence class. Method signatures and docstrings: - def __init__(self, name='uvm_reg_sequence_inst'): Function: new Create a new instance, giving it the optional `name`. Args: name: - async def body(self): Task: body C...
fc5f955701b2b56c1fddac195c70cb3ebb9139fe
<|skeleton|> class UVMRegSequence: def __init__(self, name='uvm_reg_sequence_inst'): """Function: new Create a new instance, giving it the optional `name`. Args: name:""" <|body_0|> async def body(self): """Task: body Continually gets a register transaction from the configured upstream...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UVMRegSequence: def __init__(self, name='uvm_reg_sequence_inst'): """Function: new Create a new instance, giving it the optional `name`. Args: name:""" super().__init__(name) self.reg_seqr = None self.adapter = None self.model = None self.parent_select = LOCAL ...
the_stack_v2_python_sparse
src/uvm/reg/uvm_reg_sequence.py
tpoikela/uvm-python
train
199
395894b682ece2b60e052c6f592624dfa651517f
[ "super().__init__(pool_size=pool_size)\nself.min_neg = min_neg\nself.batch_size_per_image = batch_size_per_image\nself.positive_fraction = positive_fraction", "anchors_per_image = [anchors_in_image.shape[0] for anchors_in_image in target_labels]\nfg_probs = fg_probs.split(anchors_per_image, 0)\npos_idx = []\nneg_...
<|body_start_0|> super().__init__(pool_size=pool_size) self.min_neg = min_neg self.batch_size_per_image = batch_size_per_image self.positive_fraction = positive_fraction <|end_body_0|> <|body_start_1|> anchors_per_image = [anchors_in_image.shape[0] for anchors_in_image in target...
HardNegativeSampler
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HardNegativeSampler: def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): """Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of element...
stack_v2_sparse_classes_10k_train_007796
13,985
permissive
[ { "docstring": "Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of elements to be selected per image positive_fraction (float): percentage of positive elements per batch pool_size (float): hard negatives are sampled ...
5
stack_v2_sparse_classes_30k_train_005423
Implement the Python class `HardNegativeSampler` described below. Class description: Implement the HardNegativeSampler class. Method signatures and docstrings: - def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): Created a pool from the highest scoring false ...
Implement the Python class `HardNegativeSampler` described below. Class description: Implement the HardNegativeSampler class. Method signatures and docstrings: - def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): Created a pool from the highest scoring false ...
4f41faa7536dcef8fca7b647dcdca25360e5b58a
<|skeleton|> class HardNegativeSampler: def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): """Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of element...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HardNegativeSampler: def __init__(self, batch_size_per_image: int, positive_fraction: float, min_neg: int=0, pool_size: float=10): """Created a pool from the highest scoring false positives and sample defined number of negatives from it Args: batch_size_per_image (int): number of elements to be select...
the_stack_v2_python_sparse
nndet/core/boxes/sampler.py
dboun/nnDetection
train
1
f8357c6e6d0b5a278efeee7f08179a117e68be88
[ "self.big = big\nself.medium = medium\nself.small = small", "if carType == 1:\n self.big = self.big - 1\n if self.big >= 0:\n return True\n else:\n return False\nelif carType == 2:\n self.medium = self.medium - 1\n if self.medium >= 0:\n return True\n else:\n return F...
<|body_start_0|> self.big = big self.medium = medium self.small = small <|end_body_0|> <|body_start_1|> if carType == 1: self.big = self.big - 1 if self.big >= 0: return True else: return False elif carType == 2...
ParkingSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkingSystem: def __init__(self, big, medium, small): """:type big: int :type medium: int :type small: int""" <|body_0|> def addCar(self, carType): """:type carType: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.big = big ...
stack_v2_sparse_classes_10k_train_007797
1,839
no_license
[ { "docstring": ":type big: int :type medium: int :type small: int", "name": "__init__", "signature": "def __init__(self, big, medium, small)" }, { "docstring": ":type carType: int :rtype: bool", "name": "addCar", "signature": "def addCar(self, carType)" } ]
2
stack_v2_sparse_classes_30k_train_006749
Implement the Python class `ParkingSystem` described below. Class description: Implement the ParkingSystem class. Method signatures and docstrings: - def __init__(self, big, medium, small): :type big: int :type medium: int :type small: int - def addCar(self, carType): :type carType: int :rtype: bool
Implement the Python class `ParkingSystem` described below. Class description: Implement the ParkingSystem class. Method signatures and docstrings: - def __init__(self, big, medium, small): :type big: int :type medium: int :type small: int - def addCar(self, carType): :type carType: int :rtype: bool <|skeleton|> cla...
6d6afba93d20665d033fe542c97e3eb50368bd3c
<|skeleton|> class ParkingSystem: def __init__(self, big, medium, small): """:type big: int :type medium: int :type small: int""" <|body_0|> def addCar(self, carType): """:type carType: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParkingSystem: def __init__(self, big, medium, small): """:type big: int :type medium: int :type small: int""" self.big = big self.medium = medium self.small = small def addCar(self, carType): """:type carType: int :rtype: bool""" if carType == 1: ...
the_stack_v2_python_sparse
design_parking_system.py
naomi397liu/AlgorithmPactice
train
1
856601f7348d491c89af97d715f7e406504b0d1f
[ "tmp_file_name = 'test.json'\ntmp_dir_name = tempfile.gettempdir()\njson_file_path = tmp_dir_name + '/' + tmp_file_name\nwith open(json_file_path, 'w') as f:\n f.write(policy_json.strip())\ngrd_text = '\\n <grit base_dir=\".\" latest_public_release=\"0\" current_release=\"1\" source_lang_id=\"en\">\\n <r...
<|body_start_0|> tmp_file_name = 'test.json' tmp_dir_name = tempfile.gettempdir() json_file_path = tmp_dir_name + '/' + tmp_file_name with open(json_file_path, 'w') as f: f.write(policy_json.strip()) grd_text = '\n <grit base_dir="." latest_public_release="0" curre...
Common class for unittesting writers.
WriterUnittestCommon
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" <|body_0|> def GetOutput(self...
stack_v2_sparse_classes_10k_train_007798
2,618
permissive
[ { "docstring": "Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.", "name": "PrepareTest", "signature": "def PrepareTest(self, policy_json)" }, { "docstring": "Generates an output of a writer. Args: grd: The root...
2
null
Implement the Python class `WriterUnittestCommon` described below. Class description: Common class for unittesting writers. Method signatures and docstrings: - def PrepareTest(self, policy_json): Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in J...
Implement the Python class `WriterUnittestCommon` described below. Class description: Common class for unittesting writers. Method signatures and docstrings: - def PrepareTest(self, policy_json): Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in J...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" <|body_0|> def GetOutput(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" tmp_file_name = 'test.json' tmp_dir_nam...
the_stack_v2_python_sparse
tools/grit/grit/format/policy_templates/writers/writer_unittest_common.py
metux/chromium-suckless
train
5
99d4ca8e0e3a1e13e230611864ef6a98dac4c1a6
[ "inSpec = super(SampleSelector, cls).getInputSpecification()\ninSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringType))\ncriterion = InputData.parameterInputFactory('criterion', contentType=InputTypes.StringType, strictMode=True)\ncriterion.addParam('value', InputTypes.IntegerType)...
<|body_start_0|> inSpec = super(SampleSelector, cls).getInputSpecification() inSpec.addSub(InputData.parameterInputFactory('target', contentType=InputTypes.StringType)) criterion = InputData.parameterInputFactory('criterion', contentType=InputTypes.StringType, strictMode=True) criterion....
This postprocessor selects the row in which the minimum or the maximum of a target is found.The postprocessor can act on DataObject, and generates a DataObject in return.
SampleSelector
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampleSelector: """This postprocessor selects the row in which the minimum or the maximum of a target is found.The postprocessor can act on DataObject, and generates a DataObject in return.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the ...
stack_v2_sparse_classes_10k_train_007799
5,362
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for which we are retrieving the specification @ Out, inputSpecification, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signatur...
6
null
Implement the Python class `SampleSelector` described below. Class description: This postprocessor selects the row in which the minimum or the maximum of a target is found.The postprocessor can act on DataObject, and generates a DataObject in return. Method signatures and docstrings: - def getInputSpecification(cls):...
Implement the Python class `SampleSelector` described below. Class description: This postprocessor selects the row in which the minimum or the maximum of a target is found.The postprocessor can act on DataObject, and generates a DataObject in return. Method signatures and docstrings: - def getInputSpecification(cls):...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class SampleSelector: """This postprocessor selects the row in which the minimum or the maximum of a target is found.The postprocessor can act on DataObject, and generates a DataObject in return.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SampleSelector: """This postprocessor selects the row in which the minimum or the maximum of a target is found.The postprocessor can act on DataObject, and generates a DataObject in return.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data fo...
the_stack_v2_python_sparse
ravenframework/Models/PostProcessors/SampleSelector.py
idaholab/raven
train
201