blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
30e95d22f0c92190090e870f6152c549a5e30e74
[ "super(PretrainedImageEncoding, self).__init__()\nnum_blocks = num_blocks\ncnn = getattr(torchvision.models, cnn_model)(pretrained=True)\nlayers = [cnn.conv1, cnn.bn1, cnn.relu, cnn.maxpool]\nfor i in range(num_blocks):\n name = 'layer%d' % (i + 1)\n layers.append(getattr(cnn, name))\nself.model = torch.nn.Se...
<|body_start_0|> super(PretrainedImageEncoding, self).__init__() num_blocks = num_blocks cnn = getattr(torchvision.models, cnn_model)(pretrained=True) layers = [cnn.conv1, cnn.bn1, cnn.relu, cnn.maxpool] for i in range(num_blocks): name = 'layer%d' % (i + 1) ...
Image encoding using pretrained resnetXX from torchvision.
PretrainedImageEncoding
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PretrainedImageEncoding: """Image encoding using pretrained resnetXX from torchvision.""" def __init__(self, cnn_model='resnet18', num_blocks=2): """Constructor of the PretrainedImageEncoding class. :param cnn_model: select which resnet pretrained model to load :param num_blocks: num...
stack_v2_sparse_classes_36k_train_021400
4,377
permissive
[ { "docstring": "Constructor of the PretrainedImageEncoding class. :param cnn_model: select which resnet pretrained model to load :param num_blocks: num of resnet blocks to be used", "name": "__init__", "signature": "def __init__(self, cnn_model='resnet18', num_blocks=2)" }, { "docstring": "Apply...
2
null
Implement the Python class `PretrainedImageEncoding` described below. Class description: Image encoding using pretrained resnetXX from torchvision. Method signatures and docstrings: - def __init__(self, cnn_model='resnet18', num_blocks=2): Constructor of the PretrainedImageEncoding class. :param cnn_model: select whi...
Implement the Python class `PretrainedImageEncoding` described below. Class description: Image encoding using pretrained resnetXX from torchvision. Method signatures and docstrings: - def __init__(self, cnn_model='resnet18', num_blocks=2): Constructor of the PretrainedImageEncoding class. :param cnn_model: select whi...
c655c88cc6aec4d0724c19ea95209f1c2dd6770d
<|skeleton|> class PretrainedImageEncoding: """Image encoding using pretrained resnetXX from torchvision.""" def __init__(self, cnn_model='resnet18', num_blocks=2): """Constructor of the PretrainedImageEncoding class. :param cnn_model: select which resnet pretrained model to load :param num_blocks: num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PretrainedImageEncoding: """Image encoding using pretrained resnetXX from torchvision.""" def __init__(self, cnn_model='resnet18', num_blocks=2): """Constructor of the PretrainedImageEncoding class. :param cnn_model: select which resnet pretrained model to load :param num_blocks: num of resnet bl...
the_stack_v2_python_sparse
models/stacked_attention_vqa/image_encoding.py
aasseman/mi-prometheus
train
0
aff37f6c081fd90494bba0996de2d664e56a4044
[ "for parser in parsers:\n if parser.media_type in SCIM_CONTENT_TYPES:\n return parser", "for renderer in renderers:\n if renderer.media_type in SCIM_CONTENT_TYPES:\n return (renderer, renderer.media_type)" ]
<|body_start_0|> for parser in parsers: if parser.media_type in SCIM_CONTENT_TYPES: return parser <|end_body_0|> <|body_start_1|> for renderer in renderers: if renderer.media_type in SCIM_CONTENT_TYPES: return (renderer, renderer.media_type) <|end...
SCIMClientNegotiation
[ "Apache-2.0", "BUSL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SCIMClientNegotiation: def select_parser(self, request: Request, parsers): """Select the first parser in the `.parser_classes` list.""" <|body_0|> def select_renderer(self, request: Request, renderers, format_suffix): """Select the first renderer in the `.renderer_cl...
stack_v2_sparse_classes_36k_train_021401
7,038
permissive
[ { "docstring": "Select the first parser in the `.parser_classes` list.", "name": "select_parser", "signature": "def select_parser(self, request: Request, parsers)" }, { "docstring": "Select the first renderer in the `.renderer_classes` list.", "name": "select_renderer", "signature": "def...
2
null
Implement the Python class `SCIMClientNegotiation` described below. Class description: Implement the SCIMClientNegotiation class. Method signatures and docstrings: - def select_parser(self, request: Request, parsers): Select the first parser in the `.parser_classes` list. - def select_renderer(self, request: Request,...
Implement the Python class `SCIMClientNegotiation` described below. Class description: Implement the SCIMClientNegotiation class. Method signatures and docstrings: - def select_parser(self, request: Request, parsers): Select the first parser in the `.parser_classes` list. - def select_renderer(self, request: Request,...
d9dd4f382f96b5c4576b64cbf015db651556c18b
<|skeleton|> class SCIMClientNegotiation: def select_parser(self, request: Request, parsers): """Select the first parser in the `.parser_classes` list.""" <|body_0|> def select_renderer(self, request: Request, renderers, format_suffix): """Select the first renderer in the `.renderer_cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SCIMClientNegotiation: def select_parser(self, request: Request, parsers): """Select the first parser in the `.parser_classes` list.""" for parser in parsers: if parser.media_type in SCIM_CONTENT_TYPES: return parser def select_renderer(self, request: Request, ...
the_stack_v2_python_sparse
src/sentry/scim/endpoints/utils.py
nagyist/sentry
train
0
d4bb48a59e901403ec1aab75b8983dac7f391fdb
[ "self.src = src\nself.exe = exe\nself.cond = cond\nself.dest = dest\nself.mode = mode\nself.optional = optional\nself.strip = strip\nself.blacklist = self.DEFAULT_BLACKLIST\nif blacklist is not None:\n self.blacklist += tuple(blacklist)", "for pattern in self.blacklist:\n if re.match(pattern, path):\n ...
<|body_start_0|> self.src = src self.exe = exe self.cond = cond self.dest = dest self.mode = mode self.optional = optional self.strip = strip self.blacklist = self.DEFAULT_BLACKLIST if blacklist is not None: self.blacklist += tuple(blac...
Represents an artifact to be copied from build dir to staging dir.
Path
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Path: """Represents an artifact to be copied from build dir to staging dir.""" def __init__(self, src, exe=False, cond=None, dest=None, mode=None, optional=False, strip=True, blacklist=None): """Initializes the object. Args: src: The relative path of the artifact. Can be a file or a ...
stack_v2_sparse_classes_36k_train_021402
16,433
permissive
[ { "docstring": "Initializes the object. Args: src: The relative path of the artifact. Can be a file or a directory. Can be a glob pattern. exe: Identifes the path as either being an executable or containing executables. Executables may be stripped during copy, and have special permissions set. We currently only...
3
stack_v2_sparse_classes_30k_train_015046
Implement the Python class `Path` described below. Class description: Represents an artifact to be copied from build dir to staging dir. Method signatures and docstrings: - def __init__(self, src, exe=False, cond=None, dest=None, mode=None, optional=False, strip=True, blacklist=None): Initializes the object. Args: sr...
Implement the Python class `Path` described below. Class description: Represents an artifact to be copied from build dir to staging dir. Method signatures and docstrings: - def __init__(self, src, exe=False, cond=None, dest=None, mode=None, optional=False, strip=True, blacklist=None): Initializes the object. Args: sr...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class Path: """Represents an artifact to be copied from build dir to staging dir.""" def __init__(self, src, exe=False, cond=None, dest=None, mode=None, optional=False, strip=True, blacklist=None): """Initializes the object. Args: src: The relative path of the artifact. Can be a file or a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Path: """Represents an artifact to be copied from build dir to staging dir.""" def __init__(self, src, exe=False, cond=None, dest=None, mode=None, optional=False, strip=True, blacklist=None): """Initializes the object. Args: src: The relative path of the artifact. Can be a file or a directory. Ca...
the_stack_v2_python_sparse
third_party/chromite/lib/chrome_util.py
metux/chromium-suckless
train
5
639c879674e4028b92c59d215b35f7bcf8022c21
[ "self._scope = []\nfor path in scope:\n if path.startswith('^'):\n self._scope.append(re.compile(path))\n else:\n self._scope.append(path)", "for exclusion_path in self._scope:\n if hasattr(exclusion_path, 'match'):\n if exclusion_path.match(proj_dir):\n return True\n e...
<|body_start_0|> self._scope = [] for path in scope: if path.startswith('^'): self._scope.append(re.compile(path)) else: self._scope.append(path) <|end_body_0|> <|body_start_1|> for exclusion_path in self._scope: if hasattr(exc...
Exclusion scope for a hook. An exclusion scope can be used to determine if a hook has been disabled for a specific project.
ExclusionScope
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExclusionScope: """Exclusion scope for a hook. An exclusion scope can be used to determine if a hook has been disabled for a specific project.""" def __init__(self, scope): """Initialize. Args: scope: A list of shell-style wildcards (fnmatch) or regular expression. Regular expression...
stack_v2_sparse_classes_36k_train_021403
37,276
no_license
[ { "docstring": "Initialize. Args: scope: A list of shell-style wildcards (fnmatch) or regular expression. Regular expressions must start with the ^ character.", "name": "__init__", "signature": "def __init__(self, scope)" }, { "docstring": "Checks if |proj_dir| matches the excluded paths. Args: ...
2
stack_v2_sparse_classes_30k_test_000610
Implement the Python class `ExclusionScope` described below. Class description: Exclusion scope for a hook. An exclusion scope can be used to determine if a hook has been disabled for a specific project. Method signatures and docstrings: - def __init__(self, scope): Initialize. Args: scope: A list of shell-style wild...
Implement the Python class `ExclusionScope` described below. Class description: Exclusion scope for a hook. An exclusion scope can be used to determine if a hook has been disabled for a specific project. Method signatures and docstrings: - def __init__(self, scope): Initialize. Args: scope: A list of shell-style wild...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class ExclusionScope: """Exclusion scope for a hook. An exclusion scope can be used to determine if a hook has been disabled for a specific project.""" def __init__(self, scope): """Initialize. Args: scope: A list of shell-style wildcards (fnmatch) or regular expression. Regular expression...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExclusionScope: """Exclusion scope for a hook. An exclusion scope can be used to determine if a hook has been disabled for a specific project.""" def __init__(self, scope): """Initialize. Args: scope: A list of shell-style wildcards (fnmatch) or regular expression. Regular expressions must start ...
the_stack_v2_python_sparse
tools/repohooks/rh/hooks.py
ZYHGOD-1/Aosp11
train
0
8f7e0dec1976d6cb361cd35f86a6a7b12fd5184f
[ "super(QBCStabilityAgent, self).__init__(candidate_data=candidate_data, seed_data=seed_data, n_query=n_query, hull_distance=hull_distance, parallel=parallel)\nself.alpha = alpha\nself.model = model\nself.n_members = n_members\nself.qbc = QBC(n_members=n_members, training_fraction=training_fraction, model=model)", ...
<|body_start_0|> super(QBCStabilityAgent, self).__init__(candidate_data=candidate_data, seed_data=seed_data, n_query=n_query, hull_distance=hull_distance, parallel=parallel) self.alpha = alpha self.model = model self.n_members = n_members self.qbc = QBC(n_members=n_members, train...
Agent which uses QBC to determine optimal hypotheses
QBCStabilityAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QBCStabilityAgent: """Agent which uses QBC to determine optimal hypotheses""" def __init__(self, candidate_data=None, seed_data=None, n_query=1, hull_distance=0.0, parallel=cpu_count(), alpha=0.5, training_fraction=0.5, model=None, n_members=10): """Args: candidate_data (DataFrame): ...
stack_v2_sparse_classes_36k_train_021404
38,060
permissive
[ { "docstring": "Args: candidate_data (DataFrame): data about the candidates seed_data (DataFrame): data which to fit the Agent to n_query (int): number of hypotheses to generate hull_distance (float): hull distance as a criteria for which to deem a given material as \"stable\" parallel (bool): whether to use mu...
2
stack_v2_sparse_classes_30k_test_000736
Implement the Python class `QBCStabilityAgent` described below. Class description: Agent which uses QBC to determine optimal hypotheses Method signatures and docstrings: - def __init__(self, candidate_data=None, seed_data=None, n_query=1, hull_distance=0.0, parallel=cpu_count(), alpha=0.5, training_fraction=0.5, mode...
Implement the Python class `QBCStabilityAgent` described below. Class description: Agent which uses QBC to determine optimal hypotheses Method signatures and docstrings: - def __init__(self, candidate_data=None, seed_data=None, n_query=1, hull_distance=0.0, parallel=cpu_count(), alpha=0.5, training_fraction=0.5, mode...
905f5d577513d1ca5a54fac3d381525e0fe3576a
<|skeleton|> class QBCStabilityAgent: """Agent which uses QBC to determine optimal hypotheses""" def __init__(self, candidate_data=None, seed_data=None, n_query=1, hull_distance=0.0, parallel=cpu_count(), alpha=0.5, training_fraction=0.5, model=None, n_members=10): """Args: candidate_data (DataFrame): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QBCStabilityAgent: """Agent which uses QBC to determine optimal hypotheses""" def __init__(self, candidate_data=None, seed_data=None, n_query=1, hull_distance=0.0, parallel=cpu_count(), alpha=0.5, training_fraction=0.5, model=None, n_members=10): """Args: candidate_data (DataFrame): data about th...
the_stack_v2_python_sparse
camd/agent/stability.py
apalizha/CAMD
train
0
c9b26b95d1890e17806162f3c42619bfc8f4636c
[ "header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN'))\nheader('Access-Control-Allow-Headers', ctx.env.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS'))\nheader('Access-Control-Allow-Methods', '*')\nheader('Access-Control-Allow-Credentials', 'true')\nheader('Access-Control-Expose-Headers', 'X-Rucio-Auth-Token...
<|body_start_0|> header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN')) header('Access-Control-Allow-Headers', ctx.env.get('HTTP_ACCESS_CONTROL_REQUEST_HEADERS')) header('Access-Control-Allow-Methods', '*') header('Access-Control-Allow-Credentials', 'true') header('Acc...
Authenticate a Rucio account temporarily via a GSS token.
GSS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GSS: """Authenticate a Rucio account temporarily via a GSS token.""" def OPTIONS(self): """HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.""" <|body_0|> def GET(self): """HTTP Success: 200 OK HTTP Error: 401 Unauthorized :param Rucio...
stack_v2_sparse_classes_36k_train_021405
18,732
permissive
[ { "docstring": "HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.", "name": "OPTIONS", "signature": "def OPTIONS(self)" }, { "docstring": "HTTP Success: 200 OK HTTP Error: 401 Unauthorized :param Rucio-Account: Account identifier as a string. :param Rucio-AppID: Appli...
2
null
Implement the Python class `GSS` described below. Class description: Authenticate a Rucio account temporarily via a GSS token. Method signatures and docstrings: - def OPTIONS(self): HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication. - def GET(self): HTTP Success: 200 OK HTTP Error: 401 Unau...
Implement the Python class `GSS` described below. Class description: Authenticate a Rucio account temporarily via a GSS token. Method signatures and docstrings: - def OPTIONS(self): HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication. - def GET(self): HTTP Success: 200 OK HTTP Error: 401 Unau...
355a997a5ea213c427a5d841ab151ceb01073eb4
<|skeleton|> class GSS: """Authenticate a Rucio account temporarily via a GSS token.""" def OPTIONS(self): """HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.""" <|body_0|> def GET(self): """HTTP Success: 200 OK HTTP Error: 401 Unauthorized :param Rucio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GSS: """Authenticate a Rucio account temporarily via a GSS token.""" def OPTIONS(self): """HTTP Success: 200 OK Allow cross-site scripting. Explicit for Authentication.""" header('Access-Control-Allow-Origin', ctx.env.get('HTTP_ORIGIN')) header('Access-Control-Allow-Headers', ctx....
the_stack_v2_python_sparse
lib/rucio/web/rest/webpy/v1/authentication.py
pujanm/rucio
train
1
721a103147f06d42aad444ed245e06ee090796be
[ "self.parent = list(range(len(ensemble)))\nself.identifiants = {elem: i for i, elem in enumerate(ensemble)}\nself.rang = [0] * len(ensemble)", "racine = self.identifiants[element]\nelements_rencontres = set()\nwhile self.parent[racine] != racine:\n elements_rencontres.add(racine)\n racine = self.parent[raci...
<|body_start_0|> self.parent = list(range(len(ensemble))) self.identifiants = {elem: i for i, elem in enumerate(ensemble)} self.rang = [0] * len(ensemble) <|end_body_0|> <|body_start_1|> racine = self.identifiants[element] elements_rencontres = set() while self.parent[ra...
Implémentation de la structure de données Union-Find.
UnionFind
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnionFind: """Implémentation de la structure de données Union-Find.""" def __init__(self, ensemble): """Initialisation des structures de données nécessaires.""" <|body_0|> def find(self, element): """Renvoie le numéro de la classe à laquelle appartient l'élément....
stack_v2_sparse_classes_36k_train_021406
2,968
no_license
[ { "docstring": "Initialisation des structures de données nécessaires.", "name": "__init__", "signature": "def __init__(self, ensemble)" }, { "docstring": "Renvoie le numéro de la classe à laquelle appartient l'élément.", "name": "find", "signature": "def find(self, element)" }, { ...
3
null
Implement the Python class `UnionFind` described below. Class description: Implémentation de la structure de données Union-Find. Method signatures and docstrings: - def __init__(self, ensemble): Initialisation des structures de données nécessaires. - def find(self, element): Renvoie le numéro de la classe à laquelle ...
Implement the Python class `UnionFind` described below. Class description: Implémentation de la structure de données Union-Find. Method signatures and docstrings: - def __init__(self, ensemble): Initialisation des structures de données nécessaires. - def find(self, element): Renvoie le numéro de la classe à laquelle ...
8208f08562a7ea573aa0d010b4b28085e73d0f30
<|skeleton|> class UnionFind: """Implémentation de la structure de données Union-Find.""" def __init__(self, ensemble): """Initialisation des structures de données nécessaires.""" <|body_0|> def find(self, element): """Renvoie le numéro de la classe à laquelle appartient l'élément....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnionFind: """Implémentation de la structure de données Union-Find.""" def __init__(self, ensemble): """Initialisation des structures de données nécessaires.""" self.parent = list(range(len(ensemble))) self.identifiants = {elem: i for i, elem in enumerate(ensemble)} self.r...
the_stack_v2_python_sparse
ComputerScience/AnthonyLabarre/L3-algographes/rendus/2020/rendu02-acpm/unionfind.py
PremierLangage/Yggdrasil
train
6
9a0618a319d26b2bb0507d2fb88a68ef2606fdf9
[ "context = ssl._create_unverified_context()\nwith request.urlopen(url, context=context) as r:\n return r.read()", "try:\n if not file:\n file = url.split('/')[-1]\n with open(file, 'wb') as f:\n f.write(NetworkUtil.get(url))\n return True\nexcept Exception as err:\n LogUtil.e('downloa...
<|body_start_0|> context = ssl._create_unverified_context() with request.urlopen(url, context=context) as r: return r.read() <|end_body_0|> <|body_start_1|> try: if not file: file = url.split('/')[-1] with open(file, 'wb') as f: ...
NetworkUtil
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkUtil: def get(url): """获取URL的内容 :param url: URL地址 :return: 网址内容""" <|body_0|> def downloadFile(url, file=None): """下载文件 :param url: 文件URL地址 :param file: 本地文件路径 :return: True 下载成功""" <|body_1|> def downloadPackage(url, downloadFile=None, retryTimes...
stack_v2_sparse_classes_36k_train_021407
1,842
permissive
[ { "docstring": "获取URL的内容 :param url: URL地址 :return: 网址内容", "name": "get", "signature": "def get(url)" }, { "docstring": "下载文件 :param url: 文件URL地址 :param file: 本地文件路径 :return: True 下载成功", "name": "downloadFile", "signature": "def downloadFile(url, file=None)" }, { "docstring": "下载...
3
stack_v2_sparse_classes_30k_train_002123
Implement the Python class `NetworkUtil` described below. Class description: Implement the NetworkUtil class. Method signatures and docstrings: - def get(url): 获取URL的内容 :param url: URL地址 :return: 网址内容 - def downloadFile(url, file=None): 下载文件 :param url: 文件URL地址 :param file: 本地文件路径 :return: True 下载成功 - def downloadPac...
Implement the Python class `NetworkUtil` described below. Class description: Implement the NetworkUtil class. Method signatures and docstrings: - def get(url): 获取URL的内容 :param url: URL地址 :return: 网址内容 - def downloadFile(url, file=None): 下载文件 :param url: 文件URL地址 :param file: 本地文件路径 :return: True 下载成功 - def downloadPac...
24cca5e9aaa56392200da48a1692201e2dfa25c8
<|skeleton|> class NetworkUtil: def get(url): """获取URL的内容 :param url: URL地址 :return: 网址内容""" <|body_0|> def downloadFile(url, file=None): """下载文件 :param url: 文件URL地址 :param file: 本地文件路径 :return: True 下载成功""" <|body_1|> def downloadPackage(url, downloadFile=None, retryTimes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetworkUtil: def get(url): """获取URL的内容 :param url: URL地址 :return: 网址内容""" context = ssl._create_unverified_context() with request.urlopen(url, context=context) as r: return r.read() def downloadFile(url, file=None): """下载文件 :param url: 文件URL地址 :param file: 本地文件...
the_stack_v2_python_sparse
util/NetworkUtil.py
lkl22/CommonTools
train
2
56c2faa588cefda07595751a68ba5e7a454773bf
[ "idea = self.get_object()\nif self.request.user == idea.conceiver:\n form = process_idea_form(self.request, form)\n messages.success(self.request, _('Your idea has been successfully updated.'))\nelse:\n messages.warning(self.request, _('You are not allowed to update this idea.'))\n return redirect('idea...
<|body_start_0|> idea = self.get_object() if self.request.user == idea.conceiver: form = process_idea_form(self.request, form) messages.success(self.request, _('Your idea has been successfully updated.')) else: messages.warning(self.request, _('You are not all...
Allows only conceivers to update their idea
IdeaUpdateView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdeaUpdateView: """Allows only conceivers to update their idea""" def form_valid(self, form): """Check whether the user logged in is the one updating the idea.""" <|body_0|> def test_func(self): """ensuring the conceiver themselves is updating their idea""" ...
stack_v2_sparse_classes_36k_train_021408
11,512
permissive
[ { "docstring": "Check whether the user logged in is the one updating the idea.", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "ensuring the conceiver themselves is updating their idea", "name": "test_func", "signature": "def test_func(self)" } ]
2
stack_v2_sparse_classes_30k_train_009600
Implement the Python class `IdeaUpdateView` described below. Class description: Allows only conceivers to update their idea Method signatures and docstrings: - def form_valid(self, form): Check whether the user logged in is the one updating the idea. - def test_func(self): ensuring the conceiver themselves is updatin...
Implement the Python class `IdeaUpdateView` described below. Class description: Allows only conceivers to update their idea Method signatures and docstrings: - def form_valid(self, form): Check whether the user logged in is the one updating the idea. - def test_func(self): ensuring the conceiver themselves is updatin...
9b0819fc999c6f923346b4ac0399bafe58207ab1
<|skeleton|> class IdeaUpdateView: """Allows only conceivers to update their idea""" def form_valid(self, form): """Check whether the user logged in is the one updating the idea.""" <|body_0|> def test_func(self): """ensuring the conceiver themselves is updating their idea""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdeaUpdateView: """Allows only conceivers to update their idea""" def form_valid(self, form): """Check whether the user logged in is the one updating the idea.""" idea = self.get_object() if self.request.user == idea.conceiver: form = process_idea_form(self.request, fo...
the_stack_v2_python_sparse
ideas/views.py
abhiabhi94/idea-fare
train
0
75316ed6b1e36d938bea1e10466f3ba774ddac00
[ "check_arg(dirpath, u._('Directory path'), str)\ndirpath = safe_decode(dirpath)\nif not os.path.exists(dirpath):\n raise InvalidArgument(u._('Directory path: {path} does not exist').format(path=dirpath))\ndumpfile_path = dump(dirpath)\nreturn dumpfile_path", "check_arg(dirpath, u._('Directory path'), str)\ndir...
<|body_start_0|> check_arg(dirpath, u._('Directory path'), str) dirpath = safe_decode(dirpath) if not os.path.exists(dirpath): raise InvalidArgument(u._('Directory path: {path} does not exist').format(path=dirpath)) dumpfile_path = dump(dirpath) return dumpfile_path <...
SupportApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupportApi: def support_dump(self, dirpath): """Dumps configuration data for debugging. Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / development to help with debugging problems. :param dirpath: path to directory where dump will be placed :t...
stack_v2_sparse_classes_36k_train_021409
3,067
permissive
[ { "docstring": "Dumps configuration data for debugging. Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / development to help with debugging problems. :param dirpath: path to directory where dump will be placed :type dirpath: string :return: path to dump file :rtype: s...
2
stack_v2_sparse_classes_30k_train_004346
Implement the Python class `SupportApi` described below. Class description: Implement the SupportApi class. Method signatures and docstrings: - def support_dump(self, dirpath): Dumps configuration data for debugging. Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / developm...
Implement the Python class `SupportApi` described below. Class description: Implement the SupportApi class. Method signatures and docstrings: - def support_dump(self, dirpath): Dumps configuration data for debugging. Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / developm...
dc38107ff2462f62124b5feab275fa369e223169
<|skeleton|> class SupportApi: def support_dump(self, dirpath): """Dumps configuration data for debugging. Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / development to help with debugging problems. :param dirpath: path to directory where dump will be placed :t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupportApi: def support_dump(self, dirpath): """Dumps configuration data for debugging. Dumps most files in /etc/kolla and /usr/share/kolla into a tar file so be given to support / development to help with debugging problems. :param dirpath: path to directory where dump will be placed :type dirpath: s...
the_stack_v2_python_sparse
kolla_cli/api/support.py
iputra/kolla-cli
train
0
507f3aacc54f026643bb024751df7217ba49a7db
[ "self.cluster_id = cluster_id\nself.cluster_name = cluster_name\nself.cluster_sw_version = cluster_sw_version\nself.healthy_nodes = healthy_nodes\nself.incarnation_id = incarnation_id\nself.message = message\nself.unhealthy_nodes = unhealthy_nodes", "if dictionary is None:\n return None\ncluster_id = dictionar...
<|body_start_0|> self.cluster_id = cluster_id self.cluster_name = cluster_name self.cluster_sw_version = cluster_sw_version self.healthy_nodes = healthy_nodes self.incarnation_id = incarnation_id self.message = message self.unhealthy_nodes = unhealthy_nodes <|end_...
Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. Attributes: cluster_id (long|int): Specifies the...
CreateClusterResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateClusterResult: """Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. A...
stack_v2_sparse_classes_36k_train_021410
4,007
permissive
[ { "docstring": "Constructor for the CreateClusterResult class", "name": "__init__", "signature": "def __init__(self, cluster_id=None, cluster_name=None, cluster_sw_version=None, healthy_nodes=None, incarnation_id=None, message=None, unhealthy_nodes=None)" }, { "docstring": "Creates an instance o...
2
stack_v2_sparse_classes_30k_train_010575
Implement the Python class `CreateClusterResult` described below. Class description: Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup op...
Implement the Python class `CreateClusterResult` described below. Class description: Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup op...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CreateClusterResult: """Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateClusterResult: """Implementation of the 'CreateClusterResult' model. Specifies the immediate result of a Cluster creation request. Contains validation results for each node. If the request is valid, it also indicates that the individual node bringup operation is started in the background. Attributes: cl...
the_stack_v2_python_sparse
cohesity_management_sdk/models/create_cluster_result.py
cohesity/management-sdk-python
train
24
4f38f6bb13d11c9d185e13a4eb6602637ad00205
[ "confusion_matrix = metrics.confusion_matrix(test_labels, labels).astype(np.float32)\nconfusion_matrix = confusion_matrix / confusion_matrix.sum(axis=1)[:, np.newaxis]\ndf_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names)\nplt.figure(figsize=(10, 7))\nsns.heatmap(df_cm, annot=True)\nplt.yl...
<|body_start_0|> confusion_matrix = metrics.confusion_matrix(test_labels, labels).astype(np.float32) confusion_matrix = confusion_matrix / confusion_matrix.sum(axis=1)[:, np.newaxis] df_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_names) plt.figure(figsize=(10, 7)...
Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.
ClassificationVisualiser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassificationVisualiser: """Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.""" def plot_confusion_matrix(self, labels, test_labels, class_names, title...
stack_v2_sparse_classes_36k_train_021411
3,314
no_license
[ { "docstring": "Plots a confusion matrix for the given labels. Parameters ---------- labels : array-like Predicted labels from the classifier. test_labels : array-like Ground truth labels. class_names : array-like The names of the classes in the data. title : str Title of the plot and name of the file.", "n...
2
stack_v2_sparse_classes_30k_train_006546
Implement the Python class `ClassificationVisualiser` described below. Class description: Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications. Method signatures and docstrings: - def...
Implement the Python class `ClassificationVisualiser` described below. Class description: Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications. Method signatures and docstrings: - def...
0e95ca353335acdb2f9e15958c59a1074d705441
<|skeleton|> class ClassificationVisualiser: """Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.""" def plot_confusion_matrix(self, labels, test_labels, class_names, title...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassificationVisualiser: """Visualisation helper for the classifiers. Contains functionality for plotting a confusion matrix from predicted and true labels, and a method for visualising the incorrect classifications.""" def plot_confusion_matrix(self, labels, test_labels, class_names, title): ""...
the_stack_v2_python_sparse
action_recognition/classifiers/classification_visualiser.py
CamiloAguilar/openpose-tda-action-recognition
train
0
b21618ed3065593fc20aeb76162cbfd563ac55a7
[ "func = helper.current_loc()\nself.assertTrue(type(func) is dict)\nself.assertTrue(type(func['latitude']) is float)\nself.assertTrue(type(func['longitude']) is float)", "func = helper.yelp_by_id('hackbright-academy-san-francisco')\nself.assertTrue(type(func) is dict)\nself.assertEqual(func['name'], 'Hackbright Ac...
<|body_start_0|> func = helper.current_loc() self.assertTrue(type(func) is dict) self.assertTrue(type(func['latitude']) is float) self.assertTrue(type(func['longitude']) is float) <|end_body_0|> <|body_start_1|> func = helper.yelp_by_id('hackbright-academy-san-francisco') ...
TestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: def test_current_loc(self): """tests lat/long function""" <|body_0|> def test_yelp_by_id(self): """tests that yelp id query works""" <|body_1|> <|end_skeleton|> <|body_start_0|> func = helper.current_loc() self.assertTrue(type(func...
stack_v2_sparse_classes_36k_train_021412
8,665
no_license
[ { "docstring": "tests lat/long function", "name": "test_current_loc", "signature": "def test_current_loc(self)" }, { "docstring": "tests that yelp id query works", "name": "test_yelp_by_id", "signature": "def test_yelp_by_id(self)" } ]
2
stack_v2_sparse_classes_30k_train_015472
Implement the Python class `TestCase` described below. Class description: Implement the TestCase class. Method signatures and docstrings: - def test_current_loc(self): tests lat/long function - def test_yelp_by_id(self): tests that yelp id query works
Implement the Python class `TestCase` described below. Class description: Implement the TestCase class. Method signatures and docstrings: - def test_current_loc(self): tests lat/long function - def test_yelp_by_id(self): tests that yelp id query works <|skeleton|> class TestCase: def test_current_loc(self): ...
3c8b87c0f5dd0d77af9d2c2b85886230b01fd9bd
<|skeleton|> class TestCase: def test_current_loc(self): """tests lat/long function""" <|body_0|> def test_yelp_by_id(self): """tests that yelp id query works""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCase: def test_current_loc(self): """tests lat/long function""" func = helper.current_loc() self.assertTrue(type(func) is dict) self.assertTrue(type(func['latitude']) is float) self.assertTrue(type(func['longitude']) is float) def test_yelp_by_id(self): ...
the_stack_v2_python_sparse
tests.py
Aisling-Dempsey/Haven
train
3
e1e2074cd9c8f90baffffb2d96d4f32b5f4b0646
[ "test_jobposting = JobPosting(title='Postdoctoral Researcher', description='Some description', link='http:/jobs.com/awesomejob', active=True)\ntest_jobposting.save()\nself.assertEqual(test_jobposting.pk, 1)", "test_jobposting = JobPosting(title='Postdoctoral Researcher', description='Some description', link='http...
<|body_start_0|> test_jobposting = JobPosting(title='Postdoctoral Researcher', description='Some description', link='http:/jobs.com/awesomejob', active=True) test_jobposting.save() self.assertEqual(test_jobposting.pk, 1) <|end_body_0|> <|body_start_1|> test_jobposting = JobPosting(title...
Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.
JobPostingModelTests
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobPostingModelTests: """Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.""" def test_create_jobposting_minimal(self): """This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered""" ...
stack_v2_sparse_classes_36k_train_021413
5,452
permissive
[ { "docstring": "This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered", "name": "test_create_jobposting_minimal", "signature": "def test_create_jobposting_minimal(self)" }, { "docstring": "This is a test for creating a new ::class:`JobPosting` ...
3
stack_v2_sparse_classes_30k_train_005741
Implement the Python class `JobPostingModelTests` described below. Class description: Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app. Method signatures and docstrings: - def test_create_jobposting_minimal(self): This is a test for creating a new ::class:`JobPosting` ...
Implement the Python class `JobPostingModelTests` described below. Class description: Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app. Method signatures and docstrings: - def test_create_jobposting_minimal(self): This is a test for creating a new ::class:`JobPosting` ...
d6f6c9c068bbf668c253e5943d9514947023e66d
<|skeleton|> class JobPostingModelTests: """Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.""" def test_create_jobposting_minimal(self): """This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobPostingModelTests: """Tests the model attributes of ::class:`JobPosting` objects contained in the ::mod:`personnel` app.""" def test_create_jobposting_minimal(self): """This is a test for creating a new ::class:`JobPosting` object, with only the minimum fields being entered""" test_job...
the_stack_v2_python_sparse
personnel/tests.py
BridgesLab/Lab-Website
train
0
587fcc5493081aa26787413f58e6f8e5d8782256
[ "adm = ProjektAdministration()\npersons = adm.get_all_persons()\nreturn persons", "userId = request.args.get('id')\nname = request.args.get('name')\nemail = request.args.get('email')\nadm = ProjektAdministration()\nuser = adm.get_person_by_id(userId)\nuser.set_name(name)\nuser.set_email(email)\nadm.update_person_...
<|body_start_0|> adm = ProjektAdministration() persons = adm.get_all_persons() return persons <|end_body_0|> <|body_start_1|> userId = request.args.get('id') name = request.args.get('name') email = request.args.get('email') adm = ProjektAdministration() u...
PersonOperationen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonOperationen: def get(self): """Auslesen aller Personen-Objekte. Sollten keine User-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.""" <|body_0|> def put(self): """Update des User-Objekts.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_021414
29,521
no_license
[ { "docstring": "Auslesen aller Personen-Objekte. Sollten keine User-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.", "name": "get", "signature": "def get(self)" }, { "docstring": "Update des User-Objekts.", "name": "put", "signature": "def put(self)" } ]
2
stack_v2_sparse_classes_30k_train_007841
Implement the Python class `PersonOperationen` described below. Class description: Implement the PersonOperationen class. Method signatures and docstrings: - def get(self): Auslesen aller Personen-Objekte. Sollten keine User-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben. - def put(self): Update des...
Implement the Python class `PersonOperationen` described below. Class description: Implement the PersonOperationen class. Method signatures and docstrings: - def get(self): Auslesen aller Personen-Objekte. Sollten keine User-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben. - def put(self): Update des...
9014f16fed08956bd28216e1373b60139e5caea1
<|skeleton|> class PersonOperationen: def get(self): """Auslesen aller Personen-Objekte. Sollten keine User-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.""" <|body_0|> def put(self): """Update des User-Objekts.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonOperationen: def get(self): """Auslesen aller Personen-Objekte. Sollten keine User-Objekte verfügbar sein, so wird eine leere Sequenz zurückgegeben.""" adm = ProjektAdministration() persons = adm.get_all_persons() return persons def put(self): """Update des U...
the_stack_v2_python_sparse
src/main.py
leanderpeter/university_project_selector
train
3
e35fcfb888c3e8a56b96e620800fa37a345c1777
[ "nums.sort()\nans = set()\nfor i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n t = target - nums[i] - nums[j]\n dic = set()\n for k in range(j + 1, len(nums)):\n diff = t - nums[k]\n if diff in dic:\n ans.add((nums[i], nums[j], diff, nums[k])...
<|body_start_0|> nums.sort() ans = set() for i in range(len(nums)): for j in range(i + 1, len(nums)): t = target - nums[i] - nums[j] dic = set() for k in range(j + 1, len(nums)): diff = t - nums[k] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_021415
2,270
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" nums.sort() ans = set() for i in range(len(nums)): for j in range(i + 1, len(nums)): t = target - nums[i] - nums[j] dic =...
the_stack_v2_python_sparse
medium/twopointer/test_18_4Sum.py
wuxu1019/leetcode_sophia
train
1
c2dad5c69981fc815e3c0878c4b852f0c3da5a04
[ "f = self.dtype_f(self.init)\nself.AMat.mult(u, f.impl)\nfa = self.init.getVecArray(f.expl)\nxa = self.init.getVecArray(u)\nfor i in range(self.xs, self.xe):\n for j in range(self.ys, self.ye):\n fa[i, j, 0] = -xa[i, j, 0] * xa[i, j, 1] ** 2 + self.A * (1 - xa[i, j, 0])\n fa[i, j, 1] = xa[i, j, 0] ...
<|body_start_0|> f = self.dtype_f(self.init) self.AMat.mult(u, f.impl) fa = self.init.getVecArray(f.expl) xa = self.init.getVecArray(u) for i in range(self.xs, self.xe): for j in range(self.ys, self.ye): fa[i, j, 0] = -xa[i, j, 0] * xa[i, j, 1] ** 2 + ...
Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc
petsc_grayscott_semiimplicit
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class petsc_grayscott_semiimplicit: """Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the...
stack_v2_sparse_classes_36k_train_021416
20,605
permissive
[ { "docstring": "Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RHS", "name": "eval_f", "signature": "def eval_f(self, u, t)" }, { "docstring": "Linear solver for (I-factor*A)u = rhs Args: rhs (dtype_f): right-hand side for the linear s...
2
null
Implement the Python class `petsc_grayscott_semiimplicit` described below. Class description: Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the RHS Args: u (dtype_u): cur...
Implement the Python class `petsc_grayscott_semiimplicit` described below. Class description: Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the RHS Args: u (dtype_u): cur...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class petsc_grayscott_semiimplicit: """Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class petsc_grayscott_semiimplicit: """Problem class implementing the semi-implicit 2D Gray-Scott reaction-diffusion equation with periodic BC and PETSc""" def eval_f(self, u, t): """Routine to evaluate the RHS Args: u (dtype_u): current values t (float): current time Returns: dtype_f: the RHS""" ...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/GrayScott_2D_PETSc_periodic.py
Parallel-in-Time/pySDC
train
30
a840284b1be36201f2559685cd4b9e180feaa469
[ "for event in pygame.event.get():\n if event.type == pygame.QUIT:\n return True\n elif event.type == pygame.KEYUP:\n if self._is_quit_shortcut(event.key):\n return True\n elif event.key == K_b:\n self.vehicle_control_manual_override = not self.vehicle_control_manual_...
<|body_start_0|> for event in pygame.event.get(): if event.type == pygame.QUIT: return True elif event.type == pygame.KEYUP: if self._is_quit_shortcut(event.key): return True elif event.key == K_b: se...
Handle input events
KeyboardControl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyboardControl: """Handle input events""" def parse_events(self, clock): """parse an input event""" <|body_0|> def _parse_vehicle_keys(self, keys, milliseconds): """parse key events""" <|body_1|> <|end_skeleton|> <|body_start_0|> for event in p...
stack_v2_sparse_classes_36k_train_021417
9,713
permissive
[ { "docstring": "parse an input event", "name": "parse_events", "signature": "def parse_events(self, clock)" }, { "docstring": "parse key events", "name": "_parse_vehicle_keys", "signature": "def _parse_vehicle_keys(self, keys, milliseconds)" } ]
2
stack_v2_sparse_classes_30k_val_000721
Implement the Python class `KeyboardControl` described below. Class description: Handle input events Method signatures and docstrings: - def parse_events(self, clock): parse an input event - def _parse_vehicle_keys(self, keys, milliseconds): parse key events
Implement the Python class `KeyboardControl` described below. Class description: Handle input events Method signatures and docstrings: - def parse_events(self, clock): parse an input event - def _parse_vehicle_keys(self, keys, milliseconds): parse key events <|skeleton|> class KeyboardControl: """Handle input ev...
020704a3b7087bc426f5ff97655c7e676c8b01bf
<|skeleton|> class KeyboardControl: """Handle input events""" def parse_events(self, clock): """parse an input event""" <|body_0|> def _parse_vehicle_keys(self, keys, milliseconds): """parse key events""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeyboardControl: """Handle input events""" def parse_events(self, clock): """parse an input event""" for event in pygame.event.get(): if event.type == pygame.QUIT: return True elif event.type == pygame.KEYUP: if self._is_quit_shortcu...
the_stack_v2_python_sparse
telecarla_manual_control/src/telecarla_manual_control_ctrl.py
Intuitio-OU/telecarla
train
0
bb079f4259e17cd96abdf91270557d437c874948
[ "seconds = int(3600 * hours)\ndays, seconds = divmod(seconds, 86400)\nhours, seconds = divmod(seconds, 3600)\nminutes, seconds = divmod(seconds, 60)\nif days > 0:\n return '%dd %dh %dm' % (days, hours, minutes)\nif hours > 0:\n return '%dh %dm' % (hours, minutes)\nreturn '%dm' % minutes", "if len(period) !=...
<|body_start_0|> seconds = int(3600 * hours) days, seconds = divmod(seconds, 86400) hours, seconds = divmod(seconds, 3600) minutes, seconds = divmod(seconds, 60) if days > 0: return '%dd %dh %dm' % (days, hours, minutes) if hours > 0: return '%dh %...
Static methods to make the HistoryStatsSensor code lighter.
HistoryStatsHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistoryStatsHelper: """Static methods to make the HistoryStatsSensor code lighter.""" def pretty_duration(hours): """Format a duration in days, hours, minutes, seconds.""" <|body_0|> def pretty_ratio(value, period): """Format the ratio of value / period duration....
stack_v2_sparse_classes_36k_train_021418
11,604
permissive
[ { "docstring": "Format a duration in days, hours, minutes, seconds.", "name": "pretty_duration", "signature": "def pretty_duration(hours)" }, { "docstring": "Format the ratio of value / period duration.", "name": "pretty_ratio", "signature": "def pretty_ratio(value, period)" }, { ...
3
stack_v2_sparse_classes_30k_train_006325
Implement the Python class `HistoryStatsHelper` described below. Class description: Static methods to make the HistoryStatsSensor code lighter. Method signatures and docstrings: - def pretty_duration(hours): Format a duration in days, hours, minutes, seconds. - def pretty_ratio(value, period): Format the ratio of val...
Implement the Python class `HistoryStatsHelper` described below. Class description: Static methods to make the HistoryStatsSensor code lighter. Method signatures and docstrings: - def pretty_duration(hours): Format a duration in days, hours, minutes, seconds. - def pretty_ratio(value, period): Format the ratio of val...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class HistoryStatsHelper: """Static methods to make the HistoryStatsSensor code lighter.""" def pretty_duration(hours): """Format a duration in days, hours, minutes, seconds.""" <|body_0|> def pretty_ratio(value, period): """Format the ratio of value / period duration....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HistoryStatsHelper: """Static methods to make the HistoryStatsSensor code lighter.""" def pretty_duration(hours): """Format a duration in days, hours, minutes, seconds.""" seconds = int(3600 * hours) days, seconds = divmod(seconds, 86400) hours, seconds = divmod(seconds, 3...
the_stack_v2_python_sparse
homeassistant/components/history_stats/sensor.py
BenWoodford/home-assistant
train
11
76b32fa7c5391276630065e732f3ea6cd35f34c3
[ "end = self.end\nu = Mi32SlidingWindow()\nu.ADDR_WIDTH = end.ADDR_WIDTH\nu.DATA_WIDTH = end.DATA_WIDTH\nu.WINDOW_SIZE = window_size\nu.M_ADDR_WIDTH = new_addr_width\nsetattr(self.parent, self._findSuitableName('mi32SlidingWindow'), u)\nself._propagateClkRstn(u)\nu.s(self.end)\nself.lastComp = u\nself.end = u.m\nret...
<|body_start_0|> end = self.end u = Mi32SlidingWindow() u.ADDR_WIDTH = end.ADDR_WIDTH u.DATA_WIDTH = end.DATA_WIDTH u.WINDOW_SIZE = window_size u.M_ADDR_WIDTH = new_addr_width setattr(self.parent, self._findSuitableName('mi32SlidingWindow'), u) self._propa...
Mi32Builder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mi32Builder: def sliding_window(self, window_size: int, new_addr_width: int): """Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space""" <|body_0|> def from_axi(cls, parent, axi, name=None): """convertor A...
stack_v2_sparse_classes_36k_train_021419
2,536
permissive
[ { "docstring": "Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space", "name": "sliding_window", "signature": "def sliding_window(self, window_size: int, new_addr_width: int)" }, { "docstring": "convertor AXI/AxiLite -> Mi32", "na...
3
stack_v2_sparse_classes_30k_train_016755
Implement the Python class `Mi32Builder` described below. Class description: Implement the Mi32Builder class. Method signatures and docstrings: - def sliding_window(self, window_size: int, new_addr_width: int): Instanciate a sliding window with an offset register which allows to virtually extend the addressable memor...
Implement the Python class `Mi32Builder` described below. Class description: Implement the Mi32Builder class. Method signatures and docstrings: - def sliding_window(self, window_size: int, new_addr_width: int): Instanciate a sliding window with an offset register which allows to virtually extend the addressable memor...
4c1d54c7b15929032ad2ba984bf48b45f3549c49
<|skeleton|> class Mi32Builder: def sliding_window(self, window_size: int, new_addr_width: int): """Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space""" <|body_0|> def from_axi(cls, parent, axi, name=None): """convertor A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mi32Builder: def sliding_window(self, window_size: int, new_addr_width: int): """Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space""" end = self.end u = Mi32SlidingWindow() u.ADDR_WIDTH = end.ADDR_WIDTH u....
the_stack_v2_python_sparse
hwtLib/cesnet/mi32/builder.py
Nic30/hwtLib
train
36
e0e78dbfe4fd009bfd60945323fdb6255f4c53fb
[ "self._header_state = {}\nheader_key_list = DEFAULT_HEADER_KEY_LIST\nfor header_key in header_key_list:\n self._header_state[header_key] = None\nself._metadata_extracted = False\nif DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT in config:\n particle_classes_dict = config.get(DataSetDriverConfigKeys.PARTICLE_C...
<|body_start_0|> self._header_state = {} header_key_list = DEFAULT_HEADER_KEY_LIST for header_key in header_key_list: self._header_state[header_key] = None self._metadata_extracted = False if DataSetDriverConfigKeys.PARTICLE_CLASSES_DICT in config: particl...
NutnrJCsppParser
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NutnrJCsppParser: def __init__(self, config, stream_handle, exception_callback): """This the constructor which instantiates the NutnrJCsppParser""" <|body_0|> def _process_data_match(self, data_match): """This method processes a data match. It will extract a metadata...
stack_v2_sparse_classes_36k_train_021420
17,304
permissive
[ { "docstring": "This the constructor which instantiates the NutnrJCsppParser", "name": "__init__", "signature": "def __init__(self, config, stream_handle, exception_callback)" }, { "docstring": "This method processes a data match. It will extract a metadata particle and insert it into the record...
3
null
Implement the Python class `NutnrJCsppParser` described below. Class description: Implement the NutnrJCsppParser class. Method signatures and docstrings: - def __init__(self, config, stream_handle, exception_callback): This the constructor which instantiates the NutnrJCsppParser - def _process_data_match(self, data_m...
Implement the Python class `NutnrJCsppParser` described below. Class description: Implement the NutnrJCsppParser class. Method signatures and docstrings: - def __init__(self, config, stream_handle, exception_callback): This the constructor which instantiates the NutnrJCsppParser - def _process_data_match(self, data_m...
bdbf01f5614e7188ce19596704794466e5683b30
<|skeleton|> class NutnrJCsppParser: def __init__(self, config, stream_handle, exception_callback): """This the constructor which instantiates the NutnrJCsppParser""" <|body_0|> def _process_data_match(self, data_match): """This method processes a data match. It will extract a metadata...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NutnrJCsppParser: def __init__(self, config, stream_handle, exception_callback): """This the constructor which instantiates the NutnrJCsppParser""" self._header_state = {} header_key_list = DEFAULT_HEADER_KEY_LIST for header_key in header_key_list: self._header_stat...
the_stack_v2_python_sparse
mi/dataset/parser/nutnr_j_cspp.py
oceanobservatories/mi-instrument
train
1
70f33b4ce9e669293dfb6c0a599db2a964ee4677
[ "idx = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x\nidy = cuda.blockIdx.y * cuda.blockDim.y + cuda.threadIdx.y\nindex = idx * size + idy\nif idx < size and idy < size:\n if idx > i:\n mul = A[idx * size + i] / A[i * size + i]\n if idy >= i:\n A[index] -= A[i * size + idy] * mul\...
<|body_start_0|> idx = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x idy = cuda.blockIdx.y * cuda.blockDim.y + cuda.threadIdx.y index = idx * size + idy if idx < size and idy < size: if idx > i: mul = A[idx * size + i] / A[i * size + i] ...
GuassianLUDecomposition
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuassianLUDecomposition: def gaussian_lu_decomposition(A, L, size, i): """Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which...
stack_v2_sparse_classes_36k_train_021421
4,828
no_license
[ { "docstring": "Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which all threads are performing row operations. @return None", "name": "gaussian_l...
6
stack_v2_sparse_classes_30k_train_012757
Implement the Python class `GuassianLUDecomposition` described below. Class description: Implement the GuassianLUDecomposition class. Method signatures and docstrings: - def gaussian_lu_decomposition(A, L, size, i): Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the...
Implement the Python class `GuassianLUDecomposition` described below. Class description: Implement the GuassianLUDecomposition class. Method signatures and docstrings: - def gaussian_lu_decomposition(A, L, size, i): Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the...
b2b89a18260c25134d50c37a4fbb48981de79218
<|skeleton|> class GuassianLUDecomposition: def gaussian_lu_decomposition(A, L, size, i): """Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GuassianLUDecomposition: def gaussian_lu_decomposition(A, L, size, i): """Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which all threads a...
the_stack_v2_python_sparse
project/lu_decomposition/gaussian_lu_decomposition.py
tllano11/Numerical-Methods
train
3
28d03ac4162639a97cb6ecfd0f3ae095d3b5bf29
[ "num_train_examples = 1281167\nnum_validation_examples = int(num_train_examples * validation_percent)\nnum_train_examples -= num_validation_examples\nsuper(ImageNetDataset, self).__init__(name='imagenet', num_train_examples=num_train_examples, num_validation_examples=num_validation_examples, num_test_examples=50000...
<|body_start_0|> num_train_examples = 1281167 num_validation_examples = int(num_train_examples * validation_percent) num_train_examples -= num_validation_examples super(ImageNetDataset, self).__init__(name='imagenet', num_train_examples=num_train_examples, num_validation_examples=num_val...
ImageNet dataset builder class.
ImageNetDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageNetDataset: """ImageNet dataset builder class.""" def __init__(self, batch_size: int, eval_batch_size: int, validation_percent: float=0.0, shuffle_buffer_size: int=None, num_parallel_parser_calls: int=64, data_dir: Optional[str]=None, **unused_kwargs: Dict[str, Any]): """Create ...
stack_v2_sparse_classes_36k_train_021422
4,922
permissive
[ { "docstring": "Create an ImageNet tf.data.Dataset builder. Args: batch_size: the training batch size. eval_batch_size: the validation and test batch size. validation_percent: the percent of the training set to use as a validation set. shuffle_buffer_size: the number of example to use in the shuffle buffer for ...
3
stack_v2_sparse_classes_30k_train_019704
Implement the Python class `ImageNetDataset` described below. Class description: ImageNet dataset builder class. Method signatures and docstrings: - def __init__(self, batch_size: int, eval_batch_size: int, validation_percent: float=0.0, shuffle_buffer_size: int=None, num_parallel_parser_calls: int=64, data_dir: Opti...
Implement the Python class `ImageNetDataset` described below. Class description: ImageNet dataset builder class. Method signatures and docstrings: - def __init__(self, batch_size: int, eval_batch_size: int, validation_percent: float=0.0, shuffle_buffer_size: int=None, num_parallel_parser_calls: int=64, data_dir: Opti...
88f78028fdfa6ed7a59eb79b549b14f328da5ba4
<|skeleton|> class ImageNetDataset: """ImageNet dataset builder class.""" def __init__(self, batch_size: int, eval_batch_size: int, validation_percent: float=0.0, shuffle_buffer_size: int=None, num_parallel_parser_calls: int=64, data_dir: Optional[str]=None, **unused_kwargs: Dict[str, Any]): """Create ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageNetDataset: """ImageNet dataset builder class.""" def __init__(self, batch_size: int, eval_batch_size: int, validation_percent: float=0.0, shuffle_buffer_size: int=None, num_parallel_parser_calls: int=64, data_dir: Optional[str]=None, **unused_kwargs: Dict[str, Any]): """Create an ImageNet t...
the_stack_v2_python_sparse
uncertainty_baselines/datasets/imagenet.py
kiminh/uncertainty-baselines
train
1
a8825179e1a07d5aa485bd6c8eba0f3b8f4488b4
[ "rospy.loginfo('Moving %s to handover position.' % limb)\nif limb == 'left':\n handover_position_joints = {'left_w0': 0.47016511148687934, 'left_w1': -0.42798063982003043, 'left_w2': 0.18676216092504913, 'left_e0': -1.1616069516262295, 'left_e1': 1.889097340280887, 'left_s0': 0.1499466220157992, 'left_s1': -0.91...
<|body_start_0|> rospy.loginfo('Moving %s to handover position.' % limb) if limb == 'left': handover_position_joints = {'left_w0': 0.47016511148687934, 'left_w1': -0.42798063982003043, 'left_w2': 0.18676216092504913, 'left_e0': -1.1616069516262295, 'left_e1': 1.889097340280887, 'left_s0': 0....
OfferingObjectServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferingObjectServer: def move_to_handover(self, baxter_arm, limb): """Moves specified limb to the handover position. :param baxter_arm: arm to move :param limb: which arm, 'right' or 'left :return:""" <|body_0|> def callback(self, request=None): """Call back for han...
stack_v2_sparse_classes_36k_train_021423
3,257
permissive
[ { "docstring": "Moves specified limb to the handover position. :param baxter_arm: arm to move :param limb: which arm, 'right' or 'left :return:", "name": "move_to_handover", "signature": "def move_to_handover(self, baxter_arm, limb)" }, { "docstring": "Call back for handover service. :param requ...
2
stack_v2_sparse_classes_30k_train_000744
Implement the Python class `OfferingObjectServer` described below. Class description: Implement the OfferingObjectServer class. Method signatures and docstrings: - def move_to_handover(self, baxter_arm, limb): Moves specified limb to the handover position. :param baxter_arm: arm to move :param limb: which arm, 'right...
Implement the Python class `OfferingObjectServer` described below. Class description: Implement the OfferingObjectServer class. Method signatures and docstrings: - def move_to_handover(self, baxter_arm, limb): Moves specified limb to the handover position. :param baxter_arm: arm to move :param limb: which arm, 'right...
1f9d05b7232cb9e76eff975e5ef1c8bf3fb5cde6
<|skeleton|> class OfferingObjectServer: def move_to_handover(self, baxter_arm, limb): """Moves specified limb to the handover position. :param baxter_arm: arm to move :param limb: which arm, 'right' or 'left :return:""" <|body_0|> def callback(self, request=None): """Call back for han...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfferingObjectServer: def move_to_handover(self, baxter_arm, limb): """Moves specified limb to the handover position. :param baxter_arm: arm to move :param limb: which arm, 'right' or 'left :return:""" rospy.loginfo('Moving %s to handover position.' % limb) if limb == 'left': ...
the_stack_v2_python_sparse
grasping/src/offering_object_server.py
Hankfirst/de_niro
train
1
121bdc61beba5b5d852de631dbf69fd2a25ed35d
[ "jsonpath = pathlib.Path(jsonpath)\ndata = json.load(jsonpath.open('r', encoding='utf-8'), object_pairs_hook=OrderedDict)\ncategory = ''\nproduct = data['product']\ntotal_review = data['total_review']\ntotal_text = data['total_text']\ntexts = tuple((TextWithAttrAnnotation.from_json_content(text) for text in data['t...
<|body_start_0|> jsonpath = pathlib.Path(jsonpath) data = json.load(jsonpath.open('r', encoding='utf-8'), object_pairs_hook=OrderedDict) category = '' product = data['product'] total_review = data['total_review'] total_text = data['total_text'] texts = tuple((Text...
属性抽出の評価をするためのデータ Attributes: category (str): 商品カテゴリ product (str): 商品名 total_review (int): 総レビュー数 total_text (int): 総文数 texts (Tuple[TextWithAttrAnnotation, ...]): 正解データ一覧
AttrEvaluationData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttrEvaluationData: """属性抽出の評価をするためのデータ Attributes: category (str): 商品カテゴリ product (str): 商品名 total_review (int): 総レビュー数 total_text (int): 総文数 texts (Tuple[TextWithAttrAnnotation, ...]): 正解データ一覧""" def load(cls, jsonpath: Union[str, pathlib.Path]): """JSON ファイルからインスタンス化 Args: jsonpat...
stack_v2_sparse_classes_36k_train_021424
3,444
no_license
[ { "docstring": "JSON ファイルからインスタンス化 Args: jsonpath (Union[str, pathlib.Path]): JSON ファイルのパス Returns: AttrEvaluationDataインスタンス", "name": "load", "signature": "def load(cls, jsonpath: Union[str, pathlib.Path])" }, { "docstring": "JSON 形式で保存する Args: jsonpath (Union[str, pathlib.Path]): 保存ファイルパス", ...
2
null
Implement the Python class `AttrEvaluationData` described below. Class description: 属性抽出の評価をするためのデータ Attributes: category (str): 商品カテゴリ product (str): 商品名 total_review (int): 総レビュー数 total_text (int): 総文数 texts (Tuple[TextWithAttrAnnotation, ...]): 正解データ一覧 Method signatures and docstrings: - def load(cls, jsonpath: Un...
Implement the Python class `AttrEvaluationData` described below. Class description: 属性抽出の評価をするためのデータ Attributes: category (str): 商品カテゴリ product (str): 商品名 total_review (int): 総レビュー数 total_text (int): 総文数 texts (Tuple[TextWithAttrAnnotation, ...]): 正解データ一覧 Method signatures and docstrings: - def load(cls, jsonpath: Un...
a4c6334b779a94814b7798a0fbfe9a148bf18d3a
<|skeleton|> class AttrEvaluationData: """属性抽出の評価をするためのデータ Attributes: category (str): 商品カテゴリ product (str): 商品名 total_review (int): 総レビュー数 total_text (int): 総文数 texts (Tuple[TextWithAttrAnnotation, ...]): 正解データ一覧""" def load(cls, jsonpath: Union[str, pathlib.Path]): """JSON ファイルからインスタンス化 Args: jsonpat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttrEvaluationData: """属性抽出の評価をするためのデータ Attributes: category (str): 商品カテゴリ product (str): 商品名 total_review (int): 総レビュー数 total_text (int): 総文数 texts (Tuple[TextWithAttrAnnotation, ...]): 正解データ一覧""" def load(cls, jsonpath: Union[str, pathlib.Path]): """JSON ファイルからインスタンス化 Args: jsonpath (Union[str,...
the_stack_v2_python_sparse
src/review_research/evaluation/attr_evaluation_data.py
S38knt-ks/ReviewResearch
train
0
119f5eea3ac45ebb4bf557b1d9a637a810a459c9
[ "parameters = list(inspect.signature(udf).parameters.keys())\ninput_parameters = self._get_input_params(udf)\nif len(input_parameters) < 1:\n raise ValueError('feature_processor expects at least 1 input parameter.')\nnum_data_sources = len(fp_config.inputs)\nif len(input_parameters) != num_data_sources:\n rai...
<|body_start_0|> parameters = list(inspect.signature(udf).parameters.keys()) input_parameters = self._get_input_params(udf) if len(input_parameters) < 1: raise ValueError('feature_processor expects at least 1 input parameter.') num_data_sources = len(fp_config.inputs) ...
A validator for PySpark UDF signatures.
SparkUDFSignatureValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparkUDFSignatureValidator: """A validator for PySpark UDF signatures.""" def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: """Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): ...
stack_v2_sparse_classes_36k_train_021425
7,056
permissive
[ { "docstring": "Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): The feature_processor wrapped user function. fp_config (FeatureProcessorConfig): The configuration for the feature_processor. Raises (ValueError): raises ValueError when any of ...
2
stack_v2_sparse_classes_30k_train_002980
Implement the Python class `SparkUDFSignatureValidator` described below. Class description: A validator for PySpark UDF signatures. Method signatures and docstrings: - def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: Validate the signature of the UDF based on the configurations ...
Implement the Python class `SparkUDFSignatureValidator` described below. Class description: A validator for PySpark UDF signatures. Method signatures and docstrings: - def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: Validate the signature of the UDF based on the configurations ...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class SparkUDFSignatureValidator: """A validator for PySpark UDF signatures.""" def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: """Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparkUDFSignatureValidator: """A validator for PySpark UDF signatures.""" def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: """Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): The feature_p...
the_stack_v2_python_sparse
src/sagemaker/feature_store/feature_processor/_validation.py
aws/sagemaker-python-sdk
train
2,050
5387360372fa674be695cc9aa2ef1c0cb4c8a047
[ "seq1 = 'AAAA'\nres = geneutil.sequenceEntropy(seq1)\nself.assertAlmostEqual(res.entropy, 0.0)\nself.assertTrue(res.counts['A'] == 4)", "seq1 = 'ACDEFGHIKLMNPQRSTVWY'\nres = geneutil.sequenceEntropy(seq1, base=20)\nself.assertAlmostEqual(res.entropy, 1.0)\nfor aa in seq1:\n self.assertTrue(res.counts[aa] == 1)...
<|body_start_0|> seq1 = 'AAAA' res = geneutil.sequenceEntropy(seq1) self.assertAlmostEqual(res.entropy, 0.0) self.assertTrue(res.counts['A'] == 4) <|end_body_0|> <|body_start_1|> seq1 = 'ACDEFGHIKLMNPQRSTVWY' res = geneutil.sequenceEntropy(seq1, base=20) self.ass...
test004
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test004: def test_entropy(self): """Entropy of a homopolymer""" <|body_0|> def test_max_entropy(self): """Maximum possible entropy""" <|body_1|> <|end_skeleton|> <|body_start_0|> seq1 = 'AAAA' res = geneutil.sequenceEntropy(seq1) sel...
stack_v2_sparse_classes_36k_train_021426
2,692
no_license
[ { "docstring": "Entropy of a homopolymer", "name": "test_entropy", "signature": "def test_entropy(self)" }, { "docstring": "Maximum possible entropy", "name": "test_max_entropy", "signature": "def test_max_entropy(self)" } ]
2
stack_v2_sparse_classes_30k_train_015463
Implement the Python class `test004` described below. Class description: Implement the test004 class. Method signatures and docstrings: - def test_entropy(self): Entropy of a homopolymer - def test_max_entropy(self): Maximum possible entropy
Implement the Python class `test004` described below. Class description: Implement the test004 class. Method signatures and docstrings: - def test_entropy(self): Entropy of a homopolymer - def test_max_entropy(self): Maximum possible entropy <|skeleton|> class test004: def test_entropy(self): """Entropy...
d7ddd2b585a841c6d986974a24a53e4d1abe71ba
<|skeleton|> class test004: def test_entropy(self): """Entropy of a homopolymer""" <|body_0|> def test_max_entropy(self): """Maximum possible entropy""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test004: def test_entropy(self): """Entropy of a homopolymer""" seq1 = 'AAAA' res = geneutil.sequenceEntropy(seq1) self.assertAlmostEqual(res.entropy, 0.0) self.assertTrue(res.counts['A'] == 4) def test_max_entropy(self): """Maximum possible entropy""" ...
the_stack_v2_python_sparse
src/geneutil_test.py
dad/base
train
0
99886541ee5d86ec350d9f5ec2426543c98cb185
[ "self.csv_name = f'{self.csv_dir}/{os.path.basename(self.path)}.csv'\nself._convert_dump_to_csv(bgpscanner)\nutils.csv_to_db(MRT_Announcements_Table, self.csv_name)\nutils.delete_paths([self.path, self.csv_name])\nutils.incriment_bar(logging.root.level)", "args = self._bgpscanner_args() if bgpscanner else self._b...
<|body_start_0|> self.csv_name = f'{self.csv_dir}/{os.path.basename(self.path)}.csv' self._convert_dump_to_csv(bgpscanner) utils.csv_to_db(MRT_Announcements_Table, self.csv_name) utils.delete_paths([self.path, self.csv_name]) utils.incriment_bar(logging.root.level) <|end_body_0|>...
Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README.
MRT_File
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MRT_File: """Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README.""" def parse_file(self, bgpscanner=True): """Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which...
stack_v2_sparse_classes_36k_train_021427
8,323
permissive
[ { "docstring": "Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which is faster, but ignores malformed announcements. While these malformed announcements are few and far between, bgpdump does not ignore them and should be used for full d...
4
stack_v2_sparse_classes_30k_train_020496
Implement the Python class `MRT_File` described below. Class description: Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README. Method signatures and docstrings: - def parse_file(self, bgpscanner=True): Parses a downloaded file and inserts it into the database if bgpscanner...
Implement the Python class `MRT_File` described below. Class description: Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README. Method signatures and docstrings: - def parse_file(self, bgpscanner=True): Parses a downloaded file and inserts it into the database if bgpscanner...
91c92584b31bd128d818c7fee86c738367c0712e
<|skeleton|> class MRT_File: """Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README.""" def parse_file(self, bgpscanner=True): """Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MRT_File: """Converts MRT files to CSVs and then inserts them into a database. In depth explanation in README.""" def parse_file(self, bgpscanner=True): """Parses a downloaded file and inserts it into the database if bgpscanner is set to True, bgpscanner is used to parser files which is faster, b...
the_stack_v2_python_sparse
lib_bgp_data/collectors/mrt/mrt_base/mrt_file.py
jfuruness/lib_bgp_data
train
16
856601f7348d491c89af97d715f7e406504b0d1f
[ "tmp_file_name = 'test.json'\ntmp_dir_name = tempfile.gettempdir()\njson_file_path = tmp_dir_name + '/' + tmp_file_name\nwith open(json_file_path, 'w') as f:\n f.write(policy_json.strip())\ngrd_text = '\\n <grit base_dir=\".\" latest_public_release=\"0\" current_release=\"1\" source_lang_id=\"en\">\\n <r...
<|body_start_0|> tmp_file_name = 'test.json' tmp_dir_name = tempfile.gettempdir() json_file_path = tmp_dir_name + '/' + tmp_file_name with open(json_file_path, 'w') as f: f.write(policy_json.strip()) grd_text = '\n <grit base_dir="." latest_public_release="0" curre...
Common class for unittesting writers.
WriterUnittestCommon
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" <|body_0|> def GetOutput(self...
stack_v2_sparse_classes_36k_train_021428
2,618
permissive
[ { "docstring": "Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.", "name": "PrepareTest", "signature": "def PrepareTest(self, policy_json)" }, { "docstring": "Generates an output of a writer. Args: grd: The root...
2
stack_v2_sparse_classes_30k_train_018655
Implement the Python class `WriterUnittestCommon` described below. Class description: Common class for unittesting writers. Method signatures and docstrings: - def PrepareTest(self, policy_json): Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in J...
Implement the Python class `WriterUnittestCommon` described below. Class description: Common class for unittesting writers. Method signatures and docstrings: - def PrepareTest(self, policy_json): Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in J...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" <|body_0|> def GetOutput(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WriterUnittestCommon: """Common class for unittesting writers.""" def PrepareTest(self, policy_json): """Prepares and parses a grit tree along with a data structure of policies. Args: policy_json: The policy data structure in JSON format.""" tmp_file_name = 'test.json' tmp_dir_nam...
the_stack_v2_python_sparse
tools/grit/grit/format/policy_templates/writers/writer_unittest_common.py
metux/chromium-suckless
train
5
459ff43098b6cdea39fe1f50a99b4a6cc52e7072
[ "retval = dict(default_)\nretval['keyword'].append(value)\nreturn [retval]", "retval = dict(default_)\nretval['date'] = value\nreturn [retval]", "retval = dict(default_)\nretval['id'] = value\nreturn [retval]" ]
<|body_start_0|> retval = dict(default_) retval['keyword'].append(value) return [retval] <|end_body_0|> <|body_start_1|> retval = dict(default_) retval['date'] = value return [retval] <|end_body_1|> <|body_start_2|> retval = dict(default_) retval['id'] =...
Dummy engine class, returns a dict object for certain methods called
Dummy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dummy: """Dummy engine class, returns a dict object for certain methods called""" def keyword(self, value, num, request): """Returns at most num dict objects, as an iterable, with keyword as a keyword in the dict.""" <|body_0|> def date(self, value, num, request): ...
stack_v2_sparse_classes_36k_train_021429
1,206
permissive
[ { "docstring": "Returns at most num dict objects, as an iterable, with keyword as a keyword in the dict.", "name": "keyword", "signature": "def keyword(self, value, num, request)" }, { "docstring": "Returns at most num dict objects, as an iterable, with all dict objects matching the date passed"...
3
stack_v2_sparse_classes_30k_train_005454
Implement the Python class `Dummy` described below. Class description: Dummy engine class, returns a dict object for certain methods called Method signatures and docstrings: - def keyword(self, value, num, request): Returns at most num dict objects, as an iterable, with keyword as a keyword in the dict. - def date(se...
Implement the Python class `Dummy` described below. Class description: Dummy engine class, returns a dict object for certain methods called Method signatures and docstrings: - def keyword(self, value, num, request): Returns at most num dict objects, as an iterable, with keyword as a keyword in the dict. - def date(se...
1d8105e91c3fac53e65882af0ba01bbb7186f424
<|skeleton|> class Dummy: """Dummy engine class, returns a dict object for certain methods called""" def keyword(self, value, num, request): """Returns at most num dict objects, as an iterable, with keyword as a keyword in the dict.""" <|body_0|> def date(self, value, num, request): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dummy: """Dummy engine class, returns a dict object for certain methods called""" def keyword(self, value, num, request): """Returns at most num dict objects, as an iterable, with keyword as a keyword in the dict.""" retval = dict(default_) retval['keyword'].append(value) ...
the_stack_v2_python_sparse
apibert/engines/dummy.py
ofu/brisbert
train
0
bd23cfdf47d4f71b9032c2adc5026dc142d0844f
[ "definition_node = ElementTree.Element('definition')\ndefinition_node.attrib['class'] = 'org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition'\ndefinition_node.attrib['plugin'] = 'workflow-cps'\ndefinition_node.append(scm.node)\nscript_node = ElementTree.Element('scriptPath')\nscript_node.text = script_path\ndef...
<|body_start_0|> definition_node = ElementTree.Element('definition') definition_node.attrib['class'] = 'org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition' definition_node.attrib['plugin'] = 'workflow-cps' definition_node.append(scm.node) script_node = ElementTree.Element('s...
Object that manages the config.xml for a pipeline job
PipelineXML
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineXML: """Object that manages the config.xml for a pipeline job""" def scm_definition(self, scm, script_path, lightweight): """Defines the Pipeline groovy script used by this job from files stored in a source code repository Args: scm (XMLPlugin): PyJen object defining the sour...
stack_v2_sparse_classes_36k_train_021430
6,850
permissive
[ { "docstring": "Defines the Pipeline groovy script used by this job from files stored in a source code repository Args: scm (XMLPlugin): PyJen object defining the source code repository to use script_path (str): Path within the repository where the groovy script to be run is found. lightweight (bool): Set to Tr...
4
stack_v2_sparse_classes_30k_val_000618
Implement the Python class `PipelineXML` described below. Class description: Object that manages the config.xml for a pipeline job Method signatures and docstrings: - def scm_definition(self, scm, script_path, lightweight): Defines the Pipeline groovy script used by this job from files stored in a source code reposit...
Implement the Python class `PipelineXML` described below. Class description: Object that manages the config.xml for a pipeline job Method signatures and docstrings: - def scm_definition(self, scm, script_path, lightweight): Defines the Pipeline groovy script used by this job from files stored in a source code reposit...
6ada1209b1e88f4a8aa7bde22f874168f1592e0e
<|skeleton|> class PipelineXML: """Object that manages the config.xml for a pipeline job""" def scm_definition(self, scm, script_path, lightweight): """Defines the Pipeline groovy script used by this job from files stored in a source code repository Args: scm (XMLPlugin): PyJen object defining the sour...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PipelineXML: """Object that manages the config.xml for a pipeline job""" def scm_definition(self, scm, script_path, lightweight): """Defines the Pipeline groovy script used by this job from files stored in a source code repository Args: scm (XMLPlugin): PyJen object defining the source code repos...
the_stack_v2_python_sparse
src/pyjen/plugins/pipelinejob.py
TheFriendlyCoder/pyjen
train
6
e8d7ed4dbab440e99cde9eb793498261f4249ad1
[ "if not is_exe(exe_path):\n msg = '{0} is not an executable'.format(exe_path)\n raise NotExecutableError(msg)\nself._exe_path = exe_path", "self.__build_cmd(infnames, outdir)\nif not os.path.exists(self._outdirname):\n os.makedirs(self._outdirname)\npipe = subprocess.run(self._cmd, shell=True, stdout=sub...
<|body_start_0|> if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path <|end_body_0|> <|body_start_1|> self.__build_cmd(infnames, outdir) if not os.path.exists(self._outdirname): ...
Class for working with FastQC
FastQC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastQC: """Class for working with FastQC""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, infnames, outdir, dry_run=False): """Run fastqc on the passed file""" <|body_1|> def __build_cmd(self, in...
stack_v2_sparse_classes_36k_train_021431
2,209
permissive
[ { "docstring": "Instantiate with location of executable", "name": "__init__", "signature": "def __init__(self, exe_path)" }, { "docstring": "Run fastqc on the passed file", "name": "run", "signature": "def run(self, infnames, outdir, dry_run=False)" }, { "docstring": "Build a com...
3
stack_v2_sparse_classes_30k_train_019982
Implement the Python class `FastQC` described below. Class description: Class for working with FastQC Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, infnames, outdir, dry_run=False): Run fastqc on the passed file - def __build_cmd(self, infnam...
Implement the Python class `FastQC` described below. Class description: Class for working with FastQC Method signatures and docstrings: - def __init__(self, exe_path): Instantiate with location of executable - def run(self, infnames, outdir, dry_run=False): Run fastqc on the passed file - def __build_cmd(self, infnam...
a3c64198aad3709a5c4d969f48ae0af11fdc25db
<|skeleton|> class FastQC: """Class for working with FastQC""" def __init__(self, exe_path): """Instantiate with location of executable""" <|body_0|> def run(self, infnames, outdir, dry_run=False): """Run fastqc on the passed file""" <|body_1|> def __build_cmd(self, in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastQC: """Class for working with FastQC""" def __init__(self, exe_path): """Instantiate with location of executable""" if not is_exe(exe_path): msg = '{0} is not an executable'.format(exe_path) raise NotExecutableError(msg) self._exe_path = exe_path d...
the_stack_v2_python_sparse
metapy/pycits/fastqc.py
peterthorpe5/public_scripts
train
35
975c513fb390cf934b4c683289d0a80c97bc8644
[ "context = super(EntryListView, self).get_context_data(**kwargs)\ncontext['num_entries'] = self.get_queryset().count()\ncontext['unapproved'] = False\ncontext['project_slug'] = self.project_slug\ncontext['version_slug'] = self.version_slug\nreturn context", "if self.queryset is None:\n self.project_slug = self...
<|body_start_0|> context = super(EntryListView, self).get_context_data(**kwargs) context['num_entries'] = self.get_queryset().count() context['unapproved'] = False context['project_slug'] = self.project_slug context['version_slug'] = self.version_slug return context <|end...
List view for Entry.
EntryListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryListView: """List view for Entry.""" def get_context_data(self, **kwargs): """Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template. :rtype: dict"...
stack_v2_sparse_classes_36k_train_021432
13,902
no_license
[ { "docstring": "Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template. :rtype: dict", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, ...
2
stack_v2_sparse_classes_30k_train_010650
Implement the Python class `EntryListView` described below. Class description: List view for Entry. Method signatures and docstrings: - def get_context_data(self, **kwargs): Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context...
Implement the Python class `EntryListView` described below. Class description: List view for Entry. Method signatures and docstrings: - def get_context_data(self, **kwargs): Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context...
ca489c38fdfde29f75c9c1e7f4b4c55d78d91c79
<|skeleton|> class EntryListView: """List view for Entry.""" def get_context_data(self, **kwargs): """Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template. :rtype: dict"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntryListView: """List view for Entry.""" def get_context_data(self, **kwargs): """Get the context data which is passed to a template. :param kwargs: Any arguments to pass to the superclass. :type kwargs: dict :returns: Context data which will be passed to the template. :rtype: dict""" co...
the_stack_v2_python_sparse
django_project/changes/views/entry.py
gitter-badger/projecta
train
0
84226a5cbbbc20574e0196f961a32180eb439412
[ "if can_send_sequence():\n data = parser_seq_add.parse_args()\n program = data['code']\n name = escape(data['name'])\n try:\n queue_manager.process_pool.put(ThreadWithTrace(name, target=perform, args=(program,)), block=False)\n return format_response('Sequence saved', True)\n except que...
<|body_start_0|> if can_send_sequence(): data = parser_seq_add.parse_args() program = data['code'] name = escape(data['name']) try: queue_manager.process_pool.put(ThreadWithTrace(name, target=perform, args=(program,)), block=False) ...
Class resource of sequence route:/seq This class manage all the request to manage sequence
Sequence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sequence: """Class resource of sequence route:/seq This class manage all the request to manage sequence""" def post(self): """post function of sequence Add a sequence to queue :return information of request""" <|body_0|> def delete(self): """delete function of se...
stack_v2_sparse_classes_36k_train_021433
16,281
no_license
[ { "docstring": "post function of sequence Add a sequence to queue :return information of request", "name": "post", "signature": "def post(self)" }, { "docstring": "delete function of sequence delete a sequence in the queue :return information of request", "name": "delete", "signature": "...
3
stack_v2_sparse_classes_30k_train_000748
Implement the Python class `Sequence` described below. Class description: Class resource of sequence route:/seq This class manage all the request to manage sequence Method signatures and docstrings: - def post(self): post function of sequence Add a sequence to queue :return information of request - def delete(self): ...
Implement the Python class `Sequence` described below. Class description: Class resource of sequence route:/seq This class manage all the request to manage sequence Method signatures and docstrings: - def post(self): post function of sequence Add a sequence to queue :return information of request - def delete(self): ...
de1408317d5071b7e0c6b2fea6f281660115d728
<|skeleton|> class Sequence: """Class resource of sequence route:/seq This class manage all the request to manage sequence""" def post(self): """post function of sequence Add a sequence to queue :return information of request""" <|body_0|> def delete(self): """delete function of se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sequence: """Class resource of sequence route:/seq This class manage all the request to manage sequence""" def post(self): """post function of sequence Add a sequence to queue :return information of request""" if can_send_sequence(): data = parser_seq_add.parse_args() ...
the_stack_v2_python_sparse
api/resources.py
HE-Arc/Extrusion---web-interface
train
4
ff0578471ca1b97f482e6d8b7a5f9b03d2100caa
[ "self.node = node\nself.number = number\nself.platform = platform", "fade_time = 12\ndata = bytearray([fade_time, brightness])\nself.platform.send_cmd(self.node, SpikeNodebus.SetLed + self.number, data)" ]
<|body_start_0|> self.node = node self.number = number self.platform = platform <|end_body_0|> <|body_start_1|> fade_time = 12 data = bytearray([fade_time, brightness]) self.platform.send_cmd(self.node, SpikeNodebus.SetLed + self.number, data) <|end_body_1|>
A light on a Stern Spike node board.
SpikeLight
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpikeLight: """A light on a Stern Spike node board.""" def __init__(self, node, number, platform): """Initialise switch.""" <|body_0|> def on(self, brightness=255): """Set brightness of channel.""" <|body_1|> <|end_skeleton|> <|body_start_0|> se...
stack_v2_sparse_classes_36k_train_021434
19,451
permissive
[ { "docstring": "Initialise switch.", "name": "__init__", "signature": "def __init__(self, node, number, platform)" }, { "docstring": "Set brightness of channel.", "name": "on", "signature": "def on(self, brightness=255)" } ]
2
stack_v2_sparse_classes_30k_train_013394
Implement the Python class `SpikeLight` described below. Class description: A light on a Stern Spike node board. Method signatures and docstrings: - def __init__(self, node, number, platform): Initialise switch. - def on(self, brightness=255): Set brightness of channel.
Implement the Python class `SpikeLight` described below. Class description: A light on a Stern Spike node board. Method signatures and docstrings: - def __init__(self, node, number, platform): Initialise switch. - def on(self, brightness=255): Set brightness of channel. <|skeleton|> class SpikeLight: """A light ...
00937ab2ff51b1dc668bf465282ffa8ff1eebbd8
<|skeleton|> class SpikeLight: """A light on a Stern Spike node board.""" def __init__(self, node, number, platform): """Initialise switch.""" <|body_0|> def on(self, brightness=255): """Set brightness of channel.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpikeLight: """A light on a Stern Spike node board.""" def __init__(self, node, number, platform): """Initialise switch.""" self.node = node self.number = number self.platform = platform def on(self, brightness=255): """Set brightness of channel.""" fa...
the_stack_v2_python_sparse
mpf/platforms/spike/spike.py
vgrillot/mpf
train
0
cc13d79a4b151a0bbc7c117f974e4fb6299b8ace
[ "soup = BeautifulSoup(response.content, 'html.parser')\nmenu_tag = soup.find_all(class_='uk-nav uk-nav-side')[1]\nfor li in menu_tag.find_all('li'):\n url = li.a.get('href')\n if not url.satrtswith('http'):\n url = ''.join([self.domain, url])\n yield url", "try:\n soup = BeautifulSoup(response....
<|body_start_0|> soup = BeautifulSoup(response.content, 'html.parser') menu_tag = soup.find_all(class_='uk-nav uk-nav-side')[1] for li in menu_tag.find_all('li'): url = li.a.get('href') if not url.satrtswith('http'): url = ''.join([self.domain, url]) ...
廖雪峰python3教程
LiaoXueFengPythonCrawler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LiaoXueFengPythonCrawler: """廖雪峰python3教程""" def parse_menu(self, response): """解析目录结构,获取所有URL目录列表 :param response: 爬虫所返回的response对象 :return: url生成器""" <|body_0|> def parse_body(self, response): """解析正文 :param response: 爬虫返回的response对象 :return: url生成器""" ...
stack_v2_sparse_classes_36k_train_021435
2,528
no_license
[ { "docstring": "解析目录结构,获取所有URL目录列表 :param response: 爬虫所返回的response对象 :return: url生成器", "name": "parse_menu", "signature": "def parse_menu(self, response)" }, { "docstring": "解析正文 :param response: 爬虫返回的response对象 :return: url生成器", "name": "parse_body", "signature": "def parse_body(self, r...
2
stack_v2_sparse_classes_30k_train_018696
Implement the Python class `LiaoXueFengPythonCrawler` described below. Class description: 廖雪峰python3教程 Method signatures and docstrings: - def parse_menu(self, response): 解析目录结构,获取所有URL目录列表 :param response: 爬虫所返回的response对象 :return: url生成器 - def parse_body(self, response): 解析正文 :param response: 爬虫返回的response对象 :retur...
Implement the Python class `LiaoXueFengPythonCrawler` described below. Class description: 廖雪峰python3教程 Method signatures and docstrings: - def parse_menu(self, response): 解析目录结构,获取所有URL目录列表 :param response: 爬虫所返回的response对象 :return: url生成器 - def parse_body(self, response): 解析正文 :param response: 爬虫返回的response对象 :retur...
9dc81fc32c18ef4e988fcdff2d9274d1a7cb8497
<|skeleton|> class LiaoXueFengPythonCrawler: """廖雪峰python3教程""" def parse_menu(self, response): """解析目录结构,获取所有URL目录列表 :param response: 爬虫所返回的response对象 :return: url生成器""" <|body_0|> def parse_body(self, response): """解析正文 :param response: 爬虫返回的response对象 :return: url生成器""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LiaoXueFengPythonCrawler: """廖雪峰python3教程""" def parse_menu(self, response): """解析目录结构,获取所有URL目录列表 :param response: 爬虫所返回的response对象 :return: url生成器""" soup = BeautifulSoup(response.content, 'html.parser') menu_tag = soup.find_all(class_='uk-nav uk-nav-side')[1] for li in ...
the_stack_v2_python_sparse
pdf/liaoxuefeng_python_crawler.py
qq34384878/Spider
train
0
5f65fe330f6d5effb9c36f6ccae8c30d48f10334
[ "i, j = (0, len(nums) - 1)\nwhile i < j:\n tmp = nums[i] + nums[j]\n if target < tmp:\n j -= 1\n elif target > tmp:\n i += 1\n else:\n return [nums[i], nums[j]]\nreturn None", "i, j = (0, len(nums) - 1)\nwhile i < j:\n if target - nums[i] < nums[j]:\n i += 1\n elif ta...
<|body_start_0|> i, j = (0, len(nums) - 1) while i < j: tmp = nums[i] + nums[j] if target < tmp: j -= 1 elif target > tmp: i += 1 else: return [nums[i], nums[j]] return None <|end_body_0|> <|body_sta...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum1(self, nums: List[int], target: int) -> List[int]: """因为它是一个递增排序的数组,所以我考虑从两边开始找,这样效率会高一些 复杂度分析: 时间复杂度:O(n) n为数组nums的长度,双指针共同遍历整个数组 空间复杂度:O(1) 变量 i, j 使用常数大小的额外空间""" <|body_0|> def twoSum2(self, nums: List[int], target: int) -> List[int]: """对上面版本...
stack_v2_sparse_classes_36k_train_021436
2,371
no_license
[ { "docstring": "因为它是一个递增排序的数组,所以我考虑从两边开始找,这样效率会高一些 复杂度分析: 时间复杂度:O(n) n为数组nums的长度,双指针共同遍历整个数组 空间复杂度:O(1) 变量 i, j 使用常数大小的额外空间", "name": "twoSum1", "signature": "def twoSum1(self, nums: List[int], target: int) -> List[int]" }, { "docstring": "对上面版本进行修改,考虑到溢出问题, 这里将判断条件改成 target-nums[i] 与 nums[j] 相比...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum1(self, nums: List[int], target: int) -> List[int]: 因为它是一个递增排序的数组,所以我考虑从两边开始找,这样效率会高一些 复杂度分析: 时间复杂度:O(n) n为数组nums的长度,双指针共同遍历整个数组 空间复杂度:O(1) 变量 i, j 使用常数大小的额外空间 - def tw...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum1(self, nums: List[int], target: int) -> List[int]: 因为它是一个递增排序的数组,所以我考虑从两边开始找,这样效率会高一些 复杂度分析: 时间复杂度:O(n) n为数组nums的长度,双指针共同遍历整个数组 空间复杂度:O(1) 变量 i, j 使用常数大小的额外空间 - def tw...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def twoSum1(self, nums: List[int], target: int) -> List[int]: """因为它是一个递增排序的数组,所以我考虑从两边开始找,这样效率会高一些 复杂度分析: 时间复杂度:O(n) n为数组nums的长度,双指针共同遍历整个数组 空间复杂度:O(1) 变量 i, j 使用常数大小的额外空间""" <|body_0|> def twoSum2(self, nums: List[int], target: int) -> List[int]: """对上面版本...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum1(self, nums: List[int], target: int) -> List[int]: """因为它是一个递增排序的数组,所以我考虑从两边开始找,这样效率会高一些 复杂度分析: 时间复杂度:O(n) n为数组nums的长度,双指针共同遍历整个数组 空间复杂度:O(1) 变量 i, j 使用常数大小的额外空间""" i, j = (0, len(nums) - 1) while i < j: tmp = nums[i] + nums[j] if target < t...
the_stack_v2_python_sparse
剑指offer/PythonVersion/57_1_和为s的两个数字.py
LeBron-Jian/BasicAlgorithmPractice
train
13
13b9b9aeb501acab44ed348ab9eb5aed926cf3a3
[ "super(Registry, self).__init__(name, bases, attrs)\nif getattr(bases[0], '__metaclass__', None) != Registry:\n return\nif not attrs.get(attr_name, None):\n raise TypeError(\"You must define a '%(attr)s' for the %(class)s class\" % {'attr': attr_name, 'class': name})\nattr_val = attrs[attr_name]\nif attr_val ...
<|body_start_0|> super(Registry, self).__init__(name, bases, attrs) if getattr(bases[0], '__metaclass__', None) != Registry: return if not attrs.get(attr_name, None): raise TypeError("You must define a '%(attr)s' for the %(class)s class" % {'attr': attr_name, 'class': nam...
An abstract registry for objects keyed by an attribute value.
Registry
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Registry: """An abstract registry for objects keyed by an attribute value.""" def __init__(self, name, bases, attrs): """Update our object registry, keyed by an attribute value.""" <|body_0|> def get_registry_item(self, attr_val): """Return the class registered u...
stack_v2_sparse_classes_36k_train_021437
1,405
permissive
[ { "docstring": "Update our object registry, keyed by an attribute value.", "name": "__init__", "signature": "def __init__(self, name, bases, attrs)" }, { "docstring": "Return the class registered under the given attribute name. If the class instance cannot be found, a ValueError is raised.", ...
2
null
Implement the Python class `Registry` described below. Class description: An abstract registry for objects keyed by an attribute value. Method signatures and docstrings: - def __init__(self, name, bases, attrs): Update our object registry, keyed by an attribute value. - def get_registry_item(self, attr_val): Return t...
Implement the Python class `Registry` described below. Class description: An abstract registry for objects keyed by an attribute value. Method signatures and docstrings: - def __init__(self, name, bases, attrs): Update our object registry, keyed by an attribute value. - def get_registry_item(self, attr_val): Return t...
24e354769841dd6962f38cef3bd45f8297b040c6
<|skeleton|> class Registry: """An abstract registry for objects keyed by an attribute value.""" def __init__(self, name, bases, attrs): """Update our object registry, keyed by an attribute value.""" <|body_0|> def get_registry_item(self, attr_val): """Return the class registered u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Registry: """An abstract registry for objects keyed by an attribute value.""" def __init__(self, name, bases, attrs): """Update our object registry, keyed by an attribute value.""" super(Registry, self).__init__(name, bases, attrs) if getattr(bases[0], '__metaclass__', None) != Re...
the_stack_v2_python_sparse
pressgang/utils/registry.py
cilcoberlin/pressgang
train
1
51fe80a3003d5499c5da29bc61022165f2784152
[ "input = '日本語'\nexpected_result = '5pel5pys6Kqe'\nactual_result, output = encode(input)\nassert actual_result == expected_result\nassert output == {'Base64': {'encoded': expected_result}}", "input = 'test'\nexpected_result = 'dGVzdA=='\nactual_result, output = encode(input)\nassert actual_result == expected_resul...
<|body_start_0|> input = '日本語' expected_result = '5pel5pys6Kqe' actual_result, output = encode(input) assert actual_result == expected_result assert output == {'Base64': {'encoded': expected_result}} <|end_body_0|> <|body_start_1|> input = 'test' expected_result ...
Base64EncodeV2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base64EncodeV2: def test_encode_japanese(self): """Given: Japanese characters. When: Encoding the characters using Base64. Then: Validate that the human readable and context outputs are properly formatted and that the input was encoded correctly.""" <|body_0|> def test_encod...
stack_v2_sparse_classes_36k_train_021438
3,044
permissive
[ { "docstring": "Given: Japanese characters. When: Encoding the characters using Base64. Then: Validate that the human readable and context outputs are properly formatted and that the input was encoded correctly.", "name": "test_encode_japanese", "signature": "def test_encode_japanese(self)" }, { ...
5
null
Implement the Python class `Base64EncodeV2` described below. Class description: Implement the Base64EncodeV2 class. Method signatures and docstrings: - def test_encode_japanese(self): Given: Japanese characters. When: Encoding the characters using Base64. Then: Validate that the human readable and context outputs are...
Implement the Python class `Base64EncodeV2` described below. Class description: Implement the Base64EncodeV2 class. Method signatures and docstrings: - def test_encode_japanese(self): Given: Japanese characters. When: Encoding the characters using Base64. Then: Validate that the human readable and context outputs are...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class Base64EncodeV2: def test_encode_japanese(self): """Given: Japanese characters. When: Encoding the characters using Base64. Then: Validate that the human readable and context outputs are properly formatted and that the input was encoded correctly.""" <|body_0|> def test_encod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base64EncodeV2: def test_encode_japanese(self): """Given: Japanese characters. When: Encoding the characters using Base64. Then: Validate that the human readable and context outputs are properly formatted and that the input was encoded correctly.""" input = '日本語' expected_result = '5pe...
the_stack_v2_python_sparse
Packs/CommonScripts/Scripts/Base64EncodeV2/Base64EncodeV2_test.py
demisto/content
train
1,023
06770868690021bfa5ea42778e21ff7285bb20b1
[ "if A.shape[0] != A.shape[1]:\n print('Matrix must be square')\nself.dim = A.shape[0]\nif view is None:\n view = self.dim\nelse:\n assert view <= self.dim\nself._A_buf = A[:, :]\nself.n = view\nself.A = self._A_buf[:view, :view]", "assert view <= self.dim\nself.n = view\nself.A = self._A_buf[:view, :view...
<|body_start_0|> if A.shape[0] != A.shape[1]: print('Matrix must be square') self.dim = A.shape[0] if view is None: view = self.dim else: assert view <= self.dim self._A_buf = A[:, :] self.n = view self.A = self._A_buf[:view, :v...
ScipyHessenberg
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScipyHessenberg: def __init__(self, A, view=None): """Constructor :param A: Full storage real symmetric matrix to be tridiagonalized (is not overwritten) :param view: Integer, if present selects a sub-matrix of A starting from the top-left element, up until the row/column n = view. This ...
stack_v2_sparse_classes_36k_train_021439
5,175
permissive
[ { "docstring": "Constructor :param A: Full storage real symmetric matrix to be tridiagonalized (is not overwritten) :param view: Integer, if present selects a sub-matrix of A starting from the top-left element, up until the row/column n = view. This sub-matrix is then tridiagonalized instead of the full A", ...
6
stack_v2_sparse_classes_30k_train_020313
Implement the Python class `ScipyHessenberg` described below. Class description: Implement the ScipyHessenberg class. Method signatures and docstrings: - def __init__(self, A, view=None): Constructor :param A: Full storage real symmetric matrix to be tridiagonalized (is not overwritten) :param view: Integer, if prese...
Implement the Python class `ScipyHessenberg` described below. Class description: Implement the ScipyHessenberg class. Method signatures and docstrings: - def __init__(self, A, view=None): Constructor :param A: Full storage real symmetric matrix to be tridiagonalized (is not overwritten) :param view: Integer, if prese...
daf37f522f8acb6af2285d44f39cab31f34b01a4
<|skeleton|> class ScipyHessenberg: def __init__(self, A, view=None): """Constructor :param A: Full storage real symmetric matrix to be tridiagonalized (is not overwritten) :param view: Integer, if present selects a sub-matrix of A starting from the top-left element, up until the row/column n = view. This ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScipyHessenberg: def __init__(self, A, view=None): """Constructor :param A: Full storage real symmetric matrix to be tridiagonalized (is not overwritten) :param view: Integer, if present selects a sub-matrix of A starting from the top-left element, up until the row/column n = view. This sub-matrix is ...
the_stack_v2_python_sparse
mapping/tridiag/scipy_hessenberg/full.py
fhoeb/py-mapping
train
2
407a5cc2239767789366aac65dc362cc9f6001bf
[ "self.current_usage_gib = current_usage_gib\nself.feature_name = feature_name\nself.num_vm = num_vm", "if dictionary is None:\n return None\ncurrent_usage_gib = dictionary.get('currentUsageGiB')\nfeature_name = dictionary.get('featureName')\nnum_vm = dictionary.get('numVm')\nreturn cls(current_usage_gib, featu...
<|body_start_0|> self.current_usage_gib = current_usage_gib self.feature_name = feature_name self.num_vm = num_vm <|end_body_0|> <|body_start_1|> if dictionary is None: return None current_usage_gib = dictionary.get('currentUsageGiB') feature_name = dictionar...
Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.
FeatureUsage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureUsage: """Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.""" def __init__(self, current_usage_gib=None, fea...
stack_v2_sparse_classes_36k_train_021440
1,804
permissive
[ { "docstring": "Constructor for the FeatureUsage class", "name": "__init__", "signature": "def __init__(self, current_usage_gib=None, feature_name=None, num_vm=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation...
2
stack_v2_sparse_classes_30k_train_019978
Implement the Python class `FeatureUsage` described below. Class description: Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned. Method signatu...
Implement the Python class `FeatureUsage` described below. Class description: Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned. Method signatu...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FeatureUsage: """Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.""" def __init__(self, current_usage_gib=None, fea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureUsage: """Implementation of the 'FeatureUsage' model. TODO: type description here. Attributes: current_usage_gib (long|int): Feature usage by the cluster. feature_name (string): Name of feature. num_vm (long|int): Number of VM spinned.""" def __init__(self, current_usage_gib=None, feature_name=Non...
the_stack_v2_python_sparse
cohesity_management_sdk/models/feature_usage.py
cohesity/management-sdk-python
train
24
7020c10ae6df9a131d61ab910d907159c820a7ff
[ "if Flavour.objects.filter(flavour=value.lower()):\n raise serializers.ValidationError('There already exist such flavour')\nreturn value", "ret = super().to_representation(instance)\nret['flavour'] = ret['flavour'].lower()\nreturn ret" ]
<|body_start_0|> if Flavour.objects.filter(flavour=value.lower()): raise serializers.ValidationError('There already exist such flavour') return value <|end_body_0|> <|body_start_1|> ret = super().to_representation(instance) ret['flavour'] = ret['flavour'].lower() ret...
AddFlavourSerializers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddFlavourSerializers: def validate_flavour(self, value): """Check the duplicate""" <|body_0|> def to_representation(self, instance): """Convert `flavour` to lowercase.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if Flavour.objects.filter(flavou...
stack_v2_sparse_classes_36k_train_021441
4,598
permissive
[ { "docstring": "Check the duplicate", "name": "validate_flavour", "signature": "def validate_flavour(self, value)" }, { "docstring": "Convert `flavour` to lowercase.", "name": "to_representation", "signature": "def to_representation(self, instance)" } ]
2
stack_v2_sparse_classes_30k_test_001203
Implement the Python class `AddFlavourSerializers` described below. Class description: Implement the AddFlavourSerializers class. Method signatures and docstrings: - def validate_flavour(self, value): Check the duplicate - def to_representation(self, instance): Convert `flavour` to lowercase.
Implement the Python class `AddFlavourSerializers` described below. Class description: Implement the AddFlavourSerializers class. Method signatures and docstrings: - def validate_flavour(self, value): Check the duplicate - def to_representation(self, instance): Convert `flavour` to lowercase. <|skeleton|> class AddF...
6a935bb77db3996dcf14b71deed8d7ca5c8f0fa3
<|skeleton|> class AddFlavourSerializers: def validate_flavour(self, value): """Check the duplicate""" <|body_0|> def to_representation(self, instance): """Convert `flavour` to lowercase.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddFlavourSerializers: def validate_flavour(self, value): """Check the duplicate""" if Flavour.objects.filter(flavour=value.lower()): raise serializers.ValidationError('There already exist such flavour') return value def to_representation(self, instance): """Co...
the_stack_v2_python_sparse
drf_api/serializers.py
destro6984/LynxWasp
train
0
ca0842636576f6fdfe376aa78447e85642129def
[ "legalMoves = gameState.getLegalActions()\nscores = [self.evaluationFunction(gameState, action) for action in legalMoves]\nbestScore = max(scores)\nbestIndices = [index for index in range(len(scores)) if scores[index] == bestScore]\nchosenIndex = random.choice(bestIndices)\n'Add more of your code here if you want t...
<|body_start_0|> legalMoves = gameState.getLegalActions() scores = [self.evaluationFunction(gameState, action) for action in legalMoves] bestScore = max(scores) bestIndices = [index for index in range(len(scores)) if scores[index] == bestScore] chosenIndex = random.choice(bestInd...
A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our method headers.
ReflexAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReflexAgent: """A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our method headers.""" def getAction(sel...
stack_v2_sparse_classes_36k_train_021442
16,868
no_license
[ { "docstring": "You do not need to change this method, but you're welcome to. getAction chooses among the best options according to the evaluation function. Just like in the previous project, getAction takes a GameState and returns some Directions.X for some X in the set {North, South, West, East, Stop}", "...
2
stack_v2_sparse_classes_30k_train_007346
Implement the Python class `ReflexAgent` described below. Class description: A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our me...
Implement the Python class `ReflexAgent` described below. Class description: A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our me...
fad5d28d3202056975a7e18805c1b20bd0d02d3e
<|skeleton|> class ReflexAgent: """A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our method headers.""" def getAction(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReflexAgent: """A reflex agent chooses an action at each choice point by examining its alternatives via a state evaluation function. The code below is provided as a guide. You are welcome to change it in any way you see fit, so long as you don't touch our method headers.""" def getAction(self, gameState)...
the_stack_v2_python_sparse
Year 3/Computer Science 3346/Assignment 2/multiagent/multiAgents.py
UvSandhu13/School
train
0
61ec6565de9752f5c567aa81cf1e4c403c4d9b24
[ "if ref is not None:\n if not isinstance(ref, pd.Index):\n if hasattr(ref, 'columns') and isinstance(ref.index, pd.Index):\n ref = ref.columns\n else:\n ref = pd.Index(ref)\n obj = self._get_indices(ref, obj)\nif np.issubdtype(type(obj), np.integer):\n obj = int(obj)\nif isinsta...
<|body_start_0|> if ref is not None: if not isinstance(ref, pd.Index): if hasattr(ref, 'columns') and isinstance(ref.index, pd.Index): ref = ref.columns else: ref = pd.Index(ref) obj = self._get_indices(ref, obj) if ...
Mixin class with utilities for by-column applicates.
_ColumnEstimator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ColumnEstimator: """Mixin class with utilities for by-column applicates.""" def _coerce_to_pd_index(self, obj, ref=None): """Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference ...
stack_v2_sparse_classes_36k_train_021443
36,566
permissive
[ { "docstring": "Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference index, coercible to pd.Index, optional, default=None Returns ------- obj coerced to pd.Index if ref was passed, and if obj had int or np.i...
4
stack_v2_sparse_classes_30k_train_020279
Implement the Python class `_ColumnEstimator` described below. Class description: Mixin class with utilities for by-column applicates. Method signatures and docstrings: - def _coerce_to_pd_index(self, obj, ref=None): Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of...
Implement the Python class `_ColumnEstimator` described below. Class description: Mixin class with utilities for by-column applicates. Method signatures and docstrings: - def _coerce_to_pd_index(self, obj, ref=None): Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of...
70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f
<|skeleton|> class _ColumnEstimator: """Mixin class with utilities for by-column applicates.""" def _coerce_to_pd_index(self, obj, ref=None): """Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ColumnEstimator: """Mixin class with utilities for by-column applicates.""" def _coerce_to_pd_index(self, obj, ref=None): """Coerce obj to pandas Index, replacing ints by index elements. Parameters ---------- obj : iterable of pandas compatible index elements or int ref : reference index, coerci...
the_stack_v2_python_sparse
sktime/base/_meta.py
sktime/sktime
train
1,117
4e589f8922519877ee6234a81b63ea36292a13a8
[ "super().__init__()\nself.recursion_degree = recursion_degree\nself._sk = SolovayKitaevDecomposition(basic_approximations)", "for node in dag.op_nodes():\n if not node.op.num_qubits == 1:\n continue\n check_input = not isinstance(node.op, Gate)\n if not hasattr(node.op, 'to_matrix'):\n rais...
<|body_start_0|> super().__init__() self.recursion_degree = recursion_degree self._sk = SolovayKitaevDecomposition(basic_approximations) <|end_body_0|> <|body_start_1|> for node in dag.op_nodes(): if not node.op.num_qubits == 1: continue check_inp...
Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math:`SU(2)`. This is an important result, si...
SolovayKitaev
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolovayKitaev: """Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math...
stack_v2_sparse_classes_36k_train_021444
10,726
permissive
[ { "docstring": "Args: recursion_degree: The recursion depth for the Solovay-Kitaev algorithm. A larger recursion depth increases the accuracy and length of the decomposition. basic_approximations: The basic approximations for the finding the best discrete decomposition at the root of the recursion. If a string,...
2
stack_v2_sparse_classes_30k_train_000951
Implement the Python class `SolovayKitaev` described below. Class description: Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if th...
Implement the Python class `SolovayKitaev` described below. Class description: Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if th...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class SolovayKitaev: """Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolovayKitaev: """Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm. The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in :math:`SU(2)`. Thi...
the_stack_v2_python_sparse
qiskit/transpiler/passes/synthesis/solovay_kitaev_synthesis.py
1ucian0/qiskit-terra
train
6
ff300a3e0cd1d2a0e9bee71b1d60ec77a2cf763c
[ "super().__init__(thresholds=[1], threshold_units=threshold_units, comparison_operator=comparison_operator)\nif not callable(threshold_function):\n raise TypeError('Threshold must be callable')\nself.threshold_function = threshold_function", "coord = iris.coords.AuxCoord(threshold.astype(FLOAT_DTYPE), units=cu...
<|body_start_0|> super().__init__(thresholds=[1], threshold_units=threshold_units, comparison_operator=comparison_operator) if not callable(threshold_function): raise TypeError('Threshold must be callable') self.threshold_function = threshold_function <|end_body_0|> <|body_start_1|>...
Apply a latitude-dependent threshold truth criterion to a cube. Calculates the threshold truth values based on the threshold function provided. A cube will be returned with a new threshold dimension auxillary coordinate on the latitude axis. Can operate on multiple time sequences within a cube.
LatitudeDependentThreshold
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LatitudeDependentThreshold: """Apply a latitude-dependent threshold truth criterion to a cube. Calculates the threshold truth values based on the threshold function provided. A cube will be returned with a new threshold dimension auxillary coordinate on the latitude axis. Can operate on multiple ...
stack_v2_sparse_classes_36k_train_021445
20,830
permissive
[ { "docstring": "Sets up latitude-dependent threshold class Args: threshold_function: A function which takes a latitude value (in degrees) and returns the desired threshold. threshold_units: Units of the threshold values. If not provided the units are assumed to be the same as those of the input cube. comparison...
3
null
Implement the Python class `LatitudeDependentThreshold` described below. Class description: Apply a latitude-dependent threshold truth criterion to a cube. Calculates the threshold truth values based on the threshold function provided. A cube will be returned with a new threshold dimension auxillary coordinate on the ...
Implement the Python class `LatitudeDependentThreshold` described below. Class description: Apply a latitude-dependent threshold truth criterion to a cube. Calculates the threshold truth values based on the threshold function provided. A cube will be returned with a new threshold dimension auxillary coordinate on the ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class LatitudeDependentThreshold: """Apply a latitude-dependent threshold truth criterion to a cube. Calculates the threshold truth values based on the threshold function provided. A cube will be returned with a new threshold dimension auxillary coordinate on the latitude axis. Can operate on multiple ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LatitudeDependentThreshold: """Apply a latitude-dependent threshold truth criterion to a cube. Calculates the threshold truth values based on the threshold function provided. A cube will be returned with a new threshold dimension auxillary coordinate on the latitude axis. Can operate on multiple time sequence...
the_stack_v2_python_sparse
improver/threshold.py
metoppv/improver
train
101
150f1f7d865ca13bed2d3a2dddd51e4ba8c8616d
[ "full_list = self.get_updated_list_from_DB('destination')\nfull_list.pop(0)\ndest_code = 0\nfor line in full_list:\n try:\n if int(line[8]) > dest_code:\n dest_code = int(line[8])\n except IndexError:\n continue\nadded_zero = ''\nif dest_code < 10:\n added_zero = '0'\ndestination_c...
<|body_start_0|> full_list = self.get_updated_list_from_DB('destination') full_list.pop(0) dest_code = 0 for line in full_list: try: if int(line[8]) > dest_code: dest_code = int(line[8]) except IndexError: contin...
DestinationLL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationLL: def create_dest_code(self): """Creates a destination code fo destinations""" <|body_0|> def create_destination(self, destination_identity): """Creates a new destination and saves to database. destination_identity = ('',destination,country,flight_time,d...
stack_v2_sparse_classes_36k_train_021446
3,028
no_license
[ { "docstring": "Creates a destination code fo destinations", "name": "create_dest_code", "signature": "def create_dest_code(self)" }, { "docstring": "Creates a new destination and saves to database. destination_identity = ('',destination,country,flight_time,distance,contact,emergency_number,airp...
5
stack_v2_sparse_classes_30k_train_006189
Implement the Python class `DestinationLL` described below. Class description: Implement the DestinationLL class. Method signatures and docstrings: - def create_dest_code(self): Creates a destination code fo destinations - def create_destination(self, destination_identity): Creates a new destination and saves to data...
Implement the Python class `DestinationLL` described below. Class description: Implement the DestinationLL class. Method signatures and docstrings: - def create_dest_code(self): Creates a destination code fo destinations - def create_destination(self, destination_identity): Creates a new destination and saves to data...
ee2b2e6c1422ebab40e36ed3ed23f6f70ee7adb2
<|skeleton|> class DestinationLL: def create_dest_code(self): """Creates a destination code fo destinations""" <|body_0|> def create_destination(self, destination_identity): """Creates a new destination and saves to database. destination_identity = ('',destination,country,flight_time,d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DestinationLL: def create_dest_code(self): """Creates a destination code fo destinations""" full_list = self.get_updated_list_from_DB('destination') full_list.pop(0) dest_code = 0 for line in full_list: try: if int(line[8]) > dest_code: ...
the_stack_v2_python_sparse
program_code/LL/DestinationLL.py
heidars19/3ja-vikna-verkefni
train
3
a9352774fc72ec62d7d5e61b5d75d8b1be8d3c3c
[ "self.high_time = NI_HIGH_TIME\nself.frequency = NI_FREQUENCY\nself.low_time = 1.0 / self.frequency - self.high_time\nif self.low_time < NI_MINIMUM_LOW_TIME:\n self.low_time = NI_MINIMUM_LOW_TIME\nself.dev_name = NI_DEV_NAME\nself.out_pin = TRIG_GEN_PIN_OUT\nself.taskHandle = functions.TaskHandle(0)\nfunctions.D...
<|body_start_0|> self.high_time = NI_HIGH_TIME self.frequency = NI_FREQUENCY self.low_time = 1.0 / self.frequency - self.high_time if self.low_time < NI_MINIMUM_LOW_TIME: self.low_time = NI_MINIMUM_LOW_TIME self.dev_name = NI_DEV_NAME self.out_pin = TRIG_GEN_P...
Controls the SEPIA and SuperK trigger signals, as produced by the NI Unit via commands sent down a USB port.
TriggerGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerGenerator: """Controls the SEPIA and SuperK trigger signals, as produced by the NI Unit via commands sent down a USB port.""" def _setup(self): """Set up the single-pulse parameters - the high time and the low time, and the digital output channel X to be used. The channel stri...
stack_v2_sparse_classes_36k_train_021447
2,247
no_license
[ { "docstring": "Set up the single-pulse parameters - the high time and the low time, and the digital output channel X to be used. The channel string must be of the form `deviceName/digitalOutputPin`, i.e. `Dev1/Ctr0`. /Ctr0 is used by default, but can be changed in config.py if required.", "name": "_setup",...
3
stack_v2_sparse_classes_30k_train_013444
Implement the Python class `TriggerGenerator` described below. Class description: Controls the SEPIA and SuperK trigger signals, as produced by the NI Unit via commands sent down a USB port. Method signatures and docstrings: - def _setup(self): Set up the single-pulse parameters - the high time and the low time, and ...
Implement the Python class `TriggerGenerator` described below. Class description: Controls the SEPIA and SuperK trigger signals, as produced by the NI Unit via commands sent down a USB port. Method signatures and docstrings: - def _setup(self): Set up the single-pulse parameters - the high time and the low time, and ...
9f7129c299f003e98259b1f141c22986535754af
<|skeleton|> class TriggerGenerator: """Controls the SEPIA and SuperK trigger signals, as produced by the NI Unit via commands sent down a USB port.""" def _setup(self): """Set up the single-pulse parameters - the high time and the low time, and the digital output channel X to be used. The channel stri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TriggerGenerator: """Controls the SEPIA and SuperK trigger signals, as produced by the NI Unit via commands sent down a USB port.""" def _setup(self): """Set up the single-pulse parameters - the high time and the low time, and the digital output channel X to be used. The channel string must be of...
the_stack_v2_python_sparse
smellie/ni_trigger_generator.py
jackdunger/newSmellie
train
0
d7b1d47e2b5ccd60b1b402c0bdcefd3d5153f836
[ "from __builtin__ import xrange\ngraph = {i: [] for i in xrange(n)}\nfor e in edges:\n graph[e[0]] += (e[1],)\n graph[e[1]] += (e[0],)\n\ndef dfs(key):\n child = graph.pop(key, [])\n for c in child:\n dfs(c)\ncnt = 0\nwhile graph:\n key = graph.keys()[0]\n dfs(key)\n cnt += 1\nreturn cnt...
<|body_start_0|> from __builtin__ import xrange graph = {i: [] for i in xrange(n)} for e in edges: graph[e[0]] += (e[1],) graph[e[1]] += (e[0],) def dfs(key): child = graph.pop(key, []) for c in child: dfs(c) cnt = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countComponents(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_0|> def rewrite(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_1|> def rewrite2(self, n, edges): ...
stack_v2_sparse_classes_36k_train_021448
3,101
no_license
[ { "docstring": ":type n: int :type edges: List[List[int]] :rtype: int", "name": "countComponents", "signature": "def countComponents(self, n, edges)" }, { "docstring": ":type n: int :type edges: List[List[int]] :rtype: int", "name": "rewrite", "signature": "def rewrite(self, n, edges)" ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countComponents(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - def rewrite(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countComponents(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - def rewrite(self, n, edges): :type n: int :type edges: List[List[int]] :rtype: int - ...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def countComponents(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_0|> def rewrite(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" <|body_1|> def rewrite2(self, n, edges): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countComponents(self, n, edges): """:type n: int :type edges: List[List[int]] :rtype: int""" from __builtin__ import xrange graph = {i: [] for i in xrange(n)} for e in edges: graph[e[0]] += (e[1],) graph[e[1]] += (e[0],) def dfs(ke...
the_stack_v2_python_sparse
graph/323_Number_of_Connected_Components_in_an_Undirected_Graph.py
vsdrun/lc_public
train
6
dc5e90251ee087fa66c612d57b10581085b11404
[ "if x < 0:\n return False\ny = self.reverse(x)\nreturn y == x", "if x is None:\n return None\nif x == 0:\n return 0\nx_str = str(x)\nif x_str.find('-') == -1:\n x_array = list(x_str)\n reversed_array = x_array\n reversed_array.reverse()\n i = 0\n while reversed_array[i] == '0':\n i ...
<|body_start_0|> if x < 0: return False y = self.reverse(x) return y == x <|end_body_0|> <|body_start_1|> if x is None: return None if x == 0: return 0 x_str = str(x) if x_str.find('-') == -1: x_array = list(x_str) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def reverse(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False y = self.reverse(x) ...
stack_v2_sparse_classes_36k_train_021449
2,674
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_013700
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def reverse(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def reverse(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def isPalindrome(self, x): """:ty...
71a02a2c6bc12e86119502c9c4a4b2047b9f3966
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def reverse(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False y = self.reverse(x) return y == x def reverse(self, x): """:type x: int :rtype: int""" if x is None: return None if x == 0: ...
the_stack_v2_python_sparse
Math/9. Palindrome Number(easy).py
xilixjd/leetcode
train
1
9fbb26001a4626f2cae63159fd5b981d93e044d6
[ "astCtxt = self.Triton.getAstContext()\nwhile pc:\n opcode = self.Triton.getConcreteMemoryAreaValue(pc, 16)\n instruction = Instruction()\n instruction.setOpcode(opcode)\n instruction.setAddress(pc)\n self.Triton.processing(instruction)\n self.assertTrue(checkAstIntegrity(instruction))\n if ins...
<|body_start_0|> astCtxt = self.Triton.getAstContext() while pc: opcode = self.Triton.getConcreteMemoryAreaValue(pc, 16) instruction = Instruction() instruction.setOpcode(opcode) instruction.setAddress(pc) self.Triton.processing(instruction) ...
Test for DefCamp2015 challenge.
DefCamp2015
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefCamp2015: """Test for DefCamp2015 challenge.""" def emulate(self, pc): """Emulate every opcode from pc. * Process instruction until the end and search for constraint resolution on cmp eax, 1 then self.Triton.set the new correct value and keep going.""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_021450
18,108
permissive
[ { "docstring": "Emulate every opcode from pc. * Process instruction until the end and search for constraint resolution on cmp eax, 1 then self.Triton.set the new correct value and keep going.", "name": "emulate", "signature": "def emulate(self, pc)" }, { "docstring": "Load in memory every opcode...
3
stack_v2_sparse_classes_30k_train_021400
Implement the Python class `DefCamp2015` described below. Class description: Test for DefCamp2015 challenge. Method signatures and docstrings: - def emulate(self, pc): Emulate every opcode from pc. * Process instruction until the end and search for constraint resolution on cmp eax, 1 then self.Triton.set the new corr...
Implement the Python class `DefCamp2015` described below. Class description: Test for DefCamp2015 challenge. Method signatures and docstrings: - def emulate(self, pc): Emulate every opcode from pc. * Process instruction until the end and search for constraint resolution on cmp eax, 1 then self.Triton.set the new corr...
a61651ce331ac53ec09e1d8fef5eab744e98c9de
<|skeleton|> class DefCamp2015: """Test for DefCamp2015 challenge.""" def emulate(self, pc): """Emulate every opcode from pc. * Process instruction until the end and search for constraint resolution on cmp eax, 1 then self.Triton.set the new correct value and keep going.""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefCamp2015: """Test for DefCamp2015 challenge.""" def emulate(self, pc): """Emulate every opcode from pc. * Process instruction until the end and search for constraint resolution on cmp eax, 1 then self.Triton.set the new correct value and keep going.""" astCtxt = self.Triton.getAstConte...
the_stack_v2_python_sparse
src/testers/unittests/test_simulation.py
JonathanSalwan/Triton
train
3,163
b77cb76ad8480d5843c9005817fdd15e26b278a8
[ "super(QtEnum, self).__init__()\nself._default_value = value\nEnum.__init__(self, value, *args, choices=choices, **kwargs)\nself._layout = QtWidgets.QHBoxLayout()\nself._init_ui()\nself.setLayout(self._layout)", "if self._default_value not in self.choices:\n self._combo.insertItem(0, '----Undefined----')\n ...
<|body_start_0|> super(QtEnum, self).__init__() self._default_value = value Enum.__init__(self, value, *args, choices=choices, **kwargs) self._layout = QtWidgets.QHBoxLayout() self._init_ui() self.setLayout(self._layout) <|end_body_0|> <|body_start_1|> if self._d...
Define an enum user selection control.
QtEnum
[ "LicenseRef-scancode-cecill-b-en" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QtEnum: """Define an enum user selection control.""" def __init__(self, choices, value=None, *args, **kwargs): """Initialize the 'QtEnum' class. Parameters ---------- choices: list of str the different choices. value: object (optional, default None) the parameter value.""" <|...
stack_v2_sparse_classes_36k_train_021451
2,900
permissive
[ { "docstring": "Initialize the 'QtEnum' class. Parameters ---------- choices: list of str the different choices. value: object (optional, default None) the parameter value.", "name": "__init__", "signature": "def __init__(self, choices, value=None, *args, **kwargs)" }, { "docstring": "Reset the ...
4
stack_v2_sparse_classes_30k_train_019010
Implement the Python class `QtEnum` described below. Class description: Define an enum user selection control. Method signatures and docstrings: - def __init__(self, choices, value=None, *args, **kwargs): Initialize the 'QtEnum' class. Parameters ---------- choices: list of str the different choices. value: object (o...
Implement the Python class `QtEnum` described below. Class description: Define an enum user selection control. Method signatures and docstrings: - def __init__(self, choices, value=None, *args, **kwargs): Initialize the 'QtEnum' class. Parameters ---------- choices: list of str the different choices. value: object (o...
a77fc2c81cb469535b650c79718f811c5c056238
<|skeleton|> class QtEnum: """Define an enum user selection control.""" def __init__(self, choices, value=None, *args, **kwargs): """Initialize the 'QtEnum' class. Parameters ---------- choices: list of str the different choices. value: object (optional, default None) the parameter value.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QtEnum: """Define an enum user selection control.""" def __init__(self, choices, value=None, *args, **kwargs): """Initialize the 'QtEnum' class. Parameters ---------- choices: list of str the different choices. value: object (optional, default None) the parameter value.""" super(QtEnum, s...
the_stack_v2_python_sparse
pypipe/gui/controls/enum.py
AGrigis/pypipe
train
0
0a98861fa43c1a7bd2ebcadb706761d0b98bec02
[ "self.res = []\ncol, left, right = (defaultdict(int), defaultdict(int), defaultdict(int))\nboard = [['.' for i in range(n)] for j in range(n)]\nself.dfs(n, board, -1, col, left, right)\nreturn self.res", "if k == n - 1:\n self.res.append([''.join(board[i]) for i in range(n)])\n return\nfor c in range(n):\n ...
<|body_start_0|> self.res = [] col, left, right = (defaultdict(int), defaultdict(int), defaultdict(int)) board = [['.' for i in range(n)] for j in range(n)] self.dfs(n, board, -1, col, left, right) return self.res <|end_body_0|> <|body_start_1|> if k == n - 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_0|> def dfs(self, n, board, k, col, left, right): """:type board: List[str] :type k: int (k queens has been in the board) :type res: List[List[str]] :type col: dict[int] :rtype: bo...
stack_v2_sparse_classes_36k_train_021452
1,234
no_license
[ { "docstring": ":type n: int :rtype: List[List[str]]", "name": "solveNQueens", "signature": "def solveNQueens(self, n)" }, { "docstring": ":type board: List[str] :type k: int (k queens has been in the board) :type res: List[List[str]] :type col: dict[int] :rtype: boolean", "name": "dfs", ...
2
stack_v2_sparse_classes_30k_train_012561
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] - def dfs(self, n, board, k, col, left, right): :type board: List[str] :type k: int (k queens has been in the boar...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] - def dfs(self, n, board, k, col, left, right): :type board: List[str] :type k: int (k queens has been in the boar...
2f46f85e1e297b0a50fdb66956b1d05622a4063d
<|skeleton|> class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_0|> def dfs(self, n, board, k, col, left, right): """:type board: List[str] :type k: int (k queens has been in the board) :type res: List[List[str]] :type col: dict[int] :rtype: bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" self.res = [] col, left, right = (defaultdict(int), defaultdict(int), defaultdict(int)) board = [['.' for i in range(n)] for j in range(n)] self.dfs(n, board, -1, col, left, right) r...
the_stack_v2_python_sparse
dan/Problems/Hard/Backtracking/51. N-Queens/solution.py
xudaaaaan/Leetcode
train
0
5ff8001c1a25fd4c65e3f890857be1f62c4ad09f
[ "self.model_names = []\nself.model_weights = {}\nself.cv_results = {}\nself.predictions_by_model = {}\nself.weighted_average_predictions = {}\nself.metadata = {}\nself.rank_scheme = {1: 0.4, 2: 0.3, 3: 0.2, 4: 0.1, 5: 0.0, 6: 0.0}", "cv_scores = []\nfor model_name in self.cv_results:\n cv_scores.append(self.cv...
<|body_start_0|> self.model_names = [] self.model_weights = {} self.cv_results = {} self.predictions_by_model = {} self.weighted_average_predictions = {} self.metadata = {} self.rank_scheme = {1: 0.4, 2: 0.3, 3: 0.2, 4: 0.1, 5: 0.0, 6: 0.0} <|end_body_0|> <|body_...
Methods and attributes to average the predictions of a group of models.
WeightedAverage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeightedAverage: """Methods and attributes to average the predictions of a group of models.""" def __init__(self): """rank_scheme: weights applied to each model rank, where the first-ranked model is the best.""" <|body_0|> def calculate_model_weights(self): """As...
stack_v2_sparse_classes_36k_train_021453
3,100
permissive
[ { "docstring": "rank_scheme: weights applied to each model rank, where the first-ranked model is the best.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Assign weights to each model's prediction.", "name": "calculate_model_weights", "signature": "def calculat...
5
stack_v2_sparse_classes_30k_train_003221
Implement the Python class `WeightedAverage` described below. Class description: Methods and attributes to average the predictions of a group of models. Method signatures and docstrings: - def __init__(self): rank_scheme: weights applied to each model rank, where the first-ranked model is the best. - def calculate_mo...
Implement the Python class `WeightedAverage` described below. Class description: Methods and attributes to average the predictions of a group of models. Method signatures and docstrings: - def __init__(self): rank_scheme: weights applied to each model rank, where the first-ranked model is the best. - def calculate_mo...
7e73d6a51bb3e8d2963c6d2f021caac2108cc4c0
<|skeleton|> class WeightedAverage: """Methods and attributes to average the predictions of a group of models.""" def __init__(self): """rank_scheme: weights applied to each model rank, where the first-ranked model is the best.""" <|body_0|> def calculate_model_weights(self): """As...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeightedAverage: """Methods and attributes to average the predictions of a group of models.""" def __init__(self): """rank_scheme: weights applied to each model rank, where the first-ranked model is the best.""" self.model_names = [] self.model_weights = {} self.cv_results...
the_stack_v2_python_sparse
models/weighted_average.py
tzhangwps/Recession-Predictor
train
26
10323c3277187b84d7be49819f9c117b2bfc966f
[ "self.capacity = capacity\nself.cache = dict()\nself.usedtime = dict()\nself.usedtimeheap = []\nself.time = -1", "if key not in self.cache:\n return -1\nself.time += 1\nheapq.heappush(self.usedtimeheap, (self.time, key))\nself.usedtime[key] = self.time\nreturn self.cache[key]", "self.time += 1\nif key in sel...
<|body_start_0|> self.capacity = capacity self.cache = dict() self.usedtime = dict() self.usedtimeheap = [] self.time = -1 <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 self.time += 1 heapq.heappush(self.usedtimeheap, (se...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_021454
1,462
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
4d340a45fb2e9459d47cbe179ebfa7a82e5f1b8c
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.cache = dict() self.usedtime = dict() self.usedtimeheap = [] self.time = -1 def get(self, key): """:type key: int :rtype: int""" if key not in se...
the_stack_v2_python_sparse
146_LRUCache/solution2.py
llgeek/leetcode
train
1
0992cd38aa81bb34086865ad3d282a3a5460bb7a
[ "ret = Trie(a_ignorecase=True)\nfor lexpath_i in a_lexicons:\n lexname = os.path.splitext(os.path.basename(lexpath_i))[0]\n self._logger.debug('Reading lexicon %s...', lexname)\n lexicon = pd.read_table(lexpath_i, header=None, names=LEX_CLMS, dtype=LEX_TYPES, encoding=a_encoding, error_bad_lines=False, war...
<|body_start_0|> ret = Trie(a_ignorecase=True) for lexpath_i in a_lexicons: lexname = os.path.splitext(os.path.basename(lexpath_i))[0] self._logger.debug('Reading lexicon %s...', lexname) lexicon = pd.read_table(lexpath_i, header=None, names=LEX_CLMS, dtype=LEX_TYPES,...
Abstract class for lexicon-based SA using conditional probabilities.
CondProbLexiconBaseAnalyzer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CondProbLexiconBaseAnalyzer: """Abstract class for lexicon-based SA using conditional probabilities.""" def _read_lexicons(self, a_lexicons, a_encoding=ENCODING): """Overrides the method of the parent class, superseding. Args: a_lexicons (list): tags of the input instance a_encoding ...
stack_v2_sparse_classes_36k_train_021455
21,801
permissive
[ { "docstring": "Overrides the method of the parent class, superseding. Args: a_lexicons (list): tags of the input instance a_encoding (str): input encoding Returns: cgsa.utils.trie.Trie: constructed polar terms trie", "name": "_read_lexicons", "signature": "def _read_lexicons(self, a_lexicons, a_encodin...
2
stack_v2_sparse_classes_30k_train_015205
Implement the Python class `CondProbLexiconBaseAnalyzer` described below. Class description: Abstract class for lexicon-based SA using conditional probabilities. Method signatures and docstrings: - def _read_lexicons(self, a_lexicons, a_encoding=ENCODING): Overrides the method of the parent class, superseding. Args: ...
Implement the Python class `CondProbLexiconBaseAnalyzer` described below. Class description: Abstract class for lexicon-based SA using conditional probabilities. Method signatures and docstrings: - def _read_lexicons(self, a_lexicons, a_encoding=ENCODING): Overrides the method of the parent class, superseding. Args: ...
c5af073f064db67d92b22705899c0d0263caec58
<|skeleton|> class CondProbLexiconBaseAnalyzer: """Abstract class for lexicon-based SA using conditional probabilities.""" def _read_lexicons(self, a_lexicons, a_encoding=ENCODING): """Overrides the method of the parent class, superseding. Args: a_lexicons (list): tags of the input instance a_encoding ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CondProbLexiconBaseAnalyzer: """Abstract class for lexicon-based SA using conditional probabilities.""" def _read_lexicons(self, a_lexicons, a_encoding=ENCODING): """Overrides the method of the parent class, superseding. Args: a_lexicons (list): tags of the input instance a_encoding (str): input ...
the_stack_v2_python_sparse
cgsa/lexicon/base.py
gghidiu/CGSA
train
0
90bb4f0e13c4dfbad464e855fa6ce8530677ba8b
[ "if not -2 ** 31 < x < 2 ** 31 - 1:\n return 0\nif x < 0:\n y = int(str(-x)[::-1]) * -1\nelse:\n y = int(str(x)[::-1])\nif not -2 ** 31 < y < 2 ** 31 - 1:\n return 0\nreturn y", "x = str(x)\nif '-' not in str(x):\n y = int(str(x)[::-1])\nelse:\n x = [v for v in x if v != '-']\n x = ''.join(x)...
<|body_start_0|> if not -2 ** 31 < x < 2 ** 31 - 1: return 0 if x < 0: y = int(str(-x)[::-1]) * -1 else: y = int(str(x)[::-1]) if not -2 ** 31 < y < 2 ** 31 - 1: return 0 return y <|end_body_0|> <|body_start_1|> x = str(x) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse_str(self, x): """:type x: int :rtype: int""" <|body_1|> def reverse_math(self, x): """:type x: int :rtype: int""" <|body_2|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_021456
1,905
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse_str", "signature": "def reverse_str(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse_math",...
3
stack_v2_sparse_classes_30k_test_000801
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse_str(self, x): :type x: int :rtype: int - def reverse_math(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse_str(self, x): :type x: int :rtype: int - def reverse_math(self, x): :type x: int :rtype: int <|skeleton|> class Solu...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse_str(self, x): """:type x: int :rtype: int""" <|body_1|> def reverse_math(self, x): """:type x: int :rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """:type x: int :rtype: int""" if not -2 ** 31 < x < 2 ** 31 - 1: return 0 if x < 0: y = int(str(-x)[::-1]) * -1 else: y = int(str(x)[::-1]) if not -2 ** 31 < y < 2 ** 31 - 1: return 0 ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00007.Reverse Integer.py
roger6blog/LeetCode
train
0
3035c4c4d58d458eafadde25f21844f34872f05a
[ "super(HistoryWithEarlyStopping, self).__init__(historydir)\nassert isinstance(max_patience, int), '\"max_patience\" should be a positive integer.'\nassert isinstance(max_change, int), '\"max_change\" should be a positive integer.'\nself.patience = 0\nself.change = 0\nself.max_patience = max_patience\nself.max_chan...
<|body_start_0|> super(HistoryWithEarlyStopping, self).__init__(historydir) assert isinstance(max_patience, int), '"max_patience" should be a positive integer.' assert isinstance(max_change, int), '"max_change" should be a positive integer.' self.patience = 0 self.change = 0 ...
This class implements History class with early stopping signals. Control (or try to control) training by returning behavior flags. Early stopping is applied.
HistoryWithEarlyStopping
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HistoryWithEarlyStopping: """This class implements History class with early stopping signals. Control (or try to control) training by returning behavior flags. Early stopping is applied.""" def __init__(self, historydir, max_patience=10, max_change=3): """This function initializes th...
stack_v2_sparse_classes_36k_train_021457
12,468
permissive
[ { "docstring": "This function initializes the class. Initialize with how long we wait and how many times we change learning rate. Learning rate change is done by a scheduler, not by this class. Parameters --------- historydir: string a string of path where we should make history directory. training history will...
2
stack_v2_sparse_classes_30k_train_017454
Implement the Python class `HistoryWithEarlyStopping` described below. Class description: This class implements History class with early stopping signals. Control (or try to control) training by returning behavior flags. Early stopping is applied. Method signatures and docstrings: - def __init__(self, historydir, max...
Implement the Python class `HistoryWithEarlyStopping` described below. Class description: This class implements History class with early stopping signals. Control (or try to control) training by returning behavior flags. Early stopping is applied. Method signatures and docstrings: - def __init__(self, historydir, max...
7585261dd1b1c6c99dada5d2d1aabf482e89e880
<|skeleton|> class HistoryWithEarlyStopping: """This class implements History class with early stopping signals. Control (or try to control) training by returning behavior flags. Early stopping is applied.""" def __init__(self, historydir, max_patience=10, max_change=3): """This function initializes th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HistoryWithEarlyStopping: """This class implements History class with early stopping signals. Control (or try to control) training by returning behavior flags. Early stopping is applied.""" def __init__(self, historydir, max_patience=10, max_change=3): """This function initializes the class. Init...
the_stack_v2_python_sparse
lemontree/controls/history.py
khshim/lemontree
train
3
34289ca0ce5ec0431cbe4dbfe9942e3e5fa84c72
[ "if not value:\n return []\ndelimters = '[, \\\\-!?:\\t]+'\nreturn list(filter(None, re.split(delimters, value)))", "super(MultiPriceField, self).validate(value)\nif len(value) > 0 and len(value) != 11:\n raise ValidationError('Must have 11 values, separated by commas, spaces or tabs.')\nfor price in value:...
<|body_start_0|> if not value: return [] delimters = '[, \\-!?:\t]+' return list(filter(None, re.split(delimters, value))) <|end_body_0|> <|body_start_1|> super(MultiPriceField, self).validate(value) if len(value) > 0 and len(value) != 11: raise Validatio...
MultiPriceField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiPriceField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not value: ...
stack_v2_sparse_classes_36k_train_021458
6,902
no_license
[ { "docstring": "Normalize data to a list of strings.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Check if value consists only of valid emails.", "name": "validate", "signature": "def validate(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_000109
Implement the Python class `MultiPriceField` described below. Class description: Implement the MultiPriceField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails.
Implement the Python class `MultiPriceField` described below. Class description: Implement the MultiPriceField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails. <|skeleton|> class Mult...
ebff02b1e6c95b653f027f0e05125b754c6af5af
<|skeleton|> class MultiPriceField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiPriceField: def to_python(self, value): """Normalize data to a list of strings.""" if not value: return [] delimters = '[, \\-!?:\t]+' return list(filter(None, re.split(delimters, value))) def validate(self, value): """Check if value consists only ...
the_stack_v2_python_sparse
lcf/forms.py
gamzatti/lcf
train
0
5dc9fdf5b7156f915f03771ce9dca1b36c9413d6
[ "data = request.query_params\nnext_month_only = data.get('next_month_only', True)\nnext_month_days_off = get_ua_days_off(next_month_only)\nreturn json_response_success(data=next_month_days_off)", "email = request.data.get('email', None)\nif not email:\n return json_response_error(\"Should provide customer's em...
<|body_start_0|> data = request.query_params next_month_only = data.get('next_month_only', True) next_month_days_off = get_ua_days_off(next_month_only) return json_response_success(data=next_month_days_off) <|end_body_0|> <|body_start_1|> email = request.data.get('email', None) ...
DaysOff
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DaysOff: def get(self, request): """parameters: - name: next_month_only description: show only next month days off required: false type: bool""" <|body_0|> def post(self, request): """parameters: - name: email description: client's email to whom we should send an ema...
stack_v2_sparse_classes_36k_train_021459
43,187
no_license
[ { "docstring": "parameters: - name: next_month_only description: show only next month days off required: false type: bool", "name": "get", "signature": "def get(self, request)" }, { "docstring": "parameters: - name: email description: client's email to whom we should send an email required: true...
2
stack_v2_sparse_classes_30k_test_000698
Implement the Python class `DaysOff` described below. Class description: Implement the DaysOff class. Method signatures and docstrings: - def get(self, request): parameters: - name: next_month_only description: show only next month days off required: false type: bool - def post(self, request): parameters: - name: ema...
Implement the Python class `DaysOff` described below. Class description: Implement the DaysOff class. Method signatures and docstrings: - def get(self, request): parameters: - name: next_month_only description: show only next month days off required: false type: bool - def post(self, request): parameters: - name: ema...
ef392f0ec6f5a4eac2ecb48606ccfe753ffacd2e
<|skeleton|> class DaysOff: def get(self, request): """parameters: - name: next_month_only description: show only next month days off required: false type: bool""" <|body_0|> def post(self, request): """parameters: - name: email description: client's email to whom we should send an ema...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DaysOff: def get(self, request): """parameters: - name: next_month_only description: show only next month days off required: false type: bool""" data = request.query_params next_month_only = data.get('next_month_only', True) next_month_days_off = get_ua_days_off(next_month_only...
the_stack_v2_python_sparse
erp_django/apps/core/views.py
Uvik-Software/erp-django
train
0
2bd6a5b6804b37d8349b5cf1512d564ac77dcf6d
[ "super(BcombCombiner, self).__init__(prob_estimators=prob_estimators, verbose=verbose)\nself.k = k\nself.s = s\nself.beta = beta\nself.bcomb_prior_log_prob = None\nself.prev_word2id = {}", "if self.bcomb_prior_log_prob is None or self.prev_word2id != word2id:\n self.bcomb_prior_log_prob = self.get_prior_log_pr...
<|body_start_0|> super(BcombCombiner, self).__init__(prob_estimators=prob_estimators, verbose=verbose) self.k = k self.s = s self.beta = beta self.bcomb_prior_log_prob = None self.prev_word2id = {} <|end_body_0|> <|body_start_1|> if self.bcomb_prior_log_prob is N...
BcombCombiner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BcombCombiner: def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): """Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\propto...
stack_v2_sparse_classes_36k_train_021460
12,750
permissive
[ { "docstring": "Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\\\propto \\\\displaystyle \\\\frac{P(w|C)P(w|T)}{P(w)^\\\\beta}`, where :math:`\\\\beta` -- is a parameter controlling how we penalize frequent words and :math:`...
4
stack_v2_sparse_classes_30k_train_013108
Implement the Python class `BcombCombiner` described below. Class description: Implement the BcombCombiner class. Method signatures and docstrings: - def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): Combines models predictions with the lo...
Implement the Python class `BcombCombiner` described below. Class description: Implement the BcombCombiner class. Method signatures and docstrings: - def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): Combines models predictions with the lo...
c87f67e5fe51fc8307b5d5ff8f404f202f17ab5e
<|skeleton|> class BcombCombiner: def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): """Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\propto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BcombCombiner: def __init__(self, prob_estimators: List[BaseProbEstimator], k: float=4.0, s: float=1.05, beta: float=0.0, verbose: bool=False): """Combines models predictions with the log-probs that comes from embedding similarity scores according to the formula :math:`P(w|C, T) \\propto \\displaystyl...
the_stack_v2_python_sparse
lexsubgen/prob_estimators/combiner.py
agoel00/LexSubGen
train
0
658244538eaa6488439b4d4dab8e124db83a6892
[ "from heapq import *\nself.l = []\nself.r = []", "if len(self.l) == len(self.r):\n heappush(self.r, -heappushpop(self.l, -num))\nelse:\n heappush(self.l, -heappushpop(self.r, num))", "if len(self.l) == len(self.r):\n return (self.r[0] - self.l[0]) / 2.0\nelse:\n return self.r[0]" ]
<|body_start_0|> from heapq import * self.l = [] self.r = [] <|end_body_0|> <|body_start_1|> if len(self.l) == len(self.r): heappush(self.r, -heappushpop(self.l, -num)) else: heappush(self.l, -heappushpop(self.r, num)) <|end_body_1|> <|body_start_2|> ...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_021461
1,661
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: None", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
null
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float <|skeleton|> class Me...
45be00e9451ea0b3a8fe8f77f9b0d28d92b6482b
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" from heapq import * self.l = [] self.r = [] def addNum(self, num): """:type num: int :rtype: None""" if len(self.l) == len(self.r): heappush(self.r, -heappushpop(self.l...
the_stack_v2_python_sparse
Python/C295.py
reyllama/leetcode
train
0
20c2dcae35bc686dfc4a705b25d016f285dd72f6
[ "self.X = X_init\nself.Y = Y_init\nself.L = L\nself.sigma_f = sigma_f\nself.K = self.kernel(self.X, self.X)", "sqdist = np.sum(X1 ** 2, 1).reshape(-1, 1) + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T)\ncovMatrix = self.sigma_f ** 2 * np.exp(-0.5 / self.L ** 2 * sqdist)\nprint(covMatrix)\nreturn covMatrix", "kern =...
<|body_start_0|> self.X = X_init self.Y = Y_init self.L = L self.sigma_f = sigma_f self.K = self.kernel(self.X, self.X) <|end_body_0|> <|body_start_1|> sqdist = np.sum(X1 ** 2, 1).reshape(-1, 1) + np.sum(X2 ** 2, 1) - 2 * np.dot(X1, X2.T) covMatrix = self.sigma_f...
Class reoresents noisless 1D Gaussian Process
GaussianProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcess: """Class reoresents noisless 1D Gaussian Process""" def __init__(self, X_init, Y_init, L=1, sigma_f=1): """class comstructor :param self: :param X_init: np.ndarray (t,1) imputs sampled with black-box function :param Y_init:np.ndarray (t, 1) outputs of the black box f...
stack_v2_sparse_classes_36k_train_021462
2,465
no_license
[ { "docstring": "class comstructor :param self: :param X_init: np.ndarray (t,1) imputs sampled with black-box function :param Y_init:np.ndarray (t, 1) outputs of the black box function for X_init :param L: length parameter for the kernel :param sigma_f: standard deviation given output :return: covariance np.ndar...
3
null
Implement the Python class `GaussianProcess` described below. Class description: Class reoresents noisless 1D Gaussian Process Method signatures and docstrings: - def __init__(self, X_init, Y_init, L=1, sigma_f=1): class comstructor :param self: :param X_init: np.ndarray (t,1) imputs sampled with black-box function :...
Implement the Python class `GaussianProcess` described below. Class description: Class reoresents noisless 1D Gaussian Process Method signatures and docstrings: - def __init__(self, X_init, Y_init, L=1, sigma_f=1): class comstructor :param self: :param X_init: np.ndarray (t,1) imputs sampled with black-box function :...
4ac942126918c7acaa9ef88d18efe299b2f726fe
<|skeleton|> class GaussianProcess: """Class reoresents noisless 1D Gaussian Process""" def __init__(self, X_init, Y_init, L=1, sigma_f=1): """class comstructor :param self: :param X_init: np.ndarray (t,1) imputs sampled with black-box function :param Y_init:np.ndarray (t, 1) outputs of the black box f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianProcess: """Class reoresents noisless 1D Gaussian Process""" def __init__(self, X_init, Y_init, L=1, sigma_f=1): """class comstructor :param self: :param X_init: np.ndarray (t,1) imputs sampled with black-box function :param Y_init:np.ndarray (t, 1) outputs of the black box function for X...
the_stack_v2_python_sparse
unsupervised_learning/ 0x03-hyperparameter_tuning/1-gp.py
DracoMindz/holbertonschool-machine_learning
train
2
31381aad5e917d9b8ff41b2af4452ae061562f69
[ "if o not in '^v':\n raise ValueError(\"Invalid triangle order: '{}'\".format(o))\nif a not in '<^>':\n raise ValueError(\"Invalid triangle alignment: '{}'\".format(a))\nif isinstance(char, str):\n char = [char]\nself.char = char\nself.nlevels = nlevels\nself.n1 = n1\nself.rm = rm\nself.lm = lm\nself.add =...
<|body_start_0|> if o not in '^v': raise ValueError("Invalid triangle order: '{}'".format(o)) if a not in '<^>': raise ValueError("Invalid triangle alignment: '{}'".format(a)) if isinstance(char, str): char = [char] self.char = char self.nlevel...
An ASCII text triangle. Formula for the amount of characters in each level of the triangle:: first level: nchars[1] = n1 following levels: nchars[i] = nchars[i-1]*rm + i*lm + add The triangle can be constructed of a string consisting of a single character (see the first example), a string consisting of multiple charact...
TextTriangle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextTriangle: """An ASCII text triangle. Formula for the amount of characters in each level of the triangle:: first level: nchars[1] = n1 following levels: nchars[i] = nchars[i-1]*rm + i*lm + add The triangle can be constructed of a string consisting of a single character (see the first example),...
stack_v2_sparse_classes_36k_train_021463
7,606
no_license
[ { "docstring": "Create a new text triangle.", "name": "__init__", "signature": "def __init__(self, char='*', n1=1, rm=0, lm=1, add=1, nlevels=5, o='^', a='<')" }, { "docstring": "Format a text triangle as a string.", "name": "__str__", "signature": "def __str__(self)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_014727
Implement the Python class `TextTriangle` described below. Class description: An ASCII text triangle. Formula for the amount of characters in each level of the triangle:: first level: nchars[1] = n1 following levels: nchars[i] = nchars[i-1]*rm + i*lm + add The triangle can be constructed of a string consisting of a si...
Implement the Python class `TextTriangle` described below. Class description: An ASCII text triangle. Formula for the amount of characters in each level of the triangle:: first level: nchars[1] = n1 following levels: nchars[i] = nchars[i-1]*rm + i*lm + add The triangle can be constructed of a string consisting of a si...
c80ea145c758f3b392f956e4311f11cfc099a149
<|skeleton|> class TextTriangle: """An ASCII text triangle. Formula for the amount of characters in each level of the triangle:: first level: nchars[1] = n1 following levels: nchars[i] = nchars[i-1]*rm + i*lm + add The triangle can be constructed of a string consisting of a single character (see the first example),...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextTriangle: """An ASCII text triangle. Formula for the amount of characters in each level of the triangle:: first level: nchars[1] = n1 following levels: nchars[i] = nchars[i-1]*rm + i*lm + add The triangle can be constructed of a string consisting of a single character (see the first example), a string con...
the_stack_v2_python_sparse
dailyprogrammer/plugins/asciiart.py
UltimateTimmeh/r-daily-programmer
train
0
75bc9682a1a29cb00f318098445f6f7a8c801b6c
[ "city_link_list = response.xpath('//div[@class=\"all\"]//a/@href').extract()\ncity_name_list = response.xpath('//div[@class=\"all\"]//a/text()').extract()\nfor city_link, city_name in zip(city_link_list, city_name_list):\n yield scrapy.Request(url=self.base_url + city_link, meta={'city': city_name}, callback=sel...
<|body_start_0|> city_link_list = response.xpath('//div[@class="all"]//a/@href').extract() city_name_list = response.xpath('//div[@class="all"]//a/text()').extract() for city_link, city_name in zip(city_link_list, city_name_list): yield scrapy.Request(url=self.base_url + city_link, m...
AqiRedisSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AqiRedisSpider: def parse(self, response): """解析城市列表页, 获得所有城市的链接""" <|body_0|> def parse_month(self, response): """解析每个城市的月份链接""" <|body_1|> def parse_day(self, response): """解析每天的数据""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021464
3,175
no_license
[ { "docstring": "解析城市列表页, 获得所有城市的链接", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "解析每个城市的月份链接", "name": "parse_month", "signature": "def parse_month(self, response)" }, { "docstring": "解析每天的数据", "name": "parse_day", "signature": "def parse_...
3
stack_v2_sparse_classes_30k_train_009380
Implement the Python class `AqiRedisSpider` described below. Class description: Implement the AqiRedisSpider class. Method signatures and docstrings: - def parse(self, response): 解析城市列表页, 获得所有城市的链接 - def parse_month(self, response): 解析每个城市的月份链接 - def parse_day(self, response): 解析每天的数据
Implement the Python class `AqiRedisSpider` described below. Class description: Implement the AqiRedisSpider class. Method signatures and docstrings: - def parse(self, response): 解析城市列表页, 获得所有城市的链接 - def parse_month(self, response): 解析每个城市的月份链接 - def parse_day(self, response): 解析每天的数据 <|skeleton|> class AqiRedisSpid...
298869fa9fb0291b9e364fbf4a6d8bd992840eb2
<|skeleton|> class AqiRedisSpider: def parse(self, response): """解析城市列表页, 获得所有城市的链接""" <|body_0|> def parse_month(self, response): """解析每个城市的月份链接""" <|body_1|> def parse_day(self, response): """解析每天的数据""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AqiRedisSpider: def parse(self, response): """解析城市列表页, 获得所有城市的链接""" city_link_list = response.xpath('//div[@class="all"]//a/@href').extract() city_name_list = response.xpath('//div[@class="all"]//a/text()').extract() for city_link, city_name in zip(city_link_list, city_name_lis...
the_stack_v2_python_sparse
Scrapy/AQI/AQI/AQI/spiders/aqi_spider_redis.py
AssassinHotstrip/personal_spider_pra
train
0
bf244c8d59f7592201f06cb1c6b38b4b540dd931
[ "if not request.user.has_perm('Users.props_list'):\n return HttpResponseForbidden()\nuser = user_backend.get(username=name)\nprops = property_backend.list(user=user)\nreturn HttpRestAuthResponse(request, props)", "if not request.user.has_perm('Users.prop_create'):\n return HttpResponseForbidden()\nkey, valu...
<|body_start_0|> if not request.user.has_perm('Users.props_list'): return HttpResponseForbidden() user = user_backend.get(username=name) props = property_backend.list(user=user) return HttpRestAuthResponse(request, props) <|end_body_0|> <|body_start_1|> if not reques...
Handle requests to ``/users/<user>/props/``.
UserPropsIndex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPropsIndex: """Handle requests to ``/users/<user>/props/``.""" def get(self, request, largs, name): """Get all properties of a user.""" <|body_0|> def post(self, request, largs, name, dry=False): """Create a new property.""" <|body_1|> def put(se...
stack_v2_sparse_classes_36k_train_021465
9,743
no_license
[ { "docstring": "Get all properties of a user.", "name": "get", "signature": "def get(self, request, largs, name)" }, { "docstring": "Create a new property.", "name": "post", "signature": "def post(self, request, largs, name, dry=False)" }, { "docstring": "Set multiple properties....
3
stack_v2_sparse_classes_30k_train_015201
Implement the Python class `UserPropsIndex` described below. Class description: Handle requests to ``/users/<user>/props/``. Method signatures and docstrings: - def get(self, request, largs, name): Get all properties of a user. - def post(self, request, largs, name, dry=False): Create a new property. - def put(self, ...
Implement the Python class `UserPropsIndex` described below. Class description: Handle requests to ``/users/<user>/props/``. Method signatures and docstrings: - def get(self, request, largs, name): Get all properties of a user. - def post(self, request, largs, name, dry=False): Create a new property. - def put(self, ...
60769f6b4965836b2220878cfa2e1bc403d8f8a3
<|skeleton|> class UserPropsIndex: """Handle requests to ``/users/<user>/props/``.""" def get(self, request, largs, name): """Get all properties of a user.""" <|body_0|> def post(self, request, largs, name, dry=False): """Create a new property.""" <|body_1|> def put(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserPropsIndex: """Handle requests to ``/users/<user>/props/``.""" def get(self, request, largs, name): """Get all properties of a user.""" if not request.user.has_perm('Users.props_list'): return HttpResponseForbidden() user = user_backend.get(username=name) p...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/RestAuth/Users/views.py
sachinlokesh05/login-registration-forgotpassword-and-resetpassword-using-django-rest-framework-
train
3
5b02ee3954eca5435824b3b552575275d60cac50
[ "wx.Frame.__init__(self, parent, id, 'wxYield Test')\nwx.Button(self, ID_START, 'Start', pos=(0, 0))\nwx.Button(self, ID_STOP, 'Stop', pos=(0, 50))\nself.status = wx.StaticText(self, -1, '', pos=(0, 100))\nself.Bind(wx.EVT_BUTTON, self.OnStart, id=ID_START)\nself.Bind(wx.EVT_BUTTON, self.OnStop, id=ID_STOP)\nself.w...
<|body_start_0|> wx.Frame.__init__(self, parent, id, 'wxYield Test') wx.Button(self, ID_START, 'Start', pos=(0, 0)) wx.Button(self, ID_STOP, 'Stop', pos=(0, 50)) self.status = wx.StaticText(self, -1, '', pos=(0, 100)) self.Bind(wx.EVT_BUTTON, self.OnStart, id=ID_START) se...
Class MainFrame.
MainFrame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainFrame: """Class MainFrame.""" def __init__(self, parent, id): """Create the MainFrame.""" <|body_0|> def OnStart(self, event): """Start Computation.""" <|body_1|> def OnStop(self, event): """Stop Computation.""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_021466
3,167
no_license
[ { "docstring": "Create the MainFrame.", "name": "__init__", "signature": "def __init__(self, parent, id)" }, { "docstring": "Start Computation.", "name": "OnStart", "signature": "def OnStart(self, event)" }, { "docstring": "Stop Computation.", "name": "OnStop", "signature...
3
stack_v2_sparse_classes_30k_train_016214
Implement the Python class `MainFrame` described below. Class description: Class MainFrame. Method signatures and docstrings: - def __init__(self, parent, id): Create the MainFrame. - def OnStart(self, event): Start Computation. - def OnStop(self, event): Stop Computation.
Implement the Python class `MainFrame` described below. Class description: Class MainFrame. Method signatures and docstrings: - def __init__(self, parent, id): Create the MainFrame. - def OnStart(self, event): Start Computation. - def OnStop(self, event): Stop Computation. <|skeleton|> class MainFrame: """Class ...
979436525c57fdaeaa832e960985e0406e123587
<|skeleton|> class MainFrame: """Class MainFrame.""" def __init__(self, parent, id): """Create the MainFrame.""" <|body_0|> def OnStart(self, event): """Start Computation.""" <|body_1|> def OnStop(self, event): """Stop Computation.""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainFrame: """Class MainFrame.""" def __init__(self, parent, id): """Create the MainFrame.""" wx.Frame.__init__(self, parent, id, 'wxYield Test') wx.Button(self, ID_START, 'Start', pos=(0, 0)) wx.Button(self, ID_STOP, 'Stop', pos=(0, 50)) self.status = wx.StaticTex...
the_stack_v2_python_sparse
Research/wx doco/somelongthread2_yield.py
abulka/pynsource
train
271
f7b0d716b3202ae85f8593e8e999a52f1a143b04
[ "timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_cocoa_time.CocoaTime(timestamp=timestamp)", "query_hash = hash(query)\nevent_data = IOSDatausageEventData()\nevent_data.bundle_identifier = self._GetRowValue(query_hash, row, 'ZBUNDLENAME')\neven...
<|body_start_0|> timestamp = self._GetRowValue(query_hash, row, value_name) if timestamp is None: return None return dfdatetime_cocoa_time.CocoaTime(timestamp=timestamp) <|end_body_0|> <|body_start_1|> query_hash = hash(query) event_data = IOSDatausageEventData() ...
SQLite parser plugin for iOS DataUsage database.
IOSDatausagePlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IOSDatausagePlugin: """SQLite parser plugin for iOS DataUsage database.""" def _GetTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. ro...
stack_v2_sparse_classes_36k_train_021467
4,379
permissive
[ { "docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.CocoaTime: date and time value or None if not available.", "name...
2
stack_v2_sparse_classes_30k_train_013237
Implement the Python class `IOSDatausagePlugin` described below. Class description: SQLite parser plugin for iOS DataUsage database. Method signatures and docstrings: - def _GetTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, tha...
Implement the Python class `IOSDatausagePlugin` described below. Class description: SQLite parser plugin for iOS DataUsage database. Method signatures and docstrings: - def _GetTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, tha...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class IOSDatausagePlugin: """SQLite parser plugin for iOS DataUsage database.""" def _GetTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. ro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IOSDatausagePlugin: """SQLite parser plugin for iOS DataUsage database.""" def _GetTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Ro...
the_stack_v2_python_sparse
plaso/parsers/sqlite_plugins/ios_datausage.py
log2timeline/plaso
train
1,506
820fbc8c0f80aef66fee06ac927ec4a4e7525741
[ "supported_hashes = ', '.join(cls._SUPPORTED_HASHES)\nargument_group.add_argument('--viper-hash', '--viper_hash', dest='viper_hash', type=str, action='store', choices=cls._SUPPORTED_HASHES, default=cls._DEFAULT_HASH, metavar='HASH', help=f'Type of hash to use to query the Viper server, the default is: {cls._DEFAULT...
<|body_start_0|> supported_hashes = ', '.join(cls._SUPPORTED_HASHES) argument_group.add_argument('--viper-hash', '--viper_hash', dest='viper_hash', type=str, action='store', choices=cls._SUPPORTED_HASHES, default=cls._DEFAULT_HASH, metavar='HASH', help=f'Type of hash to use to query the Viper server, th...
Viper analysis plugin CLI arguments helper.
ViperAnalysisArgumentsHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViperAnalysisArgumentsHelper: """Viper analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the co...
stack_v2_sparse_classes_36k_train_021468
4,018
permissive
[ { "docstring": "Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group.", ...
2
stack_v2_sparse_classes_30k_train_007376
Implement the Python class `ViperAnalysisArgumentsHelper` described below. Class description: Viper analysis plugin CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments the helper supports to an argument group. This function takes an argument par...
Implement the Python class `ViperAnalysisArgumentsHelper` described below. Class description: Viper analysis plugin CLI arguments helper. Method signatures and docstrings: - def AddArguments(cls, argument_group): Adds command line arguments the helper supports to an argument group. This function takes an argument par...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class ViperAnalysisArgumentsHelper: """Viper analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViperAnalysisArgumentsHelper: """Viper analysis plugin CLI arguments helper.""" def AddArguments(cls, argument_group): """Adds command line arguments the helper supports to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line ar...
the_stack_v2_python_sparse
plaso/cli/helpers/viper_analysis.py
log2timeline/plaso
train
1,506
2b446500bba1d59b8c8ce810d52a2c75100ed38f
[ "if n == 0:\n return False\nwhile not n % 2:\n n = n / 2\nreturn n == 1", "if n == 0:\n return False\nwhile not n % base:\n n = n / base\nreturn n == 1" ]
<|body_start_0|> if n == 0: return False while not n % 2: n = n / 2 return n == 1 <|end_body_0|> <|body_start_1|> if n == 0: return False while not n % base: n = n / base return n == 1 <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPowerOfTwo(self, n): """:type n: int :rtype: bool""" <|body_0|> def isPowerOf(self, n, base): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return False while not n % 2: ...
stack_v2_sparse_classes_36k_train_021469
545
no_license
[ { "docstring": ":type n: int :rtype: bool", "name": "isPowerOfTwo", "signature": "def isPowerOfTwo(self, n)" }, { "docstring": ":type n: int :rtype: bool", "name": "isPowerOf", "signature": "def isPowerOf(self, n, base)" } ]
2
stack_v2_sparse_classes_30k_train_012850
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfTwo(self, n): :type n: int :rtype: bool - def isPowerOf(self, n, base): :type n: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPowerOfTwo(self, n): :type n: int :rtype: bool - def isPowerOf(self, n, base): :type n: int :rtype: bool <|skeleton|> class Solution: def isPowerOfTwo(self, n): ...
6ea4e05adf246942949f7faa15ec5175ed646760
<|skeleton|> class Solution: def isPowerOfTwo(self, n): """:type n: int :rtype: bool""" <|body_0|> def isPowerOf(self, n, base): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPowerOfTwo(self, n): """:type n: int :rtype: bool""" if n == 0: return False while not n % 2: n = n / 2 return n == 1 def isPowerOf(self, n, base): """:type n: int :rtype: bool""" if n == 0: return False ...
the_stack_v2_python_sparse
algorithms/Power of Two.py
abos5/leetcode
train
0
cf991326c363f170393697abb3b6859ba1801bf4
[ "timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_posix_time.PosixTime(timestamp=timestamp)", "query_hash = hash(query)\nevent_data = IOSPowerlogApplicationUsageEventData()\nevent_data.background_time = self._GetRowValue(query_hash, row, 'Backgr...
<|body_start_0|> timestamp = self._GetRowValue(query_hash, row, value_name) if timestamp is None: return None return dfdatetime_posix_time.PosixTime(timestamp=timestamp) <|end_body_0|> <|body_start_1|> query_hash = hash(query) event_data = IOSPowerlogApplicationUsage...
SQLite parser plugin for iOS powerlog database files.
IOSPowerlogApplicationUsagePlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IOSPowerlogApplicationUsagePlugin: """SQLite parser plugin for iOS powerlog database files.""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query t...
stack_v2_sparse_classes_36k_train_021470
3,949
permissive
[ { "docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.PosixTime: date and time value or None if not available.", "name...
2
null
Implement the Python class `IOSPowerlogApplicationUsagePlugin` described below. Class description: SQLite parser plugin for iOS powerlog database files. Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int)...
Implement the Python class `IOSPowerlogApplicationUsagePlugin` described below. Class description: SQLite parser plugin for iOS powerlog database files. Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int)...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class IOSPowerlogApplicationUsagePlugin: """SQLite parser plugin for iOS powerlog database files.""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IOSPowerlogApplicationUsagePlugin: """SQLite parser plugin for iOS powerlog database files.""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced ...
the_stack_v2_python_sparse
plaso/parsers/sqlite_plugins/ios_powerlog.py
log2timeline/plaso
train
1,506
7180d87c16adf53abb10af49603bc77db6a29b2a
[ "self.capacity = capacity\nself.size = 0\nself.mem = dict()\nself.head = None\nself.tail = None", "node.next = self.head\nif self.head:\n self.head.prev = node\nself.head = node\nif self.tail is None:\n self.tail = node", "if node == self.head and node == self.tail:\n self.head = None\n self.tail = ...
<|body_start_0|> self.capacity = capacity self.size = 0 self.mem = dict() self.head = None self.tail = None <|end_body_0|> <|body_start_1|> node.next = self.head if self.head: self.head.prev = node self.head = node if self.tail is None...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def add_node(self, node): """Add a node to the head of the DLL""" <|body_1|> def remove_node(self, node): """Remove a node in the DLL""" <|body_2|> def get(...
stack_v2_sparse_classes_36k_train_021471
3,216
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": "Add a node to the head of the DLL", "name": "add_node", "signature": "def add_node(self, node)" }, { "docstring": "Remove a node in the DLL", "name": "remo...
5
stack_v2_sparse_classes_30k_train_017551
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def add_node(self, node): Add a node to the head of the DLL - def remove_node(self, node): Remove a node in the DLL - def get(...
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def add_node(self, node): Add a node to the head of the DLL - def remove_node(self, node): Remove a node in the DLL - def get(...
43dbcc129de3092d1ef24b95eaf35e20363cbd93
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def add_node(self, node): """Add a node to the head of the DLL""" <|body_1|> def remove_node(self, node): """Remove a node in the DLL""" <|body_2|> def get(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.size = 0 self.mem = dict() self.head = None self.tail = None def add_node(self, node): """Add a node to the head of the DLL""" node.next = self.h...
the_stack_v2_python_sparse
lru-cache.py
iyyuan/leetcode-practice
train
0
d4697daa605f3eb2e3917e55d3cce49d4259465c
[ "sentiment = global_cons.NEUTRAL\nif score <= thresholds[0]:\n sentiment = global_cons.NEGATIVE\nif score >= thresholds[1]:\n sentiment = global_cons.POSITIVE\nreturn sentiment", "if not scores:\n logger.warning(msg='Empty baseline (scores) to calculate thresholds.')\n return (None, None)\nmu, std = n...
<|body_start_0|> sentiment = global_cons.NEUTRAL if score <= thresholds[0]: sentiment = global_cons.NEGATIVE if score >= thresholds[1]: sentiment = global_cons.POSITIVE return sentiment <|end_body_0|> <|body_start_1|> if not scores: logger.war...
InterfaceLabel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceLabel: def label_sentiment(score: float, thresholds: tuple) -> str: """Label sentiment on interface :param score: score of the text :param thresholds: thresholds of negative and positive sentiment :return: sentiment label""" <|body_0|> def calculate_threshold_positi...
stack_v2_sparse_classes_36k_train_021472
1,312
permissive
[ { "docstring": "Label sentiment on interface :param score: score of the text :param thresholds: thresholds of negative and positive sentiment :return: sentiment label", "name": "label_sentiment", "signature": "def label_sentiment(score: float, thresholds: tuple) -> str" }, { "docstring": "Calcul...
2
stack_v2_sparse_classes_30k_train_016459
Implement the Python class `InterfaceLabel` described below. Class description: Implement the InterfaceLabel class. Method signatures and docstrings: - def label_sentiment(score: float, thresholds: tuple) -> str: Label sentiment on interface :param score: score of the text :param thresholds: thresholds of negative an...
Implement the Python class `InterfaceLabel` described below. Class description: Implement the InterfaceLabel class. Method signatures and docstrings: - def label_sentiment(score: float, thresholds: tuple) -> str: Label sentiment on interface :param score: score of the text :param thresholds: thresholds of negative an...
c98eb8c483a05af938a2f6f49d8ea803f5711572
<|skeleton|> class InterfaceLabel: def label_sentiment(score: float, thresholds: tuple) -> str: """Label sentiment on interface :param score: score of the text :param thresholds: thresholds of negative and positive sentiment :return: sentiment label""" <|body_0|> def calculate_threshold_positi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterfaceLabel: def label_sentiment(score: float, thresholds: tuple) -> str: """Label sentiment on interface :param score: score of the text :param thresholds: thresholds of negative and positive sentiment :return: sentiment label""" sentiment = global_cons.NEUTRAL if score <= threshol...
the_stack_v2_python_sparse
engage-analytics/sentiment_analysis/src/model/labelling_interface.py
oliveriopt/mood-analytics
train
0
04b147bd293668441c54403ba4023e5ea646c183
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ExpirationPattern()", "from .expiration_pattern_type import ExpirationPatternType\nfrom .expiration_pattern_type import ExpirationPatternType\nfields: Dict[str, Callable[[Any], None]] = {'duration': lambda n: setattr(self, 'duration', ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ExpirationPattern() <|end_body_0|> <|body_start_1|> from .expiration_pattern_type import ExpirationPatternType from .expiration_pattern_type import ExpirationPatternType fields: ...
ExpirationPattern
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpirationPattern: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExpirationPattern: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_36k_train_021473
3,644
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ExpirationPattern", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `ExpirationPattern` described below. Class description: Implement the ExpirationPattern class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExpirationPattern: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `ExpirationPattern` described below. Class description: Implement the ExpirationPattern class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExpirationPattern: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ExpirationPattern: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExpirationPattern: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpirationPattern: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExpirationPattern: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Expi...
the_stack_v2_python_sparse
msgraph/generated/models/expiration_pattern.py
microsoftgraph/msgraph-sdk-python
train
135
d73af10547f6b8d92a5debc38b9ffd2694363908
[ "news = response.xpath(\"//a[@target='_blank']\")\nfor new in news:\n item = CDagency()\n item['col_name'] = 'CD06dangxiao'\n href = new.xpath('./@href').extract_first()\n detail_url = 'https://www.cddx.gov.cn' + href\n item['detail_url'] = detail_url\n yield scrapy.Request(detail_url, callback=se...
<|body_start_0|> news = response.xpath("//a[@target='_blank']") for new in news: item = CDagency() item['col_name'] = 'CD06dangxiao' href = new.xpath('./@href').extract_first() detail_url = 'https://www.cddx.gov.cn' + href item['detail_url'] = ...
CdDangxiaoSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CdDangxiaoSpider: def parse(self, response): """"默认的解析回调函数""" <|body_0|> def get_text(self, response): """获取详细的文本信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> news = response.xpath("//a[@target='_blank']") for new in news: i...
stack_v2_sparse_classes_36k_train_021474
2,954
no_license
[ { "docstring": "\"默认的解析回调函数", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "获取详细的文本信息", "name": "get_text", "signature": "def get_text(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_020847
Implement the Python class `CdDangxiaoSpider` described below. Class description: Implement the CdDangxiaoSpider class. Method signatures and docstrings: - def parse(self, response): "默认的解析回调函数 - def get_text(self, response): 获取详细的文本信息
Implement the Python class `CdDangxiaoSpider` described below. Class description: Implement the CdDangxiaoSpider class. Method signatures and docstrings: - def parse(self, response): "默认的解析回调函数 - def get_text(self, response): 获取详细的文本信息 <|skeleton|> class CdDangxiaoSpider: def parse(self, response): """"...
d2d66206d799afbfe68cafcc9bd7cd6d9533685d
<|skeleton|> class CdDangxiaoSpider: def parse(self, response): """"默认的解析回调函数""" <|body_0|> def get_text(self, response): """获取详细的文本信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CdDangxiaoSpider: def parse(self, response): """"默认的解析回调函数""" news = response.xpath("//a[@target='_blank']") for new in news: item = CDagency() item['col_name'] = 'CD06dangxiao' href = new.xpath('./@href').extract_first() detail_url = 'ht...
the_stack_v2_python_sparse
CDagency/spiders/cd06_dangxiao.py
gongdx/CDagency
train
0
41f8c7ff6393be932c3033fddd821c8b11a77842
[ "course_run, user = create_purchasable_course_run()\norder = create_unfulfilled_order(course_run.edx_course_key, user)\nassert 'MM-{}-{}'.format(CYBERSOURCE_REFERENCE_PREFIX, order.id) == make_reference_id(order)", "course_run, user = create_purchasable_course_run()\norder = create_unfulfilled_order(course_run.ed...
<|body_start_0|> course_run, user = create_purchasable_course_run() order = create_unfulfilled_order(course_run.edx_course_key, user) assert 'MM-{}-{}'.format(CYBERSOURCE_REFERENCE_PREFIX, order.id) == make_reference_id(order) <|end_body_0|> <|body_start_1|> course_run, user = create_pu...
Tests for get_order_by_reference_number and make_reference_id
ReferenceNumberTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReferenceNumberTests: """Tests for get_order_by_reference_number and make_reference_id""" def test_make_reference_id(self): """make_reference_id should concatenate the reference prefix and the order id""" <|body_0|> def test_get_new_order_by_reference_number(self): ...
stack_v2_sparse_classes_36k_train_021475
41,111
permissive
[ { "docstring": "make_reference_id should concatenate the reference prefix and the order id", "name": "test_make_reference_id", "signature": "def test_make_reference_id(self)" }, { "docstring": "get_new_order_by_reference_number returns an Order with status created", "name": "test_get_new_ord...
4
null
Implement the Python class `ReferenceNumberTests` described below. Class description: Tests for get_order_by_reference_number and make_reference_id Method signatures and docstrings: - def test_make_reference_id(self): make_reference_id should concatenate the reference prefix and the order id - def test_get_new_order_...
Implement the Python class `ReferenceNumberTests` described below. Class description: Tests for get_order_by_reference_number and make_reference_id Method signatures and docstrings: - def test_make_reference_id(self): make_reference_id should concatenate the reference prefix and the order id - def test_get_new_order_...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class ReferenceNumberTests: """Tests for get_order_by_reference_number and make_reference_id""" def test_make_reference_id(self): """make_reference_id should concatenate the reference prefix and the order id""" <|body_0|> def test_get_new_order_by_reference_number(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReferenceNumberTests: """Tests for get_order_by_reference_number and make_reference_id""" def test_make_reference_id(self): """make_reference_id should concatenate the reference prefix and the order id""" course_run, user = create_purchasable_course_run() order = create_unfulfille...
the_stack_v2_python_sparse
ecommerce/api_test.py
mitodl/micromasters
train
35
8c62399eef4cef5a5f4b58d009a3a47feaaea1fd
[ "self.dx = dx\nself.grid_size_y = grid_size_y\nself.grid_size_x = grid_size_x\nself.real_t = real_t\nself.bc_type = bc_type\npoisson_matrix_x, poisson_matrix_y = self._construct_poisson_matrices()\nself._apply_boundary_conds_to_poisson_matrices(poisson_matrix_x, poisson_matrix_y)\nself._compute_spectral_decomp_of_p...
<|body_start_0|> self.dx = dx self.grid_size_y = grid_size_y self.grid_size_x = grid_size_x self.real_t = real_t self.bc_type = bc_type poisson_matrix_x, poisson_matrix_y = self._construct_poisson_matrices() self._apply_boundary_conds_to_poisson_matrices(poisson_m...
Class for Poisson solver in 2D via Fast Diagonalisation.
FastDiagPoissonSolver2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastDiagPoissonSolver2D: """Class for Poisson solver in 2D via Fast Diagonalisation.""" def __init__(self, grid_size_y: int, grid_size_x: int, dx: float, real_t: type=np.float64, bc_type: Literal['homogenous_neumann_along_xy']='homogenous_neumann_along_xy') -> None: """Class initiali...
stack_v2_sparse_classes_36k_train_021476
4,807
permissive
[ { "docstring": "Class initialiser.", "name": "__init__", "signature": "def __init__(self, grid_size_y: int, grid_size_x: int, dx: float, real_t: type=np.float64, bc_type: Literal['homogenous_neumann_along_xy']='homogenous_neumann_along_xy') -> None" }, { "docstring": "Construct the finite differ...
5
stack_v2_sparse_classes_30k_train_003461
Implement the Python class `FastDiagPoissonSolver2D` described below. Class description: Class for Poisson solver in 2D via Fast Diagonalisation. Method signatures and docstrings: - def __init__(self, grid_size_y: int, grid_size_x: int, dx: float, real_t: type=np.float64, bc_type: Literal['homogenous_neumann_along_xy...
Implement the Python class `FastDiagPoissonSolver2D` described below. Class description: Class for Poisson solver in 2D via Fast Diagonalisation. Method signatures and docstrings: - def __init__(self, grid_size_y: int, grid_size_x: int, dx: float, real_t: type=np.float64, bc_type: Literal['homogenous_neumann_along_xy...
99a094e0d6e635e5b2385a69bdee239a4d1fb530
<|skeleton|> class FastDiagPoissonSolver2D: """Class for Poisson solver in 2D via Fast Diagonalisation.""" def __init__(self, grid_size_y: int, grid_size_x: int, dx: float, real_t: type=np.float64, bc_type: Literal['homogenous_neumann_along_xy']='homogenous_neumann_along_xy') -> None: """Class initiali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastDiagPoissonSolver2D: """Class for Poisson solver in 2D via Fast Diagonalisation.""" def __init__(self, grid_size_y: int, grid_size_x: int, dx: float, real_t: type=np.float64, bc_type: Literal['homogenous_neumann_along_xy']='homogenous_neumann_along_xy') -> None: """Class initialiser.""" ...
the_stack_v2_python_sparse
sopht/numeric/eulerian_grid_ops/poisson_solver_2d/FastDiagPoissonSolver2D.py
SophT-Team/SophT
train
2
a3043aed42f777162310312dc6d1c4bea78690c2
[ "super().__init__(parent)\nlayout = QVBoxLayout()\nlayout.setContentsMargins(0, 0, 0, 0)\ntoggle = QToolButton(clicked=self._on_toggle_clicked)\ntoggle.setStyleSheet('border: none;')\ntoggle.setFont(QGuiApplication.font())\ntoggle.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)\ntoggle.setArrowType(Qt.RightArrow if...
<|body_start_0|> super().__init__(parent) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) toggle = QToolButton(clicked=self._on_toggle_clicked) toggle.setStyleSheet('border: none;') toggle.setFont(QGuiApplication.font()) toggle.setToolButtonStyle(Qt.T...
A widget that can be expanded or collapsed (ie. made visible or hidden) by the user clicking on a button.
CollapsibleWidget
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollapsibleWidget: """A widget that can be expanded or collapsed (ie. made visible or hidden) by the user clicking on a button.""" def __init__(self, title, collapsed=True, parent=None): """Initialise the widget.""" <|body_0|> def _on_toggle_clicked(self, checked): ...
stack_v2_sparse_classes_36k_train_021477
3,100
permissive
[ { "docstring": "Initialise the widget.", "name": "__init__", "signature": "def __init__(self, title, collapsed=True, parent=None)" }, { "docstring": "Invoked when the user clicks to expand or collapse the widget.", "name": "_on_toggle_clicked", "signature": "def _on_toggle_clicked(self, ...
3
stack_v2_sparse_classes_30k_train_020652
Implement the Python class `CollapsibleWidget` described below. Class description: A widget that can be expanded or collapsed (ie. made visible or hidden) by the user clicking on a button. Method signatures and docstrings: - def __init__(self, title, collapsed=True, parent=None): Initialise the widget. - def _on_togg...
Implement the Python class `CollapsibleWidget` described below. Class description: A widget that can be expanded or collapsed (ie. made visible or hidden) by the user clicking on a button. Method signatures and docstrings: - def __init__(self, title, collapsed=True, parent=None): Initialise the widget. - def _on_togg...
4ed2b1b9a2407afcbffdf304020d42b81c4c8cdc
<|skeleton|> class CollapsibleWidget: """A widget that can be expanded or collapsed (ie. made visible or hidden) by the user clicking on a button.""" def __init__(self, title, collapsed=True, parent=None): """Initialise the widget.""" <|body_0|> def _on_toggle_clicked(self, checked): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollapsibleWidget: """A widget that can be expanded or collapsed (ie. made visible or hidden) by the user clicking on a button.""" def __init__(self, title, collapsed=True, parent=None): """Initialise the widget.""" super().__init__(parent) layout = QVBoxLayout() layout.se...
the_stack_v2_python_sparse
note/demo/pyqt_demo/pyqtdeploy-3.3.0/pyqtdeploy/gui/collapsible_widget.py
onsunsl/onsunsl.github.io
train
1
55b9e0147b69520e91074e5af18e3b79796987b5
[ "if bubble['is_user']:\n t = 'user'\nelif bubble['is_system']:\n t = 'system'\nelif bubble['is_info']:\n t = 'info'\nelse:\n t = 'status'\nreturn t", "self.type = self._demultiplex_bubbletype(bubble)\nself.html = bubble['message']\nself.url = bubble['bubble_url'] if bubble['bubble_url'] != '' else Non...
<|body_start_0|> if bubble['is_user']: t = 'user' elif bubble['is_system']: t = 'system' elif bubble['is_info']: t = 'info' else: t = 'status' return t <|end_body_0|> <|body_start_1|> self.type = self._demultiplex_bubbletyp...
Converted bubble which is returned by the API.
DataBubble
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBubble: """Converted bubble which is returned by the API.""" def _demultiplex_bubbletype(bubble): """Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:""" <|body_0|> def __init__(self, bubble): """...
stack_v2_sparse_classes_36k_train_021478
3,741
permissive
[ { "docstring": "Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:", "name": "_demultiplex_bubbletype", "signature": "def _demultiplex_bubbletype(bubble)" }, { "docstring": "Convert given bubble to reduced bubble holding only the core...
2
stack_v2_sparse_classes_30k_train_011900
Implement the Python class `DataBubble` described below. Class description: Converted bubble which is returned by the API. Method signatures and docstrings: - def _demultiplex_bubbletype(bubble): Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return: - def __i...
Implement the Python class `DataBubble` described below. Class description: Converted bubble which is returned by the API. Method signatures and docstrings: - def _demultiplex_bubbletype(bubble): Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return: - def __i...
7996dbe0c66149c710217839877a1ec4e7eb46ed
<|skeleton|> class DataBubble: """Converted bubble which is returned by the API.""" def _demultiplex_bubbletype(bubble): """Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:""" <|body_0|> def __init__(self, bubble): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataBubble: """Converted bubble which is returned by the API.""" def _demultiplex_bubbletype(bubble): """Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:""" if bubble['is_user']: t = 'user' elif bubble['is...
the_stack_v2_python_sparse
api/models.py
hhucn/dbas
train
25
f10a69c6899f188bb33c02016d6ce3d428bf267f
[ "ans = 0\nfor i in range(3, n):\n if i % 3 == 0 or i % 5 == 0:\n ans += i\nreturn ans", "values = set()\nfor i in range(3, n, 3):\n values.add(i)\nfor j in range(5, n, 5):\n values.add(j)\nreturn sum(values)", "def get_multiples_of_x(x, n):\n num_values = n // x\n lb = x\n ub = n - n % ...
<|body_start_0|> ans = 0 for i in range(3, n): if i % 3 == 0 or i % 5 == 0: ans += i return ans <|end_body_0|> <|body_start_1|> values = set() for i in range(3, n, 3): values.add(i) for j in range(5, n, 5): values.add(j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def method1(self, n): """Use division. Complexity: O(N)""" <|body_0|> def method2(self, n): """Use multifications. Complexity O(N/3) + O(N/5) = O(N)""" <|body_1|> def method3(self, n): """Get the theoretical answer. Complexity: O(1)""" ...
stack_v2_sparse_classes_36k_train_021479
1,736
no_license
[ { "docstring": "Use division. Complexity: O(N)", "name": "method1", "signature": "def method1(self, n)" }, { "docstring": "Use multifications. Complexity O(N/3) + O(N/5) = O(N)", "name": "method2", "signature": "def method2(self, n)" }, { "docstring": "Get the theoretical answer....
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def method1(self, n): Use division. Complexity: O(N) - def method2(self, n): Use multifications. Complexity O(N/3) + O(N/5) = O(N) - def method3(self, n): Get the theoretical ans...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def method1(self, n): Use division. Complexity: O(N) - def method2(self, n): Use multifications. Complexity O(N/3) + O(N/5) = O(N) - def method3(self, n): Get the theoretical ans...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def method1(self, n): """Use division. Complexity: O(N)""" <|body_0|> def method2(self, n): """Use multifications. Complexity O(N/3) + O(N/5) = O(N)""" <|body_1|> def method3(self, n): """Get the theoretical answer. Complexity: O(1)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def method1(self, n): """Use division. Complexity: O(N)""" ans = 0 for i in range(3, n): if i % 3 == 0 or i % 5 == 0: ans += i return ans def method2(self, n): """Use multifications. Complexity O(N/3) + O(N/5) = O(N)""" ...
the_stack_v2_python_sparse
python3/euler/1.multiples_of_3_and_5.py
victorchu/algorithms
train
0
df775fed2f6fb900ed19dc13c614d1300a8521d2
[ "if content is not None:\n if hasattr(content, 'render'):\n self.contents = [content]\n else:\n self.contents = [TextWrapper(str(content))]\nelse:\n self.contents = []\nself.style = kwargs", "if new_content is not None:\n if hasattr(new_content, 'render'):\n self.contents.append(n...
<|body_start_0|> if content is not None: if hasattr(content, 'render'): self.contents = [content] else: self.contents = [TextWrapper(str(content))] else: self.contents = [] self.style = kwargs <|end_body_0|> <|body_start_1|> ...
Element is an HTML element that holds a list of contents. The list hold information describing the HTML element as well as a class attribute describing the HTML tag called tag. It also contains instance attributes such as contents which is a list that contains the contents. It is very likely that the contents could inc...
Element
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Element: """Element is an HTML element that holds a list of contents. The list hold information describing the HTML element as well as a class attribute describing the HTML tag called tag. It also contains instance attributes such as contents which is a list that contains the contents. It is very...
stack_v2_sparse_classes_36k_train_021480
8,529
no_license
[ { "docstring": "Initialises the Element class. Args: content: Accepts the first content in its contents list, otherwise it will be empty contents list. kwargs: Are additional arguments that define the style of the element.", "name": "__init__", "signature": "def __init__(self, content=None, **kwargs)" ...
5
null
Implement the Python class `Element` described below. Class description: Element is an HTML element that holds a list of contents. The list hold information describing the HTML element as well as a class attribute describing the HTML tag called tag. It also contains instance attributes such as contents which is a list...
Implement the Python class `Element` described below. Class description: Element is an HTML element that holds a list of contents. The list hold information describing the HTML element as well as a class attribute describing the HTML tag called tag. It also contains instance attributes such as contents which is a list...
76224d0fb871d0bf0b838f3fccf01022edd70f82
<|skeleton|> class Element: """Element is an HTML element that holds a list of contents. The list hold information describing the HTML element as well as a class attribute describing the HTML tag called tag. It also contains instance attributes such as contents which is a list that contains the contents. It is very...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Element: """Element is an HTML element that holds a list of contents. The list hold information describing the HTML element as well as a class attribute describing the HTML tag called tag. It also contains instance attributes such as contents which is a list that contains the contents. It is very likely that ...
the_stack_v2_python_sparse
students/Pirouz_N/lesson07/html_render.py
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
train
19
07bb56677c0d05ef476e9fd344774bcc54542634
[ "if self.host == '':\n self.error_message = 'Email Error: host is empty'\nelif self.username == '':\n self.error_message = 'Email Error: username is empty'\nelif self.password == '':\n self.error_message = 'Email Error: password is empty'\nelse:\n self.available = True\n self.postman = Postman(host=s...
<|body_start_0|> if self.host == '': self.error_message = 'Email Error: host is empty' elif self.username == '': self.error_message = 'Email Error: username is empty' elif self.password == '': self.error_message = 'Email Error: password is empty' else:...
Provide Emails Sending Service Example for config.py: "email": { "host": "smtp.gmail.com", "port": 587, "username": "james2015@gmail.com", "password": "88888888" }
Email
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Email: """Provide Emails Sending Service Example for config.py: "email": { "host": "smtp.gmail.com", "port": 587, "username": "james2015@gmail.com", "password": "88888888" }""" def __init__(self): """check email-service parameters from config.py""" <|body_0|> def send_em...
stack_v2_sparse_classes_36k_train_021481
22,148
permissive
[ { "docstring": "check email-service parameters from config.py", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Send emails notes: No all email-service providers support. if using Gmail, enable \"Access for less secure apps\" for the sender's account, Examples: xxx.send_...
2
stack_v2_sparse_classes_30k_train_019636
Implement the Python class `Email` described below. Class description: Provide Emails Sending Service Example for config.py: "email": { "host": "smtp.gmail.com", "port": 587, "username": "james2015@gmail.com", "password": "88888888" } Method signatures and docstrings: - def __init__(self): check email-service paramet...
Implement the Python class `Email` described below. Class description: Provide Emails Sending Service Example for config.py: "email": { "host": "smtp.gmail.com", "port": 587, "username": "james2015@gmail.com", "password": "88888888" } Method signatures and docstrings: - def __init__(self): check email-service paramet...
945c4fd2755f5b0dea11e54eb649eeb37ec93d01
<|skeleton|> class Email: """Provide Emails Sending Service Example for config.py: "email": { "host": "smtp.gmail.com", "port": 587, "username": "james2015@gmail.com", "password": "88888888" }""" def __init__(self): """check email-service parameters from config.py""" <|body_0|> def send_em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Email: """Provide Emails Sending Service Example for config.py: "email": { "host": "smtp.gmail.com", "port": 587, "username": "james2015@gmail.com", "password": "88888888" }""" def __init__(self): """check email-service parameters from config.py""" if self.host == '': self.err...
the_stack_v2_python_sparse
open-hackathon-server/src/hackathon/util.py
kaiyuanshe/open-hackathon
train
46
66fd272a579ab5d000ccb2e60e9185c9a3b49964
[ "base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]\ntest_dir = 'cinder_tempest_plugin'\nfull_test_dir = os.path.join(base_path, test_dir)\nreturn (full_test_dir, base_path)", "config.register_opt_group(conf, config.volume_feature_group, project_config.cinder_option)\nif 'barbican_tempest_pl...
<|body_start_0|> base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0] test_dir = 'cinder_tempest_plugin' full_test_dir = os.path.join(base_path, test_dir) return (full_test_dir, base_path) <|end_body_0|> <|body_start_1|> config.register_opt_group(conf, config...
CinderTempestPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CinderTempestPlugin: def load_tests(self): """Provides information to load the plugin tests. :return: A tuple with the first value being the test dir and the second being the top level dir.""" <|body_0|> def register_opts(self, conf): """Adds additional configuration...
stack_v2_sparse_classes_36k_train_021482
2,695
permissive
[ { "docstring": "Provides information to load the plugin tests. :return: A tuple with the first value being the test dir and the second being the top level dir.", "name": "load_tests", "signature": "def load_tests(self)" }, { "docstring": "Adds additional configuration options to tempest. This me...
3
stack_v2_sparse_classes_30k_val_000832
Implement the Python class `CinderTempestPlugin` described below. Class description: Implement the CinderTempestPlugin class. Method signatures and docstrings: - def load_tests(self): Provides information to load the plugin tests. :return: A tuple with the first value being the test dir and the second being the top l...
Implement the Python class `CinderTempestPlugin` described below. Class description: Implement the CinderTempestPlugin class. Method signatures and docstrings: - def load_tests(self): Provides information to load the plugin tests. :return: A tuple with the first value being the test dir and the second being the top l...
e5ae1ed54a7a07133ec103006dbf430d8457b29a
<|skeleton|> class CinderTempestPlugin: def load_tests(self): """Provides information to load the plugin tests. :return: A tuple with the first value being the test dir and the second being the top level dir.""" <|body_0|> def register_opts(self, conf): """Adds additional configuration...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CinderTempestPlugin: def load_tests(self): """Provides information to load the plugin tests. :return: A tuple with the first value being the test dir and the second being the top level dir.""" base_path = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0] test_dir = 'cinder_t...
the_stack_v2_python_sparse
cinder_tempest_plugin/plugin.py
sapcc/cinder-tempest-plugin
train
0
937f48ab9de736cb316fc386c140bf686bcfdca5
[ "bottom_spatial_size = calculate_output_dimension(spatial_size, kernel_sizes, stride_sizes)\ntorch.nn.Module.__init__(self)\nself.basic_num = basic_num\nself.level_depth = len(kernel_sizes)\nself.inp = scn.InputLayer(dim, spatial_size)\nself.convBN = ConvBNBlock(start_planes, init_conv_nplanes, init_conv_kernel, mo...
<|body_start_0|> bottom_spatial_size = calculate_output_dimension(spatial_size, kernel_sizes, stride_sizes) torch.nn.Module.__init__(self) self.basic_num = basic_num self.level_depth = len(kernel_sizes) self.inp = scn.InputLayer(dim, spatial_size) self.convBN = ConvBNBloc...
This class implements a UNet structure, built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the UNet ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. init_conv_nplaness : int Number of planes we want afte...
UNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UNet: """This class implements a UNet structure, built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the UNet ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. init_conv_nplaness : i...
stack_v2_sparse_classes_36k_train_021483
11,953
no_license
[ { "docstring": "Parameters ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. init_conv_nplaness : int Number of planes we want after the initial SubmanifoldConvolution, that is, to begin downsampling. init_conv_kernel : int Kernel for the first convolu...
2
stack_v2_sparse_classes_30k_train_007135
Implement the Python class `UNet` described below. Class description: This class implements a UNet structure, built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the UNet ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is als...
Implement the Python class `UNet` described below. Class description: This class implements a UNet structure, built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the UNet ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is als...
4c2cf181c6f503bf2a9c09bbe16810e727b052e7
<|skeleton|> class UNet: """This class implements a UNet structure, built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the UNet ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. init_conv_nplaness : i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UNet: """This class implements a UNet structure, built with ResNet blocks. It takes a tuple of (coordinates, features) and passes it through the UNet ... Attributes ---------- spatial_size : tuple The spatial size of the input layer. Size of the tuple is also the dimension. init_conv_nplaness : int Number of ...
the_stack_v2_python_sparse
next_sparseconvnet/networks/architectures.py
next-exp/NEXT_SPARSECONVNET
train
0
122b0681a25c45b66b89c7f99c1b562d6e44ffbd
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth or timezone.now(), first_name=first_name or '', last_name=last_name or '')\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "if ...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth or timezone.now(), first_name=first_name or '', last_name=last_name or '') user.set_password(password) ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, date_of_birth, first_name, last_name...
stack_v2_sparse_classes_36k_train_021484
1,411
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None)" }, { "docstring": "Creates and saves a superuser with the given emai...
2
stack_v2_sparse_classes_30k_train_011535
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): Creates and saves a User with the given email, date of birth and passw...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): Creates and saves a User with the given email, date of birth and passw...
42654f6c058de095ac6ff540bdd89854b7f864f9
<|skeleton|> class MyUserManager: def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, date_of_birth, first_name, last_name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email, first_name=None, last_name=None, date_of_birth=None, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.m...
the_stack_v2_python_sparse
thesis/DavideCrestini/tesi-crestini/Piattaforma/services/managers.py
lbedogni/iot
train
0
47cd03935e70b3a8e3233d9cde6b530864dca5ce
[ "super().__init__()\nself.unbiased_pcnt = unbiased_pcnt\nself.mixing_factors = mixing_factors\nself.seed = seed\nself.data_efficient = data_efficient", "mixing_factor = self.mixing_factors[split_id]\nbiased, unbiased = get_biased_subset(data, mixing_factor, self.unbiased_pcnt, self.seed, self.data_efficient)\nret...
<|body_start_0|> super().__init__() self.unbiased_pcnt = unbiased_pcnt self.mixing_factors = mixing_factors self.seed = seed self.data_efficient = data_efficient <|end_body_0|> <|body_start_1|> mixing_factor = self.mixing_factors[split_id] biased, unbiased = get_...
Split the given data into a biased subset and a normal subset.
BiasedSubset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiasedSubset: """Split the given data into a biased subset and a normal subset.""" def __init__(self, unbiased_pcnt: float, mixing_factors: Sequence[float]=(0,), seed: int=42, data_efficient: bool=True): """The constructor takes the following arguments. Args: mixing_factors: List of ...
stack_v2_sparse_classes_36k_train_021485
10,886
no_license
[ { "docstring": "The constructor takes the following arguments. Args: mixing_factors: List of mixing factors; they are chosen based on the split ID unbiased_pcnt: how much of the data should be reserved for the unbiased subset seed: random seed for the splitting data_efficient: if True, try to keep as many data ...
2
null
Implement the Python class `BiasedSubset` described below. Class description: Split the given data into a biased subset and a normal subset. Method signatures and docstrings: - def __init__(self, unbiased_pcnt: float, mixing_factors: Sequence[float]=(0,), seed: int=42, data_efficient: bool=True): The constructor take...
Implement the Python class `BiasedSubset` described below. Class description: Split the given data into a biased subset and a normal subset. Method signatures and docstrings: - def __init__(self, unbiased_pcnt: float, mixing_factors: Sequence[float]=(0,), seed: int=42, data_efficient: bool=True): The constructor take...
3aecb7642d9611ae0a61cd47948931f8f47b6f76
<|skeleton|> class BiasedSubset: """Split the given data into a biased subset and a normal subset.""" def __init__(self, unbiased_pcnt: float, mixing_factors: Sequence[float]=(0,), seed: int=42, data_efficient: bool=True): """The constructor takes the following arguments. Args: mixing_factors: List of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BiasedSubset: """Split the given data into a biased subset and a normal subset.""" def __init__(self, unbiased_pcnt: float, mixing_factors: Sequence[float]=(0,), seed: int=42, data_efficient: bool=True): """The constructor takes the following arguments. Args: mixing_factors: List of mixing factor...
the_stack_v2_python_sparse
ethicml/preprocessing/biased_split.py
anonymous-iclr-3518/code-for-submission
train
0
dfac652566853639b4474859abadb4fa756796fd
[ "self.width = width\nself.nr_lanes = nr_lanes\nself.nr_dots = nr_dots\nself.dots = np.empty((nr_lanes, nr_dots, 2, 2))", "y = 0.0\nfor i in range(self.nr_lanes):\n x = 0\n for j in range(self.nr_dots):\n self.dots[i, j] = [[x, y], [x, y + self.width]]\n x += 1\n y += self.width\nreturn self...
<|body_start_0|> self.width = width self.nr_lanes = nr_lanes self.nr_dots = nr_dots self.dots = np.empty((nr_lanes, nr_dots, 2, 2)) <|end_body_0|> <|body_start_1|> y = 0.0 for i in range(self.nr_lanes): x = 0 for j in range(self.nr_dots): ...
Generates mock-up data for lane positions. Generates a matrix consisting of lanes with 100 pairs of coordinates indicating the lanes' position. All lanes are straight and the purpose is to test the visualiser. Attributes: width: width of the lanes in m, taken as the average lane width. nr_lanes: number of lanes on the ...
Generator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Generates mock-up data for lane positions. Generates a matrix consisting of lanes with 100 pairs of coordinates indicating the lanes' position. All lanes are straight and the purpose is to test the visualiser. Attributes: width: width of the lanes in m, taken as the average lane wid...
stack_v2_sparse_classes_36k_train_021486
1,335
permissive
[ { "docstring": "Initializes the Generator class, width is set at 3.7m.", "name": "__init__", "signature": "def __init__(self, nr_lanes, nr_dots, width=3.7)" }, { "docstring": "Generates mock-up data for nr_lanes amount of lanes. The starting position on the same y as the Ego vehicle, but 50 mete...
2
null
Implement the Python class `Generator` described below. Class description: Generates mock-up data for lane positions. Generates a matrix consisting of lanes with 100 pairs of coordinates indicating the lanes' position. All lanes are straight and the purpose is to test the visualiser. Attributes: width: width of the la...
Implement the Python class `Generator` described below. Class description: Generates mock-up data for lane positions. Generates a matrix consisting of lanes with 100 pairs of coordinates indicating the lanes' position. All lanes are straight and the purpose is to test the visualiser. Attributes: width: width of the la...
2dd5c5e90adf2c29e5c1e81e8639813edbf65903
<|skeleton|> class Generator: """Generates mock-up data for lane positions. Generates a matrix consisting of lanes with 100 pairs of coordinates indicating the lanes' position. All lanes are straight and the purpose is to test the visualiser. Attributes: width: width of the lanes in m, taken as the average lane wid...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: """Generates mock-up data for lane positions. Generates a matrix consisting of lanes with 100 pairs of coordinates indicating the lanes' position. All lanes are straight and the purpose is to test the visualiser. Attributes: width: width of the lanes in m, taken as the average lane width. nr_lanes:...
the_stack_v2_python_sparse
Tools/Generator.py
florias/TNO-RU-Lane-detection-project
train
2
59ed3e63410910f4775c503f287f03115e2938db
[ "super(ListInterestCategoryInterest, self).__init__(*args, **kwargs)\nself.endpoint = 'lists'\nself.list_id = None\nself.category_id = None\nself.interest_id = None", "self.list_id = list_id\nself.category_id = category_id\nif 'name' not in data:\n raise KeyError('The list interest category interest must have ...
<|body_start_0|> super(ListInterestCategoryInterest, self).__init__(*args, **kwargs) self.endpoint = 'lists' self.list_id = None self.category_id = None self.interest_id = None <|end_body_0|> <|body_start_1|> self.list_id = list_id self.category_id = category_id ...
Manage interests for a specific MailChimp list. Assign subscribers to interests to group them together. Interests are referred to as ‘group names’ in the MailChimp application.
ListInterestCategoryInterest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListInterestCategoryInterest: """Manage interests for a specific MailChimp list. Assign subscribers to interests to group them together. Interests are referred to as ‘group names’ in the MailChimp application.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" ...
stack_v2_sparse_classes_36k_train_021487
5,847
permissive
[ { "docstring": "Initialize the endpoint", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Create a new interest or ‘group name’ for a specific category. The documentation lists only the name request body parameter so it is being documented and error-chec...
6
stack_v2_sparse_classes_30k_train_013143
Implement the Python class `ListInterestCategoryInterest` described below. Class description: Manage interests for a specific MailChimp list. Assign subscribers to interests to group them together. Interests are referred to as ‘group names’ in the MailChimp application. Method signatures and docstrings: - def __init_...
Implement the Python class `ListInterestCategoryInterest` described below. Class description: Manage interests for a specific MailChimp list. Assign subscribers to interests to group them together. Interests are referred to as ‘group names’ in the MailChimp application. Method signatures and docstrings: - def __init_...
bf61cd602dc44cbff32fbf6f6dcdd33cf6f782e8
<|skeleton|> class ListInterestCategoryInterest: """Manage interests for a specific MailChimp list. Assign subscribers to interests to group them together. Interests are referred to as ‘group names’ in the MailChimp application.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListInterestCategoryInterest: """Manage interests for a specific MailChimp list. Assign subscribers to interests to group them together. Interests are referred to as ‘group names’ in the MailChimp application.""" def __init__(self, *args, **kwargs): """Initialize the endpoint""" super(Lis...
the_stack_v2_python_sparse
mailchimp3/entities/listinterestcategoryinterest.py
VingtCinq/python-mailchimp
train
190
31276cb08d68250bcb13adb19566408462a34556
[ "problem = get_SALib_problem(uncertainties)\nsamples = self.sample(problem, size)\ntemp = {}\nfor i, unc in enumerate(uncertainties):\n sample = samples[:, i]\n if isinstance(unc, IntegerParameter):\n sample = np.floor(sample)\n temp[unc.name] = sample\nreturn temp", "parameters = sorted(parameter...
<|body_start_0|> problem = get_SALib_problem(uncertainties) samples = self.sample(problem, size) temp = {} for i, unc in enumerate(uncertainties): sample = samples[:, i] if isinstance(unc, IntegerParameter): sample = np.floor(sample) te...
SALibSampler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SALibSampler: def generate_samples(self, uncertainties, size): """The main method of :class: `~sampler.Sampler` and its children. This will call the sample method for each of the uncertainties and return the resulting designs. Parameters ---------- uncertainties : collection a collection...
stack_v2_sparse_classes_36k_train_021488
5,372
permissive
[ { "docstring": "The main method of :class: `~sampler.Sampler` and its children. This will call the sample method for each of the uncertainties and return the resulting designs. Parameters ---------- uncertainties : collection a collection of Parameter instances size : int the number of samples to generate. Retu...
2
stack_v2_sparse_classes_30k_train_005213
Implement the Python class `SALibSampler` described below. Class description: Implement the SALibSampler class. Method signatures and docstrings: - def generate_samples(self, uncertainties, size): The main method of :class: `~sampler.Sampler` and its children. This will call the sample method for each of the uncertai...
Implement the Python class `SALibSampler` described below. Class description: Implement the SALibSampler class. Method signatures and docstrings: - def generate_samples(self, uncertainties, size): The main method of :class: `~sampler.Sampler` and its children. This will call the sample method for each of the uncertai...
9d13fb6fc8e8e3fc8cc693102f85966c5876f9ac
<|skeleton|> class SALibSampler: def generate_samples(self, uncertainties, size): """The main method of :class: `~sampler.Sampler` and its children. This will call the sample method for each of the uncertainties and return the resulting designs. Parameters ---------- uncertainties : collection a collection...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SALibSampler: def generate_samples(self, uncertainties, size): """The main method of :class: `~sampler.Sampler` and its children. This will call the sample method for each of the uncertainties and return the resulting designs. Parameters ---------- uncertainties : collection a collection of Parameter ...
the_stack_v2_python_sparse
ema_workbench/em_framework/salib_samplers.py
quaquel/EMAworkbench
train
102
226fd2d91c9515b22f84840de175b4987f303df1
[ "if not root:\n return ''\nq = deque()\nq.append(root)\nans = []\nwhile q:\n length = len(q)\n for _ in range(length):\n node = q.popleft()\n ans.append(str(node.val) if node else 'null')\n if node:\n q.append(node.left)\n q.append(node.right)\nreturn ','.join(ans...
<|body_start_0|> if not root: return '' q = deque() q.append(root) ans = [] while q: length = len(q) for _ in range(length): node = q.popleft() ans.append(str(node.val) if node else 'null') if nod...
Codec
[ "BSD-3-Clause" ]
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_36k_train_021489
2,741
permissive
[ { "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:...
226cecde136531341ce23cdf88529345be1912fc
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' q = deque() q.append(root) ans = [] while q: length = len(q) for _ in range(length): ...
the_stack_v2_python_sparse
Leetcode/Intermediate/Design/297_Serialize_and_Deserialize_Binary_Tree.py
ZR-Huang/AlgorithmsPractices
train
1
6b1bd643f5b63c2aeaf1fbae0d86b98e6914dead
[ "result = []\nleft, right = (0, 0)\n\ndef backtracking(partial, left, right, n):\n if left >= right >= 0:\n if len(partial) == n * 2:\n result.append(partial)\n if left < n:\n backtracking(partial + '(', left + 1, right, n)\n if right < left:\n backtracking(p...
<|body_start_0|> result = [] left, right = (0, 0) def backtracking(partial, left, right, n): if left >= right >= 0: if len(partial) == n * 2: result.append(partial) if left < n: backtracking(partial + '(', left ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateParenthesis_add_1(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def generateParenthesis_minus_1(self, n): """:type n: int :rtype: List[str]""" <|body_1|> def generateParenthesis_refer(self, n): """:type n: int :r...
stack_v2_sparse_classes_36k_train_021490
3,026
no_license
[ { "docstring": ":type n: int :rtype: List[str]", "name": "generateParenthesis_add_1", "signature": "def generateParenthesis_add_1(self, n)" }, { "docstring": ":type n: int :rtype: List[str]", "name": "generateParenthesis_minus_1", "signature": "def generateParenthesis_minus_1(self, n)" ...
3
stack_v2_sparse_classes_30k_train_009481
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis_add_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_minus_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_refer(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis_add_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_minus_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_refer(...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def generateParenthesis_add_1(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def generateParenthesis_minus_1(self, n): """:type n: int :rtype: List[str]""" <|body_1|> def generateParenthesis_refer(self, n): """:type n: int :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generateParenthesis_add_1(self, n): """:type n: int :rtype: List[str]""" result = [] left, right = (0, 0) def backtracking(partial, left, right, n): if left >= right >= 0: if len(partial) == n * 2: result.append(par...
the_stack_v2_python_sparse
22_generateParenthesis.py
jennyChing/leetCode
train
2
01429cf2f85a8c1b0b70cc09bc86cecabd6fb5c8
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
RPCApi are "private" rpc methods for an instance related to a specific log. This should only be available to trusted parties.
LogRPCServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogRPCServicer: """RPCApi are "private" rpc methods for an instance related to a specific log. This should only be available to trusted parties.""" def GetHead(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetLogEn...
stack_v2_sparse_classes_36k_train_021491
12,917
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetHead", "signature": "def GetHead(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetLogEntries", "signature": "def GetLogEntries(self, re...
4
stack_v2_sparse_classes_30k_train_018702
Implement the Python class `LogRPCServicer` described below. Class description: RPCApi are "private" rpc methods for an instance related to a specific log. This should only be available to trusted parties. Method signatures and docstrings: - def GetHead(self, request, context): Missing associated documentation commen...
Implement the Python class `LogRPCServicer` described below. Class description: RPCApi are "private" rpc methods for an instance related to a specific log. This should only be available to trusted parties. Method signatures and docstrings: - def GetHead(self, request, context): Missing associated documentation commen...
9bf6f32ab9b28c49fdc12c6e7a847a2b6dc1aa00
<|skeleton|> class LogRPCServicer: """RPCApi are "private" rpc methods for an instance related to a specific log. This should only be available to trusted parties.""" def GetHead(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def GetLogEn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogRPCServicer: """RPCApi are "private" rpc methods for an instance related to a specific log. This should only be available to trusted parties.""" def GetHead(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEM...
the_stack_v2_python_sparse
packages/trustix-python/trustix_python/rpc/rpc_pb2_grpc.py
daotlresearch/trustix
train
0
af4427f3e83a54bf497d24818e6a9b052df23ff3
[ "if ADAPTIVE_AVG_POOL_BUG and module.input0.is_cuda and (self.N == 3):\n warn('Be careful when computing gradients of AdaptiveAvgPool3d. There is a bug using autograd.grad on cuda with AdaptiveAvgPool3d. https://discuss.pytorch.org/t/bug-report-autograd-grad-adaptiveavgpool3d-cuda/124614 BackPACK derivatives are...
<|body_start_0|> if ADAPTIVE_AVG_POOL_BUG and module.input0.is_cuda and (self.N == 3): warn('Be careful when computing gradients of AdaptiveAvgPool3d. There is a bug using autograd.grad on cuda with AdaptiveAvgPool3d. https://discuss.pytorch.org/t/bug-report-autograd-grad-adaptiveavgpool3d-cuda/1246...
Implements the derivatives for AdaptiveAvgPool.
AdaptiveAvgPoolNDDerivatives
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaptiveAvgPoolNDDerivatives: """Implements the derivatives for AdaptiveAvgPool.""" def check_parameters(self, module: Union[AdaptiveAvgPool1d, AdaptiveAvgPool2d, AdaptiveAvgPool3d]) -> None: """Checks if the parameters are supported. Specifically checks if input shape is multiple of...
stack_v2_sparse_classes_36k_train_021492
3,807
permissive
[ { "docstring": "Checks if the parameters are supported. Specifically checks if input shape is multiple of output shape. In this case, there are parameters for AvgPoolND that are equivalent. https://stackoverflow.com/questions/53841509/how-does-adaptive-pooling-in-pytorch-work/63603993#63603993 # noqa: B950 Args...
2
stack_v2_sparse_classes_30k_train_003625
Implement the Python class `AdaptiveAvgPoolNDDerivatives` described below. Class description: Implements the derivatives for AdaptiveAvgPool. Method signatures and docstrings: - def check_parameters(self, module: Union[AdaptiveAvgPool1d, AdaptiveAvgPool2d, AdaptiveAvgPool3d]) -> None: Checks if the parameters are sup...
Implement the Python class `AdaptiveAvgPoolNDDerivatives` described below. Class description: Implements the derivatives for AdaptiveAvgPool. Method signatures and docstrings: - def check_parameters(self, module: Union[AdaptiveAvgPool1d, AdaptiveAvgPool2d, AdaptiveAvgPool3d]) -> None: Checks if the parameters are sup...
1ebfb4055be72ed9e0f9d101d78806bd4119645e
<|skeleton|> class AdaptiveAvgPoolNDDerivatives: """Implements the derivatives for AdaptiveAvgPool.""" def check_parameters(self, module: Union[AdaptiveAvgPool1d, AdaptiveAvgPool2d, AdaptiveAvgPool3d]) -> None: """Checks if the parameters are supported. Specifically checks if input shape is multiple of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaptiveAvgPoolNDDerivatives: """Implements the derivatives for AdaptiveAvgPool.""" def check_parameters(self, module: Union[AdaptiveAvgPool1d, AdaptiveAvgPool2d, AdaptiveAvgPool3d]) -> None: """Checks if the parameters are supported. Specifically checks if input shape is multiple of output shape...
the_stack_v2_python_sparse
backpack/core/derivatives/adaptive_avg_pool_nd.py
f-dangel/backpack
train
505
38ffc5575f6db97d916bc84c55ad6bde5c6d1f6d
[ "res = 0\ntmp = 1\nloop = 0\nfor num in range(N, 0, -1):\n if loop == 0:\n tmp *= num\n elif loop == 1:\n tmp *= num\n elif loop == 2:\n tmp = tmp // num\n tmp = sign * tmp\n loop = (loop + 1) % 4\n res += tmp\n tmp = 1\nreturn res", "import collections\nimport heapq\...
<|body_start_0|> res = 0 tmp = 1 loop = 0 for num in range(N, 0, -1): if loop == 0: tmp *= num elif loop == 1: tmp *= num elif loop == 2: tmp = tmp // num tmp = sign * tmp loop...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def clumsy(self, N: int) -> int: """通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。 相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘法操作符: 乘法(*),除法(/),加法(+)和减法(-)。 例如,clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1。然而,这些运算仍然使用...
stack_v2_sparse_classes_36k_train_021493
2,717
no_license
[ { "docstring": "通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。 相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘法操作符: 乘法(*),除法(/),加法(+)和减法(-)。 例如,clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1。然而,这些运算仍然使用通常的算术运算顺序: 我们在任何加、减步骤之前执行所有的乘法和除法步骤,并且按从左到右处理乘法和除法步骤。 ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def clumsy(self, N: int) -> int: 通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。 相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def clumsy(self, N: int) -> int: 通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。 相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class Solution: def clumsy(self, N: int) -> int: """通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。 相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘法操作符: 乘法(*),除法(/),加法(+)和减法(-)。 例如,clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1。然而,这些运算仍然使用...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def clumsy(self, N: int) -> int: """通常,正整数 n 的阶乘是所有小于或等于 n 的正整数的乘积。例如,factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1。 相反,我们设计了一个笨阶乘 clumsy:在整数的递减序列中,我们以一个固定顺序的操作符序列来依次替换原有的乘法操作符: 乘法(*),除法(/),加法(+)和减法(-)。 例如,clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1。然而,这些运算仍然使用通常的算术运算顺序: 我们在...
the_stack_v2_python_sparse
Code/leetcode_everyday/0401.py
NiceToMeeetU/ToGetReady
train
0
c4fe4105eaa1555c6bb452e20b8d972c34fec537
[ "from anima.dcc.blackmagic import get_fusion\nfusion = get_fusion()\ncomp = fusion.GetCurrentComp()\nreturn comp.ActiveTool", "node_input_list = node.GetInputList()\nfor input_entry_key in node_input_list.keys():\n input_entry = node_input_list[input_entry_key]\n input_id = input_entry.GetAttrs()['INPS_ID']...
<|body_start_0|> from anima.dcc.blackmagic import get_fusion fusion = get_fusion() comp = fusion.GetCurrentComp() return comp.ActiveTool <|end_body_0|> <|body_start_1|> node_input_list = node.GetInputList() for input_entry_key in node_input_list.keys(): input...
Node related utils for Fusion
NodeUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeUtils: """Node related utils for Fusion""" def get_active_node(self): """returns the active node""" <|body_0|> def list_input_ids(cls, node): """List input ids of the given node :param node: :return:""" <|body_1|> def get_node_attr(cls, node, att...
stack_v2_sparse_classes_36k_train_021494
10,465
permissive
[ { "docstring": "returns the active node", "name": "get_active_node", "signature": "def get_active_node(self)" }, { "docstring": "List input ids of the given node :param node: :return:", "name": "list_input_ids", "signature": "def list_input_ids(cls, node)" }, { "docstring": "gets...
6
stack_v2_sparse_classes_30k_train_007153
Implement the Python class `NodeUtils` described below. Class description: Node related utils for Fusion Method signatures and docstrings: - def get_active_node(self): returns the active node - def list_input_ids(cls, node): List input ids of the given node :param node: :return: - def get_node_attr(cls, node, attr): ...
Implement the Python class `NodeUtils` described below. Class description: Node related utils for Fusion Method signatures and docstrings: - def get_active_node(self): returns the active node - def list_input_ids(cls, node): List input ids of the given node :param node: :return: - def get_node_attr(cls, node, attr): ...
7b4cf60cb17f00435ecc3e03d573a9e2d0b44fe0
<|skeleton|> class NodeUtils: """Node related utils for Fusion""" def get_active_node(self): """returns the active node""" <|body_0|> def list_input_ids(cls, node): """List input ids of the given node :param node: :return:""" <|body_1|> def get_node_attr(cls, node, att...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeUtils: """Node related utils for Fusion""" def get_active_node(self): """returns the active node""" from anima.dcc.blackmagic import get_fusion fusion = get_fusion() comp = fusion.GetCurrentComp() return comp.ActiveTool def list_input_ids(cls, node): ...
the_stack_v2_python_sparse
anima/dcc/fusion/utils.py
eoyilmaz/anima
train
113
f6f602813e8d149331f616953fcebe2f7c6aa15e
[ "cu = Change_Param(username, password, prod)\ngu = cu.get_params()\nself.suffix = self.c.get_value('Member', 'members_nocice_logs')\nself.url = self.url_joint(prod) + gu[1]\nlogs.info('test url:%s' % self.url)\nreturn self.get_requests(self.url, gu[0], data)", "cu = Change_Param(username, password, prod)\ngu = cu...
<|body_start_0|> cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Member', 'members_nocice_logs') self.url = self.url_joint(prod) + gu[1] logs.info('test url:%s' % self.url) return self.get_requests(self.url, gu[0], data) <|...
Member_Notice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Member_Notice: def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1""" <|body_0|> def del_member_nocice_logs_ids(self, ids, username=None, password=None, data=None, prod=None): ...
stack_v2_sparse_classes_36k_train_021495
2,683
no_license
[ { "docstring": "相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1", "name": "get_member_nocice_logs", "signature": "def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None)" }, { "docstring": "相关参数有: ids 要删除的消息主键", "name": "del_member_nocice_logs_ids", ...
3
stack_v2_sparse_classes_30k_train_012967
Implement the Python class `Member_Notice` described below. Class description: Implement the Member_Notice class. Method signatures and docstrings: - def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): 相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1 - def del_member_noci...
Implement the Python class `Member_Notice` described below. Class description: Implement the Member_Notice class. Method signatures and docstrings: - def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): 相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1 - def del_member_noci...
235200a67c1fb125f75f9771808f6655a7b14202
<|skeleton|> class Member_Notice: def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1""" <|body_0|> def del_member_nocice_logs_ids(self, ids, username=None, password=None, data=None, prod=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Member_Notice: def get_member_nocice_logs(self, username=None, password=None, data=None, prod=None): """相关参数有: page_no 页码 page_size 每页显示数量 read 是否已读,1已读,0未读,可用值:0,1""" cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Member', 'mem...
the_stack_v2_python_sparse
business/member/member_notice.py
vothin/requsets_test
train
0
ca92d368ab50f16b736a3b6ad0ebb54ab61b9efe
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ServiceAnnouncementAttachment()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'content': lambda n: setattr(self, 'content', n.get_bytes_value()), 'contentType': lambda n: setattr...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ServiceAnnouncementAttachment() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = {'content': lambd...
ServiceAnnouncementAttachment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceAnnouncementAttachment: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_36k_train_021496
2,908
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ServiceAnnouncementAttachment", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
stack_v2_sparse_classes_30k_train_003177
Implement the Python class `ServiceAnnouncementAttachment` described below. Class description: Implement the ServiceAnnouncementAttachment class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: Creates a new instance of th...
Implement the Python class `ServiceAnnouncementAttachment` described below. Class description: Implement the ServiceAnnouncementAttachment class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: Creates a new instance of th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ServiceAnnouncementAttachment: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceAnnouncementAttachment: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create ...
the_stack_v2_python_sparse
msgraph/generated/models/service_announcement_attachment.py
microsoftgraph/msgraph-sdk-python
train
135
6aa8c0779bd00888b721a590794288949f64008c
[ "cfg = self.model.cfg\nif cfg.get('inference_pipeline', None):\n test_pipeline = cfg.inference_pipeline\nelif cfg.get('demo_pipeline', None):\n test_pipeline = cfg.demo_pipeline\nelif cfg.get('test_pipeline', None):\n test_pipeline = cfg.test_pipeline\nelse:\n test_pipeline = cfg.val_pipeline\nkeys_to_r...
<|body_start_0|> cfg = self.model.cfg if cfg.get('inference_pipeline', None): test_pipeline = cfg.inference_pipeline elif cfg.get('demo_pipeline', None): test_pipeline = cfg.demo_pipeline elif cfg.get('test_pipeline', None): test_pipeline = cfg.test_pi...
inferencer that predicts with restoration models.
ImageSuperResolutionInferencer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageSuperResolutionInferencer: """inferencer that predicts with restoration models.""" def preprocess(self, img: InputsType, ref: InputsType=None) -> Dict: """Process the inputs into a model-feedable format. Args: img(InputsType): Image to be restored by models. ref(InputsType): Ref...
stack_v2_sparse_classes_36k_train_021497
3,447
permissive
[ { "docstring": "Process the inputs into a model-feedable format. Args: img(InputsType): Image to be restored by models. ref(InputsType): Reference image for restoration models. Defaults to None. Returns: data(Dict): Results of preprocess.", "name": "preprocess", "signature": "def preprocess(self, img: I...
3
null
Implement the Python class `ImageSuperResolutionInferencer` described below. Class description: inferencer that predicts with restoration models. Method signatures and docstrings: - def preprocess(self, img: InputsType, ref: InputsType=None) -> Dict: Process the inputs into a model-feedable format. Args: img(InputsTy...
Implement the Python class `ImageSuperResolutionInferencer` described below. Class description: inferencer that predicts with restoration models. Method signatures and docstrings: - def preprocess(self, img: InputsType, ref: InputsType=None) -> Dict: Process the inputs into a model-feedable format. Args: img(InputsTy...
a382f143c0fd20d227e1e5524831ba26a568190d
<|skeleton|> class ImageSuperResolutionInferencer: """inferencer that predicts with restoration models.""" def preprocess(self, img: InputsType, ref: InputsType=None) -> Dict: """Process the inputs into a model-feedable format. Args: img(InputsType): Image to be restored by models. ref(InputsType): Ref...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageSuperResolutionInferencer: """inferencer that predicts with restoration models.""" def preprocess(self, img: InputsType, ref: InputsType=None) -> Dict: """Process the inputs into a model-feedable format. Args: img(InputsType): Image to be restored by models. ref(InputsType): Reference image ...
the_stack_v2_python_sparse
mmagic/apis/inferencers/image_super_resolution_inferencer.py
open-mmlab/mmagic
train
1,370
fd3efb49add7c77ae52f40d058fcbc78f0d5ed7d
[ "length = len(s)\np = np.zeros(shape=(length, length))\nmax_len = 0\nmax_str = ''\nfor l in range(1, length + 1):\n for start in range(0, length):\n end = start + l - 1\n if end >= length:\n break\n p[start][end] = (l == 1 or l == 2 or p[start + 1][end - 1]) and s[start] == s[end]...
<|body_start_0|> length = len(s) p = np.zeros(shape=(length, length)) max_len = 0 max_str = '' for l in range(1, length + 1): for start in range(0, length): end = start + l - 1 if end >= length: break ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str 状态转移方程 p[i][j] = p[i+1][j-1] and s[i]==s[j] 空间优化: 实际只需要内存循环的值保留就行了 p[j] = p[j-1] and s[i]==s[j]""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_021498
1,483
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str 状态转移方程 p[i][j] = p[i+1][j-1] and s[i]==s[j] 空间优化: 实际只需要内存循环的值保留就行了 p[j] = p[j-1] and s[i]==s[j]", "name": "longestPalindrome2", ...
2
stack_v2_sparse_classes_30k_train_019894
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str 状态转移方程 p[i][j] = p[i+1][j-1] and s[i]==s[j] 空间优化: 实际只需要内存循环的值...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str 状态转移方程 p[i][j] = p[i+1][j-1] and s[i]==s[j] 空间优化: 实际只需要内存循环的值...
013f6f222c6c2a617787b258f8a37003a9f51526
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str 状态转移方程 p[i][j] = p[i+1][j-1] and s[i]==s[j] 空间优化: 实际只需要内存循环的值保留就行了 p[j] = p[j-1] and s[i]==s[j]""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" length = len(s) p = np.zeros(shape=(length, length)) max_len = 0 max_str = '' for l in range(1, length + 1): for start in range(0, length): end = start + l - 1 ...
the_stack_v2_python_sparse
dp/longest_palindrome.py
terrifyzhao/leetcode
train
0
639b4b2bf2b5f83f0582d98c72464a1f936b3055
[ "if n == 1:\n return 1\nelif n == 2:\n return 2\nelse:\n temp1, temp2 = (1, 2)\n for i in range(2, n):\n temp1, temp2 = (temp2, temp1 + temp2)\nreturn temp2", "def f(n):\n if n <= 2:\n return n\n else:\n return f(n - 1) + f(n - 2)\nreturn f(n)" ]
<|body_start_0|> if n == 1: return 1 elif n == 2: return 2 else: temp1, temp2 = (1, 2) for i in range(2, n): temp1, temp2 = (temp2, temp1 + temp2) return temp2 <|end_body_0|> <|body_start_1|> def f(n): i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """动态规划: 1. 设定目标:n级台阶有m种爬法 2. 迁移方程:m(n)=m(n-1) + m(n-2) 3. 初始状态:m(1)= 1, m(2) = 2""" <|body_0|> def climbStairs(self, n: int) -> int: """递归实现:超出时间限制""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n...
stack_v2_sparse_classes_36k_train_021499
793
no_license
[ { "docstring": "动态规划: 1. 设定目标:n级台阶有m种爬法 2. 迁移方程:m(n)=m(n-1) + m(n-2) 3. 初始状态:m(1)= 1, m(2) = 2", "name": "climbStairs", "signature": "def climbStairs(self, n: int) -> int" }, { "docstring": "递归实现:超出时间限制", "name": "climbStairs", "signature": "def climbStairs(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: 动态规划: 1. 设定目标:n级台阶有m种爬法 2. 迁移方程:m(n)=m(n-1) + m(n-2) 3. 初始状态:m(1)= 1, m(2) = 2 - def climbStairs(self, n: int) -> int: 递归实现:超出时间限制
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: 动态规划: 1. 设定目标:n级台阶有m种爬法 2. 迁移方程:m(n)=m(n-1) + m(n-2) 3. 初始状态:m(1)= 1, m(2) = 2 - def climbStairs(self, n: int) -> int: 递归实现:超出时间限制 <|skelet...
f0f4ba0cb91096e55e21b7a2240afbd347187351
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """动态规划: 1. 设定目标:n级台阶有m种爬法 2. 迁移方程:m(n)=m(n-1) + m(n-2) 3. 初始状态:m(1)= 1, m(2) = 2""" <|body_0|> def climbStairs(self, n: int) -> int: """递归实现:超出时间限制""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n: int) -> int: """动态规划: 1. 设定目标:n级台阶有m种爬法 2. 迁移方程:m(n)=m(n-1) + m(n-2) 3. 初始状态:m(1)= 1, m(2) = 2""" if n == 1: return 1 elif n == 2: return 2 else: temp1, temp2 = (1, 2) for i in range(2, n): ...
the_stack_v2_python_sparse
coding_test/70_climbStairs.py
zhuheng-mark/myDL
train
2