blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
2c5b3255f2bc9fa3d96f5af3b5885f817ee45e34
[ "self._padding = padding\nself._padding_mode = padding_mode\nsuper(Pad1D, self).__init__(**kwargs)", "if self._padding_mode == 'zero':\n paddings = ((0, 0), self._padding, (0, 0))\n outputs = tf.pad(inputs, paddings)\nelif self._padding_mode == 'wrap':\n outputs = tf.concat([inputs[:, -self._padding[0]:,...
<|body_start_0|> self._padding = padding self._padding_mode = padding_mode super(Pad1D, self).__init__(**kwargs) <|end_body_0|> <|body_start_1|> if self._padding_mode == 'zero': paddings = ((0, 0), self._padding, (0, 0)) outputs = tf.pad(inputs, paddings) ...
Pads a (batch, size, channels) tensor.
Pad1D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pad1D: """Pads a (batch, size, channels) tensor.""" def __init__(self, padding, padding_mode, **kwargs): """Creates the padding layer. Args: padding: (pad_left, pad_right) pair. How many elements to add to both sides of the second dimension. If this is used for the very first layer o...
stack_v2_sparse_classes_10k_train_000900
14,886
permissive
[ { "docstring": "Creates the padding layer. Args: padding: (pad_left, pad_right) pair. How many elements to add to both sides of the second dimension. If this is used for the very first layer of the feelers CNN, this can be thought as the number of feeler entries to add before the first feeler entry and after th...
2
stack_v2_sparse_classes_30k_train_000552
Implement the Python class `Pad1D` described below. Class description: Pads a (batch, size, channels) tensor. Method signatures and docstrings: - def __init__(self, padding, padding_mode, **kwargs): Creates the padding layer. Args: padding: (pad_left, pad_right) pair. How many elements to add to both sides of the sec...
Implement the Python class `Pad1D` described below. Class description: Pads a (batch, size, channels) tensor. Method signatures and docstrings: - def __init__(self, padding, padding_mode, **kwargs): Creates the padding layer. Args: padding: (pad_left, pad_right) pair. How many elements to add to both sides of the sec...
26ab377a6853463b2efce40970e54d44b91e79ca
<|skeleton|> class Pad1D: """Pads a (batch, size, channels) tensor.""" def __init__(self, padding, padding_mode, **kwargs): """Creates the padding layer. Args: padding: (pad_left, pad_right) pair. How many elements to add to both sides of the second dimension. If this is used for the very first layer o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pad1D: """Pads a (batch, size, channels) tensor.""" def __init__(self, padding, padding_mode, **kwargs): """Creates the padding layer. Args: padding: (pad_left, pad_right) pair. How many elements to add to both sides of the second dimension. If this is used for the very first layer of the feelers...
the_stack_v2_python_sparse
service/learner/brains/layers.py
stewartmiles/falken
train
1
2b750661653a1e7d68e28546e0072acf8668062e
[ "if not maze or not maze[0]:\n return False\nm, n = (len(maze), len(maze[0]))\nk = len(self.DOORS)\nkeys = [0] * k\nhas_gold = False\nqueue = []\ndoors = [None] * k\nholds = [0] * k\nvisited = set()\nfor x in range(m):\n for y in range(n):\n if maze[x][y] == self.START:\n queue.append((x, y)...
<|body_start_0|> if not maze or not maze[0]: return False m, n = (len(maze), len(maze[0])) k = len(self.DOORS) keys = [0] * k has_gold = False queue = [] doors = [None] * k holds = [0] * k visited = set() for x in range(m): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_treasure_in_maze(self, maze): """:type maze: list[str] :rtype: bool""" <|body_0|> def bfs(self, maze, queue, keys, holds, doors, visited): """return True if got gold, otherwise False :type maze: list[str] :type queue: list[tuple[int]] :type keys: l...
stack_v2_sparse_classes_10k_train_000901
4,626
no_license
[ { "docstring": ":type maze: list[str] :rtype: bool", "name": "find_treasure_in_maze", "signature": "def find_treasure_in_maze(self, maze)" }, { "docstring": "return True if got gold, otherwise False :type maze: list[str] :type queue: list[tuple[int]] :type keys: list[int] :type holds: list[int] ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_treasure_in_maze(self, maze): :type maze: list[str] :rtype: bool - def bfs(self, maze, queue, keys, holds, doors, visited): return True if got gold, otherwise False :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_treasure_in_maze(self, maze): :type maze: list[str] :rtype: bool - def bfs(self, maze, queue, keys, holds, doors, visited): return True if got gold, otherwise False :typ...
91892fd64281d96b8a9d5c0d57b938c314ae71be
<|skeleton|> class Solution: def find_treasure_in_maze(self, maze): """:type maze: list[str] :rtype: bool""" <|body_0|> def bfs(self, maze, queue, keys, holds, doors, visited): """return True if got gold, otherwise False :type maze: list[str] :type queue: list[tuple[int]] :type keys: l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def find_treasure_in_maze(self, maze): """:type maze: list[str] :rtype: bool""" if not maze or not maze[0]: return False m, n = (len(maze), len(maze[0])) k = len(self.DOORS) keys = [0] * k has_gold = False queue = [] doors =...
the_stack_v2_python_sparse
other/find_treasure_in_maze.py
jaychsu/algorithm
train
143
4e9878922a1df080980f6ce06c1a1fb939c05562
[ "def from_left(nums):\n \"\"\"increase the smaller number to the previous highest\"\"\"\n found = False\n p = nums[0]\n for i in range(1, len(nums)):\n if p > nums[i]:\n if found:\n return False\n found = True\n else:\n p = nums[i]\n retur...
<|body_start_0|> def from_left(nums): """increase the smaller number to the previous highest""" found = False p = nums[0] for i in range(1, len(nums)): if p > nums[i]: if found: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkPossibility(self, nums: List[int]) -> bool: """02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def checkPossibility(self, nums: List[int]) -> bool: """One pass, inplace Time complexity...
stack_v2_sparse_classes_10k_train_000902
3,325
no_license
[ { "docstring": "02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)", "name": "checkPossibility", "signature": "def checkPossibility(self, nums: List[int]) -> bool" }, { "docstring": "One pass, inplace Time complexity: O(n) Space complexity: O(1)", ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums: List[int]) -> bool: 02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1) - def checkPossibility(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums: List[int]) -> bool: 02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1) - def checkPossibility(self...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def checkPossibility(self, nums: List[int]) -> bool: """02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def checkPossibility(self, nums: List[int]) -> bool: """One pass, inplace Time complexity...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def checkPossibility(self, nums: List[int]) -> bool: """02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)""" def from_left(nums): """increase the smaller number to the previous highest""" found = False ...
the_stack_v2_python_sparse
leetcode/solved/665_Non-decreasing_Array/solution.py
sungminoh/algorithms
train
0
f41d9aa5ce5dcd04cc01b1109a73dcee668ac3df
[ "super(BahandauAttention, self).__init__()\nself.W1 = tf.keras.layers.Dense(units=units)\nself.W2 = tf.keras.layers.Dense(units=units)\nself.V = tf.keras.layers.Dense(units=1)", "hidden_state_with_time_axis = tf.expand_dims(hidden_state, 1)\nscore = self.V(tf.nn.tanh(self.W1(hidden_state_with_time_axis) + self.W2...
<|body_start_0|> super(BahandauAttention, self).__init__() self.W1 = tf.keras.layers.Dense(units=units) self.W2 = tf.keras.layers.Dense(units=units) self.V = tf.keras.layers.Dense(units=1) <|end_body_0|> <|body_start_1|> hidden_state_with_time_axis = tf.expand_dims(hidden_state,...
The attention layer with bahandau score.
BahandauAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BahandauAttention: """The attention layer with bahandau score.""" def __init__(self, units): """The structure function. Args: units: The units number of attention hidden layer.""" <|body_0|> def call(self, inputs, hidden_state): """The Args: inputs: The inputs. h...
stack_v2_sparse_classes_10k_train_000903
20,417
no_license
[ { "docstring": "The structure function. Args: units: The units number of attention hidden layer.", "name": "__init__", "signature": "def __init__(self, units)" }, { "docstring": "The Args: inputs: The inputs. hidden_state: The rnn hidden layer state. Returns: The context vectors and attention we...
2
stack_v2_sparse_classes_30k_train_001495
Implement the Python class `BahandauAttention` described below. Class description: The attention layer with bahandau score. Method signatures and docstrings: - def __init__(self, units): The structure function. Args: units: The units number of attention hidden layer. - def call(self, inputs, hidden_state): The Args: ...
Implement the Python class `BahandauAttention` described below. Class description: The attention layer with bahandau score. Method signatures and docstrings: - def __init__(self, units): The structure function. Args: units: The units number of attention hidden layer. - def call(self, inputs, hidden_state): The Args: ...
d1b70b2a954f4665b628ba252b03c1a74b95559f
<|skeleton|> class BahandauAttention: """The attention layer with bahandau score.""" def __init__(self, units): """The structure function. Args: units: The units number of attention hidden layer.""" <|body_0|> def call(self, inputs, hidden_state): """The Args: inputs: The inputs. h...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BahandauAttention: """The attention layer with bahandau score.""" def __init__(self, units): """The structure function. Args: units: The units number of attention hidden layer.""" super(BahandauAttention, self).__init__() self.W1 = tf.keras.layers.Dense(units=units) self.W...
the_stack_v2_python_sparse
NeuralNetworks-tensorflow/RNN/nmt_with_attention/nmt.py
zhaocc1106/machine_learn
train
15
5533738cfe772ea3bb4f6f84500b97841a7e4725
[ "if self.field:\n return 'Date field summary aggregations for \"{0:s}\"'.format(self.field)\nreturn 'Date field summary aggregations for an unknown field.'", "self.field = field\nself.field_query_string = field_query_string\nformatted_field_name = self.format_field_by_type(field)\nif field_query_string == '*':...
<|body_start_0|> if self.field: return 'Date field summary aggregations for "{0:s}"'.format(self.field) return 'Date field summary aggregations for an unknown field.' <|end_body_0|> <|body_start_1|> self.field = field self.field_query_string = field_query_string form...
Date-based Summary Aggregations.
DateSummaryAggregator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateSummaryAggregator: """Date-based Summary Aggregations.""" def chart_title(self): """Returns a title for the chart.""" <|body_0|> def run(self, field, field_query_string='*', start_time='', end_time='', date_interval='year'): """Runs the SummaryAggregation agg...
stack_v2_sparse_classes_10k_train_000904
13,136
permissive
[ { "docstring": "Returns a title for the chart.", "name": "chart_title", "signature": "def chart_title(self)" }, { "docstring": "Runs the SummaryAggregation aggregator. Args: field: What field to aggregate on. field_query_string: The field value(s) to aggregate on. supported_charts: The chart typ...
2
null
Implement the Python class `DateSummaryAggregator` described below. Class description: Date-based Summary Aggregations. Method signatures and docstrings: - def chart_title(self): Returns a title for the chart. - def run(self, field, field_query_string='*', start_time='', end_time='', date_interval='year'): Runs the S...
Implement the Python class `DateSummaryAggregator` described below. Class description: Date-based Summary Aggregations. Method signatures and docstrings: - def chart_title(self): Returns a title for the chart. - def run(self, field, field_query_string='*', start_time='', end_time='', date_interval='year'): Runs the S...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class DateSummaryAggregator: """Date-based Summary Aggregations.""" def chart_title(self): """Returns a title for the chart.""" <|body_0|> def run(self, field, field_query_string='*', start_time='', end_time='', date_interval='year'): """Runs the SummaryAggregation agg...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DateSummaryAggregator: """Date-based Summary Aggregations.""" def chart_title(self): """Returns a title for the chart.""" if self.field: return 'Date field summary aggregations for "{0:s}"'.format(self.field) return 'Date field summary aggregations for an unknown field...
the_stack_v2_python_sparse
timesketch/lib/aggregators/summary.py
google/timesketch
train
2,263
27804157bd4866469b89c0294fee607aa4b4d174
[ "gt = cv2.imread(TestImageFeature.sample)\ngt = cv2.cvtColor(gt, cv2.COLOR_BGR2RGB)\nif image.shape != gt.shape:\n gt = cv2.resize(gt, (255, 255))\ngt = tf.convert_to_tensor(gt, dtype=tf.float32)\nssim = tf.image.ssim(image, gt, max_val=255)\nassert ssim.numpy() > criteria", "if resize:\n feat = ImageFeatur...
<|body_start_0|> gt = cv2.imread(TestImageFeature.sample) gt = cv2.cvtColor(gt, cv2.COLOR_BGR2RGB) if image.shape != gt.shape: gt = cv2.resize(gt, (255, 255)) gt = tf.convert_to_tensor(gt, dtype=tf.float32) ssim = tf.image.ssim(image, gt, max_val=255) assert s...
TestImageFeature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestImageFeature: def check_ssim(image: tf.Tensor, criteria: float=0.99): """Check ssim with groud-truth sample""" <|body_0|> def test_encode_decode_in_eager_execution(self, resize): """Test encode-decode within eager execution mode Use ssim to check the decoded imag...
stack_v2_sparse_classes_10k_train_000905
8,391
no_license
[ { "docstring": "Check ssim with groud-truth sample", "name": "check_ssim", "signature": "def check_ssim(image: tf.Tensor, criteria: float=0.99)" }, { "docstring": "Test encode-decode within eager execution mode Use ssim to check the decoded image", "name": "test_encode_decode_in_eager_execut...
3
stack_v2_sparse_classes_30k_train_002598
Implement the Python class `TestImageFeature` described below. Class description: Implement the TestImageFeature class. Method signatures and docstrings: - def check_ssim(image: tf.Tensor, criteria: float=0.99): Check ssim with groud-truth sample - def test_encode_decode_in_eager_execution(self, resize): Test encode-...
Implement the Python class `TestImageFeature` described below. Class description: Implement the TestImageFeature class. Method signatures and docstrings: - def check_ssim(image: tf.Tensor, criteria: float=0.99): Check ssim with groud-truth sample - def test_encode_decode_in_eager_execution(self, resize): Test encode-...
5da5317cedd380c244f20a96213e883d6ef29de2
<|skeleton|> class TestImageFeature: def check_ssim(image: tf.Tensor, criteria: float=0.99): """Check ssim with groud-truth sample""" <|body_0|> def test_encode_decode_in_eager_execution(self, resize): """Test encode-decode within eager execution mode Use ssim to check the decoded imag...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestImageFeature: def check_ssim(image: tf.Tensor, criteria: float=0.99): """Check ssim with groud-truth sample""" gt = cv2.imread(TestImageFeature.sample) gt = cv2.cvtColor(gt, cv2.COLOR_BGR2RGB) if image.shape != gt.shape: gt = cv2.resize(gt, (255, 255)) g...
the_stack_v2_python_sparse
Database/_unittests/test_features.py
MingRuey/mlbox
train
2
97c48ebc01c91ca0db786bc0fd5d132d3b63ecc4
[ "Search.__init__(self)\nself.token = token\nself.serviceName = 'YouTube'", "self.logger.info('Running YouTube search for query %s...', query)\nurl = 'https://www.googleapis.com/youtube/v3/search?q=%s&maxResults=%i&part=snippet&key=%s&relevanceLanguage=%s&type=video' % (query.replace(' ', '+'), maxresults, self.to...
<|body_start_0|> Search.__init__(self) self.token = token self.serviceName = 'YouTube' <|end_body_0|> <|body_start_1|> self.logger.info('Running YouTube search for query %s...', query) url = 'https://www.googleapis.com/youtube/v3/search?q=%s&maxResults=%i&part=snippet&key=%s&rel...
YouTubeSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YouTubeSearch: def __init__(self, token): """Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.""" <|body_0|> def search(self, query, maxresults=10, lang='en', **opt): """Searches YouTube for videos using the given query. Returns a dic...
stack_v2_sparse_classes_10k_train_000906
5,488
no_license
[ { "docstring": "Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.", "name": "__init__", "signature": "def __init__(self, token)" }, { "docstring": "Searches YouTube for videos using the given query. Returns a dict of url: title pairs pointing to videos. If maxres...
2
stack_v2_sparse_classes_30k_train_005953
Implement the Python class `YouTubeSearch` described below. Class description: Implement the YouTubeSearch class. Method signatures and docstrings: - def __init__(self, token): Create a new YouTubeSearch instance. token should be a valid YouTube Data API key. - def search(self, query, maxresults=10, lang='en', **opt)...
Implement the Python class `YouTubeSearch` described below. Class description: Implement the YouTubeSearch class. Method signatures and docstrings: - def __init__(self, token): Create a new YouTubeSearch instance. token should be a valid YouTube Data API key. - def search(self, query, maxresults=10, lang='en', **opt)...
5fbff4606d50a114613edbb1f360aca070be9226
<|skeleton|> class YouTubeSearch: def __init__(self, token): """Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.""" <|body_0|> def search(self, query, maxresults=10, lang='en', **opt): """Searches YouTube for videos using the given query. Returns a dic...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YouTubeSearch: def __init__(self, token): """Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.""" Search.__init__(self) self.token = token self.serviceName = 'YouTube' def search(self, query, maxresults=10, lang='en', **opt): """Sea...
the_stack_v2_python_sparse
ytsearch.py
fredi-68/Ram
train
0
c8049094844995027357513c2e867c03987995f7
[ "\"\"\" Take parameters, and Sprite Constants \"\"\"\nsuper(BeesSprite, self).__init__(world_map, BeesSprite.IMAGE, GRID_LOCK, BeesSprite.HEALTH_BAR, BeesSprite.AVG_SPEED, BeesSprite.VISION, coordinates)\nself.type = 'bees'\nself.prey = ['plant']", "visible_tiles = vision.vision(15, self.world_map, self.tile)\nvi...
<|body_start_0|> """ Take parameters, and Sprite Constants """ super(BeesSprite, self).__init__(world_map, BeesSprite.IMAGE, GRID_LOCK, BeesSprite.HEALTH_BAR, BeesSprite.AVG_SPEED, BeesSprite.VISION, coordinates) self.type = 'bees' self.prey = ['plant'] <|end_body_0|> <|body_start_1|> ...
BeesSprite
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" <|body_0|> def move(self, target=None):...
stack_v2_sparse_classes_10k_train_000907
3,276
no_license
[ { "docstring": "Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)", "name": "__init__", "signature": "def __init__(self, world_map, GRID_LOCK, coordinates=None)" }, { "docstring": "@Overri...
3
stack_v2_sparse_classes_30k_train_003393
Implement the Python class `BeesSprite` described below. Class description: Implement the BeesSprite class. Method signatures and docstrings: - def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param...
Implement the Python class `BeesSprite` described below. Class description: Implement the BeesSprite class. Method signatures and docstrings: - def __init__(self, world_map, GRID_LOCK, coordinates=None): Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param...
8995bd57ae0faaf7420c74e1a7b2c091c64d6942
<|skeleton|> class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" <|body_0|> def move(self, target=None):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BeesSprite: def __init__(self, world_map, GRID_LOCK, coordinates=None): """Create a BeesSprite object :param world_map: WorldMap Object :param coordinates: Array of coordinates [x,y] :param GRID_LOCK: Lock for screen (for threading)""" """ Take parameters, and Sprite Constants """ supe...
the_stack_v2_python_sparse
sprites/sprite___bees.py
EcoSimulator/EcoSim2.0
train
0
2590c26528939dd5be2ef405a001557d30688d9e
[ "super(QCustomActionGroup, self).__init__(*args, **kwargs)\nself.triggered.connect(self.onTriggered)\nself._last_checked = None", "if action.isCheckable() and action.isChecked():\n if self.isExclusive():\n last = self._last_checked\n if last is not None and last is not action:\n last.s...
<|body_start_0|> super(QCustomActionGroup, self).__init__(*args, **kwargs) self.triggered.connect(self.onTriggered) self._last_checked = None <|end_body_0|> <|body_start_1|> if action.isCheckable() and action.isChecked(): if self.isExclusive(): last = self._l...
A QActionGroup subclass which fixes some toggling issues. When a QActionGroup is set from non-exclusive to exclusive, it doesn't uncheck the non-current actions. It also does not keep track of the most recently checked widget when in non-exclusive mode, so that state is lost. This subclass corrects these issues.
QCustomActionGroup
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QCustomActionGroup: """A QActionGroup subclass which fixes some toggling issues. When a QActionGroup is set from non-exclusive to exclusive, it doesn't uncheck the non-current actions. It also does not keep track of the most recently checked widget when in non-exclusive mode, so that state is los...
stack_v2_sparse_classes_10k_train_000908
6,993
permissive
[ { "docstring": "Initialize a QCustomActionGroup. Parameters ---------- *args, **kwargs The positional and keyword arguments needed to initialize a QActionGroup.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "The signal handler for the 'triggered' sign...
3
stack_v2_sparse_classes_30k_train_005867
Implement the Python class `QCustomActionGroup` described below. Class description: A QActionGroup subclass which fixes some toggling issues. When a QActionGroup is set from non-exclusive to exclusive, it doesn't uncheck the non-current actions. It also does not keep track of the most recently checked widget when in n...
Implement the Python class `QCustomActionGroup` described below. Class description: A QActionGroup subclass which fixes some toggling issues. When a QActionGroup is set from non-exclusive to exclusive, it doesn't uncheck the non-current actions. It also does not keep track of the most recently checked widget when in n...
1544e7fb371b8f941cfa2fde682795e479380284
<|skeleton|> class QCustomActionGroup: """A QActionGroup subclass which fixes some toggling issues. When a QActionGroup is set from non-exclusive to exclusive, it doesn't uncheck the non-current actions. It also does not keep track of the most recently checked widget when in non-exclusive mode, so that state is los...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QCustomActionGroup: """A QActionGroup subclass which fixes some toggling issues. When a QActionGroup is set from non-exclusive to exclusive, it doesn't uncheck the non-current actions. It also does not keep track of the most recently checked widget when in non-exclusive mode, so that state is lost. This subcl...
the_stack_v2_python_sparse
enaml/qt/qt_action_group.py
MatthieuDartiailh/enaml
train
26
2cf209d8ac3496f4a6ca3746e216ccf9a4b0e24f
[ "head = ListNode(0)\np = head\nwhile phead and qhead:\n if phead.val < qhead.val:\n p.next = phead\n phead = phead.next\n else:\n p.next = qhead\n qhead = qhead.next\n p = p.next\nif phead:\n p.next = phead\nif qhead:\n p.next = qhead\nreturn head.next", "if not lists:\n...
<|body_start_0|> head = ListNode(0) p = head while phead and qhead: if phead.val < qhead.val: p.next = phead phead = phead.next else: p.next = qhead qhead = qhead.next p = p.next if phead:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge2Lists(self, phead, qhead): """合并2个有序链表""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> head = ListNode(0) p = head while ...
stack_v2_sparse_classes_10k_train_000909
1,467
no_license
[ { "docstring": "合并2个有序链表", "name": "merge2Lists", "signature": "def merge2Lists(self, phead, qhead)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge2Lists(self, phead, qhead): 合并2个有序链表 - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge2Lists(self, phead, qhead): 合并2个有序链表 - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|> class Solution: def merge2Lists(self...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def merge2Lists(self, phead, qhead): """合并2个有序链表""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def merge2Lists(self, phead, qhead): """合并2个有序链表""" head = ListNode(0) p = head while phead and qhead: if phead.val < qhead.val: p.next = phead phead = phead.next else: p.next = qhead ...
the_stack_v2_python_sparse
23_合并K个排序链表.py
lovehhf/LeetCode
train
0
3801ed79f7c258e89672eb21a2c6c1d76b473ee8
[ "subv = SimpleMachineVertex(None, '')\npl = Placement(subv, 0, 0, 1)\nPlacements([pl])", "pls = Placements()\nself.assertEqual(pls._placements, dict())\nself.assertEqual(pls._machine_vertices, dict())", "subv = list()\nfor i in range(5):\n subv.append(SimpleMachineVertex(None, ''))\npl = list()\nfor i in ran...
<|body_start_0|> subv = SimpleMachineVertex(None, '') pl = Placement(subv, 0, 0, 1) Placements([pl]) <|end_body_0|> <|body_start_1|> pls = Placements() self.assertEqual(pls._placements, dict()) self.assertEqual(pls._machine_vertices, dict()) <|end_body_1|> <|body_start_...
tester for placements object in pacman.model.placements.placements
TestPlacements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPlacements: """tester for placements object in pacman.model.placements.placements""" def test_create_new_placements(self): """test creating a placements object :return:""" <|body_0|> def test_create_new_empty_placements(self): """checks that creating an empty...
stack_v2_sparse_classes_10k_train_000910
2,548
no_license
[ { "docstring": "test creating a placements object :return:", "name": "test_create_new_placements", "signature": "def test_create_new_placements(self)" }, { "docstring": "checks that creating an empty placements object is valid :return:", "name": "test_create_new_empty_placements", "signa...
5
stack_v2_sparse_classes_30k_train_001750
Implement the Python class `TestPlacements` described below. Class description: tester for placements object in pacman.model.placements.placements Method signatures and docstrings: - def test_create_new_placements(self): test creating a placements object :return: - def test_create_new_empty_placements(self): checks t...
Implement the Python class `TestPlacements` described below. Class description: tester for placements object in pacman.model.placements.placements Method signatures and docstrings: - def test_create_new_placements(self): test creating a placements object :return: - def test_create_new_empty_placements(self): checks t...
5c2faba4d823e9341e5c18f61ea9bf8c6e15b687
<|skeleton|> class TestPlacements: """tester for placements object in pacman.model.placements.placements""" def test_create_new_placements(self): """test creating a placements object :return:""" <|body_0|> def test_create_new_empty_placements(self): """checks that creating an empty...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestPlacements: """tester for placements object in pacman.model.placements.placements""" def test_create_new_placements(self): """test creating a placements object :return:""" subv = SimpleMachineVertex(None, '') pl = Placement(subv, 0, 0, 1) Placements([pl]) def test...
the_stack_v2_python_sparse
unittests/model_tests/placement_tests/test_placements_model.py
kfriesth/PACMAN
train
0
fd1eb433a667e93f061cffd39a8bbd32f2ebbb39
[ "self.maxDiff = None\nentry = dedent('\\n Main topic text\\n # subtopics\\n ## foo\\n Foo sub-category\\n ### moo\\n Foo/Moo subsub-category\\n #### dum\\n Foo/Moo/Dum subsubsub-category\\n ## bar\\n Bar su...
<|body_start_0|> self.maxDiff = None entry = dedent('\n Main topic text\n # subtopics\n ## foo\n Foo sub-category\n ### moo\n Foo/Moo subsub-category\n #### dum\n Foo/Moo/Dum subsubsub-category\n ## bar\n ...
Test the subtopic parser.
TestParseSubtopics
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestParseSubtopics: """Test the subtopic parser.""" def test_parse_entry(self): """Test for subcategories""" <|body_0|> def test_parse_single_entry(self): """Test parsing single subcategory""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ma...
stack_v2_sparse_classes_10k_train_000911
3,736
permissive
[ { "docstring": "Test for subcategories", "name": "test_parse_entry", "signature": "def test_parse_entry(self)" }, { "docstring": "Test parsing single subcategory", "name": "test_parse_single_entry", "signature": "def test_parse_single_entry(self)" } ]
2
stack_v2_sparse_classes_30k_train_004258
Implement the Python class `TestParseSubtopics` described below. Class description: Test the subtopic parser. Method signatures and docstrings: - def test_parse_entry(self): Test for subcategories - def test_parse_single_entry(self): Test parsing single subcategory
Implement the Python class `TestParseSubtopics` described below. Class description: Test the subtopic parser. Method signatures and docstrings: - def test_parse_entry(self): Test for subcategories - def test_parse_single_entry(self): Test parsing single subcategory <|skeleton|> class TestParseSubtopics: """Test ...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class TestParseSubtopics: """Test the subtopic parser.""" def test_parse_entry(self): """Test for subcategories""" <|body_0|> def test_parse_single_entry(self): """Test parsing single subcategory""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestParseSubtopics: """Test the subtopic parser.""" def test_parse_entry(self): """Test for subcategories""" self.maxDiff = None entry = dedent('\n Main topic text\n # subtopics\n ## foo\n Foo sub-category\n ### moo\n ...
the_stack_v2_python_sparse
evennia/help/tests.py
evennia/evennia
train
1,781
cf0c5e3ddaecb2f9fd25dcafc1c660631e65a42d
[ "if self.has_permission('RightTPI') is False:\n self.no_access()\nwith Database() as db:\n if id_survey is None:\n data = db.query(Table).all()\n else:\n data = db.query(Table).get(id_survey)\nreturn {'data': data}", "if self.has_permission('RightTPI') is False:\n self.no_access()\nid_su...
<|body_start_0|> if self.has_permission('RightTPI') is False: self.no_access() with Database() as db: if id_survey is None: data = db.query(Table).all() else: data = db.query(Table).get(id_survey) return {'data': data} <|end_bod...
Survey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Survey: def get(self, id_survey=None): """Return the survey information :param id_survey: UUID""" <|body_0|> def create(self, body): """Create a new survey :param body: { name: JSON, survey_type: ENUM('test'), questions: JSON }""" <|body_1|> def modify(s...
stack_v2_sparse_classes_10k_train_000912
2,534
no_license
[ { "docstring": "Return the survey information :param id_survey: UUID", "name": "get", "signature": "def get(self, id_survey=None)" }, { "docstring": "Create a new survey :param body: { name: JSON, survey_type: ENUM('test'), questions: JSON }", "name": "create", "signature": "def create(s...
4
stack_v2_sparse_classes_30k_train_006719
Implement the Python class `Survey` described below. Class description: Implement the Survey class. Method signatures and docstrings: - def get(self, id_survey=None): Return the survey information :param id_survey: UUID - def create(self, body): Create a new survey :param body: { name: JSON, survey_type: ENUM('test')...
Implement the Python class `Survey` described below. Class description: Implement the Survey class. Method signatures and docstrings: - def get(self, id_survey=None): Return the survey information :param id_survey: UUID - def create(self, body): Create a new survey :param body: { name: JSON, survey_type: ENUM('test')...
43bd57c466a5cd3b133ddc437cb4a6b9f007d267
<|skeleton|> class Survey: def get(self, id_survey=None): """Return the survey information :param id_survey: UUID""" <|body_0|> def create(self, body): """Create a new survey :param body: { name: JSON, survey_type: ENUM('test'), questions: JSON }""" <|body_1|> def modify(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Survey: def get(self, id_survey=None): """Return the survey information :param id_survey: UUID""" if self.has_permission('RightTPI') is False: self.no_access() with Database() as db: if id_survey is None: data = db.query(Table).all() ...
the_stack_v2_python_sparse
resturls/survey.py
CAUCA-9-1-1/survip-api
train
1
64a2dabeebcda17f2e421b0e05e9b6c1928665f6
[ "if not root:\n return -1\nret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right)))\nif ret >= len(results):\n results.append([])\nresults[ret].append(root.val)\nreturn ret", "ret = []\nself.findLeavesHelper(root, ret)\nreturn ret" ]
<|body_start_0|> if not root: return -1 ret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right))) if ret >= len(results): results.append([]) results[ret].append(root.val) return ret <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLeavesHelper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" <|body_0|> def findLeaves(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_10k_train_000913
830
no_license
[ { "docstring": "push root and all descendants to results return the distance from root to farthest leaf", "name": "findLeavesHelper", "signature": "def findLeavesHelper(self, root, results)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "findLeaves", "signatur...
2
stack_v2_sparse_classes_30k_train_005672
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLeavesHelper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf - def findLeaves(self, root): :type root: TreeN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLeavesHelper(self, root, results): push root and all descendants to results return the distance from root to farthest leaf - def findLeaves(self, root): :type root: TreeN...
6e051eb554d9cf6f424f1e0a77f3072adf7f64c4
<|skeleton|> class Solution: def findLeavesHelper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" <|body_0|> def findLeaves(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findLeavesHelper(self, root, results): """push root and all descendants to results return the distance from root to farthest leaf""" if not root: return -1 ret = 1 + max((self.findLeavesHelper(child, results) for child in (root.left, root.right))) if r...
the_stack_v2_python_sparse
366. Find Leaves of Binary Tree.py
vincent-kangzhou/LeetCode-Python
train
0
3206706f2940b7954780b39e562687db186a8120
[ "def postorder(root):\n return postorder(root.left) + postorder(root.right) + [root.val] if root else []\nreturn ' '.join(map(str, postorder(root)))", "def helper(lower, upper):\n if not data or data[-1] < lower or data[-1] > upper:\n return None\n cur = data.pop()\n root = TreeNode(cur)\n r...
<|body_start_0|> def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else [] return ' '.join(map(str, postorder(root))) <|end_body_0|> <|body_start_1|> def helper(lower, upper): if not data or data[-1] < lower or data[-1] > upper...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def postorder(...
stack_v2_sparse_classes_10k_train_000914
1,111
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
034efcefe9940267abcf4c9cab655b2344e3e901
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else [] return ' '.join(map(str, postorder(root))) def deserialize(self, data: str)...
the_stack_v2_python_sparse
449_serialize_and_deserialize_bst.py
HongsenHe/algo2018
train
0
80099bde77aa0a5ad3fce51183e75843a7d7bf11
[ "if not chars:\n return 0\ni, j, count, last = (1, 1, 1, chars[0])\nfor j in range(1, len(chars)):\n if chars[j] != last:\n if count > 1:\n for digit in str(count):\n chars[i] = digit\n i += 1\n chars[i] = chars[j]\n i += 1\n last = chars[j]...
<|body_start_0|> if not chars: return 0 i, j, count, last = (1, 1, 1, chars[0]) for j in range(1, len(chars)): if chars[j] != last: if count > 1: for digit in str(count): chars[i] = digit ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def compress(self, chars): """:type chars: List[str] :rtype: int""" <|body_0|> def compress2(self, chars): """:type chars: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not chars: return 0 i, ...
stack_v2_sparse_classes_10k_train_000915
2,800
no_license
[ { "docstring": ":type chars: List[str] :rtype: int", "name": "compress", "signature": "def compress(self, chars)" }, { "docstring": ":type chars: List[str] :rtype: int", "name": "compress2", "signature": "def compress2(self, chars)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compress(self, chars): :type chars: List[str] :rtype: int - def compress2(self, chars): :type chars: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def compress(self, chars): :type chars: List[str] :rtype: int - def compress2(self, chars): :type chars: List[str] :rtype: int <|skeleton|> class Solution: def compress(sel...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def compress(self, chars): """:type chars: List[str] :rtype: int""" <|body_0|> def compress2(self, chars): """:type chars: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def compress(self, chars): """:type chars: List[str] :rtype: int""" if not chars: return 0 i, j, count, last = (1, 1, 1, chars[0]) for j in range(1, len(chars)): if chars[j] != last: if count > 1: for digit i...
the_stack_v2_python_sparse
code443StringCompression.py
cybelewang/leetcode-python
train
0
9514aac7959d4683866f58f39e280b93e6a5eba7
[ "m = len(dungeon)\nif m <= 0:\n return 1\nn = len(dungeon[0])\ndp = [[0] * n for _ in range(m)]\ndp[-1][-1] = -min(0, dungeon[-1][-1]) + 1\nfor i in range(m - 2, -1, -1):\n dp[i][-1] = max(dp[i + 1][-1] - dungeon[i][-1], 1)\nfor j in range(n - 2, -1, -1):\n dp[-1][j] = max(dp[-1][j + 1] - dungeon[-1][j], 1...
<|body_start_0|> m = len(dungeon) if m <= 0: return 1 n = len(dungeon[0]) dp = [[0] * n for _ in range(m)] dp[-1][-1] = -min(0, dungeon[-1][-1]) + 1 for i in range(m - 2, -1, -1): dp[i][-1] = max(dp[i + 1][-1] - dungeon[i][-1], 1) for j in ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int 55ms""" <|body_0|> def calculateMinimumHP1(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_1|> def calculateMinimumHP_1(self, dungeon):...
stack_v2_sparse_classes_10k_train_000916
3,275
no_license
[ { "docstring": ":type dungeon: List[List[int]] :rtype: int 55ms", "name": "calculateMinimumHP", "signature": "def calculateMinimumHP(self, dungeon)" }, { "docstring": ":type dungeon: List[List[int]] :rtype: int", "name": "calculateMinimumHP1", "signature": "def calculateMinimumHP1(self, ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int 55ms - def calculateMinimumHP1(self, dungeon): :type dungeon: List[List[int]] :rtype: int - def ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int 55ms - def calculateMinimumHP1(self, dungeon): :type dungeon: List[List[int]] :rtype: int - def ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int 55ms""" <|body_0|> def calculateMinimumHP1(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_1|> def calculateMinimumHP_1(self, dungeon):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int 55ms""" m = len(dungeon) if m <= 0: return 1 n = len(dungeon[0]) dp = [[0] * n for _ in range(m)] dp[-1][-1] = -min(0, dungeon[-1][-1]) + 1 for i i...
the_stack_v2_python_sparse
DungeonGame_HARD_174.py
953250587/leetcode-python
train
2
0dede8582813858998aafa1921f7aa86ed0d54e4
[ "expected = '{SSHA}xkDIIx1I7A4gC98Vt/+UelIkTDYxMjM0NQ=='\nresult = user.encodePassword('MoinMoin', salt='12345')\nassert result == expected\nresult = user.encodePassword(u'MoinMoin', salt='12345')\nassert result == expected", "result = user.encodePassword(u'סיסמה סודית בהחלט', salt='12345')\nexpected = '{SSHA}Yiw...
<|body_start_0|> expected = '{SSHA}xkDIIx1I7A4gC98Vt/+UelIkTDYxMjM0NQ==' result = user.encodePassword('MoinMoin', salt='12345') assert result == expected result = user.encodePassword(u'MoinMoin', salt='12345') assert result == expected <|end_body_0|> <|body_start_1|> res...
user: encode passwords tests
TestEncodePassword
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestEncodePassword: """user: encode passwords tests""" def testAscii(self): """user: encode ascii password""" <|body_0|> def testUnicode(self): """user: encode unicode password""" <|body_1|> <|end_skeleton|> <|body_start_0|> expected = '{SSHA}xk...
stack_v2_sparse_classes_10k_train_000917
11,347
no_license
[ { "docstring": "user: encode ascii password", "name": "testAscii", "signature": "def testAscii(self)" }, { "docstring": "user: encode unicode password", "name": "testUnicode", "signature": "def testUnicode(self)" } ]
2
stack_v2_sparse_classes_30k_train_006715
Implement the Python class `TestEncodePassword` described below. Class description: user: encode passwords tests Method signatures and docstrings: - def testAscii(self): user: encode ascii password - def testUnicode(self): user: encode unicode password
Implement the Python class `TestEncodePassword` described below. Class description: user: encode passwords tests Method signatures and docstrings: - def testAscii(self): user: encode ascii password - def testUnicode(self): user: encode unicode password <|skeleton|> class TestEncodePassword: """user: encode passw...
d6e801402c4538bdfb34a97cf07153101167c1ec
<|skeleton|> class TestEncodePassword: """user: encode passwords tests""" def testAscii(self): """user: encode ascii password""" <|body_0|> def testUnicode(self): """user: encode unicode password""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestEncodePassword: """user: encode passwords tests""" def testAscii(self): """user: encode ascii password""" expected = '{SSHA}xkDIIx1I7A4gC98Vt/+UelIkTDYxMjM0NQ==' result = user.encodePassword('MoinMoin', salt='12345') assert result == expected result = user.enco...
the_stack_v2_python_sparse
MoinMoin/_tests/test_user.py
happytk/jardin
train
0
61eb98f72306a5956921d213ffe3f60528d29617
[ "if isinstance(distrib, dict):\n total_prob = sum(distrib.values())\n if total_prob <= 0.0:\n InferenceUtils.log.warning('all assignments in the distribution have a zero probability, cannot be normalised')\n return distrib\n for key, value in distrib.items():\n distrib[key] = distrib[k...
<|body_start_0|> if isinstance(distrib, dict): total_prob = sum(distrib.values()) if total_prob <= 0.0: InferenceUtils.log.warning('all assignments in the distribution have a zero probability, cannot be normalised') return distrib for key, valu...
Utility functions for inference operations.
InferenceUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InferenceUtils: """Utility functions for inference operations.""" def normalize(distrib): """Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_000918
5,313
permissive
[ { "docstring": "Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution", "name": "normalize", "signature": "def normalize(distrib)" }, { "docstring": "Normalises the double array (ensuri...
5
stack_v2_sparse_classes_30k_train_001459
Implement the Python class `InferenceUtils` described below. Class description: Utility functions for inference operations. Method signatures and docstrings: - def normalize(distrib): Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :retur...
Implement the Python class `InferenceUtils` described below. Class description: Utility functions for inference operations. Method signatures and docstrings: - def normalize(distrib): Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :retur...
c9bca653c18ccc082dc8b86b4a8feee9ed00a75b
<|skeleton|> class InferenceUtils: """Utility functions for inference operations.""" def normalize(distrib): """Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InferenceUtils: """Utility functions for inference operations.""" def normalize(distrib): """Normalise the given probability distribution (assuming no conditional variables). :param distrib: the distribution to normalise :return: the normalised distribution""" if isinstance(distrib, dict)...
the_stack_v2_python_sparse
utils/inference_utils.py
ppijbb/PyOpenDial
train
0
1b3538cb8b6ddc9180fb62f925ab213932bb6415
[ "self.__rootFile = ROOT.TFile(rootPath)\nself.__rootTree = self.__rootFile.Get('Config')\nself.__rootTree.GetEntry(0)", "leaf = self.__rootTree.GetLeaf(registerName)\nimport array\nregInfo = PRECINCT_INFO[precinctName][registerName]\nregData = array.array(ROOT_TYPECODE_2_ARRAY_TYPECODE[regInfo.typeCode], [0] * re...
<|body_start_0|> self.__rootFile = ROOT.TFile(rootPath) self.__rootTree = self.__rootFile.Get('Config') self.__rootTree.GetEntry(0) <|end_body_0|> <|body_start_1|> leaf = self.__rootTree.GetLeaf(registerName) import array regInfo = PRECINCT_INFO[precinctName][registerNam...
Provide LATC ROOT file data in form of python arrays
LATCRootFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LATCRootFile: """Provide LATC ROOT file data in form of python arrays""" def __init__(self, rootPath): """open ROOT File args: rootPath - path to input LATC ROOT file""" <|body_0|> def getRegisterData(self, precinctName, registerName): """retrieve single dimensio...
stack_v2_sparse_classes_10k_train_000919
9,121
permissive
[ { "docstring": "open ROOT File args: rootPath - path to input LATC ROOT file", "name": "__init__", "signature": "def __init__(self, rootPath)" }, { "docstring": "retrieve single dimensional python array with data for specified register", "name": "getRegisterData", "signature": "def getRe...
2
stack_v2_sparse_classes_30k_train_007236
Implement the Python class `LATCRootFile` described below. Class description: Provide LATC ROOT file data in form of python arrays Method signatures and docstrings: - def __init__(self, rootPath): open ROOT File args: rootPath - path to input LATC ROOT file - def getRegisterData(self, precinctName, registerName): ret...
Implement the Python class `LATCRootFile` described below. Class description: Provide LATC ROOT file data in form of python arrays Method signatures and docstrings: - def __init__(self, rootPath): open ROOT File args: rootPath - path to input LATC ROOT file - def getRegisterData(self, precinctName, registerName): ret...
3b824540d8173a24be12316a3821304e4ea20a1f
<|skeleton|> class LATCRootFile: """Provide LATC ROOT file data in form of python arrays""" def __init__(self, rootPath): """open ROOT File args: rootPath - path to input LATC ROOT file""" <|body_0|> def getRegisterData(self, precinctName, registerName): """retrieve single dimensio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LATCRootFile: """Provide LATC ROOT file data in form of python arrays""" def __init__(self, rootPath): """open ROOT File args: rootPath - path to input LATC ROOT file""" self.__rootFile = ROOT.TFile(rootPath) self.__rootTree = self.__rootFile.Get('Config') self.__rootTree....
the_stack_v2_python_sparse
python/LATCRootData.py
fermi-lat/configData
train
0
5e872aaf50142500d7a3573769ca37b9a7cc7d65
[ "super(ResNetBase, self).__init__()\nself.output_channel_block = [int(output_channel / 4), int(output_channel / 2), output_channel, output_channel]\nself.inplanes = int(output_channel / 8)\nself.conv0_1 = nn.Conv2d(input_channel, int(output_channel / 16), kernel_size=3, stride=1, padding=1, bias=False)\nself.bn0_1 ...
<|body_start_0|> super(ResNetBase, self).__init__() self.output_channel_block = [int(output_channel / 4), int(output_channel / 2), output_channel, output_channel] self.inplanes = int(output_channel / 8) self.conv0_1 = nn.Conv2d(input_channel, int(output_channel / 16), kernel_size=3, stri...
Base share backbone network
ResNetBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNetBase: """Base share backbone network""" def __init__(self, input_channel, output_channel, block, layers): """Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block""" <|body_...
stack_v2_sparse_classes_10k_train_000920
11,483
permissive
[ { "docstring": "Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block", "name": "__init__", "signature": "def __init__(self, input_channel, output_channel, block, layers)" }, { "docstring": "Args: bl...
3
stack_v2_sparse_classes_30k_test_000094
Implement the Python class `ResNetBase` described below. Class description: Base share backbone network Method signatures and docstrings: - def __init__(self, input_channel, output_channel, block, layers): Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution bl...
Implement the Python class `ResNetBase` described below. Class description: Base share backbone network Method signatures and docstrings: - def __init__(self, input_channel, output_channel, block, layers): Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution bl...
fb47a96d1a38f5ce634c6f12d710ed5300cc89fc
<|skeleton|> class ResNetBase: """Base share backbone network""" def __init__(self, input_channel, output_channel, block, layers): """Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResNetBase: """Base share backbone network""" def __init__(self, input_channel, output_channel, block, layers): """Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block""" super(ResNetBase, se...
the_stack_v2_python_sparse
davarocr/davarocr/davar_rcg/models/backbones/ResNetRFL.py
OCRWorld/DAVAR-Lab-OCR
train
0
032349d03afa0b99286113274e73f38e7f31b83c
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DeviceLogCollectionResponse()", "from .app_log_upload_state import AppLogUploadState\nfrom .entity import Entity\nfrom .app_log_upload_state import AppLogUploadState\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]]...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DeviceLogCollectionResponse() <|end_body_0|> <|body_start_1|> from .app_log_upload_state import AppLogUploadState from .entity import Entity from .app_log_upload_state import App...
Windows Log Collection request entity.
DeviceLogCollectionResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceLogCollectionResponse: """Windows Log Collection request entity.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceLogCollectionResponse: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pa...
stack_v2_sparse_classes_10k_train_000921
4,403
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: DeviceLogCollectionResponse", "name": "create_from_discriminator_value", "signature": "def create_from_discr...
3
null
Implement the Python class `DeviceLogCollectionResponse` described below. Class description: Windows Log Collection request entity. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceLogCollectionResponse: Creates a new instance of the appropriate cl...
Implement the Python class `DeviceLogCollectionResponse` described below. Class description: Windows Log Collection request entity. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceLogCollectionResponse: Creates a new instance of the appropriate cl...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DeviceLogCollectionResponse: """Windows Log Collection request entity.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceLogCollectionResponse: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeviceLogCollectionResponse: """Windows Log Collection request entity.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceLogCollectionResponse: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to u...
the_stack_v2_python_sparse
msgraph/generated/models/device_log_collection_response.py
microsoftgraph/msgraph-sdk-python
train
135
9193651aa9e4d16d33f0b7b4bdc8307099a537b2
[ "cmd_output = self._run_command([self.EXECUTABLE, '--version'])\nmatch = re.search('^Poetry version (?P<version>\\\\S*)', cmd_output)\nif not match:\n LOGGER.warning('unable to parse poetry version from output:\\n%s', cmd_output)\n return Version('0.0.0')\nreturn Version(match.group('version'))", "pyproject...
<|body_start_0|> cmd_output = self._run_command([self.EXECUTABLE, '--version']) match = re.search('^Poetry version (?P<version>\\S*)', cmd_output) if not match: LOGGER.warning('unable to parse poetry version from output:\n%s', cmd_output) return Version('0.0.0') r...
Poetry dependency manager.
Poetry
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Poetry: """Poetry dependency manager.""" def version(self) -> Version: """poetry version.""" <|body_0|> def dir_is_project(cls, directory: StrPath, **__kwargs: Any) -> bool: """Determine if the directory contains a project for this dependency manager. Args: direc...
stack_v2_sparse_classes_10k_train_000922
4,732
permissive
[ { "docstring": "poetry version.", "name": "version", "signature": "def version(self) -> Version" }, { "docstring": "Determine if the directory contains a project for this dependency manager. Args: directory: Directory to check.", "name": "dir_is_project", "signature": "def dir_is_project...
3
stack_v2_sparse_classes_30k_train_003959
Implement the Python class `Poetry` described below. Class description: Poetry dependency manager. Method signatures and docstrings: - def version(self) -> Version: poetry version. - def dir_is_project(cls, directory: StrPath, **__kwargs: Any) -> bool: Determine if the directory contains a project for this dependency...
Implement the Python class `Poetry` described below. Class description: Poetry dependency manager. Method signatures and docstrings: - def version(self) -> Version: poetry version. - def dir_is_project(cls, directory: StrPath, **__kwargs: Any) -> bool: Determine if the directory contains a project for this dependency...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class Poetry: """Poetry dependency manager.""" def version(self) -> Version: """poetry version.""" <|body_0|> def dir_is_project(cls, directory: StrPath, **__kwargs: Any) -> bool: """Determine if the directory contains a project for this dependency manager. Args: direc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Poetry: """Poetry dependency manager.""" def version(self) -> Version: """poetry version.""" cmd_output = self._run_command([self.EXECUTABLE, '--version']) match = re.search('^Poetry version (?P<version>\\S*)', cmd_output) if not match: LOGGER.warning('unable t...
the_stack_v2_python_sparse
runway/dependency_managers/_poetry.py
onicagroup/runway
train
156
3e33a8ffefc16aa193800135bf66d0a940abcefb
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('xcao19', 'xcao19')\nurl = 'http://data.insideairbnb.com/united-states/ma/boston/2019-01-17/visualisations/neighbourhoods.csv'\ndf = pd.read_csv(url, encoding='ISO-8859-1')\njson_df = df.to_json(orient='r...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('xcao19', 'xcao19') url = 'http://data.insideairbnb.com/united-states/ma/boston/2019-01-17/visualisations/neighbourhoods.csv' df = pd.read_csv(url,...
AirBNB_neighborhoods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AirBNB_neighborhoods: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing eve...
stack_v2_sparse_classes_10k_train_000923
3,316
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `AirBNB_neighborhoods` described below. Class description: Implement the AirBNB_neighborhoods class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), sta...
Implement the Python class `AirBNB_neighborhoods` described below. Class description: Implement the AirBNB_neighborhoods class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), sta...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class AirBNB_neighborhoods: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing eve...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AirBNB_neighborhoods: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('xcao19', 'xcao19') url...
the_stack_v2_python_sparse
xcao19/AirBNB_neighborhoods.py
maximega/course-2019-spr-proj
train
2
3e676a0487467960ba477b169e3e028a22a28896
[ "line = line.rstrip('\\n')\ntry:\n super(DataSamplerTaskHadoop, self).__init__(line)\nexcept ValueError as e:\n raise DataSamplerTaskInitError('%s' % e)\ntry:\n self._ratio = self.get_attribute('ratio', self._json, 'ratio')\n self._encode = self.get_attribute('encode', self._json, 'code')\n self._dec...
<|body_start_0|> line = line.rstrip('\n') try: super(DataSamplerTaskHadoop, self).__init__(line) except ValueError as e: raise DataSamplerTaskInitError('%s' % e) try: self._ratio = self.get_attribute('ratio', self._json, 'ratio') self._enco...
hadoop data sampler task
DataSamplerTaskHadoop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSamplerTaskHadoop: """hadoop data sampler task""" def __init__(self, line): """Change line to taskconf object Args: line: str Exception: DataSamplerTaskInitError""" <|body_0|> def excute(self): """begin to sample Args: None Return: 0""" <|body_1|> <|...
stack_v2_sparse_classes_10k_train_000924
6,255
no_license
[ { "docstring": "Change line to taskconf object Args: line: str Exception: DataSamplerTaskInitError", "name": "__init__", "signature": "def __init__(self, line)" }, { "docstring": "begin to sample Args: None Return: 0", "name": "excute", "signature": "def excute(self)" } ]
2
stack_v2_sparse_classes_30k_train_006199
Implement the Python class `DataSamplerTaskHadoop` described below. Class description: hadoop data sampler task Method signatures and docstrings: - def __init__(self, line): Change line to taskconf object Args: line: str Exception: DataSamplerTaskInitError - def excute(self): begin to sample Args: None Return: 0
Implement the Python class `DataSamplerTaskHadoop` described below. Class description: hadoop data sampler task Method signatures and docstrings: - def __init__(self, line): Change line to taskconf object Args: line: str Exception: DataSamplerTaskInitError - def excute(self): begin to sample Args: None Return: 0 <|s...
913fb4af29f4395f4a300d35c00236065075960e
<|skeleton|> class DataSamplerTaskHadoop: """hadoop data sampler task""" def __init__(self, line): """Change line to taskconf object Args: line: str Exception: DataSamplerTaskInitError""" <|body_0|> def excute(self): """begin to sample Args: None Return: 0""" <|body_1|> <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataSamplerTaskHadoop: """hadoop data sampler task""" def __init__(self, line): """Change line to taskconf object Args: line: str Exception: DataSamplerTaskInitError""" line = line.rstrip('\n') try: super(DataSamplerTaskHadoop, self).__init__(line) except Value...
the_stack_v2_python_sparse
script/data_sampler_task.py
jhuangpku/data_checker
train
0
d7c841a1c0bc2e9f925ed9e277e34e965d845761
[ "self.scenario = scenario\nself.actions = load_action_list(scenario)\nnvec = [len(self.action_types), len(self.scenario.subnets) - 1, max(self.scenario.subnets), self.scenario.num_os + 1, self.scenario.num_services, self.scenario.num_processes]\nsuper().__init__(nvec)", "assert isinstance(action_vec, (list, tuple...
<|body_start_0|> self.scenario = scenario self.actions = load_action_list(scenario) nvec = [len(self.action_types), len(self.scenario.subnets) - 1, max(self.scenario.subnets), self.scenario.num_os + 1, self.scenario.num_services, self.scenario.num_processes] super().__init__(nvec) <|end_...
A parameterised action space for NASim environment. Inherits and implements the gym.spaces.MultiDiscrete action space, where each dimension corresponds to a different action parameter. The action parameters (in order) are: 0. Action Type = [0, 5] Where: 0=Exploit, 1=PrivilegeEscalation, 2=ServiceScan, 3=OSScan, 4=Subne...
ParameterisedActionSpace
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterisedActionSpace: """A parameterised action space for NASim environment. Inherits and implements the gym.spaces.MultiDiscrete action space, where each dimension corresponds to a different action parameter. The action parameters (in order) are: 0. Action Type = [0, 5] Where: 0=Exploit, 1=P...
stack_v2_sparse_classes_10k_train_000925
25,856
permissive
[ { "docstring": "Parameters ---------- scenario : Scenario scenario description", "name": "__init__", "signature": "def __init__(self, scenario)" }, { "docstring": "Get Action object corresponding to action vector. Parameters ---------- action_vector : list of ints or tuple of ints or Numpy.Array...
5
stack_v2_sparse_classes_30k_train_004203
Implement the Python class `ParameterisedActionSpace` described below. Class description: A parameterised action space for NASim environment. Inherits and implements the gym.spaces.MultiDiscrete action space, where each dimension corresponds to a different action parameter. The action parameters (in order) are: 0. Act...
Implement the Python class `ParameterisedActionSpace` described below. Class description: A parameterised action space for NASim environment. Inherits and implements the gym.spaces.MultiDiscrete action space, where each dimension corresponds to a different action parameter. The action parameters (in order) are: 0. Act...
4f26de37cfdc3e4553ed8b7484c4db8e2924bdea
<|skeleton|> class ParameterisedActionSpace: """A parameterised action space for NASim environment. Inherits and implements the gym.spaces.MultiDiscrete action space, where each dimension corresponds to a different action parameter. The action parameters (in order) are: 0. Action Type = [0, 5] Where: 0=Exploit, 1=P...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParameterisedActionSpace: """A parameterised action space for NASim environment. Inherits and implements the gym.spaces.MultiDiscrete action space, where each dimension corresponds to a different action parameter. The action parameters (in order) are: 0. Action Type = [0, 5] Where: 0=Exploit, 1=PrivilegeEscal...
the_stack_v2_python_sparse
nasim/envs/action.py
Jjschwartz/NetworkAttackSimulator
train
101
682254421905ea22ba187f9b2c48f2f88701294a
[ "while sx < tx and sy < ty:\n tx, ty = (tx % ty, ty % tx)\nreturn sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx and ((tx - sx) % sy == 0))", "while sx < tx and sy < ty:\n tx, ty = (tx % ty, ty % tx)\nreturn sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx...
<|body_start_0|> while sx < tx and sy < ty: tx, ty = (tx % ty, ty % tx) return sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx and ((tx - sx) % sy == 0)) <|end_body_0|> <|body_start_1|> while sx < tx and sy < ty: tx, ty = (tx % ty, ty % tx) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reachingPoints(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool""" <|body_0|> def rewrite(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool A move consists of tak...
stack_v2_sparse_classes_10k_train_000926
2,133
no_license
[ { "docstring": ":type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool", "name": "reachingPoints", "signature": "def reachingPoints(self, sx, sy, tx, ty)" }, { "docstring": ":type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool A move consists of taking a point (x, y...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reachingPoints(self, sx, sy, tx, ty): :type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool - def rewrite(self, sx, sy, tx, ty): :type sx: int :type sy: int :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reachingPoints(self, sx, sy, tx, ty): :type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool - def rewrite(self, sx, sy, tx, ty): :type sx: int :type sy: int :t...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def reachingPoints(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool""" <|body_0|> def rewrite(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool A move consists of tak...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reachingPoints(self, sx, sy, tx, ty): """:type sx: int :type sy: int :type tx: int :type ty: int :rtype: bool""" while sx < tx and sy < ty: tx, ty = (tx % ty, ty % tx) return sx == tx and sy <= ty and ((ty - sy) % sx == 0) or (sy == ty and sx <= tx and ((tx - ...
the_stack_v2_python_sparse
math/780_Reaching_Points.py
vsdrun/lc_public
train
6
1bf31946657b271b7a836bb0e7a1312e0febc74b
[ "n = len(s)\nif n == 0:\n return '^$'\nres = '^'\nfor i in range(n):\n res += '#' + s[i]\nres += '#$'\nreturn res", "T = self.preProcess(s)\nn = len(T)\np = [0] * n\nC, R = (0, 0)\nfor i in range(1, n - 1):\n i_mirror = 2 * C - i\n if R > i:\n p[i] = min(R - i, p[i_mirror])\n while T[i + 1 +...
<|body_start_0|> n = len(s) if n == 0: return '^$' res = '^' for i in range(n): res += '#' + s[i] res += '#$' return res <|end_body_0|> <|body_start_1|> T = self.preProcess(s) n = len(T) p = [0] * n C, R = (0, 0) ...
Solution3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution3: def preProcess(self, s): """Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: str""" <|bod...
stack_v2_sparse_classes_10k_train_000927
2,734
no_license
[ { "docstring": "Transform S into T. For example, S = \"abba\", T = \"^#a#b#b#a#$\". ^ and $ signs are sentinels appended to each end to avoid bounds checking", "name": "preProcess", "signature": "def preProcess(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrom...
2
stack_v2_sparse_classes_30k_train_000612
Implement the Python class `Solution3` described below. Class description: Implement the Solution3 class. Method signatures and docstrings: - def preProcess(self, s): Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking - def longest...
Implement the Python class `Solution3` described below. Class description: Implement the Solution3 class. Method signatures and docstrings: - def preProcess(self, s): Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking - def longest...
08e791733824ddf82ba07d1666b1e5e07fb8189d
<|skeleton|> class Solution3: def preProcess(self, s): """Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: str""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution3: def preProcess(self, s): """Transform S into T. For example, S = "abba", T = "^#a#b#b#a#$". ^ and $ signs are sentinels appended to each end to avoid bounds checking""" n = len(s) if n == 0: return '^$' res = '^' for i in range(n): res...
the_stack_v2_python_sparse
longest_palindromic_substring.py
mihaanali/coding_practice
train
0
71d305bfd850dbee94b3f4b3c6a359dc403a8af3
[ "mongo = database.MongoDBConnection()\nwith mongo:\n db = mongo.connection.HPNortonDatabase\n products = db['products']\n customers = db['customers']\n rentals = db['rentals']\nproducts.drop()\ncustomers.drop()\nrentals.drop()", "directory_path = 'data'\ntuple1, tuple2 = database.import_data(directory...
<|body_start_0|> mongo = database.MongoDBConnection() with mongo: db = mongo.connection.HPNortonDatabase products = db['products'] customers = db['customers'] rentals = db['rentals'] products.drop() customers.drop() rentals.drop() <...
Tests for the database module
DatabaseTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseTests: """Tests for the database module""" def setUp(self): """Sets up database for each test""" <|body_0|> def test_import_data(self): """Tests the import_data function""" <|body_1|> def test_show_available_products(self): """Tests t...
stack_v2_sparse_classes_10k_train_000928
3,519
no_license
[ { "docstring": "Sets up database for each test", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests the import_data function", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Tests the show_available_products module",...
4
null
Implement the Python class `DatabaseTests` described below. Class description: Tests for the database module Method signatures and docstrings: - def setUp(self): Sets up database for each test - def test_import_data(self): Tests the import_data function - def test_show_available_products(self): Tests the show_availab...
Implement the Python class `DatabaseTests` described below. Class description: Tests for the database module Method signatures and docstrings: - def setUp(self): Sets up database for each test - def test_import_data(self): Tests the import_data function - def test_show_available_products(self): Tests the show_availab...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class DatabaseTests: """Tests for the database module""" def setUp(self): """Sets up database for each test""" <|body_0|> def test_import_data(self): """Tests the import_data function""" <|body_1|> def test_show_available_products(self): """Tests t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DatabaseTests: """Tests for the database module""" def setUp(self): """Sets up database for each test""" mongo = database.MongoDBConnection() with mongo: db = mongo.connection.HPNortonDatabase products = db['products'] customers = db['customers'...
the_stack_v2_python_sparse
students/amirg/lesson09/assignment/test_database.py
JavaRod/SP_Python220B_2019
train
1
f382f24c18c81e7fca39440e5fa55080e1c486a0
[ "from fractions import gcd\nvals = collections.Counter(deck).values()\nreturn reduce(gcd, vals) >= 2", "def gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\nvals = collections.Counter(deck).values()\nreturn reduce(gcd, vals) > 1", "n = len(deck)\nvals = collections.Counter(deck).values()\...
<|body_start_0|> from fractions import gcd vals = collections.Counter(deck).values() return reduce(gcd, vals) >= 2 <|end_body_0|> <|body_start_1|> def gcd(a, b): if b == 0: return a return gcd(b, a % b) vals = collections.Counter(deck).val...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: bool""" <|body_0|> def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: bool""" <|body_1|> def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: boo...
stack_v2_sparse_classes_10k_train_000929
1,001
no_license
[ { "docstring": ":type deck: List[int] :rtype: bool", "name": "hasGroupsSizeX", "signature": "def hasGroupsSizeX(self, deck)" }, { "docstring": ":type deck: List[int] :rtype: bool", "name": "hasGroupsSizeX", "signature": "def hasGroupsSizeX(self, deck)" }, { "docstring": ":type de...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasGroupsSizeX(self, deck): :type deck: List[int] :rtype: bool - def hasGroupsSizeX(self, deck): :type deck: List[int] :rtype: bool - def hasGroupsSizeX(self, deck): :type de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasGroupsSizeX(self, deck): :type deck: List[int] :rtype: bool - def hasGroupsSizeX(self, deck): :type deck: List[int] :rtype: bool - def hasGroupsSizeX(self, deck): :type de...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: bool""" <|body_0|> def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: bool""" <|body_1|> def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: boo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: bool""" from fractions import gcd vals = collections.Counter(deck).values() return reduce(gcd, vals) >= 2 def hasGroupsSizeX(self, deck): """:type deck: List[int] :rtype: bool""" def...
the_stack_v2_python_sparse
0914_X_of_a_Kind_in_a_Deck_of_Cards.py
bingli8802/leetcode
train
0
e2671ef3ec11f82e4070e8f740b54abe4796c0fb
[ "scripts = ['core_parser_app/js/builtin/autocomplete.js'] + scripts\nAbstractModule.__init__(self, scripts=scripts, styles=styles)\nself.label = label", "params = {}\nif self.data != '':\n params['value'] = self.data\nif self.label is not None:\n params.update({'label': self.label})\nreturn AbstractModule.r...
<|body_start_0|> scripts = ['core_parser_app/js/builtin/autocomplete.js'] + scripts AbstractModule.__init__(self, scripts=scripts, styles=styles) self.label = label <|end_body_0|> <|body_start_1|> params = {} if self.data != '': params['value'] = self.data if...
AutoCompleteModule class
AbstractAutoCompleteModule
[ "NIST-Software", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractAutoCompleteModule: """AutoCompleteModule class""" def __init__(self, scripts=list(), styles=list(), label=None): """Initialize the module Args: scripts: styles: label:""" <|body_0|> def _render_module(self, request): """Return the module Args: request: R...
stack_v2_sparse_classes_10k_train_000930
1,022
permissive
[ { "docstring": "Initialize the module Args: scripts: styles: label:", "name": "__init__", "signature": "def __init__(self, scripts=list(), styles=list(), label=None)" }, { "docstring": "Return the module Args: request: Returns:", "name": "_render_module", "signature": "def _render_module...
2
stack_v2_sparse_classes_30k_train_004491
Implement the Python class `AbstractAutoCompleteModule` described below. Class description: AutoCompleteModule class Method signatures and docstrings: - def __init__(self, scripts=list(), styles=list(), label=None): Initialize the module Args: scripts: styles: label: - def _render_module(self, request): Return the mo...
Implement the Python class `AbstractAutoCompleteModule` described below. Class description: AutoCompleteModule class Method signatures and docstrings: - def __init__(self, scripts=list(), styles=list(), label=None): Initialize the module Args: scripts: styles: label: - def _render_module(self, request): Return the mo...
cef5e0f040c87e5fb224c59f90c314a6944e4d6b
<|skeleton|> class AbstractAutoCompleteModule: """AutoCompleteModule class""" def __init__(self, scripts=list(), styles=list(), label=None): """Initialize the module Args: scripts: styles: label:""" <|body_0|> def _render_module(self, request): """Return the module Args: request: R...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AbstractAutoCompleteModule: """AutoCompleteModule class""" def __init__(self, scripts=list(), styles=list(), label=None): """Initialize the module Args: scripts: styles: label:""" scripts = ['core_parser_app/js/builtin/autocomplete.js'] + scripts AbstractModule.__init__(self, scri...
the_stack_v2_python_sparse
core_parser_app/tools/modules/views/builtin/autocomplete_module.py
usnistgov/core_parser_app
train
0
8614f6c3c28f4f35ae86fd6b151814cd353ae817
[ "def get(root, items):\n if root is None:\n items.append('null')\n return\n items.append(str(root.val))\n get(root.left, items)\n get(root.right, items)\nitems = []\nget(root, items)\nreturn ','.join(items)", "def get_root(data):\n if not data:\n return\n curr = data.popleft...
<|body_start_0|> def get(root, items): if root is None: items.append('null') return items.append(str(root.val)) get(root.left, items) get(root.right, items) items = [] get(root, items) return ','.join(items) ...
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_10k_train_000931
1,352
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_005665
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:...
8e87b10bd77289b891591b770a6f7adc2c00fdf0
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def get(root, items): if root is None: items.append('null') return items.append(str(root.val)) get(root.left, items) ...
the_stack_v2_python_sparse
Temp/serialize_and_deserialize_bst.py
karthik4636/practice_problems
train
0
fe699ee0cbe2831fdfd71707a98ae51fba00b641
[ "logging.info('## SETUP METHOD ##')\nlogging.info('# Initializing the webdriver.')\nself.chprofile = self.create_chprofile()\nself.driver = webdriver.Chrome(self.chprofile)\nself.driver.maximize_window()\nself.driver.implicitly_wait(5)\nself.driver.get('http://the-internet.herokuapp.com/')", "logging.info('## TEA...
<|body_start_0|> logging.info('## SETUP METHOD ##') logging.info('# Initializing the webdriver.') self.chprofile = self.create_chprofile() self.driver = webdriver.Chrome(self.chprofile) self.driver.maximize_window() self.driver.implicitly_wait(5) self.driver.get('...
This class is for instantiating web driver instances.
DriverManagerChrome
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverManagerChrome: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" <|body_0|> def tearDown(self): """This is teardown method. It is to capture the screenshots for failed t...
stack_v2_sparse_classes_10k_train_000932
3,946
permissive
[ { "docstring": "This method is to instantiate the web driver instance.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "This is teardown method. It is to capture the screenshots for failed test cases, & to remove web driver object.", "name": "tearDown", "signature": "...
3
stack_v2_sparse_classes_30k_train_000209
Implement the Python class `DriverManagerChrome` described below. Class description: This class is for instantiating web driver instances. Method signatures and docstrings: - def setUp(self): This method is to instantiate the web driver instance. - def tearDown(self): This is teardown method. It is to capture the scr...
Implement the Python class `DriverManagerChrome` described below. Class description: This class is for instantiating web driver instances. Method signatures and docstrings: - def setUp(self): This method is to instantiate the web driver instance. - def tearDown(self): This is teardown method. It is to capture the scr...
65513cb85eccb1ae3fae4ac3625d0e6878720ec8
<|skeleton|> class DriverManagerChrome: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" <|body_0|> def tearDown(self): """This is teardown method. It is to capture the screenshots for failed t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DriverManagerChrome: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" logging.info('## SETUP METHOD ##') logging.info('# Initializing the webdriver.') self.chprofile = self.create_chpr...
the_stack_v2_python_sparse
attic/2019/contributions-2019/open/mudaliar-yptu/PWAF/utility/drivermanager.py
Agriad/devops-course
train
0
4d9839bde36fff5c4027e394a82c5f4b1e52fdba
[ "def backTrack(res, nums, tmp, start):\n if len(tmp) > 0:\n t = tmp.copy()\n res.append(t)\n for i in range(start, len(nums)):\n tmp.append(nums[i])\n backTrack(res, nums, tmp, i + 1)\n tmp.pop()\nt = [[]]\nres = [[]]\ntmp = []\ndic = {}\nnums.sort()\nbackTrack(t, nums, tmp,...
<|body_start_0|> def backTrack(res, nums, tmp, start): if len(tmp) > 0: t = tmp.copy() res.append(t) for i in range(start, len(nums)): tmp.append(nums[i]) backTrack(res, nums, tmp, i + 1) tmp.pop() t ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup0(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def backTrack(...
stack_v2_sparse_classes_10k_train_000933
1,933
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup", "signature": "def subsetsWithDup(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsetsWithDup0", "signature": "def subsetsWithDup0(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_006014
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup0(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsetsWithDup0(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsetsWithDup0(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def subsetsWithDup(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def backTrack(res, nums, tmp, start): if len(tmp) > 0: t = tmp.copy() res.append(t) for i in range(start, len(nums)): tmp.append...
the_stack_v2_python_sparse
PythonCode/src/0090_Subsets_II.py
oneyuan/CodeforFun
train
0
1941dca737d2baaef65cf0b403cb3cb0fb67b085
[ "self.cumhelper = CUMHelper(commu_ip, commu_port)\nself.cumhelper.chvolume(commu_volume)\nself.debug_handler = debug_handler\nrospy.loginfo('CommUWrapper instance created.')", "rospy.loginfo(\"Saying '%s' in %s..\", utterance, 'English' if english else 'Japanese')\nif self.debug_handler is not None:\n self.deb...
<|body_start_0|> self.cumhelper = CUMHelper(commu_ip, commu_port) self.cumhelper.chvolume(commu_volume) self.debug_handler = debug_handler rospy.loginfo('CommUWrapper instance created.') <|end_body_0|> <|body_start_1|> rospy.loginfo("Saying '%s' in %s..", utterance, 'English' if...
CommUWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommUWrapper: def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): """Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU ...
stack_v2_sparse_classes_10k_train_000934
3,119
no_license
[ { "docstring": "Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU to control. :param commu_port: The port of the CommUManager on the CommU. :param commu_volume: The volume of the CommU. P...
3
stack_v2_sparse_classes_30k_train_003530
Implement the Python class `CommUWrapper` described below. Class description: Implement the CommUWrapper class. Method signatures and docstrings: - def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): Instantiates a new CommUWrapper instance. This wraps all the functions of ...
Implement the Python class `CommUWrapper` described below. Class description: Implement the CommUWrapper class. Method signatures and docstrings: - def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): Instantiates a new CommUWrapper instance. This wraps all the functions of ...
53aedca77d1f61437a22d0c52093555fb815d79b
<|skeleton|> class CommUWrapper: def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): """Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommUWrapper: def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): """Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU to control. :p...
the_stack_v2_python_sparse
src/commu_wrapper/src/wrapper.py
mgmeedendorp/ros-commu
train
2
54c9cfcfd170d0c69bc33d4df3ea4fed5e7d8245
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.iosVppEBook'.casefold():\n from .ios_vpp...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
An abstract class containing the base properties for Managed eBook.
ManagedEBook
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManagedEBook: """An abstract class containing the base properties for Managed eBook.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedEBook: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The par...
stack_v2_sparse_classes_10k_train_000935
6,821
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: ManagedEBook", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(...
3
stack_v2_sparse_classes_30k_test_000273
Implement the Python class `ManagedEBook` described below. Class description: An abstract class containing the base properties for Managed eBook. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedEBook: Creates a new instance of the appropriate cla...
Implement the Python class `ManagedEBook` described below. Class description: An abstract class containing the base properties for Managed eBook. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedEBook: Creates a new instance of the appropriate cla...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ManagedEBook: """An abstract class containing the base properties for Managed eBook.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedEBook: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The par...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManagedEBook: """An abstract class containing the base properties for Managed eBook.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedEBook: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to us...
the_stack_v2_python_sparse
msgraph/generated/models/managed_e_book.py
microsoftgraph/msgraph-sdk-python
train
135
74ba213d4fab33b0a7cfabe35671d93818512ca4
[ "self.s_g = s_g\nself.s_s = s_s\nself.h = h\nself.alpha = alpha\nself.ratio_s_g = ratio_s_g", "assert len(f1.shape) == 1, 'input must be 1d ndarray'\nassert len(f2.shape) == 1, 'input must be 1d ndarray'\nassert f1.shape == f2.shape\nn_trial = len(f1)\nf1_ = np.tile(f1, (n_samp, 1)) + self.s_s * np.random.randn(n...
<|body_start_0|> self.s_g = s_g self.s_s = s_s self.h = h self.alpha = alpha self.ratio_s_g = ratio_s_g <|end_body_0|> <|body_start_1|> assert len(f1.shape) == 1, 'input must be 1d ndarray' assert len(f2.shape) == 1, 'input must be 1d ndarray' assert f1.s...
RecencyModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecencyModel: def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): """Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ...
stack_v2_sparse_classes_10k_train_000936
11,426
no_license
[ { "docstring": "Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ratio between gaussians", "name": "__init__", "signature": "def __init__(self,...
2
stack_v2_sparse_classes_30k_train_004208
Implement the Python class `RecencyModel` described below. Class description: Implement the RecencyModel class. Method signatures and docstrings: - def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture a...
Implement the Python class `RecencyModel` described below. Class description: Implement the RecencyModel class. Method signatures and docstrings: - def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture a...
2a05aa98b501c8633e1fe2baf611d137740709de
<|skeleton|> class RecencyModel: def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): """Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecencyModel: def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): """Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ratio between ...
the_stack_v2_python_sparse
model/simple_model.py
ItayLieder/GMM_simulations
train
0
ae53ce51b67ccea4836c1ec7ad4421123c9336ed
[ "if not root:\n return '# '\nans = str(root.val) + ' '\nans += self.serialize(root.left)\nans += self.serialize(root.right)\nreturn ans", "def helper(data):\n if not data:\n return None\n cur = data.pop(0)\n if cur == '#':\n return None\n root = TreeNode(int(cur))\n root.left = hel...
<|body_start_0|> if not root: return '# ' ans = str(root.val) + ' ' ans += self.serialize(root.left) ans += self.serialize(root.right) return ans <|end_body_0|> <|body_start_1|> def helper(data): if not data: return None ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_000937
834
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_001252
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
64018a9ead8731ef98d48ab3bbd9d1dd6410c6e7
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '# ' ans = str(root.val) + ' ' ans += self.serialize(root.left) ans += self.serialize(root.right) return ans def deserialize(self, da...
the_stack_v2_python_sparse
449_SerializeandDeserializeBST/Codec.py
excaliburnan/SolutionsOnLeetcodeForZZW
train
0
59a6aad641515f42b8350b73d9551abc80647b6d
[ "def dfs(root, value):\n if root:\n value = dfs(root.left, value)\n value.append(root.val)\n value = dfs(root.right, value)\n return value\nvalue = dfs(root, [])\nhead = TreeNode(0)\ncopy_head = head\nfor i in value:\n root = TreeNode(i)\n head.right = root\n head = head.right\nr...
<|body_start_0|> def dfs(root, value): if root: value = dfs(root.left, value) value.append(root.val) value = dfs(root.right, value) return value value = dfs(root, []) head = TreeNode(0) copy_head = head for i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def increasingBST(self, root): """:type root: TreeNode :rtype: TreeNode 100 ms""" <|body_0|> def increasingBST_1(self, root, tail=None): """112ms 增加一个参数 :param root: :param tail: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> def...
stack_v2_sparse_classes_10k_train_000938
1,827
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode 100 ms", "name": "increasingBST", "signature": "def increasingBST(self, root)" }, { "docstring": "112ms 增加一个参数 :param root: :param tail: :return:", "name": "increasingBST_1", "signature": "def increasingBST_1(self, root, tail=None)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingBST(self, root): :type root: TreeNode :rtype: TreeNode 100 ms - def increasingBST_1(self, root, tail=None): 112ms 增加一个参数 :param root: :param tail: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingBST(self, root): :type root: TreeNode :rtype: TreeNode 100 ms - def increasingBST_1(self, root, tail=None): 112ms 增加一个参数 :param root: :param tail: :return: <|skele...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def increasingBST(self, root): """:type root: TreeNode :rtype: TreeNode 100 ms""" <|body_0|> def increasingBST_1(self, root, tail=None): """112ms 增加一个参数 :param root: :param tail: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def increasingBST(self, root): """:type root: TreeNode :rtype: TreeNode 100 ms""" def dfs(root, value): if root: value = dfs(root.left, value) value.append(root.val) value = dfs(root.right, value) return value ...
the_stack_v2_python_sparse
IncreasingOrderSearchTree_897.py
953250587/leetcode-python
train
2
3be51894584c440b2b70367639511c9fc0fd5062
[ "self.vals = deque()\nself.size = size\nself.curr_size = 0\nself.sum = 0", "if self.size == 0:\n return None\nself.curr_size += 1\nself.sum += val\nself.vals.append(val)\nif self.curr_size > self.size:\n self.sum -= self.vals.popleft()\n self.curr_size -= 1\nreturn self.sum / self.curr_size" ]
<|body_start_0|> self.vals = deque() self.size = size self.curr_size = 0 self.sum = 0 <|end_body_0|> <|body_start_1|> if self.size == 0: return None self.curr_size += 1 self.sum += val self.vals.append(val) if self.curr_size > self.siz...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.vals = deque() self.size...
stack_v2_sparse_classes_10k_train_000939
806
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_003507
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
692bf0e5aab402d55463274e99ab4d0ed56ce64c
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.vals = deque() self.size = size self.curr_size = 0 self.sum = 0 def next(self, val): """:type val: int :rtype: float""" if self.size == 0: ...
the_stack_v2_python_sparse
346-moving_avg_from_data_stream.py
WweiL/LeetCode
train
0
0e14fee914d0539960df826146901b0dda61af07
[ "root = setUp()\nself.assertEqual(root.left.value, 2)\nself.assertEqual(root.right.value, 10)\nself.assertEqual(root.left.right.value, 3)\nself.assertEqual(root.value, 5)", "root = setUp()\nroot.remove(2)\nself.assertEqual(root.left.value, 3)\nself.assertEqual(root.right.value, 10)\nself.assertEqual(root.left.rig...
<|body_start_0|> root = setUp() self.assertEqual(root.left.value, 2) self.assertEqual(root.right.value, 10) self.assertEqual(root.left.right.value, 3) self.assertEqual(root.value, 5) <|end_body_0|> <|body_start_1|> root = setUp() root.remove(2) self.asser...
Class with unittests for BST_Construction.py
test_BST_Construction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_BST_Construction: """Class with unittests for BST_Construction.py""" def test_Insert(self): """Checks insertion method""" <|body_0|> def test_Delete(self): """Checks deletion method""" <|body_1|> def test_Contains(self): """Checks conati...
stack_v2_sparse_classes_10k_train_000940
1,353
no_license
[ { "docstring": "Checks insertion method", "name": "test_Insert", "signature": "def test_Insert(self)" }, { "docstring": "Checks deletion method", "name": "test_Delete", "signature": "def test_Delete(self)" }, { "docstring": "Checks conatins method", "name": "test_Contains", ...
3
null
Implement the Python class `test_BST_Construction` described below. Class description: Class with unittests for BST_Construction.py Method signatures and docstrings: - def test_Insert(self): Checks insertion method - def test_Delete(self): Checks deletion method - def test_Contains(self): Checks conatins method
Implement the Python class `test_BST_Construction` described below. Class description: Class with unittests for BST_Construction.py Method signatures and docstrings: - def test_Insert(self): Checks insertion method - def test_Delete(self): Checks deletion method - def test_Contains(self): Checks conatins method <|sk...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_BST_Construction: """Class with unittests for BST_Construction.py""" def test_Insert(self): """Checks insertion method""" <|body_0|> def test_Delete(self): """Checks deletion method""" <|body_1|> def test_Contains(self): """Checks conati...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class test_BST_Construction: """Class with unittests for BST_Construction.py""" def test_Insert(self): """Checks insertion method""" root = setUp() self.assertEqual(root.left.value, 2) self.assertEqual(root.right.value, 10) self.assertEqual(root.left.right.value, 3) ...
the_stack_v2_python_sparse
DataStructures/BST_Construction/test_BST_Construction.py
JakubKazimierski/PythonPortfolio
train
9
67e5670b3e365348f8797cfe2df8113397c3eee7
[ "invalid = u'! @ # $ % ^ & * ( ) - = + , : ; \" | ~ / \\\\ \\x00 \\u202a'.split()\nbase = u'User%sName'\nexpected = False\nfor c in invalid:\n name = base % c\n result = user.isValidName(request, name)\nself.assertEqual(result, expected, 'Expected \"%(expected)s\" but got \"%(result)s\"' % locals())", "case...
<|body_start_0|> invalid = u'! @ # $ % ^ & * ( ) - = + , : ; " | ~ / \\ \x00 \u202a'.split() base = u'User%sName' expected = False for c in invalid: name = base % c result = user.isValidName(request, name) self.assertEqual(result, expected, 'Expected "%(ex...
IsValidNameTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsValidNameTestCase: def testNonAlnumCharacters(self): """user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.""" <|body_0|> def testWhitespace(self): """user: isValidName: reject leadin...
stack_v2_sparse_classes_10k_train_000941
8,790
no_license
[ { "docstring": "user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.", "name": "testNonAlnumCharacters", "signature": "def testNonAlnumCharacters(self)" }, { "docstring": "user: isValidName: reject leading, trailing...
3
stack_v2_sparse_classes_30k_train_006258
Implement the Python class `IsValidNameTestCase` described below. Class description: Implement the IsValidNameTestCase class. Method signatures and docstrings: - def testNonAlnumCharacters(self): user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to ...
Implement the Python class `IsValidNameTestCase` described below. Class description: Implement the IsValidNameTestCase class. Method signatures and docstrings: - def testNonAlnumCharacters(self): user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to ...
a2c30c3b742c65fb2c5bfbab1267d643823882a5
<|skeleton|> class IsValidNameTestCase: def testNonAlnumCharacters(self): """user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.""" <|body_0|> def testWhitespace(self): """user: isValidName: reject leadin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IsValidNameTestCase: def testNonAlnumCharacters(self): """user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.""" invalid = u'! @ # $ % ^ & * ( ) - = + , : ; " | ~ / \\ \x00 \u202a'.split() base = u'User%s...
the_stack_v2_python_sparse
mysocietyorg/moin/lib/python2.4/site-packages/MoinMoin/_tests/test_user.py
MyfanwyNixon/orgsites
train
0
0ea8ac8090ae397b5cfaaab7595b0d30ec78d823
[ "super().__init__(metadata, **kwargs)\nself.col = col\nbasic_meta = backend_key_to_query(key).copy()\nself.col.delete_many(basic_meta)\nbasic_meta['write_time'] = datetime.now(py_utc)\nbasic_meta['run_start_time'] = datetime.now(py_utc)\nbasic_meta['provides_meta'] = True\nself.run_start = None\nself.basic_md = bas...
<|body_start_0|> super().__init__(metadata, **kwargs) self.col = col basic_meta = backend_key_to_query(key).copy() self.col.delete_many(basic_meta) basic_meta['write_time'] = datetime.now(py_utc) basic_meta['run_start_time'] = datetime.now(py_utc) basic_meta['prov...
MongoSaver
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MongoSaver: def __init__(self, key: str, metadata: dict, col: collection.Collection, **kwargs): """Mongo saver :param key: string of strax.Datakey :param metadata: metadata to save belonging to data :param col: collection (NB! pymongo collection object) of mongo instance to write to""" ...
stack_v2_sparse_classes_10k_train_000942
14,056
permissive
[ { "docstring": "Mongo saver :param key: string of strax.Datakey :param metadata: metadata to save belonging to data :param col: collection (NB! pymongo collection object) of mongo instance to write to", "name": "__init__", "signature": "def __init__(self, key: str, metadata: dict, col: collection.Collec...
4
stack_v2_sparse_classes_30k_train_004948
Implement the Python class `MongoSaver` described below. Class description: Implement the MongoSaver class. Method signatures and docstrings: - def __init__(self, key: str, metadata: dict, col: collection.Collection, **kwargs): Mongo saver :param key: string of strax.Datakey :param metadata: metadata to save belongin...
Implement the Python class `MongoSaver` described below. Class description: Implement the MongoSaver class. Method signatures and docstrings: - def __init__(self, key: str, metadata: dict, col: collection.Collection, **kwargs): Mongo saver :param key: string of strax.Datakey :param metadata: metadata to save belongin...
a466a94b5dd576cf7eda12ace8760fd60dc3df11
<|skeleton|> class MongoSaver: def __init__(self, key: str, metadata: dict, col: collection.Collection, **kwargs): """Mongo saver :param key: string of strax.Datakey :param metadata: metadata to save belonging to data :param col: collection (NB! pymongo collection object) of mongo instance to write to""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MongoSaver: def __init__(self, key: str, metadata: dict, col: collection.Collection, **kwargs): """Mongo saver :param key: string of strax.Datakey :param metadata: metadata to save belonging to data :param col: collection (NB! pymongo collection object) of mongo instance to write to""" super()...
the_stack_v2_python_sparse
strax/storage/mongo.py
AxFoundation/strax
train
21
2b9a9ee0b49fb000be15190543892ac2ed410413
[ "super(TrajLoss, self).__init__()\nself.use_variance = use_variance\nself.cls_loss_weight = cls_loss_weight\nself.nll_loss_weight = nll_loss_weight\nself.loss_weight_minade = loss_weight_minade\nself.loss_weight_minfde = loss_weight_minfde", "traj = traj_preds\nlog_probs = traj_prob\ntraj_gt = gt_future_traj\nbat...
<|body_start_0|> super(TrajLoss, self).__init__() self.use_variance = use_variance self.cls_loss_weight = cls_loss_weight self.nll_loss_weight = nll_loss_weight self.loss_weight_minade = loss_weight_minade self.loss_weight_minfde = loss_weight_minfde <|end_body_0|> <|bod...
MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.
TrajLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrajLoss: """MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.""" def __init__(self, use_variance=False, cls_loss_weight=1.0, nll_loss_weight=1.0, loss_weight_minade=0.0, loss_weight_minfde=1.0, loss...
stack_v2_sparse_classes_10k_train_000943
8,891
permissive
[ { "docstring": "Initialize MTP loss :param args: Dictionary with the following (optional) keys use_variance: bool, whether or not to use variances for computing regression component of loss, default: False alpha: float, relative weight assigned to classification component, compared to regression component of lo...
2
stack_v2_sparse_classes_30k_train_006097
Implement the Python class `TrajLoss` described below. Class description: MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors. Method signatures and docstrings: - def __init__(self, use_variance=False, cls_loss_weight=1.0, nll_l...
Implement the Python class `TrajLoss` described below. Class description: MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors. Method signatures and docstrings: - def __init__(self, use_variance=False, cls_loss_weight=1.0, nll_l...
2f38ff1357d3956af11c5609d5275db56c559c20
<|skeleton|> class TrajLoss: """MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.""" def __init__(self, use_variance=False, cls_loss_weight=1.0, nll_loss_weight=1.0, loss_weight_minade=0.0, loss_weight_minfde=1.0, loss...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TrajLoss: """MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.""" def __init__(self, use_variance=False, cls_loss_weight=1.0, nll_loss_weight=1.0, loss_weight_minade=0.0, loss_weight_minfde=1.0, loss_weight_mr=1....
the_stack_v2_python_sparse
projects/mmdet3d_plugin/losses/traj_loss.py
OpenDriveLab/UniAD
train
2,156
00f3b73a17f249a6cb3ac196ce9111290f2d5d1a
[ "try:\n igdb = request.GET['igdb']\n game = Game.objects.get(igdb=igdb)\n user = CustomUser.objects.get(id=request.user.id)\n r = Ratings.objects.get(game=game, user=user)\nexcept ObjectDoesNotExist:\n return Response({})\nserializer = RatingSerializer(r)\nreturn Response(serializer.data)", "rating...
<|body_start_0|> try: igdb = request.GET['igdb'] game = Game.objects.get(igdb=igdb) user = CustomUser.objects.get(id=request.user.id) r = Ratings.objects.get(game=game, user=user) except ObjectDoesNotExist: return Response({}) serialize...
Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint.
Rate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rate: """Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint."...
stack_v2_sparse_classes_10k_train_000944
15,728
no_license
[ { "docstring": "Get rating for a specific game by the logged-in user. If the game or rating don't exist in the database, no rating exists, so we return nothing. Args: game: the game ID. Returns: response: a RatingSerializer indicating the user, game and rating.", "name": "get", "signature": "def get(sel...
2
stack_v2_sparse_classes_30k_train_006406
Implement the Python class `Rate` described below. Class description: Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authent...
Implement the Python class `Rate` described below. Class description: Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authent...
7f7e44ca0dae3525394458c16b7093f90612524b
<|skeleton|> class Rate: """Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint."...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Rate: """Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint.""" def g...
the_stack_v2_python_sparse
backend/actions/views.py
RMalmberg/overworld
train
3
13ca2ab3f3c99398ff018f03bb09bbded209500a
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('medinad', 'medinad')\napp1 = repo.medinad.app\ntickets = repo.medinad.tickets\n\ndef product(R, S):\n return [(t, u) for t in R for u in S]\n\ndef project(R, p):\n return [p(t) for t in R]\napp1_li...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('medinad', 'medinad') app1 = repo.medinad.app tickets = repo.medinad.tickets def product(R, S): return [(t, u) for t in R for ...
apptickets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class apptickets: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything ha...
stack_v2_sparse_classes_10k_train_000945
5,306
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_test_000044
Implement the Python class `apptickets` described below. Class description: Implement the apptickets class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime...
Implement the Python class `apptickets` described below. Class description: Implement the apptickets class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class apptickets: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything ha...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class apptickets: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('medinad', 'medinad') app1 = repo...
the_stack_v2_python_sparse
jtbloom_rfballes_medinad/medinad/apptickets.py
ROODAY/course-2017-fal-proj
train
3
857837e58561133e353303b45d72312fd1f9a497
[ "if os.name == 'nt':\n pass\nelse:\n self.fd = sys.stdin.fileno()\n self.new_term = termios.tcgetattr(self.fd)\n self.old_term = termios.tcgetattr(self.fd)\n self.new_term[3] = self.new_term[3] & ~termios.ICANON & ~termios.ECHO\n termios.tcsetattr(self.fd, termios.TCSAFLUSH, self.new_term)\n at...
<|body_start_0|> if os.name == 'nt': pass else: self.fd = sys.stdin.fileno() self.new_term = termios.tcgetattr(self.fd) self.old_term = termios.tcgetattr(self.fd) self.new_term[3] = self.new_term[3] & ~termios.ICANON & ~termios.ECHO ...
KBHit
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KBHit: def __init__(self): """Creates a KBHit object that you can call to do various keyboard things.""" <|body_0|> def set_normal_term(self): """Resets to normal terminal. On Windows this is a no-op.""" <|body_1|> def getch(self): """Returns a k...
stack_v2_sparse_classes_10k_train_000946
4,095
permissive
[ { "docstring": "Creates a KBHit object that you can call to do various keyboard things.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Resets to normal terminal. On Windows this is a no-op.", "name": "set_normal_term", "signature": "def set_normal_term(self)" ...
5
null
Implement the Python class `KBHit` described below. Class description: Implement the KBHit class. Method signatures and docstrings: - def __init__(self): Creates a KBHit object that you can call to do various keyboard things. - def set_normal_term(self): Resets to normal terminal. On Windows this is a no-op. - def ge...
Implement the Python class `KBHit` described below. Class description: Implement the KBHit class. Method signatures and docstrings: - def __init__(self): Creates a KBHit object that you can call to do various keyboard things. - def set_normal_term(self): Resets to normal terminal. On Windows this is a no-op. - def ge...
9253740baf46ebf4eacbce6bf3369150c5fb8ee0
<|skeleton|> class KBHit: def __init__(self): """Creates a KBHit object that you can call to do various keyboard things.""" <|body_0|> def set_normal_term(self): """Resets to normal terminal. On Windows this is a no-op.""" <|body_1|> def getch(self): """Returns a k...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KBHit: def __init__(self): """Creates a KBHit object that you can call to do various keyboard things.""" if os.name == 'nt': pass else: self.fd = sys.stdin.fileno() self.new_term = termios.tcgetattr(self.fd) self.old_term = termios.tcgeta...
the_stack_v2_python_sparse
pyocd/utility/kbhit.py
pyocd/pyOCD
train
507
1594477157a934f635f1b286347b458cc4e5d0df
[ "self.quit = False\nself.add = False\nself.delete = False\nself.item = None", "print('[command] [item] (command: a to add, d to delete, q to quit).')\nline = input()\ncommand = line[:1]\nself.item = line[2:]\nif command == 'a':\n self.add = True\nelif command == 'q':\n self.quit = True\nelif command == 'd':...
<|body_start_0|> self.quit = False self.add = False self.delete = False self.item = None <|end_body_0|> <|body_start_1|> print('[command] [item] (command: a to add, d to delete, q to quit).') line = input() command = line[:1] self.item = line[2:] ...
Order class.
Order
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Order: """Order class.""" def __init__(self): """Initializing the order.""" <|body_0|> def get_input(self): """Retrieve the order.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.quit = False self.add = False self.delete = F...
stack_v2_sparse_classes_10k_train_000947
630
permissive
[ { "docstring": "Initializing the order.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Retrieve the order.", "name": "get_input", "signature": "def get_input(self)" } ]
2
stack_v2_sparse_classes_30k_train_007284
Implement the Python class `Order` described below. Class description: Order class. Method signatures and docstrings: - def __init__(self): Initializing the order. - def get_input(self): Retrieve the order.
Implement the Python class `Order` described below. Class description: Order class. Method signatures and docstrings: - def __init__(self): Initializing the order. - def get_input(self): Retrieve the order. <|skeleton|> class Order: """Order class.""" def __init__(self): """Initializing the order.""...
fa58835d532126c4cfb0baf4cb8d9d8a0e2703d2
<|skeleton|> class Order: """Order class.""" def __init__(self): """Initializing the order.""" <|body_0|> def get_input(self): """Retrieve the order.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Order: """Order class.""" def __init__(self): """Initializing the order.""" self.quit = False self.add = False self.delete = False self.item = None def get_input(self): """Retrieve the order.""" print('[command] [item] (command: a to add, d to ...
the_stack_v2_python_sparse
sales/shopping_order.py
carlb15/Python
train
2
bcdbebfa4d8693a33adb23b2d37d47237b4ba330
[ "data = first_line(filename)\ndata = json.loads(data)\nreturn total_nums(data)", "data = first_line(filename)\ndata = json.loads(data)\nreturn total_nums_no_red(data)" ]
<|body_start_0|> data = first_line(filename) data = json.loads(data) return total_nums(data) <|end_body_0|> <|body_start_1|> data = first_line(filename) data = json.loads(data) return total_nums_no_red(data) <|end_body_1|>
AoC 2015 Day 12
Day12
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day12: """AoC 2015 Day 12""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 12 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2015 day 12 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000948
1,440
no_license
[ { "docstring": "Given a filename, solve 2015 day 12 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2015 day 12 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_000316
Implement the Python class `Day12` described below. Class description: AoC 2015 Day 12 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2015 day 12 part 1 - def part2(filename: str) -> int: Given a filename, solve 2015 day 12 part 2
Implement the Python class `Day12` described below. Class description: AoC 2015 Day 12 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2015 day 12 part 1 - def part2(filename: str) -> int: Given a filename, solve 2015 day 12 part 2 <|skeleton|> class Day12: """AoC 201...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day12: """AoC 2015 Day 12""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 12 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2015 day 12 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Day12: """AoC 2015 Day 12""" def part1(filename: str) -> int: """Given a filename, solve 2015 day 12 part 1""" data = first_line(filename) data = json.loads(data) return total_nums(data) def part2(filename: str) -> int: """Given a filename, solve 2015 day 12 p...
the_stack_v2_python_sparse
2015/python2015/aoc/day12.py
mreishus/aoc
train
16
aae448fa8cba82d39ec70b39f682f36f28a5824b
[ "self.ip = ip\nif interface not in netifaces.interfaces():\n logger.error('Error: No valid interface detected for external %s : %s.', ip, interface)\n sys.exit(1)\nself.interface = interface", "ip_packet = ethernet_packet.child()\ndelta_ttl = ip_packet.get_ip_ttl() - path\nip_packet.set_ip_ttl(delta_ttl)\ni...
<|body_start_0|> self.ip = ip if interface not in netifaces.interfaces(): logger.error('Error: No valid interface detected for external %s : %s.', ip, interface) sys.exit(1) self.interface = interface <|end_body_0|> <|body_start_1|> ip_packet = ethernet_packet.ch...
Defines bindings of external machine interfaces to virtual ips in the network
External
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class External: """Defines bindings of external machine interfaces to virtual ips in the network""" def __init__(self, ip, interface): """Function initialized an external machine in the network Args: ip : ip address of the machine in the network interface : network interface the machine is...
stack_v2_sparse_classes_10k_train_000949
28,024
permissive
[ { "docstring": "Function initialized an external machine in the network Args: ip : ip address of the machine in the network interface : network interface the machine is connected to", "name": "__init__", "signature": "def __init__(self, ip, interface)" }, { "docstring": "Function conveys traffic...
2
stack_v2_sparse_classes_30k_train_000127
Implement the Python class `External` described below. Class description: Defines bindings of external machine interfaces to virtual ips in the network Method signatures and docstrings: - def __init__(self, ip, interface): Function initialized an external machine in the network Args: ip : ip address of the machine in...
Implement the Python class `External` described below. Class description: Defines bindings of external machine interfaces to virtual ips in the network Method signatures and docstrings: - def __init__(self, ip, interface): Function initialized an external machine in the network Args: ip : ip address of the machine in...
a2812eddff632eceb68b6d00872617f536132788
<|skeleton|> class External: """Defines bindings of external machine interfaces to virtual ips in the network""" def __init__(self, ip, interface): """Function initialized an external machine in the network Args: ip : ip address of the machine in the network interface : network interface the machine is...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class External: """Defines bindings of external machine interfaces to virtual ips in the network""" def __init__(self, ip, interface): """Function initialized an external machine in the network Args: ip : ip address of the machine in the network interface : network interface the machine is connected to...
the_stack_v2_python_sparse
honeyd/core/element.py
kevindar/honeyd-python
train
0
8b57c5dc657fee3490a9dae1ab9e5a154da9fb4f
[ "self.mapping = {}\nfor i in xrange(len(words)):\n self.mapping[words[i]] = self.mapping.get(words[i], []) + [i]", "wl1 = self.mapping[word1]\nwl2 = self.mapping[word2]\ni = j = 0\nminlen = 1 << 31\nwhile i < len(wl1) and j < len(wl2):\n minlen = min(abs(wl1[i] - wl2[j]), minlen)\n if wl1[i] < wl2[j]:\n ...
<|body_start_0|> self.mapping = {} for i in xrange(len(words)): self.mapping[words[i]] = self.mapping.get(words[i], []) + [i] <|end_body_0|> <|body_start_1|> wl1 = self.mapping[word1] wl2 = self.mapping[word2] i = j = 0 minlen = 1 << 31 while i < len(...
WordDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """Adds a word into the data structure. :type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k_train_000950
982
permissive
[ { "docstring": "initialize your data structure here. :type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": "Adds a word into the data structure. :type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortes...
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: List[str] - def shortest(self, word1, word2): Adds a word into the data structure. :type word...
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: List[str] - def shortest(self, word1, word2): Adds a word into the data structure. :type word...
86f1cb98de801f58c39d9a48ce9de12df7303d20
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """Adds a word into the data structure. :type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: List[str]""" self.mapping = {} for i in xrange(len(words)): self.mapping[words[i]] = self.mapping.get(words[i], []) + [i] def shortest(self, word1, word2): """Adds a w...
the_stack_v2_python_sparse
244-Shortest-Word-Distance-II/solution.py
Tanych/CodeTracking
train
0
79b88cfb0013cfe3ff89046b6315c677f120f59b
[ "if not root:\n return ''\nres = [self.serialize(root.left), root.val, self.serialize(root.right)]\nreturn str(res)", "if not data:\n return\nleft, cur, right = eval(data)\nroot = TreeNode(cur)\nroot.left = self.deserialize(left)\nroot.right = self.deserialize(right)\nreturn root" ]
<|body_start_0|> if not root: return '' res = [self.serialize(root.left), root.val, self.serialize(root.right)] return str(res) <|end_body_0|> <|body_start_1|> if not data: return left, cur, right = eval(data) root = TreeNode(cur) root.lef...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_10k_train_000951
3,000
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_000777
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
6dc5b8968b6bef0186d3806e4aa35ee7b5d75ff2
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '' res = [self.serialize(root.left), root.val, self.serialize(root.right)] return str(res) def deserialize(self, data: str) -> TreeNode: """D...
the_stack_v2_python_sparse
letecode/361-480/441-460/449.py
hshrimp/letecode_for_me
train
1
3db8ffa1807be8ab32bd9f959a9469b5a5e2e493
[ "self.continuous = continuous\nstate_observations = [numpy.asarray(so) for so in state_observations]\nif continuous:\n self.state_distributions = [kde.gaussian_kde(so) for so in state_observations]\nelse:\n max_val = max((so.max() for so in state_observations))\n state_counts = [numpy.bincount(so, minlengt...
<|body_start_0|> self.continuous = continuous state_observations = [numpy.asarray(so) for so in state_observations] if continuous: self.state_distributions = [kde.gaussian_kde(so) for so in state_observations] else: max_val = max((so.max() for so in state_observat...
ObservationProbabilityEstimator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservationProbabilityEstimator: def __init__(self, state_observations, continuous=True, pseudocount=1): """Given a set of observations known to belong to different states, construct an object that will estimate the probability that new observations belong to each state (i.e. the p_obser...
stack_v2_sparse_classes_10k_train_000952
9,590
permissive
[ { "docstring": "Given a set of observations known to belong to different states, construct an object that will estimate the probability that new observations belong to each state (i.e. the p_observations_given_state matrix) Parameters: state_observations: list of length S containing an array of observation data...
2
stack_v2_sparse_classes_30k_test_000255
Implement the Python class `ObservationProbabilityEstimator` described below. Class description: Implement the ObservationProbabilityEstimator class. Method signatures and docstrings: - def __init__(self, state_observations, continuous=True, pseudocount=1): Given a set of observations known to belong to different sta...
Implement the Python class `ObservationProbabilityEstimator` described below. Class description: Implement the ObservationProbabilityEstimator class. Method signatures and docstrings: - def __init__(self, state_observations, continuous=True, pseudocount=1): Given a set of observations known to belong to different sta...
dc789acd481df86e0bc99e137ceb05c196425d03
<|skeleton|> class ObservationProbabilityEstimator: def __init__(self, state_observations, continuous=True, pseudocount=1): """Given a set of observations known to belong to different states, construct an object that will estimate the probability that new observations belong to each state (i.e. the p_obser...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObservationProbabilityEstimator: def __init__(self, state_observations, continuous=True, pseudocount=1): """Given a set of observations known to belong to different states, construct an object that will estimate the probability that new observations belong to each state (i.e. the p_observations_given_...
the_stack_v2_python_sparse
zplib/scalar_stats/hmm.py
zplab/zplib
train
1
1d56f70baf8e9185b69afd77dcd7fac15b19595c
[ "doc = xml.dom.minidom.Document()\narticleData = MetaXml.createGoobiMetadata(doc, article_metadata)\nmodsExtTag = doc.createElement('mods:extension')\nmodsExtTag.appendChild(articleData)\nmodsTag = doc.createElement('mods:mods')\nmodsTag.setAttributeNS('mods', 'xmlns:mods', 'http://www.loc.gov/mods/v3')\nmodsTag.ap...
<|body_start_0|> doc = xml.dom.minidom.Document() articleData = MetaXml.createGoobiMetadata(doc, article_metadata) modsExtTag = doc.createElement('mods:extension') modsExtTag.appendChild(articleData) modsTag = doc.createElement('mods:mods') modsTag.setAttributeNS('mods', ...
This class contains functions used for working with Goobi's meta.xml file
MetaXml
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetaXml: """This class contains functions used for working with Goobi's meta.xml file""" def generateArticleXml(article_id, article_metadata): """Given an id and a dictionary of data, create an XML node in the article format Metadata should follow this format: [ {'name': 'Abstract', ...
stack_v2_sparse_classes_10k_train_000953
3,630
no_license
[ { "docstring": "Given an id and a dictionary of data, create an XML node in the article format Metadata should follow this format: [ {'name': 'Abstract', 'data' : 'From the Roman Empire...' }, {'name' : 'TitleDocMain', 'data' : 'Return of the oppressed'}, {'name' : 'Author', 'type' : 'person', 'fields' : [ {'ta...
3
stack_v2_sparse_classes_30k_train_005066
Implement the Python class `MetaXml` described below. Class description: This class contains functions used for working with Goobi's meta.xml file Method signatures and docstrings: - def generateArticleXml(article_id, article_metadata): Given an id and a dictionary of data, create an XML node in the article format Me...
Implement the Python class `MetaXml` described below. Class description: This class contains functions used for working with Goobi's meta.xml file Method signatures and docstrings: - def generateArticleXml(article_id, article_metadata): Given an id and a dictionary of data, create an XML node in the article format Me...
1891071f6c5445cb9470b3d6a896fd6077466a37
<|skeleton|> class MetaXml: """This class contains functions used for working with Goobi's meta.xml file""" def generateArticleXml(article_id, article_metadata): """Given an id and a dictionary of data, create an XML node in the article format Metadata should follow this format: [ {'name': 'Abstract', ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetaXml: """This class contains functions used for working with Goobi's meta.xml file""" def generateArticleXml(article_id, article_metadata): """Given an id and a dictionary of data, create an XML node in the article format Metadata should follow this format: [ {'name': 'Abstract', 'data' : 'Fro...
the_stack_v2_python_sparse
kb/tools/goobi/meta_xml.py
kb-dk/goobi-scripts
train
0
720d2a07ca675ad86e8903581955833b08d1330f
[ "edgeList.sort(key=lambda x: x[2])\nself.__uf = VersionedUnionFind(n)\nself.__weights = []\nfor index, (i, j, weight) in enumerate(edgeList):\n if not self.__uf.union_set(i, j):\n continue\n self.__uf.snap()\n self.__weights.append(weight)", "snap_id = bisect.bisect_left(self.__weights, limit) - 1...
<|body_start_0|> edgeList.sort(key=lambda x: x[2]) self.__uf = VersionedUnionFind(n) self.__weights = [] for index, (i, j, weight) in enumerate(edgeList): if not self.__uf.union_set(i, j): continue self.__uf.snap() self.__weights.append...
DistanceLimitedPathsExist2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistanceLimitedPathsExist2: def __init__(self, n, edgeList): """:type n: int :type edgeList: List[List[int]]""" <|body_0|> def query(self, p, q, limit): """:type p: int :type q: int :type limit: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_000954
7,205
permissive
[ { "docstring": ":type n: int :type edgeList: List[List[int]]", "name": "__init__", "signature": "def __init__(self, n, edgeList)" }, { "docstring": ":type p: int :type q: int :type limit: int :rtype: bool", "name": "query", "signature": "def query(self, p, q, limit)" } ]
2
null
Implement the Python class `DistanceLimitedPathsExist2` described below. Class description: Implement the DistanceLimitedPathsExist2 class. Method signatures and docstrings: - def __init__(self, n, edgeList): :type n: int :type edgeList: List[List[int]] - def query(self, p, q, limit): :type p: int :type q: int :type ...
Implement the Python class `DistanceLimitedPathsExist2` described below. Class description: Implement the DistanceLimitedPathsExist2 class. Method signatures and docstrings: - def __init__(self, n, edgeList): :type n: int :type edgeList: List[List[int]] - def query(self, p, q, limit): :type p: int :type q: int :type ...
4dc4e6642dc92f1983c13564cc0fd99917cab358
<|skeleton|> class DistanceLimitedPathsExist2: def __init__(self, n, edgeList): """:type n: int :type edgeList: List[List[int]]""" <|body_0|> def query(self, p, q, limit): """:type p: int :type q: int :type limit: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DistanceLimitedPathsExist2: def __init__(self, n, edgeList): """:type n: int :type edgeList: List[List[int]]""" edgeList.sort(key=lambda x: x[2]) self.__uf = VersionedUnionFind(n) self.__weights = [] for index, (i, j, weight) in enumerate(edgeList): if not s...
the_stack_v2_python_sparse
Python/checking-existence-of-edge-length-limited-paths-ii.py
kamyu104/LeetCode-Solutions
train
4,549
fa1427fa9a6d84ce1a50449404e9fe79792ff85a
[ "def gcd(a, b):\n while b != 0:\n tmp = b\n b = a % b\n a = tmp\n return a\nif x + y < z:\n return False\nif x == z or y == z or x + y == z:\n return True\nreturn z % gcd(x, y) == 0", "import collections\nvisited = collections.defaultdict(dict)\nq = collections.deque([(0, 0)])\nwh...
<|body_start_0|> def gcd(a, b): while b != 0: tmp = b b = a % b a = tmp return a if x + y < z: return False if x == z or y == z or x + y == z: return True return z % gcd(x, y) == 0 <|end_body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canMeasureWater(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_0|> def canMeasureWater_BFS(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_000955
2,358
no_license
[ { "docstring": ":type x: int :type y: int :type z: int :rtype: bool", "name": "canMeasureWater", "signature": "def canMeasureWater(self, x, y, z)" }, { "docstring": ":type x: int :type y: int :type z: int :rtype: bool", "name": "canMeasureWater_BFS", "signature": "def canMeasureWater_BFS...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canMeasureWater(self, x, y, z): :type x: int :type y: int :type z: int :rtype: bool - def canMeasureWater_BFS(self, x, y, z): :type x: int :type y: int :type z: int :rtype: b...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canMeasureWater(self, x, y, z): :type x: int :type y: int :type z: int :rtype: bool - def canMeasureWater_BFS(self, x, y, z): :type x: int :type y: int :type z: int :rtype: b...
0a7aa09a2b95e4caca5b5123fb735ceb5c01e992
<|skeleton|> class Solution: def canMeasureWater(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_0|> def canMeasureWater_BFS(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canMeasureWater(self, x, y, z): """:type x: int :type y: int :type z: int :rtype: bool""" def gcd(a, b): while b != 0: tmp = b b = a % b a = tmp return a if x + y < z: return False ...
the_stack_v2_python_sparse
water-and-jug-problem.py
onestarshang/leetcode
train
0
cd546587a5335ddbe39bbdd1a8a7bb914f85dea8
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessPackage()", "from .access_package_assignment_policy import AccessPackageAssignmentPolicy\nfrom .access_package_catalog import AccessPackageCatalog\nfrom .access_package_resource_role_scope import AccessPackageResourceRoleScope\nf...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessPackage() <|end_body_0|> <|body_start_1|> from .access_package_assignment_policy import AccessPackageAssignmentPolicy from .access_package_catalog import AccessPackageCatalog ...
AccessPackage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessPackage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k_train_000956
6,428
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: AccessPackage", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
null
Implement the Python class `AccessPackage` described below. Class description: Implement the AccessPackage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackage: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `AccessPackage` described below. Class description: Implement the AccessPackage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackage: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessPackage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackage: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccessPackage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackage: """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: AccessPackag...
the_stack_v2_python_sparse
msgraph/generated/models/access_package.py
microsoftgraph/msgraph-sdk-python
train
135
f9cadcded151c9b6a9f402cd63432e1804b87ac7
[ "idx = 0\nwhile idx < len(intervals):\n cur = intervals[idx]\n if newInterval[0] <= cur[0]:\n intervals.insert(idx, newInterval)\n break\n else:\n idx += 1\nelse:\n intervals.append(newInterval)\nreturn self.merge(intervals)", "if len(intervals) < 2:\n return intervals\nidx = 0...
<|body_start_0|> idx = 0 while idx < len(intervals): cur = intervals[idx] if newInterval[0] <= cur[0]: intervals.insert(idx, newInterval) break else: idx += 1 else: intervals.append(newInterval) ...
Solution_B
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_B: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: """Insert the intervals only according to the first element, so that intervals is still sorted Then merge like LC056""" <|body_0|> def merge(self, intervals): """Help...
stack_v2_sparse_classes_10k_train_000957
4,614
permissive
[ { "docstring": "Insert the intervals only according to the first element, so that intervals is still sorted Then merge like LC056", "name": "insert", "signature": "def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]" }, { "docstring": "Helper B modified from l...
2
null
Implement the Python class `Solution_B` described below. Class description: Implement the Solution_B class. Method signatures and docstrings: - def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: Insert the intervals only according to the first element, so that intervals is still ...
Implement the Python class `Solution_B` described below. Class description: Implement the Solution_B class. Method signatures and docstrings: - def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: Insert the intervals only according to the first element, so that intervals is still ...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_B: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: """Insert the intervals only according to the first element, so that intervals is still sorted Then merge like LC056""" <|body_0|> def merge(self, intervals): """Help...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution_B: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: """Insert the intervals only according to the first element, so that intervals is still sorted Then merge like LC056""" idx = 0 while idx < len(intervals): cur = intervals[i...
the_stack_v2_python_sparse
LeetCode/LC057_insert_interval.py
jxie0755/Learning_Python
train
0
e74e64c7c73e5d81d8a59b53586a8cf9d678921e
[ "for i in range(num_consumer_types):\n if self.DiscFac == DiscFac_list[i]:\n self.solution_terminal.cFunc = deepcopy(consumers_ss[i].solution[0].cFunc)\n self.solution_terminal.vFunc = deepcopy(consumers_ss[i].solution[0].vFunc)\n self.solution_terminal.vPfunc = deepcopy(consumers_ss[i].solu...
<|body_start_0|> for i in range(num_consumer_types): if self.DiscFac == DiscFac_list[i]: self.solution_terminal.cFunc = deepcopy(consumers_ss[i].solution[0].cFunc) self.solution_terminal.vFunc = deepcopy(consumers_ss[i].solution[0].vFunc) self.solution...
FBSNK2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FBSNK2: def update_solution_terminal(self): """Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none""" <|body_0|> def sim_birth(self, which_agents): """Mak...
stack_v2_sparse_classes_10k_train_000958
31,380
no_license
[ { "docstring": "Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none", "name": "update_solution_terminal", "signature": "def update_solution_terminal(self)" }, { "docstring": "Makes ne...
2
stack_v2_sparse_classes_30k_train_000515
Implement the Python class `FBSNK2` described below. Class description: Implement the FBSNK2 class. Method signatures and docstrings: - def update_solution_terminal(self): Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Re...
Implement the Python class `FBSNK2` described below. Class description: Implement the FBSNK2 class. Method signatures and docstrings: - def update_solution_terminal(self): Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Re...
a7bc0bba0734ed6d16c0fe26f650118507e6c115
<|skeleton|> class FBSNK2: def update_solution_terminal(self): """Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none""" <|body_0|> def sim_birth(self, which_agents): """Mak...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FBSNK2: def update_solution_terminal(self): """Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none""" for i in range(num_consumer_types): if self.DiscFac == DiscFac_list...
the_stack_v2_python_sparse
Jacobians/ConsumptionJacobians/Jacobian-SS.py
wdu9/FBS-NK
train
1
fdb9af6308e60b7f913135329713a002b28acc66
[ "elem = deepcopy(elem)\nyld = elem.find('./YIELD')\nif yld is not None:\n yld.tag = 'YLD'\nreturn super(MFINFO, MFINFO).groom(elem)", "elem = deepcopy(elem)\nyld = elem.find('./YLD')\nif yld is not None:\n yld.tag = 'YIELD'\nreturn super(MFINFO, MFINFO).ungroom(elem)" ]
<|body_start_0|> elem = deepcopy(elem) yld = elem.find('./YIELD') if yld is not None: yld.tag = 'YLD' return super(MFINFO, MFINFO).groom(elem) <|end_body_0|> <|body_start_1|> elem = deepcopy(elem) yld = elem.find('./YLD') if yld is not None: ...
OFX section 13.8.5.3
MFINFO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MFINFO: """OFX section 13.8.5.3""" def groom(elem): """Rename all Elements tagged YIELD (reserved Python keyword) to YLD""" <|body_0|> def ungroom(elem): """Rename YLD back to YIELD""" <|body_1|> <|end_skeleton|> <|body_start_0|> elem = deepcopy...
stack_v2_sparse_classes_10k_train_000959
6,031
no_license
[ { "docstring": "Rename all Elements tagged YIELD (reserved Python keyword) to YLD", "name": "groom", "signature": "def groom(elem)" }, { "docstring": "Rename YLD back to YIELD", "name": "ungroom", "signature": "def ungroom(elem)" } ]
2
stack_v2_sparse_classes_30k_train_004761
Implement the Python class `MFINFO` described below. Class description: OFX section 13.8.5.3 Method signatures and docstrings: - def groom(elem): Rename all Elements tagged YIELD (reserved Python keyword) to YLD - def ungroom(elem): Rename YLD back to YIELD
Implement the Python class `MFINFO` described below. Class description: OFX section 13.8.5.3 Method signatures and docstrings: - def groom(elem): Rename all Elements tagged YIELD (reserved Python keyword) to YLD - def ungroom(elem): Rename YLD back to YIELD <|skeleton|> class MFINFO: """OFX section 13.8.5.3""" ...
67e688ea6510853657736c3804969d029c672c5c
<|skeleton|> class MFINFO: """OFX section 13.8.5.3""" def groom(elem): """Rename all Elements tagged YIELD (reserved Python keyword) to YLD""" <|body_0|> def ungroom(elem): """Rename YLD back to YIELD""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MFINFO: """OFX section 13.8.5.3""" def groom(elem): """Rename all Elements tagged YIELD (reserved Python keyword) to YLD""" elem = deepcopy(elem) yld = elem.find('./YIELD') if yld is not None: yld.tag = 'YLD' return super(MFINFO, MFINFO).groom(elem) ...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/ofxtools/models/invest/securities.py
yetaai/batchaccounting
train
0
5884c9d06bb9947a11e2247472b18c5c2f5c5815
[ "global op\nop = 0\nnext = pcs.Field('next_header', 8)\nlen = pcs.Field('length', 8)\ntype = pcs.Field('type', 8)\npcs.Packet.__init__(self, [next, len, type], bytes)", "global op\nop += 1\notype = pcs.Field('otype' + str(op), 8)\nolen = pcs.Field('olength' + str(op), 8, default=len / 8)\nif len != 0:\n odata ...
<|body_start_0|> global op op = 0 next = pcs.Field('next_header', 8) len = pcs.Field('length', 8) type = pcs.Field('type', 8) pcs.Packet.__init__(self, [next, len, type], bytes) <|end_body_0|> <|body_start_1|> global op op += 1 otype = pcs.Field('...
A class that contains the IPv6 hop-by-hop options extension-headers.
hopopts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hopopts: """A class that contains the IPv6 hop-by-hop options extension-headers.""" def __init__(self, bytes=None): """IPv6 hopbyhop options extension header from RFC 2460""" <|body_0|> def option(self, len=0): """add option header to the hop-by-hop extension hea...
stack_v2_sparse_classes_10k_train_000960
7,919
no_license
[ { "docstring": "IPv6 hopbyhop options extension header from RFC 2460", "name": "__init__", "signature": "def __init__(self, bytes=None)" }, { "docstring": "add option header to the hop-by-hop extension header", "name": "option", "signature": "def option(self, len=0)" } ]
2
stack_v2_sparse_classes_30k_train_000759
Implement the Python class `hopopts` described below. Class description: A class that contains the IPv6 hop-by-hop options extension-headers. Method signatures and docstrings: - def __init__(self, bytes=None): IPv6 hopbyhop options extension header from RFC 2460 - def option(self, len=0): add option header to the hop...
Implement the Python class `hopopts` described below. Class description: A class that contains the IPv6 hop-by-hop options extension-headers. Method signatures and docstrings: - def __init__(self, bytes=None): IPv6 hopbyhop options extension header from RFC 2460 - def option(self, len=0): add option header to the hop...
a070a39586b582fbeea72abf12bbfd812955ad81
<|skeleton|> class hopopts: """A class that contains the IPv6 hop-by-hop options extension-headers.""" def __init__(self, bytes=None): """IPv6 hopbyhop options extension header from RFC 2460""" <|body_0|> def option(self, len=0): """add option header to the hop-by-hop extension hea...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class hopopts: """A class that contains the IPv6 hop-by-hop options extension-headers.""" def __init__(self, bytes=None): """IPv6 hopbyhop options extension header from RFC 2460""" global op op = 0 next = pcs.Field('next_header', 8) len = pcs.Field('length', 8) t...
the_stack_v2_python_sparse
src/pcs/packets/ipv6.py
bilouro/tcptest
train
0
a4646da9f864ad16d92c13259e4cba52041ca990
[ "folder_path = os.path.abspath(raw_folder)\ndata = dict()\nfiles = os.listdir(folder_path)\nfor file in files:\n if is_ignored(file):\n continue\n try:\n file = os.path.join(raw_folder, file)\n datum = cls.process_file(file)\n except FileNotCompatible:\n continue\n _, kwrd = ...
<|body_start_0|> folder_path = os.path.abspath(raw_folder) data = dict() files = os.listdir(folder_path) for file in files: if is_ignored(file): continue try: file = os.path.join(raw_folder, file) datum = cls.process...
SpectreParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectreParser: def parse(cls, raw_folder: str) -> Dict[str, Any]: """parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.""" <|body_0|> def process_fil...
stack_v2_sparse_classes_10k_train_000961
2,408
permissive
[ { "docstring": "parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.", "name": "parse", "signature": "def parse(cls, raw_folder: str) -> Dict[str, Any]" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_001952
Implement the Python class `SpectreParser` described below. Class description: Implement the SpectreParser class. Method signatures and docstrings: - def parse(cls, raw_folder: str) -> Dict[str, Any]: parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionar...
Implement the Python class `SpectreParser` described below. Class description: Implement the SpectreParser class. Method signatures and docstrings: - def parse(cls, raw_folder: str) -> Dict[str, Any]: parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionar...
2ce6da8665d944bab8508a83bc4d3d07fd5afb35
<|skeleton|> class SpectreParser: def parse(cls, raw_folder: str) -> Dict[str, Any]: """parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.""" <|body_0|> def process_fil...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpectreParser: def parse(cls, raw_folder: str) -> Dict[str, Any]: """parses the spectre data in the raw folder :param raw_folder: absolute path to the spectre raw data :return: dictionary representing all the simulation data that has been saved.""" folder_path = os.path.abspath(raw_folder) ...
the_stack_v2_python_sparse
eval_engines/spectre/parser.py
kouroshHakha/bag_deep_ckt
train
19
f0c842f71926f58aad3f2622f4b321d0548122d2
[ "super().__init__(name=name)\nself._embed = embed\nself._reward_prediction = RewardPrediction(hidden_size=hidden_size, activation=activation)", "embeddings = snt.BatchApply(self._embed)(inputs)\nembeddings = snt.flatten(embeddings)\nlogits = self._reward_prediction(embeddings)\nreturn logits" ]
<|body_start_0|> super().__init__(name=name) self._embed = embed self._reward_prediction = RewardPrediction(hidden_size=hidden_size, activation=activation) <|end_body_0|> <|body_start_1|> embeddings = snt.BatchApply(self._embed)(inputs) embeddings = snt.flatten(embeddings) ...
Module that produces a reward prediction output from an observations input. This module implements the Reward prediction module from the FTW paper and wraps it together with a (possibly shared) embedding module (= embed). Thus, its output is a logits tensor, representing the log-probabilities for the 3 categories to pr...
RewardPredictionNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RewardPredictionNetwork: """Module that produces a reward prediction output from an observations input. This module implements the Reward prediction module from the FTW paper and wraps it together with a (possibly shared) embedding module (= embed). Thus, its output is a logits tensor, representi...
stack_v2_sparse_classes_10k_train_000962
10,989
no_license
[ { "docstring": "Initializes the RewardPredictionNetwork module. Args: embed: Embedding module (of type sonnet.Module) to transform observations into an embedding, e.g. FtwTorso. hidden_size: size of hidden linear layer activation: activation function to be used in RewardPrediction module (between linear and log...
2
stack_v2_sparse_classes_30k_train_005309
Implement the Python class `RewardPredictionNetwork` described below. Class description: Module that produces a reward prediction output from an observations input. This module implements the Reward prediction module from the FTW paper and wraps it together with a (possibly shared) embedding module (= embed). Thus, it...
Implement the Python class `RewardPredictionNetwork` described below. Class description: Module that produces a reward prediction output from an observations input. This module implements the Reward prediction module from the FTW paper and wraps it together with a (possibly shared) embedding module (= embed). Thus, it...
1c2b2768f2c5996c8cc998d0271f3857949bdaeb
<|skeleton|> class RewardPredictionNetwork: """Module that produces a reward prediction output from an observations input. This module implements the Reward prediction module from the FTW paper and wraps it together with a (possibly shared) embedding module (= embed). Thus, its output is a logits tensor, representi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RewardPredictionNetwork: """Module that produces a reward prediction output from an observations input. This module implements the Reward prediction module from the FTW paper and wraps it together with a (possibly shared) embedding module (= embed). Thus, its output is a logits tensor, representing the log-pr...
the_stack_v2_python_sparse
ftw/tf/networks/auxiliary.py
RaoulDrake/ftw
train
3
b587cb668f5e1e3ba09761e1bea04d15bcbd72a9
[ "super().__init__(entry, account, zone, entity_description)\nself._attr_state: StateType = None\nself._old_state: StateType = None", "if last_state is not None:\n self._attr_state = last_state.state\nif self.state == STATE_UNAVAILABLE:\n self._attr_available = False", "new_state = None\nif sia_event.code:...
<|body_start_0|> super().__init__(entry, account, zone, entity_description) self._attr_state: StateType = None self._old_state: StateType = None <|end_body_0|> <|body_start_1|> if last_state is not None: self._attr_state = last_state.state if self.state == STATE_UNAV...
Class for SIA Alarm Control Panels.
SIAAlarmControlPanel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SIAAlarmControlPanel: """Class for SIA Alarm Control Panels.""" def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: """Create SIAAlarmControlPanel object.""" <|body_0|> def handle_last_state(...
stack_v2_sparse_classes_10k_train_000963
4,240
permissive
[ { "docstring": "Create SIAAlarmControlPanel object.", "name": "__init__", "signature": "def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None" }, { "docstring": "Handle the last state.", "name": "handle_last_state",...
3
null
Implement the Python class `SIAAlarmControlPanel` described below. Class description: Class for SIA Alarm Control Panels. Method signatures and docstrings: - def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: Create SIAAlarmControlPanel ...
Implement the Python class `SIAAlarmControlPanel` described below. Class description: Class for SIA Alarm Control Panels. Method signatures and docstrings: - def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: Create SIAAlarmControlPanel ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SIAAlarmControlPanel: """Class for SIA Alarm Control Panels.""" def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: """Create SIAAlarmControlPanel object.""" <|body_0|> def handle_last_state(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SIAAlarmControlPanel: """Class for SIA Alarm Control Panels.""" def __init__(self, entry: ConfigEntry, account: str, zone: int, entity_description: SIAAlarmControlPanelEntityDescription) -> None: """Create SIAAlarmControlPanel object.""" super().__init__(entry, account, zone, entity_descr...
the_stack_v2_python_sparse
homeassistant/components/sia/alarm_control_panel.py
home-assistant/core
train
35,501
a7a935e17e4a551c4986fc4106fac8b74e866e63
[ "create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW)\ncreate_hm_flow.add(lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER]))\ncreate_hm_flow.add(database_tasks.MarkHealthMonitorPendingCreateInDB(requires=constants.HEALTH...
<|body_start_0|> create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW) create_hm_flow.add(lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER])) create_hm_flow.add(database_tasks.MarkHealthMonitorPendingCr...
HealthMonitorFlows
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthMonitorFlows: def get_create_health_monitor_flow(self): """Create a flow to create a health monitor :returns: The flow for creating a health monitor""" <|body_0|> def get_delete_health_monitor_flow(self): """Create a flow to delete a health monitor :returns: Th...
stack_v2_sparse_classes_10k_train_000964
4,639
permissive
[ { "docstring": "Create a flow to create a health monitor :returns: The flow for creating a health monitor", "name": "get_create_health_monitor_flow", "signature": "def get_create_health_monitor_flow(self)" }, { "docstring": "Create a flow to delete a health monitor :returns: The flow for deletin...
3
null
Implement the Python class `HealthMonitorFlows` described below. Class description: Implement the HealthMonitorFlows class. Method signatures and docstrings: - def get_create_health_monitor_flow(self): Create a flow to create a health monitor :returns: The flow for creating a health monitor - def get_delete_health_mo...
Implement the Python class `HealthMonitorFlows` described below. Class description: Implement the HealthMonitorFlows class. Method signatures and docstrings: - def get_create_health_monitor_flow(self): Create a flow to create a health monitor :returns: The flow for creating a health monitor - def get_delete_health_mo...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class HealthMonitorFlows: def get_create_health_monitor_flow(self): """Create a flow to create a health monitor :returns: The flow for creating a health monitor""" <|body_0|> def get_delete_health_monitor_flow(self): """Create a flow to delete a health monitor :returns: Th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HealthMonitorFlows: def get_create_health_monitor_flow(self): """Create a flow to create a health monitor :returns: The flow for creating a health monitor""" create_hm_flow = linear_flow.Flow(constants.CREATE_HEALTH_MONITOR_FLOW) create_hm_flow.add(lifecycle_tasks.HealthMonitorToErrorO...
the_stack_v2_python_sparse
octavia/controller/worker/v2/flows/health_monitor_flows.py
openstack/octavia
train
147
f71dbbae927fe13ef250bde6a7d167083652e69f
[ "self.check_parameters(params)\nexp = np.exp(1j * params[0])\nreturn UnitaryMatrix([[1, 0], [0, exp]])", "self.check_parameters(params)\ndexp = 1j * np.exp(1j * params[0])\nreturn np.array([[[0, 0], [0, dexp]]], dtype=np.complex128)", "self.check_env_matrix(env_matrix)\na = np.real(env_matrix[1, 1])\nb = np.ima...
<|body_start_0|> self.check_parameters(params) exp = np.exp(1j * params[0]) return UnitaryMatrix([[1, 0], [0, exp]]) <|end_body_0|> <|body_start_1|> self.check_parameters(params) dexp = 1j * np.exp(1j * params[0]) return np.array([[[0, 0], [0, dexp]]], dtype=np.complex12...
The U1 single qubit gate.
U1Gate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class U1Gate: """The U1 single qubit gate.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" <|body_0|> def get_grad(self, params: Sequence[float]=[]) -> np.ndarray: """Returns the...
stack_v2_sparse_classes_10k_train_000965
1,728
permissive
[ { "docstring": "Returns the unitary for this gate, see Unitary for more info.", "name": "get_unitary", "signature": "def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix" }, { "docstring": "Returns the gradient for this gate, see Gate for more info.", "name": "get_grad", "s...
3
stack_v2_sparse_classes_30k_train_006430
Implement the Python class `U1Gate` described below. Class description: The U1 single qubit gate. Method signatures and docstrings: - def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the unitary for this gate, see Unitary for more info. - def get_grad(self, params: Sequence[float]=[]) -> np...
Implement the Python class `U1Gate` described below. Class description: The U1 single qubit gate. Method signatures and docstrings: - def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the unitary for this gate, see Unitary for more info. - def get_grad(self, params: Sequence[float]=[]) -> np...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class U1Gate: """The U1 single qubit gate.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" <|body_0|> def get_grad(self, params: Sequence[float]=[]) -> np.ndarray: """Returns the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class U1Gate: """The U1 single qubit gate.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" self.check_parameters(params) exp = np.exp(1j * params[0]) return UnitaryMatrix([[1, 0], [0, exp]...
the_stack_v2_python_sparse
bqskit/ir/gates/parameterized/u1.py
mtreinish/bqskit
train
0
a6bae47c9c4a941bbf4612836085308b298e6ee1
[ "if os.path.exists(settings.GOVERNOR_INTERFACE):\n interface = settings.GOVERNOR_INTERFACE\n path = '/snapd/' + '/'.join(request.postpath)\nelse:\n interface = settings.SNAPD_INTERFACE\n path = '/' + '/'.join(request.postpath)\nbody = None\nheaders = {}\nctype = request.requestHeaders.getRawHeaders('Con...
<|body_start_0|> if os.path.exists(settings.GOVERNOR_INTERFACE): interface = settings.GOVERNOR_INTERFACE path = '/snapd/' + '/'.join(request.postpath) else: interface = settings.SNAPD_INTERFACE path = '/' + '/'.join(request.postpath) body = None ...
Expose the snapd API by forwarding requests. Changed in 0.13: we try to send the request through the governor service so that paradrop can be installed in strict mode. https://github.com/snapcore/snapd/wiki/REST-API
SnapdResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapdResource: """Expose the snapd API by forwarding requests. Changed in 0.13: we try to send the request through the governor service so that paradrop can be installed in strict mode. https://github.com/snapcore/snapd/wiki/REST-API""" def do_snapd_request(self, request): """Forward...
stack_v2_sparse_classes_10k_train_000966
2,158
permissive
[ { "docstring": "Forward the API request to snapd.", "name": "do_snapd_request", "signature": "def do_snapd_request(self, request)" }, { "docstring": "Fulfill requests by forwarding them to snapd. We use a synchronous implementation of HTTP over Unix sockets, so we do the request in a worker thre...
2
stack_v2_sparse_classes_30k_train_007145
Implement the Python class `SnapdResource` described below. Class description: Expose the snapd API by forwarding requests. Changed in 0.13: we try to send the request through the governor service so that paradrop can be installed in strict mode. https://github.com/snapcore/snapd/wiki/REST-API Method signatures and d...
Implement the Python class `SnapdResource` described below. Class description: Expose the snapd API by forwarding requests. Changed in 0.13: we try to send the request through the governor service so that paradrop can be installed in strict mode. https://github.com/snapcore/snapd/wiki/REST-API Method signatures and d...
c910fd5ac1d1b5e234f40f9f5592cc981e9bb5db
<|skeleton|> class SnapdResource: """Expose the snapd API by forwarding requests. Changed in 0.13: we try to send the request through the governor service so that paradrop can be installed in strict mode. https://github.com/snapcore/snapd/wiki/REST-API""" def do_snapd_request(self, request): """Forward...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SnapdResource: """Expose the snapd API by forwarding requests. Changed in 0.13: we try to send the request through the governor service so that paradrop can be installed in strict mode. https://github.com/snapcore/snapd/wiki/REST-API""" def do_snapd_request(self, request): """Forward the API requ...
the_stack_v2_python_sparse
paradrop/daemon/paradrop/backend/snapd_resource.py
ParadropLabs/Paradrop
train
88
c4d309a75020ab6eeafd6255881ba5197980b08b
[ "import revitron\ntry:\n return revitron.Document(self.element.GetLinkDocument()).getPath()\nexcept:\n pass", "import revitron\ntry:\n return revitron.DOC.GetElement(self.get('Type'))\nexcept:\n pass" ]
<|body_start_0|> import revitron try: return revitron.Document(self.element.GetLinkDocument()).getPath() except: pass <|end_body_0|> <|body_start_1|> import revitron try: return revitron.DOC.GetElement(self.get('Type')) except: ...
A wrapper class for Revit links.
LinkRvt
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkRvt: """A wrapper class for Revit links.""" def getPath(self): """Gets the path of the linked document. Returns: string: The path on disk""" <|body_0|> def getType(self): """Gets the type object of the link. Returns: object: The Link type""" <|body_1|...
stack_v2_sparse_classes_10k_train_000967
621
permissive
[ { "docstring": "Gets the path of the linked document. Returns: string: The path on disk", "name": "getPath", "signature": "def getPath(self)" }, { "docstring": "Gets the type object of the link. Returns: object: The Link type", "name": "getType", "signature": "def getType(self)" } ]
2
stack_v2_sparse_classes_30k_test_000131
Implement the Python class `LinkRvt` described below. Class description: A wrapper class for Revit links. Method signatures and docstrings: - def getPath(self): Gets the path of the linked document. Returns: string: The path on disk - def getType(self): Gets the type object of the link. Returns: object: The Link type
Implement the Python class `LinkRvt` described below. Class description: A wrapper class for Revit links. Method signatures and docstrings: - def getPath(self): Gets the path of the linked document. Returns: string: The path on disk - def getType(self): Gets the type object of the link. Returns: object: The Link type...
f373a0388c8b45f14f93510c9e8870190dba3b78
<|skeleton|> class LinkRvt: """A wrapper class for Revit links.""" def getPath(self): """Gets the path of the linked document. Returns: string: The path on disk""" <|body_0|> def getType(self): """Gets the type object of the link. Returns: object: The Link type""" <|body_1|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinkRvt: """A wrapper class for Revit links.""" def getPath(self): """Gets the path of the linked document. Returns: string: The path on disk""" import revitron try: return revitron.Document(self.element.GetLinkDocument()).getPath() except: pass ...
the_stack_v2_python_sparse
revitron/link.py
Thomas84/revitron
train
0
2993c58fb7b33bf4320ed9f245d41597339e7e9b
[ "if user_config_directory is CredentialsStore._DEFAULT_CONFIG_DIRECTORY:\n user_config_directory = util.get_user_config_directory()\n if user_config_directory is None:\n logger.warning('Credentials caching disabled - no private config directory found')\nif user_config_directory is None:\n self._cred...
<|body_start_0|> if user_config_directory is CredentialsStore._DEFAULT_CONFIG_DIRECTORY: user_config_directory = util.get_user_config_directory() if user_config_directory is None: logger.warning('Credentials caching disabled - no private config directory found') i...
Private file store for a `google.oauth2.credentials.Credentials`.
CredentialsStore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredentialsStore: """Private file store for a `google.oauth2.credentials.Credentials`.""" def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): """Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user con...
stack_v2_sparse_classes_10k_train_000968
16,711
permissive
[ { "docstring": "Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user configs, under which to store the credentials file. If not set, defaults to a platform-specific location. If set to None, the store is disabled (reads return None; write and cle...
4
null
Implement the Python class `CredentialsStore` described below. Class description: Private file store for a `google.oauth2.credentials.Credentials`. Method signatures and docstrings: - def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): Creates a CredentialsStore. Args: user_config_directory: Optional...
Implement the Python class `CredentialsStore` described below. Class description: Private file store for a `google.oauth2.credentials.Credentials`. Method signatures and docstrings: - def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): Creates a CredentialsStore. Args: user_config_directory: Optional...
5961c76dca0fb9bb40d146f5ce13834ac29d8ddb
<|skeleton|> class CredentialsStore: """Private file store for a `google.oauth2.credentials.Credentials`.""" def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): """Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user con...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CredentialsStore: """Private file store for a `google.oauth2.credentials.Credentials`.""" def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): """Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user configs, under w...
the_stack_v2_python_sparse
tensorboard/uploader/auth.py
tensorflow/tensorboard
train
6,766
118b13c4003ef41be67e7cf52bdc626f68c07633
[ "xy = numpy.insert(x, 0, values=y, axis=1)\ndf = pandas.DataFrame.from_records(xy)\ncolumns = ['y']\ncolumns_x = ['x' + str(i) for i in range(x.shape[1])]\ncolumns.extend(columns_x)\ndf.columns = columns\ndf.to_excel(path)", "columns = ['x' + str(i) for i in range(x.shape[1])]\ndf = pandas.DataFrame.from_records(...
<|body_start_0|> xy = numpy.insert(x, 0, values=y, axis=1) df = pandas.DataFrame.from_records(xy) columns = ['y'] columns_x = ['x' + str(i) for i in range(x.shape[1])] columns.extend(columns_x) df.columns = columns df.to_excel(path) <|end_body_0|> <|body_start_1|...
ExcelTool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExcelTool: def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): """:param self: :param x: :param y: :param path: 输出excel路径 :return:""" <|body_0|> def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): """存储预测数据集 :param x: :param path: :return:""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_000969
1,144
no_license
[ { "docstring": ":param self: :param x: :param y: :param path: 输出excel路径 :return:", "name": "saveXY2Excel", "signature": "def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx')" }, { "docstring": "存储预测数据集 :param x: :param path: :return:", "name": "saveX2Excel", "signature": "def saveX2Excel(...
3
stack_v2_sparse_classes_30k_train_005664
Implement the Python class `ExcelTool` described below. Class description: Implement the ExcelTool class. Method signatures and docstrings: - def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): :param self: :param x: :param y: :param path: 输出excel路径 :return: - def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): 存储预测数...
Implement the Python class `ExcelTool` described below. Class description: Implement the ExcelTool class. Method signatures and docstrings: - def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): :param self: :param x: :param y: :param path: 输出excel路径 :return: - def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): 存储预测数...
69b740332eaaecac553a4cc74c3e25f2af6889ac
<|skeleton|> class ExcelTool: def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): """:param self: :param x: :param y: :param path: 输出excel路径 :return:""" <|body_0|> def saveX2Excel(x, path='SALP_PREDICT_DATA.xlsx'): """存储预测数据集 :param x: :param path: :return:""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExcelTool: def saveXY2Excel(x, y, path='SALP_TRAIN_DATA.xlsx'): """:param self: :param x: :param y: :param path: 输出excel路径 :return:""" xy = numpy.insert(x, 0, values=y, axis=1) df = pandas.DataFrame.from_records(xy) columns = ['y'] columns_x = ['x' + str(i) for i in ran...
the_stack_v2_python_sparse
data/excelTools.py
9DemonFox/simpleLearning
train
9
3935a5406927ee70fe9136c685cba75f7cfb571e
[ "if self.request_token is None:\n redirect_url = build_absolute_uri(self.request, self.callback_url)\n headers = {'X-Accept': 'application/json'}\n data = {'consumer_key': self.consumer_key, 'redirect_uri': redirect_url}\n response = requests.post(url=self.request_token_url, json=data, headers=headers)\...
<|body_start_0|> if self.request_token is None: redirect_url = build_absolute_uri(self.request, self.callback_url) headers = {'X-Accept': 'application/json'} data = {'consumer_key': self.consumer_key, 'redirect_uri': redirect_url} response = requests.post(url=self...
PocketOAuthClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PocketOAuthClient: def _get_request_token(self): """Obtain a temporary request token to authorize an access token and to sign the request to obtain the access token""" <|body_0|> def get_redirect(self, authorization_url, extra_params): """Returns a ``HttpResponseRedi...
stack_v2_sparse_classes_10k_train_000970
3,273
permissive
[ { "docstring": "Obtain a temporary request token to authorize an access token and to sign the request to obtain the access token", "name": "_get_request_token", "signature": "def _get_request_token(self)" }, { "docstring": "Returns a ``HttpResponseRedirect`` object to redirect the user to the Po...
3
null
Implement the Python class `PocketOAuthClient` described below. Class description: Implement the PocketOAuthClient class. Method signatures and docstrings: - def _get_request_token(self): Obtain a temporary request token to authorize an access token and to sign the request to obtain the access token - def get_redirec...
Implement the Python class `PocketOAuthClient` described below. Class description: Implement the PocketOAuthClient class. Method signatures and docstrings: - def _get_request_token(self): Obtain a temporary request token to authorize an access token and to sign the request to obtain the access token - def get_redirec...
6b8911a5ebbabda0d446f2743bd4d00d250ed500
<|skeleton|> class PocketOAuthClient: def _get_request_token(self): """Obtain a temporary request token to authorize an access token and to sign the request to obtain the access token""" <|body_0|> def get_redirect(self, authorization_url, extra_params): """Returns a ``HttpResponseRedi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PocketOAuthClient: def _get_request_token(self): """Obtain a temporary request token to authorize an access token and to sign the request to obtain the access token""" if self.request_token is None: redirect_url = build_absolute_uri(self.request, self.callback_url) head...
the_stack_v2_python_sparse
allauth/socialaccount/providers/pocket/client.py
pennersr/django-allauth
train
7,719
39ee4a5fced47b3a3d474d763697c2d5249f784d
[ "if app:\n self.app = app\n self.init_app(app)", "self.init_config(app)\napp.extensions['invenio-app-ils'] = _InvenioAppIlsState(app)\napp.register_blueprint(Blueprint('invenio_app_ils_mail', __name__, template_folder='templates'))\nlogging.getLogger('py.warnings').propagate = False", "for k in dir(config...
<|body_start_0|> if app: self.app = app self.init_app(app) <|end_body_0|> <|body_start_1|> self.init_config(app) app.extensions['invenio-app-ils'] = _InvenioAppIlsState(app) app.register_blueprint(Blueprint('invenio_app_ils_mail', __name__, template_folder='templ...
Invenio App ILS UI app.
InvenioAppIls
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenioAppIls: """Invenio App ILS UI app.""" def __init__(self, app=None): """Extension initialization.""" <|body_0|> def init_app(self, app): """Flask application initialization.""" <|body_1|> def init_config(self, app): """Initialize config...
stack_v2_sparse_classes_10k_train_000971
3,362
permissive
[ { "docstring": "Extension initialization.", "name": "__init__", "signature": "def __init__(self, app=None)" }, { "docstring": "Flask application initialization.", "name": "init_app", "signature": "def init_app(self, app)" }, { "docstring": "Initialize configuration.", "name":...
3
stack_v2_sparse_classes_30k_train_002511
Implement the Python class `InvenioAppIls` described below. Class description: Invenio App ILS UI app. Method signatures and docstrings: - def __init__(self, app=None): Extension initialization. - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize configuration.
Implement the Python class `InvenioAppIls` described below. Class description: Invenio App ILS UI app. Method signatures and docstrings: - def __init__(self, app=None): Extension initialization. - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize configuration. <|ske...
961e88ba144b1371b629dfbc0baaf388e46e667f
<|skeleton|> class InvenioAppIls: """Invenio App ILS UI app.""" def __init__(self, app=None): """Extension initialization.""" <|body_0|> def init_app(self, app): """Flask application initialization.""" <|body_1|> def init_config(self, app): """Initialize config...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InvenioAppIls: """Invenio App ILS UI app.""" def __init__(self, app=None): """Extension initialization.""" if app: self.app = app self.init_app(app) def init_app(self, app): """Flask application initialization.""" self.init_config(app) ...
the_stack_v2_python_sparse
invenio_app_ils/ext.py
lauren-d/invenio-app-ils
train
0
a39273827da5a139d0ae4b1b1a2ee992980b92b8
[ "assert in_channels % 2 == 0, 'in_channels should be divisible by 2'\nsuper().__init__()\nself.half_channels = in_channels // 2\nself.use_only_mean = use_only_mean\nself.input_conv = torch.nn.Conv1d(self.half_channels, hidden_channels, 1)\nself.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_s...
<|body_start_0|> assert in_channels % 2 == 0, 'in_channels should be divisible by 2' super().__init__() self.half_channels = in_channels // 2 self.use_only_mean = use_only_mean self.input_conv = torch.nn.Conv1d(self.half_channels, hidden_channels, 1) self.encoder = WaveNe...
Residual affine coupling layer.
ResidualAffineCouplingLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualAffineCouplingLayer: """Residual affine coupling layer.""" def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: int=-1, dropout_rate: float=0.0, use_weight_norm: bool=True, bias: bo...
stack_v2_sparse_classes_10k_train_000972
7,596
permissive
[ { "docstring": "Initialzie ResidualAffineCouplingLayer module. Args: in_channels (int): Number of input channels. hidden_channels (int): Number of hidden channels. kernel_size (int): Kernel size for WaveNet. base_dilation (int): Base dilation factor for WaveNet. layers (int): Number of layers of WaveNet. stacks...
2
null
Implement the Python class `ResidualAffineCouplingLayer` described below. Class description: Residual affine coupling layer. Method signatures and docstrings: - def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: i...
Implement the Python class `ResidualAffineCouplingLayer` described below. Class description: Residual affine coupling layer. Method signatures and docstrings: - def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: i...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class ResidualAffineCouplingLayer: """Residual affine coupling layer.""" def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: int=-1, dropout_rate: float=0.0, use_weight_norm: bool=True, bias: bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResidualAffineCouplingLayer: """Residual affine coupling layer.""" def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: int=-1, dropout_rate: float=0.0, use_weight_norm: bool=True, bias: bool=True, use_...
the_stack_v2_python_sparse
espnet2/gan_tts/vits/residual_coupling.py
espnet/espnet
train
7,242
f734bfadb0561e90e1e3d50d833e2f8cfcbb1715
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessReviewSet()", "from .access_review_history_definition import AccessReviewHistoryDefinition\nfrom .access_review_schedule_definition import AccessReviewScheduleDefinition\nfrom .entity import Entity\nfrom .access_review_history_de...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AccessReviewSet() <|end_body_0|> <|body_start_1|> from .access_review_history_definition import AccessReviewHistoryDefinition from .access_review_schedule_definition import AccessReviewS...
AccessReviewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessReviewSet: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewSet: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret...
stack_v2_sparse_classes_10k_train_000973
3,028
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: AccessReviewSet", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_val...
3
stack_v2_sparse_classes_30k_train_007300
Implement the Python class `AccessReviewSet` described below. Class description: Implement the AccessReviewSet class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewSet: Creates a new instance of the appropriate class based on discriminator...
Implement the Python class `AccessReviewSet` described below. Class description: Implement the AccessReviewSet class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewSet: Creates a new instance of the appropriate class based on discriminator...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AccessReviewSet: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewSet: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccessReviewSet: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessReviewSet: """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: AccessRe...
the_stack_v2_python_sparse
msgraph/generated/models/access_review_set.py
microsoftgraph/msgraph-sdk-python
train
135
631de2942d6f0b78ea75799a7cdf87ae27958f39
[ "super().__init__()\nif not callable(raysampler):\n raise ValueError('\"raysampler\" has to be a \"Callable\" object.')\nif not callable(raymarcher):\n raise ValueError('\"raymarcher\" has to be a \"Callable\" object.')\nself.raysampler = raysampler\nself.raymarcher = raymarcher", "if not callable(volumetri...
<|body_start_0|> super().__init__() if not callable(raysampler): raise ValueError('"raysampler" has to be a "Callable" object.') if not callable(raymarcher): raise ValueError('"raymarcher" has to be a "Callable" object.') self.raysampler = raysampler self....
A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `volumetric_function` `Callable`, which defines ...
ImplicitRenderer
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImplicitRenderer: """A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `vol...
stack_v2_sparse_classes_10k_train_000974
17,111
permissive
[ { "docstring": "Args: raysampler: A `Callable` that takes as input scene cameras (an instance of `CamerasBase`) and returns a RayBundle or HeterogeneousRayBundle, that describes the rays emitted from the cameras. raymarcher: A `Callable` that receives the response of the `volumetric_function` (an input to `self...
2
stack_v2_sparse_classes_30k_train_001345
Implement the Python class `ImplicitRenderer` described below. Class description: A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input th...
Implement the Python class `ImplicitRenderer` described below. Class description: A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input th...
a3d99cab6bf5eb69be8d5eb48895da6edd859565
<|skeleton|> class ImplicitRenderer: """A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `vol...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ImplicitRenderer: """A class for rendering a batch of implicit surfaces. The class should be initialized with a raysampler and raymarcher class which both have to be a `Callable`. VOLUMETRIC_FUNCTION The `forward` function of the renderer accepts as input the rendering cameras as well as the `volumetric_funct...
the_stack_v2_python_sparse
pytorch3d/renderer/implicit/renderer.py
facebookresearch/pytorch3d
train
7,964
a7565767aba273b63778460edc7e99085fe1bbd6
[ "self.x = int(x)\nself.y = int(y)\nself.p = int(p)\nself.ip_address = ip_address", "if self.p > 0:\n return self.p\nelse:\n return TYPICAL_PHYSICAL_VIRTUAL_MAP[0 - self.p]", "result = CORE_RANGE.fullmatch(core_string)\nif result is not None:\n return range(int(result.group(1)), int(result.group(2)) + 1...
<|body_start_0|> self.x = int(x) self.y = int(y) self.p = int(p) self.ip_address = ip_address <|end_body_0|> <|body_start_1|> if self.p > 0: return self.p else: return TYPICAL_PHYSICAL_VIRTUAL_MAP[0 - self.p] <|end_body_1|> <|body_start_2|> ...
Represents a core to be ignored when building a machine.
IgnoreCore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IgnoreCore: """Represents a core to be ignored when building a machine.""" def __init__(self, x, y, p, ip_address=None): """:param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a...
stack_v2_sparse_classes_10k_train_000975
5,810
permissive
[ { "docstring": ":param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a core if > 0, or the physical core if <= 0 (actual value will be negated) :type p: int or str :param ip_address: Optional IP address whi...
5
stack_v2_sparse_classes_30k_train_006361
Implement the Python class `IgnoreCore` described below. Class description: Represents a core to be ignored when building a machine. Method signatures and docstrings: - def __init__(self, x, y, p, ip_address=None): :param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to igno...
Implement the Python class `IgnoreCore` described below. Class description: Represents a core to be ignored when building a machine. Method signatures and docstrings: - def __init__(self, x, y, p, ip_address=None): :param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to igno...
7ec4276879249d53ed8153a62b0b344c5f0b99e3
<|skeleton|> class IgnoreCore: """Represents a core to be ignored when building a machine.""" def __init__(self, x, y, p, ip_address=None): """:param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IgnoreCore: """Represents a core to be ignored when building a machine.""" def __init__(self, x, y, p, ip_address=None): """:param x: X coordinate of a core to ignore :type x: int or str :param y: Y coordinate of a core to ignore :type y: int or str :param p: The virtual core ID of a core if > 0,...
the_stack_v2_python_sparse
spinn_machine/ignores/ignore_core.py
SpiNNakerManchester/SpiNNMachine
train
6
763050d8f94b9409bd29b0aa821787ab0c1e103c
[ "result = []\nif not root:\n return 0\nstackOfNode = [root]\nstackOfString = [root.val]\nwhile stackOfNode:\n currNode = stackOfNode.pop()\n currString = stackOfString.pop()\n if currNode.left:\n stackOfNode.append(currNode.left)\n stackOfString.append(currString * 10 + currNode.left.val)\...
<|body_start_0|> result = [] if not root: return 0 stackOfNode = [root] stackOfString = [root.val] while stackOfNode: currNode = stackOfNode.pop() currString = stackOfString.pop() if currNode.left: stackOfNode.append...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumNumbers(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def sumNumbers_self(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] if not root: ...
stack_v2_sparse_classes_10k_train_000976
1,662
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "sumNumbers", "signature": "def sumNumbers(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "sumNumbers_self", "signature": "def sumNumbers_self(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_002025
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumNumbers(self, root): :type root: TreeNode :rtype: int - def sumNumbers_self(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumNumbers(self, root): :type root: TreeNode :rtype: int - def sumNumbers_self(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def sumNumbers...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def sumNumbers(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def sumNumbers_self(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sumNumbers(self, root): """:type root: TreeNode :rtype: int""" result = [] if not root: return 0 stackOfNode = [root] stackOfString = [root.val] while stackOfNode: currNode = stackOfNode.pop() currString = stackO...
the_stack_v2_python_sparse
129_sum_root_to_leaf_numbers/sol.py
lianke123321/leetcode_sol
train
0
0ad62148204938c5ab7c9f3f836c6f7bc2f50b2e
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IosUpdateConfiguration()", "from .day_of_week import DayOfWeek\nfrom .device_configuration import DeviceConfiguration\nfrom .day_of_week import DayOfWeek\nfrom .device_configuration import DeviceConfiguration\nfields: Dict[str, Callabl...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IosUpdateConfiguration() <|end_body_0|> <|body_start_1|> from .day_of_week import DayOfWeek from .device_configuration import DeviceConfiguration from .day_of_week import DayOfWe...
IOS Update Configuration, allows you to configure time window within week to install iOS updates
IosUpdateConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IosUpdateConfiguration: """IOS Update Configuration, allows you to configure time window within week to install iOS updates""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosUpdateConfiguration: """Creates a new instance of the appropriate class based...
stack_v2_sparse_classes_10k_train_000977
3,544
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: IosUpdateConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
stack_v2_sparse_classes_30k_train_000779
Implement the Python class `IosUpdateConfiguration` described below. Class description: IOS Update Configuration, allows you to configure time window within week to install iOS updates Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosUpdateConfigurati...
Implement the Python class `IosUpdateConfiguration` described below. Class description: IOS Update Configuration, allows you to configure time window within week to install iOS updates Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosUpdateConfigurati...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IosUpdateConfiguration: """IOS Update Configuration, allows you to configure time window within week to install iOS updates""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosUpdateConfiguration: """Creates a new instance of the appropriate class based...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IosUpdateConfiguration: """IOS Update Configuration, allows you to configure time window within week to install iOS updates""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosUpdateConfiguration: """Creates a new instance of the appropriate class based on discrimin...
the_stack_v2_python_sparse
msgraph/generated/models/ios_update_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
3d723c4c908b2393b1cd891282bd5e4aa7c20fb5
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn X509CertificateAuthenticationMethodConfiguration()", "from .authentication_method_configuration import AuthenticationMethodConfiguration\nfrom .authentication_method_target import AuthenticationMethodTarget\nfrom .x509_certificate_auth...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return X509CertificateAuthenticationMethodConfiguration() <|end_body_0|> <|body_start_1|> from .authentication_method_configuration import AuthenticationMethodConfiguration from .authentication...
X509CertificateAuthenticationMethodConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class X509CertificateAuthenticationMethodConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> X509CertificateAuthenticationMethodConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod...
stack_v2_sparse_classes_10k_train_000978
4,581
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: X509CertificateAuthenticationMethodConfiguration", "name": "create_from_discriminator_value", "signature": "...
3
null
Implement the Python class `X509CertificateAuthenticationMethodConfiguration` described below. Class description: Implement the X509CertificateAuthenticationMethodConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> X509CertificateAuthen...
Implement the Python class `X509CertificateAuthenticationMethodConfiguration` described below. Class description: Implement the X509CertificateAuthenticationMethodConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> X509CertificateAuthen...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class X509CertificateAuthenticationMethodConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> X509CertificateAuthenticationMethodConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse nod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class X509CertificateAuthenticationMethodConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> X509CertificateAuthenticationMethodConfiguration: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to re...
the_stack_v2_python_sparse
msgraph/generated/models/x509_certificate_authentication_method_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
401905174d6908ff175b93dd35435d6dd19d1f6a
[ "self.fname = fname\nif not fname:\n self.fname = sys.stdin", "line = self.fname.readline()\nwhile not line.startswith('>'):\n line = self.fname.readline()\nheader = line[1:].rstrip()\nsequence = ''\nfor line in self.fname:\n if line.startswith('>'):\n yield [header, sequence]\n header = li...
<|body_start_0|> self.fname = fname if not fname: self.fname = sys.stdin <|end_body_0|> <|body_start_1|> line = self.fname.readline() while not line.startswith('>'): line = self.fname.readline() header = line[1:].rstrip() sequence = '' for...
This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013
FastAreader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastAreader: """This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013""" def __init__(self, fname=''...
stack_v2_sparse_classes_10k_train_000979
1,405
no_license
[ { "docstring": "contructor: saves attribute fname", "name": "__init__", "signature": "def __init__(self, fname='')" }, { "docstring": "returns each FastA record as 2 strings - header and sequence. whitespace is removed, no adjustment is made to sequence contents. The initial '>' is removed from ...
2
stack_v2_sparse_classes_30k_train_002539
Implement the Python class `FastAreader` described below. Class description: This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2...
Implement the Python class `FastAreader` described below. Class description: This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2...
7236f20f52810195af397a07a797003c5c45b1e9
<|skeleton|> class FastAreader: """This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013""" def __init__(self, fname=''...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FastAreader: """This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013""" def __init__(self, fname=''): ""...
the_stack_v2_python_sparse
generate_read_size_distribution.py
belgravia/stacker-scripts
train
0
deec239cac777d1686d93df93e23797d6e50395c
[ "super(MenuPointer, self).__init__(image=MenuPointer.image, x=x, y=y, dx=0, dy=0)\nself.game = game\nself.selection = 0\nself.num_options = len(self.game.options) - 1\nself.menu = menu\nself.counter = 15", "if self.counter > 0:\n self.counter -= 1\nif self.counter == 0:\n if self.num_options > 0:\n i...
<|body_start_0|> super(MenuPointer, self).__init__(image=MenuPointer.image, x=x, y=y, dx=0, dy=0) self.game = game self.selection = 0 self.num_options = len(self.game.options) - 1 self.menu = menu self.counter = 15 <|end_body_0|> <|body_start_1|> if self.counter ...
Pointer for highlighting and making selections on the game menus
MenuPointer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MenuPointer: """Pointer for highlighting and making selections on the game menus""" def __init__(self, game, x, y, menu): """Initialize the sprite.""" <|body_0|> def update(self): """Move the pointer up and down through the options list If the user hits enter pro...
stack_v2_sparse_classes_10k_train_000980
3,711
no_license
[ { "docstring": "Initialize the sprite.", "name": "__init__", "signature": "def __init__(self, game, x, y, menu)" }, { "docstring": "Move the pointer up and down through the options list If the user hits enter proceed with the selected option", "name": "update", "signature": "def update(s...
4
stack_v2_sparse_classes_30k_val_000057
Implement the Python class `MenuPointer` described below. Class description: Pointer for highlighting and making selections on the game menus Method signatures and docstrings: - def __init__(self, game, x, y, menu): Initialize the sprite. - def update(self): Move the pointer up and down through the options list If th...
Implement the Python class `MenuPointer` described below. Class description: Pointer for highlighting and making selections on the game menus Method signatures and docstrings: - def __init__(self, game, x, y, menu): Initialize the sprite. - def update(self): Move the pointer up and down through the options list If th...
aab3e28ef659b9a62060940e752b22679b344fdf
<|skeleton|> class MenuPointer: """Pointer for highlighting and making selections on the game menus""" def __init__(self, game, x, y, menu): """Initialize the sprite.""" <|body_0|> def update(self): """Move the pointer up and down through the options list If the user hits enter pro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MenuPointer: """Pointer for highlighting and making selections on the game menus""" def __init__(self, game, x, y, menu): """Initialize the sprite.""" super(MenuPointer, self).__init__(image=MenuPointer.image, x=x, y=y, dx=0, dy=0) self.game = game self.selection = 0 ...
the_stack_v2_python_sparse
bin/menuPointer.py
noelano/Portal
train
0
60f20bb4d7b7964ceca30bd694f06e3681d15528
[ "neighbors = {}\nencoder = _IntegerEncoder()\nn_entries = len(table)\nfor n, (sequence, value) in enumerate(table.items()):\n if n % 1000000 == 0 or (n < 1000000 and n % 100000 == 0):\n logging.info('loading ScaM results %r/%r', n, n_entries)\n neighbor_sequences = [neighbor.docid for neighbor in value...
<|body_start_0|> neighbors = {} encoder = _IntegerEncoder() n_entries = len(table) for n, (sequence, value) in enumerate(table.items()): if n % 1000000 == 0 or (n < 1000000 and n % 100000 == 0): logging.info('loading ScaM results %r/%r', n, n_entries) ...
Matcher that uses pre-computed lookup tables generated by ScaM.
ScaMMatcher
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaMMatcher: """Matcher that uses pre-computed lookup tables generated by ScaM.""" def __init__(self, table, dtype='u4'): """Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed ...
stack_v2_sparse_classes_10k_train_000981
19,209
permissive
[ { "docstring": "Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed edit distance. dtype: optional object convertable to numpy.dtype to use for storing positive integer IDs. Raises: ValueError: if dtype wa...
3
null
Implement the Python class `ScaMMatcher` described below. Class description: Matcher that uses pre-computed lookup tables generated by ScaM. Method signatures and docstrings: - def __init__(self, table, dtype='u4'): Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence...
Implement the Python class `ScaMMatcher` described below. Class description: Matcher that uses pre-computed lookup tables generated by ScaM. Method signatures and docstrings: - def __init__(self, table, dtype='u4'): Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ScaMMatcher: """Matcher that uses pre-computed lookup tables generated by ScaM.""" def __init__(self, table, dtype='u4'): """Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScaMMatcher: """Matcher that uses pre-computed lookup tables generated by ScaM.""" def __init__(self, table, dtype='u4'): """Initialize as ScaMMatcher. Args: table: Mapping[str, result_pb2.NearestNeighbor] mapping each sequence to all of its (approximate) neighbors within some fixed edit distance...
the_stack_v2_python_sparse
aptamers_mlpd/preprocess/clustering.py
Jimmy-INL/google-research
train
1
2ce0900a1f9d3913db3dbd2041d6ae3060a6fc69
[ "assert len(self.buff_dict) == 10\nassert self.buff_dict.popitem() == (9, 9)\nassert len(self.buff_dict) == 9\nassert (9, 9) not in self.buff_dict.items()", "try:\n assert self.buff_dict.get(i) == i\nexcept AssertionError:\n assert self.buff_dict.get(i) is None" ]
<|body_start_0|> assert len(self.buff_dict) == 10 assert self.buff_dict.popitem() == (9, 9) assert len(self.buff_dict) == 9 assert (9, 9) not in self.buff_dict.items() <|end_body_0|> <|body_start_1|> try: assert self.buff_dict.get(i) == i except AssertionErro...
тесты для dict
TestDict2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест метода popitem""" <|body_0|> def test_dict_2_2(self, i): """тест метода get""" <|body_1|> <|end_skeleton|> <|body_start_0|> assert len(self.buff_dict) == 10 assert self.buf...
stack_v2_sparse_classes_10k_train_000982
1,316
no_license
[ { "docstring": "тест метода popitem", "name": "test_dict_2_1", "signature": "def test_dict_2_1(self)" }, { "docstring": "тест метода get", "name": "test_dict_2_2", "signature": "def test_dict_2_2(self, i)" } ]
2
stack_v2_sparse_classes_30k_train_001148
Implement the Python class `TestDict2` described below. Class description: тесты для dict Method signatures and docstrings: - def test_dict_2_1(self): тест метода popitem - def test_dict_2_2(self, i): тест метода get
Implement the Python class `TestDict2` described below. Class description: тесты для dict Method signatures and docstrings: - def test_dict_2_1(self): тест метода popitem - def test_dict_2_2(self, i): тест метода get <|skeleton|> class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест...
9c468bc73dc4e326f423cb7932090f59b50a4371
<|skeleton|> class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест метода popitem""" <|body_0|> def test_dict_2_2(self, i): """тест метода get""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestDict2: """тесты для dict""" def test_dict_2_1(self): """тест метода popitem""" assert len(self.buff_dict) == 10 assert self.buff_dict.popitem() == (9, 9) assert len(self.buff_dict) == 9 assert (9, 9) not in self.buff_dict.items() def test_dict_2_2(self, i)...
the_stack_v2_python_sparse
hw1/test_dict.py
ikramanop/2020-1-Atom-QA-Python-L-Marder
train
1
78bc9fcbed87191634711c7cfcefbb6f977882f5
[ "super(ICM, self).__init__(state_size, action_size, eta)\nself.hidden_dim = hidden_dim\nself.state_rep_size = state_rep_size\nself.learning_rate = learning_rate\nself.discrete_actions = discrete_actions\nself.model_dev = 'cpu'\nself.model = ICMNetwork(state_size, action_size, hidden_dim, state_rep_size, discrete_ac...
<|body_start_0|> super(ICM, self).__init__(state_size, action_size, eta) self.hidden_dim = hidden_dim self.state_rep_size = state_rep_size self.learning_rate = learning_rate self.discrete_actions = discrete_actions self.model_dev = 'cpu' self.model = ICMNetwork(st...
Intrinsic curiosity module (ICM) class Paper: Pathak, D., Agrawal, P., Efros, A. A., & Darrell, T. (2017). Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops (pp. 16-17). Link: http://openaccess.thecvf.com/content_cvpr_2...
ICM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ICM: """Intrinsic curiosity module (ICM) class Paper: Pathak, D., Agrawal, P., Efros, A. A., & Darrell, T. (2017). Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops (pp. 16-17). Link: http://opena...
stack_v2_sparse_classes_10k_train_000983
4,445
no_license
[ { "docstring": "Initialise parameters for MARL training :param state_size: dimension of state input :param action_size: dimension of action input :param hidden_dim: hidden dimension of networks :param state_rep_size: dimension of state representation in network :param learning_rate: learning rate for ICM parame...
4
stack_v2_sparse_classes_30k_train_000789
Implement the Python class `ICM` described below. Class description: Intrinsic curiosity module (ICM) class Paper: Pathak, D., Agrawal, P., Efros, A. A., & Darrell, T. (2017). Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Wo...
Implement the Python class `ICM` described below. Class description: Intrinsic curiosity module (ICM) class Paper: Pathak, D., Agrawal, P., Efros, A. A., & Darrell, T. (2017). Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Wo...
2afa0a9d83bd66a151c1a19242c5ef22cf4eb1f6
<|skeleton|> class ICM: """Intrinsic curiosity module (ICM) class Paper: Pathak, D., Agrawal, P., Efros, A. A., & Darrell, T. (2017). Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops (pp. 16-17). Link: http://opena...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ICM: """Intrinsic curiosity module (ICM) class Paper: Pathak, D., Agrawal, P., Efros, A. A., & Darrell, T. (2017). Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops (pp. 16-17). Link: http://openaccess.thecvf....
the_stack_v2_python_sparse
intrinsic_rewards/icm/icm.py
Jarvis-K/MSc_Curiosity_MARL
train
0
88b2439cbb6400403b7c3a34451b6355e3358996
[ "try:\n version = get_openflow_header(this_packet, 0)\n if version['version'] == 1:\n self.ofp = unpack10(this_packet)\n elif version['version'] == 4:\n self.ofp = unpack13(this_packet)\n else:\n self.ofp = 0\nexcept:\n self.ofp = 0", "if not libs.core.filters.filter_msg(self):...
<|body_start_0|> try: version = get_openflow_header(this_packet, 0) if version['version'] == 1: self.ofp = unpack10(this_packet) elif version['version'] == 4: self.ofp = unpack13(this_packet) else: self.ofp = 0 ...
Used to process all data regarding this OpenFlow message. With the python-openflow (pyof) lib, only one variable became necessary.
OFMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OFMessage: """Used to process all data regarding this OpenFlow message. With the python-openflow (pyof) lib, only one variable became necessary.""" def __init__(self, this_packet): """Instantiate OFMessage class Args: self: this class this_packet: OpenFlow msg in binary format""" ...
stack_v2_sparse_classes_10k_train_000984
2,331
permissive
[ { "docstring": "Instantiate OFMessage class Args: self: this class this_packet: OpenFlow msg in binary format", "name": "__init__", "signature": "def __init__(self, this_packet)" }, { "docstring": "Generic printing function Args: pkt: Packet class", "name": "print_packet", "signature": "...
2
stack_v2_sparse_classes_30k_train_002432
Implement the Python class `OFMessage` described below. Class description: Used to process all data regarding this OpenFlow message. With the python-openflow (pyof) lib, only one variable became necessary. Method signatures and docstrings: - def __init__(self, this_packet): Instantiate OFMessage class Args: self: thi...
Implement the Python class `OFMessage` described below. Class description: Used to process all data regarding this OpenFlow message. With the python-openflow (pyof) lib, only one variable became necessary. Method signatures and docstrings: - def __init__(self, this_packet): Instantiate OFMessage class Args: self: thi...
4b79b6c9ebb8f237ed189c38eefc9e98226606f6
<|skeleton|> class OFMessage: """Used to process all data regarding this OpenFlow message. With the python-openflow (pyof) lib, only one variable became necessary.""" def __init__(self, this_packet): """Instantiate OFMessage class Args: self: this class this_packet: OpenFlow msg in binary format""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OFMessage: """Used to process all data regarding this OpenFlow message. With the python-openflow (pyof) lib, only one variable became necessary.""" def __init__(self, this_packet): """Instantiate OFMessage class Args: self: this class this_packet: OpenFlow msg in binary format""" try: ...
the_stack_v2_python_sparse
libs/gen/ofmessage.py
amlight/ofp_sniffer
train
16
f82ae254c765166c3de130b28f3f1a59a127d1c0
[ "deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)\nfield_data.delta_P_dc -= deltap[0]\nfield_data.delta_P_omega -= deltap[1]", "deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc)\nfield_data.delta_P_dc += deltap[0]\nfield_data.delta_P_omega += deltap[1]", "delta...
<|body_start_0|> deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc) field_data.delta_P_dc -= deltap[0] field_data.delta_P_omega -= deltap[1] <|end_body_0|> <|body_start_1|> deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc) field_d...
similarity_drift_maps
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class similarity_drift_maps: def S_r(self, field_data, ptcl_data): """Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing""" <|body_0|> def S_r_inverse(self, field_data, ptcl_data): """Compute the ef...
stack_v2_sparse_classes_10k_train_000985
1,804
permissive
[ { "docstring": "Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing", "name": "S_r", "signature": "def S_r(self, field_data, ptcl_data)" }, { "docstring": "Compute the effects of the r-inverse similarity map on the fields ...
4
stack_v2_sparse_classes_30k_train_000694
Implement the Python class `similarity_drift_maps` described below. Class description: Implement the similarity_drift_maps class. Method signatures and docstrings: - def S_r(self, field_data, ptcl_data): Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :retu...
Implement the Python class `similarity_drift_maps` described below. Class description: Implement the similarity_drift_maps class. Method signatures and docstrings: - def S_r(self, field_data, ptcl_data): Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :retu...
14b119267686c64e2d0fcd3be19c365b8d486e22
<|skeleton|> class similarity_drift_maps: def S_r(self, field_data, ptcl_data): """Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing""" <|body_0|> def S_r_inverse(self, field_data, ptcl_data): """Compute the ef...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class similarity_drift_maps: def S_r(self, field_data, ptcl_data): """Compute the effects of the r similarity map on the fields and particles :param field_data: :param ptcl_data: :return: nothing""" deltap = field_data.compute_dFrdQ(ptcl_data.r, ptcl_data.z, ptcl_data.qOc) field_data.delta_P...
the_stack_v2_python_sparse
rssympim/sympim_rz/maps/similarity_drift_maps.py
radiasoft/rssympim
train
2
3e9af28a4872dd2a0eb5fafb9a1795c385c75977
[ "if not matrix:\n self.dp = None\n return\nm = len(matrix)\nn = len(matrix[0])\ndp = self.dp = [[0 for _ in range(n + 1)] for _ in range(m + 1)]\nfor x in range(1, m + 1):\n for y in range(1, n + 1):\n dp[x][y] = dp[x - 1][y] + dp[x][y - 1] - dp[x - 1][y - 1] + matrix[x - 1][y - 1]", "if not self....
<|body_start_0|> if not matrix: self.dp = None return m = len(matrix) n = len(matrix[0]) dp = self.dp = [[0 for _ in range(n + 1)] for _ in range(m + 1)] for x in range(1, m + 1): for y in range(1, n + 1): dp[x][y] = dp[x - 1][y...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_10k_train_000986
1,287
no_license
[ { "docstring": "initialize your data structure here. :type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp...
2
stack_v2_sparse_classes_30k_train_006840
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
a041962eeab9192799ad7f74b4bbd3e4f74933d0
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" if not matrix: self.dp = None return m = len(matrix) n = len(matrix[0]) dp = self.dp = [[0 for _ in range(n + 1)] for _ in range(m + 1...
the_stack_v2_python_sparse
codes/304. Range Sum Query 2D - Immutable.py
zcgu/leetcode
train
1
da93e0746aaedfb7d36cd653f0e250c0b86fe8cd
[ "Instrument.__init__(self, cle)\nself.emplacement = 'mains'\nself.positions = (1, 2)\nself.precision = 10\nself.calcul = 60\nself.etendre_editeur('r', 'précision', Uniligne, self, 'precision')\nself.etendre_editeur('ca', 'temps de calcul', Uniligne, self, 'calcul')", "precision = enveloppes['r']\nprecision.apercu...
<|body_start_0|> Instrument.__init__(self, cle) self.emplacement = 'mains' self.positions = (1, 2) self.precision = 10 self.calcul = 60 self.etendre_editeur('r', 'précision', Uniligne, self, 'precision') self.etendre_editeur('ca', 'temps de calcul', Uniligne, self...
Type d'objet: sextant.
Sextant
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sextant: """Type d'objet: sextant.""" def __init__(self, cle=''): """Constructeur de l'objet""" <|body_0|> def travailler_enveloppes(self, enveloppes): """Travail sur les enveloppes""" <|body_1|> def regarder(self, personnage): """Quand on re...
stack_v2_sparse_classes_10k_train_000987
3,821
permissive
[ { "docstring": "Constructeur de l'objet", "name": "__init__", "signature": "def __init__(self, cle='')" }, { "docstring": "Travail sur les enveloppes", "name": "travailler_enveloppes", "signature": "def travailler_enveloppes(self, enveloppes)" }, { "docstring": "Quand on regarde ...
3
null
Implement the Python class `Sextant` described below. Class description: Type d'objet: sextant. Method signatures and docstrings: - def __init__(self, cle=''): Constructeur de l'objet - def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes - def regarder(self, personnage): Quand on regarde la sextan...
Implement the Python class `Sextant` described below. Class description: Type d'objet: sextant. Method signatures and docstrings: - def __init__(self, cle=''): Constructeur de l'objet - def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes - def regarder(self, personnage): Quand on regarde la sextan...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class Sextant: """Type d'objet: sextant.""" def __init__(self, cle=''): """Constructeur de l'objet""" <|body_0|> def travailler_enveloppes(self, enveloppes): """Travail sur les enveloppes""" <|body_1|> def regarder(self, personnage): """Quand on re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Sextant: """Type d'objet: sextant.""" def __init__(self, cle=''): """Constructeur de l'objet""" Instrument.__init__(self, cle) self.emplacement = 'mains' self.positions = (1, 2) self.precision = 10 self.calcul = 60 self.etendre_editeur('r', 'précisi...
the_stack_v2_python_sparse
src/secondaires/navigation/types/sextant.py
vincent-lg/tsunami
train
5
71ac6e9debfe67d31456d98c384332719e0bc816
[ "parser = subparsers.add_parser('set', help=textwrap.fill('Set contents of pattoo DB.', width=width))\nself.subparsers = parser.add_subparsers(dest='qualifier')\nfor name in dir(self):\n attribute = getattr(self, name)\n if ismethod(attribute):\n if name.startswith('_'):\n continue\n ...
<|body_start_0|> parser = subparsers.add_parser('set', help=textwrap.fill('Set contents of pattoo DB.', width=width)) self.subparsers = parser.add_subparsers(dest='qualifier') for name in dir(self): attribute = getattr(self, name) if ismethod(attribute): i...
Class gathers all CLI 'set' information.
_Set
[ "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Set: """Class gathers all CLI 'set' information.""" def __init__(self, subparsers, width=80): """Intialize the class.""" <|body_0|> def language(self, width=80): """Process set language CLI commands. Args: width: Width of the help text string to STDIO before wra...
stack_v2_sparse_classes_10k_train_000988
14,703
permissive
[ { "docstring": "Intialize the class.", "name": "__init__", "signature": "def __init__(self, subparsers, width=80)" }, { "docstring": "Process set language CLI commands. Args: width: Width of the help text string to STDIO before wrapping Returns: None", "name": "language", "signature": "d...
3
stack_v2_sparse_classes_30k_val_000402
Implement the Python class `_Set` described below. Class description: Class gathers all CLI 'set' information. Method signatures and docstrings: - def __init__(self, subparsers, width=80): Intialize the class. - def language(self, width=80): Process set language CLI commands. Args: width: Width of the help text strin...
Implement the Python class `_Set` described below. Class description: Class gathers all CLI 'set' information. Method signatures and docstrings: - def __init__(self, subparsers, width=80): Intialize the class. - def language(self, width=80): Process set language CLI commands. Args: width: Width of the help text strin...
57bd3e82e49d51e3426b13ad53ed8326a735ce29
<|skeleton|> class _Set: """Class gathers all CLI 'set' information.""" def __init__(self, subparsers, width=80): """Intialize the class.""" <|body_0|> def language(self, width=80): """Process set language CLI commands. Args: width: Width of the help text string to STDIO before wra...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Set: """Class gathers all CLI 'set' information.""" def __init__(self, subparsers, width=80): """Intialize the class.""" parser = subparsers.add_parser('set', help=textwrap.fill('Set contents of pattoo DB.', width=width)) self.subparsers = parser.add_subparsers(dest='qualifier') ...
the_stack_v2_python_sparse
pattoo/cli/cli.py
palisadoes/pattoo
train
0
f218a16813a9351c677fdbc7a6ebe9d0242e2284
[ "QuestionTextFormRecord._init_map(self)\nQuestionFilesFormRecord._init_map(self)\nsuper(QuestionTextAndFilesMixin, self)._init_map()", "QuestionTextFormRecord._init_metadata(self)\nQuestionFilesFormRecord._init_metadata(self)\nsuper(QuestionTextAndFilesMixin, self)._init_metadata()" ]
<|body_start_0|> QuestionTextFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) super(QuestionTextAndFilesMixin, self)._init_map() <|end_body_0|> <|body_start_1|> QuestionTextFormRecord._init_metadata(self) QuestionFilesFormRecord._init_metadata(self) sup...
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
QuestionTextAndFilesMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionTextAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000989
22,562
permissive
[ { "docstring": "stub", "name": "_init_map", "signature": "def _init_map(self)" }, { "docstring": "stub", "name": "_init_metadata", "signature": "def _init_metadata(self)" } ]
2
null
Implement the Python class `QuestionTextAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub
Implement the Python class `QuestionTextAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub <|skeleton|> class QuestionTextAndFile...
445f968a175d61c8d92c0f617a3c17dc1dc7c584
<|skeleton|> class QuestionTextAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionTextAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" QuestionTextFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) super(QuestionTextAndFilesMixin, sel...
the_stack_v2_python_sparse
dlkit/records/assessment/basic/simple_records.py
mitsei/dlkit
train
2
669d87757f3be036c1f9421489221e332c9a2d63
[ "try:\n inst = Tenant.objects.get(pk=inst_id)\nexcept Tenant.DoesNotExist:\n return api_error(code=404, msg=_('Tenant not existed.'))\ninst_admins = [x.user for x in TenantAdmin.objects.filter(tenant=inst)]\nusernames = [x.user for x in Profile.objects.filter(tenant=inst.name)]\nusers = [User.objects.get(x) f...
<|body_start_0|> try: inst = Tenant.objects.get(pk=inst_id) except Tenant.DoesNotExist: return api_error(code=404, msg=_('Tenant not existed.')) inst_admins = [x.user for x in TenantAdmin.objects.filter(tenant=inst)] usernames = [x.user for x in Profile.objects.fi...
AdminTenant
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminTenant: def get(self, request, inst_id): """Get tenant details""" <|body_0|> def put(self, request, inst_id): """Update tenant quota""" <|body_1|> def delete(self, request, inst_id): """Delete a tenant""" <|body_2|> <|end_skeleton|>...
stack_v2_sparse_classes_10k_train_000990
34,523
permissive
[ { "docstring": "Get tenant details", "name": "get", "signature": "def get(self, request, inst_id)" }, { "docstring": "Update tenant quota", "name": "put", "signature": "def put(self, request, inst_id)" }, { "docstring": "Delete a tenant", "name": "delete", "signature": "d...
3
null
Implement the Python class `AdminTenant` described below. Class description: Implement the AdminTenant class. Method signatures and docstrings: - def get(self, request, inst_id): Get tenant details - def put(self, request, inst_id): Update tenant quota - def delete(self, request, inst_id): Delete a tenant
Implement the Python class `AdminTenant` described below. Class description: Implement the AdminTenant class. Method signatures and docstrings: - def get(self, request, inst_id): Get tenant details - def put(self, request, inst_id): Update tenant quota - def delete(self, request, inst_id): Delete a tenant <|skeleton...
13b3ed26a04248211ef91ca70dccc617be27a3c3
<|skeleton|> class AdminTenant: def get(self, request, inst_id): """Get tenant details""" <|body_0|> def put(self, request, inst_id): """Update tenant quota""" <|body_1|> def delete(self, request, inst_id): """Delete a tenant""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdminTenant: def get(self, request, inst_id): """Get tenant details""" try: inst = Tenant.objects.get(pk=inst_id) except Tenant.DoesNotExist: return api_error(code=404, msg=_('Tenant not existed.')) inst_admins = [x.user for x in TenantAdmin.objects.filt...
the_stack_v2_python_sparse
fhs/usr/share/python/syncwerk/restapi/restapi/api3/custom/admin/tenants.py
syncwerk/syncwerk-server-restapi
train
0
95f8d5cdb04db131eec782075bf3a3abf601f4e7
[ "self.beta1 = beta1\nself.beta2 = beta2\nself.eps = eps\nmomentums = dict()\nvelocitys = dict()\nfor k, v in model.params.items():\n momentums[k] = np.zeros_like(v)\n velocitys[k] = np.zeros_like(v)\nself.momentums = momentums\nself.velocitys = velocitys\nself.t = 0", "beta1 = self.beta1\nbeta2 = self.beta2...
<|body_start_0|> self.beta1 = beta1 self.beta2 = beta2 self.eps = eps momentums = dict() velocitys = dict() for k, v in model.params.items(): momentums[k] = np.zeros_like(v) velocitys[k] = np.zeros_like(v) self.momentums = momentums ...
AdamOptim
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamOptim: def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): """Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be differen...
stack_v2_sparse_classes_10k_train_000991
9,004
no_license
[ { "docstring": "Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be different", "name": "__init__", "signature": "def __init__(self, model, beta1=0.9, b...
2
stack_v2_sparse_classes_30k_train_003320
Implement the Python class `AdamOptim` described below. Class description: Implement the AdamOptim class. Method signatures and docstrings: - def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (floa...
Implement the Python class `AdamOptim` described below. Class description: Implement the AdamOptim class. Method signatures and docstrings: - def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (floa...
a401d09c28432109e9ced10e5011bff97dda05b9
<|skeleton|> class AdamOptim: def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): """Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be differen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdamOptim: def __init__(self, model, beta1=0.9, beta2=0.999, eps=1e-08): """Inputs: :param model: a neural network class object :param beta1: (float) should be close to 1 :param beta2: (float) similar to beta1 :param eps: (float) in different case, the good value for eps will be different""" s...
the_stack_v2_python_sparse
assignment2/E4040.2017.Assign2.xw2501/E4040.2017.Assign2.xw2501/ecbm4040/optimizers.py
xw2501/Deep_Learning_study
train
7
9b90606d3456f8603f6db3ae0aea5585b0173077
[ "picking_obj = self.pool.get('stock.picking')\nseq_obj_name = self._name\nvals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)\nnew_id = picking_obj.create(cr, user, vals, context)\nreturn new_id", "picking_obj = self.pool.get('stock.picking')\nwrite_boolean = picking_obj.write(cr, uid, ids, va...
<|body_start_0|> picking_obj = self.pool.get('stock.picking') seq_obj_name = self._name vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) new_id = picking_obj.create(cr, user, vals, context) return new_id <|end_body_0|> <|body_start_1|> picking_obj ...
stock_picking_out
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_out: def create(self, cr, user, vals, context=None): """Override create to call create of stock.picking""" <|body_0|> def write(self, cr, uid, ids, vals, context=None): """Override write to call write of stock.picking""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_000992
17,898
no_license
[ { "docstring": "Override create to call create of stock.picking", "name": "create", "signature": "def create(self, cr, user, vals, context=None)" }, { "docstring": "Override write to call write of stock.picking", "name": "write", "signature": "def write(self, cr, uid, ids, vals, context=...
2
stack_v2_sparse_classes_30k_train_007001
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def create(self, cr, user, vals, context=None): Override create to call create of stock.picking - def write(self, cr, uid, ids, vals, context=None): Override wr...
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def create(self, cr, user, vals, context=None): Override create to call create of stock.picking - def write(self, cr, uid, ids, vals, context=None): Override wr...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class stock_picking_out: def create(self, cr, user, vals, context=None): """Override create to call create of stock.picking""" <|body_0|> def write(self, cr, uid, ids, vals, context=None): """Override write to call write of stock.picking""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class stock_picking_out: def create(self, cr, user, vals, context=None): """Override create to call create of stock.picking""" picking_obj = self.pool.get('stock.picking') seq_obj_name = self._name vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name) new_id...
the_stack_v2_python_sparse
v_7/NISS/shamil_v3/stock_oc/model/stock.py
musabahmed/baba
train
0
d5b807a3a7122fb54658b4a180be703ef8b52f96
[ "self._feature_columns = feature_columns\nself._optimizer_fn = optimizer_fn\nself._checkpoint_dir = checkpoint_dir\nself._hparams = hparams\nself._aux_head_weight = hparams.aux_head_weight\nself._learn_mixture_weights = hparams.learn_mixture_weights\nself._initial_learning_rate = hparams.initial_learning_rate\nself...
<|body_start_0|> self._feature_columns = feature_columns self._optimizer_fn = optimizer_fn self._checkpoint_dir = checkpoint_dir self._hparams = hparams self._aux_head_weight = hparams.aux_head_weight self._learn_mixture_weights = hparams.learn_mixture_weights sel...
Builds a NASNet subnetwork for AdaNet.
Builder
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Builder: """Builds a NASNet subnetwork for AdaNet.""" def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): """Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_r...
stack_v2_sparse_classes_10k_train_000993
11,982
permissive
[ { "docstring": "Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_rate' argument and returns an `Optimizer` instance and learning rate `Tensor` which may have a custom learning rate schedule applied. checkpoint_dir: Ch...
5
stack_v2_sparse_classes_30k_train_003933
Implement the Python class `Builder` described below. Class description: Builds a NASNet subnetwork for AdaNet. Method signatures and docstrings: - def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem...
Implement the Python class `Builder` described below. Class description: Builds a NASNet subnetwork for AdaNet. Method signatures and docstrings: - def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem...
74106c51e0602bdd62b643f4d6c42a00142947bc
<|skeleton|> class Builder: """Builds a NASNet subnetwork for AdaNet.""" def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): """Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Builder: """Builds a NASNet subnetwork for AdaNet.""" def __init__(self, feature_columns, optimizer_fn, checkpoint_dir, hparams, seed): """Initializes a `Builder`. Args: feature_columns: The input feature columns of the problem. optimizer_fn: Function that accepts a float 'learning_rate' argument...
the_stack_v2_python_sparse
research/improve_nas/trainer/improve_nas.py
todun/adanet
train
1
70f9553d80bd7ebd981f9f855e99f0ce93ffd8b1
[ "if len(nums) < 2:\n return True\none_chance = False\nfor i in range(len(nums) - 1):\n if nums[i] > nums[i + 1]:\n if not one_chance:\n one_chance = True\n else:\n return False\nreturn True", "if len(nums) < 2:\n return True\nlast = nums[0]\nindex = 1\none_chance = Fal...
<|body_start_0|> if len(nums) < 2: return True one_chance = False for i in range(len(nums) - 1): if nums[i] > nums[i + 1]: if not one_chance: one_chance = True else: return False return True <...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def __checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def checkPossibility(self, nums): """:type nums: List[int] :r...
stack_v2_sparse_classes_10k_train_000994
3,075
permissive
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "_checkPossibility", "signature": "def _checkPossibility(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "__checkPossibility", "signature": "def __checkPossibility(self, nums)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_005470
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def __checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums):...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def __checkPossibility(self, nums): :type nums: List[int] :rtype: bool - def checkPossibility(self, nums):...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def __checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> def checkPossibility(self, nums): """:type nums: List[int] :r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def _checkPossibility(self, nums): """:type nums: List[int] :rtype: bool""" if len(nums) < 2: return True one_chance = False for i in range(len(nums) - 1): if nums[i] > nums[i + 1]: if not one_chance: one_cha...
the_stack_v2_python_sparse
665.non-decreasing-array.py
windard/leeeeee
train
0
7b65e94561f3e63be754cbcfd733623c3f4aaed0
[ "if model._meta.app_label in self.auth_apps:\n return 'default'\nreturn None", "if model._meta.app_label in self.auth_apps:\n return 'default'\nreturn None", "if obj1._meta.app_label in self.auth_apps or obj2._meta.app_label in self.auth_apps:\n return True\nreturn None", "if app_label == 'auth':\n ...
<|body_start_0|> if model._meta.app_label in self.auth_apps: return 'default' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.auth_apps: return 'default' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label in ...
A router to control all database operations on models in the auth application.
AuthRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_10k_train_000995
3,782
no_license
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
stack_v2_sparse_classes_30k_train_006544
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): At...
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): At...
9858638344366fd60e9b75a299326f951e7e66d0
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if model._meta.app_label in self.auth_apps: return 'default' return None def d...
the_stack_v2_python_sparse
aqi_backend/common/database_routers.py
dschurholz/myaqi-backend
train
0
0ecf8cdd2d74a740da3fa2ca28fd824a00d415ec
[ "self._watcher = watcher\nself._default_value = default_value\nself._flag = threading.Event()\nself.watch()", "if self._default_value:\n return not self._flag.is_set()\nelse:\n return self._flag.is_set()", "if self._watcher.watch():\n self._flag.set()\nelse:\n self._flag.clear()" ]
<|body_start_0|> self._watcher = watcher self._default_value = default_value self._flag = threading.Event() self.watch() <|end_body_0|> <|body_start_1|> if self._default_value: return not self._flag.is_set() else: return self._flag.is_set() <|end_...
FeatureSwitch checks if a feature is enabled or not.
FeatureSwitch
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureSwitch: """FeatureSwitch checks if a feature is enabled or not.""" def __init__(self, watcher, default_value): """Constructor for FeatureSwitch. Args: watcher: the watcher object used to determine if the feature is enabled or not default_value: bool, value when the watcher obj...
stack_v2_sparse_classes_10k_train_000996
4,327
permissive
[ { "docstring": "Constructor for FeatureSwitch. Args: watcher: the watcher object used to determine if the feature is enabled or not default_value: bool, value when the watcher object returns False", "name": "__init__", "signature": "def __init__(self, watcher, default_value)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_001347
Implement the Python class `FeatureSwitch` described below. Class description: FeatureSwitch checks if a feature is enabled or not. Method signatures and docstrings: - def __init__(self, watcher, default_value): Constructor for FeatureSwitch. Args: watcher: the watcher object used to determine if the feature is enabl...
Implement the Python class `FeatureSwitch` described below. Class description: FeatureSwitch checks if a feature is enabled or not. Method signatures and docstrings: - def __init__(self, watcher, default_value): Constructor for FeatureSwitch. Args: watcher: the watcher object used to determine if the feature is enabl...
1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30
<|skeleton|> class FeatureSwitch: """FeatureSwitch checks if a feature is enabled or not.""" def __init__(self, watcher, default_value): """Constructor for FeatureSwitch. Args: watcher: the watcher object used to determine if the feature is enabled or not default_value: bool, value when the watcher obj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FeatureSwitch: """FeatureSwitch checks if a feature is enabled or not.""" def __init__(self, watcher, default_value): """Constructor for FeatureSwitch. Args: watcher: the watcher object used to determine if the feature is enabled or not default_value: bool, value when the watcher object returns F...
the_stack_v2_python_sparse
biggraphite/utils.py
criteo/biggraphite
train
129
971732a3eb9197bc8edc5506f5308d2615bd7cea
[ "max_count = 0\ninvalid_index = -1\nstack = []\nfor i in range(len(s)):\n if s[i] == '(':\n stack.append(i)\n elif stack:\n stack.pop()\n start_index = stack[-1] if stack else invalid_index\n max_count = max(max_count, i - start_index)\n else:\n invalid_index = i\nreturn ...
<|body_start_0|> max_count = 0 invalid_index = -1 stack = [] for i in range(len(s)): if s[i] == '(': stack.append(i) elif stack: stack.pop() start_index = stack[-1] if stack else invalid_index max_cou...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses_failed(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_count = 0 invalid_index = ...
stack_v2_sparse_classes_10k_train_000997
2,271
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses_failed", "signature": "def longestValidParentheses_failed(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses_failed(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses_failed(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def long...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses_failed(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" max_count = 0 invalid_index = -1 stack = [] for i in range(len(s)): if s[i] == '(': stack.append(i) elif stack: stack.pop() ...
the_stack_v2_python_sparse
src/lt_32.py
oxhead/CodingYourWay
train
0
5a9daab4114da3539b8233b71115e085b5a9a4fe
[ "ignored = request.GET.get('ignored', False)\nsort = request.GET.get('sort')\nsort_fields = ['created_date', 'invite__times_used', 'invite__invitees__created_date', 'answer']\nif not sort in sort_fields + ['-{:s}'.format(f) for f in sort_fields]:\n sort = '-created_date'\nrequests = models.InviteRequest.objects....
<|body_start_0|> ignored = request.GET.get('ignored', False) sort = request.GET.get('sort') sort_fields = ['created_date', 'invite__times_used', 'invite__invitees__created_date', 'answer'] if not sort in sort_fields + ['-{:s}'.format(f) for f in sort_fields]: sort = '-created...
grant invites like the benevolent lord you are
ManageInviteRequests
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageInviteRequests: """grant invites like the benevolent lord you are""" def get(self, request): """view a list of requests""" <|body_0|> def post(self, request): """send out an invite""" <|body_1|> <|end_skeleton|> <|body_start_0|> ignored = ...
stack_v2_sparse_classes_10k_train_000998
6,414
no_license
[ { "docstring": "view a list of requests", "name": "get", "signature": "def get(self, request)" }, { "docstring": "send out an invite", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `ManageInviteRequests` described below. Class description: grant invites like the benevolent lord you are Method signatures and docstrings: - def get(self, request): view a list of requests - def post(self, request): send out an invite
Implement the Python class `ManageInviteRequests` described below. Class description: grant invites like the benevolent lord you are Method signatures and docstrings: - def get(self, request): view a list of requests - def post(self, request): send out an invite <|skeleton|> class ManageInviteRequests: """grant ...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ManageInviteRequests: """grant invites like the benevolent lord you are""" def get(self, request): """view a list of requests""" <|body_0|> def post(self, request): """send out an invite""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManageInviteRequests: """grant invites like the benevolent lord you are""" def get(self, request): """view a list of requests""" ignored = request.GET.get('ignored', False) sort = request.GET.get('sort') sort_fields = ['created_date', 'invite__times_used', 'invite__invitee...
the_stack_v2_python_sparse
bookwyrm/views/admin/invite.py
bookwyrm-social/bookwyrm
train
1,398
d8c7887bedc466479f5584538c0f694ef4f5e612
[ "n = len(nums)\nL = [1] * n\nR = [1] * n\nfor i in range(1, n):\n L[i] = L[i - 1] * nums[i - 1]\nfor i in range(n - 2, -1, -1):\n R[i] = R[i + 1] * nums[i + 1]\nres = []\nfor i in range(n):\n res.append(L[i] * R[i])\nreturn res", "n = len(nums)\nL = [1] * n\nfor i in range(1, n):\n L[i] = L[i - 1] * n...
<|body_start_0|> n = len(nums) L = [1] * n R = [1] * n for i in range(1, n): L[i] = L[i - 1] * nums[i - 1] for i in range(n - 2, -1, -1): R[i] = R[i + 1] * nums[i + 1] res = [] for i in range(n): res.append(L[i] * R[i]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) ...
stack_v2_sparse_classes_10k_train_000999
945
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002788
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf(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 productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Soluti...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" n = len(nums) L = [1] * n R = [1] * n for i in range(1, n): L[i] = L[i - 1] * nums[i - 1] for i in range(n - 2, -1, -1): R[i] = R[i + 1] * nums[i +...
the_stack_v2_python_sparse
0238_Product_of_Array_Except_Self.py
bingli8802/leetcode
train
0