blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72e365b959c1cd6aec2927d4b10361517de9c055 | [
"self.body = body\nplt.ion()\nplt.clf()\nplt.axes().set_aspect('equal')\nfor wall in body.env.walls:\n (x0, y0), (x1, y1) = wall\n plt.plot([x0, x1], [y0, y1], '-k', linewidth=3)\nfor loc in top.locations:\n x, y = top.locations[loc]\n plt.plot([x], [y], 'k<')\n plt.text(x + 1.0, y + 0.5, loc)\nplt.p... | <|body_start_0|>
self.body = body
plt.ion()
plt.clf()
plt.axes().set_aspect('equal')
for wall in body.env.walls:
(x0, y0), (x1, y1) = wall
plt.plot([x0, x1], [y0, y1], '-k', linewidth=3)
for loc in top.locations:
x, y = top.locations[lo... | Plot_env | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Plot_env:
def __init__(self, body, top):
"""sets up the plot"""
<|body_0|>
def plot_run(self):
"""plots the history after the agent has finished. This is typically only used if body.plotting==False"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sel... | stack_v2_sparse_classes_10k_train_008100 | 3,349 | no_license | [
{
"docstring": "sets up the plot",
"name": "__init__",
"signature": "def __init__(self, body, top)"
},
{
"docstring": "plots the history after the agent has finished. This is typically only used if body.plotting==False",
"name": "plot_run",
"signature": "def plot_run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001794 | Implement the Python class `Plot_env` described below.
Class description:
Implement the Plot_env class.
Method signatures and docstrings:
- def __init__(self, body, top): sets up the plot
- def plot_run(self): plots the history after the agent has finished. This is typically only used if body.plotting==False | Implement the Python class `Plot_env` described below.
Class description:
Implement the Plot_env class.
Method signatures and docstrings:
- def __init__(self, body, top): sets up the plot
- def plot_run(self): plots the history after the agent has finished. This is typically only used if body.plotting==False
<|skele... | 479d6120b75ac0ff602f032474cad440cadd9f31 | <|skeleton|>
class Plot_env:
def __init__(self, body, top):
"""sets up the plot"""
<|body_0|>
def plot_run(self):
"""plots the history after the agent has finished. This is typically only used if body.plotting==False"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Plot_env:
def __init__(self, body, top):
"""sets up the plot"""
self.body = body
plt.ion()
plt.clf()
plt.axes().set_aspect('equal')
for wall in body.env.walls:
(x0, y0), (x1, y1) = wall
plt.plot([x0, x1], [y0, y1], '-k', linewidth=3)
... | the_stack_v2_python_sparse | ass1/aipython/agentTop.py | fckphil/COMP9814 | train | 5 | |
76f32816b81a2645b48c5f143d13198f86ec11e7 | [
"try:\n return long(value)\nexcept ValueError:\n raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))",
"if isinstance(value, long):\n return 1\nreturn 0",
"base = str(long(value))\nif base[-1] in ('l', 'L'):\n base = base[:-1]\nretu... | <|body_start_0|>
try:
return long(value)
except ValueError:
raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))
<|end_body_0|>
<|body_start_1|>
if isinstance(value, long):
return 1
re... | SFUInt32 base-class | _SFUInt32 | [
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _SFUInt32:
"""SFUInt32 base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type"""
<|b... | stack_v2_sparse_classes_10k_train_008101 | 34,853 | permissive | [
{
"docstring": "Coerce the given value to our type Allowable types: any object with true/false protocol",
"name": "coerce",
"signature": "def coerce(self, value)"
},
{
"docstring": "Check that the given value is of exactly expected type",
"name": "check",
"signature": "def check(self, va... | 3 | null | Implement the Python class `_SFUInt32` described below.
Class description:
SFUInt32 base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of exactly expecte... | Implement the Python class `_SFUInt32` described below.
Class description:
SFUInt32 base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of exactly expecte... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class _SFUInt32:
"""SFUInt32 base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type"""
<|b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _SFUInt32:
"""SFUInt32 base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
try:
return long(value)
except ValueError:
raise ValueError('Attempted to set value for an %s field w... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py | alexus37/AugmentedRealityChess | train | 1 |
9df7acce6cbe4b69599fafd287f95991fb96842b | [
"self.df_path = df_path\nself.sc = sc\nself.sql = sql\nself.df = sql.read.format('com.databricks.spark.csv').option('header', 'true').load(self.df_path)\nself.rulelist_filename = None\nself.rulelist = None\nself.id_field = id_field\nself.snippet_field = snippet_field",
"print(rulelist_filename)\nself.rulelist_fil... | <|body_start_0|>
self.df_path = df_path
self.sc = sc
self.sql = sql
self.df = sql.read.format('com.databricks.spark.csv').option('header', 'true').load(self.df_path)
self.rulelist_filename = None
self.rulelist = None
self.id_field = id_field
self.snippet_f... | The parent class for creating and viewing labeled categories on a dataframe of snippets and other metadata | Categorizer | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Categorizer:
"""The parent class for creating and viewing labeled categories on a dataframe of snippets and other metadata"""
def __init__(self, df_path, sc=sc, sql=sql, id_field='Url', snippet_field='Cleaned Snippet'):
""":param df_path: Pandas df containing cleaned snippets and ids... | stack_v2_sparse_classes_10k_train_008102 | 4,874 | permissive | [
{
"docstring": ":param df_path: Pandas df containing cleaned snippets and ids (as a maximum) :param sc: spark context :param sql: spark.sql context :param id_field: the id field in source df :param snippet_field: the field containing the text data to search in",
"name": "__init__",
"signature": "def __i... | 4 | stack_v2_sparse_classes_30k_train_002612 | Implement the Python class `Categorizer` described below.
Class description:
The parent class for creating and viewing labeled categories on a dataframe of snippets and other metadata
Method signatures and docstrings:
- def __init__(self, df_path, sc=sc, sql=sql, id_field='Url', snippet_field='Cleaned Snippet'): :par... | Implement the Python class `Categorizer` described below.
Class description:
The parent class for creating and viewing labeled categories on a dataframe of snippets and other metadata
Method signatures and docstrings:
- def __init__(self, df_path, sc=sc, sql=sql, id_field='Url', snippet_field='Cleaned Snippet'): :par... | b810c6e1a93a2ecaa9d6351449239d0a1833f971 | <|skeleton|>
class Categorizer:
"""The parent class for creating and viewing labeled categories on a dataframe of snippets and other metadata"""
def __init__(self, df_path, sc=sc, sql=sql, id_field='Url', snippet_field='Cleaned Snippet'):
""":param df_path: Pandas df containing cleaned snippets and ids... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Categorizer:
"""The parent class for creating and viewing labeled categories on a dataframe of snippets and other metadata"""
def __init__(self, df_path, sc=sc, sql=sql, id_field='Url', snippet_field='Cleaned Snippet'):
""":param df_path: Pandas df containing cleaned snippets and ids (as a maximu... | the_stack_v2_python_sparse | usherwood_ds/nlp/taxonomy/spark_regex_categorizer.py | Usherwood/usherwood_ds | train | 2 |
3237fd9296bda93a3196eeecf039920b8a16a93c | [
"super().__init__(name=name)\nself.agent = agent\nself.env = env\nself.return_obs = return_obs\nself.return_action = return_action\nself.GymOutput = GymOutput(self.return_obs, self.return_action)",
"action = hk.get_state('action', shape=[], init=lambda *_: self.GymState(self.agent(raw_obs)))\nrw, obs = self.env(a... | <|body_start_0|>
super().__init__(name=name)
self.agent = agent
self.env = env
self.return_obs = return_obs
self.return_action = return_action
self.GymOutput = GymOutput(self.return_obs, self.return_action)
<|end_body_0|>
<|body_start_1|>
action = hk.get_state('a... | Gym feedback between an agent and a Gym environment. | GymFeedback | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GymFeedback:
"""Gym feedback between an agent and a Gym environment."""
def __init__(self, agent, env, return_obs=False, return_action=False, name=None):
"""Initialize module. Args: agent : Gym environment used to unroll the data and feed the agent. env : Gym environment used to unro... | stack_v2_sparse_classes_10k_train_008103 | 3,205 | permissive | [
{
"docstring": "Initialize module. Args: agent : Gym environment used to unroll the data and feed the agent. env : Gym environment used to unroll the data and feed the agent. return_obs : if true return environment observation return_action : if true return agent action name : name of the module",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_000213 | Implement the Python class `GymFeedback` described below.
Class description:
Gym feedback between an agent and a Gym environment.
Method signatures and docstrings:
- def __init__(self, agent, env, return_obs=False, return_action=False, name=None): Initialize module. Args: agent : Gym environment used to unroll the da... | Implement the Python class `GymFeedback` described below.
Class description:
Gym feedback between an agent and a Gym environment.
Method signatures and docstrings:
- def __init__(self, agent, env, return_obs=False, return_action=False, name=None): Initialize module. Args: agent : Gym environment used to unroll the da... | ab18e064f9fa1c95458978f501efb6cde9ab64d5 | <|skeleton|>
class GymFeedback:
"""Gym feedback between an agent and a Gym environment."""
def __init__(self, agent, env, return_obs=False, return_action=False, name=None):
"""Initialize module. Args: agent : Gym environment used to unroll the data and feed the agent. env : Gym environment used to unro... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GymFeedback:
"""Gym feedback between an agent and a Gym environment."""
def __init__(self, agent, env, return_obs=False, return_action=False, name=None):
"""Initialize module. Args: agent : Gym environment used to unroll the data and feed the agent. env : Gym environment used to unroll the data a... | the_stack_v2_python_sparse | wax/modules/gym_feedback.py | zggl/wax-ml | train | 0 |
0da69d1b5c0eb8a67dd58216aa04d99b24337bf9 | [
"if path in self.saved_dicts:\n id_dict, name_dict = self.saved_dicts[path]\nelse:\n id_dict, name_dict = self.construct_dicts(path, ch_name_dict)\n self.saved_dicts[path] = (id_dict, name_dict)\nreturn id_dict",
"if path in self.saved_dicts:\n id_dict, name_dict = self.saved_dicts[path]\nelse:\n i... | <|body_start_0|>
if path in self.saved_dicts:
id_dict, name_dict = self.saved_dicts[path]
else:
id_dict, name_dict = self.construct_dicts(path, ch_name_dict)
self.saved_dicts[path] = (id_dict, name_dict)
return id_dict
<|end_body_0|>
<|body_start_1|>
... | Class to load xml packet dictionaries | PktXmlLoader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PktXmlLoader:
"""Class to load xml packet dictionaries"""
def get_id_dict(self, path, ch_name_dict):
"""Returns the python dictionary keyed by ids for the given path This function will return the same dictionary originally computed for the given path or will construct new dictionarie... | stack_v2_sparse_classes_10k_train_008104 | 4,809 | permissive | [
{
"docstring": "Returns the python dictionary keyed by ids for the given path This function will return the same dictionary originally computed for the given path or will construct new dictionaries if the path has never been passed to the get_id_dict or the get_name_dict functions. Args: path (string): Path to ... | 3 | stack_v2_sparse_classes_30k_train_001473 | Implement the Python class `PktXmlLoader` described below.
Class description:
Class to load xml packet dictionaries
Method signatures and docstrings:
- def get_id_dict(self, path, ch_name_dict): Returns the python dictionary keyed by ids for the given path This function will return the same dictionary originally comp... | Implement the Python class `PktXmlLoader` described below.
Class description:
Class to load xml packet dictionaries
Method signatures and docstrings:
- def get_id_dict(self, path, ch_name_dict): Returns the python dictionary keyed by ids for the given path This function will return the same dictionary originally comp... | aa663303327587146390dde67b83b9bf4e916d54 | <|skeleton|>
class PktXmlLoader:
"""Class to load xml packet dictionaries"""
def get_id_dict(self, path, ch_name_dict):
"""Returns the python dictionary keyed by ids for the given path This function will return the same dictionary originally computed for the given path or will construct new dictionarie... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PktXmlLoader:
"""Class to load xml packet dictionaries"""
def get_id_dict(self, path, ch_name_dict):
"""Returns the python dictionary keyed by ids for the given path This function will return the same dictionary originally computed for the given path or will construct new dictionaries if the path... | the_stack_v2_python_sparse | Gds/src/fprime_gds/common/loaders/pkt_xml_loader.py | suriyaa/fprime | train | 1 |
2f2627fd229e5362574970057b40fbdaca755406 | [
"sc_table = parse_table_name(sc_table, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)\nreeds_build = parse_table_name(reeds_build, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)\nsc_table = DataCleaner.rename_cols(sc_table, name_map=DataCleaner.REV_NAM... | <|body_start_0|>
sc_table = parse_table_name(sc_table, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)
reeds_build = parse_table_name(reeds_build, wait=wait, db_host=db_host, db_user=db_user, db_pass=db_pass, db_port=db_port)
sc_table = DataCleaner.rename_cols(sc_t... | Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data. | ProjectGidHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectGidHandler:
"""Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data."""
def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432):
"""Get resource gi... | stack_v2_sparse_classes_10k_train_008105 | 18,002 | permissive | [
{
"docstring": "Get resource gids from a single reeds supply curve build Parameters ---------- sc_table : str | pd.DataFrame reV supply curve results (CSV file path or database.schema.name) reeds_build : str | pd.DataFrame REEDS buildout file with wait : int Integer seconds to wait for DB connection to become a... | 2 | stack_v2_sparse_classes_30k_train_002215 | Implement the Python class `ProjectGidHandler` described below.
Class description:
Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.
Method signatures and docstrings:
- def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', d... | Implement the Python class `ProjectGidHandler` described below.
Class description:
Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data.
Method signatures and docstrings:
- def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', d... | 2dd05402c9c05ca0bf7f0e5bc2849ede0d0bc3cb | <|skeleton|>
class ProjectGidHandler:
"""Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data."""
def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432):
"""Get resource gi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProjectGidHandler:
"""Class to handle project GIDs for a plexos project. Can be used to make gid superset project points for 5min data."""
def get_resource_gids(sc_table, reeds_build, wait=300, db_host='gds_edit.nrel.gov', db_user=None, db_pass=None, db_port=5432):
"""Get resource gids from a sin... | the_stack_v2_python_sparse | reVX/plexos/utilities.py | NREL/reVX | train | 10 |
4048cbe6be8ba4a4182a4bdfb9b4255a31b77dcb | [
"if inorder_start >= inorder_end:\n return None\nroot = TreeNode(preorder[self.preorder_index])\nroot_index = inorder.index(preorder[self.preorder_index], inorder_start, inorder_end)\nself.preorder_index += 1\nroot.left = self.get_tree(preorder, inorder, inorder_start, root_index)\nroot.right = self.get_tree(pre... | <|body_start_0|>
if inorder_start >= inorder_end:
return None
root = TreeNode(preorder[self.preorder_index])
root_index = inorder.index(preorder[self.preorder_index], inorder_start, inorder_end)
self.preorder_index += 1
root.left = self.get_tree(preorder, inorder, ino... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def get_tree(self, preorder, inorder, inorder_start, inorder_end):
"""Note that since L.index(value, [start, [stop]]) -> integer -- return first index of value. where search continues excluding stop index similar to xrange, we always use one index extra as in root.left recursiv... | stack_v2_sparse_classes_10k_train_008106 | 2,755 | no_license | [
{
"docstring": "Note that since L.index(value, [start, [stop]]) -> integer -- return first index of value. where search continues excluding stop index similar to xrange, we always use one index extra as in root.left recursive call used root_index and not root_index-1 also from buildTree similar thing.",
"na... | 2 | stack_v2_sparse_classes_30k_train_003181 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_tree(self, preorder, inorder, inorder_start, inorder_end): Note that since L.index(value, [start, [stop]]) -> integer -- return first index of value. where search continu... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_tree(self, preorder, inorder, inorder_start, inorder_end): Note that since L.index(value, [start, [stop]]) -> integer -- return first index of value. where search continu... | 57212d700dfba0db4925d9d4896f7f0b9635a5b5 | <|skeleton|>
class Solution:
def get_tree(self, preorder, inorder, inorder_start, inorder_end):
"""Note that since L.index(value, [start, [stop]]) -> integer -- return first index of value. where search continues excluding stop index similar to xrange, we always use one index extra as in root.left recursiv... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def get_tree(self, preorder, inorder, inorder_start, inorder_end):
"""Note that since L.index(value, [start, [stop]]) -> integer -- return first index of value. where search continues excluding stop index similar to xrange, we always use one index extra as in root.left recursive call used ro... | the_stack_v2_python_sparse | binary_tree_from_inorder_and_preorder.py | baloooo/coding_practice | train | 0 | |
0121c2adaeb0041cd982e7d67436ad83af1e04e6 | [
"try:\n return True if pkgutil.find_loader(module_name) else False\nexcept ImportError:\n return False",
"module_spec = importlib.util.find_spec(module_name)\nmodule_path = module_spec.submodule_search_locations\nif module_path:\n return list(module_path)[0]\nreturn module_spec.origin"
] | <|body_start_0|>
try:
return True if pkgutil.find_loader(module_name) else False
except ImportError:
return False
<|end_body_0|>
<|body_start_1|>
module_spec = importlib.util.find_spec(module_name)
module_path = module_spec.submodule_search_locations
if m... | CustomModules | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomModules:
def is_importable(module_name: str) -> bool:
"""Return whether `module_name` can be imported."""
<|body_0|>
def get_module_path(module_name: str) -> str:
"""Return file/directory path to `module_name`."""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_10k_train_008107 | 866 | permissive | [
{
"docstring": "Return whether `module_name` can be imported.",
"name": "is_importable",
"signature": "def is_importable(module_name: str) -> bool"
},
{
"docstring": "Return file/directory path to `module_name`.",
"name": "get_module_path",
"signature": "def get_module_path(module_name: ... | 2 | null | Implement the Python class `CustomModules` described below.
Class description:
Implement the CustomModules class.
Method signatures and docstrings:
- def is_importable(module_name: str) -> bool: Return whether `module_name` can be imported.
- def get_module_path(module_name: str) -> str: Return file/directory path to... | Implement the Python class `CustomModules` described below.
Class description:
Implement the CustomModules class.
Method signatures and docstrings:
- def is_importable(module_name: str) -> bool: Return whether `module_name` can be imported.
- def get_module_path(module_name: str) -> str: Return file/directory path to... | ec9ac7712500adb13fd815dfd476ce9f536c6921 | <|skeleton|>
class CustomModules:
def is_importable(module_name: str) -> bool:
"""Return whether `module_name` can be imported."""
<|body_0|>
def get_module_path(module_name: str) -> str:
"""Return file/directory path to `module_name`."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CustomModules:
def is_importable(module_name: str) -> bool:
"""Return whether `module_name` can be imported."""
try:
return True if pkgutil.find_loader(module_name) else False
except ImportError:
return False
def get_module_path(module_name: str) -> str:
... | the_stack_v2_python_sparse | client/verta/verta/_internal_utils/custom_modules.py | VertaAI/modeldb | train | 844 | |
410ea051f098f7cd66b248d469763845ca04585c | [
"assert isinstance(k, numbers.Number)\nself.net = net\nself.learners = {}\nself.inverse_map = inverse_map\nif learner_class is None:\n learner_class = learn.CountLearner\nfor inverse_net in inverse_map.values():\n for node in inverse_net.nodes_by_index:\n parents = node.parents\n parent_indices ... | <|body_start_0|>
assert isinstance(k, numbers.Number)
self.net = net
self.learners = {}
self.inverse_map = inverse_map
if learner_class is None:
learner_class = learn.CountLearner
for inverse_net in inverse_map.values():
for node in inverse_net.nod... | Learn distributions for all conditionals in a BayesNetMap. | Trainer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trainer:
"""Learn distributions for all conditionals in a BayesNetMap."""
def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None):
"""Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the... | stack_v2_sparse_classes_10k_train_008108 | 2,140 | no_license | [
{
"docstring": "Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the Bayes net precompute_gibbs: a Boolean indicating whether to do exact computation of Gibbs conditinoals during initialization. learner_class: a learnable distribution as d... | 3 | stack_v2_sparse_classes_30k_train_004115 | Implement the Python class `Trainer` described below.
Class description:
Learn distributions for all conditionals in a BayesNetMap.
Method signatures and docstrings:
- def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None): Extracting all distinct conditionals from inverse map. Args: net: a ... | Implement the Python class `Trainer` described below.
Class description:
Learn distributions for all conditionals in a BayesNetMap.
Method signatures and docstrings:
- def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None): Extracting all distinct conditionals from inverse map. Args: net: a ... | 49630b731bd5b1c43eb015075cbd794428569f53 | <|skeleton|>
class Trainer:
"""Learn distributions for all conditionals in a BayesNetMap."""
def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None):
"""Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Trainer:
"""Learn distributions for all conditionals in a BayesNetMap."""
def __init__(self, net, inverse_map, precompute_gibbs, k=50, learner_class=None):
"""Extracting all distinct conditionals from inverse map. Args: net: a BayesNet inverse_map: a BayesNetMap with inverses for the Bayes net pr... | the_stack_v2_python_sparse | i3/train.py | stuhlmueller/i3 | train | 5 |
d1f6321444eebb293c4c5b7e242eeb6170c23217 | [
"time = timezone.now() + datetime.timedelta(days=30)\nfuture_question = Question(pub_date=time)\nself.assertIs(future_question.was_published_recently(), False)",
"time = timezone.now() - datetime.timedelta(days=2)\npast_question = Question(pub_date=time)\nself.assertIs(past_question.was_published_recently(), Fals... | <|body_start_0|>
time = timezone.now() + datetime.timedelta(days=30)
future_question = Question(pub_date=time)
self.assertIs(future_question.was_published_recently(), False)
<|end_body_0|>
<|body_start_1|>
time = timezone.now() - datetime.timedelta(days=2)
past_question = Questi... | QuestionMethodTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionMethodTests:
def test_was_published_recently_with_future_question(self):
"""was_published_recently() should return False for questions whose pub_date is in the future."""
<|body_0|>
def test_was_published_recently_with_old_question(self):
"""was_published_rec... | stack_v2_sparse_classes_10k_train_008109 | 7,438 | no_license | [
{
"docstring": "was_published_recently() should return False for questions whose pub_date is in the future.",
"name": "test_was_published_recently_with_future_question",
"signature": "def test_was_published_recently_with_future_question(self)"
},
{
"docstring": "was_published_recently() should r... | 3 | stack_v2_sparse_classes_30k_train_004633 | Implement the Python class `QuestionMethodTests` described below.
Class description:
Implement the QuestionMethodTests class.
Method signatures and docstrings:
- def test_was_published_recently_with_future_question(self): was_published_recently() should return False for questions whose pub_date is in the future.
- de... | Implement the Python class `QuestionMethodTests` described below.
Class description:
Implement the QuestionMethodTests class.
Method signatures and docstrings:
- def test_was_published_recently_with_future_question(self): was_published_recently() should return False for questions whose pub_date is in the future.
- de... | a7e7fc72abe357172f5aa49b03c5b9298d92d6e8 | <|skeleton|>
class QuestionMethodTests:
def test_was_published_recently_with_future_question(self):
"""was_published_recently() should return False for questions whose pub_date is in the future."""
<|body_0|>
def test_was_published_recently_with_old_question(self):
"""was_published_rec... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuestionMethodTests:
def test_was_published_recently_with_future_question(self):
"""was_published_recently() should return False for questions whose pub_date is in the future."""
time = timezone.now() + datetime.timedelta(days=30)
future_question = Question(pub_date=time)
self.... | the_stack_v2_python_sparse | firstdjango/polls/tests.py | thewritingstew/lpthw | train | 0 | |
a4abc0cdc95169ebcc7f11d9ed7760ba3fd61f4b | [
"import math\nfinal_ans = max(piles)\nstart, end = (1, max(piles))\nwhile start <= end:\n mid = (start + end) // 2\n ans = 0\n for pile in piles:\n ans += math.ceil(pile / mid)\n if ans > H:\n start = mid + 1\n else:\n final_ans = min(mid, final_ans)\n end = mid - 1\nretur... | <|body_start_0|>
import math
final_ans = max(piles)
start, end = (1, max(piles))
while start <= end:
mid = (start + end) // 2
ans = 0
for pile in piles:
ans += math.ceil(pile / mid)
if ans > H:
start = mid + ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minEatingSpeed(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int 560 ms"""
<|body_0|>
def minEatingSpeed_1(self, piles, H):
"""252ms :param piles: :param H: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
imp... | stack_v2_sparse_classes_10k_train_008110 | 2,186 | no_license | [
{
"docstring": ":type piles: List[int] :type H: int :rtype: int 560 ms",
"name": "minEatingSpeed",
"signature": "def minEatingSpeed(self, piles, H)"
},
{
"docstring": "252ms :param piles: :param H: :return:",
"name": "minEatingSpeed_1",
"signature": "def minEatingSpeed_1(self, piles, H)"... | 2 | stack_v2_sparse_classes_30k_val_000102 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minEatingSpeed(self, piles, H): :type piles: List[int] :type H: int :rtype: int 560 ms
- def minEatingSpeed_1(self, piles, H): 252ms :param piles: :param H: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minEatingSpeed(self, piles, H): :type piles: List[int] :type H: int :rtype: int 560 ms
- def minEatingSpeed_1(self, piles, H): 252ms :param piles: :param H: :return:
<|skele... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def minEatingSpeed(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int 560 ms"""
<|body_0|>
def minEatingSpeed_1(self, piles, H):
"""252ms :param piles: :param H: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minEatingSpeed(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int 560 ms"""
import math
final_ans = max(piles)
start, end = (1, max(piles))
while start <= end:
mid = (start + end) // 2
ans = 0
for pile i... | the_stack_v2_python_sparse | KokoEatingBananas_MID_875.py | 953250587/leetcode-python | train | 2 | |
2d8c1873ca83573a9de3262aa0f07de49608b223 | [
"self._position = _format_LatLng(lat, lng, precision)\nself._text = text\ncolor = kwargs.get('color')\nself._color = _get_hex_color(color) if color is not None else None\nself._icon = _get_embeddable_image(_COLOR_ICON_PATH % 'clear')\nself._font_size = kwargs.get('font_size')",
"w.write('new google.maps.Marker({'... | <|body_start_0|>
self._position = _format_LatLng(lat, lng, precision)
self._text = text
color = kwargs.get('color')
self._color = _get_hex_color(color) if color is not None else None
self._icon = _get_embeddable_image(_COLOR_ICON_PATH % 'clear')
self._font_size = kwargs.g... | _Text | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Text:
def __init__(self, lat, lng, text, precision, **kwargs):
"""Args: lat (float): Latitude of the text label. lng (float): Longitude of the text label. text (str): Text to display. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: col... | stack_v2_sparse_classes_10k_train_008111 | 1,692 | permissive | [
{
"docstring": "Args: lat (float): Latitude of the text label. lng (float): Longitude of the text label. text (str): Text to display. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: color (str): Text color. Can be hex ('#00FFFF'), named ('cyan'), or matplotlib... | 2 | stack_v2_sparse_classes_30k_train_002818 | Implement the Python class `_Text` described below.
Class description:
Implement the _Text class.
Method signatures and docstrings:
- def __init__(self, lat, lng, text, precision, **kwargs): Args: lat (float): Latitude of the text label. lng (float): Longitude of the text label. text (str): Text to display. precision... | Implement the Python class `_Text` described below.
Class description:
Implement the _Text class.
Method signatures and docstrings:
- def __init__(self, lat, lng, text, precision, **kwargs): Args: lat (float): Latitude of the text label. lng (float): Longitude of the text label. text (str): Text to display. precision... | 8654a5a370b5ec309e1282c457eaf375c3dcb4bb | <|skeleton|>
class _Text:
def __init__(self, lat, lng, text, precision, **kwargs):
"""Args: lat (float): Latitude of the text label. lng (float): Longitude of the text label. text (str): Text to display. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: col... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _Text:
def __init__(self, lat, lng, text, precision, **kwargs):
"""Args: lat (float): Latitude of the text label. lng (float): Longitude of the text label. text (str): Text to display. precision (int): Number of digits after the decimal to round to for lat/lng values. Optional: Args: color (str): Text... | the_stack_v2_python_sparse | gmplot/drawables/text.py | fishke22/gmplot | train | 0 | |
ffd38e1013c715195ab2ee1230cda361b0e3de8b | [
"component = self._parameter('component')\nbranch = self._parameter('branch')\nbase_api_url = await SonarQubeCollector._api_url(self)\ntotal_metric_api_url = URL(f'{base_api_url}/api/measures/component?component={component}&branch={branch}&metricKeys={self.total_metric}')\nreturn await super()._get_source_responses... | <|body_start_0|>
component = self._parameter('component')
branch = self._parameter('branch')
base_api_url = await SonarQubeCollector._api_url(self)
total_metric_api_url = URL(f'{base_api_url}/api/measures/component?component={component}&branch={branch}&metricKeys={self.total_metric}')
... | SonarQube violations collectors that support the percentage scale. | SonarQubeViolationsWithPercentageScale | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SonarQubeViolationsWithPercentageScale:
"""SonarQube violations collectors that support the percentage scale."""
async def _get_source_responses(self, *urls: URL) -> SourceResponses:
"""Extend to, next to the violations, get the total number of violations as basis for the percentage ... | stack_v2_sparse_classes_10k_train_008112 | 5,688 | permissive | [
{
"docstring": "Extend to, next to the violations, get the total number of violations as basis for the percentage scale.",
"name": "_get_source_responses",
"signature": "async def _get_source_responses(self, *urls: URL) -> SourceResponses"
},
{
"docstring": "Extend to parse the total number of v... | 2 | stack_v2_sparse_classes_30k_train_003970 | Implement the Python class `SonarQubeViolationsWithPercentageScale` described below.
Class description:
SonarQube violations collectors that support the percentage scale.
Method signatures and docstrings:
- async def _get_source_responses(self, *urls: URL) -> SourceResponses: Extend to, next to the violations, get th... | Implement the Python class `SonarQubeViolationsWithPercentageScale` described below.
Class description:
SonarQube violations collectors that support the percentage scale.
Method signatures and docstrings:
- async def _get_source_responses(self, *urls: URL) -> SourceResponses: Extend to, next to the violations, get th... | 5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3 | <|skeleton|>
class SonarQubeViolationsWithPercentageScale:
"""SonarQube violations collectors that support the percentage scale."""
async def _get_source_responses(self, *urls: URL) -> SourceResponses:
"""Extend to, next to the violations, get the total number of violations as basis for the percentage ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SonarQubeViolationsWithPercentageScale:
"""SonarQube violations collectors that support the percentage scale."""
async def _get_source_responses(self, *urls: URL) -> SourceResponses:
"""Extend to, next to the violations, get the total number of violations as basis for the percentage scale."""
... | the_stack_v2_python_sparse | components/collector/src/source_collectors/sonarqube/violations.py | ICTU/quality-time | train | 43 |
079cfa111750e7132792b64391803fe4c2751039 | [
"self.seconds = seconds\nself.on_earth = self.on_planet_gen(1.0)\nself.on_mercury = self.on_planet_gen(0.2408467)\nself.on_venus = self.on_planet_gen(0.61519726)\nself.on_mars = self.on_planet_gen(1.8808158)\nself.on_jupiter = self.on_planet_gen(11.862615)\nself.on_saturn = self.on_planet_gen(29.447498)\nself.on_ur... | <|body_start_0|>
self.seconds = seconds
self.on_earth = self.on_planet_gen(1.0)
self.on_mercury = self.on_planet_gen(0.2408467)
self.on_venus = self.on_planet_gen(0.61519726)
self.on_mars = self.on_planet_gen(1.8808158)
self.on_jupiter = self.on_planet_gen(11.862615)
... | Calculates age on various planets | SpaceAge | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpaceAge:
"""Calculates age on various planets"""
def __init__(self, seconds):
"""Stores age builds functions"""
<|body_0|>
def on_planet_gen(self, ratio_to_earth):
"""Returns a function that converts seconds into planet years"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_10k_train_008113 | 1,052 | no_license | [
{
"docstring": "Stores age builds functions",
"name": "__init__",
"signature": "def __init__(self, seconds)"
},
{
"docstring": "Returns a function that converts seconds into planet years",
"name": "on_planet_gen",
"signature": "def on_planet_gen(self, ratio_to_earth)"
}
] | 2 | null | Implement the Python class `SpaceAge` described below.
Class description:
Calculates age on various planets
Method signatures and docstrings:
- def __init__(self, seconds): Stores age builds functions
- def on_planet_gen(self, ratio_to_earth): Returns a function that converts seconds into planet years | Implement the Python class `SpaceAge` described below.
Class description:
Calculates age on various planets
Method signatures and docstrings:
- def __init__(self, seconds): Stores age builds functions
- def on_planet_gen(self, ratio_to_earth): Returns a function that converts seconds into planet years
<|skeleton|>
c... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class SpaceAge:
"""Calculates age on various planets"""
def __init__(self, seconds):
"""Stores age builds functions"""
<|body_0|>
def on_planet_gen(self, ratio_to_earth):
"""Returns a function that converts seconds into planet years"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SpaceAge:
"""Calculates age on various planets"""
def __init__(self, seconds):
"""Stores age builds functions"""
self.seconds = seconds
self.on_earth = self.on_planet_gen(1.0)
self.on_mercury = self.on_planet_gen(0.2408467)
self.on_venus = self.on_planet_gen(0.6151... | the_stack_v2_python_sparse | _algorithms_challenges/exercism/exercism-python-master/space-age/space_age.py | syurskyi/Algorithms_and_Data_Structure | train | 4 |
3a737a6100ec1f3a5548817e3a067facb27cb3fd | [
"cccc.Stream.__init__(self, fileName, fileMode)\nself.label = 'FIXSRC '\nself.fileId = 1\nself.fixSrc = fixSrc\nni, nj, nz, ng = self.fixSrc.shape\nself.fc = collections.OrderedDict([('itype', 0), ('ndim', 3), ('ngroup', ng), ('ninti', ni), ('nintj', nj), ('nintk', nz), ('idists', 1), ('ndcomp', 1)... | <|body_start_0|>
cccc.Stream.__init__(self, fileName, fileMode)
self.label = 'FIXSRC '
self.fileId = 1
self.fixSrc = fixSrc
ni, nj, nz, ng = self.fixSrc.shape
self.fc = collections.OrderedDict([('itype', 0), ('ndim', 3), ('ngroup', ng), ('ninti', ni), ('n... | Read or write a binary FIXSRC file from DIF3D fixed source input. | FIXSRC | [
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FIXSRC:
"""Read or write a binary FIXSRC file from DIF3D fixed source input."""
def __init__(self, fileName, fileMode, fixSrc):
"""Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC ... | stack_v2_sparse_classes_10k_train_008114 | 4,615 | permissive | [
{
"docstring": "Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC file, the variable FIXSRC.fixSrc, which contains to-be-written core-wide multigroup gamma fixed source data, is constructed from an existing ne... | 5 | null | Implement the Python class `FIXSRC` described below.
Class description:
Read or write a binary FIXSRC file from DIF3D fixed source input.
Method signatures and docstrings:
- def __init__(self, fileName, fileMode, fixSrc): Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixe... | Implement the Python class `FIXSRC` described below.
Class description:
Read or write a binary FIXSRC file from DIF3D fixed source input.
Method signatures and docstrings:
- def __init__(self, fileName, fileMode, fixSrc): Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixe... | 360791847227df3f3a337a996ef561e00f846a09 | <|skeleton|>
class FIXSRC:
"""Read or write a binary FIXSRC file from DIF3D fixed source input."""
def __init__(self, fileName, fileMode, fixSrc):
"""Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FIXSRC:
"""Read or write a binary FIXSRC file from DIF3D fixed source input."""
def __init__(self, fileName, fileMode, fixSrc):
"""Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC file, the var... | the_stack_v2_python_sparse | armi/nuclearDataIO/cccc/fixsrc.py | terrapower/armi | train | 204 |
740adc535a591d98501eb11a6930dccd22b5ff00 | [
"q = [root]\nop = []\nwhile q:\n cur_node = q.pop(0)\n if not cur_node:\n op.append('None')\n continue\n else:\n op.append(str(cur_node.val))\n q.append(cur_node.left)\n q.append(cur_node.right)\nreturn ','.join(op)",
"data = list(data.split(','))\nif data[0] == 'None':\n re... | <|body_start_0|>
q = [root]
op = []
while q:
cur_node = q.pop(0)
if not cur_node:
op.append('None')
continue
else:
op.append(str(cur_node.val))
q.append(cur_node.left)
q.append(cur_node.ri... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_008115 | 1,622 | 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:... | fe57e668db23f7c480835c0a10f363d718fbaefd | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
q = [root]
op = []
while q:
cur_node = q.pop(0)
if not cur_node:
op.append('None')
continue
else:
... | the_stack_v2_python_sparse | Python/lc_297_serialize_deserialize_binary_tree.py | cmattey/leetcode_problems | train | 6 | |
2968199be47606452dbc768461fa40782dc26323 | [
"trigger = TimerTrigger(self.mudpi, config)\nself.add_component(trigger)\nreturn True",
"if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if not conf.get('key'):\n raise ConfigError('Missing `key` in Timer Trigger config.')\nreturn config",
"self.register_component_action... | <|body_start_0|>
trigger = TimerTrigger(self.mudpi, config)
self.add_component(trigger)
return True
<|end_body_0|>
<|body_start_1|>
if not isinstance(config, list):
config = [config]
for conf in config:
if not conf.get('key'):
raise Config... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load timer trigger component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the trigger config"""
<|body_1|>
def register_actions(self):
"""Register any interface actions"""
<|body... | stack_v2_sparse_classes_10k_train_008116 | 6,506 | permissive | [
{
"docstring": "Load timer trigger component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Validate the trigger config",
"name": "validate",
"signature": "def validate(self, config)"
},
{
"docstring": "Register any interface actions",
... | 3 | stack_v2_sparse_classes_30k_train_002941 | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load timer trigger component from configs
- def validate(self, config): Validate the trigger config
- def register_actions(self): Register any interface... | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load timer trigger component from configs
- def validate(self, config): Validate the trigger config
- def register_actions(self): Register any interface... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load timer trigger component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the trigger config"""
<|body_1|>
def register_actions(self):
"""Register any interface actions"""
<|body... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Interface:
def load(self, config):
"""Load timer trigger component from configs"""
trigger = TimerTrigger(self.mudpi, config)
self.add_component(trigger)
return True
def validate(self, config):
"""Validate the trigger config"""
if not isinstance(config, lis... | the_stack_v2_python_sparse | mudpi/extensions/timer/trigger.py | mistasp0ck/mudpi-core | train | 0 | |
96183311d01c3e2196e16b3a5dca6f89ac3ec3c7 | [
"asyncnotifier.FileEventHandlerBase.__init__(self, wm)\nself._cb = cb\nself._filename = os.path.basename(path)\nmask = pyinotify.EventsCodes.ALL_FLAGS['IN_CLOSE_WRITE'] | pyinotify.EventsCodes.ALL_FLAGS['IN_DELETE'] | pyinotify.EventsCodes.ALL_FLAGS['IN_MOVED_FROM'] | pyinotify.EventsCodes.ALL_FLAGS['IN_MOVED_TO']\... | <|body_start_0|>
asyncnotifier.FileEventHandlerBase.__init__(self, wm)
self._cb = cb
self._filename = os.path.basename(path)
mask = pyinotify.EventsCodes.ALL_FLAGS['IN_CLOSE_WRITE'] | pyinotify.EventsCodes.ALL_FLAGS['IN_DELETE'] | pyinotify.EventsCodes.ALL_FLAGS['IN_MOVED_FROM'] | pyinot... | FileEventHandler | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileEventHandler:
def __init__(self, wm, path, cb):
"""Initializes this class. @param wm: Inotify watch manager @type path: string @param path: File path @type cb: callable @param cb: Function called on file change"""
<|body_0|>
def process_default(self, event):
"""C... | stack_v2_sparse_classes_10k_train_008117 | 12,206 | permissive | [
{
"docstring": "Initializes this class. @param wm: Inotify watch manager @type path: string @param path: File path @type cb: callable @param cb: Function called on file change",
"name": "__init__",
"signature": "def __init__(self, wm, path, cb)"
},
{
"docstring": "Called upon inotify event.",
... | 2 | stack_v2_sparse_classes_30k_train_005843 | Implement the Python class `FileEventHandler` described below.
Class description:
Implement the FileEventHandler class.
Method signatures and docstrings:
- def __init__(self, wm, path, cb): Initializes this class. @param wm: Inotify watch manager @type path: string @param path: File path @type cb: callable @param cb:... | Implement the Python class `FileEventHandler` described below.
Class description:
Implement the FileEventHandler class.
Method signatures and docstrings:
- def __init__(self, wm, path, cb): Initializes this class. @param wm: Inotify watch manager @type path: string @param path: File path @type cb: callable @param cb:... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class FileEventHandler:
def __init__(self, wm, path, cb):
"""Initializes this class. @param wm: Inotify watch manager @type path: string @param path: File path @type cb: callable @param cb: Function called on file change"""
<|body_0|>
def process_default(self, event):
"""C... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FileEventHandler:
def __init__(self, wm, path, cb):
"""Initializes this class. @param wm: Inotify watch manager @type path: string @param path: File path @type cb: callable @param cb: Function called on file change"""
asyncnotifier.FileEventHandlerBase.__init__(self, wm)
self._cb = cb
... | the_stack_v2_python_sparse | lib/server/rapi.py | ganeti/ganeti | train | 465 | |
dc5d36b728d8615caf11cf93f85683b0d8182bdc | [
"user = YouYodaUser.objects.get(auth_token=request.headers['Authorization'].replace('Token ', ''))\nserializer = ProfileEditSerializer(user)\nreturn Response(serializer.data)",
"user = get_object_or_404(YouYodaUser, email=request.data.get('email'))\nserializer = ProfileEditSerializer(user, data=request.data, part... | <|body_start_0|>
user = YouYodaUser.objects.get(auth_token=request.headers['Authorization'].replace('Token ', ''))
serializer = ProfileEditSerializer(user)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
user = get_object_or_404(YouYodaUser, email=request.data.get('emai... | Takes data from ProfileEditSerializer for fill/edit user profile. | EditProfile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EditProfile:
"""Takes data from ProfileEditSerializer for fill/edit user profile."""
def get(self, request):
"""Receives and transmits user profile data"""
<|body_0|>
def patch(self, request, *args, **kwargs):
"""Receives and updates user profile data"""
... | stack_v2_sparse_classes_10k_train_008118 | 1,435 | no_license | [
{
"docstring": "Receives and transmits user profile data",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Receives and updates user profile data",
"name": "patch",
"signature": "def patch(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006405 | Implement the Python class `EditProfile` described below.
Class description:
Takes data from ProfileEditSerializer for fill/edit user profile.
Method signatures and docstrings:
- def get(self, request): Receives and transmits user profile data
- def patch(self, request, *args, **kwargs): Receives and updates user pro... | Implement the Python class `EditProfile` described below.
Class description:
Takes data from ProfileEditSerializer for fill/edit user profile.
Method signatures and docstrings:
- def get(self, request): Receives and transmits user profile data
- def patch(self, request, *args, **kwargs): Receives and updates user pro... | 62b4f1cc79b4c71cc44bb741fb20af066c7023a5 | <|skeleton|>
class EditProfile:
"""Takes data from ProfileEditSerializer for fill/edit user profile."""
def get(self, request):
"""Receives and transmits user profile data"""
<|body_0|>
def patch(self, request, *args, **kwargs):
"""Receives and updates user profile data"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EditProfile:
"""Takes data from ProfileEditSerializer for fill/edit user profile."""
def get(self, request):
"""Receives and transmits user profile data"""
user = YouYodaUser.objects.get(auth_token=request.headers['Authorization'].replace('Token ', ''))
serializer = ProfileEditSer... | the_stack_v2_python_sparse | backend/appsrc/views/edit_profile.py | OleksandrHavrylchyk/YouYoda | train | 0 |
8c9a5abaf56e2c958ad44fd406c96d65f3833360 | [
"if not hasattr(self, '_image'):\n img_dts = {}\n pname = self.product.name\n sname = self.sector.name\n img_dts['start_fullext' + sname + pname] = datetime.utcnow()\n log.info('Entering external data-based algorithm.')\n \"\\n Products are mapped one to one from productfiles/<platform_... | <|body_start_0|>
if not hasattr(self, '_image'):
img_dts = {}
pname = self.product.name
sname = self.sector.name
img_dts['start_fullext' + sname + pname] = datetime.utcnow()
log.info('Entering external data-based algorithm.')
"\n ... | ExternalAlg | [
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternalAlg:
def image(self):
"""ExternalAlg is different than ExternalImg in that it takes in the entire datafile for processing (rather than pre-registered data), and returns an arbitrary array or dictionary of arrays instead of an RGB image array). If a dictionary is returned, one ima... | stack_v2_sparse_classes_10k_train_008119 | 7,441 | permissive | [
{
"docstring": "ExternalAlg is different than ExternalImg in that it takes in the entire datafile for processing (rather than pre-registered data), and returns an arbitrary array or dictionary of arrays instead of an RGB image array). If a dictionary is returned, one image will be created per dictionary entry (... | 3 | stack_v2_sparse_classes_30k_train_003133 | Implement the Python class `ExternalAlg` described below.
Class description:
Implement the ExternalAlg class.
Method signatures and docstrings:
- def image(self): ExternalAlg is different than ExternalImg in that it takes in the entire datafile for processing (rather than pre-registered data), and returns an arbitrar... | Implement the Python class `ExternalAlg` described below.
Class description:
Implement the ExternalAlg class.
Method signatures and docstrings:
- def image(self): ExternalAlg is different than ExternalImg in that it takes in the entire datafile for processing (rather than pre-registered data), and returns an arbitrar... | a07e128467b71a5bff25ba0215e020bfe57706dd | <|skeleton|>
class ExternalAlg:
def image(self):
"""ExternalAlg is different than ExternalImg in that it takes in the entire datafile for processing (rather than pre-registered data), and returns an arbitrary array or dictionary of arrays instead of an RGB image array). If a dictionary is returned, one ima... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExternalAlg:
def image(self):
"""ExternalAlg is different than ExternalImg in that it takes in the entire datafile for processing (rather than pre-registered data), and returns an arbitrary array or dictionary of arrays instead of an RGB image array). If a dictionary is returned, one image will be cre... | the_stack_v2_python_sparse | geoips/geoimg/plot/externalalg.py | WIEQLI/GeoIPS | train | 0 | |
b9e2cba9c454e3e86a86e358200315c9b9949078 | [
"if not root:\n return None\nres = TreeNode(root.val)\nif root.children:\n res.left = self.encode(root.children[0])\ncur = res.left\nfor i in range(1, len(root.children)):\n cur.right = self.encode(root.children[i])\n cur = cur.right\nreturn res",
"if not data:\n return None\nres = Node(data.val, [... | <|body_start_0|>
if not root:
return None
res = TreeNode(root.val)
if root.children:
res.left = self.encode(root.children[0])
cur = res.left
for i in range(1, len(root.children)):
cur.right = self.encode(root.children[i])
cur = cur.... | Codec2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec2:
def encode(self, root):
"""Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode"""
<|body_0|>
def decode(self, data):
"""Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_10k_train_008120 | 1,961 | no_license | [
{
"docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode",
"name": "encode",
"signature": "def encode(self, root)"
},
{
"docstring": "Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node",
"name": "decode",
"signature": "def decode... | 2 | null | Implement the Python class `Codec2` described below.
Class description:
Implement the Codec2 class.
Method signatures and docstrings:
- def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode
- def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: Tre... | Implement the Python class `Codec2` described below.
Class description:
Implement the Codec2 class.
Method signatures and docstrings:
- def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode
- def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: Tre... | 3e50f6a936b98ad75c47d7c1719e69163c648235 | <|skeleton|>
class Codec2:
def encode(self, root):
"""Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode"""
<|body_0|>
def decode(self, data):
"""Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec2:
def encode(self, root):
"""Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode"""
if not root:
return None
res = TreeNode(root.val)
if root.children:
res.left = self.encode(root.children[0])
cur = res.left
fo... | the_stack_v2_python_sparse | LeetcodeNew/Tree/LC_431_Encode_N_ary_Tree_to_Binary_Tree.py | Taoge123/OptimizedLeetcode | train | 9 | |
8b085fff21261152e2cd43b3d0704ed56eb23550 | [
"visitorTypeDict = self.getDictBykey(self.__getVisitorConfigList().json(), 'name', visitorType)\nself.url = '/mgr/park/parkVisitorlist/save.do'\ndata = {'specialCarTypeConfigId': visitorTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'ownerPhone': '135' + SA().create_randomNum(val=8), 'visitReason... | <|body_start_0|>
visitorTypeDict = self.getDictBykey(self.__getVisitorConfigList().json(), 'name', visitorType)
self.url = '/mgr/park/parkVisitorlist/save.do'
data = {'specialCarTypeConfigId': visitorTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'ownerPhone': '135' + SA().cre... | 访客车录入 | ParkVisitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParkVisitor:
"""访客车录入"""
def addVisitor(self, visitorType, carNum):
"""新建访客车辆"""
<|body_0|>
def delVisitor(self, parkName, carNum):
"""删除访客车辆"""
<|body_1|>
def __getVisitorConfigList(self):
"""查看访客配置列表"""
<|body_2|>
def getParkVi... | stack_v2_sparse_classes_10k_train_008121 | 13,467 | no_license | [
{
"docstring": "新建访客车辆",
"name": "addVisitor",
"signature": "def addVisitor(self, visitorType, carNum)"
},
{
"docstring": "删除访客车辆",
"name": "delVisitor",
"signature": "def delVisitor(self, parkName, carNum)"
},
{
"docstring": "查看访客配置列表",
"name": "__getVisitorConfigList",
... | 4 | stack_v2_sparse_classes_30k_train_000159 | Implement the Python class `ParkVisitor` described below.
Class description:
访客车录入
Method signatures and docstrings:
- def addVisitor(self, visitorType, carNum): 新建访客车辆
- def delVisitor(self, parkName, carNum): 删除访客车辆
- def __getVisitorConfigList(self): 查看访客配置列表
- def getParkVisitorList(self, parkName): 获取访客录入车辆 | Implement the Python class `ParkVisitor` described below.
Class description:
访客车录入
Method signatures and docstrings:
- def addVisitor(self, visitorType, carNum): 新建访客车辆
- def delVisitor(self, parkName, carNum): 删除访客车辆
- def __getVisitorConfigList(self): 查看访客配置列表
- def getParkVisitorList(self, parkName): 获取访客录入车辆
<|s... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class ParkVisitor:
"""访客车录入"""
def addVisitor(self, visitorType, carNum):
"""新建访客车辆"""
<|body_0|>
def delVisitor(self, parkName, carNum):
"""删除访客车辆"""
<|body_1|>
def __getVisitorConfigList(self):
"""查看访客配置列表"""
<|body_2|>
def getParkVi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ParkVisitor:
"""访客车录入"""
def addVisitor(self, visitorType, carNum):
"""新建访客车辆"""
visitorTypeDict = self.getDictBykey(self.__getVisitorConfigList().json(), 'name', visitorType)
self.url = '/mgr/park/parkVisitorlist/save.do'
data = {'specialCarTypeConfigId': visitorTypeDict[... | the_stack_v2_python_sparse | Api/parkingManage_service/carTypeManage_service/carTypeConfig.py | oyebino/pomp_api | train | 1 |
7cfba947868653330f2e61f87cf51d2af0a14f7e | [
"super(RandomForest, self).setUp()\nschema = [('feat1', float), ('feat2', float), ('class', int)]\nfilename = self.get_file('rand_forest_class.csv')\nself.frame = self.context.frame.import_csv(filename, schema=schema)",
"rfmodel = self.context.models.classification.random_forest_classifier.train(self.frame, ['fea... | <|body_start_0|>
super(RandomForest, self).setUp()
schema = [('feat1', float), ('feat2', float), ('class', int)]
filename = self.get_file('rand_forest_class.csv')
self.frame = self.context.frame.import_csv(filename, schema=schema)
<|end_body_0|>
<|body_start_1|>
rfmodel = self.c... | RandomForest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomForest:
def setUp(self):
"""Build the required frame"""
<|body_0|>
def test_class_scoring(self):
"""Test random forest classifier scoring model"""
<|body_1|>
def test_reg_scoring(self):
"""Test random forest regressor scoring model"""
... | stack_v2_sparse_classes_10k_train_008122 | 3,004 | permissive | [
{
"docstring": "Build the required frame",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test random forest classifier scoring model",
"name": "test_class_scoring",
"signature": "def test_class_scoring(self)"
},
{
"docstring": "Test random forest regressor sc... | 3 | null | Implement the Python class `RandomForest` described below.
Class description:
Implement the RandomForest class.
Method signatures and docstrings:
- def setUp(self): Build the required frame
- def test_class_scoring(self): Test random forest classifier scoring model
- def test_reg_scoring(self): Test random forest reg... | Implement the Python class `RandomForest` described below.
Class description:
Implement the RandomForest class.
Method signatures and docstrings:
- def setUp(self): Build the required frame
- def test_class_scoring(self): Test random forest classifier scoring model
- def test_reg_scoring(self): Test random forest reg... | 5548fc925b5c278263cbdebbd9e8c7593320c2f4 | <|skeleton|>
class RandomForest:
def setUp(self):
"""Build the required frame"""
<|body_0|>
def test_class_scoring(self):
"""Test random forest classifier scoring model"""
<|body_1|>
def test_reg_scoring(self):
"""Test random forest regressor scoring model"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomForest:
def setUp(self):
"""Build the required frame"""
super(RandomForest, self).setUp()
schema = [('feat1', float), ('feat2', float), ('class', int)]
filename = self.get_file('rand_forest_class.csv')
self.frame = self.context.frame.import_csv(filename, schema=sc... | the_stack_v2_python_sparse | regression-tests/sparktkregtests/testcases/scoretests/random_forest_test.py | trustedanalytics/spark-tk | train | 35 | |
4511b9f574582a9614dd738414109b8f0154d6e8 | [
"request = pecan.request\ncontext = request.environ['context']\ntransfer_accepts = self.central_api.get_zone_transfer_accept(context, transfer_accept_id)\nLOG.info('Retrieved %(transfer_accepts)s', {'transfer_accepts': transfer_accepts})\nreturn DesignateAdapter.render('API_v2', transfer_accepts, request=request)",... | <|body_start_0|>
request = pecan.request
context = request.environ['context']
transfer_accepts = self.central_api.get_zone_transfer_accept(context, transfer_accept_id)
LOG.info('Retrieved %(transfer_accepts)s', {'transfer_accepts': transfer_accepts})
return DesignateAdapter.rende... | TransferAcceptsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransferAcceptsController:
def get_one(self, transfer_accept_id):
"""Get transfer_accepts"""
<|body_0|>
def get_all(self, **params):
"""List ZoneTransferAccepts"""
<|body_1|>
def post_all(self):
"""Create ZoneTransferAccept"""
<|body_2|>
... | stack_v2_sparse_classes_10k_train_008123 | 3,661 | permissive | [
{
"docstring": "Get transfer_accepts",
"name": "get_one",
"signature": "def get_one(self, transfer_accept_id)"
},
{
"docstring": "List ZoneTransferAccepts",
"name": "get_all",
"signature": "def get_all(self, **params)"
},
{
"docstring": "Create ZoneTransferAccept",
"name": "p... | 3 | stack_v2_sparse_classes_30k_train_004453 | Implement the Python class `TransferAcceptsController` described below.
Class description:
Implement the TransferAcceptsController class.
Method signatures and docstrings:
- def get_one(self, transfer_accept_id): Get transfer_accepts
- def get_all(self, **params): List ZoneTransferAccepts
- def post_all(self): Create... | Implement the Python class `TransferAcceptsController` described below.
Class description:
Implement the TransferAcceptsController class.
Method signatures and docstrings:
- def get_one(self, transfer_accept_id): Get transfer_accepts
- def get_all(self, **params): List ZoneTransferAccepts
- def post_all(self): Create... | 360433b38b449d1c53ab1357fdb0c4608c09efa5 | <|skeleton|>
class TransferAcceptsController:
def get_one(self, transfer_accept_id):
"""Get transfer_accepts"""
<|body_0|>
def get_all(self, **params):
"""List ZoneTransferAccepts"""
<|body_1|>
def post_all(self):
"""Create ZoneTransferAccept"""
<|body_2|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TransferAcceptsController:
def get_one(self, transfer_accept_id):
"""Get transfer_accepts"""
request = pecan.request
context = request.environ['context']
transfer_accepts = self.central_api.get_zone_transfer_accept(context, transfer_accept_id)
LOG.info('Retrieved %(tran... | the_stack_v2_python_sparse | designate/api/v2/controllers/zones/tasks/transfer_accepts.py | openstack/designate | train | 156 | |
4c60bb1677a5ac5a61022814e06d6496222ff4ed | [
"values, outdict = BaseWidget.process_form(self, instance=instance, field=field, form=form, empty_marker=empty_marker, emptyReturnsMarker=emptyReturnsMarker)\nfor index in range(len(values)):\n item = values[index]\n min_panic = self._get_spec_value(form, item['uid'], 'minpanic')\n max_panic = self._get_sp... | <|body_start_0|>
values, outdict = BaseWidget.process_form(self, instance=instance, field=field, form=form, empty_marker=empty_marker, emptyReturnsMarker=emptyReturnsMarker)
for index in range(len(values)):
item = values[index]
min_panic = self._get_spec_value(form, item['uid'], ... | AnalysisSpecificationWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnalysisSpecificationWidget:
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False):
"""Return a list of dictionaries fit for AnalysisSpecsResultsField consumption. If neither hidemin nor hidemax are specified, only services which have float()able entr... | stack_v2_sparse_classes_10k_train_008124 | 2,735 | no_license | [
{
"docstring": "Return a list of dictionaries fit for AnalysisSpecsResultsField consumption. If neither hidemin nor hidemax are specified, only services which have float()able entries in result,min and max field will be included. If hidemin and/or hidemax specified, results might contain empty min and/or max fi... | 2 | stack_v2_sparse_classes_30k_train_006571 | Implement the Python class `AnalysisSpecificationWidget` described below.
Class description:
Implement the AnalysisSpecificationWidget class.
Method signatures and docstrings:
- def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): Return a list of dictionaries fit for AnalysisSp... | Implement the Python class `AnalysisSpecificationWidget` described below.
Class description:
Implement the AnalysisSpecificationWidget class.
Method signatures and docstrings:
- def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): Return a list of dictionaries fit for AnalysisSp... | 683e87144bdca23c8b5b21161797773b5e694b90 | <|skeleton|>
class AnalysisSpecificationWidget:
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False):
"""Return a list of dictionaries fit for AnalysisSpecsResultsField consumption. If neither hidemin nor hidemax are specified, only services which have float()able entr... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AnalysisSpecificationWidget:
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False):
"""Return a list of dictionaries fit for AnalysisSpecsResultsField consumption. If neither hidemin nor hidemax are specified, only services which have float()able entries in result,... | the_stack_v2_python_sparse | bhp/lims/browser/widgets/analysisspecificationwidget.py | tdiphale/bhp.lims-1 | train | 1 | |
b932836f42c61dde39fe505bbc6fc31315d1eb03 | [
"Parameter.checkClass(alterRegressor, AbstractPredictor)\nParameter.checkClass(egoRegressor, AbstractPredictor)\nself.alterRegressor = alterRegressor\nself.egoRegressor = egoRegressor\nself.windowSize = windowSize",
"Parameter.checkInt(self.windowSize, 1, graph.getNumVertices())\nself.graph = graph\nlogging.info(... | <|body_start_0|>
Parameter.checkClass(alterRegressor, AbstractPredictor)
Parameter.checkClass(egoRegressor, AbstractPredictor)
self.alterRegressor = alterRegressor
self.egoRegressor = egoRegressor
self.windowSize = windowSize
<|end_body_0|>
<|body_start_1|>
Parameter.che... | A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent. | EgoEdgePredictor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EgoEdgePredictor:
"""A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent."""
def __init__(self, alterRegressor, egoRegressor, windowSize):
"""The alterRegressor must be a primal method, since the number of alters ... | stack_v2_sparse_classes_10k_train_008125 | 4,152 | no_license | [
{
"docstring": "The alterRegressor must be a primal method, since the number of alters for each ego vary, and hence the dual vectors are not constant in size.",
"name": "__init__",
"signature": "def __init__(self, alterRegressor, egoRegressor, windowSize)"
},
{
"docstring": "Learn a prediction m... | 3 | stack_v2_sparse_classes_30k_train_005167 | Implement the Python class `EgoEdgePredictor` described below.
Class description:
A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent.
Method signatures and docstrings:
- def __init__(self, alterRegressor, egoRegressor, windowSize): The alterRegre... | Implement the Python class `EgoEdgePredictor` described below.
Class description:
A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent.
Method signatures and docstrings:
- def __init__(self, alterRegressor, egoRegressor, windowSize): The alterRegre... | 1703510cbb51ec6df0efe1de850cd48ef7004b00 | <|skeleton|>
class EgoEdgePredictor:
"""A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent."""
def __init__(self, alterRegressor, egoRegressor, windowSize):
"""The alterRegressor must be a primal method, since the number of alters ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EgoEdgePredictor:
"""A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent."""
def __init__(self, alterRegressor, egoRegressor, windowSize):
"""The alterRegressor must be a primal method, since the number of alters for each ego ... | the_stack_v2_python_sparse | exp/sandbox/predictors/edge/EgoEdgePredictor.py | malcolmreynolds/APGL | train | 0 |
92a1915fa2859bf57ef59813821caedd96bfdbaa | [
"if not nums:\n return False\ncount = {}\nfor i in nums:\n count[i] = count.get(i, 0) + 1\n if count.get(i, 0) > 1:\n return True\nreturn False",
"if not nums:\n return False\nnums.sort()\ni = 1\nwhile i < len(nums):\n if nums[i] == nums[i - 1]:\n return True\n i += 1\nreturn False... | <|body_start_0|>
if not nums:
return False
count = {}
for i in nums:
count[i] = count.get(i, 0) + 1
if count.get(i, 0) > 1:
return True
return False
<|end_body_0|>
<|body_start_1|>
if not nums:
return False
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
"""统计"""
<|body_0|>
def containsDuplicate1(self, nums: List[int]) -> bool:
"""指针"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return False
count = {}... | stack_v2_sparse_classes_10k_train_008126 | 1,003 | no_license | [
{
"docstring": "统计",
"name": "containsDuplicate",
"signature": "def containsDuplicate(self, nums: List[int]) -> bool"
},
{
"docstring": "指针",
"name": "containsDuplicate1",
"signature": "def containsDuplicate1(self, nums: List[int]) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsDuplicate(self, nums: List[int]) -> bool: 统计
- def containsDuplicate1(self, nums: List[int]) -> bool: 指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsDuplicate(self, nums: List[int]) -> bool: 统计
- def containsDuplicate1(self, nums: List[int]) -> bool: 指针
<|skeleton|>
class Solution:
def containsDuplicate(self... | 069bb0b751ef7f469036b9897436eb5d138ffa24 | <|skeleton|>
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
"""统计"""
<|body_0|>
def containsDuplicate1(self, nums: List[int]) -> bool:
"""指针"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
"""统计"""
if not nums:
return False
count = {}
for i in nums:
count[i] = count.get(i, 0) + 1
if count.get(i, 0) > 1:
return True
return False
def cont... | the_stack_v2_python_sparse | 算法/Week_03/217. 存在重复元素.py | RichieSong/algorithm | train | 0 | |
eec3ca61ec5b63365ec6b5aaa6c2654bf9720904 | [
"super(EmbeddingCardSuperNet, self).__init__()\nself.cardinality_options = cardinality_options\nself.num_card_options = len(self.cardinality_options)\nself.dim = dim\nself.params_options = nn.Parameter(torch.Tensor([self.dim * curr_card for curr_card in self.cardinality_options]), requires_grad=False)\nself.num_emb... | <|body_start_0|>
super(EmbeddingCardSuperNet, self).__init__()
self.cardinality_options = cardinality_options
self.num_card_options = len(self.cardinality_options)
self.dim = dim
self.params_options = nn.Parameter(torch.Tensor([self.dim * curr_card for curr_card in self.cardinali... | EmbeddingCardSuperNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmbeddingCardSuperNet:
def __init__(self, cardinality_options, dim):
"""Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be m... | stack_v2_sparse_classes_10k_train_008127 | 6,458 | permissive | [
{
"docstring": "Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be mapped to the same values. Further, because we will typically be choosing between... | 5 | stack_v2_sparse_classes_30k_train_004307 | Implement the Python class `EmbeddingCardSuperNet` described below.
Class description:
Implement the EmbeddingCardSuperNet class.
Method signatures and docstrings:
- def __init__(self, cardinality_options, dim): Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the... | Implement the Python class `EmbeddingCardSuperNet` described below.
Class description:
Implement the EmbeddingCardSuperNet class.
Method signatures and docstrings:
- def __init__(self, cardinality_options, dim): Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the... | 39aa5b13d66a3899350cb4e53d87a8cd3c5c198f | <|skeleton|>
class EmbeddingCardSuperNet:
def __init__(self, cardinality_options, dim):
"""Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be m... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EmbeddingCardSuperNet:
def __init__(self, cardinality_options, dim):
"""Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be mapped to the s... | the_stack_v2_python_sparse | nas_embedding_card.py | ravikucb/dnas | train | 6 | |
d2abf2917cd8a309a4efa97f6ad5f567c85647cb | [
"self.fqdn = fqdn\nself.guid = guid\nself.id = id\nself.name = name\nself.owner_id = owner_id\nself.status = status\nself.total_size_bytes = total_size_bytes",
"if dictionary is None:\n return None\nfqdn = dictionary.get('fqdn')\nguid = dictionary.get('guid')\nid = dictionary.get('id')\nname = dictionary.get('... | <|body_start_0|>
self.fqdn = fqdn
self.guid = guid
self.id = id
self.name = name
self.owner_id = owner_id
self.status = status
self.total_size_bytes = total_size_bytes
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
... | Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (string): Specifies the Guid of the Exchange Application S... | DagApplicationServerInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DagApplicationServerInfo:
"""Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (strin... | stack_v2_sparse_classes_10k_train_008128 | 3,773 | permissive | [
{
"docstring": "Constructor for the DagApplicationServerInfo class",
"name": "__init__",
"signature": "def __init__(self, fqdn=None, guid=None, id=None, name=None, owner_id=None, status=None, total_size_bytes=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dic... | 2 | stack_v2_sparse_classes_30k_train_006530 | Implement the Python class `DagApplicationServerInfo` described below.
Class description:
Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain n... | Implement the Python class `DagApplicationServerInfo` described below.
Class description:
Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain n... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class DagApplicationServerInfo:
"""Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (strin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DagApplicationServerInfo:
"""Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (string): Specifies... | the_stack_v2_python_sparse | cohesity_management_sdk/models/dag_application_server_info.py | cohesity/management-sdk-python | train | 24 |
13a2825e1dba546a69beb6a2cda328345ef71920 | [
"n = len(nums)\nif n * k == 0:\n return []\nreturn [max(nums[i:i + k]) for i in range(n - k + 1)]",
"size = len(nums)\nif size * k == 0:\n return []\nif size == 1:\n return nums\nqueue, output, max_idx = (deque(), [], 0)\n\ndef clean_up(index: int):\n if queue and queue[0] == index - k:\n queue... | <|body_start_0|>
n = len(nums)
if n * k == 0:
return []
return [max(nums[i:i + k]) for i in range(n - k + 1)]
<|end_body_0|>
<|body_start_1|>
size = len(nums)
if size * k == 0:
return []
if size == 1:
return nums
queue, output,... | SlidingWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlidingWindow:
def get_max_in_window__(self, nums: List[int], k: int) -> List[int]:
"""Approach: Brute Force Time Complexity: O(NK) Space Complexity: O(N - k + 1) :param nums: :return:"""
<|body_0|>
def get_max_in_window_(self, nums: List[int], k: int) -> List[int]:
... | stack_v2_sparse_classes_10k_train_008129 | 2,981 | no_license | [
{
"docstring": "Approach: Brute Force Time Complexity: O(NK) Space Complexity: O(N - k + 1) :param nums: :return:",
"name": "get_max_in_window__",
"signature": "def get_max_in_window__(self, nums: List[int], k: int) -> List[int]"
},
{
"docstring": "Approach: Using Deque Time Complexity: O(N) Spa... | 3 | null | Implement the Python class `SlidingWindow` described below.
Class description:
Implement the SlidingWindow class.
Method signatures and docstrings:
- def get_max_in_window__(self, nums: List[int], k: int) -> List[int]: Approach: Brute Force Time Complexity: O(NK) Space Complexity: O(N - k + 1) :param nums: :return:
-... | Implement the Python class `SlidingWindow` described below.
Class description:
Implement the SlidingWindow class.
Method signatures and docstrings:
- def get_max_in_window__(self, nums: List[int], k: int) -> List[int]: Approach: Brute Force Time Complexity: O(NK) Space Complexity: O(N - k + 1) :param nums: :return:
-... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class SlidingWindow:
def get_max_in_window__(self, nums: List[int], k: int) -> List[int]:
"""Approach: Brute Force Time Complexity: O(NK) Space Complexity: O(N - k + 1) :param nums: :return:"""
<|body_0|>
def get_max_in_window_(self, nums: List[int], k: int) -> List[int]:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SlidingWindow:
def get_max_in_window__(self, nums: List[int], k: int) -> List[int]:
"""Approach: Brute Force Time Complexity: O(NK) Space Complexity: O(N - k + 1) :param nums: :return:"""
n = len(nums)
if n * k == 0:
return []
return [max(nums[i:i + k]) for i in ran... | the_stack_v2_python_sparse | revisited/arrays/sliding_window.py | Shiv2157k/leet_code | train | 1 | |
e4486b57c2cf1394aa0d4a34b3d1f12b0f7b50b5 | [
"np.random.seed(rand_seed)\nself.w = {}\nself.b = {}\nself.z = {}\nself.a = {}\nself.dimensions = dimensions\nself.activation_funcs = activation_funcs\nself.loss_func = loss_func\nself.rand_seed = rand_seed\nself.num_layers = len(dimensions) - 1\nfor i in range(self.num_layers):\n self.w[i + 1] = np.random.randn... | <|body_start_0|>
np.random.seed(rand_seed)
self.w = {}
self.b = {}
self.z = {}
self.a = {}
self.dimensions = dimensions
self.activation_funcs = activation_funcs
self.loss_func = loss_func
self.rand_seed = rand_seed
self.num_layers = len(dim... | NN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NN:
def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None):
"""Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number ... | stack_v2_sparse_classes_10k_train_008130 | 6,305 | no_license | [
{
"docstring": "Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number of rows and columns for the W at layer i+1. dimensions[0] is the dimension of the data. dime... | 5 | stack_v2_sparse_classes_30k_train_005264 | Implement the Python class `NN` described below.
Class description:
Implement the NN class.
Method signatures and docstrings:
- def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. ... | Implement the Python class `NN` described below.
Class description:
Implement the NN class.
Method signatures and docstrings:
- def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None): Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. ... | ae4f9d5708fb5d732ec66b98ae600c20f32ccd04 | <|skeleton|>
class NN:
def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None):
"""Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NN:
def __init__(self, dimensions, activation_funcs, loss_func, rand_seed=None):
"""Specify a L layer feedforward network. Design consideration: we don't include data in this neural network class. dimensions: list of L+1 integers , with dimensions[i+1] and dimensions[i] being the number of rows and co... | the_stack_v2_python_sparse | project_3/nn_released/src/problem2.py | 7e11/CSE-326 | train | 1 | |
e9a89339d188544f0e198c1ed82ad35310706633 | [
"if not head:\n return head\nroot = head\nlast = None\nwhile root:\n if root.val >= x:\n break\n last = root\n root = root.next\nflag = True\nif not last:\n last = ListNode(1)\n last.next = root\n head = last\n flag = False\nif not root:\n return head\nfast = root.next\nwhile fast:... | <|body_start_0|>
if not head:
return head
root = head
last = None
while root:
if root.val >= x:
break
last = root
root = root.next
flag = True
if not last:
last = ListNode(1)
last.next... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_0|>
def partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not h... | stack_v2_sparse_classes_10k_train_008131 | 2,870 | permissive | [
{
"docstring": ":type head: ListNode :type x: int :rtype: ListNode",
"name": "_partition",
"signature": "def _partition(self, head, x)"
},
{
"docstring": ":type head: ListNode :type x: int :rtype: ListNode",
"name": "partition",
"signature": "def partition(self, head, x)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
- def partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
- def partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
<|skeleton|>... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_0|>
def partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
if not head:
return head
root = head
last = None
while root:
if root.val >= x:
break
last = root
root = root... | the_stack_v2_python_sparse | 86.partition-list.py | windard/leeeeee | train | 0 | |
4a0521e733d7580ef3eba6519f3e26a369b68637 | [
"super().__init__()\nself.pooling = pooling\nself.spherical_cheb_bn = SphericalChebBN(in_channels, out_channels, lap, kernel_size)",
"x = self.pooling(x)\nx = self.spherical_cheb_bn(x)\nreturn x"
] | <|body_start_0|>
super().__init__()
self.pooling = pooling
self.spherical_cheb_bn = SphericalChebBN(in_channels, out_channels, lap, kernel_size)
<|end_body_0|>
<|body_start_1|>
x = self.pooling(x)
x = self.spherical_cheb_bn(x)
return x
<|end_body_1|>
| Building Block with a pooling/unpooling, a calling the SphericalChebBN block. | SphericalChebBNPool | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SphericalChebBNPool:
"""Building Block with a pooling/unpooling, a calling the SphericalChebBN block."""
def __init__(self, in_channels, out_channels, lap, pooling, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number... | stack_v2_sparse_classes_10k_train_008132 | 41,403 | no_license | [
{
"docstring": "Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of channels. lap (:obj:`torch.sparse.FloatTensor`): laplacian. pooling (:obj:`torch.nn.Module`): pooling/unpooling module. kernel_size (int, optional): polynomial degree. Defaults to 3.",
"... | 2 | null | Implement the Python class `SphericalChebBNPool` described below.
Class description:
Building Block with a pooling/unpooling, a calling the SphericalChebBN block.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, lap, pooling, kernel_size): Initialization. Args: in_channels (int): init... | Implement the Python class `SphericalChebBNPool` described below.
Class description:
Building Block with a pooling/unpooling, a calling the SphericalChebBN block.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, lap, pooling, kernel_size): Initialization. Args: in_channels (int): init... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SphericalChebBNPool:
"""Building Block with a pooling/unpooling, a calling the SphericalChebBN block."""
def __init__(self, in_channels, out_channels, lap, pooling, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SphericalChebBNPool:
"""Building Block with a pooling/unpooling, a calling the SphericalChebBN block."""
def __init__(self, in_channels, out_channels, lap, pooling, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. out_channels (int): output number of channels.... | the_stack_v2_python_sparse | generated/test_deepsphere_deepsphere_pytorch.py | jansel/pytorch-jit-paritybench | train | 35 |
a7e187abfd5943af19f545145d7b31c2ef09db95 | [
"if not value:\n return None\nreturn ''.join([f'{int(i):02x}' for i in value.split(':')])",
"if not value:\n return None\nvalue = value.lstrip('#')\nreturn ':'.join([str(int(value[i:i + 2], 16)) for i in range(0, len(value) - 1, 2)])"
] | <|body_start_0|>
if not value:
return None
return ''.join([f'{int(i):02x}' for i in value.split(':')])
<|end_body_0|>
<|body_start_1|>
if not value:
return None
value = value.lstrip('#')
return ':'.join([str(int(value[i:i + 2], 16)) for i in range(0, len(... | Utility field class for color values. | ColorField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ColorField:
"""Utility field class for color values."""
def _serialize(self, value: str, *_, **__):
"""Convert a hex native color value (``ff0000``) to the format exposed by the SwitchBot API (``255:0:0``)."""
<|body_0|>
def _deserialize(self, value: str, *_, **__):
... | stack_v2_sparse_classes_10k_train_008133 | 8,416 | permissive | [
{
"docstring": "Convert a hex native color value (``ff0000``) to the format exposed by the SwitchBot API (``255:0:0``).",
"name": "_serialize",
"signature": "def _serialize(self, value: str, *_, **__)"
},
{
"docstring": "Convert a SwitchBot API color value (``255:0:0``) to the hex native format ... | 2 | null | Implement the Python class `ColorField` described below.
Class description:
Utility field class for color values.
Method signatures and docstrings:
- def _serialize(self, value: str, *_, **__): Convert a hex native color value (``ff0000``) to the format exposed by the SwitchBot API (``255:0:0``).
- def _deserialize(s... | Implement the Python class `ColorField` described below.
Class description:
Utility field class for color values.
Method signatures and docstrings:
- def _serialize(self, value: str, *_, **__): Convert a hex native color value (``ff0000``) to the format exposed by the SwitchBot API (``255:0:0``).
- def _deserialize(s... | 446bc2f67493d3554c5422242ff91d5b5c76d78a | <|skeleton|>
class ColorField:
"""Utility field class for color values."""
def _serialize(self, value: str, *_, **__):
"""Convert a hex native color value (``ff0000``) to the format exposed by the SwitchBot API (``255:0:0``)."""
<|body_0|>
def _deserialize(self, value: str, *_, **__):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ColorField:
"""Utility field class for color values."""
def _serialize(self, value: str, *_, **__):
"""Convert a hex native color value (``ff0000``) to the format exposed by the SwitchBot API (``255:0:0``)."""
if not value:
return None
return ''.join([f'{int(i):02x}' f... | the_stack_v2_python_sparse | platypush/schemas/switchbot.py | BlackLight/platypush | train | 265 |
627d36c735d93da8c56ff51b2646df9bf1a8d284 | [
"super().__init__(coordinator)\nself.entity_description = description\nself._attr_name = f'{name} {description.name}'\nself._attr_unique_id = f'{station_id}_{description.key}'\nself.station_id = f'{station_id}'\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, station_id... | <|body_start_0|>
super().__init__(coordinator)
self.entity_description = description
self._attr_name = f'{name} {description.name}'
self._attr_unique_id = f'{station_id}_{description.key}'
self.station_id = f'{station_id}'
self._attr_device_info = DeviceInfo(entry_type=De... | Implementation of a ZAMG sensor. | ZamgSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZamgSensor:
"""Implementation of a ZAMG sensor."""
def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None:
"""Initialize the sensor."""
<|body_0|>
def native_value(self) -> StateType:
... | stack_v2_sparse_classes_10k_train_008134 | 7,261 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None"
},
{
"docstring": "Return the state of the sensor.",
"name": "native_value",
... | 3 | stack_v2_sparse_classes_30k_train_003137 | Implement the Python class `ZamgSensor` described below.
Class description:
Implementation of a ZAMG sensor.
Method signatures and docstrings:
- def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: Initialize the sensor.
- def native... | Implement the Python class `ZamgSensor` described below.
Class description:
Implementation of a ZAMG sensor.
Method signatures and docstrings:
- def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: Initialize the sensor.
- def native... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ZamgSensor:
"""Implementation of a ZAMG sensor."""
def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None:
"""Initialize the sensor."""
<|body_0|>
def native_value(self) -> StateType:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ZamgSensor:
"""Implementation of a ZAMG sensor."""
def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self.entity_description = descrip... | the_stack_v2_python_sparse | homeassistant/components/zamg/sensor.py | home-assistant/core | train | 35,501 |
1edfff648a58740f3bd71f485105cad2d5d84656 | [
"ConfigParameters.__init__(self)\nself._name = 'PSConfigParameters'\nself.declareBaseParameters()\nif __name__ == '__main__':\n self.fname_cp = './confpars-def.txt'\n self.readParametersFromFile()",
"self.list_of_sources = None\nself.instr_dir = self.declareParameter(name='INSTRUMENT_DIR', val_def='/cds/dat... | <|body_start_0|>
ConfigParameters.__init__(self)
self._name = 'PSConfigParameters'
self.declareBaseParameters()
if __name__ == '__main__':
self.fname_cp = './confpars-def.txt'
self.readParametersFromFile()
<|end_body_0|>
<|body_start_1|>
self.list_of_sour... | A storage of configuration parameters for Experiment Monitor (EM) project. | PSConfigParameters | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PSConfigParameters:
"""A storage of configuration parameters for Experiment Monitor (EM) project."""
def __init__(self, fname=None):
"""fname: str - the file name with configuration parameters, if not specified then use default."""
<|body_0|>
def declareBaseParameters(se... | stack_v2_sparse_classes_10k_train_008135 | 4,203 | permissive | [
{
"docstring": "fname: str - the file name with configuration parameters, if not specified then use default.",
"name": "__init__",
"signature": "def __init__(self, fname=None)"
},
{
"docstring": "Declaration of common paramaters for all PS apps",
"name": "declareBaseParameters",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_002291 | Implement the Python class `PSConfigParameters` described below.
Class description:
A storage of configuration parameters for Experiment Monitor (EM) project.
Method signatures and docstrings:
- def __init__(self, fname=None): fname: str - the file name with configuration parameters, if not specified then use default... | Implement the Python class `PSConfigParameters` described below.
Class description:
A storage of configuration parameters for Experiment Monitor (EM) project.
Method signatures and docstrings:
- def __init__(self, fname=None): fname: str - the file name with configuration parameters, if not specified then use default... | 7f0401960ceb46551fd926d932c59e96297df6b0 | <|skeleton|>
class PSConfigParameters:
"""A storage of configuration parameters for Experiment Monitor (EM) project."""
def __init__(self, fname=None):
"""fname: str - the file name with configuration parameters, if not specified then use default."""
<|body_0|>
def declareBaseParameters(se... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PSConfigParameters:
"""A storage of configuration parameters for Experiment Monitor (EM) project."""
def __init__(self, fname=None):
"""fname: str - the file name with configuration parameters, if not specified then use default."""
ConfigParameters.__init__(self)
self._name = 'PSC... | the_stack_v2_python_sparse | psana/psana/pyalgos/generic/PSConfigParameters.py | slac-lcls/lcls2 | train | 19 |
3680180c2f9d28eebc97adff1839225e53860b88 | [
"self.backup_all_existing_snapshot = backup_all_existing_snapshot\nself.blacklisted_ip_addrs = blacklisted_ip_addrs\nself.continue_on_error = continue_on_error\nself.encryption_enabled = encryption_enabled\nself.filtering_policy = filtering_policy\nself.fld_config = fld_config\nself.full_backup_snapshot_label = ful... | <|body_start_0|>
self.backup_all_existing_snapshot = backup_all_existing_snapshot
self.blacklisted_ip_addrs = blacklisted_ip_addrs
self.continue_on_error = continue_on_error
self.encryption_enabled = encryption_enabled
self.filtering_policy = filtering_policy
self.fld_con... | Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_label and incremental_backup_snapshot_label. Wh... | NasBackupParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_labe... | stack_v2_sparse_classes_10k_train_008136 | 10,003 | permissive | [
{
"docstring": "Constructor for the NasBackupParams class",
"name": "__init__",
"signature": "def __init__(self, backup_all_existing_snapshot=None, blacklisted_ip_addrs=None, continue_on_error=None, encryption_enabled=None, filtering_policy=None, fld_config=None, full_backup_snapshot_label=None, increme... | 2 | stack_v2_sparse_classes_30k_train_000718 | Implement the Python class `NasBackupParams` described below.
Class description:
Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn... | Implement the Python class `NasBackupParams` described below.
Class description:
Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_labe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_label and increme... | the_stack_v2_python_sparse | cohesity_management_sdk/models/nas_backup_params.py | cohesity/management-sdk-python | train | 24 |
214e90c5bfcf485e18e13c001f8e9e2889072097 | [
"self.encd = encd\nself.no_inner_groups = no_inner_groups\nself.istring_hook = istring_hook\nif not ifile:\n self.re_list = [DEFAULT_RE]\nelse:\n self.re_list = self.__load(ifile, encd=self.encd)",
"output = []\ngroups = ()\nfor re in self.re_list:\n for match in re.finditer(istring):\n groups = m... | <|body_start_0|>
self.encd = encd
self.no_inner_groups = no_inner_groups
self.istring_hook = istring_hook
if not ifile:
self.re_list = [DEFAULT_RE]
else:
self.re_list = self.__load(ifile, encd=self.encd)
<|end_body_0|>
<|body_start_1|>
output = []... | Container class used to hold multiple compiled regexps. | MultiRegExp | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiRegExp:
"""Container class used to hold multiple compiled regexps."""
def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]):
"""Load regular expressions from text file. Read input file passed as argument and convert lines contained... | stack_v2_sparse_classes_10k_train_008137 | 6,533 | permissive | [
{
"docstring": "Load regular expressions from text file. Read input file passed as argument and convert lines contained there to a RegExp union, i.e. regexps separated by | (OR). If istring_hook is supplied, it should be a function called for every input line except for lines with compiler directives. Return va... | 5 | stack_v2_sparse_classes_30k_train_000499 | Implement the Python class `MultiRegExp` described below.
Class description:
Container class used to hold multiple compiled regexps.
Method signatures and docstrings:
- def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): Load regular expressions from text file. Read ... | Implement the Python class `MultiRegExp` described below.
Class description:
Container class used to hold multiple compiled regexps.
Method signatures and docstrings:
- def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): Load regular expressions from text file. Read ... | ac645fb41260b86491b17fbc50e5ea3300dc28b7 | <|skeleton|>
class MultiRegExp:
"""Container class used to hold multiple compiled regexps."""
def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]):
"""Load regular expressions from text file. Read input file passed as argument and convert lines contained... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiRegExp:
"""Container class used to hold multiple compiled regexps."""
def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]):
"""Load regular expressions from text file. Read input file passed as argument and convert lines contained there to a R... | the_stack_v2_python_sparse | scripts/lib/python/ld/lingre/lre.py | WladimirSidorenko/TextNormalization | train | 1 |
126d341993bc3f850329d2912ae2dc87a6a2e51e | [
"super(GetWordInfo, self).__init__()\nself.text = text\nself.freq = 0.0\nself.left = []\nself.right = []\nself.pmi = 0",
"self.freq += 1\nif left:\n self.left.append(left)\nif right:\n self.right.append(right)",
"self.freq /= length\nself.left = cal_infor_entropy(self.left)\nself.right = cal_infor_entropy... | <|body_start_0|>
super(GetWordInfo, self).__init__()
self.text = text
self.freq = 0.0
self.left = []
self.right = []
self.pmi = 0
<|end_body_0|>
<|body_start_1|>
self.freq += 1
if left:
self.left.append(left)
if right:
self... | Store information of each word, including it's frequency, left neighbors and right neighbors | GetWordInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetWordInfo:
"""Store information of each word, including it's frequency, left neighbors and right neighbors"""
def __init__(self, text):
"""init function,the text is the word. :param text:the string will be compute,include fre,PMI,information entropy."""
<|body_0|>
def ... | stack_v2_sparse_classes_10k_train_008138 | 6,102 | no_license | [
{
"docstring": "init function,the text is the word. :param text:the string will be compute,include fre,PMI,information entropy.",
"name": "__init__",
"signature": "def __init__(self, text)"
},
{
"docstring": "Increase frequency of this word, then append left/right neighbors. :param left: left ne... | 4 | stack_v2_sparse_classes_30k_train_003924 | Implement the Python class `GetWordInfo` described below.
Class description:
Store information of each word, including it's frequency, left neighbors and right neighbors
Method signatures and docstrings:
- def __init__(self, text): init function,the text is the word. :param text:the string will be compute,include fre... | Implement the Python class `GetWordInfo` described below.
Class description:
Store information of each word, including it's frequency, left neighbors and right neighbors
Method signatures and docstrings:
- def __init__(self, text): init function,the text is the word. :param text:the string will be compute,include fre... | a5ff7ad6c94c1fbb633d7321fd1a27f849ce6fb8 | <|skeleton|>
class GetWordInfo:
"""Store information of each word, including it's frequency, left neighbors and right neighbors"""
def __init__(self, text):
"""init function,the text is the word. :param text:the string will be compute,include fre,PMI,information entropy."""
<|body_0|>
def ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GetWordInfo:
"""Store information of each word, including it's frequency, left neighbors and right neighbors"""
def __init__(self, text):
"""init function,the text is the word. :param text:the string will be compute,include fre,PMI,information entropy."""
super(GetWordInfo, self).__init__... | the_stack_v2_python_sparse | word_seg_md/newWordsFind.py | GenjiLuo/the-neologism | train | 0 |
193a89d30b0d2d193242d752e05a660769faddf0 | [
"super().__init__(NAME)\nif language_model is None:\n self.language_model = seq2seq.Gru()\nelse:\n self.language_model = language_model\nself.scaling_ghi = preprocessing.min_max_scaling_ghi()\nself.flatten = layers.Flatten()\nself.max_pool = layers.MaxPooling3D((1, 2, 2))\nself.conv1 = layers.Conv3D(64, kerne... | <|body_start_0|>
super().__init__(NAME)
if language_model is None:
self.language_model = seq2seq.Gru()
else:
self.language_model = language_model
self.scaling_ghi = preprocessing.min_max_scaling_ghi()
self.flatten = layers.Flatten()
self.max_pool =... | Create Conv3D model to be used with the language model. Generated futur images are used instead of past image. | Conv3D | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv3D:
"""Create Conv3D model to be used with the language model. Generated futur images are used instead of past image."""
def __init__(self, language_model: seq2seq.Seq2Seq=None):
"""Initialize the architecture."""
<|body_0|>
def call(self, data: Tuple[tf.Tensor, tf.T... | stack_v2_sparse_classes_10k_train_008139 | 3,337 | no_license | [
{
"docstring": "Initialize the architecture.",
"name": "__init__",
"signature": "def __init__(self, language_model: seq2seq.Seq2Seq=None)"
},
{
"docstring": "Performs the forward pass in the neural network.",
"name": "call",
"signature": "def call(self, data: Tuple[tf.Tensor, tf.Tensor],... | 4 | stack_v2_sparse_classes_30k_train_004511 | Implement the Python class `Conv3D` described below.
Class description:
Create Conv3D model to be used with the language model. Generated futur images are used instead of past image.
Method signatures and docstrings:
- def __init__(self, language_model: seq2seq.Seq2Seq=None): Initialize the architecture.
- def call(s... | Implement the Python class `Conv3D` described below.
Class description:
Create Conv3D model to be used with the language model. Generated futur images are used instead of past image.
Method signatures and docstrings:
- def __init__(self, language_model: seq2seq.Seq2Seq=None): Initialize the architecture.
- def call(s... | b20d809bff84bb508190be8540a815fb9b8b3f8b | <|skeleton|>
class Conv3D:
"""Create Conv3D model to be used with the language model. Generated futur images are used instead of past image."""
def __init__(self, language_model: seq2seq.Seq2Seq=None):
"""Initialize the architecture."""
<|body_0|>
def call(self, data: Tuple[tf.Tensor, tf.T... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Conv3D:
"""Create Conv3D model to be used with the language model. Generated futur images are used instead of past image."""
def __init__(self, language_model: seq2seq.Seq2Seq=None):
"""Initialize the architecture."""
super().__init__(NAME)
if language_model is None:
s... | the_stack_v2_python_sparse | src/model/conv3d_lm.py | nathanielsimard/Solar-Irradiance-Prediction | train | 0 |
f5f9f58b9367a51e363dcd0b4dd2b63359ce6d1d | [
"self.ad_guid_pairs = ad_guid_pairs\nself.exclude_ldap_properties = exclude_ldap_properties\nself.ldap_properties = ldap_properties\nself.merge_multi_val_properties = merge_multi_val_properties",
"if dictionary is None:\n return None\nad_guid_pairs = None\nif dictionary.get('adGuidPairs') != None:\n ad_guid... | <|body_start_0|>
self.ad_guid_pairs = ad_guid_pairs
self.exclude_ldap_properties = exclude_ldap_properties
self.ldap_properties = ldap_properties
self.merge_multi_val_properties = merge_multi_val_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
retur... | Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid pairs to restore attributes. exclude_ldap_properties (li... | AdObjectAttributeParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdObjectAttributeParameters:
"""Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid p... | stack_v2_sparse_classes_10k_train_008140 | 4,187 | permissive | [
{
"docstring": "Constructor for the AdObjectAttributeParameters class",
"name": "__init__",
"signature": "def __init__(self, ad_guid_pairs=None, exclude_ldap_properties=None, ldap_properties=None, merge_multi_val_properties=None)"
},
{
"docstring": "Creates an instance of this model from a dicti... | 2 | null | Implement the Python class `AdObjectAttributeParameters` described below.
Class description:
Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array ... | Implement the Python class `AdObjectAttributeParameters` described below.
Class description:
Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class AdObjectAttributeParameters:
"""Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AdObjectAttributeParameters:
"""Implementation of the 'AdObjectAttributeParameters' model. AdObjectAttributeParameters are AD attribute recovery parameters for one or more AD objects Attributes: ad_guid_pairs (list of RestoreAdGuidPair): Specifies the array of source and destination object guid pairs to resto... | the_stack_v2_python_sparse | cohesity_management_sdk/models/ad_object_attribute_parameters.py | cohesity/management-sdk-python | train | 24 |
e25192bcc4e1f7229d8162c3575ea0a858f245c1 | [
"rows = super(Table, self).rows\nif len(rows) == 1 and self.row_empty.is_present:\n return []\nelse:\n return rows",
"_columns = {}\nfor pos, cell in enumerate(self.header.cells, 1):\n column = cell.get_attribute('innerText').strip()\n if column:\n column = re.sub('[ -]', '_', column).lower()\n... | <|body_start_0|>
rows = super(Table, self).rows
if len(rows) == 1 and self.row_empty.is_present:
return []
else:
return rows
<|end_body_0|>
<|body_start_1|>
_columns = {}
for pos, cell in enumerate(self.header.cells, 1):
column = cell.get_attr... | Custom table. | Table | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
<|body_0|>
def columns(self):
"""Table columns {'name': position}."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
rows = super(Table, self).rows
if len(rows) == 1 and self.row... | stack_v2_sparse_classes_10k_train_008141 | 2,719 | no_license | [
{
"docstring": "Table rows.",
"name": "rows",
"signature": "def rows(self)"
},
{
"docstring": "Table columns {'name': position}.",
"name": "columns",
"signature": "def columns(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003375 | Implement the Python class `Table` described below.
Class description:
Custom table.
Method signatures and docstrings:
- def rows(self): Table rows.
- def columns(self): Table columns {'name': position}. | Implement the Python class `Table` described below.
Class description:
Custom table.
Method signatures and docstrings:
- def rows(self): Table rows.
- def columns(self): Table columns {'name': position}.
<|skeleton|>
class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
<|body_0... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
<|body_0|>
def columns(self):
"""Table columns {'name': position}."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Table:
"""Custom table."""
def rows(self):
"""Table rows."""
rows = super(Table, self).rows
if len(rows) == 1 and self.row_empty.is_present:
return []
else:
return rows
def columns(self):
"""Table columns {'name': position}."""
... | the_stack_v2_python_sparse | stepler/horizon/app/ui/table.py | Mirantis/stepler | train | 16 |
48252c83901333ad3f362942a439badd820c5fcf | [
"super().__init__()\nassert namespace is not None\nassert namespace != ''\nself.namespace = namespace\nself.type_ = type_\nself.variable = variable",
"context.search_namespaces.add(self.namespace)\nif self.type_:\n self.type_.namespace = self.namespace\n lam = self.type_.execute(session, context)\n if la... | <|body_start_0|>
super().__init__()
assert namespace is not None
assert namespace != ''
self.namespace = namespace
self.type_ = type_
self.variable = variable
<|end_body_0|>
<|body_start_1|>
context.search_namespaces.add(self.namespace)
if self.type_:
... | Import | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Import:
def __init__(self, namespace=None, type_=None, variable=None):
"""Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_... | stack_v2_sparse_classes_10k_train_008142 | 3,613 | permissive | [
{
"docstring": "Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_: TypeName :param variable: the variable :type variable: str",
"name": "__init... | 2 | stack_v2_sparse_classes_30k_train_004086 | Implement the Python class `Import` described below.
Class description:
Implement the Import class.
Method signatures and docstrings:
- def __init__(self, namespace=None, type_=None, variable=None): Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variab... | Implement the Python class `Import` described below.
Class description:
Implement the Import class.
Method signatures and docstrings:
- def __init__(self, namespace=None, type_=None, variable=None): Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variab... | ff76e030d7cebdca51c72d5d7e789d90f0e1e565 | <|skeleton|>
class Import:
def __init__(self, namespace=None, type_=None, variable=None):
"""Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Import:
def __init__(self, namespace=None, type_=None, variable=None):
"""Import the namespace, if the variable name is given, the imported type is cloned to the current context with the variable name :param namespace: the namespace :type namespace: str :param type_: the type :type type_: TypeName :pa... | the_stack_v2_python_sparse | norm/executable/namespace.py | xumiao/supernorm | train | 0 | |
e61ae8eef6835a580c4beed41fb29db68dc72cc5 | [
"temp = dict(*args, **kwargs)\nif 'Refs' in temp:\n refs = temp['Refs']\n if not isinstance(refs, DbRefs):\n refs = DbRefs(refs)\nelse:\n refs = DbRefs()\nfor key, val in temp.items():\n if key in KnownDatabases:\n refs[key] = val\n del temp[key]\nDelegator.__init__(self, refs)\nsel... | <|body_start_0|>
temp = dict(*args, **kwargs)
if 'Refs' in temp:
refs = temp['Refs']
if not isinstance(refs, DbRefs):
refs = DbRefs(refs)
else:
refs = DbRefs()
for key, val in temp.items():
if key in KnownDatabases:
... | Dictionary that stores attributes for Sequence objects. Delegates to DbRefs for database IDs. | Info | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Info:
"""Dictionary that stores attributes for Sequence objects. Delegates to DbRefs for database IDs."""
def __init__(self, *args, **kwargs):
"""Returns new Info object. Creates DbRefs if necessary."""
<|body_0|>
def __getattr__(self, attr):
"""Checks for attr i... | stack_v2_sparse_classes_10k_train_008143 | 4,625 | permissive | [
{
"docstring": "Returns new Info object. Creates DbRefs if necessary.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Checks for attr in Refs first.",
"name": "__getattr__",
"signature": "def __getattr__(self, attr)"
},
{
"docstring": "... | 6 | null | Implement the Python class `Info` described below.
Class description:
Dictionary that stores attributes for Sequence objects. Delegates to DbRefs for database IDs.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Returns new Info object. Creates DbRefs if necessary.
- def __getattr__(self, att... | Implement the Python class `Info` described below.
Class description:
Dictionary that stores attributes for Sequence objects. Delegates to DbRefs for database IDs.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Returns new Info object. Creates DbRefs if necessary.
- def __getattr__(self, att... | fe6f8c8dfed86d39c80f2804a753c05bb2e485b4 | <|skeleton|>
class Info:
"""Dictionary that stores attributes for Sequence objects. Delegates to DbRefs for database IDs."""
def __init__(self, *args, **kwargs):
"""Returns new Info object. Creates DbRefs if necessary."""
<|body_0|>
def __getattr__(self, attr):
"""Checks for attr i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Info:
"""Dictionary that stores attributes for Sequence objects. Delegates to DbRefs for database IDs."""
def __init__(self, *args, **kwargs):
"""Returns new Info object. Creates DbRefs if necessary."""
temp = dict(*args, **kwargs)
if 'Refs' in temp:
refs = temp['Refs'... | the_stack_v2_python_sparse | scripts/venv/lib/python2.7/site-packages/cogent/core/info.py | sauloal/cnidaria | train | 3 |
5f1fbb979033a14e2c58e2833ab1d2a1ccccc4aa | [
"inv = self.browse(cr, uid, id, context=context)\nres = super(account_invoice, self)._get_analytic_lines(cr, uid, id)\nfor r in res:\n r.update({'budget_confirm_id': inv.budget_confirm_id.id})\nreturn res",
"res = super(account_invoice, self).line_get_convert(cr, uid, line, part, date, context)\nres.update({'b... | <|body_start_0|>
inv = self.browse(cr, uid, id, context=context)
res = super(account_invoice, self)._get_analytic_lines(cr, uid, id)
for r in res:
r.update({'budget_confirm_id': inv.budget_confirm_id.id})
return res
<|end_body_0|>
<|body_start_1|>
res = super(account... | account_invoice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_invoice:
def _get_analytic_lines(self, cr, uid, id, context=None):
"""Add budget_confirm_id field to result dictionary. @return: dictionary of values to be updated"""
<|body_0|>
def line_get_convert(self, cr, uid, line, part, date, context=None):
"""Add budge... | stack_v2_sparse_classes_10k_train_008144 | 6,435 | no_license | [
{
"docstring": "Add budget_confirm_id field to result dictionary. @return: dictionary of values to be updated",
"name": "_get_analytic_lines",
"signature": "def _get_analytic_lines(self, cr, uid, id, context=None)"
},
{
"docstring": "Add budget_confirm_id field to result dictionary @param part: ... | 2 | null | Implement the Python class `account_invoice` described below.
Class description:
Implement the account_invoice class.
Method signatures and docstrings:
- def _get_analytic_lines(self, cr, uid, id, context=None): Add budget_confirm_id field to result dictionary. @return: dictionary of values to be updated
- def line_g... | Implement the Python class `account_invoice` described below.
Class description:
Implement the account_invoice class.
Method signatures and docstrings:
- def _get_analytic_lines(self, cr, uid, id, context=None): Add budget_confirm_id field to result dictionary. @return: dictionary of values to be updated
- def line_g... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class account_invoice:
def _get_analytic_lines(self, cr, uid, id, context=None):
"""Add budget_confirm_id field to result dictionary. @return: dictionary of values to be updated"""
<|body_0|>
def line_get_convert(self, cr, uid, line, part, date, context=None):
"""Add budge... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class account_invoice:
def _get_analytic_lines(self, cr, uid, id, context=None):
"""Add budget_confirm_id field to result dictionary. @return: dictionary of values to be updated"""
inv = self.browse(cr, uid, id, context=context)
res = super(account_invoice, self)._get_analytic_lines(cr, uid,... | the_stack_v2_python_sparse | v_7/Dongola/common/account_invoice_confirmation/invoice.py | musabahmed/baba | train | 0 | |
a8ea4ac53461d1b523445d32598efb43865af202 | [
"self.min_loss = float('inf')\nself.max_acc = -float('inf')\nself.min_delta = min_delta\nself.model_name = model_name\nself.path = str(os.path.join(model_path, self.model_name + '.pth'))\nself.count = 0\nself.first_run = True\nself.best_model = None",
"print(f'Loss to beat: {self.min_loss - self.min_delta:.4f}')\... | <|body_start_0|>
self.min_loss = float('inf')
self.max_acc = -float('inf')
self.min_delta = min_delta
self.model_name = model_name
self.path = str(os.path.join(model_path, self.model_name + '.pth'))
self.count = 0
self.first_run = True
self.best_model = No... | EarlyStopping | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EarlyStopping:
def __init__(self, model_path: str, model_name: str, fold: int, min_delta=0):
"""Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- TODO Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing... | stack_v2_sparse_classes_10k_train_008145 | 44,407 | permissive | [
{
"docstring": "Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- TODO Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing the current fold. `min_delta` : `int`, `optional` Smallest number the given metric needs to change in o... | 2 | stack_v2_sparse_classes_30k_train_002013 | Implement the Python class `EarlyStopping` described below.
Class description:
Implement the EarlyStopping class.
Method signatures and docstrings:
- def __init__(self, model_path: str, model_name: str, fold: int, min_delta=0): Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---... | Implement the Python class `EarlyStopping` described below.
Class description:
Implement the EarlyStopping class.
Method signatures and docstrings:
- def __init__(self, model_path: str, model_name: str, fold: int, min_delta=0): Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---... | d0ee019e5a573bf9b8e232786a9051cd54904487 | <|skeleton|>
class EarlyStopping:
def __init__(self, model_path: str, model_name: str, fold: int, min_delta=0):
"""Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- TODO Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EarlyStopping:
def __init__(self, model_path: str, model_name: str, fold: int, min_delta=0):
"""Class for early stopping, because only plebs rely on set amounts of epochs. Attributes ---------- TODO Parameters ---------- `model_name` : `str` Model name. `fold` : `int` Number representing the current f... | the_stack_v2_python_sparse | build/lib/pytorch_vision_utils/Utilities.py | nclgbd/PyTorch-Utilities | train | 0 | |
bd39fc9a4057bde8a8fb00b5cf810ba0f1086681 | [
"def cmp(a, b):\n if str(a) > str(b):\n return 1\n return -1\nans = [i for i in range(1, n + 1)]\nans.sort(cmp=cmp)\nprint(ans)\nreturn ans",
"curr = 1\nans = []\nfor _ in range(1, n + 1):\n ans.append(curr)\n if curr * 10 <= n:\n curr *= 10\n elif curr % 10 != 9 and curr + 1 <= n:\n ... | <|body_start_0|>
def cmp(a, b):
if str(a) > str(b):
return 1
return -1
ans = [i for i in range(1, n + 1)]
ans.sort(cmp=cmp)
print(ans)
return ans
<|end_body_0|>
<|body_start_1|>
curr = 1
ans = []
for _ in range(1, n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lexicalOrder(self, n):
""":type n: int :rtype: List[int]"""
<|body_0|>
def lexicalOrder2(self, n):
""":type n: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def cmp(a, b):
if str(a) > str(b):
... | stack_v2_sparse_classes_10k_train_008146 | 1,618 | no_license | [
{
"docstring": ":type n: int :rtype: List[int]",
"name": "lexicalOrder",
"signature": "def lexicalOrder(self, n)"
},
{
"docstring": ":type n: int :rtype: List[int]",
"name": "lexicalOrder2",
"signature": "def lexicalOrder2(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005054 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lexicalOrder(self, n): :type n: int :rtype: List[int]
- def lexicalOrder2(self, n): :type n: int :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lexicalOrder(self, n): :type n: int :rtype: List[int]
- def lexicalOrder2(self, n): :type n: int :rtype: List[int]
<|skeleton|>
class Solution:
def lexicalOrder(self, n... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def lexicalOrder(self, n):
""":type n: int :rtype: List[int]"""
<|body_0|>
def lexicalOrder2(self, n):
""":type n: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lexicalOrder(self, n):
""":type n: int :rtype: List[int]"""
def cmp(a, b):
if str(a) > str(b):
return 1
return -1
ans = [i for i in range(1, n + 1)]
ans.sort(cmp=cmp)
print(ans)
return ans
def lexicalOrd... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00386.Lexicographical Numbers.py | roger6blog/LeetCode | train | 0 | |
255d4f94087b86f574f047e44430680b0291aa2d | [
"super(ReignitionCallback, self).__init__()\nself.priority = 100\nself.desc_copy = None",
"logging.info('Start SPNas Reigniting.')\nself.desc_copy = copy.deepcopy(self.trainer.model_desc)\nbackbone = self.desc_copy.get('backbone')\ncode = backbone.get('code')\nself.trainer.model_desc = dict(type='SerialClassifica... | <|body_start_0|>
super(ReignitionCallback, self).__init__()
self.priority = 100
self.desc_copy = None
<|end_body_0|>
<|body_start_1|>
logging.info('Start SPNas Reigniting.')
self.desc_copy = copy.deepcopy(self.trainer.model_desc)
backbone = self.desc_copy.get('backbone')... | Reignition callback. | ReignitionCallback | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReignitionCallback:
"""Reignition callback."""
def __init__(self):
"""Initialize callback."""
<|body_0|>
def init_trainer(self, logs=None):
"""Be called before train."""
<|body_1|>
def after_epoch(self, epoch, logs=None):
"""Save desc into Fa... | stack_v2_sparse_classes_10k_train_008147 | 1,801 | permissive | [
{
"docstring": "Initialize callback.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Be called before train.",
"name": "init_trainer",
"signature": "def init_trainer(self, logs=None)"
},
{
"docstring": "Save desc into FasterRCNN.",
"name": "after_ep... | 3 | null | Implement the Python class `ReignitionCallback` described below.
Class description:
Reignition callback.
Method signatures and docstrings:
- def __init__(self): Initialize callback.
- def init_trainer(self, logs=None): Be called before train.
- def after_epoch(self, epoch, logs=None): Save desc into FasterRCNN. | Implement the Python class `ReignitionCallback` described below.
Class description:
Reignition callback.
Method signatures and docstrings:
- def __init__(self): Initialize callback.
- def init_trainer(self, logs=None): Be called before train.
- def after_epoch(self, epoch, logs=None): Save desc into FasterRCNN.
<|sk... | 12e37a1991eb6771a2999fe0a46ddda920c47948 | <|skeleton|>
class ReignitionCallback:
"""Reignition callback."""
def __init__(self):
"""Initialize callback."""
<|body_0|>
def init_trainer(self, logs=None):
"""Be called before train."""
<|body_1|>
def after_epoch(self, epoch, logs=None):
"""Save desc into Fa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReignitionCallback:
"""Reignition callback."""
def __init__(self):
"""Initialize callback."""
super(ReignitionCallback, self).__init__()
self.priority = 100
self.desc_copy = None
def init_trainer(self, logs=None):
"""Be called before train."""
logging.... | the_stack_v2_python_sparse | vega/algorithms/nas/sp_nas/reignition.py | huawei-noah/vega | train | 850 |
7f79c63e2ace12c00bd64007466083135eb391c2 | [
"data = {'username': 'python31', 'password': 'lemonban'}\nexpected = {'code': 0, 'msg': '登录成功'}\nres = login_check(**data)\nself.assertEqual(expected, res)",
"data = {'username': 'python31', 'password': 'lemonban111'}\nexpected = {'code': 1, 'msg': '账号或密码不正确'}\nres = login_check(**data)\nself.assertEqual(expected... | <|body_start_0|>
data = {'username': 'python31', 'password': 'lemonban'}
expected = {'code': 0, 'msg': '登录成功'}
res = login_check(**data)
self.assertEqual(expected, res)
<|end_body_0|>
<|body_start_1|>
data = {'username': 'python31', 'password': 'lemonban111'}
expected = ... | 登录的测试用例类 | TestLogin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLogin:
"""登录的测试用例类"""
def test_login_pass(self):
"""登录成功的用例"""
<|body_0|>
def test_login_pwd_error(self):
"""密码错误"""
<|body_1|>
def test_login_pwd_is_none(self):
"""密码为空"""
<|body_2|>
def test_login_user_is_none(self):
... | stack_v2_sparse_classes_10k_train_008148 | 3,469 | no_license | [
{
"docstring": "登录成功的用例",
"name": "test_login_pass",
"signature": "def test_login_pass(self)"
},
{
"docstring": "密码错误",
"name": "test_login_pwd_error",
"signature": "def test_login_pwd_error(self)"
},
{
"docstring": "密码为空",
"name": "test_login_pwd_is_none",
"signature": "... | 5 | stack_v2_sparse_classes_30k_train_005030 | Implement the Python class `TestLogin` described below.
Class description:
登录的测试用例类
Method signatures and docstrings:
- def test_login_pass(self): 登录成功的用例
- def test_login_pwd_error(self): 密码错误
- def test_login_pwd_is_none(self): 密码为空
- def test_login_user_is_none(self): 账号为空
- def test_login_user_error(self): 账号错误 | Implement the Python class `TestLogin` described below.
Class description:
登录的测试用例类
Method signatures and docstrings:
- def test_login_pass(self): 登录成功的用例
- def test_login_pwd_error(self): 密码错误
- def test_login_pwd_is_none(self): 密码为空
- def test_login_user_is_none(self): 账号为空
- def test_login_user_error(self): 账号错误
... | 734a049ecd84bfddc607ef852366eb5b7d16c6cb | <|skeleton|>
class TestLogin:
"""登录的测试用例类"""
def test_login_pass(self):
"""登录成功的用例"""
<|body_0|>
def test_login_pwd_error(self):
"""密码错误"""
<|body_1|>
def test_login_pwd_is_none(self):
"""密码为空"""
<|body_2|>
def test_login_user_is_none(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestLogin:
"""登录的测试用例类"""
def test_login_pass(self):
"""登录成功的用例"""
data = {'username': 'python31', 'password': 'lemonban'}
expected = {'code': 0, 'msg': '登录成功'}
res = login_check(**data)
self.assertEqual(expected, res)
def test_login_pwd_error(self):
"... | the_stack_v2_python_sparse | day13unittest初识/day13_teacher/demo_02单元测试框架.py | guoyunfei0603/py31 | train | 0 |
d3057d3ad245e86a0463a8a313acff8fa0de3c61 | [
"qs = super(DocsItaliaProjectViewSet, self).get_queryset()\ntags = self.request.query_params.get('tags', None)\nif tags:\n tags = tags.split(',')\n qs = qs.filter(tags__slug__in=tags).distinct()\npublisher = self.request.query_params.get('publisher', None)\nif publisher:\n qs = qs.filter(publisherproject__... | <|body_start_0|>
qs = super(DocsItaliaProjectViewSet, self).get_queryset()
tags = self.request.query_params.get('tags', None)
if tags:
tags = tags.split(',')
qs = qs.filter(tags__slug__in=tags).distinct()
publisher = self.request.query_params.get('publisher', None... | Like :py:class:`ProjectViewSet` but using slug as lookup key. | DocsItaliaProjectViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DocsItaliaProjectViewSet:
"""Like :py:class:`ProjectViewSet` but using slug as lookup key."""
def get_queryset(self):
"""Filter projects by tags, publisher and project passed as query parameters. e.g. ?tags=tag1,tag2, ?publisher=publisher-slug, ?project=project-slug"""
<|body... | stack_v2_sparse_classes_10k_train_008149 | 2,665 | permissive | [
{
"docstring": "Filter projects by tags, publisher and project passed as query parameters. e.g. ?tags=tag1,tag2, ?publisher=publisher-slug, ?project=project-slug",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Returns project for user or 404.",
"name": "get... | 3 | stack_v2_sparse_classes_30k_train_000283 | Implement the Python class `DocsItaliaProjectViewSet` described below.
Class description:
Like :py:class:`ProjectViewSet` but using slug as lookup key.
Method signatures and docstrings:
- def get_queryset(self): Filter projects by tags, publisher and project passed as query parameters. e.g. ?tags=tag1,tag2, ?publishe... | Implement the Python class `DocsItaliaProjectViewSet` described below.
Class description:
Like :py:class:`ProjectViewSet` but using slug as lookup key.
Method signatures and docstrings:
- def get_queryset(self): Filter projects by tags, publisher and project passed as query parameters. e.g. ?tags=tag1,tag2, ?publishe... | 649965d7589eb1d30efdc7906c3ee7dc5a9e3656 | <|skeleton|>
class DocsItaliaProjectViewSet:
"""Like :py:class:`ProjectViewSet` but using slug as lookup key."""
def get_queryset(self):
"""Filter projects by tags, publisher and project passed as query parameters. e.g. ?tags=tag1,tag2, ?publisher=publisher-slug, ?project=project-slug"""
<|body... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DocsItaliaProjectViewSet:
"""Like :py:class:`ProjectViewSet` but using slug as lookup key."""
def get_queryset(self):
"""Filter projects by tags, publisher and project passed as query parameters. e.g. ?tags=tag1,tag2, ?publisher=publisher-slug, ?project=project-slug"""
qs = super(DocsItal... | the_stack_v2_python_sparse | readthedocs/docsitalia/views/api.py | italia/docs.italia.it | train | 19 |
b4d5db81e7499e35850d69122b3e50f7f8f8e582 | [
"super(FunctionComponent, self).__init__(opts)\nself.opts = opts\nself.options = opts.get(FunctionComponent.SECTION_HDR, {})\nself.init_function()",
"self.opts = opts\nself.options = opts.get(FunctionComponent.SECTION_HDR, {})\nself.init_function()",
"self.template_dir = self.options.get('template_dir')\nif sel... | <|body_start_0|>
super(FunctionComponent, self).__init__(opts)
self.opts = opts
self.options = opts.get(FunctionComponent.SECTION_HDR, {})
self.init_function()
<|end_body_0|>
<|body_start_1|>
self.opts = opts
self.options = opts.get(FunctionComponent.SECTION_HDR, {})
... | Component that implements Resilient function 'fn-netdevice | FunctionComponent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'fn-netdevice"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, save new... | stack_v2_sparse_classes_10k_train_008150 | 5,616 | permissive | [
{
"docstring": "constructor provides access to the configuration options",
"name": "__init__",
"signature": "def __init__(self, opts)"
},
{
"docstring": "Configuration options have changed, save new values",
"name": "_reload",
"signature": "def _reload(self, event, opts)"
},
{
"d... | 6 | null | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'fn-netdevice
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration options h... | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'fn-netdevice
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _reload(self, event, opts): Configuration options h... | 6878c78b94eeca407998a41ce8db2cc00f2b6758 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'fn-netdevice"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _reload(self, event, opts):
"""Configuration options have changed, save new... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FunctionComponent:
"""Component that implements Resilient function 'fn-netdevice"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
super(FunctionComponent, self).__init__(opts)
self.opts = opts
self.options = opts.get(FunctionCompo... | the_stack_v2_python_sparse | fn_netdevice/fn_netdevice/components/network_device.py | ibmresilient/resilient-community-apps | train | 81 |
08c9906e28c71a08573f63ac1ca033955c508d8b | [
"self._addModelVariable(model, 'base_frequency', long, ModelVariableFormat.DECIMAL)\nself._addModelVariable(model, 'xtal_frequency', int, ModelVariableFormat.DECIMAL)\nself._addModelVariable(model, 'channel_spacing', int, ModelVariableFormat.DECIMAL)",
"model.vars.xtal_frequency.value = int(model.vars.xtal_freque... | <|body_start_0|>
self._addModelVariable(model, 'base_frequency', long, ModelVariableFormat.DECIMAL)
self._addModelVariable(model, 'xtal_frequency', int, ModelVariableFormat.DECIMAL)
self._addModelVariable(model, 'channel_spacing', int, ModelVariableFormat.DECIMAL)
<|end_body_0|>
<|body_start_1|... | CALC_Profile_Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CALC_Profile_Base:
def buildVariables(self, model):
"""Populates a list of needed variables for this calculator Args: model (ModelRoot) : Builds the variables specific to this calculator"""
<|body_0|>
def calc_map_inputs(self, model):
"""the following function maps r... | stack_v2_sparse_classes_10k_train_008151 | 1,496 | no_license | [
{
"docstring": "Populates a list of needed variables for this calculator Args: model (ModelRoot) : Builds the variables specific to this calculator",
"name": "buildVariables",
"signature": "def buildVariables(self, model)"
},
{
"docstring": "the following function maps renamed variables into the... | 2 | null | Implement the Python class `CALC_Profile_Base` described below.
Class description:
Implement the CALC_Profile_Base class.
Method signatures and docstrings:
- def buildVariables(self, model): Populates a list of needed variables for this calculator Args: model (ModelRoot) : Builds the variables specific to this calcul... | Implement the Python class `CALC_Profile_Base` described below.
Class description:
Implement the CALC_Profile_Base class.
Method signatures and docstrings:
- def buildVariables(self, model): Populates a list of needed variables for this calculator Args: model (ModelRoot) : Builds the variables specific to this calcul... | 9f84e3b5a1397998dfea5287949fa5b1f4c209a6 | <|skeleton|>
class CALC_Profile_Base:
def buildVariables(self, model):
"""Populates a list of needed variables for this calculator Args: model (ModelRoot) : Builds the variables specific to this calculator"""
<|body_0|>
def calc_map_inputs(self, model):
"""the following function maps r... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CALC_Profile_Base:
def buildVariables(self, model):
"""Populates a list of needed variables for this calculator Args: model (ModelRoot) : Builds the variables specific to this calculator"""
self._addModelVariable(model, 'base_frequency', long, ModelVariableFormat.DECIMAL)
self._addMode... | the_stack_v2_python_sparse | .closet/jython.configurator.efr32/1.0.0.201606231656-435/pyradioconfig/parts/common/calculators/calc_profile_base_beta1.py | acvilla/Sundial-Beta | train | 1 | |
d28575762b6e8e8c7851bc0f116c6bf04d856577 | [
"max_val = float('-inf')\nsum = 0\nfor i, num in enumerate(nums, 1):\n sum += num\n if i > k:\n sum -= nums[i - k - 1]\n if i >= k:\n max_val = max(max_val, sum)\nreturn float(max_val) / k",
"sum_list = [0]\nfor num in nums:\n sum_list.append(sum_list[-1] + num)\nmax_val = max((sum_list[... | <|body_start_0|>
max_val = float('-inf')
sum = 0
for i, num in enumerate(nums, 1):
sum += num
if i > k:
sum -= nums[i - k - 1]
if i >= k:
max_val = max(max_val, sum)
return float(max_val) / k
<|end_body_0|>
<|body_start... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_0|>
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
max... | stack_v2_sparse_classes_10k_train_008152 | 1,398 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: float",
"name": "findMaxAverage",
"signature": "def findMaxAverage(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: float",
"name": "findMaxAverage",
"signature": "def findMaxAverage(self, nums, k)"
... | 2 | stack_v2_sparse_classes_30k_train_003653 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float
- def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float
- def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float
<|skele... | f0fe37f489a8dc9867b774bfa22a8d73c322cb79 | <|skeleton|>
class Solution:
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_0|>
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
max_val = float('-inf')
sum = 0
for i, num in enumerate(nums, 1):
sum += num
if i > k:
sum -= nums[i - k - 1]
if i >= k:
... | the_stack_v2_python_sparse | dp/643_Maximum_Average_Subarray_I.py | AsterWang/leecode | train | 0 | |
e72e2a50e80ce636e74777c5af85afc22da363ab | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MacOSCompliancePolicy()",
"from .device_compliance_policy import DeviceCompliancePolicy\nfrom .device_threat_protection_level import DeviceThreatProtectionLevel\nfrom .required_password_type import RequiredPasswordType\nfrom .device_co... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return MacOSCompliancePolicy()
<|end_body_0|>
<|body_start_1|>
from .device_compliance_policy import DeviceCompliancePolicy
from .device_threat_protection_level import DeviceThreatProtectionLev... | This class contains compliance settings for Mac OS. | MacOSCompliancePolicy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MacOSCompliancePolicy:
"""This class contains compliance settings for Mac OS."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p... | stack_v2_sparse_classes_10k_train_008153 | 8,051 | 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: MacOSCompliancePolicy",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminat... | 3 | null | Implement the Python class `MacOSCompliancePolicy` described below.
Class description:
This class contains compliance settings for Mac OS.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: Creates a new instance of the appropriate c... | Implement the Python class `MacOSCompliancePolicy` described below.
Class description:
This class contains compliance settings for Mac OS.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: Creates a new instance of the appropriate c... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class MacOSCompliancePolicy:
"""This class contains compliance settings for Mac OS."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MacOSCompliancePolicy:
"""This class contains compliance settings for Mac OS."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to ... | the_stack_v2_python_sparse | msgraph/generated/models/mac_o_s_compliance_policy.py | microsoftgraph/msgraph-sdk-python | train | 135 |
c36710aa670ef1aad0851c4a9e4d5254a3646b32 | [
"pg_list = []\nnetwork_sys = client_object.get_network_system()\nfor pg in network_sys.networkInfo.portgroup:\n pg_list.append(pg.spec.name)\nreturn pg_list",
"host_mor = client_object.get_host_mor()\nnetwork_folder = host_mor.parent.parent.parent.networkFolder\nfor component in network_folder.childEntity:\n ... | <|body_start_0|>
pg_list = []
network_sys = client_object.get_network_system()
for pg in network_sys.networkInfo.portgroup:
pg_list.append(pg.spec.name)
return pg_list
<|end_body_0|>
<|body_start_1|>
host_mor = client_object.get_host_mor()
network_folder = ho... | Network related operations. | ESX55NetworkImpl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ESX55NetworkImpl:
"""Network related operations."""
def list_networks(cls, client_object):
"""Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups."""
<|body_0|>
d... | stack_v2_sparse_classes_10k_train_008154 | 1,942 | no_license | [
{
"docstring": "Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups.",
"name": "list_networks",
"signature": "def list_networks(cls, client_object)"
},
{
"docstring": "Returns the ID(key)... | 2 | null | Implement the Python class `ESX55NetworkImpl` described below.
Class description:
Network related operations.
Method signatures and docstrings:
- def list_networks(cls, client_object): Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @... | Implement the Python class `ESX55NetworkImpl` described below.
Class description:
Network related operations.
Method signatures and docstrings:
- def list_networks(cls, client_object): Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @... | 5b55817c050b637e2747084290f6206d2e622938 | <|skeleton|>
class ESX55NetworkImpl:
"""Network related operations."""
def list_networks(cls, client_object):
"""Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups."""
<|body_0|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ESX55NetworkImpl:
"""Network related operations."""
def list_networks(cls, client_object):
"""Returns the list of port groups. @type client_object: client instance @param client_object: Hypervisor client instance @rtype: list @return: List of port groups."""
pg_list = []
network_s... | the_stack_v2_python_sparse | SystemTesting/pylib/vmware/vsphere/esx/api/esx55_network_impl.py | Cloudxtreme/MyProject | train | 0 |
f1ccd5fc246c1867060ab596aeeb901b64be8a58 | [
"class Node:\n\n def __init__(self, chr):\n self.chr = chr\n self.end = False\n self.children = defaultdict(lambda: None)\n\nclass Trie:\n\n def __init__(self):\n self.root = Node(None)\n\n def insert(self, cur, s, i):\n if not cur:\n cur = Node(s[i])\n ... | <|body_start_0|>
class Node:
def __init__(self, chr):
self.chr = chr
self.end = False
self.children = defaultdict(lambda: None)
class Trie:
def __init__(self):
self.root = Node(None)
def insert(self, ... | MagicDictionary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def buildDict(self, dic: List[str]) -> None:
"""Build a dictionary through a list of words"""
<|body_1|>
def search(self, word: str) -> bool:
"""Returns if... | stack_v2_sparse_classes_10k_train_008155 | 2,727 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Build a dictionary through a list of words",
"name": "buildDict",
"signature": "def buildDict(self, dic: List[str]) -> None"
},
{
"docstring": "Returns ... | 3 | stack_v2_sparse_classes_30k_train_001533 | Implement the Python class `MagicDictionary` described below.
Class description:
Implement the MagicDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def buildDict(self, dic: List[str]) -> None: Build a dictionary through a list of words
- def search(self... | Implement the Python class `MagicDictionary` described below.
Class description:
Implement the MagicDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def buildDict(self, dic: List[str]) -> None: Build a dictionary through a list of words
- def search(self... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def buildDict(self, dic: List[str]) -> None:
"""Build a dictionary through a list of words"""
<|body_1|>
def search(self, word: str) -> bool:
"""Returns if... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
class Node:
def __init__(self, chr):
self.chr = chr
self.end = False
self.children = defaultdict(lambda: None)
class Trie:
def __in... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/676 Implement Magic Dictionary.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
fa0b072d5bb8a0666a66705711f0e488fb8a6e05 | [
"params = locals()\ndel params['kwargs']\nreturn BatchDisbursementItem.Query(**params)",
"url = '/batch_disbursements'\nheaders, body = _extract_params(locals(), func_object=BatchDisbursement.create, headers_params=['for_user_id', 'x_idempotency_key', 'x_api_version'])\nkwargs['headers'] = headers\nkwargs['body']... | <|body_start_0|>
params = locals()
del params['kwargs']
return BatchDisbursementItem.Query(**params)
<|end_body_0|>
<|body_start_1|>
url = '/batch_disbursements'
headers, body = _extract_params(locals(), func_object=BatchDisbursement.create, headers_params=['for_user_id', 'x_ide... | BatchDisbursement class (API Reference: Batch Disbursement) Related Classes: - BatchDisbursementItem Static Methods: - BatchDisbursement.create (API Reference: /Create Batch Disbursement) Static Methods for Object Creation: - BatchDisbursement.helper_create_batch_item (For BatchDisbursementItem in create_batch) Attribu... | BatchDisbursement | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchDisbursement:
"""BatchDisbursement class (API Reference: Batch Disbursement) Related Classes: - BatchDisbursementItem Static Methods: - BatchDisbursement.create (API Reference: /Create Batch Disbursement) Static Methods for Object Creation: - BatchDisbursement.helper_create_batch_item (For B... | stack_v2_sparse_classes_10k_train_008156 | 2,882 | permissive | [
{
"docstring": "Construct Batch Disbursement Item Object Args: - amount (int) - bank_code (str) - bank_account_name (str) - bank_account_number (str) - description (str) - external_id (str) - **email_to (str[]) - **email_cc (str[]) - **email_bcc (str[]) Return: - BatchDisbursementItem",
"name": "helper_crea... | 2 | stack_v2_sparse_classes_30k_val_000066 | Implement the Python class `BatchDisbursement` described below.
Class description:
BatchDisbursement class (API Reference: Batch Disbursement) Related Classes: - BatchDisbursementItem Static Methods: - BatchDisbursement.create (API Reference: /Create Batch Disbursement) Static Methods for Object Creation: - BatchDisbu... | Implement the Python class `BatchDisbursement` described below.
Class description:
BatchDisbursement class (API Reference: Batch Disbursement) Related Classes: - BatchDisbursementItem Static Methods: - BatchDisbursement.create (API Reference: /Create Batch Disbursement) Static Methods for Object Creation: - BatchDisbu... | 8b677fbbad5fe3bbcd0a2b93e30e8040543b8f61 | <|skeleton|>
class BatchDisbursement:
"""BatchDisbursement class (API Reference: Batch Disbursement) Related Classes: - BatchDisbursementItem Static Methods: - BatchDisbursement.create (API Reference: /Create Batch Disbursement) Static Methods for Object Creation: - BatchDisbursement.helper_create_batch_item (For B... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BatchDisbursement:
"""BatchDisbursement class (API Reference: Batch Disbursement) Related Classes: - BatchDisbursementItem Static Methods: - BatchDisbursement.create (API Reference: /Create Batch Disbursement) Static Methods for Object Creation: - BatchDisbursement.helper_create_batch_item (For BatchDisbursem... | the_stack_v2_python_sparse | xendit/models/batchdisbursement/batch_disbursement.py | baseup/xendit-python | train | 0 |
5e3f5de9d49a6684c121640e1ba4e59ff841e59f | [
"Parametre.__init__(self, 'voir', 'view')\nself.schema = ''\nself.aide_courte = 'visualise les options du joueur'\nself.aide_longue = \"Cette commande permet de voir l'état actuel des options que vous pouvez éditer avec la commande %options%. Elle donne aussi un aperçu des valeurs disponibles.\"",
"langue = perso... | <|body_start_0|>
Parametre.__init__(self, 'voir', 'view')
self.schema = ''
self.aide_courte = 'visualise les options du joueur'
self.aide_longue = "Cette commande permet de voir l'état actuel des options que vous pouvez éditer avec la commande %options%. Elle donne aussi un aperçu des va... | Commande 'options voir'. | PrmVoir | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmVoir:
"""Commande 'options voir'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametre.__ini... | stack_v2_sparse_classes_10k_train_008157 | 3,294 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmVoir` described below.
Class description:
Commande 'options voir'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmVoir` described below.
Class description:
Commande 'options voir'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmVoir:
"""Commande 'options voir'.... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmVoir:
"""Commande 'options voir'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PrmVoir:
"""Commande 'options voir'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'voir', 'view')
self.schema = ''
self.aide_courte = 'visualise les options du joueur'
self.aide_longue = "Cette commande permet de voir l'état actue... | the_stack_v2_python_sparse | src/primaires/joueur/commandes/options/voir.py | vincent-lg/tsunami | train | 5 |
446f93db141f6f425732417fb84e211bbd69465d | [
"super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)",
"enc_output = self.encoder(inputs, training, encoder_mask)\ndec_output, atten... | <|body_start_0|>
super().__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)
self.linear = tf.keras.layers.Dense(target_vocab)
<|end_body_0|>
<|body_start_1|>
... | class Transform | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""class Transform"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""* N - the number of blocks in the encoder and decoder * dm - the dimensionality of the model * h - the number of heads * hidden - the n... | stack_v2_sparse_classes_10k_train_008158 | 18,002 | no_license | [
{
"docstring": "* N - the number of blocks in the encoder and decoder * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layers * input_vocab - the size of the input vocabulary * target_vocab - the size of the target vocabulary * max_seq... | 2 | stack_v2_sparse_classes_30k_train_002899 | Implement the Python class `Transformer` described below.
Class description:
class Transform
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): * N - the number of blocks in the encoder and decoder * dm - the dimensionalit... | Implement the Python class `Transformer` described below.
Class description:
class Transform
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): * N - the number of blocks in the encoder and decoder * dm - the dimensionalit... | 8ad4c2594ff78b345dbd92e9d54d2a143ac4071a | <|skeleton|>
class Transformer:
"""class Transform"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""* N - the number of blocks in the encoder and decoder * dm - the dimensionality of the model * h - the number of heads * hidden - the n... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Transformer:
"""class Transform"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""* N - the number of blocks in the encoder and decoder * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidd... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/5-transformer.py | jorgezafra94/holbertonschool-machine_learning | train | 1 |
01ab0524405545fffde9124f0b3bf31b6856d507 | [
"super(Vehicle, self).__init__(voxel_data_dict, vehicle_csys=vehicle_csys, voxel_size=voxel_size)\nself.floor = None\nself.ceiling = None",
"labels = self.get_labels(mask_from_voxel=cabin_voxel)\nself.ceiling = np.zeros((labels.shape[0], labels.shape[1]), dtype=np.int16)\nself.floor = np.zeros((labels.shape[0], l... | <|body_start_0|>
super(Vehicle, self).__init__(voxel_data_dict, vehicle_csys=vehicle_csys, voxel_size=voxel_size)
self.floor = None
self.ceiling = None
<|end_body_0|>
<|body_start_1|>
labels = self.get_labels(mask_from_voxel=cabin_voxel)
self.ceiling = np.zeros((labels.shape[0],... | Add specific methods for finding floor and ceiling | Vehicle | [
"LicenseRef-scancode-other-permissive"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vehicle:
"""Add specific methods for finding floor and ceiling"""
def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None):
"""Call constructor of superclass and then add on two more empty parameters"""
<|body_0|>
def _make_floor_ceil(self, cabin_voxel):
... | stack_v2_sparse_classes_10k_train_008159 | 8,134 | permissive | [
{
"docstring": "Call constructor of superclass and then add on two more empty parameters",
"name": "__init__",
"signature": "def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None)"
},
{
"docstring": "Alternate method of ceiling detection: get the label in a region containing tro... | 4 | null | Implement the Python class `Vehicle` described below.
Class description:
Add specific methods for finding floor and ceiling
Method signatures and docstrings:
- def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): Call constructor of superclass and then add on two more empty parameters
- def _make_... | Implement the Python class `Vehicle` described below.
Class description:
Add specific methods for finding floor and ceiling
Method signatures and docstrings:
- def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None): Call constructor of superclass and then add on two more empty parameters
- def _make_... | bc7a05e04c7901f477fe553c59e478a837116d92 | <|skeleton|>
class Vehicle:
"""Add specific methods for finding floor and ceiling"""
def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None):
"""Call constructor of superclass and then add on two more empty parameters"""
<|body_0|>
def _make_floor_ceil(self, cabin_voxel):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Vehicle:
"""Add specific methods for finding floor and ceiling"""
def __init__(self, voxel_data_dict, vehicle_csys=None, voxel_size=None):
"""Call constructor of superclass and then add on two more empty parameters"""
super(Vehicle, self).__init__(voxel_data_dict, vehicle_csys=vehicle_csy... | the_stack_v2_python_sparse | analysis_tools/PYTHON_RICARDO/output_ingress_egress/scripts/voxel_methods.py | metamorph-inc/meta-core | train | 25 |
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_10k_train_008160 | 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_003495 | 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_10k | 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 |
db15a6e0532db708e61dfa66753e37bb65385d80 | [
"num = int(input('请输入金额:'))\naccount = self.balance()\naccount['amount'] += num\nself.update_account(account)\nreturn (True, '存款成功')",
"import os\naccount = input('请输入账户名:')\npasswd = input('请输入密码:')\npasswd_02 = input('请再次输入密码:')\naccount_names = set(os.listdir('info'))\nif account in account_names:\n return ... | <|body_start_0|>
num = int(input('请输入金额:'))
account = self.balance()
account['amount'] += num
self.update_account(account)
return (True, '存款成功')
<|end_body_0|>
<|body_start_1|>
import os
account = input('请输入账户名:')
passwd = input('请输入密码:')
passwd_0... | AtmMutil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AtmMutil:
def save_money(self):
"""存钱 :return:"""
<|body_0|>
def make_account(self):
"""创建一个账户 :return:"""
<|body_1|>
def main(self):
"""主函数 :return:"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
num = int(input('请输入金额:'))
... | stack_v2_sparse_classes_10k_train_008161 | 5,505 | no_license | [
{
"docstring": "存钱 :return:",
"name": "save_money",
"signature": "def save_money(self)"
},
{
"docstring": "创建一个账户 :return:",
"name": "make_account",
"signature": "def make_account(self)"
},
{
"docstring": "主函数 :return:",
"name": "main",
"signature": "def main(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_005596 | Implement the Python class `AtmMutil` described below.
Class description:
Implement the AtmMutil class.
Method signatures and docstrings:
- def save_money(self): 存钱 :return:
- def make_account(self): 创建一个账户 :return:
- def main(self): 主函数 :return: | Implement the Python class `AtmMutil` described below.
Class description:
Implement the AtmMutil class.
Method signatures and docstrings:
- def save_money(self): 存钱 :return:
- def make_account(self): 创建一个账户 :return:
- def main(self): 主函数 :return:
<|skeleton|>
class AtmMutil:
def save_money(self):
"""存钱 ... | 167c86be6241c6c148eb586b5dd19275246372a7 | <|skeleton|>
class AtmMutil:
def save_money(self):
"""存钱 :return:"""
<|body_0|>
def make_account(self):
"""创建一个账户 :return:"""
<|body_1|>
def main(self):
"""主函数 :return:"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AtmMutil:
def save_money(self):
"""存钱 :return:"""
num = int(input('请输入金额:'))
account = self.balance()
account['amount'] += num
self.update_account(account)
return (True, '存款成功')
def make_account(self):
"""创建一个账户 :return:"""
import os
... | the_stack_v2_python_sparse | py3-study/面向对象课上代码/1902/11-26/ATM_mutil.py | liuluyang/mk | train | 0 | |
210fb917c2ab111e331499a860120ac911a1f75a | [
"self.N = prime\nself.g = 2\nself.k = 3\nself.server = server",
"out = queue.Queue()\ninp = queue.Queue()\nself.server.authenticate(email, A, out, inp)\nsalt, B = inp.get()\nif DEBUG:\n print('CLIENT: salt: ' + str(c1.asciitohex(salt)))\n print('CLIENT: B: ' + str(B))\nif A % self.N != 0:\n raise ValueEr... | <|body_start_0|>
self.N = prime
self.g = 2
self.k = 3
self.server = server
<|end_body_0|>
<|body_start_1|>
out = queue.Queue()
inp = queue.Queue()
self.server.authenticate(email, A, out, inp)
salt, B = inp.get()
if DEBUG:
print('CLIENT... | SRPClientA | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SRPClientA:
def __init__(self, prime, server):
"""Initializes the class with a provided NIST prime and a server to communicate with. Accepts a malicious value for A to send to the server. Args: prime (int): The NIST prime used by both client and server server (SRPServer): The server to t... | stack_v2_sparse_classes_10k_train_008162 | 3,270 | no_license | [
{
"docstring": "Initializes the class with a provided NIST prime and a server to communicate with. Accepts a malicious value for A to send to the server. Args: prime (int): The NIST prime used by both client and server server (SRPServer): The server to talk to",
"name": "__init__",
"signature": "def __i... | 2 | stack_v2_sparse_classes_30k_train_003135 | Implement the Python class `SRPClientA` described below.
Class description:
Implement the SRPClientA class.
Method signatures and docstrings:
- def __init__(self, prime, server): Initializes the class with a provided NIST prime and a server to communicate with. Accepts a malicious value for A to send to the server. A... | Implement the Python class `SRPClientA` described below.
Class description:
Implement the SRPClientA class.
Method signatures and docstrings:
- def __init__(self, prime, server): Initializes the class with a provided NIST prime and a server to communicate with. Accepts a malicious value for A to send to the server. A... | 5119b857927d604a6e0ab074e5f000f3f2ac4ee1 | <|skeleton|>
class SRPClientA:
def __init__(self, prime, server):
"""Initializes the class with a provided NIST prime and a server to communicate with. Accepts a malicious value for A to send to the server. Args: prime (int): The NIST prime used by both client and server server (SRPServer): The server to t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SRPClientA:
def __init__(self, prime, server):
"""Initializes the class with a provided NIST prime and a server to communicate with. Accepts a malicious value for A to send to the server. Args: prime (int): The NIST prime used by both client and server server (SRPServer): The server to talk to"""
... | the_stack_v2_python_sparse | cryptopals-py/set5/c37.py | aasparks/cryptopals-py-rkt | train | 1 | |
b10d3963c8fb2eac58867ca1e1be402822072b2e | [
"if offset is None:\n return default_value\noffset = to_int(offset, 'offset')\nif offset < 0:\n raise ParamValueError(\"'offset' should be greater than or equal to 0.\")\nreturn offset",
"if limit is None:\n return default_value\nlimit = to_int(limit, 'limit')\nif limit < min_value or limit > max_value:\... | <|body_start_0|>
if offset is None:
return default_value
offset = to_int(offset, 'offset')
if offset < 0:
raise ParamValueError("'offset' should be greater than or equal to 0.")
return offset
<|end_body_0|>
<|body_start_1|>
if limit is None:
r... | Validation class, define all check methods. | Validation | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Validation:
"""Validation class, define all check methods."""
def check_offset(cls, offset, default_value=0):
"""Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked of... | stack_v2_sparse_classes_10k_train_008163 | 3,530 | permissive | [
{
"docstring": "Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked offset. Default: 0. Returns: int, offset.",
"name": "check_offset",
"signature": "def check_offset(cls, offset, default... | 4 | null | Implement the Python class `Validation` described below.
Class description:
Validation class, define all check methods.
Method signatures and docstrings:
- def check_offset(cls, offset, default_value=0): Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number ... | Implement the Python class `Validation` described below.
Class description:
Validation class, define all check methods.
Method signatures and docstrings:
- def check_offset(cls, offset, default_value=0): Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number ... | a774d893fb2f21dbc3edb5cd89f9e6eec274ebf1 | <|skeleton|>
class Validation:
"""Validation class, define all check methods."""
def check_offset(cls, offset, default_value=0):
"""Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked of... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Validation:
"""Validation class, define all check methods."""
def check_offset(cls, offset, default_value=0):
"""Check offset parameter, it must be greater or equal 0. Args: offset (Union[str, int]): Value can be string number or int. default_value (int): Default value for checked offset. Default... | the_stack_v2_python_sparse | mindinsight/datavisual/common/validation.py | mindspore-ai/mindinsight | train | 224 |
368f3d65b3dcbbfb9b9ff08b82a8748cb8826381 | [
"super().setUp()\nself.login(self.CURRICULUM_ADMIN_EMAIL, is_super_admin=True)\ncsrf_token = self.get_new_csrf_token()\nself.post_json('/adminhandler', {'action': 'reload_exploration', 'exploration_id': '3'}, csrf_token=csrf_token)\nself.logout()",
"library_groups = summary_services.get_library_groups([])\nexpect... | <|body_start_0|>
super().setUp()
self.login(self.CURRICULUM_ADMIN_EMAIL, is_super_admin=True)
csrf_token = self.get_new_csrf_token()
self.post_json('/adminhandler', {'action': 'reload_exploration', 'exploration_id': '3'}, csrf_token=csrf_token)
self.logout()
<|end_body_0|>
<|bod... | Test functions for getting summary dicts for library groups. | LibraryGroupsTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibraryGroupsTest:
"""Test functions for getting summary dicts for library groups."""
def setUp(self) -> None:
"""Populate the database of explorations and their summaries. The sequence of events is: - (1) Admin logs in. - (2) Admin access admin page. - (3) Admin reloads exploration ... | stack_v2_sparse_classes_10k_train_008164 | 47,358 | permissive | [
{
"docstring": "Populate the database of explorations and their summaries. The sequence of events is: - (1) Admin logs in. - (2) Admin access admin page. - (3) Admin reloads exploration with id '3'. - (4) Admin logs out.",
"name": "setUp",
"signature": "def setUp(self) -> None"
},
{
"docstring":... | 2 | null | Implement the Python class `LibraryGroupsTest` described below.
Class description:
Test functions for getting summary dicts for library groups.
Method signatures and docstrings:
- def setUp(self) -> None: Populate the database of explorations and their summaries. The sequence of events is: - (1) Admin logs in. - (2) ... | Implement the Python class `LibraryGroupsTest` described below.
Class description:
Test functions for getting summary dicts for library groups.
Method signatures and docstrings:
- def setUp(self) -> None: Populate the database of explorations and their summaries. The sequence of events is: - (1) Admin logs in. - (2) ... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class LibraryGroupsTest:
"""Test functions for getting summary dicts for library groups."""
def setUp(self) -> None:
"""Populate the database of explorations and their summaries. The sequence of events is: - (1) Admin logs in. - (2) Admin access admin page. - (3) Admin reloads exploration ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LibraryGroupsTest:
"""Test functions for getting summary dicts for library groups."""
def setUp(self) -> None:
"""Populate the database of explorations and their summaries. The sequence of events is: - (1) Admin logs in. - (2) Admin access admin page. - (3) Admin reloads exploration with id '3'. ... | the_stack_v2_python_sparse | core/domain/summary_services_test.py | oppia/oppia | train | 6,172 |
1ccd5f77c154b9eeebc9c7f8f5dac5df03681303 | [
"res = super(ResConfigInherit, self).get_values()\nparams = self.env['ir.config_parameter'].sudo().get_param\nproduct_restriction = params('sale_stock_restrict.product_restriction')\ncheck_stock = params('sale_stock_restrict.check_stock')\nres.update(product_restriction=product_restriction, check_stock=check_stock)... | <|body_start_0|>
res = super(ResConfigInherit, self).get_values()
params = self.env['ir.config_parameter'].sudo().get_param
product_restriction = params('sale_stock_restrict.product_restriction')
check_stock = params('sale_stock_restrict.check_stock')
res.update(product_restricti... | ResConfigInherit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResConfigInherit:
def get_values(self):
"""get values from the fields"""
<|body_0|>
def set_values(self):
"""Set values in the fields"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = super(ResConfigInherit, self).get_values()
params = s... | stack_v2_sparse_classes_10k_train_008165 | 2,286 | no_license | [
{
"docstring": "get values from the fields",
"name": "get_values",
"signature": "def get_values(self)"
},
{
"docstring": "Set values in the fields",
"name": "set_values",
"signature": "def set_values(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003235 | Implement the Python class `ResConfigInherit` described below.
Class description:
Implement the ResConfigInherit class.
Method signatures and docstrings:
- def get_values(self): get values from the fields
- def set_values(self): Set values in the fields | Implement the Python class `ResConfigInherit` described below.
Class description:
Implement the ResConfigInherit class.
Method signatures and docstrings:
- def get_values(self): get values from the fields
- def set_values(self): Set values in the fields
<|skeleton|>
class ResConfigInherit:
def get_values(self):... | 4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14 | <|skeleton|>
class ResConfigInherit:
def get_values(self):
"""get values from the fields"""
<|body_0|>
def set_values(self):
"""Set values in the fields"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ResConfigInherit:
def get_values(self):
"""get values from the fields"""
res = super(ResConfigInherit, self).get_values()
params = self.env['ir.config_parameter'].sudo().get_param
product_restriction = params('sale_stock_restrict.product_restriction')
check_stock = para... | the_stack_v2_python_sparse | sale_stock_restrict/models/res_config.py | CybroOdoo/CybroAddons | train | 209 | |
a6501d242bf6288b8f5bfe643dc2161b244d8298 | [
"self.mode_name = 'playstore'\nBase.__init__(self, self.mode_name)\nself.ime = IME()\nself.debug_print('PlayStore init:%f' % time.time())",
"click_button_by_id('search_button')\nclick_textview_by_id('search_src_text')\nself.ime.IME_input_english(1, name)\nsend_key(KEY_ENTER)\nsleep(20)\nclick_textview_by_text(des... | <|body_start_0|>
self.mode_name = 'playstore'
Base.__init__(self, self.mode_name)
self.ime = IME()
self.debug_print('PlayStore init:%f' % time.time())
<|end_body_0|>
<|body_start_1|>
click_button_by_id('search_button')
click_textview_by_id('search_src_text')
self... | PlayStore is a class for operating google play store application. @see: L{Base <Base>} | PlayStore | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlayStore:
"""PlayStore is a class for operating google play store application. @see: L{Base <Base>}"""
def __init__(self):
"""init function."""
<|body_0|>
def download(self, name, description):
"""download a application according to the application name and desc... | stack_v2_sparse_classes_10k_train_008166 | 2,935 | no_license | [
{
"docstring": "init function.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "download a application according to the application name and description. @type name: string @param name: application's name @type description: string @param description: applicaiton's descr... | 2 | null | Implement the Python class `PlayStore` described below.
Class description:
PlayStore is a class for operating google play store application. @see: L{Base <Base>}
Method signatures and docstrings:
- def __init__(self): init function.
- def download(self, name, description): download a application according to the appl... | Implement the Python class `PlayStore` described below.
Class description:
PlayStore is a class for operating google play store application. @see: L{Base <Base>}
Method signatures and docstrings:
- def __init__(self): init function.
- def download(self, name, description): download a application according to the appl... | a04b717ae437511abae1e7e9e399373c161a7b65 | <|skeleton|>
class PlayStore:
"""PlayStore is a class for operating google play store application. @see: L{Base <Base>}"""
def __init__(self):
"""init function."""
<|body_0|>
def download(self, name, description):
"""download a application according to the application name and desc... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PlayStore:
"""PlayStore is a class for operating google play store application. @see: L{Base <Base>}"""
def __init__(self):
"""init function."""
self.mode_name = 'playstore'
Base.__init__(self, self.mode_name)
self.ime = IME()
self.debug_print('PlayStore init:%f' %... | the_stack_v2_python_sparse | test_env/qrd_shared/playstore/PlayStore.py | wwlwwlqaz/Qualcomm | train | 1 |
2e338003a48935ec5d5790485ec3500560a3b728 | [
"field = self.getPrimaryField()\nif isinstance(field.get(self), File):\n return field.get(self).index_html(REQUEST, RESPONSE)\nreturn field.index_html(self, REQUEST, RESPONSE)",
"if key is None:\n return self.getId()\nelse:\n field = self.getField(key) or getattr(self, key, None)\n if field and shasat... | <|body_start_0|>
field = self.getPrimaryField()
if isinstance(field.get(self), File):
return field.get(self).index_html(REQUEST, RESPONSE)
return field.index_html(self, REQUEST, RESPONSE)
<|end_body_0|>
<|body_start_1|>
if key is None:
return self.getId()
... | An image attachment | ImageAttachment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageAttachment:
"""An image attachment"""
def index_html(self, REQUEST, RESPONSE):
"""download the file inline or as an attachment"""
<|body_0|>
def getFilename(self, key=None):
"""Returns the filename from a field."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_10k_train_008167 | 1,189 | no_license | [
{
"docstring": "download the file inline or as an attachment",
"name": "index_html",
"signature": "def index_html(self, REQUEST, RESPONSE)"
},
{
"docstring": "Returns the filename from a field.",
"name": "getFilename",
"signature": "def getFilename(self, key=None)"
}
] | 2 | null | Implement the Python class `ImageAttachment` described below.
Class description:
An image attachment
Method signatures and docstrings:
- def index_html(self, REQUEST, RESPONSE): download the file inline or as an attachment
- def getFilename(self, key=None): Returns the filename from a field. | Implement the Python class `ImageAttachment` described below.
Class description:
An image attachment
Method signatures and docstrings:
- def index_html(self, REQUEST, RESPONSE): download the file inline or as an attachment
- def getFilename(self, key=None): Returns the filename from a field.
<|skeleton|>
class Image... | 8a7bdbdb98c3f9fc1073c6061cd2d3a0ec80caf5 | <|skeleton|>
class ImageAttachment:
"""An image attachment"""
def index_html(self, REQUEST, RESPONSE):
"""download the file inline or as an attachment"""
<|body_0|>
def getFilename(self, key=None):
"""Returns the filename from a field."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImageAttachment:
"""An image attachment"""
def index_html(self, REQUEST, RESPONSE):
"""download the file inline or as an attachment"""
field = self.getPrimaryField()
if isinstance(field.get(self), File):
return field.get(self).index_html(REQUEST, RESPONSE)
retu... | the_stack_v2_python_sparse | buildout-cache/eggs/Products.SimpleAttachment-5.0.0-py2.7.egg/Products/SimpleAttachment/content/image.py | renansfs/Plone_SP | train | 0 |
982de57a1d9a2327f8f2caf5c5383ae05163bdd7 | [
"nlu_namespaces_to_check = [nlu.Spellbook.pretrained_pipe_references, nlu.Spellbook.pretrained_models_references, nlu.Spellbook.pretrained_healthcare_model_references, nlu.Spellbook.licensed_storage_ref_2_nlu_ref, nlu.Spellbook.storage_ref_2_nlu_ref]\nfor dict_ in nlu_namespaces_to_check:\n if lang:\n if ... | <|body_start_0|>
nlu_namespaces_to_check = [nlu.Spellbook.pretrained_pipe_references, nlu.Spellbook.pretrained_models_references, nlu.Spellbook.pretrained_healthcare_model_references, nlu.Spellbook.licensed_storage_ref_2_nlu_ref, nlu.Spellbook.storage_ref_2_nlu_ref]
for dict_ in nlu_namespaces_to_check:... | ModelHubUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelHubUtils:
def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str:
"""Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in."""
<|body_0|>
def get_url_by_nlu_refrence(nlu_ref... | stack_v2_sparse_classes_10k_train_008168 | 2,567 | permissive | [
{
"docstring": "Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in.",
"name": "NLU_ref_to_NLP_ref",
"signature": "def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str"
},
{
"docstring": "Rsolves... | 3 | stack_v2_sparse_classes_30k_train_003548 | Implement the Python class `ModelHubUtils` described below.
Class description:
Implement the ModelHubUtils class.
Method signatures and docstrings:
- def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return... | Implement the Python class `ModelHubUtils` described below.
Class description:
Implement the ModelHubUtils class.
Method signatures and docstrings:
- def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str: Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return... | fd7e73bc3e331b49361fca93cf8d07cccd934adc | <|skeleton|>
class ModelHubUtils:
def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str:
"""Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in."""
<|body_0|>
def get_url_by_nlu_refrence(nlu_ref... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ModelHubUtils:
def NLU_ref_to_NLP_ref(nlu_ref: str, lang: str=None) -> str:
"""Resolve a Spark NLU reference to a NLP reference. Args : NLU_ref : which nlu model's nlp refrence to return. lang : what language is the model in."""
nlu_namespaces_to_check = [nlu.Spellbook.pretrained_pipe_referenc... | the_stack_v2_python_sparse | nlu/pipe/utils/modelhub_utils.py | prakashcinna/nlu | train | 0 | |
76a2e77854bc0a8058da6f26826daab8771820ae | [
"trie = Trie()\nfor word, freq in zip(sentences, times):\n trie.insert(word, freq)\nself.trie = trie\nself.currSearch = ''\nself.node = trie.root",
"if c == '#':\n self.trie.insert(self.currSearch, 1)\n self.currSearch = ''\n self.node = self.trie.root\n return []\nelse:\n self.currSearch += c\n... | <|body_start_0|>
trie = Trie()
for word, freq in zip(sentences, times):
trie.insert(word, freq)
self.trie = trie
self.currSearch = ''
self.node = trie.root
<|end_body_0|>
<|body_start_1|>
if c == '#':
self.trie.insert(self.currSearch, 1)
... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
trie = Trie()
... | stack_v2_sparse_classes_10k_train_008169 | 1,657 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004701 | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | 2d5c09b63438aee7925252d5c6c4ede872bf52f1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
trie = Trie()
for word, freq in zip(sentences, times):
trie.insert(word, freq)
self.trie = trie
self.currSearch = ''
self.node = trie.ro... | the_stack_v2_python_sparse | algorithms/google/AutoComplete.py | james4388/algorithm-1 | train | 1 | |
cdd9e9a6d1855c14ab825351587b8e12a2f14e76 | [
"match = wrapperRE.match(branchInfo.GetTypeName())\nif match:\n self.type = match.group(1)\nelse:\n raise ValueError('Not edm::Wrapper')\nname = trailingDotRE.sub('', branchInfo.GetName())\npieces = underscoreRE.split(name)\nif len(pieces) != 4:\n raise ValueError('%s not formatted as expected' % name)\nse... | <|body_start_0|>
match = wrapperRE.match(branchInfo.GetTypeName())
if match:
self.type = match.group(1)
else:
raise ValueError('Not edm::Wrapper')
name = trailingDotRE.sub('', branchInfo.GetName())
pieces = underscoreRE.split(name)
if len(pieces) !... | Branch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Branch:
def __init__(self, branchInfo, regexList=None):
"""Takes the needed information from Root's Branch Info"""
<|body_0|>
def __str__(self):
"""String representation"""
<|body_1|>
def _setForm(branchList):
"""Loop through lists and set widths... | stack_v2_sparse_classes_10k_train_008170 | 9,332 | permissive | [
{
"docstring": "Takes the needed information from Root's Branch Info",
"name": "__init__",
"signature": "def __init__(self, branchInfo, regexList=None)"
},
{
"docstring": "String representation",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Loop through ... | 4 | null | Implement the Python class `Branch` described below.
Class description:
Implement the Branch class.
Method signatures and docstrings:
- def __init__(self, branchInfo, regexList=None): Takes the needed information from Root's Branch Info
- def __str__(self): String representation
- def _setForm(branchList): Loop throu... | Implement the Python class `Branch` described below.
Class description:
Implement the Branch class.
Method signatures and docstrings:
- def __init__(self, branchInfo, regexList=None): Takes the needed information from Root's Branch Info
- def __str__(self): String representation
- def _setForm(branchList): Loop throu... | 19c178740257eb48367778593da55dcad08b7a4f | <|skeleton|>
class Branch:
def __init__(self, branchInfo, regexList=None):
"""Takes the needed information from Root's Branch Info"""
<|body_0|>
def __str__(self):
"""String representation"""
<|body_1|>
def _setForm(branchList):
"""Loop through lists and set widths... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Branch:
def __init__(self, branchInfo, regexList=None):
"""Takes the needed information from Root's Branch Info"""
match = wrapperRE.match(branchInfo.GetTypeName())
if match:
self.type = match.group(1)
else:
raise ValueError('Not edm::Wrapper')
n... | the_stack_v2_python_sparse | FWCore/PythonUtilities/scripts/edmDumpEventContent | cms-sw/cmssw | train | 1,006 | |
2496f123b0ff1cae7a4473d613161b865ab51d26 | [
"if not email or not password:\n raise ValueError\nself.setOpener()\nurl_login = 'http://mp.weixin.qq.com/cgi-bin/login?lang=en_US'\nm = hashlib.md5(password[0:16])\nm.digest()\npassword = m.hexdigest()\nbody = (('username', email), ('pwd', password), ('imgcode', ''), ('f', 'json'))\ntry:\n msg = json.loads(s... | <|body_start_0|>
if not email or not password:
raise ValueError
self.setOpener()
url_login = 'http://mp.weixin.qq.com/cgi-bin/login?lang=en_US'
m = hashlib.md5(password[0:16])
m.digest()
password = m.hexdigest()
body = (('username', email), ('pwd', pas... | Client | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Client:
def __init__(self, email=None, password=None):
"""登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:"""
<|body_0|>
def sendTextMsg(self, sendTo, content):
"""给用户发送文字内容,成功返回True,使用时注意两次发送间隔,不能少于2s :param sendTo: :param content: :return:"""
... | stack_v2_sparse_classes_10k_train_008171 | 3,428 | permissive | [
{
"docstring": "登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:",
"name": "__init__",
"signature": "def __init__(self, email=None, password=None)"
},
{
"docstring": "给用户发送文字内容,成功返回True,使用时注意两次发送间隔,不能少于2s :param sendTo: :param content: :return:",
"name": "sendTextMsg",
"s... | 3 | null | Implement the Python class `Client` described below.
Class description:
Implement the Client class.
Method signatures and docstrings:
- def __init__(self, email=None, password=None): 登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:
- def sendTextMsg(self, sendTo, content): 给用户发送文字内容,成功返回True,使用时注意两次发送... | Implement the Python class `Client` described below.
Class description:
Implement the Client class.
Method signatures and docstrings:
- def __init__(self, email=None, password=None): 登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:
- def sendTextMsg(self, sendTo, content): 给用户发送文字内容,成功返回True,使用时注意两次发送... | 665d39a2bd82543d5196555f0801ef8fd4a3ee48 | <|skeleton|>
class Client:
def __init__(self, email=None, password=None):
"""登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:"""
<|body_0|>
def sendTextMsg(self, sendTo, content):
"""给用户发送文字内容,成功返回True,使用时注意两次发送间隔,不能少于2s :param sendTo: :param content: :return:"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Client:
def __init__(self, email=None, password=None):
"""登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:"""
if not email or not password:
raise ValueError
self.setOpener()
url_login = 'http://mp.weixin.qq.com/cgi-bin/login?lang=en_US'
m = h... | the_stack_v2_python_sparse | all-gists/5168051/snippet.py | gistable/gistable | train | 76 | |
6f04299c050564dc1dbac7eedee78161e389c0bb | [
"forest_predictions = self._base_estimator_predictions(X)\nif self._models_parameters.normalize_D:\n forest_predictions /= self._forest_norms\nreturn self._omp.predict(forest_predictions, forest_size)",
"forest_predictions = self._base_estimator_predictions(X)\nif forest_size is not None:\n weights = self._... | <|body_start_0|>
forest_predictions = self._base_estimator_predictions(X)
if self._models_parameters.normalize_D:
forest_predictions /= self._forest_norms
return self._omp.predict(forest_predictions, forest_size)
<|end_body_0|>
<|body_start_1|>
forest_predictions = self._bas... | NonNegativeOmpForestBinaryClassifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonNegativeOmpForestBinaryClassifier:
def predict(self, X, forest_size=None):
"""Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:"""
<|body_0|>
def predict_no_weights(self, X, forest_size=None):
"... | stack_v2_sparse_classes_10k_train_008172 | 5,444 | permissive | [
{
"docstring": "Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:",
"name": "predict",
"signature": "def predict(self, X, forest_size=None)"
},
{
"docstring": "Make a prediction of the selected trees but without weight. If for... | 3 | stack_v2_sparse_classes_30k_train_000414 | Implement the Python class `NonNegativeOmpForestBinaryClassifier` described below.
Class description:
Implement the NonNegativeOmpForestBinaryClassifier class.
Method signatures and docstrings:
- def predict(self, X, forest_size=None): Make prediction. If forest_size is None return the list of predictions of all inte... | Implement the Python class `NonNegativeOmpForestBinaryClassifier` described below.
Class description:
Implement the NonNegativeOmpForestBinaryClassifier class.
Method signatures and docstrings:
- def predict(self, X, forest_size=None): Make prediction. If forest_size is None return the list of predictions of all inte... | 64ba63c01bd04f4f959d18aff27e245d8fff3403 | <|skeleton|>
class NonNegativeOmpForestBinaryClassifier:
def predict(self, X, forest_size=None):
"""Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:"""
<|body_0|>
def predict_no_weights(self, X, forest_size=None):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NonNegativeOmpForestBinaryClassifier:
def predict(self, X, forest_size=None):
"""Make prediction. If forest_size is None return the list of predictions of all intermediate solutions :param X: :return:"""
forest_predictions = self._base_estimator_predictions(X)
if self._models_parameter... | the_stack_v2_python_sparse | code/bolsonaro/models/nn_omp_forest_classifier.py | swasun/RFOMT | train | 2 | |
8f628d9883f132531e7589e207ab2ae7091bff3e | [
"if len(arg_str) < 1:\n raise gdb.GdbError(\"ERROR: '%s' requires an argument.\" % name)\n return False\nelse:\n return True",
"try:\n return gdb.parse_and_eval('(%s *)0' % type_str).type.target()\nexcept RuntimeError:\n try:\n return gdb.lookup_type(type_str)\n except RuntimeError:\n ... | <|body_start_0|>
if len(arg_str) < 1:
raise gdb.GdbError("ERROR: '%s' requires an argument." % name)
return False
else:
return True
<|end_body_0|>
<|body_start_1|>
try:
return gdb.parse_and_eval('(%s *)0' % type_str).type.target()
except R... | Internal class which provides utilities for the main command classes. | ExploreUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExploreUtils:
"""Internal class which provides utilities for the main command classes."""
def check_args(name, arg_str):
"""Utility to check if adequate number of arguments are passed to an explore command. Arguments: name: The name of the explore command. arg_str: The argument strin... | stack_v2_sparse_classes_10k_train_008173 | 26,692 | permissive | [
{
"docstring": "Utility to check if adequate number of arguments are passed to an explore command. Arguments: name: The name of the explore command. arg_str: The argument string passed to the explore command. Returns: True if adequate arguments are passed, false otherwise. Raises: gdb.GdbError if adequate argum... | 3 | stack_v2_sparse_classes_30k_train_003776 | Implement the Python class `ExploreUtils` described below.
Class description:
Internal class which provides utilities for the main command classes.
Method signatures and docstrings:
- def check_args(name, arg_str): Utility to check if adequate number of arguments are passed to an explore command. Arguments: name: The... | Implement the Python class `ExploreUtils` described below.
Class description:
Internal class which provides utilities for the main command classes.
Method signatures and docstrings:
- def check_args(name, arg_str): Utility to check if adequate number of arguments are passed to an explore command. Arguments: name: The... | b90664de0bd4c1897a9f1f5d9e360a9631d38b34 | <|skeleton|>
class ExploreUtils:
"""Internal class which provides utilities for the main command classes."""
def check_args(name, arg_str):
"""Utility to check if adequate number of arguments are passed to an explore command. Arguments: name: The name of the explore command. arg_str: The argument strin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExploreUtils:
"""Internal class which provides utilities for the main command classes."""
def check_args(name, arg_str):
"""Utility to check if adequate number of arguments are passed to an explore command. Arguments: name: The name of the explore command. arg_str: The argument string passed to t... | the_stack_v2_python_sparse | toolchain/riscv/Linux/share/gdb/python/gdb/command/explore.py | bouffalolab/bl_iot_sdk | train | 244 |
21e8d5a6898928e2152dbd0ef0a141912c4d703d | [
"if self.action in ['create', 'list']:\n permission_classes = [permissions.IsUserFromUnitReferralRequesters | permissions.IsRequestReferralLinkedUser | permissions.IsRequestReferralLinkedUnitMember]\nelif self.action in ['retrieve']:\n permission_classes = [permissions.IsLinkedReferralLinkedUser | permissions... | <|body_start_0|>
if self.action in ['create', 'list']:
permission_classes = [permissions.IsUserFromUnitReferralRequesters | permissions.IsRequestReferralLinkedUser | permissions.IsRequestReferralLinkedUnitMember]
elif self.action in ['retrieve']:
permission_classes = [permissions... | API endpoints for referral messages. | ReferralMessageViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReferralMessageViewSet:
"""API endpoints for referral messages."""
def get_permissions(self):
"""Manage permissions for default methods separately, delegating to @action defined permissions for other actions."""
<|body_0|>
def create(self, request, *args, **kwargs):
... | stack_v2_sparse_classes_10k_train_008174 | 4,228 | permissive | [
{
"docstring": "Manage permissions for default methods separately, delegating to @action defined permissions for other actions.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Create a new referral message as the client issues a POST on the referralmessag... | 3 | stack_v2_sparse_classes_30k_val_000345 | Implement the Python class `ReferralMessageViewSet` described below.
Class description:
API endpoints for referral messages.
Method signatures and docstrings:
- def get_permissions(self): Manage permissions for default methods separately, delegating to @action defined permissions for other actions.
- def create(self,... | Implement the Python class `ReferralMessageViewSet` described below.
Class description:
API endpoints for referral messages.
Method signatures and docstrings:
- def get_permissions(self): Manage permissions for default methods separately, delegating to @action defined permissions for other actions.
- def create(self,... | 22e4afa728a851bb4c2479fbb6f5944a75984b9b | <|skeleton|>
class ReferralMessageViewSet:
"""API endpoints for referral messages."""
def get_permissions(self):
"""Manage permissions for default methods separately, delegating to @action defined permissions for other actions."""
<|body_0|>
def create(self, request, *args, **kwargs):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReferralMessageViewSet:
"""API endpoints for referral messages."""
def get_permissions(self):
"""Manage permissions for default methods separately, delegating to @action defined permissions for other actions."""
if self.action in ['create', 'list']:
permission_classes = [permi... | the_stack_v2_python_sparse | src/backend/partaj/core/api/referral_message.py | MTES-MCT/partaj | train | 4 |
5e3c1767da85fc9a11cfda502c01d8108d32e1b2 | [
"self.nums = nums\nself.reset = lambda: nums\nprint(self.reset)",
"res = ListNode(0)\ntemp = self.head[:]\nwhile temp:\n ran = random.randrange(len(temp))\n res.append(temp[ran])\n temp.remove(temp[ran])\nreturn res"
] | <|body_start_0|>
self.nums = nums
self.reset = lambda: nums
print(self.reset)
<|end_body_0|>
<|body_start_1|>
res = ListNode(0)
temp = self.head[:]
while temp:
ran = random.randrange(len(temp))
res.append(temp[ran])
temp.remove(temp[ra... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, head):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode"""
<|body_0|>
def getRandom(self):
""":rtype: List[int] randomly generate a number corre... | stack_v2_sparse_classes_10k_train_008175 | 1,098 | no_license | [
{
"docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode",
"name": "__init__",
"signature": "def __init__(self, head)"
},
{
"docstring": ":rtype: List[int] randomly generate a number corresponding ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode
- def getRan... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode
- def getRan... | f3fc71f344cd758cfce77f16ab72992c99ab288e | <|skeleton|>
class Solution:
def __init__(self, head):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode"""
<|body_0|>
def getRandom(self):
""":rtype: List[int] randomly generate a number corre... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, head):
"""@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode"""
self.nums = nums
self.reset = lambda: nums
print(self.reset)
def getRandom(self):
"... | the_stack_v2_python_sparse | 382_linkedListShuffle.py | jennyChing/leetCode | train | 2 | |
4fd5b3dd8426deaa626db5224b69d9e336256732 | [
"pub = self.publication\nmodel_mod = importlib.import_module(pub.model_module)\nmodel_cls = getattr(model_mod, pub.model_class)\ntmpl_mod = importlib.import_module(pub.template_module)\ntmpl_cls = getattr(tmpl_mod, pub.template_class)\nqs = self.exec_query(model_cls).aggregate(ids=ArrayAgg('id'))\nself.queryset = q... | <|body_start_0|>
pub = self.publication
model_mod = importlib.import_module(pub.model_module)
model_cls = getattr(model_mod, pub.model_class)
tmpl_mod = importlib.import_module(pub.template_module)
tmpl_cls = getattr(tmpl_mod, pub.template_class)
qs = self.exec_query(mode... | A subscription is an object representing the relation between a client and a publication. It also stores the _id of the component that subscribes to a given publication, and the queryset computed from that publication query. This queryset is computed per-subscription to permit user specific sets After being instanciate... | Subscriptions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subscriptions:
"""A subscription is an object representing the relation between a client and a publication. It also stores the _id of the component that subscribes to a given publication, and the queryset computed from that publication query. This queryset is computed per-subscription to permit u... | stack_v2_sparse_classes_10k_train_008176 | 5,014 | no_license | [
{
"docstring": "This method is used to populate the component which made the current subsription with its content, and to compute the queryset for the first time. This part is subject to near changes when SSR will be implemented",
"name": "init",
"signature": "def init(self)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_001003 | Implement the Python class `Subscriptions` described below.
Class description:
A subscription is an object representing the relation between a client and a publication. It also stores the _id of the component that subscribes to a given publication, and the queryset computed from that publication query. This queryset i... | Implement the Python class `Subscriptions` described below.
Class description:
A subscription is an object representing the relation between a client and a publication. It also stores the _id of the component that subscribes to a given publication, and the queryset computed from that publication query. This queryset i... | 942c1198d4538990b7905e7f7a054425f61a06e9 | <|skeleton|>
class Subscriptions:
"""A subscription is an object representing the relation between a client and a publication. It also stores the _id of the component that subscribes to a given publication, and the queryset computed from that publication query. This queryset is computed per-subscription to permit u... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Subscriptions:
"""A subscription is an object representing the relation between a client and a publication. It also stores the _id of the component that subscribes to a given publication, and the queryset computed from that publication query. This queryset is computed per-subscription to permit user specific ... | the_stack_v2_python_sparse | ryzom/models.py | thommignot/Ryzom | train | 0 |
40bc44d4ee4408b3450baf557ebcb6834e047422 | [
"self.triggered = False\nfor consumable in self.properties['consumables']:\n self.listen_state(self.consumable_changed, self.app.entity_ids['vacuum'], attribute=consumable, constrain_input_boolean=self.enabled_entity_id)",
"if int(new) < self.properties['consumable_threshold']:\n if self.triggered:\n ... | <|body_start_0|>
self.triggered = False
for consumable in self.properties['consumables']:
self.listen_state(self.consumable_changed, self.app.entity_ids['vacuum'], attribute=consumable, constrain_input_boolean=self.enabled_entity_id)
<|end_body_0|>
<|body_start_1|>
if int(new) < sel... | Define a feature to notify when a consumable gets low. | MonitorConsumables | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorConsumables:
"""Define a feature to notify when a consumable gets low."""
def configure(self) -> None:
"""Configure."""
<|body_0|>
def consumable_changed(self, entity: Union[str, dict], attribute: str, old: str, new: str, kwargs: dict) -> None:
"""Create a... | stack_v2_sparse_classes_10k_train_008177 | 11,578 | no_license | [
{
"docstring": "Configure.",
"name": "configure",
"signature": "def configure(self) -> None"
},
{
"docstring": "Create a task when a consumable is getting low.",
"name": "consumable_changed",
"signature": "def consumable_changed(self, entity: Union[str, dict], attribute: str, old: str, n... | 2 | stack_v2_sparse_classes_30k_train_002716 | Implement the Python class `MonitorConsumables` described below.
Class description:
Define a feature to notify when a consumable gets low.
Method signatures and docstrings:
- def configure(self) -> None: Configure.
- def consumable_changed(self, entity: Union[str, dict], attribute: str, old: str, new: str, kwargs: di... | Implement the Python class `MonitorConsumables` described below.
Class description:
Define a feature to notify when a consumable gets low.
Method signatures and docstrings:
- def configure(self) -> None: Configure.
- def consumable_changed(self, entity: Union[str, dict], attribute: str, old: str, new: str, kwargs: di... | b661f985d15af90ec7ef6a8b1a1547853b2a5d97 | <|skeleton|>
class MonitorConsumables:
"""Define a feature to notify when a consumable gets low."""
def configure(self) -> None:
"""Configure."""
<|body_0|>
def consumable_changed(self, entity: Union[str, dict], attribute: str, old: str, new: str, kwargs: dict) -> None:
"""Create a... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MonitorConsumables:
"""Define a feature to notify when a consumable gets low."""
def configure(self) -> None:
"""Configure."""
self.triggered = False
for consumable in self.properties['consumables']:
self.listen_state(self.consumable_changed, self.app.entity_ids['vacuu... | the_stack_v2_python_sparse | appdaemon/settings/apps/wolfie.py | buyfuturetoday/smart-home | train | 0 |
52997b71e2d928cd315df8a64ee48a08cd332729 | [
"n = len(A)\nif n < 3:\n return 0\nd = [A[i] - A[i - 1] for i in range(1, n)]\ni = 0\nj = 0\ncnts = []\nm = n - 1\nwhile i <= j and j < m:\n while j < m and d[j] == d[i]:\n j += 1\n if j == m:\n cnt = m - 1 - i + 2\n if cnt >= 3:\n cnts.append(cnt)\n break\n cnt = ... | <|body_start_0|>
n = len(A)
if n < 3:
return 0
d = [A[i] - A[i - 1] for i in range(1, n)]
i = 0
j = 0
cnts = []
m = n - 1
while i <= j and j < m:
while j < m and d[j] == d[i]:
j += 1
if j == m:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numberOfArithmeticSlices(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def nas(self, n):
"""return number of arithmetic sequence for [1,2,...,n]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(A)
if n < 3:
... | stack_v2_sparse_classes_10k_train_008178 | 2,973 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int",
"name": "numberOfArithmeticSlices",
"signature": "def numberOfArithmeticSlices(self, A)"
},
{
"docstring": "return number of arithmetic sequence for [1,2,...,n]",
"name": "nas",
"signature": "def nas(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfArithmeticSlices(self, A): :type A: List[int] :rtype: int
- def nas(self, n): return number of arithmetic sequence for [1,2,...,n] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numberOfArithmeticSlices(self, A): :type A: List[int] :rtype: int
- def nas(self, n): return number of arithmetic sequence for [1,2,...,n]
<|skeleton|>
class Solution:
... | e00cf94c5b86c8cca27e3bee69ad21e727b7679b | <|skeleton|>
class Solution:
def numberOfArithmeticSlices(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def nas(self, n):
"""return number of arithmetic sequence for [1,2,...,n]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numberOfArithmeticSlices(self, A):
""":type A: List[int] :rtype: int"""
n = len(A)
if n < 3:
return 0
d = [A[i] - A[i - 1] for i in range(1, n)]
i = 0
j = 0
cnts = []
m = n - 1
while i <= j and j < m:
... | the_stack_v2_python_sparse | dp/prob413.py | binchen15/leet-python | train | 1 | |
74e18c46b02e2e1121b4867ea3509ee260bdade2 | [
"logger.info(u'开始执行测试用例:用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置')\nlogger.info(u'开始登录操作...')\nself.assertTrue(self.user_login_success())\nlogger.info(' 正在获得用例期望值...')\nexpected_value = get_expected_value('008')\nlogger.info('正在获得截图标题...')\ntitle = get_image_title('008')\nlogger.info('生成截图中...')\ninsert_img(self.driv... | <|body_start_0|>
logger.info(u'开始执行测试用例:用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置')
logger.info(u'开始登录操作...')
self.assertTrue(self.user_login_success())
logger.info(' 正在获得用例期望值...')
expected_value = get_expected_value('008')
logger.info('正在获得截图标题...')
title = get_ima... | mp 登录首页页面元素数据检查 | MainPageCheckTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainPageCheckTest:
"""mp 登录首页页面元素数据检查"""
def test_008_loc(self):
"""用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置"""
<|body_0|>
def test_009_service_name(self):
"""用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称"""
<|body_1|>
def test_010_service_id(self):
... | stack_v2_sparse_classes_10k_train_008179 | 3,860 | no_license | [
{
"docstring": "用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置",
"name": "test_008_loc",
"signature": "def test_008_loc(self)"
},
{
"docstring": "用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称",
"name": "test_009_service_name",
"signature": "def test_009_service_name(self)"
},
{
"docstring": "用... | 4 | stack_v2_sparse_classes_30k_train_006794 | Implement the Python class `MainPageCheckTest` described below.
Class description:
mp 登录首页页面元素数据检查
Method signatures and docstrings:
- def test_008_loc(self): 用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置
- def test_009_service_name(self): 用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称
- def test_010_service_id(self): 用例编号010:mp登录... | Implement the Python class `MainPageCheckTest` described below.
Class description:
mp 登录首页页面元素数据检查
Method signatures and docstrings:
- def test_008_loc(self): 用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置
- def test_009_service_name(self): 用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称
- def test_010_service_id(self): 用例编号010:mp登录... | 5db7dc1a10100721180f0cc66e4c96479ec69501 | <|skeleton|>
class MainPageCheckTest:
"""mp 登录首页页面元素数据检查"""
def test_008_loc(self):
"""用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置"""
<|body_0|>
def test_009_service_name(self):
"""用例编号009:mp登录-用户名密码正确,且绑定了公众号,登录后检查公众号名称"""
<|body_1|>
def test_010_service_id(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MainPageCheckTest:
"""mp 登录首页页面元素数据检查"""
def test_008_loc(self):
"""用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置"""
logger.info(u'开始执行测试用例:用例编号008:mp登录-用户名密码正确,且绑定了公众号,登录后检查首页位置')
logger.info(u'开始登录操作...')
self.assertTrue(self.user_login_success())
logger.info(' 正在获得用例期望... | the_stack_v2_python_sparse | mp/test_model/test_case/main_page_check_test.py | eatingM/kk_mp | train | 0 |
a43cc8cb6d615a7d41d1d76a159b17981ee671af | [
"super().__init__(hyperparameter_space, config_count, epoch, 1, 3)\nself.sieve_columns = ['rung_id', 'config_id', 'status']\nfor i in range(0, object_count):\n self.sieve_columns.append('score_{}'.format(i))\nself.sieve_board = pd.DataFrame(columns=self.sieve_columns)\nself.max_object_ids = None\nif isinstance(m... | <|body_start_0|>
super().__init__(hyperparameter_space, config_count, epoch, 1, 3)
self.sieve_columns = ['rung_id', 'config_id', 'status']
for i in range(0, object_count):
self.sieve_columns.append('score_{}'.format(i))
self.sieve_board = pd.DataFrame(columns=self.sieve_colum... | Random Pareto Search from a given search hyperparameter_space. :param hyperparameter_space: a pre-defined search space. :type hyperparameter_space: object, instance os `HyperparameterSpace`. :param int config_count: Total config or hyperparameter count. :param int epoch: init epoch for each propose. :param int object_c... | RandomPareto | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomPareto:
"""Random Pareto Search from a given search hyperparameter_space. :param hyperparameter_space: a pre-defined search space. :type hyperparameter_space: object, instance os `HyperparameterSpace`. :param int config_count: Total config or hyperparameter count. :param int epoch: init epo... | stack_v2_sparse_classes_10k_train_008180 | 5,367 | permissive | [
{
"docstring": "Init random pareto search.",
"name": "__init__",
"signature": "def __init__(self, hyperparameter_space, config_count, epoch, object_count=2, max_object_ids=[])"
},
{
"docstring": "Get current config list located in pareto front. :return: list of dict {'config_id': int, 'score': f... | 5 | stack_v2_sparse_classes_30k_train_006940 | Implement the Python class `RandomPareto` described below.
Class description:
Random Pareto Search from a given search hyperparameter_space. :param hyperparameter_space: a pre-defined search space. :type hyperparameter_space: object, instance os `HyperparameterSpace`. :param int config_count: Total config or hyperpara... | Implement the Python class `RandomPareto` described below.
Class description:
Random Pareto Search from a given search hyperparameter_space. :param hyperparameter_space: a pre-defined search space. :type hyperparameter_space: object, instance os `HyperparameterSpace`. :param int config_count: Total config or hyperpara... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class RandomPareto:
"""Random Pareto Search from a given search hyperparameter_space. :param hyperparameter_space: a pre-defined search space. :type hyperparameter_space: object, instance os `HyperparameterSpace`. :param int config_count: Total config or hyperparameter count. :param int epoch: init epo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomPareto:
"""Random Pareto Search from a given search hyperparameter_space. :param hyperparameter_space: a pre-defined search space. :type hyperparameter_space: object, instance os `HyperparameterSpace`. :param int config_count: Total config or hyperparameter count. :param int epoch: init epoch for each p... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/algorithms/hpo/common/random_pareto.py | Huawei-Ascend/modelzoo | train | 1 |
f2d4f0df53102104b9e5a16cfe4d581144061d4a | [
"Gremlin().gremlin_post('graph.truncateBackend();', auth=auth)\nbody = {'group_name': 'gremlin', 'group_description': 'group can execute gremlin'}\ncode, res = Auth().post_groups(body, auth=auth)\nprint(code, res)\nbody = {'user_name': 'tester', 'user_password': '123456'}\ncode, res = Auth().post_users(body, auth=a... | <|body_start_0|>
Gremlin().gremlin_post('graph.truncateBackend();', auth=auth)
body = {'group_name': 'gremlin', 'group_description': 'group can execute gremlin'}
code, res = Auth().post_groups(body, auth=auth)
print(code, res)
body = {'user_name': 'tester', 'user_password': '1234... | 绑定用户和用户组 | Belongs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Belongs:
"""绑定用户和用户组"""
def setUp(self):
"""测试case开始 :resurn:"""
<|body_0|>
def test_belong_create(self):
"""创建 belong"""
<|body_1|>
def test_belong_delete(self):
"""删除 belong"""
<|body_2|>
def test_belong_list(self):
"""... | stack_v2_sparse_classes_10k_train_008181 | 17,517 | no_license | [
{
"docstring": "测试case开始 :resurn:",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "创建 belong",
"name": "test_belong_create",
"signature": "def test_belong_create(self)"
},
{
"docstring": "删除 belong",
"name": "test_belong_delete",
"signature": "def test... | 6 | stack_v2_sparse_classes_30k_val_000040 | Implement the Python class `Belongs` described below.
Class description:
绑定用户和用户组
Method signatures and docstrings:
- def setUp(self): 测试case开始 :resurn:
- def test_belong_create(self): 创建 belong
- def test_belong_delete(self): 删除 belong
- def test_belong_list(self): 获取 belongs
- def test_belong_one(self): 获取 belong
-... | Implement the Python class `Belongs` described below.
Class description:
绑定用户和用户组
Method signatures and docstrings:
- def setUp(self): 测试case开始 :resurn:
- def test_belong_create(self): 创建 belong
- def test_belong_delete(self): 删除 belong
- def test_belong_list(self): 获取 belongs
- def test_belong_one(self): 获取 belong
-... | 89e5b34ab925bcc0bbc4ad63302e96c62a420399 | <|skeleton|>
class Belongs:
"""绑定用户和用户组"""
def setUp(self):
"""测试case开始 :resurn:"""
<|body_0|>
def test_belong_create(self):
"""创建 belong"""
<|body_1|>
def test_belong_delete(self):
"""删除 belong"""
<|body_2|>
def test_belong_list(self):
"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Belongs:
"""绑定用户和用户组"""
def setUp(self):
"""测试case开始 :resurn:"""
Gremlin().gremlin_post('graph.truncateBackend();', auth=auth)
body = {'group_name': 'gremlin', 'group_description': 'group can execute gremlin'}
code, res = Auth().post_groups(body, auth=auth)
print(c... | the_stack_v2_python_sparse | src/graph_function_test/server/auth/test_auth_api.py | hugegraph/hugegraph-test | train | 1 |
9190df27fce86a01a474e84a82c0179ea9968817 | [
"name, *args = config.split(':')\navailable = []\nfor each in cls.mro():\n available.extend([name for k, name in cls._registry if k is each])\n if (each, name) in cls._registry:\n return validated_config(cls._registry[each, name](cls, *args))\nraise ValueError(f'{config} is not a valid config. Availabl... | <|body_start_0|>
name, *args = config.split(':')
available = []
for each in cls.mro():
available.extend([name for k, name in cls._registry if k is each])
if (each, name) in cls._registry:
return validated_config(cls._registry[each, name](cls, *args))
... | Base class for project configs. This class exists to simplify support of easily specifying complex configs from command line, by providing a registry of parameterized parsers to assign values to the entire nested config using simple preset values. For example config class: ``` from ml_collections import config_flags @d... | ProjectConfig | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectConfig:
"""Base class for project configs. This class exists to simplify support of easily specifying complex configs from command line, by providing a registry of parameterized parsers to assign values to the entire nested config using simple preset values. For example config class: ``` f... | stack_v2_sparse_classes_10k_train_008182 | 6,153 | permissive | [
{
"docstring": "Parses config and returns an instance of cls.",
"name": "parse_config",
"signature": "def parse_config(cls, config)"
},
{
"docstring": "Registers flag parser with a given name. This is a decorator that can be used to decorate functions that can parse configs. The parser will be i... | 2 | null | Implement the Python class `ProjectConfig` described below.
Class description:
Base class for project configs. This class exists to simplify support of easily specifying complex configs from command line, by providing a registry of parameterized parsers to assign values to the entire nested config using simple preset ... | Implement the Python class `ProjectConfig` described below.
Class description:
Base class for project configs. This class exists to simplify support of easily specifying complex configs from command line, by providing a registry of parameterized parsers to assign values to the entire nested config using simple preset ... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class ProjectConfig:
"""Base class for project configs. This class exists to simplify support of easily specifying complex configs from command line, by providing a registry of parameterized parsers to assign values to the entire nested config using simple preset values. For example config class: ``` f... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProjectConfig:
"""Base class for project configs. This class exists to simplify support of easily specifying complex configs from command line, by providing a registry of parameterized parsers to assign values to the entire nested config using simple preset values. For example config class: ``` from ml_collec... | the_stack_v2_python_sparse | wildfire_perc_sim/config.py | Jimmy-INL/google-research | train | 1 |
d3285af8240246530d8b4602ebb79bdc610586f7 | [
"self.api_url = 'http://api.douban.com/labs/bubbler/user/{}'\nself.session = Session()\nself.home_page = 'http://www.douban.com/people/{}'",
"userid = user[0]\nresult = self.session.get(self.api_url.format(userid)).json()\nself.assertEqual(result.get('id'), '1832573')\nself.assertEqual(result.get('uid'), userid)\... | <|body_start_0|>
self.api_url = 'http://api.douban.com/labs/bubbler/user/{}'
self.session = Session()
self.home_page = 'http://www.douban.com/people/{}'
<|end_body_0|>
<|body_start_1|>
userid = user[0]
result = self.session.get(self.api_url.format(userid)).json()
self.as... | test dou ban apis | TestDouBanApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDouBanApi:
"""test dou ban apis"""
def setUp(self):
"""pass"""
<|body_0|>
def test_first_user_info(self):
"""pass"""
<|body_1|>
def test_second_user_info(self):
"""pass"""
<|body_2|>
def test_third_user_info(self):
""... | stack_v2_sparse_classes_10k_train_008183 | 1,986 | no_license | [
{
"docstring": "pass",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "pass",
"name": "test_first_user_info",
"signature": "def test_first_user_info(self)"
},
{
"docstring": "pass",
"name": "test_second_user_info",
"signature": "def test_second_user_inf... | 4 | stack_v2_sparse_classes_30k_train_001055 | Implement the Python class `TestDouBanApi` described below.
Class description:
test dou ban apis
Method signatures and docstrings:
- def setUp(self): pass
- def test_first_user_info(self): pass
- def test_second_user_info(self): pass
- def test_third_user_info(self): pass | Implement the Python class `TestDouBanApi` described below.
Class description:
test dou ban apis
Method signatures and docstrings:
- def setUp(self): pass
- def test_first_user_info(self): pass
- def test_second_user_info(self): pass
- def test_third_user_info(self): pass
<|skeleton|>
class TestDouBanApi:
"""tes... | b8dd4dd6dafaf9899e97bbb75a3ef80246ec427b | <|skeleton|>
class TestDouBanApi:
"""test dou ban apis"""
def setUp(self):
"""pass"""
<|body_0|>
def test_first_user_info(self):
"""pass"""
<|body_1|>
def test_second_user_info(self):
"""pass"""
<|body_2|>
def test_third_user_info(self):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestDouBanApi:
"""test dou ban apis"""
def setUp(self):
"""pass"""
self.api_url = 'http://api.douban.com/labs/bubbler/user/{}'
self.session = Session()
self.home_page = 'http://www.douban.com/people/{}'
def test_first_user_info(self):
"""pass"""
userid... | the_stack_v2_python_sparse | fifth_week/second_day/test_douban_api.py | czkun1986/Let-s-go-python- | train | 0 |
a5a58165b6103e641547229a1f480598e0ecb48e | [
"self.myDict = {}\nself.minmaxHeap = []\nself.removed = set()",
"if key in self.myDict:\n self.myDict[key] += 1\n self.removed.add((self.myDict[key] - 1, key))\nelse:\n self.myDict[key] = 1\nhq.heappush(self.minmaxHeap, (self.myDict[key], key))",
"if key in self.myDict and self.myDict[key] > 1:\n se... | <|body_start_0|>
self.myDict = {}
self.minmaxHeap = []
self.removed = set()
<|end_body_0|>
<|body_start_1|>
if key in self.myDict:
self.myDict[key] += 1
self.removed.add((self.myDict[key] - 1, key))
else:
self.myDict[key] = 1
hq.heappu... | AllOne | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllOne:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def inc(self, key: str) -> None:
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1."""
<|body_1|>
def dec(self, key: str) -> None:
"""Decr... | stack_v2_sparse_classes_10k_train_008184 | 6,063 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a new key <Key> with value 1. Or increments an existing key by 1.",
"name": "inc",
"signature": "def inc(self, key: str) -> None"
},
{
"docstrin... | 5 | stack_v2_sparse_classes_30k_train_006629 | Implement the Python class `AllOne` described below.
Class description:
Implement the AllOne class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def inc(self, key: str) -> None: Inserts a new key <Key> with value 1. Or increments an existing key by 1.
- def dec(self, ... | Implement the Python class `AllOne` described below.
Class description:
Implement the AllOne class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def inc(self, key: str) -> None: Inserts a new key <Key> with value 1. Or increments an existing key by 1.
- def dec(self, ... | 1a961afb22f482e6b920256fa5d14154e5e1a940 | <|skeleton|>
class AllOne:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def inc(self, key: str) -> None:
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1."""
<|body_1|>
def dec(self, key: str) -> None:
"""Decr... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AllOne:
def __init__(self):
"""Initialize your data structure here."""
self.myDict = {}
self.minmaxHeap = []
self.removed = set()
def inc(self, key: str) -> None:
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1."""
if key in self... | the_stack_v2_python_sparse | Difficult/432. All O`one Data Structure.py | rghv404/leet_code | train | 0 | |
253a2a357091b0ac92a0980ab37e31c8af5e4a23 | [
"self.epochs = epochs\nself.batch_size = batch_size\nself.hidden_neurons = hidden_neurons\nself.output_neurons = output_neurons",
"input_dims = 1\nmodel = Sequential()\nmodel.add(Dense(self.hidden_neurons, activation='relu', input_shape=(input_dims,)))\nmodel.add(Dense(self.output_neurons, activation='linear'))\n... | <|body_start_0|>
self.epochs = epochs
self.batch_size = batch_size
self.hidden_neurons = hidden_neurons
self.output_neurons = output_neurons
<|end_body_0|>
<|body_start_1|>
input_dims = 1
model = Sequential()
model.add(Dense(self.hidden_neurons, activation='relu'... | ANN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ANN:
def __init__(self, epochs, batch_size, hidden_neurons, output_neurons):
"""Initialize NN settings"""
<|body_0|>
def solve(self, train_X, train_Y, test_X, test_Y):
"""Initialize NN, train and test"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_008185 | 1,636 | no_license | [
{
"docstring": "Initialize NN settings",
"name": "__init__",
"signature": "def __init__(self, epochs, batch_size, hidden_neurons, output_neurons)"
},
{
"docstring": "Initialize NN, train and test",
"name": "solve",
"signature": "def solve(self, train_X, train_Y, test_X, test_Y)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003632 | Implement the Python class `ANN` described below.
Class description:
Implement the ANN class.
Method signatures and docstrings:
- def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): Initialize NN settings
- def solve(self, train_X, train_Y, test_X, test_Y): Initialize NN, train and test | Implement the Python class `ANN` described below.
Class description:
Implement the ANN class.
Method signatures and docstrings:
- def __init__(self, epochs, batch_size, hidden_neurons, output_neurons): Initialize NN settings
- def solve(self, train_X, train_Y, test_X, test_Y): Initialize NN, train and test
<|skeleto... | 4a9e1166faa8af8b499cb90adbbaddcc93ad88e2 | <|skeleton|>
class ANN:
def __init__(self, epochs, batch_size, hidden_neurons, output_neurons):
"""Initialize NN settings"""
<|body_0|>
def solve(self, train_X, train_Y, test_X, test_Y):
"""Initialize NN, train and test"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ANN:
def __init__(self, epochs, batch_size, hidden_neurons, output_neurons):
"""Initialize NN settings"""
self.epochs = epochs
self.batch_size = batch_size
self.hidden_neurons = hidden_neurons
self.output_neurons = output_neurons
def solve(self, train_X, train_Y, t... | the_stack_v2_python_sparse | Tutorial 2/ann.py | clara2911/ANNProject | train | 1 | |
caf5ea35f2109f7f61bcc5b4961def81f1152511 | [
"n = len(prices)\nif n < 2:\n return 0\nif k >= n / 2:\n return sum((i - j for i, j in zip(prices[1:], prices[:-1]) if i - j > 0))\nglobal_max = [[0] * n for _ in xrange(k + 1)]\nfor i in xrange(1, k + 1):\n local_max = [0] * n\n for j in xrange(1, n):\n profit = prices[j] - prices[j - 1]\n ... | <|body_start_0|>
n = len(prices)
if n < 2:
return 0
if k >= n / 2:
return sum((i - j for i, j in zip(prices[1:], prices[:-1]) if i - j > 0))
global_max = [[0] * n for _ in xrange(k + 1)]
for i in xrange(1, k + 1):
local_max = [0] * n
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int beats 35.60%"""
<|body_0|>
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int beats 50.00%"""
<|body_1|>
def maxProfit2(self, ... | stack_v2_sparse_classes_10k_train_008186 | 3,377 | no_license | [
{
"docstring": ":type k: int :type prices: List[int] :rtype: int beats 35.60%",
"name": "maxProfit",
"signature": "def maxProfit(self, k, prices)"
},
{
"docstring": ":type k: int :type prices: List[int] :rtype: int beats 50.00%",
"name": "maxProfit1",
"signature": "def maxProfit1(self, k... | 3 | stack_v2_sparse_classes_30k_train_005291 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int beats 35.60%
- def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int beats 35.60%
- def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int ... | 7e0e917c15d3e35f49da3a00ef395bd5ff180d79 | <|skeleton|>
class Solution:
def maxProfit(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int beats 35.60%"""
<|body_0|>
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int beats 50.00%"""
<|body_1|>
def maxProfit2(self, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int beats 35.60%"""
n = len(prices)
if n < 2:
return 0
if k >= n / 2:
return sum((i - j for i, j in zip(prices[1:], prices[:-1]) if i - j > 0))
global_max =... | the_stack_v2_python_sparse | LeetCode/188_best_time_to_buy_and_sell_stock_IV.py | yao23/Machine_Learning_Playground | train | 12 | |
ede5a4cfa5bca266ff6aea338da80690ca3f5893 | [
"super(WotView, self).__init__(parent)\nself.setScene(Scene(self))\nself.setCacheMode(QGraphicsView.CacheBackground)\nself.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)\nself.setRenderHint(QPainter.Antialiasing)\nself.setRenderHint(QPainter.SmoothPixmapTransform)",
"if event.modifiers() & Qt.Con... | <|body_start_0|>
super(WotView, self).__init__(parent)
self.setScene(Scene(self))
self.setCacheMode(QGraphicsView.CacheBackground)
self.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
self.setRenderHint(QPainter.Antialiasing)
self.setRenderHint(QPainter.Sm... | WotView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WotView:
def __init__(self, parent=None):
"""Create View to display scene :param parent: [Optional, default=None] Parent widget"""
<|body_0|>
def wheelEvent(self, event: QWheelEvent):
"""Zoom in/out on the mouse cursor"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_008187 | 16,818 | permissive | [
{
"docstring": "Create View to display scene :param parent: [Optional, default=None] Parent widget",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "Zoom in/out on the mouse cursor",
"name": "wheelEvent",
"signature": "def wheelEvent(self, event: QWh... | 2 | stack_v2_sparse_classes_30k_val_000019 | Implement the Python class `WotView` described below.
Class description:
Implement the WotView class.
Method signatures and docstrings:
- def __init__(self, parent=None): Create View to display scene :param parent: [Optional, default=None] Parent widget
- def wheelEvent(self, event: QWheelEvent): Zoom in/out on the m... | Implement the Python class `WotView` described below.
Class description:
Implement the WotView class.
Method signatures and docstrings:
- def __init__(self, parent=None): Create View to display scene :param parent: [Optional, default=None] Parent widget
- def wheelEvent(self, event: QWheelEvent): Zoom in/out on the m... | 25699bae35ce9e46e0999f38548cb9d3c1ef7f3c | <|skeleton|>
class WotView:
def __init__(self, parent=None):
"""Create View to display scene :param parent: [Optional, default=None] Parent widget"""
<|body_0|>
def wheelEvent(self, event: QWheelEvent):
"""Zoom in/out on the mouse cursor"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WotView:
def __init__(self, parent=None):
"""Create View to display scene :param parent: [Optional, default=None] Parent widget"""
super(WotView, self).__init__(parent)
self.setScene(Scene(self))
self.setCacheMode(QGraphicsView.CacheBackground)
self.setViewportUpdateMod... | the_stack_v2_python_sparse | src/cutecoin/gui/views/wot.py | sethkontny/cutecoin | train | 0 | |
213d40a0ee761a9adba16e95b30d63937da0cc0d | [
"try:\n return blob_api.get_by_id(pk, request.user)\nexcept exceptions.DoesNotExist:\n raise Http404",
"try:\n blob_object = self.get_object(request, pk)\n serializer = BlobSerializer(blob_object, context={'request': request})\n return Response(serializer.data)\nexcept AccessControlError as e:\n ... | <|body_start_0|>
try:
return blob_api.get_by_id(pk, request.user)
except exceptions.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
try:
blob_object = self.get_object(request, pk)
serializer = BlobSerializer(blob_object, context={'requ... | Retrieve, update or delete a Blob | BlobDetail | [
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlobDetail:
"""Retrieve, update or delete a Blob"""
def get_object(self, request, pk):
"""Get Blob from db Args: request: HTTP request pk: ObjectId Returns: Blob"""
<|body_0|>
def get(self, request, pk):
"""Retrieve Blob Args: request: HTTP request pk: ObjectId R... | stack_v2_sparse_classes_10k_train_008188 | 11,564 | permissive | [
{
"docstring": "Get Blob from db Args: request: HTTP request pk: ObjectId Returns: Blob",
"name": "get_object",
"signature": "def get_object(self, request, pk)"
},
{
"docstring": "Retrieve Blob Args: request: HTTP request pk: ObjectId Returns: - code: 200 content: Blob - code: 403 content: Authe... | 3 | stack_v2_sparse_classes_30k_train_001619 | Implement the Python class `BlobDetail` described below.
Class description:
Retrieve, update or delete a Blob
Method signatures and docstrings:
- def get_object(self, request, pk): Get Blob from db Args: request: HTTP request pk: ObjectId Returns: Blob
- def get(self, request, pk): Retrieve Blob Args: request: HTTP r... | Implement the Python class `BlobDetail` described below.
Class description:
Retrieve, update or delete a Blob
Method signatures and docstrings:
- def get_object(self, request, pk): Get Blob from db Args: request: HTTP request pk: ObjectId Returns: Blob
- def get(self, request, pk): Retrieve Blob Args: request: HTTP r... | 568cb75a40ccff1d74a1a757866112535efd769a | <|skeleton|>
class BlobDetail:
"""Retrieve, update or delete a Blob"""
def get_object(self, request, pk):
"""Get Blob from db Args: request: HTTP request pk: ObjectId Returns: Blob"""
<|body_0|>
def get(self, request, pk):
"""Retrieve Blob Args: request: HTTP request pk: ObjectId R... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BlobDetail:
"""Retrieve, update or delete a Blob"""
def get_object(self, request, pk):
"""Get Blob from db Args: request: HTTP request pk: ObjectId Returns: Blob"""
try:
return blob_api.get_by_id(pk, request.user)
except exceptions.DoesNotExist:
raise Http4... | the_stack_v2_python_sparse | core_main_app/rest/blob/views.py | adilmania/core_main_app | train | 0 |
f4fbd258fed56e1a5299cbaa58ff581a312778ed | [
"self.num_categoricals = get_num_z_categoricals(model_size, override=num_categoricals)\nself.num_classes_per_categorical = get_num_z_classes(model_size, override=num_classes_per_categorical)\nsuper().__init__(name=f'z{self.num_categoricals}x{self.num_classes_per_categorical}')\nself.z_generating_layer = tf.keras.la... | <|body_start_0|>
self.num_categoricals = get_num_z_categoricals(model_size, override=num_categoricals)
self.num_classes_per_categorical = get_num_z_classes(model_size, override=num_classes_per_categorical)
super().__init__(name=f'z{self.num_categoricals}x{self.num_classes_per_categorical}')
... | A representation (z-state) generating layer. The value for z is the result of sampling from a categorical distribution with shape B x `num_classes`. So a computed z-state consists of `num_categoricals` one-hot vectors, each of size `num_classes_per_categorical`. | RepresentationLayer | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepresentationLayer:
"""A representation (z-state) generating layer. The value for z is the result of sampling from a categorical distribution with shape B x `num_classes`. So a computed z-state consists of `num_categoricals` one-hot vectors, each of size `num_classes_per_categorical`."""
de... | stack_v2_sparse_classes_10k_train_008189 | 5,719 | permissive | [
{
"docstring": "Initializes a RepresentationLayer instance. Args: model_size: The \"Model Size\" used according to [1] Appendinx B. Use None for manually setting the different parameters. num_categoricals: Overrides the number of categoricals used in the z-states. In [1], 32 is used for any model size. num_clas... | 2 | null | Implement the Python class `RepresentationLayer` described below.
Class description:
A representation (z-state) generating layer. The value for z is the result of sampling from a categorical distribution with shape B x `num_classes`. So a computed z-state consists of `num_categoricals` one-hot vectors, each of size `n... | Implement the Python class `RepresentationLayer` described below.
Class description:
A representation (z-state) generating layer. The value for z is the result of sampling from a categorical distribution with shape B x `num_classes`. So a computed z-state consists of `num_categoricals` one-hot vectors, each of size `n... | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | <|skeleton|>
class RepresentationLayer:
"""A representation (z-state) generating layer. The value for z is the result of sampling from a categorical distribution with shape B x `num_classes`. So a computed z-state consists of `num_categoricals` one-hot vectors, each of size `num_classes_per_categorical`."""
de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RepresentationLayer:
"""A representation (z-state) generating layer. The value for z is the result of sampling from a categorical distribution with shape B x `num_classes`. So a computed z-state consists of `num_categoricals` one-hot vectors, each of size `num_classes_per_categorical`."""
def __init__(se... | the_stack_v2_python_sparse | rllib/algorithms/dreamerv3/tf/models/components/representation_layer.py | ray-project/ray | train | 29,482 |
f0bdb5c89ea3cac0fd7c792e4187c8565164e69f | [
"v1, v2 = edge\nif self.has_vertex(v1) and self.has_vertex(v2):\n self.matrix[v1][v2] = weight\nelse:\n raise Exception('Vertices of the edge must be contained in the graph')",
"if self.has_edge(edge):\n v1, v2 = edge\n self.matrix[v1][v2] = None\nelse:\n raise Exception('Edge must be contained in ... | <|body_start_0|>
v1, v2 = edge
if self.has_vertex(v1) and self.has_vertex(v2):
self.matrix[v1][v2] = weight
else:
raise Exception('Vertices of the edge must be contained in the graph')
<|end_body_0|>
<|body_start_1|>
if self.has_edge(edge):
v1, v2 = e... | OrientedIncidenceMatrixGraph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrientedIncidenceMatrixGraph:
def insert_edge(self, edge, weight):
"""Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example... | stack_v2_sparse_classes_10k_train_008190 | 1,265 | no_license | [
{
"docstring": "Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example: graph.insert_edge([0, 3], 5) - connects vertices 0 and 3 with an edge of wei... | 2 | stack_v2_sparse_classes_30k_test_000384 | Implement the Python class `OrientedIncidenceMatrixGraph` described below.
Class description:
Implement the OrientedIncidenceMatrixGraph class.
Method signatures and docstrings:
- def insert_edge(self, edge, weight): Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight ... | Implement the Python class `OrientedIncidenceMatrixGraph` described below.
Class description:
Implement the OrientedIncidenceMatrixGraph class.
Method signatures and docstrings:
- def insert_edge(self, edge, weight): Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight ... | 6fdc5b93e9ceca17fc3ad522ed7243e51709d7ec | <|skeleton|>
class OrientedIncidenceMatrixGraph:
def insert_edge(self, edge, weight):
"""Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrientedIncidenceMatrixGraph:
def insert_edge(self, edge, weight):
"""Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example: graph.insert... | the_stack_v2_python_sparse | Lab6/graph/oriented_incidence_matrix_graph.py | DenisKruglik/Algorithms | train | 1 | |
e862c6e35a6158cd6945086f02e813432025ad34 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.mailSearchFolder'.casefold():\n from .ma... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | MailFolder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MailFolder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailFolder:
"""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: Mail... | stack_v2_sparse_classes_10k_train_008191 | 6,619 | 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: MailFolder",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pa... | 3 | stack_v2_sparse_classes_30k_train_000357 | Implement the Python class `MailFolder` described below.
Class description:
Implement the MailFolder class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailFolder: Creates a new instance of the appropriate class based on discriminator value Args: pa... | Implement the Python class `MailFolder` described below.
Class description:
Implement the MailFolder class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailFolder: Creates a new instance of the appropriate class based on discriminator value Args: pa... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class MailFolder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailFolder:
"""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: Mail... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MailFolder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailFolder:
"""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: MailFolder"""
... | the_stack_v2_python_sparse | msgraph/generated/models/mail_folder.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
88f0c96ae54c8810920b11236cc288b05059c353 | [
"prod = [1 for _ in range(len(nums))]\ntmp = 1\nfor i in range(len(nums)):\n prod[i] = tmp\n tmp *= nums[i]\ntmp = 1\nfor i in reversed(range(len(nums))):\n prod[i] *= tmp\n tmp *= nums[i]\nreturn prod",
"left, right = ([1 for _ in range(len(nums))], [1 for _ in range(len(nums))])\nfor i in range(1, l... | <|body_start_0|>
prod = [1 for _ in range(len(nums))]
tmp = 1
for i in range(len(nums)):
prod[i] = tmp
tmp *= nums[i]
tmp = 1
for i in reversed(range(len(nums))):
prod[i] *= tmp
tmp *= nums[i]
return prod
<|end_body_0|>
<|b... | Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. return multiply of `left` and `right` | Solution | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. return multiply of `left` and `right`"""
... | stack_v2_sparse_classes_10k_train_008192 | 1,594 | permissive | [
{
"docstring": "Time Complexity: O(n) Space Complexity: O(n) Auxiliary Space: O(1)",
"name": "crack",
"signature": "def crack(self, nums)"
},
{
"docstring": "Time Complexity: O(n) Space Complexity: O(n) Auxiliary Space: O(n)",
"name": "crack2",
"signature": "def crack2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001228 | Implement the Python class `Solution` described below.
Class description:
Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. retu... | Implement the Python class `Solution` described below.
Class description:
Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. retu... | 812859a982da666daecedbb1197afed21485a432 | <|skeleton|>
class Solution:
"""Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. return multiply of `left` and `right`"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""Algorithm: 1. Construct `left`, with `left[i]` contains product of all elements on `left` of `nums[i]` excluding `nums[i]` 2. Construct `right`, with `right[i]` contains product of all elements on `right` of `nums[i]` excluding `nums[i]` 3. return multiply of `left` and `right`"""
def crack(... | the_stack_v2_python_sparse | dcp/002/solution.py | dantin/daylight | train | 0 |
6b8eb61529efe07a400cf6b1ca9a4fcdf2a56e87 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CallRecordingEventMessageDetail()",
"from .call_recording_status import CallRecordingStatus\nfrom .event_message_detail import EventMessageDetail\nfrom .identity_set import IdentitySet\nfrom .call_recording_status import CallRecordingS... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return CallRecordingEventMessageDetail()
<|end_body_0|>
<|body_start_1|>
from .call_recording_status import CallRecordingStatus
from .event_message_detail import EventMessageDetail
from... | CallRecordingEventMessageDetail | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CallRecordingEventMessageDetail:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CallRecordingEventMessageDetail:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator... | stack_v2_sparse_classes_10k_train_008193 | 4,271 | 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: CallRecordingEventMessageDetail",
"name": "create_from_discriminator_value",
"signature": "def create_from_d... | 3 | stack_v2_sparse_classes_30k_train_004240 | Implement the Python class `CallRecordingEventMessageDetail` described below.
Class description:
Implement the CallRecordingEventMessageDetail class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CallRecordingEventMessageDetail: Creates a new instance... | Implement the Python class `CallRecordingEventMessageDetail` described below.
Class description:
Implement the CallRecordingEventMessageDetail class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CallRecordingEventMessageDetail: Creates a new instance... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class CallRecordingEventMessageDetail:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CallRecordingEventMessageDetail:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CallRecordingEventMessageDetail:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CallRecordingEventMessageDetail:
"""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 cre... | the_stack_v2_python_sparse | msgraph/generated/models/call_recording_event_message_detail.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
311b4c55f3f2c3d0fbc1a9d7913350227fabc42a | [
"prog = sf.TDMProgram(2)\neng = sf.Engine('gaussian')\nwith prog.context([1, 2], [3, 4]) as (p, q):\n ops.Sgate(p[0]) | q[0]\n ops.MeasureHomodyne(p[1]) | q[0]\nresults = eng.run(prog)\nassert results.samples.shape[0] == 1",
"prog = sf.TDMProgram(2)\neng = sf.Engine('gaussian')\nwith prog.context([1, 2], [3... | <|body_start_0|>
prog = sf.TDMProgram(2)
eng = sf.Engine('gaussian')
with prog.context([1, 2], [3, 4]) as (p, q):
ops.Sgate(p[0]) | q[0]
ops.MeasureHomodyne(p[1]) | q[0]
results = eng.run(prog)
assert results.samples.shape[0] == 1
<|end_body_0|>
<|body_st... | Test the Engine class and its interaction with TDMProgram instances. | TestEngineTDMProgramInteraction | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEngineTDMProgramInteraction:
"""Test the Engine class and its interaction with TDMProgram instances."""
def test_shots_default(self):
"""Test that default shots (1) is used"""
<|body_0|>
def test_shots_run_options(self):
"""Test that run_options takes precede... | stack_v2_sparse_classes_10k_train_008194 | 29,620 | permissive | [
{
"docstring": "Test that default shots (1) is used",
"name": "test_shots_default",
"signature": "def test_shots_default(self)"
},
{
"docstring": "Test that run_options takes precedence over default",
"name": "test_shots_run_options",
"signature": "def test_shots_run_options(self)"
},
... | 3 | stack_v2_sparse_classes_30k_train_001376 | Implement the Python class `TestEngineTDMProgramInteraction` described below.
Class description:
Test the Engine class and its interaction with TDMProgram instances.
Method signatures and docstrings:
- def test_shots_default(self): Test that default shots (1) is used
- def test_shots_run_options(self): Test that run_... | Implement the Python class `TestEngineTDMProgramInteraction` described below.
Class description:
Test the Engine class and its interaction with TDMProgram instances.
Method signatures and docstrings:
- def test_shots_default(self): Test that default shots (1) is used
- def test_shots_run_options(self): Test that run_... | 0c1c805fd5dfce465a8955ee3faf81037023a23e | <|skeleton|>
class TestEngineTDMProgramInteraction:
"""Test the Engine class and its interaction with TDMProgram instances."""
def test_shots_default(self):
"""Test that default shots (1) is used"""
<|body_0|>
def test_shots_run_options(self):
"""Test that run_options takes precede... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestEngineTDMProgramInteraction:
"""Test the Engine class and its interaction with TDMProgram instances."""
def test_shots_default(self):
"""Test that default shots (1) is used"""
prog = sf.TDMProgram(2)
eng = sf.Engine('gaussian')
with prog.context([1, 2], [3, 4]) as (p, ... | the_stack_v2_python_sparse | artifacts/old_dataset_versions/original_commits/strawberryfields/strawberryfields#611/before/test_tdmprogram.py | MattePalte/Bugs-Quantum-Computing-Platforms | train | 4 |
f15618c6d8c42e77cf96bb7744d59afd4b7c162f | [
"if not hasattr(cls, 'serialize') or not hasattr(cls, 'deserialize'):\n raise ValueError(\"%s ObjectListProperty requires properties with 'serialize' and 'deserialize' methods\" % debug_info())\nself._cls = cls\nsuper(ObjectListProperty, self).__init__(str, *args, **kwargs)",
"for item in value:\n if not is... | <|body_start_0|>
if not hasattr(cls, 'serialize') or not hasattr(cls, 'deserialize'):
raise ValueError("%s ObjectListProperty requires properties with 'serialize' and 'deserialize' methods" % debug_info())
self._cls = cls
super(ObjectListProperty, self).__init__(str, *args, **kwargs)... | A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in length. For longer strings, change line with ... | ObjectListProperty | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectListProperty:
"""A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in... | stack_v2_sparse_classes_10k_train_008195 | 6,489 | no_license | [
{
"docstring": "Construct ObjectListProperty Args: cls: Class of objects in list *args: Optional additional arguments, passed to base class **kwds: Optional additional keyword arguments, passed to base class",
"name": "__init__",
"signature": "def __init__(self, cls, *args, **kwargs)"
},
{
"docs... | 4 | stack_v2_sparse_classes_30k_train_006098 | Implement the Python class `ObjectListProperty` described below.
Class description:
A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized obj... | Implement the Python class `ObjectListProperty` described below.
Class description:
A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized obj... | def411b13e61d6e369f1629a1d9c8b45e75cd382 | <|skeleton|>
class ObjectListProperty:
"""A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObjectListProperty:
"""A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in length. For ... | the_stack_v2_python_sparse | util/model.py | BarbaraEMac/Maitre-Clik | train | 0 |
fd115993a258640a5f69874c5d7cd34822113baa | [
"super(APConnect, self).__init__()\nself.nodes = nodes\nreturn",
"self.logger.info(\"Connecting '{0}' to SSID: '{1}'\".format(parameters.nodes.parameters, parameters.ssids.parameters))\nself.nodes[parameters.nodes.parameters].connect(parameters.ssids.parameters)\nreturn"
] | <|body_start_0|>
super(APConnect, self).__init__()
self.nodes = nodes
return
<|end_body_0|>
<|body_start_1|>
self.logger.info("Connecting '{0}' to SSID: '{1}'".format(parameters.nodes.parameters, parameters.ssids.parameters))
self.nodes[parameters.nodes.parameters].connect(param... | A class to connect a device to an AP | APConnect | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APConnect:
"""A class to connect a device to an AP"""
def __init__(self, nodes):
""":param: - `nodes`: dictionary of id:device pairs"""
<|body_0|>
def __call__(self, parameters):
""":param: - `parameters`: a named tuple with `nodes.parameters` and `ssids.paramete... | stack_v2_sparse_classes_10k_train_008196 | 970 | permissive | [
{
"docstring": ":param: - `nodes`: dictionary of id:device pairs",
"name": "__init__",
"signature": "def __init__(self, nodes)"
},
{
"docstring": ":param: - `parameters`: a named tuple with `nodes.parameters` and `ssids.parameters` attributes",
"name": "__call__",
"signature": "def __cal... | 2 | null | Implement the Python class `APConnect` described below.
Class description:
A class to connect a device to an AP
Method signatures and docstrings:
- def __init__(self, nodes): :param: - `nodes`: dictionary of id:device pairs
- def __call__(self, parameters): :param: - `parameters`: a named tuple with `nodes.parameters... | Implement the Python class `APConnect` described below.
Class description:
A class to connect a device to an AP
Method signatures and docstrings:
- def __init__(self, nodes): :param: - `nodes`: dictionary of id:device pairs
- def __call__(self, parameters): :param: - `parameters`: a named tuple with `nodes.parameters... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class APConnect:
"""A class to connect a device to an AP"""
def __init__(self, nodes):
""":param: - `nodes`: dictionary of id:device pairs"""
<|body_0|>
def __call__(self, parameters):
""":param: - `parameters`: a named tuple with `nodes.parameters` and `ssids.paramete... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class APConnect:
"""A class to connect a device to an AP"""
def __init__(self, nodes):
""":param: - `nodes`: dictionary of id:device pairs"""
super(APConnect, self).__init__()
self.nodes = nodes
return
def __call__(self, parameters):
""":param: - `parameters`: a nam... | the_stack_v2_python_sparse | apetools/affectors/apconnect.py | russell-n/oldape | train | 0 |
edabaa1e51463808e7b04d6f8a8b900cd165f0b1 | [
"self.event_dispatcher = event_dispatcher or EventDispatcher\nself.logger = _logging.adapt_logger(logger or _logging.NoOpLogger())\nself.notification_center = notification_center or _notification_center.NotificationCenter(self.logger)\nif not validator.is_notification_center_valid(self.notification_center):\n se... | <|body_start_0|>
self.event_dispatcher = event_dispatcher or EventDispatcher
self.logger = _logging.adapt_logger(logger or _logging.NoOpLogger())
self.notification_center = notification_center or _notification_center.NotificationCenter(self.logger)
if not validator.is_notification_center... | ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received. | ForwardingEventProcessor | [
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForwardingEventProcessor:
"""ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received."""
def __init__(self, event_dispatcher: type[EventDispatcher] | CustomEventDispatcher, logger: Optional[_l... | stack_v2_sparse_classes_10k_train_008197 | 15,516 | permissive | [
{
"docstring": "ForwardingEventProcessor init method to configure event dispatching. Args: event_dispatcher: Provides a dispatch_event method which if given a URL and params sends a request to it. logger: Optional component which provides a log method to log messages. By default nothing would be logged. notific... | 2 | stack_v2_sparse_classes_30k_train_003246 | Implement the Python class `ForwardingEventProcessor` described below.
Class description:
ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received.
Method signatures and docstrings:
- def __init__(self, event_dispatcher... | Implement the Python class `ForwardingEventProcessor` described below.
Class description:
ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received.
Method signatures and docstrings:
- def __init__(self, event_dispatcher... | bf000e737f391270f9adec97606646ce4761ecd8 | <|skeleton|>
class ForwardingEventProcessor:
"""ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received."""
def __init__(self, event_dispatcher: type[EventDispatcher] | CustomEventDispatcher, logger: Optional[_l... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ForwardingEventProcessor:
"""ForwardingEventProcessor serves as the default EventProcessor. The ForwardingEventProcessor sends the LogEvent to EventDispatcher as soon as it is received."""
def __init__(self, event_dispatcher: type[EventDispatcher] | CustomEventDispatcher, logger: Optional[_logging.Logger... | the_stack_v2_python_sparse | optimizely/event/event_processor.py | optimizely/python-sdk | train | 34 |
ead3177246d2c42e92f5d2830552894fdc49e386 | [
"self.u_href = u_href\nself.h_ref = h_ref\nself.z_0 = z_0\nself.mask = mask\narray_sizes = [np.size(u_href), np.size(h_ref), np.size(z_0), np.size(mask)]\nif not all((x == array_sizes[0] for x in array_sizes)):\n raise ValueError('Different size input arrays u_href, h_ref, z_0, mask')",
"ustar = np.full(self.u... | <|body_start_0|>
self.u_href = u_href
self.h_ref = h_ref
self.z_0 = z_0
self.mask = mask
array_sizes = [np.size(u_href), np.size(h_ref), np.size(z_0), np.size(mask)]
if not all((x == array_sizes[0] for x in array_sizes)):
raise ValueError('Different size input... | Class to calculate the friction velocity. This holds the function to calculate the friction velocity u_star, given a reference height h_ref, the velocity at the reference height u_href and the surface roughness z_0. | FrictionVelocity | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrictionVelocity:
"""Class to calculate the friction velocity. This holds the function to calculate the friction velocity u_star, given a reference height h_ref, the velocity at the reference height u_href and the surface roughness z_0."""
def __init__(self, u_href: ndarray, h_ref: ndarray, ... | stack_v2_sparse_classes_10k_train_008198 | 37,222 | permissive | [
{
"docstring": "Initialise the class. Args: u_href: A 2D array of float32 for the wind speed at h_ref h_ref: A 2D array of float32 for the reference heights z_0: A 2D array of float32 for the vegetative roughness lengths mask: A 2D array of booleans where True indicates calculate u* Notes: * z_0 and h_ref need ... | 2 | null | Implement the Python class `FrictionVelocity` described below.
Class description:
Class to calculate the friction velocity. This holds the function to calculate the friction velocity u_star, given a reference height h_ref, the velocity at the reference height u_href and the surface roughness z_0.
Method signatures an... | Implement the Python class `FrictionVelocity` described below.
Class description:
Class to calculate the friction velocity. This holds the function to calculate the friction velocity u_star, given a reference height h_ref, the velocity at the reference height u_href and the surface roughness z_0.
Method signatures an... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class FrictionVelocity:
"""Class to calculate the friction velocity. This holds the function to calculate the friction velocity u_star, given a reference height h_ref, the velocity at the reference height u_href and the surface roughness z_0."""
def __init__(self, u_href: ndarray, h_ref: ndarray, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FrictionVelocity:
"""Class to calculate the friction velocity. This holds the function to calculate the friction velocity u_star, given a reference height h_ref, the velocity at the reference height u_href and the surface roughness z_0."""
def __init__(self, u_href: ndarray, h_ref: ndarray, z_0: ndarray,... | the_stack_v2_python_sparse | improver/wind_calculations/wind_downscaling.py | metoppv/improver | train | 101 |
c0be08f7221bcc06fcfd245da0c480d03c642443 | [
"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... | Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs. | OfflineUserDataJobServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfflineUserDataJobServiceServicer:
"""Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs."""
def CreateOfflineUserDataJob(self, request, context):
"""Creates an offline user data job."""
<|body_0|>
def GetOfflineUserDataJob(self... | stack_v2_sparse_classes_10k_train_008199 | 6,246 | permissive | [
{
"docstring": "Creates an offline user data job.",
"name": "CreateOfflineUserDataJob",
"signature": "def CreateOfflineUserDataJob(self, request, context)"
},
{
"docstring": "Returns the offline user data job.",
"name": "GetOfflineUserDataJob",
"signature": "def GetOfflineUserDataJob(sel... | 4 | stack_v2_sparse_classes_30k_train_003641 | Implement the Python class `OfflineUserDataJobServiceServicer` described below.
Class description:
Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs.
Method signatures and docstrings:
- def CreateOfflineUserDataJob(self, request, context): Creates an offline user data job.
... | Implement the Python class `OfflineUserDataJobServiceServicer` described below.
Class description:
Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs.
Method signatures and docstrings:
- def CreateOfflineUserDataJob(self, request, context): Creates an offline user data job.
... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class OfflineUserDataJobServiceServicer:
"""Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs."""
def CreateOfflineUserDataJob(self, request, context):
"""Creates an offline user data job."""
<|body_0|>
def GetOfflineUserDataJob(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OfflineUserDataJobServiceServicer:
"""Proto file describing the OfflineUserDataJobService. Service to manage offline user data jobs."""
def CreateOfflineUserDataJob(self, request, context):
"""Creates an offline user data job."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
con... | the_stack_v2_python_sparse | google/ads/google_ads/v3/proto/services/offline_user_data_job_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.