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
6fb26e357fe873040df4128205744e415796c2b1
[ "results = self._convert_json_results_to_result_objects(results)\naggregated_results = defaultdict(lambda: defaultdict(list))\nfor r in results:\n build_url = 'http://ci.chromium.org/b/%s' % r.build_id\n aggregated_results[r.test][r.typ_tags].append(dt.ImageDiffTagTupleType(r.image_diff_tag[0], r.image_diff_t...
<|body_start_0|> results = self._convert_json_results_to_result_objects(results) aggregated_results = defaultdict(lambda: defaultdict(list)) for r in results: build_url = 'http://ci.chromium.org/b/%s' % r.build_id aggregated_results[r.test][r.typ_tags].append(dt.ImageDiff...
ResultProcessor
[ "GPL-1.0-or-later", "MIT", "LGPL-2.0-or-later", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultProcessor: def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: """Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ...
stack_v2_sparse_classes_10k_train_005500
2,220
permissive
[ { "docstring": "Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ_tags_as_tuple': [ (0, 200, 'url_1'), (3, 400, 'url_2'),], }, }", "name": "aggregate_results", "signatur...
2
stack_v2_sparse_classes_30k_train_001933
Implement the Python class `ResultProcessor` described below. Class description: Implement the ResultProcessor class. Method signatures and docstrings: - def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: Aggregates BigQuery results for all image comparison tests. Args: results: Parse...
Implement the Python class `ResultProcessor` described below. Class description: Implement the ResultProcessor class. Method signatures and docstrings: - def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: Aggregates BigQuery results for all image comparison tests. Args: results: Parse...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class ResultProcessor: def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: """Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResultProcessor: def aggregate_results(self, results: ct.QueryJsonType) -> dt.AggregatedResultsType: """Aggregates BigQuery results for all image comparison tests. Args: results: Parsed JSON test results from a BigQuery query. Returns: A map in the following format: { 'test_name': { 'typ_tags_as_tuple...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/web_tests/fuzzy_diff_analyzer/results.py
chromium/chromium
train
17,408
db21a3b853c6dbd661a00bc2ee6a1ae9393adcb6
[ "def dfs(n, k, memo):\n if n == 0:\n return 0\n if k == 1:\n return n\n if (n, k) not in memo:\n ans = float('inf')\n for x in range(1, n + 1):\n ans = min(ans, 1 + max(dfs(x - 1, k - 1, memo), dfs(n - x, k, memo)))\n memo[n, k] = ans\n return memo[n, k]\nre...
<|body_start_0|> def dfs(n, k, memo): if n == 0: return 0 if k == 1: return n if (n, k) not in memo: ans = float('inf') for x in range(1, n + 1): ans = min(ans, 1 + max(dfs(x - 1, k - 1, memo)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def superEggDrop(self, K: int, N: int) -> int: """Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)""" <|body_0|> def superEggDrop(self, K: int, N: int) -> int: ...
stack_v2_sparse_classes_10k_train_005501
5,857
no_license
[ { "docstring": "Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)", "name": "superEggDrop", "signature": "def superEggDrop(self, K: int, N: int) -> int" }, { "docstring": "The above algorithm got TL...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop(self, K: int, N: int) -> int: Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop(self, K: int, N: int) -> int: Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def superEggDrop(self, K: int, N: int) -> int: """Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)""" <|body_0|> def superEggDrop(self, K: int, N: int) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def superEggDrop(self, K: int, N: int) -> int: """Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)""" def dfs(n, k, memo): if n == 0: return 0 if...
the_stack_v2_python_sparse
Leetcode 0887. Super Egg Drop.py
Chaoran-sjsu/leetcode
train
0
cc95fc34723ddc51a7162f768f2b4cae9ab980bd
[ "assert isinstance(errors, int) or errors in ('raise', 'ignore', 'report')\nself.function = function\nself.errors = errors\nself.error_count = 0", "try:\n return self.function(*args, **kwds)\nexcept Exception as e:\n self.error_count += 1\n if self.errors == 'raise':\n raise\n if self.errors ==...
<|body_start_0|> assert isinstance(errors, int) or errors in ('raise', 'ignore', 'report') self.function = function self.errors = errors self.error_count = 0 <|end_body_0|> <|body_start_1|> try: return self.function(*args, **kwds) except Exception as e: ...
Wraps a function call to catch and report exceptions.
LogErrors
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogErrors: """Wraps a function call to catch and report exceptions.""" def __init__(self, function, errors): """:param function: the function to wrap :param errors: either a number, indicating how many errors to report before ignoring them, or one of these strings: 'raise', meaning t...
stack_v2_sparse_classes_10k_train_005502
1,450
permissive
[ { "docstring": ":param function: the function to wrap :param errors: either a number, indicating how many errors to report before ignoring them, or one of these strings: 'raise', meaning to raise an exception 'ignore', meaning to ignore all errors 'report', meaning to report all errors", "name": "__init__",...
2
stack_v2_sparse_classes_30k_train_001784
Implement the Python class `LogErrors` described below. Class description: Wraps a function call to catch and report exceptions. Method signatures and docstrings: - def __init__(self, function, errors): :param function: the function to wrap :param errors: either a number, indicating how many errors to report before i...
Implement the Python class `LogErrors` described below. Class description: Wraps a function call to catch and report exceptions. Method signatures and docstrings: - def __init__(self, function, errors): :param function: the function to wrap :param errors: either a number, indicating how many errors to report before i...
fd97e6c651a4bbcade64733847f4eec8f7704b7c
<|skeleton|> class LogErrors: """Wraps a function call to catch and report exceptions.""" def __init__(self, function, errors): """:param function: the function to wrap :param errors: either a number, indicating how many errors to report before ignoring them, or one of these strings: 'raise', meaning t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LogErrors: """Wraps a function call to catch and report exceptions.""" def __init__(self, function, errors): """:param function: the function to wrap :param errors: either a number, indicating how many errors to report before ignoring them, or one of these strings: 'raise', meaning to raise an ex...
the_stack_v2_python_sparse
bibliopixel/util/log_errors.py
dr-aryone/BiblioPixel
train
2
a47b129242e4954c44511e3b5d017ba217629b99
[ "params = dict()\nparams['applicationguid'] = applicationguid\nreturn q.workflowengine.actionmanager.startActorAction('cloudinstallservice', 'initialize', params, jobguid=jobguid, executionparams=executionparams)", "params = dict()\nparams['machineguid'] = machineguid\nreturn q.workflowengine.actionmanager.startA...
<|body_start_0|> params = dict() params['applicationguid'] = applicationguid return q.workflowengine.actionmanager.startActorAction('cloudinstallservice', 'initialize', params, jobguid=jobguid, executionparams=executionparams) <|end_body_0|> <|body_start_1|> params = dict() para...
cloudinstallservice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cloudinstallservice: def initialize(self, applicationguid='', jobguid='', executionparams={}): """Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @...
stack_v2_sparse_classes_10k_train_005503
4,461
no_license
[ { "docstring": "Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @type jobguid: guid @param executionParams: dictionary with additional executionParams @type executionParam...
4
null
Implement the Python class `cloudinstallservice` described below. Class description: Implement the cloudinstallservice class. Method signatures and docstrings: - def initialize(self, applicationguid='', jobguid='', executionparams={}): Installs and configures the cloud install service. @param applicationguid: Guid of...
Implement the Python class `cloudinstallservice` described below. Class description: Implement the cloudinstallservice class. Method signatures and docstrings: - def initialize(self, applicationguid='', jobguid='', executionparams={}): Installs and configures the cloud install service. @param applicationguid: Guid of...
53d349fa6bee0ccead29afd6676979b44c109a61
<|skeleton|> class cloudinstallservice: def initialize(self, applicationguid='', jobguid='', executionparams={}): """Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class cloudinstallservice: def initialize(self, applicationguid='', jobguid='', executionparams={}): """Installs and configures the cloud install service. @param applicationguid: Guid of the application which needs to be initialized @type applicationguid: guid @param jobguid: Guid of the job @type jobguid: ...
the_stack_v2_python_sparse
apps/cloud_api_generator/actor/cloudinstallservice.py
racktivity/ext-pylabs-core
train
0
13c2070910709952904bde6c9c10bcc81d0ec81d
[ "nx, ny = np.shape(mass_map)\nif nx != ny:\n raise ValueError('Shape of mass map needs to be square!, set as %s %s' % (nx, ny))\nself._mass_map = mass_map\nself._grid_spacing = grid_spacing\nself._redshift = redshift\nself._f_x_mass, self._f_y_mass = convergence_integrals.deflection_from_kappa_grid(self._mass_ma...
<|body_start_0|> nx, ny = np.shape(mass_map) if nx != ny: raise ValueError('Shape of mass map needs to be square!, set as %s %s' % (nx, ny)) self._mass_map = mass_map self._grid_spacing = grid_spacing self._redshift = redshift self._f_x_mass, self._f_y_mass = ...
class to describe a single mass slice
MassSlice
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MassSlice: """class to describe a single mass slice""" def __init__(self, mass_map, grid_spacing, redshift): """:param mass_map: 2d numpy array of mass map (in units physical Msol) :param grid_spacing: grid spacing of the mass map (in units physical Mpc) :param redshift: redshift""" ...
stack_v2_sparse_classes_10k_train_005504
5,293
permissive
[ { "docstring": ":param mass_map: 2d numpy array of mass map (in units physical Msol) :param grid_spacing: grid spacing of the mass map (in units physical Mpc) :param redshift: redshift", "name": "__init__", "signature": "def __init__(self, mass_map, grid_spacing, redshift)" }, { "docstring": "sc...
2
null
Implement the Python class `MassSlice` described below. Class description: class to describe a single mass slice Method signatures and docstrings: - def __init__(self, mass_map, grid_spacing, redshift): :param mass_map: 2d numpy array of mass map (in units physical Msol) :param grid_spacing: grid spacing of the mass ...
Implement the Python class `MassSlice` described below. Class description: class to describe a single mass slice Method signatures and docstrings: - def __init__(self, mass_map, grid_spacing, redshift): :param mass_map: 2d numpy array of mass map (in units physical Msol) :param grid_spacing: grid spacing of the mass ...
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class MassSlice: """class to describe a single mass slice""" def __init__(self, mass_map, grid_spacing, redshift): """:param mass_map: 2d numpy array of mass map (in units physical Msol) :param grid_spacing: grid spacing of the mass map (in units physical Mpc) :param redshift: redshift""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MassSlice: """class to describe a single mass slice""" def __init__(self, mass_map, grid_spacing, redshift): """:param mass_map: 2d numpy array of mass map (in units physical Msol) :param grid_spacing: grid spacing of the mass map (in units physical Mpc) :param redshift: redshift""" nx, n...
the_stack_v2_python_sparse
lenstronomy/LensModel/LightConeSim/light_cone.py
lenstronomy/lenstronomy
train
41
9e35f489744ead8f7f7534f38a51623ebdc2883b
[ "self.from_city = kwargs['from_city']\nself.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None\nself.to_city = kwargs['to_city']\nself.to_stop = kwargs['to_stop'] if kwargs['to_stop'] not in ['__ANY__', 'none'] else None\nself.vehicle = kwargs['vehicle'] if kwargs['vehicle']...
<|body_start_0|> self.from_city = kwargs['from_city'] self.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None self.to_city = kwargs['to_city'] self.to_stop = kwargs['to_stop'] if kwargs['to_stop'] not in ['__ANY__', 'none'] else None self....
Holder for starting and ending point (and other parameters) of travel.
Travel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" <|body_0|> def get_minimal_info(se...
stack_v2_sparse_classes_10k_train_005505
30,338
permissive
[ { "docstring": "Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Return minimal waypoints information in the form of a stringified inform() dial...
2
stack_v2_sparse_classes_30k_val_000163
Implement the Python class `Travel` described below. Class description: Holder for starting and ending point (and other parameters) of travel. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran...
Implement the Python class `Travel` described below. Class description: Holder for starting and ending point (and other parameters) of travel. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran...
e8fdc6f2d908d7a1911b18f29c218ae58d19ed6f
<|skeleton|> class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" <|body_0|> def get_minimal_info(se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" self.from_city = kwargs['from_city'] self.fr...
the_stack_v2_python_sparse
alex/applications/PublicTransportInfoCS/directions.py
beka-evature/alex
train
1
b40649f78e62e1a7f1cf93fe86becbb53f51a325
[ "if not s:\n return ''\nn = len(s)\ndp = [[False] * n for _ in range(n)]\nmax_len = 1\nres = s[0]\nfor i in range(n):\n dp[i][i] = True\nfor j in range(1, n):\n for i in range(j):\n if s[i] == s[j]:\n if j - 1 - (i + 1) + 1 >= 2:\n dp[i][j] = dp[i + 1][j - 1]\n e...
<|body_start_0|> if not s: return '' n = len(s) dp = [[False] * n for _ in range(n)] max_len = 1 res = s[0] for i in range(n): dp[i][i] = True for j in range(1, n): for i in range(j): if s[i] == s[j]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if...
stack_v2_sparse_classes_10k_train_005506
4,417
no_license
[ { "docstring": "首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if s[i] != s[j] 表明就不是字符串 考虑初始状态:自下而上,初始状态为字符串长度==1,dp[i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): 首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] =...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): 首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] =...
f1bbd6b3197cd9ac4f0d35a37539c11b02272065
<|skeleton|> class Solution: def longestPalindrome(self, s): """首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if s[i] != s[j] ...
the_stack_v2_python_sparse
leetcode/动态规划/5. 最长回文子串/longestPalindrome.py
guohaoyuan/algorithms-for-work
train
2
bac7eb9694e74420e2190ac4dda1dc34118be6d1
[ "connected_indexes = []\nfor i in reversed(range(0, idx)):\n if row[i] == 1:\n connected_indexes.append(i)\n else:\n break\nfor i in range(idx, len(row)):\n if row[i] == 1:\n connected_indexes.append(i)\n else:\n break\nreturn connected_indexes", "opens = [i for i in pre_tu...
<|body_start_0|> connected_indexes = [] for i in reversed(range(0, idx)): if row[i] == 1: connected_indexes.append(i) else: break for i in range(idx, len(row)): if row[i] == 1: connected_indexes.append(i) ...
Percolation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" <|body_0|> def isPercolate(self,...
stack_v2_sparse_classes_10k_train_005507
3,374
no_license
[ { "docstring": "to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point", "name": "expand_check", "signature": "def expand_check(self, idx, row)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_val_000044
Implement the Python class `Percolation` described below. Class description: Implement the Percolation class. Method signatures and docstrings: - def expand_check(self, idx, row): to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes...
Implement the Python class `Percolation` described below. Class description: Implement the Percolation class. Method signatures and docstrings: - def expand_check(self, idx, row): to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" <|body_0|> def isPercolate(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" connected_indexes = [] for i in reversed(ra...
the_stack_v2_python_sparse
QuickProjects/Algorithm/p01_percolation.py
jxie0755/Learning_Python
train
0
74f9eafdea97ac8b9552b795b3af81549c804fc5
[ "current_user = request.user\nhighlight_data = request.data.get('highlight_data', {})\ntry:\n article = Articles.objects.get(slug=slug)\nexcept Articles.DoesNotExist:\n return Response({'errors': HIGHLIGHT_MSGS['ARTICLE_NOT_FOUND']}, status=status.HTTP_404_NOT_FOUND)\nhighlights = Highlights.objects.filter(ar...
<|body_start_0|> current_user = request.user highlight_data = request.data.get('highlight_data', {}) try: article = Articles.objects.get(slug=slug) except Articles.DoesNotExist: return Response({'errors': HIGHLIGHT_MSGS['ARTICLE_NOT_FOUND']}, status=status.HTTP_40...
Provide methods for creating a highlight
CreateGetDeleteMyHighlightsAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateGetDeleteMyHighlightsAPIView: """Provide methods for creating a highlight""" def get(self, request, slug): """Get all my highlights for an article Params ------- request: Object with request data and functions. Returns -------- Response object: { "message": "message body", "hig...
stack_v2_sparse_classes_10k_train_005508
12,153
permissive
[ { "docstring": "Get all my highlights for an article Params ------- request: Object with request data and functions. Returns -------- Response object: { \"message\": \"message body\", \"highlights\": list of highlights and their details } OR { \"errors\": \"error details body\" }", "name": "get", "signa...
2
stack_v2_sparse_classes_30k_train_005230
Implement the Python class `CreateGetDeleteMyHighlightsAPIView` described below. Class description: Provide methods for creating a highlight Method signatures and docstrings: - def get(self, request, slug): Get all my highlights for an article Params ------- request: Object with request data and functions. Returns --...
Implement the Python class `CreateGetDeleteMyHighlightsAPIView` described below. Class description: Provide methods for creating a highlight Method signatures and docstrings: - def get(self, request, slug): Get all my highlights for an article Params ------- request: Object with request data and functions. Returns --...
5a31840856de4b361fe2594dfa7a33d7774d3fe2
<|skeleton|> class CreateGetDeleteMyHighlightsAPIView: """Provide methods for creating a highlight""" def get(self, request, slug): """Get all my highlights for an article Params ------- request: Object with request data and functions. Returns -------- Response object: { "message": "message body", "hig...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateGetDeleteMyHighlightsAPIView: """Provide methods for creating a highlight""" def get(self, request, slug): """Get all my highlights for an article Params ------- request: Object with request data and functions. Returns -------- Response object: { "message": "message body", "highlights": lis...
the_stack_v2_python_sparse
authors/apps/highlights/views.py
bl4ck4ndbr0wn/ah-centauri-backend
train
0
e924989f2efa8f11ff98f983b4d1390146b096e1
[ "logger.debug('Defining unique_bitcount() function...')\nwith conn.cursor() as cursor:\n cursor.execute(sql.SQL('CREATE FUNCTION unique_bitcount(n INTEGER) RETURNS INTEGER\\n LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE\\n AS $$\\n ...
<|body_start_0|> logger.debug('Defining unique_bitcount() function...') with conn.cursor() as cursor: cursor.execute(sql.SQL('CREATE FUNCTION unique_bitcount(n INTEGER) RETURNS INTEGER\n LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE\n ...
Class use to upgrade to V84 of the schema.
SchemaMigrator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaMigrator: """Class use to upgrade to V84 of the schema.""" def _define_unique_bitcount_func(self, logger, conn): """Helper method to define unique_bitcount sql function.""" <|body_0|> def _create_index_on_device_id(self, logger, conn): """Method to create i...
stack_v2_sparse_classes_10k_train_005509
11,436
no_license
[ { "docstring": "Helper method to define unique_bitcount sql function.", "name": "_define_unique_bitcount_func", "signature": "def _define_unique_bitcount_func(self, logger, conn)" }, { "docstring": "Method to create index on device_id in registration_list.", "name": "_create_index_on_device_...
6
stack_v2_sparse_classes_30k_train_003942
Implement the Python class `SchemaMigrator` described below. Class description: Class use to upgrade to V84 of the schema. Method signatures and docstrings: - def _define_unique_bitcount_func(self, logger, conn): Helper method to define unique_bitcount sql function. - def _create_index_on_device_id(self, logger, conn...
Implement the Python class `SchemaMigrator` described below. Class description: Class use to upgrade to V84 of the schema. Method signatures and docstrings: - def _define_unique_bitcount_func(self, logger, conn): Helper method to define unique_bitcount sql function. - def _create_index_on_device_id(self, logger, conn...
ac26dc97c57216dc3c1fed1e1b17aac27d3a1a2d
<|skeleton|> class SchemaMigrator: """Class use to upgrade to V84 of the schema.""" def _define_unique_bitcount_func(self, logger, conn): """Helper method to define unique_bitcount sql function.""" <|body_0|> def _create_index_on_device_id(self, logger, conn): """Method to create i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SchemaMigrator: """Class use to upgrade to V84 of the schema.""" def _define_unique_bitcount_func(self, logger, conn): """Helper method to define unique_bitcount sql function.""" logger.debug('Defining unique_bitcount() function...') with conn.cursor() as cursor: curso...
the_stack_v2_python_sparse
src/dirbs/schema_migrators/v84_upgrade.py
yasirz/DIRBS-Core
train
0
5f179d2316f534c147804fae97e19d3704c0ea27
[ "if not self.created_date:\n self.created_date = datetime.utcnow()\nself.modified_date = datetime.utcnow()\nsuper(Message, self).save(*args, **kwargs)", "logging.info('getting %s %s for Message %s (%s)' % (asset_class, mime_type, self, self.pk))\nif isinstance(asset_class, AssetClass):\n return self.assets....
<|body_start_0|> if not self.created_date: self.created_date = datetime.utcnow() self.modified_date = datetime.utcnow() super(Message, self).save(*args, **kwargs) <|end_body_0|> <|body_start_1|> logging.info('getting %s %s for Message %s (%s)' % (asset_class, mime_type, self...
Message
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: def save(self, *args, **kwargs): """Overwriting save to set created_date and modified_date to utcnow() Django uses datetime.now() We want to store and transmit only UTC time, and localize it at rendering time""" <|body_0|> def get_asset(self, asset_class, mime_type)...
stack_v2_sparse_classes_10k_train_005510
23,088
no_license
[ { "docstring": "Overwriting save to set created_date and modified_date to utcnow() Django uses datetime.now() We want to store and transmit only UTC time, and localize it at rendering time", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "Get an asset associated...
2
stack_v2_sparse_classes_30k_train_002075
Implement the Python class `Message` described below. Class description: Implement the Message class. Method signatures and docstrings: - def save(self, *args, **kwargs): Overwriting save to set created_date and modified_date to utcnow() Django uses datetime.now() We want to store and transmit only UTC time, and loca...
Implement the Python class `Message` described below. Class description: Implement the Message class. Method signatures and docstrings: - def save(self, *args, **kwargs): Overwriting save to set created_date and modified_date to utcnow() Django uses datetime.now() We want to store and transmit only UTC time, and loca...
e5a0d666ff11c812518cecb0f57257c64ca5cdfd
<|skeleton|> class Message: def save(self, *args, **kwargs): """Overwriting save to set created_date and modified_date to utcnow() Django uses datetime.now() We want to store and transmit only UTC time, and localize it at rendering time""" <|body_0|> def get_asset(self, asset_class, mime_type)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Message: def save(self, *args, **kwargs): """Overwriting save to set created_date and modified_date to utcnow() Django uses datetime.now() We want to store and transmit only UTC time, and localize it at rendering time""" if not self.created_date: self.created_date = datetime.utcnow...
the_stack_v2_python_sparse
donomo_archive/lib/donomo/archive/models.py
alexissmirnov/donomo
train
0
9ea20f6c82956b473b8bd9fb7619a1b50bd8de74
[ "params = [10000, 5, 10, 15]\nheight = 100\nwidth = 200\nworld_map = gen.generate_map(height=height, width=width, params=params)\nimage = img.get_map_overview(world_map)\npixels = image.load()\nfor x in range(width):\n for y in range(height):\n color = tuple(img.get_color(world_map[x][y]))\n self.a...
<|body_start_0|> params = [10000, 5, 10, 15] height = 100 width = 200 world_map = gen.generate_map(height=height, width=width, params=params) image = img.get_map_overview(world_map) pixels = image.load() for x in range(width): for y in range(height): ...
MapCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapCase: def test_map_overview_accuracy(self): """Test if image of map overview properly represents generated map matrix.""" <|body_0|> def test_spreading_players(self): """Test if players are properly spread across.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_005511
1,357
permissive
[ { "docstring": "Test if image of map overview properly represents generated map matrix.", "name": "test_map_overview_accuracy", "signature": "def test_map_overview_accuracy(self)" }, { "docstring": "Test if players are properly spread across.", "name": "test_spreading_players", "signatur...
2
stack_v2_sparse_classes_30k_train_001000
Implement the Python class `MapCase` described below. Class description: Implement the MapCase class. Method signatures and docstrings: - def test_map_overview_accuracy(self): Test if image of map overview properly represents generated map matrix. - def test_spreading_players(self): Test if players are properly sprea...
Implement the Python class `MapCase` described below. Class description: Implement the MapCase class. Method signatures and docstrings: - def test_map_overview_accuracy(self): Test if image of map overview properly represents generated map matrix. - def test_spreading_players(self): Test if players are properly sprea...
1edad57d47ad975950639fc391b645e47509cf58
<|skeleton|> class MapCase: def test_map_overview_accuracy(self): """Test if image of map overview properly represents generated map matrix.""" <|body_0|> def test_spreading_players(self): """Test if players are properly spread across.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MapCase: def test_map_overview_accuracy(self): """Test if image of map overview properly represents generated map matrix.""" params = [10000, 5, 10, 15] height = 100 width = 200 world_map = gen.generate_map(height=height, width=width, params=params) image = img....
the_stack_v2_python_sparse
map_generation/test_map_generation.py
GabrielWechta/age-of-divisiveness
train
0
72de027ad380186edcd59b98e76f4f1eb3effbe9
[ "self.action_n = env.action_space.n\nself.obs_low = env.observation_space.low\nself.obs_scale = env.observation_space.high - env.observation_space.low\nself.encoder = TileCoder(layers, features)\nself.w = np.zeros(features)\nself.feature_list = []\nself.trajectory = []\nself.gamma = gamma\nself.learning_rate = lear...
<|body_start_0|> self.action_n = env.action_space.n self.obs_low = env.observation_space.low self.obs_scale = env.observation_space.high - env.observation_space.low self.encoder = TileCoder(layers, features) self.w = np.zeros(features) self.feature_list = [] self....
回合更新策略梯度算法寻找最优策略
VPGAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VPGAgent: """回合更新策略梯度算法寻找最优策略""" def __init__(self, env, layers=8, features=1893, gamma=1.0, learning_rate=0.03, epsilon=0.001, baseline=True): """学习函数 env 环境 layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 总特征数 8*8 + (8+1) * (8+1) * (8-1) gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率""" ...
stack_v2_sparse_classes_10k_train_005512
22,277
no_license
[ { "docstring": "学习函数 env 环境 layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 总特征数 8*8 + (8+1) * (8+1) * (8-1) gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率", "name": "__init__", "signature": "def __init__(self, env, layers=8, features=1893, gamma=1.0, learning_rate=0.03, epsilon=0.001, baseline=True)" }, {...
3
stack_v2_sparse_classes_30k_train_005709
Implement the Python class `VPGAgent` described below. Class description: 回合更新策略梯度算法寻找最优策略 Method signatures and docstrings: - def __init__(self, env, layers=8, features=1893, gamma=1.0, learning_rate=0.03, epsilon=0.001, baseline=True): 学习函数 env 环境 layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 总特征数 8*8 + (8+1) * (8+1) * (8...
Implement the Python class `VPGAgent` described below. Class description: 回合更新策略梯度算法寻找最优策略 Method signatures and docstrings: - def __init__(self, env, layers=8, features=1893, gamma=1.0, learning_rate=0.03, epsilon=0.001, baseline=True): 学习函数 env 环境 layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 总特征数 8*8 + (8+1) * (8+1) * (8...
e6526e9e38fcb5be91b46cb40715c15242198a0b
<|skeleton|> class VPGAgent: """回合更新策略梯度算法寻找最优策略""" def __init__(self, env, layers=8, features=1893, gamma=1.0, learning_rate=0.03, epsilon=0.001, baseline=True): """学习函数 env 环境 layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 总特征数 8*8 + (8+1) * (8+1) * (8-1) gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VPGAgent: """回合更新策略梯度算法寻找最优策略""" def __init__(self, env, layers=8, features=1893, gamma=1.0, learning_rate=0.03, epsilon=0.001, baseline=True): """学习函数 env 环境 layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 总特征数 8*8 + (8+1) * (8+1) * (8-1) gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率""" self.a...
the_stack_v2_python_sparse
mountain_car/function_approx.py
lwzswufe/gym_learning
train
0
f89a0c2b7fe5be8f2625b0618a4ca65407a53577
[ "nodes = []\nhead = point = ListNode(0)\nfor listNode in lists:\n while listNode:\n nodes.append(listNode.val)\n listNode = listNode.next\nfor node in sorted(nodes):\n point.next = ListNode(node.val)\n point = point.next\nreturn head.next", "from queue import PriorityQueue\nhead = point = L...
<|body_start_0|> nodes = [] head = point = ListNode(0) for listNode in lists: while listNode: nodes.append(listNode.val) listNode = listNode.next for node in sorted(nodes): point.next = ListNode(node.val) point = point.n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """暴力遍历所有节点 排序后增添到链表中""" <|body_0|> def fun2(self, lists): """优先队列处理""" <|body_1|> def fun3(self, lists): """分而治之""" <|body_2|> <|end_skeleton|> <|body_start_0|> nodes = [] head = ...
stack_v2_sparse_classes_10k_train_005513
2,154
no_license
[ { "docstring": "暴力遍历所有节点 排序后增添到链表中", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": "优先队列处理", "name": "fun2", "signature": "def fun2(self, lists)" }, { "docstring": "分而治之", "name": "fun3", "signature": "def fun3(self, lists)" } ]
3
stack_v2_sparse_classes_30k_train_005976
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): 暴力遍历所有节点 排序后增添到链表中 - def fun2(self, lists): 优先队列处理 - def fun3(self, lists): 分而治之
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): 暴力遍历所有节点 排序后增添到链表中 - def fun2(self, lists): 优先队列处理 - def fun3(self, lists): 分而治之 <|skeleton|> class Solution: def mergeKLists(self, lists): ...
0b10f5731690da7998add288e4b0b87d5d71a97e
<|skeleton|> class Solution: def mergeKLists(self, lists): """暴力遍历所有节点 排序后增添到链表中""" <|body_0|> def fun2(self, lists): """优先队列处理""" <|body_1|> def fun3(self, lists): """分而治之""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists(self, lists): """暴力遍历所有节点 排序后增添到链表中""" nodes = [] head = point = ListNode(0) for listNode in lists: while listNode: nodes.append(listNode.val) listNode = listNode.next for node in sorted(nodes): ...
the_stack_v2_python_sparse
leetcode/leetcode/23.合并K个排序列表.py
GGL12/myStudy
train
0
62316a86190dd5c044b15576f410aeab4c6db677
[ "super().on_episode_step(worker=worker, base_env=base_env, policies=policies, episode=episode, env_index=env_index, **kwargs)\nif isinstance(episode, Episode):\n info = episode.last_info_for()\nelse:\n info = episode._last_infos.get(_DUMMY_AGENT_ID)\nif info is not None:\n for key, value in info.items():\n...
<|body_start_0|> super().on_episode_step(worker=worker, base_env=base_env, policies=policies, episode=episode, env_index=env_index, **kwargs) if isinstance(episode, Episode): info = episode.last_info_for() else: info = episode._last_infos.get(_DUMMY_AGENT_ID) if i...
TODO: Write documentation. Base on `rllib/examples/custom_metrics_and_callbacks.py` example.
MonitorInfoCallback
[ "MIT", "BSL-1.0", "MPL-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonitorInfoCallback: """TODO: Write documentation. Base on `rllib/examples/custom_metrics_and_callbacks.py` example.""" def on_episode_step(self, *, worker: 'RolloutWorker', base_env: BaseEnv, policies: Optional[Dict[PolicyID, Policy]]=None, episode: Union[Episode, EpisodeV2], env_index: Opt...
stack_v2_sparse_classes_10k_train_005514
3,161
permissive
[ { "docstring": "TODO: Write documentation.", "name": "on_episode_step", "signature": "def on_episode_step(self, *, worker: 'RolloutWorker', base_env: BaseEnv, policies: Optional[Dict[PolicyID, Policy]]=None, episode: Union[Episode, EpisodeV2], env_index: Optional[int]=None, **kwargs: Any) -> None" }, ...
2
stack_v2_sparse_classes_30k_train_000345
Implement the Python class `MonitorInfoCallback` described below. Class description: TODO: Write documentation. Base on `rllib/examples/custom_metrics_and_callbacks.py` example. Method signatures and docstrings: - def on_episode_step(self, *, worker: 'RolloutWorker', base_env: BaseEnv, policies: Optional[Dict[PolicyI...
Implement the Python class `MonitorInfoCallback` described below. Class description: TODO: Write documentation. Base on `rllib/examples/custom_metrics_and_callbacks.py` example. Method signatures and docstrings: - def on_episode_step(self, *, worker: 'RolloutWorker', base_env: BaseEnv, policies: Optional[Dict[PolicyI...
a3b244f0bcb21abe605544d1f5c4a31419946efd
<|skeleton|> class MonitorInfoCallback: """TODO: Write documentation. Base on `rllib/examples/custom_metrics_and_callbacks.py` example.""" def on_episode_step(self, *, worker: 'RolloutWorker', base_env: BaseEnv, policies: Optional[Dict[PolicyID, Policy]]=None, episode: Union[Episode, EpisodeV2], env_index: Opt...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MonitorInfoCallback: """TODO: Write documentation. Base on `rllib/examples/custom_metrics_and_callbacks.py` example.""" def on_episode_step(self, *, worker: 'RolloutWorker', base_env: BaseEnv, policies: Optional[Dict[PolicyID, Policy]]=None, episode: Union[Episode, EpisodeV2], env_index: Optional[int]=No...
the_stack_v2_python_sparse
python/gym_jiminy/rllib/gym_jiminy/rllib/callbacks.py
duburcqa/jiminy
train
108
089999c449eae46d79e91689a2c2dc53a5c68d92
[ "self.availability_set = availability_set\nself.azure_managed_disk_params = azure_managed_disk_params\nself.compute_options = compute_options\nself.data_transfer_info = data_transfer_info\nself.network_resource_group = network_resource_group\nself.network_security_group = network_security_group\nself.resource_group...
<|body_start_0|> self.availability_set = availability_set self.azure_managed_disk_params = azure_managed_disk_params self.compute_options = compute_options self.data_transfer_info = data_transfer_info self.network_resource_group = network_resource_group self.network_secur...
Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be restored. azure_managed_disk_params (AzureManagedD...
DeployVMsToAzureParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployVMsToAzureParams: """Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be ...
stack_v2_sparse_classes_10k_train_005515
10,381
permissive
[ { "docstring": "Constructor for the DeployVMsToAzureParams class", "name": "__init__", "signature": "def __init__(self, availability_set=None, azure_managed_disk_params=None, compute_options=None, data_transfer_info=None, network_resource_group=None, network_security_group=None, resource_group=None, sto...
2
null
Implement the Python class `DeployVMsToAzureParams` described below. Class description: Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Ava...
Implement the Python class `DeployVMsToAzureParams` described below. Class description: Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Ava...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeployVMsToAzureParams: """Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeployVMsToAzureParams: """Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be restored. azu...
the_stack_v2_python_sparse
cohesity_management_sdk/models/deploy_vms_to_azure_params.py
cohesity/management-sdk-python
train
24
838323aff0a041d6247f646dddccf10cb0b6c602
[ "super(Net, self).__init__()\nconv1_shape = (height, 1)\nconv2_shape = 5\npool_1_shape = 2\npool_2_shape = 2\nconv1_outshape = 20\nconv2_outshape = 40\nself.output = output_size\nself.conv1 = nn.Sequential(nn.Conv2d(in_channels=channels, out_channels=conv1_outshape, kernel_size=conv1_shape, stride=1, padding=2), nn...
<|body_start_0|> super(Net, self).__init__() conv1_shape = (height, 1) conv2_shape = 5 pool_1_shape = 2 pool_2_shape = 2 conv1_outshape = 20 conv2_outshape = 40 self.output = output_size self.conv1 = nn.Sequential(nn.Conv2d(in_channels=channels, ou...
Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width
Net
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Net: """Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width""" def __init__(self, batch_size, channels, height, width, output_size): """Instances. Might make function in order to most accurately create Dense layers""" <|body_0|>...
stack_v2_sparse_classes_10k_train_005516
3,331
no_license
[ { "docstring": "Instances. Might make function in order to most accurately create Dense layers", "name": "__init__", "signature": "def __init__(self, batch_size, channels, height, width, output_size)" }, { "docstring": "Forward. Moving the image through the convulutions have two maxpools for cha...
4
stack_v2_sparse_classes_30k_train_001299
Implement the Python class `Net` described below. Class description: Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width Method signatures and docstrings: - def __init__(self, batch_size, channels, height, width, output_size): Instances. Might make function in order to ...
Implement the Python class `Net` described below. Class description: Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width Method signatures and docstrings: - def __init__(self, batch_size, channels, height, width, output_size): Instances. Might make function in order to ...
4c4b8fb381c8d98980e119f7f73f393034393468
<|skeleton|> class Net: """Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width""" def __init__(self, batch_size, channels, height, width, output_size): """Instances. Might make function in order to most accurately create Dense layers""" <|body_0|>...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Net: """Basic CNN. Using as basis for evantual netork Input of form: Batch Size - Channels - Height - Width""" def __init__(self, batch_size, channels, height, width, output_size): """Instances. Might make function in order to most accurately create Dense layers""" super(Net, self).__init...
the_stack_v2_python_sparse
Python_Scripts/network/CNN.py
jommysmoth/ECE_Music
train
0
f8f1726bad3d7bea6ef1db8341607f7b26dcf439
[ "if value in EMPTY_VALUES:\n return None\nif type(value) in [str, unicode]:\n try:\n value = value.replace(\"'\", '\"')\n value = json.loads(value)\n except ValueError:\n msg = self.error_messages['invalid']\n raise serializers.ValidationError(msg)\nif value:\n day = value.ge...
<|body_start_0|> if value in EMPTY_VALUES: return None if type(value) in [str, unicode]: try: value = value.replace("'", '"') value = json.loads(value) except ValueError: msg = self.error_messages['invalid'] ...
A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }
ThreePartDateField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreePartDateField: """A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }""" def to_internal_value(self, value): """Parse json data and return a date object""" <|body_0|> def ...
stack_v2_sparse_classes_10k_train_005517
4,517
permissive
[ { "docstring": "Parse json data and return a date object", "name": "to_internal_value", "signature": "def to_internal_value(self, value)" }, { "docstring": "Transform datetime.date object to json.", "name": "to_representation", "signature": "def to_representation(self, value)" } ]
2
null
Implement the Python class `ThreePartDateField` described below. Class description: A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 } Method signatures and docstrings: - def to_internal_value(self, value): Parse json data...
Implement the Python class `ThreePartDateField` described below. Class description: A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 } Method signatures and docstrings: - def to_internal_value(self, value): Parse json data...
51d40345b41eb68fb4d65ae273f3496d1012e2f3
<|skeleton|> class ThreePartDateField: """A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }""" def to_internal_value(self, value): """Parse json data and return a date object""" <|body_0|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThreePartDateField: """A serializer field for handling three part date time JSON formatted datetime.date. Expected input format: { "day": 25, "month": 12, "year": 2012 }""" def to_internal_value(self, value): """Parse json data and return a date object""" if value in EMPTY_VALUES: ...
the_stack_v2_python_sparse
cla_backend/apps/core/drf/fields.py
ministryofjustice/cla_backend
train
4
6b07d30b2c2e0afe3b73afb35604ca1e475698be
[ "super().__init__(*args, **kwargs)\nself.format = fmt\nself.size = size", "print(f'[{amber_light}]Saving video')\nlogger.debug(f'[{amber_light}]Saving video')\nfld = os.path.join(self.tmp_dir.name, '%d.png')\nfps = int(self.fps)\nname = f'{self.name}.{self.format}'\nfmt = '-vcodec libx264 -crf 28 -pix_fmt yuv420p...
<|body_start_0|> super().__init__(*args, **kwargs) self.format = fmt self.size = size <|end_body_0|> <|body_start_1|> print(f'[{amber_light}]Saving video') logger.debug(f'[{amber_light}]Saving video') fld = os.path.join(self.tmp_dir.name, '%d.png') fps = int(self...
Video
[ "BSD-3-Clause", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Video: def __init__(self, *args, fmt='mp4', size='1620x1050', **kwargs): """Video class, takes care of storing screenshots (frames) as images in a temporary folder and then merging these into a single video file when the video is closed.""" <|body_0|> def close(self): ...
stack_v2_sparse_classes_10k_train_005518
1,181
permissive
[ { "docstring": "Video class, takes care of storing screenshots (frames) as images in a temporary folder and then merging these into a single video file when the video is closed.", "name": "__init__", "signature": "def __init__(self, *args, fmt='mp4', size='1620x1050', **kwargs)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_007243
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def __init__(self, *args, fmt='mp4', size='1620x1050', **kwargs): Video class, takes care of storing screenshots (frames) as images in a temporary folder and then merging these into a ...
Implement the Python class `Video` described below. Class description: Implement the Video class. Method signatures and docstrings: - def __init__(self, *args, fmt='mp4', size='1620x1050', **kwargs): Video class, takes care of storing screenshots (frames) as images in a temporary folder and then merging these into a ...
a14ead80c1dbc75f20a145a49394dc467c4f7bf1
<|skeleton|> class Video: def __init__(self, *args, fmt='mp4', size='1620x1050', **kwargs): """Video class, takes care of storing screenshots (frames) as images in a temporary folder and then merging these into a single video file when the video is closed.""" <|body_0|> def close(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Video: def __init__(self, *args, fmt='mp4', size='1620x1050', **kwargs): """Video class, takes care of storing screenshots (frames) as images in a temporary folder and then merging these into a single video file when the video is closed.""" super().__init__(*args, **kwargs) self.format...
the_stack_v2_python_sparse
brainrender/_video.py
brainglobe/brainrender
train
345
85f47f0d3e6a9c0418d427d00de354e8fc2f4223
[ "self.plugin = OrographicEnhancement()\ndata = np.array([[200.0, 450.0, 850.0], [320.0, 500.0, 1000.0], [230.0, 600.0, 900.0]])\nx_coord = DimCoord(np.arange(3), 'projection_x_coordinate', units='km')\ny_coord = DimCoord(np.arange(3), 'projection_y_coordinate', units='km')\nself.plugin.topography = iris.cube.Cube(d...
<|body_start_0|> self.plugin = OrographicEnhancement() data = np.array([[200.0, 450.0, 850.0], [320.0, 500.0, 1000.0], [230.0, 600.0, 900.0]]) x_coord = DimCoord(np.arange(3), 'projection_x_coordinate', units='km') y_coord = DimCoord(np.arange(3), 'projection_y_coordinate', units='km') ...
Test the _orography_gradients method
Test__orography_gradients
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__orography_gradients: """Test the _orography_gradients method""" def setUp(self): """Set up an input cube""" <|body_0|> def test_basic(self): """Test outputs are cubes""" <|body_1|> def test_values(self): """Test output values and units"...
stack_v2_sparse_classes_10k_train_005519
34,979
permissive
[ { "docstring": "Set up an input cube", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test outputs are cubes", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test output values and units", "name": "test_values", "signature...
3
null
Implement the Python class `Test__orography_gradients` described below. Class description: Test the _orography_gradients method Method signatures and docstrings: - def setUp(self): Set up an input cube - def test_basic(self): Test outputs are cubes - def test_values(self): Test output values and units
Implement the Python class `Test__orography_gradients` described below. Class description: Test the _orography_gradients method Method signatures and docstrings: - def setUp(self): Set up an input cube - def test_basic(self): Test outputs are cubes - def test_values(self): Test output values and units <|skeleton|> c...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__orography_gradients: """Test the _orography_gradients method""" def setUp(self): """Set up an input cube""" <|body_0|> def test_basic(self): """Test outputs are cubes""" <|body_1|> def test_values(self): """Test output values and units"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test__orography_gradients: """Test the _orography_gradients method""" def setUp(self): """Set up an input cube""" self.plugin = OrographicEnhancement() data = np.array([[200.0, 450.0, 850.0], [320.0, 500.0, 1000.0], [230.0, 600.0, 900.0]]) x_coord = DimCoord(np.arange(3), ...
the_stack_v2_python_sparse
improver_tests/orographic_enhancement/test_OrographicEnhancement.py
metoppv/improver
train
101
3775d1779fedc61c5ce12242becca5ce2182afb5
[ "self.n_samples = n_samples\nself.ref_mask_feature = self._parse_features(ref_mask_feature, default_feature_type=FeatureType.MASK_TIMELESS)\nself.ref_labels = list(ref_labels)\nself.sample_features = self._parse_features(sample_features, new_names=True, rename_function='{}_SAMPLED'.format)\nself.return_new_eopatch ...
<|body_start_0|> self.n_samples = n_samples self.ref_mask_feature = self._parse_features(ref_mask_feature, default_feature_type=FeatureType.MASK_TIMELESS) self.ref_labels = list(ref_labels) self.sample_features = self._parse_features(sample_features, new_names=True, rename_function='{}_S...
Task for spatially sampling points from a time-series. This task performs random spatial sampling of a time-series based on a label mask. The user specifies the number of points to be sampled, the name of the `DATA` time-series, the name of the label raster image, and the name of the output sample features and sampled ...
PointSamplingTask
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointSamplingTask: """Task for spatially sampling points from a time-series. This task performs random spatial sampling of a time-series based on a label mask. The user specifies the number of points to be sampled, the name of the `DATA` time-series, the name of the label raster image, and the na...
stack_v2_sparse_classes_10k_train_005520
17,294
permissive
[ { "docstring": "Initialise sampling task. The data to be sampled is supposed to be a time-series stored in `DATA` type of the eopatch, while the raster image is supposed to be stored in `MASK_TIMELESS`. The output sampled features are stored in `DATA` and have shape T x N_SAMPLES x 1 x D, where T is the number ...
2
stack_v2_sparse_classes_30k_train_003873
Implement the Python class `PointSamplingTask` described below. Class description: Task for spatially sampling points from a time-series. This task performs random spatial sampling of a time-series based on a label mask. The user specifies the number of points to be sampled, the name of the `DATA` time-series, the nam...
Implement the Python class `PointSamplingTask` described below. Class description: Task for spatially sampling points from a time-series. This task performs random spatial sampling of a time-series based on a label mask. The user specifies the number of points to be sampled, the name of the `DATA` time-series, the nam...
148189e2b92e06059b87f223b596255ccafac86d
<|skeleton|> class PointSamplingTask: """Task for spatially sampling points from a time-series. This task performs random spatial sampling of a time-series based on a label mask. The user specifies the number of points to be sampled, the name of the `DATA` time-series, the name of the label raster image, and the na...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PointSamplingTask: """Task for spatially sampling points from a time-series. This task performs random spatial sampling of a time-series based on a label mask. The user specifies the number of points to be sampled, the name of the `DATA` time-series, the name of the label raster image, and the name of the out...
the_stack_v2_python_sparse
geometry/eolearn/geometry/sampling.py
wouellette/eo-learn
train
2
55a8d31018ec74d8722fc0afe894a7a192e2d665
[ "audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False)\nif audit['submitted'] == True:\n abort(400, 'Already submitted')\nif audit['approved'] == True:\n abort(400, 'Already approved by administrator(s)')\nschema = AuditUpdateSchema(only=['submitted', 'rejected_reason'])\...
<|body_start_0|> audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False) if audit['submitted'] == True: abort(400, 'Already submitted') if audit['approved'] == True: abort(400, 'Already approved by administrator(s)') schema = Au...
AuditSubmission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" <|body_0|> def delete(self, audit_uuid): """Withdraw the submission of the specified audit result""" <|body_1|> <|end_skeleton|> <|body_start_0|> audit = AuditResou...
stack_v2_sparse_classes_10k_train_005521
18,857
no_license
[ { "docstring": "Submit the specified audit result", "name": "post", "signature": "def post(self, audit_uuid)" }, { "docstring": "Withdraw the submission of the specified audit result", "name": "delete", "signature": "def delete(self, audit_uuid)" } ]
2
stack_v2_sparse_classes_30k_train_001707
Implement the Python class `AuditSubmission` described below. Class description: Implement the AuditSubmission class. Method signatures and docstrings: - def post(self, audit_uuid): Submit the specified audit result - def delete(self, audit_uuid): Withdraw the submission of the specified audit result
Implement the Python class `AuditSubmission` described below. Class description: Implement the AuditSubmission class. Method signatures and docstrings: - def post(self, audit_uuid): Submit the specified audit result - def delete(self, audit_uuid): Withdraw the submission of the specified audit result <|skeleton|> cl...
7b67aa682d73c8a8d7f0f19b2a90e69c40761c58
<|skeleton|> class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" <|body_0|> def delete(self, audit_uuid): """Withdraw the submission of the specified audit result""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuditSubmission: def post(self, audit_uuid): """Submit the specified audit result""" audit = AuditResource.get_by_id(audit_uuid=audit_uuid, withContacts=False, withScans=False) if audit['submitted'] == True: abort(400, 'Already submitted') if audit['approved'] == Tr...
the_stack_v2_python_sparse
rem/apis/audit.py
recruit-tech/casval
train
6
c1c03a353afa75881332d04cfbc335811935317c
[ "flowerbed = [1, 0] + flowerbed + [0, 1]\ncur = 0\nresult = 0\nfor flower in flowerbed:\n if flower == 0:\n cur += 1\n else:\n result += int((cur - 1) / 2)\n cur = 0\nreturn result >= n", "s = ('10' + ''.join([str(x) for x in flowerbed]) + '01').split('1')\nprint(s)\nresult = 0\nfor x i...
<|body_start_0|> flowerbed = [1, 0] + flowerbed + [0, 1] cur = 0 result = 0 for flower in flowerbed: if flower == 0: cur += 1 else: result += int((cur - 1) / 2) cur = 0 return result >= n <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_0|> def canPlaceFlowers1(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_005522
1,040
no_license
[ { "docstring": ":type flowerbed: List[int] :type n: int :rtype: bool", "name": "canPlaceFlowers", "signature": "def canPlaceFlowers(self, flowerbed, n)" }, { "docstring": ":type flowerbed: List[int] :type n: int :rtype: bool", "name": "canPlaceFlowers1", "signature": "def canPlaceFlowers...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool - def canPlaceFlowers1(self, flowerbed, n): :type flowerbed: List[int] :type n: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool - def canPlaceFlowers1(self, flowerbed, n): :type flowerbed: List[int] :type n: int ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_0|> def canPlaceFlowers1(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canPlaceFlowers(self, flowerbed, n): """:type flowerbed: List[int] :type n: int :rtype: bool""" flowerbed = [1, 0] + flowerbed + [0, 1] cur = 0 result = 0 for flower in flowerbed: if flower == 0: cur += 1 else: ...
the_stack_v2_python_sparse
python/leetcode/605_Can_Place_Flowers.py
bobcaoge/my-code
train
0
60fe26ac79915b57231af5608d6ae7a7ad047c37
[ "if not hasattr(cls, _mangle(cls, 'instance')):\n setattr(cls, _mangle(cls, 'instance'), super().__new__(cls))\n setattr(cls, _mangle(cls, 'initialized'), False)\nreturn getattr(cls, _mangle(cls, 'instance'))", "if cls.__init__ != object.__init__:\n old_init = cls.__init__\n\n def new_init(self, *args...
<|body_start_0|> if not hasattr(cls, _mangle(cls, 'instance')): setattr(cls, _mangle(cls, 'instance'), super().__new__(cls)) setattr(cls, _mangle(cls, 'initialized'), False) return getattr(cls, _mangle(cls, 'instance')) <|end_body_0|> <|body_start_1|> if cls.__init__ != ...
Class that is only constructed and initialized once, then future constructions return the already constructed class. When used in a class hierarchy, all children of a singleton can call their parent's constructors exactly once
Singleton
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Singleton: """Class that is only constructed and initialized once, then future constructions return the already constructed class. When used in a class hierarchy, all children of a singleton can call their parent's constructors exactly once""" def __new__(cls, *args, **kwargs): """Co...
stack_v2_sparse_classes_10k_train_005523
9,712
permissive
[ { "docstring": "Construct a new Singleton. Checks for an instance, if one doesn't exist, creates one :param args: Ignored :param kwargs: Ignored :return: New or existing instance", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "Prepare a subclass to only h...
2
stack_v2_sparse_classes_30k_train_004269
Implement the Python class `Singleton` described below. Class description: Class that is only constructed and initialized once, then future constructions return the already constructed class. When used in a class hierarchy, all children of a singleton can call their parent's constructors exactly once Method signature...
Implement the Python class `Singleton` described below. Class description: Class that is only constructed and initialized once, then future constructions return the already constructed class. When used in a class hierarchy, all children of a singleton can call their parent's constructors exactly once Method signature...
4bf155feec7cb983e8d283d93552902ec85178a2
<|skeleton|> class Singleton: """Class that is only constructed and initialized once, then future constructions return the already constructed class. When used in a class hierarchy, all children of a singleton can call their parent's constructors exactly once""" def __new__(cls, *args, **kwargs): """Co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Singleton: """Class that is only constructed and initialized once, then future constructions return the already constructed class. When used in a class hierarchy, all children of a singleton can call their parent's constructors exactly once""" def __new__(cls, *args, **kwargs): """Construct a new...
the_stack_v2_python_sparse
spidertools/common/clstools.py
CraftSpider/SpiderTools
train
6
7b9c906d6cd3f83f63e95ab467f7d7f9b6f76781
[ "global dev_plan_list_page, admin_page\ndev_plan_list_page = DevPlanListPage(self.driver)\nadmin_page = AdminPage(self.driver)\nadmin_page.into_subsystem('业务管理')\nadmin_page.select_menu('首页/渠道业务管理/年度发展计划')", "admin_page.select_menu('计划列表')\ndev_plan_list_page.query_by_year(_year='2020')\nassert '2020' in dev_plan...
<|body_start_0|> global dev_plan_list_page, admin_page dev_plan_list_page = DevPlanListPage(self.driver) admin_page = AdminPage(self.driver) admin_page.into_subsystem('业务管理') admin_page.select_menu('首页/渠道业务管理/年度发展计划') <|end_body_0|> <|body_start_1|> admin_page.select_men...
TestDevPlanList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDevPlanList: def set_up(self): """前置操作 :return:""" <|body_0|> def test_query_dev_plan(self, set_up): """年度计划查询 :return:""" <|body_1|> def test_reset_dev_plan_query(self): """重置年度计划查询 :return:""" <|body_2|> def test_click_create_d...
stack_v2_sparse_classes_10k_train_005524
2,658
no_license
[ { "docstring": "前置操作 :return:", "name": "set_up", "signature": "def set_up(self)" }, { "docstring": "年度计划查询 :return:", "name": "test_query_dev_plan", "signature": "def test_query_dev_plan(self, set_up)" }, { "docstring": "重置年度计划查询 :return:", "name": "test_reset_dev_plan_query...
6
stack_v2_sparse_classes_30k_train_000769
Implement the Python class `TestDevPlanList` described below. Class description: Implement the TestDevPlanList class. Method signatures and docstrings: - def set_up(self): 前置操作 :return: - def test_query_dev_plan(self, set_up): 年度计划查询 :return: - def test_reset_dev_plan_query(self): 重置年度计划查询 :return: - def test_click_c...
Implement the Python class `TestDevPlanList` described below. Class description: Implement the TestDevPlanList class. Method signatures and docstrings: - def set_up(self): 前置操作 :return: - def test_query_dev_plan(self, set_up): 年度计划查询 :return: - def test_reset_dev_plan_query(self): 重置年度计划查询 :return: - def test_click_c...
86d1b085af2d3808ac8472d541f4bf26d26591e0
<|skeleton|> class TestDevPlanList: def set_up(self): """前置操作 :return:""" <|body_0|> def test_query_dev_plan(self, set_up): """年度计划查询 :return:""" <|body_1|> def test_reset_dev_plan_query(self): """重置年度计划查询 :return:""" <|body_2|> def test_click_create_d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestDevPlanList: def set_up(self): """前置操作 :return:""" global dev_plan_list_page, admin_page dev_plan_list_page = DevPlanListPage(self.driver) admin_page = AdminPage(self.driver) admin_page.into_subsystem('业务管理') admin_page.select_menu('首页/渠道业务管理/年度发展计划') d...
the_stack_v2_python_sparse
src/cases/business_manage/channel_business_manage/developmentPlan/test_dev_plan_list_page_170.py
102244653/SeleniumByPython
train
2
00aebdf3dfd86c7ea7580ca6118a1db55fb135ab
[ "self.y = np.empty(0)\nself.ts_period = ts_period\nself.timestamp_interval = -1\nself.last_timestamp = -1\nself._fitted = False\nself.copy = copy\nif self.ts_period is None:\n raise ValueError(\"'ts_period' must be given.\")", "if X.size != y.size:\n raise ValueError(\"'X' and 'y' size must match.\")\nif se...
<|body_start_0|> self.y = np.empty(0) self.ts_period = ts_period self.timestamp_interval = -1 self.last_timestamp = -1 self._fitted = False self.copy = copy if self.ts_period is None: raise ValueError("'ts_period' must be given.") <|end_body_0|> <|bod...
Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding timestamp of the previous period.
TSNaiveSeasonal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSNaiveSeasonal: """Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding times...
stack_v2_sparse_classes_10k_train_005525
12,299
permissive
[ { "docstring": "Init a Seasonal Naive Model.", "name": "__init__", "signature": "def __init__(self, ts_period: int, copy: bool=False)" }, { "docstring": "Fit a Seasonal Naive model.", "name": "fit", "signature": "def fit(self, X: np.ndarray, y: np.ndarray, **kwargs) -> 'TSNaiveSeasonal'"...
3
stack_v2_sparse_classes_30k_train_003775
Implement the Python class `TSNaiveSeasonal` described below. Class description: Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal ...
Implement the Python class `TSNaiveSeasonal` described below. Class description: Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal ...
61cc1f63fa055c7466151cfefa7baff8df1702b7
<|skeleton|> class TSNaiveSeasonal: """Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding times...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TSNaiveSeasonal: """Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding timestamp of the p...
the_stack_v2_python_sparse
tspymfe/_models.py
FelSiq/ts-pymfe
train
9
15840d207be8cfbe0239573bf8d5694867192449
[ "if strs == []:\n return '-.'\nreturn '+&*+'.join(strs)", "if s == '-.':\n return []\nreturn s.split('+&*+')" ]
<|body_start_0|> if strs == []: return '-.' return '+&*+'.join(strs) <|end_body_0|> <|body_start_1|> if s == '-.': return [] return s.split('+&*+') <|end_body_1|>
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_005526
722
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_val_000161
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
30bfafb6a7727c9305b22933b63d9d645182c633
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" if strs == []: return '-.' return '+&*+'.join(strs) def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: L...
the_stack_v2_python_sparse
leetcode/String/encode-and-decode-strings.py
iCodeIN/competitive-programming-5
train
0
e0adfb50c1bd69ef89412b53925f436a7192be76
[ "if intervals == None or len(intervals) == 0:\n return [newInterval]\nres = []\ni = 0\nwhile i < len(intervals):\n if intervals[i].end < newInterval.start:\n res.append(intervals[i])\n i += 1\n continue\n if intervals[i].start > newInterval.end:\n res.append(newInterval)\n ...
<|body_start_0|> if intervals == None or len(intervals) == 0: return [newInterval] res = [] i = 0 while i < len(intervals): if intervals[i].end < newInterval.start: res.append(intervals[i]) i += 1 continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insert_before(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" <|body_0|> def insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :...
stack_v2_sparse_classes_10k_train_005527
2,021
no_license
[ { "docstring": ":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]", "name": "insert_before", "signature": "def insert_before(self, intervals, newInterval)" }, { "docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]", ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert_before(self, intervals, newInterval): :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] - def insert(self, intervals, newInterval): :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert_before(self, intervals, newInterval): :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] - def insert(self, intervals, newInterval): :t...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class Solution: def insert_before(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" <|body_0|> def insert(self, intervals, newInterval): """:type intervals: List[List[int]] :type newInterval: List[int] :...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def insert_before(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" if intervals == None or len(intervals) == 0: return [newInterval] res = [] i = 0 while i < len(intervals): ...
the_stack_v2_python_sparse
problems/InsertInterval.py
wan-catherine/Leetcode
train
5
cbb8cd4e8e83e23e52ee1c5079569069ea4233df
[ "if not api.base.is_service_enabled(request, 'compute'):\n raise rest_utils.AjaxError(501, _('Service Nova is disabled.'))\nquota_set = api.nova.default_quota_get(request, request.user.tenant_id)\ndisabled_quotas = quotas.get_disabled_quotas(request)\nfiltered_quotas = [quota for quota in quota_set if quota.name...
<|body_start_0|> if not api.base.is_service_enabled(request, 'compute'): raise rest_utils.AjaxError(501, _('Service Nova is disabled.')) quota_set = api.nova.default_quota_get(request, request.user.tenant_id) disabled_quotas = quotas.get_disabled_quotas(request) filtered_quot...
API for getting default quotas for nova
DefaultQuotaSets
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultQuotaSets: """API for getting default quotas for nova""" def get(self, request): """Get the values for Nova specific quotas Example GET: http://localhost/api/nova/quota-sets/defaults/""" <|body_0|> def patch(self, request): """Update the values for Nova sp...
stack_v2_sparse_classes_10k_train_005528
28,240
permissive
[ { "docstring": "Get the values for Nova specific quotas Example GET: http://localhost/api/nova/quota-sets/defaults/", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Update the values for Nova specific quotas This method returns HTTP 204 (no content) on success.", "na...
2
null
Implement the Python class `DefaultQuotaSets` described below. Class description: API for getting default quotas for nova Method signatures and docstrings: - def get(self, request): Get the values for Nova specific quotas Example GET: http://localhost/api/nova/quota-sets/defaults/ - def patch(self, request): Update t...
Implement the Python class `DefaultQuotaSets` described below. Class description: API for getting default quotas for nova Method signatures and docstrings: - def get(self, request): Get the values for Nova specific quotas Example GET: http://localhost/api/nova/quota-sets/defaults/ - def patch(self, request): Update t...
7896fd8c77a6766a1156a520946efaf792b76ca5
<|skeleton|> class DefaultQuotaSets: """API for getting default quotas for nova""" def get(self, request): """Get the values for Nova specific quotas Example GET: http://localhost/api/nova/quota-sets/defaults/""" <|body_0|> def patch(self, request): """Update the values for Nova sp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DefaultQuotaSets: """API for getting default quotas for nova""" def get(self, request): """Get the values for Nova specific quotas Example GET: http://localhost/api/nova/quota-sets/defaults/""" if not api.base.is_service_enabled(request, 'compute'): raise rest_utils.AjaxError(...
the_stack_v2_python_sparse
openstack_dashboard/api/rest/nova.py
openstack/horizon
train
1,060
39c40f6306e92855a045c0841c63d574ffe680c0
[ "binning = '1,1' if hdu is None else self.get_meta_value(self.get_headarr(hdu), 'binning')\ndetector_dict = dict(binning=binning, det=1, dataext=1, specaxis=0, specflip=False, spatflip=False, platescale=0.2, darkcurr=0.0, saturation=65535.0, nonlinear=0.76, mincounts=-10000000000.0, numamplifiers=1, gain=np.atleast...
<|body_start_0|> binning = '1,1' if hdu is None else self.get_meta_value(self.get_headarr(hdu), 'binning') detector_dict = dict(binning=binning, det=1, dataext=1, specaxis=0, specflip=False, spatflip=False, platescale=0.2, darkcurr=0.0, saturation=65535.0, nonlinear=0.76, mincounts=-10000000000.0, numam...
Child to handle WHT/ISIS blue specific code
WHTISISBlueSpectrograph
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WHTISISBlueSpectrograph: """Child to handle WHT/ISIS blue specific code""" def get_detector_par(self, det, hdu=None): """Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with t...
stack_v2_sparse_classes_10k_train_005529
16,230
permissive
[ { "docstring": "Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with the raw image of interest. If not provided, frame-dependent parameters are set to a default. Returns: :class:`~pypeit.images.detector_...
4
stack_v2_sparse_classes_30k_train_003628
Implement the Python class `WHTISISBlueSpectrograph` described below. Class description: Child to handle WHT/ISIS blue specific code Method signatures and docstrings: - def get_detector_par(self, det, hdu=None): Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astrop...
Implement the Python class `WHTISISBlueSpectrograph` described below. Class description: Child to handle WHT/ISIS blue specific code Method signatures and docstrings: - def get_detector_par(self, det, hdu=None): Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astrop...
0d2e2196afc6904050b1af4d572f5c643bb07e38
<|skeleton|> class WHTISISBlueSpectrograph: """Child to handle WHT/ISIS blue specific code""" def get_detector_par(self, det, hdu=None): """Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WHTISISBlueSpectrograph: """Child to handle WHT/ISIS blue specific code""" def get_detector_par(self, det, hdu=None): """Return metadata for the selected detector. Args: det (:obj:`int`): 1-indexed detector number. hdu (`astropy.io.fits.HDUList`_, optional): The open fits file with the raw image ...
the_stack_v2_python_sparse
pypeit/spectrographs/wht_isis.py
pypeit/PypeIt
train
136
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.weight, mbart_layer.self_attn.k_proj.weight, mbart_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.bias, mbart_layer.self_attn.k_proj.bias, mbart_layer.sel...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.weight, mbart_layer.self_attn.k_proj.weight, mbart_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.bias, mbart_layer.self...
MBartEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MBartEncoderLayerBetterTransformer: def __init__(self, mbart_layer, config): """A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved.""" ...
stack_v2_sparse_classes_10k_train_005530
43,670
no_license
[ { "docstring": "A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, mbart_layer, config)" }, {...
2
stack_v2_sparse_classes_30k_train_006983
Implement the Python class `MBartEncoderLayerBetterTransformer` described below. Class description: Implement the MBartEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, mbart_layer, config): A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementat...
Implement the Python class `MBartEncoderLayerBetterTransformer` described below. Class description: Implement the MBartEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, mbart_layer, config): A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementat...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MBartEncoderLayerBetterTransformer: def __init__(self, mbart_layer, config): """A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MBartEncoderLayerBetterTransformer: def __init__(self, mbart_layer, config): """A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved.""" super()....
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
8088bc5b2311607af3c9946eb29481f6881a7730
[ "if instance is None:\n raise ValueError('Class instance binding must be non-empty')\nself._instance = instance", "inst = self._instance\nif isinstance(inst, ReferenceType):\n inst = inst()\n if inst is None:\n raise InjectionError('Weakref instance expired')\nreturn inst" ]
<|body_start_0|> if instance is None: raise ValueError('Class instance binding must be non-empty') self._instance = instance <|end_body_0|> <|body_start_1|> inst = self._instance if isinstance(inst, ReferenceType): inst = inst() if inst is None: ...
Provider for a previously-created instance.
InstanceProvider
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceProvider: """Provider for a previously-created instance.""" def __init__(self, instance): """Initialize the instance provider.""" <|body_0|> def provide(self, config: BaseSettings, injector: BaseInjector): """Provide the object instance given a config and...
stack_v2_sparse_classes_10k_train_005531
4,857
permissive
[ { "docstring": "Initialize the instance provider.", "name": "__init__", "signature": "def __init__(self, instance)" }, { "docstring": "Provide the object instance given a config and injector.", "name": "provide", "signature": "def provide(self, config: BaseSettings, injector: BaseInjecto...
2
null
Implement the Python class `InstanceProvider` described below. Class description: Provider for a previously-created instance. Method signatures and docstrings: - def __init__(self, instance): Initialize the instance provider. - def provide(self, config: BaseSettings, injector: BaseInjector): Provide the object instan...
Implement the Python class `InstanceProvider` described below. Class description: Provider for a previously-created instance. Method signatures and docstrings: - def __init__(self, instance): Initialize the instance provider. - def provide(self, config: BaseSettings, injector: BaseInjector): Provide the object instan...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class InstanceProvider: """Provider for a previously-created instance.""" def __init__(self, instance): """Initialize the instance provider.""" <|body_0|> def provide(self, config: BaseSettings, injector: BaseInjector): """Provide the object instance given a config and...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceProvider: """Provider for a previously-created instance.""" def __init__(self, instance): """Initialize the instance provider.""" if instance is None: raise ValueError('Class instance binding must be non-empty') self._instance = instance def provide(self, ...
the_stack_v2_python_sparse
aries_cloudagent/config/provider.py
hyperledger/aries-cloudagent-python
train
370
385e6c0fd733bb2146de322917e44fc635480985
[ "manager = self.request.registry.queryMultiAdapter((self.request, self.context), IManager)\nrepresentation_manager = manager.get_representation_manager()\ndocument_type = type(manager.context).documents.model_class\nreturn representation_manager.represent_listing(implementedBy(document_type))", "manager = self.re...
<|body_start_0|> manager = self.request.registry.queryMultiAdapter((self.request, self.context), IManager) representation_manager = manager.get_representation_manager() document_type = type(manager.context).documents.model_class return representation_manager.represent_listing(implemented...
AuctionCancellationDocumentResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuctionCancellationDocumentResource: def collection_get(self): """Auction Cancellation Documents List""" <|body_0|> def collection_post(self): """Auction Cancellation Document Post""" <|body_1|> <|end_skeleton|> <|body_start_0|> manager = self.reque...
stack_v2_sparse_classes_10k_train_005532
2,068
permissive
[ { "docstring": "Auction Cancellation Documents List", "name": "collection_get", "signature": "def collection_get(self)" }, { "docstring": "Auction Cancellation Document Post", "name": "collection_post", "signature": "def collection_post(self)" } ]
2
stack_v2_sparse_classes_30k_train_000999
Implement the Python class `AuctionCancellationDocumentResource` described below. Class description: Implement the AuctionCancellationDocumentResource class. Method signatures and docstrings: - def collection_get(self): Auction Cancellation Documents List - def collection_post(self): Auction Cancellation Document Pos...
Implement the Python class `AuctionCancellationDocumentResource` described below. Class description: Implement the AuctionCancellationDocumentResource class. Method signatures and docstrings: - def collection_get(self): Auction Cancellation Documents List - def collection_post(self): Auction Cancellation Document Pos...
05c9ea3db1b1d290521b1430286ff2e5064819cd
<|skeleton|> class AuctionCancellationDocumentResource: def collection_get(self): """Auction Cancellation Documents List""" <|body_0|> def collection_post(self): """Auction Cancellation Document Post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuctionCancellationDocumentResource: def collection_get(self): """Auction Cancellation Documents List""" manager = self.request.registry.queryMultiAdapter((self.request, self.context), IManager) representation_manager = manager.get_representation_manager() document_type = type(...
the_stack_v2_python_sparse
openprocurement/auctions/geb/views/cancellation_document.py
andrey484/openprocurement.auctions.geb
train
0
b9590dc6d5cbe2c1720c51260df40e6f771b61e9
[ "if root is None:\n return True\nnode_bounds_stack = [(root, -float('inf'), float('inf'))]\nwhile len(node_bounds_stack):\n node, lb, ub = node_bounds_stack.pop()\n if node.val <= lb or node.val >= ub:\n return False\n if node.left:\n node_bounds_stack.append((node.left, lb, node.val))\n ...
<|body_start_0|> if root is None: return True node_bounds_stack = [(root, -float('inf'), float('inf'))] while len(node_bounds_stack): node, lb, ub = node_bounds_stack.pop() if node.val <= lb or node.val >= ub: return False if node.l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST1(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST(self, root, lb=-float('inf'), ub=float('inf')): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is ...
stack_v2_sparse_classes_10k_train_005533
2,250
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST1", "signature": "def isValidBST1(self, root)" }, { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root, lb=-float('inf'), ub=float('inf'))" } ]
2
stack_v2_sparse_classes_30k_train_000103
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST1(self, root): :type root: TreeNode :rtype: bool - def isValidBST(self, root, lb=-float('inf'), ub=float('inf')): :type root: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST1(self, root): :type root: TreeNode :rtype: bool - def isValidBST(self, root, lb=-float('inf'), ub=float('inf')): :type root: TreeNode :rtype: bool <|skeleton|> cl...
d181f2075c6c3881772dfbf54df3ac3390936079
<|skeleton|> class Solution: def isValidBST1(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST(self, root, lb=-float('inf'), ub=float('inf')): """:type root: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST1(self, root): """:type root: TreeNode :rtype: bool""" if root is None: return True node_bounds_stack = [(root, -float('inf'), float('inf'))] while len(node_bounds_stack): node, lb, ub = node_bounds_stack.pop() if node...
the_stack_v2_python_sparse
98. Validate Binary Search Tree.py
melekoktay/Leetcode-Practice
train
0
783e9b570e018918288117da37259f3e7e2b6e5c
[ "self.update_norm_coordinates((config.SCREEN_WIDTH, config.SCREEN_HEIGHT))\nvh = view_hierarchy.ViewHierarchy()\nvh.load_xml(screen_info.view_hierarchy.xml.encode('utf-8'))\nif dedup:\n vh.dedup((self.coordinates_x_pixel[0], self.coordinates_y_pixel[0]))\nself.leaf_nodes = vh.get_leaf_nodes()\nui_object_list = v...
<|body_start_0|> self.update_norm_coordinates((config.SCREEN_WIDTH, config.SCREEN_HEIGHT)) vh = view_hierarchy.ViewHierarchy() vh.load_xml(screen_info.view_hierarchy.xml.encode('utf-8')) if dedup: vh.dedup((self.coordinates_x_pixel[0], self.coordinates_y_pixel[0])) se...
This class defines ActionEvent class. ActionEvent is high level event summarized from low level android event logs. This example shows the android event logs and the extracted ActionEvent object: Android Event Logs: [ 42.407808] EV_ABS ABS_MT_TRACKING_ID 00000000 [ 42.407808] EV_ABS ABS_MT_TOUCH_MAJOR 00000004 [ 42.407...
ActionEvent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionEvent: """This class defines ActionEvent class. ActionEvent is high level event summarized from low level android event logs. This example shows the android event logs and the extracted ActionEvent object: Android Event Logs: [ 42.407808] EV_ABS ABS_MT_TRACKING_ID 00000000 [ 42.407808] EV_A...
stack_v2_sparse_classes_10k_train_005534
14,083
permissive
[ { "docstring": "Updates action event attributes from screen_info. Updates coordinates_x(y)_pixel and object_id from the screen_info proto. Args: screen_info: ScreenInfo protobuf dedup: whether dedup the UI objs with same text or content desc. Raises: ValueError when fail to find object id.", "name": "update...
3
null
Implement the Python class `ActionEvent` described below. Class description: This class defines ActionEvent class. ActionEvent is high level event summarized from low level android event logs. This example shows the android event logs and the extracted ActionEvent object: Android Event Logs: [ 42.407808] EV_ABS ABS_MT...
Implement the Python class `ActionEvent` described below. Class description: This class defines ActionEvent class. ActionEvent is high level event summarized from low level android event logs. This example shows the android event logs and the extracted ActionEvent object: Android Event Logs: [ 42.407808] EV_ABS ABS_MT...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class ActionEvent: """This class defines ActionEvent class. ActionEvent is high level event summarized from low level android event logs. This example shows the android event logs and the extracted ActionEvent object: Android Event Logs: [ 42.407808] EV_ABS ABS_MT_TRACKING_ID 00000000 [ 42.407808] EV_A...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ActionEvent: """This class defines ActionEvent class. ActionEvent is high level event summarized from low level android event logs. This example shows the android event logs and the extracted ActionEvent object: Android Event Logs: [ 42.407808] EV_ABS ABS_MT_TRACKING_ID 00000000 [ 42.407808] EV_ABS ABS_MT_TOU...
the_stack_v2_python_sparse
seq2act/data_generation/common.py
Ayoob7/google-research
train
2
aff02d4421deb6518184ae189d1198bf8ce7bf12
[ "result = bfs.setup()\nvertices = result[0]\nnode_edges = result[1]\nself.assertEqual(vertices[-1], 200, 'The vertices list has not imported correctly.')\nexpected = [149, 155, 52, 87, 120, 39, 160, 137, 27, 79, 131, 100, 25, 55, 23, 126, 84, 166, 150, 62, 67, 1, 69, 35]\nself.assertEqual(node_edges[200], expected)...
<|body_start_0|> result = bfs.setup() vertices = result[0] node_edges = result[1] self.assertEqual(vertices[-1], 200, 'The vertices list has not imported correctly.') expected = [149, 155, 52, 87, 120, 39, 160, 137, 27, 79, 131, 100, 25, 55, 23, 126, 84, 166, 150, 62, 67, 1, 69, ...
TestBFS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBFS: def test_setup(self): """Test to ensure lists are set up correctly for the problem.""" <|body_0|> def test_breadth_first_search(self): """Tests the three possible outcomes of a breadth first search: 1) A path exists between two seperate nodes. 2) A node is a...
stack_v2_sparse_classes_10k_train_005535
3,240
permissive
[ { "docstring": "Test to ensure lists are set up correctly for the problem.", "name": "test_setup", "signature": "def test_setup(self)" }, { "docstring": "Tests the three possible outcomes of a breadth first search: 1) A path exists between two seperate nodes. 2) A node is a path unto itself, dis...
3
stack_v2_sparse_classes_30k_train_002048
Implement the Python class `TestBFS` described below. Class description: Implement the TestBFS class. Method signatures and docstrings: - def test_setup(self): Test to ensure lists are set up correctly for the problem. - def test_breadth_first_search(self): Tests the three possible outcomes of a breadth first search:...
Implement the Python class `TestBFS` described below. Class description: Implement the TestBFS class. Method signatures and docstrings: - def test_setup(self): Test to ensure lists are set up correctly for the problem. - def test_breadth_first_search(self): Tests the three possible outcomes of a breadth first search:...
82605a1dea4e52480f006956645e812fe2cb02dc
<|skeleton|> class TestBFS: def test_setup(self): """Test to ensure lists are set up correctly for the problem.""" <|body_0|> def test_breadth_first_search(self): """Tests the three possible outcomes of a breadth first search: 1) A path exists between two seperate nodes. 2) A node is a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestBFS: def test_setup(self): """Test to ensure lists are set up correctly for the problem.""" result = bfs.setup() vertices = result[0] node_edges = result[1] self.assertEqual(vertices[-1], 200, 'The vertices list has not imported correctly.') expected = [149,...
the_stack_v2_python_sparse
Stanford/08_GraphSearch/BreadthFirstSearch/test_breadth_first_search.py
jeffvswanson/DataStructuresAndAlgorithms
train
4
3f214bf7e19242bdc070d885246f61f3d9edfc95
[ "result = []\nnums.sort()\n\ndef backtrack(tmpList, idx):\n newList = [item for item in tmpList]\n result.add(newList)\n for i in range(idx, len(nums)):\n tmpList.append(nums[i])\n backtrack(tmpList, i + 1)\n _ = tmpList.pop()\nbacktrack([], 0)\nreturn result", "result = [[]]\nfor it...
<|body_start_0|> result = [] nums.sort() def backtrack(tmpList, idx): newList = [item for item in tmpList] result.add(newList) for i in range(idx, len(nums)): tmpList.append(nums[i]) backtrack(tmpList, i + 1) _ ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def solve2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] nums.sort(...
stack_v2_sparse_classes_10k_train_005536
1,225
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "solve2", "signature": "def solve2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_001574
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def solve2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def solve2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def solve2(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 subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" result = [] nums.sort() def backtrack(tmpList, idx): newList = [item for item in tmpList] result.add(newList) for i in range(idx, len(nums)): ...
the_stack_v2_python_sparse
python/leetcode/combinatorial/subsets/78_subsets.py
Levintsky/topcoder
train
0
2e75f3f70ab13799d3b163d4f2873035a0de5839
[ "clickndrag.Plane.__init__(self, name, rect, draggable=False, grab=False)\nself.background_color = self.cached_color = self.current_color = BACKGROUND_COLOR\nif background_color is not None:\n self.background_color = self.cached_color = self.current_color = background_color\nif text is not None:\n self.text =...
<|body_start_0|> clickndrag.Plane.__init__(self, name, rect, draggable=False, grab=False) self.background_color = self.cached_color = self.current_color = BACKGROUND_COLOR if background_color is not None: self.background_color = self.cached_color = self.current_color = background_col...
A clickndrag.Plane which displays a text. Additional attributes: Label.text The text to be written on the Label Label.cached_text Cache to catch changes Label.background_color The original background color for this Label Label.current_color The current background color Label.cached_color A cache for color changes
Label
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Label: """A clickndrag.Plane which displays a text. Additional attributes: Label.text The text to be written on the Label Label.cached_text Cache to catch changes Label.background_color The original background color for this Label Label.current_color The current background color Label.cached_colo...
stack_v2_sparse_classes_10k_train_005537
27,668
permissive
[ { "docstring": "Initialise the Label. text is the text to be written on the Label. If text is None, it is replaced by an empty string.", "name": "__init__", "signature": "def __init__(self, name, text, rect, background_color=None)" }, { "docstring": "Renew the text on the label, then call the ba...
3
stack_v2_sparse_classes_30k_train_001487
Implement the Python class `Label` described below. Class description: A clickndrag.Plane which displays a text. Additional attributes: Label.text The text to be written on the Label Label.cached_text Cache to catch changes Label.background_color The original background color for this Label Label.current_color The cur...
Implement the Python class `Label` described below. Class description: A clickndrag.Plane which displays a text. Additional attributes: Label.text The text to be written on the Label Label.cached_text Cache to catch changes Label.background_color The original background color for this Label Label.current_color The cur...
c2fc3d4e9beedb8487cfa4bfa13bdf55ec36af97
<|skeleton|> class Label: """A clickndrag.Plane which displays a text. Additional attributes: Label.text The text to be written on the Label Label.cached_text Cache to catch changes Label.background_color The original background color for this Label Label.current_color The current background color Label.cached_colo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Label: """A clickndrag.Plane which displays a text. Additional attributes: Label.text The text to be written on the Label Label.cached_text Cache to catch changes Label.background_color The original background color for this Label Label.current_color The current background color Label.cached_color A cache for...
the_stack_v2_python_sparse
reference_scripts/clickndrag-0.4.1/clickndrag/gui.py
stivosaurus/rpi-snippets
train
1
63be88ee34c7a7c99cee6fb3528d4ecf9bfd7578
[ "self._with_bkg_par = bool(with_bkg_par)\nself._t_start = float(t_start)\nself._exposure = float(exposure)\nself._seed = int(seed)\nself._simput = simput\nself._data_dir = data_dir\nself._ra_cen = ra_cen\nself._dec_cen = dec_cen", "try:\n os.makedirs(self._data_dir)\nexcept OSError as e:\n print('already ex...
<|body_start_0|> self._with_bkg_par = bool(with_bkg_par) self._t_start = float(t_start) self._exposure = float(exposure) self._seed = int(seed) self._simput = simput self._data_dir = data_dir self._ra_cen = ra_cen self._dec_cen = dec_cen <|end_body_0|> <|...
SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.
Simulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulator: """SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.""" def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, ra_cen, dec_cen): """:param with_bkg_p...
stack_v2_sparse_classes_10k_train_005538
5,418
no_license
[ { "docstring": ":param with_bkg_par: Simulate with particle background. :param t_start: Start time of simulation. Input units of [s] :param exposure: Length of time to simulate for after t_start :param seed: Seed for random number generator. :param simput: Simput file (ie. the sky model)", "name": "__init__...
5
stack_v2_sparse_classes_30k_train_003851
Implement the Python class `Simulator` described below. Class description: SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up. Method signatures and docstrings: - def __init__(self, with_bkg_par, t_start, exposure, se...
Implement the Python class `Simulator` described below. Class description: SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up. Method signatures and docstrings: - def __init__(self, with_bkg_par, t_start, exposure, se...
2b8ac686b1d445a39fcd28dbe07ef467c0b14c7e
<|skeleton|> class Simulator: """SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.""" def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, ra_cen, dec_cen): """:param with_bkg_p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Simulator: """SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.""" def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, ra_cen, dec_cen): """:param with_bkg_par: Simulate ...
the_stack_v2_python_sparse
python/sixte/simulate_agn_only.py
HuiboZhou/mocks_high_fidelity
train
0
354bf43e403d1e54cac76c21082af39a39f11656
[ "super(ContainerSpec, cls)._ApplyFlags(config_values, flag_values)\nif flag_values['image'].present:\n config_values['image'] = flag_values.image\nif flag_values['static_container_image'].present:\n config_values['static_image'] = flag_values.static_container_image", "result = super(ContainerSpec, cls)._Get...
<|body_start_0|> super(ContainerSpec, cls)._ApplyFlags(config_values, flag_values) if flag_values['image'].present: config_values['image'] = flag_values.image if flag_values['static_container_image'].present: config_values['static_image'] = flag_values.static_container_im...
Class containing options for creating containers.
ContainerSpec
[ "Classpath-exception-2.0", "BSD-3-Clause", "AGPL-3.0-only", "MIT", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContainerSpec: """Class containing options for creating containers.""" def _ApplyFlags(cls, config_values, flag_values): """Apply flag settings to the container spec.""" <|body_0|> def _GetOptionDecoderConstructions(cls): """Gets decoder classes and constructor a...
stack_v2_sparse_classes_10k_train_005539
34,074
permissive
[ { "docstring": "Apply flag settings to the container spec.", "name": "_ApplyFlags", "signature": "def _ApplyFlags(cls, config_values, flag_values)" }, { "docstring": "Gets decoder classes and constructor args for each configurable option. Can be overridden by derived classes to add options or im...
2
stack_v2_sparse_classes_30k_train_004449
Implement the Python class `ContainerSpec` described below. Class description: Class containing options for creating containers. Method signatures and docstrings: - def _ApplyFlags(cls, config_values, flag_values): Apply flag settings to the container spec. - def _GetOptionDecoderConstructions(cls): Gets decoder clas...
Implement the Python class `ContainerSpec` described below. Class description: Class containing options for creating containers. Method signatures and docstrings: - def _ApplyFlags(cls, config_values, flag_values): Apply flag settings to the container spec. - def _GetOptionDecoderConstructions(cls): Gets decoder clas...
d0699f32998898757b036704fba39e5471641f01
<|skeleton|> class ContainerSpec: """Class containing options for creating containers.""" def _ApplyFlags(cls, config_values, flag_values): """Apply flag settings to the container spec.""" <|body_0|> def _GetOptionDecoderConstructions(cls): """Gets decoder classes and constructor a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContainerSpec: """Class containing options for creating containers.""" def _ApplyFlags(cls, config_values, flag_values): """Apply flag settings to the container spec.""" super(ContainerSpec, cls)._ApplyFlags(config_values, flag_values) if flag_values['image'].present: ...
the_stack_v2_python_sparse
perfkitbenchmarker/container_service.py
GoogleCloudPlatform/PerfKitBenchmarker
train
1,923
18d469840d0f33d2799d913dd1cad491db1d907a
[ "ret = []\nencoder = ': '\nfor string in strs:\n for char in string:\n if char == ':':\n ret.append('::')\n else:\n ret.append(char)\n ret.append(encoder)\nreturn ''.join(ret)", "encoder = ': '\nret = []\ntemp = []\nindex = 0\nwhile index < len(s):\n if s[index] == ':'...
<|body_start_0|> ret = [] encoder = ': ' for string in strs: for char in string: if char == ':': ret.append('::') else: ret.append(char) ret.append(encoder) return ''.join(ret) <|end_body_0|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = [] ...
stack_v2_sparse_classes_10k_train_005540
1,233
no_license
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
stack_v2_sparse_classes_30k_train_005726
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
fdb6bcb4c721e03e853890dd89122f2c4196a1ea
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" ret = [] encoder = ': ' for string in strs: for char in string: if char == ':': ret.append('::') else: ...
the_stack_v2_python_sparse
python/string/encode_decode_string.py
XifeiNi/LeetCode-Traversal
train
2
c89969d2dc917bef875f0ea8d6aacb561278d585
[ "self._msw = magicseaweed.MSW_Forecast(api_key, spot_id, None, units)\nself.currently = None\nself.hourly = {}\nself.update = Throttle(MIN_TIME_BETWEEN_UPDATES)(self._update)", "try:\n forecasts = self._msw.get_future()\n self.currently = forecasts.data[0]\n for forecast in forecasts.data[:8]:\n h...
<|body_start_0|> self._msw = magicseaweed.MSW_Forecast(api_key, spot_id, None, units) self.currently = None self.hourly = {} self.update = Throttle(MIN_TIME_BETWEEN_UPDATES)(self._update) <|end_body_0|> <|body_start_1|> try: forecasts = self._msw.get_future() ...
Get the latest data from MagicSeaweed.
MagicSeaweedData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicSeaweedData: """Get the latest data from MagicSeaweed.""" def __init__(self, api_key, spot_id, units): """Initialize the data object.""" <|body_0|> def _update(self): """Get the latest data from MagicSeaweed.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_005541
6,249
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, api_key, spot_id, units)" }, { "docstring": "Get the latest data from MagicSeaweed.", "name": "_update", "signature": "def _update(self)" } ]
2
null
Implement the Python class `MagicSeaweedData` described below. Class description: Get the latest data from MagicSeaweed. Method signatures and docstrings: - def __init__(self, api_key, spot_id, units): Initialize the data object. - def _update(self): Get the latest data from MagicSeaweed.
Implement the Python class `MagicSeaweedData` described below. Class description: Get the latest data from MagicSeaweed. Method signatures and docstrings: - def __init__(self, api_key, spot_id, units): Initialize the data object. - def _update(self): Get the latest data from MagicSeaweed. <|skeleton|> class MagicSea...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class MagicSeaweedData: """Get the latest data from MagicSeaweed.""" def __init__(self, api_key, spot_id, units): """Initialize the data object.""" <|body_0|> def _update(self): """Get the latest data from MagicSeaweed.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MagicSeaweedData: """Get the latest data from MagicSeaweed.""" def __init__(self, api_key, spot_id, units): """Initialize the data object.""" self._msw = magicseaweed.MSW_Forecast(api_key, spot_id, None, units) self.currently = None self.hourly = {} self.update = T...
the_stack_v2_python_sparse
homeassistant/components/magicseaweed/sensor.py
BenWoodford/home-assistant
train
11
05ebf26c1a0213d51fa6ffadcc85ab2ab5272c1b
[ "nodes = [(root, 0)]\nvalues = []\nwhile nodes:\n cur, h = nodes.pop()\n values.append(cur.val)\n if cur.left:\n nodes.append((cur.left, h + 1))\n if cur.right:\n nodes.append((cur.right, h + 1))\nvalues.sort()\nnew = [values[i + 1] - values[i] for i in range(len(values) - 1)]\nres = min(n...
<|body_start_0|> nodes = [(root, 0)] values = [] while nodes: cur, h = nodes.pop() values.append(cur.val) if cur.left: nodes.append((cur.left, h + 1)) if cur.right: nodes.append((cur.right, h + 1)) values.sor...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def getMinimumDifference2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nodes = [(root, 0)] ...
stack_v2_sparse_classes_10k_train_005542
1,588
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "getMinimumDifference", "signature": "def getMinimumDifference(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "getMinimumDifference2", "signature": "def getMinimumDifference2(self, root)" } ]
2
stack_v2_sparse_classes_30k_test_000296
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int - def getMinimumDifference2(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 getMinimumDifference(self, root): :type root: TreeNode :rtype: int - def getMinimumDifference2(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def getMinimumDifference2(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 getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" nodes = [(root, 0)] values = [] while nodes: cur, h = nodes.pop() values.append(cur.val) if cur.left: nodes.append((cur.left, h + 1)) ...
the_stack_v2_python_sparse
530. Minimum Absolute Difference in BST/difference.py
Macielyoung/LeetCode
train
1
1ee3e1395dee58c16774f54cd8adb21df5225f24
[ "super().__init__(*args, **kwargs)\nself.gx = gx\nself.gy = gy\nself.gz = gz", "if gridpoi == 'x':\n self.background_color = BCKGRND_CLR\nelif type(gridpoi) == list:\n if gridpoi[0] == 'D':\n self.background_color = [1, 1, 0, 1]\n elif gridpoi[0] == 'M':\n self.background_color = [1, 0, 1, ...
<|body_start_0|> super().__init__(*args, **kwargs) self.gx = gx self.gy = gy self.gz = gz <|end_body_0|> <|body_start_1|> if gridpoi == 'x': self.background_color = BCKGRND_CLR elif type(gridpoi) == list: if gridpoi[0] == 'D': self...
Square
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Square: def __init__(self, gx, gy, gz, *args, **kwargs): """params:- gx : int : grid x coordinate gy : int : grid y coordinate gz : int : grid z coordinate""" <|body_0|> def update_square(self, gx, gy, gz, gridpoi): """params:- gx : int : grid x coordinate, used to w...
stack_v2_sparse_classes_10k_train_005543
6,851
no_license
[ { "docstring": "params:- gx : int : grid x coordinate gy : int : grid y coordinate gz : int : grid z coordinate", "name": "__init__", "signature": "def __init__(self, gx, gy, gz, *args, **kwargs)" }, { "docstring": "params:- gx : int : grid x coordinate, used to workout black or white square gy ...
2
stack_v2_sparse_classes_30k_train_000459
Implement the Python class `Square` described below. Class description: Implement the Square class. Method signatures and docstrings: - def __init__(self, gx, gy, gz, *args, **kwargs): params:- gx : int : grid x coordinate gy : int : grid y coordinate gz : int : grid z coordinate - def update_square(self, gx, gy, gz,...
Implement the Python class `Square` described below. Class description: Implement the Square class. Method signatures and docstrings: - def __init__(self, gx, gy, gz, *args, **kwargs): params:- gx : int : grid x coordinate gy : int : grid y coordinate gz : int : grid z coordinate - def update_square(self, gx, gy, gz,...
020a6f05e17fd9ef8d8a10f22a0482352d18ddd5
<|skeleton|> class Square: def __init__(self, gx, gy, gz, *args, **kwargs): """params:- gx : int : grid x coordinate gy : int : grid y coordinate gz : int : grid z coordinate""" <|body_0|> def update_square(self, gx, gy, gz, gridpoi): """params:- gx : int : grid x coordinate, used to w...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Square: def __init__(self, gx, gy, gz, *args, **kwargs): """params:- gx : int : grid x coordinate gy : int : grid y coordinate gz : int : grid z coordinate""" super().__init__(*args, **kwargs) self.gx = gx self.gy = gy self.gz = gz def update_square(self, gx, gy, g...
the_stack_v2_python_sparse
bin/Visualliser/visualliser.py
HarryBurge/StarTrekChessAI
train
0
3022ddf851225d4782231737bcfd0a5dcc33cfd9
[ "for i in range(len(flowerbed)):\n if (i == 0 or flowerbed[i - 1] == 0) and flowerbed[i] == 0 and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0):\n flowerbed[i] = 1\n n -= 1\n if n <= 0:\n return True\nreturn n <= 0", "planted = n\nnot_planted = n\nfor x in flowerbed:\n if not x:...
<|body_start_0|> for i in range(len(flowerbed)): if (i == 0 or flowerbed[i - 1] == 0) and flowerbed[i] == 0 and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0): flowerbed[i] = 1 n -= 1 if n <= 0: return True return n <= 0 <|end_b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: """Jan 31, 2022 14:52""" <|body_0|> def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: """Apr 23, 2023 18:53""" <|body_1|> <|end_skeleton|> <|body_start_0|> for...
stack_v2_sparse_classes_10k_train_005544
2,070
no_license
[ { "docstring": "Jan 31, 2022 14:52", "name": "canPlaceFlowers", "signature": "def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool" }, { "docstring": "Apr 23, 2023 18:53", "name": "canPlaceFlowers", "signature": "def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: Jan 31, 2022 14:52 - def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: Apr 23, 2023 18:53
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: Jan 31, 2022 14:52 - def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: Apr 23, 2023 18:53 <|skele...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: """Jan 31, 2022 14:52""" <|body_0|> def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: """Apr 23, 2023 18:53""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: """Jan 31, 2022 14:52""" for i in range(len(flowerbed)): if (i == 0 or flowerbed[i - 1] == 0) and flowerbed[i] == 0 and (i == len(flowerbed) - 1 or flowerbed[i + 1] == 0): flowerbed[i] = 1 ...
the_stack_v2_python_sparse
leetcode/solved/605_Can_Place_Flowers/solution.py
sungminoh/algorithms
train
0
622f265f10cd073d10096cfffdc1e7b0a1f0fde5
[ "self.next = [None] * 26\nself.word = False\nif len(suffix) == 0:\n self.word = True\n return\nidx = ord(suffix[0]) - BaseA\nif self.next[idx] is None:\n self.next[idx] = PrefixNode(suffix[1:])\nelse:\n self.next[idx].add(suffix[1:])", "if suffix == '':\n if self.word:\n return False\n se...
<|body_start_0|> self.next = [None] * 26 self.word = False if len(suffix) == 0: self.word = True return idx = ord(suffix[0]) - BaseA if self.next[idx] is None: self.next[idx] = PrefixNode(suffix[1:]) else: self.next[idx].add...
PrefixNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrefixNode: def __init__(self, suffix): """Node in a Prefix Tree.""" <|body_0|> def add(self, suffix): """Add rest of suffix.""" <|body_1|> def remove(self, suffix): """Remove rest of suffix.""" <|body_2|> def __repr__(self): ...
stack_v2_sparse_classes_10k_train_005545
3,958
no_license
[ { "docstring": "Node in a Prefix Tree.", "name": "__init__", "signature": "def __init__(self, suffix)" }, { "docstring": "Add rest of suffix.", "name": "add", "signature": "def add(self, suffix)" }, { "docstring": "Remove rest of suffix.", "name": "remove", "signature": "...
4
stack_v2_sparse_classes_30k_train_000657
Implement the Python class `PrefixNode` described below. Class description: Implement the PrefixNode class. Method signatures and docstrings: - def __init__(self, suffix): Node in a Prefix Tree. - def add(self, suffix): Add rest of suffix. - def remove(self, suffix): Remove rest of suffix. - def __repr__(self): Repre...
Implement the Python class `PrefixNode` described below. Class description: Implement the PrefixNode class. Method signatures and docstrings: - def __init__(self, suffix): Node in a Prefix Tree. - def add(self, suffix): Add rest of suffix. - def remove(self, suffix): Remove rest of suffix. - def __repr__(self): Repre...
ec8837af1df91167fdc8666863ac9b390095a441
<|skeleton|> class PrefixNode: def __init__(self, suffix): """Node in a Prefix Tree.""" <|body_0|> def add(self, suffix): """Add rest of suffix.""" <|body_1|> def remove(self, suffix): """Remove rest of suffix.""" <|body_2|> def __repr__(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrefixNode: def __init__(self, suffix): """Node in a Prefix Tree.""" self.next = [None] * 26 self.word = False if len(suffix) == 0: self.word = True return idx = ord(suffix[0]) - BaseA if self.next[idx] is None: self.next[idx]...
the_stack_v2_python_sparse
3. Pointer Structures/prefixTreeLinkedList.py
RANUX/python-algorithms
train
0
23885620ff0ef8f70d2d8bc5d8f2e0f0c21f5447
[ "try:\n user = await get_data_from_req(self.request).administrators.get(user_id)\nexcept ResourceNotFoundError:\n raise NotFound()\nreturn json_response(user)", "if not await check_can_edit_user(get_authorization_client_from_req(self.request), self.request['client'].user_id, user_id):\n raise HTTPForbidd...
<|body_start_0|> try: user = await get_data_from_req(self.request).administrators.get(user_id) except ResourceNotFoundError: raise NotFound() return json_response(user) <|end_body_0|> <|body_start_1|> if not await check_can_edit_user(get_authorization_client_from...
AdminUserView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminUserView: async def get(self, user_id: str, /) -> Union[r200[UserResponse], r404]: """Get a user. Fetches the details of a user. Status Codes: 200: Successful operation 404: User not found""" <|body_0|> async def patch(self, user_id: str, /, data: UpdateUserRequest) -> ...
stack_v2_sparse_classes_10k_train_005546
6,189
permissive
[ { "docstring": "Get a user. Fetches the details of a user. Status Codes: 200: Successful operation 404: User not found", "name": "get", "signature": "async def get(self, user_id: str, /) -> Union[r200[UserResponse], r404]" }, { "docstring": "Update a user. Status Codes: 200: Successful operation...
2
stack_v2_sparse_classes_30k_train_006772
Implement the Python class `AdminUserView` described below. Class description: Implement the AdminUserView class. Method signatures and docstrings: - async def get(self, user_id: str, /) -> Union[r200[UserResponse], r404]: Get a user. Fetches the details of a user. Status Codes: 200: Successful operation 404: User no...
Implement the Python class `AdminUserView` described below. Class description: Implement the AdminUserView class. Method signatures and docstrings: - async def get(self, user_id: str, /) -> Union[r200[UserResponse], r404]: Get a user. Fetches the details of a user. Status Codes: 200: Successful operation 404: User no...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class AdminUserView: async def get(self, user_id: str, /) -> Union[r200[UserResponse], r404]: """Get a user. Fetches the details of a user. Status Codes: 200: Successful operation 404: User not found""" <|body_0|> async def patch(self, user_id: str, /, data: UpdateUserRequest) -> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdminUserView: async def get(self, user_id: str, /) -> Union[r200[UserResponse], r404]: """Get a user. Fetches the details of a user. Status Codes: 200: Successful operation 404: User not found""" try: user = await get_data_from_req(self.request).administrators.get(user_id) ...
the_stack_v2_python_sparse
virtool/administrators/api.py
virtool/virtool
train
45
4f8948521bc9ecc91b2ace6e440b943ab943bc8e
[ "uid = getSecurityManager().getUser().getId()\nif uid == 'Anonymous':\n return ()\nbook = component.getUtility(IAddressBookUtility).get(uid)\nentry_names = list(book.keys())\nentry_names.sort()\nentry_dict = {}\nfor entry_name in entry_names:\n second_line = ''\n if book[entry_name].ship_second_line:\n ...
<|body_start_0|> uid = getSecurityManager().getUser().getId() if uid == 'Anonymous': return () book = component.getUtility(IAddressBookUtility).get(uid) entry_names = list(book.keys()) entry_names.sort() entry_dict = {} for entry_name in entry_names: ...
AddressBookView
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressBookView: def getEntryNames(self): """get a list of entry names""" <|body_0|> def getEntryScripts(self): """Returns javascript function that fill the fields with the data""" <|body_1|> <|end_skeleton|> <|body_start_0|> uid = getSecurityManage...
stack_v2_sparse_classes_10k_train_005547
37,142
permissive
[ { "docstring": "get a list of entry names", "name": "getEntryNames", "signature": "def getEntryNames(self)" }, { "docstring": "Returns javascript function that fill the fields with the data", "name": "getEntryScripts", "signature": "def getEntryScripts(self)" } ]
2
stack_v2_sparse_classes_30k_train_000259
Implement the Python class `AddressBookView` described below. Class description: Implement the AddressBookView class. Method signatures and docstrings: - def getEntryNames(self): get a list of entry names - def getEntryScripts(self): Returns javascript function that fill the fields with the data
Implement the Python class `AddressBookView` described below. Class description: Implement the AddressBookView class. Method signatures and docstrings: - def getEntryNames(self): get a list of entry names - def getEntryScripts(self): Returns javascript function that fill the fields with the data <|skeleton|> class A...
95ebc05678cb8db7510e0de0857ad41253800fb1
<|skeleton|> class AddressBookView: def getEntryNames(self): """get a list of entry names""" <|body_0|> def getEntryScripts(self): """Returns javascript function that fill the fields with the data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddressBookView: def getEntryNames(self): """get a list of entry names""" uid = getSecurityManager().getUser().getId() if uid == 'Anonymous': return () book = component.getUtility(IAddressBookUtility).get(uid) entry_names = list(book.keys()) entry_na...
the_stack_v2_python_sparse
Products/PloneGetPaid/browser/checkout.py
Martronic-SA/Products.PloneGetPaid
train
0
162d0fdc1f6466634341acc039c5baca02ec03f3
[ "if isinstance(size, int):\n self.size = size\nelif isinstance(size, collections.abc.Iterable) and len(size) == 3:\n if type(size) == list:\n size = tuple(size)\n self.size = size\nelse:\n raise ValueError('Unknown inputs for size: {}'.format(size))\nself.order = order\nsuper().__init__()", "im...
<|body_start_0|> if isinstance(size, int): self.size = size elif isinstance(size, collections.abc.Iterable) and len(size) == 3: if type(size) == list: size = tuple(size) self.size = size else: raise ValueError('Unknown inputs for si...
Resize the input numpy ndarray to the given size. Args: size order (int, optional): Desired order
Resize3D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Resize3D: """Resize the input numpy ndarray to the given size. Args: size order (int, optional): Desired order""" def __init__(self, size, order=1): """resize""" <|body_0|> def __call__(self, img, label=None): """Args: img (numpy ndarray): Image to be scaled. lab...
stack_v2_sparse_classes_10k_train_005548
34,927
permissive
[ { "docstring": "resize", "name": "__init__", "signature": "def __init__(self, size, order=1)" }, { "docstring": "Args: img (numpy ndarray): Image to be scaled. label (numpy ndarray) : Label to be scaled Returns: numpy ndarray: Rescaled image. numpy ndarray: Rescaled label.", "name": "__call_...
2
null
Implement the Python class `Resize3D` described below. Class description: Resize the input numpy ndarray to the given size. Args: size order (int, optional): Desired order Method signatures and docstrings: - def __init__(self, size, order=1): resize - def __call__(self, img, label=None): Args: img (numpy ndarray): Im...
Implement the Python class `Resize3D` described below. Class description: Resize the input numpy ndarray to the given size. Args: size order (int, optional): Desired order Method signatures and docstrings: - def __init__(self, size, order=1): resize - def __call__(self, img, label=None): Args: img (numpy ndarray): Im...
2c8c35a8949fef74599f5ec557d340a14415f20d
<|skeleton|> class Resize3D: """Resize the input numpy ndarray to the given size. Args: size order (int, optional): Desired order""" def __init__(self, size, order=1): """resize""" <|body_0|> def __call__(self, img, label=None): """Args: img (numpy ndarray): Image to be scaled. lab...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Resize3D: """Resize the input numpy ndarray to the given size. Args: size order (int, optional): Desired order""" def __init__(self, size, order=1): """resize""" if isinstance(size, int): self.size = size elif isinstance(size, collections.abc.Iterable) and len(size) ==...
the_stack_v2_python_sparse
contrib/MedicalSeg/medicalseg/transforms/transform.py
PaddlePaddle/PaddleSeg
train
8,531
7839938c10c11e00708856e0dc9081aa58c7c434
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n acc = acciones.read(org_fiscal_id, id)\nexcept EmptySetError:\n ns.abort(404, message=self.accion_not_found)\nexcept Exception as err:\n ns.abort(400, message=err)\nreturn acc", "try:\n verify_to...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: acc = acciones.read(org_fiscal_id, id) except EmptySetError: ns.abort(404, message=self.accion_not_found) except Exception ...
Accion
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Accion: def get(self, org_fiscal_id, id): """Recuperar una Acción""" <|body_0|> def put(self, org_fiscal_id, id): """Actualizar una Acción""" <|body_1|> def delete(self, org_fiscal_id, id): """Eliminar una Acción""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_10k_train_005549
6,129
no_license
[ { "docstring": "Recuperar una Acción", "name": "get", "signature": "def get(self, org_fiscal_id, id)" }, { "docstring": "Actualizar una Acción", "name": "put", "signature": "def put(self, org_fiscal_id, id)" }, { "docstring": "Eliminar una Acción", "name": "delete", "sign...
3
stack_v2_sparse_classes_30k_train_003042
Implement the Python class `Accion` described below. Class description: Implement the Accion class. Method signatures and docstrings: - def get(self, org_fiscal_id, id): Recuperar una Acción - def put(self, org_fiscal_id, id): Actualizar una Acción - def delete(self, org_fiscal_id, id): Eliminar una Acción
Implement the Python class `Accion` described below. Class description: Implement the Accion class. Method signatures and docstrings: - def get(self, org_fiscal_id, id): Recuperar una Acción - def put(self, org_fiscal_id, id): Actualizar una Acción - def delete(self, org_fiscal_id, id): Eliminar una Acción <|skeleto...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class Accion: def get(self, org_fiscal_id, id): """Recuperar una Acción""" <|body_0|> def put(self, org_fiscal_id, id): """Actualizar una Acción""" <|body_1|> def delete(self, org_fiscal_id, id): """Eliminar una Acción""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Accion: def get(self, org_fiscal_id, id): """Recuperar una Acción""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: acc = acciones.read(org_fiscal_id, id) except EmptySetError: ...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/acciones.py
Telematica/knight-rider
train
1
2a64914a782066498ca488e831698892cbece572
[ "super().__init__()\nlogging_levels = {val: val for val in LEVELS.values()}\nlogging_levels.update(LEVELS)\nself._ignore_exceptions = []\nfor exc_name, exc_level in ignore_exceptions:\n try:\n self._ignore_exceptions.append((logging_levels[exc_level], exc_name))\n except KeyError as err:\n raise...
<|body_start_0|> super().__init__() logging_levels = {val: val for val in LEVELS.values()} logging_levels.update(LEVELS) self._ignore_exceptions = [] for exc_name, exc_level in ignore_exceptions: try: self._ignore_exceptions.append((logging_levels[exc_...
Filter out the specified exceptions with specified logging level.
ExceptionFilter
[ "BSD-2-Clause", "BSD-3-Clause", "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExceptionFilter: """Filter out the specified exceptions with specified logging level.""" def __init__(self, ignore_exceptions): """Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will...
stack_v2_sparse_classes_10k_train_005550
1,804
permissive
[ { "docstring": "Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will filter out all exceptions with that name. ignore_exceptions: a tuple of tuples ((exception name, loglevel)) example: ((\"ReadTimeout\", \"WARN...
2
null
Implement the Python class `ExceptionFilter` described below. Class description: Filter out the specified exceptions with specified logging level. Method signatures and docstrings: - def __init__(self, ignore_exceptions): Configure filtering out of the specified exceptions with specified logging level. Note if there ...
Implement the Python class `ExceptionFilter` described below. Class description: Filter out the specified exceptions with specified logging level. Method signatures and docstrings: - def __init__(self, ignore_exceptions): Configure filtering out of the specified exceptions with specified logging level. Note if there ...
232446d776fdb906d2fb253cf0a409c6813a08d6
<|skeleton|> class ExceptionFilter: """Filter out the specified exceptions with specified logging level.""" def __init__(self, ignore_exceptions): """Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExceptionFilter: """Filter out the specified exceptions with specified logging level.""" def __init__(self, ignore_exceptions): """Configure filtering out of the specified exceptions with specified logging level. Note if there are multiple exceptions that have the same name this will filter out a...
the_stack_v2_python_sparse
h/util/logging_filters.py
hypothesis/h
train
2,558
dc840657645421dbdce14ac53e42865e44af777d
[ "global gf\nclocks_to_check = self.SYSTEM_CLOCK_SOURCES.keys()\nfrequencies = gf.apis.selftest.measure_clock_frequencies(*clocks_to_check)\nfor clock_number, measured_frequency in zip(clocks_to_check, frequencies):\n parameters = self.SYSTEM_CLOCK_SOURCES[clock_number]\n with self.subTest(parameters['name']):...
<|body_start_0|> global gf clocks_to_check = self.SYSTEM_CLOCK_SOURCES.keys() frequencies = gf.apis.selftest.measure_clock_frequencies(*clocks_to_check) for clock_number, measured_frequency in zip(clocks_to_check, frequencies): parameters = self.SYSTEM_CLOCK_SOURCES[clock_num...
Ensures each of the GreatFET's clocks are up and running.
ValidateSystemClocks
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidateSystemClocks: """Ensures each of the GreatFET's clocks are up and running.""" def test_system_clocks(self): """Test of each of the system's clocks""" <|body_0|> def test_usb_pll_stability(self): """Test that the USB-PLL is exactly in spec.""" <|bo...
stack_v2_sparse_classes_10k_train_005551
4,375
permissive
[ { "docstring": "Test of each of the system's clocks", "name": "test_system_clocks", "signature": "def test_system_clocks(self)" }, { "docstring": "Test that the USB-PLL is exactly in spec.", "name": "test_usb_pll_stability", "signature": "def test_usb_pll_stability(self)" } ]
2
stack_v2_sparse_classes_30k_train_002552
Implement the Python class `ValidateSystemClocks` described below. Class description: Ensures each of the GreatFET's clocks are up and running. Method signatures and docstrings: - def test_system_clocks(self): Test of each of the system's clocks - def test_usb_pll_stability(self): Test that the USB-PLL is exactly in ...
Implement the Python class `ValidateSystemClocks` described below. Class description: Ensures each of the GreatFET's clocks are up and running. Method signatures and docstrings: - def test_system_clocks(self): Test of each of the system's clocks - def test_usb_pll_stability(self): Test that the USB-PLL is exactly in ...
2409575d28fc7c9cae44c9085c7457ddfb54f893
<|skeleton|> class ValidateSystemClocks: """Ensures each of the GreatFET's clocks are up and running.""" def test_system_clocks(self): """Test of each of the system's clocks""" <|body_0|> def test_usb_pll_stability(self): """Test that the USB-PLL is exactly in spec.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ValidateSystemClocks: """Ensures each of the GreatFET's clocks are up and running.""" def test_system_clocks(self): """Test of each of the system's clocks""" global gf clocks_to_check = self.SYSTEM_CLOCK_SOURCES.keys() frequencies = gf.apis.selftest.measure_clock_frequenci...
the_stack_v2_python_sparse
host/greatfet/commands/greatfet_selftest.py
greatscottgadgets/greatfet
train
273
7827ddd9f4cfc18c123f16a5583632fe720d95b8
[ "self.nums = nums\nself.lens = len(nums)\nself.BIT = [0] * (self.lens + 1)\nfor i in range(self.lens):\n k = i + 1\n while k <= self.lens:\n self.BIT[k] += nums[i]\n k += k & -k", "diff = val - self.nums[i]\nself.nums[i] = val\ni += 1\nwhile i <= self.lens:\n self.BIT[i] += diff\n i += i...
<|body_start_0|> self.nums = nums self.lens = len(nums) self.BIT = [0] * (self.lens + 1) for i in range(self.lens): k = i + 1 while k <= self.lens: self.BIT[k] += nums[i] k += k & -k <|end_body_0|> <|body_start_1|> diff = v...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """sum: 遍历右侧 上一层已经把左侧的值加上去了,而左侧的索引又是小于右侧,所以...
stack_v2_sparse_classes_10k_train_005552
1,921
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": "sum: 遍历右侧 上一层已经把左侧的值加上去...
3
stack_v2_sparse_classes_30k_train_003442
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void - def sumRange(self, i, j): sum: 遍历右侧 上一层已经...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void - def sumRange(self, i, j): sum: 遍历右侧 上一层已经...
212f8b83d6ac22db1a777f980075d9e12ce521d2
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """update 操作一直都是遍历左侧 :type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """sum: 遍历右侧 上一层已经把左侧的值加上去了,而左侧的索引又是小于右侧,所以...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.nums = nums self.lens = len(nums) self.BIT = [0] * (self.lens + 1) for i in range(self.lens): k = i + 1 while k <= self.lens: self.BIT[k] += nums[i] ...
the_stack_v2_python_sparse
Data Structures and Algorithm Analysis/tree/Binary Indexed Tree.py
FrankieZhen/Lookoop
train
1
d953f3efe6f392b5e513e38617f88f57835d2c79
[ "self.sequence = A\nself.cursor = 0\nself.length = len(A)", "while self.cursor < self.length and self.sequence[self.cursor] < n:\n n -= self.sequence[self.cursor]\n self.cursor += 2\nif self.cursor < self.length:\n self.sequence[self.cursor] -= n\n return self.sequence[self.cursor + 1]\nelse:\n ret...
<|body_start_0|> self.sequence = A self.cursor = 0 self.length = len(A) <|end_body_0|> <|body_start_1|> while self.cursor < self.length and self.sequence[self.cursor] < n: n -= self.sequence[self.cursor] self.cursor += 2 if self.cursor < self.length: ...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sequence = A self.cursor = 0 self.length = len(A) <|end_body_...
stack_v2_sparse_classes_10k_train_005553
699
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
null
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.sequence = A self.cursor = 0 self.length = len(A) def next(self, n): """:type n: int :rtype: int""" while self.cursor < self.length and self.sequence[self.cursor] < n: n -= self.s...
the_stack_v2_python_sparse
python/leetcode/900_RLE_Iterator.py
bobcaoge/my-code
train
0
c377090f48a4ed5ad7e380a62919aff933334352
[ "self.dtype = dtype\nself.dim = dim\nself.units = units", "if self.dtype is None:\n return False\nelif self.dtype == dtype:\n return False\nelse:\n return True", "if self.dim is None:\n return False\nelif self.dim == dim:\n return False\nelse:\n return True", "if self.units is None:\n ret...
<|body_start_0|> self.dtype = dtype self.dim = dim self.units = units <|end_body_0|> <|body_start_1|> if self.dtype is None: return False elif self.dtype == dtype: return False else: return True <|end_body_1|> <|body_start_2|> ...
A class for holding and checking netCDF variables. Parameters ---------- dtype : type or None Expected dtype of the variable, None for no expected type. dim : tuple of str Expected dimensions of the variable, None for no expected dimensions. units : str Expected units attribute of the variable. None for no expected uni...
Variable
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Variable: """A class for holding and checking netCDF variables. Parameters ---------- dtype : type or None Expected dtype of the variable, None for no expected type. dim : tuple of str Expected dimensions of the variable, None for no expected dimensions. units : str Expected units attribute of th...
stack_v2_sparse_classes_10k_train_005554
40,072
permissive
[ { "docstring": "initalize the object.", "name": "__init__", "signature": "def __init__(self, dtype=None, dim=None, units=None)" }, { "docstring": "True if the provided dtype does not match the expected dtype.", "name": "dtype_bad", "signature": "def dtype_bad(self, dtype)" }, { "...
4
stack_v2_sparse_classes_30k_train_001779
Implement the Python class `Variable` described below. Class description: A class for holding and checking netCDF variables. Parameters ---------- dtype : type or None Expected dtype of the variable, None for no expected type. dim : tuple of str Expected dimensions of the variable, None for no expected dimensions. uni...
Implement the Python class `Variable` described below. Class description: A class for holding and checking netCDF variables. Parameters ---------- dtype : type or None Expected dtype of the variable, None for no expected type. dim : tuple of str Expected dimensions of the variable, None for no expected dimensions. uni...
172bbcf1cf3bcdb953c76ebae72c27c95dc2e606
<|skeleton|> class Variable: """A class for holding and checking netCDF variables. Parameters ---------- dtype : type or None Expected dtype of the variable, None for no expected type. dim : tuple of str Expected dimensions of the variable, None for no expected dimensions. units : str Expected units attribute of th...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Variable: """A class for holding and checking netCDF variables. Parameters ---------- dtype : type or None Expected dtype of the variable, None for no expected type. dim : tuple of str Expected dimensions of the variable, None for no expected dimensions. units : str Expected units attribute of the variable. N...
the_stack_v2_python_sparse
scripts/check_cfradial
ARM-DOE/pyart
train
455
2282d991bf310ae63d2249a689bf1a818c3e6b8b
[ "def outer(self, *args, **kwargs):\n logging.info('MetaView Outer: '.format(self.request))\n if self.request.get('google_login') == 'true':\n if self.get_current_user():\n refresh_url = util.set_query_parameters(self.request.url, google_login='')\n self.redirect(refresh_url)\n ...
<|body_start_0|> def outer(self, *args, **kwargs): logging.info('MetaView Outer: '.format(self.request)) if self.request.get('google_login') == 'true': if self.get_current_user(): refresh_url = util.set_query_parameters(self.request.url, google_login='...
Allows code to be run before and after get and post methods. See: http://stackoverflow.com/questions/6780907/python-wrap-class-method
MetaView
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain", "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetaView: """Allows code to be run before and after get and post methods. See: http://stackoverflow.com/questions/6780907/python-wrap-class-method""" def wrap(method): """Return a wrapped instance method""" <|body_0|> def __new__(cls, name, bases, attrs): """If t...
stack_v2_sparse_classes_10k_train_005555
38,138
permissive
[ { "docstring": "Return a wrapped instance method", "name": "wrap", "signature": "def wrap(method)" }, { "docstring": "If the class has an http GET method, wrap it.", "name": "__new__", "signature": "def __new__(cls, name, bases, attrs)" } ]
2
stack_v2_sparse_classes_30k_train_004043
Implement the Python class `MetaView` described below. Class description: Allows code to be run before and after get and post methods. See: http://stackoverflow.com/questions/6780907/python-wrap-class-method Method signatures and docstrings: - def wrap(method): Return a wrapped instance method - def __new__(cls, name...
Implement the Python class `MetaView` described below. Class description: Allows code to be run before and after get and post methods. See: http://stackoverflow.com/questions/6780907/python-wrap-class-method Method signatures and docstrings: - def wrap(method): Return a wrapped instance method - def __new__(cls, name...
14fbcf0830e47fb0c7a6af798ed01f7181147979
<|skeleton|> class MetaView: """Allows code to be run before and after get and post methods. See: http://stackoverflow.com/questions/6780907/python-wrap-class-method""" def wrap(method): """Return a wrapped instance method""" <|body_0|> def __new__(cls, name, bases, attrs): """If t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetaView: """Allows code to be run before and after get and post methods. See: http://stackoverflow.com/questions/6780907/python-wrap-class-method""" def wrap(method): """Return a wrapped instance method""" def outer(self, *args, **kwargs): logging.info('MetaView Outer: '.form...
the_stack_v2_python_sparse
mindsetkit.py
Stanford-PERTS/mindsetkit
train
0
e8d7ee81f44fb5bcce2a22f7bdc785bdf4dd6fd7
[ "super(EvaluateEnsemblePartial, self).__init__()\nself.evaluate_ensemble_partial = evaluate_ensemble_partial\nself.result_labels = result_labels\nself.every_x_epoch = every_x_epoch", "if epoch % self.every_x_epoch == self.every_x_epoch - 1:\n results = self.evaluate_ensemble_partial()\n if results is not No...
<|body_start_0|> super(EvaluateEnsemblePartial, self).__init__() self.evaluate_ensemble_partial = evaluate_ensemble_partial self.result_labels = result_labels self.every_x_epoch = every_x_epoch <|end_body_0|> <|body_start_1|> if epoch % self.every_x_epoch == self.every_x_epoch -...
Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.
EvaluateEnsemblePartial
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluateEnsemblePartial: """Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.""" def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): """Evaluate ensemble using a ensemble.evaluate partial. Can be used in combi...
stack_v2_sparse_classes_10k_train_005556
20,794
permissive
[ { "docstring": "Evaluate ensemble using a ensemble.evaluate partial. Can be used in combination with EvaluateEnsemblePartial to evaluate the ensemble at regular intervals inside a keras model.fit() loop. Note: only ScalarStatistic's are supported. Args: evaluate_ensemble_partial: bnn.ensemble.Ensemble.evaluate ...
2
stack_v2_sparse_classes_30k_train_000120
Implement the Python class `EvaluateEnsemblePartial` described below. Class description: Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop. Method signatures and docstrings: - def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): Evaluate ensembl...
Implement the Python class `EvaluateEnsemblePartial` described below. Class description: Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop. Method signatures and docstrings: - def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): Evaluate ensembl...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class EvaluateEnsemblePartial: """Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.""" def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): """Evaluate ensemble using a ensemble.evaluate partial. Can be used in combi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EvaluateEnsemblePartial: """Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.""" def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): """Evaluate ensemble using a ensemble.evaluate partial. Can be used in combination with E...
the_stack_v2_python_sparse
cold_posterior_bnn/core/keras_utils.py
Ayoob7/google-research
train
2
b9e15a7a0d8ab884552ac29b91dc1c465decd9be
[ "super().__init__(creator, flock_size, buffer_size)\nself._delay_used = delay_used\nself.inputs = self._create_storage('inputs', (flock_size, buffer_size, *input_shape), force_cpu=False)\nself.targets = self._create_storage('targets', (flock_size, buffer_size, *target_shape))\nself.learning_coefficients = self._cre...
<|body_start_0|> super().__init__(creator, flock_size, buffer_size) self._delay_used = delay_used self.inputs = self._create_storage('inputs', (flock_size, buffer_size, *input_shape), force_cpu=False) self.targets = self._create_storage('targets', (flock_size, buffer_size, *target_shape)...
Defines a circular buffer for a flock of neural networks. It has two storages: for inputs (flock_size, buffer_size, input_size) and for outputs. Then there are learning_coefficients (flock_size, 1) determining how much each network should learn the particular IO.
NetworkFlockBuffer
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkFlockBuffer: """Defines a circular buffer for a flock of neural networks. It has two storages: for inputs (flock_size, buffer_size, input_size) and for outputs. Then there are learning_coefficients (flock_size, 1) determining how much each network should learn the particular IO.""" de...
stack_v2_sparse_classes_10k_train_005557
3,879
permissive
[ { "docstring": "Initialize the buffer Args: flock_size (int): Number of networks in the flock buffer_size (int): Number of elements that can be stored in the buffer before rewriting occurs input_shape (Tuple): The shape of the inputs target_shape (Tuple): The shape of the target delay_used (bool): whether any o...
4
null
Implement the Python class `NetworkFlockBuffer` described below. Class description: Defines a circular buffer for a flock of neural networks. It has two storages: for inputs (flock_size, buffer_size, input_size) and for outputs. Then there are learning_coefficients (flock_size, 1) determining how much each network sho...
Implement the Python class `NetworkFlockBuffer` described below. Class description: Defines a circular buffer for a flock of neural networks. It has two storages: for inputs (flock_size, buffer_size, input_size) and for outputs. Then there are learning_coefficients (flock_size, 1) determining how much each network sho...
81d72b82ec96948c26d292d709f18c9c77a17ba4
<|skeleton|> class NetworkFlockBuffer: """Defines a circular buffer for a flock of neural networks. It has two storages: for inputs (flock_size, buffer_size, input_size) and for outputs. Then there are learning_coefficients (flock_size, 1) determining how much each network should learn the particular IO.""" de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NetworkFlockBuffer: """Defines a circular buffer for a flock of neural networks. It has two storages: for inputs (flock_size, buffer_size, input_size) and for outputs. Then there are learning_coefficients (flock_size, 1) determining how much each network should learn the particular IO.""" def __init__(se...
the_stack_v2_python_sparse
torchsim/core/models/neural_network/network_flock_buffer.py
andreofner/torchsim
train
0
551d351319962976d1c5729157cc9c054385d368
[ "def call(user, perm):\n return getattr(self, perm)(obj, cls, user)\nfor func in inspect.getmembers(type(self), predicate=inspect.ismethod):\n if not isinstance(self, func[1].__self__.__class__):\n setattr(call, func[0], functools.partial(func[1], obj, cls))\n else:\n setattr(call, func[0], f...
<|body_start_0|> def call(user, perm): return getattr(self, perm)(obj, cls, user) for func in inspect.getmembers(type(self), predicate=inspect.ismethod): if not isinstance(self, func[1].__self__.__class__): setattr(call, func[0], functools.partial(func[1], obj, cl...
Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = NodePermission() # Check class permissio...
Permission
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Permission: """Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = No...
stack_v2_sparse_classes_10k_train_005558
3,550
permissive
[ { "docstring": "Hacking object internals to provide means for the mentioned interface", "name": "__get__", "signature": "def __get__(self, obj, cls)" }, { "docstring": "Aggregates cls methods to self class", "name": "_aggregate", "signature": "def _aggregate(self, obj, cls, perm)" } ]
2
null
Implement the Python class `Permission` described below. Class description: Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provi...
Implement the Python class `Permission` described below. Class description: Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provi...
49c84f13a8f92427b01231615136549fb5be3a78
<|skeleton|> class Permission: """Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = No...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Permission: """Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permissions class NodePermission(Permission): def change(self, obj, cls, user): return obj.user == user # Provide permissions Node.has_permission = NodePermission(...
the_stack_v2_python_sparse
orchestra/permissions/options.py
Ro9ueAdmin/django-orchestra
train
0
e42462dd0a4417d7d473fe26708c502fd5b28a28
[ "self.ontology_file_path = path\nself.ontology = self.load_ontology()\nself.agent_requestable = self.ontology['system_requestable']\nself.user_requestable = self.ontology['user_requestable']\nself.slots_not_required_NLU = self.ontology['slots_not_required_NLU']\nself.slots_annotation = self.ontology['slots_annotati...
<|body_start_0|> self.ontology_file_path = path self.ontology = self.load_ontology() self.agent_requestable = self.ontology['system_requestable'] self.user_requestable = self.ontology['user_requestable'] self.slots_not_required_NLU = self.ontology['slots_not_required_NLU'] ...
Ontology is a class that loads ontology files (in .json format) into IAI MovieBot.
Ontology
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ontology: """Ontology is a class that loads ontology files (in .json format) into IAI MovieBot.""" def __init__(self, path): """Initializes the internal structures of the Domain Args: path: path to load the ontology from""" <|body_0|> def load_ontology(self): """...
stack_v2_sparse_classes_10k_train_005559
1,114
permissive
[ { "docstring": "Initializes the internal structures of the Domain Args: path: path to load the ontology from", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Loads the ontology file Returns: nothing", "name": "load_ontology", "signature": "def load_ontolog...
2
stack_v2_sparse_classes_30k_train_001907
Implement the Python class `Ontology` described below. Class description: Ontology is a class that loads ontology files (in .json format) into IAI MovieBot. Method signatures and docstrings: - def __init__(self, path): Initializes the internal structures of the Domain Args: path: path to load the ontology from - def ...
Implement the Python class `Ontology` described below. Class description: Ontology is a class that loads ontology files (in .json format) into IAI MovieBot. Method signatures and docstrings: - def __init__(self, path): Initializes the internal structures of the Domain Args: path: path to load the ontology from - def ...
172966ba2b90e22037b17467d69068dad5e26b09
<|skeleton|> class Ontology: """Ontology is a class that loads ontology files (in .json format) into IAI MovieBot.""" def __init__(self, path): """Initializes the internal structures of the Domain Args: path: path to load the ontology from""" <|body_0|> def load_ontology(self): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ontology: """Ontology is a class that loads ontology files (in .json format) into IAI MovieBot.""" def __init__(self, path): """Initializes the internal structures of the Domain Args: path: path to load the ontology from""" self.ontology_file_path = path self.ontology = self.load_...
the_stack_v2_python_sparse
moviebot/ontology/ontology.py
fseimb/moviebot-1
train
0
b4f2bf194cce2fd88682429504a88de29c1b1245
[ "ctxt = context.get_admin_context()\nservices = db.service_get_all(ctxt)\nprint_format = '%-16s %-36s %-16s %-10s %-5s %-10s'\nprint(print_format % (_('Binary'), _('Host'), _('Zone'), _('Status'), _('State'), _('Updated At')))\nfor svc in services:\n alive = utils.service_is_up(svc)\n art = ':-)' if alive els...
<|body_start_0|> ctxt = context.get_admin_context() services = db.service_get_all(ctxt) print_format = '%-16s %-36s %-16s %-10s %-5s %-10s' print(print_format % (_('Binary'), _('Host'), _('Zone'), _('Status'), _('State'), _('Updated At'))) for svc in services: alive =...
Methods for managing services.
ServiceCommands
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceCommands: """Methods for managing services.""" def list(self): """Show a list of all manila services.""" <|body_0|> def cleanup(self): """Remove manila services reporting as 'down'.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ctxt = c...
stack_v2_sparse_classes_10k_train_005560
19,425
permissive
[ { "docstring": "Show a list of all manila services.", "name": "list", "signature": "def list(self)" }, { "docstring": "Remove manila services reporting as 'down'.", "name": "cleanup", "signature": "def cleanup(self)" } ]
2
stack_v2_sparse_classes_30k_train_000067
Implement the Python class `ServiceCommands` described below. Class description: Methods for managing services. Method signatures and docstrings: - def list(self): Show a list of all manila services. - def cleanup(self): Remove manila services reporting as 'down'.
Implement the Python class `ServiceCommands` described below. Class description: Methods for managing services. Method signatures and docstrings: - def list(self): Show a list of all manila services. - def cleanup(self): Remove manila services reporting as 'down'. <|skeleton|> class ServiceCommands: """Methods f...
a93a844398a11a8a85f204782fb9456f7caccdbe
<|skeleton|> class ServiceCommands: """Methods for managing services.""" def list(self): """Show a list of all manila services.""" <|body_0|> def cleanup(self): """Remove manila services reporting as 'down'.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ServiceCommands: """Methods for managing services.""" def list(self): """Show a list of all manila services.""" ctxt = context.get_admin_context() services = db.service_get_all(ctxt) print_format = '%-16s %-36s %-16s %-10s %-5s %-10s' print(print_format % (_('Binar...
the_stack_v2_python_sparse
manila/cmd/manage.py
openstack/manila
train
178
0d321699c64a7e3af7180aacae9be4171af93cd7
[ "X = _is_dataframe(X)\nself.variables = _find_numerical_variables(X, self.variables)\n_check_contains_na(X, self.variables)\nreturn X", "check_is_fitted(self)\nX = _is_dataframe(X)\n_check_contains_na(X, self.variables)\n_check_input_matches_training_df(X, self.input_shape_[1])\nreturn X" ]
<|body_start_0|> X = _is_dataframe(X) self.variables = _find_numerical_variables(X, self.variables) _check_contains_na(X, self.variables) return X <|end_body_0|> <|body_start_1|> check_is_fitted(self) X = _is_dataframe(X) _check_contains_na(X, self.variables) ...
BaseNumericalTransformer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseNumericalTransformer: def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: """Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults...
stack_v2_sparse_classes_10k_train_005561
2,119
permissive
[ { "docstring": "Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults to None. Alternatively takes Pandas Series. Returns: DataFrame with fitted transformation", "name": "fit", ...
2
stack_v2_sparse_classes_30k_train_003591
Implement the Python class `BaseNumericalTransformer` described below. Class description: Implement the BaseNumericalTransformer class. Method signatures and docstrings: - def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: Fits the transformation to the DataFrame. Args: X: Pandas DataFrame t...
Implement the Python class `BaseNumericalTransformer` described below. Class description: Implement the BaseNumericalTransformer class. Method signatures and docstrings: - def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: Fits the transformation to the DataFrame. Args: X: Pandas DataFrame t...
74a2902c129452c96cc434df70127b7fa61b7f8a
<|skeleton|> class BaseNumericalTransformer: def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: """Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseNumericalTransformer: def fit(self, X: pd.DataFrame, y: Optional[pd.Series]=None) -> pd.DataFrame: """Fits the transformation to the DataFrame. Args: X: Pandas DataFrame to fit the transformation y: This parameter exists only for compatibility with sklearn.pipeline.Pipeline. Defaults to None. Alte...
the_stack_v2_python_sparse
feature_engine/base_transformers.py
mlaricobar/feature_engine
train
0
7d2bf70a1736b50409a315ef6f4f601f3d63e250
[ "super(RBF, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name)\nlogger.debug('Initializing %s kernel.' % self.name)\nassert np.size(variance) == 1\nassert np.size(lengthscale) == 1\nself.variance = np.float64(variance)\nself.lengthscale = np.float64(lengthscale)\nself.parameter_list = ['variance', 'l...
<|body_start_0|> super(RBF, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name) logger.debug('Initializing %s kernel.' % self.name) assert np.size(variance) == 1 assert np.size(lengthscale) == 1 self.variance = np.float64(variance) self.lengthscale = np.floa...
squared exponential kernel with the same shape parameter in each dimension
RBF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RBF: """squared exponential kernel with the same shape parameter in each dimension""" def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: (very much the same as in GPy.kern.RBF) n_dims : number of dimensions va...
stack_v2_sparse_classes_10k_train_005562
9,047
no_license
[ { "docstring": "squared exponential kernel Inputs: (very much the same as in GPy.kern.RBF) n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified", "name": "__init__", "signature": "def __init__(self, n_...
2
stack_v2_sparse_classes_30k_train_007044
Implement the Python class `RBF` described below. Class description: squared exponential kernel with the same shape parameter in each dimension Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: (very much the ...
Implement the Python class `RBF` described below. Class description: squared exponential kernel with the same shape parameter in each dimension Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: (very much the ...
1bed882b8a94ee58fd0bde6920ee85f81ffb77bb
<|skeleton|> class RBF: """squared exponential kernel with the same shape parameter in each dimension""" def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: (very much the same as in GPy.kern.RBF) n_dims : number of dimensions va...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RBF: """squared exponential kernel with the same shape parameter in each dimension""" def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: (very much the same as in GPy.kern.RBF) n_dims : number of dimensions variance : kern...
the_stack_v2_python_sparse
gp_grief/kern/stationary.py
scwolof/gp_grief
train
2
0a709c3f0eec183fc3c8fb349c6ed5fc1322b43b
[ "if len(queryset) > 1:\n self.message_user(request, 'You can only choose one certificate.', level=messages.ERROR)\n return None\nresponse = HttpResponse(content_type='text/plain')\ncert = queryset.first()\nresponse.write(crypto.dump_certificate(crypto.FILETYPE_TEXT, cert.get_certificate()))\nreturn response",...
<|body_start_0|> if len(queryset) > 1: self.message_user(request, 'You can only choose one certificate.', level=messages.ERROR) return None response = HttpResponse(content_type='text/plain') cert = queryset.first() response.write(crypto.dump_certificate(crypto.FIL...
Admin model for certificates.
CertificateAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CertificateAdmin: """Admin model for certificates.""" def view_certificate(self, request, queryset): """View a text version of the certificate.""" <|body_0|> def download_certificate(self, request, queryset): """Download a certificate.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k_train_005563
4,814
permissive
[ { "docstring": "View a text version of the certificate.", "name": "view_certificate", "signature": "def view_certificate(self, request, queryset)" }, { "docstring": "Download a certificate.", "name": "download_certificate", "signature": "def download_certificate(self, request, queryset)"...
2
stack_v2_sparse_classes_30k_train_002205
Implement the Python class `CertificateAdmin` described below. Class description: Admin model for certificates. Method signatures and docstrings: - def view_certificate(self, request, queryset): View a text version of the certificate. - def download_certificate(self, request, queryset): Download a certificate.
Implement the Python class `CertificateAdmin` described below. Class description: Admin model for certificates. Method signatures and docstrings: - def view_certificate(self, request, queryset): View a text version of the certificate. - def download_certificate(self, request, queryset): Download a certificate. <|ske...
1c3608e0a02aaba9bd8594d80a247d692cbd04ad
<|skeleton|> class CertificateAdmin: """Admin model for certificates.""" def view_certificate(self, request, queryset): """View a text version of the certificate.""" <|body_0|> def download_certificate(self, request, queryset): """Download a certificate.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CertificateAdmin: """Admin model for certificates.""" def view_certificate(self, request, queryset): """View a text version of the certificate.""" if len(queryset) > 1: self.message_user(request, 'You can only choose one certificate.', level=messages.ERROR) return ...
the_stack_v2_python_sparse
webca/webca/web/admin.py
jesusfer/webca
train
0
529ab3eaed51a00812b913032462f0c325d590b8
[ "host = self.app_host\nheaders = self.headers\nlujing = '/customer/v1/member/check_phone'\nprint(self.phone)\ndata = {'phone': self.phone}\nres = RunMethod().run_main('post', host, lujing, data, headers)\nself.assertTrue(res['code'] == 0, msg=res['msg'])\nmiaoshu(url=host + lujing, method='post', data=data, check={...
<|body_start_0|> host = self.app_host headers = self.headers lujing = '/customer/v1/member/check_phone' print(self.phone) data = {'phone': self.phone} res = RunMethod().run_main('post', host, lujing, data, headers) self.assertTrue(res['code'] == 0, msg=res['msg'])...
Creat_user
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Creat_user: def test1_member_check_phone(self): """验证手机号是否注册 :return:""" <|body_0|> def test2_message_code_send(self): """发送注册验证码 :return:""" <|body_1|> def test3_message_code_check(self): """注册用户-检查验证码 :return:""" <|body_2|> def tes...
stack_v2_sparse_classes_10k_train_005564
4,078
no_license
[ { "docstring": "验证手机号是否注册 :return:", "name": "test1_member_check_phone", "signature": "def test1_member_check_phone(self)" }, { "docstring": "发送注册验证码 :return:", "name": "test2_message_code_send", "signature": "def test2_message_code_send(self)" }, { "docstring": "注册用户-检查验证码 :retu...
5
stack_v2_sparse_classes_30k_train_002311
Implement the Python class `Creat_user` described below. Class description: Implement the Creat_user class. Method signatures and docstrings: - def test1_member_check_phone(self): 验证手机号是否注册 :return: - def test2_message_code_send(self): 发送注册验证码 :return: - def test3_message_code_check(self): 注册用户-检查验证码 :return: - def t...
Implement the Python class `Creat_user` described below. Class description: Implement the Creat_user class. Method signatures and docstrings: - def test1_member_check_phone(self): 验证手机号是否注册 :return: - def test2_message_code_send(self): 发送注册验证码 :return: - def test3_message_code_check(self): 注册用户-检查验证码 :return: - def t...
7377a2d7306421d9deae88eb2edff7c9df7f125e
<|skeleton|> class Creat_user: def test1_member_check_phone(self): """验证手机号是否注册 :return:""" <|body_0|> def test2_message_code_send(self): """发送注册验证码 :return:""" <|body_1|> def test3_message_code_check(self): """注册用户-检查验证码 :return:""" <|body_2|> def tes...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Creat_user: def test1_member_check_phone(self): """验证手机号是否注册 :return:""" host = self.app_host headers = self.headers lujing = '/customer/v1/member/check_phone' print(self.phone) data = {'phone': self.phone} res = RunMethod().run_main('post', host, lujing...
the_stack_v2_python_sparse
Case/test2_creat_user.py
qq252223804/66ifuel
train
1
8213564301aa39c8f4182908fa25f7539981a669
[ "toggle = NanpyGPIOToggle(self.mudpi, config)\nif toggle:\n node = self.extension.nodes[config['node']]\n if node:\n toggle.node = node\n self.add_component(toggle)\n else:\n raise MudPiError(f\"Nanpy node {config['node']} not found trying to connect {config['key']}.\")\nreturn True", ...
<|body_start_0|> toggle = NanpyGPIOToggle(self.mudpi, config) if toggle: node = self.extension.nodes[config['node']] if node: toggle.node = node self.add_component(toggle) else: raise MudPiError(f"Nanpy node {config['nod...
Interface
[ "BSD-4-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interface: def load(self, config): """Load Nanpy Toggle components from configs""" <|body_0|> def validate(self, config): """Validate the Nanpy control config""" <|body_1|> <|end_skeleton|> <|body_start_0|> toggle = NanpyGPIOToggle(self.mudpi, confi...
stack_v2_sparse_classes_10k_train_005565
5,292
permissive
[ { "docstring": "Load Nanpy Toggle components from configs", "name": "load", "signature": "def load(self, config)" }, { "docstring": "Validate the Nanpy control config", "name": "validate", "signature": "def validate(self, config)" } ]
2
stack_v2_sparse_classes_30k_train_000837
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load Nanpy Toggle components from configs - def validate(self, config): Validate the Nanpy control config
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load Nanpy Toggle components from configs - def validate(self, config): Validate the Nanpy control config <|skeleton|> class Interface: def load(s...
fb206b1136f529c7197f1e6b29629ed05630d377
<|skeleton|> class Interface: def load(self, config): """Load Nanpy Toggle components from configs""" <|body_0|> def validate(self, config): """Validate the Nanpy control config""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Interface: def load(self, config): """Load Nanpy Toggle components from configs""" toggle = NanpyGPIOToggle(self.mudpi, config) if toggle: node = self.extension.nodes[config['node']] if node: toggle.node = node self.add_component(...
the_stack_v2_python_sparse
mudpi/extensions/nanpy/toggle.py
mistasp0ck/mudpi-core
train
0
e71679f4724cb5fef6718719cff5f0a1f7e6fb65
[ "value = value.strip()\nwhile value.endswith('/'):\n value = value[:-1]\nself.getField('branch').set(self, value)", "list = DisplayList()\ntypes = self.aq_inner.aq_parent.getProposalTypes()\nfor type in types:\n list.add(type, type)\nreturn list", "parent = self.aq_inner.aq_parent\nmaxId = 0\nfor id in pa...
<|body_start_0|> value = value.strip() while value.endswith('/'): value = value[:-1] self.getField('branch').set(self, value) <|end_body_0|> <|body_start_1|> list = DisplayList() types = self.aq_inner.aq_parent.getProposalTypes() for type in types: ...
What used to be a PLIP.
PSCImprovementProposal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSCImprovementProposal: """What used to be a PLIP.""" def setBranch(self, value): """Set the repository branch, stripping off whitespace and any trailing slashes""" <|body_0|> def getProposalTypesVocab(self): """Get the allowed proposal types.""" <|body_1...
stack_v2_sparse_classes_10k_train_005566
10,955
no_license
[ { "docstring": "Set the repository branch, stripping off whitespace and any trailing slashes", "name": "setBranch", "signature": "def setBranch(self, value)" }, { "docstring": "Get the allowed proposal types.", "name": "getProposalTypesVocab", "signature": "def getProposalTypesVocab(self...
3
stack_v2_sparse_classes_30k_train_001523
Implement the Python class `PSCImprovementProposal` described below. Class description: What used to be a PLIP. Method signatures and docstrings: - def setBranch(self, value): Set the repository branch, stripping off whitespace and any trailing slashes - def getProposalTypesVocab(self): Get the allowed proposal types...
Implement the Python class `PSCImprovementProposal` described below. Class description: What used to be a PLIP. Method signatures and docstrings: - def setBranch(self, value): Set the repository branch, stripping off whitespace and any trailing slashes - def getProposalTypesVocab(self): Get the allowed proposal types...
8a7bdbdb98c3f9fc1073c6061cd2d3a0ec80caf5
<|skeleton|> class PSCImprovementProposal: """What used to be a PLIP.""" def setBranch(self, value): """Set the repository branch, stripping off whitespace and any trailing slashes""" <|body_0|> def getProposalTypesVocab(self): """Get the allowed proposal types.""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PSCImprovementProposal: """What used to be a PLIP.""" def setBranch(self, value): """Set the repository branch, stripping off whitespace and any trailing slashes""" value = value.strip() while value.endswith('/'): value = value[:-1] self.getField('branch').set(...
the_stack_v2_python_sparse
buildout-cache/eggs/Products.PloneSoftwareCenter-1.6.4-py2.7.egg/Products/PloneSoftwareCenter/content/proposal.py
renansfs/Plone_SP
train
0
4dbe354bcbb961bd1170a72e3f0b30afc0d11572
[ "instance, version = more_data\nif self.INSTANCE is not None and self.INSTANCE != instance:\n raise ValueError('invalid instance {0} for {1}'.format(instance, self))\nelif self.INSTANCE is not None and instance not in (0, 1):\n try:\n min_val, max_val = INSTANCE_EXCEPTIONS[self.type]\n is_ok = m...
<|body_start_0|> instance, version = more_data if self.INSTANCE is not None and self.INSTANCE != instance: raise ValueError('invalid instance {0} for {1}'.format(instance, self)) elif self.INSTANCE is not None and instance not in (0, 1): try: min_val, max_...
A Record within a ppt file; has instance and version fields
PptRecord
[ "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PptRecord: """A Record within a ppt file; has instance and version fields""" def finish_constructing(self, more_data): """check and save instance and version""" <|body_0|> def _type_str(self): """helper for __str__, base implementation""" <|body_1|> <|en...
stack_v2_sparse_classes_10k_train_005567
29,559
permissive
[ { "docstring": "check and save instance and version", "name": "finish_constructing", "signature": "def finish_constructing(self, more_data)" }, { "docstring": "helper for __str__, base implementation", "name": "_type_str", "signature": "def _type_str(self)" } ]
2
stack_v2_sparse_classes_30k_train_000181
Implement the Python class `PptRecord` described below. Class description: A Record within a ppt file; has instance and version fields Method signatures and docstrings: - def finish_constructing(self, more_data): check and save instance and version - def _type_str(self): helper for __str__, base implementation
Implement the Python class `PptRecord` described below. Class description: A Record within a ppt file; has instance and version fields Method signatures and docstrings: - def finish_constructing(self, more_data): check and save instance and version - def _type_str(self): helper for __str__, base implementation <|ske...
fb4546ec1be5f46d53856161e46ea53d7b7e532a
<|skeleton|> class PptRecord: """A Record within a ppt file; has instance and version fields""" def finish_constructing(self, more_data): """check and save instance and version""" <|body_0|> def _type_str(self): """helper for __str__, base implementation""" <|body_1|> <|en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PptRecord: """A Record within a ppt file; has instance and version fields""" def finish_constructing(self, more_data): """check and save instance and version""" instance, version = more_data if self.INSTANCE is not None and self.INSTANCE != instance: raise ValueError('...
the_stack_v2_python_sparse
oletools/ppt_record_parser.py
decalage2/oletools
train
2,601
71a15946fd8337a225ed43f2b13fb68057be0f2e
[ "def helper(node):\n if not node:\n return ''\n return helper(node.left) + ',' + helper(node.right) + ',' + str(node.val)\nres = helper(root)\nprint(res)\nreturn res", "def helper(lower, upper):\n if not values or values[-1] < lower or values[-1] > upper:\n return None\n val = values.pop...
<|body_start_0|> def helper(node): if not node: return '' return helper(node.left) + ',' + helper(node.right) + ',' + str(node.val) res = helper(root) print(res) return res <|end_body_0|> <|body_start_1|> def helper(lower, upper): ...
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_005568
1,280
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `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:...
5b14b6f42baf59b04cbcc8e115df4272029b64c8
<|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 helper(node): if not node: return '' return helper(node.left) + ',' + helper(node.right) + ',' + str(node.val) res = helper(root) ...
the_stack_v2_python_sparse
LeetCode/0449.Serialize-And-Deserialize-Bst/Serialize-And-Deserialize-Bst.py
htingwang/HandsOnAlgoDS
train
12
ae79bf3327ff9e665d8177d85461e20ef100b9ce
[ "self.last_day_num_job_errors = last_day_num_job_errors\nself.last_day_num_job_runs = last_day_num_job_runs\nself.last_day_num_job_sla_violations = last_day_num_job_sla_violations\nself.num_job_running = num_job_running\nself.objects_protected_by_policy = objects_protected_by_policy", "if dictionary is None:\n ...
<|body_start_0|> self.last_day_num_job_errors = last_day_num_job_errors self.last_day_num_job_runs = last_day_num_job_runs self.last_day_num_job_sla_violations = last_day_num_job_sla_violations self.num_job_running = num_job_running self.objects_protected_by_policy = objects_prot...
Implementation of the 'JobRunsTile' model. Jon Runs information. Attributes: last_day_num_job_errors (int): Number of Error runs in the last 24 hours. last_day_num_job_runs (int): Number of Job Runs in the last 24 hours. last_day_num_job_sla_violations (int): Number of SLA Violations in the last 24 hours. num_job_runni...
JobRunsTile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobRunsTile: """Implementation of the 'JobRunsTile' model. Jon Runs information. Attributes: last_day_num_job_errors (int): Number of Error runs in the last 24 hours. last_day_num_job_runs (int): Number of Job Runs in the last 24 hours. last_day_num_job_sla_violations (int): Number of SLA Violati...
stack_v2_sparse_classes_10k_train_005569
3,291
permissive
[ { "docstring": "Constructor for the JobRunsTile class", "name": "__init__", "signature": "def __init__(self, last_day_num_job_errors=None, last_day_num_job_runs=None, last_day_num_job_sla_violations=None, num_job_running=None, objects_protected_by_policy=None)" }, { "docstring": "Creates an inst...
2
null
Implement the Python class `JobRunsTile` described below. Class description: Implementation of the 'JobRunsTile' model. Jon Runs information. Attributes: last_day_num_job_errors (int): Number of Error runs in the last 24 hours. last_day_num_job_runs (int): Number of Job Runs in the last 24 hours. last_day_num_job_sla_...
Implement the Python class `JobRunsTile` described below. Class description: Implementation of the 'JobRunsTile' model. Jon Runs information. Attributes: last_day_num_job_errors (int): Number of Error runs in the last 24 hours. last_day_num_job_runs (int): Number of Job Runs in the last 24 hours. last_day_num_job_sla_...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class JobRunsTile: """Implementation of the 'JobRunsTile' model. Jon Runs information. Attributes: last_day_num_job_errors (int): Number of Error runs in the last 24 hours. last_day_num_job_runs (int): Number of Job Runs in the last 24 hours. last_day_num_job_sla_violations (int): Number of SLA Violati...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JobRunsTile: """Implementation of the 'JobRunsTile' model. Jon Runs information. Attributes: last_day_num_job_errors (int): Number of Error runs in the last 24 hours. last_day_num_job_runs (int): Number of Job Runs in the last 24 hours. last_day_num_job_sla_violations (int): Number of SLA Violations in the la...
the_stack_v2_python_sparse
cohesity_management_sdk/models/job_runs_tile.py
cohesity/management-sdk-python
train
24
2006349a88ac9f86999dbcd899d206755ed8d7df
[ "related_models = [f.related_model for f in Cell._meta.get_fields() if f.one_to_one]\nrelated_qs = [cls.objects.filter(cell=self) for cls in related_models if len(cls.objects.filter(cell=self)) > 0]\nif len(related_qs) > 1:\n raise DashBoardException('Cell data with id %d assosiated with multiple Cell types' % s...
<|body_start_0|> related_models = [f.related_model for f in Cell._meta.get_fields() if f.one_to_one] related_qs = [cls.objects.filter(cell=self) for cls in related_models if len(cls.objects.filter(cell=self)) > 0] if len(related_qs) > 1: raise DashBoardException('Cell data with id %d...
Cell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cell: def get_related_object(self): """Get the related model instance object for this model via a onetoone relationship.""" <|body_0|> def get_related_model(cls, name): """Given a name, get the related model that matches the name""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_10k_train_005570
2,344
no_license
[ { "docstring": "Get the related model instance object for this model via a onetoone relationship.", "name": "get_related_object", "signature": "def get_related_object(self)" }, { "docstring": "Given a name, get the related model that matches the name", "name": "get_related_model", "signa...
2
stack_v2_sparse_classes_30k_train_001246
Implement the Python class `Cell` described below. Class description: Implement the Cell class. Method signatures and docstrings: - def get_related_object(self): Get the related model instance object for this model via a onetoone relationship. - def get_related_model(cls, name): Given a name, get the related model th...
Implement the Python class `Cell` described below. Class description: Implement the Cell class. Method signatures and docstrings: - def get_related_object(self): Get the related model instance object for this model via a onetoone relationship. - def get_related_model(cls, name): Given a name, get the related model th...
825c64f0148767883272c5be1e867660c969ab56
<|skeleton|> class Cell: def get_related_object(self): """Get the related model instance object for this model via a onetoone relationship.""" <|body_0|> def get_related_model(cls, name): """Given a name, get the related model that matches the name""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cell: def get_related_object(self): """Get the related model instance object for this model via a onetoone relationship.""" related_models = [f.related_model for f in Cell._meta.get_fields() if f.one_to_one] related_qs = [cls.objects.filter(cell=self) for cls in related_models if len(c...
the_stack_v2_python_sparse
p3app/dash_board/models.py
vdazrat/id8
train
0
d223d1b46c524734f9d1613f821b143e6909a891
[ "if stdin is None:\n stdin = sys.stdin.fileno()\nelif hasattr(stdin, 'fileno'):\n stdin = stdin.fileno()\nif stdout is None:\n stdout = sys.stdout.fileno()\nelif hasattr(stdout, 'fileno'):\n stdout = stdout.fileno()\nwith self._client() as podman:\n attach = podman.GetAttachSockets(self._id)\nio_sock...
<|body_start_0|> if stdin is None: stdin = sys.stdin.fileno() elif hasattr(stdin, 'fileno'): stdin = stdin.fileno() if stdout is None: stdout = sys.stdout.fileno() elif hasattr(stdout, 'fileno'): stdout = stdout.fileno() with self._...
Publish attach() for inclusion in Container class.
Mixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mixin: """Publish attach() for inclusion in Container class.""" def attach(self, eot=4, stdin=None, stdout=None): """Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().""" <|body_0|> def resize_handler(self): """Send...
stack_v2_sparse_classes_10k_train_005571
2,635
permissive
[ { "docstring": "Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().", "name": "attach", "signature": "def attach(self, eot=4, stdin=None, stdout=None)" }, { "docstring": "Send the new window size to conmon.", "name": "resize_handler", "signa...
3
null
Implement the Python class `Mixin` described below. Class description: Publish attach() for inclusion in Container class. Method signatures and docstrings: - def attach(self, eot=4, stdin=None, stdout=None): Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start(). - def resiz...
Implement the Python class `Mixin` described below. Class description: Publish attach() for inclusion in Container class. Method signatures and docstrings: - def attach(self, eot=4, stdin=None, stdout=None): Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start(). - def resiz...
ce2a8734f8b4203ec38078207297062263c49f6f
<|skeleton|> class Mixin: """Publish attach() for inclusion in Container class.""" def attach(self, eot=4, stdin=None, stdout=None): """Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().""" <|body_0|> def resize_handler(self): """Send...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mixin: """Publish attach() for inclusion in Container class.""" def attach(self, eot=4, stdin=None, stdout=None): """Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().""" if stdin is None: stdin = sys.stdin.fileno() elif ...
the_stack_v2_python_sparse
tobiko/podman/_podman1/libs/_containers_attach.py
FedericoRessi/tobiko
train
1
e94417b36416adbfe227ab0f03b7116556e310e3
[ "self.common_acl = common_acl\nself.grant_vec = grant_vec\nself.keystone_acl = keystone_acl\nself.swift_read_acl = swift_read_acl\nself.swift_write_acl = swift_write_acl", "if dictionary is None:\n return None\ncommon_acl = cohesity_management_sdk.models.common_acl_proto.CommonACLProto.from_dictionary(dictiona...
<|body_start_0|> self.common_acl = common_acl self.grant_vec = grant_vec self.keystone_acl = keystone_acl self.swift_read_acl = swift_read_acl self.swift_write_acl = swift_write_acl <|end_body_0|> <|body_start_1|> if dictionary is None: return None co...
Implementation of the 'ACLProto' model. Protobuf that describes the access control list (ACL) permissions for a bucket or for an object. Attributes: common_acl (CommonACLProto): CommonACL of the Swift container. grant_vec (list of ACLProto_Grant): TODO: Type description here. keystone_acl (KeystoneACLProto): KeystoneAC...
ACLProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ACLProto: """Implementation of the 'ACLProto' model. Protobuf that describes the access control list (ACL) permissions for a bucket or for an object. Attributes: common_acl (CommonACLProto): CommonACL of the Swift container. grant_vec (list of ACLProto_Grant): TODO: Type description here. keyston...
stack_v2_sparse_classes_10k_train_005572
3,081
permissive
[ { "docstring": "Constructor for the ACLProto class", "name": "__init__", "signature": "def __init__(self, common_acl=None, grant_vec=None, keystone_acl=None, swift_read_acl=None, swift_write_acl=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dicti...
2
null
Implement the Python class `ACLProto` described below. Class description: Implementation of the 'ACLProto' model. Protobuf that describes the access control list (ACL) permissions for a bucket or for an object. Attributes: common_acl (CommonACLProto): CommonACL of the Swift container. grant_vec (list of ACLProto_Grant...
Implement the Python class `ACLProto` described below. Class description: Implementation of the 'ACLProto' model. Protobuf that describes the access control list (ACL) permissions for a bucket or for an object. Attributes: common_acl (CommonACLProto): CommonACL of the Swift container. grant_vec (list of ACLProto_Grant...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ACLProto: """Implementation of the 'ACLProto' model. Protobuf that describes the access control list (ACL) permissions for a bucket or for an object. Attributes: common_acl (CommonACLProto): CommonACL of the Swift container. grant_vec (list of ACLProto_Grant): TODO: Type description here. keyston...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ACLProto: """Implementation of the 'ACLProto' model. Protobuf that describes the access control list (ACL) permissions for a bucket or for an object. Attributes: common_acl (CommonACLProto): CommonACL of the Swift container. grant_vec (list of ACLProto_Grant): TODO: Type description here. keystone_acl (Keysto...
the_stack_v2_python_sparse
cohesity_management_sdk/models/acl_proto.py
cohesity/management-sdk-python
train
24
df1ef78c6479f5da68addb41e3f82c2f3815efa1
[ "if not v:\n raise ValueError('courier_id is required')\nif type(v) != int:\n raise ValueError('courier_id must be integer')\nif v < 0 or v > 9223372036854775807:\n raise ValueError('courier_id out of allowed range')\nreturn v", "excess_fields = set(values.keys()).difference({'courier_id'})\nif excess_fi...
<|body_start_0|> if not v: raise ValueError('courier_id is required') if type(v) != int: raise ValueError('courier_id must be integer') if v < 0 or v > 9223372036854775807: raise ValueError('courier_id out of allowed range') return v <|end_body_0|> <|...
Описывает стрктуру данных для назначения заказов
AssignDataModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssignDataModel: """Описывает стрктуру данных для назначения заказов""" def validate_courier_id(cls, v: int) -> int: """Валидирует courier_id""" <|body_0|> def validate_excess_fields(cls, values: Dict) -> Dict: """Валидирует отсутствие лишних полей""" <|b...
stack_v2_sparse_classes_10k_train_005573
8,762
no_license
[ { "docstring": "Валидирует courier_id", "name": "validate_courier_id", "signature": "def validate_courier_id(cls, v: int) -> int" }, { "docstring": "Валидирует отсутствие лишних полей", "name": "validate_excess_fields", "signature": "def validate_excess_fields(cls, values: Dict) -> Dict"...
2
stack_v2_sparse_classes_30k_train_001538
Implement the Python class `AssignDataModel` described below. Class description: Описывает стрктуру данных для назначения заказов Method signatures and docstrings: - def validate_courier_id(cls, v: int) -> int: Валидирует courier_id - def validate_excess_fields(cls, values: Dict) -> Dict: Валидирует отсутствие лишних...
Implement the Python class `AssignDataModel` described below. Class description: Описывает стрктуру данных для назначения заказов Method signatures and docstrings: - def validate_courier_id(cls, v: int) -> int: Валидирует courier_id - def validate_excess_fields(cls, values: Dict) -> Dict: Валидирует отсутствие лишних...
f1a908e5d6b30b826c38d24c52a721764f056fde
<|skeleton|> class AssignDataModel: """Описывает стрктуру данных для назначения заказов""" def validate_courier_id(cls, v: int) -> int: """Валидирует courier_id""" <|body_0|> def validate_excess_fields(cls, values: Dict) -> Dict: """Валидирует отсутствие лишних полей""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssignDataModel: """Описывает стрктуру данных для назначения заказов""" def validate_courier_id(cls, v: int) -> int: """Валидирует courier_id""" if not v: raise ValueError('courier_id is required') if type(v) != int: raise ValueError('courier_id must be int...
the_stack_v2_python_sparse
candyapi/orders/validators.py
IntAlgambra/candyapi
train
0
650684a8f27da05721aa830d84e3adbd3e2b8d0c
[ "weight_scale_factor, n = (None, None)\nlogger.debug(f'input: {input}')\nwith torch.no_grad():\n if mode == quantization.QType.DETER:\n binarized_weight = deterministic_quantize(weight)\n s = torch.sum(torch.abs(weight))\n n = prod(weight.shape)\n weight_scale_factor = s / n\n elif...
<|body_start_0|> weight_scale_factor, n = (None, None) logger.debug(f'input: {input}') with torch.no_grad(): if mode == quantization.QType.DETER: binarized_weight = deterministic_quantize(weight) s = torch.sum(torch.abs(weight)) n = pro...
binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 forward에서 binarized wegiths를 사용하고, gradient ...
BinarizedLinear
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarizedLinear: """binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 f...
stack_v2_sparse_classes_10k_train_005574
5,021
permissive
[ { "docstring": "Real-value weights를 binarized weight와 scale factor로 변환한다. binarized tensor이를입력으로 받으면 이를 다음과 같이 계산한다. .. math:: output=I_{b} \\\\odot W_{b} \\\\times \\\\alpha_{W_{b}} Args: ctx (object): forward/backward간 정보를 공유하기위한 데이터 컨테이너 input (torch.Tensor): binairzed tensor weight (torch.Tensor): :math:`(o...
2
stack_v2_sparse_classes_30k_train_004030
Implement the Python class `BinarizedLinear` described below. Class description: binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사...
Implement the Python class `BinarizedLinear` described below. Class description: binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사...
2c02429d6ee052fe70a17ced4755d5814a4ef60a
<|skeleton|> class BinarizedLinear: """binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BinarizedLinear: """binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 forward에서 bina...
the_stack_v2_python_sparse
src/ops/binarized_linear.py
ssaru/pytorch-XNOR-YOLO
train
1
1ab9e1704ba27d6d4d61b2718f9d1c53d61571ba
[ "if not os.path.exists(base_path):\n os.makedirs(base_path)\nfor fn in NAIPTileIndex.INDEX_FNS:\n if not os.path.exists(os.path.join(base_path, fn)):\n download_url(NAIPTileIndex.NAIP_INDEX_BLOB_ROOT + fn, os.path.join(base_path, fn), verbose)\nself.base_path = base_path\nself.tile_rtree = rtree.index....
<|body_start_0|> if not os.path.exists(base_path): os.makedirs(base_path) for fn in NAIPTileIndex.INDEX_FNS: if not os.path.exists(os.path.join(base_path, fn)): download_url(NAIPTileIndex.NAIP_INDEX_BLOB_ROOT + fn, os.path.join(base_path, fn), verbose) sel...
Utility class for performing NAIP tile lookups by location
NAIPTileIndex
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NAIPTileIndex: """Utility class for performing NAIP tile lookups by location""" def __init__(self, base_path, verbose=False): """Loads the tile index into memory (~400 MB) for use by `self.lookup()`. Downloads the index files from the blob container if they do not exist in the `base_...
stack_v2_sparse_classes_10k_train_005575
5,605
permissive
[ { "docstring": "Loads the tile index into memory (~400 MB) for use by `self.lookup()`. Downloads the index files from the blob container if they do not exist in the `base_path/` directory. Args: base_path (str): The path on the local system to look for/store the three files that make up the tile index. This pat...
3
stack_v2_sparse_classes_30k_train_007157
Implement the Python class `NAIPTileIndex` described below. Class description: Utility class for performing NAIP tile lookups by location Method signatures and docstrings: - def __init__(self, base_path, verbose=False): Loads the tile index into memory (~400 MB) for use by `self.lookup()`. Downloads the index files f...
Implement the Python class `NAIPTileIndex` described below. Class description: Utility class for performing NAIP tile lookups by location Method signatures and docstrings: - def __init__(self, base_path, verbose=False): Loads the tile index into memory (~400 MB) for use by `self.lookup()`. Downloads the index files f...
ff141cd6b7a7b504c18b0987fbfd58ec6552df43
<|skeleton|> class NAIPTileIndex: """Utility class for performing NAIP tile lookups by location""" def __init__(self, base_path, verbose=False): """Loads the tile index into memory (~400 MB) for use by `self.lookup()`. Downloads the index files from the blob container if they do not exist in the `base_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NAIPTileIndex: """Utility class for performing NAIP tile lookups by location""" def __init__(self, base_path, verbose=False): """Loads the tile index into memory (~400 MB) for use by `self.lookup()`. Downloads the index files from the blob container if they do not exist in the `base_path/` direct...
the_stack_v2_python_sparse
geospatial/data/NAIPTileIndex.py
microsoft/ai4eutils
train
40
a6cb4bd1c560abaad1a0deaffc2214891c6453fa
[ "super(TemplateAngleEmbedder, self).__init__()\nself.c_out = c_out\nself.c_in = c_in\nself.linear_1 = Linear(self.c_in, self.c_out, init='relu')\nself.relu = nn.ReLU()\nself.linear_2 = Linear(self.c_out, self.c_out, init='relu')", "x = self.linear_1(x)\nx = self.relu(x)\nx = self.linear_2(x)\nreturn x" ]
<|body_start_0|> super(TemplateAngleEmbedder, self).__init__() self.c_out = c_out self.c_in = c_in self.linear_1 = Linear(self.c_in, self.c_out, init='relu') self.relu = nn.ReLU() self.linear_2 = Linear(self.c_out, self.c_out, init='relu') <|end_body_0|> <|body_start_1|>...
Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.
TemplateAngleEmbedder
[ "Apache-2.0", "CC-BY-4.0", "LicenseRef-scancode-other-permissive", "CC-BY-NC-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateAngleEmbedder: """Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.""" def __init__(self, c_in: int, c_out: int, **kwargs): """Args: c_in: Final dimension of "template_angle_feat" c_out: Output channel dimension""" <|body_0|> def forward(s...
stack_v2_sparse_classes_10k_train_005576
9,577
permissive
[ { "docstring": "Args: c_in: Final dimension of \"template_angle_feat\" c_out: Output channel dimension", "name": "__init__", "signature": "def __init__(self, c_in: int, c_out: int, **kwargs)" }, { "docstring": "Args: x: [*, N_templ, N_res, c_in] \"template_angle_feat\" features Returns: x: [*, N...
2
stack_v2_sparse_classes_30k_train_002229
Implement the Python class `TemplateAngleEmbedder` described below. Class description: Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7. Method signatures and docstrings: - def __init__(self, c_in: int, c_out: int, **kwargs): Args: c_in: Final dimension of "template_angle_feat" c_out: Output c...
Implement the Python class `TemplateAngleEmbedder` described below. Class description: Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7. Method signatures and docstrings: - def __init__(self, c_in: int, c_out: int, **kwargs): Args: c_in: Final dimension of "template_angle_feat" c_out: Output c...
2134cc09b3994b6280e6e3c569dd7d761e4da7a0
<|skeleton|> class TemplateAngleEmbedder: """Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.""" def __init__(self, c_in: int, c_out: int, **kwargs): """Args: c_in: Final dimension of "template_angle_feat" c_out: Output channel dimension""" <|body_0|> def forward(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TemplateAngleEmbedder: """Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.""" def __init__(self, c_in: int, c_out: int, **kwargs): """Args: c_in: Final dimension of "template_angle_feat" c_out: Output channel dimension""" super(TemplateAngleEmbedder, self).__init_...
the_stack_v2_python_sparse
openfold/model/embedders.py
aqlaboratory/openfold
train
2,033
1c7cc4ed9032d5b9e3b050b369f0c068b0598dcb
[ "self.error = error\nself.source = source\nself.stats = stats\nself.status = status\nself.task_end_time_usecs = task_end_time_usecs\nself.task_start_time_usecs = task_start_time_usecs", "if dictionary is None:\n return None\nerror = dictionary.get('error')\nsource = cohesity_management_sdk.models.protection_so...
<|body_start_0|> self.error = error self.source = source self.stats = stats self.status = status self.task_end_time_usecs = task_end_time_usecs self.task_start_time_usecs = task_start_time_usecs <|end_body_0|> <|body_start_1|> if dictionary is None: r...
Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is populated when the status is equal to 'kFailure'. sou...
CopySnapshotTaskStatus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopySnapshotTaskStatus: """Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is pop...
stack_v2_sparse_classes_10k_train_005577
4,290
permissive
[ { "docstring": "Constructor for the CopySnapshotTaskStatus class", "name": "__init__", "signature": "def __init__(self, error=None, source=None, stats=None, status=None, task_end_time_usecs=None, task_start_time_usecs=None)" }, { "docstring": "Creates an instance of this model from a dictionary ...
2
null
Implement the Python class `CopySnapshotTaskStatus` described below. Class description: Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) whi...
Implement the Python class `CopySnapshotTaskStatus` described below. Class description: Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) whi...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CopySnapshotTaskStatus: """Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is pop...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CopySnapshotTaskStatus: """Implementation of the 'CopySnapshotTaskStatus' model. Specifies the status of the copy task that copies the snapshot of a Protection Source object to a target. Attributes: error (string): Specifies if an error occurred (if any) while running this task. This field is populated when t...
the_stack_v2_python_sparse
cohesity_management_sdk/models/copy_snapshot_task_status.py
cohesity/management-sdk-python
train
24
5163a39a3ba3038af6cae509580ddedbda2cbc1a
[ "params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems()))\nparams['image_id'] = image_id\nform = MultiGetForm(params)\nif not form.is_valid():\n raise BadRequestException()\nreturn Response(form.submit(request))", "params = dict(((key, val) for key, val in request.DATA.iteritems()))\nparams...
<|body_start_0|> params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems())) params['image_id'] = image_id form = MultiGetForm(params) if not form.is_valid(): raise BadRequestException() return Response(form.submit(request)) <|end_body_0|> <|body_sta...
Class for rendering the view for creating TagGroups and searching through the TagGroups.
TagGroupList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagGroupList: """Class for rendering the view for creating TagGroups and searching through the TagGroups.""" def get(self, request, image_id): """Method for getting multiple TagGroups either through search or general listing.""" <|body_0|> def post(self, request, image_i...
stack_v2_sparse_classes_10k_train_005578
2,816
no_license
[ { "docstring": "Method for getting multiple TagGroups either through search or general listing.", "name": "get", "signature": "def get(self, request, image_id)" }, { "docstring": "Method for creating a new TagGroup.", "name": "post", "signature": "def post(self, request, image_id)" } ]
2
stack_v2_sparse_classes_30k_train_007148
Implement the Python class `TagGroupList` described below. Class description: Class for rendering the view for creating TagGroups and searching through the TagGroups. Method signatures and docstrings: - def get(self, request, image_id): Method for getting multiple TagGroups either through search or general listing. -...
Implement the Python class `TagGroupList` described below. Class description: Class for rendering the view for creating TagGroups and searching through the TagGroups. Method signatures and docstrings: - def get(self, request, image_id): Method for getting multiple TagGroups either through search or general listing. -...
22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c
<|skeleton|> class TagGroupList: """Class for rendering the view for creating TagGroups and searching through the TagGroups.""" def get(self, request, image_id): """Method for getting multiple TagGroups either through search or general listing.""" <|body_0|> def post(self, request, image_i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TagGroupList: """Class for rendering the view for creating TagGroups and searching through the TagGroups.""" def get(self, request, image_id): """Method for getting multiple TagGroups either through search or general listing.""" params = dict(((key, val) for key, val in request.QUERY_PARA...
the_stack_v2_python_sparse
biodig/rest/v2/TagGroups/views.py
asmariyaz23/BioDIG
train
0
a968df34f71aabf553e511073d426d30dda445c9
[ "original_ents = [{'ID': 'test-ID', 'Type': 'test-Type', 'Metadata': {'tags': 'test-tags', 'category': 'test-category', 'created': 'test-created', 'modified': 'test-modified'}}]\noutput_ents = {'Entry': [{'ID': 'test-ID', 'Type': 'test-Type', 'Tags': 'test-tags', 'Category': 'test-category', 'Created': 'test-create...
<|body_start_0|> original_ents = [{'ID': 'test-ID', 'Type': 'test-Type', 'Metadata': {'tags': 'test-tags', 'category': 'test-category', 'created': 'test-created', 'modified': 'test-modified'}}] output_ents = {'Entry': [{'ID': 'test-ID', 'Type': 'test-Type', 'Tags': 'test-tags', 'Category': 'test-categor...
TestGetEntries
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetEntries: def test_main(self, mocker): """Given: - A entry returns from getEntries. When: - No argument parameters are provided. Then: - The fields are being parsed properly in to context.""" <|body_0|> def test_main_no_ents(self, mocker): """Given: - No entrie...
stack_v2_sparse_classes_10k_train_005579
3,454
permissive
[ { "docstring": "Given: - A entry returns from getEntries. When: - No argument parameters are provided. Then: - The fields are being parsed properly in to context.", "name": "test_main", "signature": "def test_main(self, mocker)" }, { "docstring": "Given: - No entries returns from getEntries. Whe...
3
stack_v2_sparse_classes_30k_train_003730
Implement the Python class `TestGetEntries` described below. Class description: Implement the TestGetEntries class. Method signatures and docstrings: - def test_main(self, mocker): Given: - A entry returns from getEntries. When: - No argument parameters are provided. Then: - The fields are being parsed properly in to...
Implement the Python class `TestGetEntries` described below. Class description: Implement the TestGetEntries class. Method signatures and docstrings: - def test_main(self, mocker): Given: - A entry returns from getEntries. When: - No argument parameters are provided. Then: - The fields are being parsed properly in to...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestGetEntries: def test_main(self, mocker): """Given: - A entry returns from getEntries. When: - No argument parameters are provided. Then: - The fields are being parsed properly in to context.""" <|body_0|> def test_main_no_ents(self, mocker): """Given: - No entrie...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestGetEntries: def test_main(self, mocker): """Given: - A entry returns from getEntries. When: - No argument parameters are provided. Then: - The fields are being parsed properly in to context.""" original_ents = [{'ID': 'test-ID', 'Type': 'test-Type', 'Metadata': {'tags': 'test-tags', 'categ...
the_stack_v2_python_sparse
Packs/CommonScripts/Scripts/GetEntries/GetEntries_test.py
demisto/content
train
1,023
f86d102d5d66e59c6f41a664a2ca48a3920d5eb0
[ "if 1 == ver:\n return True\nelse:\n return False", "if isinstance(data, SerializableObject) is False:\n raise UnsupportedTypeException()\ndataStream = ApplicationSerializer.ApplicationSerializer.serialize(data, writeMeta=True)\nDS = DigitalSignature(dataStream)\nDS.sign()\ndsStream = DS.serialize()\ncrc...
<|body_start_0|> if 1 == ver: return True else: return False <|end_body_0|> <|body_start_1|> if isinstance(data, SerializableObject) is False: raise UnsupportedTypeException() dataStream = ApplicationSerializer.ApplicationSerializer.serialize(data, wr...
Description: An instance of this class is used to contruct/deconstruct messages sent to and received from the Lynx
MessageFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageFactory: """Description: An instance of this class is used to contruct/deconstruct messages sent to and received from the Lynx""" def supportsMsgVersion(ver): """Description: This method validates the version information Arguments: ver (in, int) The version to validate Returns...
stack_v2_sparse_classes_10k_train_005580
3,196
no_license
[ { "docstring": "Description: This method validates the version information Arguments: ver (in, int) The version to validate Returns: bool True==valid version", "name": "supportsMsgVersion", "signature": "def supportsMsgVersion(ver)" }, { "docstring": "Description: This method serializes the data...
3
stack_v2_sparse_classes_30k_train_006776
Implement the Python class `MessageFactory` described below. Class description: Description: An instance of this class is used to contruct/deconstruct messages sent to and received from the Lynx Method signatures and docstrings: - def supportsMsgVersion(ver): Description: This method validates the version information...
Implement the Python class `MessageFactory` described below. Class description: Description: An instance of this class is used to contruct/deconstruct messages sent to and received from the Lynx Method signatures and docstrings: - def supportsMsgVersion(ver): Description: This method validates the version information...
bdeeb78b58466ec8696d4fadb05051c1b06ef25e
<|skeleton|> class MessageFactory: """Description: An instance of this class is used to contruct/deconstruct messages sent to and received from the Lynx""" def supportsMsgVersion(ver): """Description: This method validates the version information Arguments: ver (in, int) The version to validate Returns...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MessageFactory: """Description: An instance of this class is used to contruct/deconstruct messages sent to and received from the Lynx""" def supportsMsgVersion(ver): """Description: This method validates the version information Arguments: ver (in, int) The version to validate Returns: bool True==...
the_stack_v2_python_sparse
src/DataTypes/MessageFactory.py
philliptay/nuclear-detection
train
0
9ed3a748839efd3332f60186124b32c57035f82d
[ "user = context.get('user', None)\nviewing_user = context.get('viewing_user', None)\nif not viewing_user or not user.is_authenticated():\n return ''\nkeyid = self.gpg_key_id.get_value(viewing_user.username)\nsend_private_link = '<a href=\"\" title=\"%s;%s\" class=\"private_message\">%s</a>' % (viewing_user.usern...
<|body_start_0|> user = context.get('user', None) viewing_user = context.get('viewing_user', None) if not viewing_user or not user.is_authenticated(): return '' keyid = self.gpg_key_id.get_value(viewing_user.username) send_private_link = '<a href="" title="%s;%s" clas...
With this plugin users can send a private and encrypted message to somebody, which will be shown only in the private timeline of that user. The message will be encrypted with GPG using a HTML extension currently only available in Khtml/Konqueror. Each user can access their private timeline with a link added by this plu...
PrivateTimelinePlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrivateTimelinePlugin: """With this plugin users can send a private and encrypted message to somebody, which will be shown only in the private timeline of that user. The message will be encrypted with GPG using a HTML extension currently only available in Khtml/Konqueror. Each user can access the...
stack_v2_sparse_classes_10k_train_005581
3,475
no_license
[ { "docstring": "Shows a button to 'Send Private Message to <username>' in the headbar, next to \"(un)follow\" button", "name": "headbar", "signature": "def headbar(self, context)" }, { "docstring": "Shows a link to 'Send Private Message' in the sidebar when browsing a profile", "name": "side...
3
stack_v2_sparse_classes_30k_train_007116
Implement the Python class `PrivateTimelinePlugin` described below. Class description: With this plugin users can send a private and encrypted message to somebody, which will be shown only in the private timeline of that user. The message will be encrypted with GPG using a HTML extension currently only available in Kh...
Implement the Python class `PrivateTimelinePlugin` described below. Class description: With this plugin users can send a private and encrypted message to somebody, which will be shown only in the private timeline of that user. The message will be encrypted with GPG using a HTML extension currently only available in Kh...
a9eb05514e8788d7c290f88eae383c0f4d9179ad
<|skeleton|> class PrivateTimelinePlugin: """With this plugin users can send a private and encrypted message to somebody, which will be shown only in the private timeline of that user. The message will be encrypted with GPG using a HTML extension currently only available in Khtml/Konqueror. Each user can access the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrivateTimelinePlugin: """With this plugin users can send a private and encrypted message to somebody, which will be shown only in the private timeline of that user. The message will be encrypted with GPG using a HTML extension currently only available in Khtml/Konqueror. Each user can access their private ti...
the_stack_v2_python_sparse
contrib/privatetimeline/PrivateTimelinePlugin.py
lilac/totem
train
0
2519e1703ef84943371b66707ded39c477ec4a9e
[ "if not isinstance(origin, math3d.VectorN) or not isinstance(direction, math3d.VectorN) or len(origin) != len(direction):\n raise ValueError(\"You must pass two equal-dimension VectorN's for the origin and direction.\")\nself.mOrigin = origin.copy()\nself.mDirection = direction.normalized()", "if not isinstanc...
<|body_start_0|> if not isinstance(origin, math3d.VectorN) or not isinstance(direction, math3d.VectorN) or len(origin) != len(direction): raise ValueError("You must pass two equal-dimension VectorN's for the origin and direction.") self.mOrigin = origin.copy() self.mDirection = direc...
An n-dimensional ray [by definition a ray is an origin point and a direction
Ray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ray: """An n-dimensional ray [by definition a ray is an origin point and a direction""" def __init__(self, origin, direction): """:param origin: the origin POSITION of the ray (a copy of the passed vector is created) :param direction: the DIRECTION of the ray (the vector passed in is...
stack_v2_sparse_classes_10k_train_005582
10,671
no_license
[ { "docstring": ":param origin: the origin POSITION of the ray (a copy of the passed vector is created) :param direction: the DIRECTION of the ray (the vector passed in is normalized) :return: N/A", "name": "__init__", "signature": "def __init__(self, origin, direction)" }, { "docstring": ":param...
4
stack_v2_sparse_classes_30k_train_002372
Implement the Python class `Ray` described below. Class description: An n-dimensional ray [by definition a ray is an origin point and a direction Method signatures and docstrings: - def __init__(self, origin, direction): :param origin: the origin POSITION of the ray (a copy of the passed vector is created) :param dir...
Implement the Python class `Ray` described below. Class description: An n-dimensional ray [by definition a ray is an origin point and a direction Method signatures and docstrings: - def __init__(self, origin, direction): :param origin: the origin POSITION of the ray (a copy of the passed vector is created) :param dir...
5916caa83fd57fd1400875d74ffff8e89b7bb0bc
<|skeleton|> class Ray: """An n-dimensional ray [by definition a ray is an origin point and a direction""" def __init__(self, origin, direction): """:param origin: the origin POSITION of the ray (a copy of the passed vector is created) :param direction: the DIRECTION of the ray (the vector passed in is...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ray: """An n-dimensional ray [by definition a ray is an origin point and a direction""" def __init__(self, origin, direction): """:param origin: the origin POSITION of the ray (a copy of the passed vector is created) :param direction: the DIRECTION of the ray (the vector passed in is normalized) ...
the_stack_v2_python_sparse
ConceptsOf3DGraphics/Lab05/objects3d.py
kjakar/Portfolio
train
0
2cb9d8f7283ad29fff2a4732f8e29636e4e8ff2f
[ "num_cases, num_dim = X.shape\noutput_df = pd.DataFrame()\nfor dim in range(num_dim):\n dim_data = X.iloc[:, dim]\n out = self.row_wise_get_der(dim_data)\n output_df['der_dim_' + str(dim)] = pd.Series(out)\nreturn output_df", "def get_der(x):\n der = []\n for i in range(1, len(x) - 1):\n der...
<|body_start_0|> num_cases, num_dim = X.shape output_df = pd.DataFrame() for dim in range(num_dim): dim_data = X.iloc[:, dim] out = self.row_wise_get_der(dim_data) output_df['der_dim_' + str(dim)] = pd.Series(out) return output_df <|end_body_0|> <|bod...
Derivative slope transformer.
DerivativeSlopeTransformer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DerivativeSlopeTransformer: """Derivative slope transformer.""" def _transform(self, X, y=None): """Transform X.""" <|body_0|> def row_wise_get_der(X): """Get derivatives.""" <|body_1|> <|end_skeleton|> <|body_start_0|> num_cases, num_dim = X.sh...
stack_v2_sparse_classes_10k_train_005583
16,453
permissive
[ { "docstring": "Transform X.", "name": "_transform", "signature": "def _transform(self, X, y=None)" }, { "docstring": "Get derivatives.", "name": "row_wise_get_der", "signature": "def row_wise_get_der(X)" } ]
2
stack_v2_sparse_classes_30k_train_001119
Implement the Python class `DerivativeSlopeTransformer` described below. Class description: Derivative slope transformer. Method signatures and docstrings: - def _transform(self, X, y=None): Transform X. - def row_wise_get_der(X): Get derivatives.
Implement the Python class `DerivativeSlopeTransformer` described below. Class description: Derivative slope transformer. Method signatures and docstrings: - def _transform(self, X, y=None): Transform X. - def row_wise_get_der(X): Get derivatives. <|skeleton|> class DerivativeSlopeTransformer: """Derivative slop...
70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f
<|skeleton|> class DerivativeSlopeTransformer: """Derivative slope transformer.""" def _transform(self, X, y=None): """Transform X.""" <|body_0|> def row_wise_get_der(X): """Get derivatives.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DerivativeSlopeTransformer: """Derivative slope transformer.""" def _transform(self, X, y=None): """Transform X.""" num_cases, num_dim = X.shape output_df = pd.DataFrame() for dim in range(num_dim): dim_data = X.iloc[:, dim] out = self.row_wise_get_...
the_stack_v2_python_sparse
sktime/transformations/panel/summarize/_extract.py
sktime/sktime
train
1,117
98a0e702cc5df157fd32d387767acc8b2f588187
[ "super(AttENC, self).__init__()\nself.cnn = CNN(n_in * 2, n_hid, n_hid, do_prob)\nself.n2e_i = MLP(n_hid, n_hid, n_hid, do_prob)\nself.e2n = MLP(n_hid, n_hid, n_hid, do_prob)\nself.n2e_o = MLP(n_hid * 3, n_hid, n_hid, do_prob)\nself.intra_att = SelfAtt(n_hid, n_hid)\nself.inter_att = SelfAtt(n_hid, n_hid)\nself.fc_...
<|body_start_0|> super(AttENC, self).__init__() self.cnn = CNN(n_in * 2, n_hid, n_hid, do_prob) self.n2e_i = MLP(n_hid, n_hid, n_hid, do_prob) self.e2n = MLP(n_hid, n_hid, n_hid, do_prob) self.n2e_o = MLP(n_hid * 3, n_hid, n_hid, do_prob) self.intra_att = SelfAtt(n_hid, n...
Encoder using the relation interaction mechanism implemented by self-attention.
AttENC
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttENC: """Encoder using the relation interaction mechanism implemented by self-attention.""" def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): """Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dim...
stack_v2_sparse_classes_10k_train_005584
12,491
permissive
[ { "docstring": "Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension, i.e., number of edge types. do_prob : float, optional rate of dropout. The default is 0.. factor : bool, optional using a factor graph or not. The default is True. reducer : st...
5
null
Implement the Python class `AttENC` described below. Class description: Encoder using the relation interaction mechanism implemented by self-attention. Method signatures and docstrings: - def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): Parameters ---------- n_in : int input dimension. n_hid...
Implement the Python class `AttENC` described below. Class description: Encoder using the relation interaction mechanism implemented by self-attention. Method signatures and docstrings: - def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): Parameters ---------- n_in : int input dimension. n_hid...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class AttENC: """Encoder using the relation interaction mechanism implemented by self-attention.""" def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): """Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dim...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttENC: """Encoder using the relation interaction mechanism implemented by self-attention.""" def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): """Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension, i.e.,...
the_stack_v2_python_sparse
research/gnn/nri-mpm/models/nri.py
mindspore-ai/models
train
301
d45662f4dd4be5a127e11579b8d510877b610a82
[ "self.ss = ss\nself.n_step = n_step\nself.mu = mu\nself.sigma = sigma\nself.step_time = step_time\nself.saw_time = saw_time / delta_t", "step_vector = np.abs([round(gauss(self.mu, self.sigma), 1) for _ in range(self.n_step)])\nstep_vector[0] = self.ss\nu = np.zeros(shape=dim)\nj = 0\nramp_Step = self.saw_time\nco...
<|body_start_0|> self.ss = ss self.n_step = n_step self.mu = mu self.sigma = sigma self.step_time = step_time self.saw_time = saw_time / delta_t <|end_body_0|> <|body_start_1|> step_vector = np.abs([round(gauss(self.mu, self.sigma), 1) for _ in range(self.n_step)...
SawGaussStep
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SawGaussStep: def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None): """Settings for a random step sequence Args: step_time: Time to perform step change n_step (int): Number of steps""" <|body_0|> def out(self, t: any, dim=(None, None)) ...
stack_v2_sparse_classes_10k_train_005585
8,036
no_license
[ { "docstring": "Settings for a random step sequence Args: step_time: Time to perform step change n_step (int): Number of steps", "name": "__init__", "signature": "def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None)" }, { "docstring": "Generate a random seq...
2
stack_v2_sparse_classes_30k_train_000560
Implement the Python class `SawGaussStep` described below. Class description: Implement the SawGaussStep class. Method signatures and docstrings: - def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None): Settings for a random step sequence Args: step_time: Time to perform step cha...
Implement the Python class `SawGaussStep` described below. Class description: Implement the SawGaussStep class. Method signatures and docstrings: - def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None): Settings for a random step sequence Args: step_time: Time to perform step cha...
cf548475295f25407ba968546c2fc85c26f9343c
<|skeleton|> class SawGaussStep: def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None): """Settings for a random step sequence Args: step_time: Time to perform step change n_step (int): Number of steps""" <|body_0|> def out(self, t: any, dim=(None, None)) ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SawGaussStep: def __init__(self, step_time, saw_time, delta_t, mu=None, sigma=None, n_step=None, ss=None): """Settings for a random step sequence Args: step_time: Time to perform step change n_step (int): Number of steps""" self.ss = ss self.n_step = n_step self.mu = mu ...
the_stack_v2_python_sparse
SourceCode/simulation/signal.py
martin-bachorik/Master-Thesis-Project
train
0
bf52cdb366bf2827c2168f9a33a80c59443be497
[ "super().__init__()\nself._use_condition = use_condition\nself._model = self._get_coupling_layers(num_layers=4, num_channels_hidden=[32, 32], compression_size=compression_size)", "mask = tf.range(4096, dtype=tf.float32)\nmask = tf.reshape(mask, shape=[64, 64, 1]) % 2\nlayers = []\nfor _ in range(num_layers):\n ...
<|body_start_0|> super().__init__() self._use_condition = use_condition self._model = self._get_coupling_layers(num_layers=4, num_channels_hidden=[32, 32], compression_size=compression_size) <|end_body_0|> <|body_start_1|> mask = tf.range(4096, dtype=tf.float32) mask = tf.reshap...
Embedding conditioned flow model. Attributes: _use_condition:
EmbeddingConditionedFlow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingConditionedFlow: """Embedding conditioned flow model. Attributes: _use_condition:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" <|body_0|> def _get_coupling_layers(self, num_layers, n...
stack_v2_sparse_classes_10k_train_005586
12,897
no_license
[ { "docstring": "Initializes the object. Args: use_condition: compression_size:", "name": "__init__", "signature": "def __init__(self, use_condition, compression_size)" }, { "docstring": "Returns a list of convolutional affine coupling layers. Args: num_layers: num_channels_hidden: compression_si...
3
stack_v2_sparse_classes_30k_train_001540
Implement the Python class `EmbeddingConditionedFlow` described below. Class description: Embedding conditioned flow model. Attributes: _use_condition: Method signatures and docstrings: - def __init__(self, use_condition, compression_size): Initializes the object. Args: use_condition: compression_size: - def _get_cou...
Implement the Python class `EmbeddingConditionedFlow` described below. Class description: Embedding conditioned flow model. Attributes: _use_condition: Method signatures and docstrings: - def __init__(self, use_condition, compression_size): Initializes the object. Args: use_condition: compression_size: - def _get_cou...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class EmbeddingConditionedFlow: """Embedding conditioned flow model. Attributes: _use_condition:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" <|body_0|> def _get_coupling_layers(self, num_layers, n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EmbeddingConditionedFlow: """Embedding conditioned flow model. Attributes: _use_condition:""" def __init__(self, use_condition, compression_size): """Initializes the object. Args: use_condition: compression_size:""" super().__init__() self._use_condition = use_condition se...
the_stack_v2_python_sparse
flow.py
gaotianxiang/text-to-image-synthesis
train
0
79fc6a1fda36ac7cc0ab0c296780db2c3fcd26a9
[ "from poHomework.page.contact_page import Contact\nself.driver.find_element_by_id('username').send_keys('jiang2')\nself.driver.find_element_by_id('memberAdd_acctid').send_keys('jiang2')\nself.driver.find_element_by_id('memberAdd_phone').send_keys('15010236359')\nself.driver.execute_script('window.scrollTo(0,documen...
<|body_start_0|> from poHomework.page.contact_page import Contact self.driver.find_element_by_id('username').send_keys('jiang2') self.driver.find_element_by_id('memberAdd_acctid').send_keys('jiang2') self.driver.find_element_by_id('memberAdd_phone').send_keys('15010236359') self....
AddMember
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMember: def add_member(self): """保存成员信息 :return:""" <|body_0|> def add_member_fail(self, acctid, phone): """添加成员报错 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> from poHomework.page.contact_page import Contact self.driver.find_...
stack_v2_sparse_classes_10k_train_005587
1,281
no_license
[ { "docstring": "保存成员信息 :return:", "name": "add_member", "signature": "def add_member(self)" }, { "docstring": "添加成员报错 :return:", "name": "add_member_fail", "signature": "def add_member_fail(self, acctid, phone)" } ]
2
stack_v2_sparse_classes_30k_train_003382
Implement the Python class `AddMember` described below. Class description: Implement the AddMember class. Method signatures and docstrings: - def add_member(self): 保存成员信息 :return: - def add_member_fail(self, acctid, phone): 添加成员报错 :return:
Implement the Python class `AddMember` described below. Class description: Implement the AddMember class. Method signatures and docstrings: - def add_member(self): 保存成员信息 :return: - def add_member_fail(self, acctid, phone): 添加成员报错 :return: <|skeleton|> class AddMember: def add_member(self): """保存成员信息 :r...
bd677551a324887bed4c3919b4645ebdeff107d1
<|skeleton|> class AddMember: def add_member(self): """保存成员信息 :return:""" <|body_0|> def add_member_fail(self, acctid, phone): """添加成员报错 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddMember: def add_member(self): """保存成员信息 :return:""" from poHomework.page.contact_page import Contact self.driver.find_element_by_id('username').send_keys('jiang2') self.driver.find_element_by_id('memberAdd_acctid').send_keys('jiang2') self.driver.find_element_by_id('...
the_stack_v2_python_sparse
poHomework/page/add_memeber_page.py
jyl4944204/study-homework
train
0
76b7ecea7bfcd392342ffc9b6bdb3578616006ec
[ "x_ = x - ra_0\ny_ = y - dec_0\nf_ = 1 / 2.0 * (gamma1 * x_ * x_ + 2 * gamma2 * x_ * y_ - gamma1 * y_ * y_)\nreturn f_", "x_ = x - ra_0\ny_ = y - dec_0\nf_x = gamma1 * x_ + gamma2 * y_\nf_y = +gamma2 * x_ - gamma1 * y_\nreturn (f_x, f_y)", "gamma1 = gamma1\ngamma2 = gamma2\nkappa = 0\nf_xx = kappa + gamma1\nf_y...
<|body_start_0|> x_ = x - ra_0 y_ = y - dec_0 f_ = 1 / 2.0 * (gamma1 * x_ * x_ + 2 * gamma2 * x_ * y_ - gamma1 * y_ * y_) return f_ <|end_body_0|> <|body_start_1|> x_ = x - ra_0 y_ = y - dec_0 f_x = gamma1 * x_ + gamma2 * y_ f_y = +gamma2 * x_ - gamma1 * ...
class for external shear gamma1, gamma2 expression
Shear
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Shear: """class for external shear gamma1, gamma2 expression""" def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): """:param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where ...
stack_v2_sparse_classes_10k_train_005588
7,557
permissive
[ { "docstring": ":param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where shear deflection is 0 :param dec_0: y/dec position where shear deflection is 0 :return: lensing potential", "name": "function", "s...
3
stack_v2_sparse_classes_30k_train_002202
Implement the Python class `Shear` described below. Class description: class for external shear gamma1, gamma2 expression Method signatures and docstrings: - def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): :param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param ...
Implement the Python class `Shear` described below. Class description: class for external shear gamma1, gamma2 expression Method signatures and docstrings: - def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): :param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param ...
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class Shear: """class for external shear gamma1, gamma2 expression""" def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): """:param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Shear: """class for external shear gamma1, gamma2 expression""" def function(self, x, y, gamma1, gamma2, ra_0=0, dec_0=0): """:param x: x-coordinate (angle) :param y: y0-coordinate (angle) :param gamma1: shear component :param gamma2: shear component :param ra_0: x/ra position where shear deflect...
the_stack_v2_python_sparse
lenstronomy/LensModel/Profiles/shear.py
lenstronomy/lenstronomy
train
41
99f6281c1a3a20480785de966d0f780fea322734
[ "nums.sort()\nmin_dist, max_dist = (nums[-1] - nums[0], nums[-1] - nums[0])\nfor i in xrange(1, len(nums)):\n min_dist = min(min_dist, nums[i] - nums[i - 1])\nleft, right = (min_dist, max_dist)\nwhile left < right:\n mid = left + (right - left >> 1)\n if self.countPairs(nums, mid) < k:\n left = mid ...
<|body_start_0|> nums.sort() min_dist, max_dist = (nums[-1] - nums[0], nums[-1] - nums[0]) for i in xrange(1, len(nums)): min_dist = min(min_dist, nums[i] - nums[i - 1]) left, right = (min_dist, max_dist) while left < right: mid = left + (right - left >> 1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def countPairs(self, nums, dist): """number of pairs whose distance is no more than dist""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_005589
1,663
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "smallestDistancePair", "signature": "def smallestDistancePair(self, nums, k)" }, { "docstring": "number of pairs whose distance is no more than dist", "name": "countPairs", "signature": "def countPairs(self, nums, ...
2
stack_v2_sparse_classes_30k_train_004357
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestDistancePair(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def countPairs(self, nums, dist): number of pairs whose distance is no more than dist
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestDistancePair(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def countPairs(self, nums, dist): number of pairs whose distance is no more than dist <...
ee79d3437cf47b26a4bca0ec798dc54d7b623453
<|skeleton|> class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def countPairs(self, nums, dist): """number of pairs whose distance is no more than dist""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def smallestDistancePair(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" nums.sort() min_dist, max_dist = (nums[-1] - nums[0], nums[-1] - nums[0]) for i in xrange(1, len(nums)): min_dist = min(min_dist, nums[i] - nums[i - 1]) l...
the_stack_v2_python_sparse
Algorithm/Python/719. Find K-th Smallest Pair Distance.py
WuLC/LeetCode
train
29
2ed079ce585737cb64624f56788bfd8ae5b34666
[ "d = defaultdict(int)\n\ndef dfs(root, level):\n if not root:\n return\n d[level] += root.val\n dfs(root.left, level + 1)\n dfs(root.right, level + 1)\ndfs(root, 0)\nreturn d[max(d.keys())]", "queue = [root]\nsum_ = 0\nwhile queue:\n count = len(queue)\n sum_ = 0\n while count:\n ...
<|body_start_0|> d = defaultdict(int) def dfs(root, level): if not root: return d[level] += root.val dfs(root.left, level + 1) dfs(root.right, level + 1) dfs(root, 0) return d[max(d.keys())] <|end_body_0|> <|body_start_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deepestLeavesSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def deepestLeavesSumIterative(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = defaultdict(int) ...
stack_v2_sparse_classes_10k_train_005590
1,718
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "deepestLeavesSum", "signature": "def deepestLeavesSum(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "deepestLeavesSumIterative", "signature": "def deepestLeavesSumIterative(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deepestLeavesSum(self, root): :type root: TreeNode :rtype: int - def deepestLeavesSumIterative(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 deepestLeavesSum(self, root): :type root: TreeNode :rtype: int - def deepestLeavesSumIterative(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
546cbce06fcd4bc34e16d42b5d5eb68fb25e16a9
<|skeleton|> class Solution: def deepestLeavesSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def deepestLeavesSumIterative(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 deepestLeavesSum(self, root): """:type root: TreeNode :rtype: int""" d = defaultdict(int) def dfs(root, level): if not root: return d[level] += root.val dfs(root.left, level + 1) dfs(root.right, level + 1) ...
the_stack_v2_python_sparse
leetcode/solution_1302.py
eselyavka/python
train
0
88f54374ec43f587394d36325a3ca57441be734a
[ "dummy_node = current = ListNode(None)\nwhile l1 and l2:\n if l1.val <= l2.val:\n current.next = l1\n l1 = l1.next\n else:\n current.next = l2\n l2 = l2.next\n current = current.next\ncurrent.next = l1 or l2\nreturn dummy_node.next", "if not l1 or not l2:\n return l1 or l2\...
<|body_start_0|> dummy_node = current = ListNode(None) while l1 and l2: if l1.val <= l2.val: current.next = l1 l1 = l1.next else: current.next = l2 l2 = l2.next current = current.next current.next...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。""" <|body_0|> def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:递归比较下一个结点和另一方结点。""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_10k_train_005591
1,995
no_license
[ { "docstring": "非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "递归:递归比较下一个结点和另一方结点。", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: 非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。 - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 递归:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: 非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。 - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 递归:...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。""" <|body_0|> def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:递归比较下一个结点和另一方结点。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。""" dummy_node = current = ListNode(None) while l1 and l2: if l1.val <= l2.val: current.next = l1 l1 = l1.next ...
the_stack_v2_python_sparse
021_merge-two-sorted-lists.py
helloocc/algorithm
train
1
7acfaad2df0755913dd9ea8e663b7639942ece3b
[ "if f is not None:\n self.f = f\n if hasattr(f, '__name__'):\n self.__name__ = f.__name__\n else:\n self.__name__ = f.__name__\n self.__module__ = f.__module__\n self.af = ArgumentFixer(f)\nif name is not None:\n self.name = name\nself.options = options", "options = self.options\ni...
<|body_start_0|> if f is not None: self.f = f if hasattr(f, '__name__'): self.__name__ = f.__name__ else: self.__name__ = f.__name__ self.__module__ = f.__module__ self.af = ArgumentFixer(f) if name is not None: ...
Decorator for :class:`EnumeratedSetFromIterator`. Name could be string or a function ``(args,kwds) -> string``. .. WARNING:: If you are going to use this with the decorator ``cached_function``, you must place the ``cached_function`` first. See the example below. EXAMPLES:: sage: from sage.sets.set_from_iterator import ...
EnumeratedSetFromIterator_function_decorator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnumeratedSetFromIterator_function_decorator: """Decorator for :class:`EnumeratedSetFromIterator`. Name could be string or a function ``(args,kwds) -> string``. .. WARNING:: If you are going to use this with the decorator ``cached_function``, you must place the ``cached_function`` first. See the ...
stack_v2_sparse_classes_10k_train_005592
34,216
no_license
[ { "docstring": "Initialize ``self``. TESTS:: sage: from sage.sets.set_from_iterator import set_from_function sage: F = set_from_function(category=FiniteEnumeratedSets())(xsrange) sage: TestSuite(F(100)).run() sage: TestSuite(F(1,5,2)).run() sage: TestSuite(F(0)).run()", "name": "__init__", "signature": ...
2
stack_v2_sparse_classes_30k_train_002227
Implement the Python class `EnumeratedSetFromIterator_function_decorator` described below. Class description: Decorator for :class:`EnumeratedSetFromIterator`. Name could be string or a function ``(args,kwds) -> string``. .. WARNING:: If you are going to use this with the decorator ``cached_function``, you must place ...
Implement the Python class `EnumeratedSetFromIterator_function_decorator` described below. Class description: Decorator for :class:`EnumeratedSetFromIterator`. Name could be string or a function ``(args,kwds) -> string``. .. WARNING:: If you are going to use this with the decorator ``cached_function``, you must place ...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class EnumeratedSetFromIterator_function_decorator: """Decorator for :class:`EnumeratedSetFromIterator`. Name could be string or a function ``(args,kwds) -> string``. .. WARNING:: If you are going to use this with the decorator ``cached_function``, you must place the ``cached_function`` first. See the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EnumeratedSetFromIterator_function_decorator: """Decorator for :class:`EnumeratedSetFromIterator`. Name could be string or a function ``(args,kwds) -> string``. .. WARNING:: If you are going to use this with the decorator ``cached_function``, you must place the ``cached_function`` first. See the example below...
the_stack_v2_python_sparse
sage/src/sage/sets/set_from_iterator.py
bopopescu/geosci
train
0
54ba03d7405958dd2f00fa5e2fd869f5f51a04df
[ "self.maxlen = maxlen\nself.val_range = val_range\nself.img = np.ones((maxlen, maxlen))\nself.time_step = 0\nself.one_img = np.ones((maxlen, maxlen))", "assert isinstance(data, np.ndarray)\ndata = np.expand_dims(data, 1)\ndata = np.resize(data, (1, self.maxlen))\nif self.time_step >= self.maxlen:\n self.img = ...
<|body_start_0|> self.maxlen = maxlen self.val_range = val_range self.img = np.ones((maxlen, maxlen)) self.time_step = 0 self.one_img = np.ones((maxlen, maxlen)) <|end_body_0|> <|body_start_1|> assert isinstance(data, np.ndarray) data = np.expand_dims(data, 1) ...
Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``
DistributionTimeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributionTimeImage: """Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``""" def __init__(self, maxlen: int=600, val_range: Optional[dic...
stack_v2_sparse_classes_10k_train_005593
6,951
permissive
[ { "docstring": "Overview: Init the ``DistributionTimeImage`` class Arguments: - maxlen (:obj:`int`): The max length of data inputs - val_range (:obj:`dict` or :obj:`None`): Dict with ``val_range['min']`` and ``val_range['max']``.", "name": "__init__", "signature": "def __init__(self, maxlen: int=600, va...
3
null
Implement the Python class `DistributionTimeImage` described below. Class description: Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image`` Method signatures and docst...
Implement the Python class `DistributionTimeImage` described below. Class description: Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image`` Method signatures and docst...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class DistributionTimeImage: """Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``""" def __init__(self, maxlen: int=600, val_range: Optional[dic...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DistributionTimeImage: """Overview: ``DistributionTimeImage`` can be used to store images accorrding to ``time_steps``, for data with 3 dims``(time, category, value)`` Interface: ``__init__``, ``add_one_time_step``, ``get_image``""" def __init__(self, maxlen: int=600, val_range: Optional[dict]=None): ...
the_stack_v2_python_sparse
ding/utils/log_helper.py
shengxuesun/DI-engine
train
1
383deee568bade880bee06ca2ff2ed83b49a2bd0
[ "fig_legend = self.get_legend()\nif self.show_legend is not False and fig_legend is not None:\n fig_legend.set_visible(True)\nself.grid(grid_on=True)", "classes = dataset.classes\nif colors is None:\n if classes.size <= 6:\n colors = ['blue', 'red', 'lightgreen', 'black', 'gray', 'cyan']\n fro...
<|body_start_0|> fig_legend = self.get_legend() if self.show_legend is not False and fig_legend is not None: fig_legend.set_visible(True) self.grid(grid_on=True) <|end_body_0|> <|body_start_1|> classes = dataset.classes if colors is None: if classes.size ...
Plots a Dataset. Custom plotting parameters can be specified. Currently parameters default: - show_legend: True - grid: True See Also -------- .CDataset : store and manage a dataset. .CPlot : basic subplot functions. .CFigure : creates and handle figures.
CPlotDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CPlotDataset: """Plots a Dataset. Custom plotting parameters can be specified. Currently parameters default: - show_legend: True - grid: True See Also -------- .CDataset : store and manage a dataset. .CPlot : basic subplot functions. .CFigure : creates and handle figures.""" def apply_params...
stack_v2_sparse_classes_10k_train_005594
3,292
permissive
[ { "docstring": "Apply defined parameters to active subplot.", "name": "apply_params_ds", "signature": "def apply_params_ds(self)" }, { "docstring": "Plot patterns of each class with a different color/marker. Parameters ---------- dataset : CDataset Dataset that contain samples which we want plot...
2
stack_v2_sparse_classes_30k_train_006317
Implement the Python class `CPlotDataset` described below. Class description: Plots a Dataset. Custom plotting parameters can be specified. Currently parameters default: - show_legend: True - grid: True See Also -------- .CDataset : store and manage a dataset. .CPlot : basic subplot functions. .CFigure : creates and h...
Implement the Python class `CPlotDataset` described below. Class description: Plots a Dataset. Custom plotting parameters can be specified. Currently parameters default: - show_legend: True - grid: True See Also -------- .CDataset : store and manage a dataset. .CPlot : basic subplot functions. .CFigure : creates and h...
431373e65d8cfe2cb7cf042ce1a6c9519ea5a14a
<|skeleton|> class CPlotDataset: """Plots a Dataset. Custom plotting parameters can be specified. Currently parameters default: - show_legend: True - grid: True See Also -------- .CDataset : store and manage a dataset. .CPlot : basic subplot functions. .CFigure : creates and handle figures.""" def apply_params...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CPlotDataset: """Plots a Dataset. Custom plotting parameters can be specified. Currently parameters default: - show_legend: True - grid: True See Also -------- .CDataset : store and manage a dataset. .CPlot : basic subplot functions. .CFigure : creates and handle figures.""" def apply_params_ds(self): ...
the_stack_v2_python_sparse
src/secml/figure/_plots/c_plot_ds.py
Cinofix/secml
train
0
3b3cfc32aaddc1273f740d65b7261f4cfe82dbce
[ "if self.oriented_from == oriented_segment:\n return self.oriented_to\nelif self.oriented_to == oriented_segment:\n return self.oriented_from\nelif tolerant:\n return None\nelse:\n raise gfapy.NotFoundError(\"Oriented segment '{}' not found\\n\".format(repr(oriented_segment)) + 'Line: {}'.format(self))"...
<|body_start_0|> if self.oriented_from == oriented_segment: return self.oriented_to elif self.oriented_to == oriented_segment: return self.oriented_from elif tolerant: return None else: raise gfapy.NotFoundError("Oriented segment '{}' not f...
Other
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Other: def other_oriented_segment(self, oriented_segment, tolerant=False): """Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segm...
stack_v2_sparse_classes_10k_train_005595
1,564
permissive
[ { "docstring": "Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segment_end is not a segment end of the line.", "name": "other_oriented_segment", ...
2
stack_v2_sparse_classes_30k_train_001962
Implement the Python class `Other` described below. Class description: Implement the Other class. Method signatures and docstrings: - def other_oriented_segment(self, oriented_segment, tolerant=False): Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns --...
Implement the Python class `Other` described below. Class description: Implement the Other class. Method signatures and docstrings: - def other_oriented_segment(self, oriented_segment, tolerant=False): Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns --...
12b31daac26ab137b6ee4a29b4f14554ba962dcb
<|skeleton|> class Other: def other_oriented_segment(self, oriented_segment, tolerant=False): """Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segm...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Other: def other_oriented_segment(self, oriented_segment, tolerant=False): """Parameters ---------- oriented_segment : gfapy.OrientedLine One of the two oriented segments of the line. Returns ------- gfapy.OrientedLine The other oriented segment. Raises ------ gfapy.NotFoundError If segment_end is not...
the_stack_v2_python_sparse
gfapy/line/edge/gfa1/other.py
ggonnella/gfapy
train
63
43014415d4e4b7c3a2ca6aa1907409479c864587
[ "self.item = item\nself.key = key\nself.left = left\nself.right = right\nself._size = 1", "if self.key == key:\n self.item = item\nelif self.key < key:\n if self.right:\n self.right.insert(item, key)\n else:\n self.right = BSTreeNode(item, key)\nelif self.left:\n self.left.insert(item, k...
<|body_start_0|> self.item = item self.key = key self.left = left self.right = right self._size = 1 <|end_body_0|> <|body_start_1|> if self.key == key: self.item = item elif self.key < key: if self.right: self.right.insert(...
Binary search tree node (subtree)
BSTreeNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" ...
stack_v2_sparse_classes_10k_train_005596
3,986
no_license
[ { "docstring": "Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)", "name": "__init__", "signature": "def __init__(self, item, key, left=None, right=None)" }, { "docstring": "Assi...
6
stack_v2_sparse_classes_30k_train_005122
Implement the Python class `BSTreeNode` described below. Class description: Binary search tree node (subtree) Method signatures and docstrings: - def __init__(self, item, key, left=None, right=None): Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) ...
Implement the Python class `BSTreeNode` described below. Class description: Binary search tree node (subtree) Method signatures and docstrings: - def __init__(self, item, key, left=None, right=None): Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) ...
61746b48482eb0701f5c7211b153a3726c24f355
<|skeleton|> class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BSTreeNode: """Binary search tree node (subtree)""" def __init__(self, item, key, left=None, right=None): """Tree node constructor. :param item: node's item :param key: item's key :param left (BSTreeNode): left child (subtree) :param right (BSTreeNode): right child (subtree)""" self.item ...
the_stack_v2_python_sparse
mpiaa/search/bstree_node.py
sergey-suslov/mpiaa-sem3
train
0
cf967a935018f6e82afc1273024f54b8213986bb
[ "logging.Handler.__init__(self)\nself.address = address\nself.port = port\nself.certfile = cert_path\nself.facility = facility\nself.level = log_level\nssl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\nssl_context.minimum_version = ssl.TLSVersion.TL...
<|body_start_0|> logging.Handler.__init__(self) self.address = address self.port = port self.certfile = cert_path self.facility = facility self.level = log_level ssl_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_context = ssl.SSLContext(ssl....
SyslogHandlerTLS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyslogHandlerTLS: def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): """Initialize a handler.""" <|body_0|> def emit(self, record): """Emit a record. The record is formatted, and then sent to the syslo...
stack_v2_sparse_classes_10k_train_005597
14,986
permissive
[ { "docstring": "Initialize a handler.", "name": "__init__", "signature": "def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool)" }, { "docstring": "Emit a record. The record is formatted, and then sent to the syslog server. If excepti...
2
stack_v2_sparse_classes_30k_train_003458
Implement the Python class `SyslogHandlerTLS` described below. Class description: Implement the SyslogHandlerTLS class. Method signatures and docstrings: - def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): Initialize a handler. - def emit(self, record...
Implement the Python class `SyslogHandlerTLS` described below. Class description: Implement the SyslogHandlerTLS class. Method signatures and docstrings: - def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): Initialize a handler. - def emit(self, record...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class SyslogHandlerTLS: def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): """Initialize a handler.""" <|body_0|> def emit(self, record): """Emit a record. The record is formatted, and then sent to the syslo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SyslogHandlerTLS: def __init__(self, address: str, port: int, log_level: int, facility: int, cert_path: str, if_self_sign_cert: bool): """Initialize a handler.""" logging.Handler.__init__(self) self.address = address self.port = port self.certfile = cert_path se...
the_stack_v2_python_sparse
Packs/Syslog/Integrations/SyslogSender/SyslogSender.py
demisto/content
train
1,023
d5545ef4c14a64e270322d54020cb0e931776ac4
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = init_refs.make_transcript_dict(cursor, build)\nconn.close()\nedges = (100, 200, 300)\nmatches = talon.search_for_ISM(edges, transcript_dict)\nassert matches == None", "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = ini...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = init_refs.make_transcript_dict(cursor, build) conn.close() edges = (100, 200, 300) matches = talon.search_for_ISM(edges, transcript_dict) assert matches == None <|end_body_0|> <...
TestSearchForISM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSearchForISM: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one ISM match for the transcript....
stack_v2_sparse_classes_10k_train_005598
1,789
permissive
[ { "docstring": "Example where the toy transcript database contains no matches for the edge set.", "name": "test_find_no_match", "signature": "def test_find_no_match(self)" }, { "docstring": "Example where the toy transcript database contains exactly one ISM match for the transcript.", "name"...
3
stack_v2_sparse_classes_30k_train_005725
Implement the Python class `TestSearchForISM` described below. Class description: Implement the TestSearchForISM class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example where the toy t...
Implement the Python class `TestSearchForISM` described below. Class description: Implement the TestSearchForISM class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example where the toy t...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestSearchForISM: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one ISM match for the transcript....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSearchForISM: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = init_refs.make_transcript_dict(cursor, build) conn.close() ...
the_stack_v2_python_sparse
testing_suite/test_search_for_ISM_match.py
kopardev/TALON
train
0
68b7e1d666c8e12f2128e3e382243f1bafa60ee0
[ "super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)\nself.orientations = dat.getOrientations(frame, *self.particles) % (2 * np.pi)\nself.colorbar(0, 2, cmap=plt.cm.hsv)\nself.colormap.set_label('$\\\\theta_i/\\\\pi$', label...
<|body_start_0|> super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length) self.orientations = dat.getOrientations(frame, *self.particles) % (2 * np.pi) self.colorbar(0, 2, cmap=plt.cm.hsv) self.colorma...
Plotting class specific to 'orientation' mode.
Orientation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Orientation: """Plotting class specific to 'orientation' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs): """Initialises and p...
stack_v2_sparse_classes_10k_train_005599
24,676
permissive
[ { "docstring": "Initialises and plots figure. Parameters ---------- dat : active_work.read.Dat Data object. frame : int Frame to render. box_size : float Length of the square box to render. centre : 2-uple like Centre of the box to render. arrow_width : float Width of the arrows. arrow_head_width : float Width ...
3
stack_v2_sparse_classes_30k_train_007137
Implement the Python class `Orientation` described below. Class description: Plotting class specific to 'orientation' mode. Method signatures and docstrings: - def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colo...
Implement the Python class `Orientation` described below. Class description: Plotting class specific to 'orientation' mode. Method signatures and docstrings: - def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colo...
99107a0d4935296b673f67469c1e2bd258954b9b
<|skeleton|> class Orientation: """Plotting class specific to 'orientation' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs): """Initialises and p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Orientation: """Plotting class specific to 'orientation' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs): """Initialises and plots figure. ...
the_stack_v2_python_sparse
frame.py
yketa/active_work
train
1