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
14f73d388dce505acb8f30bb623fd6d540791ffe
[ "print('Testing that spatial_correlation returns a float')\nsc_result = spatial_correlation(5, 5, 5, 5, 5, 5, 5, 5, 5, 5)\nself.assertTrue(isinstance(sc_result, float), 'spatial correlation is not a float')", "print('Testing that spatial_correlation returns an array')\nhist_long = [53.195, 51.954, 53.107]\nfloat_...
<|body_start_0|> print('Testing that spatial_correlation returns a float') sc_result = spatial_correlation(5, 5, 5, 5, 5, 5, 5, 5, 5, 5) self.assertTrue(isinstance(sc_result, float), 'spatial correlation is not a float') <|end_body_0|> <|body_start_1|> print('Testing that spatial_correl...
Test cases for "spatial_correlation" function
MyTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTestCase: """Test cases for "spatial_correlation" function""" def test_spatial_correlation_returns_float(self): """Check that spatial_correlation returns a float if given a float :return: Nothing""" <|body_0|> def test_spatial_correlation_returns_array(self): "...
stack_v2_sparse_classes_75kplus_train_007300
5,068
no_license
[ { "docstring": "Check that spatial_correlation returns a float if given a float :return: Nothing", "name": "test_spatial_correlation_returns_float", "signature": "def test_spatial_correlation_returns_float(self)" }, { "docstring": "Check that spatial_correlation returns an array if given an arra...
4
stack_v2_sparse_classes_30k_train_004457
Implement the Python class `MyTestCase` described below. Class description: Test cases for "spatial_correlation" function Method signatures and docstrings: - def test_spatial_correlation_returns_float(self): Check that spatial_correlation returns a float if given a float :return: Nothing - def test_spatial_correlatio...
Implement the Python class `MyTestCase` described below. Class description: Test cases for "spatial_correlation" function Method signatures and docstrings: - def test_spatial_correlation_returns_float(self): Check that spatial_correlation returns a float if given a float :return: Nothing - def test_spatial_correlatio...
3944e9783d58422d2d10bbc95f9706e168550034
<|skeleton|> class MyTestCase: """Test cases for "spatial_correlation" function""" def test_spatial_correlation_returns_float(self): """Check that spatial_correlation returns a float if given a float :return: Nothing""" <|body_0|> def test_spatial_correlation_returns_array(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyTestCase: """Test cases for "spatial_correlation" function""" def test_spatial_correlation_returns_float(self): """Check that spatial_correlation returns a float if given a float :return: Nothing""" print('Testing that spatial_correlation returns a float') sc_result = spatial_co...
the_stack_v2_python_sparse
ow_calibration/find_besthist/spatial_correlation/spatial_correlation_test.py
gmaze/argodmqc_owc
train
0
c8c7743fa094ded31aa581a690b015718024a24f
[ "if not self.start_year and (not self.end_year):\n return ''\nif self.start_year == self.end_year:\n return self.start_year\ndate_parts = [self.start_year, '-', self.end_year]\nreturn ''.join([str(dp) for dp in date_parts if dp is not None])", "if exclude is None:\n exclude = []\nif 'start_year' in exclu...
<|body_start_0|> if not self.start_year and (not self.end_year): return '' if self.start_year == self.end_year: return self.start_year date_parts = [self.start_year, '-', self.end_year] return ''.join([str(dp) for dp in date_parts if dp is not None]) <|end_body_0|...
Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year.
DateRange
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateRange: """Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year.""" def dates(self): """Date or date range as a string for display""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_007301
2,365
permissive
[ { "docstring": "Date or date range as a string for display", "name": "dates", "signature": "def dates(self)" }, { "docstring": "Override to clean fields to make sure start/end year are sensical", "name": "clean_fields", "signature": "def clean_fields(self, exclude=None)" } ]
2
stack_v2_sparse_classes_30k_train_018825
Implement the Python class `DateRange` described below. Class description: Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year. Method signatures and docstrings: - def dates(self): Date or dat...
Implement the Python class `DateRange` described below. Class description: Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year. Method signatures and docstrings: - def dates(self): Date or dat...
6371bb1266d7751af59aeaa3426ef7ac02a1fe17
<|skeleton|> class DateRange: """Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year.""" def dates(self): """Date or date range as a string for display""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DateRange: """Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year.""" def dates(self): """Date or date range as a string for display""" if not self.start_year and ...
the_stack_v2_python_sparse
derrida/common/models.py
Princeton-CDH/derrida-django
train
13
2a3becd523ade2de253dd5233f5c849ec749153d
[ "self._open_since = 0\nif 'proto' not in device or int(device['proto'][0:1]) == 1:\n data_key = 'status'\nelse:\n data_key = 'window_status'\nsuper().__init__(device, 'Door Window Sensor', xiaomi_hub, data_key, BinarySensorDeviceClass.OPENING, config_entry)", "attrs = {ATTR_OPEN_SINCE: self._open_since}\nat...
<|body_start_0|> self._open_since = 0 if 'proto' not in device or int(device['proto'][0:1]) == 1: data_key = 'status' else: data_key = 'window_status' super().__init__(device, 'Door Window Sensor', xiaomi_hub, data_key, BinarySensorDeviceClass.OPENING, config_entr...
Representation of a XiaomiDoorSensor.
XiaomiDoorSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XiaomiDoorSensor: """Representation of a XiaomiDoorSensor.""" def __init__(self, device, xiaomi_hub, config_entry): """Initialize the XiaomiDoorSensor.""" <|body_0|> def extra_state_attributes(self): """Return the state attributes.""" <|body_1|> asyn...
stack_v2_sparse_classes_75kplus_train_007302
20,131
permissive
[ { "docstring": "Initialize the XiaomiDoorSensor.", "name": "__init__", "signature": "def __init__(self, device, xiaomi_hub, config_entry)" }, { "docstring": "Return the state attributes.", "name": "extra_state_attributes", "signature": "def extra_state_attributes(self)" }, { "doc...
4
stack_v2_sparse_classes_30k_test_000667
Implement the Python class `XiaomiDoorSensor` described below. Class description: Representation of a XiaomiDoorSensor. Method signatures and docstrings: - def __init__(self, device, xiaomi_hub, config_entry): Initialize the XiaomiDoorSensor. - def extra_state_attributes(self): Return the state attributes. - async de...
Implement the Python class `XiaomiDoorSensor` described below. Class description: Representation of a XiaomiDoorSensor. Method signatures and docstrings: - def __init__(self, device, xiaomi_hub, config_entry): Initialize the XiaomiDoorSensor. - def extra_state_attributes(self): Return the state attributes. - async de...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class XiaomiDoorSensor: """Representation of a XiaomiDoorSensor.""" def __init__(self, device, xiaomi_hub, config_entry): """Initialize the XiaomiDoorSensor.""" <|body_0|> def extra_state_attributes(self): """Return the state attributes.""" <|body_1|> asyn...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XiaomiDoorSensor: """Representation of a XiaomiDoorSensor.""" def __init__(self, device, xiaomi_hub, config_entry): """Initialize the XiaomiDoorSensor.""" self._open_since = 0 if 'proto' not in device or int(device['proto'][0:1]) == 1: data_key = 'status' else:...
the_stack_v2_python_sparse
homeassistant/components/xiaomi_aqara/binary_sensor.py
home-assistant/core
train
35,501
85e805c14e8b7a3c966c67e06320c6e74c26b8cd
[ "self.dist = dist\nself.accel = accel\nself.decel = decel\nd0 = dist * decel / (accel + decel)\nd1 = 0\nt0 = sqrt(2 * d0 / accel)\nt1 = 0\nt2 = accel / decel * t0\nvc = accel * t0\nif vc > max_speed:\n t0 = max_speed / accel\n t2 = max_speed / decel\n d0 = max_speed * t0 / 2\n d1 = dist - 0.5 * (accel *...
<|body_start_0|> self.dist = dist self.accel = accel self.decel = decel d0 = dist * decel / (accel + decel) d1 = 0 t0 = sqrt(2 * d0 / accel) t1 = 0 t2 = accel / decel * t0 vc = accel * t0 if vc > max_speed: t0 = max_speed / acce...
The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.
AToBConstAccel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AToBConstAccel: """The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.""" def __init__(self, dist, accel, decel, max_speed=inf): """dist: The distance between A to B; accel: The rate of acceleration; decel: The ...
stack_v2_sparse_classes_75kplus_train_007303
1,724
no_license
[ { "docstring": "dist: The distance between A to B; accel: The rate of acceleration; decel: The rate of deceleration; max_speed: Optional. The max speed of movement.", "name": "__init__", "signature": "def __init__(self, dist, accel, decel, max_speed=inf)" }, { "docstring": "Calculating the curre...
2
stack_v2_sparse_classes_30k_train_001969
Implement the Python class `AToBConstAccel` described below. Class description: The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant. Method signatures and docstrings: - def __init__(self, dist, accel, decel, max_speed=inf): dist: The distance bet...
Implement the Python class `AToBConstAccel` described below. Class description: The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant. Method signatures and docstrings: - def __init__(self, dist, accel, decel, max_speed=inf): dist: The distance bet...
3945ef235ac8e7a7a66fec018597aa9b34b0a4e6
<|skeleton|> class AToBConstAccel: """The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.""" def __init__(self, dist, accel, decel, max_speed=inf): """dist: The distance between A to B; accel: The rate of acceleration; decel: The ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AToBConstAccel: """The model of movement from A to B. The speed at point A and B is 0. The rates of acceleration and deceleration are constant.""" def __init__(self, dist, accel, decel, max_speed=inf): """dist: The distance between A to B; accel: The rate of acceleration; decel: The rate of decel...
the_stack_v2_python_sparse
wavesynlib/formulae/motion.py
xialulee/WaveSyn
train
9
49fad8568ecbe66fe0cc2c1192f0413069d69829
[ "SHOW_REG = re.compile('^/dumi/travel')\nPLAY_REG = re.compile('/m\\\\.gif')\nret = {}\nquery = []\npage = []\nret['query'] = query\nret['page'] = page\ntravel_Db = midpagedb.DateLogDb()\ntravel = travel_Db.get_collection()\ntravelDb = travel_Db.get_db()\nquery_info = travel.aggregate([{'$match': {'url': SHOW_REG}}...
<|body_start_0|> SHOW_REG = re.compile('^/dumi/travel') PLAY_REG = re.compile('/m\\.gif') ret = {} query = [] page = [] ret['query'] = query ret['page'] = page travel_Db = midpagedb.DateLogDb() travel = travel_Db.get_collection() travelDb =...
Product
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Product: def statist(self): """self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数""" <|body_0|> def save_result(self, result): """result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库""" <|body_1|> <|end_skeleton|> <|body_start_0|> SHOW_REG = re.compile('^/dumi/tra...
stack_v2_sparse_classes_75kplus_train_007304
2,550
no_license
[ { "docstring": "self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数", "name": "statist", "signature": "def statist(self)" }, { "docstring": "result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库", "name": "save_result", "signature": "def save_result(self, result)" } ]
2
stack_v2_sparse_classes_30k_train_051794
Implement the Python class `Product` described below. Class description: Implement the Product class. Method signatures and docstrings: - def statist(self): self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数 - def save_result(self, result): result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库
Implement the Python class `Product` described below. Class description: Implement the Product class. Method signatures and docstrings: - def statist(self): self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数 - def save_result(self, result): result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库 <|skeleton|> class Product: def s...
f2303a443122e87296fb5b72a8af02d642297bc4
<|skeleton|> class Product: def statist(self): """self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数""" <|body_0|> def save_result(self, result): """result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Product: def statist(self): """self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数""" SHOW_REG = re.compile('^/dumi/travel') PLAY_REG = re.compile('/m\\.gif') ret = {} query = [] page = [] ret['query'] = query ret['page'] = page travel_Db = midp...
the_stack_v2_python_sparse
midpage/products/travel.py
cash2one/statistic
train
0
95e98f3bb53a4ca89f728ece8400ea66ee0f631e
[ "numset = set()\nfor num in nums:\n if num in numset:\n numset.remove(num)\n else:\n numset.add(num)\nreturn numset.pop()", "singleton = 0\nfor num in nums:\n singleton ^= num\nreturn singleton" ]
<|body_start_0|> numset = set() for num in nums: if num in numset: numset.remove(num) else: numset.add(num) return numset.pop() <|end_body_0|> <|body_start_1|> singleton = 0 for num in nums: singleton ^= num ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> numset = set() for num in nums: ...
stack_v2_sparse_classes_75kplus_train_007305
858
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber2", "signature": "def singleNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_024926
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def singleNu...
e11c4f1d6dcd02d1bb69534ddcf7bb957d6df318
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" numset = set() for num in nums: if num in numset: numset.remove(num) else: numset.add(num) return numset.pop() def singleNumber2(self, nu...
the_stack_v2_python_sparse
Python/single_number.py
paulolemus/leetcode
train
0
46d79c460f85c8f96d0ed6dbe2353d41c01558c9
[ "super(NOAAWCOSS, self).__init__(False, False, DO_NOT_SET, name, name + '.ncep.noaa.gov')\nself._phase = phase\nself._production = None\nself._lastprod = 0\nself._prod_cache_time = int(prod_cache_time)", "self._production = None\nself._lastprod = 0\nself._phase = 0", "now = int(time.time())\nif self._production...
<|body_start_0|> super(NOAAWCOSS, self).__init__(False, False, DO_NOT_SET, name, name + '.ncep.noaa.gov') self._phase = phase self._production = None self._lastprod = 0 self._prod_cache_time = int(prod_cache_time) <|end_body_0|> <|body_start_1|> self._production = None ...
!Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy. Automatically determines which WCOSS the program is on based on the first letter of socket.gethostname(). Will report no ACL support, and no group quotas. Hence, the cluster should use group IDs for access control. The production accessor is no l...
NOAAWCOSS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NOAAWCOSS: """!Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy. Automatically determines which WCOSS the program is on based on the first letter of socket.gethostname(). Will report no ACL support, and no group quotas. Hence, the cluster should use group IDs for access con...
stack_v2_sparse_classes_75kplus_train_007306
11,161
permissive
[ { "docstring": "!Creates a NOAAWCOSS object, and optionally specifies the time for which the result of self.production should be cached. Default: 30 seconds. @param prod_cache_time how long to cache the prod vs. dev information, in seconds", "name": "__init__", "signature": "def __init__(self, prod_cach...
3
stack_v2_sparse_classes_30k_train_053169
Implement the Python class `NOAAWCOSS` described below. Class description: !Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy. Automatically determines which WCOSS the program is on based on the first letter of socket.gethostname(). Will report no ACL support, and no group quotas. Hence, the clus...
Implement the Python class `NOAAWCOSS` described below. Class description: !Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy. Automatically determines which WCOSS the program is on based on the first letter of socket.gethostname(). Will report no ACL support, and no group quotas. Hence, the clus...
a666ac3b58d19f04249f76c9340f2e4a4a27939b
<|skeleton|> class NOAAWCOSS: """!Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy. Automatically determines which WCOSS the program is on based on the first letter of socket.gethostname(). Will report no ACL support, and no group quotas. Hence, the cluster should use group IDs for access con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NOAAWCOSS: """!Represents the NOAA WCOSS clusters, Tide, Gyre and the test system Eddy. Automatically determines which WCOSS the program is on based on the first letter of socket.gethostname(). Will report no ACL support, and no group quotas. Hence, the cluster should use group IDs for access control. The pro...
the_stack_v2_python_sparse
produtil/cluster.py
dtcenter/METplus
train
41
3020b832a160e7e14969b1df7b2afe9840f51557
[ "if not authorization_header or type(authorization_header) != str:\n return None\nll = authorization_header.split(' ')\nif ll[0] == 'Basic':\n return ll[1]\nreturn None", "if not base64_authorization_header or type(base64_authorization_header) != str:\n return None\n\ndef isBase64(sb):\n try:\n ...
<|body_start_0|> if not authorization_header or type(authorization_header) != str: return None ll = authorization_header.split(' ') if ll[0] == 'Basic': return ll[1] return None <|end_body_0|> <|body_start_1|> if not base64_authorization_header or type(ba...
Auth class
BasicAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicAuth: """Auth class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Returns the Base64 part of the Authorization header for a Basic Authentication""" <|body_0|> def decode_base64_authorization_header(self, base64_authorization_...
stack_v2_sparse_classes_75kplus_train_007307
3,522
no_license
[ { "docstring": "Returns the Base64 part of the Authorization header for a Basic Authentication", "name": "extract_base64_authorization_header", "signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str" }, { "docstring": "Returns the decoded value of a Base64 ...
5
stack_v2_sparse_classes_30k_train_012800
Implement the Python class `BasicAuth` described below. Class description: Auth class Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: Returns the Base64 part of the Authorization header for a Basic Authentication - def decode_base64_authorization_he...
Implement the Python class `BasicAuth` described below. Class description: Auth class Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: Returns the Base64 part of the Authorization header for a Basic Authentication - def decode_base64_authorization_he...
dfb69fff81fca7bccfc2cb9e3bbbdb222d318f92
<|skeleton|> class BasicAuth: """Auth class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Returns the Base64 part of the Authorization header for a Basic Authentication""" <|body_0|> def decode_base64_authorization_header(self, base64_authorization_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicAuth: """Auth class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Returns the Base64 part of the Authorization header for a Basic Authentication""" if not authorization_header or type(authorization_header) != str: return None ...
the_stack_v2_python_sparse
0x06-Basic_authentication/api/v1/auth/basic_auth.py
hunterxx0/holbertonschool-web_back_end
train
0
2e042c09e159ac0c936622bae062b2764c7aced9
[ "output = []\ni, j, carry = (0, 0, 0)\nwhile i < len(a) or j < len(b) or carry:\n n1 = int(a[i]) if i < len(a) else 0\n n2 = int(b[j]) if j < len(b) else 0\n n = n1 + n2 + carry\n carry = n // 2\n n = n % 2\n output.append(str(n))\n i += 1\n j += 1\nreturn ''.join(reversed(output))", "if l...
<|body_start_0|> output = [] i, j, carry = (0, 0, 0) while i < len(a) or j < len(b) or carry: n1 = int(a[i]) if i < len(a) else 0 n2 = int(b[j]) if j < len(b) else 0 n = n1 + n2 + carry carry = n // 2 n = n % 2 output.append...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_0|> def addBinary_verbose(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> output = [] i, j, carry =...
stack_v2_sparse_classes_75kplus_train_007308
1,638
no_license
[ { "docstring": ":type a: str :type b: str :rtype: str", "name": "addBinary", "signature": "def addBinary(self, a, b)" }, { "docstring": ":type a: str :type b: str :rtype: str", "name": "addBinary_verbose", "signature": "def addBinary_verbose(self, a, b)" } ]
2
stack_v2_sparse_classes_30k_train_009072
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary(self, a, b): :type a: str :type b: str :rtype: str - def addBinary_verbose(self, a, b): :type a: str :type b: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addBinary(self, a, b): :type a: str :type b: str :rtype: str - def addBinary_verbose(self, a, b): :type a: str :type b: str :rtype: str <|skeleton|> class Solution: def...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_0|> def addBinary_verbose(self, a, b): """:type a: str :type b: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addBinary(self, a, b): """:type a: str :type b: str :rtype: str""" output = [] i, j, carry = (0, 0, 0) while i < len(a) or j < len(b) or carry: n1 = int(a[i]) if i < len(a) else 0 n2 = int(b[j]) if j < len(b) else 0 n = n1 + n2 ...
the_stack_v2_python_sparse
src/lt_67.py
oxhead/CodingYourWay
train
0
eb95ec75a70736dd445cc02b6315bb598eb5a55a
[ "query_ = self.session.query(Category)\nuser_id = view_kwargs.get('id')\nif user_id:\n query_ = query_for_user_only(query_, user_id)\nreturn query_", "if 'name' not in data:\n raise BadRequest('Must include name field')\ndata['user_id'] = g.current_user.id" ]
<|body_start_0|> query_ = self.session.query(Category) user_id = view_kwargs.get('id') if user_id: query_ = query_for_user_only(query_, user_id) return query_ <|end_body_0|> <|body_start_1|> if 'name' not in data: raise BadRequest('Must include name field...
ResourceList: provides get and post methods to retrieve a collection of objects or create one
CategoryList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryList: """ResourceList: provides get and post methods to retrieve a collection of objects or create one""" def query(self, view_kwargs): """Adjust query to search for categories owned by current user only if the user_id is provided in the request""" <|body_0|> def...
stack_v2_sparse_classes_75kplus_train_007309
10,897
no_license
[ { "docstring": "Adjust query to search for categories owned by current user only if the user_id is provided in the request", "name": "query", "signature": "def query(self, view_kwargs)" }, { "docstring": "Prior to creating a new category, check all is OK and insert the user_id of the current use...
2
null
Implement the Python class `CategoryList` described below. Class description: ResourceList: provides get and post methods to retrieve a collection of objects or create one Method signatures and docstrings: - def query(self, view_kwargs): Adjust query to search for categories owned by current user only if the user_id ...
Implement the Python class `CategoryList` described below. Class description: ResourceList: provides get and post methods to retrieve a collection of objects or create one Method signatures and docstrings: - def query(self, view_kwargs): Adjust query to search for categories owned by current user only if the user_id ...
365543d2e121bc78ecbf6452e9e77dc75b059f03
<|skeleton|> class CategoryList: """ResourceList: provides get and post methods to retrieve a collection of objects or create one""" def query(self, view_kwargs): """Adjust query to search for categories owned by current user only if the user_id is provided in the request""" <|body_0|> def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CategoryList: """ResourceList: provides get and post methods to retrieve a collection of objects or create one""" def query(self, view_kwargs): """Adjust query to search for categories owned by current user only if the user_id is provided in the request""" query_ = self.session.query(Cate...
the_stack_v2_python_sparse
application/api/catalog/views.py
jnitin/flask-catalog
train
0
95d6498de0d4ca1828bfc7dfce95665474176ea1
[ "publisher = Publisher.query.filter_by(id=id).first()\nif publisher is None:\n return ({'message': 'Publisher does not exist'}, 404)\nreturn publisher_schema.dump(publisher)", "req = api.payload\npublisher = Publisher.query.filter_by(id=id).first()\nif publisher is None:\n return ({'message': 'Publisher doe...
<|body_start_0|> publisher = Publisher.query.filter_by(id=id).first() if publisher is None: return ({'message': 'Publisher does not exist'}, 404) return publisher_schema.dump(publisher) <|end_body_0|> <|body_start_1|> req = api.payload publisher = Publisher.query.fil...
SinglePublisher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SinglePublisher: def get(self, id): """Get Publisher by id""" <|body_0|> def put(self, id): """Update a Publisher""" <|body_1|> def delete(self, id): """Delete a Publisher by id""" <|body_2|> <|end_skeleton|> <|body_start_0|> pu...
stack_v2_sparse_classes_75kplus_train_007310
3,380
no_license
[ { "docstring": "Get Publisher by id", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update a Publisher", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Delete a Publisher by id", "name": "delete", "signature": "def delete(self, id)...
3
stack_v2_sparse_classes_30k_train_009391
Implement the Python class `SinglePublisher` described below. Class description: Implement the SinglePublisher class. Method signatures and docstrings: - def get(self, id): Get Publisher by id - def put(self, id): Update a Publisher - def delete(self, id): Delete a Publisher by id
Implement the Python class `SinglePublisher` described below. Class description: Implement the SinglePublisher class. Method signatures and docstrings: - def get(self, id): Get Publisher by id - def put(self, id): Update a Publisher - def delete(self, id): Delete a Publisher by id <|skeleton|> class SinglePublisher:...
ae78fff9888b0f68d9403d7f65cba086dabb3802
<|skeleton|> class SinglePublisher: def get(self, id): """Get Publisher by id""" <|body_0|> def put(self, id): """Update a Publisher""" <|body_1|> def delete(self, id): """Delete a Publisher by id""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SinglePublisher: def get(self, id): """Get Publisher by id""" publisher = Publisher.query.filter_by(id=id).first() if publisher is None: return ({'message': 'Publisher does not exist'}, 404) return publisher_schema.dump(publisher) def put(self, id): """...
the_stack_v2_python_sparse
api/v1/publishers.py
mythril-io/flask-api
train
0
bc7b2384045e28fe1f1254b8c95c8a36dcc45273
[ "try:\n params, is_json = (request.json, True)\nexcept ValueError:\n params, is_json = (None, False)\nif not params:\n params, is_json = (request.params, False)\nreturn (params, is_json)", "if name == ParameterType.TOKEN_NAME:\n token_name = ADMIN_TOKEN_NAME if request_api_type() == API_ADMIN else CAB...
<|body_start_0|> try: params, is_json = (request.json, True) except ValueError: params, is_json = (None, False) if not params: params, is_json = (request.params, False) return (params, is_json) <|end_body_0|> <|body_start_1|> if name == Parame...
Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.
ParameterValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterValidator: """Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.""" def request_params(): """Detects where do we have incoming arguments and returns them. :return tuple of paramete...
stack_v2_sparse_classes_75kplus_train_007311
8,864
permissive
[ { "docstring": "Detects where do we have incoming arguments and returns them. :return tuple of parameters (dict-like structure) and sign were they JSONed or not. This is required if we have different rules for processing form-data and simple JSON.", "name": "request_params", "signature": "def request_pa...
5
stack_v2_sparse_classes_30k_train_027412
Implement the Python class `ParameterValidator` described below. Class description: Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing. Method signatures and docstrings: - def request_params(): Detects where do we have incom...
Implement the Python class `ParameterValidator` described below. Class description: Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing. Method signatures and docstrings: - def request_params(): Detects where do we have incom...
bc0cfe3067bf1cbf26789f7443a36e7cdd2ac869
<|skeleton|> class ParameterValidator: """Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.""" def request_params(): """Detects where do we have incoming arguments and returns them. :return tuple of paramete...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParameterValidator: """Actual class which responsible for validation. Actually check_params decorator just puts everything in it and relies on it during the processing.""" def request_params(): """Detects where do we have incoming arguments and returns them. :return tuple of parameters (dict-like...
the_stack_v2_python_sparse
backend/api/check_params.py
omarabdalhamid/boss
train
0
0329b116613b73aa527f20fbdef65445aa406030
[ "super(EncoderRNN, self).__init__()\nself.vocab_size = vocab_size\nself.embedding_size = embedding_size\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nself.dropout = dropout\nself.batch_first = batch_first\nself.bidirectional = bidirectional\nif bidirectional:\n self.num_directions = 2\nelse:\n ...
<|body_start_0|> super(EncoderRNN, self).__init__() self.vocab_size = vocab_size self.embedding_size = embedding_size self.hidden_size = hidden_size self.num_layers = num_layers self.dropout = dropout self.batch_first = batch_first self.bidirectional = bid...
EncoderRNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderRNN: def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None): """Sentence-level Encoder""" <|body_0|> def forward(self, inputs, input...
stack_v2_sparse_classes_75kplus_train_007312
8,492
permissive
[ { "docstring": "Sentence-level Encoder", "name": "__init__", "signature": "def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None)" }, { "docstring": "Args: inpu...
2
stack_v2_sparse_classes_30k_val_002344
Implement the Python class `EncoderRNN` described below. Class description: Implement the EncoderRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weig...
Implement the Python class `EncoderRNN` described below. Class description: Implement the EncoderRNN class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weig...
8851bbde8bedd0fe07beec72d74b3b3624c9c729
<|skeleton|> class EncoderRNN: def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None): """Sentence-level Encoder""" <|body_0|> def forward(self, inputs, input...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncoderRNN: def __init__(self, vocab_size, embedding_size, hidden_size, rnn=nn.GRU, num_layers=1, bidirectional=False, dropout=0.0, bias=True, batch_first=True, train_emb=False, emb_weights_matrix=None): """Sentence-level Encoder""" super(EncoderRNN, self).__init__() self.vocab_size = ...
the_stack_v2_python_sparse
TL-ERC/bert_model/layer/encoder.py
declare-lab/conv-emotion
train
791
61a4ee57be4727ef84cd7310f388a3debd1b5566
[ "from .timeseriesdata import TimeSeriesData\ntry:\n data = TimeSeriesData.objects.filter(sensor=self).latest('ts')\nexcept TimeSeriesData.DoesNotExist:\n return {}\nreturn data", "from .timeseriesdata import TimeSeriesData\nraw = TimeSeriesData.objects.filter(ts__gte=data_start, ts__lt=data_end, sensor=self...
<|body_start_0|> from .timeseriesdata import TimeSeriesData try: data = TimeSeriesData.objects.filter(sensor=self).latest('ts') except TimeSeriesData.DoesNotExist: return {} return data <|end_body_0|> <|body_start_1|> from .timeseriesdata import TimeSerie...
A sensor associated with a device Attributes: device (Device): associated device resolution (float): how often this is sampled, in seconds sensor_type (SensorType): type of sensor
DeviceSensor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceSensor: """A sensor associated with a device Attributes: device (Device): associated device resolution (float): how often this is sampled, in seconds sensor_type (SensorType): type of sensor""" def get_latest_ts_data(self): """Get latest ts data on this sensor for this device T...
stack_v2_sparse_classes_75kplus_train_007313
8,729
permissive
[ { "docstring": "Get latest ts data on this sensor for this device The latest_ts_data_optimised on AbstractDevice should be used instead of directly calling this", "name": "get_latest_ts_data", "signature": "def get_latest_ts_data(self)" }, { "docstring": "Implementation of aggregating data. See ...
4
stack_v2_sparse_classes_30k_train_048264
Implement the Python class `DeviceSensor` described below. Class description: A sensor associated with a device Attributes: device (Device): associated device resolution (float): how often this is sampled, in seconds sensor_type (SensorType): type of sensor Method signatures and docstrings: - def get_latest_ts_data(s...
Implement the Python class `DeviceSensor` described below. Class description: A sensor associated with a device Attributes: device (Device): associated device resolution (float): how often this is sampled, in seconds sensor_type (SensorType): type of sensor Method signatures and docstrings: - def get_latest_ts_data(s...
5c569f54f100e23d72e2ac4de795739ea461a431
<|skeleton|> class DeviceSensor: """A sensor associated with a device Attributes: device (Device): associated device resolution (float): how often this is sampled, in seconds sensor_type (SensorType): type of sensor""" def get_latest_ts_data(self): """Get latest ts data on this sensor for this device T...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeviceSensor: """A sensor associated with a device Attributes: device (Device): associated device resolution (float): how often this is sampled, in seconds sensor_type (SensorType): type of sensor""" def get_latest_ts_data(self): """Get latest ts data on this sensor for this device The latest_ts_...
the_stack_v2_python_sparse
zconnect/zc_timeseries/_models/sensor.py
zconnect-iot/zconnect-django
train
2
1c432ec1132d5db09310e7c58fbb93fb844c5e59
[ "self.comment = comment\nself.policy = policy\nself.ip_version = ip_version\nself.protocol = protocol\nself.src_cidr = src_cidr\nself.src_port = src_port\nself.dst_cidr = dst_cidr\nself.dst_port = dst_port\nself.vlan = vlan", "if dictionary is None:\n return None\npolicy = dictionary.get('policy')\nprotocol = ...
<|body_start_0|> self.comment = comment self.policy = policy self.ip_version = ip_version self.protocol = protocol self.src_cidr = src_cidr self.src_port = src_port self.dst_cidr = dst_cidr self.dst_port = dst_port self.vlan = vlan <|end_body_0|> ...
Implementation of the 'Rule12' model. TODO: type model description here. Attributes: comment (string): Description of the rule (optional). policy (Policy7Enum): 'allow' or 'deny' traffic specified by this rule. ip_version (IpVersionEnum): IP address version (must be 'any', 'ipv4' or 'ipv6'). Applicable only if network ...
Rule12Model
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule12Model: """Implementation of the 'Rule12' model. TODO: type model description here. Attributes: comment (string): Description of the rule (optional). policy (Policy7Enum): 'allow' or 'deny' traffic specified by this rule. ip_version (IpVersionEnum): IP address version (must be 'any', 'ipv4' ...
stack_v2_sparse_classes_75kplus_train_007314
3,696
permissive
[ { "docstring": "Constructor for the Rule12Model class", "name": "__init__", "signature": "def __init__(self, policy=None, protocol=None, src_cidr=None, dst_cidr=None, comment=None, ip_version=None, src_port=None, dst_port=None, vlan=None)" }, { "docstring": "Creates an instance of this model fro...
2
stack_v2_sparse_classes_30k_train_003060
Implement the Python class `Rule12Model` described below. Class description: Implementation of the 'Rule12' model. TODO: type model description here. Attributes: comment (string): Description of the rule (optional). policy (Policy7Enum): 'allow' or 'deny' traffic specified by this rule. ip_version (IpVersionEnum): IP ...
Implement the Python class `Rule12Model` described below. Class description: Implementation of the 'Rule12' model. TODO: type model description here. Attributes: comment (string): Description of the rule (optional). policy (Policy7Enum): 'allow' or 'deny' traffic specified by this rule. ip_version (IpVersionEnum): IP ...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class Rule12Model: """Implementation of the 'Rule12' model. TODO: type model description here. Attributes: comment (string): Description of the rule (optional). policy (Policy7Enum): 'allow' or 'deny' traffic specified by this rule. ip_version (IpVersionEnum): IP address version (must be 'any', 'ipv4' ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Rule12Model: """Implementation of the 'Rule12' model. TODO: type model description here. Attributes: comment (string): Description of the rule (optional). policy (Policy7Enum): 'allow' or 'deny' traffic specified by this rule. ip_version (IpVersionEnum): IP address version (must be 'any', 'ipv4' or 'ipv6'). A...
the_stack_v2_python_sparse
meraki_sdk/models/rule_12_model.py
RaulCatalano/meraki-python-sdk
train
1
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b
[ "response = self.client.get(reverse('education:index'))\nself.assertEqual(response.status_code, 200)\nself.assertEqual(response.context.get('json_data'), None)\nself.assertContains(response, 'High School Graduation')\nself.assertContains(response, 'How Rates Were Calculated')\nself.assertContains(response, 'Home')\...
<|body_start_0|> response = self.client.get(reverse('education:index')) self.assertEqual(response.status_code, 200) self.assertEqual(response.context.get('json_data'), None) self.assertContains(response, 'High School Graduation') self.assertContains(response, 'How Rates Were Calc...
EducationIndexViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EducationIndexViewTests: def test_no_data(self): """If no data is in the database, no content is displayed but there is no map of graudation rates.""" <|body_0|> def test_with_data(self): """If state data is in the database, make sure the conents renders and a graph ...
stack_v2_sparse_classes_75kplus_train_007315
9,266
no_license
[ { "docstring": "If no data is in the database, no content is displayed but there is no map of graudation rates.", "name": "test_no_data", "signature": "def test_no_data(self)" }, { "docstring": "If state data is in the database, make sure the conents renders and a graph of the graudation rates i...
2
stack_v2_sparse_classes_30k_train_023380
Implement the Python class `EducationIndexViewTests` described below. Class description: Implement the EducationIndexViewTests class. Method signatures and docstrings: - def test_no_data(self): If no data is in the database, no content is displayed but there is no map of graudation rates. - def test_with_data(self): ...
Implement the Python class `EducationIndexViewTests` described below. Class description: Implement the EducationIndexViewTests class. Method signatures and docstrings: - def test_no_data(self): If no data is in the database, no content is displayed but there is no map of graudation rates. - def test_with_data(self): ...
2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f
<|skeleton|> class EducationIndexViewTests: def test_no_data(self): """If no data is in the database, no content is displayed but there is no map of graudation rates.""" <|body_0|> def test_with_data(self): """If state data is in the database, make sure the conents renders and a graph ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EducationIndexViewTests: def test_no_data(self): """If no data is in the database, no content is displayed but there is no map of graudation rates.""" response = self.client.get(reverse('education:index')) self.assertEqual(response.status_code, 200) self.assertEqual(response.co...
the_stack_v2_python_sparse
education/tests.py
smeds1/mysite
train
1
336e8389a38a99de63858c825c5e712b0868ccfd
[ "self.snake = collections.deque([(0, 0)])\nself.s = set([(0, 0)])\nself.width = width\nself.height = height\nself.food = food\nself.idx = 0", "head_r, head_c = self.snake[0]\ntail = self.snake.pop()\nself.s.remove(tail)\nif direction == 'U':\n head_r -= 1\nelif direction == 'D':\n head_r += 1\nelif directio...
<|body_start_0|> self.snake = collections.deque([(0, 0)]) self.s = set([(0, 0)]) self.width = width self.height = height self.food = food self.idx = 0 <|end_body_0|> <|body_start_1|> head_r, head_c = self.snake[0] tail = self.snake.pop() self.s.re...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_75kplus_train_007316
2,074
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_037838
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
fe79161211cc08c269cde9e1fdcfed27de11f2cb
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
MyLeetCode/python/Design Snake Game.py
ihuei801/leetcode
train
0
7fb48a88f253f5fb8237f7129c7f08bc903c8dd4
[ "self._n_classes = n_classes\nself._mode = mode\nself._normalization = normalization", "skip_128 = input_block(inputs=features, out_channels=32, normalization=self._normalization, mode=self._mode)\nskip_64 = downsample_block(inputs=skip_128, out_channels=64, normalization=self._normalization, mode=self._mode)\nsk...
<|body_start_0|> self._n_classes = n_classes self._mode = mode self._normalization = normalization <|end_body_0|> <|body_start_1|> skip_128 = input_block(inputs=features, out_channels=32, normalization=self._normalization, mode=self._mode) skip_64 = downsample_block(inputs=skip_...
Model builder
Builder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Builder: """Model builder""" def __init__(self, n_classes, mode, normalization='none'): """Configure the unet3d builder :param n_classes: Number of output channels :param mode: Estimator's execution mode :param normalization: Name of the normalization layer""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_007317
3,800
permissive
[ { "docstring": "Configure the unet3d builder :param n_classes: Number of output channels :param mode: Estimator's execution mode :param normalization: Name of the normalization layer", "name": "__init__", "signature": "def __init__(self, n_classes, mode, normalization='none')" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_006888
Implement the Python class `Builder` described below. Class description: Model builder Method signatures and docstrings: - def __init__(self, n_classes, mode, normalization='none'): Configure the unet3d builder :param n_classes: Number of output channels :param mode: Estimator's execution mode :param normalization: N...
Implement the Python class `Builder` described below. Class description: Model builder Method signatures and docstrings: - def __init__(self, n_classes, mode, normalization='none'): Configure the unet3d builder :param n_classes: Number of output channels :param mode: Estimator's execution mode :param normalization: N...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class Builder: """Model builder""" def __init__(self, n_classes, mode, normalization='none'): """Configure the unet3d builder :param n_classes: Number of output channels :param mode: Estimator's execution mode :param normalization: Name of the normalization layer""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Builder: """Model builder""" def __init__(self, n_classes, mode, normalization='none'): """Configure the unet3d builder :param n_classes: Number of output channels :param mode: Estimator's execution mode :param normalization: Name of the normalization layer""" self._n_classes = n_classes ...
the_stack_v2_python_sparse
TensorFlow/Segmentation/UNet_3D_Medical/model/unet3d.py
NVIDIA/DeepLearningExamples
train
11,838
5aaa1cb065834685c6f079391e64f5080d5d7e95
[ "self.label = label\nself.statement = statement\nself.asset_id = asset_id\nself.file_type = file_type\nself.data_available = data_available\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nlabel = dictionary.get('label')\nstatement = dictionary.get('statement')\nasse...
<|body_start_0|> self.label = label self.statement = statement self.asset_id = asset_id self.file_type = file_type self.data_available = data_available self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label will allow the paystub to go through primary data extra...
StorePayStatementRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorePayStatementRequest: """Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label wil...
stack_v2_sparse_classes_75kplus_train_007318
3,317
permissive
[ { "docstring": "Constructor for the StorePayStatementRequest class", "name": "__init__", "signature": "def __init__(self, label=None, statement=None, asset_id=None, file_type=None, data_available=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a diction...
2
stack_v2_sparse_classes_30k_train_028715
Implement the Python class `StorePayStatementRequest` described below. Class description: Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most rece...
Implement the Python class `StorePayStatementRequest` described below. Class description: Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most rece...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class StorePayStatementRequest: """Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label wil...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StorePayStatementRequest: """Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label will allow the p...
the_stack_v2_python_sparse
finicityapi/models/store_pay_statement_request.py
monarchmoney/finicity-python
train
0
371f3e653f814971e608598bae17264de5b2add1
[ "for res in self:\n if res.assessment_type in ['quarter', 'semiannual', 'probation']:\n raise UserError('当前版本仅支持类型为月度或年度,如需其他类型请购买完整版!')\n if res.assessment_type:\n res.evaluation_ids = [(2, 0, res.evaluation_ids.ids)]\n return {'domain': {'evaluation_ids': [('cycle_type', '=', self.asses...
<|body_start_0|> for res in self: if res.assessment_type in ['quarter', 'semiannual', 'probation']: raise UserError('当前版本仅支持类型为月度或年度,如需其他类型请购买完整版!') if res.assessment_type: res.evaluation_ids = [(2, 0, res.evaluation_ids.ids)] return {'doma...
InitiatePerformanceAssessment
[ "Apache-2.0", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitiatePerformanceAssessment: def _onchange_assessment_type(self): """:return:""" <|body_0|> def initiate_performance(self): """发起考核 :return:""" <|body_1|> def send_email_now(self, performance_object): """发送员工通知邮件,通过邮件:EMail队列管理器进行发送 :return:"""...
stack_v2_sparse_classes_75kplus_train_007319
6,241
permissive
[ { "docstring": ":return:", "name": "_onchange_assessment_type", "signature": "def _onchange_assessment_type(self)" }, { "docstring": "发起考核 :return:", "name": "initiate_performance", "signature": "def initiate_performance(self)" }, { "docstring": "发送员工通知邮件,通过邮件:EMail队列管理器进行发送 :ret...
4
stack_v2_sparse_classes_30k_train_016468
Implement the Python class `InitiatePerformanceAssessment` described below. Class description: Implement the InitiatePerformanceAssessment class. Method signatures and docstrings: - def _onchange_assessment_type(self): :return: - def initiate_performance(self): 发起考核 :return: - def send_email_now(self, performance_obj...
Implement the Python class `InitiatePerformanceAssessment` described below. Class description: Implement the InitiatePerformanceAssessment class. Method signatures and docstrings: - def _onchange_assessment_type(self): :return: - def initiate_performance(self): 发起考核 :return: - def send_email_now(self, performance_obj...
8608aaeae7a8c86d53b68ce26b7b308f779c3dd8
<|skeleton|> class InitiatePerformanceAssessment: def _onchange_assessment_type(self): """:return:""" <|body_0|> def initiate_performance(self): """发起考核 :return:""" <|body_1|> def send_email_now(self, performance_object): """发送员工通知邮件,通过邮件:EMail队列管理器进行发送 :return:"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InitiatePerformanceAssessment: def _onchange_assessment_type(self): """:return:""" for res in self: if res.assessment_type in ['quarter', 'semiannual', 'probation']: raise UserError('当前版本仅支持类型为月度或年度,如需其他类型请购买完整版!') if res.assessment_type: ...
the_stack_v2_python_sparse
odoo_performance_manage/wizard/initiate_performance.py
niulinlnc/odooExtModel
train
4
8873f22c3f01ae163c2573b53cfe1bf9e3fd3e33
[ "Frame.__init__(self, master)\nself.pack()\nself.createWidgets()", "entry_frame = Frame(self)\nself.instructions = Label(entry_frame, text=\"Enter two numbers and press 'Add' to get their sum.\")\nself.input_1_frame = LabelFrame(entry_frame, text='Input 1', labelanchor=S)\nself.input_1 = Entry(self.input_1_frame)...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createWidgets() <|end_body_0|> <|body_start_1|> entry_frame = Frame(self) self.instructions = Label(entry_frame, text="Enter two numbers and press 'Add' to get their sum.") self.input_1_frame = LabelFrame(ent...
Application main window class.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle_input(self): ...
stack_v2_sparse_classes_75kplus_train_007320
2,676
no_license
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createWidgets", "signature": "def createWidgets(self)" }, { "docstring": "Validat...
3
null
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createWidgets(self): Add all the widgets to the main frame. - def handle_input(self): Vali...
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createWidgets(self): Add all the widgets to the main frame. - def handle_input(self): Vali...
f51c1d2d9557c95e869cbce5bff7158f5aa90192
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle_input(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createWidgets() def createWidgets(self): """Add all the widgets to the main fram...
the_stack_v2_python_sparse
Python 02: Getting More Out of Python/Lesson 07: Introduction to Graphical User Interfaces/black_adder.py
MTset/Python-Programming-Coursework
train
0
bc8fd341094527f2720baf0db05139280f8ee4d6
[ "extension = os.path.splitext(data_file)[-1]\nif extension == '.json':\n self.vocab_set = set(json.load(open(data_file, encoding='utf-8')))\nelif extension == '.csv':\n self.vocab_df = pd.read_csv(data_file).set_index('WORD')\n self.vocab_set = set(self.vocab_df.index)\nelse:\n print('XlitError: Only Js...
<|body_start_0|> extension = os.path.splitext(data_file)[-1] if extension == '.json': self.vocab_set = set(json.load(open(data_file, encoding='utf-8'))) elif extension == '.csv': self.vocab_df = pd.read_csv(data_file).set_index('WORD') self.vocab_set = set(sel...
VocabSanitizer
[ "CC-BY-4.0", "CC-BY-SA-3.0", "CC-BY-SA-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VocabSanitizer: def __init__(self, data_file): """data_file: path to file conatining vocabulary list""" <|body_0|> def reposition(self, word_list): """Reorder Words in list""" <|body_1|> <|end_skeleton|> <|body_start_0|> extension = os.path.splitext...
stack_v2_sparse_classes_75kplus_train_007321
30,029
permissive
[ { "docstring": "data_file: path to file conatining vocabulary list", "name": "__init__", "signature": "def __init__(self, data_file)" }, { "docstring": "Reorder Words in list", "name": "reposition", "signature": "def reposition(self, word_list)" } ]
2
stack_v2_sparse_classes_30k_train_027692
Implement the Python class `VocabSanitizer` described below. Class description: Implement the VocabSanitizer class. Method signatures and docstrings: - def __init__(self, data_file): data_file: path to file conatining vocabulary list - def reposition(self, word_list): Reorder Words in list
Implement the Python class `VocabSanitizer` described below. Class description: Implement the VocabSanitizer class. Method signatures and docstrings: - def __init__(self, data_file): data_file: path to file conatining vocabulary list - def reposition(self, word_list): Reorder Words in list <|skeleton|> class VocabSa...
0e0dd8139c75477346c985201b51315b3a4e4f48
<|skeleton|> class VocabSanitizer: def __init__(self, data_file): """data_file: path to file conatining vocabulary list""" <|body_0|> def reposition(self, word_list): """Reorder Words in list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VocabSanitizer: def __init__(self, data_file): """data_file: path to file conatining vocabulary list""" extension = os.path.splitext(data_file)[-1] if extension == '.json': self.vocab_set = set(json.load(open(data_file, encoding='utf-8'))) elif extension == '.csv': ...
the_stack_v2_python_sparse
apps/ai4bharat/transliteration/xlit_src.py
JosephGeoBenjamin/IndianNLP-Transliteration
train
2
ceb8d0980c5ba00bd956b4737d89408705ef3e63
[ "assert Q.shape == (4,), Q\nw, x, y, z = Q\nxx = x * x\nxy = x * y\nyy = y * y\nxz = x * z\nyz = y * z\nzz = z * z\nxw = x * w\nyw = y * w\nzw = z * w\nreturn np.array([[1 - 2 * (yy + zz), 2 * (xy + zw), 2 * (xz - yw)], [2 * (xy - zw), 1 - 2 * (xx + zz), 2 * (yz + xw)], [2 * (xz + yw), 2 * (yz - xw), 1 - 2 * (xx + ...
<|body_start_0|> assert Q.shape == (4,), Q w, x, y, z = Q xx = x * x xy = x * y yy = y * y xz = x * z yz = y * z zz = z * z xw = x * w yw = y * w zw = z * w return np.array([[1 - 2 * (yy + zz), 2 * (xy + zw), 2 * (xz - yw)],...
WXYZ
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WXYZ: def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.""" <|body_0|> def from_rotation_matrix(R: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/m...
stack_v2_sparse_classes_75kplus_train_007322
10,562
no_license
[ { "docstring": "See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.", "name": "to_rotation_matrix", "signature": "def to_rotation_matrix(Q: np.ndarray) -> np.ndarray" }, { "docstring": "See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q55 Note: ...
2
stack_v2_sparse_classes_30k_train_028250
Implement the Python class `WXYZ` described below. Class description: Implement the WXYZ class. Method signatures and docstrings: - def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major. - def from_rotation_matrix(R: np.nd...
Implement the Python class `WXYZ` described below. Class description: Implement the WXYZ class. Method signatures and docstrings: - def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major. - def from_rotation_matrix(R: np.nd...
bac774e1f7b3131f559ee3ff1662836c424ebaa5
<|skeleton|> class WXYZ: def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.""" <|body_0|> def from_rotation_matrix(R: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WXYZ: def to_rotation_matrix(Q: np.ndarray) -> np.ndarray: """See http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q54 Note: the returned matrix is row-major.""" assert Q.shape == (4,), Q w, x, y, z = Q xx = x * x xy = x * y yy = y * y xz = x * z ...
the_stack_v2_python_sparse
src/ie/meshroomy.py
laurelkeys/ff
train
1
0e46a0cc118ccc76b55fa23bc0c287da44e820a9
[ "stackA = {}\nwhile headA:\n stackA.append(headA)\n headA = headA.next\nif not stackA:\n return None\nwhile headB:\n if headB in stackA:\n return headB\n headB = headB.next\nreturn None", "if not headA or not headB:\n return None\npA = headA\npB = headB\nwhile pA != pB:\n if pA:\n ...
<|body_start_0|> stackA = {} while headA: stackA.append(headA) headA = headA.next if not stackA: return None while headB: if headB in stackA: return headB headB = headB.next return None <|end_body_0|> <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: """Hash table solution stores every node of list A. Iterate through list B until a node of A is found.""" <|body_0|> def getIntersectionNode(self, headA, headB): """Two pointer sol...
stack_v2_sparse_classes_75kplus_train_007323
1,285
no_license
[ { "docstring": "Hash table solution stores every node of list A. Iterate through list B until a node of A is found.", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode" }, { "docstring": "Two pointer solution When headA reach...
2
stack_v2_sparse_classes_30k_train_017259
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: Hash table solution stores every node of list A. Iterate through list B until a node of A is found. -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: Hash table solution stores every node of list A. Iterate through list B until a node of A is found. -...
f33d004d7629d46fbc5670f5b384f8a604d7f1e7
<|skeleton|> class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: """Hash table solution stores every node of list A. Iterate through list B until a node of A is found.""" <|body_0|> def getIntersectionNode(self, headA, headB): """Two pointer sol...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: """Hash table solution stores every node of list A. Iterate through list B until a node of A is found.""" stackA = {} while headA: stackA.append(headA) headA = headA.next ...
the_stack_v2_python_sparse
Intersection of Two Linked Lists.py
aulee888/LeetCode
train
0
19b2f7de29fc4c6c05179ac255e523902fcbbfc3
[ "username = self.cleaned_data.get('username')\nif not User.objects.filter(username=username).exists():\n try:\n username = User.objects.get(email=username).username\n except (User.DoesNotExist, User.MultipleObjectsReturned):\n pass\nreturn username", "request = self.request\nif is_ratelimited(...
<|body_start_0|> username = self.cleaned_data.get('username') if not User.objects.filter(username=username).exists(): try: username = User.objects.get(email=username).username except (User.DoesNotExist, User.MultipleObjectsReturned): pass r...
Mixin for enhancing authentication forms. This extends Django's built-in AuthenticationForm implementation to allow users to specify their e-mail address in place of their username. In addition, it also tracks the number of failed login attempts for a given time frame, and informs the user whether the maximum number of...
ReviewBoardAuthenticationFormMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewBoardAuthenticationFormMixin: """Mixin for enhancing authentication forms. This extends Django's built-in AuthenticationForm implementation to allow users to specify their e-mail address in place of their username. In addition, it also tracks the number of failed login attempts for a given ...
stack_v2_sparse_classes_75kplus_train_007324
20,784
permissive
[ { "docstring": "Validate the 'username' field. In case the given text is not a user found on the system, attempt a look-up using it as an e-mail address and change the user-entered text so that login can succeed.", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring...
2
stack_v2_sparse_classes_30k_train_016834
Implement the Python class `ReviewBoardAuthenticationFormMixin` described below. Class description: Mixin for enhancing authentication forms. This extends Django's built-in AuthenticationForm implementation to allow users to specify their e-mail address in place of their username. In addition, it also tracks the numbe...
Implement the Python class `ReviewBoardAuthenticationFormMixin` described below. Class description: Mixin for enhancing authentication forms. This extends Django's built-in AuthenticationForm implementation to allow users to specify their e-mail address in place of their username. In addition, it also tracks the numbe...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class ReviewBoardAuthenticationFormMixin: """Mixin for enhancing authentication forms. This extends Django's built-in AuthenticationForm implementation to allow users to specify their e-mail address in place of their username. In addition, it also tracks the number of failed login attempts for a given ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReviewBoardAuthenticationFormMixin: """Mixin for enhancing authentication forms. This extends Django's built-in AuthenticationForm implementation to allow users to specify their e-mail address in place of their username. In addition, it also tracks the number of failed login attempts for a given time frame, a...
the_stack_v2_python_sparse
reviewboard/accounts/forms/auth.py
reviewboard/reviewboard
train
1,141
5884c9d06bb9947a11e2247472b18c5c2f5c5815
[ "global op\nop = 0\nnext = pcs.Field('next_header', 8)\nlen = pcs.Field('length', 8)\ntype = pcs.Field('type', 8)\npcs.Packet.__init__(self, [next, len, type], bytes)", "global op\nop += 1\notype = pcs.Field('otype' + str(op), 8)\nolen = pcs.Field('olength' + str(op), 8, default=len / 8)\nif len != 0:\n odata ...
<|body_start_0|> global op op = 0 next = pcs.Field('next_header', 8) len = pcs.Field('length', 8) type = pcs.Field('type', 8) pcs.Packet.__init__(self, [next, len, type], bytes) <|end_body_0|> <|body_start_1|> global op op += 1 otype = pcs.Field('...
A class that contains the IPv6 destination options extension-headers.
dstopts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dstopts: """A class that contains the IPv6 destination options extension-headers.""" def __init__(self, bytes=None): """IPv6 destination options extension header from RFC 2460""" <|body_0|> def option(self, len=0): """add option header to the destination extensio...
stack_v2_sparse_classes_75kplus_train_007325
7,919
no_license
[ { "docstring": "IPv6 destination options extension header from RFC 2460", "name": "__init__", "signature": "def __init__(self, bytes=None)" }, { "docstring": "add option header to the destination extension header", "name": "option", "signature": "def option(self, len=0)" } ]
2
stack_v2_sparse_classes_30k_train_034936
Implement the Python class `dstopts` described below. Class description: A class that contains the IPv6 destination options extension-headers. Method signatures and docstrings: - def __init__(self, bytes=None): IPv6 destination options extension header from RFC 2460 - def option(self, len=0): add option header to the...
Implement the Python class `dstopts` described below. Class description: A class that contains the IPv6 destination options extension-headers. Method signatures and docstrings: - def __init__(self, bytes=None): IPv6 destination options extension header from RFC 2460 - def option(self, len=0): add option header to the...
a070a39586b582fbeea72abf12bbfd812955ad81
<|skeleton|> class dstopts: """A class that contains the IPv6 destination options extension-headers.""" def __init__(self, bytes=None): """IPv6 destination options extension header from RFC 2460""" <|body_0|> def option(self, len=0): """add option header to the destination extensio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class dstopts: """A class that contains the IPv6 destination options extension-headers.""" def __init__(self, bytes=None): """IPv6 destination options extension header from RFC 2460""" global op op = 0 next = pcs.Field('next_header', 8) len = pcs.Field('length', 8) ...
the_stack_v2_python_sparse
src/pcs/packets/ipv6.py
bilouro/tcptest
train
0
ea9dcadeeb2ae4e8f1d652d7373df9ea7c6728c1
[ "super(SentimentRNN, self).__init__()\nself.output_size = output_dim\nself.num_layers = num_layers\nself.hidden_dim = hidden_dim\nself.embedding = nn.Embedding(vocab_size, input_dim)\nself.lstm = nn.LSTM(input_dim, hidden_dim, num_layers, dropout=dropout, bidirectional=False, batch_first=True)\nself.dropout = nn.Dr...
<|body_start_0|> super(SentimentRNN, self).__init__() self.output_size = output_dim self.num_layers = num_layers self.hidden_dim = hidden_dim self.embedding = nn.Embedding(vocab_size, input_dim) self.lstm = nn.LSTM(input_dim, hidden_dim, num_layers, dropout=dropout, bidir...
The RNN model that will be used to perform Sentiment analysis.
SentimentRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentimentRNN: """The RNN model that will be used to perform Sentiment analysis.""" def __init__(self, embeddings, input_dim, vocab_size, hidden_dim, num_layers, output_dim, max_len=100, dropout=0.5): """Initialize the model by setting up the layers.""" <|body_0|> def for...
stack_v2_sparse_classes_75kplus_train_007326
11,843
no_license
[ { "docstring": "Initialize the model by setting up the layers.", "name": "__init__", "signature": "def __init__(self, embeddings, input_dim, vocab_size, hidden_dim, num_layers, output_dim, max_len=100, dropout=0.5)" }, { "docstring": "Perform a forward pass of our model on some input and hidden ...
2
stack_v2_sparse_classes_30k_train_043648
Implement the Python class `SentimentRNN` described below. Class description: The RNN model that will be used to perform Sentiment analysis. Method signatures and docstrings: - def __init__(self, embeddings, input_dim, vocab_size, hidden_dim, num_layers, output_dim, max_len=100, dropout=0.5): Initialize the model by ...
Implement the Python class `SentimentRNN` described below. Class description: The RNN model that will be used to perform Sentiment analysis. Method signatures and docstrings: - def __init__(self, embeddings, input_dim, vocab_size, hidden_dim, num_layers, output_dim, max_len=100, dropout=0.5): Initialize the model by ...
031067ce6a927793045d104218f23d7be336f201
<|skeleton|> class SentimentRNN: """The RNN model that will be used to perform Sentiment analysis.""" def __init__(self, embeddings, input_dim, vocab_size, hidden_dim, num_layers, output_dim, max_len=100, dropout=0.5): """Initialize the model by setting up the layers.""" <|body_0|> def for...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentimentRNN: """The RNN model that will be used to perform Sentiment analysis.""" def __init__(self, embeddings, input_dim, vocab_size, hidden_dim, num_layers, output_dim, max_len=100, dropout=0.5): """Initialize the model by setting up the layers.""" super(SentimentRNN, self).__init__()...
the_stack_v2_python_sparse
Handson-ML/kaggle/sentiment_analysis_on_movie_reviews/torch_lstm_solution.py
txsniper/Learning-Note
train
7
75106ba0a0302156764fee6e8060d20aa0d08363
[ "all_subsets = []\ncurrent = []\nself.generate_subsets(nums, 0, all_subsets, current)\nreturn all_subsets", "print(current)\nall_subsets.append(current[:])\nfor i in range(index, len(nums)):\n current.append(nums[i])\n self.generate_subsets(nums, i + 1, all_subsets, current)\n current.pop()" ]
<|body_start_0|> all_subsets = [] current = [] self.generate_subsets(nums, 0, all_subsets, current) return all_subsets <|end_body_0|> <|body_start_1|> print(current) all_subsets.append(current[:]) for i in range(index, len(nums)): current.append(nums[...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def generate_subsets(self, nums, index, all_subsets, current): """Forms the all possible subsets of the given set of numbers""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_007327
1,182
permissive
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" }, { "docstring": "Forms the all possible subsets of the given set of numbers", "name": "generate_subsets", "signature": "def generate_subsets(self, nums, index, all_...
2
stack_v2_sparse_classes_30k_train_028633
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def generate_subsets(self, nums, index, all_subsets, current): Forms the all possible subsets of the give...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def generate_subsets(self, nums, index, all_subsets, current): Forms the all possible subsets of the give...
547c200b627c774535bc22880b16d5390183aeba
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def generate_subsets(self, nums, index, all_subsets, current): """Forms the all possible subsets of the given set of numbers""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" all_subsets = [] current = [] self.generate_subsets(nums, 0, all_subsets, current) return all_subsets def generate_subsets(self, nums, index, all_subsets, current): """Fo...
the_stack_v2_python_sparse
medium/78_subsets.py
Sukhrobjon/leetcode
train
0
387e927070389bbbebded9641a55d59a8283f1aa
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Domain()", "from .directory_object import DirectoryObject\nfrom .domain_dns_record import DomainDnsRecord\nfrom .domain_state import DomainState\nfrom .entity import Entity\nfrom .internal_domain_federation import InternalDomainFederat...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Domain() <|end_body_0|> <|body_start_1|> from .directory_object import DirectoryObject from .domain_dns_record import DomainDnsRecord from .domain_state import DomainState ...
Domain
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Domain: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Domain: """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: Domain""" ...
stack_v2_sparse_classes_75kplus_train_007328
9,421
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: Domain", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_...
3
stack_v2_sparse_classes_30k_train_026855
Implement the Python class `Domain` described below. Class description: Implement the Domain class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Domain: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: Th...
Implement the Python class `Domain` described below. Class description: Implement the Domain class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Domain: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: Th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Domain: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Domain: """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: Domain""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Domain: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Domain: """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: Domain""" if not p...
the_stack_v2_python_sparse
msgraph/generated/models/domain.py
microsoftgraph/msgraph-sdk-python
train
135
555c8a6f8091c7e47c2c87f6762c78fae3129f34
[ "super().__init__()\nout_channels = 2 * in_channels\nself.down_conv = nn.Conv2d(in_channels, out_channels, kernel_size=2, stride=2, bias=bias)\nself.bn1 = nn.BatchNorm2d(out_channels)\nself.act_function1 = act(inplace=True)\nself.act_function2 = act(inplace=True)\nself.ops = _make_nconv(out_channels, convs, act, bi...
<|body_start_0|> super().__init__() out_channels = 2 * in_channels self.down_conv = nn.Conv2d(in_channels, out_channels, kernel_size=2, stride=2, bias=bias) self.bn1 = nn.BatchNorm2d(out_channels) self.act_function1 = act(inplace=True) self.act_function2 = act(inplace=Tru...
Down Transition Block.
DownTransition
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownTransition: """Down Transition Block.""" def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): """Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module A...
stack_v2_sparse_classes_75kplus_train_007329
8,968
permissive
[ { "docstring": "Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module Activation function. dropout_prob : float Dropout probability. bias : bool Whether to use bias.", "name": "__init__", "signature": "def __init__(self, in_channels: int, ...
2
stack_v2_sparse_classes_30k_train_006159
Implement the Python class `DownTransition` described below. Class description: Down Transition Block. Method signatures and docstrings: - def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): Parameters ---------- in_channels : int Number of input channel...
Implement the Python class `DownTransition` described below. Class description: Down Transition Block. Method signatures and docstrings: - def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): Parameters ---------- in_channels : int Number of input channel...
6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066
<|skeleton|> class DownTransition: """Down Transition Block.""" def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): """Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module A...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DownTransition: """Down Transition Block.""" def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): """Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module Activation fun...
the_stack_v2_python_sparse
mridc/collections/segmentation/models/vnet_base/vnet_block.py
wdika/mridc
train
40
da34c3f5ebfb7c342b52fd829cbd21838c150cf6
[ "super(Filterer, self).__init__()\nself.expression = expression\nself.target = target\nself._event = event\nself._regex = None\nreturn", "if self._event is None:\n self._event = DummyEvent()\nreturn self._event", "if self._regex is None:\n self._regex = re.compile(self.expression)\nreturn self._regex", ...
<|body_start_0|> super(Filterer, self).__init__() self.expression = expression self.target = target self._event = event self._regex = None return <|end_body_0|> <|body_start_1|> if self._event is None: self._event = DummyEvent() return self._e...
A Filterer filters out strings that don't match an expression.
Filterer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Filterer: """A Filterer filters out strings that don't match an expression.""" def __init__(self, expression, target, event=None): """:param: - `expression`: A regular expression. - `target`: a target to send matching strings to - `event`: an Event to activate flow through the filter...
stack_v2_sparse_classes_75kplus_train_007330
1,774
permissive
[ { "docstring": ":param: - `expression`: A regular expression. - `target`: a target to send matching strings to - `event`: an Event to activate flow through the filter", "name": "__init__", "signature": "def __init__(self, expression, target, event=None)" }, { "docstring": ":return: threading eve...
4
stack_v2_sparse_classes_30k_train_028857
Implement the Python class `Filterer` described below. Class description: A Filterer filters out strings that don't match an expression. Method signatures and docstrings: - def __init__(self, expression, target, event=None): :param: - `expression`: A regular expression. - `target`: a target to send matching strings t...
Implement the Python class `Filterer` described below. Class description: A Filterer filters out strings that don't match an expression. Method signatures and docstrings: - def __init__(self, expression, target, event=None): :param: - `expression`: A regular expression. - `target`: a target to send matching strings t...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class Filterer: """A Filterer filters out strings that don't match an expression.""" def __init__(self, expression, target, event=None): """:param: - `expression`: A regular expression. - `target`: a target to send matching strings to - `event`: an Event to activate flow through the filter...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Filterer: """A Filterer filters out strings that don't match an expression.""" def __init__(self, expression, target, event=None): """:param: - `expression`: A regular expression. - `target`: a target to send matching strings to - `event`: an Event to activate flow through the filter""" s...
the_stack_v2_python_sparse
apetools/commons/filterer.py
russell-n/oldape
train
0
ed2ae09a932a04cab6416112802b5220c621265d
[ "super().__init__()\nimport sklearn\nimport sklearn.naive_bayes\nself.model = sklearn.naive_bayes.GaussianNB", "specs = super(GaussianNB, cls).getInputSpecification()\nspecs.description = 'The \\\\\\\\textit{GaussianNB} classifier implements the Gaussian Naive Bayes\\n algorithm for classi...
<|body_start_0|> super().__init__() import sklearn import sklearn.naive_bayes self.model = sklearn.naive_bayes.GaussianNB <|end_body_0|> <|body_start_1|> specs = super(GaussianNB, cls).getInputSpecification() specs.description = 'The \\\\textit{GaussianNB} classifier imp...
GaussianNB Classifier Gaussian Naive Bayes (GaussianNB) classifier
GaussianNB
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianNB: """GaussianNB Classifier Gaussian Naive Bayes (GaussianNB) classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method ...
stack_v2_sparse_classes_75kplus_train_007331
4,253
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
stack_v2_sparse_classes_30k_train_006065
Implement the Python class `GaussianNB` described below. Class description: GaussianNB Classifier Gaussian Naive Bayes (GaussianNB) classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecif...
Implement the Python class `GaussianNB` described below. Class description: GaussianNB Classifier Gaussian Naive Bayes (GaussianNB) classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecif...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class GaussianNB: """GaussianNB Classifier Gaussian Naive Bayes (GaussianNB) classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GaussianNB: """GaussianNB Classifier Gaussian Naive Bayes (GaussianNB) classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.naive_bayes ...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/NaiveBayes/GaussianNBClassifier.py
idaholab/raven
train
201
d45c0a98cf5d1ee7a2f539e6448716fb3487232a
[ "out_module_path = self.path + module_name + '/' + self.outpath_foldername + '/' + project_name + '/' + self.map_outputpath_folder[self.projects[project_name]['by']] + '/'\nif not os.path.exists(out_module_path):\n os.makedirs(out_module_path)\nreturn out_module_path", "res_module_path = self.path + module_nam...
<|body_start_0|> out_module_path = self.path + module_name + '/' + self.outpath_foldername + '/' + project_name + '/' + self.map_outputpath_folder[self.projects[project_name]['by']] + '/' if not os.path.exists(out_module_path): os.makedirs(out_module_path) return out_module_path <|en...
Framework
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Framework: def get_outfolder_path(self, project_name, module_name): """Get the output folder path :param project_name: :param module_name: :return:""" <|body_0|> def get_resfolder_path(self, project_name, module_name): """Get the output folder path :param project_nam...
stack_v2_sparse_classes_75kplus_train_007332
1,538
no_license
[ { "docstring": "Get the output folder path :param project_name: :param module_name: :return:", "name": "get_outfolder_path", "signature": "def get_outfolder_path(self, project_name, module_name)" }, { "docstring": "Get the output folder path :param project_name: :param module_name: :return:", ...
2
stack_v2_sparse_classes_30k_train_004231
Implement the Python class `Framework` described below. Class description: Implement the Framework class. Method signatures and docstrings: - def get_outfolder_path(self, project_name, module_name): Get the output folder path :param project_name: :param module_name: :return: - def get_resfolder_path(self, project_nam...
Implement the Python class `Framework` described below. Class description: Implement the Framework class. Method signatures and docstrings: - def get_outfolder_path(self, project_name, module_name): Get the output folder path :param project_name: :param module_name: :return: - def get_resfolder_path(self, project_nam...
f434776eb5966f706e6190b8ab576bf98229715f
<|skeleton|> class Framework: def get_outfolder_path(self, project_name, module_name): """Get the output folder path :param project_name: :param module_name: :return:""" <|body_0|> def get_resfolder_path(self, project_name, module_name): """Get the output folder path :param project_nam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Framework: def get_outfolder_path(self, project_name, module_name): """Get the output folder path :param project_name: :param module_name: :return:""" out_module_path = self.path + module_name + '/' + self.outpath_foldername + '/' + project_name + '/' + self.map_outputpath_folder[self.projects...
the_stack_v2_python_sparse
mailib/workflow/workflow.py
TomCMM/sib2_reg_lcb
train
0
68ad8f8efb4a57cd48c279f3f5d58948212cb1aa
[ "self.description = description\nself.suggested_values = suggested_values\nself.default = default\nself.languages = Languages(languages)", "if obj is not None:\n if self.languages and obj.language not in self.languages:\n raise TasteError('%s.%s is not available for %s.' % (type(obj).__qualname__, self....
<|body_start_0|> self.description = description self.suggested_values = suggested_values self.default = default self.languages = Languages(languages) <|end_body_0|> <|body_start_1|> if obj is not None: if self.languages and obj.language not in self.languages: ...
Defines tastes in aspectclass definitions. Tastes can be made only available for certain languages by providing a ``tuple`` of language identifiers on instantiation: >>> Taste[bool]( ... 'Ignore ``using`` directives in C#.', ... (True, False), default=False, ... languages=('CSharp', ) ... ).languages (C#,) If no `langu...
Taste
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Taste: """Defines tastes in aspectclass definitions. Tastes can be made only available for certain languages by providing a ``tuple`` of language identifiers on instantiation: >>> Taste[bool]( ... 'Ignore ``using`` directives in C#.', ... (True, False), default=False, ... languages=('CSharp', ) ....
stack_v2_sparse_classes_75kplus_train_007333
2,896
no_license
[ { "docstring": "Creates a new taste that can be optionally only available for the given `languages`, which must be language identifiers supported by :class:`coalib.bearlib.languages.Language`. No need to specify name an cast type: The taste name is defined by the taste's attribute name in an aspectclass definit...
3
stack_v2_sparse_classes_30k_val_001440
Implement the Python class `Taste` described below. Class description: Defines tastes in aspectclass definitions. Tastes can be made only available for certain languages by providing a ``tuple`` of language identifiers on instantiation: >>> Taste[bool]( ... 'Ignore ``using`` directives in C#.', ... (True, False), defa...
Implement the Python class `Taste` described below. Class description: Defines tastes in aspectclass definitions. Tastes can be made only available for certain languages by providing a ``tuple`` of language identifiers on instantiation: >>> Taste[bool]( ... 'Ignore ``using`` directives in C#.', ... (True, False), defa...
d494b3041069d377d6a7a9c296a14334f2fa5acc
<|skeleton|> class Taste: """Defines tastes in aspectclass definitions. Tastes can be made only available for certain languages by providing a ``tuple`` of language identifiers on instantiation: >>> Taste[bool]( ... 'Ignore ``using`` directives in C#.', ... (True, False), default=False, ... languages=('CSharp', ) ....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Taste: """Defines tastes in aspectclass definitions. Tastes can be made only available for certain languages by providing a ``tuple`` of language identifiers on instantiation: >>> Taste[bool]( ... 'Ignore ``using`` directives in C#.', ... (True, False), default=False, ... languages=('CSharp', ) ... ).language...
the_stack_v2_python_sparse
python/coala_coala/coala-master/coalib/bearlib/aspects/taste.py
LiuFang816/SALSTM_py_data
train
10
79fe8892580e23bd912fa3b8dff67c591777c650
[ "self.params = [W]\nself.grads = [np.zeros_like(W)]\nself.idx = None", "W, = self.params\nself.idx = idx\nout = W[idx]\nreturn out" ]
<|body_start_0|> self.params = [W] self.grads = [np.zeros_like(W)] self.idx = None <|end_body_0|> <|body_start_1|> W, = self.params self.idx = idx out = W[idx] return out <|end_body_1|>
Embedding
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding: def __init__(self, W): """W : 重み行列, word2vecの埋め込み行列に相当する。配列形状は、(語彙数、埋め込みベクトルの要素数)""" <|body_0|> def forward(self, idx): """順伝播計算""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.params = [W] self.grads = [np.zeros_like(W)] ...
stack_v2_sparse_classes_75kplus_train_007334
2,822
permissive
[ { "docstring": "W : 重み行列, word2vecの埋め込み行列に相当する。配列形状は、(語彙数、埋め込みベクトルの要素数)", "name": "__init__", "signature": "def __init__(self, W)" }, { "docstring": "順伝播計算", "name": "forward", "signature": "def forward(self, idx)" } ]
2
stack_v2_sparse_classes_30k_train_009513
Implement the Python class `Embedding` described below. Class description: Implement the Embedding class. Method signatures and docstrings: - def __init__(self, W): W : 重み行列, word2vecの埋め込み行列に相当する。配列形状は、(語彙数、埋め込みベクトルの要素数) - def forward(self, idx): 順伝播計算
Implement the Python class `Embedding` described below. Class description: Implement the Embedding class. Method signatures and docstrings: - def __init__(self, W): W : 重み行列, word2vecの埋め込み行列に相当する。配列形状は、(語彙数、埋め込みベクトルの要素数) - def forward(self, idx): 順伝播計算 <|skeleton|> class Embedding: def __init__(self, W): ...
d3f8a36c068db44391afcf4727ccbb7c456852c2
<|skeleton|> class Embedding: def __init__(self, W): """W : 重み行列, word2vecの埋め込み行列に相当する。配列形状は、(語彙数、埋め込みベクトルの要素数)""" <|body_0|> def forward(self, idx): """順伝播計算""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Embedding: def __init__(self, W): """W : 重み行列, word2vecの埋め込み行列に相当する。配列形状は、(語彙数、埋め込みベクトルの要素数)""" self.params = [W] self.grads = [np.zeros_like(W)] self.idx = None def forward(self, idx): """順伝播計算""" W, = self.params self.idx = idx out = W[idx...
the_stack_v2_python_sparse
chapter15/layers.py
skillup-ai/tettei-engineer
train
26
aeac4d50df9de8bffa7dabfe632fce9b0bc510fe
[ "self.f = [0] * len(nums)\nfor i, x in enumerate(nums):\n self.f[i] = self.f[i - 1] + x", "if i > 0:\n prefix = self.f[i - 1]\nelse:\n prefix = 0\nreturn self.f[j] - prefix" ]
<|body_start_0|> self.f = [0] * len(nums) for i, x in enumerate(nums): self.f[i] = self.f[i - 1] + x <|end_body_0|> <|body_start_1|> if i > 0: prefix = self.f[i - 1] else: prefix = 0 return self.f[j] - prefix <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.f = [0] * len(nums) for i, x in enumerate(nums...
stack_v2_sparse_classes_75kplus_train_007335
624
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_013834
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
e471af90af15e8a4b304e0244a724698a47286f2
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.f = [0] * len(nums) for i, x in enumerate(nums): self.f[i] = self.f[i - 1] + x def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i > 0: prefix = self...
the_stack_v2_python_sparse
303.py
hchen13/LeetCode
train
0
5df56d9dd6be2f5c4957777354b81dc4dc845aac
[ "self.main_window = QtGui.QWidget()\nself.gui = Gui()\nself.gui.setupUi(self.main_window)\nself.gui.f_to_c_button.clicked.connect(self.f_to_c)\nself.gui.c_to_f_button.clicked.connect(self.c_to_f)\nself.main_window.setWindowTitle(title)\nself.main_window.setGeometry(40, 40, 200, 150)", "f = float(self.gui.fahrenhe...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) self.gui.f_to_c_button.clicked.connect(self.f_to_c) self.gui.c_to_f_button.clicked.connect(self.c_to_f) self.main_window.setWindowTitle(title) self.main_window....
Application class to create and control the gui.
App
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """Application class to create and control the gui.""" def __init__(self, title='Temperature Conversion'): """Initialize the gui.""" <|body_0|> def f_to_c(self): """Convert from fahrenheit to celsius.""" <|body_1|> def c_to_f(self): """C...
stack_v2_sparse_classes_75kplus_train_007336
2,315
no_license
[ { "docstring": "Initialize the gui.", "name": "__init__", "signature": "def __init__(self, title='Temperature Conversion')" }, { "docstring": "Convert from fahrenheit to celsius.", "name": "f_to_c", "signature": "def f_to_c(self)" }, { "docstring": "Convert from celsius to fahren...
3
stack_v2_sparse_classes_30k_train_019156
Implement the Python class `App` described below. Class description: Application class to create and control the gui. Method signatures and docstrings: - def __init__(self, title='Temperature Conversion'): Initialize the gui. - def f_to_c(self): Convert from fahrenheit to celsius. - def c_to_f(self): Convert from cel...
Implement the Python class `App` described below. Class description: Application class to create and control the gui. Method signatures and docstrings: - def __init__(self, title='Temperature Conversion'): Initialize the gui. - def f_to_c(self): Convert from fahrenheit to celsius. - def c_to_f(self): Convert from cel...
0e3470085083012f893adb22aa46d46039016965
<|skeleton|> class App: """Application class to create and control the gui.""" def __init__(self, title='Temperature Conversion'): """Initialize the gui.""" <|body_0|> def f_to_c(self): """Convert from fahrenheit to celsius.""" <|body_1|> def c_to_f(self): """C...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class App: """Application class to create and control the gui.""" def __init__(self, title='Temperature Conversion'): """Initialize the gui.""" self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) self.gui.f_to_c_button.clicked.connect(s...
the_stack_v2_python_sparse
CS_210 (Introduction to Programming)/Labs/Gooey/TemperatureApp.py
JacobOrner/USAFA
train
0
1c249f7a80400f2454c99c1015c7ae59deee0e98
[ "reg_a_port = IOPort('reg-a', 'control', 'in', 4, False)\nreg_b_port = IOPort('reg-b', 'control', 'in', 4, False)\nreg_w_con = IOPort('reg-w-con', 'control', 'in', 1, False)\nreg_w_port = IOPort('reg-w', 'control', 'in', 4, False)\ndata_w_port = IOPort('data-w', 'data', 'in')\ndata_a_port = IOPort('data-a', 'data',...
<|body_start_0|> reg_a_port = IOPort('reg-a', 'control', 'in', 4, False) reg_b_port = IOPort('reg-b', 'control', 'in', 4, False) reg_w_con = IOPort('reg-w-con', 'control', 'in', 1, False) reg_w_port = IOPort('reg-w', 'control', 'in', 4, False) data_w_port = IOPort('data-w', 'data...
A class to represent a register bank that extends Component. This class is a functional logic component that retrieves data at a given memory address. Attributes: data (List[Signal]): the register contents indexed by register address
Register
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Register: """A class to represent a register bank that extends Component. This class is a functional logic component that retrieves data at a given memory address. Attributes: data (List[Signal]): the register contents indexed by register address""" def __init__(self): """Initialize ...
stack_v2_sparse_classes_75kplus_train_007337
3,000
no_license
[ { "docstring": "Initialize the Register object and extend Component.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Execute the register's read functional logic. The register bank retrieves data at a given register address.", "name": "_execute_read", "signatur...
4
stack_v2_sparse_classes_30k_train_014587
Implement the Python class `Register` described below. Class description: A class to represent a register bank that extends Component. This class is a functional logic component that retrieves data at a given memory address. Attributes: data (List[Signal]): the register contents indexed by register address Method sig...
Implement the Python class `Register` described below. Class description: A class to represent a register bank that extends Component. This class is a functional logic component that retrieves data at a given memory address. Attributes: data (List[Signal]): the register contents indexed by register address Method sig...
0b360801545e459d616b35435788fddbb958a626
<|skeleton|> class Register: """A class to represent a register bank that extends Component. This class is a functional logic component that retrieves data at a given memory address. Attributes: data (List[Signal]): the register contents indexed by register address""" def __init__(self): """Initialize ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Register: """A class to represent a register bank that extends Component. This class is a functional logic component that retrieves data at a given memory address. Attributes: data (List[Signal]): the register contents indexed by register address""" def __init__(self): """Initialize the Register ...
the_stack_v2_python_sparse
components/register.py
bwiswell/py-virpu
train
1
5fc6c86715e2405076541db45616642c32dc24c5
[ "self.n_iter = 0\nself.n_steps = n_steps\nself.walkers = np.zeros((2, n_walkers), int)\nself.n_walkers = n_walkers", "while self.n_iter < self.n_steps:\n x = ran.randint(low=-1, high=2, size=self.n_walkers)\n y = ran.randint(low=-1, high=2, size=self.n_walkers)\n self.walkers[0] += x\n self.walkers[1]...
<|body_start_0|> self.n_iter = 0 self.n_steps = n_steps self.walkers = np.zeros((2, n_walkers), int) self.n_walkers = n_walkers <|end_body_0|> <|body_start_1|> while self.n_iter < self.n_steps: x = ran.randint(low=-1, high=2, size=self.n_walkers) y = ran....
class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.
random_walk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class random_walk: """class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.""" def __init__(...
stack_v2_sparse_classes_75kplus_train_007338
1,945
no_license
[ { "docstring": "initialize walkers to origin", "name": "__init__", "signature": "def __init__(self, n_walkers, n_steps)" }, { "docstring": "update the random walk and call plot method each time", "name": "iterate", "signature": "def iterate(self)" }, { "docstring": "plots the wal...
3
stack_v2_sparse_classes_30k_train_009577
Implement the Python class `random_walk` described below. Class description: class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers...
Implement the Python class `random_walk` described below. Class description: class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers...
516b74c57a1c7db7fb5097e833582744c92adf62
<|skeleton|> class random_walk: """class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.""" def __init__(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class random_walk: """class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.""" def __init__(self, n_walke...
the_stack_v2_python_sparse
PythonProgramming/Homework 08/wood_10.3.py
Computational-Physics-Research/Computational-Physics-1
train
0
0fb98998ddaeef5c4bbfdb856d3133c142f8a643
[ "pk = kwargs.get('pk')\nqapp = Qapp.objects.filter(id=pk).first()\nif check_can_edit(qapp, request.user):\n qapp_approval = QappApproval.objects.filter(qapp_id=pk).first()\n return render(request, self.template_name, {'object': qapp_approval, 'qapp_id': pk, 'form': QappApprovalForm(instance=qapp_approval)})\n...
<|body_start_0|> pk = kwargs.get('pk') qapp = Qapp.objects.filter(id=pk).first() if check_can_edit(qapp, request.user): qapp_approval = QappApproval.objects.filter(qapp_id=pk).first() return render(request, self.template_name, {'object': qapp_approval, 'qapp_id': pk, 'for...
View for editing the details of an existing Qapp Approval page.
ProjectApprovalEdit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectApprovalEdit: """View for editing the details of an existing Qapp Approval page.""" def get(self, request, *args, **kwargs): """GET Project Approval Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membe...
stack_v2_sparse_classes_75kplus_train_007339
36,787
no_license
[ { "docstring": "GET Project Approval Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membership.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Save the changes to the form.", ...
2
stack_v2_sparse_classes_30k_train_023312
Implement the Python class `ProjectApprovalEdit` described below. Class description: View for editing the details of an existing Qapp Approval page. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET Project Approval Edit page. Override default get request so we can verify the user has e...
Implement the Python class `ProjectApprovalEdit` described below. Class description: View for editing the details of an existing Qapp Approval page. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET Project Approval Edit page. Override default get request so we can verify the user has e...
ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4
<|skeleton|> class ProjectApprovalEdit: """View for editing the details of an existing Qapp Approval page.""" def get(self, request, *args, **kwargs): """GET Project Approval Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectApprovalEdit: """View for editing the details of an existing Qapp Approval page.""" def get(self, request, *args, **kwargs): """GET Project Approval Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membership.""" ...
the_stack_v2_python_sparse
DataSearch/qar5/views.py
USEPA/FoodWaste
train
1
86b4470755b7ba8058d49ba3ff0495c8637b8ac7
[ "print(self.proxy_database_info)\nmongo_client = pymongo.MongoClient(self.proxy_database_info['host'], self.proxy_database_info['port'])\ndatabase = mongo_client[self.proxy_database_info['database']]\nusername = self.proxy_database_info['username']\npassword = self.proxy_database_info['password']\nif username and p...
<|body_start_0|> print(self.proxy_database_info) mongo_client = pymongo.MongoClient(self.proxy_database_info['host'], self.proxy_database_info['port']) database = mongo_client[self.proxy_database_info['database']] username = self.proxy_database_info['username'] password = self.pr...
BaseProxyPool子类 主要实现代理池初始化 init_proxy_pool 代理状态更新方法 update_proxy_state
VivoProxyPool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VivoProxyPool: """BaseProxyPool子类 主要实现代理池初始化 init_proxy_pool 代理状态更新方法 update_proxy_state""" def init_mongo_connection(self): """根据 self.proxy_database_info 初始化mongodb连接 :param self: 代理池类的实例 :return: mongo_client: mongo连接客户,将其返回的目的旨在希望使用者能够及时关闭连接 用完即关,再用再申请即可,避免资源浪费 database: 操作数据集的句柄...
stack_v2_sparse_classes_75kplus_train_007340
5,219
no_license
[ { "docstring": "根据 self.proxy_database_info 初始化mongodb连接 :param self: 代理池类的实例 :return: mongo_client: mongo连接客户,将其返回的目的旨在希望使用者能够及时关闭连接 用完即关,再用再申请即可,避免资源浪费 database: 操作数据集的句柄", "name": "init_mongo_connection", "signature": "def init_mongo_connection(self)" }, { "docstring": "父类的抽象方法,针对mongodb数据库操作...
3
null
Implement the Python class `VivoProxyPool` described below. Class description: BaseProxyPool子类 主要实现代理池初始化 init_proxy_pool 代理状态更新方法 update_proxy_state Method signatures and docstrings: - def init_mongo_connection(self): 根据 self.proxy_database_info 初始化mongodb连接 :param self: 代理池类的实例 :return: mongo_client: mongo连接客户,将其返回...
Implement the Python class `VivoProxyPool` described below. Class description: BaseProxyPool子类 主要实现代理池初始化 init_proxy_pool 代理状态更新方法 update_proxy_state Method signatures and docstrings: - def init_mongo_connection(self): 根据 self.proxy_database_info 初始化mongodb连接 :param self: 代理池类的实例 :return: mongo_client: mongo连接客户,将其返回...
1b42878b694fabc65a02228662ffdf819e5dcc71
<|skeleton|> class VivoProxyPool: """BaseProxyPool子类 主要实现代理池初始化 init_proxy_pool 代理状态更新方法 update_proxy_state""" def init_mongo_connection(self): """根据 self.proxy_database_info 初始化mongodb连接 :param self: 代理池类的实例 :return: mongo_client: mongo连接客户,将其返回的目的旨在希望使用者能够及时关闭连接 用完即关,再用再申请即可,避免资源浪费 database: 操作数据集的句柄...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VivoProxyPool: """BaseProxyPool子类 主要实现代理池初始化 init_proxy_pool 代理状态更新方法 update_proxy_state""" def init_mongo_connection(self): """根据 self.proxy_database_info 初始化mongodb连接 :param self: 代理池类的实例 :return: mongo_client: mongo连接客户,将其返回的目的旨在希望使用者能够及时关闭连接 用完即关,再用再申请即可,避免资源浪费 database: 操作数据集的句柄""" p...
the_stack_v2_python_sparse
vivo_public_modules/download_middleware/vivo_proxy_pool.py
wangsanshi123/spiders
train
0
457e43be3cf777024a1c15063d29943fc449ae23
[ "self.transport = transport\nself.address = transport.get_extra_info('peername')\nself.data = b''\nprint('accepted connection from {}'.format(self.address))", "self.data += data\nif self.data.endswith(b'?'):\n answer = zen_utils.get_answer(self.data)\n self.transport.write(answer)\n self.data = b''", "...
<|body_start_0|> self.transport = transport self.address = transport.get_extra_info('peername') self.data = b'' print('accepted connection from {}'.format(self.address)) <|end_body_0|> <|body_start_1|> self.data += data if self.data.endswith(b'?'): answer = z...
ZenServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZenServer: def connection_made(self, transport): """负责连接套接字建立后的准备工作""" <|body_0|> def data_received(self, data): """负责数据的接收、处理和发送,可以会被调用多次""" <|body_1|> def connection_lost(self, exc): """负责一次连接结束后的清理工作""" <|body_2|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_007341
1,953
no_license
[ { "docstring": "负责连接套接字建立后的准备工作", "name": "connection_made", "signature": "def connection_made(self, transport)" }, { "docstring": "负责数据的接收、处理和发送,可以会被调用多次", "name": "data_received", "signature": "def data_received(self, data)" }, { "docstring": "负责一次连接结束后的清理工作", "name": "conn...
3
stack_v2_sparse_classes_30k_train_036236
Implement the Python class `ZenServer` described below. Class description: Implement the ZenServer class. Method signatures and docstrings: - def connection_made(self, transport): 负责连接套接字建立后的准备工作 - def data_received(self, data): 负责数据的接收、处理和发送,可以会被调用多次 - def connection_lost(self, exc): 负责一次连接结束后的清理工作
Implement the Python class `ZenServer` described below. Class description: Implement the ZenServer class. Method signatures and docstrings: - def connection_made(self, transport): 负责连接套接字建立后的准备工作 - def data_received(self, data): 负责数据的接收、处理和发送,可以会被调用多次 - def connection_lost(self, exc): 负责一次连接结束后的清理工作 <|skeleton|> cla...
9d766f06b0d4b30f640fe7f0d7deabea99ba5eeb
<|skeleton|> class ZenServer: def connection_made(self, transport): """负责连接套接字建立后的准备工作""" <|body_0|> def data_received(self, data): """负责数据的接收、处理和发送,可以会被调用多次""" <|body_1|> def connection_lost(self, exc): """负责一次连接结束后的清理工作""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZenServer: def connection_made(self, transport): """负责连接套接字建立后的准备工作""" self.transport = transport self.address = transport.get_extra_info('peername') self.data = b'' print('accepted connection from {}'.format(self.address)) def data_received(self, data): ""...
the_stack_v2_python_sparse
pynetwork/第七章-服务器架构/srv_asyncio1.py
nick-fang/pynetwork
train
1
c6ede396fad99534e4d0a7f6161c53c2b2640c5d
[ "super(Actor, self).__init__()\nself.state_dim = state_dim\nself.action_dim = action_dim\nself.action_lim = action_lim\nself.hidden = 128\nself.usecuda = usecuda\nself.rnn = nn.LSTMCell(self.state_dim, self.hidden, bias=True)\nself.fc1 = nn.Linear(self.hidden, action_dim)\nself.fc1.weight.data.uniform_(-EPS, EPS)\n...
<|body_start_0|> super(Actor, self).__init__() self.state_dim = state_dim self.action_dim = action_dim self.action_lim = action_lim self.hidden = 128 self.usecuda = usecuda self.rnn = nn.LSTMCell(self.state_dim, self.hidden, bias=True) self.fc1 = nn.Linear...
Actor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Actor: def __init__(self, state_dim, action_dim, action_lim, usecuda=False): """Special method for class initialisation. :param state_dim: Dimension of input state. :type state_dim: int. :param action_dim: Dimension of output action. :type action_dim: int. :param action_lim: Used to limi...
stack_v2_sparse_classes_75kplus_train_007342
3,704
permissive
[ { "docstring": "Special method for class initialisation. :param state_dim: Dimension of input state. :type state_dim: int. :param action_dim: Dimension of output action. :type action_dim: int. :param action_lim: Used to limit action. :type action_lim: float. :return:", "name": "__init__", "signature": "...
3
stack_v2_sparse_classes_30k_train_045859
Implement the Python class `Actor` described below. Class description: Implement the Actor class. Method signatures and docstrings: - def __init__(self, state_dim, action_dim, action_lim, usecuda=False): Special method for class initialisation. :param state_dim: Dimension of input state. :type state_dim: int. :param ...
Implement the Python class `Actor` described below. Class description: Implement the Actor class. Method signatures and docstrings: - def __init__(self, state_dim, action_dim, action_lim, usecuda=False): Special method for class initialisation. :param state_dim: Dimension of input state. :type state_dim: int. :param ...
a02bdb1754e9bae1c2448e4bccec795c739b3e6f
<|skeleton|> class Actor: def __init__(self, state_dim, action_dim, action_lim, usecuda=False): """Special method for class initialisation. :param state_dim: Dimension of input state. :type state_dim: int. :param action_dim: Dimension of output action. :type action_dim: int. :param action_lim: Used to limi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Actor: def __init__(self, state_dim, action_dim, action_lim, usecuda=False): """Special method for class initialisation. :param state_dim: Dimension of input state. :type state_dim: int. :param action_dim: Dimension of output action. :type action_dim: int. :param action_lim: Used to limit action. :typ...
the_stack_v2_python_sparse
notebook/njord-ddpg/model.py
LUOFENGZHOU/njord
train
0
e19be8619a9c617306f543ffa7a78387dd891033
[ "self.config_entry = config_entry\nself.current_config: dict = dict(config_entry.data)\nself.sensor_type: SensorType = self.current_config.get(CONF_SENSOR_TYPE) or SensorType.VIRTUAL_POWER\nself.source_entity_id: str = self.current_config.get(CONF_ENTITY_ID)\nself.source_entity: SourceEntity | None = None\nself.pow...
<|body_start_0|> self.config_entry = config_entry self.current_config: dict = dict(config_entry.data) self.sensor_type: SensorType = self.current_config.get(CONF_SENSOR_TYPE) or SensorType.VIRTUAL_POWER self.source_entity_id: str = self.current_config.get(CONF_ENTITY_ID) self.sou...
Handle an option flow for PowerCalc.
OptionsFlowHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsFlowHandler: """Handle an option flow for PowerCalc.""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle option...
stack_v2_sparse_classes_75kplus_train_007343
38,362
permissive
[ { "docstring": "Initialize options flow.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry) -> None" }, { "docstring": "Handle options flow.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input: dict[str, Any] | None=None) -...
5
stack_v2_sparse_classes_30k_train_008577
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle an option flow for PowerCalc. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Initialize options flow. - async def async_step_init(self, user_input: dict[str, Any] | None=None) -> Flow...
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle an option flow for PowerCalc. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Initialize options flow. - async def async_step_init(self, user_input: dict[str, Any] | None=None) -> Flow...
b22a7c3b5837b40a71d6eeecf7147503b96b9bf9
<|skeleton|> class OptionsFlowHandler: """Handle an option flow for PowerCalc.""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle option...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptionsFlowHandler: """Handle an option flow for PowerCalc.""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry self.current_config: dict = dict(config_entry.data) self.sensor_type: SensorType = self.cur...
the_stack_v2_python_sparse
custom_components/powercalc/config_flow.py
klaasnicolaas/Student-homeassistant-config
train
185
987b66eeb02ba22c8ca1ab98fa550ec54c094e93
[ "dic = {}\nfor i in nums:\n if i not in dic:\n dic[i] = 1\n else:\n dic[i] += 1\nvs = list(dic.values())\nreturn list(dic.keys())[vs.index(max(vs))]", "dict1 = {}\nfor i in nums:\n if i not in dict1:\n dict1[i] = 1\n else:\n dict1[i] += 1\nreturn max(dict1, key=dict1.get)" ...
<|body_start_0|> dic = {} for i in nums: if i not in dic: dic[i] = 1 else: dic[i] += 1 vs = list(dic.values()) return list(dic.keys())[vs.index(max(vs))] <|end_body_0|> <|body_start_1|> dict1 = {} for i in nums: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int 查找众数 hash反存值和出现的次数""" <|body_0|> def majorityElementFast(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dic = {} ...
stack_v2_sparse_classes_75kplus_train_007344
939
permissive
[ { "docstring": ":type nums: List[int] :rtype: int 查找众数 hash反存值和出现的次数", "name": "majorityElement", "signature": "def majorityElement(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "majorityElementFast", "signature": "def majorityElementFast(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_043726
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): :type nums: List[int] :rtype: int 查找众数 hash反存值和出现的次数 - def majorityElementFast(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): :type nums: List[int] :rtype: int 查找众数 hash反存值和出现的次数 - def majorityElementFast(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class...
9f49766a2b375a6c65f7bfa96df513875ddd772d
<|skeleton|> class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int 查找众数 hash反存值和出现的次数""" <|body_0|> def majorityElementFast(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int 查找众数 hash反存值和出现的次数""" dic = {} for i in nums: if i not in dic: dic[i] = 1 else: dic[i] += 1 vs = list(dic.values()) return list(dic.ke...
the_stack_v2_python_sparse
LeetcodeView/169.majorityElement.md
Song2017/Leetcode_python
train
1
cacdcae2357f9e4d21b8de430ec032fcf746b735
[ "nxg_e = nx.DiGraph()\nnxg_e.add_nodes_from(g1)\nnxg_e.add_nodes_from(g2)\nnxg_1 = nx.DiGraph()\nnxg_1.add_nodes_from(nxg_e)\nnxg_1.add_edges_from(g1.edges())\nnxg_2 = nx.DiGraph()\nnxg_2.add_nodes_from(nxg_e)\nnxg_2.add_edges_from(g2.edges())\nadj_1 = nx.adjacency_matrix(nxg_1)\nadj_2 = nx.adjacency_matrix(nxg_2)\...
<|body_start_0|> nxg_e = nx.DiGraph() nxg_e.add_nodes_from(g1) nxg_e.add_nodes_from(g2) nxg_1 = nx.DiGraph() nxg_1.add_nodes_from(nxg_e) nxg_1.add_edges_from(g1.edges()) nxg_2 = nx.DiGraph() nxg_2.add_nodes_from(nxg_e) nxg_2.add_edges_from(g2.edges...
DeltaCon similarity Refer the paper DELTACON: A Principled Massive-Graph Similarity Function https://arxiv.org/abs/1304.4657
DLcon_Similarity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DLcon_Similarity: """DeltaCon similarity Refer the paper DELTACON: A Principled Massive-Graph Similarity Function https://arxiv.org/abs/1304.4657""" def __init__(self, g1, g2): """:param g1: NetworkX graph 1 :param g2: NetworkX graph 2""" <|body_0|> def InverseMatrix(sel...
stack_v2_sparse_classes_75kplus_train_007345
2,476
permissive
[ { "docstring": ":param g1: NetworkX graph 1 :param g2: NetworkX graph 2", "name": "__init__", "signature": "def __init__(self, g1, g2)" }, { "docstring": "Calculate the inverse matrix of the adjacency matrix. :param A: Adjacency matrix :return: inverted matrix", "name": "InverseMatrix", ...
3
stack_v2_sparse_classes_30k_train_038468
Implement the Python class `DLcon_Similarity` described below. Class description: DeltaCon similarity Refer the paper DELTACON: A Principled Massive-Graph Similarity Function https://arxiv.org/abs/1304.4657 Method signatures and docstrings: - def __init__(self, g1, g2): :param g1: NetworkX graph 1 :param g2: NetworkX...
Implement the Python class `DLcon_Similarity` described below. Class description: DeltaCon similarity Refer the paper DELTACON: A Principled Massive-Graph Similarity Function https://arxiv.org/abs/1304.4657 Method signatures and docstrings: - def __init__(self, g1, g2): :param g1: NetworkX graph 1 :param g2: NetworkX...
6bbdabe4b71be369e616e3136d7f0120531c9fc8
<|skeleton|> class DLcon_Similarity: """DeltaCon similarity Refer the paper DELTACON: A Principled Massive-Graph Similarity Function https://arxiv.org/abs/1304.4657""" def __init__(self, g1, g2): """:param g1: NetworkX graph 1 :param g2: NetworkX graph 2""" <|body_0|> def InverseMatrix(sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DLcon_Similarity: """DeltaCon similarity Refer the paper DELTACON: A Principled Massive-Graph Similarity Function https://arxiv.org/abs/1304.4657""" def __init__(self, g1, g2): """:param g1: NetworkX graph 1 :param g2: NetworkX graph 2""" nxg_e = nx.DiGraph() nxg_e.add_nodes_from(...
the_stack_v2_python_sparse
callflow/algorithms/deltacon_similarity.py
LLNL/CallFlow
train
32
c4fee94b0ab112d92d527c48acae81e1d6c6103a
[ "settings = ConfigSetup()\nself.frag_url = settings.get('fragalysis', 'url')\nself.pdb_url = settings.get('pdb', 'search')\nself.bound_pdb_url = settings.get('bound_pdb', 'search')\nself.bound_query = settings.get('bound_pdb', 'query')\nself.query = settings.get('pdb', 'query')", "url = str(self.frag_url + self.p...
<|body_start_0|> settings = ConfigSetup() self.frag_url = settings.get('fragalysis', 'url') self.pdb_url = settings.get('pdb', 'search') self.bound_pdb_url = settings.get('bound_pdb', 'search') self.bound_query = settings.get('bound_pdb', 'query') self.query = settings.ge...
Getting protine data from the fragalysis website in the pdb file format
GetPdbData
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetPdbData: """Getting protine data from the fragalysis website in the pdb file format""" def __init__(self): """:param self.frag_url: URL of the fragalysis website :param self.pdb_url: URL to search the fragalysis data base for the protein :param self.query: URL to tell the restfull...
stack_v2_sparse_classes_75kplus_train_007346
10,546
permissive
[ { "docstring": ":param self.frag_url: URL of the fragalysis website :param self.pdb_url: URL to search the fragalysis data base for the protein :param self.query: URL to tell the restfull API how to do the query", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Function ...
3
stack_v2_sparse_classes_30k_val_000280
Implement the Python class `GetPdbData` described below. Class description: Getting protine data from the fragalysis website in the pdb file format Method signatures and docstrings: - def __init__(self): :param self.frag_url: URL of the fragalysis website :param self.pdb_url: URL to search the fragalysis data base fo...
Implement the Python class `GetPdbData` described below. Class description: Getting protine data from the fragalysis website in the pdb file format Method signatures and docstrings: - def __init__(self): :param self.frag_url: URL of the fragalysis website :param self.pdb_url: URL to search the fragalysis data base fo...
b09a4b978c2e2bdfdc2d9d0b4c85178b24e949c7
<|skeleton|> class GetPdbData: """Getting protine data from the fragalysis website in the pdb file format""" def __init__(self): """:param self.frag_url: URL of the fragalysis website :param self.pdb_url: URL to search the fragalysis data base for the protein :param self.query: URL to tell the restfull...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GetPdbData: """Getting protine data from the fragalysis website in the pdb file format""" def __init__(self): """:param self.frag_url: URL of the fragalysis website :param self.pdb_url: URL to search the fragalysis data base for the protein :param self.query: URL to tell the restfull API how to d...
the_stack_v2_python_sparse
fragalysis_api/xcextracter/getdata.py
xchem/fragalysis-api
train
11
811faaebee9a02c7133c7ac2419d168fb41553be
[ "super(AddUserHandler, self).prepare()\nself.json_data = None\ntry:\n self.json_data = tornado.escape.json_decode(self.request.body)\nexcept ValueError:\n pass", "sm = self.game_manager\nusernm = self.get_body_argument('username')\npasswd = self.get_body_argument('password')\nrval = True\nif not usernm is N...
<|body_start_0|> super(AddUserHandler, self).prepare() self.json_data = None try: self.json_data = tornado.escape.json_decode(self.request.body) except ValueError: pass <|end_body_0|> <|body_start_1|> sm = self.game_manager usernm = self.get_body_...
Handler for adding a user to the DB
AddUserHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddUserHandler: """Handler for adding a user to the DB""" def prepare(self): """Prepares json response""" <|body_0|> def post(self): """on Post request behavior""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(AddUserHandler, self).prepare(...
stack_v2_sparse_classes_75kplus_train_007347
6,266
no_license
[ { "docstring": "Prepares json response", "name": "prepare", "signature": "def prepare(self)" }, { "docstring": "on Post request behavior", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `AddUserHandler` described below. Class description: Handler for adding a user to the DB Method signatures and docstrings: - def prepare(self): Prepares json response - def post(self): on Post request behavior
Implement the Python class `AddUserHandler` described below. Class description: Handler for adding a user to the DB Method signatures and docstrings: - def prepare(self): Prepares json response - def post(self): on Post request behavior <|skeleton|> class AddUserHandler: """Handler for adding a user to the DB"""...
445a6caf00d8af4eb0444d39496753cd97e95cca
<|skeleton|> class AddUserHandler: """Handler for adding a user to the DB""" def prepare(self): """Prepares json response""" <|body_0|> def post(self): """on Post request behavior""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddUserHandler: """Handler for adding a user to the DB""" def prepare(self): """Prepares json response""" super(AddUserHandler, self).prepare() self.json_data = None try: self.json_data = tornado.escape.json_decode(self.request.body) except ValueError: ...
the_stack_v2_python_sparse
dev/back-end/RequestHandlers.py
IdanHershcovich/checkers
train
0
f9c5bcea20a8d0bdd41c3c6b3dbd4eb347316576
[ "super().__init__()\nself.num_classes = classes_n\nself.linear = LinearPolicy(inp_n, hidden_size, hidden_size, num_layers - 1, activation_fn)\nlast_in_n = inp_n\nif num_layers > 1:\n self.linear = nn.Sequential(self.linear, activation_fn())\n last_in_n = hidden_size\nself.value = nn.Linear(last_in_n, out_n * ...
<|body_start_0|> super().__init__() self.num_classes = classes_n self.linear = LinearPolicy(inp_n, hidden_size, hidden_size, num_layers - 1, activation_fn) last_in_n = inp_n if num_layers > 1: self.linear = nn.Sequential(self.linear, activation_fn()) last_...
A simple multi-categorical policy.
MultiCategoricalPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiCategoricalPolicy: """A simple multi-categorical policy.""" def __init__(self, inp_n: int, out_n: int, classes_n: int, hidden_size: int, num_layers: int, activation_fn: nn.Module): """Creates the gaussian policy. Args: inp_n: The number of input units to the network. out_n: The ...
stack_v2_sparse_classes_75kplus_train_007348
6,947
permissive
[ { "docstring": "Creates the gaussian policy. Args: inp_n: The number of input units to the network. out_n: The number of independent categorical distributions. classes_n: The number of classes per category. hidden_size: The number of units in each hidden layer. num_layers: The number of layers before the gaussi...
2
stack_v2_sparse_classes_30k_train_004204
Implement the Python class `MultiCategoricalPolicy` described below. Class description: A simple multi-categorical policy. Method signatures and docstrings: - def __init__(self, inp_n: int, out_n: int, classes_n: int, hidden_size: int, num_layers: int, activation_fn: nn.Module): Creates the gaussian policy. Args: inp...
Implement the Python class `MultiCategoricalPolicy` described below. Class description: A simple multi-categorical policy. Method signatures and docstrings: - def __init__(self, inp_n: int, out_n: int, classes_n: int, hidden_size: int, num_layers: int, activation_fn: nn.Module): Creates the gaussian policy. Args: inp...
cde3be1c69bfd76fe4a78fa529e851d0a78318c7
<|skeleton|> class MultiCategoricalPolicy: """A simple multi-categorical policy.""" def __init__(self, inp_n: int, out_n: int, classes_n: int, hidden_size: int, num_layers: int, activation_fn: nn.Module): """Creates the gaussian policy. Args: inp_n: The number of input units to the network. out_n: The ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiCategoricalPolicy: """A simple multi-categorical policy.""" def __init__(self, inp_n: int, out_n: int, classes_n: int, hidden_size: int, num_layers: int, activation_fn: nn.Module): """Creates the gaussian policy. Args: inp_n: The number of input units to the network. out_n: The number of ind...
the_stack_v2_python_sparse
hlrl/torch/policies/distribution.py
Chainso/HLRL
train
3
f187006e01fc57789e714d7778b7868779b7bbe4
[ "try:\n updated_count = self.update_order_count()\nexcept Exception:\n return HttpResponseBadRequest()\nelse:\n return JsonResponse({'count': updated_count})", "product_id = self.request.POST['product_id']\ncount = int(self.request.POST['updated_order_count'])\nproduct = get_object_or_404(BaseProduct, id...
<|body_start_0|> try: updated_count = self.update_order_count() except Exception: return HttpResponseBadRequest() else: return JsonResponse({'count': updated_count}) <|end_body_0|> <|body_start_1|> product_id = self.request.POST['product_id'] ...
View for setting re-order counts.
UpdateOrderCount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateOrderCount: """View for setting re-order counts.""" def post(self, *args, **kwargs): """Update re-order counts.""" <|body_0|> def update_order_count(self): """Update re-order count.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_75kplus_train_007349
6,889
no_license
[ { "docstring": "Update re-order counts.", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "Update re-order count.", "name": "update_order_count", "signature": "def update_order_count(self)" } ]
2
stack_v2_sparse_classes_30k_train_013300
Implement the Python class `UpdateOrderCount` described below. Class description: View for setting re-order counts. Method signatures and docstrings: - def post(self, *args, **kwargs): Update re-order counts. - def update_order_count(self): Update re-order count.
Implement the Python class `UpdateOrderCount` described below. Class description: View for setting re-order counts. Method signatures and docstrings: - def post(self, *args, **kwargs): Update re-order counts. - def update_order_count(self): Update re-order count. <|skeleton|> class UpdateOrderCount: """View for ...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class UpdateOrderCount: """View for setting re-order counts.""" def post(self, *args, **kwargs): """Update re-order counts.""" <|body_0|> def update_order_count(self): """Update re-order count.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateOrderCount: """View for setting re-order counts.""" def post(self, *args, **kwargs): """Update re-order counts.""" try: updated_count = self.update_order_count() except Exception: return HttpResponseBadRequest() else: return JsonRe...
the_stack_v2_python_sparse
restock/views.py
stcstores/stcadmin
train
0
eb948763ff35d7c414bcd0ef9ad3f82c8bba3ae9
[ "super(ModularAttributeVQA, self).__init__()\nself.cube_fc_layer = nn.Sequential(nn.Linear(cube_feat_dim, fc_dim), nn.ReLU())\nself.dist_fc_layer = nn.Sequential(nn.Linear(ego_feat_dim + rnn_feat_dim, fc_dim), nn.ReLU())\nself.attr_to_in = {'object_color_equal': 2 * rnn_feat_dim, 'object_size_bigger': 2 * rnn_feat_...
<|body_start_0|> super(ModularAttributeVQA, self).__init__() self.cube_fc_layer = nn.Sequential(nn.Linear(cube_feat_dim, fc_dim), nn.ReLU()) self.dist_fc_layer = nn.Sequential(nn.Linear(ego_feat_dim + rnn_feat_dim, fc_dim), nn.ReLU()) self.attr_to_in = {'object_color_equal': 2 * rnn_feat...
ModularAttributeVQA
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModularAttributeVQA: def __init__(self, ego_feat_dim, rnn_feat_dim, cube_feat_dim, fc_dim, fc_dropout, num_answers=2): """- ego_feat_dim : ego-centric feat dimension, i.e., (2, ego_feat_dim) or (3, ego_feat_dim) - rnn_feat_dim : rnn output feat dimension - cube_feat_dim : cube feat dimen...
stack_v2_sparse_classes_75kplus_train_007350
2,956
permissive
[ { "docstring": "- ego_feat_dim : ego-centric feat dimension, i.e., (2, ego_feat_dim) or (3, ego_feat_dim) - rnn_feat_dim : rnn output feat dimension - cube_feat_dim : cube feat dimension, i.e., (2, 4, cube_feat_dim) - fc_dim : fc dimension - fc_dropout : fc dropout - num_answers : num. answrs (yes/no)", "na...
2
null
Implement the Python class `ModularAttributeVQA` described below. Class description: Implement the ModularAttributeVQA class. Method signatures and docstrings: - def __init__(self, ego_feat_dim, rnn_feat_dim, cube_feat_dim, fc_dim, fc_dropout, num_answers=2): - ego_feat_dim : ego-centric feat dimension, i.e., (2, ego...
Implement the Python class `ModularAttributeVQA` described below. Class description: Implement the ModularAttributeVQA class. Method signatures and docstrings: - def __init__(self, ego_feat_dim, rnn_feat_dim, cube_feat_dim, fc_dim, fc_dropout, num_answers=2): - ego_feat_dim : ego-centric feat dimension, i.e., (2, ego...
9a5483cc29ed6ee8d00590e28264743c6bcbe7ad
<|skeleton|> class ModularAttributeVQA: def __init__(self, ego_feat_dim, rnn_feat_dim, cube_feat_dim, fc_dim, fc_dropout, num_answers=2): """- ego_feat_dim : ego-centric feat dimension, i.e., (2, ego_feat_dim) or (3, ego_feat_dim) - rnn_feat_dim : rnn output feat dimension - cube_feat_dim : cube feat dimen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModularAttributeVQA: def __init__(self, ego_feat_dim, rnn_feat_dim, cube_feat_dim, fc_dim, fc_dropout, num_answers=2): """- ego_feat_dim : ego-centric feat dimension, i.e., (2, ego_feat_dim) or (3, ego_feat_dim) - rnn_feat_dim : rnn output feat dimension - cube_feat_dim : cube feat dimension, i.e., (2...
the_stack_v2_python_sparse
nav_loc_vqa/nav_loc_vqa/models/vqa_model.py
johndpope/MT-EQA
train
0
b5ed249159fcad654587459c57bd9079036de852
[ "if content_type == APPLICATION_JSON:\n try:\n return json.loads(data)\n except json.JSONDecodeError:\n raise HTTPException(status_code=400, detail=f'JSON deserialization failed for the request data: {data}.\\nTo specify a different type, please set the \"content-type\" header in the request.\\n...
<|body_start_0|> if content_type == APPLICATION_JSON: try: return json.loads(data) except json.JSONDecodeError: raise HTTPException(status_code=400, detail=f'JSON deserialization failed for the request data: {data}.\nTo specify a different type, please set...
Default serializer for serialization and deserialization for prediction.
DefaultSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultSerializer: """Default serializer for serialization and deserialization for prediction.""" def deserialize(data: Any, content_type: Optional[str]) -> Any: """Deserializes the request data. Invoked before predict. Args: data (Any): Required. The request data sent to the applica...
stack_v2_sparse_classes_75kplus_train_007351
5,203
permissive
[ { "docstring": "Deserializes the request data. Invoked before predict. Args: data (Any): Required. The request data sent to the application. content_type (str): Optional. The specified content type of the request. Raises: HTTPException: If Json deserialization failed or the specified content type is not support...
2
stack_v2_sparse_classes_30k_val_000784
Implement the Python class `DefaultSerializer` described below. Class description: Default serializer for serialization and deserialization for prediction. Method signatures and docstrings: - def deserialize(data: Any, content_type: Optional[str]) -> Any: Deserializes the request data. Invoked before predict. Args: d...
Implement the Python class `DefaultSerializer` described below. Class description: Default serializer for serialization and deserialization for prediction. Method signatures and docstrings: - def deserialize(data: Any, content_type: Optional[str]) -> Any: Deserializes the request data. Invoked before predict. Args: d...
76b95b92c1d3b87c72d754d8c02b1bca652b9a27
<|skeleton|> class DefaultSerializer: """Default serializer for serialization and deserialization for prediction.""" def deserialize(data: Any, content_type: Optional[str]) -> Any: """Deserializes the request data. Invoked before predict. Args: data (Any): Required. The request data sent to the applica...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultSerializer: """Default serializer for serialization and deserialization for prediction.""" def deserialize(data: Any, content_type: Optional[str]) -> Any: """Deserializes the request data. Invoked before predict. Args: data (Any): Required. The request data sent to the application. content...
the_stack_v2_python_sparse
google/cloud/aiplatform/prediction/serializer.py
googleapis/python-aiplatform
train
418
ed1689733a913a5ef1e3715fc9e5f7f6f1848381
[ "if 'ProcessorDate' in metadata_dict:\n replace_dic = {'$': '', '#': '', 'Date::': ''}\n processor_date_value = metadata_dict['ProcessorDate']\n for i, j in replace_dic.iteritems():\n processor_date_value = processor_date_value.replace(i, j)\n metadata_dict['ProcessorDate'] = processor_date_value...
<|body_start_0|> if 'ProcessorDate' in metadata_dict: replace_dic = {'$': '', '#': '', 'Date::': ''} processor_date_value = metadata_dict['ProcessorDate'] for i, j in replace_dic.iteritems(): processor_date_value = processor_date_value.replace(i, j) ...
This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.
AlgorithmMetadata
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlgorithmMetadata: """This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.""" def __init__(self, metadata_dict, child_variable_metadata=None): """I...
stack_v2_sparse_classes_75kplus_train_007352
17,164
permissive
[ { "docstring": "Initialize AlgorithmMetadata instance with given metadata in dict form and any child variable metadata. :param dict metadata_dict: Dictionary object containing variable metadata names and values :param list child_varable_metadata: Optional - List containing VariableMetadata", "name": "__init...
2
stack_v2_sparse_classes_30k_train_033272
Implement the Python class `AlgorithmMetadata` described below. Class description: This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs. Method signatures and docstrings: - def __ini...
Implement the Python class `AlgorithmMetadata` described below. Class description: This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs. Method signatures and docstrings: - def __ini...
05fce4d36f070587171506caa8b136508fa9405c
<|skeleton|> class AlgorithmMetadata: """This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.""" def __init__(self, metadata_dict, child_variable_metadata=None): """I...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlgorithmMetadata: """This class is designed to provide storage and handling capabilities for EGADS algorithm metadata. Stores instances of VariableMetadata objects to use to populate algorithm variable outputs.""" def __init__(self, metadata_dict, child_variable_metadata=None): """Initialize Alg...
the_stack_v2_python_sparse
egads/egads/core/metadata.py
mfreer/eufar-egads
train
0
73c8ebb8cb941e6e0b714d3051e0610c8a44bce9
[ "self.template = template\nself.arguments = arguments\nself.attachment_ref = attachment", "message = path_or_string(self.template)\nif self.arguments:\n template = Template(message)\n message = template.render(**self.arguments)\nreturn message", "if self.attachment_ref is None:\n return None\nif isinst...
<|body_start_0|> self.template = template self.arguments = arguments self.attachment_ref = attachment <|end_body_0|> <|body_start_1|> message = path_or_string(self.template) if self.arguments: template = Template(message) message = template.render(**self....
SlackMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlackMessage: def __init__(self, template, arguments: Dict=None, attachment: Optional[Union[Path, IO]]=None): """Create Slack message. Args: template: Jinja template. template_args (dict): Arguments to be passed to the Jinja templates . attachment (Path): Path to file (or image) to attac...
stack_v2_sparse_classes_75kplus_train_007353
11,381
permissive
[ { "docstring": "Create Slack message. Args: template: Jinja template. template_args (dict): Arguments to be passed to the Jinja templates . attachment (Path): Path to file (or image) to attach to the image.", "name": "__init__", "signature": "def __init__(self, template, arguments: Dict=None, attachment...
3
null
Implement the Python class `SlackMessage` described below. Class description: Implement the SlackMessage class. Method signatures and docstrings: - def __init__(self, template, arguments: Dict=None, attachment: Optional[Union[Path, IO]]=None): Create Slack message. Args: template: Jinja template. template_args (dict)...
Implement the Python class `SlackMessage` described below. Class description: Implement the SlackMessage class. Method signatures and docstrings: - def __init__(self, template, arguments: Dict=None, attachment: Optional[Union[Path, IO]]=None): Create Slack message. Args: template: Jinja template. template_args (dict)...
1c7bdf3ccbde11f2fa7a3fe2731c067887112909
<|skeleton|> class SlackMessage: def __init__(self, template, arguments: Dict=None, attachment: Optional[Union[Path, IO]]=None): """Create Slack message. Args: template: Jinja template. template_args (dict): Arguments to be passed to the Jinja templates . attachment (Path): Path to file (or image) to attac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SlackMessage: def __init__(self, template, arguments: Dict=None, attachment: Optional[Union[Path, IO]]=None): """Create Slack message. Args: template: Jinja template. template_args (dict): Arguments to be passed to the Jinja templates . attachment (Path): Path to file (or image) to attach to the image...
the_stack_v2_python_sparse
soam/reporting/slack_report.py
guido-mutt/soam
train
0
daf7ce02d1a3d3a275d7e2a771f708388619e0df
[ "self.log.info('login from QQ')\ncode = context.get('code')\nredirect_uri = context.get('redirect_uri')\nif not code or not redirect_uri:\n return None\naccess_token = self.get_token(code, redirect_uri)\ninfo = self.get_info(access_token)\nuser_info = self.get_user_info(access_token, info['openid'], info['client...
<|body_start_0|> self.log.info('login from QQ') code = context.get('code') redirect_uri = context.get('redirect_uri') if not code or not redirect_uri: return None access_token = self.get_token(code, redirect_uri) info = self.get_info(access_token) user...
Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::
QQLogin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QQLogin: """Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::""" def login(self, context): """QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" <|body_0|> def get_token(self, code, redir...
stack_v2_sparse_classes_75kplus_train_007354
17,886
permissive
[ { "docstring": "QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user", "name": "login", "signature": "def login(self, context)" }, { "docstring": "Get qq access token :type code: str :param code: authorization code :type redirect_uri: str :param redire...
4
stack_v2_sparse_classes_30k_train_035458
Implement the Python class `QQLogin` described below. Class description: Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes:: Method signatures and docstrings: - def login(self, context): QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user -...
Implement the Python class `QQLogin` described below. Class description: Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes:: Method signatures and docstrings: - def login(self, context): QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user -...
945c4fd2755f5b0dea11e54eb649eeb37ec93d01
<|skeleton|> class QQLogin: """Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::""" def login(self, context): """QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" <|body_0|> def get_token(self, code, redir...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QQLogin: """Sign in with QQ :Example: from client.user.login import QQLogin QQLogin() .. notes::""" def login(self, context): """QQ Login :type context: Context :param context: :rtype: dict :return: token and instance of user""" self.log.info('login from QQ') code = context.get('c...
the_stack_v2_python_sparse
open-hackathon-server/src/hackathon/user/oauth_login.py
kaiyuanshe/open-hackathon
train
46
0ba1d62f727c9bd6de6e829835306a5c37c4caf5
[ "vrs_session = session.VerseSession.instance()\nscene = context.scene\nscene_item = scene.verse_scenes[scene.cur_verse_scene_index]\ntry:\n verse_scene_data = vrs_session.nodes[scene_item.data_node_id]\nexcept KeyError:\n return {'CANCELLED'}\nelse:\n verse_scene_data.subscribe()\nreturn {'FINISHED'}", "...
<|body_start_0|> vrs_session = session.VerseSession.instance() scene = context.scene scene_item = scene.verse_scenes[scene.cur_verse_scene_index] try: verse_scene_data = vrs_session.nodes[scene_item.data_node_id] except KeyError: return {'CANCELLED'} ...
This operator subscribes to existing scene shared at Verse server. It will create new Blender scene in current .blend file.
VERSE_SCENE_OT_subscribe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VERSE_SCENE_OT_subscribe: """This operator subscribes to existing scene shared at Verse server. It will create new Blender scene in current .blend file.""" def invoke(self, context, event): """Operator for subscribing to Verse scene node""" <|body_0|> def poll(cls, conte...
stack_v2_sparse_classes_75kplus_train_007355
9,072
no_license
[ { "docstring": "Operator for subscribing to Verse scene node", "name": "invoke", "signature": "def invoke(self, context, event)" }, { "docstring": "This class method is used, when Blender check, if this operator can be executed", "name": "poll", "signature": "def poll(cls, context)" } ...
2
stack_v2_sparse_classes_30k_val_000619
Implement the Python class `VERSE_SCENE_OT_subscribe` described below. Class description: This operator subscribes to existing scene shared at Verse server. It will create new Blender scene in current .blend file. Method signatures and docstrings: - def invoke(self, context, event): Operator for subscribing to Verse ...
Implement the Python class `VERSE_SCENE_OT_subscribe` described below. Class description: This operator subscribes to existing scene shared at Verse server. It will create new Blender scene in current .blend file. Method signatures and docstrings: - def invoke(self, context, event): Operator for subscribing to Verse ...
7b796d30dfd22b7706a93e4419ed913d18d29a44
<|skeleton|> class VERSE_SCENE_OT_subscribe: """This operator subscribes to existing scene shared at Verse server. It will create new Blender scene in current .blend file.""" def invoke(self, context, event): """Operator for subscribing to Verse scene node""" <|body_0|> def poll(cls, conte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VERSE_SCENE_OT_subscribe: """This operator subscribes to existing scene shared at Verse server. It will create new Blender scene in current .blend file.""" def invoke(self, context, event): """Operator for subscribing to Verse scene node""" vrs_session = session.VerseSession.instance() ...
the_stack_v2_python_sparse
All_In_One/addons/io_verse/ui_scene.py
2434325680/Learnbgame
train
0
0dafeda683de230e8cef2291ea67da8c71b02268
[ "driver = self.base_driver\ndriver.type('n,rename', '张珊珊')\ndriver.click('x,/html/body/div[6]/div[1]/div[2]/ul/form/dl[2]/dd/span')\ndriver.click_by_text('安徽')\ndriver.click_by_text('合肥')\ndriver.click_by_text('长丰县')\ndriver.type('n,addr', '长安街九乡6里8号')\ndriver.type('n,mobile', '13823218582')\ndriver.click('x,/html/...
<|body_start_0|> driver = self.base_driver driver.type('n,rename', '张珊珊') driver.click('x,/html/body/div[6]/div[1]/div[2]/ul/form/dl[2]/dd/span') driver.click_by_text('安徽') driver.click_by_text('合肥') driver.click_by_text('长丰县') driver.type('n,addr', '长安街九乡6里8号') ...
订单页
OrderAdd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderAdd: """订单页""" def first_order_info(self): """添加地址信息""" <|body_0|> def del_order_info(self): """删除地址信息""" <|body_1|> def edit_order_info(self): """编辑地址信息""" <|body_2|> def get_assertion_information(self): """获取订单编号""...
stack_v2_sparse_classes_75kplus_train_007356
1,734
no_license
[ { "docstring": "添加地址信息", "name": "first_order_info", "signature": "def first_order_info(self)" }, { "docstring": "删除地址信息", "name": "del_order_info", "signature": "def del_order_info(self)" }, { "docstring": "编辑地址信息", "name": "edit_order_info", "signature": "def edit_order...
4
stack_v2_sparse_classes_30k_train_011134
Implement the Python class `OrderAdd` described below. Class description: 订单页 Method signatures and docstrings: - def first_order_info(self): 添加地址信息 - def del_order_info(self): 删除地址信息 - def edit_order_info(self): 编辑地址信息 - def get_assertion_information(self): 获取订单编号
Implement the Python class `OrderAdd` described below. Class description: 订单页 Method signatures and docstrings: - def first_order_info(self): 添加地址信息 - def del_order_info(self): 删除地址信息 - def edit_order_info(self): 编辑地址信息 - def get_assertion_information(self): 获取订单编号 <|skeleton|> class OrderAdd: """订单页""" def...
b75bf1bdbf4ee14f0485d552ff2f382c7991821e
<|skeleton|> class OrderAdd: """订单页""" def first_order_info(self): """添加地址信息""" <|body_0|> def del_order_info(self): """删除地址信息""" <|body_1|> def edit_order_info(self): """编辑地址信息""" <|body_2|> def get_assertion_information(self): """获取订单编号""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrderAdd: """订单页""" def first_order_info(self): """添加地址信息""" driver = self.base_driver driver.type('n,rename', '张珊珊') driver.click('x,/html/body/div[6]/div[1]/div[2]/ul/form/dl[2]/dd/span') driver.click_by_text('安徽') driver.click_by_text('合肥') drive...
the_stack_v2_python_sparse
nengkaiShop/page/after_login_page/order_add_page/order_add.py
caixinshu/api
train
0
e544cfaac64aa935b2c59f4b43b38a586ca19249
[ "self.fop = file_operator.FileOperator('./')\nconvert_file_path, data_file_path = self.fop._getWorkFilesPath()\nself.topic_manager = topic_manager.TopicManager(convert_file_path, data_file_path)\nself.setting_reader = relay_setting_reader.RelaySettingReader(self.topic_manager)\nself.app_creator = relay_app_creator....
<|body_start_0|> self.fop = file_operator.FileOperator('./') convert_file_path, data_file_path = self.fop._getWorkFilesPath() self.topic_manager = topic_manager.TopicManager(convert_file_path, data_file_path) self.setting_reader = relay_setting_reader.RelaySettingReader(self.topic_manage...
Create of relay application.
RelayCreator
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelayCreator: """Create of relay application.""" def __init__(self, logger, cfe_dir_path, ros_dir_path): """Constructor. Args: logger (RelayLogger): RelayLogger object cfe_dir_path (str): Path to the cfe_relay_app directory ros_dir_path (str): Path to the ros_relay_node directory""" ...
stack_v2_sparse_classes_75kplus_train_007357
5,560
permissive
[ { "docstring": "Constructor. Args: logger (RelayLogger): RelayLogger object cfe_dir_path (str): Path to the cfe_relay_app directory ros_dir_path (str): Path to the ros_relay_node directory", "name": "__init__", "signature": "def __init__(self, logger, cfe_dir_path, ros_dir_path)" }, { "docstring...
5
stack_v2_sparse_classes_30k_train_031144
Implement the Python class `RelayCreator` described below. Class description: Create of relay application. Method signatures and docstrings: - def __init__(self, logger, cfe_dir_path, ros_dir_path): Constructor. Args: logger (RelayLogger): RelayLogger object cfe_dir_path (str): Path to the cfe_relay_app directory ros...
Implement the Python class `RelayCreator` described below. Class description: Create of relay application. Method signatures and docstrings: - def __init__(self, logger, cfe_dir_path, ros_dir_path): Constructor. Args: logger (RelayLogger): RelayLogger object cfe_dir_path (str): Path to the cfe_relay_app directory ros...
f16c5966c0ade342d6fea8c20fe4d705ee0d9630
<|skeleton|> class RelayCreator: """Create of relay application.""" def __init__(self, logger, cfe_dir_path, ros_dir_path): """Constructor. Args: logger (RelayLogger): RelayLogger object cfe_dir_path (str): Path to the cfe_relay_app directory ros_dir_path (str): Path to the ros_relay_node directory""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RelayCreator: """Create of relay application.""" def __init__(self, logger, cfe_dir_path, ros_dir_path): """Constructor. Args: logger (RelayLogger): RelayLogger object cfe_dir_path (str): Path to the cfe_relay_app directory ros_dir_path (str): Path to the ros_relay_node directory""" self....
the_stack_v2_python_sparse
cfs_converter/relay_creator.py
kbiesiadecki141/roscfe
train
0
8c58fab38a813cf4e850f936148dd6b7949cdc78
[ "if isinstance(array, drv.IPCMemoryHandle):\n self.handle = array.ipc_handle\nelse:\n self.handle = drv.mem_get_ipc_handle(array.ptr)\nself.shape = array.shape\nself.dtype = array.dtype\nself.size = array.size\nself.mem_size = array.mem_size", "drv.IPCMemoryHandle(self.handle)\narray = gpuarray.GPUArray((0,...
<|body_start_0|> if isinstance(array, drv.IPCMemoryHandle): self.handle = array.ipc_handle else: self.handle = drv.mem_get_ipc_handle(array.ptr) self.shape = array.shape self.dtype = array.dtype self.size = array.size self.mem_size = array.mem_size...
Converter between GPUArray and its Inter-Process Communication handle. It holds IPC memory handle with shape and dtype information. The instance can be pickled, which means it can be passed through IPC path way, e.g. Pipe and Queue. The other process can extract shared GPUArray by calling :meth:`get`. Also, the extract...
IPCArrayHandle
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPCArrayHandle: """Converter between GPUArray and its Inter-Process Communication handle. It holds IPC memory handle with shape and dtype information. The instance can be pickled, which means it can be passed through IPC path way, e.g. Pipe and Queue. The other process can extract shared GPUArray...
stack_v2_sparse_classes_75kplus_train_007358
28,045
permissive
[ { "docstring": "Creates an IPC memory handle of the device array. Args: array (~pycuda.gpuarray.GPUArray): GPU array to be shared accross processes.", "name": "__init__", "signature": "def __init__(self, array)" }, { "docstring": "Creates a GPUArray object from the IPC memory handle. Returns: ~p...
2
stack_v2_sparse_classes_30k_train_033490
Implement the Python class `IPCArrayHandle` described below. Class description: Converter between GPUArray and its Inter-Process Communication handle. It holds IPC memory handle with shape and dtype information. The instance can be pickled, which means it can be passed through IPC path way, e.g. Pipe and Queue. The ot...
Implement the Python class `IPCArrayHandle` described below. Class description: Converter between GPUArray and its Inter-Process Communication handle. It holds IPC memory handle with shape and dtype information. The instance can be pickled, which means it can be passed through IPC path way, e.g. Pipe and Queue. The ot...
81fe720a9b32ec9a2f47e50f34918ad35b17f0ab
<|skeleton|> class IPCArrayHandle: """Converter between GPUArray and its Inter-Process Communication handle. It holds IPC memory handle with shape and dtype information. The instance can be pickled, which means it can be passed through IPC path way, e.g. Pipe and Queue. The other process can extract shared GPUArray...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IPCArrayHandle: """Converter between GPUArray and its Inter-Process Communication handle. It holds IPC memory handle with shape and dtype information. The instance can be pickled, which means it can be passed through IPC path way, e.g. Pipe and Queue. The other process can extract shared GPUArray by calling :...
the_stack_v2_python_sparse
chainer/cuda.py
jheymann85/chainer
train
1
2e9fd050211c7e0d9ffa6160a971028a8cf8baa1
[ "self.xd = kwargs['xd']\nself.skip_days = 0\nself.factor_name = '{}:{}'.format(self.__class__.__name__, self.xd)\nself.hit_ml = kwargs['hit_ml']", "ump = self.ump_manger\ndeg_hit_cnt = ump.ump_main_deg.predict_hit_kwargs(**ml_feature_dict)\njump_hit_cnt = ump.ump_main_jump.predict_hit_kwargs(**ml_feature_dict)\nw...
<|body_start_0|> self.xd = kwargs['xd'] self.skip_days = 0 self.factor_name = '{}:{}'.format(self.__class__.__name__, self.xd) self.hit_ml = kwargs['hit_ml'] <|end_body_0|> <|body_start_1|> ump = self.ump_manger deg_hit_cnt = ump.ump_main_deg.predict_hit_kwargs(**ml_feat...
继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易
AbuFactorBuyBreakHitPredictDemo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbuFactorBuyBreakHitPredictDemo: """继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易""" def _init_self(self, **kwargs): """与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好...
stack_v2_sparse_classes_75kplus_train_007359
9,900
no_license
[ { "docstring": "与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好的决策器 self.hit_ml = kwargs['hit_ml']", "name": "_init_self", "signature": "def _init_self(self, **kwargs)" }, { "docstring": "用回测的数据进行训练后再次反过来指导回测,结果是没有意义的, 这里的示例只是为了容易理解什么叫做:让裁判自己学习怎么配合, 自己做出最正确的判断,更详细完整的示例会在之后的章...
2
stack_v2_sparse_classes_30k_train_017752
Implement the Python class `AbuFactorBuyBreakHitPredictDemo` described below. Class description: 继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易 Method signatures and docstrings: - def _init_self(self, **kwargs): 与AbuFactorB...
Implement the Python class `AbuFactorBuyBreakHitPredictDemo` described below. Class description: 继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易 Method signatures and docstrings: - def _init_self(self, **kwargs): 与AbuFactorB...
f00a070626407afe87763a50c99241696a38df46
<|skeleton|> class AbuFactorBuyBreakHitPredictDemo: """继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易""" def _init_self(self, **kwargs): """与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AbuFactorBuyBreakHitPredictDemo: """继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易""" def _init_self(self, **kwargs): """与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好的决策器 self.hit...
the_stack_v2_python_sparse
abupy/FactorBuyBu/ABuFactorBuyDemo.py
zly111/abu
train
1
b9d3e235d9f24444f8a5c3ab2580c9e007696479
[ "if not TTS:\n raise ImportError('TextToSpeech pipeline is not available - install \"pipeline\" extra to enable')\npath = path if path else 'neuml/ljspeech-jets-onnx'\nconfig = hf_hub_download(path, filename='config.yaml')\nmodel = hf_hub_download(path, filename='model.onnx')\nwith open(config, 'r', encoding='ut...
<|body_start_0|> if not TTS: raise ImportError('TextToSpeech pipeline is not available - install "pipeline" extra to enable') path = path if path else 'neuml/ljspeech-jets-onnx' config = hf_hub_download(path, filename='config.yaml') model = hf_hub_download(path, filename='mod...
Generates speech from text
TextToSpeech
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextToSpeech: """Generates speech from text""" def __init__(self, path=None, maxtokens=512): """Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512""" <|body_0|> def __...
stack_v2_sparse_classes_75kplus_train_007360
3,823
permissive
[ { "docstring": "Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512", "name": "__init__", "signature": "def __init__(self, path=None, maxtokens=512)" }, { "docstring": "Generates speech from te...
4
stack_v2_sparse_classes_30k_val_001907
Implement the Python class `TextToSpeech` described below. Class description: Generates speech from text Method signatures and docstrings: - def __init__(self, path=None, maxtokens=512): Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can p...
Implement the Python class `TextToSpeech` described below. Class description: Generates speech from text Method signatures and docstrings: - def __init__(self, path=None, maxtokens=512): Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can p...
789a4555cb60ee9cdfa69afae5a5236d197e2b07
<|skeleton|> class TextToSpeech: """Generates speech from text""" def __init__(self, path=None, maxtokens=512): """Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512""" <|body_0|> def __...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextToSpeech: """Generates speech from text""" def __init__(self, path=None, maxtokens=512): """Creates a new TextToSpeech pipeline. Args: path: optional Hugging Face model hub id maxtokens: maximum number of tokens model can process, defaults to 512""" if not TTS: raise Impor...
the_stack_v2_python_sparse
src/python/txtai/pipeline/audio/texttospeech.py
neuml/txtai
train
4,804
1f8ca18039b8aa35ca6fbf9aae0fd16af10e45e0
[ "func = chain_transform(self._default_units())\ndata_pack = data_pack.apply_on_text(func, verbose=verbose)\nvocab_unit = build_vocab_unit(data_pack, verbose=verbose)\nself._context['vocab_unit'] = vocab_unit\nreturn self", "data_pack = data_pack.copy()\nunits_ = self._default_units()\nunits_.append(self._context[...
<|body_start_0|> func = chain_transform(self._default_units()) data_pack = data_pack.apply_on_text(func, verbose=verbose) vocab_unit = build_vocab_unit(data_pack, verbose=verbose) self._context['vocab_unit'] = vocab_unit return self <|end_body_0|> <|body_start_1|> data_p...
Naive preprocessor. Example: >>> import matchzoo as mz >>> train_data = mz.datasets.toy.load_data() >>> test_data = mz.datasets.toy.load_data(stage='test') >>> preprocessor = mz.preprocessors.NaivePreprocessor() >>> train_data_processed = preprocessor.fit_transform(train_data, ... verbose=0) >>> type(train_data_process...
NaivePreprocessor
[ "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaivePreprocessor: """Naive preprocessor. Example: >>> import matchzoo as mz >>> train_data = mz.datasets.toy.load_data() >>> test_data = mz.datasets.toy.load_data(stage='test') >>> preprocessor = mz.preprocessors.NaivePreprocessor() >>> train_data_processed = preprocessor.fit_transform(train_dat...
stack_v2_sparse_classes_75kplus_train_007361
2,402
permissive
[ { "docstring": "Fit pre-processing context for transformation. :param data_pack: data_pack to be preprocessed. :param verbose: Verbosity. :return: class:`NaivePreprocessor` instance.", "name": "fit", "signature": "def fit(self, data_pack: DataPack, verbose: int=1)" }, { "docstring": "Apply trans...
2
stack_v2_sparse_classes_30k_val_000929
Implement the Python class `NaivePreprocessor` described below. Class description: Naive preprocessor. Example: >>> import matchzoo as mz >>> train_data = mz.datasets.toy.load_data() >>> test_data = mz.datasets.toy.load_data(stage='test') >>> preprocessor = mz.preprocessors.NaivePreprocessor() >>> train_data_processed...
Implement the Python class `NaivePreprocessor` described below. Class description: Naive preprocessor. Example: >>> import matchzoo as mz >>> train_data = mz.datasets.toy.load_data() >>> test_data = mz.datasets.toy.load_data(stage='test') >>> preprocessor = mz.preprocessors.NaivePreprocessor() >>> train_data_processed...
4198ebce942f4afe7ddca6a96ab6f4464ade4518
<|skeleton|> class NaivePreprocessor: """Naive preprocessor. Example: >>> import matchzoo as mz >>> train_data = mz.datasets.toy.load_data() >>> test_data = mz.datasets.toy.load_data(stage='test') >>> preprocessor = mz.preprocessors.NaivePreprocessor() >>> train_data_processed = preprocessor.fit_transform(train_dat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NaivePreprocessor: """Naive preprocessor. Example: >>> import matchzoo as mz >>> train_data = mz.datasets.toy.load_data() >>> test_data = mz.datasets.toy.load_data(stage='test') >>> preprocessor = mz.preprocessors.NaivePreprocessor() >>> train_data_processed = preprocessor.fit_transform(train_data, ... verbos...
the_stack_v2_python_sparse
poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/naive_preprocessor.py
microsoft/ContextualSP
train
332
ee2aed7b3678c8c22b05c04c50adf7571f4228b0
[ "super(QueryPluginConfiguration, self).__init__(*args, **kwargs)\nself._query_configuration = None\nself._adapter is None\nreturn", "if self._adapter is None:\n config = ConfigParser()\n section = 'query'\n config.add_section(section)\n self._adapter = ConfigurationAdapter(config)\nreturn self._adapte...
<|body_start_0|> super(QueryPluginConfiguration, self).__init__(*args, **kwargs) self._query_configuration = None self._adapter is None return <|end_body_0|> <|body_start_1|> if self._adapter is None: config = ConfigParser() section = 'query' ...
A configuration for the queries
QueryPluginConfiguration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryPluginConfiguration: """A configuration for the queries""" def __init__(self, *args, **kwargs): """Constructor to set up the sub-configuration""" <|body_0|> def adapter(self): """Mapping config obj to the Configuration Adapter""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_007362
18,096
no_license
[ { "docstring": "Constructor to set up the sub-configuration", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Mapping config obj to the Configuration Adapter", "name": "adapter", "signature": "def adapter(self)" }, { "docstring": "The cam...
4
stack_v2_sparse_classes_30k_train_041606
Implement the Python class `QueryPluginConfiguration` described below. Class description: A configuration for the queries Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor to set up the sub-configuration - def adapter(self): Mapping config obj to the Configuration Adapter - def quer...
Implement the Python class `QueryPluginConfiguration` described below. Class description: A configuration for the queries Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor to set up the sub-configuration - def adapter(self): Mapping config obj to the Configuration Adapter - def quer...
cd735b8c0fec06f7f9083714900ff88395c9443f
<|skeleton|> class QueryPluginConfiguration: """A configuration for the queries""" def __init__(self, *args, **kwargs): """Constructor to set up the sub-configuration""" <|body_0|> def adapter(self): """Mapping config obj to the Configuration Adapter""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QueryPluginConfiguration: """A configuration for the queries""" def __init__(self, *args, **kwargs): """Constructor to set up the sub-configuration""" super(QueryPluginConfiguration, self).__init__(*args, **kwargs) self._query_configuration = None self._adapter is None ...
the_stack_v2_python_sparse
cameraobscura/plugins/rvrplugin.py
russell-n/cameraobscura
train
0
323196a88b8b5ef1b0de519c9974d96a5053afb6
[ "self.fname = xml.get('file')\nself.bucket = xml.get('bucket')\nself.groupby = []\nself.columns = []\nself.where = []\nself.rows = []\nself.target = None\nself.group_operation = 'avg'\nfor node in xml.iterchildren():\n if node.tag == 'Label':\n self.label = node.text\n if node.tag == 'Caption':\n ...
<|body_start_0|> self.fname = xml.get('file') self.bucket = xml.get('bucket') self.groupby = [] self.columns = [] self.where = [] self.rows = [] self.target = None self.group_operation = 'avg' for node in xml.iterchildren(): if node.tag...
Handles export of _ResultCollections to LyX-format for insertion into final report
ResultPivotTableOutput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultPivotTableOutput: """Handles export of _ResultCollections to LyX-format for insertion into final report""" def __init__(self, xml): """XML configuration looks like this: <ResultTableOutput bucket="subjective-anns" file="Tables/Annotations.lyx"> <Label>tab:annotation</Label> <Ca...
stack_v2_sparse_classes_75kplus_train_007363
2,745
no_license
[ { "docstring": "XML configuration looks like this: <ResultTableOutput bucket=\"subjective-anns\" file=\"Tables/Annotations.lyx\"> <Label>tab:annotation</Label> <Caption>Comparison of annotation methods</Caption> <!--Inside is optional, <GroupBy> <Item string=\"algorithm\" /> </GroupBy> <GroupOperation operation...
2
stack_v2_sparse_classes_30k_train_000640
Implement the Python class `ResultPivotTableOutput` described below. Class description: Handles export of _ResultCollections to LyX-format for insertion into final report Method signatures and docstrings: - def __init__(self, xml): XML configuration looks like this: <ResultTableOutput bucket="subjective-anns" file="T...
Implement the Python class `ResultPivotTableOutput` described below. Class description: Handles export of _ResultCollections to LyX-format for insertion into final report Method signatures and docstrings: - def __init__(self, xml): XML configuration looks like this: <ResultTableOutput bucket="subjective-anns" file="T...
d48de55173e2d788c0ebc54d0bf85d92dd57ff26
<|skeleton|> class ResultPivotTableOutput: """Handles export of _ResultCollections to LyX-format for insertion into final report""" def __init__(self, xml): """XML configuration looks like this: <ResultTableOutput bucket="subjective-anns" file="Tables/Annotations.lyx"> <Label>tab:annotation</Label> <Ca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResultPivotTableOutput: """Handles export of _ResultCollections to LyX-format for insertion into final report""" def __init__(self, xml): """XML configuration looks like this: <ResultTableOutput bucket="subjective-anns" file="Tables/Annotations.lyx"> <Label>tab:annotation</Label> <Caption>Compari...
the_stack_v2_python_sparse
Actions/results.py
Sentimentron/Nebraska-public
train
0
f8f771aa1e9c56b344c33da5b41e11cfbd70b6f4
[ "y_lvls = np.asarray(y_lvls)\nif y_lvls.ndim != 2:\n raise ValueError('y values along level curves must be 2D array.')\nn, m = y_lvls.shape\nif n != len(x):\n raise ValueError(f'Number of y rows ({n}) does not match the number of x values ({len(x)}).')\nif m != len(lvl_vals):\n raise ValueError(f'Number of...
<|body_start_0|> y_lvls = np.asarray(y_lvls) if y_lvls.ndim != 2: raise ValueError('y values along level curves must be 2D array.') n, m = y_lvls.shape if n != len(x): raise ValueError(f'Number of y rows ({n}) does not match the number of x values ({len(x)}).') ...
Two step interpolator based on SciPy interp1d, for interpolating data where multiple single-Y-valued curves are given. Interpolation proceeds as follows for an intermediate level: - A parameterised curve is generated from the provided data on either side. - The parameterised curve is interrogated for the specific X-val...
Interp2Level
[ "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interp2Level: """Two step interpolator based on SciPy interp1d, for interpolating data where multiple single-Y-valued curves are given. Interpolation proceeds as follows for an intermediate level: - A parameterised curve is generated from the provided data on either side. - The parameterised curv...
stack_v2_sparse_classes_75kplus_train_007364
15,922
permissive
[ { "docstring": "Parameters ---------- x : (N,) array_like A 1-D array of `x` real values. y_lvls : (N,M) array_like A ``N x M`` array of real values, where columns represent the `y` data at different values of the level curves: - ``N`` must equal to the length of `x`. - ``M`` must equal to the length of `val_lv...
2
stack_v2_sparse_classes_30k_train_047033
Implement the Python class `Interp2Level` described below. Class description: Two step interpolator based on SciPy interp1d, for interpolating data where multiple single-Y-valued curves are given. Interpolation proceeds as follows for an intermediate level: - A parameterised curve is generated from the provided data o...
Implement the Python class `Interp2Level` described below. Class description: Two step interpolator based on SciPy interp1d, for interpolating data where multiple single-Y-valued curves are given. Interpolation proceeds as follows for an intermediate level: - A parameterised curve is generated from the provided data o...
f394a3eb0a59b2bf5467a2679ab99a6fa5a6490f
<|skeleton|> class Interp2Level: """Two step interpolator based on SciPy interp1d, for interpolating data where multiple single-Y-valued curves are given. Interpolation proceeds as follows for an intermediate level: - A parameterised curve is generated from the provided data on either side. - The parameterised curv...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Interp2Level: """Two step interpolator based on SciPy interp1d, for interpolating data where multiple single-Y-valued curves are given. Interpolation proceeds as follows for an intermediate level: - A parameterised curve is generated from the provided data on either side. - The parameterised curve is interrog...
the_stack_v2_python_sparse
pyavia/data/interpolate.py
ericjwhitney/pyavia
train
1
f874fee5a16426d04ca637f1d732e2a88590c514
[ "transformation_indicies = [(i, j) for i in range(1, int(self.max_area / film_area)) for j in range(1, int(self.max_area / substrate_area)) if np.absolute(film_area / substrate_area - float(j) / i) < self.max_area_ratio_tol * float(j) / i]\nfor x in sorted(transformation_indicies, key=lambda x: x[0] * x[1]):\n y...
<|body_start_0|> transformation_indicies = [(i, j) for i in range(1, int(self.max_area / film_area)) for j in range(1, int(self.max_area / substrate_area)) if np.absolute(film_area / substrate_area - float(j) / i) < self.max_area_ratio_tol * float(j) / i] for x in sorted(transformation_indicies, key=lam...
This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The process of generating all possible matching super lattices is: 1.) Reduce the surfac...
ZSLGenerator_mod
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZSLGenerator_mod: """This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The process of generating all possible match...
stack_v2_sparse_classes_75kplus_train_007365
13,473
permissive
[ { "docstring": "Generates transformation sets for film/substrate pair given the area of the unit cell area for the film and substrate. The transformation sets map the film and substrate unit cells to super lattices with a maximum area Args: film_area(int): the unit cell area for the film substrate_area(int): th...
3
stack_v2_sparse_classes_30k_test_002737
Implement the Python class `ZSLGenerator_mod` described below. Class description: This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The p...
Implement the Python class `ZSLGenerator_mod` described below. Class description: This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The p...
93820af1abb8f43cab2f4c4d84e8a625091fcccd
<|skeleton|> class ZSLGenerator_mod: """This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The process of generating all possible match...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZSLGenerator_mod: """This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The process of generating all possible matching super lat...
the_stack_v2_python_sparse
waterstructureCreator/modified_pymatgen/substrate_analyzer_mod.py
computationalelectrochemistrygroup/WaterStructureCreator
train
4
fb3c5a0fb33abafa27232d21560009704962d6e4
[ "self.connected = False\nself.tmPacketData = None\nself.sendCyclic = False\nself.cyclicPeriodMs = int(UTIL.SYS.s_configuration.TM_CYCLIC_PERIOD_MS)\nself.obcAck1 = ENABLE_ACK\nself.obcAck2 = ENABLE_ACK\nself.obcAck3 = ENABLE_ACK\nself.obcAck4 = ENABLE_ACK\nself.obqAck1 = ENABLE_ACK\nself.obqAck2 = ENABLE_ACK\nself....
<|body_start_0|> self.connected = False self.tmPacketData = None self.sendCyclic = False self.cyclicPeriodMs = int(UTIL.SYS.s_configuration.TM_CYCLIC_PERIOD_MS) self.obcAck1 = ENABLE_ACK self.obcAck2 = ENABLE_ACK self.obcAck3 = ENABLE_ACK self.obcAck4 = EN...
Configuration
Configuration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configuration: """Configuration""" def __init__(self): """Initialise the connection relevant informations""" <|body_0|> def dump(self): """Dumps the status of the configuration attributes""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.conn...
stack_v2_sparse_classes_75kplus_train_007366
36,057
permissive
[ { "docstring": "Initialise the connection relevant informations", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Dumps the status of the configuration attributes", "name": "dump", "signature": "def dump(self)" } ]
2
stack_v2_sparse_classes_30k_train_017534
Implement the Python class `Configuration` described below. Class description: Configuration Method signatures and docstrings: - def __init__(self): Initialise the connection relevant informations - def dump(self): Dumps the status of the configuration attributes
Implement the Python class `Configuration` described below. Class description: Configuration Method signatures and docstrings: - def __init__(self): Initialise the connection relevant informations - def dump(self): Dumps the status of the configuration attributes <|skeleton|> class Configuration: """Configuratio...
c94415e9d85519f345fc56938198ac2537c0c6d0
<|skeleton|> class Configuration: """Configuration""" def __init__(self): """Initialise the connection relevant informations""" <|body_0|> def dump(self): """Dumps the status of the configuration attributes""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Configuration: """Configuration""" def __init__(self): """Initialise the connection relevant informations""" self.connected = False self.tmPacketData = None self.sendCyclic = False self.cyclicPeriodMs = int(UTIL.SYS.s_configuration.TM_CYCLIC_PERIOD_MS) self...
the_stack_v2_python_sparse
SPACE/IF.py
khawatkom/SpacePyLibrary
train
1
8276e1b589c31740fca51c035d2c0f21d9683078
[ "if config is None:\n raise TypeError('Input parameter config is None')\nif not isinstance(config, StubConfiguration):\n raise TypeError('Input parameter config is not a StubConfiguration')\nself._config = config", "path_split = service_name.split('.')\nmodule_name = '%s_client' % '.'.join(path_split[:-1])\...
<|body_start_0|> if config is None: raise TypeError('Input parameter config is None') if not isinstance(config, StubConfiguration): raise TypeError('Input parameter config is not a StubConfiguration') self._config = config <|end_body_0|> <|body_start_1|> path_spl...
Factory for client-side vAPI stubs
StubFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StubFactory: """Factory for client-side vAPI stubs""" def __init__(self, config): """Initialize the stub factory :type config: :class:`StubConfiguration` :param config: Configuration data for vAPI stubs""" <|body_0|> def create_stub(self, service_name): """Create...
stack_v2_sparse_classes_75kplus_train_007367
16,678
no_license
[ { "docstring": "Initialize the stub factory :type config: :class:`StubConfiguration` :param config: Configuration data for vAPI stubs", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Create a stub corresponding to the specified service name :type service_name: :...
2
stack_v2_sparse_classes_30k_train_024738
Implement the Python class `StubFactory` described below. Class description: Factory for client-side vAPI stubs Method signatures and docstrings: - def __init__(self, config): Initialize the stub factory :type config: :class:`StubConfiguration` :param config: Configuration data for vAPI stubs - def create_stub(self, ...
Implement the Python class `StubFactory` described below. Class description: Factory for client-side vAPI stubs Method signatures and docstrings: - def __init__(self, config): Initialize the stub factory :type config: :class:`StubConfiguration` :param config: Configuration data for vAPI stubs - def create_stub(self, ...
5d395700ab3d0d1d45b497e48beab8c366fca9f5
<|skeleton|> class StubFactory: """Factory for client-side vAPI stubs""" def __init__(self, config): """Initialize the stub factory :type config: :class:`StubConfiguration` :param config: Configuration data for vAPI stubs""" <|body_0|> def create_stub(self, service_name): """Create...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StubFactory: """Factory for client-side vAPI stubs""" def __init__(self, config): """Initialize the stub factory :type config: :class:`StubConfiguration` :param config: Configuration data for vAPI stubs""" if config is None: raise TypeError('Input parameter config is None') ...
the_stack_v2_python_sparse
alexa-program/vmware/vapi/bindings/stub.py
taromurata/TDP2018_VMCAPI
train
1
cf7c6084c41c8f0b7910a3ec6fc980d787f3b1a5
[ "if head is None:\n return False\ntry:\n cur1 = head\n cur2 = head.next\n while cur1 is not None and cur2 is not None:\n if cur1 == cur2:\n return True\n cur1 = cur1.next\n cur2 = cur2.next.next\n return False\nexcept Exception:\n return False", "if head is None o...
<|body_start_0|> if head is None: return False try: cur1 = head cur2 = head.next while cur1 is not None and cur2 is not None: if cur1 == cur2: return True cur1 = cur1.next cur2 = cur2.next...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> def hasCycle3(self, head): """我们可以通过检查一个结点此前是否被访问过来判断链表是否为环形链表。常用的方法是使用哈希表。 :type...
stack_v2_sparse_classes_75kplus_train_007368
2,439
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle2", "signature": "def hasCycle2(self, head)" }, { "docstring": "我们可以通过检查一个结点此前是否被访问过来判断链表是否为环形链表...
3
stack_v2_sparse_classes_30k_train_040606
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 hasCycle2(self, head): :type head: ListNode :rtype: bool - def hasCycle3(self, head): 我们可以通过检查一个结点此前是否被访问过来判断链表是...
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 hasCycle2(self, head): :type head: ListNode :rtype: bool - def hasCycle3(self, head): 我们可以通过检查一个结点此前是否被访问过来判断链表是...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> def hasCycle3(self, head): """我们可以通过检查一个结点此前是否被访问过来判断链表是否为环形链表。常用的方法是使用哈希表。 :type...
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 head is None: return False try: cur1 = head cur2 = head.next while cur1 is not None and cur2 is not None: if cur1 == cur2: ...
the_stack_v2_python_sparse
leetcode/141.py
yanggelinux/algorithm-data-structure
train
0
b8584d79ec40cb01bc46b253ae7a3712612520e7
[ "with FileFixture() as file_fixture:\n path = os.path.join(file_fixture.root, 'logs/job-output.json')\n file_detail = FileDetail(path, '')\n path_stat = os.stat(path)\n self.assertEqual(time.gmtime(path_stat[stat.ST_MTIME]), file_detail.last_modified)\n self.assertEqual(16, file_detail.size)", "fil...
<|body_start_0|> with FileFixture() as file_fixture: path = os.path.join(file_fixture.root, 'logs/job-output.json') file_detail = FileDetail(path, '') path_stat = os.stat(path) self.assertEqual(time.gmtime(path_stat[stat.ST_MTIME]), file_detail.last_modified) ...
TestFileDetail
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFileDetail: def test_get_file_detail(self): """Test files info""" <|body_0|> def test_get_file_detail_missing_file(self): """Test files that go missing during a walk""" <|body_1|> <|end_skeleton|> <|body_start_0|> with FileFixture() as file_fixt...
stack_v2_sparse_classes_75kplus_train_007369
22,845
permissive
[ { "docstring": "Test files info", "name": "test_get_file_detail", "signature": "def test_get_file_detail(self)" }, { "docstring": "Test files that go missing during a walk", "name": "test_get_file_detail_missing_file", "signature": "def test_get_file_detail_missing_file(self)" } ]
2
stack_v2_sparse_classes_30k_train_025136
Implement the Python class `TestFileDetail` described below. Class description: Implement the TestFileDetail class. Method signatures and docstrings: - def test_get_file_detail(self): Test files info - def test_get_file_detail_missing_file(self): Test files that go missing during a walk
Implement the Python class `TestFileDetail` described below. Class description: Implement the TestFileDetail class. Method signatures and docstrings: - def test_get_file_detail(self): Test files info - def test_get_file_detail_missing_file(self): Test files that go missing during a walk <|skeleton|> class TestFileDe...
c8ac1bef639127327091c126aa88d14e2f04835a
<|skeleton|> class TestFileDetail: def test_get_file_detail(self): """Test files info""" <|body_0|> def test_get_file_detail_missing_file(self): """Test files that go missing during a walk""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFileDetail: def test_get_file_detail(self): """Test files info""" with FileFixture() as file_fixture: path = os.path.join(file_fixture.root, 'logs/job-output.json') file_detail = FileDetail(path, '') path_stat = os.stat(path) self.assertEqual...
the_stack_v2_python_sparse
roles/upload-logs-base1/library/test_index.py
opentelekomcloud-infra/otc-zuul-jobs
train
1
503c72178d8d2931ae0e3700e7ee3a0b5478a821
[ "result = {'result': 'NG'}\ndata = request.get_json(force=True)\nif data:\n succsee, message = CtrlQuotations().add_combination_by_quotation_id3(quotation_id, data)\n if succsee:\n result = {'result': 'OK', 'content': message}\n else:\n result['error'] = message\nelse:\n result['error'] = ...
<|body_start_0|> result = {'result': 'NG'} data = request.get_json(force=True) if data: succsee, message = CtrlQuotations().add_combination_by_quotation_id3(quotation_id, data) if succsee: result = {'result': 'OK', 'content': message} else: ...
ApiOptionCombinationInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiOptionCombinationInfo: def post(self, quotation_id): """更新/添加此报价下的Combination :return:""" <|body_0|> def get(self, quotation_id): """获取此报价下的所有Option :return:""" <|body_1|> def delete(self, op_id): """删除此条Option :return:""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_007370
10,406
no_license
[ { "docstring": "更新/添加此报价下的Combination :return:", "name": "post", "signature": "def post(self, quotation_id)" }, { "docstring": "获取此报价下的所有Option :return:", "name": "get", "signature": "def get(self, quotation_id)" }, { "docstring": "删除此条Option :return:", "name": "delete", ...
3
stack_v2_sparse_classes_30k_train_020337
Implement the Python class `ApiOptionCombinationInfo` described below. Class description: Implement the ApiOptionCombinationInfo class. Method signatures and docstrings: - def post(self, quotation_id): 更新/添加此报价下的Combination :return: - def get(self, quotation_id): 获取此报价下的所有Option :return: - def delete(self, op_id): 删除...
Implement the Python class `ApiOptionCombinationInfo` described below. Class description: Implement the ApiOptionCombinationInfo class. Method signatures and docstrings: - def post(self, quotation_id): 更新/添加此报价下的Combination :return: - def get(self, quotation_id): 获取此报价下的所有Option :return: - def delete(self, op_id): 删除...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiOptionCombinationInfo: def post(self, quotation_id): """更新/添加此报价下的Combination :return:""" <|body_0|> def get(self, quotation_id): """获取此报价下的所有Option :return:""" <|body_1|> def delete(self, op_id): """删除此条Option :return:""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ApiOptionCombinationInfo: def post(self, quotation_id): """更新/添加此报价下的Combination :return:""" result = {'result': 'NG'} data = request.get_json(force=True) if data: succsee, message = CtrlQuotations().add_combination_by_quotation_id3(quotation_id, data) i...
the_stack_v2_python_sparse
koala/koala_server/app/api_1_0/api_quotations.py
lsn1183/web_project
train
0
db5392730296201fc393727bab4d48779fbfa707
[ "super().__init__(address)\nself._name = name\nself._card_no = card_no\nself._expiry_date = expiry_date", "expiry = ''\ncard_no = ''\nif self._expiry_date is not None:\n expiry = f\"Expires on {self._expiry_date.strftime('%Y-%m-%d')}\\n\"\nif self._card_no is not None:\n card_no = f'{self._card_no}\\n'\nret...
<|body_start_0|> super().__init__(address) self._name = name self._card_no = card_no self._expiry_date = expiry_date <|end_body_0|> <|body_start_1|> expiry = '' card_no = '' if self._expiry_date is not None: expiry = f"Expires on {self._expiry_date.st...
Represent identification card.
IDCard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IDCard: """Represent identification card.""" def __init__(self, name, card_no, expiry_date, address): """Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address""" <|body_0|> def __str__(self): """Format how ...
stack_v2_sparse_classes_75kplus_train_007371
10,626
no_license
[ { "docstring": "Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address", "name": "__init__", "signature": "def __init__(self, name, card_no, expiry_date, address)" }, { "docstring": "Format how IDCards are displayed to the user. :return: St...
2
stack_v2_sparse_classes_30k_train_054754
Implement the Python class `IDCard` described below. Class description: Represent identification card. Method signatures and docstrings: - def __init__(self, name, card_no, expiry_date, address): Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address - def __str...
Implement the Python class `IDCard` described below. Class description: Represent identification card. Method signatures and docstrings: - def __init__(self, name, card_no, expiry_date, address): Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address - def __str...
b7695cc7cf0860aa9c8bf492b1bd06bd88b9af41
<|skeleton|> class IDCard: """Represent identification card.""" def __init__(self, name, card_no, expiry_date, address): """Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address""" <|body_0|> def __str__(self): """Format how ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IDCard: """Represent identification card.""" def __init__(self, name, card_no, expiry_date, address): """Initialise IDCard. :param name: String :param card_no: String :param expiry_date: Date :param address: Address""" super().__init__(address) self._name = name self._card...
the_stack_v2_python_sparse
Assignments/Assignment 2/card.py
sakshambhardwaj523/Python-OOP-Projects
train
0
83c4007b7b3e32e34e21317a4f69d82ca06f38bd
[ "table = self.metadata.tables[table]\nconnection.execute(table.insert(), [dict(zip(columns, row)) for row in record_iterable])\nself.session.flush()", "rt_map_model_name = f'{table_name}Model'\nself.models[table_name] = type(rt_map_model_name, (object,), {})\nrt_map_fields = [Column('record_type_id', Unicode(18),...
<|body_start_0|> table = self.metadata.tables[table] connection.execute(table.insert(), [dict(zip(columns, row)) for row in record_iterable]) self.session.flush() <|end_body_0|> <|body_start_1|> rt_map_model_name = f'{table_name}Model' self.models[table_name] = type(rt_map_model...
SqlAlchemyMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlAlchemyMixin: def _sql_bulk_insert_from_records(self, *, connection, table, columns, record_iterable): """Persist records from the given generator into the local database.""" <|body_0|> def _create_record_type_table(self, table_name): """Create a table to store ma...
stack_v2_sparse_classes_75kplus_train_007372
5,969
permissive
[ { "docstring": "Persist records from the given generator into the local database.", "name": "_sql_bulk_insert_from_records", "signature": "def _sql_bulk_insert_from_records(self, *, connection, table, columns, record_iterable)" }, { "docstring": "Create a table to store mapping between Record Ty...
3
stack_v2_sparse_classes_30k_train_001494
Implement the Python class `SqlAlchemyMixin` described below. Class description: Implement the SqlAlchemyMixin class. Method signatures and docstrings: - def _sql_bulk_insert_from_records(self, *, connection, table, columns, record_iterable): Persist records from the given generator into the local database. - def _cr...
Implement the Python class `SqlAlchemyMixin` described below. Class description: Implement the SqlAlchemyMixin class. Method signatures and docstrings: - def _sql_bulk_insert_from_records(self, *, connection, table, columns, record_iterable): Persist records from the given generator into the local database. - def _cr...
ea01e5d3523cc174d4a60af93584df7f4486c9f3
<|skeleton|> class SqlAlchemyMixin: def _sql_bulk_insert_from_records(self, *, connection, table, columns, record_iterable): """Persist records from the given generator into the local database.""" <|body_0|> def _create_record_type_table(self, table_name): """Create a table to store ma...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SqlAlchemyMixin: def _sql_bulk_insert_from_records(self, *, connection, table, columns, record_iterable): """Persist records from the given generator into the local database.""" table = self.metadata.tables[table] connection.execute(table.insert(), [dict(zip(columns, row)) for row in r...
the_stack_v2_python_sparse
cumulusci/tasks/bulkdata/utils.py
Julian88Tex/CumulusCI
train
1
df0645eddb26dc95e3d45119a7c3bc3803c42d72
[ "cls._init_from_yaml = True\nobj = cls(**data.get('with', {}), needs=data.get('needs'), runtime_args=runtime_args)\ncls._init_from_yaml = False\nobj.is_updated = False\nreturn obj", "r = {}\nr['with'] = {}\nparser = set_deployment_parser()\nnon_default_kw = ArgNamespace.get_non_defaults_args(data.args, parser)\nf...
<|body_start_0|> cls._init_from_yaml = True obj = cls(**data.get('with', {}), needs=data.get('needs'), runtime_args=runtime_args) cls._init_from_yaml = False obj.is_updated = False return obj <|end_body_0|> <|body_start_1|> r = {} r['with'] = {} parser = ...
Legacy parser for gateway.
DeploymentLegacyParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeploymentLegacyParser: """Legacy parser for gateway.""" def parse(self, cls: Type['Deployment'], data: Dict, runtime_args: Optional[Dict[str, Any]]=None) -> 'Deployment': """:param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: deployment y...
stack_v2_sparse_classes_75kplus_train_007373
1,922
permissive
[ { "docstring": ":param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: deployment yaml file loaded as python dict :param runtime_args: Optional runtime_args to be directly passed without being parsed into a yaml config :return: the Deployment YAML parser given the synta...
2
null
Implement the Python class `DeploymentLegacyParser` described below. Class description: Legacy parser for gateway. Method signatures and docstrings: - def parse(self, cls: Type['Deployment'], data: Dict, runtime_args: Optional[Dict[str, Any]]=None) -> 'Deployment': :param cls: target class type to parse into, must be...
Implement the Python class `DeploymentLegacyParser` described below. Class description: Legacy parser for gateway. Method signatures and docstrings: - def parse(self, cls: Type['Deployment'], data: Dict, runtime_args: Optional[Dict[str, Any]]=None) -> 'Deployment': :param cls: target class type to parse into, must be...
23c7b8c78fc4ad67d16d83fc0c9f0eae9e935e71
<|skeleton|> class DeploymentLegacyParser: """Legacy parser for gateway.""" def parse(self, cls: Type['Deployment'], data: Dict, runtime_args: Optional[Dict[str, Any]]=None) -> 'Deployment': """:param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: deployment y...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeploymentLegacyParser: """Legacy parser for gateway.""" def parse(self, cls: Type['Deployment'], data: Dict, runtime_args: Optional[Dict[str, Any]]=None) -> 'Deployment': """:param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: deployment yaml file load...
the_stack_v2_python_sparse
jina/jaml/parsers/deployment/legacy.py
jina-ai/jina
train
20,687
11c287e088260c257405754a756a3a480f6b1814
[ "bootcamp_application = self.instance.bootcamp_application\nif 'review_status' in attrs:\n if bootcamp_application.state not in (AppStates.AWAITING_SUBMISSION_REVIEW.value, AppStates.AWAITING_USER_SUBMISSIONS.value, AppStates.AWAITING_PAYMENT.value, AppStates.REJECTED.value) or bootcamp_application.total_paid > ...
<|body_start_0|> bootcamp_application = self.instance.bootcamp_application if 'review_status' in attrs: if bootcamp_application.state not in (AppStates.AWAITING_SUBMISSION_REVIEW.value, AppStates.AWAITING_USER_SUBMISSIONS.value, AppStates.AWAITING_PAYMENT.value, AppStates.REJECTED.value) or ...
ApplicationStepSubmission serializer for reviewers
SubmissionReviewSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionReviewSerializer: """ApplicationStepSubmission serializer for reviewers""" def validate(self, attrs): """Validate incoming data for a write""" <|body_0|> def update(self, instance, validated_data): """Update an ApplicationStepSubmission""" <|bod...
stack_v2_sparse_classes_75kplus_train_007374
10,254
permissive
[ { "docstring": "Validate incoming data for a write", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Update an ApplicationStepSubmission", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_053239
Implement the Python class `SubmissionReviewSerializer` described below. Class description: ApplicationStepSubmission serializer for reviewers Method signatures and docstrings: - def validate(self, attrs): Validate incoming data for a write - def update(self, instance, validated_data): Update an ApplicationStepSubmis...
Implement the Python class `SubmissionReviewSerializer` described below. Class description: ApplicationStepSubmission serializer for reviewers Method signatures and docstrings: - def validate(self, attrs): Validate incoming data for a write - def update(self, instance, validated_data): Update an ApplicationStepSubmis...
339c67b84b661a37ffe32580da72383d95666c5c
<|skeleton|> class SubmissionReviewSerializer: """ApplicationStepSubmission serializer for reviewers""" def validate(self, attrs): """Validate incoming data for a write""" <|body_0|> def update(self, instance, validated_data): """Update an ApplicationStepSubmission""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubmissionReviewSerializer: """ApplicationStepSubmission serializer for reviewers""" def validate(self, attrs): """Validate incoming data for a write""" bootcamp_application = self.instance.bootcamp_application if 'review_status' in attrs: if bootcamp_application.state...
the_stack_v2_python_sparse
applications/serializers.py
mitodl/bootcamp-ecommerce
train
6
6250dfaf355ea65d7fcc8b1a806d70aeeb1a7d21
[ "try:\n return ClientLocationDetail.objects.get(client_location__client__pk=client_id, client_location__pk=client_location_id)\nexcept ClientLocationDetail.DoesNotExist:\n if get_or_create:\n return ClientLocationDetail.objects.create(client_location__pk=client_location_id)\n else:\n self.rai...
<|body_start_0|> try: return ClientLocationDetail.objects.get(client_location__client__pk=client_id, client_location__pk=client_location_id) except ClientLocationDetail.DoesNotExist: if get_or_create: return ClientLocationDetail.objects.create(client_location__pk=...
Client Location Detail Detail API Class Example URL: /api/v1/clients/<client_id>/locations/<client_location_id>/details/
ClientLocationDetailDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientLocationDetailDetail: """Client Location Detail Detail API Class Example URL: /api/v1/clients/<client_id>/locations/<client_location_id>/details/""" def get_object(self, client_id, client_location_id, get_or_create=False): """Method to ease access of getting the queryset for us...
stack_v2_sparse_classes_75kplus_train_007375
3,068
no_license
[ { "docstring": "Method to ease access of getting the queryset for use :pk - PK of the client location detail that you want to get detail on :client_id - Client Id that the detail is related too :client_location_id - Client Location ID that the detail is related too You must pass a PK in otherwise this will fail...
3
stack_v2_sparse_classes_30k_train_025740
Implement the Python class `ClientLocationDetailDetail` described below. Class description: Client Location Detail Detail API Class Example URL: /api/v1/clients/<client_id>/locations/<client_location_id>/details/ Method signatures and docstrings: - def get_object(self, client_id, client_location_id, get_or_create=Fal...
Implement the Python class `ClientLocationDetailDetail` described below. Class description: Client Location Detail Detail API Class Example URL: /api/v1/clients/<client_id>/locations/<client_location_id>/details/ Method signatures and docstrings: - def get_object(self, client_id, client_location_id, get_or_create=Fal...
9769e1a96730b02511d25af8828b075dff5c35b5
<|skeleton|> class ClientLocationDetailDetail: """Client Location Detail Detail API Class Example URL: /api/v1/clients/<client_id>/locations/<client_location_id>/details/""" def get_object(self, client_id, client_location_id, get_or_create=False): """Method to ease access of getting the queryset for us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClientLocationDetailDetail: """Client Location Detail Detail API Class Example URL: /api/v1/clients/<client_id>/locations/<client_location_id>/details/""" def get_object(self, client_id, client_location_id, get_or_create=False): """Method to ease access of getting the queryset for use :pk - PK of...
the_stack_v2_python_sparse
clients/api/client_location_detail_detail.py
doubleclickdetroit/dindintonight
train
0
5a5b61ac7be37418920c7208dc317f8df84c9461
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing Service resources.
ServiceServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceServiceServicer: """A set of methods for managing Service resources.""" def Get(self, request, context): """Returns the specified service.""" <|body_0|> def List(self, request, context): """Retrieves the list of services.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_007376
4,669
permissive
[ { "docstring": "Returns the specified service.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Retrieves the list of services.", "name": "List", "signature": "def List(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_035506
Implement the Python class `ServiceServiceServicer` described below. Class description: A set of methods for managing Service resources. Method signatures and docstrings: - def Get(self, request, context): Returns the specified service. - def List(self, request, context): Retrieves the list of services.
Implement the Python class `ServiceServiceServicer` described below. Class description: A set of methods for managing Service resources. Method signatures and docstrings: - def Get(self, request, context): Returns the specified service. - def List(self, request, context): Retrieves the list of services. <|skeleton|>...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class ServiceServiceServicer: """A set of methods for managing Service resources.""" def Get(self, request, context): """Returns the specified service.""" <|body_0|> def List(self, request, context): """Retrieves the list of services.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceServiceServicer: """A set of methods for managing Service resources.""" def Get(self, request, context): """Returns the specified service.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Me...
the_stack_v2_python_sparse
yandex/cloud/billing/v1/service_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
d45e81eb238d35b40eae1b699607e86918a8d21e
[ "dp = {0}\nfor a in stones:\n dp = {a + i for i in dp} | {a - i for i in dp}\nreturn min((abs(i) for i in dp))", "dp = [0] * 1501\ndp[0] = 1\ns = 0\nres = 100\nfor a in stones:\n s += a\n for i in range(1500, a - 1, -1):\n dp[i] += dp[i - a]\nfor i in range(1500):\n res = min(res, abs(s - dp[i]...
<|body_start_0|> dp = {0} for a in stones: dp = {a + i for i in dp} | {a - i for i in dp} return min((abs(i) for i in dp)) <|end_body_0|> <|body_start_1|> dp = [0] * 1501 dp[0] = 1 s = 0 res = 100 for a in stones: s += a ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lastStoneWeightII(self, stones): """暂时看不懂 :type stones: List[int] :rtype: int""" <|body_0|> def lastStoneWeightII2(self, stones): """看不懂+1 :param stones: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = {0} for a i...
stack_v2_sparse_classes_75kplus_train_007377
3,100
no_license
[ { "docstring": "暂时看不懂 :type stones: List[int] :rtype: int", "name": "lastStoneWeightII", "signature": "def lastStoneWeightII(self, stones)" }, { "docstring": "看不懂+1 :param stones: :return:", "name": "lastStoneWeightII2", "signature": "def lastStoneWeightII2(self, stones)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastStoneWeightII(self, stones): 暂时看不懂 :type stones: List[int] :rtype: int - def lastStoneWeightII2(self, stones): 看不懂+1 :param stones: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastStoneWeightII(self, stones): 暂时看不懂 :type stones: List[int] :rtype: int - def lastStoneWeightII2(self, stones): 看不懂+1 :param stones: :return: <|skeleton|> class Solution:...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def lastStoneWeightII(self, stones): """暂时看不懂 :type stones: List[int] :rtype: int""" <|body_0|> def lastStoneWeightII2(self, stones): """看不懂+1 :param stones: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lastStoneWeightII(self, stones): """暂时看不懂 :type stones: List[int] :rtype: int""" dp = {0} for a in stones: dp = {a + i for i in dp} | {a - i for i in dp} return min((abs(i) for i in dp)) def lastStoneWeightII2(self, stones): """看不懂+1 :para...
the_stack_v2_python_sparse
1049_最后一块石头的重量 II.py
lovehhf/LeetCode
train
0
4634506925d36b6e900e9db6887cda8232712270
[ "self._api_url = url\nself._session = requests.Session()\nself._session.headers['x-api-key'] = api_key\nself._session.verify = verify\nif not url:\n raise ValueError('IronNet URL must be set')\nif not api_key:\n raise ValueError('IronNet API key must be set')", "resp: Response = self._session.get(self._api_...
<|body_start_0|> self._api_url = url self._session = requests.Session() self._session.headers['x-api-key'] = api_key self._session.verify = verify if not url: raise ValueError('IronNet URL must be set') if not api_key: raise ValueError('IronNet API...
IronNet client
IronNetClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IronNetClient: """IronNet client""" def __init__(self, url: str, api_key: str, verify: bool=True): """Constructor. :param url: IronNet url :param api_key: IronNet API key :param verify: Verify SSL connections""" <|body_0|> def query(self) -> Iterator[IronNetItem]: ...
stack_v2_sparse_classes_75kplus_train_007378
1,867
permissive
[ { "docstring": "Constructor. :param url: IronNet url :param api_key: IronNet API key :param verify: Verify SSL connections", "name": "__init__", "signature": "def __init__(self, url: str, api_key: str, verify: bool=True)" }, { "docstring": "Process the feed URL and return any indicators. :return...
2
stack_v2_sparse_classes_30k_train_042740
Implement the Python class `IronNetClient` described below. Class description: IronNet client Method signatures and docstrings: - def __init__(self, url: str, api_key: str, verify: bool=True): Constructor. :param url: IronNet url :param api_key: IronNet API key :param verify: Verify SSL connections - def query(self) ...
Implement the Python class `IronNetClient` described below. Class description: IronNet client Method signatures and docstrings: - def __init__(self, url: str, api_key: str, verify: bool=True): Constructor. :param url: IronNet url :param api_key: IronNet API key :param verify: Verify SSL connections - def query(self) ...
d00a0243946ded25b5d06bdefd9b40015dea9b80
<|skeleton|> class IronNetClient: """IronNet client""" def __init__(self, url: str, api_key: str, verify: bool=True): """Constructor. :param url: IronNet url :param api_key: IronNet API key :param verify: Verify SSL connections""" <|body_0|> def query(self) -> Iterator[IronNetItem]: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IronNetClient: """IronNet client""" def __init__(self, url: str, api_key: str, verify: bool=True): """Constructor. :param url: IronNet url :param api_key: IronNet API key :param verify: Verify SSL connections""" self._api_url = url self._session = requests.Session() self._...
the_stack_v2_python_sparse
external-import/ironnet/src/ironnet/client.py
OpenCTI-Platform/connectors
train
254
d09e902719804baca27f4b107dcb407bd898e8cd
[ "with steps.start('Shut Bgp process') as step:\n try:\n uut.execute('process shutdown bgp')\n except Exception as e:\n step.failed('Failed to shut the feature', from_exception=e)", "with steps.start('UnShut Bgp process') as step:\n try:\n uut.execute('process restart bpm')\n excep...
<|body_start_0|> with steps.start('Shut Bgp process') as step: try: uut.execute('process shutdown bgp') except Exception as e: step.failed('Failed to shut the feature', from_exception=e) <|end_body_0|> <|body_start_1|> with steps.start('UnShut Bgp...
Trigger class for ShutNoShut action
TriggerShutNoShut
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerShutNoShut: """Trigger class for ShutNoShut action""" def shut(self, uut, method, abstract, steps): """Send configuration to shut Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object Returns: None Raises: pyATS Results""" ...
stack_v2_sparse_classes_75kplus_train_007379
5,672
permissive
[ { "docstring": "Send configuration to shut Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object Returns: None Raises: pyATS Results", "name": "shut", "signature": "def shut(self, uut, method, abstract, steps)" }, { "docstring": "restart proc...
2
stack_v2_sparse_classes_30k_train_047782
Implement the Python class `TriggerShutNoShut` described below. Class description: Trigger class for ShutNoShut action Method signatures and docstrings: - def shut(self, uut, method, abstract, steps): Send configuration to shut Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): a...
Implement the Python class `TriggerShutNoShut` described below. Class description: Trigger class for ShutNoShut action Method signatures and docstrings: - def shut(self, uut, method, abstract, steps): Send configuration to shut Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): a...
e42e51475cddcb10f5c7814d0fe892ac865742ba
<|skeleton|> class TriggerShutNoShut: """Trigger class for ShutNoShut action""" def shut(self, uut, method, abstract, steps): """Send configuration to shut Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object Returns: None Raises: pyATS Results""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TriggerShutNoShut: """Trigger class for ShutNoShut action""" def shut(self, uut, method, abstract, steps): """Send configuration to shut Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object Returns: None Raises: pyATS Results""" with ...
the_stack_v2_python_sparse
pkgs/sdk-pkg/src/genie/libs/sdk/triggers/shutnoshut/bgp/iosxr/shutnoshut.py
CiscoTestAutomation/genielibs
train
109
b6ca720e8de5230623ed66b784ad30985bf34dcf
[ "Nature.__init__(self, x, y, window)\nself.image = pygame.image.load('Images/desertdune.png')\nself.rect = self.image.get_rect()\nself.rect.x = x\nself.rect.y = y", "if window.model.heat < 255:\n window.model.heat += 0.01\nif window.model.wet > 0:\n window.model.wet -= 0.01" ]
<|body_start_0|> Nature.__init__(self, x, y, window) self.image = pygame.image.load('Images/desertdune.png') self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y <|end_body_0|> <|body_start_1|> if window.model.heat < 255: window.model.heat += 0.0...
Desert sand dune object
DesertDune
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DesertDune: """Desert sand dune object""" def __init__(self, x, y, window): """replaces the default image with the desert dune image""" <|body_0|> def effect(self, window): """makes the enrivonment hotter and drier""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_007380
4,149
no_license
[ { "docstring": "replaces the default image with the desert dune image", "name": "__init__", "signature": "def __init__(self, x, y, window)" }, { "docstring": "makes the enrivonment hotter and drier", "name": "effect", "signature": "def effect(self, window)" } ]
2
null
Implement the Python class `DesertDune` described below. Class description: Desert sand dune object Method signatures and docstrings: - def __init__(self, x, y, window): replaces the default image with the desert dune image - def effect(self, window): makes the enrivonment hotter and drier
Implement the Python class `DesertDune` described below. Class description: Desert sand dune object Method signatures and docstrings: - def __init__(self, x, y, window): replaces the default image with the desert dune image - def effect(self, window): makes the enrivonment hotter and drier <|skeleton|> class DesertD...
dbe8fbd8825b47290d11d6e3d4a7199f668e7527
<|skeleton|> class DesertDune: """Desert sand dune object""" def __init__(self, x, y, window): """replaces the default image with the desert dune image""" <|body_0|> def effect(self, window): """makes the enrivonment hotter and drier""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DesertDune: """Desert sand dune object""" def __init__(self, x, y, window): """replaces the default image with the desert dune image""" Nature.__init__(self, x, y, window) self.image = pygame.image.load('Images/desertdune.png') self.rect = self.image.get_rect() sel...
the_stack_v2_python_sparse
environment.py
Greenlightrj/playgod
train
0
b29c492a5833cbb30ba4247a872c518d9727e25a
[ "data = {'args': (data.pop('name'),)}\nmethod = rebalance.status\nreturn await self.middleware.call('gluster.method.run', method, data)", "data = {'args': (data.pop('name'),)}\nmethod = rebalance.fix_layout_start\nreturn await self.middleware.call('gluster.method.run', method, data)", "options = {'args': (data....
<|body_start_0|> data = {'args': (data.pop('name'),)} method = rebalance.status return await self.middleware.call('gluster.method.run', method, data) <|end_body_0|> <|body_start_1|> data = {'args': (data.pop('name'),)} method = rebalance.fix_layout_start return await sel...
GlusterRebalanceService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlusterRebalanceService: async def status(self, job, data): """Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.""" <|body_0|> async def fix_layout(self, job, data): """Start a fix-layout operation f...
stack_v2_sparse_classes_75kplus_train_007381
2,514
no_license
[ { "docstring": "Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.", "name": "status", "signature": "async def status(self, job, data)" }, { "docstring": "Start a fix-layout operation for a given gluster volume. `name` String rep...
4
stack_v2_sparse_classes_30k_train_017971
Implement the Python class `GlusterRebalanceService` described below. Class description: Implement the GlusterRebalanceService class. Method signatures and docstrings: - async def status(self, job, data): Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster vol...
Implement the Python class `GlusterRebalanceService` described below. Class description: Implement the GlusterRebalanceService class. Method signatures and docstrings: - async def status(self, job, data): Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster vol...
7404f896226978409291d48c4dc723ed34f21329
<|skeleton|> class GlusterRebalanceService: async def status(self, job, data): """Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.""" <|body_0|> async def fix_layout(self, job, data): """Start a fix-layout operation f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlusterRebalanceService: async def status(self, job, data): """Return the status of a rebalance operation for a given gluster volume. `name` String representing the gluster volume.""" data = {'args': (data.pop('name'),)} method = rebalance.status return await self.middleware.ca...
the_stack_v2_python_sparse
src/middlewared/middlewared/plugins/gluster_linux/rebalance.py
haoshao/freenas
train
1
a6815155d11b138ad5d10da9c5a91b52b714ccfb
[ "super(ActionValueFunction, self).__init__()\nself.values = nn.Parameter(torch.zeros((state_size, action_size), requires_grad=True))\nself.state_size = state_size\nself.action_size = action_size\nif init is not None:\n if isinstance(init, (float, int, torch.Tensor)):\n self.values.data.add_(init)\n els...
<|body_start_0|> super(ActionValueFunction, self).__init__() self.values = nn.Parameter(torch.zeros((state_size, action_size), requires_grad=True)) self.state_size = state_size self.action_size = action_size if init is not None: if isinstance(init, (float, int, torch....
<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, the returned values are differentiable and can be...
ActionValueFunction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionValueFunction: """<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, th...
stack_v2_sparse_classes_75kplus_train_007382
3,917
permissive
[ { "docstring": "## Arguments * `state_size` (int) - The number of states in the environment. * `action_size` (int) - The number of actions per state. * `init` (function, *optional*, default=None) - The initialization scheme for the values in the table. (Default is 0.)", "name": "__init__", "signature": ...
2
stack_v2_sparse_classes_30k_train_038314
Implement the Python class `ActionValueFunction` described below. Class description: <a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states an...
Implement the Python class `ActionValueFunction` described below. Class description: <a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states an...
f4164a53dcc762ac5ce53a761fb54f3f69847f90
<|skeleton|> class ActionValueFunction: """<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActionValueFunction: """<a href="https://github.com/seba-1511/cherry/blob/master/cherry/models/tabular.py" class="source-link">[Source]</a> ## Description Stores a table of action values, Q(s, a), one for each (state, action) pair. Assumes that the states and actions are one-hot encoded. Also, the returned va...
the_stack_v2_python_sparse
cherry/models/tabular.py
learnables/cherry
train
185
a8553863a4ba89dad0382b607b0d71d38a122ac5
[ "self.id = id\nself.version = version\nself.log_id = log_id\nself.provider = provider\nself.magic_num = magic_num\nself.reserved = reserved", "self.id = socket.htons(self.id)\nself.version = socket.htons(self.version)\nself.log_id = socket.htonl(self.log_id)\nself.reserved = socket.htons(self.reserved)\nself.body...
<|body_start_0|> self.id = id self.version = version self.log_id = log_id self.provider = provider self.magic_num = magic_num self.reserved = reserved <|end_body_0|> <|body_start_1|> self.id = socket.htons(self.id) self.version = socket.htons(self.version...
ĿǰͨʽбĿռɽĶ̬ء ͷṹ unit16_t id, //id 1 unit16_t version, //汾 1 unit32_t log_id, //apchelogidᴩһ罻 111 char provider[16], //ͻ˱ʵ"client" uint32_t magic_num //ʾһʼ 0xffee7799 unit32_t reserved; // unit32_t body_len; //headܳȣҲprotobufкźij
x_server_header
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class x_server_header: """ĿǰͨʽбĿռɽĶ̬ء ͷṹ unit16_t id, //id 1 unit16_t version, //汾 1 unit32_t log_id, //apchelogidᴩһ罻 111 char provider[16], //ͻ˱ʵ"client" uint32_t magic_num //ʾһʼ 0xffee7799 unit32_t reserved; // unit32_t body_len; //headܳȣҲprotobufкźij""" def __init__(self, id=1, version=1, log_id...
stack_v2_sparse_classes_75kplus_train_007383
2,381
no_license
[ { "docstring": "ʵʱҪbody_len", "name": "__init__", "signature": "def __init__(self, id=1, version=1, log_id=111, provider='client', magic_num=socket.htonl(4293818265), reserved=0)" }, { "docstring": "תٽstruct", "name": "package_header", "signature": "def package_header(self, body_len)" ...
3
stack_v2_sparse_classes_30k_train_003008
Implement the Python class `x_server_header` described below. Class description: ĿǰͨʽбĿռɽĶ̬ء ͷṹ unit16_t id, //id 1 unit16_t version, //汾 1 unit32_t log_id, //apchelogidᴩһ罻 111 char provider[16], //ͻ˱ʵ"client" uint32_t magic_num //ʾһʼ 0xffee7799 unit32_t reserved; // unit32_t body_len; //headܳȣҲprotobufкźij Method sig...
Implement the Python class `x_server_header` described below. Class description: ĿǰͨʽбĿռɽĶ̬ء ͷṹ unit16_t id, //id 1 unit16_t version, //汾 1 unit32_t log_id, //apchelogidᴩһ罻 111 char provider[16], //ͻ˱ʵ"client" uint32_t magic_num //ʾһʼ 0xffee7799 unit32_t reserved; // unit32_t body_len; //headܳȣҲprotobufкźij Method sig...
ce1131cee2808e9631e3467c8ded4b43d7bf3792
<|skeleton|> class x_server_header: """ĿǰͨʽбĿռɽĶ̬ء ͷṹ unit16_t id, //id 1 unit16_t version, //汾 1 unit32_t log_id, //apchelogidᴩһ罻 111 char provider[16], //ͻ˱ʵ"client" uint32_t magic_num //ʾһʼ 0xffee7799 unit32_t reserved; // unit32_t body_len; //headܳȣҲprotobufкźij""" def __init__(self, id=1, version=1, log_id...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class x_server_header: """ĿǰͨʽбĿռɽĶ̬ء ͷṹ unit16_t id, //id 1 unit16_t version, //汾 1 unit32_t log_id, //apchelogidᴩһ罻 111 char provider[16], //ͻ˱ʵ"client" uint32_t magic_num //ʾһʼ 0xffee7799 unit32_t reserved; // unit32_t body_len; //headܳȣҲprotobufкźij""" def __init__(self, id=1, version=1, log_id=111, provide...
the_stack_v2_python_sparse
mock_server_tool/mock_lib/header.py
EllaSun/TesterCode
train
1
b347078daf97a2fb92761ee070c401fcaf71f8de
[ "dh_params = DH.PARAM_NUMBERS.parameters(default_backend())\nx = dh_params.generate_private_key()\nx_bytes = x.private_numbers().x.to_bytes(128, 'big')\ngx = x.public_key()\ngx_bytes = gx.public_numbers().y.to_bytes(128, 'big')\nreturn (x, x_bytes, gx, gx_bytes)", "gy = DH.dh_public_from_bytes(gy)\nshared_key_mat...
<|body_start_0|> dh_params = DH.PARAM_NUMBERS.parameters(default_backend()) x = dh_params.generate_private_key() x_bytes = x.private_numbers().x.to_bytes(128, 'big') gx = x.public_key() gx_bytes = gx.public_numbers().y.to_bytes(128, 'big') return (x, x_bytes, gx, gx_bytes...
DH
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DH: def generate_keys(): """Generates the 128 bit diffe hellman private (x) and public (g^x) keys. :return: x value, x as bytes, gx value, and gx as bytes""" <|body_0|> def derrive_shared_key(x: dh.DHPrivateKey, gy: bytes, hash: bytes): """Derrive the shared key from...
stack_v2_sparse_classes_75kplus_train_007384
11,662
no_license
[ { "docstring": "Generates the 128 bit diffe hellman private (x) and public (g^x) keys. :return: x value, x as bytes, gx value, and gx as bytes", "name": "generate_keys", "signature": "def generate_keys()" }, { "docstring": "Derrive the shared key from gy with x, as done in Diffie Hellman :param ...
4
stack_v2_sparse_classes_30k_train_034198
Implement the Python class `DH` described below. Class description: Implement the DH class. Method signatures and docstrings: - def generate_keys(): Generates the 128 bit diffe hellman private (x) and public (g^x) keys. :return: x value, x as bytes, gx value, and gx as bytes - def derrive_shared_key(x: dh.DHPrivateKe...
Implement the Python class `DH` described below. Class description: Implement the DH class. Method signatures and docstrings: - def generate_keys(): Generates the 128 bit diffe hellman private (x) and public (g^x) keys. :return: x value, x as bytes, gx value, and gx as bytes - def derrive_shared_key(x: dh.DHPrivateKe...
cf0daa63ead5a9282e36cf28133c93a9f67068c1
<|skeleton|> class DH: def generate_keys(): """Generates the 128 bit diffe hellman private (x) and public (g^x) keys. :return: x value, x as bytes, gx value, and gx as bytes""" <|body_0|> def derrive_shared_key(x: dh.DHPrivateKey, gy: bytes, hash: bytes): """Derrive the shared key from...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DH: def generate_keys(): """Generates the 128 bit diffe hellman private (x) and public (g^x) keys. :return: x value, x as bytes, gx value, and gx as bytes""" dh_params = DH.PARAM_NUMBERS.parameters(default_backend()) x = dh_params.generate_private_key() x_bytes = x.private_numb...
the_stack_v2_python_sparse
crypto/core_crypto.py
Eli-G3/PyTORoxy
train
1
76158a960c8a2aa3090a9fb8ba41c13ab2fa2174
[ "base.Action.__init__(self, self.__openBrowser)\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__frame = frame\nif wxnat is None:\n self.enabled = False", "hosts = fslsettings.read('fsleyes.xnat.hosts', [])\naccounts = fslsettings.read('fsleyes.xnat.accounts', {})\ndlg = XNATBrowser(se...
<|body_start_0|> base.Action.__init__(self, self.__openBrowser) self.__overlayList = overlayList self.__displayCtx = displayCtx self.__frame = frame if wxnat is None: self.enabled = False <|end_body_0|> <|body_start_1|> hosts = fslsettings.read('fsleyes.xnat....
The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.
BrowseXNATAction
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowseXNATAction: """The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``Browse...
stack_v2_sparse_classes_75kplus_train_007385
7,179
permissive
[ { "docstring": "Create a ``BrowseXNATAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.", "name": "__init__", "signature": "def __init__(self, overlayList, displayCtx, frame)" }, { "docstring": "Opens a :c...
2
stack_v2_sparse_classes_30k_train_011311
Implement the Python class `BrowseXNATAction` described below. Class description: The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`. Method signatures and docstrings: - def __init__...
Implement the Python class `BrowseXNATAction` described below. Class description: The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`. Method signatures and docstrings: - def __init__...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class BrowseXNATAction: """The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``Browse...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BrowseXNATAction: """The ``BrowseXNATAction`` allows the user to open files from an XNAT repository. It opens a :class:`XNATBrowser``, and adds the files that the user selected into the :class:`.OverlayList`.""" def __init__(self, overlayList, displayCtx, frame): """Create a ``BrowseXNATAction``....
the_stack_v2_python_sparse
fsleyes/actions/browsexnat.py
sanjayankur31/fsleyes
train
1
c442ed8f8bcc9c2a8ab714e6490bdc12ec5bf719
[ "self.lines_to_read = int(sys.argv[2])\nself.fileread = file_read.MyFile()\nself.mystack = stack.MyStack()", "fhandle = self.fileread.open_file(sys.argv[1])\nlinecount = self.fileread.get_line_count(sys.argv[1])\ntempfile = file_read.MyFile()\nhandle = tempfile.open_file(name='output.txt', mode='w')\nfor lines in...
<|body_start_0|> self.lines_to_read = int(sys.argv[2]) self.fileread = file_read.MyFile() self.mystack = stack.MyStack() <|end_body_0|> <|body_start_1|> fhandle = self.fileread.open_file(sys.argv[1]) linecount = self.fileread.get_line_count(sys.argv[1]) tempfile = file_r...
line
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class line: def __init__(self): """Initializes: 1)File handle 2)Number of lines to be read 3)Stack""" <|body_0|> def push_lines_to_stack(self): """Pushes all the lines in file to the stack.""" <|body_1|> def pop_required_lines(self): """Pops required l...
stack_v2_sparse_classes_75kplus_train_007386
1,578
no_license
[ { "docstring": "Initializes: 1)File handle 2)Number of lines to be read 3)Stack", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Pushes all the lines in file to the stack.", "name": "push_lines_to_stack", "signature": "def push_lines_to_stack(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_032355
Implement the Python class `line` described below. Class description: Implement the line class. Method signatures and docstrings: - def __init__(self): Initializes: 1)File handle 2)Number of lines to be read 3)Stack - def push_lines_to_stack(self): Pushes all the lines in file to the stack. - def pop_required_lines(s...
Implement the Python class `line` described below. Class description: Implement the line class. Method signatures and docstrings: - def __init__(self): Initializes: 1)File handle 2)Number of lines to be read 3)Stack - def push_lines_to_stack(self): Pushes all the lines in file to the stack. - def pop_required_lines(s...
f1f3544ce3006dd33a87ed6aaa493248ca9a301d
<|skeleton|> class line: def __init__(self): """Initializes: 1)File handle 2)Number of lines to be read 3)Stack""" <|body_0|> def push_lines_to_stack(self): """Pushes all the lines in file to the stack.""" <|body_1|> def pop_required_lines(self): """Pops required l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class line: def __init__(self): """Initializes: 1)File handle 2)Number of lines to be read 3)Stack""" self.lines_to_read = int(sys.argv[2]) self.fileread = file_read.MyFile() self.mystack = stack.MyStack() def push_lines_to_stack(self): """Pushes all the lines in file to...
the_stack_v2_python_sparse
python/tail/tail/tail.py
sayalilunkad/mycodes
train
0
92942f69195622cb3268a1ee33d3d1bb9e93bbeb
[ "super().__init__()\nnout_new = nout - nin\nself.eesp = VGGBlock(nin, nout_new, stride=2, down_method='avg')\nself.avg = nn.AvgPool2d(kernel_size=3, padding=1, stride=2)\nif reinf:\n self.inp_reinf = nn.Sequential(CBR(config_inp_reinf, config_inp_reinf, 3, 1), CB(config_inp_reinf, nout, 1, 1))\nself.act = nn.PRe...
<|body_start_0|> super().__init__() nout_new = nout - nin self.eesp = VGGBlock(nin, nout_new, stride=2, down_method='avg') self.avg = nn.AvgPool2d(kernel_size=3, padding=1, stride=2) if reinf: self.inp_reinf = nn.Sequential(CBR(config_inp_reinf, config_inp_reinf, 3, 1...
Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the final output.
DownSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownSampler: """Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the...
stack_v2_sparse_classes_75kplus_train_007387
8,682
permissive
[ { "docstring": ":param nin: number of input channels :param nout: number of output channels :param k: # of parallel branches :param r_lim: A maximum value of receptive field allowed for EESP block :param reinf: Use long range shortcut connection with the input or not.", "name": "__init__", "signature": ...
2
stack_v2_sparse_classes_30k_train_031688
Implement the Python class `DownSampler` described below. Class description: Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then a...
Implement the Python class `DownSampler` described below. Class description: Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then a...
d00a290cb1c86cb079acef69f914805737cb3696
<|skeleton|> class DownSampler: """Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DownSampler: """Down-sampling fucntion that has three parallel branches: (1) avg pooling, (2) EESP block with stride of 2 and (3) efficient long-range connection with the input. The output feature maps of branches from (1) and (2) are concatenated and then additively fused with (3) to produce the final output...
the_stack_v2_python_sparse
affspec/models/vgg.py
BeibinLi/affspec
train
0
0abf3a01cda9f5ca379bd62f99597a5f6ca99638
[ "if len(teams) % 4 != 0:\n raise DrawFatalError('Tried to do a four-way fold with non-multiple of four: %d' % len(teams))\nn = len(teams) // 4\npools = (teams[0:n], teams[n:2 * n], teams[2 * n:3 * n], teams[3 * n:4 * n])\npools[1].reverse()\npools[3].reverse()\npairings = list()\nfor i, ts in enumerate(zip(*pool...
<|body_start_0|> if len(teams) % 4 != 0: raise DrawFatalError('Tried to do a four-way fold with non-multiple of four: %d' % len(teams)) n = len(teams) // 4 pools = (teams[0:n], teams[n:2 * n], teams[2 * n:3 * n], teams[3 * n:4 * n]) pools[1].reverse() pools[3].reverse...
BaseBPEliminationDrawGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseBPEliminationDrawGenerator: def _four_way_fold(self, teams, start_rank=0): """Returns pairings folded four-way, with room ranks numbered from start_rank+1.""" <|body_0|> def _get_advancing_teams(self): """Collates the advancing teams from `self.results`, checks t...
stack_v2_sparse_classes_75kplus_train_007388
6,004
no_license
[ { "docstring": "Returns pairings folded four-way, with room ranks numbered from start_rank+1.", "name": "_four_way_fold", "signature": "def _four_way_fold(self, teams, start_rank=0)" }, { "docstring": "Collates the advancing teams from `self.results`, checks them for validity, and returns them i...
2
stack_v2_sparse_classes_30k_train_035494
Implement the Python class `BaseBPEliminationDrawGenerator` described below. Class description: Implement the BaseBPEliminationDrawGenerator class. Method signatures and docstrings: - def _four_way_fold(self, teams, start_rank=0): Returns pairings folded four-way, with room ranks numbered from start_rank+1. - def _ge...
Implement the Python class `BaseBPEliminationDrawGenerator` described below. Class description: Implement the BaseBPEliminationDrawGenerator class. Method signatures and docstrings: - def _four_way_fold(self, teams, start_rank=0): Returns pairings folded four-way, with room ranks numbered from start_rank+1. - def _ge...
691dba2d26ec5c6a0c43ef8fa20ee0d14c18e52b
<|skeleton|> class BaseBPEliminationDrawGenerator: def _four_way_fold(self, teams, start_rank=0): """Returns pairings folded four-way, with room ranks numbered from start_rank+1.""" <|body_0|> def _get_advancing_teams(self): """Collates the advancing teams from `self.results`, checks t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseBPEliminationDrawGenerator: def _four_way_fold(self, teams, start_rank=0): """Returns pairings folded four-way, with room ranks numbered from start_rank+1.""" if len(teams) % 4 != 0: raise DrawFatalError('Tried to do a four-way fold with non-multiple of four: %d' % len(teams)) ...
the_stack_v2_python_sparse
tabbycat/draw/generator/bpelimination.py
dedymerdeka/tabbycat
train
0
d25c0692a98abd428c559fa52252dfdbb41f9ab9
[ "inputs = common_layers.flatten4d3d(inputs)\nencoder_input, self_attention_bias, encoder_decoder_attention_bias = transformer_prepare_encoder(inputs, target_space, hparams)\nencoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.layer_prepostprocess_dropout)\nencoder_output = transformer_encoder(encoder_input, ...
<|body_start_0|> inputs = common_layers.flatten4d3d(inputs) encoder_input, self_attention_bias, encoder_decoder_attention_bias = transformer_prepare_encoder(inputs, target_space, hparams) encoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.layer_prepostprocess_dropout) encoder_out...
Attention net. See file docstring.
TransformerExt
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerExt: """Attention net. See file docstring.""" def encode(self, inputs, raw_inputs, target_space, hparams): """Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, hidden_dim] target_space: scalar, target space ID. hparams: hyperparmeters f...
stack_v2_sparse_classes_75kplus_train_007389
32,545
permissive
[ { "docstring": "Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, hidden_dim] target_space: scalar, target space ID. hparams: hyperparmeters for model. Returns: Tuple of: encoder_output: Encoder representation. [batch_size, input_length, hidden_dim] encoder_decoder_attention...
3
stack_v2_sparse_classes_30k_train_038924
Implement the Python class `TransformerExt` described below. Class description: Attention net. See file docstring. Method signatures and docstrings: - def encode(self, inputs, raw_inputs, target_space, hparams): Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, hidden_dim] target_...
Implement the Python class `TransformerExt` described below. Class description: Attention net. See file docstring. Method signatures and docstrings: - def encode(self, inputs, raw_inputs, target_space, hparams): Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, hidden_dim] target_...
f6e1b78c4b831c09149265edfd2873aa7fc29f55
<|skeleton|> class TransformerExt: """Attention net. See file docstring.""" def encode(self, inputs, raw_inputs, target_space, hparams): """Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, hidden_dim] target_space: scalar, target space ID. hparams: hyperparmeters f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformerExt: """Attention net. See file docstring.""" def encode(self, inputs, raw_inputs, target_space, hparams): """Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, hidden_dim] target_space: scalar, target space ID. hparams: hyperparmeters for model. Ret...
the_stack_v2_python_sparse
usr/models/transformer_ext.old/model.py
fstahlberg/tensor2tensor-usr
train
5
3a1589982e96238b6060a343c65a247bbb606d51
[ "self.path_data = '/disk/data/share/s1690903/pandemic_anxiety/data/'\nself.data = pd.read_csv(self.path_data + filename)\nself.path_result = '/disk/data/share/s1690903/pandemic_anxiety/results/lda_results/'", "data = self.data.drop_duplicates(subset='post_id', keep='first', inplace=False)\ndata = data[~data['text...
<|body_start_0|> self.path_data = '/disk/data/share/s1690903/pandemic_anxiety/data/' self.data = pd.read_csv(self.path_data + filename) self.path_result = '/disk/data/share/s1690903/pandemic_anxiety/results/lda_results/' <|end_body_0|> <|body_start_1|> data = self.data.drop_duplicates(s...
ProcessText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessText: def __init__(self, filename): """Define varibles.""" <|body_0|> def processed_data(self): """Remove duplicates and deleted posts and nan""" <|body_1|> def data_dict(self): """Convert df to dictionary.""" <|body_2|> def s...
stack_v2_sparse_classes_75kplus_train_007390
23,190
no_license
[ { "docstring": "Define varibles.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Remove duplicates and deleted posts and nan", "name": "processed_data", "signature": "def processed_data(self)" }, { "docstring": "Convert df to dictionary.", ...
6
stack_v2_sparse_classes_30k_train_007912
Implement the Python class `ProcessText` described below. Class description: Implement the ProcessText class. Method signatures and docstrings: - def __init__(self, filename): Define varibles. - def processed_data(self): Remove duplicates and deleted posts and nan - def data_dict(self): Convert df to dictionary. - de...
Implement the Python class `ProcessText` described below. Class description: Implement the ProcessText class. Method signatures and docstrings: - def __init__(self, filename): Define varibles. - def processed_data(self): Remove duplicates and deleted posts and nan - def data_dict(self): Convert df to dictionary. - de...
167764802f1e474cd4c421b347be396f6412ba70
<|skeleton|> class ProcessText: def __init__(self, filename): """Define varibles.""" <|body_0|> def processed_data(self): """Remove duplicates and deleted posts and nan""" <|body_1|> def data_dict(self): """Convert df to dictionary.""" <|body_2|> def s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProcessText: def __init__(self, filename): """Define varibles.""" self.path_data = '/disk/data/share/s1690903/pandemic_anxiety/data/' self.data = pd.read_csv(self.path_data + filename) self.path_result = '/disk/data/share/s1690903/pandemic_anxiety/results/lda_results/' def...
the_stack_v2_python_sparse
source/lda_topic.py
luciasalar/pandemic_anxiety
train
1
06f7ccc7f03ecee0c20bda4605795cd2b14c6219
[ "left, right = (0, len(nums) - 1)\nwhile left <= right:\n mid = left + (right - left) // 2\n if nums[mid] == target:\n return mid\n elif nums[left] <= nums[mid]:\n if nums[left] <= target <= nums[mid]:\n right = mid - 1\n else:\n left = mid + 1\n elif nums[mid]...
<|body_start_0|> left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if nums[mid] == target: return mid elif nums[left] <= nums[mid]: if nums[left] <= target <= nums[mid]: right = m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search_v2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def search_naive(self, nums, target): ...
stack_v2_sparse_classes_75kplus_train_007391
3,502
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search", "signature": "def search(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "search_v2", "signature": "def search_v2(self, nums, target)" }, { ...
3
stack_v2_sparse_classes_30k_train_005673
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search_v2(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def search_v2(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def search_v2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> def search_naive(self, nums, target): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if nums[mid] == target: return mid elif nums[le...
the_stack_v2_python_sparse
src/lt_33.py
oxhead/CodingYourWay
train
0
709fbd4599794c5cfda6e1ef3f1ff9ea620d3f49
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TimeBasedAttributeTrigger()", "from .workflow_execution_trigger import WorkflowExecutionTrigger\nfrom .workflow_trigger_time_based_attribute import WorkflowTriggerTimeBasedAttribute\nfrom .workflow_execution_trigger import WorkflowExec...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return TimeBasedAttributeTrigger() <|end_body_0|> <|body_start_1|> from .workflow_execution_trigger import WorkflowExecutionTrigger from .workflow_trigger_time_based_attribute import WorkflowTr...
TimeBasedAttributeTrigger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeBasedAttributeTrigger: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeBasedAttributeTrigger: """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 c...
stack_v2_sparse_classes_75kplus_train_007392
3,115
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: TimeBasedAttributeTrigger", "name": "create_from_discriminator_value", "signature": "def create_from_discrim...
3
stack_v2_sparse_classes_30k_train_027601
Implement the Python class `TimeBasedAttributeTrigger` described below. Class description: Implement the TimeBasedAttributeTrigger class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeBasedAttributeTrigger: Creates a new instance of the appropriat...
Implement the Python class `TimeBasedAttributeTrigger` described below. Class description: Implement the TimeBasedAttributeTrigger class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeBasedAttributeTrigger: Creates a new instance of the appropriat...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class TimeBasedAttributeTrigger: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeBasedAttributeTrigger: """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 c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeBasedAttributeTrigger: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TimeBasedAttributeTrigger: """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 obje...
the_stack_v2_python_sparse
msgraph/generated/models/identity_governance/time_based_attribute_trigger.py
microsoftgraph/msgraph-sdk-python
train
135
d8c11acbc8f175a47c59f4398647f52c71fe2e40
[ "args = authorization_arguments.parse_args(request)\nclient = UserClient()\nuser = client.check_token(args.get('Authorization'))\nif not user:\n return (None, 401)\nreturn Order.get_opened_order(user['id'])", "args = add_beer_arguments.parse_args(request)\nif args.get('quantity') <= 0:\n return (None, 400)\...
<|body_start_0|> args = authorization_arguments.parse_args(request) client = UserClient() user = client.check_token(args.get('Authorization')) if not user: return (None, 401) return Order.get_opened_order(user['id']) <|end_body_0|> <|body_start_1|> args = add...
OrderItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderItem: def get(self): """Returns opened order of current user.""" <|body_0|> def put(self): """Adds a quantity of beers to the opened order of current user.""" <|body_1|> def delete(self): """Remove beers from the opened order of current user...
stack_v2_sparse_classes_75kplus_train_007393
4,248
no_license
[ { "docstring": "Returns opened order of current user.", "name": "get", "signature": "def get(self)" }, { "docstring": "Adds a quantity of beers to the opened order of current user.", "name": "put", "signature": "def put(self)" }, { "docstring": "Remove beers from the opened order...
3
null
Implement the Python class `OrderItem` described below. Class description: Implement the OrderItem class. Method signatures and docstrings: - def get(self): Returns opened order of current user. - def put(self): Adds a quantity of beers to the opened order of current user. - def delete(self): Remove beers from the op...
Implement the Python class `OrderItem` described below. Class description: Implement the OrderItem class. Method signatures and docstrings: - def get(self): Returns opened order of current user. - def put(self): Adds a quantity of beers to the opened order of current user. - def delete(self): Remove beers from the op...
fd35e2bb6d1501110bf978ae51fff5910dfc631e
<|skeleton|> class OrderItem: def get(self): """Returns opened order of current user.""" <|body_0|> def put(self): """Adds a quantity of beers to the opened order of current user.""" <|body_1|> def delete(self): """Remove beers from the opened order of current user...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrderItem: def get(self): """Returns opened order of current user.""" args = authorization_arguments.parse_args(request) client = UserClient() user = client.check_token(args.get('Authorization')) if not user: return (None, 401) return Order.get_opene...
the_stack_v2_python_sparse
orders/api/endpoints.py
batetopro/beers
train
0
9149e8529e0cbd1c0d3c9ecac23d921210c2f1fe
[ "cleaned_data = super(SensorForm, self).clean()\npin = cleaned_data['pin']\ntype_sensor = cleaned_data['type_sensor']\nsensors = Sensor.objects.filter(pin=pin)\npk = self.instance.pk\nif pk:\n sensors = sensors.exclude(pk=pk)\nif sensors:\n for sensor in sensors:\n if sensor.type_sensor in (sensor.AMBI...
<|body_start_0|> cleaned_data = super(SensorForm, self).clean() pin = cleaned_data['pin'] type_sensor = cleaned_data['type_sensor'] sensors = Sensor.objects.filter(pin=pin) pk = self.instance.pk if pk: sensors = sensors.exclude(pk=pk) if sensors: ...
.
SensorForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorForm: """.""" def clean(self): """Validate date.""" <|body_0|> def __init__(self, user, *args, **kwargs): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> cleaned_data = super(SensorForm, self).clean() pin = cleaned_data['pin']...
stack_v2_sparse_classes_75kplus_train_007394
2,262
no_license
[ { "docstring": "Validate date.", "name": "clean", "signature": "def clean(self)" }, { "docstring": ".", "name": "__init__", "signature": "def __init__(self, user, *args, **kwargs)" } ]
2
null
Implement the Python class `SensorForm` described below. Class description: . Method signatures and docstrings: - def clean(self): Validate date. - def __init__(self, user, *args, **kwargs): .
Implement the Python class `SensorForm` described below. Class description: . Method signatures and docstrings: - def clean(self): Validate date. - def __init__(self, user, *args, **kwargs): . <|skeleton|> class SensorForm: """.""" def clean(self): """Validate date.""" <|body_0|> def __...
75ba60376f0d278ec54e6b6ac523324aa6b83f56
<|skeleton|> class SensorForm: """.""" def clean(self): """Validate date.""" <|body_0|> def __init__(self, user, *args, **kwargs): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SensorForm: """.""" def clean(self): """Validate date.""" cleaned_data = super(SensorForm, self).clean() pin = cleaned_data['pin'] type_sensor = cleaned_data['type_sensor'] sensors = Sensor.objects.filter(pin=pin) pk = self.instance.pk if pk: ...
the_stack_v2_python_sparse
app/gardenmatic/sensor/forms.py
reycab/gardenmatic
train
0
5b82728ecdb8af261742df9cdf47c4237b1d2a6e
[ "assert resource and containerOsh\nosh = self._getBuilder().buildResource(resource)\nosh.setContainer(containerOsh)\nreturn osh", "assert pdo and containerOsh\nosh = self._getBuilder().buildResourcePdo(pdo)\nosh.setContainer(containerOsh)\nreturn osh" ]
<|body_start_0|> assert resource and containerOsh osh = self._getBuilder().buildResource(resource) osh.setContainer(containerOsh) return osh <|end_body_0|> <|body_start_1|> assert pdo and containerOsh osh = self._getBuilder().buildResourcePdo(pdo) osh.setContaine...
ResourceReporter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceReporter: def reportResource(self, resource, containerOsh): """@types: Resource, ObjectStateHolder -> ObjectStateHolder""" <|body_0|> def reportResourcePdo(self, pdo, containerOsh): """@types: ResourceBuilder.Pdo, ObjectStateHolder -> ObjectStateHolder""" ...
stack_v2_sparse_classes_75kplus_train_007395
15,554
no_license
[ { "docstring": "@types: Resource, ObjectStateHolder -> ObjectStateHolder", "name": "reportResource", "signature": "def reportResource(self, resource, containerOsh)" }, { "docstring": "@types: ResourceBuilder.Pdo, ObjectStateHolder -> ObjectStateHolder", "name": "reportResourcePdo", "sign...
2
stack_v2_sparse_classes_30k_train_047997
Implement the Python class `ResourceReporter` described below. Class description: Implement the ResourceReporter class. Method signatures and docstrings: - def reportResource(self, resource, containerOsh): @types: Resource, ObjectStateHolder -> ObjectStateHolder - def reportResourcePdo(self, pdo, containerOsh): @type...
Implement the Python class `ResourceReporter` described below. Class description: Implement the ResourceReporter class. Method signatures and docstrings: - def reportResource(self, resource, containerOsh): @types: Resource, ObjectStateHolder -> ObjectStateHolder - def reportResourcePdo(self, pdo, containerOsh): @type...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class ResourceReporter: def reportResource(self, resource, containerOsh): """@types: Resource, ObjectStateHolder -> ObjectStateHolder""" <|body_0|> def reportResourcePdo(self, pdo, containerOsh): """@types: ResourceBuilder.Pdo, ObjectStateHolder -> ObjectStateHolder""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceReporter: def reportResource(self, resource, containerOsh): """@types: Resource, ObjectStateHolder -> ObjectStateHolder""" assert resource and containerOsh osh = self._getBuilder().buildResource(resource) osh.setContainer(containerOsh) return osh def report...
the_stack_v2_python_sparse
reference/ucmdb/discovery/ms_cluster.py
madmonkyang/cda-record
train
0
9a587c363af0438435bfc46d2a9816ceb30c7fb9
[ "\"\"\"\n\t\t- activation: #softmax\n\t\t type: leakyrelu # softmax\n\t\t alpha: 100\n\t\t\"\"\"\nsuper().__init__(*args, **kwargs)\nself.type = None", "if not isinstance(self.args, dict):\n self.type = self.args\nelse:\n self.type = self.args['type']\nif self.type == 'leakyrelu':\n if 'alpha' ...
<|body_start_0|> """ - activation: #softmax type: leakyrelu # softmax alpha: 100 """ super().__init__(*args, **kwargs) self.type = None <|end_body_0|> <|body_start_1|> if not isinstance(self.args, dict): self.type = self.ar...
An activation layer. Some layers may include an 'activation' keyword. Those layers are intended to be equivalent to no-activation followed by this explicit activation layer.
Activation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Activation: """An activation layer. Some layers may include an 'activation' keyword. Those layers are intended to be equivalent to no-activation followed by this explicit activation layer.""" def __init__(self, *args, **kwargs): """Creates a new activation layer.""" <|body_0|...
stack_v2_sparse_classes_75kplus_train_007396
4,977
no_license
[ { "docstring": "Creates a new activation layer.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Parse the layer.", "name": "_parse", "signature": "def _parse(self, engine)" }, { "docstring": "Create the backend-specific placeholder.", ...
4
null
Implement the Python class `Activation` described below. Class description: An activation layer. Some layers may include an 'activation' keyword. Those layers are intended to be equivalent to no-activation followed by this explicit activation layer. Method signatures and docstrings: - def __init__(self, *args, **kwar...
Implement the Python class `Activation` described below. Class description: An activation layer. Some layers may include an 'activation' keyword. Those layers are intended to be equivalent to no-activation followed by this explicit activation layer. Method signatures and docstrings: - def __init__(self, *args, **kwar...
8c30b6aabc5842092c18dd97a0c20aa19f62000f
<|skeleton|> class Activation: """An activation layer. Some layers may include an 'activation' keyword. Those layers are intended to be equivalent to no-activation followed by this explicit activation layer.""" def __init__(self, *args, **kwargs): """Creates a new activation layer.""" <|body_0|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Activation: """An activation layer. Some layers may include an 'activation' keyword. Those layers are intended to be equivalent to no-activation followed by this explicit activation layer.""" def __init__(self, *args, **kwargs): """Creates a new activation layer.""" """ - activa...
the_stack_v2_python_sparse
kur-projects/kur/z_tracking/added_features/add_activation.py
EmbraceLife/LIE
train
4
7507b42bdf34b278f46632b261725fcead3e939f
[ "if not self.id:\n self.created = timezone.localtime(timezone.now())\nself.modified = timezone.localtime(timezone.now())\nself.calculate_date_next()\nreturn super(ScheduledOrder, self).save(*args, **kwargs)", "now = timezone.localtime(timezone.now())\nif self.times > 0:\n self.date_next = now.date() + timez...
<|body_start_0|> if not self.id: self.created = timezone.localtime(timezone.now()) self.modified = timezone.localtime(timezone.now()) self.calculate_date_next() return super(ScheduledOrder, self).save(*args, **kwargs) <|end_body_0|> <|body_start_1|> now = timezone.lo...
ScheduledOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduledOrder: def save(self, *args, **kwargs): """On save, update timestamps""" <|body_0|> def calculate_date_next(self): """if self.period == self.WEEKLY: self.days = 7 elif self.period == self.MONTHLY: self.days = 30""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_75kplus_train_007397
13,890
no_license
[ { "docstring": "On save, update timestamps", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "if self.period == self.WEEKLY: self.days = 7 elif self.period == self.MONTHLY: self.days = 30", "name": "calculate_date_next", "signature": "def calculate_date_n...
2
stack_v2_sparse_classes_30k_val_000181
Implement the Python class `ScheduledOrder` described below. Class description: Implement the ScheduledOrder class. Method signatures and docstrings: - def save(self, *args, **kwargs): On save, update timestamps - def calculate_date_next(self): if self.period == self.WEEKLY: self.days = 7 elif self.period == self.MON...
Implement the Python class `ScheduledOrder` described below. Class description: Implement the ScheduledOrder class. Method signatures and docstrings: - def save(self, *args, **kwargs): On save, update timestamps - def calculate_date_next(self): if self.period == self.WEEKLY: self.days = 7 elif self.period == self.MON...
c4f28a6080aa60b8248cfa4d6b36a083f24e7ccd
<|skeleton|> class ScheduledOrder: def save(self, *args, **kwargs): """On save, update timestamps""" <|body_0|> def calculate_date_next(self): """if self.period == self.WEEKLY: self.days = 7 elif self.period == self.MONTHLY: self.days = 30""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScheduledOrder: def save(self, *args, **kwargs): """On save, update timestamps""" if not self.id: self.created = timezone.localtime(timezone.now()) self.modified = timezone.localtime(timezone.now()) self.calculate_date_next() return super(ScheduledOrder, sel...
the_stack_v2_python_sparse
usuarios/models.py
InteractiveValley/djFarmApp
train
0
6c0da7cc92518ad56850358757ac147348052b6a
[ "self.pause_backup = pause_backup\nself.protected_source_uid = protected_source_uid\nself.rpo_policy_id = rpo_policy_id\nself.source_parameters = source_parameters", "if dictionary is None:\n return None\npause_backup = dictionary.get('pauseBackup')\nprotected_source_uid = cohesity_management_sdk.models.univer...
<|body_start_0|> self.pause_backup = pause_backup self.protected_source_uid = protected_source_uid self.rpo_policy_id = rpo_policy_id self.source_parameters = source_parameters <|end_body_0|> <|body_start_1|> if dictionary is None: return None pause_backup = ...
Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, required): Specifies the unique id of the Protected Source to...
UpdateProtectionObjectParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateProtectionObjectParameters: """Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, r...
stack_v2_sparse_classes_75kplus_train_007398
3,048
permissive
[ { "docstring": "Constructor for the UpdateProtectionObjectParameters class", "name": "__init__", "signature": "def __init__(self, pause_backup=None, protected_source_uid=None, rpo_policy_id=None, source_parameters=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args...
2
stack_v2_sparse_classes_30k_train_004048
Implement the Python class `UpdateProtectionObjectParameters` described below. Class description: Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be pause...
Implement the Python class `UpdateProtectionObjectParameters` described below. Class description: Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be pause...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class UpdateProtectionObjectParameters: """Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateProtectionObjectParameters: """Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, required): Spe...
the_stack_v2_python_sparse
cohesity_management_sdk/models/update_protection_object_parameters.py
cohesity/management-sdk-python
train
24
85be6638fbe1047c8329aba0fa1aea4135867951
[ "Controller.__init__(self, params)\nself.E_k = 0\nself.e_k_1 = 0", "self.kp = params.kp\nself.ki = params.ki\nself.kd = params.kd", "x_g, y_g = (state.goal.x, state.goal.y)\nx_r, y_r, theta = state.pose\ne_k = math.atan2(y_g - y_r, x_g - x_r) - theta\ne_k = math.atan2(math.sin(e_k), math.cos(e_k))\nself.E_k += ...
<|body_start_0|> Controller.__init__(self, params) self.E_k = 0 self.e_k_1 = 0 <|end_body_0|> <|body_start_1|> self.kp = params.kp self.ki = params.ki self.kd = params.kd <|end_body_1|> <|body_start_2|> x_g, y_g = (state.goal.x, state.goal.y) x_r, y_r, t...
Example of PID implementation for goal-seek
GoToGoal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoToGoal: """Example of PID implementation for goal-seek""" def __init__(self, params): """init @params:""" <|body_0|> def set_parameters(self, params): """Set the PID Values @params: (float) kp, ki, kd""" <|body_1|> def execute(self, state, dt): ...
stack_v2_sparse_classes_75kplus_train_007399
1,591
no_license
[ { "docstring": "init @params:", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Set the PID Values @params: (float) kp, ki, kd", "name": "set_parameters", "signature": "def set_parameters(self, params)" }, { "docstring": "Executes the controller b...
3
stack_v2_sparse_classes_30k_train_038444
Implement the Python class `GoToGoal` described below. Class description: Example of PID implementation for goal-seek Method signatures and docstrings: - def __init__(self, params): init @params: - def set_parameters(self, params): Set the PID Values @params: (float) kp, ki, kd - def execute(self, state, dt): Execute...
Implement the Python class `GoToGoal` described below. Class description: Example of PID implementation for goal-seek Method signatures and docstrings: - def __init__(self, params): init @params: - def set_parameters(self, params): Set the PID Values @params: (float) kp, ki, kd - def execute(self, state, dt): Execute...
4b2c92086d48cb7297793998714eded968674df0
<|skeleton|> class GoToGoal: """Example of PID implementation for goal-seek""" def __init__(self, params): """init @params:""" <|body_0|> def set_parameters(self, params): """Set the PID Values @params: (float) kp, ki, kd""" <|body_1|> def execute(self, state, dt): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GoToGoal: """Example of PID implementation for goal-seek""" def __init__(self, params): """init @params:""" Controller.__init__(self, params) self.E_k = 0 self.e_k_1 = 0 def set_parameters(self, params): """Set the PID Values @params: (float) kp, ki, kd""" ...
the_stack_v2_python_sparse
controllers/gotogoal.py
jamesclyeh/pysimiam
train
0