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
d7367642f37563412ff457f45f0547494861dfd6
[ "left, right = (0, len(height) - 1)\nleft_max = right_max = water_area = 0\nwhile left < right:\n if height[left] < height[right]:\n if height[left] > left_max:\n left_max = height[left]\n water_area += left_max - height[left]\n left += 1\n else:\n if height[right] > rig...
<|body_start_0|> left, right = (0, len(height) - 1) left_max = right_max = water_area = 0 while left < right: if height[left] < height[right]: if height[left] > left_max: left_max = height[left] water_area += left_max - height[left]...
RainWater
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RainWater: def get_area(self, height: List[int]) -> int: """Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:""" <|body_0|> def get_area_(self, height: List[int]) -> int: """Approach: Pointers Time Complexity: O(N) Space Comp...
stack_v2_sparse_classes_75kplus_train_005200
1,629
no_license
[ { "docstring": "Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:", "name": "get_area", "signature": "def get_area(self, height: List[int]) -> int" }, { "docstring": "Approach: Pointers Time Complexity: O(N) Space Complexity: O(N) :param height: :return:...
2
stack_v2_sparse_classes_30k_train_023451
Implement the Python class `RainWater` described below. Class description: Implement the RainWater class. Method signatures and docstrings: - def get_area(self, height: List[int]) -> int: Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return: - def get_area_(self, height: List[int...
Implement the Python class `RainWater` described below. Class description: Implement the RainWater class. Method signatures and docstrings: - def get_area(self, height: List[int]) -> int: Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return: - def get_area_(self, height: List[int...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class RainWater: def get_area(self, height: List[int]) -> int: """Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:""" <|body_0|> def get_area_(self, height: List[int]) -> int: """Approach: Pointers Time Complexity: O(N) Space Comp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RainWater: def get_area(self, height: List[int]) -> int: """Approach: Two Pointers Time Complexity: O(N) Space Complexity: O(1) :param height: :return:""" left, right = (0, len(height) - 1) left_max = right_max = water_area = 0 while left < right: if height[left] < ...
the_stack_v2_python_sparse
revisited_2021/arrays/two_pointers/trapping_rain_water.py
Shiv2157k/leet_code
train
1
856601f7348d491c89af97d715f7e406504b0d1f
[ "tmp_file_name = 'test.json'\ntmp_dir_name = tempfile.gettempdir()\njson_file_path = tmp_dir_name + '/' + tmp_file_name\nwith open(json_file_path, 'w') as f:\n f.write(policy_json.strip())\ngrd_text = '\\n <grit base_dir=\".\" latest_public_release=\"0\" current_release=\"1\" source_lang_id=\"en\">\\n <r...
<|body_start_0|> tmp_file_name = 'test.json' tmp_dir_name = tempfile.gettempdir() json_file_path = tmp_dir_name + '/' + tmp_file_name with open(json_file_path, 'w') as f: f.write(policy_json.strip()) grd_text = '\n <grit base_dir="." latest_public_release="0" curre...
Common class for unittesting writers.
WriterUnittestCommon
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" <|body_0|> def GetOutput(self...
stack_v2_sparse_classes_75kplus_train_005201
2,618
permissive
[ { "docstring": "Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.", "name": "PrepareTest", "signature": "def PrepareTest(self, policy_json)" }, { "docstring": "Generates an output of a writer. Args: grd: The root...
2
stack_v2_sparse_classes_30k_train_011710
Implement the Python class `WriterUnittestCommon` described below. Class description: Common class for unittesting writers. Method signatures and docstrings: - def PrepareTest(self, policy_json): Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in J...
Implement the Python class `WriterUnittestCommon` described below. Class description: Common class for unittesting writers. Method signatures and docstrings: - def PrepareTest(self, policy_json): Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in J...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" <|body_0|> def GetOutput(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" tmp_file_name = 'test.json' tmp_dir_nam...
the_stack_v2_python_sparse
tools/grit/grit/format/policy_templates/writers/writer_unittest_common.py
metux/chromium-suckless
train
5
de7c8e34a48d9d66e448f53c79f29e4a857af470
[ "self.capacity = capacity\nself.cache: Dict[int, [int, int]] = {}\nself.fake_time_stamp = 0", "if key in self.cache:\n self.fake_time_stamp += 1\n self.cache[key][0] = self.fake_time_stamp\n return self.cache[key][1]\nelse:\n return -1", "self.fake_time_stamp += 1\noldest_key = -1\noldest_fake_time_...
<|body_start_0|> self.capacity = capacity self.cache: Dict[int, [int, int]] = {} self.fake_time_stamp = 0 <|end_body_0|> <|body_start_1|> if key in self.cache: self.fake_time_stamp += 1 self.cache[key][0] = self.fake_time_stamp return self.cache[key][...
Implements a LRU Cache.
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: """Implements a LRU Cache.""" def __init__(self, capacity: int): """Initialize LUR cache with specific capacity. args: capacity: capacity""" <|body_0|> def get(self, key: int) -> int: """Fetch value by key. Args: key: key to lookup Returns: Value found ...
stack_v2_sparse_classes_75kplus_train_005202
1,653
no_license
[ { "docstring": "Initialize LUR cache with specific capacity. args: capacity: capacity", "name": "__init__", "signature": "def __init__(self, capacity: int)" }, { "docstring": "Fetch value by key. Args: key: key to lookup Returns: Value found or -1 if not found", "name": "get", "signature...
3
null
Implement the Python class `LRUCache` described below. Class description: Implements a LRU Cache. Method signatures and docstrings: - def __init__(self, capacity: int): Initialize LUR cache with specific capacity. args: capacity: capacity - def get(self, key: int) -> int: Fetch value by key. Args: key: key to lookup ...
Implement the Python class `LRUCache` described below. Class description: Implements a LRU Cache. Method signatures and docstrings: - def __init__(self, capacity: int): Initialize LUR cache with specific capacity. args: capacity: capacity - def get(self, key: int) -> int: Fetch value by key. Args: key: key to lookup ...
d5f32b77afb35e5a37d553e7e523d186c7bddcf6
<|skeleton|> class LRUCache: """Implements a LRU Cache.""" def __init__(self, capacity: int): """Initialize LUR cache with specific capacity. args: capacity: capacity""" <|body_0|> def get(self, key: int) -> int: """Fetch value by key. Args: key: key to lookup Returns: Value found ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: """Implements a LRU Cache.""" def __init__(self, capacity: int): """Initialize LUR cache with specific capacity. args: capacity: capacity""" self.capacity = capacity self.cache: Dict[int, [int, int]] = {} self.fake_time_stamp = 0 def get(self, key: int) -> i...
the_stack_v2_python_sparse
Challenges/challenge_45_lru_cache/GregHilston/src/solution.py
GregHilston/Code-Foo
train
2
c9362c2498c5163d24f9684beab7fbe3836c73c0
[ "if monosaccharide_codes is None:\n self.monosaccharide_codes = get_default_monosaccharide_codes()\nself.parser = self._create_cfg_parser()", "parsed_result = self.parser.parseString(glycan_string)\nresults = parse_cfg_structure_to_graph(parsed_result, parse_linker=parse_linker)\nreturn results", "digit = Wo...
<|body_start_0|> if monosaccharide_codes is None: self.monosaccharide_codes = get_default_monosaccharide_codes() self.parser = self._create_cfg_parser() <|end_body_0|> <|body_start_1|> parsed_result = self.parser.parseString(glycan_string) results = parse_cfg_structure_to_gr...
A parser for CFG glycan strings. Provides access to a parser object that can be used to parse CFG glycan strings.
CFGGlycanParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CFGGlycanParser: """A parser for CFG glycan strings. Provides access to a parser object that can be used to parse CFG glycan strings.""" def __init__(self, monosaccharide_codes=None): """Create a parser object which can then be used to parse multiple CFG glycan strings. Args: monosac...
stack_v2_sparse_classes_75kplus_train_005203
9,405
permissive
[ { "docstring": "Create a parser object which can then be used to parse multiple CFG glycan strings. Args: monosaccharide_codes (list, optional): A list of monosaccharide codes to initialise the parser with. If `None`, then uses the KEGG list of glycan codes, with the addition of `G-ol`, which appears in the CFG...
3
stack_v2_sparse_classes_30k_train_048116
Implement the Python class `CFGGlycanParser` described below. Class description: A parser for CFG glycan strings. Provides access to a parser object that can be used to parse CFG glycan strings. Method signatures and docstrings: - def __init__(self, monosaccharide_codes=None): Create a parser object which can then be...
Implement the Python class `CFGGlycanParser` described below. Class description: A parser for CFG glycan strings. Provides access to a parser object that can be used to parse CFG glycan strings. Method signatures and docstrings: - def __init__(self, monosaccharide_codes=None): Create a parser object which can then be...
2faa2856f370dbe5893d0e0f4e0082c956939335
<|skeleton|> class CFGGlycanParser: """A parser for CFG glycan strings. Provides access to a parser object that can be used to parse CFG glycan strings.""" def __init__(self, monosaccharide_codes=None): """Create a parser object which can then be used to parse multiple CFG glycan strings. Args: monosac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CFGGlycanParser: """A parser for CFG glycan strings. Provides access to a parser object that can be used to parse CFG glycan strings.""" def __init__(self, monosaccharide_codes=None): """Create a parser object which can then be used to parse multiple CFG glycan strings. Args: monosaccharide_codes...
the_stack_v2_python_sparse
Scripts/cfg_parser.py
andrewguy/CCARL
train
3
cd7dfdd72709a257b275b71cc62aa20be13cc676
[ "if self.is_present:\n self.is_absent = False\n self.present_absentcheck = True", "if self.is_absent:\n self.is_present = False\n self.present_absentcheck = True", "for rec in self:\n if not rec.is_present and (not rec.is_absent):\n raise ValidationError(_('Check Present or Absent!'))" ]
<|body_start_0|> if self.is_present: self.is_absent = False self.present_absentcheck = True <|end_body_0|> <|body_start_1|> if self.is_absent: self.is_present = False self.present_absentcheck = True <|end_body_1|> <|body_start_2|> for rec in self...
Defining Daily Attendance Sheet Line Information.
DailySubjectAttendanceLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DailySubjectAttendanceLine: """Defining Daily Attendance Sheet Line Information.""" def onchange_attendance(self): """Method to make absent false when student is present.""" <|body_0|> def onchange_absent(self): """Method to make present false when student is abs...
stack_v2_sparse_classes_75kplus_train_005204
32,692
no_license
[ { "docstring": "Method to make absent false when student is present.", "name": "onchange_attendance", "signature": "def onchange_attendance(self)" }, { "docstring": "Method to make present false when student is absent.", "name": "onchange_absent", "signature": "def onchange_absent(self)"...
3
stack_v2_sparse_classes_30k_train_050542
Implement the Python class `DailySubjectAttendanceLine` described below. Class description: Defining Daily Attendance Sheet Line Information. Method signatures and docstrings: - def onchange_attendance(self): Method to make absent false when student is present. - def onchange_absent(self): Method to make present fals...
Implement the Python class `DailySubjectAttendanceLine` described below. Class description: Defining Daily Attendance Sheet Line Information. Method signatures and docstrings: - def onchange_attendance(self): Method to make absent false when student is present. - def onchange_absent(self): Method to make present fals...
fd699e2767ae286b7b37b610809faa753d58c219
<|skeleton|> class DailySubjectAttendanceLine: """Defining Daily Attendance Sheet Line Information.""" def onchange_attendance(self): """Method to make absent false when student is present.""" <|body_0|> def onchange_absent(self): """Method to make present false when student is abs...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DailySubjectAttendanceLine: """Defining Daily Attendance Sheet Line Information.""" def onchange_attendance(self): """Method to make absent false when student is present.""" if self.is_present: self.is_absent = False self.present_absentcheck = True def onchang...
the_stack_v2_python_sparse
School/custom_attendance/models/daily_attendance.py
fahimanizam/odoo-my-file
train
0
cb551029c7d4842f5f0ecf73a092b44db105a69f
[ "response = self.client.get(endpoint, filters, format='json')\nself.assertEqual(response.status_code, status_code)\nreturn response.data", "user_as_owner = Owner.get_owner(self.user)\nself.assertEqual(type(user_as_owner), Owner)\ngroup_as_owner = Owner.get_owner(self.group)\nself.assertEqual(type(group_as_owner),...
<|body_start_0|> response = self.client.get(endpoint, filters, format='json') self.assertEqual(response.status_code, status_code) return response.data <|end_body_0|> <|body_start_1|> user_as_owner = Owner.get_owner(self.user) self.assertEqual(type(user_as_owner), Owner) ...
Some simplistic tests to ensure the Owner model is setup correctly.
OwnerModelTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" <|body_0|> def test_owner(self): """Tests for the 'owner' model""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_005205
9,692
permissive
[ { "docstring": "Perform an API request", "name": "do_request", "signature": "def do_request(self, endpoint, filters, status_code=200)" }, { "docstring": "Tests for the 'owner' model", "name": "test_owner", "signature": "def test_owner(self)" }, { "docstring": "Test user APIs.", ...
4
stack_v2_sparse_classes_30k_train_035592
Implement the Python class `OwnerModelTest` described below. Class description: Some simplistic tests to ensure the Owner model is setup correctly. Method signatures and docstrings: - def do_request(self, endpoint, filters, status_code=200): Perform an API request - def test_owner(self): Tests for the 'owner' model -...
Implement the Python class `OwnerModelTest` described below. Class description: Some simplistic tests to ensure the Owner model is setup correctly. Method signatures and docstrings: - def do_request(self, endpoint, filters, status_code=200): Perform an API request - def test_owner(self): Tests for the 'owner' model -...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" <|body_0|> def test_owner(self): """Tests for the 'owner' model""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" response = self.client.get(endpoint, filters, format='json') self.assertEqual(response.status_code, stat...
the_stack_v2_python_sparse
InvenTree/users/tests.py
inventree/InvenTree
train
3,077
5edf75a4705040f77fac838cd8564104449a2e35
[ "all_objects = list(fetch_all_fn())\nself.assertNotEmpty(all_objects, \"Fetched objects can't be empty (%s).\" % error_desc)\nfor i in range(len(all_objects)):\n for l in range(1, len(all_objects) + 1):\n results = list(fetch_range_fn(i, l))\n expected = list(all_objects[i:i + l])\n self.ass...
<|body_start_0|> all_objects = list(fetch_all_fn()) self.assertNotEmpty(all_objects, "Fetched objects can't be empty (%s)." % error_desc) for i in range(len(all_objects)): for l in range(1, len(all_objects) + 1): results = list(fetch_range_fn(i, l)) ex...
Mixin containing helper methods for list/query methods tests.
QueryTestHelpersMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryTestHelpersMixin: """Mixin containing helper methods for list/query methods tests.""" def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_desc: Optional[Text]=None): """Tests a DB API method with di...
stack_v2_sparse_classes_75kplus_train_005206
10,806
permissive
[ { "docstring": "Tests a DB API method with different offset/count combinations. This helper method works by first fetching all available objects with fetch_all_fn and then fetching all possible ranges using fetch_fn. The test passes if subranges returned by fetch_fn match subranges of values in the list returne...
3
stack_v2_sparse_classes_30k_train_029621
Implement the Python class `QueryTestHelpersMixin` described below. Class description: Mixin containing helper methods for list/query methods tests. Method signatures and docstrings: - def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_...
Implement the Python class `QueryTestHelpersMixin` described below. Class description: Mixin containing helper methods for list/query methods tests. Method signatures and docstrings: - def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class QueryTestHelpersMixin: """Mixin containing helper methods for list/query methods tests.""" def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_desc: Optional[Text]=None): """Tests a DB API method with di...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QueryTestHelpersMixin: """Mixin containing helper methods for list/query methods tests.""" def DoOffsetAndCountTest(self, fetch_all_fn: Callable[[], Iterable[Any]], fetch_range_fn: Callable[[int, int], Iterable[Any]], error_desc: Optional[Text]=None): """Tests a DB API method with different offse...
the_stack_v2_python_sparse
grr/server/grr_response_server/databases/db_test_utils.py
google/grr
train
4,683
0491f4e5d0edd8319be9228d820e278c69fd3c13
[ "try:\n return Recipe.objects.get(slug=slug)\nexcept Recipe.DoesNotExist:\n return None", "recipe_instance = self.get_object(slug)\nif not recipe_instance:\n return Response({'res': 'Object with that recipe slug does not exist'}, status=status.HTTP_400_BAD_REQUEST)\nserializer = RecipeSerializer(recipe_i...
<|body_start_0|> try: return Recipe.objects.get(slug=slug) except Recipe.DoesNotExist: return None <|end_body_0|> <|body_start_1|> recipe_instance = self.get_object(slug) if not recipe_instance: return Response({'res': 'Object with that recipe slug do...
RecipeDetailApiView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecipeDetailApiView: def get_object(self, slug): """Helper method to get the object with given recipe slug""" <|body_0|> def get(self, request, slug, *args, **kwargs): """Deletes the recipe with the given recipe slug (if it exists)""" <|body_1|> def put(...
stack_v2_sparse_classes_75kplus_train_005207
4,547
no_license
[ { "docstring": "Helper method to get the object with given recipe slug", "name": "get_object", "signature": "def get_object(self, slug)" }, { "docstring": "Deletes the recipe with the given recipe slug (if it exists)", "name": "get", "signature": "def get(self, request, slug, *args, **kw...
4
null
Implement the Python class `RecipeDetailApiView` described below. Class description: Implement the RecipeDetailApiView class. Method signatures and docstrings: - def get_object(self, slug): Helper method to get the object with given recipe slug - def get(self, request, slug, *args, **kwargs): Deletes the recipe with ...
Implement the Python class `RecipeDetailApiView` described below. Class description: Implement the RecipeDetailApiView class. Method signatures and docstrings: - def get_object(self, slug): Helper method to get the object with given recipe slug - def get(self, request, slug, *args, **kwargs): Deletes the recipe with ...
bad9c0c88505367b06983daaf14459edf80ddd0e
<|skeleton|> class RecipeDetailApiView: def get_object(self, slug): """Helper method to get the object with given recipe slug""" <|body_0|> def get(self, request, slug, *args, **kwargs): """Deletes the recipe with the given recipe slug (if it exists)""" <|body_1|> def put(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecipeDetailApiView: def get_object(self, slug): """Helper method to get the object with given recipe slug""" try: return Recipe.objects.get(slug=slug) except Recipe.DoesNotExist: return None def get(self, request, slug, *args, **kwargs): """Deletes...
the_stack_v2_python_sparse
therecipes/views.py
michaeldonlon/django_kids_site
train
0
d22b509c66f8f33f775b72f89dc11d123ee56747
[ "while i < j:\n array[i], array[j] = (array[j], array[i])\n i += 1\n j -= 1", "for i in range(len(array) - 1, 0, -1):\n if array[i] > array[i - 1]:\n break\nelse:\n array.reverse()\n return\nfor j in range(len(array) - 1, i - 1, -1):\n if array[j] > array[i - 1]:\n array[j], arr...
<|body_start_0|> while i < j: array[i], array[j] = (array[j], array[i]) i += 1 j -= 1 <|end_body_0|> <|body_start_1|> for i in range(len(array) - 1, 0, -1): if array[i] > array[i - 1]: break else: array.reverse() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse_array(self, array, i, j): """Reverses array in-place from index i to j.""" <|body_0|> def next_permutation(self, array): """Generates next lexicographical permutation of an array. Modifies array in-place, doesn't return anything.""" <|bo...
stack_v2_sparse_classes_75kplus_train_005208
3,435
no_license
[ { "docstring": "Reverses array in-place from index i to j.", "name": "reverse_array", "signature": "def reverse_array(self, array, i, j)" }, { "docstring": "Generates next lexicographical permutation of an array. Modifies array in-place, doesn't return anything.", "name": "next_permutation",...
5
stack_v2_sparse_classes_30k_train_011438
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_array(self, array, i, j): Reverses array in-place from index i to j. - def next_permutation(self, array): Generates next lexicographical permutation of an array. Modi...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_array(self, array, i, j): Reverses array in-place from index i to j. - def next_permutation(self, array): Generates next lexicographical permutation of an array. Modi...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def reverse_array(self, array, i, j): """Reverses array in-place from index i to j.""" <|body_0|> def next_permutation(self, array): """Generates next lexicographical permutation of an array. Modifies array in-place, doesn't return anything.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverse_array(self, array, i, j): """Reverses array in-place from index i to j.""" while i < j: array[i], array[j] = (array[j], array[i]) i += 1 j -= 1 def next_permutation(self, array): """Generates next lexicographical permutatio...
the_stack_v2_python_sparse
Backtracking/permutation_sequence.py
vladn90/Algorithms
train
0
d4d6e81a1e4182c269cdaac531e29d97b4ce5c53
[ "if len(input_mask_and_length_tuple) < 2:\n return\nassert len(output_mask_and_length_tuple) == 1\nsuper().__init__(input_mask_and_length_tuple, output_mask_and_length_tuple)", "mask_changed = False\nsaved_output_mask = output_mask_list[0]\nnum_in_masks = len(input_mask_list)\nnum_out_masks = len(output_mask_l...
<|body_start_0|> if len(input_mask_and_length_tuple) < 2: return assert len(output_mask_and_length_tuple) == 1 super().__init__(input_mask_and_length_tuple, output_mask_and_length_tuple) <|end_body_0|> <|body_start_1|> mask_changed = False saved_output_mask = output_...
Models ADD internal connectivity for an Op.
AddInternalConnectivity
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddInternalConnectivity: """Models ADD internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list ...
stack_v2_sparse_classes_75kplus_train_005209
39,659
permissive
[ { "docstring": ":param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of input masks and the mask length. :param output_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of output masks and the mask length.", "name": "__init__", "signature": "def __init__(self, i...
3
stack_v2_sparse_classes_30k_train_042704
Implement the Python class `AddInternalConnectivity` described below. Class description: Models ADD internal connectivity for an Op. Method signatures and docstrings: - def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): :param input_mask_and_...
Implement the Python class `AddInternalConnectivity` described below. Class description: Models ADD internal connectivity for an Op. Method signatures and docstrings: - def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): :param input_mask_and_...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class AddInternalConnectivity: """Models ADD internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddInternalConnectivity: """Models ADD internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of input mask...
the_stack_v2_python_sparse
TrainingExtensions/common/src/python/aimet_common/winnow/mask.py
quic/aimet
train
1,676
b1fd00957bfee0bfe8ac109a16d0e48e8e7b1ed4
[ "self.save_file_data = save_file_data\nself.policy = ActorCritic(INPUT_SIZE, OUTPUT_SIZE, save_file_data['n_latent_var'], torch.device('cpu'), save_file_data['use_recurrent'])\nself.policy.load_state_dict(save_file_data['policy_state_dict'])\nself.shape = (7, 2)\nself.hidden = torch.zeros(self.save_file_data['n_lat...
<|body_start_0|> self.save_file_data = save_file_data self.policy = ActorCritic(INPUT_SIZE, OUTPUT_SIZE, save_file_data['n_latent_var'], torch.device('cpu'), save_file_data['use_recurrent']) self.policy.load_state_dict(save_file_data['policy_state_dict']) self.shape = (7, 2) self...
PPO Class for evaluation post training
PPO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PPO: """PPO Class for evaluation post training""" def __init__(self, save_file_data, player_num, map_name): """Initialize the PPO evaluation class @param save_file_data The save file containing the trained PPO's data @param player_num The player number of the agent @param map_name Th...
stack_v2_sparse_classes_75kplus_train_005210
1,821
no_license
[ { "docstring": "Initialize the PPO evaluation class @param save_file_data The save file containing the trained PPO's data @param player_num The player number of the agent @param map_name The name of the everglades map", "name": "__init__", "signature": "def __init__(self, save_file_data, player_num, map...
2
stack_v2_sparse_classes_30k_train_009888
Implement the Python class `PPO` described below. Class description: PPO Class for evaluation post training Method signatures and docstrings: - def __init__(self, save_file_data, player_num, map_name): Initialize the PPO evaluation class @param save_file_data The save file containing the trained PPO's data @param pla...
Implement the Python class `PPO` described below. Class description: PPO Class for evaluation post training Method signatures and docstrings: - def __init__(self, save_file_data, player_num, map_name): Initialize the PPO evaluation class @param save_file_data The save file containing the trained PPO's data @param pla...
20d4a9dd6c574dbddc714bd2fc83b951f2b5b846
<|skeleton|> class PPO: """PPO Class for evaluation post training""" def __init__(self, save_file_data, player_num, map_name): """Initialize the PPO evaluation class @param save_file_data The save file containing the trained PPO's data @param player_num The player number of the agent @param map_name Th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PPO: """PPO Class for evaluation post training""" def __init__(self, save_file_data, player_num, map_name): """Initialize the PPO evaluation class @param save_file_data The save file containing the trained PPO's data @param player_num The player number of the agent @param map_name The name of the...
the_stack_v2_python_sparse
utils/Agent_Loader/Saved_Agent_Types/PPO.py
djMahoney/everglades-ai-wargame
train
0
9912eab3acdb137aa307431bdffa4b28401a7057
[ "recordings = AnnotatedRecording.objects.all().order_by('-timestamp')[:10]\nserializer = AnnotatedRecordingSerializerGet(recordings, many=True)\nreturn Response(serializer.data)", "session_key = request.session.session_key\nif hasattr(request.data, 'session_id'):\n session_key = request.data['session_id']\neli...
<|body_start_0|> recordings = AnnotatedRecording.objects.all().order_by('-timestamp')[:10] serializer = AnnotatedRecordingSerializerGet(recordings, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> session_key = request.session.session_key if hasattr(re...
AnnotatedRecordingList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnotatedRecordingList: def get(self, request, format=None): """Returns the last 10 recordings received.""" <|body_0|> def post(self, request, *args, **kwargs): """Creates a recording record in the DB using a serializer. Attempts to link a demographic if a session ke...
stack_v2_sparse_classes_75kplus_train_005211
21,650
permissive
[ { "docstring": "Returns the last 10 recordings received.", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "Creates a recording record in the DB using a serializer. Attempts to link a demographic if a session key exists.", "name": "post", "signature": ...
2
stack_v2_sparse_classes_30k_train_027794
Implement the Python class `AnnotatedRecordingList` described below. Class description: Implement the AnnotatedRecordingList class. Method signatures and docstrings: - def get(self, request, format=None): Returns the last 10 recordings received. - def post(self, request, *args, **kwargs): Creates a recording record i...
Implement the Python class `AnnotatedRecordingList` described below. Class description: Implement the AnnotatedRecordingList class. Method signatures and docstrings: - def get(self, request, format=None): Returns the last 10 recordings received. - def post(self, request, *args, **kwargs): Creates a recording record i...
aaffba05ddd559a56ef1fe06380f9b3ff520cb5b
<|skeleton|> class AnnotatedRecordingList: def get(self, request, format=None): """Returns the last 10 recordings received.""" <|body_0|> def post(self, request, *args, **kwargs): """Creates a recording record in the DB using a serializer. Attempts to link a demographic if a session ke...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnnotatedRecordingList: def get(self, request, format=None): """Returns the last 10 recordings received.""" recordings = AnnotatedRecording.objects.all().order_by('-timestamp')[:10] serializer = AnnotatedRecordingSerializerGet(recordings, many=True) return Response(serializer.d...
the_stack_v2_python_sparse
restapi/views.py
texzone/tarteel.io
train
4
fce832a87b4591fd827773ce17fa01db081b10af
[ "n2_disp1d = np.arange(-self.N + 1, self.N + 1) ** 2\nn2 = np.sum([el.flatten() for el in np.meshgrid(*[n2_disp1d] * self._ndim)], axis=0)\nif self.spherical:\n n2 = np.array([el for el in n2 if el < self.N ** 2])\nreturn n2", "all_vecs = {}\nfor n2 in self._get_n2():\n all_vecs[n2] = all_vecs.get(n2, 0) + ...
<|body_start_0|> n2_disp1d = np.arange(-self.N + 1, self.N + 1) ** 2 n2 = np.sum([el.flatten() for el in np.meshgrid(*[n2_disp1d] * self._ndim)], axis=0) if self.spherical: n2 = np.array([el for el in n2 if el < self.N ** 2]) return n2 <|end_body_0|> <|body_start_1|> ...
Three dimensional Zeta function for discretized finite volume. This class implements $$ S_3^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi^2 N \\\\mathcal L_A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(A\\\\) means either spherical or cart...
Zeta3D
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Zeta3D: """Three dimensional Zeta function for discretized finite volume. This class implements $$ S_3^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi^2 N \\\\mathcal L_A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(A\\...
stack_v2_sparse_classes_75kplus_train_005212
6,923
permissive
[ { "docstring": "Returns all normalized momentum modes allowed on the lattice. This is the list of all \\\\\\\\(n^2 = n_1^2 + n_2^2\\\\\\\\) with * \\\\\\\\(\\\\\\\\Lambda \\\\leq n_i < \\\\\\\\Lambda\\\\\\\\) (cartesian) * \\\\\\\\(n^2 < \\\\\\\\Lambda\\\\\\\\) (spherical)", "name": "_get_n2", "signatur...
3
stack_v2_sparse_classes_30k_train_049292
Implement the Python class `Zeta3D` described below. Class description: Three dimensional Zeta function for discretized finite volume. This class implements $$ S_3^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi^2 N \\\\mathcal L_A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is th...
Implement the Python class `Zeta3D` described below. Class description: Three dimensional Zeta function for discretized finite volume. This class implements $$ S_3^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi^2 N \\\\mathcal L_A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is th...
d1bc6bff0c6ee9f4dc0d1d0bb4bcfa842c44cceb
<|skeleton|> class Zeta3D: """Three dimensional Zeta function for discretized finite volume. This class implements $$ S_3^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi^2 N \\\\mathcal L_A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(A\\...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Zeta3D: """Three dimensional Zeta function for discretized finite volume. This class implements $$ S_3^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi^2 N \\\\mathcal L_A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(A\\\\) means eit...
the_stack_v2_python_sparse
luescher_nd/zeta/zeta3d.py
ckoerber/luescher-nd
train
2
9ccc326414214310c4e2855ff3a295810c1abcac
[ "text = err_text\nif not fixable:\n option = 'unfixable'\nif option in ['warn', 'exception']:\n pass\nelif option == 'unfixable':\n text = 'Unfixable error: %s' % text\nelse:\n if fix:\n fix()\n text += ' ' + fix_text\nreturn text", "opt = option.lower()\nif opt not in ['fix', 'silentfix', ...
<|body_start_0|> text = err_text if not fixable: option = 'unfixable' if option in ['warn', 'exception']: pass elif option == 'unfixable': text = 'Unfixable error: %s' % text else: if fix: fix() text += '...
Shared methods for verification.
_Verify
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Verify: """Shared methods for verification.""" def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): """Execute the verification with selected option.""" <|body_0|> def verify(self, option='warn'): """Verify all values in t...
stack_v2_sparse_classes_75kplus_train_005213
3,589
permissive
[ { "docstring": "Execute the verification with selected option.", "name": "run_option", "signature": "def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True)" }, { "docstring": "Verify all values in the instance. Parameters ---------- option : str Output verifi...
2
stack_v2_sparse_classes_30k_train_033755
Implement the Python class `_Verify` described below. Class description: Shared methods for verification. Method signatures and docstrings: - def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): Execute the verification with selected option. - def verify(self, option='warn'): V...
Implement the Python class `_Verify` described below. Class description: Shared methods for verification. Method signatures and docstrings: - def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): Execute the verification with selected option. - def verify(self, option='warn'): V...
8876e902f5efa02a3fc27d82fe15c16001d4df5e
<|skeleton|> class _Verify: """Shared methods for verification.""" def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): """Execute the verification with selected option.""" <|body_0|> def verify(self, option='warn'): """Verify all values in t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Verify: """Shared methods for verification.""" def run_option(self, option='warn', err_text='', fix_text='Fixed.', fix=None, fixable=True): """Execute the verification with selected option.""" text = err_text if not fixable: option = 'unfixable' if option in [...
the_stack_v2_python_sparse
astropy/io/fits/verify.py
xiaomi1122/astropy
train
0
2be5aaedec134dfb0ec8bf5a54cc52652ad19cf8
[ "self.pair_file_loc = pair_file_loc\nself.r1 = pair_file_loc + '_R1_001.fastq.gz'\nself.r2 = pair_file_loc + '_R2_001.fastq.gz'\nself.lane = re.search('L[0-9]{3}', pair_file_loc)\nself.id = re.search('^[0-9]{6}', pair_file_loc)\nself.prefix = pair_file_loc\nself.home_dir = home_dir\nself.hisat2_idx = hisat2_idx\nse...
<|body_start_0|> self.pair_file_loc = pair_file_loc self.r1 = pair_file_loc + '_R1_001.fastq.gz' self.r2 = pair_file_loc + '_R2_001.fastq.gz' self.lane = re.search('L[0-9]{3}', pair_file_loc) self.id = re.search('^[0-9]{6}', pair_file_loc) self.prefix = pair_file_loc ...
Create a FastQ pair object.
fq_pair
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fq_pair: """Create a FastQ pair object.""" def __init__(self, pair_file_loc, home_dir, hisat2_idx, star_idx, n): """Create an object for the FASTQ file.""" <|body_0|> def RunHISAT2(self): """Run HISAT2. Manual: https://ccb.jhu.edu/software/hisat2/manual.shtml Not...
stack_v2_sparse_classes_75kplus_train_005214
5,699
no_license
[ { "docstring": "Create an object for the FASTQ file.", "name": "__init__", "signature": "def __init__(self, pair_file_loc, home_dir, hisat2_idx, star_idx, n)" }, { "docstring": "Run HISAT2. Manual: https://ccb.jhu.edu/software/hisat2/manual.shtml Notes on HISAT2: -p is number of cores to use", ...
3
stack_v2_sparse_classes_30k_train_046337
Implement the Python class `fq_pair` described below. Class description: Create a FastQ pair object. Method signatures and docstrings: - def __init__(self, pair_file_loc, home_dir, hisat2_idx, star_idx, n): Create an object for the FASTQ file. - def RunHISAT2(self): Run HISAT2. Manual: https://ccb.jhu.edu/software/hi...
Implement the Python class `fq_pair` described below. Class description: Create a FastQ pair object. Method signatures and docstrings: - def __init__(self, pair_file_loc, home_dir, hisat2_idx, star_idx, n): Create an object for the FASTQ file. - def RunHISAT2(self): Run HISAT2. Manual: https://ccb.jhu.edu/software/hi...
eb84ab40dcd2915b09a3126948e83ebdf981ec3d
<|skeleton|> class fq_pair: """Create a FastQ pair object.""" def __init__(self, pair_file_loc, home_dir, hisat2_idx, star_idx, n): """Create an object for the FASTQ file.""" <|body_0|> def RunHISAT2(self): """Run HISAT2. Manual: https://ccb.jhu.edu/software/hisat2/manual.shtml Not...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class fq_pair: """Create a FastQ pair object.""" def __init__(self, pair_file_loc, home_dir, hisat2_idx, star_idx, n): """Create an object for the FASTQ file.""" self.pair_file_loc = pair_file_loc self.r1 = pair_file_loc + '_R1_001.fastq.gz' self.r2 = pair_file_loc + '_R2_001.fa...
the_stack_v2_python_sparse
code_variants/align_qc_class.py
frichter/embryo_rnaseq
train
2
2b551172bf54fd9244d467e6079151b001a79ddf
[ "super(PositionalEncoding, self).__init__()\nself.dropout: nn.Dropout = nn.Dropout(p=dropout)\npe = torch.zeros(seq_len, d_model)\nposition = torch.arange(0, seq_len, dtype=torch.float).unsqueeze(1)\ndiv_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))\npe[:, 0::2] = torch.sin(...
<|body_start_0|> super(PositionalEncoding, self).__init__() self.dropout: nn.Dropout = nn.Dropout(p=dropout) pe = torch.zeros(seq_len, d_model) position = torch.arange(0, seq_len, dtype=torch.float).unsqueeze(1) div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.lo...
``Positional Encoding`` used in the ``Transformer`` model proposed in `Attention is all you need`. References: `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://pytorch.org/tutorials/beginner/transformer_tutorial.html#define-the-model>`_
PositionalEncoding
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionalEncoding: """``Positional Encoding`` used in the ``Transformer`` model proposed in `Attention is all you need`. References: `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://pytorch.org/tutorials/beginner/transformer_tutorial.html#define-the-model>`_""" def ...
stack_v2_sparse_classes_75kplus_train_005215
1,939
permissive
[ { "docstring": "Args: d_model: the number of expected features in the encoder/decoder inputs. seq_len: length of input sequence. dropout: dropout rate.", "name": "__init__", "signature": "def __init__(self, d_model: int, seq_len: int, dropout: float=0.1) -> None" }, { "docstring": "Forward propa...
2
stack_v2_sparse_classes_30k_train_045165
Implement the Python class `PositionalEncoding` described below. Class description: ``Positional Encoding`` used in the ``Transformer`` model proposed in `Attention is all you need`. References: `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://pytorch.org/tutorials/beginner/transformer_tutoria...
Implement the Python class `PositionalEncoding` described below. Class description: ``Positional Encoding`` used in the ``Transformer`` model proposed in `Attention is all you need`. References: `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://pytorch.org/tutorials/beginner/transformer_tutoria...
454d72a51daf8fab6419ceaa62c72d932fef2a61
<|skeleton|> class PositionalEncoding: """``Positional Encoding`` used in the ``Transformer`` model proposed in `Attention is all you need`. References: `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://pytorch.org/tutorials/beginner/transformer_tutorial.html#define-the-model>`_""" def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PositionalEncoding: """``Positional Encoding`` used in the ``Transformer`` model proposed in `Attention is all you need`. References: `Sequence-to-Sequence Modeling with nn.Transformer and TorchText <https://pytorch.org/tutorials/beginner/transformer_tutorial.html#define-the-model>`_""" def __init__(self...
the_stack_v2_python_sparse
enchanter/addons/layers/positional_encoding.py
khirotaka/enchanter
train
8
97126404bc1cbec7c9daa3622909b52755830540
[ "self.encoding_size = encoding_size\nself.policy_model = policy_model\nself.next_visual_in: List[tf.Tensor] = []\nencoded_state, encoded_next_state = self.create_curiosity_encoders()\nself.create_inverse_model(encoded_state, encoded_next_state)\nself.create_forward_model(encoded_state, encoded_next_state)\nself.cre...
<|body_start_0|> self.encoding_size = encoding_size self.policy_model = policy_model self.next_visual_in: List[tf.Tensor] = [] encoded_state, encoded_next_state = self.create_curiosity_encoders() self.create_inverse_model(encoded_state, encoded_next_state) self.create_for...
CuriosityModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CuriosityModel: def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): """Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the e...
stack_v2_sparse_classes_75kplus_train_005216
8,093
permissive
[ { "docstring": "Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the encoding for the Curiosity module :param learning_rate: The learning rate for the curiosity module", "name": "__init__", "...
5
stack_v2_sparse_classes_30k_train_048585
Implement the Python class `CuriosityModel` described below. Class description: Implement the CuriosityModel class. Method signatures and docstrings: - def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): Creates the curiosity model for the Curiosity reward Generator :...
Implement the Python class `CuriosityModel` described below. Class description: Implement the CuriosityModel class. Method signatures and docstrings: - def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): Creates the curiosity model for the Curiosity reward Generator :...
334df1e8afbfff3544413ade46fb12f03556014b
<|skeleton|> class CuriosityModel: def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): """Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CuriosityModel: def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): """Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the encoding for th...
the_stack_v2_python_sparse
mlagents/trainers/components/reward_signals/curiosity/model.py
Abluceli/HRG-SAC
train
7
b79266990d0c502ca390e30b53bdc5461a69c0cf
[ "self.config_entry = config_entry\nself.options = config_entry.options\nself.host = config_entry.data[CONF_HOST]\nself.key = config_entry.data[CONF_CLIENT_SECRET]", "errors = {}\nif user_input is not None:\n options_input = {CONF_SOURCES: user_input[CONF_SOURCES]}\n return self.async_create_entry(title='', ...
<|body_start_0|> self.config_entry = config_entry self.options = config_entry.options self.host = config_entry.data[CONF_HOST] self.key = config_entry.data[CONF_CLIENT_SECRET] <|end_body_0|> <|body_start_1|> errors = {} if user_input is not None: options_inpu...
Handle options.
OptionsFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsFlowHandler: """Handle options.""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Manage the options.""" <|b...
stack_v2_sparse_classes_75kplus_train_005217
7,262
permissive
[ { "docstring": "Initialize options flow.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry) -> None" }, { "docstring": "Manage the options.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input: dict[str, Any] | None=None) ->...
2
stack_v2_sparse_classes_30k_train_039050
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle options. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Initialize options flow. - async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult: Manage the op...
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle options. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry) -> None: Initialize options flow. - async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult: Manage the op...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OptionsFlowHandler: """Handle options.""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Manage the options.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptionsFlowHandler: """Handle options.""" def __init__(self, config_entry: ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry self.options = config_entry.options self.host = config_entry.data[CONF_HOST] self.key = config_entry.dat...
the_stack_v2_python_sparse
homeassistant/components/webostv/config_flow.py
home-assistant/core
train
35,501
00aebdf3dfd86c7ea7580ca6118a1db55fb135ab
[ "self.a, self.b, self.c = 3 * [-1.0]\nself._func = lambda t, a, b, c: a * np.exp(b * t) + c\nself._fit_func = lambda t: self.a * np.exp(self.b * t) + self.c\nself._fitted = False", "b_0 = y[-1] / y[-2]\na_0 = 0.1\nc_0 = 0\nguess = np.asarray([a_0, b_0, c_0], dtype=float)\ntry:\n popt = scipy.optimize.curve_fit...
<|body_start_0|> self.a, self.b, self.c = 3 * [-1.0] self._func = lambda t, a, b, c: a * np.exp(b * t) + c self._fit_func = lambda t: self.a * np.exp(self.b * t) + self.c self._fitted = False <|end_body_0|> <|body_start_1|> b_0 = y[-1] / y[-2] a_0 = 0.1 c_0 = 0 ...
Exponential forecasting model. The exponential model is in the form by y(t) = a * exp(b * t) + c, where `a`, `b`, and `c` are parameters to be optimized from the fitted data.
TSExp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSExp: """Exponential forecasting model. The exponential model is in the form by y(t) = a * exp(b * t) + c, where `a`, `b`, and `c` are parameters to be optimized from the fitted data.""" def __init__(self): """Init an exponential forecasting model.""" <|body_0|> def fit...
stack_v2_sparse_classes_75kplus_train_005218
12,299
permissive
[ { "docstring": "Init an exponential forecasting model.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Fit the exponential forecasting model.", "name": "fit", "signature": "def fit(self, X: np.ndarray, y: np.ndarray, **kwargs) -> 'TSExp'" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_018613
Implement the Python class `TSExp` described below. Class description: Exponential forecasting model. The exponential model is in the form by y(t) = a * exp(b * t) + c, where `a`, `b`, and `c` are parameters to be optimized from the fitted data. Method signatures and docstrings: - def __init__(self): Init an exponent...
Implement the Python class `TSExp` described below. Class description: Exponential forecasting model. The exponential model is in the form by y(t) = a * exp(b * t) + c, where `a`, `b`, and `c` are parameters to be optimized from the fitted data. Method signatures and docstrings: - def __init__(self): Init an exponent...
61cc1f63fa055c7466151cfefa7baff8df1702b7
<|skeleton|> class TSExp: """Exponential forecasting model. The exponential model is in the form by y(t) = a * exp(b * t) + c, where `a`, `b`, and `c` are parameters to be optimized from the fitted data.""" def __init__(self): """Init an exponential forecasting model.""" <|body_0|> def fit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TSExp: """Exponential forecasting model. The exponential model is in the form by y(t) = a * exp(b * t) + c, where `a`, `b`, and `c` are parameters to be optimized from the fitted data.""" def __init__(self): """Init an exponential forecasting model.""" self.a, self.b, self.c = 3 * [-1.0] ...
the_stack_v2_python_sparse
tspymfe/_models.py
FelSiq/ts-pymfe
train
9
7d7ab5d4a6981a72663f95f77cc7765b346f7f29
[ "self.direction = random.randint(0, 3)\nself.screen = screen\nself.x = x\nself.y = y\nself.color = color", "self.direction = self.direction - 1\nif self.direction < 0:\n self.direction = 3", "self.direction = self.direction + 1\nif self.direction > 3:\n self.direction = 0", "if self.direction == 0:\n ...
<|body_start_0|> self.direction = random.randint(0, 3) self.screen = screen self.x = x self.y = y self.color = color <|end_body_0|> <|body_start_1|> self.direction = self.direction - 1 if self.direction < 0: self.direction = 3 <|end_body_1|> <|body_s...
Lightcycle class, - a single point at the screen, which moves until it runs into something. The object has the following properties: color, x and y coordinates, direction which is an integer where 0 means left, 1 means down, 2 means right and 3 means up, and a reference to the screen where it is drawn
lightcycle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lightcycle: """Lightcycle class, - a single point at the screen, which moves until it runs into something. The object has the following properties: color, x and y coordinates, direction which is an integer where 0 means left, 1 means down, 2 means right and 3 means up, and a reference to the scre...
stack_v2_sparse_classes_75kplus_train_005219
3,392
no_license
[ { "docstring": "Create the object", "name": "__init__", "signature": "def __init__(self, screen, x, y, color)" }, { "docstring": "Turn left", "name": "left", "signature": "def left(self)" }, { "docstring": "Turn right", "name": "right", "signature": "def right(self)" },...
4
stack_v2_sparse_classes_30k_train_041838
Implement the Python class `lightcycle` described below. Class description: Lightcycle class, - a single point at the screen, which moves until it runs into something. The object has the following properties: color, x and y coordinates, direction which is an integer where 0 means left, 1 means down, 2 means right and ...
Implement the Python class `lightcycle` described below. Class description: Lightcycle class, - a single point at the screen, which moves until it runs into something. The object has the following properties: color, x and y coordinates, direction which is an integer where 0 means left, 1 means down, 2 means right and ...
7be40c84dfe0f97e0d0404942e82ab4838c4ff44
<|skeleton|> class lightcycle: """Lightcycle class, - a single point at the screen, which moves until it runs into something. The object has the following properties: color, x and y coordinates, direction which is an integer where 0 means left, 1 means down, 2 means right and 3 means up, and a reference to the scre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class lightcycle: """Lightcycle class, - a single point at the screen, which moves until it runs into something. The object has the following properties: color, x and y coordinates, direction which is an integer where 0 means left, 1 means down, 2 means right and 3 means up, and a reference to the screen where it i...
the_stack_v2_python_sparse
weeks/week39/lightcycle.py
KodeKunstner/grundat
train
0
910190f5dd13c387e453d4563059f3d32fad5ebf
[ "result_flag = self.check_element_displayed(self.about_dunzo_business)\nself.conditional_write(result_flag, positive='About Dunzo business is present in the business page', negative='Failed to detect About Dunzo business in the business page', level='debug')\nreturn result_flag", "result_flag = self.check_element...
<|body_start_0|> result_flag = self.check_element_displayed(self.about_dunzo_business) self.conditional_write(result_flag, positive='About Dunzo business is present in the business page', negative='Failed to detect About Dunzo business in the business page', level='debug') return result_flag <|e...
Page object for Business page
Dunzo_Business_Object
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dunzo_Business_Object: """Page object for Business page""" def check_about_dunzo_business_present(self): """Check whether about dunzo business is present""" <|body_0|> def check_sign_up_button(self): """Check whether sign up button is present""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_005220
3,477
permissive
[ { "docstring": "Check whether about dunzo business is present", "name": "check_about_dunzo_business_present", "signature": "def check_about_dunzo_business_present(self)" }, { "docstring": "Check whether sign up button is present", "name": "check_sign_up_button", "signature": "def check_s...
6
stack_v2_sparse_classes_30k_train_022426
Implement the Python class `Dunzo_Business_Object` described below. Class description: Page object for Business page Method signatures and docstrings: - def check_about_dunzo_business_present(self): Check whether about dunzo business is present - def check_sign_up_button(self): Check whether sign up button is present...
Implement the Python class `Dunzo_Business_Object` described below. Class description: Page object for Business page Method signatures and docstrings: - def check_about_dunzo_business_present(self): Check whether about dunzo business is present - def check_sign_up_button(self): Check whether sign up button is present...
b905baaad68982230f8f5f6bfbd41043e6cade26
<|skeleton|> class Dunzo_Business_Object: """Page object for Business page""" def check_about_dunzo_business_present(self): """Check whether about dunzo business is present""" <|body_0|> def check_sign_up_button(self): """Check whether sign up button is present""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dunzo_Business_Object: """Page object for Business page""" def check_about_dunzo_business_present(self): """Check whether about dunzo business is present""" result_flag = self.check_element_displayed(self.about_dunzo_business) self.conditional_write(result_flag, positive='About Du...
the_stack_v2_python_sparse
page_objects/dunzo_business_object.py
Rajkumar-94/DunzoTest
train
0
5db82296de2fc4a63b05922903bafd33ae0db3fa
[ "try:\n return AirbyteConnectionStatus(status=Status.SUCCEEDED)\nexcept Exception as e:\n return AirbyteConnectionStatus(status=Status.FAILED, message=f'An exception occurred: {str(e)}')", "streams = []\nstream_name = 'TableName'\njson_schema = {'$schema': 'http://json-schema.org/draft-07/schema#', 'type': ...
<|body_start_0|> try: return AirbyteConnectionStatus(status=Status.SUCCEEDED) except Exception as e: return AirbyteConnectionStatus(status=Status.FAILED, message=f'An exception occurred: {str(e)}') <|end_body_0|> <|body_start_1|> streams = [] stream_name = 'Table...
SourceScaffoldSourcePython
[ "MIT", "Elastic-2.0", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceScaffoldSourcePython: def check(self, logger: AirbyteLogger, config: json) -> AirbyteConnectionStatus: """Tests if the input configuration can be used to successfully connect to the integration e.g: if a provided Stripe API token can be used to connect to the Stripe API. :param log...
stack_v2_sparse_classes_75kplus_train_005221
4,796
permissive
[ { "docstring": "Tests if the input configuration can be used to successfully connect to the integration e.g: if a provided Stripe API token can be used to connect to the Stripe API. :param logger: Logging object to display debug/info/error to the logs (logs will not be accessible via airbyte UI if they are not ...
3
stack_v2_sparse_classes_30k_train_052425
Implement the Python class `SourceScaffoldSourcePython` described below. Class description: Implement the SourceScaffoldSourcePython class. Method signatures and docstrings: - def check(self, logger: AirbyteLogger, config: json) -> AirbyteConnectionStatus: Tests if the input configuration can be used to successfully ...
Implement the Python class `SourceScaffoldSourcePython` described below. Class description: Implement the SourceScaffoldSourcePython class. Method signatures and docstrings: - def check(self, logger: AirbyteLogger, config: json) -> AirbyteConnectionStatus: Tests if the input configuration can be used to successfully ...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class SourceScaffoldSourcePython: def check(self, logger: AirbyteLogger, config: json) -> AirbyteConnectionStatus: """Tests if the input configuration can be used to successfully connect to the integration e.g: if a provided Stripe API token can be used to connect to the Stripe API. :param log...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceScaffoldSourcePython: def check(self, logger: AirbyteLogger, config: json) -> AirbyteConnectionStatus: """Tests if the input configuration can be used to successfully connect to the integration e.g: if a provided Stripe API token can be used to connect to the Stripe API. :param logger: Logging o...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/source-scaffold-source-python/source_scaffold_source_python/source.py
alldatacenter/alldata
train
774
35eb14f18f7d14b130427e4c9492aa8f7a77a4b4
[ "if nmax < 0:\n return ValueError('nmax must be >= 0')\nsuper().__init__(self._Lx, nf=nmax + 1, nx=1, maxderiv=None, zlevel=None)\nself.nmax = nmax\nself.alpha = alpha\nreturn", "nd, nvar = dfun.ndnvar(deriv, var, self.nx)\nif out is None:\n base_shape = X.shape[1:]\n out = np.ndarray((nd, self.nf) + bas...
<|body_start_0|> if nmax < 0: return ValueError('nmax must be >= 0') super().__init__(self._Lx, nf=nmax + 1, nx=1, maxderiv=None, zlevel=None) self.nmax = nmax self.alpha = alpha return <|end_body_0|> <|body_start_1|> nd, nvar = dfun.ndnvar(deriv, var, self.n...
Generalized Laguerre polynomials of a given order, :math:`\\alpha`. .. math:: L_n^{(\\alpha)}(x) Attributes ---------- nmax : int The maximum degree. alpha : float The associated Legendre function order index.
LaguerreL
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaguerreL: """Generalized Laguerre polynomials of a given order, :math:`\\alpha`. .. math:: L_n^{(\\alpha)}(x) Attributes ---------- nmax : int The maximum degree. alpha : float The associated Legendre function order index.""" def __init__(self, alpha, nmax): """Create associated Leg...
stack_v2_sparse_classes_75kplus_train_005222
39,055
permissive
[ { "docstring": "Create associated Legendre basis DFuns Parameters ---------- m : float The real order parameter. nmax : int The maximum degree.", "name": "__init__", "signature": "def __init__(self, alpha, nmax)" }, { "docstring": "basis evaluation function Use recursion relations for generalize...
2
stack_v2_sparse_classes_30k_test_000910
Implement the Python class `LaguerreL` described below. Class description: Generalized Laguerre polynomials of a given order, :math:`\\alpha`. .. math:: L_n^{(\\alpha)}(x) Attributes ---------- nmax : int The maximum degree. alpha : float The associated Legendre function order index. Method signatures and docstrings:...
Implement the Python class `LaguerreL` described below. Class description: Generalized Laguerre polynomials of a given order, :math:`\\alpha`. .. math:: L_n^{(\\alpha)}(x) Attributes ---------- nmax : int The maximum degree. alpha : float The associated Legendre function order index. Method signatures and docstrings:...
c6341a58331deef3728cc43c627c556139deb673
<|skeleton|> class LaguerreL: """Generalized Laguerre polynomials of a given order, :math:`\\alpha`. .. math:: L_n^{(\\alpha)}(x) Attributes ---------- nmax : int The maximum degree. alpha : float The associated Legendre function order index.""" def __init__(self, alpha, nmax): """Create associated Leg...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LaguerreL: """Generalized Laguerre polynomials of a given order, :math:`\\alpha`. .. math:: L_n^{(\\alpha)}(x) Attributes ---------- nmax : int The maximum degree. alpha : float The associated Legendre function order index.""" def __init__(self, alpha, nmax): """Create associated Legendre basis D...
the_stack_v2_python_sparse
nitrogen/special.py
bchangala/nitrogen
train
11
6e36b3fa2f3e0af60eb323ed181fc87e6bc972b5
[ "for uri in msg.uri_list:\n while HTTP_REDIR.match(uri):\n h_redir = HTTP_REDIR.match(uri).groups()[0]\n h_dest = HTTP_REDIR.match(uri).groups()[1]\n uri = h_dest\n h_redir = urlparse(h_redir).netloc\n h_dest = urlparse(h_dest).netloc\n if h_redir != h_dest:\n ...
<|body_start_0|> for uri in msg.uri_list: while HTTP_REDIR.match(uri): h_redir = HTTP_REDIR.match(uri).groups()[0] h_dest = HTTP_REDIR.match(uri).groups()[1] uri = h_dest h_redir = urlparse(h_redir).netloc h_dest = urlpa...
Implements the uri_eval rule
URIEvalPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URIEvalPlugin: """Implements the uri_eval rule""" def check_for_http_redirector(self, msg, target=None): """Checks if the uri has been redirected. -use HTTP_REDIR regex in order to extract the destination domain and compare it with source domain""" <|body_0|> def check_h...
stack_v2_sparse_classes_75kplus_train_005223
3,242
permissive
[ { "docstring": "Checks if the uri has been redirected. -use HTTP_REDIR regex in order to extract the destination domain and compare it with source domain", "name": "check_for_http_redirector", "signature": "def check_for_http_redirector(self, msg, target=None)" }, { "docstring": "Checks if in <a...
4
stack_v2_sparse_classes_30k_train_048769
Implement the Python class `URIEvalPlugin` described below. Class description: Implements the uri_eval rule Method signatures and docstrings: - def check_for_http_redirector(self, msg, target=None): Checks if the uri has been redirected. -use HTTP_REDIR regex in order to extract the destination domain and compare it ...
Implement the Python class `URIEvalPlugin` described below. Class description: Implements the uri_eval rule Method signatures and docstrings: - def check_for_http_redirector(self, msg, target=None): Checks if the uri has been redirected. -use HTTP_REDIR regex in order to extract the destination domain and compare it ...
86cab72a79f9d9151390a01f3efc372a2c658eef
<|skeleton|> class URIEvalPlugin: """Implements the uri_eval rule""" def check_for_http_redirector(self, msg, target=None): """Checks if the uri has been redirected. -use HTTP_REDIR regex in order to extract the destination domain and compare it with source domain""" <|body_0|> def check_h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class URIEvalPlugin: """Implements the uri_eval rule""" def check_for_http_redirector(self, msg, target=None): """Checks if the uri has been redirected. -use HTTP_REDIR regex in order to extract the destination domain and compare it with source domain""" for uri in msg.uri_list: whi...
the_stack_v2_python_sparse
oa/plugins/uri_eval.py
SpamExperts/OrangeAssassin
train
59
882d8bda42dbc61f1275f3e005e1e7719f4092db
[ "Asset.asset_num += 1\nif not from_keyboard and usr_inputs:\n self.usr_inputs = usr_inputs\n self.rt = self.usr_inputs['ER'][Asset.asset_num - 1]\n self.std = self.usr_inputs['std'][Asset.asset_num - 1]\nelse:\n self.rt = is_valid(f\"Enter asset{Asset.asset_num}'s expected return: \", (0, 1))\n self....
<|body_start_0|> Asset.asset_num += 1 if not from_keyboard and usr_inputs: self.usr_inputs = usr_inputs self.rt = self.usr_inputs['ER'][Asset.asset_num - 1] self.std = self.usr_inputs['std'][Asset.asset_num - 1] else: self.rt = is_valid(f"Enter ass...
Asset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Asset: def __init__(self, usr_inputs: dict=None, from_keyboard=True): """If user choose to input via keyboard and no user inputs are given, tigger the input prompts; else unpack user inputs""" <|body_0|> def common_attrs(cls, usr_inputs: dict=None, from_keyboard=True): ...
stack_v2_sparse_classes_75kplus_train_005224
16,402
permissive
[ { "docstring": "If user choose to input via keyboard and no user inputs are given, tigger the input prompts; else unpack user inputs", "name": "__init__", "signature": "def __init__(self, usr_inputs: dict=None, from_keyboard=True)" }, { "docstring": "If from_keyboard is True, prompt user to ente...
3
stack_v2_sparse_classes_30k_train_050644
Implement the Python class `Asset` described below. Class description: Implement the Asset class. Method signatures and docstrings: - def __init__(self, usr_inputs: dict=None, from_keyboard=True): If user choose to input via keyboard and no user inputs are given, tigger the input prompts; else unpack user inputs - de...
Implement the Python class `Asset` described below. Class description: Implement the Asset class. Method signatures and docstrings: - def __init__(self, usr_inputs: dict=None, from_keyboard=True): If user choose to input via keyboard and no user inputs are given, tigger the input prompts; else unpack user inputs - de...
f8a1c137acbbe4a43d915b2bff15760764a6b97d
<|skeleton|> class Asset: def __init__(self, usr_inputs: dict=None, from_keyboard=True): """If user choose to input via keyboard and no user inputs are given, tigger the input prompts; else unpack user inputs""" <|body_0|> def common_attrs(cls, usr_inputs: dict=None, from_keyboard=True): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Asset: def __init__(self, usr_inputs: dict=None, from_keyboard=True): """If user choose to input via keyboard and no user inputs are given, tigger the input prompts; else unpack user inputs""" Asset.asset_num += 1 if not from_keyboard and usr_inputs: self.usr_inputs = usr_i...
the_stack_v2_python_sparse
lecture_exercises/lecture_code/two_fund_compact.py
linusqzdeng/pyfinance
train
1
e4e7da20cfba3fe7e4037e103c4d19e657780cc9
[ "qs = self if self.ordered else self.order_by('pk')\ntry:\n return qs[0]\nexcept IndexError:\n return None", "qs = self.reverse() if self.ordered else self.order_by('-pk')\ntry:\n return qs[0]\nexcept IndexError:\n return None" ]
<|body_start_0|> qs = self if self.ordered else self.order_by('pk') try: return qs[0] except IndexError: return None <|end_body_0|> <|body_start_1|> qs = self.reverse() if self.ordered else self.order_by('-pk') try: return qs[0] except...
QuerySet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuerySet: def first(self): """Returns the first object of a query, returns None if no match is found.""" <|body_0|> def last(self): """Returns the last object of a query, returns None if no match is found.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_005225
987
permissive
[ { "docstring": "Returns the first object of a query, returns None if no match is found.", "name": "first", "signature": "def first(self)" }, { "docstring": "Returns the last object of a query, returns None if no match is found.", "name": "last", "signature": "def last(self)" } ]
2
stack_v2_sparse_classes_30k_train_031733
Implement the Python class `QuerySet` described below. Class description: Implement the QuerySet class. Method signatures and docstrings: - def first(self): Returns the first object of a query, returns None if no match is found. - def last(self): Returns the last object of a query, returns None if no match is found.
Implement the Python class `QuerySet` described below. Class description: Implement the QuerySet class. Method signatures and docstrings: - def first(self): Returns the first object of a query, returns None if no match is found. - def last(self): Returns the last object of a query, returns None if no match is found. ...
f04a4b4befb437e9603539b49e06587276426b01
<|skeleton|> class QuerySet: def first(self): """Returns the first object of a query, returns None if no match is found.""" <|body_0|> def last(self): """Returns the last object of a query, returns None if no match is found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuerySet: def first(self): """Returns the first object of a query, returns None if no match is found.""" qs = self if self.ordered else self.order_by('pk') try: return qs[0] except IndexError: return None def last(self): """Returns the last ...
the_stack_v2_python_sparse
courriers/core.py
AdeleD/django-courriers
train
2
4c0c8326d369622f30d201063f4888797166192b
[ "if not bn_layers:\n logger.info('High Bias folding is not supported for models without BatchNorm Layers')\n return\nfor cls_set_info in cls_set_info_list:\n for cls_pair_info in cls_set_info.cls_pair_info_list:\n if cls_pair_info.layer1.bias is None or cls_pair_info.layer2.bias is None or cls_pair_...
<|body_start_0|> if not bn_layers: logger.info('High Bias folding is not supported for models without BatchNorm Layers') return for cls_set_info in cls_set_info_list: for cls_pair_info in cls_set_info.cls_pair_info_list: if cls_pair_info.layer1.bias is...
Code to apply the high-bias-fold technique to a model
HighBiasFold
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HighBiasFold: """Code to apply the high-bias-fold technique to a model""" def bias_fold(cls, cls_set_info_list: List[ClsSetInfo], bn_layers: Dict[Union[torch.nn.Conv2d, torch.nn.ConvTranspose2d], torch.nn.BatchNorm2d]): """Folds bias values greater than 3 * sigma to next layer's bias...
stack_v2_sparse_classes_75kplus_train_005226
43,505
permissive
[ { "docstring": "Folds bias values greater than 3 * sigma to next layer's bias :param cls_set_info_list: List of info elements for each cls set :param bn_layers: Key: Conv/Linear layer Value: Corresponding folded BN layer :return: None", "name": "bias_fold", "signature": "def bias_fold(cls, cls_set_info_...
4
null
Implement the Python class `HighBiasFold` described below. Class description: Code to apply the high-bias-fold technique to a model Method signatures and docstrings: - def bias_fold(cls, cls_set_info_list: List[ClsSetInfo], bn_layers: Dict[Union[torch.nn.Conv2d, torch.nn.ConvTranspose2d], torch.nn.BatchNorm2d]): Fold...
Implement the Python class `HighBiasFold` described below. Class description: Code to apply the high-bias-fold technique to a model Method signatures and docstrings: - def bias_fold(cls, cls_set_info_list: List[ClsSetInfo], bn_layers: Dict[Union[torch.nn.Conv2d, torch.nn.ConvTranspose2d], torch.nn.BatchNorm2d]): Fold...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class HighBiasFold: """Code to apply the high-bias-fold technique to a model""" def bias_fold(cls, cls_set_info_list: List[ClsSetInfo], bn_layers: Dict[Union[torch.nn.Conv2d, torch.nn.ConvTranspose2d], torch.nn.BatchNorm2d]): """Folds bias values greater than 3 * sigma to next layer's bias...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HighBiasFold: """Code to apply the high-bias-fold technique to a model""" def bias_fold(cls, cls_set_info_list: List[ClsSetInfo], bn_layers: Dict[Union[torch.nn.Conv2d, torch.nn.ConvTranspose2d], torch.nn.BatchNorm2d]): """Folds bias values greater than 3 * sigma to next layer's bias :param cls_s...
the_stack_v2_python_sparse
TrainingExtensions/torch/src/python/aimet_torch/cross_layer_equalization.py
quic/aimet
train
1,676
d4c017c165545c611738a74fc81f04c70abbe23b
[ "test_queue = single_process.SingleProcessQueue()\nfor item in self._ITEMS:\n test_queue.PushItem(item)\ntest_queue.SignalEndOfInput()\ntest_queue_consumer = test_lib.TestQueueConsumer(test_queue)\ntest_queue_consumer.ConsumeItems()\nexpected_number_of_items = len(self._ITEMS)\nself.assertEqual(test_queue_consum...
<|body_start_0|> test_queue = single_process.SingleProcessQueue() for item in self._ITEMS: test_queue.PushItem(item) test_queue.SignalEndOfInput() test_queue_consumer = test_lib.TestQueueConsumer(test_queue) test_queue_consumer.ConsumeItems() expected_number_o...
Tests the single process queue.
SingleProcessQueueTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleProcessQueueTest: """Tests the single process queue.""" def testPushPopItem(self): """Tests the PushItem and PopItem functions.""" <|body_0|> def testQueueEmpty(self): """Tests the queue raises the QueueEmpty exception.""" <|body_1|> def testQu...
stack_v2_sparse_classes_75kplus_train_005227
3,813
permissive
[ { "docstring": "Tests the PushItem and PopItem functions.", "name": "testPushPopItem", "signature": "def testPushPopItem(self)" }, { "docstring": "Tests the queue raises the QueueEmpty exception.", "name": "testQueueEmpty", "signature": "def testQueueEmpty(self)" }, { "docstring"...
3
null
Implement the Python class `SingleProcessQueueTest` described below. Class description: Tests the single process queue. Method signatures and docstrings: - def testPushPopItem(self): Tests the PushItem and PopItem functions. - def testQueueEmpty(self): Tests the queue raises the QueueEmpty exception. - def testQueueF...
Implement the Python class `SingleProcessQueueTest` described below. Class description: Tests the single process queue. Method signatures and docstrings: - def testPushPopItem(self): Tests the PushItem and PopItem functions. - def testQueueEmpty(self): Tests the queue raises the QueueEmpty exception. - def testQueueF...
f525298bb1dd8f0fecd16d28acc443785ffe88c3
<|skeleton|> class SingleProcessQueueTest: """Tests the single process queue.""" def testPushPopItem(self): """Tests the PushItem and PopItem functions.""" <|body_0|> def testQueueEmpty(self): """Tests the queue raises the QueueEmpty exception.""" <|body_1|> def testQu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SingleProcessQueueTest: """Tests the single process queue.""" def testPushPopItem(self): """Tests the PushItem and PopItem functions.""" test_queue = single_process.SingleProcessQueue() for item in self._ITEMS: test_queue.PushItem(item) test_queue.SignalEndOfIn...
the_stack_v2_python_sparse
plaso/engine/single_process_test.py
cnbird1999/plaso
train
0
1ce9646cc7a8a4278dfbfcde159bdfa0b06f05b5
[ "gt_bboxes, gt_bboxes_ignore = ([], [])\ngt_masks, gt_masks_ignore = ([], [])\ngt_labels = []\nfor ann in annotations:\n if ann.get('iscrowd', False):\n gt_bboxes_ignore.append(ann['bbox'])\n gt_masks_ignore.append(ann.get('segmentation', None))\n else:\n gt_bboxes.append(ann['bbox'])\n ...
<|body_start_0|> gt_bboxes, gt_bboxes_ignore = ([], []) gt_masks, gt_masks_ignore = ([], []) gt_labels = [] for ann in annotations: if ann.get('iscrowd', False): gt_bboxes_ignore.append(ann['bbox']) gt_masks_ignore.append(ann.get('segmentation'...
TextDetDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextDetDataset: def _parse_anno_info(self, annotations): """Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. "masks" and "masks_ignore" are represen...
stack_v2_sparse_classes_75kplus_train_005228
4,665
permissive
[ { "docstring": "Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. \"masks\" and \"masks_ignore\" are represented by polygon boundary point sequences.", "name": "_parse_a...
3
stack_v2_sparse_classes_30k_val_001268
Implement the Python class `TextDetDataset` described below. Class description: Implement the TextDetDataset class. Method signatures and docstrings: - def _parse_anno_info(self, annotations): Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the foll...
Implement the Python class `TextDetDataset` described below. Class description: Implement the TextDetDataset class. Method signatures and docstrings: - def _parse_anno_info(self, annotations): Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the foll...
89bf8a218881b250d0ead7a0287526c69586c92a
<|skeleton|> class TextDetDataset: def _parse_anno_info(self, annotations): """Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. "masks" and "masks_ignore" are represen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextDetDataset: def _parse_anno_info(self, annotations): """Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. "masks" and "masks_ignore" are represented by polygon...
the_stack_v2_python_sparse
mmocr/datasets/text_det_dataset.py
xdxie/WordArt
train
106
c2f251a1be2fe7ad385aa44f93ff959f89e19f39
[ "if id not in df.index:\n api.abort(404, \"User with id {} doesn't exist\".format(id))\nuser = dict(df.loc[id])\nuser['id'] = id\nreturn user", "if id not in df.index:\n api.abort(404, \"User with id {} doesn't exist\".format(id))\ndf.drop(id, inplace=True)\nreturn ({'message': 'User with id {} has been rem...
<|body_start_0|> if id not in df.index: api.abort(404, "User with id {} doesn't exist".format(id)) user = dict(df.loc[id]) user['id'] = id return user <|end_body_0|> <|body_start_1|> if id not in df.index: api.abort(404, "User with id {} doesn't exist".fo...
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: def get(self, id): """Returns a user""" <|body_0|> def delete(self, id): """Removes a user from the database""" <|body_1|> def put(self, id): """Updates a user""" <|body_2|> <|end_skeleton|> <|body_start_0|> if id not in d...
stack_v2_sparse_classes_75kplus_train_005229
8,237
no_license
[ { "docstring": "Returns a user", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Removes a user from the database", "name": "delete", "signature": "def delete(self, id)" }, { "docstring": "Updates a user", "name": "put", "signature": "def put(self, id)"...
3
null
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def get(self, id): Returns a user - def delete(self, id): Removes a user from the database - def put(self, id): Updates a user
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def get(self, id): Returns a user - def delete(self, id): Removes a user from the database - def put(self, id): Updates a user <|skeleton|> class User: def get(self, id): "...
703f0b132fe11ec343cbe999322927bc2036702d
<|skeleton|> class User: def get(self, id): """Returns a user""" <|body_0|> def delete(self, id): """Removes a user from the database""" <|body_1|> def put(self, id): """Updates a user""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: def get(self, id): """Returns a user""" if id not in df.index: api.abort(404, "User with id {} doesn't exist".format(id)) user = dict(df.loc[id]) user['id'] = id return user def delete(self, id): """Removes a user from the database""" ...
the_stack_v2_python_sparse
API/users/users.py
pingchoy/Sydney-Suburbs-Information-API
train
0
85e946a51bf04a1b4654a084a7f1f0d6b4baad68
[ "data_model = self._sdc_definitions.data_model\nself._logger.info('set_numeric_value operation_handle={} requested_numeric_value={}', operation_handle, requested_numeric_value)\nrequest = data_model.msg_types.SetValue()\nrequest.OperationHandleRef = operation_handle\nrequest.RequestedNumericValue = requested_numeri...
<|body_start_0|> data_model = self._sdc_definitions.data_model self._logger.info('set_numeric_value operation_handle={} requested_numeric_value={}', operation_handle, requested_numeric_value) request = data_model.msg_types.SetValue() request.OperationHandleRef = operation_handle ...
Client for SetService.
SetServiceClient
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetServiceClient: """Client for SetService.""" def set_numeric_value(self, operation_handle: str, requested_numeric_value: Decimal | float | int | str, request_manipulator: RequestManipulatorProtocol | None=None) -> Future: """Send a GetSupportedLanguages request. :param operation_ha...
stack_v2_sparse_classes_75kplus_train_005230
7,899
permissive
[ { "docstring": "Send a GetSupportedLanguages request. :param operation_handle: a string :param requested_numeric_value: decimal, int, float or a string representing a decimal number :param request_manipulator: :return: a Future object", "name": "set_numeric_value", "signature": "def set_numeric_value(se...
6
stack_v2_sparse_classes_30k_train_046749
Implement the Python class `SetServiceClient` described below. Class description: Client for SetService. Method signatures and docstrings: - def set_numeric_value(self, operation_handle: str, requested_numeric_value: Decimal | float | int | str, request_manipulator: RequestManipulatorProtocol | None=None) -> Future: ...
Implement the Python class `SetServiceClient` described below. Class description: Client for SetService. Method signatures and docstrings: - def set_numeric_value(self, operation_handle: str, requested_numeric_value: Decimal | float | int | str, request_manipulator: RequestManipulatorProtocol | None=None) -> Future: ...
dab57b38ed9a9e70e6bc6a9cf44140b96fd95851
<|skeleton|> class SetServiceClient: """Client for SetService.""" def set_numeric_value(self, operation_handle: str, requested_numeric_value: Decimal | float | int | str, request_manipulator: RequestManipulatorProtocol | None=None) -> Future: """Send a GetSupportedLanguages request. :param operation_ha...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SetServiceClient: """Client for SetService.""" def set_numeric_value(self, operation_handle: str, requested_numeric_value: Decimal | float | int | str, request_manipulator: RequestManipulatorProtocol | None=None) -> Future: """Send a GetSupportedLanguages request. :param operation_handle: a strin...
the_stack_v2_python_sparse
src/sdc11073/consumer/serviceclients/setservice.py
deichmab-draeger/sdc11073
train
0
c64c5d982adfaf94c2561341d502ea5084ddc2f7
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewInactiveUsersQueryScope()", "from .access_review_query_scope import AccessReviewQueryScope\nfrom .access_review_query_scope import AccessReviewQueryScope\nfields: Dict[str, Callable[[Any], None]] = {'inactiveDuration': lamb...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessReviewInactiveUsersQueryScope() <|end_body_0|> <|body_start_1|> from .access_review_query_scope import AccessReviewQueryScope from .access_review_query_scope import AccessReviewQue...
AccessReviewInactiveUsersQueryScope
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessReviewInactiveUsersQueryScope: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInactiveUsersQueryScope: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
stack_v2_sparse_classes_75kplus_train_005231
2,516
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: AccessReviewInactiveUsersQueryScope", "name": "create_from_discriminator_value", "signature": "def create_fr...
3
stack_v2_sparse_classes_30k_train_038863
Implement the Python class `AccessReviewInactiveUsersQueryScope` described below. Class description: Implement the AccessReviewInactiveUsersQueryScope class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInactiveUsersQueryScope: Creates a ...
Implement the Python class `AccessReviewInactiveUsersQueryScope` described below. Class description: Implement the AccessReviewInactiveUsersQueryScope class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInactiveUsersQueryScope: Creates a ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessReviewInactiveUsersQueryScope: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInactiveUsersQueryScope: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccessReviewInactiveUsersQueryScope: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewInactiveUsersQueryScope: """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...
the_stack_v2_python_sparse
msgraph/generated/models/access_review_inactive_users_query_scope.py
microsoftgraph/msgraph-sdk-python
train
135
eaa8000765ae446e630cec15bb39601bfbb90441
[ "df_list = []\nfor content1 in os.listdir(predictions_dir):\n if pred_nametag in content1:\n patientID1 = int(content1.split('_')[1])\n for content2 in os.listdir(ground_truth_dir):\n if gt_nametag in content2:\n patientID2 = int(content2.split('_')[1])\n if...
<|body_start_0|> df_list = [] for content1 in os.listdir(predictions_dir): if pred_nametag in content1: patientID1 = int(content1.split('_')[1]) for content2 in os.listdir(ground_truth_dir): if gt_nametag in content2: ...
EvaluatePredictedFiles
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluatePredictedFiles: def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): """Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. No...
stack_v2_sparse_classes_75kplus_train_005232
9,017
no_license
[ { "docstring": "Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. Note: All the predicted files should be inside the given predictions_dir, and GT files in ground_truth_dir as well. Parameters ---...
2
stack_v2_sparse_classes_30k_train_013578
Implement the Python class `EvaluatePredictedFiles` described below. Class description: Implement the EvaluatePredictedFiles class. Method signatures and docstrings: - def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): Creates an excel file as well as returns a DataFrame cont...
Implement the Python class `EvaluatePredictedFiles` described below. Class description: Implement the EvaluatePredictedFiles class. Method signatures and docstrings: - def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): Creates an excel file as well as returns a DataFrame cont...
fad319f2f8061ff662b16bd935abefbc0c5e176d
<|skeleton|> class EvaluatePredictedFiles: def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): """Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. No...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EvaluatePredictedFiles: def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): """Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. Note: All the pr...
the_stack_v2_python_sparse
evaluate_predicted_files.py
youpele52/thesis
train
2
d8cdea93337e2596b76a88ee9de6ea2a176dcf50
[ "self.img_tag = img_tag\nself.id = ''\nself.output = []\nself.running = False", "client = docker.from_env()\ncontainer = client.containers.run(self.img_tag, cmd, detach=True, auto_remove=False, **args)\nself.id = container.short_id\nself.running = True", "for line in self.hook():\n line = line.decode(Alaska....
<|body_start_0|> self.img_tag = img_tag self.id = '' self.output = [] self.running = False <|end_body_0|> <|body_start_1|> client = docker.from_env() container = client.containers.run(self.img_tag, cmd, detach=True, auto_remove=False, **args) self.id = container....
AlaskaDocker. An abstraction around the Docker Python API. Used to call qc, kallisto, and sleuth Docker images. Methods: run out_listener hook terminate
AlaskaDocker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlaskaDocker: """AlaskaDocker. An abstraction around the Docker Python API. Used to call qc, kallisto, and sleuth Docker images. Methods: run out_listener hook terminate""" def __init__(self, img_tag): """Constructor. Arguments: img_tag -- (str) Docker tag of image Returns: None""" ...
stack_v2_sparse_classes_75kplus_train_005233
2,585
permissive
[ { "docstring": "Constructor. Arguments: img_tag -- (str) Docker tag of image Returns: None", "name": "__init__", "signature": "def __init__(self, img_tag)" }, { "docstring": "Start container with the given. Arguments: cmd -- (str) command to run on Docker image args -- arguments to pass to the d...
5
stack_v2_sparse_classes_30k_train_050666
Implement the Python class `AlaskaDocker` described below. Class description: AlaskaDocker. An abstraction around the Docker Python API. Used to call qc, kallisto, and sleuth Docker images. Methods: run out_listener hook terminate Method signatures and docstrings: - def __init__(self, img_tag): Constructor. Arguments...
Implement the Python class `AlaskaDocker` described below. Class description: AlaskaDocker. An abstraction around the Docker Python API. Used to call qc, kallisto, and sleuth Docker images. Methods: run out_listener hook terminate Method signatures and docstrings: - def __init__(self, img_tag): Constructor. Arguments...
968475b77718263b7af2fd098b23c3e7cfa40546
<|skeleton|> class AlaskaDocker: """AlaskaDocker. An abstraction around the Docker Python API. Used to call qc, kallisto, and sleuth Docker images. Methods: run out_listener hook terminate""" def __init__(self, img_tag): """Constructor. Arguments: img_tag -- (str) Docker tag of image Returns: None""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlaskaDocker: """AlaskaDocker. An abstraction around the Docker Python API. Used to call qc, kallisto, and sleuth Docker images. Methods: run out_listener hook terminate""" def __init__(self, img_tag): """Constructor. Arguments: img_tag -- (str) Docker tag of image Returns: None""" self.i...
the_stack_v2_python_sparse
src/scripts/AlaskaDocker.py
WormLabCaltech/alaska
train
7
ee6475f54db8beec0ada304b22068b11ad606c88
[ "if ui_test_result_id == '':\n return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})\nui_result = UITestResultAssociated.objects.filter(ui_result_id=ui_test_result_id)\nsingle_case_results = []\nfor single_case in ui_result:\n single_case_dict = {'id': single_case.id, 'ui_test_case_name'...
<|body_start_0|> if ui_test_result_id == '': return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'}) ui_result = UITestResultAssociated.objects.filter(ui_result_id=ui_test_result_id) single_case_results = [] for single_case in ui_result: single...
CheckResult
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckResult: def post(self, request, ui_test_result_id, *args, **kwargs): """查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:""" <|body_0|> def get(self, request, ui_test_abnormal_result_id, *args, **kwargs): """获取异常测试报告 :param re...
stack_v2_sparse_classes_75kplus_train_005234
13,627
no_license
[ { "docstring": "查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, request, ui_test_result_id, *args, **kwargs)" }, { "docstring": "获取异常测试报告 :param request: :param ui_test_abnormal_result_id: :param args: :param kw...
2
stack_v2_sparse_classes_30k_train_031543
Implement the Python class `CheckResult` described below. Class description: Implement the CheckResult class. Method signatures and docstrings: - def post(self, request, ui_test_result_id, *args, **kwargs): 查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return: - def get(self, request, ...
Implement the Python class `CheckResult` described below. Class description: Implement the CheckResult class. Method signatures and docstrings: - def post(self, request, ui_test_result_id, *args, **kwargs): 查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return: - def get(self, request, ...
730bbb7a048e0f41a2fb61c8cdf554bcc2bd042c
<|skeleton|> class CheckResult: def post(self, request, ui_test_result_id, *args, **kwargs): """查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:""" <|body_0|> def get(self, request, ui_test_abnormal_result_id, *args, **kwargs): """获取异常测试报告 :param re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheckResult: def post(self, request, ui_test_result_id, *args, **kwargs): """查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:""" if ui_test_result_id == '': return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'}) ui_r...
the_stack_v2_python_sparse
automated_main/view/ui_automation/ui_test_task/ui_test_task_view.py
a877429929/TestPlatformDjango
train
0
d5fe49199b1d21bf3d13cd40abae74fd31c192ee
[ "self.children = children\nself.parent = parent\nself.index = index", "node = self\nancestor_list = []\nwhile node.parent is not None:\n ancestor_list.append(node.parent)\n node = node.parent\nreturn ancestor_list" ]
<|body_start_0|> self.children = children self.parent = parent self.index = index <|end_body_0|> <|body_start_1|> node = self ancestor_list = [] while node.parent is not None: ancestor_list.append(node.parent) node = node.parent return anc...
Fenwick Tree node.
FenwickNode
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FenwickNode: """Fenwick Tree node.""" def __init__(self, parent, children, index=None): """Fenwick Tree node. Single parent and multiple children. Args: parent: FenwickNode. A parent node. children: List. A list of children nodes (FenwickNode). index: Int. Node label.""" <|bo...
stack_v2_sparse_classes_75kplus_train_005235
5,001
permissive
[ { "docstring": "Fenwick Tree node. Single parent and multiple children. Args: parent: FenwickNode. A parent node. children: List. A list of children nodes (FenwickNode). index: Int. Node label.", "name": "__init__", "signature": "def __init__(self, parent, children, index=None)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_042878
Implement the Python class `FenwickNode` described below. Class description: Fenwick Tree node. Method signatures and docstrings: - def __init__(self, parent, children, index=None): Fenwick Tree node. Single parent and multiple children. Args: parent: FenwickNode. A parent node. children: List. A list of children nod...
Implement the Python class `FenwickNode` described below. Class description: Fenwick Tree node. Method signatures and docstrings: - def __init__(self, parent, children, index=None): Fenwick Tree node. Single parent and multiple children. Args: parent: FenwickNode. A parent node. children: List. A list of children nod...
788481753c798a72c5cb3aa9f2aa9da3ce3190b0
<|skeleton|> class FenwickNode: """Fenwick Tree node.""" def __init__(self, parent, children, index=None): """Fenwick Tree node. Single parent and multiple children. Args: parent: FenwickNode. A parent node. children: List. A list of children nodes (FenwickNode). index: Int. Node label.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FenwickNode: """Fenwick Tree node.""" def __init__(self, parent, children, index=None): """Fenwick Tree node. Single parent and multiple children. Args: parent: FenwickNode. A parent node. children: List. A list of children nodes (FenwickNode). index: Int. Node label.""" self.children = c...
the_stack_v2_python_sparse
src/openfermion/transforms/opconversions/fenwick_tree.py
quantumlib/OpenFermion
train
1,481
64c7f18dc5d7bde35d83534b942e40634776d540
[ "def rserialize(root, string):\n \"\"\" a recursive helper function for the serialize() function.\"\"\"\n if root is None:\n string += '#!'\n else:\n string += str(root.val) + '!'\n string = rserialize(root.left, string)\n string = rserialize(root.right, string)\n return stri...
<|body_start_0|> def rserialize(root, string): """ a recursive helper function for the serialize() function.""" if root is None: string += '#!' else: string += str(root.val) + '!' string = rserialize(root.left, string) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: 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|> <|bo...
stack_v2_sparse_classes_75kplus_train_005236
3,667
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
stack_v2_sparse_classes_30k_train_044247
Implement the Python class `Solution` described below. Class description: Implement the Solution 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 :...
Implement the Python class `Solution` described below. Class description: Implement the Solution 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 :...
a5461947c7aadbbd0be14202adf54e847e8bc6ee
<|skeleton|> class Solution: 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 Solution: def Serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def rserialize(root, string): """ a recursive helper function for the serialize() function.""" if root is None: string += '#!' else...
the_stack_v2_python_sparse
offer/47.py
weiyudang/leetcode
train
0
7ac8afb8aedb9009fe504ce6d43729dfdd1b725c
[ "with tf.variable_scope('w_patch'):\n write_size = self._H * self._W * self._C\n w = tf.contrib.layers.fully_connected(h_dec, write_size, activation_fn=None, scope='fc')\n w = tf.reshape(w, [-1, self._H, self._W, self._C])\n return w", "with tf.variable_scope('write'):\n w = self._generate_write_pa...
<|body_start_0|> with tf.variable_scope('w_patch'): write_size = self._H * self._W * self._C w = tf.contrib.layers.fully_connected(h_dec, write_size, activation_fn=None, scope='fc') w = tf.reshape(w, [-1, self._H, self._W, self._C]) return w <|end_body_0|> <|body...
A class for writing without attention (simply reading the entire image). This class implements the WriteInterface.
WriteNoAttn
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WriteNoAttn: """A class for writing without attention (simply reading the entire image). This class implements the WriteInterface.""" def _generate_write_patch(self, h_dec): """Overrides implementation in WriteInterface in order to generate a write patch the same size of the input im...
stack_v2_sparse_classes_75kplus_train_005237
4,572
permissive
[ { "docstring": "Overrides implementation in WriteInterface in order to generate a write patch the same size of the input image. Applies a fully connected linear layer to generate the attention patch to be written. Parameters ---------- h_dec: Output of decoder. (B x decoder_output_size) Return ------ w: Write p...
2
null
Implement the Python class `WriteNoAttn` described below. Class description: A class for writing without attention (simply reading the entire image). This class implements the WriteInterface. Method signatures and docstrings: - def _generate_write_patch(self, h_dec): Overrides implementation in WriteInterface in orde...
Implement the Python class `WriteNoAttn` described below. Class description: A class for writing without attention (simply reading the entire image). This class implements the WriteInterface. Method signatures and docstrings: - def _generate_write_patch(self, h_dec): Overrides implementation in WriteInterface in orde...
3c73fb24c299896a1c778294c73e314bcde5bc25
<|skeleton|> class WriteNoAttn: """A class for writing without attention (simply reading the entire image). This class implements the WriteInterface.""" def _generate_write_patch(self, h_dec): """Overrides implementation in WriteInterface in order to generate a write patch the same size of the input im...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WriteNoAttn: """A class for writing without attention (simply reading the entire image). This class implements the WriteInterface.""" def _generate_write_patch(self, h_dec): """Overrides implementation in WriteInterface in order to generate a write patch the same size of the input image. Applies ...
the_stack_v2_python_sparse
attention/no_attn.py
RyanJDick/DRAW-hard
train
0
371f7250db3db5a1ed091f2cfa2d49854ae3ca24
[ "dict = {}\nfor each in nums:\n if each not in dict:\n dict[each] = 1\n else:\n dict[each] += 1\nres = []\nfor each in dict.keys():\n if dict[each] == 2:\n res.append(each)\nreturn res", "a = []\nb = set()\nfor each in nums:\n if each in b:\n a.append(each)\n else:\n ...
<|body_start_0|> dict = {} for each in nums: if each not in dict: dict[each] = 1 else: dict[each] += 1 res = [] for each in dict.keys(): if dict[each] == 2: res.append(each) return res <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDuplicates2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> dict = {} for each...
stack_v2_sparse_classes_75kplus_train_005238
724
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDuplicates", "signature": "def findDuplicates(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDuplicates2", "signature": "def findDuplicates2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_038935
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] - def findDuplicates2(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] - def findDuplicates2(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution: ...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDuplicates2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" dict = {} for each in nums: if each not in dict: dict[each] = 1 else: dict[each] += 1 res = [] for each in dict.keys(): ...
the_stack_v2_python_sparse
findDuplicates.py
NeilWangziyu/Leetcode_py
train
2
c2becd509e7392a90aeb931be5a0505ebba94362
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_direction = choice([1, -1]) x_distance = choice([0, 1, 2, 3, 4]) x_step = x_direction *...
一个生成随机漫步数据的类
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_points = num_points self.x_values = [0] ...
stack_v2_sparse_classes_75kplus_train_005239
2,094
no_license
[ { "docstring": "初始化随机漫步的属性", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(self)" } ]
2
stack_v2_sparse_classes_30k_train_003203
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 <|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初...
c998faa04abf21cf62a539bd57c24440ae939387
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """计算随机漫步包含的所有点""" while len(self.x_values) < self.num_points: x_...
the_stack_v2_python_sparse
static/Mac/练习/随机漫步/random_walk.py
li-MacBook-Pro/li
train
0
a32042b9b4e4880db0f7f2b220bcd15349d90c89
[ "GroupFactory(type_id='area')\nurl = reverse('ietf.secr.areas.views.list_areas')\nself.client.login(username='secretary', password='secretary+password')\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)", "area = GroupEventFactory(type='started', group__type_id='area').group\nurl = rev...
<|body_start_0|> GroupFactory(type_id='area') url = reverse('ietf.secr.areas.views.list_areas') self.client.login(username='secretary', password='secretary+password') response = self.client.get(url) self.assertEqual(response.status_code, 200) <|end_body_0|> <|body_start_1|> ...
SecrAreasTestCase
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecrAreasTestCase: def test_main(self): """Main Test""" <|body_0|> def test_view(self): """View Test""" <|body_1|> def test_add(self): """Add Test""" <|body_2|> <|end_skeleton|> <|body_start_0|> GroupFactory(type_id='area') ...
stack_v2_sparse_classes_75kplus_train_005240
1,934
permissive
[ { "docstring": "Main Test", "name": "test_main", "signature": "def test_main(self)" }, { "docstring": "View Test", "name": "test_view", "signature": "def test_view(self)" }, { "docstring": "Add Test", "name": "test_add", "signature": "def test_add(self)" } ]
3
stack_v2_sparse_classes_30k_train_010546
Implement the Python class `SecrAreasTestCase` described below. Class description: Implement the SecrAreasTestCase class. Method signatures and docstrings: - def test_main(self): Main Test - def test_view(self): View Test - def test_add(self): Add Test
Implement the Python class `SecrAreasTestCase` described below. Class description: Implement the SecrAreasTestCase class. Method signatures and docstrings: - def test_main(self): Main Test - def test_view(self): View Test - def test_add(self): Add Test <|skeleton|> class SecrAreasTestCase: def test_main(self): ...
aeaae292fbd55aca1b6043227ec105e67d73367f
<|skeleton|> class SecrAreasTestCase: def test_main(self): """Main Test""" <|body_0|> def test_view(self): """View Test""" <|body_1|> def test_add(self): """Add Test""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SecrAreasTestCase: def test_main(self): """Main Test""" GroupFactory(type_id='area') url = reverse('ietf.secr.areas.views.list_areas') self.client.login(username='secretary', password='secretary+password') response = self.client.get(url) self.assertEqual(respons...
the_stack_v2_python_sparse
ietf/secr/areas/tests.py
omunroe-com/ietfdb2
train
2
038119f22ddaabda4d80f62bba2a9ba980b3e513
[ "try:\n sliceInfo = self.sliceDB[k]\nexcept KeyError:\n return ''\nstart = int(self.getSliceAttr(sliceInfo, 'start'))\nstop = int(self.getSliceAttr(sliceInfo, 'stop'))\ntry:\n if int(self.getSliceAttr(sliceInfo, 'orientation')) < 0 and start >= 0:\n start, stop = (-stop, -start)\nexcept AttributeErr...
<|body_start_0|> try: sliceInfo = self.sliceDB[k] except KeyError: return '' start = int(self.getSliceAttr(sliceInfo, 'start')) stop = int(self.getSliceAttr(sliceInfo, 'stop')) try: if int(self.getSliceAttr(sliceInfo, 'orientation')) < 0 and st...
XMLRPC-ready server for AnnotationDB
AnnotationServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnotationServer: """XMLRPC-ready server for AnnotationDB""" def get_slice_tuple(self, k): """get (seqID,start,stop) for a given key""" <|body_0|> def get_slice_items(self): """get all (key,tuple) pairs in one query""" <|body_1|> def get_annotation_a...
stack_v2_sparse_classes_75kplus_train_005241
18,540
no_license
[ { "docstring": "get (seqID,start,stop) for a given key", "name": "get_slice_tuple", "signature": "def get_slice_tuple(self, k)" }, { "docstring": "get all (key,tuple) pairs in one query", "name": "get_slice_items", "signature": "def get_slice_items(self)" }, { "docstring": "get t...
3
null
Implement the Python class `AnnotationServer` described below. Class description: XMLRPC-ready server for AnnotationDB Method signatures and docstrings: - def get_slice_tuple(self, k): get (seqID,start,stop) for a given key - def get_slice_items(self): get all (key,tuple) pairs in one query - def get_annotation_attr(...
Implement the Python class `AnnotationServer` described below. Class description: XMLRPC-ready server for AnnotationDB Method signatures and docstrings: - def get_slice_tuple(self, k): get (seqID,start,stop) for a given key - def get_slice_items(self): get all (key,tuple) pairs in one query - def get_annotation_attr(...
3df911a6a922338422ce17e8cedba9480d6977f2
<|skeleton|> class AnnotationServer: """XMLRPC-ready server for AnnotationDB""" def get_slice_tuple(self, k): """get (seqID,start,stop) for a given key""" <|body_0|> def get_slice_items(self): """get all (key,tuple) pairs in one query""" <|body_1|> def get_annotation_a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnnotationServer: """XMLRPC-ready server for AnnotationDB""" def get_slice_tuple(self, k): """get (seqID,start,stop) for a given key""" try: sliceInfo = self.sliceDB[k] except KeyError: return '' start = int(self.getSliceAttr(sliceInfo, 'start')) ...
the_stack_v2_python_sparse
splicing_prior/pyhgvs_env/lib/python2.7/site-packages/pygr/annotation.py
BD2KGenomics/brca-pipeline
train
3
1ec5a8c7d4bc9934553291d95d1a39242bf7e978
[ "q = collections.deque([root])\nres = ''\nwhile q:\n node = q.pop()\n if node:\n res += str(node.val) + '!'\n q.appendleft(node.left)\n q.appendleft(node.right)\n else:\n res += '#!'\n continue\nreturn res", "lst = data.split('!')\ntmp = []\nn = len(lst)\nfor node in ls...
<|body_start_0|> q = collections.deque([root]) res = '' while q: node = q.pop() if node: res += str(node.val) + '!' q.appendleft(node.left) q.appendleft(node.right) else: res += '#!' ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_005242
5,531
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
stack_v2_sparse_classes_30k_train_046542
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
507ed2efeff7818ca9cf53a8ee7fb80d3c530d67
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = collections.deque([root]) res = '' while q: node = q.pop() if node: res += str(node.val) + '!' q.appendleft(no...
the_stack_v2_python_sparse
Leetcode/Tree/#297-Serialize and Deserialize Binary Tree/main.py
qizongjun/Algorithms-1
train
0
2505cd8105d929f46fe40905a99048f9dfbb78ea
[ "self.root = AncestralTree('A')\nself.B = AncestralTree('B')\nself.C = AncestralTree('C')\nself.D = AncestralTree('D')\nself.E = AncestralTree('E')\nself.F = AncestralTree('F')\nself.G = AncestralTree('G')\nself.H = AncestralTree('H')\nself.I = AncestralTree('I')\nself.B.ancestor = self.root\nself.C.ancestor = self...
<|body_start_0|> self.root = AncestralTree('A') self.B = AncestralTree('B') self.C = AncestralTree('C') self.D = AncestralTree('D') self.E = AncestralTree('E') self.F = AncestralTree('F') self.G = AncestralTree('G') self.H = AncestralTree('H') self...
Class with unittests for YoungestCommonAncestor.py
test_YoungestCommonAncestor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_YoungestCommonAncestor: """Class with unittests for YoungestCommonAncestor.py""" def setUp(self): """SetUp tree for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_005243
1,547
no_license
[ { "docstring": "SetUp tree for tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if returned output is as expected.", "name": "test_ExpectedOutput", "signature": "def test_ExpectedOutput(self)" } ]
2
stack_v2_sparse_classes_30k_train_032864
Implement the Python class `test_YoungestCommonAncestor` described below. Class description: Class with unittests for YoungestCommonAncestor.py Method signatures and docstrings: - def setUp(self): SetUp tree for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected.
Implement the Python class `test_YoungestCommonAncestor` described below. Class description: Class with unittests for YoungestCommonAncestor.py Method signatures and docstrings: - def setUp(self): SetUp tree for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected. <|skeleton|> class test...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_YoungestCommonAncestor: """Class with unittests for YoungestCommonAncestor.py""" def setUp(self): """SetUp tree for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class test_YoungestCommonAncestor: """Class with unittests for YoungestCommonAncestor.py""" def setUp(self): """SetUp tree for tests.""" self.root = AncestralTree('A') self.B = AncestralTree('B') self.C = AncestralTree('C') self.D = AncestralTree('D') self.E = An...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Medium/YoungestCommonAncestor/test_YoubgestCommonAncestor.py
JakubKazimierski/PythonPortfolio
train
9
d212b6c73ece8e4a11261fbf50c893dddbce2086
[ "def canShip(m):\n t, days = (0, 0)\n for w in weights:\n if t + w > m:\n days += 1\n t = w\n else:\n t += w\n return days + 1 <= D\nl, r = (max(weights), sum(weights))\nwhile l < r:\n mid = l + (r - l) // 2\n if canShip(mid):\n r = mid\n else:...
<|body_start_0|> def canShip(m): t, days = (0, 0) for w in weights: if t + w > m: days += 1 t = w else: t += w return days + 1 <= D l, r = (max(weights), sum(weights)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_0|> def shipWithinDays(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_005244
3,083
no_license
[ { "docstring": ":type weights: List[int] :type D: int :rtype: int", "name": "shipWithinDaysAC", "signature": "def shipWithinDaysAC(self, weights, D)" }, { "docstring": ":type weights: List[int] :type D: int :rtype: int", "name": "shipWithinDays", "signature": "def shipWithinDays(self, we...
2
stack_v2_sparse_classes_30k_train_001730
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shipWithinDaysAC(self, weights, D): :type weights: List[int] :type D: int :rtype: int - def shipWithinDays(self, weights, D): :type weights: List[int] :type D: int :rtype: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shipWithinDaysAC(self, weights, D): :type weights: List[int] :type D: int :rtype: int - def shipWithinDays(self, weights, D): :type weights: List[int] :type D: int :rtype: in...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_0|> def shipWithinDays(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" def canShip(m): t, days = (0, 0) for w in weights: if t + w > m: days += 1 t = w else: ...
the_stack_v2_python_sparse
C/CapacityToShipPackagesWithinDDays.py
bssrdf/pyleet
train
2
6f91d47659a9ec242d4cb42f02a6de6f1b296116
[ "table_object = Tag.query.get_or_404(int_id)\nform = TagForm(obj=table_object)\nflask.flash(f\"Please confirm deleting the tag '{table_object.name}'.\")\ntemplate_return = flask.render_template('confirm_deletion.html', form=form)\nreturn flask.Response(template_return, mimetype='text/html')", "table_object = Tag....
<|body_start_0|> table_object = Tag.query.get_or_404(int_id) form = TagForm(obj=table_object) flask.flash(f"Please confirm deleting the tag '{table_object.name}'.") template_return = flask.render_template('confirm_deletion.html', form=form) return flask.Response(template_return, ...
DeleteTagResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteTagResource: def get(self, int_id): """Args: int_id: Returns:""" <|body_0|> def post(self, int_id): """Args: int_id: Returns:""" <|body_1|> <|end_skeleton|> <|body_start_0|> table_object = Tag.query.get_or_404(int_id) form = TagForm(ob...
stack_v2_sparse_classes_75kplus_train_005245
3,873
no_license
[ { "docstring": "Args: int_id: Returns:", "name": "get", "signature": "def get(self, int_id)" }, { "docstring": "Args: int_id: Returns:", "name": "post", "signature": "def post(self, int_id)" } ]
2
stack_v2_sparse_classes_30k_train_006684
Implement the Python class `DeleteTagResource` described below. Class description: Implement the DeleteTagResource class. Method signatures and docstrings: - def get(self, int_id): Args: int_id: Returns: - def post(self, int_id): Args: int_id: Returns:
Implement the Python class `DeleteTagResource` described below. Class description: Implement the DeleteTagResource class. Method signatures and docstrings: - def get(self, int_id): Args: int_id: Returns: - def post(self, int_id): Args: int_id: Returns: <|skeleton|> class DeleteTagResource: def get(self, int_id)...
865403e3b1717226b25c9d64aeb4c35c7220e7e3
<|skeleton|> class DeleteTagResource: def get(self, int_id): """Args: int_id: Returns:""" <|body_0|> def post(self, int_id): """Args: int_id: Returns:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeleteTagResource: def get(self, int_id): """Args: int_id: Returns:""" table_object = Tag.query.get_or_404(int_id) form = TagForm(obj=table_object) flask.flash(f"Please confirm deleting the tag '{table_object.name}'.") template_return = flask.render_template('confirm_de...
the_stack_v2_python_sparse
things_organizer/web_app/tags/resources.py
yeyeto2788/Things-Organizer
train
11
bc762e00ca180cbe0ecc1d29c89f8943792fd183
[ "worker_id = kwargs.get('worker_id')\nworker_node_dao = daos.WorkerNodeDao(self.settings)\nworker_node = worker_node_dao.find_by_id(worker_id)\nif not worker_node:\n logger.critical(\"unknown node with ID '{}' successfully requested job\".format(worker_id))\n self.abort({'message': ''}, status=404)\n retur...
<|body_start_0|> worker_id = kwargs.get('worker_id') worker_node_dao = daos.WorkerNodeDao(self.settings) worker_node = worker_node_dao.find_by_id(worker_id) if not worker_node: logger.critical("unknown node with ID '{}' successfully requested job".format(worker_id)) ...
GradingJobHandler
[ "NCSA", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradingJobHandler: def get(self, *args, **kwargs): """Allows workers to request their next grading job""" <|body_0|> def post(self, *args, **kwargs): """Allows workers to update grading job status on completion""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_005246
7,429
permissive
[ { "docstring": "Allows workers to request their next grading job", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "Allows workers to update grading job status on completion", "name": "post", "signature": "def post(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_035667
Implement the Python class `GradingJobHandler` described below. Class description: Implement the GradingJobHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): Allows workers to request their next grading job - def post(self, *args, **kwargs): Allows workers to update grading job status ...
Implement the Python class `GradingJobHandler` described below. Class description: Implement the GradingJobHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): Allows workers to request their next grading job - def post(self, *args, **kwargs): Allows workers to update grading job status ...
509dc38700c1bd06dc4cc78965d58cce89451859
<|skeleton|> class GradingJobHandler: def get(self, *args, **kwargs): """Allows workers to request their next grading job""" <|body_0|> def post(self, *args, **kwargs): """Allows workers to update grading job status on completion""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GradingJobHandler: def get(self, *args, **kwargs): """Allows workers to request their next grading job""" worker_id = kwargs.get('worker_id') worker_node_dao = daos.WorkerNodeDao(self.settings) worker_node = worker_node_dao.find_by_id(worker_id) if not worker_node: ...
the_stack_v2_python_sparse
broadway/api/handlers/worker.py
illinois-cs241/broadway
train
16
c218549ae5fb3a3013325ae52db89c0837e88559
[ "firstElement, secondElement = (None, None)\nprevElement = TreeNode(float('-inf'))\n\ndef traverse(root):\n nonlocal firstElement, secondElement, prevElement\n if root == None:\n return\n traverse(root.left)\n if firstElement == None and prevElement.val >= root.val:\n firstElement = prevEl...
<|body_start_0|> firstElement, secondElement = (None, None) prevElement = TreeNode(float('-inf')) def traverse(root): nonlocal firstElement, secondElement, prevElement if root == None: return traverse(root.left) if firstElement == ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def recoverTree(self, root: TreeNode) -> None: """Do not return anything, modify root in-place instead.""" <|body_0|> def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_1...
stack_v2_sparse_classes_75kplus_train_005247
3,935
no_license
[ { "docstring": "Do not return anything, modify root in-place instead.", "name": "recoverTree", "signature": "def recoverTree(self, root: TreeNode) -> None" }, { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "recoverTree", ...
2
stack_v2_sparse_classes_30k_train_004961
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root: TreeNode) -> None: Do not return anything, modify root in-place instead. - def recoverTree(self, root): :type root: TreeNode :rtype: void Do not retur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root: TreeNode) -> None: Do not return anything, modify root in-place instead. - def recoverTree(self, root): :type root: TreeNode :rtype: void Do not retur...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def recoverTree(self, root: TreeNode) -> None: """Do not return anything, modify root in-place instead.""" <|body_0|> def recoverTree(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def recoverTree(self, root: TreeNode) -> None: """Do not return anything, modify root in-place instead.""" firstElement, secondElement = (None, None) prevElement = TreeNode(float('-inf')) def traverse(root): nonlocal firstElement, secondElement, prevEleme...
the_stack_v2_python_sparse
python_leetcode_2020/Python_Leetcode_2020/99_recover_binary_search_tree.py
xiangcao/Leetcode
train
0
e995551f989d9afd3ce9a01a19a5ec812d41e6aa
[ "self.__logger = State().getLogger('DetectionCore_Component_Logger')\nself.__logger.info('Starting __init__()', 'HorizontalLineRemoveDetector:__init__')\nself.__indexOfProcessMat = indexOfProcessMat\nself.__anchorPoint = anchorPoint\nself.__kernelWidth = kernelWidth\nself.__kernelHeight = kernelHeight\nself.__morph...
<|body_start_0|> self.__logger = State().getLogger('DetectionCore_Component_Logger') self.__logger.info('Starting __init__()', 'HorizontalLineRemoveDetector:__init__') self.__indexOfProcessMat = indexOfProcessMat self.__anchorPoint = anchorPoint self.__kernelWidth = kernelWidth ...
HorizontalLineRemoveDetector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HorizontalLineRemoveDetector: def __init__(self, indexOfProcessMat=0, anchorPoint=(-1, -1), kernelWidth=1, kernelHeight=3, morphOfKernel=cv2.MORPH_RECT, showImagesInWindow=True): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" <|body_0|> def detect(self, mats): ...
stack_v2_sparse_classes_75kplus_train_005248
3,792
no_license
[ { "docstring": "To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!", "name": "__init__", "signature": "def __init__(self, indexOfProcessMat=0, anchorPoint=(-1, -1), kernelWidth=1, kernelHeight=3, morphOfKernel=cv2.MORPH_RECT, showImagesInWindow=True)" }, { "docstring": "To-Do: Bitte Kommentar b...
2
stack_v2_sparse_classes_30k_train_046718
Implement the Python class `HorizontalLineRemoveDetector` described below. Class description: Implement the HorizontalLineRemoveDetector class. Method signatures and docstrings: - def __init__(self, indexOfProcessMat=0, anchorPoint=(-1, -1), kernelWidth=1, kernelHeight=3, morphOfKernel=cv2.MORPH_RECT, showImagesInWin...
Implement the Python class `HorizontalLineRemoveDetector` described below. Class description: Implement the HorizontalLineRemoveDetector class. Method signatures and docstrings: - def __init__(self, indexOfProcessMat=0, anchorPoint=(-1, -1), kernelWidth=1, kernelHeight=3, morphOfKernel=cv2.MORPH_RECT, showImagesInWin...
3daaa72b193ebfb55894b47b6a752cdc2192bb6b
<|skeleton|> class HorizontalLineRemoveDetector: def __init__(self, indexOfProcessMat=0, anchorPoint=(-1, -1), kernelWidth=1, kernelHeight=3, morphOfKernel=cv2.MORPH_RECT, showImagesInWindow=True): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" <|body_0|> def detect(self, mats): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HorizontalLineRemoveDetector: def __init__(self, indexOfProcessMat=0, anchorPoint=(-1, -1), kernelWidth=1, kernelHeight=3, morphOfKernel=cv2.MORPH_RECT, showImagesInWindow=True): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" self.__logger = State().getLogger('DetectionCore_Componen...
the_stack_v2_python_sparse
SheetMusicScanner/DetectionCore_Component/Detector/HorizontalLineRemoveDetector.py
jadeskon/score-scan
train
0
cb5aa2a087739d600b6ce01506b5f4c16eccbe97
[ "if not event.metadata:\n return None\nreturn event.metadata.receiver_role", "if not event.metadata or not event.metadata.receiver_unit:\n return None\nreturn event.metadata.receiver_unit.id", "if not event.metadata:\n return None\nreturn event.metadata.sender_role" ]
<|body_start_0|> if not event.metadata: return None return event.metadata.receiver_role <|end_body_0|> <|body_start_1|> if not event.metadata or not event.metadata.receiver_unit: return None return event.metadata.receiver_unit.id <|end_body_1|> <|body_start_2|> ...
Referral lite serializer. Avoids the use of nested serializers and nested objects to limit the number of requests to the database, and make list API requests faster. Some properties need to be annotated onto the referrals for performance.
ValidationEventLiteSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidationEventLiteSerializer: """Referral lite serializer. Avoids the use of nested serializers and nested objects to limit the number of requests to the database, and make list API requests faster. Some properties need to be annotated onto the referrals for performance.""" def get_receiver...
stack_v2_sparse_classes_75kplus_train_005249
29,548
permissive
[ { "docstring": "Helper to get event receiver role in metadata", "name": "get_receiver_role", "signature": "def get_receiver_role(self, event)" }, { "docstring": "Helper to get event receiver unit in metadata", "name": "get_receiver_unit", "signature": "def get_receiver_unit(self, event)"...
3
stack_v2_sparse_classes_30k_train_039172
Implement the Python class `ValidationEventLiteSerializer` described below. Class description: Referral lite serializer. Avoids the use of nested serializers and nested objects to limit the number of requests to the database, and make list API requests faster. Some properties need to be annotated onto the referrals fo...
Implement the Python class `ValidationEventLiteSerializer` described below. Class description: Referral lite serializer. Avoids the use of nested serializers and nested objects to limit the number of requests to the database, and make list API requests faster. Some properties need to be annotated onto the referrals fo...
22e4afa728a851bb4c2479fbb6f5944a75984b9b
<|skeleton|> class ValidationEventLiteSerializer: """Referral lite serializer. Avoids the use of nested serializers and nested objects to limit the number of requests to the database, and make list API requests faster. Some properties need to be annotated onto the referrals for performance.""" def get_receiver...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidationEventLiteSerializer: """Referral lite serializer. Avoids the use of nested serializers and nested objects to limit the number of requests to the database, and make list API requests faster. Some properties need to be annotated onto the referrals for performance.""" def get_receiver_role(self, e...
the_stack_v2_python_sparse
src/backend/partaj/core/serializers.py
MTES-MCT/partaj
train
4
4e5d54a94a763b3ccf542afef3380085aec83596
[ "if user_input is None:\n return await self._async_show_form(step_id='user')\nreturn await self._async_check_and_create('user', user_input)", "await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_UDN])\nself._abort_if_unique_id_configured()\nself.url = url_normalize(discovery_info.upnp.get(ssdp.AT...
<|body_start_0|> if user_input is None: return await self._async_show_form(step_id='user') return await self._async_check_and_create('user', user_input) <|end_body_0|> <|body_start_1|> await self.async_set_unique_id(discovery_info.upnp[ssdp.ATTR_UPNP_UDN]) self._abort_if_uni...
Samsung SyncThru config flow.
SyncThruConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruConfigFlow: """Samsung SyncThru config flow.""" async def async_step_user(self, user_input=None): """Handle user initiated flow.""" <|body_0|> async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult: """Handle SSDP initiated fl...
stack_v2_sparse_classes_75kplus_train_005250
4,936
permissive
[ { "docstring": "Handle user initiated flow.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Handle SSDP initiated flow.", "name": "async_step_ssdp", "signature": "async def async_step_ssdp(self, discovery_info: ssdp.SsdpServ...
5
stack_v2_sparse_classes_30k_train_031875
Implement the Python class `SyncThruConfigFlow` described below. Class description: Samsung SyncThru config flow. Method signatures and docstrings: - async def async_step_user(self, user_input=None): Handle user initiated flow. - async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult: Han...
Implement the Python class `SyncThruConfigFlow` described below. Class description: Samsung SyncThru config flow. Method signatures and docstrings: - async def async_step_user(self, user_input=None): Handle user initiated flow. - async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult: Han...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SyncThruConfigFlow: """Samsung SyncThru config flow.""" async def async_step_user(self, user_input=None): """Handle user initiated flow.""" <|body_0|> async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult: """Handle SSDP initiated fl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SyncThruConfigFlow: """Samsung SyncThru config flow.""" async def async_step_user(self, user_input=None): """Handle user initiated flow.""" if user_input is None: return await self._async_show_form(step_id='user') return await self._async_check_and_create('user', user_...
the_stack_v2_python_sparse
homeassistant/components/syncthru/config_flow.py
home-assistant/core
train
35,501
56c63f6d45c86654e62e879b105769b7b1d71652
[ "user_friends_graph = self.get_user_friends_graph(user, user_friends_getter)\nsocial_graph_setter.store_user_friends_graph(user, user_friends_graph)\nreturn user_friends_graph", "graph = nx.Graph()\nuser_friends_list = user_friends_getter.get_friends_by_name(user)\nlocal = [user] + user_friends_list\nfor agent in...
<|body_start_0|> user_friends_graph = self.get_user_friends_graph(user, user_friends_getter) social_graph_setter.store_user_friends_graph(user, user_friends_graph) return user_friends_graph <|end_body_0|> <|body_start_1|> graph = nx.Graph() user_friends_list = user_friends_gette...
Creates a graph of twitter friends representing a community
SocialGraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_...
stack_v2_sparse_classes_75kplus_train_005251
2,007
no_license
[ { "docstring": "Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_getter the dao to retrieve the given users friends from @param social_graph_setter the dao to store the computed social graph", "name": "gen_user_friends_graph", "signature"...
2
stack_v2_sparse_classes_30k_train_030277
Implement the Python class `SocialGraph` described below. Class description: Creates a graph of twitter friends representing a community Method signatures and docstrings: - def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): Generates a user friends graph for a given user @param use...
Implement the Python class `SocialGraph` described below. Class description: Creates a graph of twitter friends representing a community Method signatures and docstrings: - def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): Generates a user friends graph for a given user @param use...
33a3fa38ad4dcdd54ff583da15dcd67c99ad9701
<|skeleton|> class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SocialGraph: """Creates a graph of twitter friends representing a community""" def gen_user_friends_graph(self, user: str, user_friends_getter, social_graph_setter): """Generates a user friends graph for a given user @param user the user to generate the graph for @param user_friends_getter the da...
the_stack_v2_python_sparse
src/process/social_graph/social_graph.py
ReinaKousaka/core
train
0
d6ad663f1a8334a2aadae0904b309e22d3ef6a45
[ "self.hdfs_entity_id = hdfs_entity_id\nself.kerberos_principal = kerberos_principal\nself.metastore = metastore\nself.thrift_port = thrift_port", "if dictionary is None:\n return None\nhdfs_entity_id = dictionary.get('hdfsEntityId')\nkerberos_principal = dictionary.get('kerberosPrincipal')\nmetastore = diction...
<|body_start_0|> self.hdfs_entity_id = hdfs_entity_id self.kerberos_principal = kerberos_principal self.metastore = metastore self.thrift_port = thrift_port <|end_body_0|> <|body_start_1|> if dictionary is None: return None hdfs_entity_id = dictionary.get('hd...
Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos principal. metastore (string): Specifies the Hiv...
HiveConnectParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HiveConnectParams: """Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos pri...
stack_v2_sparse_classes_75kplus_train_005252
2,242
permissive
[ { "docstring": "Constructor for the HiveConnectParams class", "name": "__init__", "signature": "def __init__(self, hdfs_entity_id=None, kerberos_principal=None, metastore=None, thrift_port=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)...
2
stack_v2_sparse_classes_30k_train_014324
Implement the Python class `HiveConnectParams` described below. Class description: Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_princip...
Implement the Python class `HiveConnectParams` described below. Class description: Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_princip...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class HiveConnectParams: """Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos pri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HiveConnectParams: """Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos principal. metas...
the_stack_v2_python_sparse
cohesity_management_sdk/models/hive_connect_params.py
cohesity/management-sdk-python
train
24
db12d7259bbebf9eadb282614fc4bf02d3ca8b01
[ "super().save_model(request, obj, form, change)\nfrom celery_tasks.tasks import generate_static_index_html\ngenerate_static_index_html.delay()\ncache.delete('index_info')", "super().delete_model(request, obj)\nfrom celery_tasks.tasks import generate_static_index_html\ngenerate_static_index_html.delay()\ncache.del...
<|body_start_0|> super().save_model(request, obj, form, change) from celery_tasks.tasks import generate_static_index_html generate_static_index_html.delay() cache.delete('index_info') <|end_body_0|> <|body_start_1|> super().delete_model(request, obj) from celery_tasks.ta...
数据表中的数据发生改变时调用 生产新的静态页面index.html
BaseModelAdmin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseModelAdmin: """数据表中的数据发生改变时调用 生产新的静态页面index.html""" def save_model(self, request, obj, form, change): """新增或修改数据表中的数据时调用""" <|body_0|> def delete_model(self, request, obj): """删除数据表中的数据时调用""" <|body_1|> <|end_skeleton|> <|body_start_0|> supe...
stack_v2_sparse_classes_75kplus_train_005253
1,857
permissive
[ { "docstring": "新增或修改数据表中的数据时调用", "name": "save_model", "signature": "def save_model(self, request, obj, form, change)" }, { "docstring": "删除数据表中的数据时调用", "name": "delete_model", "signature": "def delete_model(self, request, obj)" } ]
2
stack_v2_sparse_classes_30k_train_048746
Implement the Python class `BaseModelAdmin` described below. Class description: 数据表中的数据发生改变时调用 生产新的静态页面index.html Method signatures and docstrings: - def save_model(self, request, obj, form, change): 新增或修改数据表中的数据时调用 - def delete_model(self, request, obj): 删除数据表中的数据时调用
Implement the Python class `BaseModelAdmin` described below. Class description: 数据表中的数据发生改变时调用 生产新的静态页面index.html Method signatures and docstrings: - def save_model(self, request, obj, form, change): 新增或修改数据表中的数据时调用 - def delete_model(self, request, obj): 删除数据表中的数据时调用 <|skeleton|> class BaseModelAdmin: """数据表中的数...
59f6d1fc667ecaf902c8d8c3571a633cce80490e
<|skeleton|> class BaseModelAdmin: """数据表中的数据发生改变时调用 生产新的静态页面index.html""" def save_model(self, request, obj, form, change): """新增或修改数据表中的数据时调用""" <|body_0|> def delete_model(self, request, obj): """删除数据表中的数据时调用""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseModelAdmin: """数据表中的数据发生改变时调用 生产新的静态页面index.html""" def save_model(self, request, obj, form, change): """新增或修改数据表中的数据时调用""" super().save_model(request, obj, form, change) from celery_tasks.tasks import generate_static_index_html generate_static_index_html.delay() ...
the_stack_v2_python_sparse
fresh365/apps/goods/admin.py
rehth/MyDjango
train
0
39ec83b74bef5822751e9993268bc0786529b1d9
[ "storage = get_storage()\ncdf_forecast_groups = storage.list_cdf_forecast_groups()\nreturn jsonify(CDFForecastGroupSchema(many=True).dump(cdf_forecast_groups))", "data = request.get_json()\ntry:\n cdf_forecast_group = CDFForecastGroupPostSchema().load(data)\nexcept ValidationError as err:\n raise BadAPIRequ...
<|body_start_0|> storage = get_storage() cdf_forecast_groups = storage.list_cdf_forecast_groups() return jsonify(CDFForecastGroupSchema(many=True).dump(cdf_forecast_groups)) <|end_body_0|> <|body_start_1|> data = request.get_json() try: cdf_forecast_group = CDFForeca...
AllCDFForecastGroupsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllCDFForecastGroupsView: def get(self, *args): """--- summary: List Probabilistic Forecasts groups. description: List all probabilistic forecasts a user has access to. tags: - Probabilistic Forecasts responses: 200: description: A list of probabilistic forecasts content: application/jso...
stack_v2_sparse_classes_75kplus_train_005254
33,198
permissive
[ { "docstring": "--- summary: List Probabilistic Forecasts groups. description: List all probabilistic forecasts a user has access to. tags: - Probabilistic Forecasts responses: 200: description: A list of probabilistic forecasts content: application/json: schema: type: array items: $ref: '#/components/schemas/C...
2
null
Implement the Python class `AllCDFForecastGroupsView` described below. Class description: Implement the AllCDFForecastGroupsView class. Method signatures and docstrings: - def get(self, *args): --- summary: List Probabilistic Forecasts groups. description: List all probabilistic forecasts a user has access to. tags: ...
Implement the Python class `AllCDFForecastGroupsView` described below. Class description: Implement the AllCDFForecastGroupsView class. Method signatures and docstrings: - def get(self, *args): --- summary: List Probabilistic Forecasts groups. description: List all probabilistic forecasts a user has access to. tags: ...
280800c73eb7cfd49029462b352887e78f1ff91b
<|skeleton|> class AllCDFForecastGroupsView: def get(self, *args): """--- summary: List Probabilistic Forecasts groups. description: List all probabilistic forecasts a user has access to. tags: - Probabilistic Forecasts responses: 200: description: A list of probabilistic forecasts content: application/jso...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AllCDFForecastGroupsView: def get(self, *args): """--- summary: List Probabilistic Forecasts groups. description: List all probabilistic forecasts a user has access to. tags: - Probabilistic Forecasts responses: 200: description: A list of probabilistic forecasts content: application/json: schema: typ...
the_stack_v2_python_sparse
sfa_api/forecasts.py
SolarArbiter/solarforecastarbiter-api
train
9
56dc88c07bd42a34731bf85d0274a09989bfbbdc
[ "def helper(*args, **kwargs):\n helper.calls += 1\n return func(*args, **kwargs)\nhelper.calls = 0\nhelper.__name__ = func.__name__\nreturn helper", "print('__new__ class: {}'.format(clsname))\nfor attr in attributedict:\n if not callable(attr) and (not attr.startswith('__')):\n '\\n ...
<|body_start_0|> def helper(*args, **kwargs): helper.calls += 1 return func(*args, **kwargs) helper.calls = 0 helper.__name__ = func.__name__ return helper <|end_body_0|> <|body_start_1|> print('__new__ class: {}'.format(clsname)) for attr in attr...
decorates all the methods of the subclass using call_counter.
FunctionCallCounter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionCallCounter: """decorates all the methods of the subclass using call_counter.""" def call_counter(func): """Decorator for counting the number of function or method calls.""" <|body_0|> def __new__(cls, clsname, superclasses, attributedict): """Decorate ev...
stack_v2_sparse_classes_75kplus_train_005255
1,753
no_license
[ { "docstring": "Decorator for counting the number of function or method calls.", "name": "call_counter", "signature": "def call_counter(func)" }, { "docstring": "Decorate every method with the decorator call_counter.", "name": "__new__", "signature": "def __new__(cls, clsname, superclass...
2
stack_v2_sparse_classes_30k_val_001018
Implement the Python class `FunctionCallCounter` described below. Class description: decorates all the methods of the subclass using call_counter. Method signatures and docstrings: - def call_counter(func): Decorator for counting the number of function or method calls. - def __new__(cls, clsname, superclasses, attrib...
Implement the Python class `FunctionCallCounter` described below. Class description: decorates all the methods of the subclass using call_counter. Method signatures and docstrings: - def call_counter(func): Decorator for counting the number of function or method calls. - def __new__(cls, clsname, superclasses, attrib...
5e6d5ef799a94877b42b71fa1bd6f6aafd9688d6
<|skeleton|> class FunctionCallCounter: """decorates all the methods of the subclass using call_counter.""" def call_counter(func): """Decorator for counting the number of function or method calls.""" <|body_0|> def __new__(cls, clsname, superclasses, attributedict): """Decorate ev...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FunctionCallCounter: """decorates all the methods of the subclass using call_counter.""" def call_counter(func): """Decorator for counting the number of function or method calls.""" def helper(*args, **kwargs): helper.calls += 1 return func(*args, **kwargs) ...
the_stack_v2_python_sparse
tutorials/metaclasses/meta_08_call_counter.py
herereadthis/timballisto
train
0
545d15c4ae69c6b5ce1bdec93aadf562840fdac5
[ "if node_type == None:\n node_type = node_base\nif edge_type == None:\n edge_type = edge_base\nsuper().__init__()\nself.node_type = node_type\nself.edge_type = edge_type\nself.node_list = []\nself.edge_list = []\nself.mst = None", "self.unionset = unionset(len(self.node_list), int)\nself.edge_list.sort()\ns...
<|body_start_0|> if node_type == None: node_type = node_base if edge_type == None: edge_type = edge_base super().__init__() self.node_type = node_type self.edge_type = edge_type self.node_list = [] self.edge_list = [] self.mst = Non...
mst_base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mst_base: def __init__(self, node_type=None, edge_type=None): """vector_list: list, with node value edge_list: list, with edge value edge_type: str, 'list' for adjacent list, 'matrix' for adjacent matrix""" <|body_0|> def generate_mst(self): """The base function for ...
stack_v2_sparse_classes_75kplus_train_005256
1,213
no_license
[ { "docstring": "vector_list: list, with node value edge_list: list, with edge value edge_type: str, 'list' for adjacent list, 'matrix' for adjacent matrix", "name": "__init__", "signature": "def __init__(self, node_type=None, edge_type=None)" }, { "docstring": "The base function for mst Using Kr...
2
stack_v2_sparse_classes_30k_train_013464
Implement the Python class `mst_base` described below. Class description: Implement the mst_base class. Method signatures and docstrings: - def __init__(self, node_type=None, edge_type=None): vector_list: list, with node value edge_list: list, with edge value edge_type: str, 'list' for adjacent list, 'matrix' for adj...
Implement the Python class `mst_base` described below. Class description: Implement the mst_base class. Method signatures and docstrings: - def __init__(self, node_type=None, edge_type=None): vector_list: list, with node value edge_list: list, with edge value edge_type: str, 'list' for adjacent list, 'matrix' for adj...
2bd6aaadb8f6abcc13e9c468adff74c93b0ae6b2
<|skeleton|> class mst_base: def __init__(self, node_type=None, edge_type=None): """vector_list: list, with node value edge_list: list, with edge value edge_type: str, 'list' for adjacent list, 'matrix' for adjacent matrix""" <|body_0|> def generate_mst(self): """The base function for ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class mst_base: def __init__(self, node_type=None, edge_type=None): """vector_list: list, with node value edge_list: list, with edge value edge_type: str, 'list' for adjacent list, 'matrix' for adjacent matrix""" if node_type == None: node_type = node_base if edge_type == None: ...
the_stack_v2_python_sparse
graph_utils/mstpy/mst_base.py
jrahim/graph_clean
train
0
908ae0cce406613bce50900852e08db64640528c
[ "initial = super().get_initial(*args, **kwargs)\nself.product_range = get_object_or_404(models.ProductRange, pk=self.kwargs.get('range_pk'))\ninitial.update({'product_range': self.product_range})\nreturn initial", "range_pk = self.object.product_range.pk\nif self.object.polymorphic_ctype.model_class() == models.P...
<|body_start_0|> initial = super().get_initial(*args, **kwargs) self.product_range = get_object_or_404(models.ProductRange, pk=self.kwargs.get('range_pk')) initial.update({'product_range': self.product_range}) return initial <|end_body_0|> <|body_start_1|> range_pk = self.object...
Create the first product in a new range.
CreateInitialVariation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateInitialVariation: """Create the first product in a new range.""" def get_initial(self, *args, **kwargs): """Return initial form values.""" <|body_0|> def get_success_url(self): """Return URL to redirect to after successful form submission.""" <|body...
stack_v2_sparse_classes_75kplus_train_005257
11,012
no_license
[ { "docstring": "Return initial form values.", "name": "get_initial", "signature": "def get_initial(self, *args, **kwargs)" }, { "docstring": "Return URL to redirect to after successful form submission.", "name": "get_success_url", "signature": "def get_success_url(self)" } ]
2
stack_v2_sparse_classes_30k_train_003867
Implement the Python class `CreateInitialVariation` described below. Class description: Create the first product in a new range. Method signatures and docstrings: - def get_initial(self, *args, **kwargs): Return initial form values. - def get_success_url(self): Return URL to redirect to after successful form submissi...
Implement the Python class `CreateInitialVariation` described below. Class description: Create the first product in a new range. Method signatures and docstrings: - def get_initial(self, *args, **kwargs): Return initial form values. - def get_success_url(self): Return URL to redirect to after successful form submissi...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class CreateInitialVariation: """Create the first product in a new range.""" def get_initial(self, *args, **kwargs): """Return initial form values.""" <|body_0|> def get_success_url(self): """Return URL to redirect to after successful form submission.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateInitialVariation: """Create the first product in a new range.""" def get_initial(self, *args, **kwargs): """Return initial form values.""" initial = super().get_initial(*args, **kwargs) self.product_range = get_object_or_404(models.ProductRange, pk=self.kwargs.get('range_pk'...
the_stack_v2_python_sparse
inventory/views/product_editor.py
stcstores/stcadmin
train
0
9f88d859633b506dc00d9689f06b08a9846b075d
[ "self.author = Author.objects.create(name='Test Name', email='testemail@email.com', address='Test address', bio='Test bio')\nself.publisher = publisher = Publisher.objects.create(name='Test Name', address='Test address', email='testemail@email.com', publisher_url='http://testpublisherurl.com')\nself.book = Book.obj...
<|body_start_0|> self.author = Author.objects.create(name='Test Name', email='testemail@email.com', address='Test address', bio='Test bio') self.publisher = publisher = Publisher.objects.create(name='Test Name', address='Test address', email='testemail@email.com', publisher_url='http://testpublisherurl....
Test casees for the Book model
BookTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookTestCase: """Test casees for the Book model""" def setUp(self): """Set up data to be used in test cases""" <|body_0|> def test_model_fields_with_correct_values(self): """Test the model fields with correct values.""" <|body_1|> def test_model_fiel...
stack_v2_sparse_classes_75kplus_train_005258
12,307
permissive
[ { "docstring": "Set up data to be used in test cases", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the model fields with correct values.", "name": "test_model_fields_with_correct_values", "signature": "def test_model_fields_with_correct_values(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_036866
Implement the Python class `BookTestCase` described below. Class description: Test casees for the Book model Method signatures and docstrings: - def setUp(self): Set up data to be used in test cases - def test_model_fields_with_correct_values(self): Test the model fields with correct values. - def test_model_fields_w...
Implement the Python class `BookTestCase` described below. Class description: Test casees for the Book model Method signatures and docstrings: - def setUp(self): Set up data to be used in test cases - def test_model_fields_with_correct_values(self): Test the model fields with correct values. - def test_model_fields_w...
a364e9997c1c91b09f5db8a004deb4df305fa8cf
<|skeleton|> class BookTestCase: """Test casees for the Book model""" def setUp(self): """Set up data to be used in test cases""" <|body_0|> def test_model_fields_with_correct_values(self): """Test the model fields with correct values.""" <|body_1|> def test_model_fiel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BookTestCase: """Test casees for the Book model""" def setUp(self): """Set up data to be used in test cases""" self.author = Author.objects.create(name='Test Name', email='testemail@email.com', address='Test address', bio='Test bio') self.publisher = publisher = Publisher.objects....
the_stack_v2_python_sparse
libStash/books/tests.py
Dev-Rem/libStash
train
0
4dba39749728e3f96c2639edf215a6ac48a048dc
[ "self.data = data\nself.column_text = flags_parameters.column_text\nself.apply_small_clean = flags_parameters.apply_small_clean\nself.language_text = flags_parameters.language_text\nassert isinstance(self.data, pd.DataFrame), 'data must be a DataFrame type'\nassert self.column_text in self.data.columns, 'column_tex...
<|body_start_0|> self.data = data self.column_text = flags_parameters.column_text self.apply_small_clean = flags_parameters.apply_small_clean self.language_text = flags_parameters.language_text assert isinstance(self.data, pd.DataFrame), 'data must be a DataFrame type' as...
Preprocessing_EDA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocessing_EDA: def __init__(self, data, flags_parameters): """Args: data (Dataframe) flags_parameters : Instance of Flags class object From flags_parameters: column_text (str) : name of the column with texts (only one column) apply_small_clean (Boolean) step 1 of transform apply_spac...
stack_v2_sparse_classes_75kplus_train_005259
8,802
no_license
[ { "docstring": "Args: data (Dataframe) flags_parameters : Instance of Flags class object From flags_parameters: column_text (str) : name of the column with texts (only one column) apply_small_clean (Boolean) step 1 of transform apply_spacy_preprocessing (Boolean) step 2 of transform language_text (str) language...
2
null
Implement the Python class `Preprocessing_EDA` described below. Class description: Implement the Preprocessing_EDA class. Method signatures and docstrings: - def __init__(self, data, flags_parameters): Args: data (Dataframe) flags_parameters : Instance of Flags class object From flags_parameters: column_text (str) : ...
Implement the Python class `Preprocessing_EDA` described below. Class description: Implement the Preprocessing_EDA class. Method signatures and docstrings: - def __init__(self, data, flags_parameters): Args: data (Dataframe) flags_parameters : Instance of Flags class object From flags_parameters: column_text (str) : ...
2fda81c6b4848540c378a6f6359c3d163b44b012
<|skeleton|> class Preprocessing_EDA: def __init__(self, data, flags_parameters): """Args: data (Dataframe) flags_parameters : Instance of Flags class object From flags_parameters: column_text (str) : name of the column with texts (only one column) apply_small_clean (Boolean) step 1 of transform apply_spac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Preprocessing_EDA: def __init__(self, data, flags_parameters): """Args: data (Dataframe) flags_parameters : Instance of Flags class object From flags_parameters: column_text (str) : name of the column with texts (only one column) apply_small_clean (Boolean) step 1 of transform apply_spacy_preprocessin...
the_stack_v2_python_sparse
autonlp/utils/eda_utils.py
Tarandro/testML
train
0
826fa9d0f6dc621ed82389b83440ffcf90a485c7
[ "tf.logging.info('Create InitVariablesHook.')\nself._checkpoint_dir = checkpoint_dir\nself._global_var_initop = tf.global_variables_initializer()", "checkpoint_path = saver_lib.latest_checkpoint(self._checkpoint_dir)\nif not checkpoint_path:\n tf.logging.info('InitVariablesHook (after_create_sess): initializin...
<|body_start_0|> tf.logging.info('Create InitVariablesHook.') self._checkpoint_dir = checkpoint_dir self._global_var_initop = tf.global_variables_initializer() <|end_body_0|> <|body_start_1|> checkpoint_path = saver_lib.latest_checkpoint(self._checkpoint_dir) if not checkpoint_p...
Define the hook to initialize all global variables.
InitVariablesHook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitVariablesHook: """Define the hook to initialize all global variables.""" def __init__(self, checkpoint_dir): """Initializes the hook. Args: checkpoint_dir: A string, the name of the directory that checkpoints save to.""" <|body_0|> def after_create_session(self, sess...
stack_v2_sparse_classes_75kplus_train_005260
12,247
permissive
[ { "docstring": "Initializes the hook. Args: checkpoint_dir: A string, the name of the directory that checkpoints save to.", "name": "__init__", "signature": "def __init__(self, checkpoint_dir)" }, { "docstring": "Initializes all global variables after session is created. Args: session: A TensorF...
2
stack_v2_sparse_classes_30k_train_026355
Implement the Python class `InitVariablesHook` described below. Class description: Define the hook to initialize all global variables. Method signatures and docstrings: - def __init__(self, checkpoint_dir): Initializes the hook. Args: checkpoint_dir: A string, the name of the directory that checkpoints save to. - def...
Implement the Python class `InitVariablesHook` described below. Class description: Define the hook to initialize all global variables. Method signatures and docstrings: - def __init__(self, checkpoint_dir): Initializes the hook. Args: checkpoint_dir: A string, the name of the directory that checkpoints save to. - def...
01155c740705f1641ebf3134829cea0e212f2d28
<|skeleton|> class InitVariablesHook: """Define the hook to initialize all global variables.""" def __init__(self, checkpoint_dir): """Initializes the hook. Args: checkpoint_dir: A string, the name of the directory that checkpoints save to.""" <|body_0|> def after_create_session(self, sess...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InitVariablesHook: """Define the hook to initialize all global variables.""" def __init__(self, checkpoint_dir): """Initializes the hook. Args: checkpoint_dir: A string, the name of the directory that checkpoints save to.""" tf.logging.info('Create InitVariablesHook.') self._check...
the_stack_v2_python_sparse
njunmt/training/hooks.py
zhaocq-nlp/NJUNMT-tf
train
114
e7ad0b40810b8e714729951a8dfef37fc332b4a8
[ "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] = 1.0\nself.weight = nn.Parameter(torch.as_tensor([0.001]))", "eye = torch.eye(self.nelec, self.nelec).to(self.device)\nmask = torch.ones_like(ree) - eye\nreturn self....
<|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] = 1.0 self.weight = nn.Parameter(torch.as_tensor([0.001])) <|end_body_0|> <|body_start_1|> eye = torch.e...
BackFlowKernelAutoInverse
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackFlowKernelAutoInverse: 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_005261
1,085
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_007324
Implement the Python class `BackFlowKernelAutoInverse` described below. Class description: Implement the BackFlowKernelAutoInverse 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 ...
Implement the Python class `BackFlowKernelAutoInverse` described below. Class description: Implement the BackFlowKernelAutoInverse 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 ...
439a79e97ee63057e3032d28a1a5ebafd2d5b5e4
<|skeleton|> class BackFlowKernelAutoInverse: 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 BackFlowKernelAutoInverse: 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_autodiff_inverse.py
NLESC-JCER/QMCTorch
train
22
bd6df8ca0f1c28ea5347628e80b88f8c4608ad4e
[ "if remainder < 4:\n roman = [cnt] * remainder\nelif remainder == 4:\n roman = [half, cnt]\nelif remainder == 5:\n roman = [half]\nelif remainder < 9:\n roman = [cnt] * (remainder - 5)\n roman.append(half)\nelse:\n roman = [next, cnt]\nreturn roman", "rounds = 1\nroman = []\nwhile num != 0 or le...
<|body_start_0|> if remainder < 4: roman = [cnt] * remainder elif remainder == 4: roman = [half, cnt] elif remainder == 5: roman = [half] elif remainder < 9: roman = [cnt] * (remainder - 5) roman.append(half) else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __remainderToRoman(self, remainder, cnt, half, next): """:param remainder: :param cnt: str :param half: str :param next: str :return:""" <|body_0|> def intToRoman(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_005262
1,734
no_license
[ { "docstring": ":param remainder: :param cnt: str :param half: str :param next: str :return:", "name": "__remainderToRoman", "signature": "def __remainderToRoman(self, remainder, cnt, half, next)" }, { "docstring": ":type num: int :rtype: str", "name": "intToRoman", "signature": "def int...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __remainderToRoman(self, remainder, cnt, half, next): :param remainder: :param cnt: str :param half: str :param next: str :return: - def intToRoman(self, num): :type num: int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __remainderToRoman(self, remainder, cnt, half, next): :param remainder: :param cnt: str :param half: str :param next: str :return: - def intToRoman(self, num): :type num: int...
28d7f599e685d423721cb72d842a4cf51f3e03b7
<|skeleton|> class Solution: def __remainderToRoman(self, remainder, cnt, half, next): """:param remainder: :param cnt: str :param half: str :param next: str :return:""" <|body_0|> def intToRoman(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __remainderToRoman(self, remainder, cnt, half, next): """:param remainder: :param cnt: str :param half: str :param next: str :return:""" if remainder < 4: roman = [cnt] * remainder elif remainder == 4: roman = [half, cnt] elif remainder == ...
the_stack_v2_python_sparse
leetcode012/leetcode012.py
chuqidecha/leetcode
train
0
38b79f2c567d9575bd4774b8f7c60a5515b32f7d
[ "current_user_id = g.user.user_id\nchat = return_chat_or_abort(chat_id)\nabort_if_not_a_participant(current_user_id, chat)\nmessage = return_message_or_abort(message_id)\nabort_if_not_from_a_chat(chat_id, message)\nreturn ({'user_id': current_user_id, 'chat_id': chat_id, 'data': message}, 200)", "current_user_id ...
<|body_start_0|> current_user_id = g.user.user_id chat = return_chat_or_abort(chat_id) abort_if_not_a_participant(current_user_id, chat) message = return_message_or_abort(message_id) abort_if_not_from_a_chat(chat_id, message) return ({'user_id': current_user_id, 'chat_id'...
ChatMessageSingle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChatMessageSingle: def get(self, chat_id: int, message_id: int) -> Tuple[dict, int]: """Return info about a certain message from the chat""" <|body_0|> def delete(self, chat_id: int, message_id: int) -> Tuple[dict, int]: """Delete the message with a given id from the...
stack_v2_sparse_classes_75kplus_train_005263
4,930
permissive
[ { "docstring": "Return info about a certain message from the chat", "name": "get", "signature": "def get(self, chat_id: int, message_id: int) -> Tuple[dict, int]" }, { "docstring": "Delete the message with a given id from the chat", "name": "delete", "signature": "def delete(self, chat_i...
3
stack_v2_sparse_classes_30k_train_020273
Implement the Python class `ChatMessageSingle` described below. Class description: Implement the ChatMessageSingle class. Method signatures and docstrings: - def get(self, chat_id: int, message_id: int) -> Tuple[dict, int]: Return info about a certain message from the chat - def delete(self, chat_id: int, message_id:...
Implement the Python class `ChatMessageSingle` described below. Class description: Implement the ChatMessageSingle class. Method signatures and docstrings: - def get(self, chat_id: int, message_id: int) -> Tuple[dict, int]: Return info about a certain message from the chat - def delete(self, chat_id: int, message_id:...
cb58c21deee6e9f77ab84b3c9af58df2c7b7f510
<|skeleton|> class ChatMessageSingle: def get(self, chat_id: int, message_id: int) -> Tuple[dict, int]: """Return info about a certain message from the chat""" <|body_0|> def delete(self, chat_id: int, message_id: int) -> Tuple[dict, int]: """Delete the message with a given id from the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChatMessageSingle: def get(self, chat_id: int, message_id: int) -> Tuple[dict, int]: """Return info about a certain message from the chat""" current_user_id = g.user.user_id chat = return_chat_or_abort(chat_id) abort_if_not_a_participant(current_user_id, chat) message =...
the_stack_v2_python_sparse
app/api/resources/messages.py
dmytro-afanasiev/flask-simple-chats
train
0
17a37e96b9caf44c6518a5e843566ef4ae767f43
[ "self._requirements: Dict[str, Dict] = requirements\nself.__sha_algorithm: str = sha_algorithm\nself.__download: Callable = download_func\nself.__download_args: Dict = download_func_args or {}\nself.__check_connection: Callable = check_connection or (lambda addr: True)", "if requirement[self.__sha_algorithm] != S...
<|body_start_0|> self._requirements: Dict[str, Dict] = requirements self.__sha_algorithm: str = sha_algorithm self.__download: Callable = download_func self.__download_args: Dict = download_func_args or {} self.__check_connection: Callable = check_connection or (lambda addr: True...
Wrapper for downloading requirements with checksum validation.
BaseDownloader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseDownloader: """Wrapper for downloading requirements with checksum validation.""" def __init__(self, requirements: Dict[str, Dict], sha_algorithm: str, download_func: Callable, download_func_args: Dict=None, check_connection: Callable=None): """:param requirements: data from parse...
stack_v2_sparse_classes_75kplus_train_005264
4,097
permissive
[ { "docstring": ":param requirements: data from parsed requirements file :param sha_algorithm: which algorithm will be used in validating the requirements :param download_func: back end function used for downloading the requirements :param download_func_args: optional args passed to the `download_func` :param ch...
3
stack_v2_sparse_classes_30k_train_023196
Implement the Python class `BaseDownloader` described below. Class description: Wrapper for downloading requirements with checksum validation. Method signatures and docstrings: - def __init__(self, requirements: Dict[str, Dict], sha_algorithm: str, download_func: Callable, download_func_args: Dict=None, check_connect...
Implement the Python class `BaseDownloader` described below. Class description: Wrapper for downloading requirements with checksum validation. Method signatures and docstrings: - def __init__(self, requirements: Dict[str, Dict], sha_algorithm: str, download_func: Callable, download_func_args: Dict=None, check_connect...
6c917422dfa831ffb3eb7f8f5a616bc074734b66
<|skeleton|> class BaseDownloader: """Wrapper for downloading requirements with checksum validation.""" def __init__(self, requirements: Dict[str, Dict], sha_algorithm: str, download_func: Callable, download_func_args: Dict=None, check_connection: Callable=None): """:param requirements: data from parse...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseDownloader: """Wrapper for downloading requirements with checksum validation.""" def __init__(self, requirements: Dict[str, Dict], sha_algorithm: str, download_func: Callable, download_func_args: Dict=None, check_connection: Callable=None): """:param requirements: data from parsed requirement...
the_stack_v2_python_sparse
ansible/playbooks/roles/repository/files/download-requirements/src/downloader/base_downloader.py
seriva/epiphany
train
1
1851520e5358f6e3556853cb985294009951490d
[ "for crc_name in self.check_crc_names:\n crcfun = mkPredefinedCrcFun(crc_name)\n for i in range(len(self.msg) + 1):\n test_msg = self.msg[:i]\n bytes_answer = crcfun(test_msg)\n bytearray_answer = crcfun(bytearray(test_msg))\n self.assertEqual(bytes_answer, bytearray_answer)", "f...
<|body_start_0|> for crc_name in self.check_crc_names: crcfun = mkPredefinedCrcFun(crc_name) for i in range(len(self.msg) + 1): test_msg = self.msg[:i] bytes_answer = crcfun(test_msg) bytearray_answer = crcfun(bytearray(test_msg)) ...
Check the various input types that CRC functions can accept.
InputTypesTest
[ "BSD-3-Clause", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputTypesTest: """Check the various input types that CRC functions can accept.""" def test_bytearray_input(self): """Test that bytearray inputs are accepted, as an example of a type that implements the buffer protocol.""" <|body_0|> def test_array_input(self): "...
stack_v2_sparse_classes_75kplus_train_005265
18,433
permissive
[ { "docstring": "Test that bytearray inputs are accepted, as an example of a type that implements the buffer protocol.", "name": "test_bytearray_input", "signature": "def test_bytearray_input(self)" }, { "docstring": "Test that array inputs are accepted, as an example of a type that implements th...
3
stack_v2_sparse_classes_30k_train_029113
Implement the Python class `InputTypesTest` described below. Class description: Check the various input types that CRC functions can accept. Method signatures and docstrings: - def test_bytearray_input(self): Test that bytearray inputs are accepted, as an example of a type that implements the buffer protocol. - def t...
Implement the Python class `InputTypesTest` described below. Class description: Check the various input types that CRC functions can accept. Method signatures and docstrings: - def test_bytearray_input(self): Test that bytearray inputs are accepted, as an example of a type that implements the buffer protocol. - def t...
53102de187a48ac2cfc241fef54dcbc29c453a8e
<|skeleton|> class InputTypesTest: """Check the various input types that CRC functions can accept.""" def test_bytearray_input(self): """Test that bytearray inputs are accepted, as an example of a type that implements the buffer protocol.""" <|body_0|> def test_array_input(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputTypesTest: """Check the various input types that CRC functions can accept.""" def test_bytearray_input(self): """Test that bytearray inputs are accepted, as an example of a type that implements the buffer protocol.""" for crc_name in self.check_crc_names: crcfun = mkPrede...
the_stack_v2_python_sparse
third_party/gsutil/third_party/crcmod/python3/crcmod/test.py
catapult-project/catapult
train
2,032
3d44111898dad01053a9a72e2f8e4d158fcbf5d7
[ "answer = await _duckduckgo(ctx, query='random name')\nanswer = answer.replace('(random)', '')\nawait ctx.send(answer)", "query = f'find anagram for {phrase}'\nanswer = await _duckduckgo(ctx, query=query)\nif answer:\n await ctx.send(answer)\nelse:\n await ctx.send('No anagrams found. :<')" ]
<|body_start_0|> answer = await _duckduckgo(ctx, query='random name') answer = answer.replace('(random)', '') await ctx.send(answer) <|end_body_0|> <|body_start_1|> query = f'find anagram for {phrase}' answer = await _duckduckgo(ctx, query=query) if answer: a...
Words
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Words: async def rname(self, ctx): """Generate a random name.""" <|body_0|> async def anagram(self, ctx, *, phrase: str): """Find possible anagrams of a phrase. * phrase = The message to find an anagram for.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_005266
4,354
permissive
[ { "docstring": "Generate a random name.", "name": "rname", "signature": "async def rname(self, ctx)" }, { "docstring": "Find possible anagrams of a phrase. * phrase = The message to find an anagram for.", "name": "anagram", "signature": "async def anagram(self, ctx, *, phrase: str)" } ...
2
stack_v2_sparse_classes_30k_train_030755
Implement the Python class `Words` described below. Class description: Implement the Words class. Method signatures and docstrings: - async def rname(self, ctx): Generate a random name. - async def anagram(self, ctx, *, phrase: str): Find possible anagrams of a phrase. * phrase = The message to find an anagram for.
Implement the Python class `Words` described below. Class description: Implement the Words class. Method signatures and docstrings: - async def rname(self, ctx): Generate a random name. - async def anagram(self, ctx, *, phrase: str): Find possible anagrams of a phrase. * phrase = The message to find an anagram for. ...
3a456ad06814181d13d4aabefc151756c55444f4
<|skeleton|> class Words: async def rname(self, ctx): """Generate a random name.""" <|body_0|> async def anagram(self, ctx, *, phrase: str): """Find possible anagrams of a phrase. * phrase = The message to find an anagram for.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Words: async def rname(self, ctx): """Generate a random name.""" answer = await _duckduckgo(ctx, query='random name') answer = answer.replace('(random)', '') await ctx.send(answer) async def anagram(self, ctx, *, phrase: str): """Find possible anagrams of a phrase....
the_stack_v2_python_sparse
cogs/ddg.py
sokcheng/Kitsuchan-NG
train
1
24160b8861ad8f1feba2c260f8f3f2135a65c484
[ "object.__init__(self)\nif timeout is not None and timeout < 0.0:\n raise ValueError('Timeout must not be negative')\nself._timeout = timeout\nself._allow_negative = allow_negative\nself._time_fn = _time_fn\nself._start_time = None", "if self._timeout is None:\n return None\nif self._start_time is None:\n ...
<|body_start_0|> object.__init__(self) if timeout is not None and timeout < 0.0: raise ValueError('Timeout must not be negative') self._timeout = timeout self._allow_negative = allow_negative self._time_fn = _time_fn self._start_time = None <|end_body_0|> <|b...
Class to calculate remaining timeout when doing several operations.
RunningTimeout
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunningTimeout: """Class to calculate remaining timeout when doing several operations.""" def __init__(self, timeout, allow_negative, _time_fn=time.time): """Initializes this class. @type timeout: float @param timeout: Timeout duration @type allow_negative: bool @param allow_negative...
stack_v2_sparse_classes_75kplus_train_005267
10,129
permissive
[ { "docstring": "Initializes this class. @type timeout: float @param timeout: Timeout duration @type allow_negative: bool @param allow_negative: Whether to return values below zero @param _time_fn: Time function for unittests", "name": "__init__", "signature": "def __init__(self, timeout, allow_negative,...
2
stack_v2_sparse_classes_30k_train_032498
Implement the Python class `RunningTimeout` described below. Class description: Class to calculate remaining timeout when doing several operations. Method signatures and docstrings: - def __init__(self, timeout, allow_negative, _time_fn=time.time): Initializes this class. @type timeout: float @param timeout: Timeout ...
Implement the Python class `RunningTimeout` described below. Class description: Class to calculate remaining timeout when doing several operations. Method signatures and docstrings: - def __init__(self, timeout, allow_negative, _time_fn=time.time): Initializes this class. @type timeout: float @param timeout: Timeout ...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class RunningTimeout: """Class to calculate remaining timeout when doing several operations.""" def __init__(self, timeout, allow_negative, _time_fn=time.time): """Initializes this class. @type timeout: float @param timeout: Timeout duration @type allow_negative: bool @param allow_negative...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RunningTimeout: """Class to calculate remaining timeout when doing several operations.""" def __init__(self, timeout, allow_negative, _time_fn=time.time): """Initializes this class. @type timeout: float @param timeout: Timeout duration @type allow_negative: bool @param allow_negative: Whether to ...
the_stack_v2_python_sparse
lib/utils/algo.py
ganeti/ganeti
train
465
ed26f15cf2cac17b51a8bc924b1ecbf624d752e2
[ "self.send_response(resp)\nself.send_header('Content-type', 'application/json')\nself.end_headers()", "global health_state\nself._set_headers(200)\nself.wfile.write(health_state.as_json())" ]
<|body_start_0|> self.send_response(resp) self.send_header('Content-type', 'application/json') self.end_headers() <|end_body_0|> <|body_start_1|> global health_state self._set_headers(200) self.wfile.write(health_state.as_json()) <|end_body_1|>
Custom HTTP handler for Mauka's health requests.
HealthRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthRequestHandler: """Custom HTTP handler for Mauka's health requests.""" def _set_headers(self, resp: int): """Custom heaser setting method. :param resp: The response type.""" <|body_0|> def do_GET(self): """Returns the health state as JSON to the requestee. ...
stack_v2_sparse_classes_75kplus_train_005268
3,495
no_license
[ { "docstring": "Custom heaser setting method. :param resp: The response type.", "name": "_set_headers", "signature": "def _set_headers(self, resp: int)" }, { "docstring": "Returns the health state as JSON to the requestee. :return: The health state as JSON", "name": "do_GET", "signature"...
2
stack_v2_sparse_classes_30k_val_001257
Implement the Python class `HealthRequestHandler` described below. Class description: Custom HTTP handler for Mauka's health requests. Method signatures and docstrings: - def _set_headers(self, resp: int): Custom heaser setting method. :param resp: The response type. - def do_GET(self): Returns the health state as JS...
Implement the Python class `HealthRequestHandler` described below. Class description: Custom HTTP handler for Mauka's health requests. Method signatures and docstrings: - def _set_headers(self, resp: int): Custom heaser setting method. :param resp: The response type. - def do_GET(self): Returns the health state as JS...
0795f6140bc93c0a74d8ac788bdea547428517b5
<|skeleton|> class HealthRequestHandler: """Custom HTTP handler for Mauka's health requests.""" def _set_headers(self, resp: int): """Custom heaser setting method. :param resp: The response type.""" <|body_0|> def do_GET(self): """Returns the health state as JSON to the requestee. ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HealthRequestHandler: """Custom HTTP handler for Mauka's health requests.""" def _set_headers(self, resp: int): """Custom heaser setting method. :param resp: The response type.""" self.send_response(resp) self.send_header('Content-type', 'application/json') self.end_header...
the_stack_v2_python_sparse
mauka/plugins/status_plugin.py
vinipletsch/opq
train
0
79d2952222d3d65a2e7869e70e28c42c44af20f3
[ "q = collections.deque([root])\nans = []\nwhile q:\n now = q.popleft()\n if now:\n ans.append(now.val)\n else:\n ans.append(None)\n if now:\n q.append(now.left)\n q.append(now.right)\nreturn ans", "if data == [None]:\n return []\nroot = TreeNode(data[0])\nq = collections...
<|body_start_0|> q = collections.deque([root]) ans = [] while q: now = q.popleft() if now: ans.append(now.val) else: ans.append(None) if now: q.append(now.left) q.append(now.right) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_005269
1,604
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
stack_v2_sparse_classes_30k_train_032691
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
d5d09b047808b6fc2eeaabdbe7f32c83446b4a1b
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = collections.deque([root]) ans = [] while q: now = q.popleft() if now: ans.append(now.val) else: an...
the_stack_v2_python_sparse
leetcode/tree/lc_297.py
ckdrjs96/algorithm
train
0
328539190b12c42949a5efd95b2b39f199ee523b
[ "query = g.db.query(MatchTeam)\nquery = query.filter(MatchTeam.match_id == match_id)\nrows = query.all()\nret = []\nfor row in rows:\n record = row.as_dict()\n record['url'] = url_for('matches.team', match_id=match_id, team_id=row.team_id, _external=True)\n ret.append(record)\nreturn jsonify(ret)", "team...
<|body_start_0|> query = g.db.query(MatchTeam) query = query.filter(MatchTeam.match_id == match_id) rows = query.all() ret = [] for row in rows: record = row.as_dict() record['url'] = url_for('matches.team', match_id=match_id, team_id=row.team_id, _externa...
All teams in a match
MatchTeamsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchTeamsAPI: """All teams in a match""" def get(self, match_id): """Find teams by match""" <|body_0|> def post(self, args, match_id): """Add a team to a match""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = g.db.query(MatchTeam) ...
stack_v2_sparse_classes_75kplus_train_005270
38,064
permissive
[ { "docstring": "Find teams by match", "name": "get", "signature": "def get(self, match_id)" }, { "docstring": "Add a team to a match", "name": "post", "signature": "def post(self, args, match_id)" } ]
2
null
Implement the Python class `MatchTeamsAPI` described below. Class description: All teams in a match Method signatures and docstrings: - def get(self, match_id): Find teams by match - def post(self, args, match_id): Add a team to a match
Implement the Python class `MatchTeamsAPI` described below. Class description: All teams in a match Method signatures and docstrings: - def get(self, match_id): Find teams by match - def post(self, args, match_id): Add a team to a match <|skeleton|> class MatchTeamsAPI: """All teams in a match""" def get(se...
2771bb46db7fd331448f9db3cfb257fab7f89bcc
<|skeleton|> class MatchTeamsAPI: """All teams in a match""" def get(self, match_id): """Find teams by match""" <|body_0|> def post(self, args, match_id): """Add a team to a match""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MatchTeamsAPI: """All teams in a match""" def get(self, match_id): """Find teams by match""" query = g.db.query(MatchTeam) query = query.filter(MatchTeam.match_id == match_id) rows = query.all() ret = [] for row in rows: record = row.as_dict() ...
the_stack_v2_python_sparse
driftbase/api/matches.py
directivegames/drift-base
train
1
9f5c15b175ca5863fc44c2593094c1f1b4316771
[ "assert len(n_lanes) == n_roads\nself.n_roads = n_roads\nself.n_lanes = n_lanes\nself.k_current = k_c\nself.k_accumulation = k_a\nself.k_wait = k_w\nself.threshold = thresh\nassert -1 <= current < n_roads\nself.current = current\nself.wait_times = [0] * self.n_roads\nself.confirmation = False\nself.conf_timer = 0\n...
<|body_start_0|> assert len(n_lanes) == n_roads self.n_roads = n_roads self.n_lanes = n_lanes self.k_current = k_c self.k_accumulation = k_a self.k_wait = k_w self.threshold = thresh assert -1 <= current < n_roads self.current = current sel...
Class to represent to Traffic Scheduler that manages the traffic signal at a particular intersection.
Scheduler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scheduler: """Class to represent to Traffic Scheduler that manages the traffic signal at a particular intersection.""" def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1): """Constructs the Traffic Scheduler object. :param n_roads: Number of independent roads a...
stack_v2_sparse_classes_75kplus_train_005271
6,754
permissive
[ { "docstring": "Constructs the Traffic Scheduler object. :param n_roads: Number of independent roads at this intersection :type n_roads: int :param n_lanes: List containing the number of lanes in each of the roads. Must have length equal to n_roads. :type n_lanes: List[int] :param k_c: k_current coefficient for...
5
stack_v2_sparse_classes_30k_train_008955
Implement the Python class `Scheduler` described below. Class description: Class to represent to Traffic Scheduler that manages the traffic signal at a particular intersection. Method signatures and docstrings: - def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1): Constructs the Traffic Schedu...
Implement the Python class `Scheduler` described below. Class description: Class to represent to Traffic Scheduler that manages the traffic signal at a particular intersection. Method signatures and docstrings: - def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1): Constructs the Traffic Schedu...
94ed5a9c57ea5b4232dac6b68a86a05d1cae9c39
<|skeleton|> class Scheduler: """Class to represent to Traffic Scheduler that manages the traffic signal at a particular intersection.""" def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1): """Constructs the Traffic Scheduler object. :param n_roads: Number of independent roads a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Scheduler: """Class to represent to Traffic Scheduler that manages the traffic signal at a particular intersection.""" def __init__(self, n_roads, n_lanes, k_c, k_a, k_w, thresh=10, current=-1): """Constructs the Traffic Scheduler object. :param n_roads: Number of independent roads at this inters...
the_stack_v2_python_sparse
scheduler/scheduler.py
anjali-2504/DIY-TRAFFIC-FLOW-OPTIMISATION
train
0
370c4215eab7b5c428d5d3f9aff3f5f8190fb492
[ "self._text = text or ''\nself._has_div = True\nm = self.p_header.search(self._text)\nif m:\n self.ql = int(m['ql'])\n self.user = m['user']\n self.header = m['header']\n if not m['has_div']:\n self._has_div = False\nelse:\n self.ql = ProofreadPage.NOT_PROOFREAD\n self.user = ''\n self.h...
<|body_start_0|> self._text = text or '' self._has_div = True m = self.p_header.search(self._text) if m: self.ql = int(m['ql']) self.user = m['user'] self.header = m['header'] if not m['has_div']: self._has_div = False ...
Header of a ProofreadPage object.
FullHeader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullHeader: """Header of a ProofreadPage object.""" def __init__(self, text: Optional[str]=None) -> None: """Initializer.""" <|body_0|> def __str__(self) -> str: """Return a string representation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_005272
47,197
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, text: Optional[str]=None) -> None" }, { "docstring": "Return a string representation.", "name": "__str__", "signature": "def __str__(self) -> str" } ]
2
stack_v2_sparse_classes_30k_train_043884
Implement the Python class `FullHeader` described below. Class description: Header of a ProofreadPage object. Method signatures and docstrings: - def __init__(self, text: Optional[str]=None) -> None: Initializer. - def __str__(self) -> str: Return a string representation.
Implement the Python class `FullHeader` described below. Class description: Header of a ProofreadPage object. Method signatures and docstrings: - def __init__(self, text: Optional[str]=None) -> None: Initializer. - def __str__(self) -> str: Return a string representation. <|skeleton|> class FullHeader: """Header...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class FullHeader: """Header of a ProofreadPage object.""" def __init__(self, text: Optional[str]=None) -> None: """Initializer.""" <|body_0|> def __str__(self) -> str: """Return a string representation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FullHeader: """Header of a ProofreadPage object.""" def __init__(self, text: Optional[str]=None) -> None: """Initializer.""" self._text = text or '' self._has_div = True m = self.p_header.search(self._text) if m: self.ql = int(m['ql']) self....
the_stack_v2_python_sparse
pywikibot/proofreadpage.py
wikimedia/pywikibot
train
432
9482528ae5d13310a590580fa3f2645bbda13f92
[ "try:\n firewallController = FirewallController()\n json_data = json.dumps(firewallController.get_firewall_status())\n resp = Response(json_data, status=200, mimetype='application/json')\n return resp\nexcept Exception as err:\n return Response(json.dumps(str(err)), status=500, mimetype='application/...
<|body_start_0|> try: firewallController = FirewallController() json_data = json.dumps(firewallController.get_firewall_status()) resp = Response(json_data, status=200, mimetype='application/json') return resp except Exception as err: return Res...
Firewall
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Firewall: def get(self): """Gets the status of the firewall""" <|body_0|> def put(self): """Update the firewall configuration""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: firewallController = FirewallController() json...
stack_v2_sparse_classes_75kplus_train_005273
1,569
no_license
[ { "docstring": "Gets the status of the firewall", "name": "get", "signature": "def get(self)" }, { "docstring": "Update the firewall configuration", "name": "put", "signature": "def put(self)" } ]
2
null
Implement the Python class `Firewall` described below. Class description: Implement the Firewall class. Method signatures and docstrings: - def get(self): Gets the status of the firewall - def put(self): Update the firewall configuration
Implement the Python class `Firewall` described below. Class description: Implement the Firewall class. Method signatures and docstrings: - def get(self): Gets the status of the firewall - def put(self): Update the firewall configuration <|skeleton|> class Firewall: def get(self): """Gets the status of ...
6070e3cb6bf957e04f5d8267db11f3296410e18e
<|skeleton|> class Firewall: def get(self): """Gets the status of the firewall""" <|body_0|> def put(self): """Update the firewall configuration""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Firewall: def get(self): """Gets the status of the firewall""" try: firewallController = FirewallController() json_data = json.dumps(firewallController.get_firewall_status()) resp = Response(json_data, status=200, mimetype='application/json') ret...
the_stack_v2_python_sparse
configuration-agent/firewall/rest_api/resources/firewall.py
ReliableLion/frog4-configurable-vnf
train
0
4f5c61086d75c0be7572563274275cd728a97f0b
[ "dx = qx - px\ndy = qy - py\ndz = qz - pz\nreturn math.sqrt(dx * dx + dy * dy + dz * dz)", "r_xy = math.sqrt(x * x + y * y)\nr_zx = math.sqrt(x * x + z * z)\nr_yz = math.sqrt(y * y + z * z)\nreturn [math.acos(z / r_zx), math.acos(y / r_yz), math.acos(x / r_xy)]" ]
<|body_start_0|> dx = qx - px dy = qy - py dz = qz - pz return math.sqrt(dx * dx + dy * dy + dz * dz) <|end_body_0|> <|body_start_1|> r_xy = math.sqrt(x * x + y * y) r_zx = math.sqrt(x * x + z * z) r_yz = math.sqrt(y * y + z * z) return [math.acos(z / r_z...
Geometry3D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geometry3D: def distance(px, py, pz, qx, qy, qz): """:param px: :param py: :param pz: :param qx: :param qy: :param qz: :return:""" <|body_0|> def getCosineFromSides(x, y, z): """:param x: :param y: :param z: :return:""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_005274
3,045
no_license
[ { "docstring": ":param px: :param py: :param pz: :param qx: :param qy: :param qz: :return:", "name": "distance", "signature": "def distance(px, py, pz, qx, qy, qz)" }, { "docstring": ":param x: :param y: :param z: :return:", "name": "getCosineFromSides", "signature": "def getCosineFromSi...
2
stack_v2_sparse_classes_30k_train_009454
Implement the Python class `Geometry3D` described below. Class description: Implement the Geometry3D class. Method signatures and docstrings: - def distance(px, py, pz, qx, qy, qz): :param px: :param py: :param pz: :param qx: :param qy: :param qz: :return: - def getCosineFromSides(x, y, z): :param x: :param y: :param...
Implement the Python class `Geometry3D` described below. Class description: Implement the Geometry3D class. Method signatures and docstrings: - def distance(px, py, pz, qx, qy, qz): :param px: :param py: :param pz: :param qx: :param qy: :param qz: :return: - def getCosineFromSides(x, y, z): :param x: :param y: :param...
282078dee659934d5342bc8251265cdf135fd614
<|skeleton|> class Geometry3D: def distance(px, py, pz, qx, qy, qz): """:param px: :param py: :param pz: :param qx: :param qy: :param qz: :return:""" <|body_0|> def getCosineFromSides(x, y, z): """:param x: :param y: :param z: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Geometry3D: def distance(px, py, pz, qx, qy, qz): """:param px: :param py: :param pz: :param qx: :param qy: :param qz: :return:""" dx = qx - px dy = qy - py dz = qz - pz return math.sqrt(dx * dx + dy * dy + dz * dz) def getCosineFromSides(x, y, z): """:para...
the_stack_v2_python_sparse
dataset/geometry.py
davidespano/deictic
train
2
649f14f2128fac4ae29ce929f9d5403ea407f5af
[ "super().__init__(*args, **kw)\nnew_order = self.fields.keyOrder[:-2]\nnew_order.insert(0, 'first_name')\nnew_order.insert(1, 'last_name')\nself.fields.keyOrder = new_order", "new_user = super().save()\nnew_user.first_name = self.cleaned_data['first_name']\nnew_user.last_name = self.cleaned_data['last_name']\nnew...
<|body_start_0|> super().__init__(*args, **kw) new_order = self.fields.keyOrder[:-2] new_order.insert(0, 'first_name') new_order.insert(1, 'last_name') self.fields.keyOrder = new_order <|end_body_0|> <|body_start_1|> new_user = super().save() new_user.first_name ...
A form to demonstrate how to add extra fields to the signup form, in this case adding the first and last name.
SignupFormExtra
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignupFormExtra: """A form to demonstrate how to add extra fields to the signup form, in this case adding the first and last name.""" def __init__(self, *args, **kw): """A bit of hackery to get the first name and last name at the top of the form instead at the end.""" <|body_...
stack_v2_sparse_classes_75kplus_train_005275
1,422
permissive
[ { "docstring": "A bit of hackery to get the first name and last name at the top of the form instead at the end.", "name": "__init__", "signature": "def __init__(self, *args, **kw)" }, { "docstring": "Override the save method to save the first and last name to the user field.", "name": "save"...
2
null
Implement the Python class `SignupFormExtra` described below. Class description: A form to demonstrate how to add extra fields to the signup form, in this case adding the first and last name. Method signatures and docstrings: - def __init__(self, *args, **kw): A bit of hackery to get the first name and last name at t...
Implement the Python class `SignupFormExtra` described below. Class description: A form to demonstrate how to add extra fields to the signup form, in this case adding the first and last name. Method signatures and docstrings: - def __init__(self, *args, **kw): A bit of hackery to get the first name and last name at t...
6d995f8d3ebf386ff265b2d442126d97d4ac11e9
<|skeleton|> class SignupFormExtra: """A form to demonstrate how to add extra fields to the signup form, in this case adding the first and last name.""" def __init__(self, *args, **kw): """A bit of hackery to get the first name and last name at the top of the form instead at the end.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignupFormExtra: """A form to demonstrate how to add extra fields to the signup form, in this case adding the first and last name.""" def __init__(self, *args, **kw): """A bit of hackery to get the first name and last name at the top of the form instead at the end.""" super().__init__(*ar...
the_stack_v2_python_sparse
demo/profiles/forms.py
django-userena-ce/django-userena-ce
train
92
707aef503547fc51c6b2fb2e8bff1d3cb6419ff3
[ "super().__init__(hass=hass, logger=_LOGGER, name=name, update_interval=timedelta(minutes=5))\nself.api = api\nself.name = name\nself.latitude = int(latitude)\nself.longitude = int(longitude)\nself.threshold = int(threshold)", "try:\n return await self.api.get_forecast_data(self.longitude, self.latitude)\nexce...
<|body_start_0|> super().__init__(hass=hass, logger=_LOGGER, name=name, update_interval=timedelta(minutes=5)) self.api = api self.name = name self.latitude = int(latitude) self.longitude = int(longitude) self.threshold = int(threshold) <|end_body_0|> <|body_start_1|> ...
Class to manage fetching data from the NOAA Aurora API.
AuroraDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuroraDataUpdateCoordinator: """Class to manage fetching data from the NOAA Aurora API.""" def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None: """Initialize the data updater.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_005276
1,334
permissive
[ { "docstring": "Initialize the data updater.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None" }, { "docstring": "Fetch the data from the NOAA Aurora Forecast.", "name": "_...
2
stack_v2_sparse_classes_30k_val_000082
Implement the Python class `AuroraDataUpdateCoordinator` described below. Class description: Class to manage fetching data from the NOAA Aurora API. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None:...
Implement the Python class `AuroraDataUpdateCoordinator` described below. Class description: Class to manage fetching data from the NOAA Aurora API. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None:...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AuroraDataUpdateCoordinator: """Class to manage fetching data from the NOAA Aurora API.""" def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None: """Initialize the data updater.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuroraDataUpdateCoordinator: """Class to manage fetching data from the NOAA Aurora API.""" def __init__(self, hass: HomeAssistant, name: str, api: AuroraForecast, latitude: float, longitude: float, threshold: float) -> None: """Initialize the data updater.""" super().__init__(hass=hass, l...
the_stack_v2_python_sparse
homeassistant/components/aurora/coordinator.py
home-assistant/core
train
35,501
ff58b243200814d2a8a2b1eee600fe020abc9039
[ "self.lightmap = rgb_lightmap\nself.color_balance = color_balance\nself.brightness = brightness", "if self.color_balance:\n new_rgb = gray_world(image)\nelse:\n new_rgb = image\nreturn new_rgb / self.lightmap * self.lightmap.ptp() * self.brightness" ]
<|body_start_0|> self.lightmap = rgb_lightmap self.color_balance = color_balance self.brightness = brightness <|end_body_0|> <|body_start_1|> if self.color_balance: new_rgb = gray_world(image) else: new_rgb = image return new_rgb / self.lightmap *...
Given a lightmap computed by LearnLightmap(raw=False), correct new images.
CorrectRgb
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrectRgb: """Given a lightmap computed by LearnLightmap(raw=False), correct new images.""" def __init__(self, rgb_lightmap, color_balance=False, brightness=1.0): """Parameters ---------- rgb_lightmap : ndarray RGB lightmap returned from average_image in LearnLightmap color_balance ...
stack_v2_sparse_classes_75kplus_train_005277
7,263
no_license
[ { "docstring": "Parameters ---------- rgb_lightmap : ndarray RGB lightmap returned from average_image in LearnLightmap color_balance : boolean Whether to apply gray world color balancing to corrected images brightness : float How much to scale brightness. 1.0 means not to brighten.", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_005218
Implement the Python class `CorrectRgb` described below. Class description: Given a lightmap computed by LearnLightmap(raw=False), correct new images. Method signatures and docstrings: - def __init__(self, rgb_lightmap, color_balance=False, brightness=1.0): Parameters ---------- rgb_lightmap : ndarray RGB lightmap re...
Implement the Python class `CorrectRgb` described below. Class description: Given a lightmap computed by LearnLightmap(raw=False), correct new images. Method signatures and docstrings: - def __init__(self, rgb_lightmap, color_balance=False, brightness=1.0): Parameters ---------- rgb_lightmap : ndarray RGB lightmap re...
49d5f9dbd1675cf2c336dbb7df9c8195d087a3b1
<|skeleton|> class CorrectRgb: """Given a lightmap computed by LearnLightmap(raw=False), correct new images.""" def __init__(self, rgb_lightmap, color_balance=False, brightness=1.0): """Parameters ---------- rgb_lightmap : ndarray RGB lightmap returned from average_image in LearnLightmap color_balance ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CorrectRgb: """Given a lightmap computed by LearnLightmap(raw=False), correct new images.""" def __init__(self, rgb_lightmap, color_balance=False, brightness=1.0): """Parameters ---------- rgb_lightmap : ndarray RGB lightmap returned from average_image in LearnLightmap color_balance : boolean Whe...
the_stack_v2_python_sparse
image/lightmap.py
joefutrelle/oii
train
5
084457662be19fa87d2cc684957f2775cb8e1c20
[ "self.ref = defaults['ref']\nself.protocol = defaults['protocol']\nself.remote = defaults['remote']\nself.source = defaults['source']\nself.depth = defaults.get('depth', 0)\nself.recursive = defaults.get('recursive', False)\nself.timestamp_author = defaults.get('timestamp_author', None)", "defaults = {'ref': self...
<|body_start_0|> self.ref = defaults['ref'] self.protocol = defaults['protocol'] self.remote = defaults['remote'] self.source = defaults['source'] self.depth = defaults.get('depth', 0) self.recursive = defaults.get('recursive', False) self.timestamp_author = defau...
clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: Default timestamp author
Defaults
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Defaults: """clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: D...
stack_v2_sparse_classes_75kplus_train_005278
1,522
permissive
[ { "docstring": "Defaults __init__ :param dict defaults: Parsed YAML python object for defaults", "name": "__init__", "signature": "def __init__(self, defaults)" }, { "docstring": "Return python object representation for saving yaml :return: YAML python object :rtype: dict", "name": "get_yaml...
2
stack_v2_sparse_classes_30k_train_020000
Implement the Python class `Defaults` described below. Class description: clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recurs...
Implement the Python class `Defaults` described below. Class description: clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recurs...
5e3920a386229cb143271655d5046dfda2ea3009
<|skeleton|> class Defaults: """clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: D...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Defaults: """clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: Default timest...
the_stack_v2_python_sparse
src/clowder/model/defaults.py
reidab/clowder
train
0
6f9200e6eac1ba1940a7c116e45a2559e0964547
[ "account = db().query(RedHatAccount).first()\nif not account:\n raise web.notfound()\nreturn self.render(account)", "data = self.checked_data()\nlicense_type = data.get('license_type')\nif license_type == 'rhsm':\n data['satellite'] = ''\n data['activation_key'] = ''\nrelease_id = data.pop('release_id')\...
<|body_start_0|> account = db().query(RedHatAccount).first() if not account: raise web.notfound() return self.render(account) <|end_body_0|> <|body_start_1|> data = self.checked_data() license_type = data.get('license_type') if license_type == 'rhsm': ...
Red Hat account handler
RedHatAccountHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedHatAccountHandler: """Red Hat account handler""" def GET(self): """:returns: JSONized RedHatAccount object. :http: * 200 (OK) * 404 (account not found in db)""" <|body_0|> def POST(self): """:returns: JSONized RedHatAccount object. :http: * 200 (OK) * 400 (inv...
stack_v2_sparse_classes_75kplus_train_005279
4,410
no_license
[ { "docstring": ":returns: JSONized RedHatAccount object. :http: * 200 (OK) * 404 (account not found in db)", "name": "GET", "signature": "def GET(self)" }, { "docstring": ":returns: JSONized RedHatAccount object. :http: * 200 (OK) * 400 (invalid account data specified) * 404 (account not found i...
2
stack_v2_sparse_classes_30k_train_019717
Implement the Python class `RedHatAccountHandler` described below. Class description: Red Hat account handler Method signatures and docstrings: - def GET(self): :returns: JSONized RedHatAccount object. :http: * 200 (OK) * 404 (account not found in db) - def POST(self): :returns: JSONized RedHatAccount object. :http: ...
Implement the Python class `RedHatAccountHandler` described below. Class description: Red Hat account handler Method signatures and docstrings: - def GET(self): :returns: JSONized RedHatAccount object. :http: * 200 (OK) * 404 (account not found in db) - def POST(self): :returns: JSONized RedHatAccount object. :http: ...
64d5e511c5ceb0e2d18107012d73042ad1daa345
<|skeleton|> class RedHatAccountHandler: """Red Hat account handler""" def GET(self): """:returns: JSONized RedHatAccount object. :http: * 200 (OK) * 404 (account not found in db)""" <|body_0|> def POST(self): """:returns: JSONized RedHatAccount object. :http: * 200 (OK) * 400 (inv...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RedHatAccountHandler: """Red Hat account handler""" def GET(self): """:returns: JSONized RedHatAccount object. :http: * 200 (OK) * 404 (account not found in db)""" account = db().query(RedHatAccount).first() if not account: raise web.notfound() return self.rend...
the_stack_v2_python_sparse
nailgun/nailgun/api/handlers/redhat.py
loles/fuel-web
train
1
1e160c0eb462dff389be317cfb0be331dc19cb1c
[ "sensors = {}\nsensors_pattern = re.compile(u'sensor\\\\d')\nfor section in list(config_file.items(u'CpuTemp')):\n if sensors_pattern.search(section[0]):\n sensors[section[0]] = section[1]\ntemp_data = {}\nfor sensor_name, sensor_file in sensors.iteritems():\n try:\n with open(sensor_file) as sf...
<|body_start_0|> sensors = {} sensors_pattern = re.compile(u'sensor\\d') for section in list(config_file.items(u'CpuTemp')): if sensors_pattern.search(section[0]): sensors[section[0]] = section[1] temp_data = {} for sensor_name, sensor_file in sensors....
Super class for everything. Many things inherit from here.
CpuTemp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CpuTemp: """Super class for everything. Many things inherit from here.""" def get_data(config_file, log_tool): """Reading data from file.""" <|body_0|> def write_data(tab_name, cur_data, db_tool, log_tool): """Write data to database.""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_005280
7,018
no_license
[ { "docstring": "Reading data from file.", "name": "get_data", "signature": "def get_data(config_file, log_tool)" }, { "docstring": "Write data to database.", "name": "write_data", "signature": "def write_data(tab_name, cur_data, db_tool, log_tool)" }, { "docstring": "Reading data...
3
stack_v2_sparse_classes_30k_train_018478
Implement the Python class `CpuTemp` described below. Class description: Super class for everything. Many things inherit from here. Method signatures and docstrings: - def get_data(config_file, log_tool): Reading data from file. - def write_data(tab_name, cur_data, db_tool, log_tool): Write data to database. - def re...
Implement the Python class `CpuTemp` described below. Class description: Super class for everything. Many things inherit from here. Method signatures and docstrings: - def get_data(config_file, log_tool): Reading data from file. - def write_data(tab_name, cur_data, db_tool, log_tool): Write data to database. - def re...
7a83bb313decacbcaab3967576453acb8c380b38
<|skeleton|> class CpuTemp: """Super class for everything. Many things inherit from here.""" def get_data(config_file, log_tool): """Reading data from file.""" <|body_0|> def write_data(tab_name, cur_data, db_tool, log_tool): """Write data to database.""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CpuTemp: """Super class for everything. Many things inherit from here.""" def get_data(config_file, log_tool): """Reading data from file.""" sensors = {} sensors_pattern = re.compile(u'sensor\\d') for section in list(config_file.items(u'CpuTemp')): if sensors_p...
the_stack_v2_python_sparse
task_types/regular.py
kirimaks/data_plot
train
0
942a1b7180ca41a8a3f2996b4b7f16f2f4ff2ae7
[ "patient_id = data['patient_id']\npatient = Patient(data['patient'])\nanamnesis = Anamnesis(data['anamnesis'])\nrecord = Record(patient_id, patient, anamnesis)\nfilename = '{}.json'.format(str(random.randint(10000, 99999)))\nfilepath = os.path.join(os.getcwd(), self.DEFAULT_PATH_TO_PENDING_BLOCK, filename)\nwith op...
<|body_start_0|> patient_id = data['patient_id'] patient = Patient(data['patient']) anamnesis = Anamnesis(data['anamnesis']) record = Record(patient_id, patient, anamnesis) filename = '{}.json'.format(str(random.randint(10000, 99999))) filepath = os.path.join(os.getcwd(),...
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" <|body_0|> def get(self, id): """Mengambil data berdasarkan ID yang ada""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_005281
1,571
no_license
[ { "docstring": "Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis", "name": "add", "signature": "def add(self, data)" }, { "docstring": "Mengambil data berdasarkan ID yang ada", "name": "get", "signature": "...
3
stack_v2_sparse_classes_30k_train_051962
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def add(self, data): Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis - def get(self, id): M...
Implement the Python class `Controller` described below. Class description: Implement the Controller class. Method signatures and docstrings: - def add(self, data): Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis - def get(self, id): M...
8e55e77f6a89e0e4fef60da38c318fcf97b551a3
<|skeleton|> class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" <|body_0|> def get(self, id): """Mengambil data berdasarkan ID yang ada""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Controller: def add(self, data): """Data akan ditambahkan ke folder pending sebelum dibuat menjadi satu blok utuh Data terdiri dari 2 class yaitu : Patient, Anamnesis""" patient_id = data['patient_id'] patient = Patient(data['patient']) anamnesis = Anamnesis(data['anamnesis']) ...
the_stack_v2_python_sparse
Distributed/Puskesmas Manado/Data/components/Controller.py
chlengkey/medchain-peer
train
0
45c0a718863957d132d0d995ce1a180b824e8502
[ "self.list_error = []\nself.sql = SQL()\nself.db_ml = current_app.config.get('DB_ML')", "self.sql.sql_connect(self.db_ml)\nsql_statement = 'SELECT mtype.model FROM tbl_dataset_entity mid INNER JOIN tbl_model_type mtype ON mid.model_type = mtype.id_model WHERE mid.id_entity=%s'\nargs = id_entity\nresponse = self.s...
<|body_start_0|> self.list_error = [] self.sql = SQL() self.db_ml = current_app.config.get('DB_ML') <|end_body_0|> <|body_start_1|> self.sql.sql_connect(self.db_ml) sql_statement = 'SELECT mtype.model FROM tbl_dataset_entity mid INNER JOIN tbl_model_type mtype ON mid.model_type ...
@Retrieve_Model_Type Note: this class explicitly inherits the 'new-style' class.
Retrieve_Model_Type
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Retrieve_Model_Type: """@Retrieve_Model_Type Note: this class explicitly inherits the 'new-style' class.""" def __init__(self): """@__init__ This constructor is responsible for defining class variables.""" <|body_0|> def get_model_type(self, id_entity): """@get_t...
stack_v2_sparse_classes_75kplus_train_005282
1,773
permissive
[ { "docstring": "@__init__ This constructor is responsible for defining class variables.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "@get_title This method is responsible for retrieving the model type, from the SQL database, using a fixed 'model_id'. @id_entity, thi...
2
stack_v2_sparse_classes_30k_train_049356
Implement the Python class `Retrieve_Model_Type` described below. Class description: @Retrieve_Model_Type Note: this class explicitly inherits the 'new-style' class. Method signatures and docstrings: - def __init__(self): @__init__ This constructor is responsible for defining class variables. - def get_model_type(sel...
Implement the Python class `Retrieve_Model_Type` described below. Class description: @Retrieve_Model_Type Note: this class explicitly inherits the 'new-style' class. Method signatures and docstrings: - def __init__(self): @__init__ This constructor is responsible for defining class variables. - def get_model_type(sel...
576ffee48f36e2594855259eb4215070c6d1e18f
<|skeleton|> class Retrieve_Model_Type: """@Retrieve_Model_Type Note: this class explicitly inherits the 'new-style' class.""" def __init__(self): """@__init__ This constructor is responsible for defining class variables.""" <|body_0|> def get_model_type(self, id_entity): """@get_t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Retrieve_Model_Type: """@Retrieve_Model_Type Note: this class explicitly inherits the 'new-style' class.""" def __init__(self): """@__init__ This constructor is responsible for defining class variables.""" self.list_error = [] self.sql = SQL() self.db_ml = current_app.conf...
the_stack_v2_python_sparse
brain/database/retrieve_model_type.py
datadave/machine-learning
train
1
7fb2592690a9344ff820b7fc53060662577c7baf
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConnectionOperation()", "from ..entity import Entity\nfrom ..public_error import PublicError\nfrom .connection_operation_status import ConnectionOperationStatus\nfrom ..entity import Entity\nfrom ..public_error import PublicError\nfrom...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ConnectionOperation() <|end_body_0|> <|body_start_1|> from ..entity import Entity from ..public_error import PublicError from .connection_operation_status import ConnectionOperat...
ConnectionOperation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnectionOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: """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...
stack_v2_sparse_classes_75kplus_train_005283
2,757
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: ConnectionOperation", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_007561
Implement the Python class `ConnectionOperation` described below. Class description: Implement the ConnectionOperation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: Creates a new instance of the appropriate class based on d...
Implement the Python class `ConnectionOperation` described below. Class description: Implement the ConnectionOperation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ConnectionOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: """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...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConnectionOperation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: """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: ...
the_stack_v2_python_sparse
msgraph/generated/models/external_connectors/connection_operation.py
microsoftgraph/msgraph-sdk-python
train
135
bac4db69a0f7a82e0e142a7c49319c49344a5886
[ "me = request.me\npk = request.data.get('id')\ntry:\n pk = int(pk)\nexcept:\n return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA)\narticle = Article.objects.filter(pk=pk, is_deleted=False).first()\nif article is None:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\nif artic...
<|body_start_0|> me = request.me pk = request.data.get('id') try: pk = int(pk) except: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) article = Article.objects.filter(pk=pk, is_deleted=False).first() if article is None: ...
DraftView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" <|body_0|> def get(self, request): """查看本人的所有草稿,可分页""" <|body_1|> <|end_skeleton|> <|body_start_0|> me = request.me pk = request.data.get('id') try: pk = int(pk)...
stack_v2_sparse_classes_75kplus_train_005284
8,733
no_license
[ { "docstring": "发表草稿,不需要内容数据,节省资源", "name": "post", "signature": "def post(self, request)" }, { "docstring": "查看本人的所有草稿,可分页", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_034820
Implement the Python class `DraftView` described below. Class description: Implement the DraftView class. Method signatures and docstrings: - def post(self, request): 发表草稿,不需要内容数据,节省资源 - def get(self, request): 查看本人的所有草稿,可分页
Implement the Python class `DraftView` described below. Class description: Implement the DraftView class. Method signatures and docstrings: - def post(self, request): 发表草稿,不需要内容数据,节省资源 - def get(self, request): 查看本人的所有草稿,可分页 <|skeleton|> class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" ...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" <|body_0|> def get(self, request): """查看本人的所有草稿,可分页""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DraftView: def post(self, request): """发表草稿,不需要内容数据,节省资源""" me = request.me pk = request.data.get('id') try: pk = int(pk) except: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) article = Article.objects.filter(pk=pk...
the_stack_v2_python_sparse
apps/articles_v2/views.py
Slowhalfframe/fanyijiang-API
train
0
c45493bda1bccf04b4e6a9d4b3e96b093b7eddb9
[ "if isinstance(part, PermutationGroupElement) and part.parent() is group:\n elt = part\n part = sorted([len(x) for x in part.cycle_tuples(True)], reverse=True)\nelse:\n elt = default_representative(part, group)\nSymmetricGroupConjugacyClassMixin.__init__(self, group.domain(), part)\nConjugacyClassGAP.__ini...
<|body_start_0|> if isinstance(part, PermutationGroupElement) and part.parent() is group: elt = part part = sorted([len(x) for x in part.cycle_tuples(True)], reverse=True) else: elt = default_representative(part, group) SymmetricGroupConjugacyClassMixin.__init...
A conjugacy class of the symmetric group. INPUT: - ``group`` -- the symmetric group - ``part`` -- a partition or an element of ``group``
SymmetricGroupConjugacyClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SymmetricGroupConjugacyClass: """A conjugacy class of the symmetric group. INPUT: - ``group`` -- the symmetric group - ``part`` -- a partition or an element of ``group``""" def __init__(self, group, part): """Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1...
stack_v2_sparse_classes_75kplus_train_005285
10,400
no_license
[ { "docstring": "Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1,2), (3,4,5)]) sage: C = G.conjugacy_class(g) sage: TestSuite(C).run() sage: C = G.conjugacy_class(Partition([3,2])) sage: TestSuite(C).run()", "name": "__init__", "signature": "def __init__(self, group, part)" ...
3
stack_v2_sparse_classes_30k_train_015271
Implement the Python class `SymmetricGroupConjugacyClass` described below. Class description: A conjugacy class of the symmetric group. INPUT: - ``group`` -- the symmetric group - ``part`` -- a partition or an element of ``group`` Method signatures and docstrings: - def __init__(self, group, part): Initialize ``self`...
Implement the Python class `SymmetricGroupConjugacyClass` described below. Class description: A conjugacy class of the symmetric group. INPUT: - ``group`` -- the symmetric group - ``part`` -- a partition or an element of ``group`` Method signatures and docstrings: - def __init__(self, group, part): Initialize ``self`...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class SymmetricGroupConjugacyClass: """A conjugacy class of the symmetric group. INPUT: - ``group`` -- the symmetric group - ``part`` -- a partition or an element of ``group``""" def __init__(self, group, part): """Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SymmetricGroupConjugacyClass: """A conjugacy class of the symmetric group. INPUT: - ``group`` -- the symmetric group - ``part`` -- a partition or an element of ``group``""" def __init__(self, group, part): """Initialize ``self``. EXAMPLES:: sage: G = SymmetricGroup(5) sage: g = G([(1,2), (3,4,5)]...
the_stack_v2_python_sparse
sage/src/sage/groups/perm_gps/symgp_conjugacy_class.py
bopopescu/geosci
train
0
2ae7cb7e76b6649329923ea8cb66340cca1753fb
[ "args, kw = parse_args(content)\nself.macroid = str(kw.get('macroid')) or '1'\nself.macroargs = args\nfor k in kw.keys():\n kw[k] = kw[k].replace('$user', req.authname)\nself.macrokw = kw\nself.const = PPConstant\nself.tracenv = env\nself.tracreq = req\nself.conf = PPConfiguration(env)\nself.cache = ppFSFileCach...
<|body_start_0|> args, kw = parse_args(content) self.macroid = str(kw.get('macroid')) or '1' self.macroargs = args for k in kw.keys(): kw[k] = kw[k].replace('$user', req.authname) self.macrokw = kw self.const = PPConstant self.tracenv = env sel...
Project Plan Environment containing references and so on, for most used objects and values like macro arguments, trac environment and request...
PPEnv
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PPEnv: """Project Plan Environment containing references and so on, for most used objects and values like macro arguments, trac environment and request...""" def __init__(self, env, req, content): """Initialize the Envoironment""" <|body_0|> def get_args(self, argname): ...
stack_v2_sparse_classes_75kplus_train_005286
33,028
permissive
[ { "docstring": "Initialize the Envoironment", "name": "__init__", "signature": "def __init__(self, env, req, content)" }, { "docstring": "get http url parameter", "name": "get_args", "signature": "def get_args(self, argname)" }, { "docstring": "check existence of http url paramet...
5
null
Implement the Python class `PPEnv` described below. Class description: Project Plan Environment containing references and so on, for most used objects and values like macro arguments, trac environment and request... Method signatures and docstrings: - def __init__(self, env, req, content): Initialize the Envoironment...
Implement the Python class `PPEnv` described below. Class description: Project Plan Environment containing references and so on, for most used objects and values like macro arguments, trac environment and request... Method signatures and docstrings: - def __init__(self, env, req, content): Initialize the Envoironment...
9ea0210f6b88f135ef73f370b48127af0495b2d7
<|skeleton|> class PPEnv: """Project Plan Environment containing references and so on, for most used objects and values like macro arguments, trac environment and request...""" def __init__(self, env, req, content): """Initialize the Envoironment""" <|body_0|> def get_args(self, argname): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PPEnv: """Project Plan Environment containing references and so on, for most used objects and values like macro arguments, trac environment and request...""" def __init__(self, env, req, content): """Initialize the Envoironment""" args, kw = parse_args(content) self.macroid = str(...
the_stack_v2_python_sparse
trac/Lib/site-packages/projectplan-0.93.0-py2.7-patched.egg/projectplan/ppenv.py
thinkbase/PortableTrac
train
2
e28391d7c4b82a0a3918dd79eef43426b5a34cf0
[ "self.mean_dim = state_dim\nself.variance_bound = variance_bound\nself.predicts_delta = predicts_delta\nlayers = [state_dim + action_dim] + hidden_layers + [state_dim * 2]\nsuper(ProbabilisticEnvironmentModel, self).__init__(layers, activations, batch_norm)\nself.softplus = torch.nn.Softplus()\nself.propagate_proba...
<|body_start_0|> self.mean_dim = state_dim self.variance_bound = variance_bound self.predicts_delta = predicts_delta layers = [state_dim + action_dim] + hidden_layers + [state_dim * 2] super(ProbabilisticEnvironmentModel, self).__init__(layers, activations, batch_norm) se...
ProbabilisticEnvironmentModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProbabilisticEnvironmentModel: def __init__(self, state_dim, action_dim, hidden_layers, activations, variance_bound=[1e-05, 0.5], batch_norm=True, predicts_delta=True, propagate_probabilistic=True): """A neural network parameterized to model an OpenAI Gym environemnt. Also outputs the di...
stack_v2_sparse_classes_75kplus_train_005287
21,063
no_license
[ { "docstring": "A neural network parameterized to model an OpenAI Gym environemnt. Also outputs the diagonal covariance of the prediction. This means the output layer will be of format [mean:variance]. :param state_dim: dimension of the environments state space :param action_dim: dimension of the environments a...
3
null
Implement the Python class `ProbabilisticEnvironmentModel` described below. Class description: Implement the ProbabilisticEnvironmentModel class. Method signatures and docstrings: - def __init__(self, state_dim, action_dim, hidden_layers, activations, variance_bound=[1e-05, 0.5], batch_norm=True, predicts_delta=True,...
Implement the Python class `ProbabilisticEnvironmentModel` described below. Class description: Implement the ProbabilisticEnvironmentModel class. Method signatures and docstrings: - def __init__(self, state_dim, action_dim, hidden_layers, activations, variance_bound=[1e-05, 0.5], batch_norm=True, predicts_delta=True,...
ceeb196bde01592f9ec15f9e24d008a9395c65ea
<|skeleton|> class ProbabilisticEnvironmentModel: def __init__(self, state_dim, action_dim, hidden_layers, activations, variance_bound=[1e-05, 0.5], batch_norm=True, predicts_delta=True, propagate_probabilistic=True): """A neural network parameterized to model an OpenAI Gym environemnt. Also outputs the di...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProbabilisticEnvironmentModel: def __init__(self, state_dim, action_dim, hidden_layers, activations, variance_bound=[1e-05, 0.5], batch_norm=True, predicts_delta=True, propagate_probabilistic=True): """A neural network parameterized to model an OpenAI Gym environemnt. Also outputs the diagonal covaria...
the_stack_v2_python_sparse
src/algorithm/MPC/model.py
al91liwo/pytorch-rl-lab
train
3
efb428d9486bdb290b34d883d07553d1290bad10
[ "numOfDec = 0\nfor i in range(-len(nums) + 1, len(nums)):\n if nums[i] < nums[i - 1]:\n numOfDec += 1\nreturn numOfDec <= 2", "numOfDec = 0\nfor i in range(len(nums)):\n if nums[i - 1] > nums[i]:\n numOfDec += 1\nreturn numOfDec < 2" ]
<|body_start_0|> numOfDec = 0 for i in range(-len(nums) + 1, len(nums)): if nums[i] < nums[i - 1]: numOfDec += 1 return numOfDec <= 2 <|end_body_0|> <|body_start_1|> numOfDec = 0 for i in range(len(nums)): if nums[i - 1] > nums[i]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def check(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def check2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> numOfDec = 0 for i in range(-len(nums) + 1, le...
stack_v2_sparse_classes_75kplus_train_005288
1,251
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "check", "signature": "def check(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "check2", "signature": "def check2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_053357
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def check(self, nums): :type nums: List[int] :rtype: bool - def check2(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def check(self, nums): :type nums: List[int] :rtype: bool - def check2(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def check(self, nums): ...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def check(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def check2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def check(self, nums): """:type nums: List[int] :rtype: bool""" numOfDec = 0 for i in range(-len(nums) + 1, len(nums)): if nums[i] < nums[i - 1]: numOfDec += 1 return numOfDec <= 2 def check2(self, nums): """:type nums: List[in...
the_stack_v2_python_sparse
0.LIST AND ARRAY/1752_check_if_arrayIs_sorted_and_rotated/solution.py
kimmyoo/python_leetcode
train
1
5de99a428b2d3fe48774d03cf04de9c0aae0c7f4
[ "self.data_list_name = data_list_name\nself.batch_call_func = batch_call_func\nself.get_config_dict_func = get_config_dict_func\nself.get_config_dict_args = get_config_dict_args or ()\nself.get_config_dict_kwargs = get_config_dict_kwargs or {}\nself.get_data = get_data\nself.extend_result = extend_result\nself.batc...
<|body_start_0|> self.data_list_name = data_list_name self.batch_call_func = batch_call_func self.get_config_dict_func = get_config_dict_func self.get_config_dict_args = get_config_dict_args or () self.get_config_dict_kwargs = get_config_dict_kwargs or {} self.get_data = ...
并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...
ConcurrentController
[ "MIT", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConcurrentController: """并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...""" def __init__(self, data_list_...
stack_v2_sparse_classes_75kplus_train_005289
6,948
permissive
[ { "docstring": ":param data_list_name: 待执行对象列表名称 :param batch_call_func: 批量执行方法,定义方式参考 batch_call :param get_config_dict_func: 获取配置方法 :param get_config_dict_args: 获取配置方法 位置参数 :param get_config_dict_kwargs: 获取配置方法 关键字参数 :param get_data: 对 batch_call_func 结果进行预处理 :param extend_result: 是否展开结果 :param batch_call_kwa...
3
stack_v2_sparse_classes_30k_train_049679
Implement the Python class `ConcurrentController` described below. Class description: 并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 .....
Implement the Python class `ConcurrentController` described below. Class description: 并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 .....
72d2104783443bff26c752c5bd934a013b302b6d
<|skeleton|> class ConcurrentController: """并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...""" def __init__(self, data_list_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConcurrentController: """并发控制器 功能:细粒度控制不同执行逻辑的单次并发量,将批量任务先按设置的单次并发限制数量进行分批,批次间选择并行或串行 背景: - 并发 ssh 连接问题 使用 paramiko 远程连接时发现,当任务量 > CONCURRENT_NUMBER 时,部分线程出现 self.chan.recv(RECV_BUFLEN) 超时的问题 经测试,如果需要下发多条命令,一次并发量 <= CONCURRENT_NUMBER 是安全的 - JOB 执行脚本接口调用限频 ...""" def __init__(self, data_list_name: str, ba...
the_stack_v2_python_sparse
apps/core/concurrent/controller.py
TencentBlueKing/bk-nodeman
train
54
3ed8ac44356e6851334db0d09f2395d2ed4f7d1c
[ "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...
ClaraServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClaraServicer: def Stop(self, request, context): """Requests the termination of Clara Platform Server and associated resource cleanup.""" <|body_0|> def Utilization(self, request, context): """Requests utilization data for all Clara Platform managed GPUs.""" ...
stack_v2_sparse_classes_75kplus_train_005290
4,175
permissive
[ { "docstring": "Requests the termination of Clara Platform Server and associated resource cleanup.", "name": "Stop", "signature": "def Stop(self, request, context)" }, { "docstring": "Requests utilization data for all Clara Platform managed GPUs.", "name": "Utilization", "signature": "de...
3
stack_v2_sparse_classes_30k_train_013545
Implement the Python class `ClaraServicer` described below. Class description: Implement the ClaraServicer class. Method signatures and docstrings: - def Stop(self, request, context): Requests the termination of Clara Platform Server and associated resource cleanup. - def Utilization(self, request, context): Requests...
Implement the Python class `ClaraServicer` described below. Class description: Implement the ClaraServicer class. Method signatures and docstrings: - def Stop(self, request, context): Requests the termination of Clara Platform Server and associated resource cleanup. - def Utilization(self, request, context): Requests...
0d2e328f238bbbe127023bc834e12811df6f4a27
<|skeleton|> class ClaraServicer: def Stop(self, request, context): """Requests the termination of Clara Platform Server and associated resource cleanup.""" <|body_0|> def Utilization(self, request, context): """Requests utilization data for all Clara Platform managed GPUs.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClaraServicer: def Stop(self, request, context): """Requests the termination of Clara Platform Server and associated resource cleanup.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not impleme...
the_stack_v2_python_sparse
nvidia_clara/grpc/clara_pb2_grpc.py
DeepHiveMind/clara-platform-python-client
train
2
6aee2e8a601e07c1a212a55f9ad5e6e9153fe014
[ "try:\n with open(filepath, 'rt', encoding='utf8') as fp:\n header = next(fp)\n return (header, fp.readlines())\nexcept:\n raise", "errorvalues = {}\nerrormessages = []\nerrorvalues['missingvalues'] = [headers[index] for index, datavalue in enumerate(datavalues) if len(datavalue) == 0]\nif len...
<|body_start_0|> try: with open(filepath, 'rt', encoding='utf8') as fp: header = next(fp) return (header, fp.readlines()) except: raise <|end_body_0|> <|body_start_1|> errorvalues = {} errormessages = [] errorvalues['missin...
OrderDetails
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderDetails: def readfromfile(self, filepath): """summary: Reads data from file :param filepath: filepath :return: (header,data)""" <|body_0|> def checkintegrity(self, headers, datavalues): """summary: Validates if there are any violation of business rules :param he...
stack_v2_sparse_classes_75kplus_train_005291
8,042
no_license
[ { "docstring": "summary: Reads data from file :param filepath: filepath :return: (header,data)", "name": "readfromfile", "signature": "def readfromfile(self, filepath)" }, { "docstring": "summary: Validates if there are any violation of business rules :param headers: list of headers :param datav...
6
null
Implement the Python class `OrderDetails` described below. Class description: Implement the OrderDetails class. Method signatures and docstrings: - def readfromfile(self, filepath): summary: Reads data from file :param filepath: filepath :return: (header,data) - def checkintegrity(self, headers, datavalues): summary:...
Implement the Python class `OrderDetails` described below. Class description: Implement the OrderDetails class. Method signatures and docstrings: - def readfromfile(self, filepath): summary: Reads data from file :param filepath: filepath :return: (header,data) - def checkintegrity(self, headers, datavalues): summary:...
f65ce10c9d4f320e3db446eabcee1e999a6f130f
<|skeleton|> class OrderDetails: def readfromfile(self, filepath): """summary: Reads data from file :param filepath: filepath :return: (header,data)""" <|body_0|> def checkintegrity(self, headers, datavalues): """summary: Validates if there are any violation of business rules :param he...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrderDetails: def readfromfile(self, filepath): """summary: Reads data from file :param filepath: filepath :return: (header,data)""" try: with open(filepath, 'rt', encoding='utf8') as fp: header = next(fp) return (header, fp.readlines()) exce...
the_stack_v2_python_sparse
Python/challenges/filetransformer/filetransformer.py
prathapreddy123/Projects
train
0
35106be8b6485ac465f3329e3c2507bbc4cf492a
[ "if mode == 'python':\n from .python.filters import filter_manager as filtermgr\n return filtermgr.register(name_or_filter)\n\ndef decorator(filterfunc):\n name = filterfunc.__name__\n name = [name]\n if name_or_filter and name_or_filter is not filterfunc:\n names = name_or_filter\n if ...
<|body_start_0|> if mode == 'python': from .python.filters import filter_manager as filtermgr return filtermgr.register(name_or_filter) def decorator(filterfunc): name = filterfunc.__name__ name = [name] if name_or_filter and name_or_filter is...
A manager for filters Attributes: INSTANCE: The instance of the class, since it's a signleton filters: The filters database
FilterManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterManager: """A manager for filters Attributes: INSTANCE: The instance of the class, since it's a signleton filters: The filters database""" def register(self, name_or_filter=None, mode='standard'): """Register a filter This can be used as a decorator >>> @filter_manager.register...
stack_v2_sparse_classes_75kplus_train_005292
9,877
permissive
[ { "docstring": "Register a filter This can be used as a decorator >>> @filter_manager.register >>> def add(a, b): >>> return a+b >>> # register it with an alias: >>> @filter_manager.register('addfunc') >>> def add(a, b): >>> return a+b Args: name_or_filter: The filter to register if name is given, will be treat...
2
stack_v2_sparse_classes_30k_train_037376
Implement the Python class `FilterManager` described below. Class description: A manager for filters Attributes: INSTANCE: The instance of the class, since it's a signleton filters: The filters database Method signatures and docstrings: - def register(self, name_or_filter=None, mode='standard'): Register a filter Thi...
Implement the Python class `FilterManager` described below. Class description: A manager for filters Attributes: INSTANCE: The instance of the class, since it's a signleton filters: The filters database Method signatures and docstrings: - def register(self, name_or_filter=None, mode='standard'): Register a filter Thi...
bf84d631a2ecab0c020ba883bf2a09042715f772
<|skeleton|> class FilterManager: """A manager for filters Attributes: INSTANCE: The instance of the class, since it's a signleton filters: The filters database""" def register(self, name_or_filter=None, mode='standard'): """Register a filter This can be used as a decorator >>> @filter_manager.register...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FilterManager: """A manager for filters Attributes: INSTANCE: The instance of the class, since it's a signleton filters: The filters database""" def register(self, name_or_filter=None, mode='standard'): """Register a filter This can be used as a decorator >>> @filter_manager.register >>> def add(...
the_stack_v2_python_sparse
liquid/filters.py
lingfromSh/liquidpy
train
0
233e464239c669c25b63d5d61222b39130ae3960
[ "code = '\\na = 9\\nb = 3\\n '\nattr = self.prepare(code, self.attr_name)\nself.assertEqual(attr, 0)\ncode = '\\na = 9\\nfor b in range(0, 10, 2):\\n b = a\\n '\nattr = self.prepare(code, self.attr_name)\nself.assertEqual(attr, 0)\ncode = '\\na = 9\\nfor b in range(0, a, 2):\\n b = a\\n '...
<|body_start_0|> code = '\na = 9\nb = 3\n ' attr = self.prepare(code, self.attr_name) self.assertEqual(attr, 0) code = '\na = 9\nfor b in range(0, 10, 2):\n b = a\n ' attr = self.prepare(code, self.attr_name) self.assertEqual(attr, 0) code = '\na ...
Test class for Reuse Values
TestReuseValues
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestReuseValues: """Test class for Reuse Values""" def test_noReuseValues(self): """Tests the correct results for codes which do not reuse values. Keyword arguments: self -- the TestReuseValues instance""" <|body_0|> def test_reuseValues(self): """Tests the corre...
stack_v2_sparse_classes_75kplus_train_005293
20,005
no_license
[ { "docstring": "Tests the correct results for codes which do not reuse values. Keyword arguments: self -- the TestReuseValues instance", "name": "test_noReuseValues", "signature": "def test_noReuseValues(self)" }, { "docstring": "Tests the correct results for codes which reuse values. Keyword ar...
2
stack_v2_sparse_classes_30k_train_045424
Implement the Python class `TestReuseValues` described below. Class description: Test class for Reuse Values Method signatures and docstrings: - def test_noReuseValues(self): Tests the correct results for codes which do not reuse values. Keyword arguments: self -- the TestReuseValues instance - def test_reuseValues(s...
Implement the Python class `TestReuseValues` described below. Class description: Test class for Reuse Values Method signatures and docstrings: - def test_noReuseValues(self): Tests the correct results for codes which do not reuse values. Keyword arguments: self -- the TestReuseValues instance - def test_reuseValues(s...
2c0b907f5d9e74265e87ab3e36753f764a965f21
<|skeleton|> class TestReuseValues: """Test class for Reuse Values""" def test_noReuseValues(self): """Tests the correct results for codes which do not reuse values. Keyword arguments: self -- the TestReuseValues instance""" <|body_0|> def test_reuseValues(self): """Tests the corre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestReuseValues: """Test class for Reuse Values""" def test_noReuseValues(self): """Tests the correct results for codes which do not reuse values. Keyword arguments: self -- the TestReuseValues instance""" code = '\na = 9\nb = 3\n ' attr = self.prepare(code, self.attr_name)...
the_stack_v2_python_sparse
AlgoBooster/ab_ui/ab_main/ab_unittests/test_extraction.py
danielaboeing/algobooster
train
0
e68d8224d27ac288fe8214277bc4635d7a0e3673
[ "self.logger.info('GET env=%s', env)\nargs = PARSER.parse_args(request)\ntime = args.get('time', None)\nsvc = RecorderService()\ntry:\n result = svc.load_session(env, time)\n self.logger.debug(result)\nexcept RecordingException as exc:\n api.abort(exc.http_status, exc.message)\nreturn result", "self.logg...
<|body_start_0|> self.logger.info('GET env=%s', env) args = PARSER.parse_args(request) time = args.get('time', None) svc = RecorderService() try: result = svc.load_session(env, time) self.logger.debug(result) except RecordingException as exc: ...
Recorder services management class.
Recorder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Recorder: """Recorder services management class.""" def get(self, env): """Get current recording session. Get informations about the current recording session :param env: Environement identifier :type env: string""" <|body_0|> def delete(self, env): """Stop a ses...
stack_v2_sparse_classes_75kplus_train_005294
4,646
no_license
[ { "docstring": "Get current recording session. Get informations about the current recording session :param env: Environement identifier :type env: string", "name": "get", "signature": "def get(self, env)" }, { "docstring": "Stop a session. Stop a data recording session :param env: Environement i...
3
stack_v2_sparse_classes_30k_train_013253
Implement the Python class `Recorder` described below. Class description: Recorder services management class. Method signatures and docstrings: - def get(self, env): Get current recording session. Get informations about the current recording session :param env: Environement identifier :type env: string - def delete(s...
Implement the Python class `Recorder` described below. Class description: Recorder services management class. Method signatures and docstrings: - def get(self, env): Get current recording session. Get informations about the current recording session :param env: Environement identifier :type env: string - def delete(s...
a872f095f256b0dd63d292301426f0a807c04abb
<|skeleton|> class Recorder: """Recorder services management class.""" def get(self, env): """Get current recording session. Get informations about the current recording session :param env: Environement identifier :type env: string""" <|body_0|> def delete(self, env): """Stop a ses...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Recorder: """Recorder services management class.""" def get(self, env): """Get current recording session. Get informations about the current recording session :param env: Environement identifier :type env: string""" self.logger.info('GET env=%s', env) args = PARSER.parse_args(requ...
the_stack_v2_python_sparse
recording-api/api/endpoints/recorder.py
bherard/energyrecorder
train
2
111aa98d6622e3212fdc5f6b86ea5b8495f43485
[ "data = JSONParser().parse(self.request)\nret = {'code': constant.BACKEND_CODE_OPT_FAIL, 'message': '创建数据收集器失败'}\ntry:\n DataCollector.objects.create(name=data['name'], ip=data['ip'], port=data['port'])\nexcept:\n print(traceback.format_exc())\n return JsonResponse(ret, safe=False)\nret = {'code': constant...
<|body_start_0|> data = JSONParser().parse(self.request) ret = {'code': constant.BACKEND_CODE_OPT_FAIL, 'message': '创建数据收集器失败'} try: DataCollector.objects.create(name=data['name'], ip=data['ip'], port=data['port']) except: print(traceback.format_exc()) ...
DataCollectorInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataCollectorInfo: def post(self, *args, **kwargs): """创建机房""" <|body_0|> def delete(self, *args, **kwargs): """删除数据收集器""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = JSONParser().parse(self.request) ret = {'code': constant.BACKEND_C...
stack_v2_sparse_classes_75kplus_train_005295
3,079
no_license
[ { "docstring": "创建机房", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "删除数据收集器", "name": "delete", "signature": "def delete(self, *args, **kwargs)" } ]
2
null
Implement the Python class `DataCollectorInfo` described below. Class description: Implement the DataCollectorInfo class. Method signatures and docstrings: - def post(self, *args, **kwargs): 创建机房 - def delete(self, *args, **kwargs): 删除数据收集器
Implement the Python class `DataCollectorInfo` described below. Class description: Implement the DataCollectorInfo class. Method signatures and docstrings: - def post(self, *args, **kwargs): 创建机房 - def delete(self, *args, **kwargs): 删除数据收集器 <|skeleton|> class DataCollectorInfo: def post(self, *args, **kwargs): ...
b7018a9357a7d71acd1cd5eb0b8e0f6dc8016a88
<|skeleton|> class DataCollectorInfo: def post(self, *args, **kwargs): """创建机房""" <|body_0|> def delete(self, *args, **kwargs): """删除数据收集器""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataCollectorInfo: def post(self, *args, **kwargs): """创建机房""" data = JSONParser().parse(self.request) ret = {'code': constant.BACKEND_CODE_OPT_FAIL, 'message': '创建数据收集器失败'} try: DataCollector.objects.create(name=data['name'], ip=data['ip'], port=data['port']) ...
the_stack_v2_python_sparse
monitor_api2/monitor_web/views/data_collector_view.py
evoup/monitor_pass
train
0
4f2b8cadb07cc05b2dbfd130a11d0a838afb5a42
[ "def getRoot(node):\n \"\"\"\n :param node: ListNode\n :ret: TreeNode\n \"\"\"\n if not node:\n return None\n head = node\n double_head = head.next.next if head and head.next else None\n prev = None\n while double_head:\n prev = head\n head = h...
<|body_start_0|> def getRoot(node): """ :param node: ListNode :ret: TreeNode """ if not node: return None head = node double_head = head.next.next if head and head.next else None ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: TreeNode 提中 recursive, 更快的方法為將 sigle linked list 轉為 array cache affinity, 快! 且為一個sorted array, 很快!""" <|...
stack_v2_sparse_classes_75kplus_train_005296
3,726
no_license
[ { "docstring": ":type head: ListNode :rtype: TreeNode", "name": "sortedListToBST", "signature": "def sortedListToBST(self, head)" }, { "docstring": ":type head: ListNode :rtype: TreeNode 提中 recursive, 更快的方法為將 sigle linked list 轉為 array cache affinity, 快! 且為一個sorted array, 很快!", "name": "rewr...
2
stack_v2_sparse_classes_30k_train_047334
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def rewrite(self, head): :type head: ListNode :rtype: TreeNode 提中 recursive, 更快的方法為將 sigle linked list 轉為...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedListToBST(self, head): :type head: ListNode :rtype: TreeNode - def rewrite(self, head): :type head: ListNode :rtype: TreeNode 提中 recursive, 更快的方法為將 sigle linked list 轉為...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: TreeNode 提中 recursive, 更快的方法為將 sigle linked list 轉為 array cache affinity, 快! 且為一個sorted array, 很快!""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sortedListToBST(self, head): """:type head: ListNode :rtype: TreeNode""" def getRoot(node): """ :param node: ListNode :ret: TreeNode """ if not node: return None head =...
the_stack_v2_python_sparse
co_fb/109_Convert_Sorted_List_to_Binary_Search_Tree.py
vsdrun/lc_public
train
6
58e20a7bc841922de93db80a3b22aeaa802e909d
[ "res = ''\nfactorial = [1] * (n + 1)\nfor i in range(1, n + 1):\n factorial[i] = factorial[i - 1] * i\nnums = [i for i in range(1, n + 1)]\nk -= 1\nfor i in range(1, n + 1):\n idx = k / factorial[n - i]\n res += str(nums[int(idx)])\n nums.pop(int(idx))\n k -= idx * factorial[n - i]\nreturn res", "d...
<|body_start_0|> res = '' factorial = [1] * (n + 1) for i in range(1, n + 1): factorial[i] = factorial[i - 1] * i nums = [i for i in range(1, n + 1)] k -= 1 for i in range(1, n + 1): idx = k / factorial[n - i] res += str(nums[int(idx)])...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getPermutation(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_0|> def getPermutation1(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = '' factorial = [...
stack_v2_sparse_classes_75kplus_train_005297
1,719
no_license
[ { "docstring": ":type n: int :type k: int :rtype: str", "name": "getPermutation", "signature": "def getPermutation(self, n, k)" }, { "docstring": ":type n: int :type k: int :rtype: str", "name": "getPermutation1", "signature": "def getPermutation1(self, n, k)" } ]
2
stack_v2_sparse_classes_30k_train_040210
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation(self, n, k): :type n: int :type k: int :rtype: str - def getPermutation1(self, n, k): :type n: int :type k: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation(self, n, k): :type n: int :type k: int :rtype: str - def getPermutation1(self, n, k): :type n: int :type k: int :rtype: str <|skeleton|> class Solution: ...
f1d780b7e8b91b4df704651514018143c6931f9d
<|skeleton|> class Solution: def getPermutation(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_0|> def getPermutation1(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getPermutation(self, n, k): """:type n: int :type k: int :rtype: str""" res = '' factorial = [1] * (n + 1) for i in range(1, n + 1): factorial[i] = factorial[i - 1] * i nums = [i for i in range(1, n + 1)] k -= 1 for i in range(1...
the_stack_v2_python_sparse
ProgramForLeetCode/LeetCode/60_getPermutation.py
DQDH/Algorithm_Code
train
0
bae85852f1822cb2bff1679970a0c7be33ae43b7
[ "indiv_preds = ((Role.VILLAGER, Role.SEER, Role.ROBBER),) * len(small_game_roles)\nplayer_list = tuple((Player(i) for i in range(len(small_game_roles))))\nresult = one_night.get_voting_result(player_list, indiv_preds)\nassert result == ((Role.VILLAGER, Role.SEER, Role.ROBBER), (0, 1, 2), (1, 2, 0))\nverify_output_s...
<|body_start_0|> indiv_preds = ((Role.VILLAGER, Role.SEER, Role.ROBBER),) * len(small_game_roles) player_list = tuple((Player(i) for i in range(len(small_game_roles)))) result = one_night.get_voting_result(player_list, indiv_preds) assert result == ((Role.VILLAGER, Role.SEER, Role.ROBBER...
Tests for the get_voting_result function.
TestGetVotingResult
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetVotingResult: """Tests for the get_voting_result function.""" def test_small_voting_result(caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...]) -> None: """Should get voting results from the individual predictions.""" <|body_0|> def test_medium_vo...
stack_v2_sparse_classes_75kplus_train_005298
11,902
permissive
[ { "docstring": "Should get voting results from the individual predictions.", "name": "test_small_voting_result", "signature": "def test_small_voting_result(caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...]) -> None" }, { "docstring": "Should get voting results from the individ...
3
null
Implement the Python class `TestGetVotingResult` described below. Class description: Tests for the get_voting_result function. Method signatures and docstrings: - def test_small_voting_result(caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...]) -> None: Should get voting results from the individual p...
Implement the Python class `TestGetVotingResult` described below. Class description: Tests for the get_voting_result function. Method signatures and docstrings: - def test_small_voting_result(caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...]) -> None: Should get voting results from the individual p...
6e91c2f24e72f9374c4f703bd966963ea6626e8e
<|skeleton|> class TestGetVotingResult: """Tests for the get_voting_result function.""" def test_small_voting_result(caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...]) -> None: """Should get voting results from the individual predictions.""" <|body_0|> def test_medium_vo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestGetVotingResult: """Tests for the get_voting_result function.""" def test_small_voting_result(caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...]) -> None: """Should get voting results from the individual predictions.""" indiv_preds = ((Role.VILLAGER, Role.SEER, Role....
the_stack_v2_python_sparse
unit_test/one_night_test.py
srijan-deepsource/wolfbot
train
0
1327b10fb1b913a43a4cee1e16e4c76b6be265b4
[ "source = 0\ntarge = 0\nlenOfSource = len(haystack)\nlenOfTarget = len(needle)\nwhile lenOfTarget + source <= lenOfSource:\n target = 0\n while target < lenOfTarget:\n if haystack[source + target] != needle[target]:\n break\n target += 1\n if target == lenOfTarget:\n return ...
<|body_start_0|> source = 0 targe = 0 lenOfSource = len(haystack) lenOfTarget = len(needle) while lenOfTarget + source <= lenOfSource: target = 0 while target < lenOfTarget: if haystack[source + target] != needle[target]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_1|> def strStr(self, haystack, needle): ...
stack_v2_sparse_classes_75kplus_train_005299
1,698
no_license
[ { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStr", "signature": "def strStr(self, haystack, needle)" }, { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStr", "signature": "def strStr(self, haystack, needle)" }, { ...
3
stack_v2_sparse_classes_30k_train_029381
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - de...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_1|> def strStr(self, haystack, needle): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" source = 0 targe = 0 lenOfSource = len(haystack) lenOfTarget = len(needle) while lenOfTarget + source <= lenOfSource: target = 0 while t...
the_stack_v2_python_sparse
Python_leetcode/28_strstr.py
xiangcao/Leetcode
train
0