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
0ec0239c51b93ec9596ca82f66fdf8f2775d49cb
[ "data = np.zeros((2, 2, 2, 2), dtype=np.float32)\nself.wg_perc = 50.0\nself.ws_perc = 95.0\nself.cube_wg = create_wind_percentile_cube(data=data, perc_values=[self.wg_perc, 90.0])", "plugin = WindGustDiagnostic(self.wg_perc, self.ws_perc)\nresult, perc_coord = plugin.extract_percentile_data(self.cube_wg, self.wg_...
<|body_start_0|> data = np.zeros((2, 2, 2, 2), dtype=np.float32) self.wg_perc = 50.0 self.ws_perc = 95.0 self.cube_wg = create_wind_percentile_cube(data=data, perc_values=[self.wg_perc, 90.0]) <|end_body_0|> <|body_start_1|> plugin = WindGustDiagnostic(self.wg_perc, self.ws_perc...
Test the extract_percentile_data method.
Test_extract_percentile_data
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_extract_percentile_data: """Test the extract_percentile_data method.""" def setUp(self): """Create a wind-speed and wind-gust cube with percentile coord.""" <|body_0|> def test_basic(self): """Test that the function returns a Cube and Coord.""" <|bod...
stack_v2_sparse_classes_75kplus_train_001100
11,962
permissive
[ { "docstring": "Create a wind-speed and wind-gust cube with percentile coord.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the function returns a Cube and Coord.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test ...
6
null
Implement the Python class `Test_extract_percentile_data` described below. Class description: Test the extract_percentile_data method. Method signatures and docstrings: - def setUp(self): Create a wind-speed and wind-gust cube with percentile coord. - def test_basic(self): Test that the function returns a Cube and Co...
Implement the Python class `Test_extract_percentile_data` described below. Class description: Test the extract_percentile_data method. Method signatures and docstrings: - def setUp(self): Create a wind-speed and wind-gust cube with percentile coord. - def test_basic(self): Test that the function returns a Cube and Co...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_extract_percentile_data: """Test the extract_percentile_data method.""" def setUp(self): """Create a wind-speed and wind-gust cube with percentile coord.""" <|body_0|> def test_basic(self): """Test that the function returns a Cube and Coord.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_extract_percentile_data: """Test the extract_percentile_data method.""" def setUp(self): """Create a wind-speed and wind-gust cube with percentile coord.""" data = np.zeros((2, 2, 2, 2), dtype=np.float32) self.wg_perc = 50.0 self.ws_perc = 95.0 self.cube_wg = ...
the_stack_v2_python_sparse
improver_tests/wind_calculations/wind_gust_diagnostic/test_WindGustDiagnostic.py
metoppv/improver
train
101
a10ba72ceb7669164f1067115b1e9cc31704f7fb
[ "try:\n return int(str_val)\nexcept ValueError:\n return None", "if str_val == 'False':\n return False\nreturn True" ]
<|body_start_0|> try: return int(str_val) except ValueError: return None <|end_body_0|> <|body_start_1|> if str_val == 'False': return False return True <|end_body_1|>
converters
Converter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Converter: """converters""" def str_to_int(str_val): """convert string to int :param str_val: the source string value :returns: the target integer value :raises ValueError: trigs when user provide an error str_val""" <|body_0|> def str_to_bool(str_val): """conver...
stack_v2_sparse_classes_75kplus_train_001101
694
no_license
[ { "docstring": "convert string to int :param str_val: the source string value :returns: the target integer value :raises ValueError: trigs when user provide an error str_val", "name": "str_to_int", "signature": "def str_to_int(str_val)" }, { "docstring": "convert string to boolean :param str_val...
2
null
Implement the Python class `Converter` described below. Class description: converters Method signatures and docstrings: - def str_to_int(str_val): convert string to int :param str_val: the source string value :returns: the target integer value :raises ValueError: trigs when user provide an error str_val - def str_to_...
Implement the Python class `Converter` described below. Class description: converters Method signatures and docstrings: - def str_to_int(str_val): convert string to int :param str_val: the source string value :returns: the target integer value :raises ValueError: trigs when user provide an error str_val - def str_to_...
59bb703824ca08dfac1550c1e28fc3bc1028e123
<|skeleton|> class Converter: """converters""" def str_to_int(str_val): """convert string to int :param str_val: the source string value :returns: the target integer value :raises ValueError: trigs when user provide an error str_val""" <|body_0|> def str_to_bool(str_val): """conver...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Converter: """converters""" def str_to_int(str_val): """convert string to int :param str_val: the source string value :returns: the target integer value :raises ValueError: trigs when user provide an error str_val""" try: return int(str_val) except ValueError: ...
the_stack_v2_python_sparse
venv/lib/python3.8/site-packages/eggit/converters.py
scottwedge/reporting-system
train
0
23cd0953204e0b55805680051edfb1690b9c8ac2
[ "self._renderer = renderer\nself._width = self._renderer.width\nself._height = self._renderer.height\nself._small = int(self._height / 20)\nself._extra_small = int(self._height / 25)\nself._lines = []", "row = 1\nfor save in saves:\n txt = f'{save.nickname} - {save.progress}% - CREATED: {save.created_at} ( pre...
<|body_start_0|> self._renderer = renderer self._width = self._renderer.width self._height = self._renderer.height self._small = int(self._height / 20) self._extra_small = int(self._height / 25) self._lines = [] <|end_body_0|> <|body_start_1|> row = 1 for...
A class to represent load game view of UI. Attributes: renderer: Renderer object.
LoadGameView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadGameView: """A class to represent load game view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_001102
1,967
no_license
[ { "docstring": "Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.", "name": "__init__", "signature": "def __init__(self, renderer)" }, { "docstring": "Prepares all information to show for the renderer object. Informatio...
2
null
Implement the Python class `LoadGameView` described below. Class description: A class to represent load game view of UI. Attributes: renderer: Renderer object. Method signatures and docstrings: - def __init__(self, renderer): Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer...
Implement the Python class `LoadGameView` described below. Class description: A class to represent load game view of UI. Attributes: renderer: Renderer object. Method signatures and docstrings: - def __init__(self, renderer): Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer...
29cd15dddff620de068a479595a5cb9aba855343
<|skeleton|> class LoadGameView: """A class to represent load game view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoadGameView: """A class to represent load game view of UI. Attributes: renderer: Renderer object.""" def __init__(self, renderer): """Constructs all the necessary attributes for finish view. Args: renderer (Renderer): Renderer object which renders the display.""" self._renderer = rendere...
the_stack_v2_python_sparse
src/ui/load_game_view.py
TopiasHarjunpaa/ot-harjoitustyo
train
0
055c4d78c1de2906bc018d6082e9f7222fc16ab6
[ "if not hasattr(self, '_dimensions_cache'):\n self._dimensions_cache = self.get_image_dimensions()\nreturn self._dimensions_cache", "close = self.closed\ntry:\n self.open()\n image = willow.Image.open(self)\n return image.get_size()\nfinally:\n if close:\n self.close()\n else:\n se...
<|body_start_0|> if not hasattr(self, '_dimensions_cache'): self._dimensions_cache = self.get_image_dimensions() return self._dimensions_cache <|end_body_0|> <|body_start_1|> close = self.closed try: self.open() image = willow.Image.open(self) ...
Override the ImageFieldFile in order to use Willow instead of Pillow.
WagtailImageFieldFile
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WagtailImageFieldFile: """Override the ImageFieldFile in order to use Willow instead of Pillow.""" def _get_image_dimensions(self): """override _get_image_dimensions to call our own get_image_dimensions.""" <|body_0|> def get_image_dimensions(self): """The upstre...
stack_v2_sparse_classes_75kplus_train_001103
42,364
permissive
[ { "docstring": "override _get_image_dimensions to call our own get_image_dimensions.", "name": "_get_image_dimensions", "signature": "def _get_image_dimensions(self)" }, { "docstring": "The upstream ImageFieldFile calls a local function get_image_dimensions. In this implementation we've made get...
2
stack_v2_sparse_classes_30k_train_047273
Implement the Python class `WagtailImageFieldFile` described below. Class description: Override the ImageFieldFile in order to use Willow instead of Pillow. Method signatures and docstrings: - def _get_image_dimensions(self): override _get_image_dimensions to call our own get_image_dimensions. - def get_image_dimensi...
Implement the Python class `WagtailImageFieldFile` described below. Class description: Override the ImageFieldFile in order to use Willow instead of Pillow. Method signatures and docstrings: - def _get_image_dimensions(self): override _get_image_dimensions to call our own get_image_dimensions. - def get_image_dimensi...
06a7bc6124bf62675c09fbe0a4ed9bbac183e025
<|skeleton|> class WagtailImageFieldFile: """Override the ImageFieldFile in order to use Willow instead of Pillow.""" def _get_image_dimensions(self): """override _get_image_dimensions to call our own get_image_dimensions.""" <|body_0|> def get_image_dimensions(self): """The upstre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WagtailImageFieldFile: """Override the ImageFieldFile in order to use Willow instead of Pillow.""" def _get_image_dimensions(self): """override _get_image_dimensions to call our own get_image_dimensions.""" if not hasattr(self, '_dimensions_cache'): self._dimensions_cache = se...
the_stack_v2_python_sparse
wagtail/images/models.py
wagtail/wagtail
train
12,974
59978cfa0309fc7502029c8c73b9a9963e0ca9e6
[ "import heapq\n\ndef gcd(A, B):\n if B == 0:\n return A\n return gcd(B, A % B)\nif A < B:\n A, B = (B, A)\nc = gcd(A, B)\nmaxmin = A * B // c\nt1 = maxmin // A + maxmin // B - 1\nd = N // t1\nr = N % t1\ns = d * maxmin\nprint(d, r, maxmin, s)\nif r == 0:\n return s % (10 ** 9 + 7)\nh = [s + B, s ...
<|body_start_0|> import heapq def gcd(A, B): if B == 0: return A return gcd(B, A % B) if A < B: A, B = (B, A) c = gcd(A, B) maxmin = A * B // c t1 = maxmin // A + maxmin // B - 1 d = N // t1 r = N % t1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nthMagicalNumber(self, N, A, B): """:type N: int :type A: int :type B: int :rtype: int 144 ms""" <|body_0|> def nthMagicalNumber_1(self, N, A, B): """28MS :param N: :param A: :param B: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001104
2,205
no_license
[ { "docstring": ":type N: int :type A: int :type B: int :rtype: int 144 ms", "name": "nthMagicalNumber", "signature": "def nthMagicalNumber(self, N, A, B)" }, { "docstring": "28MS :param N: :param A: :param B: :return:", "name": "nthMagicalNumber_1", "signature": "def nthMagicalNumber_1(s...
2
stack_v2_sparse_classes_30k_train_016686
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nthMagicalNumber(self, N, A, B): :type N: int :type A: int :type B: int :rtype: int 144 ms - def nthMagicalNumber_1(self, N, A, B): 28MS :param N: :param A: :param B: :return...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nthMagicalNumber(self, N, A, B): :type N: int :type A: int :type B: int :rtype: int 144 ms - def nthMagicalNumber_1(self, N, A, B): 28MS :param N: :param A: :param B: :return...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def nthMagicalNumber(self, N, A, B): """:type N: int :type A: int :type B: int :rtype: int 144 ms""" <|body_0|> def nthMagicalNumber_1(self, N, A, B): """28MS :param N: :param A: :param B: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def nthMagicalNumber(self, N, A, B): """:type N: int :type A: int :type B: int :rtype: int 144 ms""" import heapq def gcd(A, B): if B == 0: return A return gcd(B, A % B) if A < B: A, B = (B, A) c = gcd(A, B)...
the_stack_v2_python_sparse
NthMagicalNumber_HARD_878.py
953250587/leetcode-python
train
2
ed62a18590d04c2e0abd79169cc74f77220acd95
[ "self.nuts = [Coconut(variety) for variety in ['middle eastern', 'south asian', 'american']]\nself.weights = [2.5, 3.0, 3.5]\nfor i in range(0, 3):\n self.assertEqual(self.nuts[i]._Coconut__weight, self.weights[i], 'The weight is wrong')", "varieties = [Coconut(variety) for variety in ['middle eastern', 'south...
<|body_start_0|> self.nuts = [Coconut(variety) for variety in ['middle eastern', 'south asian', 'american']] self.weights = [2.5, 3.0, 3.5] for i in range(0, 3): self.assertEqual(self.nuts[i]._Coconut__weight, self.weights[i], 'The weight is wrong') <|end_body_0|> <|body_start_1|> ...
TestCoconuts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" <|body_0|> def test_total_weight(self): """Tests that the sum of a specified number of coconuts of each type returned matches the expected total""" <|bo...
stack_v2_sparse_classes_75kplus_train_001105
2,241
no_license
[ { "docstring": "Tests that different coconut types each have a different weight", "name": "test_weight", "signature": "def test_weight(self)" }, { "docstring": "Tests that the sum of a specified number of coconuts of each type returned matches the expected total", "name": "test_total_weight"...
3
stack_v2_sparse_classes_30k_train_012118
Implement the Python class `TestCoconuts` described below. Class description: Implement the TestCoconuts class. Method signatures and docstrings: - def test_weight(self): Tests that different coconut types each have a different weight - def test_total_weight(self): Tests that the sum of a specified number of coconuts...
Implement the Python class `TestCoconuts` described below. Class description: Implement the TestCoconuts class. Method signatures and docstrings: - def test_weight(self): Tests that different coconut types each have a different weight - def test_total_weight(self): Tests that the sum of a specified number of coconuts...
4ca74dd054be17e7a57da891c5d239e3f915d3f1
<|skeleton|> class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" <|body_0|> def test_total_weight(self): """Tests that the sum of a specified number of coconuts of each type returned matches the expected total""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCoconuts: def test_weight(self): """Tests that different coconut types each have a different weight""" self.nuts = [Coconut(variety) for variety in ['middle eastern', 'south asian', 'american']] self.weights = [2.5, 3.0, 3.5] for i in range(0, 3): self.assertEqu...
the_stack_v2_python_sparse
Lesson 2 - Converting Data Into Structured Objects/project/attempt_1/test_coconuts.py
jmwoloso/Python_3
train
0
6e3d45fa4b81340a1eeea23533780054804ca0b7
[ "if isinstance(data, str):\n data = json.loads(data)\ntry:\n customer = QueryCustomersModel.objects.get(id=data['id'])\n customer.update(name=data.get('name', customer.name), phone=data.get('phone', customer.phone), email=data.get('email', customer.email), full_name=data.get('full_name', customer.full_name...
<|body_start_0|> if isinstance(data, str): data = json.loads(data) try: customer = QueryCustomersModel.objects.get(id=data['id']) customer.update(name=data.get('name', customer.name), phone=data.get('phone', customer.phone), email=data.get('email', customer.email), fu...
Query
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: def normalize_db(self, data): """with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database""" <|body_0|> def list(self, num_page=1, limit=...
stack_v2_sparse_classes_75kplus_train_001106
12,821
no_license
[ { "docstring": "with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database", "name": "normalize_db", "signature": "def normalize_db(self, data)" }, { "docstring": "ret...
3
stack_v2_sparse_classes_30k_train_051041
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def normalize_db(self, data): with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add...
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def normalize_db(self, data): with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add...
3f4c93c631e5d5b52acd2ce11e220ff3fbec07b6
<|skeleton|> class Query: def normalize_db(self, data): """with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database""" <|body_0|> def list(self, num_page=1, limit=...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Query: def normalize_db(self, data): """with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database""" if isinstance(data, str): data = json.loads(data) ...
the_stack_v2_python_sparse
customers/customers/service.py
bsmi021/eahub_shopco
train
0
81a8a2cb11688874d8203235090f5aab4e337ab4
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AuthenticationStrengthRoot()", "from .authentication_method_mode_detail import AuthenticationMethodModeDetail\nfrom .authentication_method_modes import AuthenticationMethodModes\nfrom .authentication_strength_policy import Authenticati...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AuthenticationStrengthRoot() <|end_body_0|> <|body_start_1|> from .authentication_method_mode_detail import AuthenticationMethodModeDetail from .authentication_method_modes import Authen...
AuthenticationStrengthRoot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationStrengthRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: """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...
stack_v2_sparse_classes_75kplus_train_001107
3,660
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: AuthenticationStrengthRoot", "name": "create_from_discriminator_value", "signature": "def create_from_discri...
3
stack_v2_sparse_classes_30k_train_045602
Implement the Python class `AuthenticationStrengthRoot` described below. Class description: Implement the AuthenticationStrengthRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: Creates a new instance of the appropr...
Implement the Python class `AuthenticationStrengthRoot` described below. Class description: Implement the AuthenticationStrengthRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: Creates a new instance of the appropr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AuthenticationStrengthRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: """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...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthenticationStrengthRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: """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 ob...
the_stack_v2_python_sparse
msgraph/generated/models/authentication_strength_root.py
microsoftgraph/msgraph-sdk-python
train
135
c5c8881bd0be191f11f319032efc6f9d1dd40f21
[ "res = defaultdict(list)\nfor s in strs:\n res[tuple(sorted(s))].append(s)\nreturn list(res.values())", "res = defaultdict(list)\nfor s in strs:\n count = [0] * 26\n for c in s:\n count[ord(c) - ord('a')] += 1\n res[tuple(count)].append(s)\nreturn list(res.values())" ]
<|body_start_0|> res = defaultdict(list) for s in strs: res[tuple(sorted(s))].append(s) return list(res.values()) <|end_body_0|> <|body_start_1|> res = defaultdict(list) for s in strs: count = [0] * 26 for c in s: count[ord(c) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams(self, strs: list[str]) -> list[str]: """方法一:排序数组分类 思路 当且仅当它们的排序字符串相等时,两个字符串是字母异位词""" <|body_0|> def fun2(self, strs): """方法二:按计数分类 思路 当且仅当它们的字符计数(每个字符的出现次数)相同时,两个字符串是字母异位词。""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001108
858
no_license
[ { "docstring": "方法一:排序数组分类 思路 当且仅当它们的排序字符串相等时,两个字符串是字母异位词", "name": "groupAnagrams", "signature": "def groupAnagrams(self, strs: list[str]) -> list[str]" }, { "docstring": "方法二:按计数分类 思路 当且仅当它们的字符计数(每个字符的出现次数)相同时,两个字符串是字母异位词。", "name": "fun2", "signature": "def fun2(self, strs)" } ]
2
stack_v2_sparse_classes_30k_train_042378
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs: list[str]) -> list[str]: 方法一:排序数组分类 思路 当且仅当它们的排序字符串相等时,两个字符串是字母异位词 - def fun2(self, strs): 方法二:按计数分类 思路 当且仅当它们的字符计数(每个字符的出现次数)相同时,两个字符串是字母异位词。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs: list[str]) -> list[str]: 方法一:排序数组分类 思路 当且仅当它们的排序字符串相等时,两个字符串是字母异位词 - def fun2(self, strs): 方法二:按计数分类 思路 当且仅当它们的字符计数(每个字符的出现次数)相同时,两个字符串是字母异位词。 <|sk...
0b10f5731690da7998add288e4b0b87d5d71a97e
<|skeleton|> class Solution: def groupAnagrams(self, strs: list[str]) -> list[str]: """方法一:排序数组分类 思路 当且仅当它们的排序字符串相等时,两个字符串是字母异位词""" <|body_0|> def fun2(self, strs): """方法二:按计数分类 思路 当且仅当它们的字符计数(每个字符的出现次数)相同时,两个字符串是字母异位词。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def groupAnagrams(self, strs: list[str]) -> list[str]: """方法一:排序数组分类 思路 当且仅当它们的排序字符串相等时,两个字符串是字母异位词""" res = defaultdict(list) for s in strs: res[tuple(sorted(s))].append(s) return list(res.values()) def fun2(self, strs): """方法二:按计数分类 思路 当且仅当它...
the_stack_v2_python_sparse
leetcode/leetcode/49.字母异位词分组.py
GGL12/myStudy
train
0
f4c9340eefcb732230114ea40ac0669179df6f2f
[ "self.domain = domain\nself.web_messaging = web_messaging\nself.height = height\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\ndomain = dictionary.get('Domain')\nweb_messaging = dictionary.get('WebMessaging')\nheight = dictionary.get('Height')\nfor key in cls._name...
<|body_start_0|> self.domain = domain self.web_messaging = web_messaging self.height = height self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None domain = dictionary.get('Domain') web_m...
Implementation of the 'iFrameSettings' model. iFrame settings REMARK! If using iframe the parent site have to be on https Attributes: domain (string): The domain of the site hosting the iFrame, this is used for the CSP policy and must be correct. web_messaging (bool): Should WebMessaging be used for redirect of the iFr...
IFrameSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IFrameSettings: """Implementation of the 'iFrameSettings' model. iFrame settings REMARK! If using iframe the parent site have to be on https Attributes: domain (string): The domain of the site hosting the iFrame, this is used for the CSP policy and must be correct. web_messaging (bool): Should We...
stack_v2_sparse_classes_75kplus_train_001109
2,722
permissive
[ { "docstring": "Constructor for the IFrameSettings class", "name": "__init__", "signature": "def __init__(self, domain=None, web_messaging=None, height=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A diction...
2
null
Implement the Python class `IFrameSettings` described below. Class description: Implementation of the 'iFrameSettings' model. iFrame settings REMARK! If using iframe the parent site have to be on https Attributes: domain (string): The domain of the site hosting the iFrame, this is used for the CSP policy and must be c...
Implement the Python class `IFrameSettings` described below. Class description: Implementation of the 'iFrameSettings' model. iFrame settings REMARK! If using iframe the parent site have to be on https Attributes: domain (string): The domain of the site hosting the iFrame, this is used for the CSP policy and must be c...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class IFrameSettings: """Implementation of the 'iFrameSettings' model. iFrame settings REMARK! If using iframe the parent site have to be on https Attributes: domain (string): The domain of the site hosting the iFrame, this is used for the CSP policy and must be correct. web_messaging (bool): Should We...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IFrameSettings: """Implementation of the 'iFrameSettings' model. iFrame settings REMARK! If using iframe the parent site have to be on https Attributes: domain (string): The domain of the site hosting the iFrame, this is used for the CSP policy and must be correct. web_messaging (bool): Should WebMessaging be...
the_stack_v2_python_sparse
idfy_rest_client/models/i_frame_settings.py
dealflowteam/Idfy
train
0
114dd65d8d613ffa225a4399c84274f74e7e5fde
[ "self.onefuzz._warn_preview(PreviewFeature.job_templates)\nself.onefuzz.logger.debug('listing job templates')\nreturn self._req_model_list('GET', JobTemplateIndex, data=JobTemplateGet(name=None))", "self.onefuzz._warn_preview(PreviewFeature.job_templates)\nself.onefuzz.logger.debug('get job template')\nreturn sel...
<|body_start_0|> self.onefuzz._warn_preview(PreviewFeature.job_templates) self.onefuzz.logger.debug('listing job templates') return self._req_model_list('GET', JobTemplateIndex, data=JobTemplateGet(name=None)) <|end_body_0|> <|body_start_1|> self.onefuzz._warn_preview(PreviewFeature.job...
Manage Job Templates
Manage
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manage: """Manage Job Templates""" def list(self) -> List[JobTemplateIndex]: """List templates""" <|body_0|> def get(self, name: str) -> JobTemplate: """Get an existing Job Template""" <|body_1|> def upload(self, name: str, template: JobTemplate) -> ...
stack_v2_sparse_classes_75kplus_train_001110
1,790
permissive
[ { "docstring": "List templates", "name": "list", "signature": "def list(self) -> List[JobTemplateIndex]" }, { "docstring": "Get an existing Job Template", "name": "get", "signature": "def get(self, name: str) -> JobTemplate" }, { "docstring": "Upload a Job Template", "name": ...
4
stack_v2_sparse_classes_30k_train_014198
Implement the Python class `Manage` described below. Class description: Manage Job Templates Method signatures and docstrings: - def list(self) -> List[JobTemplateIndex]: List templates - def get(self, name: str) -> JobTemplate: Get an existing Job Template - def upload(self, name: str, template: JobTemplate) -> Bool...
Implement the Python class `Manage` described below. Class description: Manage Job Templates Method signatures and docstrings: - def list(self) -> List[JobTemplateIndex]: List templates - def get(self, name: str) -> JobTemplate: Get an existing Job Template - def upload(self, name: str, template: JobTemplate) -> Bool...
f141050bbbf7ddc6f42881cb82ded38e2924fdb3
<|skeleton|> class Manage: """Manage Job Templates""" def list(self) -> List[JobTemplateIndex]: """List templates""" <|body_0|> def get(self, name: str) -> JobTemplate: """Get an existing Job Template""" <|body_1|> def upload(self, name: str, template: JobTemplate) -> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Manage: """Manage Job Templates""" def list(self) -> List[JobTemplateIndex]: """List templates""" self.onefuzz._warn_preview(PreviewFeature.job_templates) self.onefuzz.logger.debug('listing job templates') return self._req_model_list('GET', JobTemplateIndex, data=JobTempla...
the_stack_v2_python_sparse
src/cli/onefuzz/job_templates/manage.py
microsoft/onefuzz
train
2,998
341a71566b9a7ccdb72765b6112b42e696647dc0
[ "if architecture not in _OUTPUT_DIM.keys():\n raise ValueError('Architecture {} is not supported.'.format(architecture))\nsuper(GlobalFeatureNet, self).__init__()\ndim = _OUTPUT_DIM[architecture]\nif pretrained:\n net_in = getattr(tf.keras.applications, architecture)(include_top=False, weights='imagenet')\nel...
<|body_start_0|> if architecture not in _OUTPUT_DIM.keys(): raise ValueError('Architecture {} is not supported.'.format(architecture)) super(GlobalFeatureNet, self).__init__() dim = _OUTPUT_DIM[architecture] if pretrained: net_in = getattr(tf.keras.applications, a...
Instantiates global model for image retrieval. This class implements the [GlobalFeatureNet]( https://arxiv.org/abs/1711.02512) for image retrieval. The model uses a user-defined model as a backbone.
GlobalFeatureNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalFeatureNet: """Instantiates global model for image retrieval. This class implements the [GlobalFeatureNet]( https://arxiv.org/abs/1711.02512) for image retrieval. The model uses a user-defined model as a backbone.""" def __init__(self, architecture='ResNet101', pooling='gem', whitening...
stack_v2_sparse_classes_75kplus_train_001111
10,634
permissive
[ { "docstring": "GlobalFeatureNet network initialization. Args: architecture: Network backbone. pooling: Pooling method used 'mac'/'spoc'/'gem'. whitening: Bool, whether to use whitening. pretrained: Bool, whether to initialize the network with the weights pretrained on ImageNet. data_root: String, path to the d...
3
stack_v2_sparse_classes_30k_train_013946
Implement the Python class `GlobalFeatureNet` described below. Class description: Instantiates global model for image retrieval. This class implements the [GlobalFeatureNet]( https://arxiv.org/abs/1711.02512) for image retrieval. The model uses a user-defined model as a backbone. Method signatures and docstrings: - d...
Implement the Python class `GlobalFeatureNet` described below. Class description: Instantiates global model for image retrieval. This class implements the [GlobalFeatureNet]( https://arxiv.org/abs/1711.02512) for image retrieval. The model uses a user-defined model as a backbone. Method signatures and docstrings: - d...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class GlobalFeatureNet: """Instantiates global model for image retrieval. This class implements the [GlobalFeatureNet]( https://arxiv.org/abs/1711.02512) for image retrieval. The model uses a user-defined model as a backbone.""" def __init__(self, architecture='ResNet101', pooling='gem', whitening...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlobalFeatureNet: """Instantiates global model for image retrieval. This class implements the [GlobalFeatureNet]( https://arxiv.org/abs/1711.02512) for image retrieval. The model uses a user-defined model as a backbone.""" def __init__(self, architecture='ResNet101', pooling='gem', whitening=False, pretr...
the_stack_v2_python_sparse
research/delf/delf/python/training/model/global_model.py
jianzhnie/models
train
2
4621d21bed8d7a6cee75c40f3b148beced6c1c80
[ "from mercury.plugin import AbstractFactory, PUMappingStrategy\nself.edc_id: str = edc_config.edc_id\nself.srv_priority: list[str] = srv_priority\nself.pu_twins: list[ProcessingUnit] = list()\nfor pu_id, pu_config in edc_config.pu_configs.items():\n self.pu_twins.append(ProcessingUnit(f'{pu_id}_slicer', pu_id, p...
<|body_start_0|> from mercury.plugin import AbstractFactory, PUMappingStrategy self.edc_id: str = edc_config.edc_id self.srv_priority: list[str] = srv_priority self.pu_twins: list[ProcessingUnit] = list() for pu_id, pu_config in edc_config.pu_configs.items(): self.pu_...
EDCResourceSlicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EDCResourceSlicer: def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): """Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priori...
stack_v2_sparse_classes_75kplus_train_001112
2,763
permissive
[ { "docstring": "Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priority. :param edc_config: configuration parameters of the EDC.", "name": "__init__", "signature": "def _...
2
stack_v2_sparse_classes_30k_train_006601
Implement the Python class `EDCResourceSlicer` described below. Class description: Implement the EDCResourceSlicer class. Method signatures and docstrings: - def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): Edge Data Center resource slicer. :param srv_priority: list of services in decrea...
Implement the Python class `EDCResourceSlicer` described below. Class description: Implement the EDCResourceSlicer class. Method signatures and docstrings: - def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): Edge Data Center resource slicer. :param srv_priority: list of services in decrea...
cb425605de3341d27ce43fb326b300cb8ac781f6
<|skeleton|> class EDCResourceSlicer: def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): """Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priori...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EDCResourceSlicer: def __init__(self, edc_config: EdgeDataCenterConfig, srv_priority: list[str]): """Edge Data Center resource slicer. :param srv_priority: list of services in decreasing priority order. The resource slicer will allocate first resources for the services with higher priority. :param edc...
the_stack_v2_python_sparse
mercury/model/edcs/edc/r_manager/slicer.py
greenlsi/mercury_mso_framework
train
2
7ca47e81214e5546d9461b862e88b271a5d86ded
[ "if not isinstance(user, User):\n raise TypeError()\nq = self._klass.gql('WHERE user = :1 AND has = \"done:T\" ORDER BY modified DESC', user)\np = PagedQuery(q, id=query_id)\nreturn [p.id, p.fetch_page(page)]", "if not isinstance(user, User):\n raise TypeError()\nq = self._klass.gql('WHERE user = :1 AND has...
<|body_start_0|> if not isinstance(user, User): raise TypeError() q = self._klass.gql('WHERE user = :1 AND has = "done:T" ORDER BY modified DESC', user) p = PagedQuery(q, id=query_id) return [p.id, p.fetch_page(page)] <|end_body_0|> <|body_start_1|> if not isinstance...
AlertHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlertHelper: def get_by_user_done(self, user, page=1, query_id=None): """Obtiene una lista con todos los Eventos de un usuario""" <|body_0|> def get_by_user_undone(self, user, page=1, query_id=None): """Obtiene una lista con todos los Eventos de un usuario""" ...
stack_v2_sparse_classes_75kplus_train_001113
3,112
no_license
[ { "docstring": "Obtiene una lista con todos los Eventos de un usuario", "name": "get_by_user_done", "signature": "def get_by_user_done(self, user, page=1, query_id=None)" }, { "docstring": "Obtiene una lista con todos los Eventos de un usuario", "name": "get_by_user_undone", "signature":...
2
null
Implement the Python class `AlertHelper` described below. Class description: Implement the AlertHelper class. Method signatures and docstrings: - def get_by_user_done(self, user, page=1, query_id=None): Obtiene una lista con todos los Eventos de un usuario - def get_by_user_undone(self, user, page=1, query_id=None): ...
Implement the Python class `AlertHelper` described below. Class description: Implement the AlertHelper class. Method signatures and docstrings: - def get_by_user_done(self, user, page=1, query_id=None): Obtiene una lista con todos los Eventos de un usuario - def get_by_user_undone(self, user, page=1, query_id=None): ...
f8315a2d37db6dca26c8b4af100fd6f1d6fcae20
<|skeleton|> class AlertHelper: def get_by_user_done(self, user, page=1, query_id=None): """Obtiene una lista con todos los Eventos de un usuario""" <|body_0|> def get_by_user_undone(self, user, page=1, query_id=None): """Obtiene una lista con todos los Eventos de un usuario""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlertHelper: def get_by_user_done(self, user, page=1, query_id=None): """Obtiene una lista con todos los Eventos de un usuario""" if not isinstance(user, User): raise TypeError() q = self._klass.gql('WHERE user = :1 AND has = "done:T" ORDER BY modified DESC', user) ...
the_stack_v2_python_sparse
trunk/src/webapp/geoalert/helpers.py
hhkaos/GeoRemindMe_Web
train
0
01d74009f652435a584d412cb72f39071a096ce0
[ "self._targets_and_priorities = targets_and_priorities\nself._queue_name = queue_name\nsuper(NotificationPikaPoller, self).__init__(pika_engine, batch_size, batch_timeout, prefetch_count, pika_drv_msg.PikaIncomingMessage)", "queues_to_consume = []\nfor target, priority in self._targets_and_priorities:\n routin...
<|body_start_0|> self._targets_and_priorities = targets_and_priorities self._queue_name = queue_name super(NotificationPikaPoller, self).__init__(pika_engine, batch_size, batch_timeout, prefetch_count, pika_drv_msg.PikaIncomingMessage) <|end_body_0|> <|body_start_1|> queues_to_consume =...
PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific
NotificationPikaPoller
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationPikaPoller: """PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific""" def __init__(self, pika_engine, targets_and_priorities, batch_size, batch_timeout, prefetch_count, queue_name=None): """Adds targ...
stack_v2_sparse_classes_75kplus_train_001114
22,231
permissive
[ { "docstring": "Adds targets_and_priorities and queue_name parameter for declaring exchanges and queues used for notification delivery :param pika_engine: PikaEngine, shared object with configuration and shared driver functionality :param targets_and_priorities: list of (target, priority), defines default queue...
2
stack_v2_sparse_classes_30k_train_030872
Implement the Python class `NotificationPikaPoller` described below. Class description: PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific Method signatures and docstrings: - def __init__(self, pika_engine, targets_and_priorities, batch_size, b...
Implement the Python class `NotificationPikaPoller` described below. Class description: PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific Method signatures and docstrings: - def __init__(self, pika_engine, targets_and_priorities, batch_size, b...
c01951b33e278de9e769c2d0609c0be61d2cb26b
<|skeleton|> class NotificationPikaPoller: """PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific""" def __init__(self, pika_engine, targets_and_priorities, batch_size, batch_timeout, prefetch_count, queue_name=None): """Adds targ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationPikaPoller: """PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific""" def __init__(self, pika_engine, targets_and_priorities, batch_size, batch_timeout, prefetch_count, queue_name=None): """Adds targets_and_prior...
the_stack_v2_python_sparse
filesystems/vnx_rootfs_lxc_ubuntu64-16.04-v025-openstack-compute/rootfs/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/pika_driver/pika_poller.py
juancarlosdiaztorres/Ansible-OpenStack
train
0
c0a26c4ee40c5e7a1bc91eb030c4c311b14be04b
[ "self._filter_configuration = filter_configuration\nself._output_format = output_format\nself.max_reports_per_category = max_reports_per_category\nself.min_confidence = min_confidence\nself.stderr_write = stderr_write", "if confidence_in_error < self.min_confidence:\n return False\nreturn self._filter_configur...
<|body_start_0|> self._filter_configuration = filter_configuration self._output_format = output_format self.max_reports_per_category = max_reports_per_category self.min_confidence = min_confidence self.stderr_write = stderr_write <|end_body_0|> <|body_start_1|> if confid...
Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category, per file. stderr_write: A function that takes a string...
StyleProcessorConfiguration
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyleProcessorConfiguration: """Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category,...
stack_v2_sparse_classes_75kplus_train_001115
23,775
permissive
[ { "docstring": "Create a StyleProcessorConfiguration instance. Args: filter_configuration: A FilterConfiguration instance. The default is the \"empty\" filter configuration, which means that all errors should be checked. max_reports_per_category: The maximum number of errors to report per category, per file. mi...
3
stack_v2_sparse_classes_30k_train_037513
Implement the Python class `StyleProcessorConfiguration` described below. Class description: Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum n...
Implement the Python class `StyleProcessorConfiguration` described below. Class description: Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum n...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class StyleProcessorConfiguration: """Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StyleProcessorConfiguration: """Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category, per file. st...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/style/checker.py
chromium/chromium
train
17,408
6cfee43b0338e9d172c4ca80bc8a6451963240fd
[ "super().__init__()\nself.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)\nself.conv2 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True)\nself.relu = nn.ReLU(inplace=True)", "out = self.relu(x)\nout = self.conv1(out)\nout = self.relu(out)\nout = sel...
<|body_start_0|> super().__init__() self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True) self.conv2 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True) self.relu = nn.ReLU(inplace=True) <|end_body_0|> <|body_start_1|> ...
Residual convolution module.
ResidualConvUnit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualConvUnit: """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, x): """Forward pass. Args: x (tensor): input Returns: tensor: output""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_001116
17,410
permissive
[ { "docstring": "Init. Args: features (int): number of features", "name": "__init__", "signature": "def __init__(self, features)" }, { "docstring": "Forward pass. Args: x (tensor): input Returns: tensor: output", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_031580
Implement the Python class `ResidualConvUnit` described below. Class description: Residual convolution module. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, x): Forward pass. Args: x (tensor): input Returns: tensor: output
Implement the Python class `ResidualConvUnit` described below. Class description: Residual convolution module. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, x): Forward pass. Args: x (tensor): input Returns: tensor: output <|skele...
a00c3619bf4042e446e1919087f0b09fe9fa3a65
<|skeleton|> class ResidualConvUnit: """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, x): """Forward pass. Args: x (tensor): input Returns: tensor: output""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResidualConvUnit: """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features""" super().__init__() self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1, padding=1, bias=True) self.conv2 = nn.Conv2d(featu...
the_stack_v2_python_sparse
nasws/cnn/search_space/monodepth/models/blocks.py
kcyu2014/nas-landmarkreg
train
10
d925d5d9b898cc2875db4b9bf2c51221e80f63be
[ "self.fat_tensor, paths = torch.load(os.path.join('..', visual_features_pth))\nself.mapper = dict(zip(paths, range(len(paths))))\nassert len(paths) == self.fat_tensor.size(0)\nself.pad = [0.0] * 4096\nself.max_len_images = max_len_images", "images = [self.fat_tensor[self.mapper[p]].numpy().tolist() for p in image...
<|body_start_0|> self.fat_tensor, paths = torch.load(os.path.join('..', visual_features_pth)) self.mapper = dict(zip(paths, range(len(paths)))) assert len(paths) == self.fat_tensor.size(0) self.pad = [0.0] * 4096 self.max_len_images = max_len_images <|end_body_0|> <|body_start_1...
ImagesUnit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImagesUnit: def __init__(self, visual_features_pth: str, max_len_images: int): """Parameters ---------- visual_features_pth: str the path to pre-extracted features from images max_len_images: str the maxinum number of images used""" <|body_0|> def transform(self, images: str...
stack_v2_sparse_classes_75kplus_train_001117
7,523
permissive
[ { "docstring": "Parameters ---------- visual_features_pth: str the path to pre-extracted features from images max_len_images: str the maxinum number of images used", "name": "__init__", "signature": "def __init__(self, visual_features_pth: str, max_len_images: int)" }, { "docstring": "Process in...
2
stack_v2_sparse_classes_30k_train_040974
Implement the Python class `ImagesUnit` described below. Class description: Implement the ImagesUnit class. Method signatures and docstrings: - def __init__(self, visual_features_pth: str, max_len_images: int): Parameters ---------- visual_features_pth: str the path to pre-extracted features from images max_len_image...
Implement the Python class `ImagesUnit` described below. Class description: Implement the ImagesUnit class. Method signatures and docstrings: - def __init__(self, visual_features_pth: str, max_len_images: int): Parameters ---------- visual_features_pth: str the path to pre-extracted features from images max_len_image...
db101beed691a0e399f9b0b19fb59c7dc8b16760
<|skeleton|> class ImagesUnit: def __init__(self, visual_features_pth: str, max_len_images: int): """Parameters ---------- visual_features_pth: str the path to pre-extracted features from images max_len_images: str the maxinum number of images used""" <|body_0|> def transform(self, images: str...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImagesUnit: def __init__(self, visual_features_pth: str, max_len_images: int): """Parameters ---------- visual_features_pth: str the path to pre-extracted features from images max_len_images: str the maxinum number of images used""" self.fat_tensor, paths = torch.load(os.path.join('..', visual...
the_stack_v2_python_sparse
matchzoo/preprocessors/bow_preprocessor.py
nguyenvo09/LearningFromFactCheckers
train
11
a881f03c97164a6b8f92672d82326919fa0743ed
[ "parser = ArgumentParser()\nparser.add_argument('--version', '-v')\nparser.add_argument('--model', '-m')\nargs, unknown = parser.parse_known_args(shlex.split(arg_line))\nif args.model is None:\n raise ValueError(\"The parameter 'model' is required.\")\nif args.version is None:\n raise ValueError(\"The paramet...
<|body_start_0|> parser = ArgumentParser() parser.add_argument('--version', '-v') parser.add_argument('--model', '-m') args, unknown = parser.parse_known_args(shlex.split(arg_line)) if args.model is None: raise ValueError("The parameter 'model' is required.") ...
InputParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputParser: def parse_set_device_info_args(self, arg_line): """:type arg_line: string :rtype: DeviceInfo""" <|body_0|> def parse_list_args(self, arg_line): """:type arg_line: string :rtype: (string, DataSource, DeviceInfo)""" <|body_1|> def parse_execut...
stack_v2_sparse_classes_75kplus_train_001118
4,574
no_license
[ { "docstring": ":type arg_line: string :rtype: DeviceInfo", "name": "parse_set_device_info_args", "signature": "def parse_set_device_info_args(self, arg_line)" }, { "docstring": ":type arg_line: string :rtype: (string, DataSource, DeviceInfo)", "name": "parse_list_args", "signature": "de...
5
stack_v2_sparse_classes_30k_train_004746
Implement the Python class `InputParser` described below. Class description: Implement the InputParser class. Method signatures and docstrings: - def parse_set_device_info_args(self, arg_line): :type arg_line: string :rtype: DeviceInfo - def parse_list_args(self, arg_line): :type arg_line: string :rtype: (string, Dat...
Implement the Python class `InputParser` described below. Class description: Implement the InputParser class. Method signatures and docstrings: - def parse_set_device_info_args(self, arg_line): :type arg_line: string :rtype: DeviceInfo - def parse_list_args(self, arg_line): :type arg_line: string :rtype: (string, Dat...
88b773fc3516db70d7f61de8fc5317dc8702df13
<|skeleton|> class InputParser: def parse_set_device_info_args(self, arg_line): """:type arg_line: string :rtype: DeviceInfo""" <|body_0|> def parse_list_args(self, arg_line): """:type arg_line: string :rtype: (string, DataSource, DeviceInfo)""" <|body_1|> def parse_execut...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputParser: def parse_set_device_info_args(self, arg_line): """:type arg_line: string :rtype: DeviceInfo""" parser = ArgumentParser() parser.add_argument('--version', '-v') parser.add_argument('--model', '-m') args, unknown = parser.parse_known_args(shlex.split(arg_lin...
the_stack_v2_python_sparse
components/input_parser.py
juandiana/android-inspector
train
0
ae0c89122b0b25bb91f45d8b43586a5d87704185
[ "res = []\nself.dfs(root, res)\nreturn res", "if root:\n self.dfs(root.left, res)\n self.dfs(root.right, res)\n res.append(root.val)", "if not root:\n return []\nstack, res = ([root], [])\nwhile stack:\n node = stack.pop()\n if node.left:\n stack.append(node.left)\n if node.right:\n ...
<|body_start_0|> res = [] self.dfs(root, res) return res <|end_body_0|> <|body_start_1|> if root: self.dfs(root.left, res) self.dfs(root.right, res) res.append(root.val) <|end_body_1|> <|body_start_2|> if not root: return [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def dfs(self, root, res): """:type root: TreeNode :type res: List[int] :rtype: None""" <|body_1|> def postorderTraversal_1(self, root): """:type...
stack_v2_sparse_classes_75kplus_train_001119
2,233
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "postorderTraversal", "signature": "def postorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :type res: List[int] :rtype: None", "name": "dfs", "signature": "def dfs(self, root, res)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_052921
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def dfs(self, root, res): :type root: TreeNode :type res: List[int] :rtype: None - def postorderTrave...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def dfs(self, root, res): :type root: TreeNode :type res: List[int] :rtype: None - def postorderTrave...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def dfs(self, root, res): """:type root: TreeNode :type res: List[int] :rtype: None""" <|body_1|> def postorderTraversal_1(self, root): """:type...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" res = [] self.dfs(root, res) return res def dfs(self, root, res): """:type root: TreeNode :type res: List[int] :rtype: None""" if root: self.dfs(root.left...
the_stack_v2_python_sparse
Solutions/0145_postorderTraversal.py
YoupengLi/leetcode-sorting
train
3
2170a6771d53b47cd8e37244b64a00f93f8f27b9
[ "def filter(d, max):\n \"\"\" filters dataset by max_len \"\"\"\n return tf.math.less(d, max)\nself.batch_size = batch_size\ntrain = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(train)\nself.data_train = train.map(sel...
<|body_start_0|> def filter(d, max): """ filters dataset by max_len """ return tf.math.less(d, max) self.batch_size = batch_size train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) self.tokenizer_pt, self.tokenizer_en = self.tokeniz...
loads and preps a dataset for machine translation
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """loads and preps a dataset for machine translation""" def __init__(self, batch_size, max_len): """batch_size is the batch size for training/validation max_len is the maximum number of tokens allowed per example sentence data_train, which contains the ted_hrlr_translate/pt_...
stack_v2_sparse_classes_75kplus_train_001120
5,014
no_license
[ { "docstring": "batch_size is the batch size for training/validation max_len is the maximum number of tokens allowed per example sentence data_train, which contains the ted_hrlr_translate/pt_to en tf.data.Dataset train split, loaded as_supervided data_valid, which contains the ted_hrlr_translate/pt to_en tf.dat...
4
stack_v2_sparse_classes_30k_train_009887
Implement the Python class `Dataset` described below. Class description: loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self, batch_size, max_len): batch_size is the batch size for training/validation max_len is the maximum number of tokens allowed per example sente...
Implement the Python class `Dataset` described below. Class description: loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self, batch_size, max_len): batch_size is the batch size for training/validation max_len is the maximum number of tokens allowed per example sente...
5114f884241b3406940b00450d8c71f55d5d6a70
<|skeleton|> class Dataset: """loads and preps a dataset for machine translation""" def __init__(self, batch_size, max_len): """batch_size is the batch size for training/validation max_len is the maximum number of tokens allowed per example sentence data_train, which contains the ted_hrlr_translate/pt_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dataset: """loads and preps a dataset for machine translation""" def __init__(self, batch_size, max_len): """batch_size is the batch size for training/validation max_len is the maximum number of tokens allowed per example sentence data_train, which contains the ted_hrlr_translate/pt_to en tf.data...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/3-dataset.py
icculp/holbertonschool-machine_learning
train
0
386421f654c08464b1b39fe6b7b4242629c9d255
[ "self._recv_packet = []\nself.packet_buffer = []\nself.buf = []\nself.is_new_packet = False\nself.num_packets = 0\nself.comm_object = None", "self.num_packets = 0\nself.is_new_packet = False\nfor i in range(0, 6):\n if len(self.buf) < 8:\n return self.num_packets\n try:\n packet_end = self.buf...
<|body_start_0|> self._recv_packet = [] self.packet_buffer = [] self.buf = [] self.is_new_packet = False self.num_packets = 0 self.comm_object = None <|end_body_0|> <|body_start_1|> self.num_packets = 0 self.is_new_packet = False for i in range(0,...
class to handle low-level work of processing FlightGear packets out of a data stream from some input source This is a worker super-class, you should use the inherited classes which implement a specific interface (UDP or TCP)
FlightGearParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlightGearParser: """class to handle low-level work of processing FlightGear packets out of a data stream from some input source This is a worker super-class, you should use the inherited classes which implement a specific interface (UDP or TCP)""" def __init__(self): """constructor ...
stack_v2_sparse_classes_75kplus_train_001121
6,640
permissive
[ { "docstring": "constructor intializes the parser variable Args: no args Returns: FlightGearParser instance", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "parse the buffer to find packets searches buffer for packets, returns the number of packets found Args: no args R...
3
null
Implement the Python class `FlightGearParser` described below. Class description: class to handle low-level work of processing FlightGear packets out of a data stream from some input source This is a worker super-class, you should use the inherited classes which implement a specific interface (UDP or TCP) Method sign...
Implement the Python class `FlightGearParser` described below. Class description: class to handle low-level work of processing FlightGear packets out of a data stream from some input source This is a worker super-class, you should use the inherited classes which implement a specific interface (UDP or TCP) Method sign...
6827886916e36432ce1d806f0a78edef6c9270d9
<|skeleton|> class FlightGearParser: """class to handle low-level work of processing FlightGear packets out of a data stream from some input source This is a worker super-class, you should use the inherited classes which implement a specific interface (UDP or TCP)""" def __init__(self): """constructor ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlightGearParser: """class to handle low-level work of processing FlightGear packets out of a data stream from some input source This is a worker super-class, you should use the inherited classes which implement a specific interface (UDP or TCP)""" def __init__(self): """constructor intializes th...
the_stack_v2_python_sparse
pybots/src/communications/flightgear_protocol.py
aivian/robots
train
0
2c098de81b15cc4f5fbadce22c067bdf2320bd46
[ "_logger.info('sync var')\nif not isinstance(ids, list):\n ids = [ids]\nsync_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S')\nproduct_model = self.pool.get('product.product')\npartner_model = self.pool.get('res.partner')\nproduct_lines = []\nfor ebiz_stock in self.read(cr, uid, ids, ['product_id', 'var_qty',...
<|body_start_0|> _logger.info('sync var') if not isinstance(ids, list): ids = [ids] sync_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') product_model = self.pool.get('product.product') partner_model = self.pool.get('res.partner') product_lines = [] ...
ebiz_stock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ebiz_stock: def sync_stock_var(self, cr, uid, ids, context=None): """库存增量同步""" <|body_0|> def sync_stock_qty(self, cr, uid, ids, context=None): """库存全量同步""" <|body_1|> <|end_skeleton|> <|body_start_0|> _logger.info('sync var') if not isinsta...
stack_v2_sparse_classes_75kplus_train_001122
3,970
no_license
[ { "docstring": "库存增量同步", "name": "sync_stock_var", "signature": "def sync_stock_var(self, cr, uid, ids, context=None)" }, { "docstring": "库存全量同步", "name": "sync_stock_qty", "signature": "def sync_stock_qty(self, cr, uid, ids, context=None)" } ]
2
stack_v2_sparse_classes_30k_train_001649
Implement the Python class `ebiz_stock` described below. Class description: Implement the ebiz_stock class. Method signatures and docstrings: - def sync_stock_var(self, cr, uid, ids, context=None): 库存增量同步 - def sync_stock_qty(self, cr, uid, ids, context=None): 库存全量同步
Implement the Python class `ebiz_stock` described below. Class description: Implement the ebiz_stock class. Method signatures and docstrings: - def sync_stock_var(self, cr, uid, ids, context=None): 库存增量同步 - def sync_stock_qty(self, cr, uid, ids, context=None): 库存全量同步 <|skeleton|> class ebiz_stock: def sync_stoc...
96186dfac9a10cd47079de226f6f1d0761928a84
<|skeleton|> class ebiz_stock: def sync_stock_var(self, cr, uid, ids, context=None): """库存增量同步""" <|body_0|> def sync_stock_qty(self, cr, uid, ids, context=None): """库存全量同步""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ebiz_stock: def sync_stock_var(self, cr, uid, ids, context=None): """库存增量同步""" _logger.info('sync var') if not isinstance(ids, list): ids = [ids] sync_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') product_model = self.pool.get('product.product') ...
the_stack_v2_python_sparse
bysun_stock_product_V2/models/ebiz.py
luohuayong/addons8
train
0
caa3646eedd5885e6711b34be659cd68fa5707a9
[ "self.elems_dict = elems_dict\nself.unit_length = unit_length\nself.filename = filename", "if os.path.isfile(self.filename):\n os.remove(self.filename)\nlat = open(self.filename, 'w')\nheader = '? VERSION = 1.0\\n'\nheader += '? UNITLENGTH = ' + str(self.unit_length) + '\\n'\nlat.write(header)\nquad_label = '#...
<|body_start_0|> self.elems_dict = elems_dict self.unit_length = unit_length self.filename = filename <|end_body_0|> <|body_start_1|> if os.path.isfile(self.filename): os.remove(self.filename) lat = open(self.filename, 'w') header = '? VERSION = 1.0\n' ...
Class for generating a properly formatted Genesis1.3 .lat file.
GenLatFile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenLatFile: """Class for generating a properly formatted Genesis1.3 .lat file.""" def __init__(self, filename, elems_dict, unit_length): """Class constructor Args: filename (string): the name of the file the lattice is to be exported as elems_dict (string): a dictionary of the elemen...
stack_v2_sparse_classes_75kplus_train_001123
2,279
permissive
[ { "docstring": "Class constructor Args: filename (string): the name of the file the lattice is to be exported as elems_dict (string): a dictionary of the elements for the genesis lattice unit_length (float): the unit length for genesis, usually the undulator period", "name": "__init__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_049521
Implement the Python class `GenLatFile` described below. Class description: Class for generating a properly formatted Genesis1.3 .lat file. Method signatures and docstrings: - def __init__(self, filename, elems_dict, unit_length): Class constructor Args: filename (string): the name of the file the lattice is to be ex...
Implement the Python class `GenLatFile` described below. Class description: Class for generating a properly formatted Genesis1.3 .lat file. Method signatures and docstrings: - def __init__(self, filename, elems_dict, unit_length): Class constructor Args: filename (string): the name of the file the lattice is to be ex...
e984b5828b1fc8f93bdaa9575dd16f519f44a288
<|skeleton|> class GenLatFile: """Class for generating a properly formatted Genesis1.3 .lat file.""" def __init__(self, filename, elems_dict, unit_length): """Class constructor Args: filename (string): the name of the file the lattice is to be exported as elems_dict (string): a dictionary of the elemen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GenLatFile: """Class for generating a properly formatted Genesis1.3 .lat file.""" def __init__(self, filename, elems_dict, unit_length): """Class constructor Args: filename (string): the name of the file the lattice is to be exported as elems_dict (string): a dictionary of the elements for the ge...
the_stack_v2_python_sparse
radtrack/genesis/rbGenLatFile.py
lynch829/radtrack
train
1
ae8a5357d5876fc7d58a95e26c3c1ccc6c59ff53
[ "expected_checksum, checksum_object = sync_helpers._get_expected_checksum(response, self._get_headers, self.media_url, checksum_type=self.checksum)\nlocal_checksum_object = _add_decoder(response, checksum_object)\nasync for chunk in response.content.iter_chunked(_request_helpers._SINGLE_GET_CHUNK_SIZE):\n self._...
<|body_start_0|> expected_checksum, checksum_object = sync_helpers._get_expected_checksum(response, self._get_headers, self.media_url, checksum_type=self.checksum) local_checksum_object = _add_decoder(response, checksum_object) async for chunk in response.content.iter_chunked(_request_helpers._S...
Helper to manage downloading a resource from a Google API. "Slices" of the resource can be retrieved by specifying a range with ``start`` and / or ``end``. However, in typical usage, neither ``start`` nor ``end`` is expected to be provided. Args: media_url (str): The URL containing the media to be downloaded. stream (I...
Download
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Download: """Helper to manage downloading a resource from a Google API. "Slices" of the resource can be retrieved by specifying a range with ``start`` and / or ``end``. However, in typical usage, neither ``start`` nor ``end`` is expected to be provided. Args: media_url (str): The URL containing t...
stack_v2_sparse_classes_75kplus_train_001124
18,751
permissive
[ { "docstring": "Write response body to a write-able stream. .. note: This method assumes that the ``_stream`` attribute is set on the current download. Args: response (~requests.Response): The HTTP response object. Raises: ~google.resumable_media.common.DataCorruption: If the download's checksum doesn't agree w...
2
null
Implement the Python class `Download` described below. Class description: Helper to manage downloading a resource from a Google API. "Slices" of the resource can be retrieved by specifying a range with ``start`` and / or ``end``. However, in typical usage, neither ``start`` nor ``end`` is expected to be provided. Args...
Implement the Python class `Download` described below. Class description: Helper to manage downloading a resource from a Google API. "Slices" of the resource can be retrieved by specifying a range with ``start`` and / or ``end``. However, in typical usage, neither ``start`` nor ``end`` is expected to be provided. Args...
a02d814ed75d367f0e4047f1982bb79ea970e181
<|skeleton|> class Download: """Helper to manage downloading a resource from a Google API. "Slices" of the resource can be retrieved by specifying a range with ``start`` and / or ``end``. However, in typical usage, neither ``start`` nor ``end`` is expected to be provided. Args: media_url (str): The URL containing t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Download: """Helper to manage downloading a resource from a Google API. "Slices" of the resource can be retrieved by specifying a range with ``start`` and / or ``end``. However, in typical usage, neither ``start`` nor ``end`` is expected to be provided. Args: media_url (str): The URL containing the media to b...
the_stack_v2_python_sparse
google/_async_resumable_media/requests/download.py
googleapis/google-resumable-media-python
train
42
b8ca325f77e298a8750cbf50f8324eb99f53d67a
[ "result = is_leap(1990)\nself.assertEquals(result, False)\nreturn", "result = is_leap(2000)\nself.assertEquals(result, True)\nreturn", "result = is_leap(2400)\nself.assertEquals(result, True)\nreturn" ]
<|body_start_0|> result = is_leap(1990) self.assertEquals(result, False) return <|end_body_0|> <|body_start_1|> result = is_leap(2000) self.assertEquals(result, True) return <|end_body_1|> <|body_start_2|> result = is_leap(2400) self.assertEquals(result,...
Description
TestWriteAFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestWriteAFunction: """Description""" def test_hackerrank_sample1(self): """Verify provided test case.""" <|body_0|> def test_hackerrank_sample2(self): """Verify provided test case.""" <|body_1|> def test_hackerrank_sample3(self): """Verify p...
stack_v2_sparse_classes_75kplus_train_001125
707
no_license
[ { "docstring": "Verify provided test case.", "name": "test_hackerrank_sample1", "signature": "def test_hackerrank_sample1(self)" }, { "docstring": "Verify provided test case.", "name": "test_hackerrank_sample2", "signature": "def test_hackerrank_sample2(self)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_050110
Implement the Python class `TestWriteAFunction` described below. Class description: Description Method signatures and docstrings: - def test_hackerrank_sample1(self): Verify provided test case. - def test_hackerrank_sample2(self): Verify provided test case. - def test_hackerrank_sample3(self): Verify provided test ca...
Implement the Python class `TestWriteAFunction` described below. Class description: Description Method signatures and docstrings: - def test_hackerrank_sample1(self): Verify provided test case. - def test_hackerrank_sample2(self): Verify provided test case. - def test_hackerrank_sample3(self): Verify provided test ca...
fcf3755b62fe0644af763875e3a00be962941a6d
<|skeleton|> class TestWriteAFunction: """Description""" def test_hackerrank_sample1(self): """Verify provided test case.""" <|body_0|> def test_hackerrank_sample2(self): """Verify provided test case.""" <|body_1|> def test_hackerrank_sample3(self): """Verify p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestWriteAFunction: """Description""" def test_hackerrank_sample1(self): """Verify provided test case.""" result = is_leap(1990) self.assertEquals(result, False) return def test_hackerrank_sample2(self): """Verify provided test case.""" result = is_lea...
the_stack_v2_python_sparse
python3/write_a_function/test_write_a_function.py
ayazhemani/hackerrank-py
train
0
e62a825fc930d50875e5756d9a82cab964d6a5f2
[ "self.data = data\nself.plot_title = plot_title\nself.label_names = label_names", "try:\n assert isinstance(title, str)\n self.plot_title = title\nexcept AssertionError:\n print('the add_title method requires a sting input')\n print(\"therefore not changing plot's title\")", "try:\n if not isinst...
<|body_start_0|> self.data = data self.plot_title = plot_title self.label_names = label_names <|end_body_0|> <|body_start_1|> try: assert isinstance(title, str) self.plot_title = title except AssertionError: print('the add_title method require...
Generic plotting class used in the grapher module
Plotter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Plotter: """Generic plotting class used in the grapher module""" def __init__(self, data, plot_title=None, label_names=None): """Initializes plotting class with an optional plot title and label Parameters ---------- data : pandas.DataFrame the Pandas Dataframe to be plotted plot_titl...
stack_v2_sparse_classes_75kplus_train_001126
4,793
permissive
[ { "docstring": "Initializes plotting class with an optional plot title and label Parameters ---------- data : pandas.DataFrame the Pandas Dataframe to be plotted plot_title : str, optional (default = None) the plot title label_names : str tuple, optional (default = None) the x-axis and y-axis titles (x-axis is ...
5
stack_v2_sparse_classes_30k_val_002837
Implement the Python class `Plotter` described below. Class description: Generic plotting class used in the grapher module Method signatures and docstrings: - def __init__(self, data, plot_title=None, label_names=None): Initializes plotting class with an optional plot title and label Parameters ---------- data : pand...
Implement the Python class `Plotter` described below. Class description: Generic plotting class used in the grapher module Method signatures and docstrings: - def __init__(self, data, plot_title=None, label_names=None): Initializes plotting class with an optional plot title and label Parameters ---------- data : pand...
8fbcf41d579be76eadf0ac980f4c9cbe30d60d93
<|skeleton|> class Plotter: """Generic plotting class used in the grapher module""" def __init__(self, data, plot_title=None, label_names=None): """Initializes plotting class with an optional plot title and label Parameters ---------- data : pandas.DataFrame the Pandas Dataframe to be plotted plot_titl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Plotter: """Generic plotting class used in the grapher module""" def __init__(self, data, plot_title=None, label_names=None): """Initializes plotting class with an optional plot title and label Parameters ---------- data : pandas.DataFrame the Pandas Dataframe to be plotted plot_title : str, opti...
the_stack_v2_python_sparse
quickscreen/plot/plotter.py
mqharris/533_lab2
train
0
23a97525b6c1ca0734babed8602ad52db72ca9b7
[ "if A is None or B is None:\n return None\nm, n, l = (len(A), len(A[0]), len(B[0]))\nif len(B) != n:\n raise Exception(\"A's column number must be equal to B's row number.\")\nC = [[0 for _ in range(l)] for _ in range(m)]\nfor i, row in enumerate(A):\n for k, eleA in enumerate(row):\n if eleA:\n ...
<|body_start_0|> if A is None or B is None: return None m, n, l = (len(A), len(A[0]), len(B[0])) if len(B) != n: raise Exception("A's column number must be equal to B's row number.") C = [[0 for _ in range(l)] for _ in range(m)] for i, row in enumerate(A):...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def multiply(self, A, B): """:type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def multiply2(self, A, B): """:type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus_train_001127
5,317
no_license
[ { "docstring": ":type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]", "name": "multiply", "signature": "def multiply(self, A, B)" }, { "docstring": ":type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]", "name": "multiply2", "signature": "def mu...
2
stack_v2_sparse_classes_30k_train_042970
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def multiply(self, A, B): :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] - def multiply2(self, A, B): :type A: List[List[int]] :type B: List[List[int]]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def multiply(self, A, B): :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] - def multiply2(self, A, B): :type A: List[List[int]] :type B: List[List[int]]...
4c0cfe857f5d78a44c1a3bfb2571d72da4911d97
<|skeleton|> class Solution: def multiply(self, A, B): """:type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]""" <|body_0|> def multiply2(self, A, B): """:type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def multiply(self, A, B): """:type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]]""" if A is None or B is None: return None m, n, l = (len(A), len(A[0]), len(B[0])) if len(B) != n: raise Exception("A's column number must be...
the_stack_v2_python_sparse
311-SparseMatrixMultiplication.py
minseoch/algorithm
train
0
62cdd31e6ee267ed423286c7bdec43a68a3955e9
[ "self.result = {}\nself.timeouts = {}\nself.time = datetime.now()\nself.timeout = timeout\nself.file = file", "def wrapper(*a, **k):\n uid = a[0].uid\n if k.get('recache', 0):\n self.result[uid] = ''\n del k['recache']\n if self.timedout(uid):\n self.result[uid] = ''\n if not self...
<|body_start_0|> self.result = {} self.timeouts = {} self.time = datetime.now() self.timeout = timeout self.file = file <|end_body_0|> <|body_start_1|> def wrapper(*a, **k): uid = a[0].uid if k.get('recache', 0): self.result[uid] =...
a decorator
CachedInstance
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedInstance: """a decorator""" def __init__(self, timeout=0, file=''): """timeout: int seconds file='string path to store result'""" <|body_0|> def __call__(self, fn): """wrap our function""" <|body_1|> def timedout(self, uid): """returns ...
stack_v2_sparse_classes_75kplus_train_001128
2,764
permissive
[ { "docstring": "timeout: int seconds file='string path to store result'", "name": "__init__", "signature": "def __init__(self, timeout=0, file='')" }, { "docstring": "wrap our function", "name": "__call__", "signature": "def __call__(self, fn)" }, { "docstring": "returns True if ...
3
stack_v2_sparse_classes_30k_val_002533
Implement the Python class `CachedInstance` described below. Class description: a decorator Method signatures and docstrings: - def __init__(self, timeout=0, file=''): timeout: int seconds file='string path to store result' - def __call__(self, fn): wrap our function - def timedout(self, uid): returns True if we have...
Implement the Python class `CachedInstance` described below. Class description: a decorator Method signatures and docstrings: - def __init__(self, timeout=0, file=''): timeout: int seconds file='string path to store result' - def __call__(self, fn): wrap our function - def timedout(self, uid): returns True if we have...
430d6dfd719f8c88a4c3de2b735f8736187ff19b
<|skeleton|> class CachedInstance: """a decorator""" def __init__(self, timeout=0, file=''): """timeout: int seconds file='string path to store result'""" <|body_0|> def __call__(self, fn): """wrap our function""" <|body_1|> def timedout(self, uid): """returns ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CachedInstance: """a decorator""" def __init__(self, timeout=0, file=''): """timeout: int seconds file='string path to store result'""" self.result = {} self.timeouts = {} self.time = datetime.now() self.timeout = timeout self.file = file def __call__(...
the_stack_v2_python_sparse
evoke/serve/cached_instance.py
howiemac/evoke
train
0
110f306a6f2c0aa3489cf469818ce57045991e22
[ "if not requires_filters or not isinstance(requires_filters, dict):\n return configs\nnew_requirements = {}\nfor field, config in configs.items():\n requirement, key, allow_none = config\n try:\n explicit_filter = requires_filters[field]\n requirement_copy = requirement.copy()\n requir...
<|body_start_0|> if not requires_filters or not isinstance(requires_filters, dict): return configs new_requirements = {} for field, config in configs.items(): requirement, key, allow_none = config try: explicit_filter = requires_filters[field] ...
Factory service for service registration handlers
_HandlerFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _HandlerFactory: """Factory service for service registration handlers""" def _prepare_requirements(configs, requires_filters): """Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_fil...
stack_v2_sparse_classes_75kplus_train_001129
21,139
permissive
[ { "docstring": "Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_filters: Content of the 'requires.filter' component property (field → string) :return: The new configuration dictionary", "name": "_prepare_r...
2
stack_v2_sparse_classes_30k_train_041699
Implement the Python class `_HandlerFactory` described below. Class description: Factory service for service registration handlers Method signatures and docstrings: - def _prepare_requirements(configs, requires_filters): Overrides the filters specified in the decorator with the given ones :param configs: Field → (Req...
Implement the Python class `_HandlerFactory` described below. Class description: Factory service for service registration handlers Method signatures and docstrings: - def _prepare_requirements(configs, requires_filters): Overrides the filters specified in the decorator with the given ones :param configs: Field → (Req...
1d0add361ca219da8fdf72bb9ba8cb0ade01ad2f
<|skeleton|> class _HandlerFactory: """Factory service for service registration handlers""" def _prepare_requirements(configs, requires_filters): """Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_fil...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _HandlerFactory: """Factory service for service registration handlers""" def _prepare_requirements(configs, requires_filters): """Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_filters: Content...
the_stack_v2_python_sparse
pelix/ipopo/handlers/requiresmap.py
tcalmant/ipopo
train
67
b3511fc20828fc0cfd9f8519ab892786164bb15a
[ "i = 0\nproduct_sum = 1\nadd_sum = 0\nfor eary_month_benchmark in benchmark_monthly:\n if eary_month_benchmark >= 0:\n product_sum = product_sum * (benchmark_monthly[i] + 1)\n add_sum += 1\n i += 1\nucr_x = pow(product_sum, 1 / add_sum) - 1\nreturn ucr_x", "ucr_y = UpwardCapture.upward_capture...
<|body_start_0|> i = 0 product_sum = 1 add_sum = 0 for eary_month_benchmark in benchmark_monthly: if eary_month_benchmark >= 0: product_sum = product_sum * (benchmark_monthly[i] + 1) add_sum += 1 i += 1 ucr_x = pow(product_s...
UplinkCapture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UplinkCapture: def ucr_x(benchmark_monthly: list): """ucr_x计算,需要传基金月度收益率列表和基准月度收益率列表""" <|body_0|> def uplink_capture(monthly_fund_field: list, benchmark_monthly: list): """上行捕获率计算,上行捕获收益率(ucr_y)除以ucrx,计算需要传入基金月度收益率列表和基准月度收益率列表""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_001130
2,161
no_license
[ { "docstring": "ucr_x计算,需要传基金月度收益率列表和基准月度收益率列表", "name": "ucr_x", "signature": "def ucr_x(benchmark_monthly: list)" }, { "docstring": "上行捕获率计算,上行捕获收益率(ucr_y)除以ucrx,计算需要传入基金月度收益率列表和基准月度收益率列表", "name": "uplink_capture", "signature": "def uplink_capture(monthly_fund_field: list, benchmark_m...
2
stack_v2_sparse_classes_30k_train_039480
Implement the Python class `UplinkCapture` described below. Class description: Implement the UplinkCapture class. Method signatures and docstrings: - def ucr_x(benchmark_monthly: list): ucr_x计算,需要传基金月度收益率列表和基准月度收益率列表 - def uplink_capture(monthly_fund_field: list, benchmark_monthly: list): 上行捕获率计算,上行捕获收益率(ucr_y)除以ucrx...
Implement the Python class `UplinkCapture` described below. Class description: Implement the UplinkCapture class. Method signatures and docstrings: - def ucr_x(benchmark_monthly: list): ucr_x计算,需要传基金月度收益率列表和基准月度收益率列表 - def uplink_capture(monthly_fund_field: list, benchmark_monthly: list): 上行捕获率计算,上行捕获收益率(ucr_y)除以ucrx...
eae782a78ffde1276a0812a43d7deefb0bdedeb4
<|skeleton|> class UplinkCapture: def ucr_x(benchmark_monthly: list): """ucr_x计算,需要传基金月度收益率列表和基准月度收益率列表""" <|body_0|> def uplink_capture(monthly_fund_field: list, benchmark_monthly: list): """上行捕获率计算,上行捕获收益率(ucr_y)除以ucrx,计算需要传入基金月度收益率列表和基准月度收益率列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UplinkCapture: def ucr_x(benchmark_monthly: list): """ucr_x计算,需要传基金月度收益率列表和基准月度收益率列表""" i = 0 product_sum = 1 add_sum = 0 for eary_month_benchmark in benchmark_monthly: if eary_month_benchmark >= 0: product_sum = product_sum * (benchmark_mont...
the_stack_v2_python_sparse
public_method/indicator_calculation_method/uplink_capture.py
liufubin-git/python
train
0
224e05850e26d30e7e3be47255af498784dd0fc6
[ "parser = super(CancelVnfLcmOp, self).get_parser(prog_name)\nparser.add_argument(_VNF_LCM_OP_OCC_ID, metavar='<vnf-lcm-op-occ-id>', help=_('VNF lifecycle management operation occurrence ID.'))\nparser.add_argument('--cancel-mode', default='GRACEFUL', metavar='<cancel-mode>', choices=['GRACEFUL', 'FORCEFUL'], help=_...
<|body_start_0|> parser = super(CancelVnfLcmOp, self).get_parser(prog_name) parser.add_argument(_VNF_LCM_OP_OCC_ID, metavar='<vnf-lcm-op-occ-id>', help=_('VNF lifecycle management operation occurrence ID.')) parser.add_argument('--cancel-mode', default='GRACEFUL', metavar='<cancel-mode>', choice...
CancelVnfLcmOp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CancelVnfLcmOp: def get_parser(self, prog_name): """Add arguments to parser. Args: prog_name ([type]): program name Returns: parser([ArgumentParser]):""" <|body_0|> def take_action(self, parsed_args): """Execute cancel_vnf_instance and output comment. Args: parsed_ar...
stack_v2_sparse_classes_75kplus_train_001131
11,909
permissive
[ { "docstring": "Add arguments to parser. Args: prog_name ([type]): program name Returns: parser([ArgumentParser]):", "name": "get_parser", "signature": "def get_parser(self, prog_name)" }, { "docstring": "Execute cancel_vnf_instance and output comment. Args: parsed_args ([Namespace]): arguments ...
2
stack_v2_sparse_classes_30k_val_002018
Implement the Python class `CancelVnfLcmOp` described below. Class description: Implement the CancelVnfLcmOp class. Method signatures and docstrings: - def get_parser(self, prog_name): Add arguments to parser. Args: prog_name ([type]): program name Returns: parser([ArgumentParser]): - def take_action(self, parsed_arg...
Implement the Python class `CancelVnfLcmOp` described below. Class description: Implement the CancelVnfLcmOp class. Method signatures and docstrings: - def get_parser(self, prog_name): Add arguments to parser. Args: prog_name ([type]): program name Returns: parser([ArgumentParser]): - def take_action(self, parsed_arg...
e8460be8c53ad5dfbac720367cf0ae2c3291dc3b
<|skeleton|> class CancelVnfLcmOp: def get_parser(self, prog_name): """Add arguments to parser. Args: prog_name ([type]): program name Returns: parser([ArgumentParser]):""" <|body_0|> def take_action(self, parsed_args): """Execute cancel_vnf_instance and output comment. Args: parsed_ar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CancelVnfLcmOp: def get_parser(self, prog_name): """Add arguments to parser. Args: prog_name ([type]): program name Returns: parser([ArgumentParser]):""" parser = super(CancelVnfLcmOp, self).get_parser(prog_name) parser.add_argument(_VNF_LCM_OP_OCC_ID, metavar='<vnf-lcm-op-occ-id>', he...
the_stack_v2_python_sparse
tackerclient/osc/v1/vnflcm/vnflcm_op_occs.py
openstack/python-tackerclient
train
21
608eda567b1c98079ef6384daee47e21bb89f84b
[ "writer = KvDbWriter(KvDbClient(**config))\nfor configured_stream in configured_catalog.streams:\n if configured_stream.destination_sync_mode == DestinationSyncMode.overwrite:\n writer.delete_stream_entries(configured_stream.stream.name)\nfor message in input_messages:\n if message.type == Type.STATE:\...
<|body_start_0|> writer = KvDbWriter(KvDbClient(**config)) for configured_stream in configured_catalog.streams: if configured_stream.destination_sync_mode == DestinationSyncMode.overwrite: writer.delete_stream_entries(configured_stream.stream.name) for message in inpu...
DestinationKvdb
[ "MIT", "Apache-2.0", "BSD-3-Clause", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationKvdb: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """Reads the input stream of messages, config, and catalog to write data to the destination. This method return...
stack_v2_sparse_classes_75kplus_train_001132
3,439
permissive
[ { "docstring": "Reads the input stream of messages, config, and catalog to write data to the destination. This method returns an iterable (typically a generator of AirbyteMessages via yield) containing state messages received in the input message stream. Outputting a state message means that every AirbyteRecord...
2
stack_v2_sparse_classes_30k_train_040109
Implement the Python class `DestinationKvdb` described below. Class description: Implement the DestinationKvdb class. Method signatures and docstrings: - def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: Read...
Implement the Python class `DestinationKvdb` described below. Class description: Implement the DestinationKvdb class. Method signatures and docstrings: - def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: Read...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class DestinationKvdb: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """Reads the input stream of messages, config, and catalog to write data to the destination. This method return...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DestinationKvdb: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """Reads the input stream of messages, config, and catalog to write data to the destination. This method returns an iterable ...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/destination-kvdb/destination_kvdb/destination.py
alldatacenter/alldata
train
774
1cf4f8a86c1d161204c22447b7026d96507c4192
[ "self.userId = userId\nself.question = question\nself.comment = comment", "commnt = dict(userId=self.userId, question=self.question, comment=self.comment)\ncommentData = {'comment': 'comment'}\ntable = 'comments'\ncolumns = ', '.join(commnt.keys())\nvalues = \"', '\".join(map(str, commnt.values()))\ndetails = ','...
<|body_start_0|> self.userId = userId self.question = question self.comment = comment <|end_body_0|> <|body_start_1|> commnt = dict(userId=self.userId, question=self.question, comment=self.comment) commentData = {'comment': 'comment'} table = 'comments' columns =...
Class for comments CRUD operations
CommentModels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentModels: """Class for comments CRUD operations""" def __init__(self, userId, question, comment): """Initialize the comment models""" <|body_0|> def create_comment(self): """method for posting comments""" <|body_1|> def fetch_quest(self, questio...
stack_v2_sparse_classes_75kplus_train_001133
2,329
no_license
[ { "docstring": "Initialize the comment models", "name": "__init__", "signature": "def __init__(self, userId, question, comment)" }, { "docstring": "method for posting comments", "name": "create_comment", "signature": "def create_comment(self)" }, { "docstring": "Method to fetch q...
5
stack_v2_sparse_classes_30k_train_000919
Implement the Python class `CommentModels` described below. Class description: Class for comments CRUD operations Method signatures and docstrings: - def __init__(self, userId, question, comment): Initialize the comment models - def create_comment(self): method for posting comments - def fetch_quest(self, questionId)...
Implement the Python class `CommentModels` described below. Class description: Class for comments CRUD operations Method signatures and docstrings: - def __init__(self, userId, question, comment): Initialize the comment models - def create_comment(self): method for posting comments - def fetch_quest(self, questionId)...
93c7aeb54c240b6312e6164859acd2c878e85825
<|skeleton|> class CommentModels: """Class for comments CRUD operations""" def __init__(self, userId, question, comment): """Initialize the comment models""" <|body_0|> def create_comment(self): """method for posting comments""" <|body_1|> def fetch_quest(self, questio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommentModels: """Class for comments CRUD operations""" def __init__(self, userId, question, comment): """Initialize the comment models""" self.userId = userId self.question = question self.comment = comment def create_comment(self): """method for posting comm...
the_stack_v2_python_sparse
app/api/v2/models/comment_models.py
matthenge/Questioner-api-v2
train
0
855b21380e26916be92250eee201b437aa9dc315
[ "action_space = Bag([])\naction_space.seed(seed=seed)\nsuper().__init__(initial_state=initial_state, default_reward=default_reward, seed=seed, columns=columns, action_space=action_space)", "x, y = position\nif action == self.actions['RIGHT']:\n x += 1\nelif action == self.actions['DOWN']:\n y += 1\nnext_pos...
<|body_start_0|> action_space = Bag([]) action_space.seed(seed=seed) super().__init__(initial_state=initial_state, default_reward=default_reward, seed=seed, columns=columns, action_space=action_space) <|end_body_0|> <|body_start_1|> x, y = position if action == self.actions['RIG...
DeepSeaTreasureRightDown
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepSeaTreasureRightDown: def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0,), seed: int=0, columns: int=10): """:param initial_state: Initial state where start the agent. :param default_reward: (time_inverted, treasure_value) :param seed: Seed used for np.random.R...
stack_v2_sparse_classes_75kplus_train_001134
4,417
no_license
[ { "docstring": ":param initial_state: Initial state where start the agent. :param default_reward: (time_inverted, treasure_value) :param seed: Seed used for np.random.RandomState method. :param columns: Number of columns to be used to build this environment (allows experimenting with an identical environment, b...
4
stack_v2_sparse_classes_30k_train_050180
Implement the Python class `DeepSeaTreasureRightDown` described below. Class description: Implement the DeepSeaTreasureRightDown class. Method signatures and docstrings: - def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0,), seed: int=0, columns: int=10): :param initial_state: Initial state whe...
Implement the Python class `DeepSeaTreasureRightDown` described below. Class description: Implement the DeepSeaTreasureRightDown class. Method signatures and docstrings: - def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0,), seed: int=0, columns: int=10): :param initial_state: Initial state whe...
b51c64c867e15356c9f978839fd0040182324edd
<|skeleton|> class DeepSeaTreasureRightDown: def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0,), seed: int=0, columns: int=10): """:param initial_state: Initial state where start the agent. :param default_reward: (time_inverted, treasure_value) :param seed: Seed used for np.random.R...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepSeaTreasureRightDown: def __init__(self, initial_state: tuple=(0, 0), default_reward: tuple=(0,), seed: int=0, columns: int=10): """:param initial_state: Initial state where start the agent. :param default_reward: (time_inverted, treasure_value) :param seed: Seed used for np.random.RandomState met...
the_stack_v2_python_sparse
environments/deep_sea_treasure_right_down.py
Pozas91/tiadas
train
1
6db837e1bcaea8cf9b304017d511826394e1a2f3
[ "userdb = CombaUser()\nif userdb.hasPassword(username, password):\n return userdb.getUser(username)\nelse:\n return False", "valid_user = self.check_auth(username, password)\nif valid_user:\n group = None\n groupcreated = None\n try:\n user = User.objects.get(username=username)\n except U...
<|body_start_0|> userdb = CombaUser() if userdb.hasPassword(username, password): return userdb.getUser(username) else: return False <|end_body_0|> <|body_start_1|> valid_user = self.check_auth(username, password) if valid_user: group = None ...
Provides authentication via comba_lib
RedisBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedisBackend: """Provides authentication via comba_lib""" def check_auth(self, username, password): """check user and password in redis db :param username: :param password: :return:""" <|body_0|> def authenticate(self, username=None, password=None): """Overwrite ...
stack_v2_sparse_classes_75kplus_train_001135
3,013
no_license
[ { "docstring": "check user and password in redis db :param username: :param password: :return:", "name": "check_auth", "signature": "def check_auth(self, username, password)" }, { "docstring": "Overwrite the parent authenticate method :param username: :param password: :return:", "name": "aut...
3
stack_v2_sparse_classes_30k_test_000859
Implement the Python class `RedisBackend` described below. Class description: Provides authentication via comba_lib Method signatures and docstrings: - def check_auth(self, username, password): check user and password in redis db :param username: :param password: :return: - def authenticate(self, username=None, passw...
Implement the Python class `RedisBackend` described below. Class description: Provides authentication via comba_lib Method signatures and docstrings: - def check_auth(self, username, password): check user and password in redis db :param username: :param password: :return: - def authenticate(self, username=None, passw...
eb6b8bca4f782f7aa8fbabd4fddbfddaae769252
<|skeleton|> class RedisBackend: """Provides authentication via comba_lib""" def check_auth(self, username, password): """check user and password in redis db :param username: :param password: :return:""" <|body_0|> def authenticate(self, username=None, password=None): """Overwrite ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RedisBackend: """Provides authentication via comba_lib""" def check_auth(self, username, password): """check user and password in redis db :param username: :param password: :return:""" userdb = CombaUser() if userdb.hasPassword(username, password): return userdb.getUse...
the_stack_v2_python_sparse
comba_web/redisbackend.py
combaos/comba_web
train
0
58b582a0f06ce719f0e92f0b51b9ff61d70899da
[ "if obj.id:\n url = reverse('admin:{}_{}_upvote'.format(self.model._meta.app_label, self.model._meta.model_name), args=(obj.id,))\nelse:\n url = '#'\nreturn mark_safe('<a href=\"{}\"><div class=\"arrow-up\"></div></a>'.format(url))", "if obj.id:\n url = reverse('admin:{}_{}_downvote'.format(self.model._m...
<|body_start_0|> if obj.id: url = reverse('admin:{}_{}_upvote'.format(self.model._meta.app_label, self.model._meta.model_name), args=(obj.id,)) else: url = '#' return mark_safe('<a href="{}"><div class="arrow-up"></div></a>'.format(url)) <|end_body_0|> <|body_start_1|> ...
Admin support for voteable models.
VoteableModelAdmin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoteableModelAdmin: """Admin support for voteable models.""" def upvote(self, obj): """Provide a button to upvote instance.""" <|body_0|> def downvote(self, obj): """Provide a button to downvote instance.""" <|body_1|> def upvote_view(self, request, ...
stack_v2_sparse_classes_75kplus_train_001136
3,959
permissive
[ { "docstring": "Provide a button to upvote instance.", "name": "upvote", "signature": "def upvote(self, obj)" }, { "docstring": "Provide a button to downvote instance.", "name": "downvote", "signature": "def downvote(self, obj)" }, { "docstring": "Admin view to upvote object.", ...
5
stack_v2_sparse_classes_30k_train_046786
Implement the Python class `VoteableModelAdmin` described below. Class description: Admin support for voteable models. Method signatures and docstrings: - def upvote(self, obj): Provide a button to upvote instance. - def downvote(self, obj): Provide a button to downvote instance. - def upvote_view(self, request, obj_...
Implement the Python class `VoteableModelAdmin` described below. Class description: Admin support for voteable models. Method signatures and docstrings: - def upvote(self, obj): Provide a button to upvote instance. - def downvote(self, obj): Provide a button to downvote instance. - def upvote_view(self, request, obj_...
5f2ad4a15dc62160c6d03c87c121e934cacb8228
<|skeleton|> class VoteableModelAdmin: """Admin support for voteable models.""" def upvote(self, obj): """Provide a button to upvote instance.""" <|body_0|> def downvote(self, obj): """Provide a button to downvote instance.""" <|body_1|> def upvote_view(self, request, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VoteableModelAdmin: """Admin support for voteable models.""" def upvote(self, obj): """Provide a button to upvote instance.""" if obj.id: url = reverse('admin:{}_{}_upvote'.format(self.model._meta.app_label, self.model._meta.model_name), args=(obj.id,)) else: ...
the_stack_v2_python_sparse
quotetron/admin.py
CMU-Robotics-Club/roboticsclub.org
train
0
5cb2a47095bcd1a84838323141c695c7e8167725
[ "if isinstance(value, str) and value.replace(' ', '') == '':\n raise InvalidEmptyValue(field_name=field.name)\nreturn value", "ti_utils = ThreatIntelUtil(session_tc=registry.session_tc)\ngroup_types = cls.group_types or ti_utils.group_types\nif value.lower() not in [i.lower() for i in group_types]:\n raise ...
<|body_start_0|> if isinstance(value, str) and value.replace(' ', '') == '': raise InvalidEmptyValue(field_name=field.name) return value <|end_body_0|> <|body_start_1|> ti_utils = ThreatIntelUtil(session_tc=registry.session_tc) group_types = cls.group_types or ti_utils.group...
Group Entity Field (Model) Type
GroupEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupEntity: """Group Entity Field (Model) Type""" def is_empty(cls, value: str, field: ModelField) -> str: """Validate that the value is a non-empty string.""" <|body_0|> def is_type(cls, value: str, field: ModelField) -> str: """Validate that the value is a non...
stack_v2_sparse_classes_75kplus_train_001137
2,435
permissive
[ { "docstring": "Validate that the value is a non-empty string.", "name": "is_empty", "signature": "def is_empty(cls, value: str, field: ModelField) -> str" }, { "docstring": "Validate that the value is a non-empty string. Without the always and pre args, None values will validated before this va...
2
stack_v2_sparse_classes_30k_train_015219
Implement the Python class `GroupEntity` described below. Class description: Group Entity Field (Model) Type Method signatures and docstrings: - def is_empty(cls, value: str, field: ModelField) -> str: Validate that the value is a non-empty string. - def is_type(cls, value: str, field: ModelField) -> str: Validate th...
Implement the Python class `GroupEntity` described below. Class description: Group Entity Field (Model) Type Method signatures and docstrings: - def is_empty(cls, value: str, field: ModelField) -> str: Validate that the value is a non-empty string. - def is_type(cls, value: str, field: ModelField) -> str: Validate th...
30dc147e40d63d1082ec2a5e6c62005b60c29c37
<|skeleton|> class GroupEntity: """Group Entity Field (Model) Type""" def is_empty(cls, value: str, field: ModelField) -> str: """Validate that the value is a non-empty string.""" <|body_0|> def is_type(cls, value: str, field: ModelField) -> str: """Validate that the value is a non...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GroupEntity: """Group Entity Field (Model) Type""" def is_empty(cls, value: str, field: ModelField) -> str: """Validate that the value is a non-empty string.""" if isinstance(value, str) and value.replace(' ', '') == '': raise InvalidEmptyValue(field_name=field.name) r...
the_stack_v2_python_sparse
tcex/input/field_type/group_entity.py
ThreatConnect-Inc/tcex
train
24
675f1fd78983342da841d16e51b55d1771cd228a
[ "if journey is None:\n return self.filter(Q(journey__template__user=user) | Q(journey__passengers__user=user))\nif not journey.is_messenger_allowed(user):\n return self.none()\nreturn self.filter(journey=journey)", "if not journey.is_messenger_allowed(user):\n raise UserNotAllowed()\nreturn self.create(u...
<|body_start_0|> if journey is None: return self.filter(Q(journey__template__user=user) | Q(journey__passengers__user=user)) if not journey.is_messenger_allowed(user): return self.none() return self.filter(journey=journey) <|end_body_0|> <|body_start_1|> if not j...
Manager to handle messages.
MessageManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageManager: """Manager to handle messages.""" def list(self, user, journey=None): """Gets the list of all messages the given user could read. :param user: :param journey:""" <|body_0|> def send(self, user, message, journey): """User tries send 'message' to 'j...
stack_v2_sparse_classes_75kplus_train_001138
9,126
no_license
[ { "docstring": "Gets the list of all messages the given user could read. :param user: :param journey:", "name": "list", "signature": "def list(self, user, journey=None)" }, { "docstring": "User tries send 'message' to 'journey' group.", "name": "send", "signature": "def send(self, user, ...
2
stack_v2_sparse_classes_30k_train_013773
Implement the Python class `MessageManager` described below. Class description: Manager to handle messages. Method signatures and docstrings: - def list(self, user, journey=None): Gets the list of all messages the given user could read. :param user: :param journey: - def send(self, user, message, journey): User tries...
Implement the Python class `MessageManager` described below. Class description: Manager to handle messages. Method signatures and docstrings: - def list(self, user, journey=None): Gets the list of all messages the given user could read. :param user: :param journey: - def send(self, user, message, journey): User tries...
1713bb544bbddacda34b7d7dbd6e422872546776
<|skeleton|> class MessageManager: """Manager to handle messages.""" def list(self, user, journey=None): """Gets the list of all messages the given user could read. :param user: :param journey:""" <|body_0|> def send(self, user, message, journey): """User tries send 'message' to 'j...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageManager: """Manager to handle messages.""" def list(self, user, journey=None): """Gets the list of all messages the given user could read. :param user: :param journey:""" if journey is None: return self.filter(Q(journey__template__user=user) | Q(journey__passengers__use...
the_stack_v2_python_sparse
upvcarshare/journeys/managers.py
marcosgabarda/upvcarshare
train
0
61265c35eb9602d885e82c8387d9f81606bf6f9d
[ "help_width = get_help_width()\nself._boot_arg = dict()\nself.deprecated_bootargs = []\nself.bootarg_prefix = kwargs.pop('bootarg_prefix', '')\nself.require_prefix = kwargs.pop('require_prefix', True)\nArgumentParser.__init__(self, *args, description=DESCRIPTION, formatter_class=lambda prog: HelpFormatter(prog, max...
<|body_start_0|> help_width = get_help_width() self._boot_arg = dict() self.deprecated_bootargs = [] self.bootarg_prefix = kwargs.pop('bootarg_prefix', '') self.require_prefix = kwargs.pop('require_prefix', True) ArgumentParser.__init__(self, *args, description=DESCRIPTIO...
Subclass of ArgumentParser that also examines boot arguments.
AnacondaArgumentParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnacondaArgumentParser: """Subclass of ArgumentParser that also examines boot arguments.""" def __init__(self, *args, **kwargs): """If the "bootarg_prefix" keyword argument is set, it's assumed that all bootargs will start with that prefix. "require_prefix" is a bool: False: accept t...
stack_v2_sparse_classes_75kplus_train_001139
13,877
no_license
[ { "docstring": "If the \"bootarg_prefix\" keyword argument is set, it's assumed that all bootargs will start with that prefix. \"require_prefix\" is a bool: False: accept the argument with or without the prefix. True: ignore the argument without the prefix. (default)", "name": "__init__", "signature": "...
5
null
Implement the Python class `AnacondaArgumentParser` described below. Class description: Subclass of ArgumentParser that also examines boot arguments. Method signatures and docstrings: - def __init__(self, *args, **kwargs): If the "bootarg_prefix" keyword argument is set, it's assumed that all bootargs will start with...
Implement the Python class `AnacondaArgumentParser` described below. Class description: Subclass of ArgumentParser that also examines boot arguments. Method signatures and docstrings: - def __init__(self, *args, **kwargs): If the "bootarg_prefix" keyword argument is set, it's assumed that all bootargs will start with...
6976d7e1d8af45b1432cbf4f1461076ca04349e0
<|skeleton|> class AnacondaArgumentParser: """Subclass of ArgumentParser that also examines boot arguments.""" def __init__(self, *args, **kwargs): """If the "bootarg_prefix" keyword argument is set, it's assumed that all bootargs will start with that prefix. "require_prefix" is a bool: False: accept t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnacondaArgumentParser: """Subclass of ArgumentParser that also examines boot arguments.""" def __init__(self, *args, **kwargs): """If the "bootarg_prefix" keyword argument is set, it's assumed that all bootargs will start with that prefix. "require_prefix" is a bool: False: accept the argument w...
the_stack_v2_python_sparse
rootfs/usr/lib64/python2.7/site-packages/pyanaconda/anaconda_argparse.py
outstanding-mjy/make_rootfs
train
0
d675ffb926b6f8f2fb131440c062b5fa10eee2f4
[ "super().__init__()\nself.up = nn.ConvTranspose2d(in_channels, in_channels, kernel_size=2, stride=2)\nself.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)", "x = self.up(x)\nx = self.conv(x)\nx = F.relu(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.up = nn.ConvTranspose2d(in_channels, in_channels, kernel_size=2, stride=2) self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1) <|end_body_0|> <|body_start_1|> x = self.up(x) x = self.conv(x) x = F.relu(x) ...
Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.
UpConvBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpConvBlock: """Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.""" def __init__(self, in_channels, out_channels): """Init. ...
stack_v2_sparse_classes_75kplus_train_001140
10,936
no_license
[ { "docstring": "Init. Args: in_channels(int): Input channels. out_channels(int): Output channels.", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels)" }, { "docstring": "Forward pass. Args: x(torch.Tensor): Input data. Returns: torch.Tensor: Activations.", "name...
2
stack_v2_sparse_classes_30k_train_039141
Implement the Python class `UpConvBlock` described below. Class description: Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user. Method signatures and docstrings...
Implement the Python class `UpConvBlock` described below. Class description: Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user. Method signatures and docstrings...
9027b529eaa4cf0a38f25512141810f92db99639
<|skeleton|> class UpConvBlock: """Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.""" def __init__(self, in_channels, out_channels): """Init. ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpConvBlock: """Transpose convolutional block to upscale input. 2x2 Transpoe convolution followed by a convolutional layer with 3x3 kernel with 1 padding, Max pooling and Relu activations. Channels must be specified by user.""" def __init__(self, in_channels, out_channels): """Init. Args: in_chan...
the_stack_v2_python_sparse
grae/models/torch_modules.py
jakerhodes/GRAE
train
0
25abc94b08d5c5fcc5839375fb347f399eade309
[ "spus = Brand.objects.all()\nspus_serial = BrandSerializer(spus, many=True)\nreturn Response(spus_serial.data)", "spus = GoodsCategory.objects.get(id=pk).subs.all()\nspus_serial = GoodsCategorySerializer(spus, many=True)\nreturn Response(spus_serial.data)", "spus = GoodsCategory.objects.all()\nspus_serial = Goo...
<|body_start_0|> spus = Brand.objects.all() spus_serial = BrandSerializer(spus, many=True) return Response(spus_serial.data) <|end_body_0|> <|body_start_1|> spus = GoodsCategory.objects.get(id=pk).subs.all() spus_serial = GoodsCategorySerializer(spus, many=True) return R...
SPU管理
SPUView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SPUView: """SPU管理""" def simple(self, request): """获取商品品牌""" <|body_0|> def category_23(self, request, pk): """获取二三级分类""" <|body_1|> def category_1(self, request, pk=None): """获取一级分类""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001141
1,328
no_license
[ { "docstring": "获取商品品牌", "name": "simple", "signature": "def simple(self, request)" }, { "docstring": "获取二三级分类", "name": "category_23", "signature": "def category_23(self, request, pk)" }, { "docstring": "获取一级分类", "name": "category_1", "signature": "def category_1(self, r...
3
null
Implement the Python class `SPUView` described below. Class description: SPU管理 Method signatures and docstrings: - def simple(self, request): 获取商品品牌 - def category_23(self, request, pk): 获取二三级分类 - def category_1(self, request, pk=None): 获取一级分类
Implement the Python class `SPUView` described below. Class description: SPU管理 Method signatures and docstrings: - def simple(self, request): 获取商品品牌 - def category_23(self, request, pk): 获取二三级分类 - def category_1(self, request, pk=None): 获取一级分类 <|skeleton|> class SPUView: """SPU管理""" def simple(self, request...
e3976cbb9e96a1558f4e00abed1c61d887f915b1
<|skeleton|> class SPUView: """SPU管理""" def simple(self, request): """获取商品品牌""" <|body_0|> def category_23(self, request, pk): """获取二三级分类""" <|body_1|> def category_1(self, request, pk=None): """获取一级分类""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SPUView: """SPU管理""" def simple(self, request): """获取商品品牌""" spus = Brand.objects.all() spus_serial = BrandSerializer(spus, many=True) return Response(spus_serial.data) def category_23(self, request, pk): """获取二三级分类""" spus = GoodsCategory.objects.get(...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/meiduo_admin/views/spus.py
yi0506/meiduo
train
0
09edf147777f1ff5956cb528ee35ae9c7e033b25
[ "super(TaskTarget, self).__init__()\nself.service_name = service_name\nself.job_name = job_name\nself.region = region\nself.hostname = hostname\nself.task_num = task_num\nself._fields = ('service_name', 'job_name', 'region', 'hostname', 'task_num')", "collection.task.service_name = self.service_name\ncollection.t...
<|body_start_0|> super(TaskTarget, self).__init__() self.service_name = service_name self.job_name = job_name self.region = region self.hostname = hostname self.task_num = task_num self._fields = ('service_name', 'job_name', 'region', 'hostname', 'task_num') <|end...
Monitoring interface class for monitoring active jobs or processes.
TaskTarget
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskTarget: """Monitoring interface class for monitoring active jobs or processes.""" def __init__(self, service_name, job_name, region, hostname, task_num=0): """Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a pa...
stack_v2_sparse_classes_75kplus_train_001142
4,448
permissive
[ { "docstring": "Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a part. job_name (str): specific name of this task. region (str): general region in which this task is running. hostname (str): specific machine on which this task is running. tas...
2
stack_v2_sparse_classes_30k_train_051944
Implement the Python class `TaskTarget` described below. Class description: Monitoring interface class for monitoring active jobs or processes. Method signatures and docstrings: - def __init__(self, service_name, job_name, region, hostname, task_num=0): Create a Target object exporting info about a specific task. Arg...
Implement the Python class `TaskTarget` described below. Class description: Monitoring interface class for monitoring active jobs or processes. Method signatures and docstrings: - def __init__(self, service_name, job_name, region, hostname, task_num=0): Create a Target object exporting info about a specific task. Arg...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class TaskTarget: """Monitoring interface class for monitoring active jobs or processes.""" def __init__(self, service_name, job_name, region, hostname, task_num=0): """Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskTarget: """Monitoring interface class for monitoring active jobs or processes.""" def __init__(self, service_name, job_name, region, hostname, task_num=0): """Create a Target object exporting info about a specific task. Args: service_name (str): service of which this task is a part. job_name ...
the_stack_v2_python_sparse
third_party/gae_ts_mon/gae_ts_mon/common/targets.py
catapult-project/catapult
train
2,032
3f5fc35bed313825a2b58d9dc200dd1315d4914a
[ "this_target_matrix = standalone_utils.do_2d_convolution(feature_matrix=TARGET_MATRIX, kernel_matrix=WEIGHT_MATRIX_SIZE0, pad_edges=True, stride_length_px=1)\nself.assertTrue(numpy.allclose(this_target_matrix, TARGET_MATRIX, atol=TOLERANCE))\nthis_prediction_matrix = standalone_utils.do_2d_convolution(feature_matri...
<|body_start_0|> this_target_matrix = standalone_utils.do_2d_convolution(feature_matrix=TARGET_MATRIX, kernel_matrix=WEIGHT_MATRIX_SIZE0, pad_edges=True, stride_length_px=1) self.assertTrue(numpy.allclose(this_target_matrix, TARGET_MATRIX, atol=TOLERANCE)) this_prediction_matrix = standalone_uti...
Each method is a unit test for standalone_utils.py.
StandaloneUtilsTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandaloneUtilsTests: """Each method is a unit test for standalone_utils.py.""" def test_do_2d_convolution_size0(self): """Ensures correct output from do_2d_convolution. In this case, half-window size is 0 pixels.""" <|body_0|> def test_do_2d_convolution_size1(self): ...
stack_v2_sparse_classes_75kplus_train_001143
4,632
no_license
[ { "docstring": "Ensures correct output from do_2d_convolution. In this case, half-window size is 0 pixels.", "name": "test_do_2d_convolution_size0", "signature": "def test_do_2d_convolution_size0(self)" }, { "docstring": "Ensures correct output from do_2d_convolution. In this case, half-window s...
3
null
Implement the Python class `StandaloneUtilsTests` described below. Class description: Each method is a unit test for standalone_utils.py. Method signatures and docstrings: - def test_do_2d_convolution_size0(self): Ensures correct output from do_2d_convolution. In this case, half-window size is 0 pixels. - def test_do...
Implement the Python class `StandaloneUtilsTests` described below. Class description: Each method is a unit test for standalone_utils.py. Method signatures and docstrings: - def test_do_2d_convolution_size0(self): Ensures correct output from do_2d_convolution. In this case, half-window size is 0 pixels. - def test_do...
cf5e9682bc3182305274132ae246bc72d994308f
<|skeleton|> class StandaloneUtilsTests: """Each method is a unit test for standalone_utils.py.""" def test_do_2d_convolution_size0(self): """Ensures correct output from do_2d_convolution. In this case, half-window size is 0 pixels.""" <|body_0|> def test_do_2d_convolution_size1(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StandaloneUtilsTests: """Each method is a unit test for standalone_utils.py.""" def test_do_2d_convolution_size0(self): """Ensures correct output from do_2d_convolution. In this case, half-window size is 0 pixels.""" this_target_matrix = standalone_utils.do_2d_convolution(feature_matrix=T...
the_stack_v2_python_sparse
ml4convection/machine_learning/standalone_utils_test.py
thunderhoser/ml4convection
train
14
9059e5efda6ca76153784e9dd736cc896b348a89
[ "self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_speed_factor = 1.5\nself.ship_limit = 1\nself.bullet_speed_factor = 10\nself.bullet_width = 500\nself.bullet_height = 15\nself.bullet_color = (192, 14, 235)\nself.bullets_allowed = 30\nself.alien_speed_factor = 1\nself.f...
<|body_start_0|> self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.ship_speed_factor = 1.5 self.ship_limit = 1 self.bullet_speed_factor = 10 self.bullet_width = 500 self.bullet_height = 15 self.bullet_color = (1...
存储《外星人入侵》的所有设置的类
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置""" <|body_2|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_001144
1,663
no_license
[ { "docstring": "初始化游戏的设置", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "初始化随游戏进行而变化的设置", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { "docstring": "提高速度设置", "name": "increase_speed", "signatur...
3
stack_v2_sparse_classes_30k_train_002976
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置
Implement the Python class `Settings` described below. Class description: 存储《外星人入侵》的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置 <|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __ini...
53073a7e6b393f92f5737edaa917c9100b7e0a5e
<|skeleton|> class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Settings: """存储《外星人入侵》的所有设置的类""" def __init__(self): """初始化游戏的设置""" self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.ship_speed_factor = 1.5 self.ship_limit = 1 self.bullet_speed_factor = 10 self.bullet_...
the_stack_v2_python_sparse
python/AllienGame/settings.py
amorcc/code
train
0
c9940f4dc7155ad37b68d220ae4e8beddf19646a
[ "args_parser = RequestParser()\nargs_parser.add_argument('page', type=inputs.positive, required=False, location='args')\nargs_parser.add_argument('per_page', type=inputs.int_range(constants.PER_PAGE_MIN, constants.PER_PAGE_MAX, 'per_page'), required=False, location='args')\nargs_parser.add_argument('word', location...
<|body_start_0|> args_parser = RequestParser() args_parser.add_argument('page', type=inputs.positive, required=False, location='args') args_parser.add_argument('per_page', type=inputs.int_range(constants.PER_PAGE_MIN, constants.PER_PAGE_MAX, 'per_page'), required=False, location='args') ...
敏感词
SensitiveWordListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensitiveWordListResource: """敏感词""" def get(self): """获取敏感词列表""" <|body_0|> def post(self): """添加敏感词""" <|body_1|> <|end_skeleton|> <|body_start_0|> args_parser = RequestParser() args_parser.add_argument('page', type=inputs.positive, re...
stack_v2_sparse_classes_75kplus_train_001145
5,331
no_license
[ { "docstring": "获取敏感词列表", "name": "get", "signature": "def get(self)" }, { "docstring": "添加敏感词", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_024774
Implement the Python class `SensitiveWordListResource` described below. Class description: 敏感词 Method signatures and docstrings: - def get(self): 获取敏感词列表 - def post(self): 添加敏感词
Implement the Python class `SensitiveWordListResource` described below. Class description: 敏感词 Method signatures and docstrings: - def get(self): 获取敏感词列表 - def post(self): 添加敏感词 <|skeleton|> class SensitiveWordListResource: """敏感词""" def get(self): """获取敏感词列表""" <|body_0|> def post(self...
c9703a9c57a98babf8d1e41b227aada9ef4bfe15
<|skeleton|> class SensitiveWordListResource: """敏感词""" def get(self): """获取敏感词列表""" <|body_0|> def post(self): """添加敏感词""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SensitiveWordListResource: """敏感词""" def get(self): """获取敏感词列表""" args_parser = RequestParser() args_parser.add_argument('page', type=inputs.positive, required=False, location='args') args_parser.add_argument('per_page', type=inputs.int_range(constants.PER_PAGE_MIN, consta...
the_stack_v2_python_sparse
mis/resources/recommend/sensitive.py
Yaooooooooooooo/toutiao-backend
train
0
49da06c27a279978a29d115758ac6cec5aebf1c6
[ "serializer = TJWSerializer(settings.SECRET_KEY, 3600 * 24)\ndata = {'username': self.username, 'email': self.email}\ntoken = serializer.dumps(data).decode()\nverify_url = settings.EMAIL_VERIFY_URL + '?token=' + token\nreturn verify_url", "serializer = TJWSerializer(settings.SECRET_KEY, 3600 * 24)\ntry:\n data...
<|body_start_0|> serializer = TJWSerializer(settings.SECRET_KEY, 3600 * 24) data = {'username': self.username, 'email': self.email} token = serializer.dumps(data).decode() verify_url = settings.EMAIL_VERIFY_URL + '?token=' + token return verify_url <|end_body_0|> <|body_start_1|...
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: def generate_email_verify_url(self): """生成邮箱激活连接""" <|body_0|> def check_verify_email_token(token): """对token解密,并查询对应的user""" <|body_1|> <|end_skeleton|> <|body_start_0|> serializer = TJWSerializer(settings.SECRET_KEY, 3600 * 24) data ...
stack_v2_sparse_classes_75kplus_train_001146
2,521
no_license
[ { "docstring": "生成邮箱激活连接", "name": "generate_email_verify_url", "signature": "def generate_email_verify_url(self)" }, { "docstring": "对token解密,并查询对应的user", "name": "check_verify_email_token", "signature": "def check_verify_email_token(token)" } ]
2
null
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def generate_email_verify_url(self): 生成邮箱激活连接 - def check_verify_email_token(token): 对token解密,并查询对应的user
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def generate_email_verify_url(self): 生成邮箱激活连接 - def check_verify_email_token(token): 对token解密,并查询对应的user <|skeleton|> class User: def generate_email_verify_url(self): """生成...
94d1ea40fdcdbb6288f9ed547d22d4f3111cd264
<|skeleton|> class User: def generate_email_verify_url(self): """生成邮箱激活连接""" <|body_0|> def check_verify_email_token(token): """对token解密,并查询对应的user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: def generate_email_verify_url(self): """生成邮箱激活连接""" serializer = TJWSerializer(settings.SECRET_KEY, 3600 * 24) data = {'username': self.username, 'email': self.email} token = serializer.dumps(data).decode() verify_url = settings.EMAIL_VERIFY_URL + '?token=' + toke...
the_stack_v2_python_sparse
dada_mall/dada_mall/apps/user/models.py
dingshenghao/dada_mall
train
0
ac960c5200912432220c41002eaa00ee8d86af63
[ "if response_status.lower() == 'success':\n assert f'Response status: {response_status}'\nelif response_status != 'success':\n assert False, f'Response status: {response_status}'\nelse:\n assert False, 'Something wrong'", "if response_status_code == 200:\n assert f'Response status code: {response_stat...
<|body_start_0|> if response_status.lower() == 'success': assert f'Response status: {response_status}' elif response_status != 'success': assert False, f'Response status: {response_status}' else: assert False, 'Something wrong' <|end_body_0|> <|body_start_1|>...
TestDog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDog: def test_response_status(self, response_status): """Тест проверяет текст успешности ответа сервера для запроса произвольно выбранного изображения собаки""" <|body_0|> def test_response_status_code(self, response_status_code): """Тест проверяет код успешности...
stack_v2_sparse_classes_75kplus_train_001147
2,869
no_license
[ { "docstring": "Тест проверяет текст успешности ответа сервера для запроса произвольно выбранного изображения собаки", "name": "test_response_status", "signature": "def test_response_status(self, response_status)" }, { "docstring": "Тест проверяет код успешности ответа сервера для запроса произв...
5
stack_v2_sparse_classes_30k_train_006459
Implement the Python class `TestDog` described below. Class description: Implement the TestDog class. Method signatures and docstrings: - def test_response_status(self, response_status): Тест проверяет текст успешности ответа сервера для запроса произвольно выбранного изображения собаки - def test_response_status_cod...
Implement the Python class `TestDog` described below. Class description: Implement the TestDog class. Method signatures and docstrings: - def test_response_status(self, response_status): Тест проверяет текст успешности ответа сервера для запроса произвольно выбранного изображения собаки - def test_response_status_cod...
54467b2334b33ae48b5fa5a65cab47fdf03967be
<|skeleton|> class TestDog: def test_response_status(self, response_status): """Тест проверяет текст успешности ответа сервера для запроса произвольно выбранного изображения собаки""" <|body_0|> def test_response_status_code(self, response_status_code): """Тест проверяет код успешности...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestDog: def test_response_status(self, response_status): """Тест проверяет текст успешности ответа сервера для запроса произвольно выбранного изображения собаки""" if response_status.lower() == 'success': assert f'Response status: {response_status}' elif response_status !=...
the_stack_v2_python_sparse
03_REST_API/dog_api/test_dog_api.py
vamotest/qa_automation
train
4
115e070509a3f9c3e7c618263faedf6b4e97bff3
[ "self.c = capacity\nself.used = []\nself.f = {}\nself.m = {}", "if key not in self.m:\n return -1\nself.f[key] += 1\nself.used.remove(key)\nself.used.append(key)\nreturn self.m[key]", "if self.c == 0:\n return\nif key in self.f:\n self.f[key] += 1\n self.used.remove(key)\n self.used.append(key)\n...
<|body_start_0|> self.c = capacity self.used = [] self.f = {} self.m = {} <|end_body_0|> <|body_start_1|> if key not in self.m: return -1 self.f[key] += 1 self.used.remove(key) self.used.append(key) return self.m[key] <|end_body_1|> <...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_001148
1,544
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "se...
3
stack_v2_sparse_classes_30k_train_049752
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: void <|sk...
fa1a63cb192666fc6aa5c7c72130993818ea58d0
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.c = capacity self.used = [] self.f = {} self.m = {} def get(self, key): """:type key: int :rtype: int""" if key not in self.m: return -1 self.f[key] += 1 ...
the_stack_v2_python_sparse
q460.py
gitttttt/lc
train
0
aeb3ab99d75b26bd66743ad4a6bee3666807a4ab
[ "fmt = 'PO-{abc:02f}-{ref:04d}-{date}-???'\ninfo = InvenTree.format.parse_format_string(fmt)\nself.assertIn('abc', info)\nself.assertIn('ref', info)\nself.assertIn('date', info)\nfor fmt in ['PO-{{xyz}', 'PO-{xyz}}', 'PO-{xyz}-{']:\n with self.assertRaises(ValueError):\n InvenTree.format.parse_format_stri...
<|body_start_0|> fmt = 'PO-{abc:02f}-{ref:04d}-{date}-???' info = InvenTree.format.parse_format_string(fmt) self.assertIn('abc', info) self.assertIn('ref', info) self.assertIn('date', info) for fmt in ['PO-{{xyz}', 'PO-{xyz}}', 'PO-{xyz}-{']: with self.assertR...
Unit tests for custom string formatting functionality
FormatTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatTest: """Unit tests for custom string formatting functionality""" def test_parse(self): """Tests for the 'parse_format_string' function""" <|body_0|> def test_create_regex(self): """Test function for creating a regex from a format string""" <|body_1...
stack_v2_sparse_classes_75kplus_train_001149
41,191
permissive
[ { "docstring": "Tests for the 'parse_format_string' function", "name": "test_parse", "signature": "def test_parse(self)" }, { "docstring": "Test function for creating a regex from a format string", "name": "test_create_regex", "signature": "def test_create_regex(self)" }, { "docs...
4
stack_v2_sparse_classes_30k_train_016399
Implement the Python class `FormatTest` described below. Class description: Unit tests for custom string formatting functionality Method signatures and docstrings: - def test_parse(self): Tests for the 'parse_format_string' function - def test_create_regex(self): Test function for creating a regex from a format strin...
Implement the Python class `FormatTest` described below. Class description: Unit tests for custom string formatting functionality Method signatures and docstrings: - def test_parse(self): Tests for the 'parse_format_string' function - def test_create_regex(self): Test function for creating a regex from a format strin...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class FormatTest: """Unit tests for custom string formatting functionality""" def test_parse(self): """Tests for the 'parse_format_string' function""" <|body_0|> def test_create_regex(self): """Test function for creating a regex from a format string""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FormatTest: """Unit tests for custom string formatting functionality""" def test_parse(self): """Tests for the 'parse_format_string' function""" fmt = 'PO-{abc:02f}-{ref:04d}-{date}-???' info = InvenTree.format.parse_format_string(fmt) self.assertIn('abc', info) se...
the_stack_v2_python_sparse
InvenTree/InvenTree/tests.py
inventree/InvenTree
train
3,077
d994fc32514f8166a35f40972a7fc640054a3b88
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information about a specific analysis instance on a resource. An occu...
ContainerAnalysisServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContainerAnalysisServicer: """Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information abou...
stack_v2_sparse_classes_75kplus_train_001150
6,187
permissive
[ { "docstring": "Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOT...
3
stack_v2_sparse_classes_30k_train_046647
Implement the Python class `ContainerAnalysisServicer` described below. Class description: Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An...
Implement the Python class `ContainerAnalysisServicer` described below. Class description: Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class ContainerAnalysisServicer: """Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information abou...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContainerAnalysisServicer: """Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information about a specific ...
the_stack_v2_python_sparse
containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py
tswast/google-cloud-python
train
1
6d813bb102040147e9879520800106159d9225b8
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserTrainingStatusInfo()", "from .training_status import TrainingStatus\nfrom .training_status import TrainingStatus\nfields: Dict[str, Callable[[Any], None]] = {'assignedDateTime': lambda n: setattr(self, 'assigned_date_time', n.get_d...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserTrainingStatusInfo() <|end_body_0|> <|body_start_1|> from .training_status import TrainingStatus from .training_status import TrainingStatus fields: Dict[str, Callable[[Any],...
UserTrainingStatusInfo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTrainingStatusInfo: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserTrainingStatusInfo: """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 ...
stack_v2_sparse_classes_75kplus_train_001151
3,696
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: UserTrainingStatusInfo", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
stack_v2_sparse_classes_30k_train_012894
Implement the Python class `UserTrainingStatusInfo` described below. Class description: Implement the UserTrainingStatusInfo class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserTrainingStatusInfo: Creates a new instance of the appropriate class b...
Implement the Python class `UserTrainingStatusInfo` described below. Class description: Implement the UserTrainingStatusInfo class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserTrainingStatusInfo: Creates a new instance of the appropriate class b...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserTrainingStatusInfo: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserTrainingStatusInfo: """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 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserTrainingStatusInfo: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserTrainingStatusInfo: """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 Ret...
the_stack_v2_python_sparse
msgraph/generated/models/user_training_status_info.py
microsoftgraph/msgraph-sdk-python
train
135
d0e49691d01165326447f346c7624fdbf6e7f72d
[ "self.domain = domain or config.Master.master_domain\nself.permitted_domains = permitted_domains or config.Master.permitted_domains\nif self.permitted_domains:\n assert isinstance(self.permitted_domains, tuple), 'permitted_domains must be a tuple, now it is a %s (value: %s)' % (type(self.permitted_domains), self...
<|body_start_0|> self.domain = domain or config.Master.master_domain self.permitted_domains = permitted_domains or config.Master.permitted_domains if self.permitted_domains: assert isinstance(self.permitted_domains, tuple), 'permitted_domains must be a tuple, now it is a %s (value: %...
Similar to buildbot.mail.Domain but permits filtering out people we don't want to spam. Also loads default values from chromium_config.
FilterDomain
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterDomain: """Similar to buildbot.mail.Domain but permits filtering out people we don't want to spam. Also loads default values from chromium_config.""" def __init__(self, domain=None, permitted_domains=None): """domain is the default domain to append when only the naked username ...
stack_v2_sparse_classes_75kplus_train_001152
27,927
permissive
[ { "docstring": "domain is the default domain to append when only the naked username is available. permitted_domains is a whitelist of domains that emails will be sent to.", "name": "__init__", "signature": "def __init__(self, domain=None, permitted_domains=None)" }, { "docstring": "If name is al...
2
stack_v2_sparse_classes_30k_train_027888
Implement the Python class `FilterDomain` described below. Class description: Similar to buildbot.mail.Domain but permits filtering out people we don't want to spam. Also loads default values from chromium_config. Method signatures and docstrings: - def __init__(self, domain=None, permitted_domains=None): domain is t...
Implement the Python class `FilterDomain` described below. Class description: Similar to buildbot.mail.Domain but permits filtering out people we don't want to spam. Also loads default values from chromium_config. Method signatures and docstrings: - def __init__(self, domain=None, permitted_domains=None): domain is t...
f8e42c70146c1b668421ee6358dc550a955770a3
<|skeleton|> class FilterDomain: """Similar to buildbot.mail.Domain but permits filtering out people we don't want to spam. Also loads default values from chromium_config.""" def __init__(self, domain=None, permitted_domains=None): """domain is the default domain to append when only the naked username ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FilterDomain: """Similar to buildbot.mail.Domain but permits filtering out people we don't want to spam. Also loads default values from chromium_config.""" def __init__(self, domain=None, permitted_domains=None): """domain is the default domain to append when only the naked username is available....
the_stack_v2_python_sparse
scripts/master/master_utils.py
mcgreevy/chromium-build
train
0
1e15e54e6f32fd3b7a97542a8a025be3e74543fe
[ "if target <= 1:\n raise ValueError(f'Target iteration of ETA must be > 1, got {target}')\nself.targetIteration = target\nself._ti = None\nself._xi = None", "if self._ti is None:\n if current > 0:\n self._ti = time.time()\n self._xi = current\n return None\nif current <= self._xi:\n retu...
<|body_start_0|> if target <= 1: raise ValueError(f'Target iteration of ETA must be > 1, got {target}') self.targetIteration = target self._ti = None self._xi = None <|end_body_0|> <|body_start_1|> if self._ti is None: if current > 0: self...
! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for mostly stable durations. The start ...
ETA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for most...
stack_v2_sparse_classes_75kplus_train_001153
29,663
permissive
[ { "docstring": "!Initialize with a given target iteration number.", "name": "__init__", "signature": "def __init__(self, target)" }, { "docstring": "! Estimate the time of arrival given a current iteration. \\\\param current Iteration number the loop is currently at. \\\\returns - Estimated time...
3
stack_v2_sparse_classes_30k_train_027683
Implement the Python class `ETA` described below. Class description: ! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterat...
Implement the Python class `ETA` described below. Class description: ! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterat...
41557db1965bf3801bfadf9ece39ec1dab9b7660
<|skeleton|> class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for most...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ETA: """! Estimate the time of arrival for iterations. The ETA is computed from a linear regression to the starting time and current time (time at execution of the __call__ method). This is not very stable for strongly changing durations of individual iterations but gives a good estimate for mostly stable dur...
the_stack_v2_python_sparse
src/isle/cli.py
evanberkowitz/isle
train
3
03dbcca9c17893d472412f1d71ca1b7d2362c564
[ "filter_parser = reqparse.RequestParser(bundle_errors=True)\nfilter_parser.add_argument('last_pk', type=int, default=0, location='args')\nfilter_parser.add_argument('limit_num', type=int, default=20, location='args')\nfilter_parser_args = filter_parser.parse_args()\ndata = get_customer_limit_rows_by_last_id(**filte...
<|body_start_0|> filter_parser = reqparse.RequestParser(bundle_errors=True) filter_parser.add_argument('last_pk', type=int, default=0, location='args') filter_parser.add_argument('limit_num', type=int, default=20, location='args') filter_parser_args = filter_parser.parse_args() d...
CustomerListResource
CustomerListResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerListResource: """CustomerListResource""" def get(self): """Example: curl http://0.0.0.0:5000/bearings/customers curl http://0.0.0.0:5000/bearings/customers?last_pk=2&limit_num=2 :return:""" <|body_0|> def post(self): """Example: curl http://0.0.0.0:5000/b...
stack_v2_sparse_classes_75kplus_train_001154
5,730
permissive
[ { "docstring": "Example: curl http://0.0.0.0:5000/bearings/customers curl http://0.0.0.0:5000/bearings/customers?last_pk=2&limit_num=2 :return:", "name": "get", "signature": "def get(self)" }, { "docstring": "Example: curl http://0.0.0.0:5000/bearings/customers -H \"Content-Type: application/jso...
2
null
Implement the Python class `CustomerListResource` described below. Class description: CustomerListResource Method signatures and docstrings: - def get(self): Example: curl http://0.0.0.0:5000/bearings/customers curl http://0.0.0.0:5000/bearings/customers?last_pk=2&limit_num=2 :return: - def post(self): Example: curl ...
Implement the Python class `CustomerListResource` described below. Class description: CustomerListResource Method signatures and docstrings: - def get(self): Example: curl http://0.0.0.0:5000/bearings/customers curl http://0.0.0.0:5000/bearings/customers?last_pk=2&limit_num=2 :return: - def post(self): Example: curl ...
6ef54f3f7efbbaff6169e963dcf45ab25e11e593
<|skeleton|> class CustomerListResource: """CustomerListResource""" def get(self): """Example: curl http://0.0.0.0:5000/bearings/customers curl http://0.0.0.0:5000/bearings/customers?last_pk=2&limit_num=2 :return:""" <|body_0|> def post(self): """Example: curl http://0.0.0.0:5000/b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomerListResource: """CustomerListResource""" def get(self): """Example: curl http://0.0.0.0:5000/bearings/customers curl http://0.0.0.0:5000/bearings/customers?last_pk=2&limit_num=2 :return:""" filter_parser = reqparse.RequestParser(bundle_errors=True) filter_parser.add_argume...
the_stack_v2_python_sparse
web_api/bearings/resources/customer.py
zhanghe06/flask_restful
train
2
7bfc64407fc6fd15028b7b3ec82751a623ef652e
[ "context = super(DeleteStatusMessageView, self).get_context_data(**kwargs)\nstatus = StatusMessage.objects.get(pk=self.kwargs['status_pk'])\ncontext['status'] = status\nreturn context", "profile_pk = self.kwargs['profile_pk']\nstatus_pk = self.kwargs['status_pk']\nstatus = StatusMessage.objects.get(pk=status_pk)\...
<|body_start_0|> context = super(DeleteStatusMessageView, self).get_context_data(**kwargs) status = StatusMessage.objects.get(pk=self.kwargs['status_pk']) context['status'] = status return context <|end_body_0|> <|body_start_1|> profile_pk = self.kwargs['profile_pk'] sta...
a view to delete a quote
DeleteStatusMessageView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteStatusMessageView: """a view to delete a quote""" def get_context_data(self, **kwargs): """Return the context data (a dictionary) to be used in the template.""" <|body_0|> def get_object(self, **kwargs): """return a single instance of a quote object, select...
stack_v2_sparse_classes_75kplus_train_001155
5,336
no_license
[ { "docstring": "Return the context data (a dictionary) to be used in the template.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "return a single instance of a quote object, selected at random", "name": "get_object", "signature": "def...
3
stack_v2_sparse_classes_30k_train_052706
Implement the Python class `DeleteStatusMessageView` described below. Class description: a view to delete a quote Method signatures and docstrings: - def get_context_data(self, **kwargs): Return the context data (a dictionary) to be used in the template. - def get_object(self, **kwargs): return a single instance of a...
Implement the Python class `DeleteStatusMessageView` described below. Class description: a view to delete a quote Method signatures and docstrings: - def get_context_data(self, **kwargs): Return the context data (a dictionary) to be used in the template. - def get_object(self, **kwargs): return a single instance of a...
7490df5c5c074493cad65a043364c673d49ace65
<|skeleton|> class DeleteStatusMessageView: """a view to delete a quote""" def get_context_data(self, **kwargs): """Return the context data (a dictionary) to be used in the template.""" <|body_0|> def get_object(self, **kwargs): """return a single instance of a quote object, select...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeleteStatusMessageView: """a view to delete a quote""" def get_context_data(self, **kwargs): """Return the context data (a dictionary) to be used in the template.""" context = super(DeleteStatusMessageView, self).get_context_data(**kwargs) status = StatusMessage.objects.get(pk=se...
the_stack_v2_python_sparse
mini_fb/views.py
askap-bu/askap-bu
train
0
2c3e15131d0fddb7764d02213f2e87be4c270b7b
[ "res = []\nuf = UnionFind(n)\nfor user1, user2 in requests:\n root1, root2 = (uf.find(user1), uf.find(user2))\n if root1 == root2:\n res.append(True)\n else:\n for user3, user4 in restrictions:\n root3, root4 = (uf.find(user3), uf.find(user4))\n if root1 == root3 and roo...
<|body_start_0|> res = [] uf = UnionFind(n) for user1, user2 in requests: root1, root2 = (uf.find(user1), uf.find(user2)) if root1 == root2: res.append(True) else: for user3, user4 in restrictions: root3, roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: """并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)""" <|body_0|> def friendRequests2(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List...
stack_v2_sparse_classes_75kplus_train_001156
3,693
no_license
[ { "docstring": "并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)", "name": "friendRequests", "signature": "def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]" }, { "docstring": "可撤销并查集", "name": "friendRequests2", "signature": "def friendRe...
2
stack_v2_sparse_classes_30k_train_014117
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: 并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2) - def friendRequests2(self, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: 并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2) - def friendRequests2(self, n...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: """并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)""" <|body_0|> def friendRequests2(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def friendRequests(self, n: int, restrictions: List[List[int]], requests: List[List[int]]) -> List[bool]: """并查集,连接之前遍历限制找到对应组的边,如果边重合,那么就不能连这条边 O(n^2)""" res = [] uf = UnionFind(n) for user1, user2 in requests: root1, root2 = (uf.find(user1), uf.find(user...
the_stack_v2_python_sparse
14_并查集/经典题/2076. 处理含限制条件的好友请求.py
981377660LMT/algorithm-study
train
225
723b88ebb01c603955e1ebc4df95994caad0585f
[ "assert schema is not None, 'The `schema` argument must be provided.'\nif not schema.coerce:\n return check_obj\nerror_handler = SchemaErrorHandler(lazy=True)\ncoerced_multi_index = {}\nfor i, index in enumerate(schema.indexes):\n if all((x is None for x in schema.names)):\n index_levels = [i]\n els...
<|body_start_0|> assert schema is not None, 'The `schema` argument must be provided.' if not schema.coerce: return check_obj error_handler = SchemaErrorHandler(lazy=True) coerced_multi_index = {} for i, index in enumerate(schema.indexes): if all((x is None...
Backend implementation for pandas multiindex.
MultiIndexBackend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiIndexBackend: """Backend implementation for pandas multiindex.""" def coerce_dtype(self, check_obj: pd.MultiIndex, schema=None) -> pd.MultiIndex: """Coerce type of a pd.Series by type specified in dtype. :param obj: multi-index to coerce. :returns: ``MultiIndex`` with coerced da...
stack_v2_sparse_classes_75kplus_train_001157
19,001
permissive
[ { "docstring": "Coerce type of a pd.Series by type specified in dtype. :param obj: multi-index to coerce. :returns: ``MultiIndex`` with coerced data type", "name": "coerce_dtype", "signature": "def coerce_dtype(self, check_obj: pd.MultiIndex, schema=None) -> pd.MultiIndex" }, { "docstring": "Val...
4
stack_v2_sparse_classes_30k_train_023069
Implement the Python class `MultiIndexBackend` described below. Class description: Backend implementation for pandas multiindex. Method signatures and docstrings: - def coerce_dtype(self, check_obj: pd.MultiIndex, schema=None) -> pd.MultiIndex: Coerce type of a pd.Series by type specified in dtype. :param obj: multi-...
Implement the Python class `MultiIndexBackend` described below. Class description: Backend implementation for pandas multiindex. Method signatures and docstrings: - def coerce_dtype(self, check_obj: pd.MultiIndex, schema=None) -> pd.MultiIndex: Coerce type of a pd.Series by type specified in dtype. :param obj: multi-...
850dcf8e59632d54bc9a6df47b9ca08afa089a27
<|skeleton|> class MultiIndexBackend: """Backend implementation for pandas multiindex.""" def coerce_dtype(self, check_obj: pd.MultiIndex, schema=None) -> pd.MultiIndex: """Coerce type of a pd.Series by type specified in dtype. :param obj: multi-index to coerce. :returns: ``MultiIndex`` with coerced da...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiIndexBackend: """Backend implementation for pandas multiindex.""" def coerce_dtype(self, check_obj: pd.MultiIndex, schema=None) -> pd.MultiIndex: """Coerce type of a pd.Series by type specified in dtype. :param obj: multi-index to coerce. :returns: ``MultiIndex`` with coerced data type""" ...
the_stack_v2_python_sparse
pandera/backends/pandas/components.py
unionai-oss/pandera
train
997
e4e16aaaa13dc523c00a4720626e7317a8ddadcd
[ "super().__init__(mol, cuda)\nself.order = order\nself.fc = nn.Linear(order, 1, bias=False)\nself.fc.weight.data *= 0.0\nself.fc.weight.data[0, 0] = 0.0001", "original_shape = ree.shape\nx = ree.reshape(-1, 1)\nx = x.repeat(1, self.order)\nx = x.cumprod(dim=-1)\nx = self.fc(x)\nx = x.reshape(*original_shape)\nret...
<|body_start_0|> super().__init__(mol, cuda) self.order = order self.fc = nn.Linear(order, 1, bias=False) self.fc.weight.data *= 0.0 self.fc.weight.data[0, 0] = 0.0001 <|end_body_0|> <|body_start_1|> original_shape = ree.shape x = ree.reshape(-1, 1) x = x...
BackFlowKernelPowerSum
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackFlowKernelPowerSum: def __init__(self, mol, cuda, order=2): """Compute the back flow kernel, i.e. the function f(rij) where rij is the distance between electron i and j This kernel is used in the backflow transformation .. math: q_i = r_i + \\sum_{j\\neq i} f(r_{ij}) (r_i-r_j)""" ...
stack_v2_sparse_classes_75kplus_train_001158
1,060
permissive
[ { "docstring": "Compute the back flow kernel, i.e. the function f(rij) where rij is the distance between electron i and j This kernel is used in the backflow transformation .. math: q_i = r_i + \\\\sum_{j\\\\neq i} f(r_{ij}) (r_i-r_j)", "name": "__init__", "signature": "def __init__(self, mol, cuda, ord...
2
stack_v2_sparse_classes_30k_train_034270
Implement the Python class `BackFlowKernelPowerSum` described below. Class description: Implement the BackFlowKernelPowerSum class. Method signatures and docstrings: - def __init__(self, mol, cuda, order=2): Compute the back flow kernel, i.e. the function f(rij) where rij is the distance between electron i and j This...
Implement the Python class `BackFlowKernelPowerSum` described below. Class description: Implement the BackFlowKernelPowerSum class. Method signatures and docstrings: - def __init__(self, mol, cuda, order=2): Compute the back flow kernel, i.e. the function f(rij) where rij is the distance between electron i and j This...
439a79e97ee63057e3032d28a1a5ebafd2d5b5e4
<|skeleton|> class BackFlowKernelPowerSum: def __init__(self, mol, cuda, order=2): """Compute the back flow kernel, i.e. the function f(rij) where rij is the distance between electron i and j This kernel is used in the backflow transformation .. math: q_i = r_i + \\sum_{j\\neq i} f(r_{ij}) (r_i-r_j)""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BackFlowKernelPowerSum: def __init__(self, mol, cuda, order=2): """Compute the back flow kernel, i.e. the function f(rij) where rij is the distance between electron i and j This kernel is used in the backflow transformation .. math: q_i = r_i + \\sum_{j\\neq i} f(r_{ij}) (r_i-r_j)""" super()._...
the_stack_v2_python_sparse
qmctorch/wavefunction/orbitals/backflow/kernels/backflow_kernel_power_sum.py
NLESC-JCER/QMCTorch
train
22
324c91d4a4726c8fc90533c8d404843988cd2fff
[ "arr = []\nstack = [root]\nwhile stack:\n root = stack.pop()\n if not root:\n continue\n arr.append(root.val)\n stack.append(root.right)\n stack.append(root.left)\nreturn arr", "arr = []\nstack = []\nwhile root or stack:\n while root:\n stack.append(root)\n root = root.left\...
<|body_start_0|> arr = [] stack = [root] while stack: root = stack.pop() if not root: continue arr.append(root.val) stack.append(root.right) stack.append(root.left) return arr <|end_body_0|> <|body_start_1|> ...
非递归法实现前、中、后序遍历
Solution2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: """非递归法实现前、中、后序遍历""" def pre_order(self, root): """前序遍历""" <|body_0|> def in_order(self, root): """中序遍历""" <|body_1|> def post_order(self, root): """后序遍历""" <|body_2|> <|end_skeleton|> <|body_start_0|> arr = [] ...
stack_v2_sparse_classes_75kplus_train_001159
2,354
no_license
[ { "docstring": "前序遍历", "name": "pre_order", "signature": "def pre_order(self, root)" }, { "docstring": "中序遍历", "name": "in_order", "signature": "def in_order(self, root)" }, { "docstring": "后序遍历", "name": "post_order", "signature": "def post_order(self, root)" } ]
3
stack_v2_sparse_classes_30k_train_035469
Implement the Python class `Solution2` described below. Class description: 非递归法实现前、中、后序遍历 Method signatures and docstrings: - def pre_order(self, root): 前序遍历 - def in_order(self, root): 中序遍历 - def post_order(self, root): 后序遍历
Implement the Python class `Solution2` described below. Class description: 非递归法实现前、中、后序遍历 Method signatures and docstrings: - def pre_order(self, root): 前序遍历 - def in_order(self, root): 中序遍历 - def post_order(self, root): 后序遍历 <|skeleton|> class Solution2: """非递归法实现前、中、后序遍历""" def pre_order(self, root): ...
cbdb055bfdf34ce2e143ab10af90372422984008
<|skeleton|> class Solution2: """非递归法实现前、中、后序遍历""" def pre_order(self, root): """前序遍历""" <|body_0|> def in_order(self, root): """中序遍历""" <|body_1|> def post_order(self, root): """后序遍历""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution2: """非递归法实现前、中、后序遍历""" def pre_order(self, root): """前序遍历""" arr = [] stack = [root] while stack: root = stack.pop() if not root: continue arr.append(root.val) stack.append(root.right) sta...
the_stack_v2_python_sparse
18_tree_iterate.py
turbobin/algorithm_learning
train
0
ab3006fe41b68bdecd862b9fad7e15178d645949
[ "if not root:\n return ''\nseq = ''\nlevel = [root]\nwhile level:\n next_level = []\n flag = False\n for node in level:\n if node is None:\n next_level.extend([None, None])\n seq += '#'\n else:\n next_level.extend([node.left, node.right])\n seq +...
<|body_start_0|> if not root: return '' seq = '' level = [root] while level: next_level = [] flag = False for node in level: if node is None: next_level.extend([None, None]) seq += '#'...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_75kplus_train_001160
5,549
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
052bd7915257679877dbe55b60ed1abb7528eaa2
<|skeleton|> class Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' seq = '' level = [root] while level: next_level = [] flag = False for node in level: ...
the_stack_v2_python_sparse
python_solution/Tree/297_SerializeAndDeserializeBinaryTree.py
Dimen61/leetcode
train
4
6da4425102b6b5847d98115febd4c17c7c8654bf
[ "if HAVE_PY26_SSL:\n self.sslobj = ssl.wrap_socket(self.sock)\n self.sslobj.do_handshake()\nelse:\n self.sslobj = socket.ssl(self.sock)", "result = self.sslobj.read(n)\nwhile len(result) < n:\n s = self.sslobj.read(n - len(result))\n if not s:\n raise IOError('Socket closed')\n result += ...
<|body_start_0|> if HAVE_PY26_SSL: self.sslobj = ssl.wrap_socket(self.sock) self.sslobj.do_handshake() else: self.sslobj = socket.ssl(self.sock) <|end_body_0|> <|body_start_1|> result = self.sslobj.read(n) while len(result) < n: s = self.s...
Transport that works over SSL
SSLTransport
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSLTransport: """Transport that works over SSL""" def _setup_transport(self): """Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version.""" <|body_0|> def _read(self, n): """It seems that SSL Objects read() ...
stack_v2_sparse_classes_75kplus_train_001161
5,384
permissive
[ { "docstring": "Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version.", "name": "_setup_transport", "signature": "def _setup_transport(self)" }, { "docstring": "It seems that SSL Objects read() method may not supply as much as you're aski...
3
stack_v2_sparse_classes_30k_train_022001
Implement the Python class `SSLTransport` described below. Class description: Transport that works over SSL Method signatures and docstrings: - def _setup_transport(self): Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version. - def _read(self, n): It seems tha...
Implement the Python class `SSLTransport` described below. Class description: Transport that works over SSL Method signatures and docstrings: - def _setup_transport(self): Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version. - def _read(self, n): It seems tha...
37444fb16b36743c439b0d6c3cac2347e0cc0a94
<|skeleton|> class SSLTransport: """Transport that works over SSL""" def _setup_transport(self): """Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version.""" <|body_0|> def _read(self, n): """It seems that SSL Objects read() ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSLTransport: """Transport that works over SSL""" def _setup_transport(self): """Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version.""" if HAVE_PY26_SSL: self.sslobj = ssl.wrap_socket(self.sock) self.sslob...
the_stack_v2_python_sparse
vendor/amqplib/client_0_8/transport.py
bopopescu/cc-2
train
0
863777be6a8136dd8144abda04eea8a9265533b8
[ "if not data:\n data = 0\nif not size:\n size = 1\nmax_size = 2 ** (size * 8)\nif data >= max_size:\n data = max_size - 1\nreturn data.to_bytes(size, byteorder='big')", "if not size:\n size = 1\nif len(payload) < size:\n return (payload, None)\nreturn (payload[size:], int.from_bytes(payload[:size],...
<|body_start_0|> if not data: data = 0 if not size: size = 1 max_size = 2 ** (size * 8) if data >= max_size: data = max_size - 1 return data.to_bytes(size, byteorder='big') <|end_body_0|> <|body_start_1|> if not size: size ...
INT data encode in x bytes.
SMPayloadTypeINT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMPayloadTypeINT: """INT data encode in x bytes.""" def encode(data, size=1): """Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\x07[\\xcd\\x15' >>> # Return the max is size exceed >>>...
stack_v2_sparse_classes_75kplus_train_001162
14,049
permissive
[ { "docstring": "Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\\\x00\\\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\\\x07[\\\\xcd\\\\x15' >>> # Return the max is size exceed >>> SMPayloadTypeINT.encode(5165165, size=2) b'\\\\xff\\\\xff'", "name": "encode",...
2
stack_v2_sparse_classes_30k_train_004661
Implement the Python class `SMPayloadTypeINT` described below. Class description: INT data encode in x bytes. Method signatures and docstrings: - def encode(data, size=1): Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'...
Implement the Python class `SMPayloadTypeINT` described below. Class description: INT data encode in x bytes. Method signatures and docstrings: - def encode(data, size=1): Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'...
cf20b363ed3d7bcb75101b17870e876a857ecd66
<|skeleton|> class SMPayloadTypeINT: """INT data encode in x bytes.""" def encode(data, size=1): """Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\x07[\\xcd\\x15' >>> # Return the max is size exceed >>>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SMPayloadTypeINT: """INT data encode in x bytes.""" def encode(data, size=1): """Encode integer into binary string :Example: >>> SMPayloadTypeINT.encode(2, size=2) b'\\x00\\x02' >>> SMPayloadTypeINT.encode(123456789, size=4) b'\\x07[\\xcd\\x15' >>> # Return the max is size exceed >>> SMPayloadTyp...
the_stack_v2_python_sparse
smserver/smutils/smpacket/smencoder.py
Moutix/stepmania-server
train
4
700c103ddd91c17558f5ad3c125ee3ebe22f3fd3
[ "dp = list(range(1, n + 2))\nfor _ in range(3):\n dp = list(itertools.accumulate(dp))\nreturn dp[-1]", "n_combos = 1\nfor i in range(2, n + 2):\n n_combos += sum((a * b for a, b in zip(range(1, i + 1), range(i, 0, -1))))\nreturn n_combos", "n += 1\nn_combos = 0\nsum_first_i = 0\nfor i in range(1, n + 1):\...
<|body_start_0|> dp = list(range(1, n + 2)) for _ in range(3): dp = list(itertools.accumulate(dp)) return dp[-1] <|end_body_0|> <|body_start_1|> n_combos = 1 for i in range(2, n + 2): n_combos += sum((a * b for a, b in zip(range(1, i + 1), range(i, 0, -1)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countVowelStringsDP(self, n: int) -> int: """Count the number of combinations using dp. Observe that if we know the quantity of a, i, o, e, u in a string, then there is a unique string that contains such letters in a lexicographical order. :param n: the target length of the...
stack_v2_sparse_classes_75kplus_train_001163
3,743
no_license
[ { "docstring": "Count the number of combinations using dp. Observe that if we know the quantity of a, i, o, e, u in a string, then there is a unique string that contains such letters in a lexicographical order. :param n: the target length of the strings :return: number of combos of strings length n made from vo...
3
stack_v2_sparse_classes_30k_train_049289
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countVowelStringsDP(self, n: int) -> int: Count the number of combinations using dp. Observe that if we know the quantity of a, i, o, e, u in a string, then there is a unique...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countVowelStringsDP(self, n: int) -> int: Count the number of combinations using dp. Observe that if we know the quantity of a, i, o, e, u in a string, then there is a unique...
ee8237b66975fb5584a3d68b311e762c0462c8aa
<|skeleton|> class Solution: def countVowelStringsDP(self, n: int) -> int: """Count the number of combinations using dp. Observe that if we know the quantity of a, i, o, e, u in a string, then there is a unique string that contains such letters in a lexicographical order. :param n: the target length of the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countVowelStringsDP(self, n: int) -> int: """Count the number of combinations using dp. Observe that if we know the quantity of a, i, o, e, u in a string, then there is a unique string that contains such letters in a lexicographical order. :param n: the target length of the strings :retu...
the_stack_v2_python_sparse
LC1641-Count-Sorted-Vowel-Strings.py
kate-melnykova/LeetCode-solutions
train
2
1ebfeaaa2546f48c1a172bc63c5d69f25b4fd122
[ "PinshCmd.PinshCmd.__init__(self, 'PackageField')\nself.help_text = '<PackageField>\\tA package name that comes from machine status'\nself.action_type = action_type\nself.cmd_owner = 0\nself.machine_name_index = 1", "complete_machine_name = command_line[self.machine_name_index]\nincomplete_package_name = command_...
<|body_start_0|> PinshCmd.PinshCmd.__init__(self, 'PackageField') self.help_text = '<PackageField>\tA package name that comes from machine status' self.action_type = action_type self.cmd_owner = 0 self.machine_name_index = 1 <|end_body_0|> <|body_start_1|> complete_machi...
Some times you want to maintain package status data on a machine.
PackageField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageField: """Some times you want to maintain package status data on a machine.""" def __init__(self, action_type): """action_type -- FIXABLE or PURGABLE machine_name_index -- which token in the set of arguments passed to preferred_names is the machine name package_name_index -- w...
stack_v2_sparse_classes_75kplus_train_001164
7,256
no_license
[ { "docstring": "action_type -- FIXABLE or PURGABLE machine_name_index -- which token in the set of arguments passed to preferred_names is the machine name package_name_index -- which token is the package_name to be completed", "name": "__init__", "signature": "def __init__(self, action_type)" }, { ...
6
null
Implement the Python class `PackageField` described below. Class description: Some times you want to maintain package status data on a machine. Method signatures and docstrings: - def __init__(self, action_type): action_type -- FIXABLE or PURGABLE machine_name_index -- which token in the set of arguments passed to pr...
Implement the Python class `PackageField` described below. Class description: Some times you want to maintain package status data on a machine. Method signatures and docstrings: - def __init__(self, action_type): action_type -- FIXABLE or PURGABLE machine_name_index -- which token in the set of arguments passed to pr...
bb528eed464a63e0f6772fa27a9d472ef3a407aa
<|skeleton|> class PackageField: """Some times you want to maintain package status data on a machine.""" def __init__(self, action_type): """action_type -- FIXABLE or PURGABLE machine_name_index -- which token in the set of arguments passed to preferred_names is the machine name package_name_index -- w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PackageField: """Some times you want to maintain package status data on a machine.""" def __init__(self, action_type): """action_type -- FIXABLE or PURGABLE machine_name_index -- which token in the set of arguments passed to preferred_names is the machine name package_name_index -- which token is...
the_stack_v2_python_sparse
cli/lib/PackageField.py
psbanka/bombardier
train
0
7b7b351eac046dd4e65e40114a10ebf39e26bd39
[ "super(VAELoss, self).__init__()\nself.sample_z = sample_z\nself.bce_loss = nn.BCELoss(size_average=True)\nself.reg_weight = reg_weight", "model_out_x, mu, log_var = model_out\nbatch_size = target_x.size()[0]\nseq_len = target_x.size()[1]\nz_size = mu.size()[1]\nmodel_out_x = F.softmax(model_out_x, dim=2)\nBCE = ...
<|body_start_0|> super(VAELoss, self).__init__() self.sample_z = sample_z self.bce_loss = nn.BCELoss(size_average=True) self.reg_weight = reg_weight <|end_body_0|> <|body_start_1|> model_out_x, mu, log_var = model_out batch_size = target_x.size()[0] seq_len = tar...
VAELoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VAELoss: def __init__(self, grammar=None, sample_z=False, reg_weight=0.01): """:param masks: array of allowed transition rules from a given symbol""" <|body_0|> def forward(self, model_out, target_x): """gives the batch normalized Variational Error.""" <|body...
stack_v2_sparse_classes_75kplus_train_001165
2,556
permissive
[ { "docstring": ":param masks: array of allowed transition rules from a given symbol", "name": "__init__", "signature": "def __init__(self, grammar=None, sample_z=False, reg_weight=0.01)" }, { "docstring": "gives the batch normalized Variational Error.", "name": "forward", "signature": "d...
2
stack_v2_sparse_classes_30k_train_053514
Implement the Python class `VAELoss` described below. Class description: Implement the VAELoss class. Method signatures and docstrings: - def __init__(self, grammar=None, sample_z=False, reg_weight=0.01): :param masks: array of allowed transition rules from a given symbol - def forward(self, model_out, target_x): giv...
Implement the Python class `VAELoss` described below. Class description: Implement the VAELoss class. Method signatures and docstrings: - def __init__(self, grammar=None, sample_z=False, reg_weight=0.01): :param masks: array of allowed transition rules from a given symbol - def forward(self, model_out, target_x): giv...
5c336dfbd14235e4fd97b21778842a650e733275
<|skeleton|> class VAELoss: def __init__(self, grammar=None, sample_z=False, reg_weight=0.01): """:param masks: array of allowed transition rules from a given symbol""" <|body_0|> def forward(self, model_out, target_x): """gives the batch normalized Variational Error.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VAELoss: def __init__(self, grammar=None, sample_z=False, reg_weight=0.01): """:param masks: array of allowed transition rules from a given symbol""" super(VAELoss, self).__init__() self.sample_z = sample_z self.bce_loss = nn.BCELoss(size_average=True) self.reg_weight =...
the_stack_v2_python_sparse
src/generative_playground/models/losses/vae_loss.py
JGU-dev/generative_playground
train
0
3c0a68e399548287377fbf4f5d4e646524722057
[ "if not kwargs.get('auth_plugin') and (not kwargs.get('session')):\n kwargs['auth_plugin'] = monitoringclient.get_auth_plugin(*args, **kwargs)\nself.auth_plugin = kwargs.get('auth_plugin')\nself.http_client = monitoringclient._construct_http_client(**kwargs)\nself.alarm_client = self._get_alarm_client(**kwargs)\...
<|body_start_0|> if not kwargs.get('auth_plugin') and (not kwargs.get('session')): kwargs['auth_plugin'] = monitoringclient.get_auth_plugin(*args, **kwargs) self.auth_plugin = kwargs.get('auth_plugin') self.http_client = monitoringclient._construct_http_client(**kwargs) self....
Client for the Ceilometer v2 API. :param session: a keystoneauth session object :type session: keystoneauth1.session.Session :param str service_type: The default service_type for URL discovery :param str service_name: The default service_name for URL discovery :param str interface: The default interface for URL discove...
Client
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: """Client for the Ceilometer v2 API. :param session: a keystoneauth session object :type session: keystoneauth1.session.Session :param str service_type: The default service_type for URL discovery :param str service_name: The default service_name for URL discovery :param str interface: The...
stack_v2_sparse_classes_75kplus_train_001166
5,420
permissive
[ { "docstring": "Initialize a new client for the Ceilometer v2 API.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Get client for alarm manager that redirect to aodh.", "name": "_get_alarm_client", "signature": "def _get_alarm_client(**ceilo_kw...
2
stack_v2_sparse_classes_30k_train_033942
Implement the Python class `Client` described below. Class description: Client for the Ceilometer v2 API. :param session: a keystoneauth session object :type session: keystoneauth1.session.Session :param str service_type: The default service_type for URL discovery :param str service_name: The default service_name for ...
Implement the Python class `Client` described below. Class description: Client for the Ceilometer v2 API. :param session: a keystoneauth session object :type session: keystoneauth1.session.Session :param str service_type: The default service_type for URL discovery :param str service_name: The default service_name for ...
5e88cf438b4d24b92f996ae31907d44bd736c7f1
<|skeleton|> class Client: """Client for the Ceilometer v2 API. :param session: a keystoneauth session object :type session: keystoneauth1.session.Session :param str service_type: The default service_type for URL discovery :param str service_name: The default service_name for URL discovery :param str interface: The...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Client: """Client for the Ceilometer v2 API. :param session: a keystoneauth session object :type session: keystoneauth1.session.Session :param str service_type: The default service_type for URL discovery :param str service_name: The default service_name for URL discovery :param str interface: The default inte...
the_stack_v2_python_sparse
eclcli/monitoring/monitoringclient/v2/client.py
nttcom/eclcli
train
32
01df8692e21fe49797094a037353a3c6391d2651
[ "self.conn_info = {}\nwith open('mongo_secret', 'r') as secret:\n lines = secret.readlines()\n self.conn_info['username'] = lines[0].strip()\n self.conn_info['password'] = lines[1].strip()\n self.conn_info['conn_str'] = lines[2].strip()\nassert cfg_mongo['datastore'] in ['gridfs', 'numpy', 'adios2']\nse...
<|body_start_0|> self.conn_info = {} with open('mongo_secret', 'r') as secret: lines = secret.readlines() self.conn_info['username'] = lines[0].strip() self.conn_info['password'] = lines[1].strip() self.conn_info['conn_str'] = lines[2].strip() asse...
Abstraction for mongo_connection using context manager.
mongo_connection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mongo_connection: """Abstraction for mongo_connection using context manager.""" def __init__(self, cfg_mongo): """Initializes context.""" <|body_0|> def __enter__(self): """Instantiate a new MongoClient and return the collection.""" <|body_1|> def __...
stack_v2_sparse_classes_75kplus_train_001167
10,764
no_license
[ { "docstring": "Initializes context.", "name": "__init__", "signature": "def __init__(self, cfg_mongo)" }, { "docstring": "Instantiate a new MongoClient and return the collection.", "name": "__enter__", "signature": "def __enter__(self)" }, { "docstring": "Close connection to Mon...
3
null
Implement the Python class `mongo_connection` described below. Class description: Abstraction for mongo_connection using context manager. Method signatures and docstrings: - def __init__(self, cfg_mongo): Initializes context. - def __enter__(self): Instantiate a new MongoClient and return the collection. - def __exit...
Implement the Python class `mongo_connection` described below. Class description: Abstraction for mongo_connection using context manager. Method signatures and docstrings: - def __init__(self, cfg_mongo): Initializes context. - def __enter__(self): Instantiate a new MongoClient and return the collection. - def __exit...
7ce63705e18c427f448c8d720c950a54add07966
<|skeleton|> class mongo_connection: """Abstraction for mongo_connection using context manager.""" def __init__(self, cfg_mongo): """Initializes context.""" <|body_0|> def __enter__(self): """Instantiate a new MongoClient and return the collection.""" <|body_1|> def __...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class mongo_connection: """Abstraction for mongo_connection using context manager.""" def __init__(self, cfg_mongo): """Initializes context.""" self.conn_info = {} with open('mongo_secret', 'r') as secret: lines = secret.readlines() self.conn_info['username'] = l...
the_stack_v2_python_sparse
delta/storage/backend_mongodb.py
rkube/delta
train
7
a5e9c3845327dd96502dd05ced5491fc55fdd43c
[ "self.__region_points = region_points\nself.__min = None\nself.__max = None", "if self.__min is None:\n self.__compute()\nreturn self.__min", "if self.__max is None:\n self.__compute()\nreturn self.__max", "for k, v in self.__region_points.items():\n for p in v:\n if self.__min is None:\n ...
<|body_start_0|> self.__region_points = region_points self.__min = None self.__max = None <|end_body_0|> <|body_start_1|> if self.__min is None: self.__compute() return self.__min <|end_body_1|> <|body_start_2|> if self.__max is None: self.__comp...
Axis aligned bounding box.
BBox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BBox: """Axis aligned bounding box.""" def __init__(self, region_points): """Initializer.""" <|body_0|> def min(self): """Get min point (in upper left corner). :return: Minimum point describing the bbox""" <|body_1|> def max(self): """Get max...
stack_v2_sparse_classes_75kplus_train_001168
1,417
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, region_points)" }, { "docstring": "Get min point (in upper left corner). :return: Minimum point describing the bbox", "name": "min", "signature": "def min(self)" }, { "docstring": "Get max point (...
4
stack_v2_sparse_classes_30k_train_015601
Implement the Python class `BBox` described below. Class description: Axis aligned bounding box. Method signatures and docstrings: - def __init__(self, region_points): Initializer. - def min(self): Get min point (in upper left corner). :return: Minimum point describing the bbox - def max(self): Get max point (in lowe...
Implement the Python class `BBox` described below. Class description: Axis aligned bounding box. Method signatures and docstrings: - def __init__(self, region_points): Initializer. - def min(self): Get min point (in upper left corner). :return: Minimum point describing the bbox - def max(self): Get max point (in lowe...
44246265f1e0b269fa69eaf6988cd2f1464c2344
<|skeleton|> class BBox: """Axis aligned bounding box.""" def __init__(self, region_points): """Initializer.""" <|body_0|> def min(self): """Get min point (in upper left corner). :return: Minimum point describing the bbox""" <|body_1|> def max(self): """Get max...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BBox: """Axis aligned bounding box.""" def __init__(self, region_points): """Initializer.""" self.__region_points = region_points self.__min = None self.__max = None def min(self): """Get min point (in upper left corner). :return: Minimum point describing the ...
the_stack_v2_python_sparse
tools/mapgen/svg/math/bbox.py
cpppwner/NoRiskNoFun
train
1
a9e64e69fb3e1ccffd7c6b2938afb6c82c67c5e5
[ "self.num_days_to_keep = num_days_to_keep\nself.num_secs_to_keep = num_secs_to_keep\nself.worm_retention = worm_retention", "if dictionary is None:\n return None\nnum_days_to_keep = dictionary.get('numDaysToKeep')\nnum_secs_to_keep = dictionary.get('numSecsToKeep')\nworm_retention = cohesity_management_sdk.mod...
<|body_start_0|> self.num_days_to_keep = num_days_to_keep self.num_secs_to_keep = num_secs_to_keep self.worm_retention = worm_retention <|end_body_0|> <|body_start_1|> if dictionary is None: return None num_days_to_keep = dictionary.get('numDaysToKeep') num_s...
Implementation of the 'RetentionPolicyProto' model. Message that specifies the retention policy for backup snapshots. Attributes: num_days_to_keep (long|int): The number of days to keep the snapshots for a backup run. num_secs_to_keep (int): The number of seconds to keep the snapshots for a backup run. worm_retention (...
RetentionPolicyProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetentionPolicyProto: """Implementation of the 'RetentionPolicyProto' model. Message that specifies the retention policy for backup snapshots. Attributes: num_days_to_keep (long|int): The number of days to keep the snapshots for a backup run. num_secs_to_keep (int): The number of seconds to keep ...
stack_v2_sparse_classes_75kplus_train_001169
2,976
permissive
[ { "docstring": "Constructor for the RetentionPolicyProto class", "name": "__init__", "signature": "def __init__(self, num_days_to_keep=None, num_secs_to_keep=None, worm_retention=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
stack_v2_sparse_classes_30k_train_041508
Implement the Python class `RetentionPolicyProto` described below. Class description: Implementation of the 'RetentionPolicyProto' model. Message that specifies the retention policy for backup snapshots. Attributes: num_days_to_keep (long|int): The number of days to keep the snapshots for a backup run. num_secs_to_kee...
Implement the Python class `RetentionPolicyProto` described below. Class description: Implementation of the 'RetentionPolicyProto' model. Message that specifies the retention policy for backup snapshots. Attributes: num_days_to_keep (long|int): The number of days to keep the snapshots for a backup run. num_secs_to_kee...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RetentionPolicyProto: """Implementation of the 'RetentionPolicyProto' model. Message that specifies the retention policy for backup snapshots. Attributes: num_days_to_keep (long|int): The number of days to keep the snapshots for a backup run. num_secs_to_keep (int): The number of seconds to keep ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RetentionPolicyProto: """Implementation of the 'RetentionPolicyProto' model. Message that specifies the retention policy for backup snapshots. Attributes: num_days_to_keep (long|int): The number of days to keep the snapshots for a backup run. num_secs_to_keep (int): The number of seconds to keep the snapshots...
the_stack_v2_python_sparse
cohesity_management_sdk/models/retention_policy_proto.py
cohesity/management-sdk-python
train
24
e3b6256a39d11024c89e871880a2b27923d4e112
[ "partitions = HiveUtil.get_table_partitions(spark, table_name)\nnewest_partition = partitions[0] if partitions else None\nreturn newest_partition", "partitions = HiveUtil.get_table_partitions(spark, table_name)\nif not partitions:\n print(f'====table {table_name} has no partition')\n return None\nfor partit...
<|body_start_0|> partitions = HiveUtil.get_table_partitions(spark, table_name) newest_partition = partitions[0] if partitions else None return newest_partition <|end_body_0|> <|body_start_1|> partitions = HiveUtil.get_table_partitions(spark, table_name) if not partitions: ...
HiveUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HiveUtil: def newest_partition(spark: SparkSession, table_name: str): """get newest partition for hive table error happened if table not exist or spark session is not activate :param spark: current spark session :param table_name: :return: newest partition or None""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_001170
3,181
no_license
[ { "docstring": "get newest partition for hive table error happened if table not exist or spark session is not activate :param spark: current spark session :param table_name: :return: newest partition or None", "name": "newest_partition", "signature": "def newest_partition(spark: SparkSession, table_name...
4
null
Implement the Python class `HiveUtil` described below. Class description: Implement the HiveUtil class. Method signatures and docstrings: - def newest_partition(spark: SparkSession, table_name: str): get newest partition for hive table error happened if table not exist or spark session is not activate :param spark: c...
Implement the Python class `HiveUtil` described below. Class description: Implement the HiveUtil class. Method signatures and docstrings: - def newest_partition(spark: SparkSession, table_name: str): get newest partition for hive table error happened if table not exist or spark session is not activate :param spark: c...
9ac20619c426a3240cac08c7e68fc3eeca948c7b
<|skeleton|> class HiveUtil: def newest_partition(spark: SparkSession, table_name: str): """get newest partition for hive table error happened if table not exist or spark session is not activate :param spark: current spark session :param table_name: :return: newest partition or None""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HiveUtil: def newest_partition(spark: SparkSession, table_name: str): """get newest partition for hive table error happened if table not exist or spark session is not activate :param spark: current spark session :param table_name: :return: newest partition or None""" partitions = HiveUtil.get_...
the_stack_v2_python_sparse
rose/scwgj/proj_common/hive_util.py
HGrey-EVE/spark_submit
train
0
296f9b295faa57fbf30195d4f8f71a9aec2c8c3a
[ "if not phone:\n raise ValueError('Users must have a phone')\nif not name:\n raise ValueError('Users must have a name')\nif not type:\n raise ValueError('Users must have a type of Personal or Agent')\nuser = self.model(phone=phone, name=name, type=type)\nuser.set_password(password)\nuser.save(using=self._d...
<|body_start_0|> if not phone: raise ValueError('Users must have a phone') if not name: raise ValueError('Users must have a name') if not type: raise ValueError('Users must have a type of Personal or Agent') user = self.model(phone=phone, name=name, ty...
AccountManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountManager: def create_user(self, phone, name, type, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, phone, name, password): """Creates and saves a superuser with the given email and password...
stack_v2_sparse_classes_75kplus_train_001171
2,600
no_license
[ { "docstring": "Creates and saves a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, phone, name, type, password=None)" }, { "docstring": "Creates and saves a superuser with the given email and password.", "name": "create_superuser", "s...
2
stack_v2_sparse_classes_30k_train_022171
Implement the Python class `AccountManager` described below. Class description: Implement the AccountManager class. Method signatures and docstrings: - def create_user(self, phone, name, type, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, phone, name, passwor...
Implement the Python class `AccountManager` described below. Class description: Implement the AccountManager class. Method signatures and docstrings: - def create_user(self, phone, name, type, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, phone, name, passwor...
55b59edf5735af4f1c2c1544e4e3e545f779239f
<|skeleton|> class AccountManager: def create_user(self, phone, name, type, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, phone, name, password): """Creates and saves a superuser with the given email and password...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccountManager: def create_user(self, phone, name, type, password=None): """Creates and saves a User with the given email and password.""" if not phone: raise ValueError('Users must have a phone') if not name: raise ValueError('Users must have a name') i...
the_stack_v2_python_sparse
accounts/models.py
matir-bank/matirbank-django
train
0
53207fbb49532c4da6d3d8c8a185a800fbe6a3f7
[ "self.na_dict = {}\nfor name in self.cont_names:\n if pd.isnull(df[name]).sum():\n if self.add_col:\n df[name + '_na'] = pd.isnull(df[name])\n if name + '_na' not in self.cat_names:\n self.cat_names.append(name + '_na')\n if self.fill_strategy == FillStrategy.ME...
<|body_start_0|> self.na_dict = {} for name in self.cont_names: if pd.isnull(df[name]).sum(): if self.add_col: df[name + '_na'] = pd.isnull(df[name]) if name + '_na' not in self.cat_names: self.cat_names.append(n...
Fill the missing values in continuous columns.
FillMissing
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FillMissing: """Fill the missing values in continuous columns.""" def apply_train(self, df: DataFrame): """Fill missing values in `self.cont_names` according to `self.fill_strategy`.""" <|body_0|> def apply_test(self, df: DataFrame): """Fill missing values in `se...
stack_v2_sparse_classes_75kplus_train_001172
9,761
permissive
[ { "docstring": "Fill missing values in `self.cont_names` according to `self.fill_strategy`.", "name": "apply_train", "signature": "def apply_train(self, df: DataFrame)" }, { "docstring": "Fill missing values in `self.cont_names` like in `apply_train`.", "name": "apply_test", "signature":...
2
stack_v2_sparse_classes_30k_train_012264
Implement the Python class `FillMissing` described below. Class description: Fill the missing values in continuous columns. Method signatures and docstrings: - def apply_train(self, df: DataFrame): Fill missing values in `self.cont_names` according to `self.fill_strategy`. - def apply_test(self, df: DataFrame): Fill ...
Implement the Python class `FillMissing` described below. Class description: Fill the missing values in continuous columns. Method signatures and docstrings: - def apply_train(self, df: DataFrame): Fill missing values in `self.cont_names` according to `self.fill_strategy`. - def apply_test(self, df: DataFrame): Fill ...
141e873e42eb5e40665d20349f4b8e9a267ba1c4
<|skeleton|> class FillMissing: """Fill the missing values in continuous columns.""" def apply_train(self, df: DataFrame): """Fill missing values in `self.cont_names` according to `self.fill_strategy`.""" <|body_0|> def apply_test(self, df: DataFrame): """Fill missing values in `se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FillMissing: """Fill the missing values in continuous columns.""" def apply_train(self, df: DataFrame): """Fill missing values in `self.cont_names` according to `self.fill_strategy`.""" self.na_dict = {} for name in self.cont_names: if pd.isnull(df[name]).sum(): ...
the_stack_v2_python_sparse
fastai/tabular/transform.py
jantic/DeOldify
train
17,137
0d1e59ee5c9a339e86b002e5a6ef51efb5b5f1f2
[ "scale_initializer = kwargs.pop('scale_initializer', None)\nif scale_initializer is None:\n scale_initializer = tf.keras.initializers.RandomNormal(0.3, 0.01)\nsuper(EmbeddingLogitNormalDiag, self).__init__(input_dim, output_dim, scale_initializer=scale_initializer, **kwargs)", "self.untransformed_loc = self.ad...
<|body_start_0|> scale_initializer = kwargs.pop('scale_initializer', None) if scale_initializer is None: scale_initializer = tf.keras.initializers.RandomNormal(0.3, 0.01) super(EmbeddingLogitNormalDiag, self).__init__(input_dim, output_dim, scale_initializer=scale_initializer, **kwar...
A distribution-based embedding. Each embedding point is characterized by LogitNormal distribution with a diagonal scale matrix.
EmbeddingLogitNormalDiag
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingLogitNormalDiag: """A distribution-based embedding. Each embedding point is characterized by LogitNormal distribution with a diagonal scale matrix.""" def __init__(self, input_dim, output_dim, **kwargs): """Initialize.""" <|body_0|> def _build_embeddings_distrib...
stack_v2_sparse_classes_75kplus_train_001173
32,786
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, input_dim, output_dim, **kwargs)" }, { "docstring": "Build embeddings distribution.", "name": "_build_embeddings_distribution", "signature": "def _build_embeddings_distribution(self, dtype)" }, { "...
3
stack_v2_sparse_classes_30k_train_030858
Implement the Python class `EmbeddingLogitNormalDiag` described below. Class description: A distribution-based embedding. Each embedding point is characterized by LogitNormal distribution with a diagonal scale matrix. Method signatures and docstrings: - def __init__(self, input_dim, output_dim, **kwargs): Initialize....
Implement the Python class `EmbeddingLogitNormalDiag` described below. Class description: A distribution-based embedding. Each embedding point is characterized by LogitNormal distribution with a diagonal scale matrix. Method signatures and docstrings: - def __init__(self, input_dim, output_dim, **kwargs): Initialize....
4f05348cf43d2d53ff9cc6dee633de385df883e3
<|skeleton|> class EmbeddingLogitNormalDiag: """A distribution-based embedding. Each embedding point is characterized by LogitNormal distribution with a diagonal scale matrix.""" def __init__(self, input_dim, output_dim, **kwargs): """Initialize.""" <|body_0|> def _build_embeddings_distrib...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmbeddingLogitNormalDiag: """A distribution-based embedding. Each embedding point is characterized by LogitNormal distribution with a diagonal scale matrix.""" def __init__(self, input_dim, output_dim, **kwargs): """Initialize.""" scale_initializer = kwargs.pop('scale_initializer', None) ...
the_stack_v2_python_sparse
psiz/keras/layers/embeddings.py
asuiconlab/psiz
train
0
b4aac92bcdbd1ff770f0ed3c766697e9e0d81fcc
[ "self.players = []\nfor i in range(num_players):\n player = TrainablePlayer()\n if i == trainable_index:\n player.is_trainable = True\n self.players.append(player)\nself.trainer = Trainer(self.players[0], self.players[1], trainable_player='player{}'.format(trainable_index + 1), **trainer_args)", "...
<|body_start_0|> self.players = [] for i in range(num_players): player = TrainablePlayer() if i == trainable_index: player.is_trainable = True self.players.append(player) self.trainer = Trainer(self.players[0], self.players[1], trainable_player...
test the train module which controls multi-hole and multi-game matches
TestTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTrainer: """test the train module which controls multi-hole and multi-game matches""" def _setup_players_and_trainer(self, trainable_index=0, num_players=2, trainer_args={}): """Setup players - with the option to make them trainable""" <|body_0|> def test_creation_pa...
stack_v2_sparse_classes_75kplus_train_001174
6,447
no_license
[ { "docstring": "Setup players - with the option to make them trainable", "name": "_setup_players_and_trainer", "signature": "def _setup_players_and_trainer(self, trainable_index=0, num_players=2, trainer_args={})" }, { "docstring": "Test the initialization of params for the trainer class", "...
5
null
Implement the Python class `TestTrainer` described below. Class description: test the train module which controls multi-hole and multi-game matches Method signatures and docstrings: - def _setup_players_and_trainer(self, trainable_index=0, num_players=2, trainer_args={}): Setup players - with the option to make them ...
Implement the Python class `TestTrainer` described below. Class description: test the train module which controls multi-hole and multi-game matches Method signatures and docstrings: - def _setup_players_and_trainer(self, trainable_index=0, num_players=2, trainer_args={}): Setup players - with the option to make them ...
fd5dc391c04083cccaa3e2eea23619494b60ce0c
<|skeleton|> class TestTrainer: """test the train module which controls multi-hole and multi-game matches""" def _setup_players_and_trainer(self, trainable_index=0, num_players=2, trainer_args={}): """Setup players - with the option to make them trainable""" <|body_0|> def test_creation_pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestTrainer: """test the train module which controls multi-hole and multi-game matches""" def _setup_players_and_trainer(self, trainable_index=0, num_players=2, trainer_args={}): """Setup players - with the option to make them trainable""" self.players = [] for i in range(num_play...
the_stack_v2_python_sparse
golf/unit_tests/test_trainer.py
RaymondKlass/golf-reinforcement
train
0
7f65df1744c71553f605286898749eb0e1510eae
[ "super().__init__()\nassert latent_size != 0 and latent_size & latent_size - 1 == 0, 'latent size not a power of 2'\nif depth >= 4:\n assert latent_size >= np.power(2, depth - 4), 'latent size will diminish to zero'\nself.use_eql = use_eql\nself.depth = depth\nself.latent_size = latent_size\nself.initial_block =...
<|body_start_0|> super().__init__() assert latent_size != 0 and latent_size & latent_size - 1 == 0, 'latent size not a power of 2' if depth >= 4: assert latent_size >= np.power(2, depth - 4), 'latent size will diminish to zero' self.use_eql = use_eql self.depth = dept...
Generator
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: def __init__(self, depth=7, latent_size=512, use_eql=True): """constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the latent manifold :param use_eql: whether to use equalized learning rate""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus_train_001175
10,883
permissive
[ { "docstring": "constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the latent manifold :param use_eql: whether to use equalized learning rate", "name": "__init__", "signature": "def __init__(self, depth=7, latent_size=512, use_eql=True)" }, { ...
2
stack_v2_sparse_classes_30k_train_036312
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, depth=7, latent_size=512, use_eql=True): constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the late...
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, depth=7, latent_size=512, use_eql=True): constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the late...
30e7404924070f63b68e73f33f2b42ea8be22f65
<|skeleton|> class Generator: def __init__(self, depth=7, latent_size=512, use_eql=True): """constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the latent manifold :param use_eql: whether to use equalized learning rate""" <|body_0|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Generator: def __init__(self, depth=7, latent_size=512, use_eql=True): """constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the latent manifold :param use_eql: whether to use equalized learning rate""" super().__init__() assert ...
the_stack_v2_python_sparse
model/pggan/utils/Networks.py
TrendingTechnology/MTV-TSA
train
0
093be06cf49b3ee130d3c67e3fd9aa17f7233f02
[ "repo = values['repo']\nif repo:\n if isinstance(v, dict):\n v.setdefault('tag', repo)\n elif isinstance(v, DockerImageBuildApiOptions) and (not v.tag):\n v.tag = repo\nreturn v", "if v and isinstance(v, dict):\n return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_...
<|body_start_0|> repo = values['repo'] if repo: if isinstance(v, dict): v.setdefault('tag', repo) elif isinstance(v, DockerImageBuildApiOptions) and (not v.tag): v.tag = repo return v <|end_body_0|> <|body_start_1|> if v and isinst...
Args passed to image.build.
ImageBuildArgs
[ "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageBuildArgs: """Args passed to image.build.""" def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: """Set the value of ``docker``.""" <|body_0|> def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: ...
stack_v2_sparse_classes_75kplus_train_001176
6,815
permissive
[ { "docstring": "Set the value of ``docker``.", "name": "_set_docker", "signature": "def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any" }, { "docstring": "Set the value of ``ecr_repo``.", "name": "_set_ecr_repo", "signature": "d...
4
stack_v2_sparse_classes_30k_train_010560
Implement the Python class `ImageBuildArgs` described below. Class description: Args passed to image.build. Method signatures and docstrings: - def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: Set the value of ``docker``. - def _set_ecr_repo(cls, v: Any, ...
Implement the Python class `ImageBuildArgs` described below. Class description: Args passed to image.build. Method signatures and docstrings: - def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: Set the value of ``docker``. - def _set_ecr_repo(cls, v: Any, ...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class ImageBuildArgs: """Args passed to image.build.""" def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: """Set the value of ``docker``.""" <|body_0|> def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageBuildArgs: """Args passed to image.build.""" def _set_docker(cls, v: Union[Dict[str, Any], DockerImageBuildApiOptions, Any], values: Dict[str, Any]) -> Any: """Set the value of ``docker``.""" repo = values['repo'] if repo: if isinstance(v, dict): v...
the_stack_v2_python_sparse
runway/cfngin/hooks/docker/image/_build.py
onicagroup/runway
train
156
522410df50463b49e0b5852197fb2d922a8a4c2f
[ "self.token = token\nheaders = {'X-RFToken': token, 'User-Agent': header}\nself.session = requests.Session()\nself.session.headers.update(headers)\nself.helper = helper", "enrichment = self._enrich(entity, type_)\nlinks = self._get_links(enrichment['entity']['id'])\nenrichment['links'] = links\nreturn enrichment"...
<|body_start_0|> self.token = token headers = {'X-RFToken': token, 'User-Agent': header} self.session = requests.Session() self.session.headers.update(headers) self.helper = helper <|end_body_0|> <|body_start_1|> enrichment = self._enrich(entity, type_) links = s...
class for talking to the RF API, specifically for enriching indicators
RFClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RFClient: """class for talking to the RF API, specifically for enriching indicators""" def __init__(self, token, helper, header='OpenCTI-Enrichment/2.0'): """Inits function""" <|body_0|> def full_enrichment(self, entity, type_): """Enrich an individual IOC""" ...
stack_v2_sparse_classes_75kplus_train_001177
2,351
permissive
[ { "docstring": "Inits function", "name": "__init__", "signature": "def __init__(self, token, helper, header='OpenCTI-Enrichment/2.0')" }, { "docstring": "Enrich an individual IOC", "name": "full_enrichment", "signature": "def full_enrichment(self, entity, type_)" }, { "docstring"...
4
stack_v2_sparse_classes_30k_train_041834
Implement the Python class `RFClient` described below. Class description: class for talking to the RF API, specifically for enriching indicators Method signatures and docstrings: - def __init__(self, token, helper, header='OpenCTI-Enrichment/2.0'): Inits function - def full_enrichment(self, entity, type_): Enrich an ...
Implement the Python class `RFClient` described below. Class description: class for talking to the RF API, specifically for enriching indicators Method signatures and docstrings: - def __init__(self, token, helper, header='OpenCTI-Enrichment/2.0'): Inits function - def full_enrichment(self, entity, type_): Enrich an ...
d00a0243946ded25b5d06bdefd9b40015dea9b80
<|skeleton|> class RFClient: """class for talking to the RF API, specifically for enriching indicators""" def __init__(self, token, helper, header='OpenCTI-Enrichment/2.0'): """Inits function""" <|body_0|> def full_enrichment(self, entity, type_): """Enrich an individual IOC""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RFClient: """class for talking to the RF API, specifically for enriching indicators""" def __init__(self, token, helper, header='OpenCTI-Enrichment/2.0'): """Inits function""" self.token = token headers = {'X-RFToken': token, 'User-Agent': header} self.session = requests.S...
the_stack_v2_python_sparse
internal-enrichment/recordedfuture-enrichment/src/rflib/rf_client.py
OpenCTI-Platform/connectors
train
254
6a48537f508272e8be4fbe70366bbeccb4ab8ab9
[ "super(Model, self).__init__(model_proto, is_training)\nif not isinstance(model_proto, vse_model_pb2.VSEModel):\n raise ValueError('The model_proto has to be an instance of VSEModel.')\nself._stmt_encoder = builder.build(model_proto.stmt_encoder, is_training)\nself._mining_fn = triplet_loss.build_mining_func(mod...
<|body_start_0|> super(Model, self).__init__(model_proto, is_training) if not isinstance(model_proto, vse_model_pb2.VSEModel): raise ValueError('The model_proto has to be an instance of VSEModel.') self._stmt_encoder = builder.build(model_proto.stmt_encoder, is_training) self...
VSEModel.
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """VSEModel.""" def __init__(self, model_proto, is_training=False): """Initializes ads model. Args: model_proto: an instance of vse_model_pb2.VSEModel. is_training: if True, training graph would be built.""" <|body_0|> def build_inference_graph(self, examples, **k...
stack_v2_sparse_classes_75kplus_train_001178
4,530
no_license
[ { "docstring": "Initializes ads model. Args: model_proto: an instance of vse_model_pb2.VSEModel. is_training: if True, training graph would be built.", "name": "__init__", "signature": "def __init__(self, model_proto, is_training=False)" }, { "docstring": "Builds tensorflow graph for inference. ...
3
null
Implement the Python class `Model` described below. Class description: VSEModel. Method signatures and docstrings: - def __init__(self, model_proto, is_training=False): Initializes ads model. Args: model_proto: an instance of vse_model_pb2.VSEModel. is_training: if True, training graph would be built. - def build_inf...
Implement the Python class `Model` described below. Class description: VSEModel. Method signatures and docstrings: - def __init__(self, model_proto, is_training=False): Initializes ads model. Args: model_proto: an instance of vse_model_pb2.VSEModel. is_training: if True, training graph would be built. - def build_inf...
2ea5e1405b1ab178b95f9c2cd9158b16847ac6a3
<|skeleton|> class Model: """VSEModel.""" def __init__(self, model_proto, is_training=False): """Initializes ads model. Args: model_proto: an instance of vse_model_pb2.VSEModel. is_training: if True, training graph would be built.""" <|body_0|> def build_inference_graph(self, examples, **k...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Model: """VSEModel.""" def __init__(self, model_proto, is_training=False): """Initializes ads model. Args: model_proto: an instance of vse_model_pb2.VSEModel. is_training: if True, training graph would be built.""" super(Model, self).__init__(model_proto, is_training) if not isins...
the_stack_v2_python_sparse
models/vse_model.py
yekeren/ADVISE-Image_ads_understanding
train
22
7b96372c84777c99f59c36bc55cfb7e89cc53a9b
[ "str_list = []\nself._html_print_obj(obj_json, str_list, 0)\nstr_list.append('<button class=\"btn btn-secondary sodar-list-btn sodar-copy-btn sodar-tl-copy-btn\" data-clipboard-target=\"#data-to-clipboard\" title=\"Copy to clipboard\" data-toggle=\"tooltip\"><i class=\"iconify\" data-icon=\"mdi:clipboard-multiple-o...
<|body_start_0|> str_list = [] self._html_print_obj(obj_json, str_list, 0) str_list.append('<button class="btn btn-secondary sodar-list-btn sodar-copy-btn sodar-tl-copy-btn" data-clipboard-target="#data-to-clipboard" title="Copy to clipboard" data-toggle="tooltip"><i class="iconify" data-icon="m...
Mixin for event extra data retrieval helpers
EventExtraDataMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventExtraDataMixin: """Mixin for event extra data retrieval helpers""" def _json_to_html(self, obj_json): """Return HTML representation of JSON object""" <|body_0|> def _html_print_obj(self, obj_json, str_list: list, indent): """Print JSON object to HTML string ...
stack_v2_sparse_classes_75kplus_train_001179
10,045
permissive
[ { "docstring": "Return HTML representation of JSON object", "name": "_json_to_html", "signature": "def _json_to_html(self, obj_json)" }, { "docstring": "Print JSON object to HTML string list", "name": "_html_print_obj", "signature": "def _html_print_obj(self, obj_json, str_list: list, in...
5
stack_v2_sparse_classes_30k_train_018369
Implement the Python class `EventExtraDataMixin` described below. Class description: Mixin for event extra data retrieval helpers Method signatures and docstrings: - def _json_to_html(self, obj_json): Return HTML representation of JSON object - def _html_print_obj(self, obj_json, str_list: list, indent): Print JSON o...
Implement the Python class `EventExtraDataMixin` described below. Class description: Mixin for event extra data retrieval helpers Method signatures and docstrings: - def _json_to_html(self, obj_json): Return HTML representation of JSON object - def _html_print_obj(self, obj_json, str_list: list, indent): Print JSON o...
6156b6409af01828fca506796a736b4f4669f33e
<|skeleton|> class EventExtraDataMixin: """Mixin for event extra data retrieval helpers""" def _json_to_html(self, obj_json): """Return HTML representation of JSON object""" <|body_0|> def _html_print_obj(self, obj_json, str_list: list, indent): """Print JSON object to HTML string ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EventExtraDataMixin: """Mixin for event extra data retrieval helpers""" def _json_to_html(self, obj_json): """Return HTML representation of JSON object""" str_list = [] self._html_print_obj(obj_json, str_list, 0) str_list.append('<button class="btn btn-secondary sodar-list...
the_stack_v2_python_sparse
timeline/views_ajax.py
bihealth/sodar-core
train
7
d7f8fd57a0f023836d53a919b0c7c432daa5e943
[ "self.value = value\nif atom1 is not None and atom2 is not None:\n self.atoms = array([atom1, atom2])\nif orbital1 is not None and orbital2 is not None:\n self.orbitals = array([orbital1, orbital2])\nif spin1 is not None and spin2 is not None:\n self.spins = array([spin1, spin2])\nif atoms is not None:\n ...
<|body_start_0|> self.value = value if atom1 is not None and atom2 is not None: self.atoms = array([atom1, atom2]) if orbital1 is not None and orbital2 is not None: self.orbitals = array([orbital1, orbital2]) if spin1 is not None and spin2 is not None: ...
This class assumes part of a systematic description of a general quadratic term. Attributes: value: float or complex The overall coefficient of the index pack. atoms: 1D ndarray of integers with len==2 The atom indices for the quadratic term. orbitals: 1D ndarray of integers with len==2 The orbital indices for the quad...
IndexPackage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexPackage: """This class assumes part of a systematic description of a general quadratic term. Attributes: value: float or complex The overall coefficient of the index pack. atoms: 1D ndarray of integers with len==2 The atom indices for the quadratic term. orbitals: 1D ndarray of integers with...
stack_v2_sparse_classes_75kplus_train_001180
9,705
no_license
[ { "docstring": "Constructor. It can be used in two different ways: 1) IndexPackage(value,atom1=...,atom2=...,orbital1=...,orbital2=...,spin1=...,spin2=...) 2) IndexPackage(value,atoms=...,orbitals=...,spins=...) Parameters: value: float or complex The overall coefficient of the index pack atom1,atom2: integer,o...
5
stack_v2_sparse_classes_30k_train_014850
Implement the Python class `IndexPackage` described below. Class description: This class assumes part of a systematic description of a general quadratic term. Attributes: value: float or complex The overall coefficient of the index pack. atoms: 1D ndarray of integers with len==2 The atom indices for the quadratic term...
Implement the Python class `IndexPackage` described below. Class description: This class assumes part of a systematic description of a general quadratic term. Attributes: value: float or complex The overall coefficient of the index pack. atoms: 1D ndarray of integers with len==2 The atom indices for the quadratic term...
c985d0e5c70b08ef396dd591180c493b60b268ee
<|skeleton|> class IndexPackage: """This class assumes part of a systematic description of a general quadratic term. Attributes: value: float or complex The overall coefficient of the index pack. atoms: 1D ndarray of integers with len==2 The atom indices for the quadratic term. orbitals: 1D ndarray of integers with...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IndexPackage: """This class assumes part of a systematic description of a general quadratic term. Attributes: value: float or complex The overall coefficient of the index pack. atoms: 1D ndarray of integers with len==2 The atom indices for the quadratic term. orbitals: 1D ndarray of integers with len==2 The o...
the_stack_v2_python_sparse
Core/BasicClass/IndexPackagePy.py
Farewell1989/Hamiltonian-Generator
train
0
d2c96ccf6a11c9696b42cbfd369fdeb1ab1336e1
[ "kb.initialize(prefix='/rosplan_knowledge_base')\nrospy.init_node('hectic_knowledge_deriving', anonymous=True)\nrospy.Subscriber('sound_recognised', RecognisedSounds, self.sound_recognised)\nself.notified = False\nrospy.spin()", "sounds = sounds.sounds\nringing = False\nfor elem in sounds:\n if elem.sound == '...
<|body_start_0|> kb.initialize(prefix='/rosplan_knowledge_base') rospy.init_node('hectic_knowledge_deriving', anonymous=True) rospy.Subscriber('sound_recognised', RecognisedSounds, self.sound_recognised) self.notified = False rospy.spin() <|end_body_0|> <|body_start_1|> ...
DoorbellKnowledgeDeriving
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoorbellKnowledgeDeriving: def __init__(self): """This will derive knowledge when an alarm bell rings""" <|body_0|> def sound_recognised(self, sounds): """When an alarm bell rings, put it into the knowledge base""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_001181
1,455
no_license
[ { "docstring": "This will derive knowledge when an alarm bell rings", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "When an alarm bell rings, put it into the knowledge base", "name": "sound_recognised", "signature": "def sound_recognised(self, sounds)" } ]
2
null
Implement the Python class `DoorbellKnowledgeDeriving` described below. Class description: Implement the DoorbellKnowledgeDeriving class. Method signatures and docstrings: - def __init__(self): This will derive knowledge when an alarm bell rings - def sound_recognised(self, sounds): When an alarm bell rings, put it i...
Implement the Python class `DoorbellKnowledgeDeriving` described below. Class description: Implement the DoorbellKnowledgeDeriving class. Method signatures and docstrings: - def __init__(self): This will derive knowledge when an alarm bell rings - def sound_recognised(self, sounds): When an alarm bell rings, put it i...
132c126005451349a045fb46823611caebe74c72
<|skeleton|> class DoorbellKnowledgeDeriving: def __init__(self): """This will derive knowledge when an alarm bell rings""" <|body_0|> def sound_recognised(self, sounds): """When an alarm bell rings, put it into the knowledge base""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DoorbellKnowledgeDeriving: def __init__(self): """This will derive knowledge when an alarm bell rings""" kb.initialize(prefix='/rosplan_knowledge_base') rospy.init_node('hectic_knowledge_deriving', anonymous=True) rospy.Subscriber('sound_recognised', RecognisedSounds, self.soun...
the_stack_v2_python_sparse
src/knowledge_deriving/src/doorbell_knowledge_deriving.py
jonascuypers/spontaneous-robot-reactions
train
0
7137ac767111ebd62ed8ea5498bca3bc9237270f
[ "response = BaseResponse()\ntry:\n shell_cmd = 'dmidecode -t system'\n output = self.exec_shell_cmd(shell_cmd)\n response.data = self.parse(output)\nexcept Exception as e:\n msg = '%s linux main board plugin error:%s' % (self.host_ip, traceback.format_exc())\n self.logger.log(msg, mode=False)\n re...
<|body_start_0|> response = BaseResponse() try: shell_cmd = 'dmidecode -t system' output = self.exec_shell_cmd(shell_cmd) response.data = self.parse(output) except Exception as e: msg = '%s linux main board plugin error:%s' % (self.host_ip, traceba...
获取主板信息
BoardPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoardPlugin: """获取主板信息""" def linux(self): """执行获取主板命令""" <|body_0|> def parse(content): """解析shell命令结果 :param self: :param content:shell命令结果 :return: 解析后的结果""" <|body_1|> <|end_skeleton|> <|body_start_0|> response = BaseResponse() try: ...
stack_v2_sparse_classes_75kplus_train_001182
1,853
no_license
[ { "docstring": "执行获取主板命令", "name": "linux", "signature": "def linux(self)" }, { "docstring": "解析shell命令结果 :param self: :param content:shell命令结果 :return: 解析后的结果", "name": "parse", "signature": "def parse(content)" } ]
2
stack_v2_sparse_classes_30k_val_002453
Implement the Python class `BoardPlugin` described below. Class description: 获取主板信息 Method signatures and docstrings: - def linux(self): 执行获取主板命令 - def parse(content): 解析shell命令结果 :param self: :param content:shell命令结果 :return: 解析后的结果
Implement the Python class `BoardPlugin` described below. Class description: 获取主板信息 Method signatures and docstrings: - def linux(self): 执行获取主板命令 - def parse(content): 解析shell命令结果 :param self: :param content:shell命令结果 :return: 解析后的结果 <|skeleton|> class BoardPlugin: """获取主板信息""" def linux(self): """执...
73602f72e0ec7f6b49040d38f1591b2245292e3b
<|skeleton|> class BoardPlugin: """获取主板信息""" def linux(self): """执行获取主板命令""" <|body_0|> def parse(content): """解析shell命令结果 :param self: :param content:shell命令结果 :return: 解析后的结果""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BoardPlugin: """获取主板信息""" def linux(self): """执行获取主板命令""" response = BaseResponse() try: shell_cmd = 'dmidecode -t system' output = self.exec_shell_cmd(shell_cmd) response.data = self.parse(output) except Exception as e: msg ...
the_stack_v2_python_sparse
FhywClient/src/cmdb/board.py
shisanjun/fhyw
train
0
73d3d2465bc2e4e6d86d2cb99dcda7f206940575
[ "self._db = 'strategy'\nself._collection = 'asset'\nsuper(AssetData, self).__init__(self._db, self._collection)", "d = {'platform': platform, 'account': account}\nfor key, value in asset.items():\n d[key] = value\nasset_id = await self.insert(d)\nreturn asset_id", "spec = {'platform': platform, 'account': ac...
<|body_start_0|> self._db = 'strategy' self._collection = 'asset' super(AssetData, self).__init__(self._db, self._collection) <|end_body_0|> <|body_start_1|> d = {'platform': platform, 'account': account} for key, value in asset.items(): d[key] = value asset_...
资产数据存储 资产数据结构: {}
AssetData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssetData: """资产数据存储 资产数据结构: {}""" def __init__(self): """初始化""" <|body_0|> async def create_new_asset(self, platform, account, asset): """创建新的资产信息 @param platform 交易平台 @param account 账户 @param asset 资产详情""" <|body_1|> async def update_asset(self, pl...
stack_v2_sparse_classes_75kplus_train_001183
12,604
permissive
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "创建新的资产信息 @param platform 交易平台 @param account 账户 @param asset 资产详情", "name": "create_new_asset", "signature": "async def create_new_asset(self, platform, account, asset)" }, { "docstring...
4
null
Implement the Python class `AssetData` described below. Class description: 资产数据存储 资产数据结构: {} Method signatures and docstrings: - def __init__(self): 初始化 - async def create_new_asset(self, platform, account, asset): 创建新的资产信息 @param platform 交易平台 @param account 账户 @param asset 资产详情 - async def update_asset(self, platfo...
Implement the Python class `AssetData` described below. Class description: 资产数据存储 资产数据结构: {} Method signatures and docstrings: - def __init__(self): 初始化 - async def create_new_asset(self, platform, account, asset): 创建新的资产信息 @param platform 交易平台 @param account 账户 @param asset 资产详情 - async def update_asset(self, platfo...
b0b9d60439a916bc4b1980f908f648aa863d5918
<|skeleton|> class AssetData: """资产数据存储 资产数据结构: {}""" def __init__(self): """初始化""" <|body_0|> async def create_new_asset(self, platform, account, asset): """创建新的资产信息 @param platform 交易平台 @param account 账户 @param asset 资产详情""" <|body_1|> async def update_asset(self, pl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AssetData: """资产数据存储 资产数据结构: {}""" def __init__(self): """初始化""" self._db = 'strategy' self._collection = 'asset' super(AssetData, self).__init__(self._db, self._collection) async def create_new_asset(self, platform, account, asset): """创建新的资产信息 @param platfor...
the_stack_v2_python_sparse
quant/data.py
51bitquant/thenextquant
train
6
def0cd3f64ecc41f25c829404d61c113a2690896
[ "with open(os.path.join(TESTDATA_DIR, 'get_playable_class__10.json')) as f:\n cls.MONK_CLASS_DATA = json.load(f)\ncls.MONK_SPECS_DATA = {}\nwith open(os.path.join(TESTDATA_DIR, 'get_playable_spec__268.json')) as f:\n cls.MONK_SPECS_DATA[268] = json.load(f)\nwith open(os.path.join(TESTDATA_DIR, 'get_playable_s...
<|body_start_0|> with open(os.path.join(TESTDATA_DIR, 'get_playable_class__10.json')) as f: cls.MONK_CLASS_DATA = json.load(f) cls.MONK_SPECS_DATA = {} with open(os.path.join(TESTDATA_DIR, 'get_playable_spec__268.json')) as f: cls.MONK_SPECS_DATA[268] = json.load(f) ...
Checks creation of a wow playable spec.
TestWowPlayableClassModel
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestWowPlayableClassModel: """Checks creation of a wow playable spec.""" def setUpClass(cls): """Load test data.""" <|body_0|> def create_mock_api(self) -> unittest.mock.MagicMock: """Creates a mock API providing data about the Monk class.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_001184
5,861
permissive
[ { "docstring": "Load test data.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Creates a mock API providing data about the Monk class.", "name": "create_mock_api", "signature": "def create_mock_api(self) -> unittest.mock.MagicMock" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_013438
Implement the Python class `TestWowPlayableClassModel` described below. Class description: Checks creation of a wow playable spec. Method signatures and docstrings: - def setUpClass(cls): Load test data. - def create_mock_api(self) -> unittest.mock.MagicMock: Creates a mock API providing data about the Monk class. - ...
Implement the Python class `TestWowPlayableClassModel` described below. Class description: Checks creation of a wow playable spec. Method signatures and docstrings: - def setUpClass(cls): Load test data. - def create_mock_api(self) -> unittest.mock.MagicMock: Creates a mock API providing data about the Monk class. - ...
709dd307b046158ddf9e49a559852d486168a94f
<|skeleton|> class TestWowPlayableClassModel: """Checks creation of a wow playable spec.""" def setUpClass(cls): """Load test data.""" <|body_0|> def create_mock_api(self) -> unittest.mock.MagicMock: """Creates a mock API providing data about the Monk class.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestWowPlayableClassModel: """Checks creation of a wow playable spec.""" def setUpClass(cls): """Load test data.""" with open(os.path.join(TESTDATA_DIR, 'get_playable_class__10.json')) as f: cls.MONK_CLASS_DATA = json.load(f) cls.MONK_SPECS_DATA = {} with open(...
the_stack_v2_python_sparse
api/mod_wow/static_test.py
FunkySayu/discord-event-manager
train
6
99ec9eea977b63fa6bc30eb49ff79122b177b0d0
[ "self.input_size = input_size\nself.output_size = output_size\nself.alpha = 0.01\nself.alpha_decay = 0.01\nself.gamma = 1", "neural_net = Sequential()\nneural_net.add(Dense(52, input_dim=self.input_size, activation='tanh'))\nneural_net.add(Dense(128, activation='tanh'))\nneural_net.add(Dense(self.output_size * 2 ...
<|body_start_0|> self.input_size = input_size self.output_size = output_size self.alpha = 0.01 self.alpha_decay = 0.01 self.gamma = 1 <|end_body_0|> <|body_start_1|> neural_net = Sequential() neural_net.add(Dense(52, input_dim=self.input_size, activation='tanh'))...
'Controller' class that manages the updating of neural networks for a list of agents.
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """'Controller' class that manages the updating of neural networks for a list of agents.""" def __init__(self, input_size: int, output_size: int): """Initialise the class with learning parameters.""" <|body_0|> def make_agent(self): """Create agent us...
stack_v2_sparse_classes_75kplus_train_001185
4,546
no_license
[ { "docstring": "Initialise the class with learning parameters.", "name": "__init__", "signature": "def __init__(self, input_size: int, output_size: int)" }, { "docstring": "Create agent using Keras neural network.", "name": "make_agent", "signature": "def make_agent(self)" }, { "...
4
stack_v2_sparse_classes_30k_train_053920
Implement the Python class `Controller` described below. Class description: 'Controller' class that manages the updating of neural networks for a list of agents. Method signatures and docstrings: - def __init__(self, input_size: int, output_size: int): Initialise the class with learning parameters. - def make_agent(s...
Implement the Python class `Controller` described below. Class description: 'Controller' class that manages the updating of neural networks for a list of agents. Method signatures and docstrings: - def __init__(self, input_size: int, output_size: int): Initialise the class with learning parameters. - def make_agent(s...
c72db39f7e49bd2c4ba9d8446f6ac7b3678928fd
<|skeleton|> class Controller: """'Controller' class that manages the updating of neural networks for a list of agents.""" def __init__(self, input_size: int, output_size: int): """Initialise the class with learning parameters.""" <|body_0|> def make_agent(self): """Create agent us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Controller: """'Controller' class that manages the updating of neural networks for a list of agents.""" def __init__(self, input_size: int, output_size: int): """Initialise the class with learning parameters.""" self.input_size = input_size self.output_size = output_size s...
the_stack_v2_python_sparse
Machine_Learning/DeepQ/RLController.py
JamesNunns/Robotics-Group-Studies
train
8
d2e31fc712762b4ffe2364ea3aacf761c6d3a21a
[ "try:\n entry = db.get_entry_by_id(list_id=list_id, entry_id=entry_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('could not find entry with id %d in list %d' % (entry_id, list_id))\nreturn jsonify(entry.to_dict())", "try:\n entry = db.get_entry_by_id(list_id=list_id, entry_id=entry_id...
<|body_start_0|> try: entry = db.get_entry_by_id(list_id=list_id, entry_id=entry_id, session=session) except NoResultFound: raise NotFoundError('could not find entry with id %d in list %d' % (entry_id, list_id)) return jsonify(entry.to_dict()) <|end_body_0|> <|body_start...
EntryListEntryAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryListEntryAPI: def get(self, list_id, entry_id, session=None): """Get an entry by list ID and entry ID""" <|body_0|> def delete(self, list_id, entry_id, session=None): """Delete an entry by list ID and entry ID""" <|body_1|> def put(self, list_id, en...
stack_v2_sparse_classes_75kplus_train_001186
11,181
permissive
[ { "docstring": "Get an entry by list ID and entry ID", "name": "get", "signature": "def get(self, list_id, entry_id, session=None)" }, { "docstring": "Delete an entry by list ID and entry ID", "name": "delete", "signature": "def delete(self, list_id, entry_id, session=None)" }, { ...
3
stack_v2_sparse_classes_30k_val_001281
Implement the Python class `EntryListEntryAPI` described below. Class description: Implement the EntryListEntryAPI class. Method signatures and docstrings: - def get(self, list_id, entry_id, session=None): Get an entry by list ID and entry ID - def delete(self, list_id, entry_id, session=None): Delete an entry by lis...
Implement the Python class `EntryListEntryAPI` described below. Class description: Implement the EntryListEntryAPI class. Method signatures and docstrings: - def get(self, list_id, entry_id, session=None): Get an entry by list ID and entry ID - def delete(self, list_id, entry_id, session=None): Delete an entry by lis...
2b7e8314d103c94cf4552bd0152699eeca0ad159
<|skeleton|> class EntryListEntryAPI: def get(self, list_id, entry_id, session=None): """Get an entry by list ID and entry ID""" <|body_0|> def delete(self, list_id, entry_id, session=None): """Delete an entry by list ID and entry ID""" <|body_1|> def put(self, list_id, en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntryListEntryAPI: def get(self, list_id, entry_id, session=None): """Get an entry by list ID and entry ID""" try: entry = db.get_entry_by_id(list_id=list_id, entry_id=entry_id, session=session) except NoResultFound: raise NotFoundError('could not find entry wit...
the_stack_v2_python_sparse
flexget/components/managed_lists/lists/entry_list/api.py
BrutuZ/Flexget
train
1
5a9b0798d7c7ffb85babad224f395cc8b4bfb9ec
[ "self.full_path = search_path\nself.directory_contents = listdir(self.full_path)\nself.config_filenames = []\nself.comp_filenames = []\nself.vi_list = []\nself._extract_config_filenames()", "for filename in self.directory_contents:\n if fnmatch(filename, '*.conf'):\n self.config_filenames.append(filenam...
<|body_start_0|> self.full_path = search_path self.directory_contents = listdir(self.full_path) self.config_filenames = [] self.comp_filenames = [] self.vi_list = [] self._extract_config_filenames() <|end_body_0|> <|body_start_1|> for filename in self.directory_c...
Reads SECI configuration files and extracts VI names
ReadConfigFiles
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadConfigFiles: """Reads SECI configuration files and extracts VI names""" def __init__(self, search_path): """create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path ...
stack_v2_sparse_classes_75kplus_train_001187
3,583
no_license
[ { "docstring": "create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path for files", "name": "__init__", "signature": "def __init__(self, search_path)" }, { "docstring": "extract SE...
6
stack_v2_sparse_classes_30k_train_039664
Implement the Python class `ReadConfigFiles` described below. Class description: Reads SECI configuration files and extracts VI names Method signatures and docstrings: - def __init__(self, search_path): create lists for filenames and initialise to empty lists call methods for reading directory contents and searching ...
Implement the Python class `ReadConfigFiles` described below. Class description: Reads SECI configuration files and extracts VI names Method signatures and docstrings: - def __init__(self, search_path): create lists for filenames and initialise to empty lists call methods for reading directory contents and searching ...
bcc5cf19773731979f3e3123a4f585a0bf723c1b
<|skeleton|> class ReadConfigFiles: """Reads SECI configuration files and extracts VI names""" def __init__(self, search_path): """create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReadConfigFiles: """Reads SECI configuration files and extracts VI names""" def __init__(self, search_path): """create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path for files""" ...
the_stack_v2_python_sparse
SECI_Config_Analyser/Directory_Operations.py
ISISComputingGroup/ibex_utils
train
0
e1c0538e51c22b15efb5aa83ab6d516d907d66ac
[ "if nr_processes is None:\n available_processors = cpu_count()\n self.processes = available_processors\n print('BatchRunner MP will use {} processors.'.format(self.processes))\nelse:\n self.processes = nr_processes\nsuper().__init__(model_cls, **kwargs)\nself.pool = Pool(self.processes)", "total_itera...
<|body_start_0|> if nr_processes is None: available_processors = cpu_count() self.processes = available_processors print('BatchRunner MP will use {} processors.'.format(self.processes)) else: self.processes = nr_processes super().__init__(model_cls...
Child class of BatchRunner, extended with multiprocessing support.
BatchRunnerMP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchRunnerMP: """Child class of BatchRunner, extended with multiprocessing support.""" def __init__(self, model_cls, nr_processes=None, **kwargs): """Create a new BatchRunnerMP for a given model with the given parameters. model_cls: The class of model to batch-run. nr_processes: int...
stack_v2_sparse_classes_75kplus_train_001188
21,332
permissive
[ { "docstring": "Create a new BatchRunnerMP for a given model with the given parameters. model_cls: The class of model to batch-run. nr_processes: int the number of separate processes the BatchRunner should start, all running in parallel. kwargs: the kwargs required for the parent BatchRunner class", "name":...
5
null
Implement the Python class `BatchRunnerMP` described below. Class description: Child class of BatchRunner, extended with multiprocessing support. Method signatures and docstrings: - def __init__(self, model_cls, nr_processes=None, **kwargs): Create a new BatchRunnerMP for a given model with the given parameters. mode...
Implement the Python class `BatchRunnerMP` described below. Class description: Child class of BatchRunner, extended with multiprocessing support. Method signatures and docstrings: - def __init__(self, model_cls, nr_processes=None, **kwargs): Create a new BatchRunnerMP for a given model with the given parameters. mode...
39efe4007fba2b12b75c72f7795827a1f74d640b
<|skeleton|> class BatchRunnerMP: """Child class of BatchRunner, extended with multiprocessing support.""" def __init__(self, model_cls, nr_processes=None, **kwargs): """Create a new BatchRunnerMP for a given model with the given parameters. model_cls: The class of model to batch-run. nr_processes: int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BatchRunnerMP: """Child class of BatchRunner, extended with multiprocessing support.""" def __init__(self, model_cls, nr_processes=None, **kwargs): """Create a new BatchRunnerMP for a given model with the given parameters. model_cls: The class of model to batch-run. nr_processes: int the number o...
the_stack_v2_python_sparse
venv/Lib/site-packages/mesa/batchrunner.py
tpike3/SugarScape
train
11
58690e25a79d411293a0eeb743dda16024c9a731
[ "self.next_link = next_link\nself.total_links = total_links\nself.list = list\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nnext_link = dictionary.get('NextLink')\ntotal_links = dictionary.get('TotalLinks')\nlist = None\nif dictionary.get('List') != None:\n lis...
<|body_start_0|> self.next_link = next_link self.total_links = total_links self.list = list self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None next_link = dictionary.get('NextLink') to...
Implementation of the 'ListResult[IdentificationLogItem]' model. TODO: type model description here. Attributes: next_link (string): Link to the next results if not set there are less then the return limit of 1000 total_links (int): The total amount of links (pages) for the list list (list of IdentificationLogItem): Lis...
ListResultIdentificationLogItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListResultIdentificationLogItem: """Implementation of the 'ListResult[IdentificationLogItem]' model. TODO: type model description here. Attributes: next_link (string): Link to the next results if not set there are less then the return limit of 1000 total_links (int): The total amount of links (pa...
stack_v2_sparse_classes_75kplus_train_001189
2,729
permissive
[ { "docstring": "Constructor for the ListResultIdentificationLogItem class", "name": "__init__", "signature": "def __init__(self, next_link=None, total_links=None, list=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictio...
2
stack_v2_sparse_classes_30k_train_050561
Implement the Python class `ListResultIdentificationLogItem` described below. Class description: Implementation of the 'ListResult[IdentificationLogItem]' model. TODO: type model description here. Attributes: next_link (string): Link to the next results if not set there are less then the return limit of 1000 total_lin...
Implement the Python class `ListResultIdentificationLogItem` described below. Class description: Implementation of the 'ListResult[IdentificationLogItem]' model. TODO: type model description here. Attributes: next_link (string): Link to the next results if not set there are less then the return limit of 1000 total_lin...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class ListResultIdentificationLogItem: """Implementation of the 'ListResult[IdentificationLogItem]' model. TODO: type model description here. Attributes: next_link (string): Link to the next results if not set there are less then the return limit of 1000 total_links (int): The total amount of links (pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ListResultIdentificationLogItem: """Implementation of the 'ListResult[IdentificationLogItem]' model. TODO: type model description here. Attributes: next_link (string): Link to the next results if not set there are less then the return limit of 1000 total_links (int): The total amount of links (pages) for the ...
the_stack_v2_python_sparse
idfy_rest_client/models/list_result_identification_log_item.py
dealflowteam/Idfy
train
0
3eee3c20521da9edd15910b1581b27b1cb60cd9a
[ "super(SplitterBlock, self).__init__()\nassert len(sections) == 2\nself.sections = sections\nself.header['out_1'] = {}\nself.header['out_1']['dtype'] = str(np.float32)\nself.header['out_1']['nbit'] = 32\nself.header['out_1']['shape'] = sections[0]\nself.header['out_2'] = self.header['out_1']\nself.header['out_2']['...
<|body_start_0|> super(SplitterBlock, self).__init__() assert len(sections) == 2 self.sections = sections self.header['out_1'] = {} self.header['out_1']['dtype'] = str(np.float32) self.header['out_1']['nbit'] = 32 self.header['out_1']['shape'] = sections[0] ...
Block which splits up a ring into two
SplitterBlock
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SplitterBlock: """Block which splits up a ring into two""" def __init__(self, sections): """@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices.""" <|body_0|> def load_settings(sel...
stack_v2_sparse_classes_75kplus_train_001190
49,813
permissive
[ { "docstring": "@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices.", "name": "__init__", "signature": "def __init__(self, sections)" }, { "docstring": "Set the gulp sizes appropriate to the input ring", ...
3
stack_v2_sparse_classes_30k_train_026046
Implement the Python class `SplitterBlock` described below. Class description: Block which splits up a ring into two Method signatures and docstrings: - def __init__(self, sections): @param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing ...
Implement the Python class `SplitterBlock` described below. Class description: Block which splits up a ring into two Method signatures and docstrings: - def __init__(self, sections): @param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing ...
5a93e5d4e906694cf754ac4f1015640a710ffc02
<|skeleton|> class SplitterBlock: """Block which splits up a ring into two""" def __init__(self, sections): """@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices.""" <|body_0|> def load_settings(sel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SplitterBlock: """Block which splits up a ring into two""" def __init__(self, sections): """@param[in] sections List of two lists - each list is a 1D array of integers indicating sections of the ring to cut. Like numpy slicing indices.""" super(SplitterBlock, self).__init__() asse...
the_stack_v2_python_sparse
python/bifrost/block.py
ledatelescope/bifrost
train
66
d1cf2693d6534155191cf92b85d6544d2c307cd2
[ "data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]])\nself.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea')\nself.plugin = DifferenceBetweenAdjacentGridSquares()", "expected = np.array([[1, 1], [2, 2], [5, 5]])\nresult = self.plugin.calculate_difference(self.cube, self.cube.coord(axis='x').n...
<|body_start_0|> data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea') self.plugin = DifferenceBetweenAdjacentGridSquares() <|end_body_0|> <|body_start_1|> expected = np.array([[1, 1], [2, 2], [5, 5]]) res...
Test the calculate_difference method.
Test_calculate_difference
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_calculate_difference: """Test the calculate_difference method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_x_dimension(self): """Test differences calculated along the x dimension.""" <|body_1|> def test_y_dimension(self): ...
stack_v2_sparse_classes_75kplus_train_001191
8,701
permissive
[ { "docstring": "Set up cube.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test differences calculated along the x dimension.", "name": "test_x_dimension", "signature": "def test_x_dimension(self)" }, { "docstring": "Test differences calculated along the y ...
5
stack_v2_sparse_classes_30k_train_012526
Implement the Python class `Test_calculate_difference` described below. Class description: Test the calculate_difference method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_x_dimension(self): Test differences calculated along the x dimension. - def test_y_dimension(self): Test differe...
Implement the Python class `Test_calculate_difference` described below. Class description: Test the calculate_difference method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_x_dimension(self): Test differences calculated along the x dimension. - def test_y_dimension(self): Test differe...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_calculate_difference: """Test the calculate_difference method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_x_dimension(self): """Test differences calculated along the x dimension.""" <|body_1|> def test_y_dimension(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_calculate_difference: """Test the calculate_difference method.""" def setUp(self): """Set up cube.""" data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea') self.plugin = DifferenceBetweenAdjacen...
the_stack_v2_python_sparse
improver_tests/utilities/test_DifferenceBetweenAdjacentGridSquares.py
metoppv/improver
train
101
1b40b2a03ceb5f1bcc60171f6bf2dda7398d7a49
[ "self.logger = logging.getLogger('portfolio_manager')\nself.logger.info('Starting portfolio manager...')\nself.config = json.loads(open(config_file, 'r').read())\nself.logger.debug('Config loaded')\nself.HOST = self.config['host']\nself.PORT = self.config['port']\nself.REFRESH_TIMEOUT = self.config['refresh_timeout...
<|body_start_0|> self.logger = logging.getLogger('portfolio_manager') self.logger.info('Starting portfolio manager...') self.config = json.loads(open(config_file, 'r').read()) self.logger.debug('Config loaded') self.HOST = self.config['host'] self.PORT = self.config['port...
Manages the whole Hydra system. Keeps a list of market interfaces and strategies, and assigns resources. It also send initialization and various lifecycle signals to the strategy. Starts a server which handles incoming requests to the manager.
PortfolioManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortfolioManager: """Manages the whole Hydra system. Keeps a list of market interfaces and strategies, and assigns resources. It also send initialization and various lifecycle signals to the strategy. Starts a server which handles incoming requests to the manager.""" def __init__(self, confi...
stack_v2_sparse_classes_75kplus_train_001192
4,282
no_license
[ { "docstring": "Initialize manager and start manager server :param config_file: filename of the config file containing the necessary info", "name": "__init__", "signature": "def __init__(self, config_file='config.json')" }, { "docstring": "Cycle that periodically checks registered strategies and...
2
stack_v2_sparse_classes_30k_train_002086
Implement the Python class `PortfolioManager` described below. Class description: Manages the whole Hydra system. Keeps a list of market interfaces and strategies, and assigns resources. It also send initialization and various lifecycle signals to the strategy. Starts a server which handles incoming requests to the ma...
Implement the Python class `PortfolioManager` described below. Class description: Manages the whole Hydra system. Keeps a list of market interfaces and strategies, and assigns resources. It also send initialization and various lifecycle signals to the strategy. Starts a server which handles incoming requests to the ma...
b036fe92acd8d158a177f5b3b8021797b9ebc24a
<|skeleton|> class PortfolioManager: """Manages the whole Hydra system. Keeps a list of market interfaces and strategies, and assigns resources. It also send initialization and various lifecycle signals to the strategy. Starts a server which handles incoming requests to the manager.""" def __init__(self, confi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PortfolioManager: """Manages the whole Hydra system. Keeps a list of market interfaces and strategies, and assigns resources. It also send initialization and various lifecycle signals to the strategy. Starts a server which handles incoming requests to the manager.""" def __init__(self, config_file='confi...
the_stack_v2_python_sparse
portfolio_manager/manager.py
Danis98/Hydra
train
7
00ad209f236b1433a31f17c00d35af216b630163
[ "del kwargs\ninstance_dict = self._get_instance_dict(context)\nfor gi, s in settings.items():\n s = deepcopy(s)\n try:\n gi.enable(**s)\n instance_dict[gi.name] = gi\n except AttributeError:\n self.machine.gis[gi].enable(**s)\n instance_dict[gi] = self.machine.gis[gi]", "value...
<|body_start_0|> del kwargs instance_dict = self._get_instance_dict(context) for gi, s in settings.items(): s = deepcopy(s) try: gi.enable(**s) instance_dict[gi.name] = gi except AttributeError: self.machine.gis[...
Enables GIs based on config.
GiPlayer
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GiPlayer: """Enables GIs based on config.""" def play(self, settings, context, calling_context, priority=0, **kwargs): """Enable GIs.""" <|body_0|> def get_express_config(self, value): """Parse express config.""" <|body_1|> def clear_context(self, co...
stack_v2_sparse_classes_75kplus_train_001193
1,312
permissive
[ { "docstring": "Enable GIs.", "name": "play", "signature": "def play(self, settings, context, calling_context, priority=0, **kwargs)" }, { "docstring": "Parse express config.", "name": "get_express_config", "signature": "def get_express_config(self, value)" }, { "docstring": "Dis...
3
null
Implement the Python class `GiPlayer` described below. Class description: Enables GIs based on config. Method signatures and docstrings: - def play(self, settings, context, calling_context, priority=0, **kwargs): Enable GIs. - def get_express_config(self, value): Parse express config. - def clear_context(self, contex...
Implement the Python class `GiPlayer` described below. Class description: Enables GIs based on config. Method signatures and docstrings: - def play(self, settings, context, calling_context, priority=0, **kwargs): Enable GIs. - def get_express_config(self, value): Parse express config. - def clear_context(self, contex...
00937ab2ff51b1dc668bf465282ffa8ff1eebbd8
<|skeleton|> class GiPlayer: """Enables GIs based on config.""" def play(self, settings, context, calling_context, priority=0, **kwargs): """Enable GIs.""" <|body_0|> def get_express_config(self, value): """Parse express config.""" <|body_1|> def clear_context(self, co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GiPlayer: """Enables GIs based on config.""" def play(self, settings, context, calling_context, priority=0, **kwargs): """Enable GIs.""" del kwargs instance_dict = self._get_instance_dict(context) for gi, s in settings.items(): s = deepcopy(s) try: ...
the_stack_v2_python_sparse
mpf/config_players/gi_player.py
vgrillot/mpf
train
0
6bb164861316ce0e8cd53a7bf584b50ab695464d
[ "self.nums = nums\nself.lens = len(nums)\nself.BIT = [0] * (self.lens + 1)\nfor i in range(self.lens):\n k = i + 1\n while k <= self.lens:\n self.BIT[k] += nums[i]\n k += k & -k", "diff = val - self.nums[i]\nself.nums[i] = val\ni += 1\nwhile i <= self.lens:\n self.BIT[i] += diff\n i += i...
<|body_start_0|> self.nums = nums self.lens = len(nums) self.BIT = [0] * (self.lens + 1) for i in range(self.lens): k = i + 1 while k <= self.lens: self.BIT[k] += nums[i] k += k & -k <|end_body_0|> <|body_start_1|> diff = v...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_001194
1,866
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
stack_v2_sparse_classes_30k_train_004251
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 update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
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 update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
212f8b83d6ac22db1a777f980075d9e12ce521d2
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.nums = nums self.lens = len(nums) self.BIT = [0] * (self.lens + 1) for i in range(self.lens): k = i + 1 while k <= self.lens: self.BIT[k] += nums[i] ...
the_stack_v2_python_sparse
LeetCode/python/307_(Binary Indexed Tree)_hard_Range Sum Query - Mutable.py
FrankieZhen/Lookoop
train
1
32440e864510ab2c887fd215e7f98ec94d9c97e0
[ "length = len(nums)\nif k >= length:\n k = k % length\nstep = 0\nwhile step < k:\n lats_num = nums[length - 1]\n end_index = length - 1\n while end_index > 0:\n nums[end_index] = nums[end_index - 1]\n end_index = end_index - 1\n nums[0] = lats_num\n step += 1\nreturn nums", "n = le...
<|body_start_0|> length = len(nums) if k >= length: k = k % length step = 0 while step < k: lats_num = nums[length - 1] end_index = length - 1 while end_index > 0: nums[end_index] = nums[end_index - 1] end_in...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def over_rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: None Do not return anything, modi...
stack_v2_sparse_classes_75kplus_train_001195
1,182
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.", "name": "over_rotate", "signature": "def over_rotate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-p...
2
stack_v2_sparse_classes_30k_train_001771
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def over_rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead. - def rotate(self, nums, k): :type nums: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def over_rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead. - def rotate(self, nums, k): :type nums: Lis...
f43d70cac56bdf6377b22b865174af822902ff78
<|skeleton|> class Solution: def over_rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: None Do not return anything, modi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def over_rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead.""" length = len(nums) if k >= length: k = k % length step = 0 while step < k: lats_num = nums[lengt...
the_stack_v2_python_sparse
数组/LeetCode189_旋转数组.py
ltzp/LeetCode
train
0
05501b6ce329db9dde3d1a76567473870b817b25
[ "try:\n response_text = response.read()\nexcept AttributeError:\n response_text = response\nself.version, self.status, self.error_type, self.message = (None, None, None, None)\ntry:\n response = json.loads(response_text)\n self.version = response['version']\n self.status = response['status']\n sel...
<|body_start_0|> try: response_text = response.read() except AttributeError: response_text = response self.version, self.status, self.error_type, self.message = (None, None, None, None) try: response = json.loads(response_text) self.version...
Object representation of a response received from the Resolve API See http://developer.factual.com/display/docs/Places+API+-+Resolve for details.
ResolveResponse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResolveResponse: """Object representation of a response received from the Resolve API See http://developer.factual.com/display/docs/Places+API+-+Resolve for details.""" def __init__(self, response): """response can be string or file-like object""" <|body_0|> def get_reso...
stack_v2_sparse_classes_75kplus_train_001196
4,243
no_license
[ { "docstring": "response can be string or file-like object", "name": "__init__", "signature": "def __init__(self, response)" }, { "docstring": "Returns the one and only \"resolved\" result, if it exists. Return False if it doesnt. Return value is a dict containing place components as well as res...
2
stack_v2_sparse_classes_30k_train_040260
Implement the Python class `ResolveResponse` described below. Class description: Object representation of a response received from the Resolve API See http://developer.factual.com/display/docs/Places+API+-+Resolve for details. Method signatures and docstrings: - def __init__(self, response): response can be string or...
Implement the Python class `ResolveResponse` described below. Class description: Object representation of a response received from the Resolve API See http://developer.factual.com/display/docs/Places+API+-+Resolve for details. Method signatures and docstrings: - def __init__(self, response): response can be string or...
baad13c5812f541478b914575ffba42128edce65
<|skeleton|> class ResolveResponse: """Object representation of a response received from the Resolve API See http://developer.factual.com/display/docs/Places+API+-+Resolve for details.""" def __init__(self, response): """response can be string or file-like object""" <|body_0|> def get_reso...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResolveResponse: """Object representation of a response received from the Resolve API See http://developer.factual.com/display/docs/Places+API+-+Resolve for details.""" def __init__(self, response): """response can be string or file-like object""" try: response_text = response...
the_stack_v2_python_sparse
outsourcing/apitools/factual.py
Crockcharterings/onlyinpgh
train
0
e016a92d441f4b2e04ef1f442ee7cc9411b01ba8
[ "import re\nself.dataset_urls_file_path = dataset_urls_file_path\nself._category_regex = re.compile('[A-Za-z]+:')\nself._document_regex = re.compile('.*,http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')", "import IOUtilities, os\nwith open(self.dataset_urls_file_path, 'r') as f:\n ...
<|body_start_0|> import re self.dataset_urls_file_path = dataset_urls_file_path self._category_regex = re.compile('[A-Za-z]+:') self._document_regex = re.compile('.*,http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+') <|end_body_0|> <|body_start_1|> im...
Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category.
DataSetCreator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSetCreator: """Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category.""" def __init__(self, dataset_urls_file_path: str): ...
stack_v2_sparse_classes_75kplus_train_001197
3,112
no_license
[ { "docstring": ":param dataset_urls_file_path: Filename for a .txt file which consists of category name,text names and urls.", "name": "__init__", "signature": "def __init__(self, dataset_urls_file_path: str)" }, { "docstring": "From the given dataset_utilities url file, reach document is retrie...
2
stack_v2_sparse_classes_30k_train_042526
Implement the Python class `DataSetCreator` described below. Class description: Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category. Method signatures and ...
Implement the Python class `DataSetCreator` described below. Class description: Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category. Method signatures and ...
e79acd95d02f981aae13b4d6e55e8bdf65dc268c
<|skeleton|> class DataSetCreator: """Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category.""" def __init__(self, dataset_urls_file_path: str): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataSetCreator: """Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category.""" def __init__(self, dataset_urls_file_path: str): """:param ...
the_stack_v2_python_sparse
dataset_utilities/data_set_creation.py
MDThomsen/DBAC-Device-Detection
train
0
0e24f3163912ad1e2fd3656f60a154da16d91d56
[ "self._model = model\nself._beam_size = beam_size\nself._start_token = start_token\nself._end_token = end_token\nself._max_steps = max_steps", "enc_top_states, dec_in_state = self._model.encode_top_state(sess, enc_inputs, enc_seqlen)\nhyps = [Hypothesis([self._start_token], 0.0, dec_in_state)] * self._beam_size\n...
<|body_start_0|> self._model = model self._beam_size = beam_size self._start_token = start_token self._end_token = end_token self._max_steps = max_steps <|end_body_0|> <|body_start_1|> enc_top_states, dec_in_state = self._model.encode_top_state(sess, enc_inputs, enc_seql...
Beam search. Beam search takes the top K results from the model, predicts the K results for each of the previous K result, getting K*K results. Pick the top K results from K*K results, and start over again until certain number of results are fully decoded
BeamSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeamSearch: """Beam search. Beam search takes the top K results from the model, predicts the K results for each of the previous K result, getting K*K results. Pick the top K results from K*K results, and start over again until certain number of results are fully decoded""" def __init__(self,...
stack_v2_sparse_classes_75kplus_train_001198
5,217
no_license
[ { "docstring": "Creates BeamSearch object :param model: Seq2SeqAttentionModel :param beam_size: int :param start_token: int, id of the token to start decoding with :param end_token: int, id of the token that completes an hypothesis :param max_steps: int, upper limit on the size of the hypothesis", "name": "...
3
null
Implement the Python class `BeamSearch` described below. Class description: Beam search. Beam search takes the top K results from the model, predicts the K results for each of the previous K result, getting K*K results. Pick the top K results from K*K results, and start over again until certain number of results are f...
Implement the Python class `BeamSearch` described below. Class description: Beam search. Beam search takes the top K results from the model, predicts the K results for each of the previous K result, getting K*K results. Pick the top K results from K*K results, and start over again until certain number of results are f...
ee7ecedd55ce544b127be8009e026ac2cdc3f71b
<|skeleton|> class BeamSearch: """Beam search. Beam search takes the top K results from the model, predicts the K results for each of the previous K result, getting K*K results. Pick the top K results from K*K results, and start over again until certain number of results are fully decoded""" def __init__(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BeamSearch: """Beam search. Beam search takes the top K results from the model, predicts the K results for each of the previous K result, getting K*K results. Pick the top K results from K*K results, and start over again until certain number of results are fully decoded""" def __init__(self, model, beam_...
the_stack_v2_python_sparse
model_tensorflow/textsum_model/beam_search.py
ZouJoshua/dl_project
train
9
b024ce790f1a0c6ce1cc0e1f34202313fcedc8a0
[ "super().__init__()\nself.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config)\nself.label_map = parse_dataset_metadata_bytes(metadata_bytes)\nself.input_image = self.graph.get_tensor_by_name('input')\nself.segmented_tensor = self.graph.get_tensor_by_name('output_prediction')", "feed = ...
<|body_start_0|> super().__init__() self.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config) self.label_map = parse_dataset_metadata_bytes(metadata_bytes) self.input_image = self.graph.get_tensor_by_name('input') self.segmented_tensor = self.graph.get_...
Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?
Segmenter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Segmenter: """Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?""" def __ini...
stack_v2_sparse_classes_75kplus_train_001199
2,521
permissive
[ { "docstring": ":param model_bytes: Model file data, likely a loaded *.pb file :param metadata_bytes: The dataset metadata file data, likely named \"dataset_metadata.json\" :param device: The device to run the model on :param session_config: Model configuration options", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_train_007648
Implement the Python class `Segmenter` described below. Class description: Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch predictio...
Implement the Python class `Segmenter` described below. Class description: Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch predictio...
7412902fed8f91c9c82bd42b0180e07673c38bf1
<|skeleton|> class Segmenter: """Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?""" def __ini...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Segmenter: """Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?""" def __init__(self, mod...
the_stack_v2_python_sparse
vcap_utils/vcap_utils/backends/segmentation.py
opencv/open_vision_capsules
train
124