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
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
fd58e74197fc7fd8b102b5f889eb7cb45de62683
[ "self.lambtha = float(lambtha)\nif lambtha < 1:\n raise ValueError('lambtha must be a positive value')\nif data is not None and (not isinstance(data, list)):\n raise TypeError('data must be a list')\nif isinstance(data, list) and len(data) < 2:\n raise ValueError('data must contain multiple values')\nif da...
<|body_start_0|> self.lambtha = float(lambtha) if lambtha < 1: raise ValueError('lambtha must be a positive value') if data is not None and (not isinstance(data, list)): raise TypeError('data must be a list') if isinstance(data, list) and len(data) < 2: ...
class Exponential
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: """class Exponential""" def __init__(self, data=None, lambtha=1.0): """Initialize Exponential data is a list of the data to be used to estimate the distribution lambtha is the expected number of occurences in a given time frame""" <|body_0|> def pdf(self, x)...
stack_v2_sparse_classes_75kplus_train_001800
1,599
no_license
[ { "docstring": "Initialize Exponential data is a list of the data to be used to estimate the distribution lambtha is the expected number of occurences in a given time frame", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "Calculates the value of ...
3
stack_v2_sparse_classes_30k_train_030067
Implement the Python class `Exponential` described below. Class description: class Exponential Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Initialize Exponential data is a list of the data to be used to estimate the distribution lambtha is the expected number of occurences in a giv...
Implement the Python class `Exponential` described below. Class description: class Exponential Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Initialize Exponential data is a list of the data to be used to estimate the distribution lambtha is the expected number of occurences in a giv...
4a7a8ff0c4f785656a395d0abf4f182ce1fef5bc
<|skeleton|> class Exponential: """class Exponential""" def __init__(self, data=None, lambtha=1.0): """Initialize Exponential data is a list of the data to be used to estimate the distribution lambtha is the expected number of occurences in a given time frame""" <|body_0|> def pdf(self, x)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Exponential: """class Exponential""" def __init__(self, data=None, lambtha=1.0): """Initialize Exponential data is a list of the data to be used to estimate the distribution lambtha is the expected number of occurences in a given time frame""" self.lambtha = float(lambtha) if lamb...
the_stack_v2_python_sparse
math/0x03-probability/exponential.py
xica369/holbertonschool-machine_learning
train
0
0aa5d902ca3dbcb037d24117091f75af600fd47f
[ "thumbnails = []\nif host.image.name and THUMBNAIL_SIZES:\n for size in THUMBNAIL_SIZES:\n thumbnails.append(host.image.crop[size].name)\nreturn thumbnails", "instance.name = validated_data.get('name', instance.name)\ninstance.is_active = validated_data.get('is_active', instance.is_active)\ninstance.ema...
<|body_start_0|> thumbnails = [] if host.image.name and THUMBNAIL_SIZES: for size in THUMBNAIL_SIZES: thumbnails.append(host.image.crop[size].name) return thumbnails <|end_body_0|> <|body_start_1|> instance.name = validated_data.get('name', instance.name) ...
HostSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostSerializer: def get_thumbnails(self, host): """Returns thumbnails""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing Host instance, given the validated data.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001801
16,874
permissive
[ { "docstring": "Returns thumbnails", "name": "get_thumbnails", "signature": "def get_thumbnails(self, host)" }, { "docstring": "Update and return an existing Host instance, given the validated data.", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_003827
Implement the Python class `HostSerializer` described below. Class description: Implement the HostSerializer class. Method signatures and docstrings: - def get_thumbnails(self, host): Returns thumbnails - def update(self, instance, validated_data): Update and return an existing Host instance, given the validated data...
Implement the Python class `HostSerializer` described below. Class description: Implement the HostSerializer class. Method signatures and docstrings: - def get_thumbnails(self, host): Returns thumbnails - def update(self, instance, validated_data): Update and return an existing Host instance, given the validated data...
8aae293e58b2e79a05956c535bb109f74edc89c3
<|skeleton|> class HostSerializer: def get_thumbnails(self, host): """Returns thumbnails""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing Host instance, given the validated data.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HostSerializer: def get_thumbnails(self, host): """Returns thumbnails""" thumbnails = [] if host.image.name and THUMBNAIL_SIZES: for size in THUMBNAIL_SIZES: thumbnails.append(host.image.crop[size].name) return thumbnails def update(self, instan...
the_stack_v2_python_sparse
program/serializers.py
Dumbaz/autoradio-pv
train
0
d7b1d47e2b5ccd60b1b402c0bdcefd3d5153f836
[ "from __builtin__ import xrange\ngraph = {i: [] for i in xrange(n)}\nfor e in edges:\n graph[e[0]] += (e[1],)\n graph[e[1]] += (e[0],)\n\ndef dfs(key):\n child = graph.pop(key, [])\n for c in child:\n dfs(c)\ncnt = 0\nwhile graph:\n key = graph.keys()[0]\n dfs(key)\n cnt += 1\nreturn cnt...
<|body_start_0|> from __builtin__ import xrange graph = {i: [] for i in xrange(n)} for e in edges: graph[e[0]] += (e[1],) graph[e[1]] += (e[0],) def dfs(key): child = graph.pop(key, []) for c in child: dfs(c) cnt = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countComponents(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_0|> def rewrite(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_1|> def rewrite2(self, n, edges): ...
stack_v2_sparse_classes_75kplus_train_001802
3,101
no_license
[ { "docstring": ":type n: int :type edges: List[List[int]] :rtype: int", "name": "countComponents", "signature": "def countComponents(self, n, edges)" }, { "docstring": ":type n: int :type edges: List[List[int]] :rtype: int", "name": "rewrite", "signature": "def rewrite(self, n, edges)" ...
3
stack_v2_sparse_classes_30k_train_040271
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countComponents(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - def rewrite(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countComponents(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - def rewrite(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - ...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def countComponents(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_0|> def rewrite(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_1|> def rewrite2(self, n, edges): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countComponents(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" from __builtin__ import xrange graph = {i: [] for i in xrange(n)} for e in edges: graph[e[0]] += (e[1],) graph[e[1]] += (e[0],) def dfs(ke...
the_stack_v2_python_sparse
graph/323_Number_of_Connected_Components_in_an_Undirected_Graph.py
vsdrun/lc_public
train
6
f3ca066ce44d43d6b22e40854792e04d4573f1e6
[ "self.logger = ml.get(name='PhotoManager', level=level)\nself.logger.debug(f'PhotoManager object instantiated')\nself.cameras = []\nfor i in range(10):\n camera = cv2.VideoCapture(i, cv2.CAP_DSHOW)\n result, img = camera.read()\n if result == True:\n self.cameras.append(camera)\n else:\n c...
<|body_start_0|> self.logger = ml.get(name='PhotoManager', level=level) self.logger.debug(f'PhotoManager object instantiated') self.cameras = [] for i in range(10): camera = cv2.VideoCapture(i, cv2.CAP_DSHOW) result, img = camera.read() if result == Tr...
A class which handles taking photos from a webcam.
PhotoManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhotoManager: """A class which handles taking photos from a webcam.""" def __init__(self, level: str='NOTSET', size: tuple=(256, 256)): """Constructs a PhotoManager object. level: Minimum level of logging messages to report; "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NONE"."""...
stack_v2_sparse_classes_75kplus_train_001803
1,750
no_license
[ { "docstring": "Constructs a PhotoManager object. level: Minimum level of logging messages to report; \"DEBUG\", \"INFO\", \"WARNING\", \"ERROR\", \"CRITICAL\", \"NONE\".", "name": "__init__", "signature": "def __init__(self, level: str='NOTSET', size: tuple=(256, 256))" }, { "docstring": "Delet...
3
null
Implement the Python class `PhotoManager` described below. Class description: A class which handles taking photos from a webcam. Method signatures and docstrings: - def __init__(self, level: str='NOTSET', size: tuple=(256, 256)): Constructs a PhotoManager object. level: Minimum level of logging messages to report; "D...
Implement the Python class `PhotoManager` described below. Class description: A class which handles taking photos from a webcam. Method signatures and docstrings: - def __init__(self, level: str='NOTSET', size: tuple=(256, 256)): Constructs a PhotoManager object. level: Minimum level of logging messages to report; "D...
5d308b149b6f488e02928f65be6db7fcd9abd725
<|skeleton|> class PhotoManager: """A class which handles taking photos from a webcam.""" def __init__(self, level: str='NOTSET', size: tuple=(256, 256)): """Constructs a PhotoManager object. level: Minimum level of logging messages to report; "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NONE"."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PhotoManager: """A class which handles taking photos from a webcam.""" def __init__(self, level: str='NOTSET', size: tuple=(256, 256)): """Constructs a PhotoManager object. level: Minimum level of logging messages to report; "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL", "NONE".""" self...
the_stack_v2_python_sparse
mods/photo.py
jake-the-creative/dehc-1
train
0
f578d1c2c1c30c31737ea5c5c8014b163bef5739
[ "self.datatype = datatype\nself.datarange = datarange\nself.num = num\nself.strlen = strlen", "@wraps(func)\ndef wrapper(*args, **kwargs):\n dataset = self.gener(self.datatype, self.datarange, self.num, self.strlen)\n return func(dataset, *args, **kwargs)\nreturn wrapper", "if num <= 0:\n raise Excepti...
<|body_start_0|> self.datatype = datatype self.datarange = datarange self.num = num self.strlen = strlen <|end_body_0|> <|body_start_1|> @wraps(func) def wrapper(*args, **kwargs): dataset = self.gener(self.datatype, self.datarange, self.num, self.strlen) ...
Attentions: This is a decorated class, you may use it by '@'
Random_gener
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Random_gener: """Attentions: This is a decorated class, you may use it by '@'""" def __init__(self, datatype, datarange, num, strlen): """Introduction ------------ constructor Parameters ---------- datatype: the type of the random data you need, it now only supports int,float or str ...
stack_v2_sparse_classes_75kplus_train_001804
5,425
no_license
[ { "docstring": "Introduction ------------ constructor Parameters ---------- datatype: the type of the random data you need, it now only supports int,float or str datarange: if your datatype is int or float, this will be a list of two elements, like[a,b] which means the random numbers generate are bigger than a,...
4
stack_v2_sparse_classes_30k_train_018137
Implement the Python class `Random_gener` described below. Class description: Attentions: This is a decorated class, you may use it by '@' Method signatures and docstrings: - def __init__(self, datatype, datarange, num, strlen): Introduction ------------ constructor Parameters ---------- datatype: the type of the ran...
Implement the Python class `Random_gener` described below. Class description: Attentions: This is a decorated class, you may use it by '@' Method signatures and docstrings: - def __init__(self, datatype, datarange, num, strlen): Introduction ------------ constructor Parameters ---------- datatype: the type of the ran...
661dba7ea846859056fd6ee7a310d352ca178e98
<|skeleton|> class Random_gener: """Attentions: This is a decorated class, you may use it by '@'""" def __init__(self, datatype, datarange, num, strlen): """Introduction ------------ constructor Parameters ---------- datatype: the type of the random data you need, it now only supports int,float or str ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Random_gener: """Attentions: This is a decorated class, you may use it by '@'""" def __init__(self, datatype, datarange, num, strlen): """Introduction ------------ constructor Parameters ---------- datatype: the type of the random data you need, it now only supports int,float or str datarange: if...
the_stack_v2_python_sparse
包亦航2018011890/The_final_edition_of_all_the_homework/Random_filter_dec(second_homework)/Random_gener_dec.py
wanghan79/2020_Python
train
4
debd9efecef6c3c22aab28da5f22ac2a8fff399a
[ "super().__init__(center=center, velocity=velocity, angle=angle, radius=radius)\nself.life = BULLET_LIFE\nself.fire()", "if image == 'unset':\n image = 'images/laserBlue01.png'\nsuper().draw(image)", "super().advance(screen_width, screen_height)\nself.life -= 1\nif self.life < 1:\n self.kill()", "angle ...
<|body_start_0|> super().__init__(center=center, velocity=velocity, angle=angle, radius=radius) self.life = BULLET_LIFE self.fire() <|end_body_0|> <|body_start_1|> if image == 'unset': image = 'images/laserBlue01.png' super().draw(image) <|end_body_1|> <|body_start_...
Class for a bullet in a shooting game
Bullet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bullet: """Class for a bullet in a shooting game""" def __init__(self, center, velocity, angle=0, radius=BULLET_RADIUS): """Initialize a Bullet object :param center: Point object :param velocity: Velocity object :param angle: int angle in degrees""" <|body_0|> def draw(s...
stack_v2_sparse_classes_75kplus_train_001805
1,641
no_license
[ { "docstring": "Initialize a Bullet object :param center: Point object :param velocity: Velocity object :param angle: int angle in degrees", "name": "__init__", "signature": "def __init__(self, center, velocity, angle=0, radius=BULLET_RADIUS)" }, { "docstring": "Draw a bullet from an image file ...
4
stack_v2_sparse_classes_30k_train_030420
Implement the Python class `Bullet` described below. Class description: Class for a bullet in a shooting game Method signatures and docstrings: - def __init__(self, center, velocity, angle=0, radius=BULLET_RADIUS): Initialize a Bullet object :param center: Point object :param velocity: Velocity object :param angle: i...
Implement the Python class `Bullet` described below. Class description: Class for a bullet in a shooting game Method signatures and docstrings: - def __init__(self, center, velocity, angle=0, radius=BULLET_RADIUS): Initialize a Bullet object :param center: Point object :param velocity: Velocity object :param angle: i...
39a23d3a828230d501264ed6b614e74b7b00127c
<|skeleton|> class Bullet: """Class for a bullet in a shooting game""" def __init__(self, center, velocity, angle=0, radius=BULLET_RADIUS): """Initialize a Bullet object :param center: Point object :param velocity: Velocity object :param angle: int angle in degrees""" <|body_0|> def draw(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bullet: """Class for a bullet in a shooting game""" def __init__(self, center, velocity, angle=0, radius=BULLET_RADIUS): """Initialize a Bullet object :param center: Point object :param velocity: Velocity object :param angle: int angle in degrees""" super().__init__(center=center, velocit...
the_stack_v2_python_sparse
asteroids/bullet.py
cjense77/python_oop
train
0
e14c53ddde42953ccf163f31c76c8594edf7f20e
[ "hypers = self._list_hypervisors()\nself.assertNotEmpty(hypers, 'No hypervisors found.')\nhostname = hypers[0]['hypervisor_hostname']\nhypervisors = self.client.list_servers_on_hypervisor(hostname)['hypervisors']\nself.assertNotEmpty(hypervisors)", "hypers = self._list_hypervisors()\nself.assertNotEmpty(hypers, '...
<|body_start_0|> hypers = self._list_hypervisors() self.assertNotEmpty(hypers, 'No hypervisors found.') hostname = hypers[0]['hypervisor_hostname'] hypervisors = self.client.list_servers_on_hypervisor(hostname)['hypervisors'] self.assertNotEmpty(hypervisors) <|end_body_0|> <|bod...
Tests Hypervisors API below 2.53 that require admin privileges
HypervisorAdminUnderV252Test
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HypervisorAdminUnderV252Test: """Tests Hypervisors API below 2.53 that require admin privileges""" def test_get_hypervisor_show_servers(self): """Test showing instances about the specific hypervisors""" <|body_0|> def test_search_hypervisor(self): """Test searchi...
stack_v2_sparse_classes_75kplus_train_001806
6,975
permissive
[ { "docstring": "Test showing instances about the specific hypervisors", "name": "test_get_hypervisor_show_servers", "signature": "def test_get_hypervisor_show_servers(self)" }, { "docstring": "Test searching for hypervisors by its name", "name": "test_search_hypervisor", "signature": "de...
2
stack_v2_sparse_classes_30k_train_014645
Implement the Python class `HypervisorAdminUnderV252Test` described below. Class description: Tests Hypervisors API below 2.53 that require admin privileges Method signatures and docstrings: - def test_get_hypervisor_show_servers(self): Test showing instances about the specific hypervisors - def test_search_hyperviso...
Implement the Python class `HypervisorAdminUnderV252Test` described below. Class description: Tests Hypervisors API below 2.53 that require admin privileges Method signatures and docstrings: - def test_get_hypervisor_show_servers(self): Test showing instances about the specific hypervisors - def test_search_hyperviso...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class HypervisorAdminUnderV252Test: """Tests Hypervisors API below 2.53 that require admin privileges""" def test_get_hypervisor_show_servers(self): """Test showing instances about the specific hypervisors""" <|body_0|> def test_search_hypervisor(self): """Test searchi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HypervisorAdminUnderV252Test: """Tests Hypervisors API below 2.53 that require admin privileges""" def test_get_hypervisor_show_servers(self): """Test showing instances about the specific hypervisors""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers, 'No hypervisors ...
the_stack_v2_python_sparse
tempest/api/compute/admin/test_hypervisor.py
openstack/tempest
train
270
44aa5ecc53b7637fb6b3caec17d746cc98e78562
[ "left, right = (1, n)\nwhile left <= right:\n mid = (left + right) // 2\n if not isBadVersion(mid - 1) and isBadVersion(mid):\n return mid\n if isBadVersion(mid):\n right = mid - 1\n else:\n left = mid + 1", "l = 1\nr = n\nwhile l < r:\n mid = (l + r) / 2\n if isBadVersion(m...
<|body_start_0|> left, right = (1, n) while left <= right: mid = (left + right) // 2 if not isBadVersion(mid - 1) and isBadVersion(mid): return mid if isBadVersion(mid): right = mid - 1 else: left = mid + 1 <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstBadVersion(self, n): """:type n: int :rtype: int""" <|body_0|> def firstBadVersion2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left, right = (1, n) while left <= right: ...
stack_v2_sparse_classes_75kplus_train_001807
962
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "firstBadVersion", "signature": "def firstBadVersion(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "firstBadVersion2", "signature": "def firstBadVersion2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_030187
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstBadVersion(self, n): :type n: int :rtype: int - def firstBadVersion2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstBadVersion(self, n): :type n: int :rtype: int - def firstBadVersion2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def firstBadVersion(self, n): ...
85128e7d26157b3c36eb43868269de42ea2fcb98
<|skeleton|> class Solution: def firstBadVersion(self, n): """:type n: int :rtype: int""" <|body_0|> def firstBadVersion2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def firstBadVersion(self, n): """:type n: int :rtype: int""" left, right = (1, n) while left <= right: mid = (left + right) // 2 if not isBadVersion(mid - 1) and isBadVersion(mid): return mid if isBadVersion(mid): ...
the_stack_v2_python_sparse
src/First Bad Version.py
jsdiuf/leetcode
train
1
82289d0aee8525016f9c38b869bc78cae4ada5c9
[ "try:\n user = UserProfile.objects.select_related('user').get(user__username=username)\nexcept UserProfile.DoesNotExist:\n raise NotFound(errors['profile_missing'])\ncontext = {'request': request.user.username, 'username': username}\nserializer = self.serializer_class(user, context=context)\nreturn Response(s...
<|body_start_0|> try: user = UserProfile.objects.select_related('user').get(user__username=username) except UserProfile.DoesNotExist: raise NotFound(errors['profile_missing']) context = {'request': request.user.username, 'username': username} serializer = self.ser...
get: Get user profile. put: Update user profile.
ProfileRetreiveUpdateAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileRetreiveUpdateAPIView: """get: Get user profile. put: Update user profile.""" def retrieve(self, request, username): """get: Get user profile.""" <|body_0|> def update(self, request, username): """put: Update user profile. :param username: username associa...
stack_v2_sparse_classes_75kplus_train_001808
2,727
permissive
[ { "docstring": "get: Get user profile.", "name": "retrieve", "signature": "def retrieve(self, request, username)" }, { "docstring": "put: Update user profile. :param username: username associated with user account :return: updated user profile details if successful", "name": "update", "s...
2
stack_v2_sparse_classes_30k_train_050549
Implement the Python class `ProfileRetreiveUpdateAPIView` described below. Class description: get: Get user profile. put: Update user profile. Method signatures and docstrings: - def retrieve(self, request, username): get: Get user profile. - def update(self, request, username): put: Update user profile. :param usern...
Implement the Python class `ProfileRetreiveUpdateAPIView` described below. Class description: get: Get user profile. put: Update user profile. Method signatures and docstrings: - def retrieve(self, request, username): get: Get user profile. - def update(self, request, username): put: Update user profile. :param usern...
ba429dfcec577bd6d52052673c1c413835f65988
<|skeleton|> class ProfileRetreiveUpdateAPIView: """get: Get user profile. put: Update user profile.""" def retrieve(self, request, username): """get: Get user profile.""" <|body_0|> def update(self, request, username): """put: Update user profile. :param username: username associa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProfileRetreiveUpdateAPIView: """get: Get user profile. put: Update user profile.""" def retrieve(self, request, username): """get: Get user profile.""" try: user = UserProfile.objects.select_related('user').get(user__username=username) except UserProfile.DoesNotExist:...
the_stack_v2_python_sparse
authors/apps/profiles/views.py
andela/ah-the-jedi-backend
train
1
f86ef3406672e36e291697c07a353df8f9e442db
[ "activity_level = ActivityLevel(date=Date, loalt2=LOALT2, loalt5=LOALT5, loalt10=LOALT10, loalt100=LOALT100, loalt1000=LOALT1000, loalt5000=LOALT5000, loagt5000=LOAGT5000)\ndb_session.add(activity_level)\ntry:\n db_session.commit()\n response = {'ResponseCode': ResponseCodes.Success.value, 'ResponseDesc': Res...
<|body_start_0|> activity_level = ActivityLevel(date=Date, loalt2=LOALT2, loalt5=LOALT5, loalt10=LOALT10, loalt100=LOALT100, loalt1000=LOALT1000, loalt5000=LOALT5000, loagt5000=LOAGT5000) db_session.add(activity_level) try: db_session.commit() response = {'ResponseCode': ...
Class implementing activity level by date
ActivityLevelByDateEndpoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityLevelByDateEndpoint: """Class implementing activity level by date""" def post(self, Date, LOALT2=None, LOALT5=None, LOALT10=None, LOALT100=None, LOALT1000=None, LOALT5000=None, LOAGT5000=None): """Method for POST request :param Date: :param LOALT2: :param LOALT5: :param LOALT...
stack_v2_sparse_classes_75kplus_train_001809
4,331
no_license
[ { "docstring": "Method for POST request :param Date: :param LOALT2: :param LOALT5: :param LOALT10: :param LOALT100: :param LOALT1000: :param LOALT5000: :param LOAGT5000:", "name": "post", "signature": "def post(self, Date, LOALT2=None, LOALT5=None, LOALT10=None, LOALT100=None, LOALT1000=None, LOALT5000=...
3
stack_v2_sparse_classes_30k_train_049176
Implement the Python class `ActivityLevelByDateEndpoint` described below. Class description: Class implementing activity level by date Method signatures and docstrings: - def post(self, Date, LOALT2=None, LOALT5=None, LOALT10=None, LOALT100=None, LOALT1000=None, LOALT5000=None, LOAGT5000=None): Method for POST reques...
Implement the Python class `ActivityLevelByDateEndpoint` described below. Class description: Class implementing activity level by date Method signatures and docstrings: - def post(self, Date, LOALT2=None, LOALT5=None, LOALT10=None, LOALT100=None, LOALT1000=None, LOALT5000=None, LOAGT5000=None): Method for POST reques...
83a7000c4aa8020481771c0956a9918a335fc2f5
<|skeleton|> class ActivityLevelByDateEndpoint: """Class implementing activity level by date""" def post(self, Date, LOALT2=None, LOALT5=None, LOALT10=None, LOALT100=None, LOALT1000=None, LOALT5000=None, LOAGT5000=None): """Method for POST request :param Date: :param LOALT2: :param LOALT5: :param LOALT...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActivityLevelByDateEndpoint: """Class implementing activity level by date""" def post(self, Date, LOALT2=None, LOALT5=None, LOALT10=None, LOALT100=None, LOALT1000=None, LOALT5000=None, LOAGT5000=None): """Method for POST request :param Date: :param LOALT2: :param LOALT5: :param LOALT10: :param LO...
the_stack_v2_python_sparse
foundations/bitcoin_api/resources/graph/level_of_activity.py
tskiranmayee/Blockchain-Analysis-Project
train
0
f672653a0d289d5467e28a0d377b14c2f07de7cd
[ "self.add_class('instruments', 1, 'instruments')\nimgs = []\nimg_id = []\nwith open(dataset_dir, 'r') as f:\n lines = f.readlines()\n for line in lines:\n str_list = line.split(' ')\n imgs.append(str_list[0])\n img_id.append(str_list[1])\nprint('************Train Image Num is: ', len(imgs...
<|body_start_0|> self.add_class('instruments', 1, 'instruments') imgs = [] img_id = [] with open(dataset_dir, 'r') as f: lines = f.readlines() for line in lines: str_list = line.split(' ') imgs.append(str_list[0]) im...
EndovisDataset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EndovisDataset: def load_dataset(self, dataset_dir): """Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val""" <|body_0|> def load_mask(self, image_id): """Generate instance masks for an image. Return...
stack_v2_sparse_classes_75kplus_train_001810
8,949
permissive
[ { "docstring": "Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val", "name": "load_dataset", "signature": "def load_dataset(self, dataset_dir)" }, { "docstring": "Generate instance masks for an image. Returns: masks: A bool arra...
3
stack_v2_sparse_classes_30k_test_000040
Implement the Python class `EndovisDataset` described below. Class description: Implement the EndovisDataset class. Method signatures and docstrings: - def load_dataset(self, dataset_dir): Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val - def load...
Implement the Python class `EndovisDataset` described below. Class description: Implement the EndovisDataset class. Method signatures and docstrings: - def load_dataset(self, dataset_dir): Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val - def load...
c2e5b085a82d7d47d426c203776b7720872ae546
<|skeleton|> class EndovisDataset: def load_dataset(self, dataset_dir): """Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val""" <|body_0|> def load_mask(self, image_id): """Generate instance masks for an image. Return...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EndovisDataset: def load_dataset(self, dataset_dir): """Load a subset of the Balloon dataset. dataset_dir: Root directory of the dataset. subset: Subset to load: train or val""" self.add_class('instruments', 1, 'instruments') imgs = [] img_id = [] with open(dataset_dir,...
the_stack_v2_python_sparse
samples/endovis/train.py
EmmaSRH/Contour-aware_Amodal_Segmentation
train
0
9d1c2795f0a9bf3d8a64e65dbf49753e00a56502
[ "username = kwargs.get('username')\nUser = get_user_model()\ntry:\n queryset = User.objects.get(username=username)\nexcept User.DoesNotExist:\n raise Http404\nserializer = UserSerializer(queryset, context={'request': request, 'kwargs': kwargs})\nreturn Response(serializer.data)", "request_user = request.use...
<|body_start_0|> username = kwargs.get('username') User = get_user_model() try: queryset = User.objects.get(username=username) except User.DoesNotExist: raise Http404 serializer = UserSerializer(queryset, context={'request': request, 'kwargs': kwargs}) ...
Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).
UserDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetail: """Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).""" def get(self, request, *args, **kwargs): """Retrieve user information""" <|body_0|> def patch(self, request, *args, **kwargs): """Edit user info...
stack_v2_sparse_classes_75kplus_train_001811
19,438
no_license
[ { "docstring": "Retrieve user information", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Edit user information", "name": "patch", "signature": "def patch(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_022066
Implement the Python class `UserDetail` described below. Class description: Return user information. GET: return user information. PATCH: edit user information( fields: bio, ). Method signatures and docstrings: - def get(self, request, *args, **kwargs): Retrieve user information - def patch(self, request, *args, **kw...
Implement the Python class `UserDetail` described below. Class description: Return user information. GET: return user information. PATCH: edit user information( fields: bio, ). Method signatures and docstrings: - def get(self, request, *args, **kwargs): Retrieve user information - def patch(self, request, *args, **kw...
3e77877d1805ae2b361c9b3f564e73f698a3f4c6
<|skeleton|> class UserDetail: """Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).""" def get(self, request, *args, **kwargs): """Retrieve user information""" <|body_0|> def patch(self, request, *args, **kwargs): """Edit user info...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserDetail: """Return user information. GET: return user information. PATCH: edit user information( fields: bio, ).""" def get(self, request, *args, **kwargs): """Retrieve user information""" username = kwargs.get('username') User = get_user_model() try: querys...
the_stack_v2_python_sparse
api/views.py
zagorboda/django-blog
train
0
e7f218f9bd56620e872389aa1adccae21993341a
[ "res = []\nif not root:\n return res\nqueue = [root, None]\nlevel = []\nwhile queue:\n node = queue.pop(0)\n if not node:\n if not level:\n break\n res.append(level.copy())\n level.clear()\n queue.append(None)\n continue\n level.append(node.val)\n if node...
<|body_start_0|> res = [] if not root: return res queue = [root, None] level = [] while queue: node = queue.pop(0) if not node: if not level: break res.append(level.copy()) lev...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def printFromTopToBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def printFromTopToBottom_2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res...
stack_v2_sparse_classes_75kplus_train_001812
2,922
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "printFromTopToBottom", "signature": "def printFromTopToBottom(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "printFromTopToBottom_2", "signature": "def printFromTopToBottom_2(...
2
stack_v2_sparse_classes_30k_train_036348
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printFromTopToBottom(self, root): :type root: TreeNode :rtype: List[List[int]] - def printFromTopToBottom_2(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printFromTopToBottom(self, root): :type root: TreeNode :rtype: List[List[int]] - def printFromTopToBottom_2(self, root): :type root: TreeNode :rtype: List[List[int]] <|skele...
967b0fbb40ae491b552bc3365a481e66324cb6f2
<|skeleton|> class Solution: def printFromTopToBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def printFromTopToBottom_2(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def printFromTopToBottom(self, root): """:type root: TreeNode :rtype: List[List[int]]""" res = [] if not root: return res queue = [root, None] level = [] while queue: node = queue.pop(0) if not node: ...
the_stack_v2_python_sparse
jianzhi_offer/26_分行从上到下打印二叉树.py
ryanatgz/data_structure_and_algorithm
train
0
530238e63a0c0470a8bf4368f9fffb3fa6466ad2
[ "which_model = Idea if request.data.get('type', '') == 'idea' else IdeaComment\nwhich_object = which_model.objects.filter(pk=request.data.get('id', None)).first()\nif not which_object:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\ntry:\n which_object.agree.update_or_create(user_id=request._re...
<|body_start_0|> which_model = Idea if request.data.get('type', '') == 'idea' else IdeaComment which_object = which_model.objects.filter(pk=request.data.get('id', None)).first() if not which_object: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) try: ...
IdeaLikeView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdeaLikeView: def post(self, request): """想法及其评论点赞""" <|body_0|> def delete(self, request): """取消点赞""" <|body_1|> <|end_skeleton|> <|body_start_0|> which_model = Idea if request.data.get('type', '') == 'idea' else IdeaComment which_object = ...
stack_v2_sparse_classes_75kplus_train_001813
8,429
no_license
[ { "docstring": "想法及其评论点赞", "name": "post", "signature": "def post(self, request)" }, { "docstring": "取消点赞", "name": "delete", "signature": "def delete(self, request)" } ]
2
null
Implement the Python class `IdeaLikeView` described below. Class description: Implement the IdeaLikeView class. Method signatures and docstrings: - def post(self, request): 想法及其评论点赞 - def delete(self, request): 取消点赞
Implement the Python class `IdeaLikeView` described below. Class description: Implement the IdeaLikeView class. Method signatures and docstrings: - def post(self, request): 想法及其评论点赞 - def delete(self, request): 取消点赞 <|skeleton|> class IdeaLikeView: def post(self, request): """想法及其评论点赞""" <|body_...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class IdeaLikeView: def post(self, request): """想法及其评论点赞""" <|body_0|> def delete(self, request): """取消点赞""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IdeaLikeView: def post(self, request): """想法及其评论点赞""" which_model = Idea if request.data.get('type', '') == 'idea' else IdeaComment which_object = which_model.objects.filter(pk=request.data.get('id', None)).first() if not which_object: return self.error(errorcode.MS...
the_stack_v2_python_sparse
apps/ideas/views.py
Slowhalfframe/fanyijiang-API
train
0
0d52b4124a32a9b2b5601e1aeb8b955765c9cdd9
[ "if not head:\n return False\nfirst = head\nsecond = head.next.next if head.next else None\nif not second:\n return False\nwhile first != second:\n first = first.next\n second = second.next.next if second.next else None\n if not second:\n return False\nreturn True", "fwd = ohead = head\ncnt ...
<|body_start_0|> if not head: return False first = head second = head.next.next if head.next else None if not second: return False while first != second: first = first.next second = second.next.next if second.next else None ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: bool Best solution :-)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return Fa...
stack_v2_sparse_classes_75kplus_train_001814
2,391
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool Best solution :-)", "name": "rewrite", "signature": "def rewrite(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_035028
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def rewrite(self, head): :type head: ListNode :rtype: bool Best solution :-)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def rewrite(self, head): :type head: ListNode :rtype: bool Best solution :-) <|skeleton|> class Solution: def ...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: bool Best solution :-)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" if not head: return False first = head second = head.next.next if head.next else None if not second: return False while first != second: first = first...
the_stack_v2_python_sparse
co_amazon/141_Linked_List_Cycle.py
vsdrun/lc_public
train
6
ba3c984ded47887d4138f67bc8ba372b6dcc271c
[ "max_steps = max_steps or 0\nmax_episodes = max_episodes or 0\nif max_steps < 1 and max_episodes < 1:\n raise ValueError('Either `max_steps` or `max_episodes` should be greater than 0.')\nsuper(PyDriver, self).__init__(env, policy, observers, transition_observers, info_observers)\nself._max_steps = max_steps or ...
<|body_start_0|> max_steps = max_steps or 0 max_episodes = max_episodes or 0 if max_steps < 1 and max_episodes < 1: raise ValueError('Either `max_steps` or `max_episodes` should be greater than 0.') super(PyDriver, self).__init__(env, policy, observers, transition_observers, ...
A driver that runs a python policy in a python environment.
PyDriver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyDriver: """A driver that runs a python policy in a python environment.""" def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], transition_observers: Optional[Sequence[Callable[[trajectory.Transition],...
stack_v2_sparse_classes_75kplus_train_001815
6,250
permissive
[ { "docstring": "A driver that runs a python policy in a python environment. **Note** about bias when using batched environments with `max_episodes`: When using `max_episodes != None`, a `run` step \"finishes\" when `max_episodes` have been completely collected (hit a boundary). When used in conjunction with env...
2
stack_v2_sparse_classes_30k_test_001734
Implement the Python class `PyDriver` described below. Class description: A driver that runs a python policy in a python environment. Method signatures and docstrings: - def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], trans...
Implement the Python class `PyDriver` described below. Class description: A driver that runs a python policy in a python environment. Method signatures and docstrings: - def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], trans...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class PyDriver: """A driver that runs a python policy in a python environment.""" def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], transition_observers: Optional[Sequence[Callable[[trajectory.Transition],...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PyDriver: """A driver that runs a python policy in a python environment.""" def __init__(self, env: py_environment.PyEnvironment, policy: py_policy.PyPolicy, observers: Sequence[Callable[[trajectory.Trajectory], Any]], transition_observers: Optional[Sequence[Callable[[trajectory.Transition], Any]]]=None,...
the_stack_v2_python_sparse
tf_agents/drivers/py_driver.py
tensorflow/agents
train
2,755
6493da2b3696799d3b27d5e7f5f5bf16adc50fbe
[ "data = request.body\nif not data:\n return RESPONSE_400_EMPTY_JSON\ndata = {'longitude': data.get('longitude'), 'latitude': data.get('latitude'), 'address': data.get('address'), 'name': data.get('name'), 'stop_id': data.get('stop_id')}\nif not place_data_validator(data):\n return RESPONSE_400_INVALID_DATA\np...
<|body_start_0|> data = request.body if not data: return RESPONSE_400_EMPTY_JSON data = {'longitude': data.get('longitude'), 'latitude': data.get('latitude'), 'address': data.get('address'), 'name': data.get('name'), 'stop_id': data.get('stop_id')} if not place_data_validator...
Class that handle HTTP requests for place model.
PlaceView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlaceView: """Class that handle HTTP requests for place model.""" def post(self, request, place_id=None): """Handle the request to create a new place object.""" <|body_0|> def get(self, request, place_id=None): """Handle the request to retrieve a place object or ...
stack_v2_sparse_classes_75kplus_train_001816
3,912
no_license
[ { "docstring": "Handle the request to create a new place object.", "name": "post", "signature": "def post(self, request, place_id=None)" }, { "docstring": "Handle the request to retrieve a place object or user`s places.", "name": "get", "signature": "def get(self, request, place_id=None)...
4
stack_v2_sparse_classes_30k_train_003244
Implement the Python class `PlaceView` described below. Class description: Class that handle HTTP requests for place model. Method signatures and docstrings: - def post(self, request, place_id=None): Handle the request to create a new place object. - def get(self, request, place_id=None): Handle the request to retrie...
Implement the Python class `PlaceView` described below. Class description: Class that handle HTTP requests for place model. Method signatures and docstrings: - def post(self, request, place_id=None): Handle the request to create a new place object. - def get(self, request, place_id=None): Handle the request to retrie...
c5f533bd049f6939037b14045e2aa2550aaac36a
<|skeleton|> class PlaceView: """Class that handle HTTP requests for place model.""" def post(self, request, place_id=None): """Handle the request to create a new place object.""" <|body_0|> def get(self, request, place_id=None): """Handle the request to retrieve a place object or ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlaceView: """Class that handle HTTP requests for place model.""" def post(self, request, place_id=None): """Handle the request to create a new place object.""" data = request.body if not data: return RESPONSE_400_EMPTY_JSON data = {'longitude': data.get('longi...
the_stack_v2_python_sparse
way_to_home/place/views.py
Lv-365python/wayToHome
train
1
b0c4361509851ba9a1c439e44febfe6a68fbb704
[ "AbstractTransportLayer.__init__(self, sim_env, test=test)\nself.STDTL_SEND_PROCESS = time.STDTL_SEND_PROCESS\nself.STDTL_RECEIVE_PROCESS = time.STDTL_RECEIVE_PROCESS", "self.settings = {}\nself.settings['t_send_process'] = 'STDTL_SEND_PROCESS'\nself.settings['t_receive_process'] = 'STDTL_RECEIVE_PROCESS'", "me...
<|body_start_0|> AbstractTransportLayer.__init__(self, sim_env, test=test) self.STDTL_SEND_PROCESS = time.STDTL_SEND_PROCESS self.STDTL_RECEIVE_PROCESS = time.STDTL_RECEIVE_PROCESS <|end_body_0|> <|body_start_1|> self.settings = {} self.settings['t_send_process'] = 'STDTL_SEND_P...
This class implements the Transport Layer for the implementation of a secure Communication Module. It transmits message as a whole not in segments
StdTransportLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StdTransportLayer: """This class implements the Transport Layer for the implementation of a secure Communication Module. It transmits message as a whole not in segments""" def __init__(self, sim_env, test=None): """Constructor Input: sim_env simpy.Environment environment of this comp...
stack_v2_sparse_classes_75kplus_train_001817
32,509
permissive
[ { "docstring": "Constructor Input: sim_env simpy.Environment environment of this component Output: -", "name": "__init__", "signature": "def __init__(self, sim_env, test=None)" }, { "docstring": "sets the initial setting association between the settings variables and the actual parameter Input: ...
6
null
Implement the Python class `StdTransportLayer` described below. Class description: This class implements the Transport Layer for the implementation of a secure Communication Module. It transmits message as a whole not in segments Method signatures and docstrings: - def __init__(self, sim_env, test=None): Constructor ...
Implement the Python class `StdTransportLayer` described below. Class description: This class implements the Transport Layer for the implementation of a secure Communication Module. It transmits message as a whole not in segments Method signatures and docstrings: - def __init__(self, sim_env, test=None): Constructor ...
b2e395611e9b5111aeda7ab128f3486354bbbf0d
<|skeleton|> class StdTransportLayer: """This class implements the Transport Layer for the implementation of a secure Communication Module. It transmits message as a whole not in segments""" def __init__(self, sim_env, test=None): """Constructor Input: sim_env simpy.Environment environment of this comp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StdTransportLayer: """This class implements the Transport Layer for the implementation of a secure Communication Module. It transmits message as a whole not in segments""" def __init__(self, sim_env, test=None): """Constructor Input: sim_env simpy.Environment environment of this component Output:...
the_stack_v2_python_sparse
ECUSimulation/components/base/ecu/software/impl_transport_layers.py
PhilippMundhenk/IVNS
train
15
18011655da572bf710eb2834fb3a9b6b6759dfdb
[ "QtWidgets.QDialog.__init__(self, *args, **kargs)\nself.setWindowTitle('AthenaWriter: Document Statistics')\nassert textedit or text, 'Either <textedit> or <text> should contain something'\nbutton_quit = QtWidgets.QPushButton('Quit')\nbutton_refresh = QtWidgets.QPushButton('Refresh')\nself.textedit = textedit\nself...
<|body_start_0|> QtWidgets.QDialog.__init__(self, *args, **kargs) self.setWindowTitle('AthenaWriter: Document Statistics') assert textedit or text, 'Either <textedit> or <text> should contain something' button_quit = QtWidgets.QPushButton('Quit') button_refresh = QtWidgets.QPushB...
DPStatisticsDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DPStatisticsDialog: def __init__(self, textedit=False, text=False, *args, **kargs): """This is a display dialog window to show the statistics of the text. - textedit: a TETextEdit instance the text has to be displayed - text: if there is no textedit, then if will display the string conta...
stack_v2_sparse_classes_75kplus_train_001818
8,380
no_license
[ { "docstring": "This is a display dialog window to show the statistics of the text. - textedit: a TETextEdit instance the text has to be displayed - text: if there is no textedit, then if will display the string contained in text. - *args,**kargs: argument putted in the constructor of QDialog.", "name": "__...
2
stack_v2_sparse_classes_30k_train_014367
Implement the Python class `DPStatisticsDialog` described below. Class description: Implement the DPStatisticsDialog class. Method signatures and docstrings: - def __init__(self, textedit=False, text=False, *args, **kargs): This is a display dialog window to show the statistics of the text. - textedit: a TETextEdit i...
Implement the Python class `DPStatisticsDialog` described below. Class description: Implement the DPStatisticsDialog class. Method signatures and docstrings: - def __init__(self, textedit=False, text=False, *args, **kargs): This is a display dialog window to show the statistics of the text. - textedit: a TETextEdit i...
14c9e51fa31fd3ff4113f33e26619d07c9f1dc7c
<|skeleton|> class DPStatisticsDialog: def __init__(self, textedit=False, text=False, *args, **kargs): """This is a display dialog window to show the statistics of the text. - textedit: a TETextEdit instance the text has to be displayed - text: if there is no textedit, then if will display the string conta...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DPStatisticsDialog: def __init__(self, textedit=False, text=False, *args, **kargs): """This is a display dialog window to show the statistics of the text. - textedit: a TETextEdit instance the text has to be displayed - text: if there is no textedit, then if will display the string contained in text. ...
the_stack_v2_python_sparse
DocProperties/DocPropertiesStatistics.py
grumpfou/AthenaWriter
train
0
d95184ef18dd30147e975eb40965d047e857aef7
[ "if not n:\n return n\ndp = [0] * (n + 1)\ndp[0] = dp[1] = 1\nfor i in range(2, n + 1):\n dp[i] = dp[i - 1] + dp[i - 2]\nreturn dp[n]", "if not n:\n return n\na, b = (1, 1)\nfor i in range(2, n + 1):\n b, a = (a + b, b)\nreturn b" ]
<|body_start_0|> if not n: return n dp = [0] * (n + 1) dp[0] = dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] <|end_body_0|> <|body_start_1|> if not n: return n a, b = (1, 1) for i in ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs1(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not n: return n dp = [0] * (n + 1) d...
stack_v2_sparse_classes_75kplus_train_001819
1,419
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs1", "signature": "def climbStairs1(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs2", "signature": "def climbStairs2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_030170
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs1(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs1(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def climbStairs1(self, n): ""...
65bd3cc5b6a6221b7e4d22d2a405fdaf3a08afc0
<|skeleton|> class Solution: def climbStairs1(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def climbStairs1(self, n): """:type n: int :rtype: int""" if not n: return n dp = [0] * (n + 1) dp[0] = dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] return dp[n] def climbStairs2(self, n): """:t...
the_stack_v2_python_sparse
Week_04/id_26/LeetCode_70_26.py
laocaicaicai/algorithm
train
0
d1ee315d6621b58757a8e5372784697a25ad0279
[ "try:\n headers = {'Accept': 'application/json'} | TokenAuthenticator(token=config['access_token']).get_auth_header()\n resp = requests.get(f\"https://{config['wrike_instance']}/api/v4/version\", headers=headers)\n resp.raise_for_status()\n return (True, None)\nexcept requests.exceptions.RequestExceptio...
<|body_start_0|> try: headers = {'Accept': 'application/json'} | TokenAuthenticator(token=config['access_token']).get_auth_header() resp = requests.get(f"https://{config['wrike_instance']}/api/v4/version", headers=headers) resp.raise_for_status() return (True, Non...
SourceWrike
[ "MIT", "Elastic-2.0", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceWrike: def check_connection(self, logger, config) -> Tuple[bool, any]: """:param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger object :return Tuple[bool, any]: (True, None) if the input config can be used to connect to the API su...
stack_v2_sparse_classes_75kplus_train_001820
5,051
permissive
[ { "docstring": ":param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger object :return Tuple[bool, any]: (True, None) if the input config can be used to connect to the API successfully, (False, error) otherwise.", "name": "check_connection", "signature":...
2
stack_v2_sparse_classes_30k_train_031428
Implement the Python class `SourceWrike` described below. Class description: Implement the SourceWrike class. Method signatures and docstrings: - def check_connection(self, logger, config) -> Tuple[bool, any]: :param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger ob...
Implement the Python class `SourceWrike` described below. Class description: Implement the SourceWrike class. Method signatures and docstrings: - def check_connection(self, logger, config) -> Tuple[bool, any]: :param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger ob...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class SourceWrike: def check_connection(self, logger, config) -> Tuple[bool, any]: """:param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger object :return Tuple[bool, any]: (True, None) if the input config can be used to connect to the API su...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceWrike: def check_connection(self, logger, config) -> Tuple[bool, any]: """:param config: the user-input config object conforming to the connector's spec.yaml :param logger: logger object :return Tuple[bool, any]: (True, None) if the input config can be used to connect to the API successfully, (F...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/source-wrike/source_wrike/source.py
alldatacenter/alldata
train
774
54c80aaab2863f8dbaffdfefa0f7b793b9bd6667
[ "context = super(ProductListView, self).get_context_data(*args, **kwargs)\nprint(context)\ncontext['now'] = timezone.now()\ncontext['query'] = self.request.GET.get('q', 'default value')\ncontext['filter_form'] = ProductFilterForm(data=self.request.GET or None)\nreturn context", "qs = super(ProductListView, self)....
<|body_start_0|> context = super(ProductListView, self).get_context_data(*args, **kwargs) print(context) context['now'] = timezone.now() context['query'] = self.request.GET.get('q', 'default value') context['filter_form'] = ProductFilterForm(data=self.request.GET or None) ...
What is the context? In List views, it's auto in get_context_data(SELF). queryset using models is auto, too
ProductListView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductListView: """What is the context? In List views, it's auto in get_context_data(SELF). queryset using models is auto, too""" def get_context_data(self, *args, **kwargs): """Sets the new context info on a ProductList View GET.get('q'): gets the GET request - the URL - and looks ...
stack_v2_sparse_classes_75kplus_train_001821
13,595
permissive
[ { "docstring": "Sets the new context info on a ProductList View GET.get('q'): gets the GET request - the URL - and looks for a parameter q, which if nonexistent sets it to none. Can set default value with second param. True, 'string', whatever If leave off lowercase get... request.GET('q') and it isn't there, w...
2
null
Implement the Python class `ProductListView` described below. Class description: What is the context? In List views, it's auto in get_context_data(SELF). queryset using models is auto, too Method signatures and docstrings: - def get_context_data(self, *args, **kwargs): Sets the new context info on a ProductList View ...
Implement the Python class `ProductListView` described below. Class description: What is the context? In List views, it's auto in get_context_data(SELF). queryset using models is auto, too Method signatures and docstrings: - def get_context_data(self, *args, **kwargs): Sets the new context info on a ProductList View ...
c0dc4150f0b8112d591b5b5e3b462d24be4a4d79
<|skeleton|> class ProductListView: """What is the context? In List views, it's auto in get_context_data(SELF). queryset using models is auto, too""" def get_context_data(self, *args, **kwargs): """Sets the new context info on a ProductList View GET.get('q'): gets the GET request - the URL - and looks ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductListView: """What is the context? In List views, it's auto in get_context_data(SELF). queryset using models is auto, too""" def get_context_data(self, *args, **kwargs): """Sets the new context info on a ProductList View GET.get('q'): gets the GET request - the URL - and looks for a paramet...
the_stack_v2_python_sparse
src/products/views.py
Toruitas/ecom
train
0
7d342404829cbc4518c592b1efe602856897105a
[ "def preorder(root, acc):\n if not root:\n return\n acc.append(str(root.val))\n preorder(root.left, acc)\n preorder(root.right, acc)\n\ndef inorder(root, acc):\n if not root:\n return\n inorder(root.left, acc)\n acc.append(str(root.val))\n inorder(root.right, acc)\npreorder_arr...
<|body_start_0|> def preorder(root, acc): if not root: return acc.append(str(root.val)) preorder(root.left, acc) preorder(root.right, acc) def inorder(root, acc): if not root: return inorder(root.lef...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def preorder(r...
stack_v2_sparse_classes_75kplus_train_001822
1,695
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_030756
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
ec14ad04893073ff911b6d11aacc26b372766b6d
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def preorder(root, acc): if not root: return acc.append(str(root.val)) preorder(root.left, acc) preorder(root.right, acc) def ino...
the_stack_v2_python_sparse
problems/Medium/serialize-and-deserialize-bst/sol.py
Zahidsqldba07/leetcode-3
train
0
ce13129e90c7160143f7d1a5ca7f132d2532497b
[ "if not email:\n raise ValueError('需要一个合法的邮箱地址')\nuser = self.model(email=self.normalize_email(email), name=name, img=img)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password, name=name)\nuser.is_superuser = True\nuser.save(using=self._db)\nr...
<|body_start_0|> if not email: raise ValueError('需要一个合法的邮箱地址') user = self.model(email=self.normalize_email(email), name=name, img=img) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(e...
UserProfileManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileManager: def create_user(self, email, name, password=None, img=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, name, password): """Creates and saves a superuser with the g...
stack_v2_sparse_classes_75kplus_train_001823
11,777
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, email, name, password=None, img=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", ...
2
stack_v2_sparse_classes_30k_train_033995
Implement the Python class `UserProfileManager` described below. Class description: Implement the UserProfileManager class. Method signatures and docstrings: - def create_user(self, email, name, password=None, img=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser...
Implement the Python class `UserProfileManager` described below. Class description: Implement the UserProfileManager class. Method signatures and docstrings: - def create_user(self, email, name, password=None, img=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser...
b7eb3dabcce6a026b2258587be099ab88248549b
<|skeleton|> class UserProfileManager: def create_user(self, email, name, password=None, img=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, name, password): """Creates and saves a superuser with the g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProfileManager: def create_user(self, email, name, password=None, img=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('需要一个合法的邮箱地址') user = self.model(email=self.normalize_email(email), name=name, im...
the_stack_v2_python_sparse
crm/models.py
PyPylang/PerfectCRM
train
0
0212a9501aa8b01ee2901c1721dfd0fe2ba89960
[ "backup_count = 0\nsuper(CompressedFileHandler, self).__init__(filename, mode=mode, maxBytes=max_bytes, backupCount=backup_count, encoding=encoding, delay=delay)\nself.suffix = '%Y%m%d-%H%M%S'\nself.extMatch = '^\\\\d{4}\\\\d{2}\\\\d{2}-\\\\d{2}\\\\d{2}\\\\d{2}$'\nself.extMatch = re.compile(self.extMatch)", "if s...
<|body_start_0|> backup_count = 0 super(CompressedFileHandler, self).__init__(filename, mode=mode, maxBytes=max_bytes, backupCount=backup_count, encoding=encoding, delay=delay) self.suffix = '%Y%m%d-%H%M%S' self.extMatch = '^\\d{4}\\d{2}\\d{2}-\\d{2}\\d{2}\\d{2}$' self.extMatch =...
A custom log handler to compress files.
CompressedFileHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompressedFileHandler: """A custom log handler to compress files.""" def __init__(self, filename, mode='a', max_bytes=0, encoding=None, delay=0): """Note: We don't want to delete any log files for backupCount is automatically set to 0. If you really want to delete log files set backu...
stack_v2_sparse_classes_75kplus_train_001824
6,555
permissive
[ { "docstring": "Note: We don't want to delete any log files for backupCount is automatically set to 0. If you really want to delete log files set backupCount to > 0 example: handler = CompressedFileHandler('logfile.txt') handler.backupCount = 5 Args: filename (str): Path of logfile. mode (str): Mode to open log...
3
stack_v2_sparse_classes_30k_train_003975
Implement the Python class `CompressedFileHandler` described below. Class description: A custom log handler to compress files. Method signatures and docstrings: - def __init__(self, filename, mode='a', max_bytes=0, encoding=None, delay=0): Note: We don't want to delete any log files for backupCount is automatically s...
Implement the Python class `CompressedFileHandler` described below. Class description: A custom log handler to compress files. Method signatures and docstrings: - def __init__(self, filename, mode='a', max_bytes=0, encoding=None, delay=0): Note: We don't want to delete any log files for backupCount is automatically s...
6fb2ca9d7e85826b300d3d7780c30cb09da433c7
<|skeleton|> class CompressedFileHandler: """A custom log handler to compress files.""" def __init__(self, filename, mode='a', max_bytes=0, encoding=None, delay=0): """Note: We don't want to delete any log files for backupCount is automatically set to 0. If you really want to delete log files set backu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CompressedFileHandler: """A custom log handler to compress files.""" def __init__(self, filename, mode='a', max_bytes=0, encoding=None, delay=0): """Note: We don't want to delete any log files for backupCount is automatically set to 0. If you really want to delete log files set backupCount to > 0...
the_stack_v2_python_sparse
qalib/qabase/log.py
Datera/datera-automation-toolkit
train
0
018f6b14c0e308320ae38fc9a8b99988f29ff95e
[ "proxy_pool = [{}] if proxy_pool is None else proxy_pool\nheaders_pool = [{}] if headers_pool is None else headers_pool\nproxy_pool_size = len(proxy_pool)\nheaders_pool_size = len(headers_pool)\nif proxy_pool_size > headers_pool_size:\n times, remainder = divmod(proxy_pool_size, headers_pool_size)\n new_heade...
<|body_start_0|> proxy_pool = [{}] if proxy_pool is None else proxy_pool headers_pool = [{}] if headers_pool is None else headers_pool proxy_pool_size = len(proxy_pool) headers_pool_size = len(headers_pool) if proxy_pool_size > headers_pool_size: times, remainder = di...
SafeDownload
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafeDownload: def __init__(self, proxy_pool=None, headers_pool=None, throttle=Throttle(10), cache=MongoCache()): """be able to: 1. cache HTML retrieved. 2. pair proxies and headers. 3. sleep flexibly 4. handle the ConnectionError, Timeout, and ProxyError arising from invalid proxy. :para...
stack_v2_sparse_classes_75kplus_train_001825
11,411
no_license
[ { "docstring": "be able to: 1. cache HTML retrieved. 2. pair proxies and headers. 3. sleep flexibly 4. handle the ConnectionError, Timeout, and ProxyError arising from invalid proxy. :param proxy_pool: list or list-like of more than one dict. :param headers_pool: list or list-like of more than one dict. :param ...
4
null
Implement the Python class `SafeDownload` described below. Class description: Implement the SafeDownload class. Method signatures and docstrings: - def __init__(self, proxy_pool=None, headers_pool=None, throttle=Throttle(10), cache=MongoCache()): be able to: 1. cache HTML retrieved. 2. pair proxies and headers. 3. sl...
Implement the Python class `SafeDownload` described below. Class description: Implement the SafeDownload class. Method signatures and docstrings: - def __init__(self, proxy_pool=None, headers_pool=None, throttle=Throttle(10), cache=MongoCache()): be able to: 1. cache HTML retrieved. 2. pair proxies and headers. 3. sl...
530a1f091c932309d0fe48a98373192b063cbf20
<|skeleton|> class SafeDownload: def __init__(self, proxy_pool=None, headers_pool=None, throttle=Throttle(10), cache=MongoCache()): """be able to: 1. cache HTML retrieved. 2. pair proxies and headers. 3. sleep flexibly 4. handle the ConnectionError, Timeout, and ProxyError arising from invalid proxy. :para...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SafeDownload: def __init__(self, proxy_pool=None, headers_pool=None, throttle=Throttle(10), cache=MongoCache()): """be able to: 1. cache HTML retrieved. 2. pair proxies and headers. 3. sleep flexibly 4. handle the ConnectionError, Timeout, and ProxyError arising from invalid proxy. :param proxy_pool: ...
the_stack_v2_python_sparse
base/downloader/get_static.py
flying-chicks/faculty_spider
train
0
b1eb4edd9a5c6d01d5d9cb09e8ee08b83b5abb65
[ "self.config_entry = config_entry\nself.homekit_options = {}\nself.included_cameras = set()", "if user_input is not None:\n return self.async_create_entry(title='', data=self.config_entry.options)\nreturn self.async_show_form(step_id='yaml')", "if user_input is not None:\n self.homekit_options.update(user...
<|body_start_0|> self.config_entry = config_entry self.homekit_options = {} self.included_cameras = set() <|end_body_0|> <|body_start_1|> if user_input is not None: return self.async_create_entry(title='', data=self.config_entry.options) return self.async_show_form(s...
Handle a option flow for tado.
OptionsFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsFlowHandler: """Handle a option flow for tado.""" def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize options flow.""" <|body_0|> async def async_step_yaml(self, user_input=None): """No options for yaml managed entries.""" <...
stack_v2_sparse_classes_75kplus_train_001826
11,910
permissive
[ { "docstring": "Initialize options flow.", "name": "__init__", "signature": "def __init__(self, config_entry: config_entries.ConfigEntry)" }, { "docstring": "No options for yaml managed entries.", "name": "async_step_yaml", "signature": "async def async_step_yaml(self, user_input=None)" ...
6
null
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle a option flow for tado. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry): Initialize options flow. - async def async_step_yaml(self, user_input=None): No options for yaml managed ...
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle a option flow for tado. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry): Initialize options flow. - async def async_step_yaml(self, user_input=None): No options for yaml managed ...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class OptionsFlowHandler: """Handle a option flow for tado.""" def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize options flow.""" <|body_0|> async def async_step_yaml(self, user_input=None): """No options for yaml managed entries.""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptionsFlowHandler: """Handle a option flow for tado.""" def __init__(self, config_entry: config_entries.ConfigEntry): """Initialize options flow.""" self.config_entry = config_entry self.homekit_options = {} self.included_cameras = set() async def async_step_yaml(sel...
the_stack_v2_python_sparse
homeassistant/components/homekit/config_flow.py
tchellomello/home-assistant
train
8
9e87621a742cc27090abe201cb9d9ce1d4ee1b53
[ "li = values[0].strip().split()\nif len(li) == 1:\n li.append('')\nbefore, after = (li[0], li[1])\nsim1 = self.similiarity(key, before)\nsim2 = self.similiarity(key, after)\nif sim1 >= sim2:\n self.outputcollector.collect(key, before)\nelse:\n self.outputcollector.collect(key, after)", "n = min(len(name1...
<|body_start_0|> li = values[0].strip().split() if len(li) == 1: li.append('') before, after = (li[0], li[1]) sim1 = self.similiarity(key, before) sim2 = self.similiarity(key, after) if sim1 >= sim2: self.outputcollector.collect(key, before) ...
find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)
Name2SimiliarName
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Name2SimiliarName: """find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)""" def reduce(self, key, values): """find the most simliar name for the given name @param key: the given name @param values: the name before an...
stack_v2_sparse_classes_75kplus_train_001827
1,271
permissive
[ { "docstring": "find the most simliar name for the given name @param key: the given name @param values: the name before and after the given name", "name": "reduce", "signature": "def reduce(self, key, values)" }, { "docstring": "compute the similarity between name1 and name2 e.g. similiarity(\"A...
2
stack_v2_sparse_classes_30k_train_045340
Implement the Python class `Name2SimiliarName` described below. Class description: find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada) Method signatures and docstrings: - def reduce(self, key, values): find the most simliar name for the given name @pa...
Implement the Python class `Name2SimiliarName` described below. Class description: find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada) Method signatures and docstrings: - def reduce(self, key, values): find the most simliar name for the given name @pa...
95d1806e2f4e89e960b76a685b1fba2eaa7d5142
<|skeleton|> class Name2SimiliarName: """find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)""" def reduce(self, key, values): """find the most simliar name for the given name @param key: the given name @param values: the name before an...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Name2SimiliarName: """find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)""" def reduce(self, key, values): """find the most simliar name for the given name @param key: the given name @param values: the name before and after the g...
the_stack_v2_python_sparse
nltk_contrib/hadoop/name_similarity/similiar_name_reducer.py
nltk/nltk_contrib
train
145
b6ec725a9d4022943fc7b6073c9d6bb5bc1d5e5b
[ "aug_kwargs = cfg.aug_kwargs\naug_list = []\nif is_train:\n aug_list.extend([getattr(A, name)(**kwargs) for name, kwargs in aug_kwargs.items()])\nself.transform = A.Compose(aug_list, bbox_params=A.BboxParams(format='pascal_voc', label_fields=['category_ids']))\nself.is_train = is_train\nmode = 'training' if is_t...
<|body_start_0|> aug_kwargs = cfg.aug_kwargs aug_list = [] if is_train: aug_list.extend([getattr(A, name)(**kwargs) for name, kwargs in aug_kwargs.items()]) self.transform = A.Compose(aug_list, bbox_params=A.BboxParams(format='pascal_voc', label_fields=['category_ids'])) ...
AlbumentationsMapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlbumentationsMapper: def __init__(self, cfg, is_train: bool=True): """:cfg: contains information about augmentations to apply :is_train: is_train = True for training only. is_train = False for validation and test""" <|body_0|> def __call__(self, dataset_dict): """:d...
stack_v2_sparse_classes_75kplus_train_001828
18,732
no_license
[ { "docstring": ":cfg: contains information about augmentations to apply :is_train: is_train = True for training only. is_train = False for validation and test", "name": "__init__", "signature": "def __init__(self, cfg, is_train: bool=True)" }, { "docstring": ":dataset_dict: this contains a singl...
2
stack_v2_sparse_classes_30k_train_033786
Implement the Python class `AlbumentationsMapper` described below. Class description: Implement the AlbumentationsMapper class. Method signatures and docstrings: - def __init__(self, cfg, is_train: bool=True): :cfg: contains information about augmentations to apply :is_train: is_train = True for training only. is_tra...
Implement the Python class `AlbumentationsMapper` described below. Class description: Implement the AlbumentationsMapper class. Method signatures and docstrings: - def __init__(self, cfg, is_train: bool=True): :cfg: contains information about augmentations to apply :is_train: is_train = True for training only. is_tra...
4a7a248389ee82ef3cf7a207423f5b68d1bd0975
<|skeleton|> class AlbumentationsMapper: def __init__(self, cfg, is_train: bool=True): """:cfg: contains information about augmentations to apply :is_train: is_train = True for training only. is_train = False for validation and test""" <|body_0|> def __call__(self, dataset_dict): """:d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlbumentationsMapper: def __init__(self, cfg, is_train: bool=True): """:cfg: contains information about augmentations to apply :is_train: is_train = True for training only. is_train = False for validation and test""" aug_kwargs = cfg.aug_kwargs aug_list = [] if is_train: ...
the_stack_v2_python_sparse
common/detectron2_utils.py
sheldonsebastian/vbd_cxr
train
0
e20d3405c3d96abfe6a27287f293cdff675825f1
[ "database.clear_database()\nreal = database.show_available_products()\nexpected = {}\nself.assertEqual(real, expected)", "real_dict = database.create_dict_from_csv('test_files/test_test.csv')\nexpected_dict = [{'user_id': '543', 'name': 'Bob Builder', 'address': 'Bricktown', 'phone_number': '7594930584', 'email':...
<|body_start_0|> database.clear_database() real = database.show_available_products() expected = {} self.assertEqual(real, expected) <|end_body_0|> <|body_start_1|> real_dict = database.create_dict_from_csv('test_files/test_test.csv') expected_dict = [{'user_id': '543', '...
This class holds the tests for database.py
TestDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatabase: """This class holds the tests for database.py""" def test_clear_database(self): """This tests that the database is cleared""" <|body_0|> def test_create_dict_from_csv(self): """Tests creation of dict from csv file""" <|body_1|> def test...
stack_v2_sparse_classes_75kplus_train_001829
3,347
no_license
[ { "docstring": "This tests that the database is cleared", "name": "test_clear_database", "signature": "def test_clear_database(self)" }, { "docstring": "Tests creation of dict from csv file", "name": "test_create_dict_from_csv", "signature": "def test_create_dict_from_csv(self)" }, {...
5
stack_v2_sparse_classes_30k_train_017646
Implement the Python class `TestDatabase` described below. Class description: This class holds the tests for database.py Method signatures and docstrings: - def test_clear_database(self): This tests that the database is cleared - def test_create_dict_from_csv(self): Tests creation of dict from csv file - def test_imp...
Implement the Python class `TestDatabase` described below. Class description: This class holds the tests for database.py Method signatures and docstrings: - def test_clear_database(self): This tests that the database is cleared - def test_create_dict_from_csv(self): Tests creation of dict from csv file - def test_imp...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestDatabase: """This class holds the tests for database.py""" def test_clear_database(self): """This tests that the database is cleared""" <|body_0|> def test_create_dict_from_csv(self): """Tests creation of dict from csv file""" <|body_1|> def test...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestDatabase: """This class holds the tests for database.py""" def test_clear_database(self): """This tests that the database is cleared""" database.clear_database() real = database.show_available_products() expected = {} self.assertEqual(real, expected) def t...
the_stack_v2_python_sparse
students/randi_peterson/lesson09/test_database.py
JavaRod/SP_Python220B_2019
train
1
ea60e78c8d74fe35fbd30984ea955399213a5c41
[ "self.train_data = train_data\nself.bandwidth = bandwidth\nself.kernel_type = kernel_type", "if self.bandwidth is None:\n output = kde_func(x, self.train_data[idx], bandwidth=self.bandwidth, kernel_type=self.kernel_type)\nelse:\n output = kde_func(x, self.train_data[idx], bandwidth=self.bandwidth[idx], kern...
<|body_start_0|> self.train_data = train_data self.bandwidth = bandwidth self.kernel_type = kernel_type <|end_body_0|> <|body_start_1|> if self.bandwidth is None: output = kde_func(x, self.train_data[idx], bandwidth=self.bandwidth, kernel_type=self.kernel_type) else:...
KDE
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KDE: def __init__(self, train_data, bandwidth=None, kernel_type='gaussian'): """Class for kernel density estimation, based on kde_func function Made this so I could use kde_func as a method For this class, training occurs inside forward Inputs: train_data (list of np.array): list of len ...
stack_v2_sparse_classes_75kplus_train_001830
8,636
no_license
[ { "docstring": "Class for kernel density estimation, based on kde_func function Made this so I could use kde_func as a method For this class, training occurs inside forward Inputs: train_data (list of np.array): list of len N, with each item being a Mx1 array of M training samples. N is number of datasets to tr...
2
stack_v2_sparse_classes_30k_train_037102
Implement the Python class `KDE` described below. Class description: Implement the KDE class. Method signatures and docstrings: - def __init__(self, train_data, bandwidth=None, kernel_type='gaussian'): Class for kernel density estimation, based on kde_func function Made this so I could use kde_func as a method For th...
Implement the Python class `KDE` described below. Class description: Implement the KDE class. Method signatures and docstrings: - def __init__(self, train_data, bandwidth=None, kernel_type='gaussian'): Class for kernel density estimation, based on kde_func function Made this so I could use kde_func as a method For th...
ad713e4eb15a2d9573622bace528fc86e19a6545
<|skeleton|> class KDE: def __init__(self, train_data, bandwidth=None, kernel_type='gaussian'): """Class for kernel density estimation, based on kde_func function Made this so I could use kde_func as a method For this class, training occurs inside forward Inputs: train_data (list of np.array): list of len ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KDE: def __init__(self, train_data, bandwidth=None, kernel_type='gaussian'): """Class for kernel density estimation, based on kde_func function Made this so I could use kde_func as a method For this class, training occurs inside forward Inputs: train_data (list of np.array): list of len N, with each i...
the_stack_v2_python_sparse
manipulation/plating/Darknet/pytorch-yolo-v3/prediction_utils/kernel_density.py
HARPLab/gastronomy
train
6
cc20c3f604266ee113b8ec29da059175f332656a
[ "with self.session() as session:\n query = session.query(mod.NrClasses.handle).distinct()\n return set((result.handle for result in query))", "def empty():\n return {'members': [], 'representative': None, 'name': {'class_id': None, 'full': None, 'handle': None, 'version': None, 'cutoff': cutoff}, 'releas...
<|body_start_0|> with self.session() as session: query = session.query(mod.NrClasses.handle).distinct() return set((result.handle for result in query)) <|end_body_0|> <|body_start_1|> def empty(): return {'members': [], 'representative': None, 'name': {'class_id': No...
Known
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Known: def handles(self): """Return a set of all known handles for the nr set.""" <|body_0|> def classes(self, release_id, cutoff): """Get all classes with the given resolution cutoff in the given release. If nothing is below the cutoff then an empty dictonary will b...
stack_v2_sparse_classes_75kplus_train_001831
17,502
no_license
[ { "docstring": "Return a set of all known handles for the nr set.", "name": "handles", "signature": "def handles(self)" }, { "docstring": "Get all classes with the given resolution cutoff in the given release. If nothing is below the cutoff then an empty dictonary will be returned. :release_id: ...
3
stack_v2_sparse_classes_30k_train_047380
Implement the Python class `Known` described below. Class description: Implement the Known class. Method signatures and docstrings: - def handles(self): Return a set of all known handles for the nr set. - def classes(self, release_id, cutoff): Get all classes with the given resolution cutoff in the given release. If ...
Implement the Python class `Known` described below. Class description: Implement the Known class. Method signatures and docstrings: - def handles(self): Return a set of all known handles for the nr set. - def classes(self, release_id, cutoff): Get all classes with the given resolution cutoff in the given release. If ...
1982e10a56885e56d79aac69365b9ff78c0e3d92
<|skeleton|> class Known: def handles(self): """Return a set of all known handles for the nr set.""" <|body_0|> def classes(self, release_id, cutoff): """Get all classes with the given resolution cutoff in the given release. If nothing is below the cutoff then an empty dictonary will b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Known: def handles(self): """Return a set of all known handles for the nr set.""" with self.session() as session: query = session.query(mod.NrClasses.handle).distinct() return set((result.handle for result in query)) def classes(self, release_id, cutoff): "...
the_stack_v2_python_sparse
pymotifs/nr/builder.py
BGSU-RNA/RNA-3D-Hub-core
train
3
af2b089179ebfdbf5dc6bc8b5cb01c0c7379711e
[ "with open(filename, mode=mode, encoding=encod) as f:\n eeg = f.read()\n U = np.array([float(i) for i in filter(lambda x: x, eeg.split('\\n'))])\n if shi == 0:\n return self.jinshishang(U)\n else:\n return self.jinshishangbiao(U)", "U = np.array([float(i) for i in filter(lambda x: x, dat...
<|body_start_0|> with open(filename, mode=mode, encoding=encod) as f: eeg = f.read() U = np.array([float(i) for i in filter(lambda x: x, eeg.split('\n'))]) if shi == 0: return self.jinshishang(U) else: return self.jinshishangbiao(U)...
打开文件流分析近似熵和基于二进制流分析
FileApEn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileApEn: """打开文件流分析近似熵和基于二进制流分析""" def anal_file(self, filename, mode='r', encod='utf-8', shi=0): """打开eeg的文件读取eeg数据 :param filename: :param mode: :param shi: :param encod: :return:""" <|body_0|> def anal_string(self, data: str, shi=0): """传入字符串形式的eeg数据 :param s...
stack_v2_sparse_classes_75kplus_train_001832
13,083
no_license
[ { "docstring": "打开eeg的文件读取eeg数据 :param filename: :param mode: :param shi: :param encod: :return:", "name": "anal_file", "signature": "def anal_file(self, filename, mode='r', encod='utf-8', shi=0)" }, { "docstring": "传入字符串形式的eeg数据 :param shi: :param data: :return:", "name": "anal_string", ...
2
stack_v2_sparse_classes_30k_train_052621
Implement the Python class `FileApEn` described below. Class description: 打开文件流分析近似熵和基于二进制流分析 Method signatures and docstrings: - def anal_file(self, filename, mode='r', encod='utf-8', shi=0): 打开eeg的文件读取eeg数据 :param filename: :param mode: :param shi: :param encod: :return: - def anal_string(self, data: str, shi=0): 传...
Implement the Python class `FileApEn` described below. Class description: 打开文件流分析近似熵和基于二进制流分析 Method signatures and docstrings: - def anal_file(self, filename, mode='r', encod='utf-8', shi=0): 打开eeg的文件读取eeg数据 :param filename: :param mode: :param shi: :param encod: :return: - def anal_string(self, data: str, shi=0): 传...
086fea3b84480829e25668354799ca46ad68744e
<|skeleton|> class FileApEn: """打开文件流分析近似熵和基于二进制流分析""" def anal_file(self, filename, mode='r', encod='utf-8', shi=0): """打开eeg的文件读取eeg数据 :param filename: :param mode: :param shi: :param encod: :return:""" <|body_0|> def anal_string(self, data: str, shi=0): """传入字符串形式的eeg数据 :param s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileApEn: """打开文件流分析近似熵和基于二进制流分析""" def anal_file(self, filename, mode='r', encod='utf-8', shi=0): """打开eeg的文件读取eeg数据 :param filename: :param mode: :param shi: :param encod: :return:""" with open(filename, mode=mode, encoding=encod) as f: eeg = f.read() U = np.arra...
the_stack_v2_python_sparse
sleep_eeg_analysis/apen.py
muyi110/EmotionRecognition
train
2
a3e6239e79ebc51dafdec0c46d45694f54554dbf
[ "super(TextFileStream, self).__init__(*path)\nfrom flume.proto import entity_pb2\npb = entity_pb2.PbInputFormatEntityConfig()\npb.repeatedly = True\npb.max_record_num_per_round = options.get('max_record_num_per_round', 1000)\npb.timeout_per_round = options.get('timeout_per_round', 30)\npb.file_stream.filename_patte...
<|body_start_0|> super(TextFileStream, self).__init__(*path) from flume.proto import entity_pb2 pb = entity_pb2.PbInputFormatEntityConfig() pb.repeatedly = True pb.max_record_num_per_round = options.get('max_record_num_per_round', 1000) pb.timeout_per_round = options.get(...
表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs:///multi_path1', 'hdfs:///multi_path2')) >>>...
TextFileStream
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextFileStream: """表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs://...
stack_v2_sparse_classes_75kplus_train_001833
30,720
permissive
[ { "docstring": "内部方法", "name": "__init__", "signature": "def __init__(self, *path, **options)" }, { "docstring": "内部接口", "name": "transform_from_node", "signature": "def transform_from_node(self, load_node, pipeline)" } ]
2
stack_v2_sparse_classes_30k_train_010191
Implement the Python class `TextFileStream` described below. Class description: 表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipe...
Implement the Python class `TextFileStream` described below. Class description: 表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipe...
cfcef62e8a64565b1dceb84efd4278fa83f87b7c
<|skeleton|> class TextFileStream: """表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs://...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextFileStream: """表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs:///multi_path1'...
the_stack_v2_python_sparse
bigflow_python/python/bigflow/input.py
baidu/bigflow
train
1,279
c37b220f165f42d8ec0e898a1b9a921918144260
[ "super().__init__()\nself.func = func\nself.args = args\nself.kwargs = kwargs\nself.returns = None\nself.callback = callback\nself.completed = False\nself.finished.connect(self.callitback, type=qtConnectType)", "try:\n self.returns = self.func(*self.args, **self.kwargs)\nexcept Exception as e:\n log.error(f...
<|body_start_0|> super().__init__() self.func = func self.args = args self.kwargs = kwargs self.returns = None self.callback = callback self.completed = False self.finished.connect(self.callitback, type=qtConnectType) <|end_body_0|> <|body_start_1|> ...
SmartThread is a QThread extension. It adds little, but offers an alternative interface for creating the thread and callback handling.
SmartThread
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmartThread: """SmartThread is a QThread extension. It adds little, but offers an alternative interface for creating the thread and callback handling.""" def __init__(self, func, callback, *args, qtConnectType=QtCore.Qt.AutoConnection, **kwargs): """Args: func (func): The function to...
stack_v2_sparse_classes_75kplus_train_001834
19,833
permissive
[ { "docstring": "Args: func (func): The function to run in a separate thread. callback (func): A function to receive the return value from `func`. *args (tuple): optional positional arguements to pass to `func`. qtConnectType (type): Signal synchronisity. **kwargs (dict): optional keyword arguments to pass to `f...
3
stack_v2_sparse_classes_30k_train_002620
Implement the Python class `SmartThread` described below. Class description: SmartThread is a QThread extension. It adds little, but offers an alternative interface for creating the thread and callback handling. Method signatures and docstrings: - def __init__(self, func, callback, *args, qtConnectType=QtCore.Qt.Auto...
Implement the Python class `SmartThread` described below. Class description: SmartThread is a QThread extension. It adds little, but offers an alternative interface for creating the thread and callback handling. Method signatures and docstrings: - def __init__(self, func, callback, *args, qtConnectType=QtCore.Qt.Auto...
f7f7d9f7da8d49d9ae9a72e5579b07a3b8572267
<|skeleton|> class SmartThread: """SmartThread is a QThread extension. It adds little, but offers an alternative interface for creating the thread and callback handling.""" def __init__(self, func, callback, *args, qtConnectType=QtCore.Qt.AutoConnection, **kwargs): """Args: func (func): The function to...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SmartThread: """SmartThread is a QThread extension. It adds little, but offers an alternative interface for creating the thread and callback handling.""" def __init__(self, func, callback, *args, qtConnectType=QtCore.Qt.AutoConnection, **kwargs): """Args: func (func): The function to run in a sep...
the_stack_v2_python_sparse
tinywallet/tinywallet/qutilities.py
decred/tinydecred
train
17
933b5d6b1b3ee1c924bbbb4afe4214e1f318e298
[ "self.indiceImage = 0\nself.cap = cv2.VideoCapture(fichierVideo)\nself.nbFrames = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT))", "self.indiceImage = ind\nself.cap.set(cv2.CAP_PROP_POS_FRAMES, self.indiceImage)\nret, frame = self.cap.read()\nreturn (self.indiceImage, frame)", "self.indiceImage -= 1\nif self.indic...
<|body_start_0|> self.indiceImage = 0 self.cap = cv2.VideoCapture(fichierVideo) self.nbFrames = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT)) <|end_body_0|> <|body_start_1|> self.indiceImage = ind self.cap.set(cv2.CAP_PROP_POS_FRAMES, self.indiceImage) ret, frame = self.ca...
Source d'images depuis une vidéo
SourceImagesVideo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceImagesVideo: """Source d'images depuis une vidéo""" def __init__(self, fichierVideo): """Constructeur :param fichierVideo: le fichier vidéo""" <|body_0|> def imageCourante(self, ind): """Récupération de la 'ind' ième image de la vidéo :param ind: :return: l...
stack_v2_sparse_classes_75kplus_train_001835
1,607
no_license
[ { "docstring": "Constructeur :param fichierVideo: le fichier vidéo", "name": "__init__", "signature": "def __init__(self, fichierVideo)" }, { "docstring": "Récupération de la 'ind' ième image de la vidéo :param ind: :return: la position de cette image dans la vidéo et l'image elle même (format O...
4
stack_v2_sparse_classes_30k_train_021201
Implement the Python class `SourceImagesVideo` described below. Class description: Source d'images depuis une vidéo Method signatures and docstrings: - def __init__(self, fichierVideo): Constructeur :param fichierVideo: le fichier vidéo - def imageCourante(self, ind): Récupération de la 'ind' ième image de la vidéo :...
Implement the Python class `SourceImagesVideo` described below. Class description: Source d'images depuis une vidéo Method signatures and docstrings: - def __init__(self, fichierVideo): Constructeur :param fichierVideo: le fichier vidéo - def imageCourante(self, ind): Récupération de la 'ind' ième image de la vidéo :...
461397664c5df40712be8aad90a558caa735e255
<|skeleton|> class SourceImagesVideo: """Source d'images depuis une vidéo""" def __init__(self, fichierVideo): """Constructeur :param fichierVideo: le fichier vidéo""" <|body_0|> def imageCourante(self, ind): """Récupération de la 'ind' ième image de la vidéo :param ind: :return: l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceImagesVideo: """Source d'images depuis une vidéo""" def __init__(self, fichierVideo): """Constructeur :param fichierVideo: le fichier vidéo""" self.indiceImage = 0 self.cap = cv2.VideoCapture(fichierVideo) self.nbFrames = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT)) ...
the_stack_v2_python_sparse
sourceImagesVideo.py
raiv-toulouse/generationClasseImage
train
0
36d121cf4ab8c4a21fac3cad275776852e5ea7a7
[ "super().__init__()\nself._stft = Stft(fps, window, n_perseg, n_overlap)\nif pp_params:\n self._ppkr = FilterPeakPicker(**pp_params)\nelse:\n self._ppkr = FilterPeakPicker()", "sxx = self._stft.transform(inp)\nflux = features.spectral_flux(sxx.abs, total=True)\ntimes = sxx.times.squeeze()\nodf = {'frame': (...
<|body_start_0|> super().__init__() self._stft = Stft(fps, window, n_perseg, n_overlap) if pp_params: self._ppkr = FilterPeakPicker(**pp_params) else: self._ppkr = FilterPeakPicker() <|end_body_0|> <|body_start_1|> sxx = self._stft.transform(inp) ...
Onset detection based on spectral flux.
FluxOnsetDetector
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FluxOnsetDetector: """Onset detection based on spectral flux.""" def __init__(self, fps: int, window: str='hamming', n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: """Detect onsets as local maxima in the energy difference of consecutive stft time ste...
stack_v2_sparse_classes_75kplus_train_001836
8,907
permissive
[ { "docstring": "Detect onsets as local maxima in the energy difference of consecutive stft time steps. Args: fps: Sample rate. window: Name of window function. n_perseg: Samples per segment. n_overlap: Numnber of overlapping samples per segment. pp_params: Keyword args for peak picking.", "name": "__init__"...
2
stack_v2_sparse_classes_30k_train_037165
Implement the Python class `FluxOnsetDetector` described below. Class description: Onset detection based on spectral flux. Method signatures and docstrings: - def __init__(self, fps: int, window: str='hamming', n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: Detect onsets as local max...
Implement the Python class `FluxOnsetDetector` described below. Class description: Onset detection based on spectral flux. Method signatures and docstrings: - def __init__(self, fps: int, window: str='hamming', n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: Detect onsets as local max...
c733591240f3a4d3825d61385bd19262bd76b43b
<|skeleton|> class FluxOnsetDetector: """Onset detection based on spectral flux.""" def __init__(self, fps: int, window: str='hamming', n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: """Detect onsets as local maxima in the energy difference of consecutive stft time ste...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FluxOnsetDetector: """Onset detection based on spectral flux.""" def __init__(self, fps: int, window: str='hamming', n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: """Detect onsets as local maxima in the energy difference of consecutive stft time steps. Args: fps...
the_stack_v2_python_sparse
src/apollon/onsets.py
TimZiemer/apollon
train
0
bb47d3758f831aeb3f9a276dacfb4b9fac0b37ce
[ "self.s = compressedString\nself.char = 0\nself.num = 0\nself.count = 0", "if self.hasNext():\n self.count -= 1\n return self.s[self.char]\nreturn ' '", "if self.char > len(self.s):\n return False\nif self.count == 0:\n self.char = self.num\n tmp = self.char + 1\n a = ''\n while tmp < len(s...
<|body_start_0|> self.s = compressedString self.char = 0 self.num = 0 self.count = 0 <|end_body_0|> <|body_start_1|> if self.hasNext(): self.count -= 1 return self.s[self.char] return ' ' <|end_body_1|> <|body_start_2|> if self.char > len...
StringIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_75kplus_train_001837
1,062
no_license
[ { "docstring": ":type compressedString: str", "name": "__init__", "signature": "def __init__(self, compressedString)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasN...
3
null
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool <|skeleton|> class StringIterator: ...
d8c3be5937c54b740ebccd0b373a67ece46773f3
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" self.s = compressedString self.char = 0 self.num = 0 self.count = 0 def next(self): """:rtype: str""" if self.hasNext(): self.count -= 1 ...
the_stack_v2_python_sparse
Design Compressed String Iterator.py
shank54/Leetcode
train
0
84efe49c9c908c131952f8070c2d00f556ce3776
[ "self.url = api_reverse('authentication:email_password')\nself.register_url = api_reverse('authentication:user-registration')\nself.user = {'user': {'username': 'kevin', 'email': 'koechkevin92@gmail.com', 'password': 'Kevin12345'}}\nself.client.post(self.register_url, self.user, format='json')\nUser.is_active = Tru...
<|body_start_0|> self.url = api_reverse('authentication:email_password') self.register_url = api_reverse('authentication:user-registration') self.user = {'user': {'username': 'kevin', 'email': 'koechkevin92@gmail.com', 'password': 'Kevin12345'}} self.client.post(self.register_url, self.u...
test for class to send password reset link to email
TestEmailSent
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEmailSent: """test for class to send password reset link to email""" def setUp(self): """set up method to test email to be sent endpoint""" <|body_0|> def test_unregistered_email(self): """case where unregistered user tries to request a password""" <|...
stack_v2_sparse_classes_75kplus_train_001838
7,001
permissive
[ { "docstring": "set up method to test email to be sent endpoint", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "case where unregistered user tries to request a password", "name": "test_unregistered_email", "signature": "def test_unregistered_email(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_012246
Implement the Python class `TestEmailSent` described below. Class description: test for class to send password reset link to email Method signatures and docstrings: - def setUp(self): set up method to test email to be sent endpoint - def test_unregistered_email(self): case where unregistered user tries to request a p...
Implement the Python class `TestEmailSent` described below. Class description: test for class to send password reset link to email Method signatures and docstrings: - def setUp(self): set up method to test email to be sent endpoint - def test_unregistered_email(self): case where unregistered user tries to request a p...
a14ffcac494053ff338aa7f0a5524062964a49cc
<|skeleton|> class TestEmailSent: """test for class to send password reset link to email""" def setUp(self): """set up method to test email to be sent endpoint""" <|body_0|> def test_unregistered_email(self): """case where unregistered user tries to request a password""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestEmailSent: """test for class to send password reset link to email""" def setUp(self): """set up method to test email to be sent endpoint""" self.url = api_reverse('authentication:email_password') self.register_url = api_reverse('authentication:user-registration') self....
the_stack_v2_python_sparse
authors/apps/authentication/test_password_reset.py
andela/ah-shakas
train
1
85870ff7d1ef4825a60fcac61adcd2ffe2093fe4
[ "self.centre = centre\nself.probe_height = probe_height\nself.path = path\nif model_array_list:\n self.model_array_list = model_array_list\nelse:\n with h5py.File('data/{}/data_files/model_array_list'.format(self.path), 'r') as model_data_file:\n self.model_array_list = model_data_file['array_list'][:]...
<|body_start_0|> self.centre = centre self.probe_height = probe_height self.path = path if model_array_list: self.model_array_list = model_array_list else: with h5py.File('data/{}/data_files/model_array_list'.format(self.path), 'r') as model_data_file: ...
A class for the ECG analysis of model data.
ECG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ECG: """A class for the ECG analysis of model data.""" def __init__(self, centre, probe_height, path, model_array_list=None): """ECG Initialisation :param centre: The point of ecg contact on the surface :param probe_height: Height of the probe above the surface :param path: The path ...
stack_v2_sparse_classes_75kplus_train_001839
3,941
no_license
[ { "docstring": "ECG Initialisation :param centre: The point of ecg contact on the surface :param probe_height: Height of the probe above the surface :param path: The path for data to read and view", "name": "__init__", "signature": "def __init__(self, centre, probe_height, path, model_array_list=None)" ...
4
stack_v2_sparse_classes_30k_train_013616
Implement the Python class `ECG` described below. Class description: A class for the ECG analysis of model data. Method signatures and docstrings: - def __init__(self, centre, probe_height, path, model_array_list=None): ECG Initialisation :param centre: The point of ecg contact on the surface :param probe_height: Hei...
Implement the Python class `ECG` described below. Class description: A class for the ECG analysis of model data. Method signatures and docstrings: - def __init__(self, centre, probe_height, path, model_array_list=None): ECG Initialisation :param centre: The point of ecg contact on the surface :param probe_height: Hei...
b6e847a64aeffe2609b427d05530a49e7607a122
<|skeleton|> class ECG: """A class for the ECG analysis of model data.""" def __init__(self, centre, probe_height, path, model_array_list=None): """ECG Initialisation :param centre: The point of ecg contact on the surface :param probe_height: Height of the probe above the surface :param path: The path ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ECG: """A class for the ECG analysis of model data.""" def __init__(self, centre, probe_height, path, model_array_list=None): """ECG Initialisation :param centre: The point of ecg contact on the surface :param probe_height: Height of the probe above the surface :param path: The path for data to r...
the_stack_v2_python_sparse
ecg.py
anthonyli358/Atrial-Fibrillation-CMP
train
3
fb6e51f3f5ecd74dc41dfbade1c4059fae3f90dd
[ "args = parse_base.parse_args()\npid = args.get('pid')\nname = args.get('name')\nurl = args.get('url')\nicon = args.get('icon')\nsort = args.get('sort')\n_data = Menu.query.filter_by(name=name, is_del='0').first()\nif _data:\n abort(RET.Forbidden, msg='菜单已存在')\nmodel_data = Menu()\nmodel_data.pid = pid\nmodel_da...
<|body_start_0|> args = parse_base.parse_args() pid = args.get('pid') name = args.get('name') url = args.get('url') icon = args.get('icon') sort = args.get('sort') _data = Menu.query.filter_by(name=name, is_del='0').first() if _data: abort(RET....
MenuResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MenuResource: def post(self): """添加菜单""" <|body_0|> def put(self): """修改菜单""" <|body_1|> def get(self): """获取菜单树""" <|body_2|> def delete(self): """删除菜单""" <|body_3|> <|end_skeleton|> <|body_start_0|> args =...
stack_v2_sparse_classes_75kplus_train_001840
5,254
permissive
[ { "docstring": "添加菜单", "name": "post", "signature": "def post(self)" }, { "docstring": "修改菜单", "name": "put", "signature": "def put(self)" }, { "docstring": "获取菜单树", "name": "get", "signature": "def get(self)" }, { "docstring": "删除菜单", "name": "delete", "s...
4
stack_v2_sparse_classes_30k_train_021284
Implement the Python class `MenuResource` described below. Class description: Implement the MenuResource class. Method signatures and docstrings: - def post(self): 添加菜单 - def put(self): 修改菜单 - def get(self): 获取菜单树 - def delete(self): 删除菜单
Implement the Python class `MenuResource` described below. Class description: Implement the MenuResource class. Method signatures and docstrings: - def post(self): 添加菜单 - def put(self): 修改菜单 - def get(self): 获取菜单树 - def delete(self): 删除菜单 <|skeleton|> class MenuResource: def post(self): """添加菜单""" ...
35ddd2946bf4c97806bb38057a7dc9d6fa97c118
<|skeleton|> class MenuResource: def post(self): """添加菜单""" <|body_0|> def put(self): """修改菜单""" <|body_1|> def get(self): """获取菜单树""" <|body_2|> def delete(self): """删除菜单""" <|body_3|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MenuResource: def post(self): """添加菜单""" args = parse_base.parse_args() pid = args.get('pid') name = args.get('name') url = args.get('url') icon = args.get('icon') sort = args.get('sort') _data = Menu.query.filter_by(name=name, is_del='0').first(...
the_stack_v2_python_sparse
service/app/apis/admin/menu.py
xuannanxan/maitul-manage
train
0
3f3fc88d845948a9a5a8b18518fab01e5bfbca6f
[ "super().__init__(log_root=log_root)\nlog = self.log\nlog.debug(f'In {__name__}')\nself.config = config\nself.out = out\nself.csv = csv\nself.generate_config(get_element)\nself.write_csv()", "log = self.log\nnew_config: Dict = {}\nfor section in ['Parameter', 'Dimension', 'Paths', 'Model']:\n new_config[sectio...
<|body_start_0|> super().__init__(log_root=log_root) log = self.log log.debug(f'In {__name__}') self.config = config self.out = out self.csv = csv self.generate_config(get_element) self.write_csv() <|end_body_0|> <|body_start_1|> log = self.log ...
Creates an output object. Supply a callback that provides each model element in turn since we we cannot pass it. For while mutual import fails so instead we need a callback so that output and run through all the elements of model. http://effbot.org/pyfaq/how-can-i-have-modules-that-mutually-import-each-other.htm
Output
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Output: """Creates an output object. Supply a callback that provides each model element in turn since we we cannot pass it. For while mutual import fails so instead we need a callback so that output and run through all the elements of model. http://effbot.org/pyfaq/how-can-i-have-modules-that-mut...
stack_v2_sparse_classes_75kplus_train_001841
2,525
no_license
[ { "docstring": "Do the initializing. Generate the config files", "name": "__init__", "signature": "def __init__(self, get_element: Callable, config: confuse.Configuration, log_root: Log=None, out: str=None, csv: str=None)" }, { "docstring": "Generate a new config yaml.", "name": "generate_co...
4
stack_v2_sparse_classes_30k_train_042163
Implement the Python class `Output` described below. Class description: Creates an output object. Supply a callback that provides each model element in turn since we we cannot pass it. For while mutual import fails so instead we need a callback so that output and run through all the elements of model. http://effbot.or...
Implement the Python class `Output` described below. Class description: Creates an output object. Supply a callback that provides each model element in turn since we we cannot pass it. For while mutual import fails so instead we need a callback so that output and run through all the elements of model. http://effbot.or...
93b0ddddd872f953feec46025aef80a990e6bbeb
<|skeleton|> class Output: """Creates an output object. Supply a callback that provides each model element in turn since we we cannot pass it. For while mutual import fails so instead we need a callback so that output and run through all the elements of model. http://effbot.org/pyfaq/how-can-i-have-modules-that-mut...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Output: """Creates an output object. Supply a callback that provides each model element in turn since we we cannot pass it. For while mutual import fails so instead we need a callback so that output and run through all the elements of model. http://effbot.org/pyfaq/how-can-i-have-modules-that-mutually-import-...
the_stack_v2_python_sparse
restart/output.py
dcaseykc/restart
train
0
cd48833b863aff8281ade0f95007e878b3e4d79c
[ "if not grid or not grid[0]:\n return 0\nn, m = (len(grid), len(grid[0]))\nmemo = {}\nmemo[0, 0] = 0\nvisited = set()\n\ndef dfs(i, j):\n \"\"\"From (i, j) to (n-1, m-1)\"\"\"\n if i == n - 1 and j == m - 1:\n return grid[i][j]\n ret = float('inf')\n for di, dj in ((-1, 0), (1, 0), (0, 1), (0,...
<|body_start_0|> if not grid or not grid[0]: return 0 n, m = (len(grid), len(grid[0])) memo = {} memo[0, 0] = 0 visited = set() def dfs(i, j): """From (i, j) to (n-1, m-1)""" if i == n - 1 and j == m - 1: return grid[i]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swimInWater(self, grid: List[List[int]]) -> int: """DFS, brute-force searching every path to find min elebation""" <|body_0|> def swimInWater(self, grid: List[List[int]]) -> int: """BFS with a heap""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_001842
3,928
no_license
[ { "docstring": "DFS, brute-force searching every path to find min elebation", "name": "swimInWater", "signature": "def swimInWater(self, grid: List[List[int]]) -> int" }, { "docstring": "BFS with a heap", "name": "swimInWater", "signature": "def swimInWater(self, grid: List[List[int]]) -...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swimInWater(self, grid: List[List[int]]) -> int: DFS, brute-force searching every path to find min elebation - def swimInWater(self, grid: List[List[int]]) -> int: BFS with a...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swimInWater(self, grid: List[List[int]]) -> int: DFS, brute-force searching every path to find min elebation - def swimInWater(self, grid: List[List[int]]) -> int: BFS with a...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def swimInWater(self, grid: List[List[int]]) -> int: """DFS, brute-force searching every path to find min elebation""" <|body_0|> def swimInWater(self, grid: List[List[int]]) -> int: """BFS with a heap""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def swimInWater(self, grid: List[List[int]]) -> int: """DFS, brute-force searching every path to find min elebation""" if not grid or not grid[0]: return 0 n, m = (len(grid), len(grid[0])) memo = {} memo[0, 0] = 0 visited = set() d...
the_stack_v2_python_sparse
leetcode/solved/794_Swim_in_Rising_Water/solution.py
sungminoh/algorithms
train
0
9f8638b0a12fd5110d7d6514ae311c5f1bd35a44
[ "self.mnemonic = mnemonic\nself.value = value\ncondition.cond_time_pairs.append(self.cond_true_time())", "temp_start: float = []\ntemp_end: float = []\nfor key in self.mnemonic:\n if float(key['value']) > self.value:\n temp_start.append(key['time'])\n else:\n temp_end.append(key['time'])\ntime...
<|body_start_0|> self.mnemonic = mnemonic self.value = value condition.cond_time_pairs.append(self.cond_true_time()) <|end_body_0|> <|body_start_1|> temp_start: float = [] temp_end: float = [] for key in self.mnemonic: if float(key['value']) > self.value: ...
Class to hold single "greater than" subcondition
greater
[ "BSD-3-Clause", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class greater: """Class to hold single "greater than" subcondition""" def __init__(self, mnemonic, value): """Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal state...
stack_v2_sparse_classes_75kplus_train_001843
13,097
permissive
[ { "docstring": "Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal statement", "name": "__init__", "signature": "def __init__(self, mnemonic, value)" }, { "docstring": "Fil...
2
stack_v2_sparse_classes_30k_train_005536
Implement the Python class `greater` described below. Class description: Class to hold single "greater than" subcondition Method signatures and docstrings: - def __init__(self, mnemonic, value): Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding...
Implement the Python class `greater` described below. Class description: Class to hold single "greater than" subcondition Method signatures and docstrings: - def __init__(self, mnemonic, value): Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding...
2ae74c51594925f81dde2f28b51548ffcdc257fd
<|skeleton|> class greater: """Class to hold single "greater than" subcondition""" def __init__(self, mnemonic, value): """Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal state...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class greater: """Class to hold single "greater than" subcondition""" def __init__(self, mnemonic, value): """Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal statement""" ...
the_stack_v2_python_sparse
jwql/instrument_monitors/nirspec_monitors/data_trending/utils/condition.py
catherine-martlin/jwql
train
1
6e727787fe429458b3130f60bde5b363c6c4d129
[ "skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.preface.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Preface', self, '')\nself.openWikiManualHelpPage =...
<|body_start_0|> skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.preface.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Preface', self, '') ...
A class to handle the preface settings.
PrefaceRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrefaceRepository: """A class to handle the preface settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Preface button has been clicked.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_001844
11,424
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Preface button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
null
Implement the Python class `PrefaceRepository` described below. Class description: A class to handle the preface settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Preface button has been clicked.
Implement the Python class `PrefaceRepository` described below. Class description: A class to handle the preface settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Preface button has been clicked. <|skeleton|> class Pref...
c1b00a76f1550df2cbb457248205159e51fd4308
<|skeleton|> class PrefaceRepository: """A class to handle the preface settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Preface button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrefaceRepository: """A class to handle the preface settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.preface.html', self) se...
the_stack_v2_python_sparse
skeinforge_application/skeinforge_plugins/craft_plugins/preface.py
amsler/skeinforge
train
10
ca503d562b8869c3e28912cd29f20e76adfc2b06
[ "self.id = ItemId(id_)\nself.entry_point = EntryPoint[ItemType](entry_point)\nself._class_kwargs = {} if class_kwargs is None else class_kwargs\nself._kwargs = {} if kwargs is None else kwargs", "_kwargs = self._kwargs.copy()\n_kwargs.update(kwargs)\ncls = self.get_class()\nitem = cls(**_kwargs)\nreturn item", ...
<|body_start_0|> self.id = ItemId(id_) self.entry_point = EntryPoint[ItemType](entry_point) self._class_kwargs = {} if class_kwargs is None else class_kwargs self._kwargs = {} if kwargs is None else kwargs <|end_body_0|> <|body_start_1|> _kwargs = self._kwargs.copy() _kw...
A specification for a particular instance of an object.
ItemSpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemSpec: """A specification for a particular instance of an object.""" def __init__(self, id_: ItemId, entry_point: EntryPoint[ItemType], class_kwargs: Optional[Dict[str, Any]]=None, **kwargs: Dict) -> None: """Initialize an item specification. :param id_: the id associated to this ...
stack_v2_sparse_classes_75kplus_train_001845
9,473
permissive
[ { "docstring": "Initialize an item specification. :param id_: the id associated to this specification :param entry_point: The Python entry_point of the environment class (e.g. module.name:Class). :param class_kwargs: keyword arguments to be attached on the class as class variables. :param kwargs: other custom k...
3
stack_v2_sparse_classes_30k_train_034445
Implement the Python class `ItemSpec` described below. Class description: A specification for a particular instance of an object. Method signatures and docstrings: - def __init__(self, id_: ItemId, entry_point: EntryPoint[ItemType], class_kwargs: Optional[Dict[str, Any]]=None, **kwargs: Dict) -> None: Initialize an i...
Implement the Python class `ItemSpec` described below. Class description: A specification for a particular instance of an object. Method signatures and docstrings: - def __init__(self, id_: ItemId, entry_point: EntryPoint[ItemType], class_kwargs: Optional[Dict[str, Any]]=None, **kwargs: Dict) -> None: Initialize an i...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class ItemSpec: """A specification for a particular instance of an object.""" def __init__(self, id_: ItemId, entry_point: EntryPoint[ItemType], class_kwargs: Optional[Dict[str, Any]]=None, **kwargs: Dict) -> None: """Initialize an item specification. :param id_: the id associated to this ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItemSpec: """A specification for a particular instance of an object.""" def __init__(self, id_: ItemId, entry_point: EntryPoint[ItemType], class_kwargs: Optional[Dict[str, Any]]=None, **kwargs: Dict) -> None: """Initialize an item specification. :param id_: the id associated to this specification...
the_stack_v2_python_sparse
aea/crypto/registries/base.py
fetchai/agents-aea
train
192
901fa2772e6626eea738b5b35502f44487eef97b
[ "self.directory = directory\nself.files_summary = dict()\nself.analyze_files()", "try:\n files = os.listdir(self.directory)\nexcept FileNotFoundError:\n raise FileNotFoundError(f\"Can't open {self.directory}\")\nelse:\n for doc in files:\n if doc.endswith('.py'):\n num_lines = 0\n ...
<|body_start_0|> self.directory = directory self.files_summary = dict() self.analyze_files() <|end_body_0|> <|body_start_1|> try: files = os.listdir(self.directory) except FileNotFoundError: raise FileNotFoundError(f"Can't open {self.directory}") ...
FileAnalyzer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileAnalyzer: def __init__(self, directory): """Function __init__ initializes the directory, files_summary and function analyze_files.""" <|body_0|> def analyze_files(self): """Function analyze_files reads a directory and returns the total number of characters, funct...
stack_v2_sparse_classes_75kplus_train_001846
3,706
no_license
[ { "docstring": "Function __init__ initializes the directory, files_summary and function analyze_files.", "name": "__init__", "signature": "def __init__(self, directory)" }, { "docstring": "Function analyze_files reads a directory and returns the total number of characters, functions, classes, an...
3
stack_v2_sparse_classes_30k_train_017772
Implement the Python class `FileAnalyzer` described below. Class description: Implement the FileAnalyzer class. Method signatures and docstrings: - def __init__(self, directory): Function __init__ initializes the directory, files_summary and function analyze_files. - def analyze_files(self): Function analyze_files re...
Implement the Python class `FileAnalyzer` described below. Class description: Implement the FileAnalyzer class. Method signatures and docstrings: - def __init__(self, directory): Function __init__ initializes the directory, files_summary and function analyze_files. - def analyze_files(self): Function analyze_files re...
6fea7b54756f30e1f44d1019853f3dd88e2e905b
<|skeleton|> class FileAnalyzer: def __init__(self, directory): """Function __init__ initializes the directory, files_summary and function analyze_files.""" <|body_0|> def analyze_files(self): """Function analyze_files reads a directory and returns the total number of characters, funct...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileAnalyzer: def __init__(self, directory): """Function __init__ initializes the directory, files_summary and function analyze_files.""" self.directory = directory self.files_summary = dict() self.analyze_files() def analyze_files(self): """Function analyze_files ...
the_stack_v2_python_sparse
HW08_Ejona_Kocibelli.py
ekocibelli/Special-Topics-in-SE
train
0
ade82999cd973b7b507db3c29792f87f34fdce31
[ "for key, value in data.iteritems():\n ob_value = getattr(ob, key)\n n_msg = msg + ' data[\"{0}\"] != ob.{0}, {1} != {2}'.format(key, value, ob_value)\n self.assertEquals(ob_value, value, n_msg)", "def get_set(model):\n return set(model.objects.all())\n\nclass GetattrProxy(object):\n ob = None\n\n ...
<|body_start_0|> for key, value in data.iteritems(): ob_value = getattr(ob, key) n_msg = msg + ' data["{0}"] != ob.{0}, {1} != {2}'.format(key, value, ob_value) self.assertEquals(ob_value, value, n_msg) <|end_body_0|> <|body_start_1|> def get_set(model): ...
TestHelpersMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHelpersMixin: def assertObjectMatchesData(self, ob, data, msg=''): """Checks that every field in the data exists in the object and is the same""" <|body_0|> def new_item(self, kind): """Finds and returns the new item of the specified kind created in the context""...
stack_v2_sparse_classes_75kplus_train_001847
3,180
no_license
[ { "docstring": "Checks that every field in the data exists in the object and is the same", "name": "assertObjectMatchesData", "signature": "def assertObjectMatchesData(self, ob, data, msg='')" }, { "docstring": "Finds and returns the new item of the specified kind created in the context", "n...
2
null
Implement the Python class `TestHelpersMixin` described below. Class description: Implement the TestHelpersMixin class. Method signatures and docstrings: - def assertObjectMatchesData(self, ob, data, msg=''): Checks that every field in the data exists in the object and is the same - def new_item(self, kind): Finds an...
Implement the Python class `TestHelpersMixin` described below. Class description: Implement the TestHelpersMixin class. Method signatures and docstrings: - def assertObjectMatchesData(self, ob, data, msg=''): Checks that every field in the data exists in the object and is the same - def new_item(self, kind): Finds an...
cbb94c5748dd8fe2117d1fb66491d4f7404e32b9
<|skeleton|> class TestHelpersMixin: def assertObjectMatchesData(self, ob, data, msg=''): """Checks that every field in the data exists in the object and is the same""" <|body_0|> def new_item(self, kind): """Finds and returns the new item of the specified kind created in the context""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestHelpersMixin: def assertObjectMatchesData(self, ob, data, msg=''): """Checks that every field in the data exists in the object and is the same""" for key, value in data.iteritems(): ob_value = getattr(ob, key) n_msg = msg + ' data["{0}"] != ob.{0}, {1} != {2}'.forma...
the_stack_v2_python_sparse
tienda_ecuador_project/accounts_receivable/testsuite/helpers.py
javcasas/tienda_ecuador
train
2
346a239096bad2bf87dd82454cc9178ca5cacf84
[ "self.enabled = enabled\nself.spare_serial = spare_serial\nself.uplink_mode = uplink_mode\nself.virtual_ip_1 = virtual_ip_1\nself.virtual_ip_2 = virtual_ip_2", "if dictionary is None:\n return None\nenabled = dictionary.get('enabled')\nspare_serial = dictionary.get('spareSerial')\nuplink_mode = dictionary.get(...
<|body_start_0|> self.enabled = enabled self.spare_serial = spare_serial self.uplink_mode = uplink_mode self.virtual_ip_1 = virtual_ip_1 self.virtual_ip_2 = virtual_ip_2 <|end_body_0|> <|body_start_1|> if dictionary is None: return None enabled = dict...
Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual or public virtual_ip_1 (string): The WAN 1 shared IP virtual_i...
UpdateNetworkWarmSpareSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkWarmSpareSettingsModel: """Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual...
stack_v2_sparse_classes_75kplus_train_001848
2,514
permissive
[ { "docstring": "Constructor for the UpdateNetworkWarmSpareSettingsModel class", "name": "__init__", "signature": "def __init__(self, enabled=None, spare_serial=None, uplink_mode=None, virtual_ip_1=None, virtual_ip_2=None)" }, { "docstring": "Creates an instance of this model from a dictionary Ar...
2
stack_v2_sparse_classes_30k_train_007338
Implement the Python class `UpdateNetworkWarmSpareSettingsModel` described below. Class description: Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mod...
Implement the Python class `UpdateNetworkWarmSpareSettingsModel` described below. Class description: Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mod...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkWarmSpareSettingsModel: """Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateNetworkWarmSpareSettingsModel: """Implementation of the 'updateNetworkWarmSpareSettings' model. TODO: type model description here. Attributes: enabled (bool): Enable warm spare spare_serial (string): Serial number of the warm spare appliance uplink_mode (string): Uplink mode, either virtual or public vi...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_warm_spare_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
67fde1c2bb2e041b9a0d5ba2b2bb9aab02982488
[ "updated_grid = [[self.update_cell(row, col) for col in range(self.get_grid_width())] for row in range(self.get_grid_height())]\nfor col in range(self.get_grid_width()):\n for row in range(self.get_grid_height()):\n if updated_grid[row][col] == EMPTY:\n self.set_empty(row, col)\n else:\n...
<|body_start_0|> updated_grid = [[self.update_cell(row, col) for col in range(self.get_grid_width())] for row in range(self.get_grid_height())] for col in range(self.get_grid_width()): for row in range(self.get_grid_height()): if updated_grid[row][col] == EMPTY: ...
Extend Grid class to support Game of Life
GameOfLife
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameOfLife: """Extend Grid class to support Game of Life""" def update_gol(self): """Function that performs one step of the Game of Life""" <|body_0|> def update_cell(self, row, col): """Function that computes the update for one cell in the Game of Life""" ...
stack_v2_sparse_classes_75kplus_train_001849
1,456
no_license
[ { "docstring": "Function that performs one step of the Game of Life", "name": "update_gol", "signature": "def update_gol(self)" }, { "docstring": "Function that computes the update for one cell in the Game of Life", "name": "update_cell", "signature": "def update_cell(self, row, col)" ...
2
stack_v2_sparse_classes_30k_train_035119
Implement the Python class `GameOfLife` described below. Class description: Extend Grid class to support Game of Life Method signatures and docstrings: - def update_gol(self): Function that performs one step of the Game of Life - def update_cell(self, row, col): Function that computes the update for one cell in the G...
Implement the Python class `GameOfLife` described below. Class description: Extend Grid class to support Game of Life Method signatures and docstrings: - def update_gol(self): Function that performs one step of the Game of Life - def update_cell(self, row, col): Function that computes the update for one cell in the G...
8d3000467be6ccef812dec0d9e95e108551f8b3b
<|skeleton|> class GameOfLife: """Extend Grid class to support Game of Life""" def update_gol(self): """Function that performs one step of the Game of Life""" <|body_0|> def update_cell(self, row, col): """Function that computes the update for one cell in the Game of Life""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GameOfLife: """Extend Grid class to support Game of Life""" def update_gol(self): """Function that performs one step of the Game of Life""" updated_grid = [[self.update_cell(row, col) for col in range(self.get_grid_width())] for row in range(self.get_grid_height())] for col in ran...
the_stack_v2_python_sparse
principles_of_computing/pj5/gameoflife.py
creasyw/Courses
train
2
47e08fd0f2a61952b22471808d43a191ce09b77d
[ "super(LocalAffine, self).__init__()\nself.A = nn.Parameter(torch.eye(3).unsqueeze(0).unsqueeze(0).repeat(batch_size, num_points, 1, 1))\nself.b = nn.Parameter(torch.zeros(3).unsqueeze(0).unsqueeze(0).unsqueeze(3).repeat(batch_size, num_points, 1, 1))\nself.edges = edges\nself.num_points = num_points", "if self.e...
<|body_start_0|> super(LocalAffine, self).__init__() self.A = nn.Parameter(torch.eye(3).unsqueeze(0).unsqueeze(0).repeat(batch_size, num_points, 1, 1)) self.b = nn.Parameter(torch.zeros(3).unsqueeze(0).unsqueeze(0).unsqueeze(3).repeat(batch_size, num_points, 1, 1)) self.edges = edges ...
LocalAffine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalAffine: def __init__(self, num_points, batch_size=1, edges=None): """specify the number of points, the number of points should be constant across the batch and the edges torch.Longtensor() with shape N * 2 the local affine operator supports batch operation batch size must be constan...
stack_v2_sparse_classes_75kplus_train_001850
2,141
permissive
[ { "docstring": "specify the number of points, the number of points should be constant across the batch and the edges torch.Longtensor() with shape N * 2 the local affine operator supports batch operation batch size must be constant add additional pooling on top of w matrix", "name": "__init__", "signatu...
3
stack_v2_sparse_classes_30k_train_010621
Implement the Python class `LocalAffine` described below. Class description: Implement the LocalAffine class. Method signatures and docstrings: - def __init__(self, num_points, batch_size=1, edges=None): specify the number of points, the number of points should be constant across the batch and the edges torch.Longten...
Implement the Python class `LocalAffine` described below. Class description: Implement the LocalAffine class. Method signatures and docstrings: - def __init__(self, num_points, batch_size=1, edges=None): specify the number of points, the number of points should be constant across the batch and the edges torch.Longten...
099f189b749154e97d0f6fa5a1e16e8fb885cce0
<|skeleton|> class LocalAffine: def __init__(self, num_points, batch_size=1, edges=None): """specify the number of points, the number of points should be constant across the batch and the edges torch.Longtensor() with shape N * 2 the local affine operator supports batch operation batch size must be constan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocalAffine: def __init__(self, num_points, batch_size=1, edges=None): """specify the number of points, the number of points should be constant across the batch and the edges torch.Longtensor() with shape N * 2 the local affine operator supports batch operation batch size must be constant add addition...
the_stack_v2_python_sparse
local_affine.py
YeahEstherChan/pytorch-nicp
train
0
8802c64c6c2298f82ed4bec3814b6ad1f05b0eee
[ "if num == 0:\n return 0\nnum = num % 9\nreturn 9 if num == 0 else num", "if 0 <= num < 10:\n return num\nnew_num = 0\nwhile num != 0:\n num, left = divmod(num, 10)\n new_num += left\nreturn self.addDigits(new_num)" ]
<|body_start_0|> if num == 0: return 0 num = num % 9 return 9 if num == 0 else num <|end_body_0|> <|body_start_1|> if 0 <= num < 10: return num new_num = 0 while num != 0: num, left = divmod(num, 10) new_num += left ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addDigits(self, num: int) -> int: """Just print 0~50 to see the result. Runtime: 48 ms, faster than 37.91% Memory Usage: 13.8 MB, less than 91.66% 0 <= num <= 2^31 - 1 :param num: :return:""" <|body_0|> def addDigits2(self, num: int) -> int: """0 <= num...
stack_v2_sparse_classes_75kplus_train_001851
1,025
permissive
[ { "docstring": "Just print 0~50 to see the result. Runtime: 48 ms, faster than 37.91% Memory Usage: 13.8 MB, less than 91.66% 0 <= num <= 2^31 - 1 :param num: :return:", "name": "addDigits", "signature": "def addDigits(self, num: int) -> int" }, { "docstring": "0 <= num <= 2^31 - 1 :param num: :...
2
stack_v2_sparse_classes_30k_train_040573
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num: int) -> int: Just print 0~50 to see the result. Runtime: 48 ms, faster than 37.91% Memory Usage: 13.8 MB, less than 91.66% 0 <= num <= 2^31 - 1 :param nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addDigits(self, num: int) -> int: Just print 0~50 to see the result. Runtime: 48 ms, faster than 37.91% Memory Usage: 13.8 MB, less than 91.66% 0 <= num <= 2^31 - 1 :param nu...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def addDigits(self, num: int) -> int: """Just print 0~50 to see the result. Runtime: 48 ms, faster than 37.91% Memory Usage: 13.8 MB, less than 91.66% 0 <= num <= 2^31 - 1 :param num: :return:""" <|body_0|> def addDigits2(self, num: int) -> int: """0 <= num...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addDigits(self, num: int) -> int: """Just print 0~50 to see the result. Runtime: 48 ms, faster than 37.91% Memory Usage: 13.8 MB, less than 91.66% 0 <= num <= 2^31 - 1 :param num: :return:""" if num == 0: return 0 num = num % 9 return 9 if num == 0 els...
the_stack_v2_python_sparse
src/258-AddDigits.py
Jiezhi/myleetcode
train
1
65025ea88ff837003cb63347231f4644b40a2846
[ "if isinstance(instances, Dict):\n payloads = self._generate_payloads(instances=instances)\nelif isinstance(instances, List):\n payloads = instances\nelse:\n instances_dict = instances.to_dict(orient='index')\n payloads = self._generate_payloads(instances=instances_dict)\n_LOGGER.log_action_start_agains...
<|body_start_0|> if isinstance(instances, Dict): payloads = self._generate_payloads(instances=instances) elif isinstance(instances, List): payloads = instances else: instances_dict = instances.to_dict(orient='index') payloads = self._generate_paylo...
Preview EntityType resource for Vertex AI.
EntityType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityType: """Preview EntityType resource for Vertex AI.""" def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float, bool, bytes, List[int], List[str], List[float], List[bool]]]], 'pd....
stack_v2_sparse_classes_75kplus_train_001852
10,796
permissive
[ { "docstring": "Streaming ingestion. Write feature values directly to Feature Store. ``` my_entity_type = aiplatform.EntityType( entity_type_name=\"my_entity_type_id\", featurestore_id=\"my_featurestore_id\", ) # writing feature values from a pandas DataFrame my_dataframe = pd.DataFrame( data = [ {\"entity_id\"...
3
stack_v2_sparse_classes_30k_train_050946
Implement the Python class `EntityType` described below. Class description: Preview EntityType resource for Vertex AI. Method signatures and docstrings: - def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float,...
Implement the Python class `EntityType` described below. Class description: Preview EntityType resource for Vertex AI. Method signatures and docstrings: - def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float,...
76b95b92c1d3b87c72d754d8c02b1bca652b9a27
<|skeleton|> class EntityType: """Preview EntityType resource for Vertex AI.""" def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float, bool, bytes, List[int], List[str], List[float], List[bool]]]], 'pd....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntityType: """Preview EntityType resource for Vertex AI.""" def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float, bool, bytes, List[int], List[str], List[float], List[bool]]]], 'pd.DataFrame']) ...
the_stack_v2_python_sparse
google/cloud/aiplatform/preview/featurestore/entity_type.py
googleapis/python-aiplatform
train
418
5a319ae2510924066495d4b39bbb3a2ce0265667
[ "self._t0 = t0\nself._coeff_list = coeff_list\nself._slant_range_time_interval = slant_range_time_interval\nself._slant_range_time = slant_range_time", "res = 0\nfor index, coeff in enumerate(self._coeff_list):\n res += coeff * (t * self._slant_range_time_interval + self._slant_range_time - self._t0) ** index\...
<|body_start_0|> self._t0 = t0 self._coeff_list = coeff_list self._slant_range_time_interval = slant_range_time_interval self._slant_range_time = slant_range_time <|end_body_0|> <|body_start_1|> res = 0 for index, coeff in enumerate(self._coeff_list): res += ...
Polynomial used for quantities relating to deramping sentinel
RampPolynomial
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RampPolynomial: """Polynomial used for quantities relating to deramping sentinel""" def __init__(self, t0, coeff_list, slant_range_time_interval, slant_range_time): """Initialize Deramp Polynomial object @param t0: Starting time @param coeff_list: List of coefficients @param slant_ra...
stack_v2_sparse_classes_75kplus_train_001853
19,206
permissive
[ { "docstring": "Initialize Deramp Polynomial object @param t0: Starting time @param coeff_list: List of coefficients @param slant_range_time_interval: Time between range samples @param slant_range_time: Two way slant range time", "name": "__init__", "signature": "def __init__(self, t0, coeff_list, slant...
2
null
Implement the Python class `RampPolynomial` described below. Class description: Polynomial used for quantities relating to deramping sentinel Method signatures and docstrings: - def __init__(self, t0, coeff_list, slant_range_time_interval, slant_range_time): Initialize Deramp Polynomial object @param t0: Starting tim...
Implement the Python class `RampPolynomial` described below. Class description: Polynomial used for quantities relating to deramping sentinel Method signatures and docstrings: - def __init__(self, t0, coeff_list, slant_range_time_interval, slant_range_time): Initialize Deramp Polynomial object @param t0: Starting tim...
4d22e3ef90ef842d6b390074a8b5deedc7658a2b
<|skeleton|> class RampPolynomial: """Polynomial used for quantities relating to deramping sentinel""" def __init__(self, t0, coeff_list, slant_range_time_interval, slant_range_time): """Initialize Deramp Polynomial object @param t0: Starting time @param coeff_list: List of coefficients @param slant_ra...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RampPolynomial: """Polynomial used for quantities relating to deramping sentinel""" def __init__(self, t0, coeff_list, slant_range_time_interval, slant_range_time): """Initialize Deramp Polynomial object @param t0: Starting time @param coeff_list: List of coefficients @param slant_range_time_inte...
the_stack_v2_python_sparse
pyinsar/processing/instruments/sentinel.py
MITeaps/pyinsar
train
11
33e2ab16afdc779555e1cb14aa3d167332556b10
[ "self.dt = dup.parse(inStr.split(',')[0])\nm = re.findall('^.*,\\\\d\\\\d\\\\d\\\\s\\\\-\\\\s(.*)\\\\s\\\\-\\\\sERROR\\\\s\\\\-\\\\s(.*)$', inStr.strip())\nself.codename = m[0][0]\nself.errormsg = m[0][1]", "outStr = '<tr>'\nfor attr in ['dt', 'Codename', 'Error message']:\n outStr += '<th>{0}</th>'.format(att...
<|body_start_0|> self.dt = dup.parse(inStr.split(',')[0]) m = re.findall('^.*,\\d\\d\\d\\s\\-\\s(.*)\\s\\-\\sERROR\\s\\-\\s(.*)$', inStr.strip()) self.codename = m[0][0] self.errormsg = m[0][1] <|end_body_0|> <|body_start_1|> outStr = '<tr>' for attr in ['dt', 'Codename'...
errors
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class errors: def __init__(self, inStr): """parse the error and collect what we want""" <|body_0|> def htmlheader(self): """return a string html header""" <|body_1|> def html(self, alt=False): """return a html string for this""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus_train_001854
9,741
no_license
[ { "docstring": "parse the error and collect what we want", "name": "__init__", "signature": "def __init__(self, inStr)" }, { "docstring": "return a string html header", "name": "htmlheader", "signature": "def htmlheader(self)" }, { "docstring": "return a html string for this", ...
3
stack_v2_sparse_classes_30k_test_000248
Implement the Python class `errors` described below. Class description: Implement the errors class. Method signatures and docstrings: - def __init__(self, inStr): parse the error and collect what we want - def htmlheader(self): return a string html header - def html(self, alt=False): return a html string for this
Implement the Python class `errors` described below. Class description: Implement the errors class. Method signatures and docstrings: - def __init__(self, inStr): parse the error and collect what we want - def htmlheader(self): return a string html header - def html(self, alt=False): return a html string for this <|...
be29f149e93a66886dc988ea8aff1346e9174fe8
<|skeleton|> class errors: def __init__(self, inStr): """parse the error and collect what we want""" <|body_0|> def htmlheader(self): """return a string html header""" <|body_1|> def html(self, alt=False): """return a html string for this""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class errors: def __init__(self, inStr): """parse the error and collect what we want""" self.dt = dup.parse(inStr.split(',')[0]) m = re.findall('^.*,\\d\\d\\d\\s\\-\\s(.*)\\s\\-\\sERROR\\s\\-\\s(.*)$', inStr.strip()) self.codename = m[0][0] self.errormsg = m[0][1] def ht...
the_stack_v2_python_sparse
dbprocessing/reports.py
lanl/dbprocessing
train
0
8a367533e167a04b5c56eb52a3a6b7b2afe2cebc
[ "super(VQVAE, self).__init__()\nencoder_class = getattr(parallel_wavegan.models, encoder_type)\ndecoder_class = getattr(parallel_wavegan.models, decoder_type)\nencoder_conf.update({'in_channels': in_channels})\ndecoder_conf.update({'out_channels': out_channels})\nif not issubclass(decoder_class, parallel_wavegan.mo...
<|body_start_0|> super(VQVAE, self).__init__() encoder_class = getattr(parallel_wavegan.models, encoder_type) decoder_class = getattr(parallel_wavegan.models, decoder_type) encoder_conf.update({'in_channels': in_channels}) decoder_conf.update({'out_channels': out_channels}) ...
VQVAE module.
VQVAE
[ "MIT", "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VQVAE: """VQVAE module.""" def __init__(self, in_channels=1, out_channels=1, num_embeds=512, embed_dim=256, num_local_embeds=None, local_embed_dim=None, num_global_embeds=None, global_embed_dim=None, encoder_type='MelGANDiscriminator', decoder_type='MelGANGenerator', encoder_conf={'out_chann...
stack_v2_sparse_classes_75kplus_train_001855
6,165
permissive
[ { "docstring": "Initialize VQVAE module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. num_embeds (int): Number of embeddings. embed_dim (int): Dimension of each embedding. num_local_embeds (int): Number of local embeddings. local_embed_dim (int): Dimension of...
6
stack_v2_sparse_classes_30k_train_021904
Implement the Python class `VQVAE` described below. Class description: VQVAE module. Method signatures and docstrings: - def __init__(self, in_channels=1, out_channels=1, num_embeds=512, embed_dim=256, num_local_embeds=None, local_embed_dim=None, num_global_embeds=None, global_embed_dim=None, encoder_type='MelGANDisc...
Implement the Python class `VQVAE` described below. Class description: VQVAE module. Method signatures and docstrings: - def __init__(self, in_channels=1, out_channels=1, num_embeds=512, embed_dim=256, num_local_embeds=None, local_embed_dim=None, num_global_embeds=None, global_embed_dim=None, encoder_type='MelGANDisc...
c68b4590ab20eaf55e0b96b82325a90177fffd5c
<|skeleton|> class VQVAE: """VQVAE module.""" def __init__(self, in_channels=1, out_channels=1, num_embeds=512, embed_dim=256, num_local_embeds=None, local_embed_dim=None, num_global_embeds=None, global_embed_dim=None, encoder_type='MelGANDiscriminator', decoder_type='MelGANGenerator', encoder_conf={'out_chann...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VQVAE: """VQVAE module.""" def __init__(self, in_channels=1, out_channels=1, num_embeds=512, embed_dim=256, num_local_embeds=None, local_embed_dim=None, num_global_embeds=None, global_embed_dim=None, encoder_type='MelGANDiscriminator', decoder_type='MelGANGenerator', encoder_conf={'out_channels': 256, 'd...
the_stack_v2_python_sparse
parallel_wavegan/models/vqvae.py
kan-bayashi/ParallelWaveGAN
train
1,405
7f6a8ad7f9725e6161e4dca0adcb8be22812c87a
[ "def helper(n):\n if n in dp:\n return dp[n]\n if n < 0:\n return float('+inf')\n else:\n tmp = float('+inf')\n for i in ps:\n s = helper(n - i)\n if s < tmp:\n tmp = s\n dp[n] = tmp + 1\n return tmp\nps = []\ndp = {0: 0, 1: 1, ...
<|body_start_0|> def helper(n): if n in dp: return dp[n] if n < 0: return float('+inf') else: tmp = float('+inf') for i in ps: s = helper(n - i) if s < tmp: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares(self, n): """:type n: int :rtype: int""" <|body_1|> def numSquares(self, n): """:type n: int :rtype: int 广度优先""" <|body_2|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_001856
2,548
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int 广度优先", "name": "numSq...
3
stack_v2_sparse_classes_30k_train_053923
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int 广度优先
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int - def numSquares(self, n): :type n: int :rtype: int 广度优先 <|skeleton|> class...
8853f85214ac88db024d26e228f1848dd5acd933
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares(self, n): """:type n: int :rtype: int""" <|body_1|> def numSquares(self, n): """:type n: int :rtype: int 广度优先""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares(self, n): """:type n: int :rtype: int""" def helper(n): if n in dp: return dp[n] if n < 0: return float('+inf') else: tmp = float('+inf') for i in ps: ...
the_stack_v2_python_sparse
279-PerfectSquares/PerfectSquares.py
cqxmzhc/my_leetcode_solutions
train
2
5f1f341c719f250604b6f6820acab7d8e2c20e99
[ "Flowable.__init__(self)\nself.value = value\nself.ratio = ratio", "self.width = availwidth\nself.height = self.ratio * availheight\nreturn (self.width, self.height)", "a4width, a4height = A4\nqr_code = qr.QrCodeWidget(self.value)\nbounds = qr_code.getBounds()\nwidth = bounds[2] - bounds[0]\nheight = bounds[3] ...
<|body_start_0|> Flowable.__init__(self) self.value = value self.ratio = ratio <|end_body_0|> <|body_start_1|> self.width = availwidth self.height = self.ratio * availheight return (self.width, self.height) <|end_body_1|> <|body_start_2|> a4width, a4height = A4 ...
Barcode class.
BarCode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarCode: """Barcode class.""" def __init__(self, value='1234567890', ratio=2.1): """Init and store rendering value.""" <|body_0|> def wrap(self, availwidth, availheight): """Make the barcode fill the width while maintaining the ratio.""" <|body_1|> d...
stack_v2_sparse_classes_75kplus_train_001857
20,082
no_license
[ { "docstring": "Init and store rendering value.", "name": "__init__", "signature": "def __init__(self, value='1234567890', ratio=2.1)" }, { "docstring": "Make the barcode fill the width while maintaining the ratio.", "name": "wrap", "signature": "def wrap(self, availwidth, availheight)" ...
3
null
Implement the Python class `BarCode` described below. Class description: Barcode class. Method signatures and docstrings: - def __init__(self, value='1234567890', ratio=2.1): Init and store rendering value. - def wrap(self, availwidth, availheight): Make the barcode fill the width while maintaining the ratio. - def d...
Implement the Python class `BarCode` described below. Class description: Barcode class. Method signatures and docstrings: - def __init__(self, value='1234567890', ratio=2.1): Init and store rendering value. - def wrap(self, availwidth, availheight): Make the barcode fill the width while maintaining the ratio. - def d...
5b34d66f2d4219d9cb0861ebb7b3242e41cd23a2
<|skeleton|> class BarCode: """Barcode class.""" def __init__(self, value='1234567890', ratio=2.1): """Init and store rendering value.""" <|body_0|> def wrap(self, availwidth, availheight): """Make the barcode fill the width while maintaining the ratio.""" <|body_1|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BarCode: """Barcode class.""" def __init__(self, value='1234567890', ratio=2.1): """Init and store rendering value.""" Flowable.__init__(self) self.value = value self.ratio = ratio def wrap(self, availwidth, availheight): """Make the barcode fill the width whi...
the_stack_v2_python_sparse
cpims/documents.py
Atieno-Ouma/cpims-dcs-2.1
train
0
237efaeea62e6a113d91c6f3fd90a2d66f293ae1
[ "existing = get_user_model().objects.filter(email__iexact=self.cleaned_data['email'])\nif existing.exists():\n raise forms.ValidationError(self.error_messages['exist_email'], code='exist_email')\nelse:\n return self.cleaned_data['email']", "data = self.cleaned_data.get(name, None)\nif not data:\n self.cl...
<|body_start_0|> existing = get_user_model().objects.filter(email__iexact=self.cleaned_data['email']) if existing.exists(): raise forms.ValidationError(self.error_messages['exist_email'], code='exist_email') else: return self.cleaned_data['email'] <|end_body_0|> <|body_s...
注册页面表单
RegistrationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationForm: """注册页面表单""" def clean_email(self): """验证电子邮件是否被使用""" <|body_0|> def get_and_set_cleaned_data(self, name): """获得验证后的数据, 当数据为空时,设置该值为None并返回None""" <|body_1|> def clean(self): """对表单合法性进行最终验证""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_75kplus_train_001858
8,928
no_license
[ { "docstring": "验证电子邮件是否被使用", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "获得验证后的数据, 当数据为空时,设置该值为None并返回None", "name": "get_and_set_cleaned_data", "signature": "def get_and_set_cleaned_data(self, name)" }, { "docstring": "对表单合法性进行最终验证", "name...
3
stack_v2_sparse_classes_30k_train_008430
Implement the Python class `RegistrationForm` described below. Class description: 注册页面表单 Method signatures and docstrings: - def clean_email(self): 验证电子邮件是否被使用 - def get_and_set_cleaned_data(self, name): 获得验证后的数据, 当数据为空时,设置该值为None并返回None - def clean(self): 对表单合法性进行最终验证
Implement the Python class `RegistrationForm` described below. Class description: 注册页面表单 Method signatures and docstrings: - def clean_email(self): 验证电子邮件是否被使用 - def get_and_set_cleaned_data(self, name): 获得验证后的数据, 当数据为空时,设置该值为None并返回None - def clean(self): 对表单合法性进行最终验证 <|skeleton|> class RegistrationForm: """注册页...
d52681a84bc75615dcfd7a373e579833e1ebece8
<|skeleton|> class RegistrationForm: """注册页面表单""" def clean_email(self): """验证电子邮件是否被使用""" <|body_0|> def get_and_set_cleaned_data(self, name): """获得验证后的数据, 当数据为空时,设置该值为None并返回None""" <|body_1|> def clean(self): """对表单合法性进行最终验证""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegistrationForm: """注册页面表单""" def clean_email(self): """验证电子邮件是否被使用""" existing = get_user_model().objects.filter(email__iexact=self.cleaned_data['email']) if existing.exists(): raise forms.ValidationError(self.error_messages['exist_email'], code='exist_email') ...
the_stack_v2_python_sparse
citi/apps/account/forms.py
doraemonext/citi
train
0
a84f46139f630cc1f852731269354f480b2996ab
[ "try:\n json_file = open(jsonFilePath, 'r')\n if json_file == None:\n print('Could not read file %s' % jsonFilePath)\n return None\n json_config_str = json_file.read()\n json_object = json.loads(json_config_str)\n json_file.close()\n if json_object != None:\n return json_objec...
<|body_start_0|> try: json_file = open(jsonFilePath, 'r') if json_file == None: print('Could not read file %s' % jsonFilePath) return None json_config_str = json_file.read() json_object = json.loads(json_config_str) json...
JsonFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonFile: def readJsonFile(jsonFilePath): """Reads a JSON file and returns as a JSON object, or None if it can't read the JSON file.""" <|body_0|> def writeJsonFile(jsonObject, jsonFilePath=None): """TODO: Need to edit this because we are now going to need to store m...
stack_v2_sparse_classes_75kplus_train_001859
1,938
permissive
[ { "docstring": "Reads a JSON file and returns as a JSON object, or None if it can't read the JSON file.", "name": "readJsonFile", "signature": "def readJsonFile(jsonFilePath)" }, { "docstring": "TODO: Need to edit this because we are now going to need to store more than just the credentials.", ...
2
stack_v2_sparse_classes_30k_train_050053
Implement the Python class `JsonFile` described below. Class description: Implement the JsonFile class. Method signatures and docstrings: - def readJsonFile(jsonFilePath): Reads a JSON file and returns as a JSON object, or None if it can't read the JSON file. - def writeJsonFile(jsonObject, jsonFilePath=None): TODO: ...
Implement the Python class `JsonFile` described below. Class description: Implement the JsonFile class. Method signatures and docstrings: - def readJsonFile(jsonFilePath): Reads a JSON file and returns as a JSON object, or None if it can't read the JSON file. - def writeJsonFile(jsonObject, jsonFilePath=None): TODO: ...
1b714f518b7cc98a788f123e18f713ea362870c4
<|skeleton|> class JsonFile: def readJsonFile(jsonFilePath): """Reads a JSON file and returns as a JSON object, or None if it can't read the JSON file.""" <|body_0|> def writeJsonFile(jsonObject, jsonFilePath=None): """TODO: Need to edit this because we are now going to need to store m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JsonFile: def readJsonFile(jsonFilePath): """Reads a JSON file and returns as a JSON object, or None if it can't read the JSON file.""" try: json_file = open(jsonFilePath, 'r') if json_file == None: print('Could not read file %s' % jsonFilePath) ...
the_stack_v2_python_sparse
gravityApp/app/JsonFile.py
philoxnard/gravtest
train
0
4bf267e1ce03320d8442efe3d8cd8f9541a71257
[ "self.nums = nums\nself.d = {}\nfor i in xrange(len(nums)):\n if nums[i] in self.d:\n self.d[nums[i]] += 1\n else:\n self.d[nums[i]] = 1", "import random\nx = random.randint(1, self.d[target])\nfor i in xrange(len(self.nums)):\n if self.nums[i] == target:\n if x == 1:\n re...
<|body_start_0|> self.nums = nums self.d = {} for i in xrange(len(nums)): if nums[i] in self.d: self.d[nums[i]] += 1 else: self.d[nums[i]] = 1 <|end_body_0|> <|body_start_1|> import random x = random.randint(1, self.d[targe...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nums = nums self.d = {} for ...
stack_v2_sparse_classes_75kplus_train_001860
843
no_license
[ { "docstring": ":type nums: List[int] :type numsSize: int", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type target: int :rtype: int", "name": "pick", "signature": "def pick(self, target)" } ]
2
stack_v2_sparse_classes_30k_train_027072
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type numsSize: int - def pick(self, target): :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] :type numsSize: int - def pick(self, target): :type target: int :rtype: int <|skeleton|> class Solution: def __init__(self, ...
0c89fb5b95a33f866ffa881e0fa164c6ed8fc2d3
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, nums): """:type nums: List[int] :type numsSize: int""" self.nums = nums self.d = {} for i in xrange(len(nums)): if nums[i] in self.d: self.d[nums[i]] += 1 else: self.d[nums[i]] = 1 def pic...
the_stack_v2_python_sparse
Random Pick Index.py
KiwiFlow/Algorithms
train
1
92aa9b9f5032dceb6c8f78f1a45d0be7bd2bc026
[ "images = tf.zeros(shape=(batch_size, image_size, image_size, 1), dtype=tf.float32)\nlabels = tf.zeros(shape=(batch_size,), dtype=tf.int32)\nreturn io.encode_samples(images, labels)", "weights = io.decode_weights(encoded)\nself.assertLen(weights, num_weights)\nfor weight in weights:\n self.assertEqual(weight.s...
<|body_start_0|> images = tf.zeros(shape=(batch_size, image_size, image_size, 1), dtype=tf.float32) labels = tf.zeros(shape=(batch_size,), dtype=tf.int32) return io.encode_samples(images, labels) <|end_body_0|> <|body_start_1|> weights = io.decode_weights(encoded) self.assertLen...
UtilTest
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilTest: def _encode_samples(self, batch_size, image_size, io): """Creates empty images and labels and encodes for Transformer.""" <|body_0|> def _check_weights(self, encoded, num_weights, image_size, io): """Decodes weights and checks their number and their shapes....
stack_v2_sparse_classes_75kplus_train_001861
2,805
permissive
[ { "docstring": "Creates empty images and labels and encodes for Transformer.", "name": "_encode_samples", "signature": "def _encode_samples(self, batch_size, image_size, io)" }, { "docstring": "Decodes weights and checks their number and their shapes.", "name": "_check_weights", "signatu...
4
stack_v2_sparse_classes_30k_train_032766
Implement the Python class `UtilTest` described below. Class description: Implement the UtilTest class. Method signatures and docstrings: - def _encode_samples(self, batch_size, image_size, io): Creates empty images and labels and encodes for Transformer. - def _check_weights(self, encoded, num_weights, image_size, i...
Implement the Python class `UtilTest` described below. Class description: Implement the UtilTest class. Method signatures and docstrings: - def _encode_samples(self, batch_size, image_size, io): Creates empty images and labels and encodes for Transformer. - def _check_weights(self, encoded, num_weights, image_size, i...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class UtilTest: def _encode_samples(self, batch_size, image_size, io): """Creates empty images and labels and encodes for Transformer.""" <|body_0|> def _check_weights(self, encoded, num_weights, image_size, io): """Decodes weights and checks their number and their shapes....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UtilTest: def _encode_samples(self, batch_size, image_size, io): """Creates empty images and labels and encodes for Transformer.""" images = tf.zeros(shape=(batch_size, image_size, image_size, 1), dtype=tf.float32) labels = tf.zeros(shape=(batch_size,), dtype=tf.int32) return i...
the_stack_v2_python_sparse
hypertransformer/tf/core/util_test.py
Jimmy-INL/google-research
train
1
592fa985d3be9e61737e78892a28d3124a1c4974
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsHelloForBusinessAuthenticationMethod()", "from .authentication_method import AuthenticationMethod\nfrom .authentication_method_key_strength import AuthenticationMethodKeyStrength\nfrom .device import Device\nfrom .authentication...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsHelloForBusinessAuthenticationMethod() <|end_body_0|> <|body_start_1|> from .authentication_method import AuthenticationMethod from .authentication_method_key_strength import Auth...
WindowsHelloForBusinessAuthenticationMethod
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsHelloForBusinessAuthenticationMethod: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenticationMethod: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use t...
stack_v2_sparse_classes_75kplus_train_001862
3,929
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: WindowsHelloForBusinessAuthenticationMethod", "name": "create_from_discriminator_value", "signature": "def c...
3
stack_v2_sparse_classes_30k_train_047901
Implement the Python class `WindowsHelloForBusinessAuthenticationMethod` described below. Class description: Implement the WindowsHelloForBusinessAuthenticationMethod class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenti...
Implement the Python class `WindowsHelloForBusinessAuthenticationMethod` described below. Class description: Implement the WindowsHelloForBusinessAuthenticationMethod class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenti...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsHelloForBusinessAuthenticationMethod: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenticationMethod: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WindowsHelloForBusinessAuthenticationMethod: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsHelloForBusinessAuthenticationMethod: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the dis...
the_stack_v2_python_sparse
msgraph/generated/models/windows_hello_for_business_authentication_method.py
microsoftgraph/msgraph-sdk-python
train
135
8a959e031949d4d507b47f0cb2e841c22789d8d1
[ "self.stack = []\nself.quene = []\nself.flag = True", "if x is None:\n return\nelif self.flag:\n self.stack.append(x)\nelse:\n while self.quene:\n self.stack.append(self.quene.pop())\n self.flag = True\n self.stack.append(x)", "l = len(self.stack) + len(self.quene)\nif l > 0:\n if not s...
<|body_start_0|> self.stack = [] self.quene = [] self.flag = True <|end_body_0|> <|body_start_1|> if x is None: return elif self.flag: self.stack.append(x) else: while self.quene: self.stack.append(self.quene.pop()) ...
Queue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Queue: def __init__(self): """initialize your data structure here.""" <|body_0|> def push(self, x): """:type x: int :rtype: nothing""" <|body_1|> def pop(self): """:rtype: nothing""" <|body_2|> def peek(self): """:rtype: int"...
stack_v2_sparse_classes_75kplus_train_001863
1,579
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type x: int :rtype: nothing", "name": "push", "signature": "def push(self, x)" }, { "docstring": ":rtype: nothing", "name": "pop", "signature":...
5
null
Implement the Python class `Queue` described below. Class description: Implement the Queue class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def push(self, x): :type x: int :rtype: nothing - def pop(self): :rtype: nothing - def peek(self): :rtype: int - def empty(se...
Implement the Python class `Queue` described below. Class description: Implement the Queue class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def push(self, x): :type x: int :rtype: nothing - def pop(self): :rtype: nothing - def peek(self): :rtype: int - def empty(se...
2dd6c05c021e5a8a75a5f4f5d0a6a3d7a1566b1b
<|skeleton|> class Queue: def __init__(self): """initialize your data structure here.""" <|body_0|> def push(self, x): """:type x: int :rtype: nothing""" <|body_1|> def pop(self): """:rtype: nothing""" <|body_2|> def peek(self): """:rtype: int"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Queue: def __init__(self): """initialize your data structure here.""" self.stack = [] self.quene = [] self.flag = True def push(self, x): """:type x: int :rtype: nothing""" if x is None: return elif self.flag: self.stack.appe...
the_stack_v2_python_sparse
232.Implement_Queue_using_Stacks.py
XinScript/Leetcode
train
0
c7dd6d09117cc8686eddbd1a7ea10d88a5909a25
[ "transactions = get_transactions_by_ids(transaction_ids=None)\nresult = TransactionSchema(many=True).dump(transactions).data\nreturn (result, 200)", "transactions = get_transactions_by_ids(request.json['transaction_ids'])\nresult = TransactionSchema(many=True).dump(transactions).data\nreturn (result, 200)" ]
<|body_start_0|> transactions = get_transactions_by_ids(transaction_ids=None) result = TransactionSchema(many=True).dump(transactions).data return (result, 200) <|end_body_0|> <|body_start_1|> transactions = get_transactions_by_ids(request.json['transaction_ids']) result = Trans...
Flask-RESTful resource endpoints for TransactionModel by ID's.
TransactionsByIds
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransactionsByIds: """Flask-RESTful resource endpoints for TransactionModel by ID's.""" def get(self): """Simple endpoint to retrieve all rows from table.""" <|body_0|> def post(self): """Simple endpoint to return several rows from table given a list of ID's.""" ...
stack_v2_sparse_classes_75kplus_train_001864
4,727
no_license
[ { "docstring": "Simple endpoint to retrieve all rows from table.", "name": "get", "signature": "def get(self)" }, { "docstring": "Simple endpoint to return several rows from table given a list of ID's.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_val_001421
Implement the Python class `TransactionsByIds` described below. Class description: Flask-RESTful resource endpoints for TransactionModel by ID's. Method signatures and docstrings: - def get(self): Simple endpoint to retrieve all rows from table. - def post(self): Simple endpoint to return several rows from table give...
Implement the Python class `TransactionsByIds` described below. Class description: Flask-RESTful resource endpoints for TransactionModel by ID's. Method signatures and docstrings: - def get(self): Simple endpoint to retrieve all rows from table. - def post(self): Simple endpoint to return several rows from table give...
d5ffcc5d276692d1578cea704125b1b3952beb1c
<|skeleton|> class TransactionsByIds: """Flask-RESTful resource endpoints for TransactionModel by ID's.""" def get(self): """Simple endpoint to retrieve all rows from table.""" <|body_0|> def post(self): """Simple endpoint to return several rows from table given a list of ID's.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransactionsByIds: """Flask-RESTful resource endpoints for TransactionModel by ID's.""" def get(self): """Simple endpoint to retrieve all rows from table.""" transactions = get_transactions_by_ids(transaction_ids=None) result = TransactionSchema(many=True).dump(transactions).data ...
the_stack_v2_python_sparse
application/resources/transaction.py
transreductionist/API-Project-1
train
0
d1f6321444eebb293c4c5b7e242eeb6170c23217
[ "future_question = create_question(question_text='Future question.', days=5)\nurl = reverse('polls:detail', args=(future_question.id,))\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 404)", "past_question = create_question(question_text='Past question.', days=-5)\nurl = reverse('polls:de...
<|body_start_0|> future_question = create_question(question_text='Future question.', days=5) url = reverse('polls:detail', args=(future_question.id,)) response = self.client.get(url) self.assertEqual(response.status_code, 404) <|end_body_0|> <|body_start_1|> past_question = crea...
QuestionDetailViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionDetailViewTests: def test_detail_view_with_a_future_question(self): """The detail view of a question with a pub_date in the future should return a 404 not found.""" <|body_0|> def test_detail_view_with_a_past_question(self): """The detail view of a question w...
stack_v2_sparse_classes_75kplus_train_001865
7,438
no_license
[ { "docstring": "The detail view of a question with a pub_date in the future should return a 404 not found.", "name": "test_detail_view_with_a_future_question", "signature": "def test_detail_view_with_a_future_question(self)" }, { "docstring": "The detail view of a question with a pub_date in the...
2
stack_v2_sparse_classes_30k_train_015804
Implement the Python class `QuestionDetailViewTests` described below. Class description: Implement the QuestionDetailViewTests class. Method signatures and docstrings: - def test_detail_view_with_a_future_question(self): The detail view of a question with a pub_date in the future should return a 404 not found. - def ...
Implement the Python class `QuestionDetailViewTests` described below. Class description: Implement the QuestionDetailViewTests class. Method signatures and docstrings: - def test_detail_view_with_a_future_question(self): The detail view of a question with a pub_date in the future should return a 404 not found. - def ...
a7e7fc72abe357172f5aa49b03c5b9298d92d6e8
<|skeleton|> class QuestionDetailViewTests: def test_detail_view_with_a_future_question(self): """The detail view of a question with a pub_date in the future should return a 404 not found.""" <|body_0|> def test_detail_view_with_a_past_question(self): """The detail view of a question w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionDetailViewTests: def test_detail_view_with_a_future_question(self): """The detail view of a question with a pub_date in the future should return a 404 not found.""" future_question = create_question(question_text='Future question.', days=5) url = reverse('polls:detail', args=(f...
the_stack_v2_python_sparse
firstdjango/polls/tests.py
thewritingstew/lpthw
train
0
158150f3c94a45d1b42444ed356c989dcf1fa61d
[ "pending_messages_qs = Message.objects.get_pending_messages(request.user)\nmessages_serializer = MessageSerializer(pending_messages_qs, context={'request': request}, many=True)\nrooms = set()\nfor message_data in messages_serializer.data:\n rooms.add(message_data['room'])\nrooms_obj = Room.objects.filter(id__in=...
<|body_start_0|> pending_messages_qs = Message.objects.get_pending_messages(request.user) messages_serializer = MessageSerializer(pending_messages_qs, context={'request': request}, many=True) rooms = set() for message_data in messages_serializer.data: rooms.add(message_data['...
Endpoints related to managing messages
MessageViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageViewSet: """Endpoints related to managing messages""" def list(self, request): """List user's pending to receive messages""" <|body_0|> def create(self, request): """Create new message in backend and signal participants to receive it""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_001866
5,743
permissive
[ { "docstring": "List user's pending to receive messages", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Create new message in backend and signal participants to receive it", "name": "create", "signature": "def create(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_015838
Implement the Python class `MessageViewSet` described below. Class description: Endpoints related to managing messages Method signatures and docstrings: - def list(self, request): List user's pending to receive messages - def create(self, request): Create new message in backend and signal participants to receive it
Implement the Python class `MessageViewSet` described below. Class description: Endpoints related to managing messages Method signatures and docstrings: - def list(self, request): List user's pending to receive messages - def create(self, request): Create new message in backend and signal participants to receive it ...
6ad3d8e2d9deede34ec57f7b47cadb6db9e8c8db
<|skeleton|> class MessageViewSet: """Endpoints related to managing messages""" def list(self, request): """List user's pending to receive messages""" <|body_0|> def create(self, request): """Create new message in backend and signal participants to receive it""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageViewSet: """Endpoints related to managing messages""" def list(self, request): """List user's pending to receive messages""" pending_messages_qs = Message.objects.get_pending_messages(request.user) messages_serializer = MessageSerializer(pending_messages_qs, context={'reque...
the_stack_v2_python_sparse
djchat/chat/api/messageViews.py
DanRHamidullin/whatsapp-clone-django-vuejs
train
0
3700795e461fc6fe69f9a790c9dbf7f4e7092827
[ "self.name = mol_name\nself.type = mol_type\nself._mol_index = None\nself.res = ResidueList()", "text = 'Class containing all the molecule specific data.\\n'\ntext = text + '\\n'\ntext = text + 'Objects:\\n'\nfor name in dir(self):\n if name == 'res':\n text = text + ' res: The list of the residues of ...
<|body_start_0|> self.name = mol_name self.type = mol_type self._mol_index = None self.res = ResidueList() <|end_body_0|> <|body_start_1|> text = 'Class containing all the molecule specific data.\n' text = text + '\n' text = text + 'Objects:\n' for name i...
Class containing all the molecule specific data.
MoleculeContainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoleculeContainer: """Class containing all the molecule specific data.""" def __init__(self, mol_name=None, mol_type=None): """Set up the default objects of the molecule data container.""" <|body_0|> def __repr__(self): """The string representation of the object....
stack_v2_sparse_classes_75kplus_train_001867
28,677
no_license
[ { "docstring": "Set up the default objects of the molecule data container.", "name": "__init__", "signature": "def __init__(self, mol_name=None, mol_type=None)" }, { "docstring": "The string representation of the object. Rather than using the standard Python conventions (either the string repres...
3
null
Implement the Python class `MoleculeContainer` described below. Class description: Class containing all the molecule specific data. Method signatures and docstrings: - def __init__(self, mol_name=None, mol_type=None): Set up the default objects of the molecule data container. - def __repr__(self): The string represen...
Implement the Python class `MoleculeContainer` described below. Class description: Class containing all the molecule specific data. Method signatures and docstrings: - def __init__(self, mol_name=None, mol_type=None): Set up the default objects of the molecule data container. - def __repr__(self): The string represen...
c317326ddeacd1a1c608128769676899daeae531
<|skeleton|> class MoleculeContainer: """Class containing all the molecule specific data.""" def __init__(self, mol_name=None, mol_type=None): """Set up the default objects of the molecule data container.""" <|body_0|> def __repr__(self): """The string representation of the object....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MoleculeContainer: """Class containing all the molecule specific data.""" def __init__(self, mol_name=None, mol_type=None): """Set up the default objects of the molecule data container.""" self.name = mol_name self.type = mol_type self._mol_index = None self.res = ...
the_stack_v2_python_sparse
data_store/mol_res_spin.py
jlec/relax
train
4
42b8ac7ca91354596ffe2993503869dc9408f67a
[ "index = {a: i for i, a in enumerate(A)}\nlongest = defaultdict(lambda: 2)\nans = 0\nfor k, z in enumerate(A):\n for j in range(k):\n i = index.get(z - A[j], None)\n if i is not None and i < j:\n cand = longest[j, k] = longest[i, j] + 1\n ans = max(ans, cand)\nreturn ans if an...
<|body_start_0|> index = {a: i for i, a in enumerate(A)} longest = defaultdict(lambda: 2) ans = 0 for k, z in enumerate(A): for j in range(k): i = index.get(z - A[j], None) if i is not None and i < j: cand = longest[j, k] = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lenLongestFibSubseq(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def lenLongestFibSubseq2(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> index = {a: i for i, a in enumerate(A)} ...
stack_v2_sparse_classes_75kplus_train_001868
2,821
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "lenLongestFibSubseq", "signature": "def lenLongestFibSubseq(self, A)" }, { "docstring": ":type A: List[int] :rtype: int", "name": "lenLongestFibSubseq2", "signature": "def lenLongestFibSubseq2(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_035178
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lenLongestFibSubseq(self, A): :type A: List[int] :rtype: int - def lenLongestFibSubseq2(self, A): :type A: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lenLongestFibSubseq(self, A): :type A: List[int] :rtype: int - def lenLongestFibSubseq2(self, A): :type A: List[int] :rtype: int <|skeleton|> class Solution: def lenLon...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def lenLongestFibSubseq(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def lenLongestFibSubseq2(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lenLongestFibSubseq(self, A): """:type A: List[int] :rtype: int""" index = {a: i for i, a in enumerate(A)} longest = defaultdict(lambda: 2) ans = 0 for k, z in enumerate(A): for j in range(k): i = index.get(z - A[j], None) ...
the_stack_v2_python_sparse
code873LengthOfLongestFibonacciSubsequence.py
cybelewang/leetcode-python
train
0
8d1d7e6e557ad399366b3fc8caf6c408d2e25d25
[ "book = BookModel.find_by_id(id)\nif book:\n return book.json()\nreturn ({'message': 'Book not found'}, 404)", "book = BookModel.find_by_id(id)\nif book:\n book.delete_from_db()\n return {'message': 'Book deleted.'}\nreturn ({'message': 'Book not found.'}, 404)", "data = Book.parser.parse_args()\nbook ...
<|body_start_0|> book = BookModel.find_by_id(id) if book: return book.json() return ({'message': 'Book not found'}, 404) <|end_body_0|> <|body_start_1|> book = BookModel.find_by_id(id) if book: book.delete_from_db() return {'message': 'Book de...
Book. Resource that helps with dealing with Http request for a book by providing its id. HTTP GET call : /books/<int:id> HTTP DELETE call : /books/<int:id> HTTP PUT call : /books/<int:id>
Book
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Book: """Book. Resource that helps with dealing with Http request for a book by providing its id. HTTP GET call : /books/<int:id> HTTP DELETE call : /books/<int:id> HTTP PUT call : /books/<int:id>""" def get(self, id): """GET request that deals with requests that look for a book by i...
stack_v2_sparse_classes_75kplus_train_001869
12,325
permissive
[ { "docstring": "GET request that deals with requests that look for a book by id", "name": "get", "signature": "def get(self, id)" }, { "docstring": "DELETE request that deals with the deletion of book given its id", "name": "delete", "signature": "def delete(self, id)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_000058
Implement the Python class `Book` described below. Class description: Book. Resource that helps with dealing with Http request for a book by providing its id. HTTP GET call : /books/<int:id> HTTP DELETE call : /books/<int:id> HTTP PUT call : /books/<int:id> Method signatures and docstrings: - def get(self, id): GET r...
Implement the Python class `Book` described below. Class description: Book. Resource that helps with dealing with Http request for a book by providing its id. HTTP GET call : /books/<int:id> HTTP DELETE call : /books/<int:id> HTTP PUT call : /books/<int:id> Method signatures and docstrings: - def get(self, id): GET r...
42456ced804a2c9570227b393de662847283c76f
<|skeleton|> class Book: """Book. Resource that helps with dealing with Http request for a book by providing its id. HTTP GET call : /books/<int:id> HTTP DELETE call : /books/<int:id> HTTP PUT call : /books/<int:id>""" def get(self, id): """GET request that deals with requests that look for a book by i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Book: """Book. Resource that helps with dealing with Http request for a book by providing its id. HTTP GET call : /books/<int:id> HTTP DELETE call : /books/<int:id> HTTP PUT call : /books/<int:id>""" def get(self, id): """GET request that deals with requests that look for a book by id""" ...
the_stack_v2_python_sparse
resources/book.py
basgir/bibliotek
train
0
58c903cd2492d29938bb5ec575c8b8bfae6a729f
[ "self.__logger = log(self.__class__.__name__)\nself.symbols = []\ns = self.symbolFactory(geoType, category.symbol(), layerTransparency)\nself.symbols.append(s)\nself.field = field\nself.fieldType = fieldType\nself.label = category.label()\nself.value = str(category.value())", "if self.fieldType == 'String' or sel...
<|body_start_0|> self.__logger = log(self.__class__.__name__) self.symbols = [] s = self.symbolFactory(geoType, category.symbol(), layerTransparency) self.symbols.append(s) self.field = field self.fieldType = fieldType self.label = category.label() self.va...
Categorized renderer class
categorized
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class categorized: """Categorized renderer class""" def __init__(self, geoType, field, fieldType, category, layerTransparency): """Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name...
stack_v2_sparse_classes_75kplus_train_001870
36,198
permissive
[ { "docstring": "Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name of the attribute field used in the symbology :type field: str :param fieldType: Type of the attribute field used in the symbology (Integ...
3
stack_v2_sparse_classes_30k_train_052820
Implement the Python class `categorized` described below. Class description: Categorized renderer class Method signatures and docstrings: - def __init__(self, geoType, field, fieldType, category, layerTransparency): Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoT...
Implement the Python class `categorized` described below. Class description: Categorized renderer class Method signatures and docstrings: - def __init__(self, geoType, field, fieldType, category, layerTransparency): Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoT...
aa3733f2cc0e52ca70b93bc55d5f8f7059b73e31
<|skeleton|> class categorized: """Categorized renderer class""" def __init__(self, geoType, field, fieldType, category, layerTransparency): """Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class categorized: """Categorized renderer class""" def __init__(self, geoType, field, fieldType, category, layerTransparency): """Initialise the symbol range :param geoType: Layer.geometryType() GeometryType of the layer. :type geoType: GeometryType e.g. QGis.WKBPolygon :param field: Name of the attri...
the_stack_v2_python_sparse
symbology.py
Real-Currents/d3MapRenderer
train
0
3288b8ca2a0ad50d62e7def01d025312649510d7
[ "super().add_args(parser)\nfor param in om.computations_params[self.computation_name]:\n add_argument_kwargs = {key: param.get(key) for key in ['action', 'nargs', 'const', 'type', 'choices', 'help', 'metavar', 'dest'] if param.get(key) is not None}\n if 'help' in add_argument_kwargs:\n arg_name = f\"--...
<|body_start_0|> super().add_args(parser) for param in om.computations_params[self.computation_name]: add_argument_kwargs = {key: param.get(key) for key in ['action', 'nargs', 'const', 'type', 'choices', 'help', 'metavar', 'dest'] if param.get(key) is not None} if 'help' in add_a...
Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step
OasisComputationCommand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OasisComputationCommand: """Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step""" def add_args(self, parser): """Adds arguments to the argument parser. :param parser: The argument p...
stack_v2_sparse_classes_75kplus_train_001871
5,012
permissive
[ { "docstring": "Adds arguments to the argument parser. :param parser: The argument parser object :type parser: ArgumentParser", "name": "add_args", "signature": "def add_args(self, parser)" }, { "docstring": "Generic method that call the correct manager method from the child class computation_na...
2
stack_v2_sparse_classes_30k_train_024196
Implement the Python class `OasisComputationCommand` described below. Class description: Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step Method signatures and docstrings: - def add_args(self, parser): Adds argume...
Implement the Python class `OasisComputationCommand` described below. Class description: Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step Method signatures and docstrings: - def add_args(self, parser): Adds argume...
23e704c335629ccd010969b1090446cfa3f384d5
<|skeleton|> class OasisComputationCommand: """Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step""" def add_args(self, parser): """Adds arguments to the argument parser. :param parser: The argument p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OasisComputationCommand: """Eventually, the Parent class for all Oasis Computation Command create the command line interface from parameter define in the associated computation step""" def add_args(self, parser): """Adds arguments to the argument parser. :param parser: The argument parser object ...
the_stack_v2_python_sparse
oasislmf/cli/command.py
OasisLMF/OasisLMF
train
122
aca3eb1aa6f11d6af1dfd68f80b269107c05560d
[ "v.theme.dark = self._dark_theme\nself.theme_name = 'dark' if self._dark_theme else 'light'\nsu.set_config('theme', self.theme_name)\nself.kwargs = DARK_THEME if self._dark_theme else LIGHT_THEME\nself.kwargs = new_colors or self.kwargs\ntheme = getattr(v.theme.themes, self.theme_name)\n[setattr(theme, color_name, ...
<|body_start_0|> v.theme.dark = self._dark_theme self.theme_name = 'dark' if self._dark_theme else 'light' su.set_config('theme', self.theme_name) self.kwargs = DARK_THEME if self._dark_theme else LIGHT_THEME self.kwargs = new_colors or self.kwargs theme = getattr(v.theme...
SepalColor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SepalColor: def __init__(self, *_, **new_colors) -> None: """Custom simple name space to store and access to the sepal_ui colors and with a magic method to display theme. Args: **new_colors (optional): the new colors to set in hexadecimal as a dict (experimental)""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_001872
5,262
permissive
[ { "docstring": "Custom simple name space to store and access to the sepal_ui colors and with a magic method to display theme. Args: **new_colors (optional): the new colors to set in hexadecimal as a dict (experimental)", "name": "__init__", "signature": "def __init__(self, *_, **new_colors) -> None" }...
2
stack_v2_sparse_classes_30k_train_006584
Implement the Python class `SepalColor` described below. Class description: Implement the SepalColor class. Method signatures and docstrings: - def __init__(self, *_, **new_colors) -> None: Custom simple name space to store and access to the sepal_ui colors and with a magic method to display theme. Args: **new_colors...
Implement the Python class `SepalColor` described below. Class description: Implement the SepalColor class. Method signatures and docstrings: - def __init__(self, *_, **new_colors) -> None: Custom simple name space to store and access to the sepal_ui colors and with a magic method to display theme. Args: **new_colors...
b26c7d698659d5c5a2029d02fc94dcd9daf0df98
<|skeleton|> class SepalColor: def __init__(self, *_, **new_colors) -> None: """Custom simple name space to store and access to the sepal_ui colors and with a magic method to display theme. Args: **new_colors (optional): the new colors to set in hexadecimal as a dict (experimental)""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SepalColor: def __init__(self, *_, **new_colors) -> None: """Custom simple name space to store and access to the sepal_ui colors and with a magic method to display theme. Args: **new_colors (optional): the new colors to set in hexadecimal as a dict (experimental)""" v.theme.dark = self._dark_t...
the_stack_v2_python_sparse
sepal_ui/frontend/styles.py
12rambau/sepal_ui
train
17
6d957b3b3a589f576c2f8d0df3c37f99063d3809
[ "li = []\n\ndef helper(node, res):\n if not node:\n return\n res = res + node.val\n if node.left == None and node.right == None:\n li.append(res)\n helper(node.left, res)\n helper(node.right, res)\nhelper(root, 0)\nprint(li)\nfor item in li:\n if item == sum:\n return True\nre...
<|body_start_0|> li = [] def helper(node, res): if not node: return res = res + node.val if node.left == None and node.right == None: li.append(res) helper(node.left, res) helper(node.right, res) helper(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSum1(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> li = [...
stack_v2_sparse_classes_75kplus_train_001873
1,266
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" }, { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum1", "signature": "def hasPathSum1(self, root, sum)" } ]
2
stack_v2_sparse_classes_30k_train_049330
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSum1(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSum1(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool <|skeleton...
b049816905f3ea19707577d07f4b414147da3cfb
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSum1(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" li = [] def helper(node, res): if not node: return res = res + node.val if node.left == None and node.right == None: li...
the_stack_v2_python_sparse
0112hasPathSum.py
mondon11/leetcode
train
0
9b59af4e98e0d0f495a173948530287e74e1f842
[ "super(TransformerSeq2SeqEncoder, self).__init__()\nself.embed = get_embeddings(embed)\nself.embed_scale = math.sqrt(d_model)\nself.pos_embed = pos_embed\nself.num_layers = num_layers\nself.d_model = d_model\nself.n_head = n_head\nself.dim_ff = dim_ff\nself.dropout = dropout\nself.input_fc = nn.Linear(self.embed.em...
<|body_start_0|> super(TransformerSeq2SeqEncoder, self).__init__() self.embed = get_embeddings(embed) self.embed_scale = math.sqrt(d_model) self.pos_embed = pos_embed self.num_layers = num_layers self.d_model = d_model self.n_head = n_head self.dim_ff = di...
TransformerSeq2SeqEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerSeq2SeqEncoder: def __init__(self, embed: Union[nn.Module, StaticEmbedding, Tuple[int, int]], pos_embed=None, num_layers=6, d_model=512, n_head=8, dim_ff=2048, dropout=0.1): """基于Transformer的Encoder :param embed: encoder输入token的embedding :param nn.Module pos_embed: position em...
stack_v2_sparse_classes_75kplus_train_001874
7,093
permissive
[ { "docstring": "基于Transformer的Encoder :param embed: encoder输入token的embedding :param nn.Module pos_embed: position embedding :param int num_layers: 多少层的encoder :param int d_model: 输入输出的维度 :param int n_head: 多少个head :param int dim_ff: FFN中间的维度大小 :param float dropout: Attention和FFN的dropout大小", "name": "__init_...
2
stack_v2_sparse_classes_30k_train_050655
Implement the Python class `TransformerSeq2SeqEncoder` described below. Class description: Implement the TransformerSeq2SeqEncoder class. Method signatures and docstrings: - def __init__(self, embed: Union[nn.Module, StaticEmbedding, Tuple[int, int]], pos_embed=None, num_layers=6, d_model=512, n_head=8, dim_ff=2048, ...
Implement the Python class `TransformerSeq2SeqEncoder` described below. Class description: Implement the TransformerSeq2SeqEncoder class. Method signatures and docstrings: - def __init__(self, embed: Union[nn.Module, StaticEmbedding, Tuple[int, int]], pos_embed=None, num_layers=6, d_model=512, n_head=8, dim_ff=2048, ...
148ad1dcb7aa4990ac30d9a62ae8b89b6e706f8c
<|skeleton|> class TransformerSeq2SeqEncoder: def __init__(self, embed: Union[nn.Module, StaticEmbedding, Tuple[int, int]], pos_embed=None, num_layers=6, d_model=512, n_head=8, dim_ff=2048, dropout=0.1): """基于Transformer的Encoder :param embed: encoder输入token的embedding :param nn.Module pos_embed: position em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformerSeq2SeqEncoder: def __init__(self, embed: Union[nn.Module, StaticEmbedding, Tuple[int, int]], pos_embed=None, num_layers=6, d_model=512, n_head=8, dim_ff=2048, dropout=0.1): """基于Transformer的Encoder :param embed: encoder输入token的embedding :param nn.Module pos_embed: position embedding :param...
the_stack_v2_python_sparse
fastNLP/modules/encoder/seq2seq_encoder.py
irfan11111111/fastNLP
train
1
3aa50cd82b1ac77df7f38e50c8ac6d3dd0fe65b5
[ "Continuum.__init__(self, *args, **kwargs)\nself.regions = regions\nself.average = average", "if valid is None:\n valid = np.ones(x.shape, dtype=np.bool)\nxx = []\nyy = []\nfor r in self.regions:\n mask = valid & (x >= r[0]) & (x <= r[1])\n if self.average:\n xx.append(np.mean(x[mask]))\n y...
<|body_start_0|> Continuum.__init__(self, *args, **kwargs) self.regions = regions self.average = average <|end_body_0|> <|body_start_1|> if valid is None: valid = np.ones(x.shape, dtype=np.bool) xx = [] yy = [] for r in self.regions: mask ...
Derives continuum from given regions.
Regions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regions: """Derives continuum from given regions.""" def __init__(self, regions: List[Tuple[float, float]], average: bool=True, *args, **kwargs): """Initializes new Regions continuum Args: regions: List of tuples with start end end x values for regions. average: Use average wave/flux...
stack_v2_sparse_classes_75kplus_train_001875
15,610
permissive
[ { "docstring": "Initializes new Regions continuum Args: regions: List of tuples with start end end x values for regions. average: Use average wave/flux in regions instead of all pixels.", "name": "__init__", "signature": "def __init__(self, regions: List[Tuple[float, float]], average: bool=True, *args, ...
2
null
Implement the Python class `Regions` described below. Class description: Derives continuum from given regions. Method signatures and docstrings: - def __init__(self, regions: List[Tuple[float, float]], average: bool=True, *args, **kwargs): Initializes new Regions continuum Args: regions: List of tuples with start end...
Implement the Python class `Regions` described below. Class description: Derives continuum from given regions. Method signatures and docstrings: - def __init__(self, regions: List[Tuple[float, float]], average: bool=True, *args, **kwargs): Initializes new Regions continuum Args: regions: List of tuples with start end...
648eb1758e3744d9e3d6669edc4a0c4753559f17
<|skeleton|> class Regions: """Derives continuum from given regions.""" def __init__(self, regions: List[Tuple[float, float]], average: bool=True, *args, **kwargs): """Initializes new Regions continuum Args: regions: List of tuples with start end end x values for regions. average: Use average wave/flux...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Regions: """Derives continuum from given regions.""" def __init__(self, regions: List[Tuple[float, float]], average: bool=True, *args, **kwargs): """Initializes new Regions continuum Args: regions: List of tuples with start end end x values for regions. average: Use average wave/flux in regions i...
the_stack_v2_python_sparse
spexxy/utils/continuum.py
thusser/spexxy
train
4
01c181c73d4faa468c1b724483c24b4d84ff7082
[ "left_height, right_height = (0, 0)\nif root.left is None and root.right is None:\n return 0\nif root.left is not None:\n left_height = self.height(root.left)\nif root.right is not None:\n right_height = self.height(root.right)\nreturn max(left_height, right_height) + 1", "if root is None:\n return []...
<|body_start_0|> left_height, right_height = (0, 0) if root.left is None and root.right is None: return 0 if root.left is not None: left_height = self.height(root.left) if root.right is not None: right_height = self.height(root.right) return ma...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def height(self, root: TreeNode) -> int: """>>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2) >>> s.height(root) 1 >>> s.height(root.left) 0""" <|body_0|> def printTree(self, root: TreeNode | None) -> list[list[str]]: """>>> s = Solution...
stack_v2_sparse_classes_75kplus_train_001876
2,862
no_license
[ { "docstring": ">>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2) >>> s.height(root) 1 >>> s.height(root.left) 0", "name": "height", "signature": "def height(self, root: TreeNode) -> int" }, { "docstring": ">>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2)...
2
stack_v2_sparse_classes_30k_train_015877
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def height(self, root: TreeNode) -> int: >>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2) >>> s.height(root) 1 >>> s.height(root.left) 0 - def printTree(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def height(self, root: TreeNode) -> int: >>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2) >>> s.height(root) 1 >>> s.height(root.left) 0 - def printTree(self...
d2e8b2dca40fc955045eb62e576c776bad8ee5f1
<|skeleton|> class Solution: def height(self, root: TreeNode) -> int: """>>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2) >>> s.height(root) 1 >>> s.height(root.left) 0""" <|body_0|> def printTree(self, root: TreeNode | None) -> list[list[str]]: """>>> s = Solution...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def height(self, root: TreeNode) -> int: """>>> s = Solution() >>> root = TreeNode(1) >>> root.left = TreeNode(2) >>> s.height(root) 1 >>> s.height(root.left) 0""" left_height, right_height = (0, 0) if root.left is None and root.right is None: return 0 if ...
the_stack_v2_python_sparse
print-binary-tree/solution.py
childe/leetcode
train
2
fd115993a258640a5f69874c5d7cd34822113baa
[ "super(APConnect, self).__init__()\nself.nodes = nodes\nreturn", "self.logger.info(\"Connecting '{0}' to SSID: '{1}'\".format(parameters.nodes.parameters, parameters.ssids.parameters))\nself.nodes[parameters.nodes.parameters].connect(parameters.ssids.parameters)\nreturn" ]
<|body_start_0|> super(APConnect, self).__init__() self.nodes = nodes return <|end_body_0|> <|body_start_1|> self.logger.info("Connecting '{0}' to SSID: '{1}'".format(parameters.nodes.parameters, parameters.ssids.parameters)) self.nodes[parameters.nodes.parameters].connect(param...
A class to connect a device to an AP
APConnect
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APConnect: """A class to connect a device to an AP""" def __init__(self, nodes): """:param: - `nodes`: dictionary of id:device pairs""" <|body_0|> def __call__(self, parameters): """:param: - `parameters`: a named tuple with `nodes.parameters` and `ssids.paramete...
stack_v2_sparse_classes_75kplus_train_001877
970
permissive
[ { "docstring": ":param: - `nodes`: dictionary of id:device pairs", "name": "__init__", "signature": "def __init__(self, nodes)" }, { "docstring": ":param: - `parameters`: a named tuple with `nodes.parameters` and `ssids.parameters` attributes", "name": "__call__", "signature": "def __cal...
2
stack_v2_sparse_classes_30k_train_032987
Implement the Python class `APConnect` described below. Class description: A class to connect a device to an AP Method signatures and docstrings: - def __init__(self, nodes): :param: - `nodes`: dictionary of id:device pairs - def __call__(self, parameters): :param: - `parameters`: a named tuple with `nodes.parameters...
Implement the Python class `APConnect` described below. Class description: A class to connect a device to an AP Method signatures and docstrings: - def __init__(self, nodes): :param: - `nodes`: dictionary of id:device pairs - def __call__(self, parameters): :param: - `parameters`: a named tuple with `nodes.parameters...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class APConnect: """A class to connect a device to an AP""" def __init__(self, nodes): """:param: - `nodes`: dictionary of id:device pairs""" <|body_0|> def __call__(self, parameters): """:param: - `parameters`: a named tuple with `nodes.parameters` and `ssids.paramete...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class APConnect: """A class to connect a device to an AP""" def __init__(self, nodes): """:param: - `nodes`: dictionary of id:device pairs""" super(APConnect, self).__init__() self.nodes = nodes return def __call__(self, parameters): """:param: - `parameters`: a nam...
the_stack_v2_python_sparse
apetools/affectors/apconnect.py
russell-n/oldape
train
0
491af05458ad0c24050fe7538d767bb7b5615188
[ "logger.info('load trainset from %s' % path)\nmode = TaskMode.create_train()\nreturn self._parse_creator(path, mode)", "logger.info('load testset from %s' % path)\nmode = TaskMode.create_test()\nreturn self._parse_creator(path, mode)", "logger.info('load inferset from %s' % path)\nmode = TaskMode.create_infer()...
<|body_start_0|> logger.info('load trainset from %s' % path) mode = TaskMode.create_train() return self._parse_creator(path, mode) <|end_body_0|> <|body_start_1|> logger.info('load testset from %s' % path) mode = TaskMode.create_test() return self._parse_creator(path, mo...
Dataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: def train(self, path): """载入数据集""" <|body_0|> def test(self, path): """载入测试集""" <|body_1|> def infer(self, path): """载入预测集""" <|body_2|> def _parse_creator(self, path, mode): """稀疏化数据集""" <|body_3|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_001878
2,064
permissive
[ { "docstring": "载入数据集", "name": "train", "signature": "def train(self, path)" }, { "docstring": "载入测试集", "name": "test", "signature": "def test(self, path)" }, { "docstring": "载入预测集", "name": "infer", "signature": "def infer(self, path)" }, { "docstring": "稀疏化数据集"...
4
stack_v2_sparse_classes_30k_train_003605
Implement the Python class `Dataset` described below. Class description: Implement the Dataset class. Method signatures and docstrings: - def train(self, path): 载入数据集 - def test(self, path): 载入测试集 - def infer(self, path): 载入预测集 - def _parse_creator(self, path, mode): 稀疏化数据集
Implement the Python class `Dataset` described below. Class description: Implement the Dataset class. Method signatures and docstrings: - def train(self, path): 载入数据集 - def test(self, path): 载入测试集 - def infer(self, path): 载入预测集 - def _parse_creator(self, path, mode): 稀疏化数据集 <|skeleton|> class Dataset: def train...
d71136c105b78b57c5df1fe98e19e2fd8ee65045
<|skeleton|> class Dataset: def train(self, path): """载入数据集""" <|body_0|> def test(self, path): """载入测试集""" <|body_1|> def infer(self, path): """载入预测集""" <|body_2|> def _parse_creator(self, path, mode): """稀疏化数据集""" <|body_3|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dataset: def train(self, path): """载入数据集""" logger.info('load trainset from %s' % path) mode = TaskMode.create_train() return self._parse_creator(path, mode) def test(self, path): """载入测试集""" logger.info('load testset from %s' % path) mode = TaskMod...
the_stack_v2_python_sparse
lesson9/reader.py
tiansiyuan/DeepLearningAndPaddleTutorial
train
0
9e610cef92c3f9a27ce716577bd54232b9871a21
[ "result = [[]]\nfor num in nums:\n result += [curr_result + [num] for curr_result in result]\nreturn result", "result = []\n\ndef backtrack(tmp, idx):\n result.append(tmp[:])\n for i in xrange(idx, len(nums)):\n tmp.append(nums[i])\n backtrack(tmp, i + 1)\n tmp.pop()\nbacktrack([], 0...
<|body_start_0|> result = [[]] for num in nums: result += [curr_result + [num] for curr_result in result] return result <|end_body_0|> <|body_start_1|> result = [] def backtrack(tmp, idx): result.append(tmp[:]) for i in xrange(idx, len(nums))...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets_1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [[]] for n...
stack_v2_sparse_classes_75kplus_train_001879
1,481
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets_1", "signature": "def subsets_1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_028067
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets_1(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets_1(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
5c2473f859da5efec73120256faad06ab8e0e359
<|skeleton|> class Solution: def subsets_1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subsets_1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" result = [[]] for num in nums: result += [curr_result + [num] for curr_result in result] return result def subsets(self, nums): """:type nums: List[int] :rtype: Lis...
the_stack_v2_python_sparse
leetcode/subsets.py
chlos/exercises_in_futility
train
0
2ff57fc0666b5d3178f54f82aec139f793ca308f
[ "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...
PeeringGroupPeers provides the building blocks necessary to link two peering groups.
PeeringGroupPeersServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeeringGroupPeersServicer: """PeeringGroupPeers provides the building blocks necessary to link two peering groups.""" def Create(self, request, context): """Create links two peering groups.""" <|body_0|> def Delete(self, request, context): """Delete unlinks two p...
stack_v2_sparse_classes_75kplus_train_001880
8,167
permissive
[ { "docstring": "Create links two peering groups.", "name": "Create", "signature": "def Create(self, request, context)" }, { "docstring": "Delete unlinks two peering groups.", "name": "Delete", "signature": "def Delete(self, request, context)" }, { "docstring": "Get reads the info...
4
stack_v2_sparse_classes_30k_train_028099
Implement the Python class `PeeringGroupPeersServicer` described below. Class description: PeeringGroupPeers provides the building blocks necessary to link two peering groups. Method signatures and docstrings: - def Create(self, request, context): Create links two peering groups. - def Delete(self, request, context):...
Implement the Python class `PeeringGroupPeersServicer` described below. Class description: PeeringGroupPeers provides the building blocks necessary to link two peering groups. Method signatures and docstrings: - def Create(self, request, context): Create links two peering groups. - def Delete(self, request, context):...
1f3a53ef8c404e64d9324f9fd13f5c39c71eaca5
<|skeleton|> class PeeringGroupPeersServicer: """PeeringGroupPeers provides the building blocks necessary to link two peering groups.""" def Create(self, request, context): """Create links two peering groups.""" <|body_0|> def Delete(self, request, context): """Delete unlinks two p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PeeringGroupPeersServicer: """PeeringGroupPeers provides the building blocks necessary to link two peering groups.""" def Create(self, request, context): """Create links two peering groups.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemen...
the_stack_v2_python_sparse
strongdm/peering_group_peers_pb2_grpc.py
strongdm/strongdm-sdk-python
train
9
7d09b62d616989dcae74b87bf4504516a31b9413
[ "self.predictor_logger = logging.getLogger('predictor')\nself.predictor_logger.setLevel(logging.DEBUG)\nif not os.path.exists(LOGS_FILE_PATH):\n try:\n os.makedirs(LOGS_FILE_PATH)\n except OSError as e:\n if e.errno != errno.EEXIST:\n raise\nfh = logging.FileHandler(os.path.join(LOGS_...
<|body_start_0|> self.predictor_logger = logging.getLogger('predictor') self.predictor_logger.setLevel(logging.DEBUG) if not os.path.exists(LOGS_FILE_PATH): try: os.makedirs(LOGS_FILE_PATH) except OSError as e: if e.errno != errno.EEXIST: ...
TODO
_Logger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Logger: """TODO""" def __init__(self): """Initializes logger for logging messages in log file and console. This method should not never been explicitly called. Instead, ``get_logger`` method should be used when obtaining reference to logger instance. Messages of level INFO and highe...
stack_v2_sparse_classes_75kplus_train_001881
2,447
permissive
[ { "docstring": "Initializes logger for logging messages in log file and console. This method should not never been explicitly called. Instead, ``get_logger`` method should be used when obtaining reference to logger instance. Messages of level INFO and higher (except those of DEBUG level) are logged on the conso...
2
stack_v2_sparse_classes_30k_train_029153
Implement the Python class `_Logger` described below. Class description: TODO Method signatures and docstrings: - def __init__(self): Initializes logger for logging messages in log file and console. This method should not never been explicitly called. Instead, ``get_logger`` method should be used when obtaining refer...
Implement the Python class `_Logger` described below. Class description: TODO Method signatures and docstrings: - def __init__(self): Initializes logger for logging messages in log file and console. This method should not never been explicitly called. Instead, ``get_logger`` method should be used when obtaining refer...
4919d6bede01298f269985fdce94d8176d2ad62b
<|skeleton|> class _Logger: """TODO""" def __init__(self): """Initializes logger for logging messages in log file and console. This method should not never been explicitly called. Instead, ``get_logger`` method should be used when obtaining reference to logger instance. Messages of level INFO and highe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Logger: """TODO""" def __init__(self): """Initializes logger for logging messages in log file and console. This method should not never been explicitly called. Instead, ``get_logger`` method should be used when obtaining reference to logger instance. Messages of level INFO and higher (except tho...
the_stack_v2_python_sparse
Algorithm-Selection/gripsPredictorPkg/predictor/logger.py
goranagojic/algoselection
train
0
6092746b461e8423478ff35b1dc045f10190790a
[ "num_dic = {}\nfor i, num in enumerate(numbers):\n if num_dic.get(target - num) is not None:\n return [num_dic.get(target - num) + 1, i + 1]\n else:\n num_dic[num] = i\nreturn [-1, -1]", "left, right = (0, len(numbers) - 1)\nwhile left < right:\n sums = numbers[left] + numbers[right]\n i...
<|body_start_0|> num_dic = {} for i, num in enumerate(numbers): if num_dic.get(target - num) is not None: return [num_dic.get(target - num) + 1, i + 1] else: num_dic[num] = i return [-1, -1] <|end_body_0|> <|body_start_1|> left, ri...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, numbers, target): """字典边存边查看是否满足""" <|body_0|> def twoSum_(self, numbers, target): """双指针法:有效利用有序数组这个条件""" <|body_1|> <|end_skeleton|> <|body_start_0|> num_dic = {} for i, num in enumerate(numbers): if ...
stack_v2_sparse_classes_75kplus_train_001882
1,765
no_license
[ { "docstring": "字典边存边查看是否满足", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": "双指针法:有效利用有序数组这个条件", "name": "twoSum_", "signature": "def twoSum_(self, numbers, target)" } ]
2
stack_v2_sparse_classes_30k_test_002775
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): 字典边存边查看是否满足 - def twoSum_(self, numbers, target): 双指针法:有效利用有序数组这个条件
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): 字典边存边查看是否满足 - def twoSum_(self, numbers, target): 双指针法:有效利用有序数组这个条件 <|skeleton|> class Solution: def twoSum(self, numbers, target): ...
2e81b871bf1db7ea7432d1ebf889c72066e64753
<|skeleton|> class Solution: def twoSum(self, numbers, target): """字典边存边查看是否满足""" <|body_0|> def twoSum_(self, numbers, target): """双指针法:有效利用有序数组这个条件""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, numbers, target): """字典边存边查看是否满足""" num_dic = {} for i, num in enumerate(numbers): if num_dic.get(target - num) is not None: return [num_dic.get(target - num) + 1, i + 1] else: num_dic[num] = i r...
the_stack_v2_python_sparse
array/twoSum.py
NextNight/LeetCodeAndStructAndAlgorithm
train
0
4fa69a811473d990ad8bf952615094e79bcac648
[ "pl = PageLogin(self.driver)\npl.quick_login()\nree = ReceiveEmail(self.driver)\nree.goto_inbox()\nself.driver.switch_to.frame('mainFrame')\nree.single_check(0)\nree.completely_del_email()\nself.driver.switch_to.default_content()\nree.prompt_confirmation(0)\nassert ree.get_message_box() == '删除成功 [撤销]', '未删除成功'\nree...
<|body_start_0|> pl = PageLogin(self.driver) pl.quick_login() ree = ReceiveEmail(self.driver) ree.goto_inbox() self.driver.switch_to.frame('mainFrame') ree.single_check(0) ree.completely_del_email() self.driver.switch_to.default_content() ree.promp...
收件箱,信件彻底删除测试
TestCompleteTheEmail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCompleteTheEmail: """收件箱,信件彻底删除测试""" def test1_single_delete(self): """随机勾选一个信件彻底删除""" <|body_0|> def test2_batch_del(self): """随机批量彻底删除""" <|body_1|> def test3_del_by_sender(self): """按发件人姓名勾选彻底删除""" <|body_2|> def test4_del...
stack_v2_sparse_classes_75kplus_train_001883
3,456
no_license
[ { "docstring": "随机勾选一个信件彻底删除", "name": "test1_single_delete", "signature": "def test1_single_delete(self)" }, { "docstring": "随机批量彻底删除", "name": "test2_batch_del", "signature": "def test2_batch_del(self)" }, { "docstring": "按发件人姓名勾选彻底删除", "name": "test3_del_by_sender", "s...
4
stack_v2_sparse_classes_30k_train_022702
Implement the Python class `TestCompleteTheEmail` described below. Class description: 收件箱,信件彻底删除测试 Method signatures and docstrings: - def test1_single_delete(self): 随机勾选一个信件彻底删除 - def test2_batch_del(self): 随机批量彻底删除 - def test3_del_by_sender(self): 按发件人姓名勾选彻底删除 - def test4_del_all(self): 全部勾选彻底删除
Implement the Python class `TestCompleteTheEmail` described below. Class description: 收件箱,信件彻底删除测试 Method signatures and docstrings: - def test1_single_delete(self): 随机勾选一个信件彻底删除 - def test2_batch_del(self): 随机批量彻底删除 - def test3_del_by_sender(self): 按发件人姓名勾选彻底删除 - def test4_del_all(self): 全部勾选彻底删除 <|skeleton|> class...
d6fb7c64903dfbf89f9b10f4bc3beb72e7c251f5
<|skeleton|> class TestCompleteTheEmail: """收件箱,信件彻底删除测试""" def test1_single_delete(self): """随机勾选一个信件彻底删除""" <|body_0|> def test2_batch_del(self): """随机批量彻底删除""" <|body_1|> def test3_del_by_sender(self): """按发件人姓名勾选彻底删除""" <|body_2|> def test4_del...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCompleteTheEmail: """收件箱,信件彻底删除测试""" def test1_single_delete(self): """随机勾选一个信件彻底删除""" pl = PageLogin(self.driver) pl.quick_login() ree = ReceiveEmail(self.driver) ree.goto_inbox() self.driver.switch_to.frame('mainFrame') ree.single_check(0) ...
the_stack_v2_python_sparse
QQ_mail_auto_test/mail_auto_test/test_case/testF_complete_delete.py
jianghualuo/python_selenium
train
0
5c0ebdbadc44c0e63f02830f0d70a756f1273091
[ "name = homework.get_slug()\nrepos_root = Config.REPOS_ROOT + '/' + name\ntry:\n os.mkdir(repos_root)\nexcept FileExistsError:\n pass\nrepositories = Repository.clone(Repository.search(name), repos_root, homework)\nfor repo in repositories:\n Repository.parse(repo)", "repos = []\nresponse_len = Config.GI...
<|body_start_0|> name = homework.get_slug() repos_root = Config.REPOS_ROOT + '/' + name try: os.mkdir(repos_root) except FileExistsError: pass repositories = Repository.clone(Repository.search(name), repos_root, homework) for repo in repositories: ...
Repository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Repository: def clone_n_parse(homework): """Clone all repositories for given homework and parse all solution files for each repository""" <|body_0|> def search(name): """Searches for gitea repositories with given name. Returns a list of dictionaries representing repo...
stack_v2_sparse_classes_75kplus_train_001884
6,212
no_license
[ { "docstring": "Clone all repositories for given homework and parse all solution files for each repository", "name": "clone_n_parse", "signature": "def clone_n_parse(homework)" }, { "docstring": "Searches for gitea repositories with given name. Returns a list of dictionaries representing reposit...
6
stack_v2_sparse_classes_30k_train_019457
Implement the Python class `Repository` described below. Class description: Implement the Repository class. Method signatures and docstrings: - def clone_n_parse(homework): Clone all repositories for given homework and parse all solution files for each repository - def search(name): Searches for gitea repositories wi...
Implement the Python class `Repository` described below. Class description: Implement the Repository class. Method signatures and docstrings: - def clone_n_parse(homework): Clone all repositories for given homework and parse all solution files for each repository - def search(name): Searches for gitea repositories wi...
86f343f8fc734207799fdc30b2266e982be24213
<|skeleton|> class Repository: def clone_n_parse(homework): """Clone all repositories for given homework and parse all solution files for each repository""" <|body_0|> def search(name): """Searches for gitea repositories with given name. Returns a list of dictionaries representing repo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Repository: def clone_n_parse(homework): """Clone all repositories for given homework and parse all solution files for each repository""" name = homework.get_slug() repos_root = Config.REPOS_ROOT + '/' + name try: os.mkdir(repos_root) except FileExistsError:...
the_stack_v2_python_sparse
app/repository.py
KSET/OKOSL_homeworks
train
1
6446087165ac247f2c5601a60ef383b00c6ba5eb
[ "stripes_count = int(2 * (surface.get_height() + surface.get_width()) / (cls.STRIPE_SPACING * surface.scaling))\ns_origin, _ = lane.local_coordinates(surface.origin)\ns0 = (int(s_origin) // cls.STRIPE_SPACING - stripes_count // 2) * cls.STRIPE_SPACING\nfor side in range(2):\n if lane.line_types[side] == LineType...
<|body_start_0|> stripes_count = int(2 * (surface.get_height() + surface.get_width()) / (cls.STRIPE_SPACING * surface.scaling)) s_origin, _ = lane.local_coordinates(surface.origin) s0 = (int(s_origin) // cls.STRIPE_SPACING - stripes_count // 2) * cls.STRIPE_SPACING for side in range(2): ...
A visualization of a lane.
LaneGraphics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaneGraphics: """A visualization of a lane.""" def display(cls, lane, surface): """Display a lane on a surface. :param lane: the lane to be displayed :param surface: the pygame surface""" <|body_0|> def striped_line(cls, lane, surface, stripes_count, s0, side): "...
stack_v2_sparse_classes_75kplus_train_001885
19,284
no_license
[ { "docstring": "Display a lane on a surface. :param lane: the lane to be displayed :param surface: the pygame surface", "name": "display", "signature": "def display(cls, lane, surface)" }, { "docstring": "Draw a striped line on one side of a lane, on a surface. :param lane: the lane :param surfa...
5
stack_v2_sparse_classes_30k_train_007673
Implement the Python class `LaneGraphics` described below. Class description: A visualization of a lane. Method signatures and docstrings: - def display(cls, lane, surface): Display a lane on a surface. :param lane: the lane to be displayed :param surface: the pygame surface - def striped_line(cls, lane, surface, str...
Implement the Python class `LaneGraphics` described below. Class description: A visualization of a lane. Method signatures and docstrings: - def display(cls, lane, surface): Display a lane on a surface. :param lane: the lane to be displayed :param surface: the pygame surface - def striped_line(cls, lane, surface, str...
d615d6f0561d04f6f4eb928d49a1b4363389f9dd
<|skeleton|> class LaneGraphics: """A visualization of a lane.""" def display(cls, lane, surface): """Display a lane on a surface. :param lane: the lane to be displayed :param surface: the pygame surface""" <|body_0|> def striped_line(cls, lane, surface, stripes_count, s0, side): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LaneGraphics: """A visualization of a lane.""" def display(cls, lane, surface): """Display a lane on a surface. :param lane: the lane to be displayed :param surface: the pygame surface""" stripes_count = int(2 * (surface.get_height() + surface.get_width()) / (cls.STRIPE_SPACING * surface....
the_stack_v2_python_sparse
highwayEnv/Graphics/graphics.py
RonMen10/Artificial-decision-making-of-autonomous-vehicles-AI
train
4
fd3c13af74c6049fadb2d306176cd60729b1f076
[ "_aa_sequence = ''\nmappings = {x.uniprot_position: x.uniprot_residue for x in mappings}\nfor key in sorted(mappings, key=lambda x: (x is None, x)):\n if skip_asterix_at_end and key is None:\n continue\n _aa_sequence += mappings[key]\nreturn _aa_sequence", "if region_start < 0 or region_stop > len(se...
<|body_start_0|> _aa_sequence = '' mappings = {x.uniprot_position: x.uniprot_residue for x in mappings} for key in sorted(mappings, key=lambda x: (x is None, x)): if skip_asterix_at_end and key is None: continue _aa_sequence += mappings[key] return...
SequenceRepository
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SequenceRepository: def get_aa_sequence(mappings, skip_asterix_at_end=False): """For a list of mappings, returns the amino acid sequence based on the uniprot positions If an asterix is expected at the end (e.g. a stop codon) there is the posibility to skip that""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_001886
17,106
permissive
[ { "docstring": "For a list of mappings, returns the amino acid sequence based on the uniprot positions If an asterix is expected at the end (e.g. a stop codon) there is the posibility to skip that", "name": "get_aa_sequence", "signature": "def get_aa_sequence(mappings, skip_asterix_at_end=False)" }, ...
3
null
Implement the Python class `SequenceRepository` described below. Class description: Implement the SequenceRepository class. Method signatures and docstrings: - def get_aa_sequence(mappings, skip_asterix_at_end=False): For a list of mappings, returns the amino acid sequence based on the uniprot positions If an asterix...
Implement the Python class `SequenceRepository` described below. Class description: Implement the SequenceRepository class. Method signatures and docstrings: - def get_aa_sequence(mappings, skip_asterix_at_end=False): For a list of mappings, returns the amino acid sequence based on the uniprot positions If an asterix...
2b4448b33cbc5512b56f5aaa7453d0a255ee1628
<|skeleton|> class SequenceRepository: def get_aa_sequence(mappings, skip_asterix_at_end=False): """For a list of mappings, returns the amino acid sequence based on the uniprot positions If an asterix is expected at the end (e.g. a stop codon) there is the posibility to skip that""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SequenceRepository: def get_aa_sequence(mappings, skip_asterix_at_end=False): """For a list of mappings, returns the amino acid sequence based on the uniprot positions If an asterix is expected at the end (e.g. a stop codon) there is the posibility to skip that""" _aa_sequence = '' map...
the_stack_v2_python_sparse
metadome/domain/repositories.py
kchennen/metadome
train
0
e906604128afbbab825f2aeaada205ad46eaf0d8
[ "self.group = group\nself.order = self.group.order()\nself.n = n\nself.generators = [self.group.hash_to_point(str(i).encode()) for i in range(n + 1)]\nself.generators = np.array(self.generators)", "if len(values) != self.n:\n raise RuntimeError('Incorrect length of input {0} expected {1}'.format(len(values), s...
<|body_start_0|> self.group = group self.order = self.group.order() self.n = n self.generators = [self.group.hash_to_point(str(i).encode()) for i in range(n + 1)] self.generators = np.array(self.generators) <|end_body_0|> <|body_start_1|> if len(values) != self.n: ...
Simple public key for Pedersen's commitment scheme
PublicKey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicKey: """Simple public key for Pedersen's commitment scheme""" def __init__(self, group, n): """Create a public key for the Pedersen commitment scheme. Create a public key for a Pedersen commitment scheme in group `group` for n elements. We set the bases by hashing integers to p...
stack_v2_sparse_classes_75kplus_train_001887
6,646
no_license
[ { "docstring": "Create a public key for the Pedersen commitment scheme. Create a public key for a Pedersen commitment scheme in group `group` for n elements. We set the bases by hashing integers to points on the curve. Example: >>> G = EcGroup() >>> pk = PublicKey(G, 2) >>> G = FFGroup() >>> pk = PublicKey(G, 2...
2
stack_v2_sparse_classes_30k_train_018307
Implement the Python class `PublicKey` described below. Class description: Simple public key for Pedersen's commitment scheme Method signatures and docstrings: - def __init__(self, group, n): Create a public key for the Pedersen commitment scheme. Create a public key for a Pedersen commitment scheme in group `group` ...
Implement the Python class `PublicKey` described below. Class description: Simple public key for Pedersen's commitment scheme Method signatures and docstrings: - def __init__(self, group, n): Create a public key for the Pedersen commitment scheme. Create a public key for a Pedersen commitment scheme in group `group` ...
bf6b2ba1dc7f3d6fc81a7d83b5fea122eecb8871
<|skeleton|> class PublicKey: """Simple public key for Pedersen's commitment scheme""" def __init__(self, group, n): """Create a public key for the Pedersen commitment scheme. Create a public key for a Pedersen commitment scheme in group `group` for n elements. We set the bases by hashing integers to p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PublicKey: """Simple public key for Pedersen's commitment scheme""" def __init__(self, group, n): """Create a public key for the Pedersen commitment scheme. Create a public key for a Pedersen commitment scheme in group `group` for n elements. We set the bases by hashing integers to points on the ...
the_stack_v2_python_sparse
primitives/pedersen.py
iquerejeta/rsa_sign_ring
train
1
3e0fa2e54938d72afe0ee795890c28920402d6dc
[ "if self.kill:\n return\nif self.text_timer[index].IsRunning():\n self.text_timer[index].Stop()\nelse:\n self.saved_text = self.GetStatusText(index)\nself.SetStatusText(text, index)\nself.text_timer[index].Start(3000, oneShot=True)", "if self.kill:\n return\nif self.text_timer[index].IsRunning():\n ...
<|body_start_0|> if self.kill: return if self.text_timer[index].IsRunning(): self.text_timer[index].Stop() else: self.saved_text = self.GetStatusText(index) self.SetStatusText(text, index) self.text_timer[index].Start(3000, oneShot=True) <|end_...
Timed status in status bar.
TimedStatusExtension
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimedStatusExtension: """Timed status in status bar.""" def set_timed_status(self, text, index=0): """Set the status for a short time. Save the previous status for restore when the timed status completes.""" <|body_0|> def cancel_timed_status(self, index=0): """C...
stack_v2_sparse_classes_75kplus_train_001888
9,581
permissive
[ { "docstring": "Set the status for a short time. Save the previous status for restore when the timed status completes.", "name": "set_timed_status", "signature": "def set_timed_status(self, text, index=0)" }, { "docstring": "Cancel running timed status.", "name": "cancel_timed_status", "...
6
stack_v2_sparse_classes_30k_train_006399
Implement the Python class `TimedStatusExtension` described below. Class description: Timed status in status bar. Method signatures and docstrings: - def set_timed_status(self, text, index=0): Set the status for a short time. Save the previous status for restore when the timed status completes. - def cancel_timed_sta...
Implement the Python class `TimedStatusExtension` described below. Class description: Timed status in status bar. Method signatures and docstrings: - def set_timed_status(self, text, index=0): Set the status for a short time. Save the previous status for restore when the timed status completes. - def cancel_timed_sta...
95129ca054384a4c59a4effdb3fe32a7a66af6ff
<|skeleton|> class TimedStatusExtension: """Timed status in status bar.""" def set_timed_status(self, text, index=0): """Set the status for a short time. Save the previous status for restore when the timed status completes.""" <|body_0|> def cancel_timed_status(self, index=0): """C...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimedStatusExtension: """Timed status in status bar.""" def set_timed_status(self, text, index=0): """Set the status for a short time. Save the previous status for restore when the timed status completes.""" if self.kill: return if self.text_timer[index].IsRunning(): ...
the_stack_v2_python_sparse
rummage/lib/gui/controls/custom_statusbar.py
facelessuser/Rummage
train
70
994230ab0479ed58e3b84eb43673850649f3c682
[ "data = self.data\ngroups = data.get('groups', [])\nslugs = {g.get('slug', '') for g in groups}\nreturn tuple(slugs)", "payload = super().transform()\ndata = self.data\npayload[0]['fullname'] = data.get('fullname')\npayload[0]['email'] = data.get('email')\npayload[0]['data'] = {'FIRSTNAME': data.get('first_name')...
<|body_start_0|> data = self.data groups = data.get('groups', []) slugs = {g.get('slug', '') for g in groups} return tuple(slugs) <|end_body_0|> <|body_start_1|> payload = super().transform() data = self.data payload[0]['fullname'] = data.get('fullname') ...
Base class for emails sent on User events.
UserMail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserMail: """Base class for emails sent on User events.""" def user_groups_slugs(self) -> t.Sequence[str]: """Given the event data, return a sequence of group slugs. :return: Sequence of group slugs""" <|body_0|> def transform(self) -> t.List[dict]: """Transform ...
stack_v2_sparse_classes_75kplus_train_001889
4,062
no_license
[ { "docstring": "Given the event data, return a sequence of group slugs. :return: Sequence of group slugs", "name": "user_groups_slugs", "signature": "def user_groups_slugs(self) -> t.Sequence[str]" }, { "docstring": "Transform data.", "name": "transform", "signature": "def transform(self...
2
stack_v2_sparse_classes_30k_train_017134
Implement the Python class `UserMail` described below. Class description: Base class for emails sent on User events. Method signatures and docstrings: - def user_groups_slugs(self) -> t.Sequence[str]: Given the event data, return a sequence of group slugs. :return: Sequence of group slugs - def transform(self) -> t.L...
Implement the Python class `UserMail` described below. Class description: Base class for emails sent on User events. Method signatures and docstrings: - def user_groups_slugs(self) -> t.Sequence[str]: Given the event data, return a sequence of group slugs. :return: Sequence of group slugs - def transform(self) -> t.L...
cca179f55ebc3c420426eff59b23d7c8963ca9a3
<|skeleton|> class UserMail: """Base class for emails sent on User events.""" def user_groups_slugs(self) -> t.Sequence[str]: """Given the event data, return a sequence of group slugs. :return: Sequence of group slugs""" <|body_0|> def transform(self) -> t.List[dict]: """Transform ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserMail: """Base class for emails sent on User events.""" def user_groups_slugs(self) -> t.Sequence[str]: """Given the event data, return a sequence of group slugs. :return: Sequence of group slugs""" data = self.data groups = data.get('groups', []) slugs = {g.get('slug',...
the_stack_v2_python_sparse
src/briefy/choreographer/actions/mail/user.py
BriefyHQ/briefy.choreographer
train
0
709ae2b0a9d3ae1341fbad581cebf484a64fb9c0
[ "self.p1 = p1\nself.p2 = p2\nself.p3 = p3\nself.normal = math3d.cross(p2 - p1, p3 - p1)\nself.area = self.normal.magnitude()\nself.normalnew = self.normal.normalized_copy()\nself.plane = Plane(self.normal, math3d.dot(p1, self.normal), None)\nself.color = color", "result = self.plane.rayHit(R)\nif result != None:\...
<|body_start_0|> self.p1 = p1 self.p2 = p2 self.p3 = p3 self.normal = math3d.cross(p2 - p1, p3 - p1) self.area = self.normal.magnitude() self.normalnew = self.normal.normalized_copy() self.plane = Plane(self.normal, math3d.dot(p1, self.normal), None) self....
A triangle
Triangle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Triangle: """A triangle""" def __init__(self, p1, p2, p3, color): """p1, p2, and p3 are 3 (non-equal) VectorN positions material: an instance of one of the classes in materials.py""" <|body_0|> def rayHit(self, R): """R: a Ray object in the same dimension as this...
stack_v2_sparse_classes_75kplus_train_001890
15,203
no_license
[ { "docstring": "p1, p2, and p3 are 3 (non-equal) VectorN positions material: an instance of one of the classes in materials.py", "name": "__init__", "signature": "def __init__(self, p1, p2, p3, color)" }, { "docstring": "R: a Ray object in the same dimension as this triangle. This method returns...
3
null
Implement the Python class `Triangle` described below. Class description: A triangle Method signatures and docstrings: - def __init__(self, p1, p2, p3, color): p1, p2, and p3 are 3 (non-equal) VectorN positions material: an instance of one of the classes in materials.py - def rayHit(self, R): R: a Ray object in the s...
Implement the Python class `Triangle` described below. Class description: A triangle Method signatures and docstrings: - def __init__(self, p1, p2, p3, color): p1, p2, and p3 are 3 (non-equal) VectorN positions material: an instance of one of the classes in materials.py - def rayHit(self, R): R: a Ray object in the s...
700657208eb57d197d6c8e7811c5a3eb12b4ae5b
<|skeleton|> class Triangle: """A triangle""" def __init__(self, p1, p2, p3, color): """p1, p2, and p3 are 3 (non-equal) VectorN positions material: an instance of one of the classes in materials.py""" <|body_0|> def rayHit(self, R): """R: a Ray object in the same dimension as this...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Triangle: """A triangle""" def __init__(self, p1, p2, p3, color): """p1, p2, and p3 are 3 (non-equal) VectorN positions material: an instance of one of the classes in materials.py""" self.p1 = p1 self.p2 = p2 self.p3 = p3 self.normal = math3d.cross(p2 - p1, p3 - p1...
the_stack_v2_python_sparse
src/objects3d.py
Kingcitaldo125/Python-Files
train
0
2faebd7b647b21f05a9962dfdc1fddef6c1e2b37
[ "prev = None\n\ndef go(root):\n if root:\n go(root.right)\n go(root.left)\n nonlocal prev\n root.right = prev\n root.left = None\n prev = root\ngo(root)", "ret = []\n\ndef go(root):\n if root:\n ret.append(root)\n go(root.left)\n go(root.right)\...
<|body_start_0|> prev = None def go(root): if root: go(root.right) go(root.left) nonlocal prev root.right = prev root.left = None prev = root go(root) <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def flattenA(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. 用前序全部裝到lis...
stack_v2_sparse_classes_75kplus_train_001891
1,313
no_license
[ { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. 用前序全部裝到list中 然後將後面的Node當成...
2
stack_v2_sparse_classes_30k_train_015542
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def flattenA(self, root): :type root: TreeNode :rtype: void Do ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def flattenA(self, root): :type root: TreeNode :rtype: void Do ...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def flattenA(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. 用前序全部裝到lis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" prev = None def go(root): if root: go(root.right) go(root.left) nonlocal prev ro...
the_stack_v2_python_sparse
cs_notes/tree/recursive/flatten_binary_tree_to_linked_list.py
hwc1824/LeetCodeSolution
train
0
2c32e3ed8876f5b92b3074c45c4657991a922e56
[ "if not parent:\n parent = tk.Tk()\n parent.withdraw()\nself.prompt = prompt\nself.initialvalue = initialvalue\nself.username_entry = None\nself.pass_entry = None\ntkSimpleDialog.Dialog.__init__(self, parent, title)", "self.username_entry = None\nself.pass_entry = None\ntkSimpleDialog.Dialog.destroy(self)",...
<|body_start_0|> if not parent: parent = tk.Tk() parent.withdraw() self.prompt = prompt self.initialvalue = initialvalue self.username_entry = None self.pass_entry = None tkSimpleDialog.Dialog.__init__(self, parent, title) <|end_body_0|> <|body_st...
Auth query dialog (replicates tkSimpleDialog._QueryDialog)
_QueryAuthDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _QueryAuthDialog: """Auth query dialog (replicates tkSimpleDialog._QueryDialog)""" def __init__(self, title, prompt, initialvalue=None, parent=None): """Constructor called in instantiation. Creates an auth query dialog window. :param title: the dialog title :type title: basestring :p...
stack_v2_sparse_classes_75kplus_train_001892
4,519
no_license
[ { "docstring": "Constructor called in instantiation. Creates an auth query dialog window. :param title: the dialog title :type title: basestring :param prompt: the label text :type prompt: basestring :param initialvalue: initial username value :type initialvalue: basestring :param parent: a parent window (the a...
5
stack_v2_sparse_classes_30k_train_046492
Implement the Python class `_QueryAuthDialog` described below. Class description: Auth query dialog (replicates tkSimpleDialog._QueryDialog) Method signatures and docstrings: - def __init__(self, title, prompt, initialvalue=None, parent=None): Constructor called in instantiation. Creates an auth query dialog window. ...
Implement the Python class `_QueryAuthDialog` described below. Class description: Auth query dialog (replicates tkSimpleDialog._QueryDialog) Method signatures and docstrings: - def __init__(self, title, prompt, initialvalue=None, parent=None): Constructor called in instantiation. Creates an auth query dialog window. ...
e632b43890b1ab2fc3eb76621e72a23f5f0d1a9a
<|skeleton|> class _QueryAuthDialog: """Auth query dialog (replicates tkSimpleDialog._QueryDialog)""" def __init__(self, title, prompt, initialvalue=None, parent=None): """Constructor called in instantiation. Creates an auth query dialog window. :param title: the dialog title :type title: basestring :p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _QueryAuthDialog: """Auth query dialog (replicates tkSimpleDialog._QueryDialog)""" def __init__(self, title, prompt, initialvalue=None, parent=None): """Constructor called in instantiation. Creates an auth query dialog window. :param title: the dialog title :type title: basestring :param prompt: ...
the_stack_v2_python_sparse
widgets/auth_dialog.py
deepak223098/Auto-Jama-Proxy-Creation
train
2
616d4eb4fd8aceec185b6013d5029ff8766b9238
[ "self.novel_id = self.novel_url.split('rebirth.online/novel/')[1].split('/')[0]\nlogger.info('Novel Id: %s', self.novel_id)\nself.novel_url = book_url % self.novel_id\nlogger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nself.novel_title = soup.select_one('h2.entry-title a').text\nlogg...
<|body_start_0|> self.novel_id = self.novel_url.split('rebirth.online/novel/')[1].split('/')[0] logger.info('Novel Id: %s', self.novel_id) self.novel_url = book_url % self.novel_id logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel...
RebirthOnlineCrawler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RebirthOnlineCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_001893
3,418
permissive
[ { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring": "Download body of a single chapter and return as clean html format.", "name": "download_chapter_body", "signature": "def download_chapter_body(self, c...
2
null
Implement the Python class `RebirthOnlineCrawler` described below. Class description: Implement the RebirthOnlineCrawler class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as c...
Implement the Python class `RebirthOnlineCrawler` described below. Class description: Implement the RebirthOnlineCrawler class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and return as c...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class RebirthOnlineCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RebirthOnlineCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" self.novel_id = self.novel_url.split('rebirth.online/novel/')[1].split('/')[0] logger.info('Novel Id: %s', self.novel_id) self.novel_url = book_url % self.novel_id logger.debug('Vis...
the_stack_v2_python_sparse
lncrawl/sources/rebirthonline.py
NNTin/lightnovel-crawler
train
2
0be2dab7064a3b9af860c074c1b541112f817aa1
[ "if dt <= 0:\n raise ValueError('dt should be strictly positive')\nif not isinstance(data, np.ndarray):\n raise TypeError('Data has to be a numpy array')\ncondition = isinstance(lag_structure, LagStructure)\nif not condition and lag_structure is not None:\n raise TypeError('lag structure has to be a LagStr...
<|body_start_0|> if dt <= 0: raise ValueError('dt should be strictly positive') if not isinstance(data, np.ndarray): raise TypeError('Data has to be a numpy array') condition = isinstance(lag_structure, LagStructure) if not condition and lag_structure is not None:...
This is the basic class for a sensor. It contains the data of a single instance (pixel, time series, any other object with multiple samples) and some methods to operate with them
Sensor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sensor: """This is the basic class for a sensor. It contains the data of a single instance (pixel, time series, any other object with multiple samples) and some methods to operate with them""" def __init__(self, data, dt=1.0, lag_structure=LagStructure(window_size=10)): """Initialize...
stack_v2_sparse_classes_75kplus_train_001894
6,911
no_license
[ { "docstring": "Initializes the sensor, data should be an array of the samples for the sensor and dt the sampling rate, lag structure is an object from the LagStructure class", "name": "__init__", "signature": "def __init__(self, data, dt=1.0, lag_structure=LagStructure(window_size=10))" }, { "d...
2
stack_v2_sparse_classes_30k_val_002140
Implement the Python class `Sensor` described below. Class description: This is the basic class for a sensor. It contains the data of a single instance (pixel, time series, any other object with multiple samples) and some methods to operate with them Method signatures and docstrings: - def __init__(self, data, dt=1.0...
Implement the Python class `Sensor` described below. Class description: This is the basic class for a sensor. It contains the data of a single instance (pixel, time series, any other object with multiple samples) and some methods to operate with them Method signatures and docstrings: - def __init__(self, data, dt=1.0...
654fb67ef6258b3f200c15a2b8068ab9300401d7
<|skeleton|> class Sensor: """This is the basic class for a sensor. It contains the data of a single instance (pixel, time series, any other object with multiple samples) and some methods to operate with them""" def __init__(self, data, dt=1.0, lag_structure=LagStructure(window_size=10)): """Initialize...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sensor: """This is the basic class for a sensor. It contains the data of a single instance (pixel, time series, any other object with multiple samples) and some methods to operate with them""" def __init__(self, data, dt=1.0, lag_structure=LagStructure(window_size=10)): """Initializes the sensor,...
the_stack_v2_python_sparse
inputs/sensors.py
h-mayorquin/time_series_basic
train
0
51a80ef7b85d759dcdce8dd65783d9426266bc6a
[ "self.correctProbs = self.be.iobuf(1)\nself.top1 = self.be.iobuf(1)\nself.topk = self.be.iobuf(1)\nself.k = k\nself.metric_names = ['LogLoss', 'Top1Misclass', 'Top' + str(k) + 'Misclass']", "be = self.be\nself.correctProbs[:] = be.sum(y * t, axis=0)\nnSlots = self.k - be.sum(y > self.correctProbs, axis=0)\nnEq = ...
<|body_start_0|> self.correctProbs = self.be.iobuf(1) self.top1 = self.be.iobuf(1) self.topk = self.be.iobuf(1) self.k = k self.metric_names = ['LogLoss', 'Top1Misclass', 'Top' + str(k) + 'Misclass'] <|end_body_0|> <|body_start_1|> be = self.be self.correctProbs[...
Multiple misclassification metrics. Computes the LogLoss metric, the Top-1 Misclassification rate, and the Top-K misclassification rate.
TopKMisclassification
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopKMisclassification: """Multiple misclassification metrics. Computes the LogLoss metric, the Top-1 Misclassification rate, and the Top-K misclassification rate.""" def __init__(self, k): """Arguments: k (integer): Number of guesses to allow.""" <|body_0|> def __call__(...
stack_v2_sparse_classes_75kplus_train_001895
28,077
permissive
[ { "docstring": "Arguments: k (integer): Number of guesses to allow.", "name": "__init__", "signature": "def __init__(self, k)" }, { "docstring": "Returns a numpy array of metrics for: LogLoss, Top-1, and Top-K. Args: y (Tensor or OpTree): Output of previous layer or model t (Tensor or OpTree): T...
2
stack_v2_sparse_classes_30k_train_008498
Implement the Python class `TopKMisclassification` described below. Class description: Multiple misclassification metrics. Computes the LogLoss metric, the Top-1 Misclassification rate, and the Top-K misclassification rate. Method signatures and docstrings: - def __init__(self, k): Arguments: k (integer): Number of g...
Implement the Python class `TopKMisclassification` described below. Class description: Multiple misclassification metrics. Computes the LogLoss metric, the Top-1 Misclassification rate, and the Top-K misclassification rate. Method signatures and docstrings: - def __init__(self, k): Arguments: k (integer): Number of g...
11fd08f5fab303067c03dfc4d1e4332e12a61187
<|skeleton|> class TopKMisclassification: """Multiple misclassification metrics. Computes the LogLoss metric, the Top-1 Misclassification rate, and the Top-K misclassification rate.""" def __init__(self, k): """Arguments: k (integer): Number of guesses to allow.""" <|body_0|> def __call__(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TopKMisclassification: """Multiple misclassification metrics. Computes the LogLoss metric, the Top-1 Misclassification rate, and the Top-K misclassification rate.""" def __init__(self, k): """Arguments: k (integer): Number of guesses to allow.""" self.correctProbs = self.be.iobuf(1) ...
the_stack_v2_python_sparse
skynet/neon/transforms/cost.py
evanjzou/stocks-nn
train
4
b217f07d6de18fe26f668b738c15e3ae56a1fbcd
[ "with open(positives, encoding='utf-8') as file_stream:\n self.pos_words = [line.rstrip('\\n') for line in file_stream if line[0].isalpha()]\nwith open(negatives, encoding='utf-8') as file_stream:\n self.neg_words = [line.rstrip('\\n') for line in file_stream if line[0].isalpha()]", "if not isinstance(text,...
<|body_start_0|> with open(positives, encoding='utf-8') as file_stream: self.pos_words = [line.rstrip('\n') for line in file_stream if line[0].isalpha()] with open(negatives, encoding='utf-8') as file_stream: self.neg_words = [line.rstrip('\n') for line in file_stream if line[0]....
Implements sentiment analysis.
Analyzer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Analyzer: """Implements sentiment analysis.""" def __init__(self, positives, negatives): """Initialize Analyzer.""" <|body_0|> def analyze(self, text): """Analyze text for sentiment, returning its score.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001896
1,421
no_license
[ { "docstring": "Initialize Analyzer.", "name": "__init__", "signature": "def __init__(self, positives, negatives)" }, { "docstring": "Analyze text for sentiment, returning its score.", "name": "analyze", "signature": "def analyze(self, text)" } ]
2
stack_v2_sparse_classes_30k_train_035615
Implement the Python class `Analyzer` described below. Class description: Implements sentiment analysis. Method signatures and docstrings: - def __init__(self, positives, negatives): Initialize Analyzer. - def analyze(self, text): Analyze text for sentiment, returning its score.
Implement the Python class `Analyzer` described below. Class description: Implements sentiment analysis. Method signatures and docstrings: - def __init__(self, positives, negatives): Initialize Analyzer. - def analyze(self, text): Analyze text for sentiment, returning its score. <|skeleton|> class Analyzer: """I...
0dd9ff601dc86e1615ead90c394137f56ff98a73
<|skeleton|> class Analyzer: """Implements sentiment analysis.""" def __init__(self, positives, negatives): """Initialize Analyzer.""" <|body_0|> def analyze(self, text): """Analyze text for sentiment, returning its score.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Analyzer: """Implements sentiment analysis.""" def __init__(self, positives, negatives): """Initialize Analyzer.""" with open(positives, encoding='utf-8') as file_stream: self.pos_words = [line.rstrip('\n') for line in file_stream if line[0].isalpha()] with open(negati...
the_stack_v2_python_sparse
CS50 projects/sentiments/analyzer.py
SilentGamelan/code_portfolio
train
0
896fed0cf4e76b9f3d7f51e217e87e6319a1c095
[ "if reverse:\n return -matrix[-1 - row][-1 - col]\nelse:\n return matrix[row][col]", "k -= 1\nfrom heapq import heappush, heappop\nnumRows = len(matrix)\nnumCols = len(matrix[0])\nreverse = False\nif k > numRows * numCols // 2:\n k = numRows * numCols - 1 - k\n reverse = True\nseenCells = {(0, 0)}\nhe...
<|body_start_0|> if reverse: return -matrix[-1 - row][-1 - col] else: return matrix[row][col] <|end_body_0|> <|body_start_1|> k -= 1 from heapq import heappush, heappop numRows = len(matrix) numCols = len(matrix[0]) reverse = False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMatrixCell(self, matrix, row, col, reverse): """if reverse, row and col are from back, and also reverse signk""" <|body_0|> def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_001897
1,725
no_license
[ { "docstring": "if reverse, row and col are from back, and also reverse signk", "name": "getMatrixCell", "signature": "def getMatrixCell(self, matrix, row, col, reverse)" }, { "docstring": ":type matrix: List[List[int]] :type k: int :rtype: int", "name": "kthSmallest", "signature": "def ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMatrixCell(self, matrix, row, col, reverse): if reverse, row and col are from back, and also reverse signk - def kthSmallest(self, matrix, k): :type matrix: List[List[int]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMatrixCell(self, matrix, row, col, reverse): if reverse, row and col are from back, and also reverse signk - def kthSmallest(self, matrix, k): :type matrix: List[List[int]...
6e051eb554d9cf6f424f1e0a77f3072adf7f64c4
<|skeleton|> class Solution: def getMatrixCell(self, matrix, row, col, reverse): """if reverse, row and col are from back, and also reverse signk""" <|body_0|> def kthSmallest(self, matrix, k): """:type matrix: List[List[int]] :type k: int :rtype: int""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getMatrixCell(self, matrix, row, col, reverse): """if reverse, row and col are from back, and also reverse signk""" if reverse: return -matrix[-1 - row][-1 - col] else: return matrix[row][col] def kthSmallest(self, matrix, k): """:type...
the_stack_v2_python_sparse
378. Kth Smallest Element in a Sorted Matrix.py
vincent-kangzhou/LeetCode-Python
train
0
2f17b4c3e3db64f730dcbe33b8acac4249e39c7e
[ "hist, _ = np.histogram(y, bins=max(y[:, 0]) + 1)\nself.class_ids = np.where(n_shot + n_query <= hist)[0]\nself.x = x\nself.y = y\nself.shape_x = x.shape[1:]\nself.n_way = n_way\nself.n_shot = n_shot\nself.n_query = n_query\nself.s_x = np.zeros((n_way * n_shot,) + x[0].shape)\nself.q_x = np.zeros((n_way * n_query,)...
<|body_start_0|> hist, _ = np.histogram(y, bins=max(y[:, 0]) + 1) self.class_ids = np.where(n_shot + n_query <= hist)[0] self.x = x self.y = y self.shape_x = x.shape[1:] self.n_way = n_way self.n_shot = n_shot self.n_query = n_query self.s_x = np.z...
EpisodeGenerator
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-proprietary-license", "Apache-2.0", "CC-BY-NC-4.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpisodeGenerator: def __init__(self, x, y, n_way, n_shot, n_query): """Initialization function for episode generator class Args: x (nd_array): nd_array of images (n_sample, image_shape) y (nd_array): nd_array of labels (n_sample, 1) n_way (int): number of support classes, generally calle...
stack_v2_sparse_classes_75kplus_train_001898
22,165
permissive
[ { "docstring": "Initialization function for episode generator class Args: x (nd_array): nd_array of images (n_sample, image_shape) y (nd_array): nd_array of labels (n_sample, 1) n_way (int): number of support classes, generally called n_way in one-shot litterateur n_shot (int): number of shots per class n_query...
2
stack_v2_sparse_classes_30k_train_034391
Implement the Python class `EpisodeGenerator` described below. Class description: Implement the EpisodeGenerator class. Method signatures and docstrings: - def __init__(self, x, y, n_way, n_shot, n_query): Initialization function for episode generator class Args: x (nd_array): nd_array of images (n_sample, image_shap...
Implement the Python class `EpisodeGenerator` described below. Class description: Implement the EpisodeGenerator class. Method signatures and docstrings: - def __init__(self, x, y, n_way, n_shot, n_query): Initialization function for episode generator class Args: x (nd_array): nd_array of images (n_sample, image_shap...
41f71faa6efff7774a76bbd5af3198322a90a6ab
<|skeleton|> class EpisodeGenerator: def __init__(self, x, y, n_way, n_shot, n_query): """Initialization function for episode generator class Args: x (nd_array): nd_array of images (n_sample, image_shape) y (nd_array): nd_array of labels (n_sample, 1) n_way (int): number of support classes, generally calle...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EpisodeGenerator: def __init__(self, x, y, n_way, n_shot, n_query): """Initialization function for episode generator class Args: x (nd_array): nd_array of images (n_sample, image_shape) y (nd_array): nd_array of labels (n_sample, 1) n_way (int): number of support classes, generally called n_way in one...
the_stack_v2_python_sparse
meta-learning/prototypical/prototypical.py
sony/nnabla-examples
train
308
5885f66e6d7e56f733deb43afa3733a8d645136c
[ "k = 2 * np.pi / wave.wavelength\nunwrapped_phase_lbl = f'[{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}, {np.max(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}] rad; [{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]) * 1000000.0 / k:.1f}, {np.max(wave.get_unwrapped_phase(a...
<|body_start_0|> k = 2 * np.pi / wave.wavelength unwrapped_phase_lbl = f'[{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}, {np.max(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]):.2f}] rad; [{np.min(wave.get_unwrapped_phase(aperture=aperture, z=z)[0]) * 1000000.0 / k:.1f}, {np.max...
Построение графиков распространения волны в пространстве
WavePlotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WavePlotter: """Построение графиков распространения волны в пространстве""" def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): """Сохраняет график для фазы :return:""" <|body_0|> def save_intensity(wave: Wave, z: float, saver: S...
stack_v2_sparse_classes_75kplus_train_001899
3,997
no_license
[ { "docstring": "Сохраняет график для фазы :return:", "name": "save_phase", "signature": "def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False)" }, { "docstring": "Сохраняет график для интенсивности :return:", "name": "save_intensity", "signature": "...
4
stack_v2_sparse_classes_30k_train_052193
Implement the Python class `WavePlotter` described below. Class description: Построение графиков распространения волны в пространстве Method signatures and docstrings: - def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): Сохраняет график для фазы :return: - def save_intensit...
Implement the Python class `WavePlotter` described below. Class description: Построение графиков распространения волны в пространстве Method signatures and docstrings: - def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): Сохраняет график для фазы :return: - def save_intensit...
102ff08f22d9f82d74884d5c31a6b91b804d26f4
<|skeleton|> class WavePlotter: """Построение графиков распространения волны в пространстве""" def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): """Сохраняет график для фазы :return:""" <|body_0|> def save_intensity(wave: Wave, z: float, saver: S...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WavePlotter: """Построение графиков распространения волны в пространстве""" def save_phase(wave: Wave, aperture: Aperture, z: float, saver: Saver, save_npy: bool=False): """Сохраняет график для фазы :return:""" k = 2 * np.pi / wave.wavelength unwrapped_phase_lbl = f'[{np.min(wave....
the_stack_v2_python_sparse
src/propagation/presenter/interface/wave_plotter.py
megamott/Phase-problem-modeling
train
2