blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
369a3bda6190d22bc2b60b448833673d54ca405d
[ "self.key = key\nself._set_key_parms(['type'])\nself._set_prhb_parms(['type'])", "if 'conf' not in self.__dict__:\n self.conf = self.get_view_obj(self.key)\nreturn self.conf.get('type')" ]
<|body_start_0|> self.key = key self._set_key_parms(['type']) self._set_prhb_parms(['type']) <|end_body_0|> <|body_start_1|> if 'conf' not in self.__dict__: self.conf = self.get_view_obj(self.key) return self.conf.get('type') <|end_body_1|>
WorkFlowEvalConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkFlowEvalConfig: def __init__(self, key=None): """init key variable :param key: :return:""" <|body_0|> def get_eval_type(self): """get eval type ( regression, classification.. ) :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.key = ...
stack_v2_sparse_classes_36k_train_025900
632
permissive
[ { "docstring": "init key variable :param key: :return:", "name": "__init__", "signature": "def __init__(self, key=None)" }, { "docstring": "get eval type ( regression, classification.. ) :return:", "name": "get_eval_type", "signature": "def get_eval_type(self)" } ]
2
stack_v2_sparse_classes_30k_train_009286
Implement the Python class `WorkFlowEvalConfig` described below. Class description: Implement the WorkFlowEvalConfig class. Method signatures and docstrings: - def __init__(self, key=None): init key variable :param key: :return: - def get_eval_type(self): get eval type ( regression, classification.. ) :return:
Implement the Python class `WorkFlowEvalConfig` described below. Class description: Implement the WorkFlowEvalConfig class. Method signatures and docstrings: - def __init__(self, key=None): init key variable :param key: :return: - def get_eval_type(self): get eval type ( regression, classification.. ) :return: <|ske...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class WorkFlowEvalConfig: def __init__(self, key=None): """init key variable :param key: :return:""" <|body_0|> def get_eval_type(self): """get eval type ( regression, classification.. ) :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkFlowEvalConfig: def __init__(self, key=None): """init key variable :param key: :return:""" self.key = key self._set_key_parms(['type']) self._set_prhb_parms(['type']) def get_eval_type(self): """get eval type ( regression, classification.. ) :return:""" ...
the_stack_v2_python_sparse
master/workflow/evalconf/workflow_evalconf.py
yurimkoo/tensormsa
train
1
c171d24a1dc2736d69b4d9d333d5bb605196cb16
[ "self.signal = None\nself.covar = None\nself.min_size = 2", "assert signal.ndim > 1, 'Not enough dimensions'\nself.signal = signal[:, 0].reshape(-1, 1)\nself.covar = signal[:, 1:]\nreturn self", "if end - start < self.min_size:\n raise NotEnoughPoints\ny, X = (self.signal[start:end], self.covar[start:end])\n...
<|body_start_0|> self.signal = None self.covar = None self.min_size = 2 <|end_body_0|> <|body_start_1|> assert signal.ndim > 1, 'Not enough dimensions' self.signal = signal[:, 0].reshape(-1, 1) self.covar = signal[:, 1:] return self <|end_body_1|> <|body_start_2...
Least-square estimate for linear changes.
CostLinear
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CostLinear: """Least-square estimate for linear changes.""" def __init__(self): """Initialize the object.""" <|body_0|> def fit(self, signal) -> 'CostLinear': """Set parameters of the instance. The first column contains the observed variable. The other columns co...
stack_v2_sparse_classes_36k_train_025901
1,462
permissive
[ { "docstring": "Initialize the object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Set parameters of the instance. The first column contains the observed variable. The other columns contains the covariates. Args: signal (array): signal of shape (n_samples, n_regres...
3
stack_v2_sparse_classes_30k_train_019708
Implement the Python class `CostLinear` described below. Class description: Least-square estimate for linear changes. Method signatures and docstrings: - def __init__(self): Initialize the object. - def fit(self, signal) -> 'CostLinear': Set parameters of the instance. The first column contains the observed variable....
Implement the Python class `CostLinear` described below. Class description: Least-square estimate for linear changes. Method signatures and docstrings: - def __init__(self): Initialize the object. - def fit(self, signal) -> 'CostLinear': Set parameters of the instance. The first column contains the observed variable....
0eb34388df2096d22fb1afd6e33ec511fb64cfa6
<|skeleton|> class CostLinear: """Least-square estimate for linear changes.""" def __init__(self): """Initialize the object.""" <|body_0|> def fit(self, signal) -> 'CostLinear': """Set parameters of the instance. The first column contains the observed variable. The other columns co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CostLinear: """Least-square estimate for linear changes.""" def __init__(self): """Initialize the object.""" self.signal = None self.covar = None self.min_size = 2 def fit(self, signal) -> 'CostLinear': """Set parameters of the instance. The first column conta...
the_stack_v2_python_sparse
src/ruptures/costs/costlinear.py
deepcharles/ruptures
train
1,299
685b32abeaf4b139cd5cf303556d1e41a4e57b70
[ "color_maps = {}\norigins = self.origin_from_mol(self.positioned_mol)\nn_colors = sum(map(bool, origins))\ncolors = divergent_colors[n_colors]\nmapped_idxs = [i for i, m in enumerate(origins) if m]\nfollowup_color_map = dict(zip(mapped_idxs, colors))\npositioned_name: str = self.positioned_mol.GetProp('_Name')\ncol...
<|body_start_0|> color_maps = {} origins = self.origin_from_mol(self.positioned_mol) n_colors = sum(map(bool, origins)) colors = divergent_colors[n_colors] mapped_idxs = [i for i, m in enumerate(origins) if m] followup_color_map = dict(zip(mapped_idxs, colors)) po...
_MonsterUtilCompare
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _MonsterUtilCompare: def get_color_origins(self) -> Dict[str, Dict[int, str]]: """Get for the hits and followup the color of the origin as seen in show_comparison :return:""" <|body_0|> def store_origin_colors_atomically(self): """Store the color of the origin in the...
stack_v2_sparse_classes_36k_train_025902
8,142
permissive
[ { "docstring": "Get for the hits and followup the color of the origin as seen in show_comparison :return:", "name": "get_color_origins", "signature": "def get_color_origins(self) -> Dict[str, Dict[int, str]]" }, { "docstring": "Store the color of the origin in the mol as the private property _co...
6
null
Implement the Python class `_MonsterUtilCompare` described below. Class description: Implement the _MonsterUtilCompare class. Method signatures and docstrings: - def get_color_origins(self) -> Dict[str, Dict[int, str]]: Get for the hits and followup the color of the origin as seen in show_comparison :return: - def st...
Implement the Python class `_MonsterUtilCompare` described below. Class description: Implement the _MonsterUtilCompare class. Method signatures and docstrings: - def get_color_origins(self) -> Dict[str, Dict[int, str]]: Get for the hits and followup the color of the origin as seen in show_comparison :return: - def st...
c03945c089beec35b7aabb83dc1efd9cc57ac281
<|skeleton|> class _MonsterUtilCompare: def get_color_origins(self) -> Dict[str, Dict[int, str]]: """Get for the hits and followup the color of the origin as seen in show_comparison :return:""" <|body_0|> def store_origin_colors_atomically(self): """Store the color of the origin in the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _MonsterUtilCompare: def get_color_origins(self) -> Dict[str, Dict[int, str]]: """Get for the hits and followup the color of the origin as seen in show_comparison :return:""" color_maps = {} origins = self.origin_from_mol(self.positioned_mol) n_colors = sum(map(bool, origins)) ...
the_stack_v2_python_sparse
fragmenstein/monster/_util_compare.py
matteoferla/Fragmenstein
train
120
896a2aec39f22ecabb20de999e5c490d68b13e12
[ "self.queryFile = os.path.join(os.path.dirname(__file__), 'adh.fasta')\nconfig = Configure()\nself.BLASTDB = config.log['data']", "self.blast = Blast(self.queryFile)\nstart, stop = (0, 2)\nnewQueryFile = self.blast.get_query_file('.', start, stop)\nqueryFileName = os.path.split(self.queryFile)[-1]\nqueryFilePath ...
<|body_start_0|> self.queryFile = os.path.join(os.path.dirname(__file__), 'adh.fasta') config = Configure() self.BLASTDB = config.log['data'] <|end_body_0|> <|body_start_1|> self.blast = Blast(self.queryFile) start, stop = (0, 2) newQueryFile = self.blast.get_query_file(...
Run a number of tests using taxa id 7227
BlastTest
[ "BSD-3-Clause", "LicenseRef-scancode-public-domain", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlastTest: """Run a number of tests using taxa id 7227""" def setUp(self): """connect to the database""" <|body_0|> def testGetQueryFile(self): """test the function breaks the fasta file in to chunks""" <|body_1|> def testRunBlastX(self): """...
stack_v2_sparse_classes_36k_train_025903
2,543
permissive
[ { "docstring": "connect to the database", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test the function breaks the fasta file in to chunks", "name": "testGetQueryFile", "signature": "def testGetQueryFile(self)" }, { "docstring": "test running blastx", "...
4
null
Implement the Python class `BlastTest` described below. Class description: Run a number of tests using taxa id 7227 Method signatures and docstrings: - def setUp(self): connect to the database - def testGetQueryFile(self): test the function breaks the fasta file in to chunks - def testRunBlastX(self): test running bl...
Implement the Python class `BlastTest` described below. Class description: Run a number of tests using taxa id 7227 Method signatures and docstrings: - def setUp(self): connect to the database - def testGetQueryFile(self): test the function breaks the fasta file in to chunks - def testRunBlastX(self): test running bl...
a343aff9b833979b4f5d4ba6d16fc2b65d8ccfc1
<|skeleton|> class BlastTest: """Run a number of tests using taxa id 7227""" def setUp(self): """connect to the database""" <|body_0|> def testGetQueryFile(self): """test the function breaks the fasta file in to chunks""" <|body_1|> def testRunBlastX(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlastTest: """Run a number of tests using taxa id 7227""" def setUp(self): """connect to the database""" self.queryFile = os.path.join(os.path.dirname(__file__), 'adh.fasta') config = Configure() self.BLASTDB = config.log['data'] def testGetQueryFile(self): ""...
the_stack_v2_python_sparse
unittests/BlastTest.py
changanla/htsint
train
0
53d9ecac0fa1189e0d46838f3321d32602bc13fa
[ "super(cpa, self).__init__()\nself.eoslibinit_init_cpa = getattr(self.tp, self.get_export_name('eoslibinit', 'init_cpa'))\nself.s_get_kij = getattr(self.tp, self.get_export_name('saft_interface', 'cpa_get_kij'))\nself.s_set_kij = getattr(self.tp, self.get_export_name('saft_interface', 'cpa_set_kij'))", "self.acti...
<|body_start_0|> super(cpa, self).__init__() self.eoslibinit_init_cpa = getattr(self.tp, self.get_export_name('eoslibinit', 'init_cpa')) self.s_get_kij = getattr(self.tp, self.get_export_name('saft_interface', 'cpa_get_kij')) self.s_set_kij = getattr(self.tp, self.get_export_name('saft_i...
Interface to cubic plus association model
cpa
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cpa: """Interface to cubic plus association model""" def __init__(self): """Initialize cubic specific function pointers""" <|body_0|> def init(self, comps, eos='SRK', mixing='vdW', alpha='Classic', parameter_reference='Default'): """Initialize cubic plus associat...
stack_v2_sparse_classes_36k_train_025904
4,659
permissive
[ { "docstring": "Initialize cubic specific function pointers", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Initialize cubic plus association model in thermopack Args: comps (str): Comma separated list of component names eos (str, optional): Cubic equation of state. De...
4
stack_v2_sparse_classes_30k_val_000592
Implement the Python class `cpa` described below. Class description: Interface to cubic plus association model Method signatures and docstrings: - def __init__(self): Initialize cubic specific function pointers - def init(self, comps, eos='SRK', mixing='vdW', alpha='Classic', parameter_reference='Default'): Initializ...
Implement the Python class `cpa` described below. Class description: Interface to cubic plus association model Method signatures and docstrings: - def __init__(self): Initialize cubic specific function pointers - def init(self, comps, eos='SRK', mixing='vdW', alpha='Classic', parameter_reference='Default'): Initializ...
dcec37ba9b38acd9a65dbb011483a16c2439706a
<|skeleton|> class cpa: """Interface to cubic plus association model""" def __init__(self): """Initialize cubic specific function pointers""" <|body_0|> def init(self, comps, eos='SRK', mixing='vdW', alpha='Classic', parameter_reference='Default'): """Initialize cubic plus associat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cpa: """Interface to cubic plus association model""" def __init__(self): """Initialize cubic specific function pointers""" super(cpa, self).__init__() self.eoslibinit_init_cpa = getattr(self.tp, self.get_export_name('eoslibinit', 'init_cpa')) self.s_get_kij = getattr(self....
the_stack_v2_python_sparse
addon/pycThermopack/pyctp/cpa.py
ibell/thermopack
train
3
2bae8961ba0176f9860c97dd3372535348a6b341
[ "self.api_key = api_key\nself.logger = logger\nself.wta_endpoint = 'https://{host}:{port}/{client_id}/wta?key={api_key}&sync=true'.format(host=settings.MOBOLT_API_HOST, port=settings.MOBOLT_API_PORT, client_id=settings.MOBOLT_API_CLIENT_ID, api_key=settings.MOBOLT_API_KEY)\nself.upload_endpoint = 'https://{host}:{p...
<|body_start_0|> self.api_key = api_key self.logger = logger self.wta_endpoint = 'https://{host}:{port}/{client_id}/wta?key={api_key}&sync=true'.format(host=settings.MOBOLT_API_HOST, port=settings.MOBOLT_API_PORT, client_id=settings.MOBOLT_API_CLIENT_ID, api_key=settings.MOBOLT_API_KEY) ...
Mobolt API wrapper
MoboltClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoboltClient: """Mobolt API wrapper""" def __init__(self, api_key, logger): """Initializes the MoboltClient""" <|body_0|> def submit_application(self, mobolt_job_id, answers): """Submits a job application. Args: mobolt_job_id: Mobolt ID of the job being applied t...
stack_v2_sparse_classes_36k_train_025905
4,396
no_license
[ { "docstring": "Initializes the MoboltClient", "name": "__init__", "signature": "def __init__(self, api_key, logger)" }, { "docstring": "Submits a job application. Args: mobolt_job_id: Mobolt ID of the job being applied to answers: a dict containing a question ID to answer mapping Returns: True ...
3
stack_v2_sparse_classes_30k_train_016378
Implement the Python class `MoboltClient` described below. Class description: Mobolt API wrapper Method signatures and docstrings: - def __init__(self, api_key, logger): Initializes the MoboltClient - def submit_application(self, mobolt_job_id, answers): Submits a job application. Args: mobolt_job_id: Mobolt ID of th...
Implement the Python class `MoboltClient` described below. Class description: Mobolt API wrapper Method signatures and docstrings: - def __init__(self, api_key, logger): Initializes the MoboltClient - def submit_application(self, mobolt_job_id, answers): Submits a job application. Args: mobolt_job_id: Mobolt ID of th...
da3073eec6d676dfe0164502b80d2a1c75e89575
<|skeleton|> class MoboltClient: """Mobolt API wrapper""" def __init__(self, api_key, logger): """Initializes the MoboltClient""" <|body_0|> def submit_application(self, mobolt_job_id, answers): """Submits a job application. Args: mobolt_job_id: Mobolt ID of the job being applied t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoboltClient: """Mobolt API wrapper""" def __init__(self, api_key, logger): """Initializes the MoboltClient""" self.api_key = api_key self.logger = logger self.wta_endpoint = 'https://{host}:{port}/{client_id}/wta?key={api_key}&sync=true'.format(host=settings.MOBOLT_API_HO...
the_stack_v2_python_sparse
web-serpng/code/serpng/mobile/mobolt.py
alyago/django-web
train
0
03502115034121b423ee3d439135b66d65952c93
[ "self.cities = cities\nself.gas_stations = gas_stations\nself.min_sleep_time = min_sleep_time\nself.max_sleep_time = max_sleep_time\nself.parser = Parser()\nself.params = ['address', 'brand', 'lat', 'lon', 'price_1', 'price_2', 'price_3']\nself.storage = storage", "for city in self.cities:\n try:\n data...
<|body_start_0|> self.cities = cities self.gas_stations = gas_stations self.min_sleep_time = min_sleep_time self.max_sleep_time = max_sleep_time self.parser = Parser() self.params = ['address', 'brand', 'lat', 'lon', 'price_1', 'price_2', 'price_3'] self.storage =...
A Crawler class for crawling GoogleMaps gas station prices.
Crawler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crawler: """A Crawler class for crawling GoogleMaps gas station prices.""" def __init__(self, cities, gas_stations, storage, min_sleep_time=15, max_sleep_time=60): """Initializes a crawler. Args: cities: a list of "city, state" gas_stations: a list of gas stations sleep_time: number ...
stack_v2_sparse_classes_36k_train_025906
3,279
no_license
[ { "docstring": "Initializes a crawler. Args: cities: a list of \"city, state\" gas_stations: a list of gas stations sleep_time: number of seconds to sleep after web request", "name": "__init__", "signature": "def __init__(self, cities, gas_stations, storage, min_sleep_time=15, max_sleep_time=60)" }, ...
3
stack_v2_sparse_classes_30k_train_007173
Implement the Python class `Crawler` described below. Class description: A Crawler class for crawling GoogleMaps gas station prices. Method signatures and docstrings: - def __init__(self, cities, gas_stations, storage, min_sleep_time=15, max_sleep_time=60): Initializes a crawler. Args: cities: a list of "city, state"...
Implement the Python class `Crawler` described below. Class description: A Crawler class for crawling GoogleMaps gas station prices. Method signatures and docstrings: - def __init__(self, cities, gas_stations, storage, min_sleep_time=15, max_sleep_time=60): Initializes a crawler. Args: cities: a list of "city, state"...
32d02a7893f0645a1ba18fa463fc3dd02e1a6e26
<|skeleton|> class Crawler: """A Crawler class for crawling GoogleMaps gas station prices.""" def __init__(self, cities, gas_stations, storage, min_sleep_time=15, max_sleep_time=60): """Initializes a crawler. Args: cities: a list of "city, state" gas_stations: a list of gas stations sleep_time: number ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crawler: """A Crawler class for crawling GoogleMaps gas station prices.""" def __init__(self, cities, gas_stations, storage, min_sleep_time=15, max_sleep_time=60): """Initializes a crawler. Args: cities: a list of "city, state" gas_stations: a list of gas stations sleep_time: number of seconds to...
the_stack_v2_python_sparse
crawler/crawler.py
WSJ-2018SE-CPP/gasme
train
1
b1799de74974b7e9d10cc0fe99dd9d83f4f03d2a
[ "self.filename = filename\nself.abs_filename = abs_filename\nself.old_file = 'UNDEFINED'\nself.new_file = 'UNDEFINED'\nself.diff_text = diff_text\nself.hunks = []", "if not self.hunks:\n self.parse_diff(include_headers=include_headers)\nreturn self.hunks", "hunks = self.HUNK_MATCH.split(self.diff_text)\nhunk...
<|body_start_0|> self.filename = filename self.abs_filename = abs_filename self.old_file = 'UNDEFINED' self.new_file = 'UNDEFINED' self.diff_text = diff_text self.hunks = [] <|end_body_0|> <|body_start_1|> if not self.hunks: self.parse_diff(include_he...
Representation of a single file's diff.
FileDiff
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileDiff: """Representation of a single file's diff.""" def __init__(self, filename, abs_filename, diff_text): """Constructor. Args: filename: The filename as given by Git - i.e. relative to the Git base directory. abs_filename: The absolute filename for this file. diff_text: The tex...
stack_v2_sparse_classes_36k_train_025907
3,550
permissive
[ { "docstring": "Constructor. Args: filename: The filename as given by Git - i.e. relative to the Git base directory. abs_filename: The absolute filename for this file. diff_text: The text of the Git diff.", "name": "__init__", "signature": "def __init__(self, filename, abs_filename, diff_text)" }, {...
6
stack_v2_sparse_classes_30k_train_009726
Implement the Python class `FileDiff` described below. Class description: Representation of a single file's diff. Method signatures and docstrings: - def __init__(self, filename, abs_filename, diff_text): Constructor. Args: filename: The filename as given by Git - i.e. relative to the Git base directory. abs_filename...
Implement the Python class `FileDiff` described below. Class description: Representation of a single file's diff. Method signatures and docstrings: - def __init__(self, filename, abs_filename, diff_text): Constructor. Args: filename: The filename as given by Git - i.e. relative to the Git base directory. abs_filename...
17afe53e4a96c80f0a43093f5ea21d61c42a090b
<|skeleton|> class FileDiff: """Representation of a single file's diff.""" def __init__(self, filename, abs_filename, diff_text): """Constructor. Args: filename: The filename as given by Git - i.e. relative to the Git base directory. abs_filename: The absolute filename for this file. diff_text: The tex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileDiff: """Representation of a single file's diff.""" def __init__(self, filename, abs_filename, diff_text): """Constructor. Args: filename: The filename as given by Git - i.e. relative to the Git base directory. abs_filename: The absolute filename for this file. diff_text: The text of the Git ...
the_stack_v2_python_sparse
parser/file_diff.py
CJTozer/SublimeDiffView
train
23
62f96a6d2ff09586914263ebfbdb2827d8ad5e38
[ "view = cls.as_view('periodic_incomes')\napp.add_url_rule('/api/budgets/<int:budget_id>/periodic-incomes', defaults={'income_id': None}, view_func=view, methods=['GET'])\napp.add_url_rule('/api/budgets/<int:budget_id>/periodic-incomes', view_func=view, methods=['POST'])\napp.add_url_rule('/api/budget-periodic-incom...
<|body_start_0|> view = cls.as_view('periodic_incomes') app.add_url_rule('/api/budgets/<int:budget_id>/periodic-incomes', defaults={'income_id': None}, view_func=view, methods=['GET']) app.add_url_rule('/api/budgets/<int:budget_id>/periodic-incomes', view_func=view, methods=['POST']) app...
Periodic income REST resource view
PeriodicIncomesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeriodicIncomesView: """Periodic income REST resource view""" def register(cls, app: Flask): """Registers routes for this view""" <|body_0|> def get(budget_id: Optional[int], income_id: Optional[int]): """Gets a specific periodic income or all incomes in the spec...
stack_v2_sparse_classes_36k_train_025908
17,779
permissive
[ { "docstring": "Registers routes for this view", "name": "register", "signature": "def register(cls, app: Flask)" }, { "docstring": "Gets a specific periodic income or all incomes in the specified budget", "name": "get", "signature": "def get(budget_id: Optional[int], income_id: Optional...
5
stack_v2_sparse_classes_30k_train_004741
Implement the Python class `PeriodicIncomesView` described below. Class description: Periodic income REST resource view Method signatures and docstrings: - def register(cls, app: Flask): Registers routes for this view - def get(budget_id: Optional[int], income_id: Optional[int]): Gets a specific periodic income or al...
Implement the Python class `PeriodicIncomesView` described below. Class description: Periodic income REST resource view Method signatures and docstrings: - def register(cls, app: Flask): Registers routes for this view - def get(budget_id: Optional[int], income_id: Optional[int]): Gets a specific periodic income or al...
20d992356952542fd79aab69849a04129fa22de2
<|skeleton|> class PeriodicIncomesView: """Periodic income REST resource view""" def register(cls, app: Flask): """Registers routes for this view""" <|body_0|> def get(budget_id: Optional[int], income_id: Optional[int]): """Gets a specific periodic income or all incomes in the spec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PeriodicIncomesView: """Periodic income REST resource view""" def register(cls, app: Flask): """Registers routes for this view""" view = cls.as_view('periodic_incomes') app.add_url_rule('/api/budgets/<int:budget_id>/periodic-incomes', defaults={'income_id': None}, view_func=view, ...
the_stack_v2_python_sparse
backend/underbudget/views/budgets.py
vimofthevine/underbudget4
train
0
37c5f658592de38a14caf7e3bce84f55951dcc6b
[ "user = request.user\nnotifications = user.notifications.read()\nserializer = self.serializer_class(notifications, many=True)\nreturn Response(serializer.data, status.HTTP_200_OK)", "user = request.user\nNotification.objects.mark_all_as_read(user)\nreturn Response({'response': 'All read'}, status.HTTP_200_OK)" ]
<|body_start_0|> user = request.user notifications = user.notifications.read() serializer = self.serializer_class(notifications, many=True) return Response(serializer.data, status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> user = request.user Notification.objects.mark_...
Retrieves read notifications
ReadNotificationApiView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadNotificationApiView: """Retrieves read notifications""" def get(self, request): """Read notifications Retrieves read notifications""" <|body_0|> def put(self, request, format=None): """Mark as read""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025909
2,497
permissive
[ { "docstring": "Read notifications Retrieves read notifications", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Mark as read", "name": "put", "signature": "def put(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_010352
Implement the Python class `ReadNotificationApiView` described below. Class description: Retrieves read notifications Method signatures and docstrings: - def get(self, request): Read notifications Retrieves read notifications - def put(self, request, format=None): Mark as read
Implement the Python class `ReadNotificationApiView` described below. Class description: Retrieves read notifications Method signatures and docstrings: - def get(self, request): Read notifications Retrieves read notifications - def put(self, request, format=None): Mark as read <|skeleton|> class ReadNotificationApiV...
b80ad485339dbb02b74d9b2093543bf8173d51de
<|skeleton|> class ReadNotificationApiView: """Retrieves read notifications""" def get(self, request): """Read notifications Retrieves read notifications""" <|body_0|> def put(self, request, format=None): """Mark as read""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadNotificationApiView: """Retrieves read notifications""" def get(self, request): """Read notifications Retrieves read notifications""" user = request.user notifications = user.notifications.read() serializer = self.serializer_class(notifications, many=True) retu...
the_stack_v2_python_sparse
authors/apps/notifications/views.py
deferral/ah-django
train
1
a2a7e7af2e545214939ee908cc17f519ba7f50de
[ "try:\n import dgl\nexcept:\n raise ImportError('This class requires DGL to be installed.')\nsuper(CGCNN, self).__init__()\nif mode not in ['classification', 'regression']:\n raise ValueError(\"mode must be either 'classification' or 'regression'\")\nself.n_tasks = n_tasks\nself.mode = mode\nself.n_classes...
<|body_start_0|> try: import dgl except: raise ImportError('This class requires DGL to be installed.') super(CGCNN, self).__init__() if mode not in ['classification', 'regression']: raise ValueError("mode must be either 'classification' or 'regression'...
Crystal Graph Convolutional Neural Network (CGCNN). This model takes arbitary crystal structures as an input, and predict material properties using the element information and connection of atoms in the crystal. If you want to get some material properties which has a high computational cost like band gap in the case of...
CGCNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CGCNN: """Crystal Graph Convolutional Neural Network (CGCNN). This model takes arbitary crystal structures as an input, and predict material properties using the element information and connection of atoms in the crystal. If you want to get some material properties which has a high computational ...
stack_v2_sparse_classes_36k_train_025910
14,455
permissive
[ { "docstring": "Parameters ---------- in_node_dim: int, default 92 The length of the initial node feature vectors. The 92 is based on length of vectors in the atom_init.json. hidden_node_dim: int, default 64 The length of the hidden node feature vectors. in_edge_dim: int, default 41 The length of the initial ed...
2
null
Implement the Python class `CGCNN` described below. Class description: Crystal Graph Convolutional Neural Network (CGCNN). This model takes arbitary crystal structures as an input, and predict material properties using the element information and connection of atoms in the crystal. If you want to get some material pro...
Implement the Python class `CGCNN` described below. Class description: Crystal Graph Convolutional Neural Network (CGCNN). This model takes arbitary crystal structures as an input, and predict material properties using the element information and connection of atoms in the crystal. If you want to get some material pro...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class CGCNN: """Crystal Graph Convolutional Neural Network (CGCNN). This model takes arbitary crystal structures as an input, and predict material properties using the element information and connection of atoms in the crystal. If you want to get some material properties which has a high computational ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CGCNN: """Crystal Graph Convolutional Neural Network (CGCNN). This model takes arbitary crystal structures as an input, and predict material properties using the element information and connection of atoms in the crystal. If you want to get some material properties which has a high computational cost like ban...
the_stack_v2_python_sparse
deepchem/models/torch_models/cgcnn.py
deepchem/deepchem
train
4,876
f53e8d47c874f62e63b8b4e7a2f1b6c2e94f4df6
[ "with datastore_services.get_ndb_context():\n latest_exploration = exp_fetchers.get_exploration_by_id(exp_id, strict=False)\n if latest_exploration is None:\n return result.Err((exp_id, Exception('Exploration does not exist.')))\n exploration_model = exp_models.ExplorationModel.get(exp_id)\nif explo...
<|body_start_0|> with datastore_services.get_ndb_context(): latest_exploration = exp_fetchers.get_exploration_by_id(exp_id, strict=False) if latest_exploration is None: return result.Err((exp_id, Exception('Exploration does not exist.'))) exploration_model = e...
A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore.
ExpSnapshotsMigrationAuditJob
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExpSnapshotsMigrationAuditJob: """A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore.""" def _migrate_exploration_snapshot_model(exp_id: str, exp_snapsh...
stack_v2_sparse_classes_36k_train_025911
28,752
permissive
[ { "docstring": "Migrates exploration snapshot content model but does not put it in the datastore. Args: exp_id: str. The ID of the exploration. exp_snapshot_model: ExplorationSnapshotContentModel. The exploration model to migrate. Returns: Result((str, Exception)). Result containing tuple that consists of explo...
2
stack_v2_sparse_classes_30k_train_017638
Implement the Python class `ExpSnapshotsMigrationAuditJob` described below. Class description: A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore. Method signatures and docstring...
Implement the Python class `ExpSnapshotsMigrationAuditJob` described below. Class description: A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore. Method signatures and docstring...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class ExpSnapshotsMigrationAuditJob: """A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore.""" def _migrate_exploration_snapshot_model(exp_id: str, exp_snapsh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExpSnapshotsMigrationAuditJob: """A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore.""" def _migrate_exploration_snapshot_model(exp_id: str, exp_snapshot_model: exp...
the_stack_v2_python_sparse
core/jobs/batch_jobs/exp_migration_jobs.py
oppia/oppia
train
6,172
8140b2ff8fe6b4357ed90f12e8e9f61482997883
[ "if EVENT_ALL_EVENTS in event_types:\n event_types = EVENTS\nself._event_types = {camelcase(evt): evt for evt in event_types}\nself._custom_attributes = custom_attributes\nself._scan_interval = scan_interval\nself._async_see = async_see\nself._api = api\nself._hass = hass\nself._max_accuracy = max_accuracy\nself...
<|body_start_0|> if EVENT_ALL_EVENTS in event_types: event_types = EVENTS self._event_types = {camelcase(evt): evt for evt in event_types} self._custom_attributes = custom_attributes self._scan_interval = scan_interval self._async_see = async_see self._api = a...
Define an object to retrieve Traccar data.
TraccarScanner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TraccarScanner: """Define an object to retrieve Traccar data.""" def __init__(self, api: ApiClient, hass: HomeAssistant, async_see: AsyncSeeCallback, scan_interval: timedelta, max_accuracy: int, skip_accuracy_on: bool, custom_attributes: list[str], event_types: list[str]) -> None: ""...
stack_v2_sparse_classes_36k_train_025912
15,131
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, api: ApiClient, hass: HomeAssistant, async_see: AsyncSeeCallback, scan_interval: timedelta, max_accuracy: int, skip_accuracy_on: bool, custom_attributes: list[str], event_types: list[str]) -> None" }, { "docstring...
5
stack_v2_sparse_classes_30k_train_000301
Implement the Python class `TraccarScanner` described below. Class description: Define an object to retrieve Traccar data. Method signatures and docstrings: - def __init__(self, api: ApiClient, hass: HomeAssistant, async_see: AsyncSeeCallback, scan_interval: timedelta, max_accuracy: int, skip_accuracy_on: bool, custo...
Implement the Python class `TraccarScanner` described below. Class description: Define an object to retrieve Traccar data. Method signatures and docstrings: - def __init__(self, api: ApiClient, hass: HomeAssistant, async_see: AsyncSeeCallback, scan_interval: timedelta, max_accuracy: int, skip_accuracy_on: bool, custo...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class TraccarScanner: """Define an object to retrieve Traccar data.""" def __init__(self, api: ApiClient, hass: HomeAssistant, async_see: AsyncSeeCallback, scan_interval: timedelta, max_accuracy: int, skip_accuracy_on: bool, custom_attributes: list[str], event_types: list[str]) -> None: ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TraccarScanner: """Define an object to retrieve Traccar data.""" def __init__(self, api: ApiClient, hass: HomeAssistant, async_see: AsyncSeeCallback, scan_interval: timedelta, max_accuracy: int, skip_accuracy_on: bool, custom_attributes: list[str], event_types: list[str]) -> None: """Initialize."...
the_stack_v2_python_sparse
homeassistant/components/traccar/device_tracker.py
home-assistant/core
train
35,501
1bd8795529d5efd70c825c5a9836f14544a5d1d2
[ "self.__tracks = track_list\nself.__album_title = album_title\nself.__album_artist = album_artist\nself.genre = genre\nself.year = year", "if track.get_album() == self.__album_title:\n self.__tracks.append(track)\nelse:\n print(\"*** Track {} doesn't belong to album. ***\".format(track))" ]
<|body_start_0|> self.__tracks = track_list self.__album_title = album_title self.__album_artist = album_artist self.genre = genre self.year = year <|end_body_0|> <|body_start_1|> if track.get_album() == self.__album_title: self.__tracks.append(track) ...
Album
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Album: def __init__(self, album_title, album_artist, track_list=[], genre=None, year=None): """Initializes an instance of the Album object.""" <|body_0|> def add_to_album(self, track: Track): """Adds a track to the album track list.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_025913
2,349
no_license
[ { "docstring": "Initializes an instance of the Album object.", "name": "__init__", "signature": "def __init__(self, album_title, album_artist, track_list=[], genre=None, year=None)" }, { "docstring": "Adds a track to the album track list.", "name": "add_to_album", "signature": "def add_t...
2
null
Implement the Python class `Album` described below. Class description: Implement the Album class. Method signatures and docstrings: - def __init__(self, album_title, album_artist, track_list=[], genre=None, year=None): Initializes an instance of the Album object. - def add_to_album(self, track: Track): Adds a track t...
Implement the Python class `Album` described below. Class description: Implement the Album class. Method signatures and docstrings: - def __init__(self, album_title, album_artist, track_list=[], genre=None, year=None): Initializes an instance of the Album object. - def add_to_album(self, track: Track): Adds a track t...
b05b05728713637b1976a8203c2c97dbbfbb6a94
<|skeleton|> class Album: def __init__(self, album_title, album_artist, track_list=[], genre=None, year=None): """Initializes an instance of the Album object.""" <|body_0|> def add_to_album(self, track: Track): """Adds a track to the album track list.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Album: def __init__(self, album_title, album_artist, track_list=[], genre=None, year=None): """Initializes an instance of the Album object.""" self.__tracks = track_list self.__album_title = album_title self.__album_artist = album_artist self.genre = genre self....
the_stack_v2_python_sparse
ch11/exercises/exercise 04.py
Pshypher/tpocup
train
0
1fd11d927fa29686727bdf6229280b7422c59679
[ "if not self.get_accepted_answer(answer.question):\n answer.accepted = True\n answer.save()\n answer_accepted.send(sender=Answer, instance=answer)\nelse:\n answer = None\nreturn answer", "try:\n answer = Answer.objects.get(question=question, accepted=True)\nexcept ObjectDoesNotExist:\n answer = ...
<|body_start_0|> if not self.get_accepted_answer(answer.question): answer.accepted = True answer.save() answer_accepted.send(sender=Answer, instance=answer) else: answer = None return answer <|end_body_0|> <|body_start_1|> try: ...
QuestionManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionManager: def accept_answer(self, answer): """Accepts an @answer as the correct answer to a question. Each question can only have max 1 accepted answer.""" <|body_0|> def get_accepted_answer(self, question): """Returns the accepted answer for target @question ...
stack_v2_sparse_classes_36k_train_025914
4,799
permissive
[ { "docstring": "Accepts an @answer as the correct answer to a question. Each question can only have max 1 accepted answer.", "name": "accept_answer", "signature": "def accept_answer(self, answer)" }, { "docstring": "Returns the accepted answer for target @question if it has one, otherwise return...
5
stack_v2_sparse_classes_30k_train_003492
Implement the Python class `QuestionManager` described below. Class description: Implement the QuestionManager class. Method signatures and docstrings: - def accept_answer(self, answer): Accepts an @answer as the correct answer to a question. Each question can only have max 1 accepted answer. - def get_accepted_answe...
Implement the Python class `QuestionManager` described below. Class description: Implement the QuestionManager class. Method signatures and docstrings: - def accept_answer(self, answer): Accepts an @answer as the correct answer to a question. Each question can only have max 1 accepted answer. - def get_accepted_answe...
5f8f3b682ac28fd3f464e7a993c3988c1a49eb02
<|skeleton|> class QuestionManager: def accept_answer(self, answer): """Accepts an @answer as the correct answer to a question. Each question can only have max 1 accepted answer.""" <|body_0|> def get_accepted_answer(self, question): """Returns the accepted answer for target @question ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionManager: def accept_answer(self, answer): """Accepts an @answer as the correct answer to a question. Each question can only have max 1 accepted answer.""" if not self.get_accepted_answer(answer.question): answer.accepted = True answer.save() answer_a...
the_stack_v2_python_sparse
eruditio/shared_apps/django_qa/models.py
genghisu/eruditio
train
0
628b037a271c4a7f535c147e791ad4261b5c813f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MailAssessmentRequest()", "from .mail_destination_routing_reason import MailDestinationRoutingReason\nfrom .threat_assessment_request import ThreatAssessmentRequest\nfrom .mail_destination_routing_reason import MailDestinationRoutingRe...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MailAssessmentRequest() <|end_body_0|> <|body_start_1|> from .mail_destination_routing_reason import MailDestinationRoutingReason from .threat_assessment_request import ThreatAssessmentR...
MailAssessmentRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailAssessmentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailAssessmentRequest: """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 th...
stack_v2_sparse_classes_36k_train_025915
3,338
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: MailAssessmentRequest", "name": "create_from_discriminator_value", "signature": "def create_from_discriminat...
3
null
Implement the Python class `MailAssessmentRequest` described below. Class description: Implement the MailAssessmentRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailAssessmentRequest: Creates a new instance of the appropriate class base...
Implement the Python class `MailAssessmentRequest` described below. Class description: Implement the MailAssessmentRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailAssessmentRequest: Creates a new instance of the appropriate class base...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MailAssessmentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailAssessmentRequest: """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 th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailAssessmentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MailAssessmentRequest: """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 Retur...
the_stack_v2_python_sparse
msgraph/generated/models/mail_assessment_request.py
microsoftgraph/msgraph-sdk-python
train
135
c6491f977526c597940112798fa0afff24a5b320
[ "if self.target_not_in_range(nums, target, num_sum, pointer):\n return 0\nif pointer == len(nums) and num_sum == target:\n return 1\nadd_current = self.findTargetSumWays(nums, target, num_sum + nums[pointer], pointer + 1)\nsubtract_current = self.findTargetSumWays(nums, target, num_sum - nums[pointer], pointe...
<|body_start_0|> if self.target_not_in_range(nums, target, num_sum, pointer): return 0 if pointer == len(nums) and num_sum == target: return 1 add_current = self.findTargetSumWays(nums, target, num_sum + nums[pointer], pointer + 1) subtract_current = self.findTarg...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays(self, nums: [int], target: int, num_sum: int=0, pointer: int=0) -> int: """Find the number of ways to reach a value by either addint or subtracting each element of the input list. Input: :nums: [int] -- list of integers to evaluate :target: int -- value th...
stack_v2_sparse_classes_36k_train_025916
3,273
no_license
[ { "docstring": "Find the number of ways to reach a value by either addint or subtracting each element of the input list. Input: :nums: [int] -- list of integers to evaluate :target: int -- value that we want to reach :num_sum: int -- running total for the current path :pointer: int -- index of the number to eva...
2
stack_v2_sparse_classes_30k_train_019358
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: [int], target: int, num_sum: int=0, pointer: int=0) -> int: Find the number of ways to reach a value by either addint or subtracting each elemen...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums: [int], target: int, num_sum: int=0, pointer: int=0) -> int: Find the number of ways to reach a value by either addint or subtracting each elemen...
452245e0e5a86f712d99df189821331a0a91db94
<|skeleton|> class Solution: def findTargetSumWays(self, nums: [int], target: int, num_sum: int=0, pointer: int=0) -> int: """Find the number of ways to reach a value by either addint or subtracting each element of the input list. Input: :nums: [int] -- list of integers to evaluate :target: int -- value th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays(self, nums: [int], target: int, num_sum: int=0, pointer: int=0) -> int: """Find the number of ways to reach a value by either addint or subtracting each element of the input list. Input: :nums: [int] -- list of integers to evaluate :target: int -- value that we want to ...
the_stack_v2_python_sparse
algorithm/494.1.TO_target_sum.py
potatoHVAC/leetcode_challenges
train
2
b47907afce20bb2bd6970ed8b7cb28f3709acbb2
[ "total_val = 0\nprev_val = 0\nfor i, c in enumerate(s):\n curr_val = self.val_map[c]\n total_val += curr_val\n if prev_val > 0 and prev_val < curr_val:\n total_val -= 2 * prev_val\n prev_val = curr_val\nreturn total_val", "result = 0\nprev = 0\nfor c in reversed(s):\n v = self.val_map[c]\n ...
<|body_start_0|> total_val = 0 prev_val = 0 for i, c in enumerate(s): curr_val = self.val_map[c] total_val += curr_val if prev_val > 0 and prev_val < curr_val: total_val -= 2 * prev_val prev_val = curr_val return total_val <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def romanToInt_v1(self, s: str) -> int: """Look back. LeetCode runtime: 44ms, 13.8 MB. (beats 77.6%)""" <|body_0|> def romanToInt_v2(self, s: str) -> int: """Use reversed order. LeetCode: 36ms, 13.9 MB; beats 96.82%.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_025917
2,837
no_license
[ { "docstring": "Look back. LeetCode runtime: 44ms, 13.8 MB. (beats 77.6%)", "name": "romanToInt_v1", "signature": "def romanToInt_v1(self, s: str) -> int" }, { "docstring": "Use reversed order. LeetCode: 36ms, 13.9 MB; beats 96.82%.", "name": "romanToInt_v2", "signature": "def romanToInt...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def romanToInt_v1(self, s: str) -> int: Look back. LeetCode runtime: 44ms, 13.8 MB. (beats 77.6%) - def romanToInt_v2(self, s: str) -> int: Use reversed order. LeetCode: 36ms, 13...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def romanToInt_v1(self, s: str) -> int: Look back. LeetCode runtime: 44ms, 13.8 MB. (beats 77.6%) - def romanToInt_v2(self, s: str) -> int: Use reversed order. LeetCode: 36ms, 13...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def romanToInt_v1(self, s: str) -> int: """Look back. LeetCode runtime: 44ms, 13.8 MB. (beats 77.6%)""" <|body_0|> def romanToInt_v2(self, s: str) -> int: """Use reversed order. LeetCode: 36ms, 13.9 MB; beats 96.82%.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def romanToInt_v1(self, s: str) -> int: """Look back. LeetCode runtime: 44ms, 13.8 MB. (beats 77.6%)""" total_val = 0 prev_val = 0 for i, c in enumerate(s): curr_val = self.val_map[c] total_val += curr_val if prev_val > 0 and prev_v...
the_stack_v2_python_sparse
python3/string_array/roman_to_integer.py
victorchu/algorithms
train
0
5825a68147bc4c22179c80b5bd1efd302f40eb14
[ "if not root:\n return cls.TMPL.format('')\nvalues = []\nqueue = [root]\nfor node in queue:\n if not node:\n values.append(cls.EMPTY)\n continue\n values.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\nwhile values[-1] == cls.EMPTY:\n values.pop()\nreturn ...
<|body_start_0|> if not root: return cls.TMPL.format('') values = [] queue = [root] for node in queue: if not node: values.append(cls.EMPTY) continue values.append(str(node.val)) queue.append(node.left) ...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def serialize(cls, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(cls, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_025918
1,641
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(cls, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserialize...
2
null
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def serialize(cls, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(cls, data): Decodes your encoded data to tree. :type data: str...
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def serialize(cls, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(cls, data): Decodes your encoded data to tree. :type data: str...
91892fd64281d96b8a9d5c0d57b938c314ae71be
<|skeleton|> class BinaryTree: def serialize(cls, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(cls, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTree: def serialize(cls, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return cls.TMPL.format('') values = [] queue = [root] for node in queue: if not node: values.append(cls.E...
the_stack_v2_python_sparse
topic/tree/python/binary_tree.py
jaychsu/algorithm
train
143
0cb7177eb6db88d49cb5c4e74f853ee9c041edb1
[ "self.body = body\nif notif_type not in ['Error', 'Feedback', 'Misc']:\n self.notif_type = 'Invalid'\nelse:\n self.notif_type = notif_type\nself.guild, self.channel, self.user = (guild, channel, user)\nself.time = time_module.strftime('%D %T PST')", "embed = discord.Embed()\nif self.notif_type == 'Error':\n...
<|body_start_0|> self.body = body if notif_type not in ['Error', 'Feedback', 'Misc']: self.notif_type = 'Invalid' else: self.notif_type = notif_type self.guild, self.channel, self.user = (guild, channel, user) self.time = time_module.strftime('%D %T PST') ...
DevNotif
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DevNotif: def __init__(self, body, notif_type, guild, channel, user): """Creates a DevNotif class. Params: body: str notif_type: str guild: discord.Guild() channel: discord.Channel() user: discord.User() time: int DevNotif() -> None""" <|body_0|> def format_into_embed(self):...
stack_v2_sparse_classes_36k_train_025919
2,135
no_license
[ { "docstring": "Creates a DevNotif class. Params: body: str notif_type: str guild: discord.Guild() channel: discord.Channel() user: discord.User() time: int DevNotif() -> None", "name": "__init__", "signature": "def __init__(self, body, notif_type, guild, channel, user)" }, { "docstring": "Forma...
2
stack_v2_sparse_classes_30k_train_017031
Implement the Python class `DevNotif` described below. Class description: Implement the DevNotif class. Method signatures and docstrings: - def __init__(self, body, notif_type, guild, channel, user): Creates a DevNotif class. Params: body: str notif_type: str guild: discord.Guild() channel: discord.Channel() user: di...
Implement the Python class `DevNotif` described below. Class description: Implement the DevNotif class. Method signatures and docstrings: - def __init__(self, body, notif_type, guild, channel, user): Creates a DevNotif class. Params: body: str notif_type: str guild: discord.Guild() channel: discord.Channel() user: di...
8b1fb4bb4aff32685c989626f551cae3b97c3120
<|skeleton|> class DevNotif: def __init__(self, body, notif_type, guild, channel, user): """Creates a DevNotif class. Params: body: str notif_type: str guild: discord.Guild() channel: discord.Channel() user: discord.User() time: int DevNotif() -> None""" <|body_0|> def format_into_embed(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DevNotif: def __init__(self, body, notif_type, guild, channel, user): """Creates a DevNotif class. Params: body: str notif_type: str guild: discord.Guild() channel: discord.Channel() user: discord.User() time: int DevNotif() -> None""" self.body = body if notif_type not in ['Error', 'F...
the_stack_v2_python_sparse
cogs/util/devnotif.py
GeoffreyWesthoff/lilac-mirror
train
0
e5d1fbd725e3dcfa1fa4c667e06a871641547634
[ "data = {'username': 'some_username', 'email': 'some_email@gmail.com', 'password': 'some_password'}\nresponse = self.client.post(self.url, data)\nself.assertEqual(response.status_code, status.HTTP_201_CREATED)\nself.assertEqual(Profile.objects.count(), 1)\nself.assertEqual(Profile.objects.get().user.username, 'some...
<|body_start_0|> data = {'username': 'some_username', 'email': 'some_email@gmail.com', 'password': 'some_password'} response = self.client.post(self.url, data) self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(Profile.objects.count(), 1) self.assert...
UserRegistrationTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRegistrationTests: def test_register_user(self): """Ensure we can register a new user profile""" <|body_0|> def test_email_required(self): """Ensure that email field is required and cannot be submitted blank""" <|body_1|> def test_unique_email(self):...
stack_v2_sparse_classes_36k_train_025920
13,549
permissive
[ { "docstring": "Ensure we can register a new user profile", "name": "test_register_user", "signature": "def test_register_user(self)" }, { "docstring": "Ensure that email field is required and cannot be submitted blank", "name": "test_email_required", "signature": "def test_email_require...
3
stack_v2_sparse_classes_30k_train_004138
Implement the Python class `UserRegistrationTests` described below. Class description: Implement the UserRegistrationTests class. Method signatures and docstrings: - def test_register_user(self): Ensure we can register a new user profile - def test_email_required(self): Ensure that email field is required and cannot ...
Implement the Python class `UserRegistrationTests` described below. Class description: Implement the UserRegistrationTests class. Method signatures and docstrings: - def test_register_user(self): Ensure we can register a new user profile - def test_email_required(self): Ensure that email field is required and cannot ...
9fa31e01c8fc3496f92540081a8c078474d59c0f
<|skeleton|> class UserRegistrationTests: def test_register_user(self): """Ensure we can register a new user profile""" <|body_0|> def test_email_required(self): """Ensure that email field is required and cannot be submitted blank""" <|body_1|> def test_unique_email(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserRegistrationTests: def test_register_user(self): """Ensure we can register a new user profile""" data = {'username': 'some_username', 'email': 'some_email@gmail.com', 'password': 'some_password'} response = self.client.post(self.url, data) self.assertEqual(response.status_c...
the_stack_v2_python_sparse
player/tests.py
apoorvaeternity/DirectMe
train
1
f29c67392d53702387c32d9e921e15f1a9d29a95
[ "self._attr_available = False\nself._gitlab_data = gitlab_data\nself._attr_name = name", "if self.native_value == 'success':\n return ICON_HAPPY\nif self.native_value == 'failed':\n return ICON_SAD\nreturn ICON_OTHER", "self._gitlab_data.update()\nself._attr_native_value = self._gitlab_data.status\nself._...
<|body_start_0|> self._attr_available = False self._gitlab_data = gitlab_data self._attr_name = name <|end_body_0|> <|body_start_1|> if self.native_value == 'success': return ICON_HAPPY if self.native_value == 'failed': return ICON_SAD return ICON...
Representation of a GitLab sensor.
GitLabSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitLabSensor: """Representation of a GitLab sensor.""" def __init__(self, gitlab_data: GitLabData, name: str) -> None: """Initialize the GitLab sensor.""" <|body_0|> def icon(self) -> str: """Return the icon to use in the frontend.""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_025921
5,282
permissive
[ { "docstring": "Initialize the GitLab sensor.", "name": "__init__", "signature": "def __init__(self, gitlab_data: GitLabData, name: str) -> None" }, { "docstring": "Return the icon to use in the frontend.", "name": "icon", "signature": "def icon(self) -> str" }, { "docstring": "C...
3
stack_v2_sparse_classes_30k_val_000570
Implement the Python class `GitLabSensor` described below. Class description: Representation of a GitLab sensor. Method signatures and docstrings: - def __init__(self, gitlab_data: GitLabData, name: str) -> None: Initialize the GitLab sensor. - def icon(self) -> str: Return the icon to use in the frontend. - def upda...
Implement the Python class `GitLabSensor` described below. Class description: Representation of a GitLab sensor. Method signatures and docstrings: - def __init__(self, gitlab_data: GitLabData, name: str) -> None: Initialize the GitLab sensor. - def icon(self) -> str: Return the icon to use in the frontend. - def upda...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class GitLabSensor: """Representation of a GitLab sensor.""" def __init__(self, gitlab_data: GitLabData, name: str) -> None: """Initialize the GitLab sensor.""" <|body_0|> def icon(self) -> str: """Return the icon to use in the frontend.""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GitLabSensor: """Representation of a GitLab sensor.""" def __init__(self, gitlab_data: GitLabData, name: str) -> None: """Initialize the GitLab sensor.""" self._attr_available = False self._gitlab_data = gitlab_data self._attr_name = name def icon(self) -> str: ...
the_stack_v2_python_sparse
homeassistant/components/gitlab_ci/sensor.py
home-assistant/core
train
35,501
6a3792edf4a166cee32fcd1d885a377d65d0d95a
[ "super(HME, self).__init__()\nself.vid_encoder = vid_encoder\nself.qns_encoder = qns_encoder\ndim = qns_encoder.dim_hidden\nself.temp_att_a = TempAttention(dim * 2, dim * 2, hidden_dim=256)\nself.temp_att_m = TempAttention(dim * 2, dim * 2, hidden_dim=256)\nself.mrm_vid = MemoryRamTwoStreamModule(dim, dim, max_len_...
<|body_start_0|> super(HME, self).__init__() self.vid_encoder = vid_encoder self.qns_encoder = qns_encoder dim = qns_encoder.dim_hidden self.temp_att_a = TempAttention(dim * 2, dim * 2, hidden_dim=256) self.temp_att_m = TempAttention(dim * 2, dim * 2, hidden_dim=256) ...
HME
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HME: def __init__(self, vid_encoder, qns_encoder, max_len_v, max_len_q, device, input_drop_p=0.2): """Heterogeneous memory enhanced multimodal attention model for video question answering (CVPR19) :param vid_encoder: :param qns_encoder: :param ans_decoder: :param device:""" <|bod...
stack_v2_sparse_classes_36k_train_025922
4,219
permissive
[ { "docstring": "Heterogeneous memory enhanced multimodal attention model for video question answering (CVPR19) :param vid_encoder: :param qns_encoder: :param ans_decoder: :param device:", "name": "__init__", "signature": "def __init__(self, vid_encoder, qns_encoder, max_len_v, max_len_q, device, input_d...
3
stack_v2_sparse_classes_30k_train_011961
Implement the Python class `HME` described below. Class description: Implement the HME class. Method signatures and docstrings: - def __init__(self, vid_encoder, qns_encoder, max_len_v, max_len_q, device, input_drop_p=0.2): Heterogeneous memory enhanced multimodal attention model for video question answering (CVPR19)...
Implement the Python class `HME` described below. Class description: Implement the HME class. Method signatures and docstrings: - def __init__(self, vid_encoder, qns_encoder, max_len_v, max_len_q, device, input_drop_p=0.2): Heterogeneous memory enhanced multimodal attention model for video question answering (CVPR19)...
f54f850a91e64dca4452598154838924548f3b2f
<|skeleton|> class HME: def __init__(self, vid_encoder, qns_encoder, max_len_v, max_len_q, device, input_drop_p=0.2): """Heterogeneous memory enhanced multimodal attention model for video question answering (CVPR19) :param vid_encoder: :param qns_encoder: :param ans_decoder: :param device:""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HME: def __init__(self, vid_encoder, qns_encoder, max_len_v, max_len_q, device, input_drop_p=0.2): """Heterogeneous memory enhanced multimodal attention model for video question answering (CVPR19) :param vid_encoder: :param qns_encoder: :param ans_decoder: :param device:""" super(HME, self).__...
the_stack_v2_python_sparse
networks/VQAModel/HME.py
ankitshah009/NExT-QA
train
0
2157d5c7ff067216be074f32e28949a8315cf862
[ "if not root:\n return True\nstack, in_order = ([], float('-inf'))\nwhile root or stack:\n while root:\n stack.append(root)\n root = root.left\n root = stack.pop()\n if root.val <= in_order:\n return False\n in_order = root.val\n root = root.right\nreturn True", "if not root...
<|body_start_0|> if not root: return True stack, in_order = ([], float('-inf')) while root or stack: while root: stack.append(root) root = root.left root = stack.pop() if root.val <= in_order: return ...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def is_valid_via_in_order(self, root: 'TreeNode') -> bool: """Approach: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def is_valid_via_dfs(self, root: 'TreeNode') -> bool: """Approach: DFS Time Complex...
stack_v2_sparse_classes_36k_train_025923
2,100
no_license
[ { "docstring": "Approach: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:", "name": "is_valid_via_in_order", "signature": "def is_valid_via_in_order(self, root: 'TreeNode') -> bool" }, { "docstring": "Approach: DFS Time Complexity: O(N) Space Complexity: O(N...
3
null
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_valid_via_in_order(self, root: 'TreeNode') -> bool: Approach: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def is_valid_via_...
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_valid_via_in_order(self, root: 'TreeNode') -> bool: Approach: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def is_valid_via_...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BinaryTree: def is_valid_via_in_order(self, root: 'TreeNode') -> bool: """Approach: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def is_valid_via_dfs(self, root: 'TreeNode') -> bool: """Approach: DFS Time Complex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTree: def is_valid_via_in_order(self, root: 'TreeNode') -> bool: """Approach: In-order traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" if not root: return True stack, in_order = ([], float('-inf')) while root or stack: ...
the_stack_v2_python_sparse
revisited/trees/valid_bst.py
Shiv2157k/leet_code
train
1
b609240df84899e0a9278b5e2260a27fb2c49a5a
[ "ans = collections.defaultdict(list)\nfor s in strs:\n ans[tuple(sorted(s))].append(s)\nreturn list(ans.values())", "ans = collections.defaultdict(list)\nfor s in strs:\n word = [0] * 26\n for c in s:\n word[ord(c) - 97] += 1\n ans[tuple(word)].append(s)\nreturn list(ans.values())" ]
<|body_start_0|> ans = collections.defaultdict(list) for s in strs: ans[tuple(sorted(s))].append(s) return list(ans.values()) <|end_body_0|> <|body_start_1|> ans = collections.defaultdict(list) for s in strs: word = [0] * 26 for c in s: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams1(self, strs): """思路:哈希+tuple 1. 对每个单词进行排序,使得key唯一 2. 将list转换为可哈希的tuple,作为dict的key @param strs: @return:""" <|body_0|> def groupAnagrams2(self, strs): """思路:哈希+tuple 1. 上面的方案中如果字符串长度很大,排序会比较耗时 2. 通过长度为26的list记录每个字母出现的次数,最后转换成可哈希的tuple,作为dic...
stack_v2_sparse_classes_36k_train_025924
1,695
no_license
[ { "docstring": "思路:哈希+tuple 1. 对每个单词进行排序,使得key唯一 2. 将list转换为可哈希的tuple,作为dict的key @param strs: @return:", "name": "groupAnagrams1", "signature": "def groupAnagrams1(self, strs)" }, { "docstring": "思路:哈希+tuple 1. 上面的方案中如果字符串长度很大,排序会比较耗时 2. 通过长度为26的list记录每个字母出现的次数,最后转换成可哈希的tuple,作为dict的key @param s...
2
stack_v2_sparse_classes_30k_train_010474
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams1(self, strs): 思路:哈希+tuple 1. 对每个单词进行排序,使得key唯一 2. 将list转换为可哈希的tuple,作为dict的key @param strs: @return: - def groupAnagrams2(self, strs): 思路:哈希+tuple 1. 上面的方案中如果字符...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams1(self, strs): 思路:哈希+tuple 1. 对每个单词进行排序,使得key唯一 2. 将list转换为可哈希的tuple,作为dict的key @param strs: @return: - def groupAnagrams2(self, strs): 思路:哈希+tuple 1. 上面的方案中如果字符...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def groupAnagrams1(self, strs): """思路:哈希+tuple 1. 对每个单词进行排序,使得key唯一 2. 将list转换为可哈希的tuple,作为dict的key @param strs: @return:""" <|body_0|> def groupAnagrams2(self, strs): """思路:哈希+tuple 1. 上面的方案中如果字符串长度很大,排序会比较耗时 2. 通过长度为26的list记录每个字母出现的次数,最后转换成可哈希的tuple,作为dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams1(self, strs): """思路:哈希+tuple 1. 对每个单词进行排序,使得key唯一 2. 将list转换为可哈希的tuple,作为dict的key @param strs: @return:""" ans = collections.defaultdict(list) for s in strs: ans[tuple(sorted(s))].append(s) return list(ans.values()) def groupAnagrams...
the_stack_v2_python_sparse
LeetCode/哈希表(hash table)/49. 字母异位词分组.py
yiming1012/MyLeetCode
train
2
dd3c30de538f893a183f0f7e21257470fbcd7bc9
[ "obj = super(Bartels, cls).__new__(cls)\nparse(local_fname=local_fname, data_map=obj)\nobj._interval_map = OrderedDict()\ntimes_1 = [x.dt for x in obj.values()[:-1]]\ntimes_2 = [x.dt for x in obj.values()[1:]]\nfor b_id, (t1, t2) in zip(obj, zip(times_1, times_2)):\n interval = P.closed_open(t1, t2)\n obj._in...
<|body_start_0|> obj = super(Bartels, cls).__new__(cls) parse(local_fname=local_fname, data_map=obj) obj._interval_map = OrderedDict() times_1 = [x.dt for x in obj.values()[:-1]] times_2 = [x.dt for x in obj.values()[1:]] for b_id, (t1, t2) in zip(obj, zip(times_1, times_...
Bartels
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bartels: def __new__(cls, local_fname=BARTELS_FNAME): """Build a new Bartels rotation information object.""" <|body_0|> def __call__(self, dt): """Return the Bartels rotation number corresponding to the date time *dt*.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025925
4,515
permissive
[ { "docstring": "Build a new Bartels rotation information object.", "name": "__new__", "signature": "def __new__(cls, local_fname=BARTELS_FNAME)" }, { "docstring": "Return the Bartels rotation number corresponding to the date time *dt*.", "name": "__call__", "signature": "def __call__(sel...
2
null
Implement the Python class `Bartels` described below. Class description: Implement the Bartels class. Method signatures and docstrings: - def __new__(cls, local_fname=BARTELS_FNAME): Build a new Bartels rotation information object. - def __call__(self, dt): Return the Bartels rotation number corresponding to the date...
Implement the Python class `Bartels` described below. Class description: Implement the Bartels class. Method signatures and docstrings: - def __new__(cls, local_fname=BARTELS_FNAME): Build a new Bartels rotation information object. - def __call__(self, dt): Return the Bartels rotation number corresponding to the date...
e364be68cb0cadbeea10ca569963b8f99aa7b05b
<|skeleton|> class Bartels: def __new__(cls, local_fname=BARTELS_FNAME): """Build a new Bartels rotation information object.""" <|body_0|> def __call__(self, dt): """Return the Bartels rotation number corresponding to the date time *dt*.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bartels: def __new__(cls, local_fname=BARTELS_FNAME): """Build a new Bartels rotation information object.""" obj = super(Bartels, cls).__new__(cls) parse(local_fname=local_fname, data_map=obj) obj._interval_map = OrderedDict() times_1 = [x.dt for x in obj.values()[:-1]]...
the_stack_v2_python_sparse
pyrsss/l1/bartels.py
butala/pyrsss
train
7
a7e27c730eebd63102939b372b90e30353ee2e74
[ "LOG.debug('image_defined called for instance', instance=instance)\ntry:\n client = self.get_session(instance.host)\n return client.alias_defined(instance.image_ref)\nexcept lxd_exceptions.APIError as ex:\n if ex.status_code == 404:\n return False\n else:\n msg = _('Failed to communicate w...
<|body_start_0|> LOG.debug('image_defined called for instance', instance=instance) try: client = self.get_session(instance.host) return client.alias_defined(instance.image_ref) except lxd_exceptions.APIError as ex: if ex.status_code == 404: ret...
Image functions for LXD.
ImageMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageMixin: """Image functions for LXD.""" def image_defined(self, instance): """Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise""" <|body_0|> def create_alias...
stack_v2_sparse_classes_36k_train_025926
4,586
permissive
[ { "docstring": "Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise", "name": "image_defined", "signature": "def image_defined(self, instance)" }, { "docstring": "Creates an alias for a gi...
3
stack_v2_sparse_classes_30k_train_012718
Implement the Python class `ImageMixin` described below. Class description: Image functions for LXD. Method signatures and docstrings: - def image_defined(self, instance): Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, Fa...
Implement the Python class `ImageMixin` described below. Class description: Image functions for LXD. Method signatures and docstrings: - def image_defined(self, instance): Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, Fa...
b305843e268ce4044b7fbb930b353bdbd2ad0c44
<|skeleton|> class ImageMixin: """Image functions for LXD.""" def image_defined(self, instance): """Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise""" <|body_0|> def create_alias...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageMixin: """Image functions for LXD.""" def image_defined(self, instance): """Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise""" LOG.debug('image_defined called for instance'...
the_stack_v2_python_sparse
nova_lxd/nova/virt/lxd/session/image.py
bkuschel/nova-lxd
train
1
1f0065e62120dd04007ed66a4f6a594b8730cf0d
[ "nums.sort()\na = nums[0]\nfor i in nums[1:]:\n if i == a:\n return a\n else:\n a = i", "left = 1\nright = len(nums) - 1\nwhile left < right:\n mid = left + (right - left) // 2\n cnt = 0\n for num in nums:\n if num <= mid:\n cnt += 1\n if cnt <= mid:\n left...
<|body_start_0|> nums.sort() a = nums[0] for i in nums[1:]: if i == a: return a else: a = i <|end_body_0|> <|body_start_1|> left = 1 right = len(nums) - 1 while left < right: mid = left + (right - left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate_2div(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def findDuplicate_2point(self, nums): """:type nums: List[int] :rty...
stack_v2_sparse_classes_36k_train_025927
1,740
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate", "signature": "def findDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate_2div", "signature": "def findDuplicate_2div(self, nums)" }, { "docstring": ":typ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): :type nums: List[int] :rtype: int - def findDuplicate_2div(self, nums): :type nums: List[int] :rtype: int - def findDuplicate_2point(self, nums): :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): :type nums: List[int] :rtype: int - def findDuplicate_2div(self, nums): :type nums: List[int] :rtype: int - def findDuplicate_2point(self, nums): :...
3f4284330f9771037ca59e2e6a94122e51e58540
<|skeleton|> class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate_2div(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def findDuplicate_2point(self, nums): """:type nums: List[int] :rty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" nums.sort() a = nums[0] for i in nums[1:]: if i == a: return a else: a = i def findDuplicate_2div(self, nums): """:type nums: Li...
the_stack_v2_python_sparse
Leetcode/287.寻找重复数.py
myf-algorithm/Leetcode
train
1
2ac79297d833e31d205c61d8eb0ecbc295ee55b7
[ "datas1 = []\ndatas2 = []\nfor data in datas:\n dataF = FilterData.filterFunction_key_words(data)\n if dataF != None:\n datas1.append(dataF)\n else:\n datas2.append(data)\nreturn (datas1, datas2)", "datas1 = []\ndatas2 = []\nfor data in datas:\n dataF = FilterData.filterFunction_site(dat...
<|body_start_0|> datas1 = [] datas2 = [] for data in datas: dataF = FilterData.filterFunction_key_words(data) if dataF != None: datas1.append(dataF) else: datas2.append(data) return (datas1, datas2) <|end_body_0|> <|bod...
DataCuter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" <|body_0|> def dataCuterBySite(self, datas): """位置过滤器""" <|body_1|> <|end_skeleton|> <|body_start_0|> datas1 = [] datas2 = [] for data in datas: dataF = FilterData....
stack_v2_sparse_classes_36k_train_025928
899
no_license
[ { "docstring": "关键词过滤器", "name": "dataCuterByKey", "signature": "def dataCuterByKey(self, datas)" }, { "docstring": "位置过滤器", "name": "dataCuterBySite", "signature": "def dataCuterBySite(self, datas)" } ]
2
stack_v2_sparse_classes_30k_train_017550
Implement the Python class `DataCuter` described below. Class description: Implement the DataCuter class. Method signatures and docstrings: - def dataCuterByKey(self, datas): 关键词过滤器 - def dataCuterBySite(self, datas): 位置过滤器
Implement the Python class `DataCuter` described below. Class description: Implement the DataCuter class. Method signatures and docstrings: - def dataCuterByKey(self, datas): 关键词过滤器 - def dataCuterBySite(self, datas): 位置过滤器 <|skeleton|> class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" ...
5eda21e66f65dd6f7f79e56441073bdcb7f18bdf
<|skeleton|> class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" <|body_0|> def dataCuterBySite(self, datas): """位置过滤器""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataCuter: def dataCuterByKey(self, datas): """关键词过滤器""" datas1 = [] datas2 = [] for data in datas: dataF = FilterData.filterFunction_key_words(data) if dataF != None: datas1.append(dataF) else: datas2.append(d...
the_stack_v2_python_sparse
clientScrapySystem/DataFilterSystem/src/tool/DataCuter.py
jhfwb/Web-spiders
train
0
ffcc6d3f3c26fcc45994304a6b551b26ae908f73
[ "elems = [(1, 'foo'), (2, 'bar'), (3, 'baz')]\nds = tf.data.Dataset.from_generator(lambda: elems, output_signature=(tf.TensorSpec(shape=(), dtype=tf.int32), tf.TensorSpec(shape=(), dtype=tf.string)))\nnew_ds = ds.map(lambda x, y: x)\nassert_val(first_element_of(new_ds), 1)\npower_func_tf = lambda x, y: (tf.pow(2, x...
<|body_start_0|> elems = [(1, 'foo'), (2, 'bar'), (3, 'baz')] ds = tf.data.Dataset.from_generator(lambda: elems, output_signature=(tf.TensorSpec(shape=(), dtype=tf.int32), tf.TensorSpec(shape=(), dtype=tf.string))) new_ds = ds.map(lambda x, y: x) assert_val(first_element_of(new_ds), 1) ...
test for ops that change dataset element value, mainly
TestDatasetTransform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatasetTransform: """test for ops that change dataset element value, mainly""" def test_map(self): """ds.map(func): - func: use tf ops whenever possible; use tf.py_function if non-tf ops is needed""" <|body_0|> def test_apply(self): """ds.apply(trans_func): -...
stack_v2_sparse_classes_36k_train_025929
2,167
no_license
[ { "docstring": "ds.map(func): - func: use tf ops whenever possible; use tf.py_function if non-tf ops is needed", "name": "test_map", "signature": "def test_map(self)" }, { "docstring": "ds.apply(trans_func): - trans_func: a function with ds argument and ds return", "name": "test_apply", ...
3
null
Implement the Python class `TestDatasetTransform` described below. Class description: test for ops that change dataset element value, mainly Method signatures and docstrings: - def test_map(self): ds.map(func): - func: use tf ops whenever possible; use tf.py_function if non-tf ops is needed - def test_apply(self): ds...
Implement the Python class `TestDatasetTransform` described below. Class description: test for ops that change dataset element value, mainly Method signatures and docstrings: - def test_map(self): ds.map(func): - func: use tf ops whenever possible; use tf.py_function if non-tf ops is needed - def test_apply(self): ds...
4f4bd55d7f0502c188976dda2f95fd25614283f3
<|skeleton|> class TestDatasetTransform: """test for ops that change dataset element value, mainly""" def test_map(self): """ds.map(func): - func: use tf ops whenever possible; use tf.py_function if non-tf ops is needed""" <|body_0|> def test_apply(self): """ds.apply(trans_func): -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDatasetTransform: """test for ops that change dataset element value, mainly""" def test_map(self): """ds.map(func): - func: use tf ops whenever possible; use tf.py_function if non-tf ops is needed""" elems = [(1, 'foo'), (2, 'bar'), (3, 'baz')] ds = tf.data.Dataset.from_genera...
the_stack_v2_python_sparse
com.xulf.learn.ml.tf2/lib_data/test_dataset_transform.py
sankoudai/py-knowledge-center
train
0
76cd6aabee6122feb7811b641799bc8b292e3529
[ "nums.sort()\nresults = []\nfor i in range(len(nums) - 3):\n if i == 0 or nums[i] != nums[i - 1]:\n threeResult = self.threeSum(nums[i + 1:], target - nums[i])\n for item in threeResult:\n results.append([nums[i]] + item)\nreturn results", "res = []\nnums.sort()\nfor i in range(len(num...
<|body_start_0|> nums.sort() results = [] for i in range(len(nums) - 3): if i == 0 or nums[i] != nums[i - 1]: threeResult = self.threeSum(nums[i + 1:], target - nums[i]) for item in threeResult: results.append([nums[i]] + item) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)""" <|body_0|> def threeSum(self, nums, target): """第15...
stack_v2_sparse_classes_36k_train_025930
3,097
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": "第15题 :type nums: List[int]...
2
stack_v2_sparse_classes_30k_train_002027
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-...
0b3bc77cbfe0e45e62c3c8f244e9e3d2421e6121
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)""" <|body_0|> def threeSum(self, nums, target): """第15...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]] https://leetcode.com/problems/4sum/discuss/8545/Python-140ms-beats-100-and-works-for-N-sum-(Ngreater2)""" nums.sort() results = [] for i in range(len(nums) - 3): ...
the_stack_v2_python_sparse
18.py
lailianqi/LeetCodeByPython
train
0
2a095e61c67b839e075b28064d1e28a0148c965e
[ "directions = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nstack = [[i, j]]\n_stack = []\ncnt = 0\nstep = N\nwhile stack and step:\n x, y = stack.pop()\n for p, q in directions:\n _x = p + x\n _y = q + y\n if _x < 0 or _x >= m or _y < 0 or (_y >= n):\n cnt += 1\n else:\n ...
<|body_start_0|> directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] stack = [[i, j]] _stack = [] cnt = 0 step = N while stack and step: x, y = stack.pop() for p, q in directions: _x = p + x _y = q + y if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPaths1(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" <|body_0|> def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" ...
stack_v2_sparse_classes_36k_train_025931
1,870
no_license
[ { "docstring": ":type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int", "name": "findPaths1", "signature": "def findPaths1(self, m, n, N, i, j)" }, { "docstring": ":type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int", "name": "findPaths", "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPaths1(self, m, n, N, i, j): :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int - def findPaths(self, m, n, N, i, j): :type m: int :type n: int ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPaths1(self, m, n, N, i, j): :type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int - def findPaths(self, m, n, N, i, j): :type m: int :type n: int ...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def findPaths1(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" <|body_0|> def findPaths(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findPaths1(self, m, n, N, i, j): """:type m: int :type n: int :type N: int :type i: int :type j: int :rtype: int""" directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] stack = [[i, j]] _stack = [] cnt = 0 step = N while stack and step: ...
the_stack_v2_python_sparse
py/leetcode/573.py
wfeng1991/learnpy
train
0
b71f639763855c226c97cf82de728e53fc019e54
[ "self._sha = sha_type\nself._rsa_key = rsa_key_size\nself._envelope = Envelope(encryption_algorithm, key_type, rsa_key_size, message, mode)\nself._signature = None\nself._env_res = None", "self._env_res = self._envelope.encrypt()\nmessage = str(self._envelope.cipher) + str(self._envelope.crypt_key)\nself._signatu...
<|body_start_0|> self._sha = sha_type self._rsa_key = rsa_key_size self._envelope = Envelope(encryption_algorithm, key_type, rsa_key_size, message, mode) self._signature = None self._env_res = None <|end_body_0|> <|body_start_1|> self._env_res = self._envelope.encrypt() ...
Class Seal represents digital seal. It combines digital envelope and digital signature.
Seal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Seal: """Class Seal represents digital seal. It combines digital envelope and digital signature.""" def __init__(self, encryption_algorithm, key_type, rsa_key_size, message, mode, sha_type): """Initialization method. :param encryption_algorithm: which symmetric algorithm will be used...
stack_v2_sparse_classes_36k_train_025932
1,525
no_license
[ { "docstring": "Initialization method. :param encryption_algorithm: which symmetric algorithm will be used :param key_type: key size for the symmetric algorithm :param rsa_key_size: key size for the asymmetric algorithm :param message: encryption data :param mode: mode of the symmetric algorithm :param sha_type...
3
stack_v2_sparse_classes_30k_train_000055
Implement the Python class `Seal` described below. Class description: Class Seal represents digital seal. It combines digital envelope and digital signature. Method signatures and docstrings: - def __init__(self, encryption_algorithm, key_type, rsa_key_size, message, mode, sha_type): Initialization method. :param enc...
Implement the Python class `Seal` described below. Class description: Class Seal represents digital seal. It combines digital envelope and digital signature. Method signatures and docstrings: - def __init__(self, encryption_algorithm, key_type, rsa_key_size, message, mode, sha_type): Initialization method. :param enc...
6a285ef6a0a0356a942e02e25607fa30c49f7e67
<|skeleton|> class Seal: """Class Seal represents digital seal. It combines digital envelope and digital signature.""" def __init__(self, encryption_algorithm, key_type, rsa_key_size, message, mode, sha_type): """Initialization method. :param encryption_algorithm: which symmetric algorithm will be used...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Seal: """Class Seal represents digital seal. It combines digital envelope and digital signature.""" def __init__(self, encryption_algorithm, key_type, rsa_key_size, message, mode, sha_type): """Initialization method. :param encryption_algorithm: which symmetric algorithm will be used :param key_t...
the_stack_v2_python_sparse
lab2/Seal.py
evukelic/NOS
train
0
c120acd5af964ec3df331bad4fdbd6ba6a8889a2
[ "super(GeLU, self).__init__()\nself.div = P.Div()\nself.div_w = 1.4142135381698608\nself.erf = P.Erf()\nself.add = P.Add()\nself.add_bias = 1.0\nself.mul = P.Mul()\nself.mul_w = 0.5", "output = self.div(x, self.div_w)\noutput = self.erf(output)\noutput = self.add(output, self.add_bias)\noutput = self.mul(x, outpu...
<|body_start_0|> super(GeLU, self).__init__() self.div = P.Div() self.div_w = 1.4142135381698608 self.erf = P.Erf() self.add = P.Add() self.add_bias = 1.0 self.mul = P.Mul() self.mul_w = 0.5 <|end_body_0|> <|body_start_1|> output = self.div(x, sel...
gelu layer
GeLU
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeLU: """gelu layer""" def __init__(self): """init fun""" <|body_0|> def construct(self, x): """construct function""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(GeLU, self).__init__() self.div = P.Div() self.div_w = 1.414...
stack_v2_sparse_classes_36k_train_025933
16,172
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "construct function", "name": "construct", "signature": "def construct(self, x)" } ]
2
null
Implement the Python class `GeLU` described below. Class description: gelu layer Method signatures and docstrings: - def __init__(self): init fun - def construct(self, x): construct function
Implement the Python class `GeLU` described below. Class description: gelu layer Method signatures and docstrings: - def __init__(self): init fun - def construct(self, x): construct function <|skeleton|> class GeLU: """gelu layer""" def __init__(self): """init fun""" <|body_0|> def cons...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class GeLU: """gelu layer""" def __init__(self): """init fun""" <|body_0|> def construct(self, x): """construct function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeLU: """gelu layer""" def __init__(self): """init fun""" super(GeLU, self).__init__() self.div = P.Div() self.div_w = 1.4142135381698608 self.erf = P.Erf() self.add = P.Add() self.add_bias = 1.0 self.mul = P.Mul() self.mul_w = 0.5 ...
the_stack_v2_python_sparse
research/nlp/luke/src/luke/robert.py
mindspore-ai/models
train
301
9e72d71ab50682762f33ec8557006432fbb41843
[ "self.d = collections.deque()\nself.sum = 0\nself.size = size", "self.d.append(val)\nself.sum += val\nif len(self.d) > self.size:\n self.sum -= self.d.popleft()\nreturn self.sum / len(self.d)" ]
<|body_start_0|> self.d = collections.deque() self.sum = 0 self.size = size <|end_body_0|> <|body_start_1|> self.d.append(val) self.sum += val if len(self.d) > self.size: self.sum -= self.d.popleft() return self.sum / len(self.d) <|end_body_1|>
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.d = collections.deque() ...
stack_v2_sparse_classes_36k_train_025934
854
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_018904
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
c27f19fac14b4acef8c631ad5569e1a5c29e9e1f
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.d = collections.deque() self.sum = 0 self.size = size def next(self, val): """:type val: int :rtype: float""" self.d.append(val) self.sum += val...
the_stack_v2_python_sparse
leetcode/p0346 - Moving Average from Data Stream.py
liseyko/CtCI
train
0
adb703394914861c00a080352ae6bdc3c4033771
[ "super(sMacNetwork, self).__init__()\nself.params = params\nself.dim = 512\nself.embed_hidden = params.emb_dim\nself.max_step = 12\nself.dropout = 0.15\ntry:\n self.nb_classes = params.num_classes\nexcept Exception as ex:\n self.logger.warning(\"Couldn't retrieve one or more value(s) from problem_default_valu...
<|body_start_0|> super(sMacNetwork, self).__init__() self.params = params self.dim = 512 self.embed_hidden = params.emb_dim self.max_step = 12 self.dropout = 0.15 try: self.nb_classes = params.num_classes except Exception as ex: sel...
Implementation of the entire ``S-MAC`` model. .. note:: This implementation is a simplified version of the MAC network, where modifications regarding the different units have been done to reduce the number of linear layers (and thus number of parameters). This is part of a submission to the ViGIL workshop for NIPS 2018...
sMacNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sMacNetwork: """Implementation of the entire ``S-MAC`` model. .. note:: This implementation is a simplified version of the MAC network, where modifications regarding the different units have been done to reduce the number of linear layers (and thus number of parameters). This is part of a submiss...
stack_v2_sparse_classes_36k_train_025935
6,378
permissive
[ { "docstring": "Constructor for the ``S-MAC`` network. :param params: dict of parameters (read from configuration ``.yaml`` file). :type params: :py:class:`miprometheus.utils.ParamInterface` :param problem_default_values_: default values coming from the :py:class:`Problem` class. :type problem_default_values_: ...
2
stack_v2_sparse_classes_30k_train_012458
Implement the Python class `sMacNetwork` described below. Class description: Implementation of the entire ``S-MAC`` model. .. note:: This implementation is a simplified version of the MAC network, where modifications regarding the different units have been done to reduce the number of linear layers (and thus number of...
Implement the Python class `sMacNetwork` described below. Class description: Implementation of the entire ``S-MAC`` model. .. note:: This implementation is a simplified version of the MAC network, where modifications regarding the different units have been done to reduce the number of linear layers (and thus number of...
2e82ca75a3e4d4ccba00c5a763097cc0f650a0a4
<|skeleton|> class sMacNetwork: """Implementation of the entire ``S-MAC`` model. .. note:: This implementation is a simplified version of the MAC network, where modifications regarding the different units have been done to reduce the number of linear layers (and thus number of parameters). This is part of a submiss...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sMacNetwork: """Implementation of the entire ``S-MAC`` model. .. note:: This implementation is a simplified version of the MAC network, where modifications regarding the different units have been done to reduce the number of linear layers (and thus number of parameters). This is part of a submission to the Vi...
the_stack_v2_python_sparse
vqa_experiments/s_mac/s_mac.py
msrocean/REMIND
train
1
180fdbbc490edd92fd14d0d15fc9aa6fb114667f
[ "self.__config = config\nself.__logger = SLoggerHandler().getLogger(LoggerNames.EXPERIMENT_C)\nself.__num_gpus = ConfigProvider().get_config('controllerConfig.json')['hardware']['numGPUs']", "for pretext_model_config in self.__config['pretextModelConfigs']:\n model_name = pretext_model_config['modelName']\n ...
<|body_start_0|> self.__config = config self.__logger = SLoggerHandler().getLogger(LoggerNames.EXPERIMENT_C) self.__num_gpus = ConfigProvider().get_config('controllerConfig.json')['hardware']['numGPUs'] <|end_body_0|> <|body_start_1|> for pretext_model_config in self.__config['pretextMo...
The experiment trains each pretext model for each given dataset and saves logs and checkpoints. If xFoldCrossValidation is given this will be repeated for all given cross-validations. :Attributes: __config: (Dictionary) The config of the experiment, containing all pretext models parameters. Refer to the config trainPre...
TrainPretextModelsExperiment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainPretextModelsExperiment: """The experiment trains each pretext model for each given dataset and saves logs and checkpoints. If xFoldCrossValidation is given this will be repeated for all given cross-validations. :Attributes: __config: (Dictionary) The config of the experiment, containing all...
stack_v2_sparse_classes_36k_train_025936
3,560
permissive
[ { "docstring": "Constructor, initialize member variables. :param config: (Dictionary) The config of the experiment, containing all pretext models parameters. Refer to the config trainPretextModelsExperiment.json for an example.", "name": "__init__", "signature": "def __init__(self, config)" }, { ...
2
stack_v2_sparse_classes_30k_train_010268
Implement the Python class `TrainPretextModelsExperiment` described below. Class description: The experiment trains each pretext model for each given dataset and saves logs and checkpoints. If xFoldCrossValidation is given this will be repeated for all given cross-validations. :Attributes: __config: (Dictionary) The c...
Implement the Python class `TrainPretextModelsExperiment` described below. Class description: The experiment trains each pretext model for each given dataset and saves logs and checkpoints. If xFoldCrossValidation is given this will be repeated for all given cross-validations. :Attributes: __config: (Dictionary) The c...
6907ae5781765f56a8492bfba594bfb3b9987f29
<|skeleton|> class TrainPretextModelsExperiment: """The experiment trains each pretext model for each given dataset and saves logs and checkpoints. If xFoldCrossValidation is given this will be repeated for all given cross-validations. :Attributes: __config: (Dictionary) The config of the experiment, containing all...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainPretextModelsExperiment: """The experiment trains each pretext model for each given dataset and saves logs and checkpoints. If xFoldCrossValidation is given this will be repeated for all given cross-validations. :Attributes: __config: (Dictionary) The config of the experiment, containing all pretext mode...
the_stack_v2_python_sparse
Experiment_Component/Experiments/TrainPretextModelsExperiment.py
BonifazStuhr/OFM
train
0
152c5455d024c2b2844df6b01b9907e06adfcd4b
[ "curr1, curr2 = (head1, head2)\nexit1, exit2 = (False, False)\nwhile curr1 != curr2:\n if curr1 is not None:\n curr1 = curr1.next\n elif not exit1:\n exit1 = True\n curr1 = head2\n else:\n return\n if curr2 is not None:\n curr2 = curr2.next\n elif not exit2:\n ...
<|body_start_0|> curr1, curr2 = (head1, head2) exit1, exit2 = (False, False) while curr1 != curr2: if curr1 is not None: curr1 = curr1.next elif not exit1: exit1 = True curr1 = head2 else: return ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def get_intersection_node(self, head1, head2): """Returns a node where list 1 connects with list 2 if there's one, returns None otherwise. Time complexity: O(n + m). Space complexity: O(1), where n, m are lengths of linked lists.""" <|body_0|> def get_intersection_...
stack_v2_sparse_classes_36k_train_025937
2,029
no_license
[ { "docstring": "Returns a node where list 1 connects with list 2 if there's one, returns None otherwise. Time complexity: O(n + m). Space complexity: O(1), where n, m are lengths of linked lists.", "name": "get_intersection_node", "signature": "def get_intersection_node(self, head1, head2)" }, { ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_intersection_node(self, head1, head2): Returns a node where list 1 connects with list 2 if there's one, returns None otherwise. Time complexity: O(n + m). Space complexit...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_intersection_node(self, head1, head2): Returns a node where list 1 connects with list 2 if there's one, returns None otherwise. Time complexity: O(n + m). Space complexit...
71b722ddfe8da04572e527b055cf8723d5c87bbf
<|skeleton|> class Solution: def get_intersection_node(self, head1, head2): """Returns a node where list 1 connects with list 2 if there's one, returns None otherwise. Time complexity: O(n + m). Space complexity: O(1), where n, m are lengths of linked lists.""" <|body_0|> def get_intersection_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def get_intersection_node(self, head1, head2): """Returns a node where list 1 connects with list 2 if there's one, returns None otherwise. Time complexity: O(n + m). Space complexity: O(1), where n, m are lengths of linked lists.""" curr1, curr2 = (head1, head2) exit1, exit2 ...
the_stack_v2_python_sparse
Linked_Lists/intersection_linked_lists.py
vladn90/Algorithms
train
0
1443fb56bdaa5faff76fb302e7d33b7263af4452
[ "self.last_name = value\nif not self.allow_empty_string and value.strip() == '':\n raise TraitError('Empty string not allowed.')\nreturn super(MyViewController, self).setattr(info, object, traitname, value)", "if not self.allow_empty_string and self.model.myname == '':\n self.model.myname = '?'\nelse:\n ...
<|body_start_0|> self.last_name = value if not self.allow_empty_string and value.strip() == '': raise TraitError('Empty string not allowed.') return super(MyViewController, self).setattr(info, object, traitname, value) <|end_body_0|> <|body_start_1|> if not self.allow_empty_...
Define a combined controller/view class that validates that MyModel.myname is consistent with the 'allow_empty_string' flag.
MyViewController
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyViewController: """Define a combined controller/view class that validates that MyModel.myname is consistent with the 'allow_empty_string' flag.""" def myname_setattr(self, info, object, traitname, value): """Validate the request to change the named trait on object to the specified ...
stack_v2_sparse_classes_36k_train_025938
3,027
permissive
[ { "docstring": "Validate the request to change the named trait on object to the specified value. Validation errors raise TraitError, which by default causes the editor's entry field to be shown in red. (This is a specially named method <model trait name>_setattr, which is available inside a Controller.)", "...
2
null
Implement the Python class `MyViewController` described below. Class description: Define a combined controller/view class that validates that MyModel.myname is consistent with the 'allow_empty_string' flag. Method signatures and docstrings: - def myname_setattr(self, info, object, traitname, value): Validate the requ...
Implement the Python class `MyViewController` described below. Class description: Define a combined controller/view class that validates that MyModel.myname is consistent with the 'allow_empty_string' flag. Method signatures and docstrings: - def myname_setattr(self, info, object, traitname, value): Validate the requ...
95479cd0c298de4c18718b0477baada3384bcad2
<|skeleton|> class MyViewController: """Define a combined controller/view class that validates that MyModel.myname is consistent with the 'allow_empty_string' flag.""" def myname_setattr(self, info, object, traitname, value): """Validate the request to change the named trait on object to the specified ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyViewController: """Define a combined controller/view class that validates that MyModel.myname is consistent with the 'allow_empty_string' flag.""" def myname_setattr(self, info, object, traitname, value): """Validate the request to change the named trait on object to the specified value. Valida...
the_stack_v2_python_sparse
Python/Book/scipybook2/codes/traitsuidemo/Advanced/MVC_demo.py
leeweizhe1993/Individual_project
train
2
f1d07364d9b62b14c520ec4de393d84ae86fe86d
[ "total_sum = sum(nums)\nif total_sum % 2 != 0:\n return False\nsub_set_sum = total_sum // 2\ndp = [False] * (sub_set_sum + 1)\ndp[0] = True\nfor num in nums:\n for j in range(sub_set_sum, num - 1, -1):\n dp[j] = dp[j] or dp[j - num]\nreturn dp[sub_set_sum]", "total_sum = sum(nums)\nif total_sum % 2 !...
<|body_start_0|> total_sum = sum(nums) if total_sum % 2 != 0: return False sub_set_sum = total_sum // 2 dp = [False] * (sub_set_sum + 1) dp[0] = True for num in nums: for j in range(sub_set_sum, num - 1, -1): dp[j] = dp[j] or dp[j -...
Array
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Array: def can_partition(self, nums: List[int]) -> bool: """Approach: DP (1D Array) Time Complexity: O(m * n) Space Complexity: O(m) :param nums: :return:""" <|body_0|> def can_partition_(self, nums: List[int]) -> bool: """Approach: DP (2D Array) Time Complexity: O(m...
stack_v2_sparse_classes_36k_train_025939
1,709
no_license
[ { "docstring": "Approach: DP (1D Array) Time Complexity: O(m * n) Space Complexity: O(m) :param nums: :return:", "name": "can_partition", "signature": "def can_partition(self, nums: List[int]) -> bool" }, { "docstring": "Approach: DP (2D Array) Time Complexity: O(m * n) Space Complexity: O(m * n...
2
stack_v2_sparse_classes_30k_train_018770
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def can_partition(self, nums: List[int]) -> bool: Approach: DP (1D Array) Time Complexity: O(m * n) Space Complexity: O(m) :param nums: :return: - def can_partition_(self, nums: List[i...
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def can_partition(self, nums: List[int]) -> bool: Approach: DP (1D Array) Time Complexity: O(m * n) Space Complexity: O(m) :param nums: :return: - def can_partition_(self, nums: List[i...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Array: def can_partition(self, nums: List[int]) -> bool: """Approach: DP (1D Array) Time Complexity: O(m * n) Space Complexity: O(m) :param nums: :return:""" <|body_0|> def can_partition_(self, nums: List[int]) -> bool: """Approach: DP (2D Array) Time Complexity: O(m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Array: def can_partition(self, nums: List[int]) -> bool: """Approach: DP (1D Array) Time Complexity: O(m * n) Space Complexity: O(m) :param nums: :return:""" total_sum = sum(nums) if total_sum % 2 != 0: return False sub_set_sum = total_sum // 2 dp = [False] ...
the_stack_v2_python_sparse
revisited_2021/dp/partition_equal_subset_sum.py
Shiv2157k/leet_code
train
1
38cf31c70e81dcc8b5dde1a94307b18dc26fbc5d
[ "data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\ndata_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en = tokenizer_en...
<|body_start_0|> data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True) tokenizer_pt, tokenizer_en = self.tokenize_dataset(data_train) self.tokenizer_pt = token...
class Dataset
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """class Dataset""" def __init__(self): """class constructor""" <|body_0|> def tokenize_dataset(self, data): """Instance method that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """Instance meth...
stack_v2_sparse_classes_36k_train_025940
1,969
no_license
[ { "docstring": "class constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Instance method that creates sub-word tokenizers for our dataset", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "Instance ...
4
stack_v2_sparse_classes_30k_train_003804
Implement the Python class `Dataset` described below. Class description: class Dataset Method signatures and docstrings: - def __init__(self): class constructor - def tokenize_dataset(self, data): Instance method that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Instance method that encodes...
Implement the Python class `Dataset` described below. Class description: class Dataset Method signatures and docstrings: - def __init__(self): class constructor - def tokenize_dataset(self, data): Instance method that creates sub-word tokenizers for our dataset - def encode(self, pt, en): Instance method that encodes...
b1d0995023630f2a2b7ed953983c405077c0d5a8
<|skeleton|> class Dataset: """class Dataset""" def __init__(self): """class constructor""" <|body_0|> def tokenize_dataset(self, data): """Instance method that creates sub-word tokenizers for our dataset""" <|body_1|> def encode(self, pt, en): """Instance meth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """class Dataset""" def __init__(self): """class constructor""" data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True) data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True) tokenizer_pt, tok...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/2-dataset.py
oscarmrt/holbertonschool-machine_learning
train
1
b31db7fe833cce4590d9f2ef45afd8ff020f5558
[ "self.embeddings = embeddings\nself.action = action\nself.config = embeddings.config\nself.delete = embeddings.delete\nself.model = embeddings.model\nself.database = embeddings.database\nself.graph = embeddings.graph\nself.indexes = embeddings.indexes\nself.scoring = embeddings.scoring if embeddings.issparse() else...
<|body_start_0|> self.embeddings = embeddings self.action = action self.config = embeddings.config self.delete = embeddings.delete self.model = embeddings.model self.database = embeddings.database self.graph = embeddings.graph self.indexes = embeddings.ind...
Executes a transform. Processes a stream of documents, loads batches into enabled data stores and vectorizes documents.
Transform
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transform: """Executes a transform. Processes a stream of documents, loads batches into enabled data stores and vectorizes documents.""" def __init__(self, embeddings, action): """Creates a new transform. Args: embeddings: embeddings instance action: index action""" <|body_0|...
stack_v2_sparse_classes_36k_train_025941
6,891
permissive
[ { "docstring": "Creates a new transform. Args: embeddings: embeddings instance action: index action", "name": "__init__", "signature": "def __init__(self, embeddings, action)" }, { "docstring": "Processes an iterable collection of documents, handles any iterable including generators. This method...
6
null
Implement the Python class `Transform` described below. Class description: Executes a transform. Processes a stream of documents, loads batches into enabled data stores and vectorizes documents. Method signatures and docstrings: - def __init__(self, embeddings, action): Creates a new transform. Args: embeddings: embe...
Implement the Python class `Transform` described below. Class description: Executes a transform. Processes a stream of documents, loads batches into enabled data stores and vectorizes documents. Method signatures and docstrings: - def __init__(self, embeddings, action): Creates a new transform. Args: embeddings: embe...
789a4555cb60ee9cdfa69afae5a5236d197e2b07
<|skeleton|> class Transform: """Executes a transform. Processes a stream of documents, loads batches into enabled data stores and vectorizes documents.""" def __init__(self, embeddings, action): """Creates a new transform. Args: embeddings: embeddings instance action: index action""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transform: """Executes a transform. Processes a stream of documents, loads batches into enabled data stores and vectorizes documents.""" def __init__(self, embeddings, action): """Creates a new transform. Args: embeddings: embeddings instance action: index action""" self.embeddings = embe...
the_stack_v2_python_sparse
src/python/txtai/embeddings/index/transform.py
neuml/txtai
train
4,804
c4fefc24b5d994b00db269d56838a42f60dec481
[ "n = len(nums)\ndp = [n] * n\ndp[0] = 0\nfor i in range(n):\n for j in range(1, min(nums[i] + 1, n - i)):\n dp[i + j] = min(dp[i + j], dp[i] + 1)\nreturn dp[n - 1]", "n = len(nums)\ndp = [n] * n\ndp[0] = 0\ncur = 0\nfor i in range(n):\n for j in range(max(1, cur + 1 - i), min(nums[i] + 1, n - i)):\n ...
<|body_start_0|> n = len(nums) dp = [n] * n dp[0] = 0 for i in range(n): for j in range(1, min(nums[i] + 1, n - i)): dp[i + j] = min(dp[i + j], dp[i] + 1) return dp[n - 1] <|end_body_0|> <|body_start_1|> n = len(nums) dp = [n] * n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def jump1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) dp = [n] * n dp[0] = 0 ...
stack_v2_sparse_classes_36k_train_025942
1,201
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "jump1", "signature": "def jump1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "jump", "signature": "def jump(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_006165
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump1(self, nums): :type nums: List[int] :rtype: int - def jump(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jump1(self, nums): :type nums: List[int] :rtype: int - def jump(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def jump1(self, nums): ...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def jump1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def jump(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def jump1(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) dp = [n] * n dp[0] = 0 for i in range(n): for j in range(1, min(nums[i] + 1, n - i)): dp[i + j] = min(dp[i + j], dp[i] + 1) return dp[n - 1] d...
the_stack_v2_python_sparse
Greedy/q045_jump_game_ii.py
sevenhe716/LeetCode
train
0
2d26ae887ff3bebbae5706a93293ced0f6631fa4
[ "self.level = 0\nself.header = Node(MAX_LEVEL, None, None)\nself.size = 0", "i = self.level - 1\nq = self.header\nwhile i >= 0:\n while q.forward[i] and q.forward[i].key <= key:\n if q.forward[i].key == key:\n return (q.forward[i].key, q.forward[1].value, i)\n q = q.forward[i]\n i -...
<|body_start_0|> self.level = 0 self.header = Node(MAX_LEVEL, None, None) self.size = 0 <|end_body_0|> <|body_start_1|> i = self.level - 1 q = self.header while i >= 0: while q.forward[i] and q.forward[i].key <= key: if q.forward[i].key == key...
SkipList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkipList: def __init__(self): """跳表初始化 层数为0 初始化头部节点""" <|body_0|> def search(self, key): """跳表搜索操作 :param key: 查找的关键字 :return: 节点的 key & value & 节点所在的层数(最高的层数)""" <|body_1|> def insert(self, key, value): """跳表插入操作 :param key: 节点索引值 :param value: ...
stack_v2_sparse_classes_36k_train_025943
2,899
no_license
[ { "docstring": "跳表初始化 层数为0 初始化头部节点", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "跳表搜索操作 :param key: 查找的关键字 :return: 节点的 key & value & 节点所在的层数(最高的层数)", "name": "search", "signature": "def search(self, key)" }, { "docstring": "跳表插入操作 :param key: 节点索引值 :...
3
stack_v2_sparse_classes_30k_train_019405
Implement the Python class `SkipList` described below. Class description: Implement the SkipList class. Method signatures and docstrings: - def __init__(self): 跳表初始化 层数为0 初始化头部节点 - def search(self, key): 跳表搜索操作 :param key: 查找的关键字 :return: 节点的 key & value & 节点所在的层数(最高的层数) - def insert(self, key, value): 跳表插入操作 :param ...
Implement the Python class `SkipList` described below. Class description: Implement the SkipList class. Method signatures and docstrings: - def __init__(self): 跳表初始化 层数为0 初始化头部节点 - def search(self, key): 跳表搜索操作 :param key: 查找的关键字 :return: 节点的 key & value & 节点所在的层数(最高的层数) - def insert(self, key, value): 跳表插入操作 :param ...
9030cbf726b384d05e634195b78f6789af612aa1
<|skeleton|> class SkipList: def __init__(self): """跳表初始化 层数为0 初始化头部节点""" <|body_0|> def search(self, key): """跳表搜索操作 :param key: 查找的关键字 :return: 节点的 key & value & 节点所在的层数(最高的层数)""" <|body_1|> def insert(self, key, value): """跳表插入操作 :param key: 节点索引值 :param value: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkipList: def __init__(self): """跳表初始化 层数为0 初始化头部节点""" self.level = 0 self.header = Node(MAX_LEVEL, None, None) self.size = 0 def search(self, key): """跳表搜索操作 :param key: 查找的关键字 :return: 节点的 key & value & 节点所在的层数(最高的层数)""" i = self.level - 1 q = sel...
the_stack_v2_python_sparse
data_struct/skiplist.py
houhailun/data_struct_alrhorithm
train
1
bee61905df9061f89ae83ead9e3167c99315e3cb
[ "compression_op.LowRankDecompMatrixCompressor.__init__(self, spec=spec)\nself._spec.set_hparam('name', 'kmeans_compressor')\nself._spec.is_c_matrix_trainable = False\nself._seed = 42", "codebook_shape = (self._spec.rank, self._spec.block_size)\nencoding_shape = (a_matrix.shape[0], a_matrix.shape[1] // self._spec....
<|body_start_0|> compression_op.LowRankDecompMatrixCompressor.__init__(self, spec=spec) self._spec.set_hparam('name', 'kmeans_compressor') self._spec.is_c_matrix_trainable = False self._seed = 42 <|end_body_0|> <|body_start_1|> codebook_shape = (self._spec.rank, self._spec.block...
K-means decomposition compressor. Implements matrix compression interface for the kmeans quantize algorithm.
KmeansMatrixCompressor
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KmeansMatrixCompressor: """K-means decomposition compressor. Implements matrix compression interface for the kmeans quantize algorithm.""" def __init__(self, spec=None): """Initializer. Args: spec: hparams object with default value given by self.get_default_hparams()""" <|bod...
stack_v2_sparse_classes_36k_train_025944
47,174
permissive
[ { "docstring": "Initializer. Args: spec: hparams object with default value given by self.get_default_hparams()", "name": "__init__", "signature": "def __init__(self, spec=None)" }, { "docstring": "Returns shapes of the matrix factors. Args: a_matrix: input matrix Returns: codebook_shape: tuple o...
3
null
Implement the Python class `KmeansMatrixCompressor` described below. Class description: K-means decomposition compressor. Implements matrix compression interface for the kmeans quantize algorithm. Method signatures and docstrings: - def __init__(self, spec=None): Initializer. Args: spec: hparams object with default v...
Implement the Python class `KmeansMatrixCompressor` described below. Class description: K-means decomposition compressor. Implements matrix compression interface for the kmeans quantize algorithm. Method signatures and docstrings: - def __init__(self, spec=None): Initializer. Args: spec: hparams object with default v...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class KmeansMatrixCompressor: """K-means decomposition compressor. Implements matrix compression interface for the kmeans quantize algorithm.""" def __init__(self, spec=None): """Initializer. Args: spec: hparams object with default value given by self.get_default_hparams()""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KmeansMatrixCompressor: """K-means decomposition compressor. Implements matrix compression interface for the kmeans quantize algorithm.""" def __init__(self, spec=None): """Initializer. Args: spec: hparams object with default value given by self.get_default_hparams()""" compression_op.Low...
the_stack_v2_python_sparse
graph_compression/compression_lib/simhash_compression_op.py
Jimmy-INL/google-research
train
1
f3f1e9ce9126b4be7a5e377a9be7a6f7300ed5a0
[ "multiprocessing.Process.__init__(self, *args, **kw)\nself.queue = q\nself.workers = N\nself.sorting = sorting\nself.output = []\nself.start_time = start_time", "while self.workers:\n p = self.queue.get()\n if p is None:\n self.workers -= 1\n else:\n self.output.append(p)\nprint(len(self.ou...
<|body_start_0|> multiprocessing.Process.__init__(self, *args, **kw) self.queue = q self.workers = N self.sorting = sorting self.output = [] self.start_time = start_time <|end_body_0|> <|body_start_1|> while self.workers: p = self.queue.get() ...
OutProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutProcess: def __init__(self, N, q, start_time, sorting=False, *args, **kw): """Initialize thread and save queue references.""" <|body_0|> def run(self): """Extract items from output queue and print until all done.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_025945
1,123
no_license
[ { "docstring": "Initialize thread and save queue references.", "name": "__init__", "signature": "def __init__(self, N, q, start_time, sorting=False, *args, **kw)" }, { "docstring": "Extract items from output queue and print until all done.", "name": "run", "signature": "def run(self)" ...
2
null
Implement the Python class `OutProcess` described below. Class description: Implement the OutProcess class. Method signatures and docstrings: - def __init__(self, N, q, start_time, sorting=False, *args, **kw): Initialize thread and save queue references. - def run(self): Extract items from output queue and print unti...
Implement the Python class `OutProcess` described below. Class description: Implement the OutProcess class. Method signatures and docstrings: - def __init__(self, N, q, start_time, sorting=False, *args, **kw): Initialize thread and save queue references. - def run(self): Extract items from output queue and print unti...
f51c1d2d9557c95e869cbce5bff7158f5aa90192
<|skeleton|> class OutProcess: def __init__(self, N, q, start_time, sorting=False, *args, **kw): """Initialize thread and save queue references.""" <|body_0|> def run(self): """Extract items from output queue and print until all done.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutProcess: def __init__(self, N, q, start_time, sorting=False, *args, **kw): """Initialize thread and save queue references.""" multiprocessing.Process.__init__(self, *args, **kw) self.queue = q self.workers = N self.sorting = sorting self.output = [] s...
the_stack_v2_python_sparse
Python 04: Advanced Python/Lesson 12: Multi-Processing/output.py
MTset/Python-Programming-Coursework
train
0
848677f3603da6e6c1e7fa93f2ea945e8d726014
[ "from __builtin__ import xrange\nbuyin = -prices[0]\nfor_next_buy = 0\nsell = 0\nfor i in xrange(1, len(prices)):\n for_next_buy = max(buyin, -prices[i] + sell)\n sell = max(sell, prices[i] - fee + buyin)\n buyin = for_next_buy\nreturn sell", "from __builtin__ import xrange\nbuyin = -prices[0]\nnext_buy ...
<|body_start_0|> from __builtin__ import xrange buyin = -prices[0] for_next_buy = 0 sell = 0 for i in xrange(1, len(prices)): for_next_buy = max(buyin, -prices[i] + sell) sell = max(sell, prices[i] - fee + buyin) buyin = for_next_buy re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的price , -prices[i] 賣: 正的price + previous買的負的prices -prices[0] 減去手續費.""" <|body_0|> def rewrite(self, prices, fee): """:type prices: List[int] :type fee: int :rt...
stack_v2_sparse_classes_36k_train_025946
3,005
no_license
[ { "docstring": ":type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的price , -prices[i] 賣: 正的price + previous買的負的prices -prices[0] 減去手續費.", "name": "maxProfit", "signature": "def maxProfit(self, prices, fee)" }, { "docstring": ":type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的p...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices, fee): :type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的price , -prices[i] 賣: 正的price + previous買的負的prices -prices[0] 減去手續費. - def rewrite(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices, fee): :type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的price , -prices[i] 賣: 正的price + previous買的負的prices -prices[0] 減去手續費. - def rewrite(s...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的price , -prices[i] 賣: 正的price + previous買的負的prices -prices[0] 減去手續費.""" <|body_0|> def rewrite(self, prices, fee): """:type prices: List[int] :type fee: int :rt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int 概念: 買: 負的price , -prices[i] 賣: 正的price + previous買的負的prices -prices[0] 減去手續費.""" from __builtin__ import xrange buyin = -prices[0] for_next_buy = 0 sell = 0 for i i...
the_stack_v2_python_sparse
greedy/714_Best_Time_to_Buy_and_Sell_Stock_with_Transaction_Fee.py
vsdrun/lc_public
train
6
c23ce6598da18687bd7ae46d14cb5d4914c503b6
[ "self._basis_name = 'characteristic'\nCombinatorialFreeModule.__init__(self, M.base_ring(), tuple(M._lattice), prefix=prefix, category=MoebiusAlgebraBases(M))\nE = M.E()\nphi = self.module_morphism(self._to_natural_basis, codomain=E, category=self.category(), triangular='lower', unitriangular=True, key=M._lattice._...
<|body_start_0|> self._basis_name = 'characteristic' CombinatorialFreeModule.__init__(self, M.base_ring(), tuple(M._lattice), prefix=prefix, category=MoebiusAlgebraBases(M)) E = M.E() phi = self.module_morphism(self._to_natural_basis, codomain=E, category=self.category(), triangular='low...
The characteristic basis of a quantum Möbius algebra. The characteristic basis `\\{ C_x \\mid x \\in L \\}` of `M_L` for some lattice `L` is defined by .. MATH:: C_x = \\sum_{a \\geq x} P(F^x; q) E_a, where `F^x = \\{ y \\in L \\mid y \\geq x \\}` is the principal order filter of `x` and `P(F^x; q)` is the characterist...
C
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class C: """The characteristic basis of a quantum Möbius algebra. The characteristic basis `\\{ C_x \\mid x \\in L \\}` of `M_L` for some lattice `L` is defined by .. MATH:: C_x = \\sum_{a \\geq x} P(F^x; q) E_a, where `F^x = \\{ y \\in L \\mid y \\geq x \\}` is the principal order filter of `x` and `P...
stack_v2_sparse_classes_36k_train_025947
26,467
no_license
[ { "docstring": "Initialize ``self``. TESTS:: sage: L = posets.BooleanLattice(3) sage: M = L.quantum_moebius_algebra() sage: TestSuite(M.C()).run() # long time", "name": "__init__", "signature": "def __init__(self, M, prefix='C')" }, { "docstring": "Convert the element indexed by ``x`` to the nat...
2
stack_v2_sparse_classes_30k_train_003649
Implement the Python class `C` described below. Class description: The characteristic basis of a quantum Möbius algebra. The characteristic basis `\\{ C_x \\mid x \\in L \\}` of `M_L` for some lattice `L` is defined by .. MATH:: C_x = \\sum_{a \\geq x} P(F^x; q) E_a, where `F^x = \\{ y \\in L \\mid y \\geq x \\}` is t...
Implement the Python class `C` described below. Class description: The characteristic basis of a quantum Möbius algebra. The characteristic basis `\\{ C_x \\mid x \\in L \\}` of `M_L` for some lattice `L` is defined by .. MATH:: C_x = \\sum_{a \\geq x} P(F^x; q) E_a, where `F^x = \\{ y \\in L \\mid y \\geq x \\}` is t...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class C: """The characteristic basis of a quantum Möbius algebra. The characteristic basis `\\{ C_x \\mid x \\in L \\}` of `M_L` for some lattice `L` is defined by .. MATH:: C_x = \\sum_{a \\geq x} P(F^x; q) E_a, where `F^x = \\{ y \\in L \\mid y \\geq x \\}` is the principal order filter of `x` and `P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class C: """The characteristic basis of a quantum Möbius algebra. The characteristic basis `\\{ C_x \\mid x \\in L \\}` of `M_L` for some lattice `L` is defined by .. MATH:: C_x = \\sum_{a \\geq x} P(F^x; q) E_a, where `F^x = \\{ y \\in L \\mid y \\geq x \\}` is the principal order filter of `x` and `P(F^x; q)` is ...
the_stack_v2_python_sparse
sage/src/sage/combinat/posets/moebius_algebra.py
bopopescu/geosci
train
0
9f75a49d92e089e64bcbe77b2587becc1d28a79e
[ "super(CLITabularTableView, self).__init__()\nself._columns = column_names or []\nself._column_sizes = column_sizes or []\nself._number_of_columns = len(self._columns)\nself._rows = []", "row_strings = []\nfor value_index, value_string in enumerate(values):\n padding_size = self._column_sizes[value_index] - le...
<|body_start_0|> super(CLITabularTableView, self).__init__() self._columns = column_names or [] self._column_sizes = column_sizes or [] self._number_of_columns = len(self._columns) self._rows = [] <|end_body_0|> <|body_start_1|> row_strings = [] for value_index, ...
Command line interface tabular table view.
CLITabularTableView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CLITabularTableView: """Command line interface tabular table view.""" def __init__(self, column_names=None, column_sizes=None): """Initializes a command line interface tabular table view. Args: column_names (Optional[list[str]]): column names. column_sizes (Optional[list[int]]): mini...
stack_v2_sparse_classes_36k_train_025948
29,440
permissive
[ { "docstring": "Initializes a command line interface tabular table view. Args: column_names (Optional[list[str]]): column names. column_sizes (Optional[list[int]]): minimum column sizes, in number of characters. If a column name or row value is larger than the minimum column size the column will be enlarged. No...
4
null
Implement the Python class `CLITabularTableView` described below. Class description: Command line interface tabular table view. Method signatures and docstrings: - def __init__(self, column_names=None, column_sizes=None): Initializes a command line interface tabular table view. Args: column_names (Optional[list[str]]...
Implement the Python class `CLITabularTableView` described below. Class description: Command line interface tabular table view. Method signatures and docstrings: - def __init__(self, column_names=None, column_sizes=None): Initializes a command line interface tabular table view. Args: column_names (Optional[list[str]]...
28756d910e951a22c5f0b2bcf5184f055a19d544
<|skeleton|> class CLITabularTableView: """Command line interface tabular table view.""" def __init__(self, column_names=None, column_sizes=None): """Initializes a command line interface tabular table view. Args: column_names (Optional[list[str]]): column names. column_sizes (Optional[list[int]]): mini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CLITabularTableView: """Command line interface tabular table view.""" def __init__(self, column_names=None, column_sizes=None): """Initializes a command line interface tabular table view. Args: column_names (Optional[list[str]]): column names. column_sizes (Optional[list[int]]): minimum column si...
the_stack_v2_python_sparse
dfvfs/helpers/command_line.py
log2timeline/dfvfs
train
197
95d76f3adc9cde5140c1759f6b2c72ac92f9cea5
[ "results = search_fn(species=species, locations=locations, inlet=inlet, instrument=instrument, start_datetime=start_datetime, end_datetime=end_datetime)\nself._results = results\nreturn results", "if not isinstance(selected_keys, list):\n selected_keys = [selected_keys]\nkey_dict = {key: self._results[key]['ke...
<|body_start_0|> results = search_fn(species=species, locations=locations, inlet=inlet, instrument=instrument, start_datetime=start_datetime, end_datetime=end_datetime) self._results = results return results <|end_body_0|> <|body_start_1|> if not isinstance(selected_keys, list): ...
Used to search and download data from the object store
Search
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species ...
stack_v2_sparse_classes_36k_train_025949
2,647
permissive
[ { "docstring": "This is just a wrapper for the search function that allows easy access through LocalClient Args: species (str or list): Terms to search for in Datasources locations (str or list): Where to search for the terms in species inlet (str, default=None): Inlet height such as 100m instrument (str, defau...
2
stack_v2_sparse_classes_30k_train_009534
Implement the Python class `Search` described below. Class description: Used to search and download data from the object store Method signatures and docstrings: - def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): This is just a wrapper for the search function t...
Implement the Python class `Search` described below. Class description: Used to search and download data from the object store Method signatures and docstrings: - def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): This is just a wrapper for the search function t...
93c58c9e0381f453a604f39141f73022d4003322
<|skeleton|> class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Search: """Used to search and download data from the object store""" def search(self, species, locations, inlet=None, instrument=None, start_datetime=None, end_datetime=None): """This is just a wrapper for the search function that allows easy access through LocalClient Args: species (str or list)...
the_stack_v2_python_sparse
HUGS/LocalClient/_search.py
hugs-cloud/hugs
train
0
0ab48ba5aadbcf311d8841dc3b82891ae9298b5b
[ "for item in input_items:\n if isinstance(item, (list, tuple)):\n yield from self.flatten_input(item)\n else:\n yield item", "input_list = list(self.flatten_input(input_list))\nresult = ami_average.average_LG(input_list)\nresult.meta.cal_step.ami_average = 'COMPLETE'\nreturn result" ]
<|body_start_0|> for item in input_items: if isinstance(item, (list, tuple)): yield from self.flatten_input(item) else: yield item <|end_body_0|> <|body_start_1|> input_list = list(self.flatten_input(input_list)) result = ami_average.avera...
AmiAverageStep: Averages LG results for multiple NIRISS AMI mode exposures
AmiAverageStep
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmiAverageStep: """AmiAverageStep: Averages LG results for multiple NIRISS AMI mode exposures""" def flatten_input(self, input_items): """Remove any nested list/tuple structure and return generator to provide iterable simple list with no nested structure.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_025950
1,441
permissive
[ { "docstring": "Remove any nested list/tuple structure and return generator to provide iterable simple list with no nested structure.", "name": "flatten_input", "signature": "def flatten_input(self, input_items)" }, { "docstring": "Averages the results of LG analysis for a set of multiple NIRISS...
2
null
Implement the Python class `AmiAverageStep` described below. Class description: AmiAverageStep: Averages LG results for multiple NIRISS AMI mode exposures Method signatures and docstrings: - def flatten_input(self, input_items): Remove any nested list/tuple structure and return generator to provide iterable simple li...
Implement the Python class `AmiAverageStep` described below. Class description: AmiAverageStep: Averages LG results for multiple NIRISS AMI mode exposures Method signatures and docstrings: - def flatten_input(self, input_items): Remove any nested list/tuple structure and return generator to provide iterable simple li...
a4a0e8ad2b88249f01445ee1dcf175229c51033f
<|skeleton|> class AmiAverageStep: """AmiAverageStep: Averages LG results for multiple NIRISS AMI mode exposures""" def flatten_input(self, input_items): """Remove any nested list/tuple structure and return generator to provide iterable simple list with no nested structure.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmiAverageStep: """AmiAverageStep: Averages LG results for multiple NIRISS AMI mode exposures""" def flatten_input(self, input_items): """Remove any nested list/tuple structure and return generator to provide iterable simple list with no nested structure.""" for item in input_items: ...
the_stack_v2_python_sparse
jwst/ami/ami_average_step.py
spacetelescope/jwst
train
449
ac193c3bfc0480464070527a580fedd758c2abed
[ "self.path = Path(path)\nif not self.path.is_absolute():\n raise ValueError(f'PdfReader initialized with relative path {path}')", "if force_ocr:\n return self.ocr_text()\nwith open(self.path, 'rb') as file:\n try:\n pdf = pdftotext.PDF(file)\n except pdftotext.Error:\n if not (allow_ocr ...
<|body_start_0|> self.path = Path(path) if not self.path.is_absolute(): raise ValueError(f'PdfReader initialized with relative path {path}') <|end_body_0|> <|body_start_1|> if force_ocr: return self.ocr_text() with open(self.path, 'rb') as file: try: ...
PdfReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PdfReader: def __init__(self, path: Union[Path, str]) -> None: """Construct PdfReader object. :param path: Absolute path to PDF document.""" <|body_0|> def read_text(self, *, allow_ocr: bool, force_ocr: bool=False) -> Optional[str]: """Return text content of PDF. :pa...
stack_v2_sparse_classes_36k_train_025951
6,213
permissive
[ { "docstring": "Construct PdfReader object. :param path: Absolute path to PDF document.", "name": "__init__", "signature": "def __init__(self, path: Union[Path, str]) -> None" }, { "docstring": "Return text content of PDF. :param allow_ocr: If text cant be extracted from PDF directly, since it d...
4
stack_v2_sparse_classes_30k_train_008489
Implement the Python class `PdfReader` described below. Class description: Implement the PdfReader class. Method signatures and docstrings: - def __init__(self, path: Union[Path, str]) -> None: Construct PdfReader object. :param path: Absolute path to PDF document. - def read_text(self, *, allow_ocr: bool, force_ocr:...
Implement the Python class `PdfReader` described below. Class description: Implement the PdfReader class. Method signatures and docstrings: - def __init__(self, path: Union[Path, str]) -> None: Construct PdfReader object. :param path: Absolute path to PDF document. - def read_text(self, *, allow_ocr: bool, force_ocr:...
5743b1d4c3fefa66fcaa4d283436d2a3f0490604
<|skeleton|> class PdfReader: def __init__(self, path: Union[Path, str]) -> None: """Construct PdfReader object. :param path: Absolute path to PDF document.""" <|body_0|> def read_text(self, *, allow_ocr: bool, force_ocr: bool=False) -> Optional[str]: """Return text content of PDF. :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PdfReader: def __init__(self, path: Union[Path, str]) -> None: """Construct PdfReader object. :param path: Absolute path to PDF document.""" self.path = Path(path) if not self.path.is_absolute(): raise ValueError(f'PdfReader initialized with relative path {path}') def ...
the_stack_v2_python_sparse
examiner/pdf.py
JakobGM/WikiLinks
train
7
7832d6c9eda8448515dcca08029e2f8e73b792dc
[ "end = len(numbers) - 1\nstart = 1\nfor index, num in enumerate(numbers):\n find_index = self.find_num(numbers, target - num, index + 1, end)\n if find_index != -1:\n return [index + 1, find_index + 1]", "if end - start < 2:\n if numbers[start] == target:\n return start\n elif numbers[en...
<|body_start_0|> end = len(numbers) - 1 start = 1 for index, num in enumerate(numbers): find_index = self.find_num(numbers, target - num, index + 1, end) if find_index != -1: return [index + 1, find_index + 1] <|end_body_0|> <|body_start_1|> if en...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def find_num(self, numbers, target, start, end): """return index if target was find, else return -1""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_025952
2,289
no_license
[ { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": "return index if target was find, else return -1", "name": "find_num", "signature": "def find_num(self, numbers, target, sta...
2
stack_v2_sparse_classes_30k_train_007325
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def find_num(self, numbers, target, start, end): return index if target was ...
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def find_num(self, numbers, target, start, end): return index if target was ...
f96a2273c6831a8035e1adacfa452f73c599ae16
<|skeleton|> class Solution_1: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def find_num(self, numbers, target, start, end): """return index if target was find, else return -1""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_1: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" end = len(numbers) - 1 start = 1 for index, num in enumerate(numbers): find_index = self.find_num(numbers, target - num, index + 1, end) if ...
the_stack_v2_python_sparse
Python/TwoSumIIInputarrayissorted.py
here0009/LeetCode
train
1
5e65142bd1a6c38411c192717e93c4002635144c
[ "with open(SLAPHUG_FILE.format(bot.root), encoding='utf-8') as file:\n self.replies = json.load(file)\n self.slapreply = self.replies['slap']\n self.hugreply = self.replies['hug']", "if '<user>' in reply:\n reply = reply.replace('<user>', bot.twitch.display_name(user))\nif '<target>' in reply:\n re...
<|body_start_0|> with open(SLAPHUG_FILE.format(bot.root), encoding='utf-8') as file: self.replies = json.load(file) self.slapreply = self.replies['slap'] self.hugreply = self.replies['hug'] <|end_body_0|> <|body_start_1|> if '<user>' in reply: reply = rep...
Slap or hug a user.
SlapHug
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlapHug: """Slap or hug a user.""" def __init__(self, bot): """Load command list.""" <|body_0|> def replace_reply(bot, user, target, reply): """Replace words in the reply string and return it.""" <|body_1|> def match(self, bot, user, msg, tag_info): ...
stack_v2_sparse_classes_36k_train_025953
2,338
permissive
[ { "docstring": "Load command list.", "name": "__init__", "signature": "def __init__(self, bot)" }, { "docstring": "Replace words in the reply string and return it.", "name": "replace_reply", "signature": "def replace_reply(bot, user, target, reply)" }, { "docstring": "Match if co...
4
null
Implement the Python class `SlapHug` described below. Class description: Slap or hug a user. Method signatures and docstrings: - def __init__(self, bot): Load command list. - def replace_reply(bot, user, target, reply): Replace words in the reply string and return it. - def match(self, bot, user, msg, tag_info): Matc...
Implement the Python class `SlapHug` described below. Class description: Slap or hug a user. Method signatures and docstrings: - def __init__(self, bot): Load command list. - def replace_reply(bot, user, target, reply): Replace words in the reply string and return it. - def match(self, bot, user, msg, tag_info): Matc...
6bef453bf5042401ecdafcdda404452dfd982ecf
<|skeleton|> class SlapHug: """Slap or hug a user.""" def __init__(self, bot): """Load command list.""" <|body_0|> def replace_reply(bot, user, target, reply): """Replace words in the reply string and return it.""" <|body_1|> def match(self, bot, user, msg, tag_info): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlapHug: """Slap or hug a user.""" def __init__(self, bot): """Load command list.""" with open(SLAPHUG_FILE.format(bot.root), encoding='utf-8') as file: self.replies = json.load(file) self.slapreply = self.replies['slap'] self.hugreply = self.replies['h...
the_stack_v2_python_sparse
bot/commands/slaphug.py
ghostduck/monkalot
train
0
20307e76f43ed6680931962f26b5044c4a97988c
[ "res = ''\nfor s in strs:\n res += str(len(s)) + '$' + s\nreturn res", "res = []\nwhile s:\n i = s.find('$')\n length = int(s[:i])\n temp = s[i + 1:i + 1 + length]\n res.append(temp)\n s = s[i + 1 + length:]\nreturn res" ]
<|body_start_0|> res = '' for s in strs: res += str(len(s)) + '$' + s return res <|end_body_0|> <|body_start_1|> res = [] while s: i = s.find('$') length = int(s[:i]) temp = s[i + 1:i + 1 + length] res.append(temp) ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_025954
2,077
permissive
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_014318
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
5097f69bb0050d963c784d6bc0e88a7e871568ed
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" res = '' for s in strs: res += str(len(s)) + '$' + s return res def decode(self, s): """Decodes a single string to a list of strings. :t...
the_stack_v2_python_sparse
251-300/271.py
yshshadow/Leetcode
train
0
fbf5c273959467d628a58aac69b42c79f4532202
[ "dummy = ListNode(0)\ndummy.next = head\nlength = 0\nnode = dummy\nwhile node.next:\n length += 1\n node = node.next\nlength -= n\nnode = dummy\nwhile length > 0:\n length -= 1\n node = node.next\nnode.next = node.next.next\nreturn dummy.next", "dummy = ListNode(0)\ndummy.next = head\nfirst = dummy\ns...
<|body_start_0|> dummy = ListNode(0) dummy.next = head length = 0 node = dummy while node.next: length += 1 node = node.next length -= n node = dummy while length > 0: length -= 1 node = node.next nod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode11""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025955
1,751
no_license
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head, n)" }, { "docstring": ":type head: ListNode :type n: int :rtype: ListNode11", "name": "removeNthFromEnd2", "signature": "def removeNthFromEnd2(s...
2
stack_v2_sparse_classes_30k_train_018412
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): :type head: ListNode :type n: int :rtype: ListNode...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): :type head: ListNode :type n: int :rtype: ListNode...
628654fad22589b15350622084e8c69d58e3563b
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode11""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" dummy = ListNode(0) dummy.next = head length = 0 node = dummy while node.next: length += 1 node = node.next length -= n ...
the_stack_v2_python_sparse
code/19 删除链表的倒数第n个节点.py
lmzzzzz1/leetcode
train
0
31a03016fe81d88904679c9327cfa7c5648f6a58
[ "def helper_ser(node):\n if not node:\n fp.append('null')\n return\n fp.append(str(node.val))\n helper_ser(node.left)\n helper_ser(node.right)\nfp = []\nhelper_ser(root)\nreturn ','.join(fp)", "def helper_des():\n if helper_des.index >= len(data) or data[helper_des.index] == 'null':\n...
<|body_start_0|> def helper_ser(node): if not node: fp.append('null') return fp.append(str(node.val)) helper_ser(node.left) helper_ser(node.right) fp = [] helper_ser(root) return ','.join(fp) <|end_body_0|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025956
2,213
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
3aab1747a1e6a77de808073e8735f89704940496
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def helper_ser(node): if not node: fp.append('null') return fp.append(str(node.val)) helper_ser(node.left) ...
the_stack_v2_python_sparse
leetcode/questions/serializeAnddeserializeBinaryTree.py
ziqingW/pythonPlayground
train
0
1e8cd18e2633cb520b52e61136a081ecf3690889
[ "self.trajectory = None\nself.status = None\npass", "self.trajectory = trajectory\nself.status = self._stop(trajectory)\nreturn self.status" ]
<|body_start_0|> self.trajectory = None self.status = None pass <|end_body_0|> <|body_start_1|> self.trajectory = trajectory self.status = self._stop(trajectory) return self.status <|end_body_1|>
A Stopper works on trajectories and/or snapshots and is called by the generator and returns True if the generator should be stop and no more frames should be generated. Usually these are generated from Ensembles or Volumes.
Stopper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stopper: """A Stopper works on trajectories and/or snapshots and is called by the generator and returns True if the generator should be stop and no more frames should be generated. Usually these are generated from Ensembles or Volumes.""" def __init__(self, params): """Constructor"""...
stack_v2_sparse_classes_36k_train_025957
1,842
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "If not properly defined always stop the simulation", "name": "__call__", "signature": "def __call__(self, trajectory)" } ]
2
null
Implement the Python class `Stopper` described below. Class description: A Stopper works on trajectories and/or snapshots and is called by the generator and returns True if the generator should be stop and no more frames should be generated. Usually these are generated from Ensembles or Volumes. Method signatures and...
Implement the Python class `Stopper` described below. Class description: A Stopper works on trajectories and/or snapshots and is called by the generator and returns True if the generator should be stop and no more frames should be generated. Usually these are generated from Ensembles or Volumes. Method signatures and...
d081ea2a85dd2e563da6c8604780be32607e3203
<|skeleton|> class Stopper: """A Stopper works on trajectories and/or snapshots and is called by the generator and returns True if the generator should be stop and no more frames should be generated. Usually these are generated from Ensembles or Volumes.""" def __init__(self, params): """Constructor"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Stopper: """A Stopper works on trajectories and/or snapshots and is called by the generator and returns True if the generator should be stop and no more frames should be generated. Usually these are generated from Ensembles or Volumes.""" def __init__(self, params): """Constructor""" self...
the_stack_v2_python_sparse
openpathsampling/attic/Stopper.py
Asagodi/openpathsampling
train
0
1f2e00b403a4679e26d794b4b5c759bf5b905d39
[ "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...
Manages documents of a knowledge base.
DocumentsServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentsServicer: """Manages documents of a knowledge base.""" def ListDocuments(self, request, context): """Returns the list of all documents of the knowledge base.""" <|body_0|> def GetDocument(self, request, context): """Retrieves the specified document.""" ...
stack_v2_sparse_classes_36k_train_025958
5,127
permissive
[ { "docstring": "Returns the list of all documents of the knowledge base.", "name": "ListDocuments", "signature": "def ListDocuments(self, request, context)" }, { "docstring": "Retrieves the specified document.", "name": "GetDocument", "signature": "def GetDocument(self, request, context)...
4
stack_v2_sparse_classes_30k_train_021427
Implement the Python class `DocumentsServicer` described below. Class description: Manages documents of a knowledge base. Method signatures and docstrings: - def ListDocuments(self, request, context): Returns the list of all documents of the knowledge base. - def GetDocument(self, request, context): Retrieves the spe...
Implement the Python class `DocumentsServicer` described below. Class description: Manages documents of a knowledge base. Method signatures and docstrings: - def ListDocuments(self, request, context): Returns the list of all documents of the knowledge base. - def GetDocument(self, request, context): Retrieves the spe...
c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf
<|skeleton|> class DocumentsServicer: """Manages documents of a knowledge base.""" def ListDocuments(self, request, context): """Returns the list of all documents of the knowledge base.""" <|body_0|> def GetDocument(self, request, context): """Retrieves the specified document.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DocumentsServicer: """Manages documents of a knowledge base.""" def ListDocuments(self, request, context): """Returns the list of all documents of the knowledge base.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise No...
the_stack_v2_python_sparse
pyenv/lib/python3.6/site-packages/dialogflow_v2beta1/proto/document_pb2_grpc.py
ronald-rgr/ai-chatbot-smartguide
train
0
848f62c95358f83f4a826860fb7bc1f0fa2995e1
[ "context = aq_inner(self.context)\nksscore = self.getCommandSet('core')\nutility = zapi.getUtility(ICountriesStates)\nif not search and (not country):\n country = context.getCountry()\nif country and country != '--':\n results = TitledVocabulary.fromTitles(utility.states(country=country))\nelse:\n results ...
<|body_start_0|> context = aq_inner(self.context) ksscore = self.getCommandSet('core') utility = zapi.getUtility(ICountriesStates) if not search and (not country): country = context.getCountry() if country and country != '--': results = TitledVocabulary.fr...
KSSModifySelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KSSModifySelector: def kssModifyState(self, country=None, search=0): """This method is used to update the province drop down when adding a person or organization and also from the advanced search template that's why it has some ugly logic. Perhaps should be divided in two methods, one th...
stack_v2_sparse_classes_36k_train_025959
5,306
no_license
[ { "docstring": "This method is used to update the province drop down when adding a person or organization and also from the advanced search template that's why it has some ugly logic. Perhaps should be divided in two methods, one that gets called from the ct, and another one that gets called from the search tem...
2
stack_v2_sparse_classes_30k_train_012505
Implement the Python class `KSSModifySelector` described below. Class description: Implement the KSSModifySelector class. Method signatures and docstrings: - def kssModifyState(self, country=None, search=0): This method is used to update the province drop down when adding a person or organization and also from the ad...
Implement the Python class `KSSModifySelector` described below. Class description: Implement the KSSModifySelector class. Method signatures and docstrings: - def kssModifyState(self, country=None, search=0): This method is used to update the province drop down when adding a person or organization and also from the ad...
65e9035903d11f3da53faf22f66ee6080abf3ea1
<|skeleton|> class KSSModifySelector: def kssModifyState(self, country=None, search=0): """This method is used to update the province drop down when adding a person or organization and also from the advanced search template that's why it has some ugly logic. Perhaps should be divided in two methods, one th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KSSModifySelector: def kssModifyState(self, country=None, search=0): """This method is used to update the province drop down when adding a person or organization and also from the advanced search template that's why it has some ugly logic. Perhaps should be divided in two methods, one that gets called...
the_stack_v2_python_sparse
collective/contacts/browser/ksscommands.py
collective/collective.contacts
train
0
fee68699409cd9530e8fd967122376d13e8b3d7c
[ "x = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(x, title='Set Mouse Cursor Position', prompt='Please input x-coordinate:')\ny = self.get_y()\nctypes.windll.user32.SetCursorPos(x, y)", "x = self.get_x()\ny = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(y, title='Set Mouse Cursor Position', ...
<|body_start_0|> x = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(x, title='Set Mouse Cursor Position', prompt='Please input x-coordinate:') y = self.get_y() ctypes.windll.user32.SetCursorPos(x, y) <|end_body_0|> <|body_start_1|> x = self.get_x() y = self.root_node.gu...
The advanced mouse node on Windows.
Mouse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mouse: """The advanced mouse node on Windows.""" def set_x(self, x): """Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.""" <|body_0|> def set_y(self, y): """Set the y-coord of the mouse pointer. y: int. The new y-coord of the m...
stack_v2_sparse_classes_36k_train_025960
18,417
no_license
[ { "docstring": "Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.", "name": "set_x", "signature": "def set_x(self, x)" }, { "docstring": "Set the y-coord of the mouse pointer. y: int. The new y-coord of the mouse pointer.", "name": "set_y", "signature": ...
3
stack_v2_sparse_classes_30k_test_000863
Implement the Python class `Mouse` described below. Class description: The advanced mouse node on Windows. Method signatures and docstrings: - def set_x(self, x): Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer. - def set_y(self, y): Set the y-coord of the mouse pointer. y: int. The...
Implement the Python class `Mouse` described below. Class description: The advanced mouse node on Windows. Method signatures and docstrings: - def set_x(self, x): Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer. - def set_y(self, y): Set the y-coord of the mouse pointer. y: int. The...
3945ef235ac8e7a7a66fec018597aa9b34b0a4e6
<|skeleton|> class Mouse: """The advanced mouse node on Windows.""" def set_x(self, x): """Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.""" <|body_0|> def set_y(self, y): """Set the y-coord of the mouse pointer. y: int. The new y-coord of the m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mouse: """The advanced mouse node on Windows.""" def set_x(self, x): """Set the x-coord of the mouse pointer. x: int. The new x-coord of the mouse pointer.""" x = self.root_node.gui.dialogs.constant_handler_ASK_INTEGER(x, title='Set Mouse Cursor Position', prompt='Please input x-coordinat...
the_stack_v2_python_sparse
wavesynlib/interfaces/os/modelnode.py
xialulee/WaveSyn
train
9
0d13ef110b2caf49b2d9f39b5ecdc41ffda29fd1
[ "super(Resnet18_8s, self).__init__()\nresnet18_8s = resnet18(fully_conv=True, output_stride=8, pretrained_path=pretrained_path, remove_avg_pool_layer=True)\nself.ver_dim = ver_dim\nself.seg_dim = seg_dim\nself.conv_init = HeUniform(negative_slope=math.sqrt(5), mode='fan_in', nonlinearity='leaky_relu')\nresnet18_8s....
<|body_start_0|> super(Resnet18_8s, self).__init__() resnet18_8s = resnet18(fully_conv=True, output_stride=8, pretrained_path=pretrained_path, remove_avg_pool_layer=True) self.ver_dim = ver_dim self.seg_dim = seg_dim self.conv_init = HeUniform(negative_slope=math.sqrt(5), mode='f...
Resnet18_8s Network
Resnet18_8s
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Resnet18_8s: """Resnet18_8s Network""" def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): """__init__""" <|body_0|> def construct(self, x, feature_alignment=False): """construct Network""" <...
stack_v2_sparse_classes_36k_train_025961
8,234
permissive
[ { "docstring": "__init__", "name": "__init__", "signature": "def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None)" }, { "docstring": "construct Network", "name": "construct", "signature": "def construct(self, x, feature_alignm...
2
null
Implement the Python class `Resnet18_8s` described below. Class description: Resnet18_8s Network Method signatures and docstrings: - def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): __init__ - def construct(self, x, feature_alignment=False): construct...
Implement the Python class `Resnet18_8s` described below. Class description: Resnet18_8s Network Method signatures and docstrings: - def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): __init__ - def construct(self, x, feature_alignment=False): construct...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class Resnet18_8s: """Resnet18_8s Network""" def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): """__init__""" <|body_0|> def construct(self, x, feature_alignment=False): """construct Network""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Resnet18_8s: """Resnet18_8s Network""" def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): """__init__""" super(Resnet18_8s, self).__init__() resnet18_8s = resnet18(fully_conv=True, output_stride=8, pretrained_path=pr...
the_stack_v2_python_sparse
official/cv/PVNet/src/model_reposity.py
mindspore-ai/models
train
301
2025d3b36c3d93ec16bf201f367666be402c1ec8
[ "conform = getattr(obj, '__conform__', None)\nif conform is not None:\n adapter = self._call_conform(conform)\n if adapter is not None:\n return adapter\nadapter = self.__adapt__(obj)\nif adapter is not None:\n return adapter\nelif alternate is not _marker:\n return alternate\nelse:\n raise Ty...
<|body_start_0|> conform = getattr(obj, '__conform__', None) if conform is not None: adapter = self._call_conform(conform) if adapter is not None: return adapter adapter = self.__adapt__(obj) if adapter is not None: return adapter ...
Base class that wants to be replaced with a C base :)
InterfaceBasePy
[ "Apache-2.0", "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceBasePy: """Base class that wants to be replaced with a C base :)""" def __call__(self, obj, alternate=_marker): """Adapt an object to the interface""" <|body_0|> def __adapt__(self, obj): """Adapt an object to the reciever""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_025962
20,297
permissive
[ { "docstring": "Adapt an object to the interface", "name": "__call__", "signature": "def __call__(self, obj, alternate=_marker)" }, { "docstring": "Adapt an object to the reciever", "name": "__adapt__", "signature": "def __adapt__(self, obj)" } ]
2
null
Implement the Python class `InterfaceBasePy` described below. Class description: Base class that wants to be replaced with a C base :) Method signatures and docstrings: - def __call__(self, obj, alternate=_marker): Adapt an object to the interface - def __adapt__(self, obj): Adapt an object to the reciever
Implement the Python class `InterfaceBasePy` described below. Class description: Base class that wants to be replaced with a C base :) Method signatures and docstrings: - def __call__(self, obj, alternate=_marker): Adapt an object to the interface - def __adapt__(self, obj): Adapt an object to the reciever <|skeleto...
05dbd4575d01a213f3f4d69aa4968473f2536142
<|skeleton|> class InterfaceBasePy: """Base class that wants to be replaced with a C base :)""" def __call__(self, obj, alternate=_marker): """Adapt an object to the interface""" <|body_0|> def __adapt__(self, obj): """Adapt an object to the reciever""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterfaceBasePy: """Base class that wants to be replaced with a C base :)""" def __call__(self, obj, alternate=_marker): """Adapt an object to the interface""" conform = getattr(obj, '__conform__', None) if conform is not None: adapter = self._call_conform(conform) ...
the_stack_v2_python_sparse
plugins/hg4idea/testData/bin/mercurial/thirdparty/zope/interface/interface.py
JetBrains/intellij-community
train
16,288
a2bf34d587bc9ee2a087ceecdd383893f6feff67
[ "super(LandmarkDataSourceMultiple, self).__init__(id_dict_preprocessing=id_dict_preprocessing)\nself.multiple_point_list_file_name = multiple_point_list_file_name\nself.num_points = num_points\nself.dim = dim\nself.multiple = multiple\nself.silent_not_found = silent_not_found\nself.load()", "ext = os.path.splitex...
<|body_start_0|> super(LandmarkDataSourceMultiple, self).__init__(id_dict_preprocessing=id_dict_preprocessing) self.multiple_point_list_file_name = multiple_point_list_file_name self.num_points = num_points self.dim = dim self.multiple = multiple self.silent_not_found = s...
Datasource used for loading landmarks for images with possible multiple instances. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. If multiple is True, all landmarks of all instances are returned. Otherwise, only the landmarks with the instance_id == id_dict['instance_id'] are returne...
LandmarkDataSourceMultiple
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LandmarkDataSourceMultiple: """Datasource used for loading landmarks for images with possible multiple instances. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. If multiple is True, all landmarks of all instances are returned. Otherwise, only the landmarks with...
stack_v2_sparse_classes_36k_train_025963
5,859
no_license
[ { "docstring": "Initializer. :param multiple_point_list_file_name: File that contains all the landmarks for all instances. Must be a .csv file. :param num_points: Number of landmarks in the landmarks file. :param dim: Dimension of the landmarks. :param multiple: If true, all landmarks of all instances will be r...
4
stack_v2_sparse_classes_30k_test_000615
Implement the Python class `LandmarkDataSourceMultiple` described below. Class description: Datasource used for loading landmarks for images with possible multiple instances. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. If multiple is True, all landmarks of all instances are retur...
Implement the Python class `LandmarkDataSourceMultiple` described below. Class description: Datasource used for loading landmarks for images with possible multiple instances. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. If multiple is True, all landmarks of all instances are retur...
ef6cee91264ba1fe6b40d9823a07647b95bcc2c4
<|skeleton|> class LandmarkDataSourceMultiple: """Datasource used for loading landmarks for images with possible multiple instances. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. If multiple is True, all landmarks of all instances are returned. Otherwise, only the landmarks with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LandmarkDataSourceMultiple: """Datasource used for loading landmarks for images with possible multiple instances. Uses id_dict['image_id'] as the landmark file key and returns a list of landmarks. If multiple is True, all landmarks of all instances are returned. Otherwise, only the landmarks with the instance...
the_stack_v2_python_sparse
datasources/landmark_datasource.py
XiaoweiXu/MedicalDataAugmentationTool
train
1
98608ec46ab301d09ddf494b8c34fe1437e5a2c0
[ "self.Trie = {}\nself.prefix = ''\nself.max = 0\nfor word in words:\n if len(word) > self.max:\n self.max = len(word)\n word = word[::-1]\n d = self.Trie\n for l in word:\n if l not in d:\n d[l] = {}\n d = d[l]\n d['#'] = True", "self.prefix += letter\nif len(self.pr...
<|body_start_0|> self.Trie = {} self.prefix = '' self.max = 0 for word in words: if len(word) > self.max: self.max = len(word) word = word[::-1] d = self.Trie for l in word: if l not in d: ...
StreamChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StreamChecker: def __init__(self, words): """:type words: List[str]""" <|body_0|> def query(self, letter): """:type letter: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.Trie = {} self.prefix = '' self.max = 0...
stack_v2_sparse_classes_36k_train_025964
1,104
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type letter: str :rtype: bool", "name": "query", "signature": "def query(self, letter)" } ]
2
stack_v2_sparse_classes_30k_train_012353
Implement the Python class `StreamChecker` described below. Class description: Implement the StreamChecker class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def query(self, letter): :type letter: str :rtype: bool
Implement the Python class `StreamChecker` described below. Class description: Implement the StreamChecker class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def query(self, letter): :type letter: str :rtype: bool <|skeleton|> class StreamChecker: def __init__(self, w...
811a76449292016069d592fbd4ce82e3e0c2f8cc
<|skeleton|> class StreamChecker: def __init__(self, words): """:type words: List[str]""" <|body_0|> def query(self, letter): """:type letter: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StreamChecker: def __init__(self, words): """:type words: List[str]""" self.Trie = {} self.prefix = '' self.max = 0 for word in words: if len(word) > self.max: self.max = len(word) word = word[::-1] d = self.Trie ...
the_stack_v2_python_sparse
Aug - Challenge/Stream of Characters.py
msha096/Leetcoding
train
0
49c065aa9d9a47b440538f6e739c028fafb59d0d
[ "super().define(spec)\nspec.input('structure', valid_type=CifData, help='input structure')\nspec.expose_inputs(ZeoppCalculation, namespace='zeopp', exclude=['structure'])\nspec.inputs['zeopp']['parameters'].default = lambda: NetworkParameters(dict=cls.parameters_schema({}))\nspec.inputs['zeopp']['parameters'].valid...
<|body_start_0|> super().define(spec) spec.input('structure', valid_type=CifData, help='input structure') spec.expose_inputs(ZeoppCalculation, namespace='zeopp', exclude=['structure']) spec.inputs['zeopp']['parameters'].default = lambda: NetworkParameters(dict=cls.parameters_schema({})) ...
A workchain that combines: Zeopp + Cp2kMultistageWorkChain + Cp2kDdecWorkChain + Zeopp
ZeoppMultistageDdecWorkChain
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZeoppMultistageDdecWorkChain: """A workchain that combines: Zeopp + Cp2kMultistageWorkChain + Cp2kDdecWorkChain + Zeopp""" def define(cls, spec): """Define workflow specification.""" <|body_0|> def run_zeopp_before(self): """Run Zeo++ for the original structure""...
stack_v2_sparse_classes_36k_train_025965
5,119
permissive
[ { "docstring": "Define workflow specification.", "name": "define", "signature": "def define(cls, spec)" }, { "docstring": "Run Zeo++ for the original structure", "name": "run_zeopp_before", "signature": "def run_zeopp_before(self)" }, { "docstring": "Run MultistageDdec work chain...
5
stack_v2_sparse_classes_30k_train_011246
Implement the Python class `ZeoppMultistageDdecWorkChain` described below. Class description: A workchain that combines: Zeopp + Cp2kMultistageWorkChain + Cp2kDdecWorkChain + Zeopp Method signatures and docstrings: - def define(cls, spec): Define workflow specification. - def run_zeopp_before(self): Run Zeo++ for the...
Implement the Python class `ZeoppMultistageDdecWorkChain` described below. Class description: A workchain that combines: Zeopp + Cp2kMultistageWorkChain + Cp2kDdecWorkChain + Zeopp Method signatures and docstrings: - def define(cls, spec): Define workflow specification. - def run_zeopp_before(self): Run Zeo++ for the...
6bf08fa42e545dadf889ea8095d7fcdd8d1be15c
<|skeleton|> class ZeoppMultistageDdecWorkChain: """A workchain that combines: Zeopp + Cp2kMultistageWorkChain + Cp2kDdecWorkChain + Zeopp""" def define(cls, spec): """Define workflow specification.""" <|body_0|> def run_zeopp_before(self): """Run Zeo++ for the original structure""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZeoppMultistageDdecWorkChain: """A workchain that combines: Zeopp + Cp2kMultistageWorkChain + Cp2kDdecWorkChain + Zeopp""" def define(cls, spec): """Define workflow specification.""" super().define(spec) spec.input('structure', valid_type=CifData, help='input structure') s...
the_stack_v2_python_sparse
aiida_lsmo/workchains/zeopp_multistage_ddec.py
lsmo-epfl/aiida-lsmo
train
3
fa04ed7fbb2fb0e85bc1c75c7eaa2fefd467603b
[ "import math\nlow = 1\nhigh = 1000000000\nwhile low < high:\n mid = (low + high) // 2\n time = 0\n for each in piles:\n time += math.ceil(each / mid)\n if time <= H:\n high = mid\n else:\n low = mid + 1\nreturn low", "from math import ceil\nmini_speed = ceil(sum(piles) / H)\nwh...
<|body_start_0|> import math low = 1 high = 1000000000 while low < high: mid = (low + high) // 2 time = 0 for each in piles: time += math.ceil(each / mid) if time <= H: high = mid else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minEatingSpeed(self, piles, H): """:type piles: List[int] :type H: int :rtype: int""" <|body_0|> def minEatingSpeed2(self, piles, H): """:type piles: List[int] :type H: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> im...
stack_v2_sparse_classes_36k_train_025966
1,006
no_license
[ { "docstring": ":type piles: List[int] :type H: int :rtype: int", "name": "minEatingSpeed", "signature": "def minEatingSpeed(self, piles, H)" }, { "docstring": ":type piles: List[int] :type H: int :rtype: int", "name": "minEatingSpeed2", "signature": "def minEatingSpeed2(self, piles, H)"...
2
stack_v2_sparse_classes_30k_train_021102
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 - def minEatingSpeed2(self, piles, H): :type piles: List[int] :type H: int :rtype: int
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 - def minEatingSpeed2(self, piles, H): :type piles: List[int] :type H: int :rtype: int <|skel...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def minEatingSpeed(self, piles, H): """:type piles: List[int] :type H: int :rtype: int""" <|body_0|> def minEatingSpeed2(self, piles, H): """:type piles: List[int] :type H: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minEatingSpeed(self, piles, H): """:type piles: List[int] :type H: int :rtype: int""" import math low = 1 high = 1000000000 while low < high: mid = (low + high) // 2 time = 0 for each in piles: time += ma...
the_stack_v2_python_sparse
minEatingSpeed.py
NeilWangziyu/Leetcode_py
train
2
2993c58fb7b33bf4320ed9f245d41597339e7e9b
[ "if user_config_directory is CredentialsStore._DEFAULT_CONFIG_DIRECTORY:\n user_config_directory = util.get_user_config_directory()\n if user_config_directory is None:\n logger.warning('Credentials caching disabled - no private config directory found')\nif user_config_directory is None:\n self._cred...
<|body_start_0|> if user_config_directory is CredentialsStore._DEFAULT_CONFIG_DIRECTORY: user_config_directory = util.get_user_config_directory() if user_config_directory is None: logger.warning('Credentials caching disabled - no private config directory found') i...
Private file store for a `google.oauth2.credentials.Credentials`.
CredentialsStore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredentialsStore: """Private file store for a `google.oauth2.credentials.Credentials`.""" def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): """Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user con...
stack_v2_sparse_classes_36k_train_025967
16,711
permissive
[ { "docstring": "Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user configs, under which to store the credentials file. If not set, defaults to a platform-specific location. If set to None, the store is disabled (reads return None; write and cle...
4
stack_v2_sparse_classes_30k_train_002119
Implement the Python class `CredentialsStore` described below. Class description: Private file store for a `google.oauth2.credentials.Credentials`. Method signatures and docstrings: - def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): Creates a CredentialsStore. Args: user_config_directory: Optional...
Implement the Python class `CredentialsStore` described below. Class description: Private file store for a `google.oauth2.credentials.Credentials`. Method signatures and docstrings: - def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): Creates a CredentialsStore. Args: user_config_directory: Optional...
5961c76dca0fb9bb40d146f5ce13834ac29d8ddb
<|skeleton|> class CredentialsStore: """Private file store for a `google.oauth2.credentials.Credentials`.""" def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): """Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CredentialsStore: """Private file store for a `google.oauth2.credentials.Credentials`.""" def __init__(self, user_config_directory=_DEFAULT_CONFIG_DIRECTORY): """Creates a CredentialsStore. Args: user_config_directory: Optional absolute path to the root directory for storing user configs, under w...
the_stack_v2_python_sparse
tensorboard/uploader/auth.py
tensorflow/tensorboard
train
6,766
669d08e07dbc4ffc91d05df866bf7940b401d953
[ "if code == None:\n return json.dumps([c.__dict__ for c in Client().selectAllClients()])\nelse:\n return json.dumps(Client().selectClient(code).__dict__)", "if strJson != None:\n client = Client()\n client.__dict__ = json.loads(strJson)\n if client.isNew():\n client.insertClient()\n else:...
<|body_start_0|> if code == None: return json.dumps([c.__dict__ for c in Client().selectAllClients()]) else: return json.dumps(Client().selectClient(code).__dict__) <|end_body_0|> <|body_start_1|> if strJson != None: client = Client() client.__dic...
Classe que controla os acessos ao cadastro de clientes.
ClientController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientController: """Classe que controla os acessos ao cadastro de clientes.""" def GET(self, code=None): """Lista os clientes cadastradas no sistema.""" <|body_0|> def PUT(self, strJson): """Inclui ou atualiza""" <|body_1|> def DELETE(self, code=Non...
stack_v2_sparse_classes_36k_train_025968
1,633
permissive
[ { "docstring": "Lista os clientes cadastradas no sistema.", "name": "GET", "signature": "def GET(self, code=None)" }, { "docstring": "Inclui ou atualiza", "name": "PUT", "signature": "def PUT(self, strJson)" }, { "docstring": "Apaga um cliente do sistema.", "name": "DELETE", ...
3
stack_v2_sparse_classes_30k_train_019683
Implement the Python class `ClientController` described below. Class description: Classe que controla os acessos ao cadastro de clientes. Method signatures and docstrings: - def GET(self, code=None): Lista os clientes cadastradas no sistema. - def PUT(self, strJson): Inclui ou atualiza - def DELETE(self, code=None): ...
Implement the Python class `ClientController` described below. Class description: Classe que controla os acessos ao cadastro de clientes. Method signatures and docstrings: - def GET(self, code=None): Lista os clientes cadastradas no sistema. - def PUT(self, strJson): Inclui ou atualiza - def DELETE(self, code=None): ...
bee8c9ecf4ef44ba579e4a3b58acf0c2f1467147
<|skeleton|> class ClientController: """Classe que controla os acessos ao cadastro de clientes.""" def GET(self, code=None): """Lista os clientes cadastradas no sistema.""" <|body_0|> def PUT(self, strJson): """Inclui ou atualiza""" <|body_1|> def DELETE(self, code=Non...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientController: """Classe que controla os acessos ao cadastro de clientes.""" def GET(self, code=None): """Lista os clientes cadastradas no sistema.""" if code == None: return json.dumps([c.__dict__ for c in Client().selectAllClients()]) else: return json...
the_stack_v2_python_sparse
Back End/Controller/ClienteController.py
jhelioreis/petnew
train
0
e1c90b1195a32a763507561983cf4e2a0a00e395
[ "num2 = int(num2) * 1.0\nnum1 = int(num1)\nif operator == '+':\n return str(int(num1 + num2))\nelif operator == '*':\n return str(int(num1 * num2))\nelif operator == '/':\n return str(int(num1 / num2))\nelif operator == '-':\n return str(int(num1 - num2))", "stack = []\nfor token in tokens:\n if to...
<|body_start_0|> num2 = int(num2) * 1.0 num1 = int(num1) if operator == '+': return str(int(num1 + num2)) elif operator == '*': return str(int(num1 * num2)) elif operator == '/': return str(int(num1 / num2)) elif operator == '-': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calc(self, num1, num2, operator): """:str num1: :str num2: :str operator: :rtype: str""" <|body_0|> def evalRPN(self, tokens): """:type tokens: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> num2 = int(num2) * 1....
stack_v2_sparse_classes_36k_train_025969
1,251
no_license
[ { "docstring": ":str num1: :str num2: :str operator: :rtype: str", "name": "calc", "signature": "def calc(self, num1, num2, operator)" }, { "docstring": ":type tokens: List[str] :rtype: int", "name": "evalRPN", "signature": "def evalRPN(self, tokens)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calc(self, num1, num2, operator): :str num1: :str num2: :str operator: :rtype: str - def evalRPN(self, tokens): :type tokens: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calc(self, num1, num2, operator): :str num1: :str num2: :str operator: :rtype: str - def evalRPN(self, tokens): :type tokens: List[str] :rtype: int <|skeleton|> class Soluti...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def calc(self, num1, num2, operator): """:str num1: :str num2: :str operator: :rtype: str""" <|body_0|> def evalRPN(self, tokens): """:type tokens: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def calc(self, num1, num2, operator): """:str num1: :str num2: :str operator: :rtype: str""" num2 = int(num2) * 1.0 num1 = int(num1) if operator == '+': return str(int(num1 + num2)) elif operator == '*': return str(int(num1 * num2)) ...
the_stack_v2_python_sparse
python/leetcode/150_Evaluate_Reverse_Polish_Notation.py
bobcaoge/my-code
train
0
157531e19e01a12b9cee3509e08aa190eef861df
[ "res = super(stock_picking, self).manage_sale_purchase_state(unlink_picking_ids)\nfor picking in self:\n if picking.sale_id:\n picking.sale_id.pass_done_sale(False, unlink_picking_ids)\nreturn res", "res = super(stock_picking, self).get_transport_files(partner)\nif not res:\n res = {}\nres['address_c...
<|body_start_0|> res = super(stock_picking, self).manage_sale_purchase_state(unlink_picking_ids) for picking in self: if picking.sale_id: picking.sale_id.pass_done_sale(False, unlink_picking_ids) return res <|end_body_0|> <|body_start_1|> res = super(stock_pi...
stock_picking
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking: def manage_sale_purchase_state(self, unlink_picking_ids=False): """Surcharge de la fonction des picking pour lancer la méthode de changement de l'état de la vente""" <|body_0|> def get_transport_files(self, partner): """Ajout du partenaire de livraison...
stack_v2_sparse_classes_36k_train_025970
5,201
no_license
[ { "docstring": "Surcharge de la fonction des picking pour lancer la méthode de changement de l'état de la vente", "name": "manage_sale_purchase_state", "signature": "def manage_sale_purchase_state(self, unlink_picking_ids=False)" }, { "docstring": "Ajout du partenaire de livraison", "name": ...
2
null
Implement the Python class `stock_picking` described below. Class description: Implement the stock_picking class. Method signatures and docstrings: - def manage_sale_purchase_state(self, unlink_picking_ids=False): Surcharge de la fonction des picking pour lancer la méthode de changement de l'état de la vente - def ge...
Implement the Python class `stock_picking` described below. Class description: Implement the stock_picking class. Method signatures and docstrings: - def manage_sale_purchase_state(self, unlink_picking_ids=False): Surcharge de la fonction des picking pour lancer la méthode de changement de l'état de la vente - def ge...
eb394e1f79ba1995da2dcd81adfdd511c22caff9
<|skeleton|> class stock_picking: def manage_sale_purchase_state(self, unlink_picking_ids=False): """Surcharge de la fonction des picking pour lancer la méthode de changement de l'état de la vente""" <|body_0|> def get_transport_files(self, partner): """Ajout du partenaire de livraison...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stock_picking: def manage_sale_purchase_state(self, unlink_picking_ids=False): """Surcharge de la fonction des picking pour lancer la méthode de changement de l'état de la vente""" res = super(stock_picking, self).manage_sale_purchase_state(unlink_picking_ids) for picking in self: ...
the_stack_v2_python_sparse
OpenPROD/openprod-addons/sale/stock.py
kazacube-mziouadi/ceci
train
0
54c30dde3aa757faf2454510c6f5c7a96aeb28fa
[ "if root == None:\n return ''\nres, queue = ([], [root])\nwhile queue:\n node = queue.pop(0)\n if node == None:\n res.append('null')\n else:\n res.append(str(node.val))\n queue.extend([node.left, node.right])\nwhile res[-1] == 'null':\n res.pop()\nreturn ','.join(res)", "if dat...
<|body_start_0|> if root == None: return '' res, queue = ([], [root]) while queue: node = queue.pop(0) if node == None: res.append('null') else: res.append(str(node.val)) queue.extend([node.left, node...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025971
1,474
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
b1f93854006a9b1e1afa4aadf80006551d492f8a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return '' res, queue = ([], [root]) while queue: node = queue.pop(0) if node == None: res.append('nul...
the_stack_v2_python_sparse
leetcode/Chapter4_BFS/Binary_Tree_Traversal/Serialize_and_Deserialize_Binary_Tree.py
xulleon/algorithm
train
0
f7353dca57849289f2af674a6225b7014eec5312
[ "self.lg('%s STARTED' % self._testID)\nself.lg('do login using admin username/password, should succeed')\nself.Login.Login()\nself.lg('check the home page title, should succeed')\nself.assertEqual(self.driver.title, 'OpenvCloud - Decks')\nurl = self.environment_url.replace('http:', 'https:')\nself.assertTrue(self.w...
<|body_start_0|> self.lg('%s STARTED' % self._testID) self.lg('do login using admin username/password, should succeed') self.Login.Login() self.lg('check the home page title, should succeed') self.assertEqual(self.driver.title, 'OpenvCloud - Decks') url = self.environment...
LoginLogoutPortalTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginLogoutPortalTests: def test001_login_and_portal_title(self): """PRTL-001 *Test case for check user potal login and titles.* **Test Scenario:** #. check the login page title, should succeed #. do login using admin username/password, should succeed #. check the home page title, should...
stack_v2_sparse_classes_36k_train_025972
6,582
no_license
[ { "docstring": "PRTL-001 *Test case for check user potal login and titles.* **Test Scenario:** #. check the login page title, should succeed #. do login using admin username/password, should succeed #. check the home page title, should succeed", "name": "test001_login_and_portal_title", "signature": "de...
5
stack_v2_sparse_classes_30k_train_010905
Implement the Python class `LoginLogoutPortalTests` described below. Class description: Implement the LoginLogoutPortalTests class. Method signatures and docstrings: - def test001_login_and_portal_title(self): PRTL-001 *Test case for check user potal login and titles.* **Test Scenario:** #. check the login page title...
Implement the Python class `LoginLogoutPortalTests` described below. Class description: Implement the LoginLogoutPortalTests class. Method signatures and docstrings: - def test001_login_and_portal_title(self): PRTL-001 *Test case for check user potal login and titles.* **Test Scenario:** #. check the login page title...
b8d9f99d56b063c0c6ad050e5e309e58a33674ac
<|skeleton|> class LoginLogoutPortalTests: def test001_login_and_portal_title(self): """PRTL-001 *Test case for check user potal login and titles.* **Test Scenario:** #. check the login page title, should succeed #. do login using admin username/password, should succeed #. check the home page title, should...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginLogoutPortalTests: def test001_login_and_portal_title(self): """PRTL-001 *Test case for check user potal login and titles.* **Test Scenario:** #. check the login page title, should succeed #. do login using admin username/password, should succeed #. check the home page title, should succeed""" ...
the_stack_v2_python_sparse
functional_testing/Openvcloud/ovc_master_hosted/Portal/testcases/end_user/home/test01_login_logout.py
alimcodescalers/G8_testing
train
0
3f93dee11e7348859c4ee9f4ff1eb15af10b5a41
[ "if self.chunk_size is None:\n return None\nchunk_size = self.chunk_size\nd = {k: coords[k].size for k in self._dims}\ns = reduce(mul, d.values(), 1)\nfor dim in coords.dims[::-1]:\n if dim in self._dims:\n continue\n n = chunk_size // s\n if n == 0:\n d[dim] = 1\n elif n < coords[dim]....
<|body_start_0|> if self.chunk_size is None: return None chunk_size = self.chunk_size d = {k: coords[k].size for k in self._dims} s = reduce(mul, d.values(), 1) for dim in coords.dims[::-1]: if dim in self._dims: continue n = ch...
Extended Reduce class that enables chunks that are smaller than the reduced output array. The base Reduce node ensures that each chunk is at least as big as the reduced output, which works for statistics that can be calculated in O(1) space. For statistics that require O(n) space, the node must iterate through the Coor...
ReduceOrthogonal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReduceOrthogonal: """Extended Reduce class that enables chunks that are smaller than the reduced output array. The base Reduce node ensures that each chunk is at least as big as the reduced output, which works for statistics that can be calculated in O(1) space. For statistics that require O(n) s...
stack_v2_sparse_classes_36k_train_025973
34,643
permissive
[ { "docstring": "Shape of chunks for parallel processing or large arrays that do not fit in memory. Returns ------- list List of integers giving the shape of each chunk.", "name": "_get_chunk_shape", "signature": "def _get_chunk_shape(self, coords)" }, { "docstring": "Generator for the chunks of ...
3
stack_v2_sparse_classes_30k_val_000979
Implement the Python class `ReduceOrthogonal` described below. Class description: Extended Reduce class that enables chunks that are smaller than the reduced output array. The base Reduce node ensures that each chunk is at least as big as the reduced output, which works for statistics that can be calculated in O(1) sp...
Implement the Python class `ReduceOrthogonal` described below. Class description: Extended Reduce class that enables chunks that are smaller than the reduced output array. The base Reduce node ensures that each chunk is at least as big as the reduced output, which works for statistics that can be calculated in O(1) sp...
66d8ec7a9086e39347e32922e15a3f59cb055415
<|skeleton|> class ReduceOrthogonal: """Extended Reduce class that enables chunks that are smaller than the reduced output array. The base Reduce node ensures that each chunk is at least as big as the reduced output, which works for statistics that can be calculated in O(1) space. For statistics that require O(n) s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReduceOrthogonal: """Extended Reduce class that enables chunks that are smaller than the reduced output array. The base Reduce node ensures that each chunk is at least as big as the reduced output, which works for statistics that can be calculated in O(1) space. For statistics that require O(n) space, the nod...
the_stack_v2_python_sparse
podpac/core/algorithm/stats.py
creare-com/podpac
train
48
91014a472b550ceb686eaaa31d5d08ec4938dce7
[ "if start:\n s0 = 2 * start / mother2d.flambda()\nelse:\n print('No start scale given, set to 2*dx')\n s0 = 4 * res / mother2d.flambda()\na = s0 * 2.0 ** (np.arange(0, nb + 1) * dist)\nfreqs = 1.0 / (mother2d.flambda() * a)\nperiod = 1.0 / freqs\nscales = period / 2.0\nself.scale_dist = dist\nself.scale_st...
<|body_start_0|> if start: s0 = 2 * start / mother2d.flambda() else: print('No start scale given, set to 2*dx') s0 = 4 * res / mother2d.flambda() a = s0 * 2.0 ** (np.arange(0, nb + 1) * dist) freqs = 1.0 / (mother2d.flambda() * a) period = 1.0 ...
wavelet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class wavelet: def __init__(self, res, dist, nb, mother2d=w2d.Mexican_hat(), start=None): """2D continuous wavelet analysis initialisation. This only supports dx == dy. Initialisation sets the scales we want to decompose into. From Torrence and Compo: Mexican Hat period, in Fourier sense, is 4...
stack_v2_sparse_classes_36k_train_025974
3,390
no_license
[ { "docstring": "2D continuous wavelet analysis initialisation. This only supports dx == dy. Initialisation sets the scales we want to decompose into. From Torrence and Compo: Mexican Hat period, in Fourier sense, is 4 * wavelet scale :param res: pixel resolution of prospective input data (e.g. in km) :param dis...
2
null
Implement the Python class `wavelet` described below. Class description: Implement the wavelet class. Method signatures and docstrings: - def __init__(self, res, dist, nb, mother2d=w2d.Mexican_hat(), start=None): 2D continuous wavelet analysis initialisation. This only supports dx == dy. Initialisation sets the scale...
Implement the Python class `wavelet` described below. Class description: Implement the wavelet class. Method signatures and docstrings: - def __init__(self, res, dist, nb, mother2d=w2d.Mexican_hat(), start=None): 2D continuous wavelet analysis initialisation. This only supports dx == dy. Initialisation sets the scale...
790ad1aa7e7a8c6593a21ee53b2c946b2f7a356b
<|skeleton|> class wavelet: def __init__(self, res, dist, nb, mother2d=w2d.Mexican_hat(), start=None): """2D continuous wavelet analysis initialisation. This only supports dx == dy. Initialisation sets the scales we want to decompose into. From Torrence and Compo: Mexican Hat period, in Fourier sense, is 4...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class wavelet: def __init__(self, res, dist, nb, mother2d=w2d.Mexican_hat(), start=None): """2D continuous wavelet analysis initialisation. This only supports dx == dy. Initialisation sets the scales we want to decompose into. From Torrence and Compo: Mexican Hat period, in Fourier sense, is 4 * wavelet sca...
the_stack_v2_python_sparse
saveCore_standalone_v2/wav.py
cornkle/proj_CEH
train
2
58483fd26ded2eef48506baf01f41c8d30f8086e
[ "self.done = False\nself.th_lim = 10.0\nself.sign = 1 if positive else -1\nself.u_max = 0.8\nself.cnt = 0\nself.cnt_done = cnt_done", "th = meas[0].item()\nif abs(th - self.th_lim) > 1e-08:\n self.cnt = 0\n self.th_lim = th\nelse:\n self.cnt += 1\nself.done = self.cnt >= self.cnt_done\nreturn to.tensor([...
<|body_start_0|> self.done = False self.th_lim = 10.0 self.sign = 1 if positive else -1 self.u_max = 0.8 self.cnt = 0 self.cnt_done = cnt_done <|end_body_0|> <|body_start_1|> th = meas[0].item() if abs(th - self.th_lim) > 1e-08: self.cnt = 0 ...
Controller for going to one of the joint limits (part of the calibration routine)
GoToLimCtrl
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoToLimCtrl: """Controller for going to one of the joint limits (part of the calibration routine)""" def __init__(self, positive: bool=True, cnt_done: int=250): """Constructor :param positive: direction switch""" <|body_0|> def __call__(self, meas: to.Tensor) -> to.Tenso...
stack_v2_sparse_classes_36k_train_025975
25,612
permissive
[ { "docstring": "Constructor :param positive: direction switch", "name": "__init__", "signature": "def __init__(self, positive: bool=True, cnt_done: int=250)" }, { "docstring": "Go to joint limits by applying u_max and save limit value in th_lim. :param meas: sensor measurement :return: action", ...
2
stack_v2_sparse_classes_30k_train_016120
Implement the Python class `GoToLimCtrl` described below. Class description: Controller for going to one of the joint limits (part of the calibration routine) Method signatures and docstrings: - def __init__(self, positive: bool=True, cnt_done: int=250): Constructor :param positive: direction switch - def __call__(se...
Implement the Python class `GoToLimCtrl` described below. Class description: Controller for going to one of the joint limits (part of the calibration routine) Method signatures and docstrings: - def __init__(self, positive: bool=True, cnt_done: int=250): Constructor :param positive: direction switch - def __call__(se...
a6c982862e2ab39a9f65d1c09aa59d9a8b7ac6c5
<|skeleton|> class GoToLimCtrl: """Controller for going to one of the joint limits (part of the calibration routine)""" def __init__(self, positive: bool=True, cnt_done: int=250): """Constructor :param positive: direction switch""" <|body_0|> def __call__(self, meas: to.Tensor) -> to.Tenso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoToLimCtrl: """Controller for going to one of the joint limits (part of the calibration routine)""" def __init__(self, positive: bool=True, cnt_done: int=250): """Constructor :param positive: direction switch""" self.done = False self.th_lim = 10.0 self.sign = 1 if positi...
the_stack_v2_python_sparse
Pyrado/pyrado/policies/environment_specific.py
jacarvalho/SimuRLacra
train
0
20e0306cd560e76acd9c4edc56dd17cd5260700b
[ "overrides = overrides or {}\nis_training = overrides.pop('is_training', False)\nconfig = config or build_dict(name='ModelConfig')\nself.config = config\nself.config.update(overrides)\ninput_channels = self.config['input_channels']\nmodel_name = self.config['model_name']\ninput_shape = (None, None, input_channels)\...
<|body_start_0|> overrides = overrides or {} is_training = overrides.pop('is_training', False) config = config or build_dict(name='ModelConfig') self.config = config self.config.update(overrides) input_channels = self.config['input_channels'] model_name = self.con...
Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.
EfficientNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfficientNet: """Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.""" def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None): """Create an EfficientNet model. Args: config: (optional)...
stack_v2_sparse_classes_36k_train_025976
11,511
permissive
[ { "docstring": "Create an EfficientNet model. Args: config: (optional) the main model parameters to create the model overrides: (optional) a dict containing keys that can override config", "name": "__init__", "signature": "def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None)...
2
stack_v2_sparse_classes_30k_test_000876
Implement the Python class `EfficientNet` described below. Class description: Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model. Method signatures and docstrings: - def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None...
Implement the Python class `EfficientNet` described below. Class description: Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model. Method signatures and docstrings: - def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None...
2d555548b698e4fc207965b7121f525c37e0401c
<|skeleton|> class EfficientNet: """Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.""" def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None): """Create an EfficientNet model. Args: config: (optional)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EfficientNet: """Wrapper class for an EfficientNet Keras model. Contains helper methods to build, manage, and save metadata about the model.""" def __init__(self, config: Dict[Text, Any]=None, overrides: Dict[Text, Any]=None): """Create an EfficientNet model. Args: config: (optional) the main mod...
the_stack_v2_python_sparse
TensorFlow2/Classification/ConvNets/efficientnet/model/efficientnet_model.py
resemble-ai/DeepLearningExamples
train
4
db29e9509c6f77cb897cc65e58127c3799636518
[ "self.key = key\nif isinstance(val, list):\n nested_debug_strs = [self.StringRep(v) for v in val]\n self.val = '[%s]' % ', '.join(nested_debug_strs)\nelse:\n self.val = self.StringRep(val)", "try:\n return val.DebugString()\nexcept Exception:\n try:\n return str(val.__dict__)\n except Exc...
<|body_start_0|> self.key = key if isinstance(val, list): nested_debug_strs = [self.StringRep(v) for v in val] self.val = '[%s]' % ', '.join(nested_debug_strs) else: self.val = self.StringRep(val) <|end_body_0|> <|body_start_1|> try: retur...
Wrapper class to generate on-screen debugging output.
_ContextDebugItem
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ContextDebugItem: """Wrapper class to generate on-screen debugging output.""" def __init__(self, key, val): """Store the key and generate a string for the value.""" <|body_0|> def StringRep(self, val): """Make a useful string representation of the given value.""...
stack_v2_sparse_classes_36k_train_025977
36,471
permissive
[ { "docstring": "Store the key and generate a string for the value.", "name": "__init__", "signature": "def __init__(self, key, val)" }, { "docstring": "Make a useful string representation of the given value.", "name": "StringRep", "signature": "def StringRep(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_020760
Implement the Python class `_ContextDebugItem` described below. Class description: Wrapper class to generate on-screen debugging output. Method signatures and docstrings: - def __init__(self, key, val): Store the key and generate a string for the value. - def StringRep(self, val): Make a useful string representation ...
Implement the Python class `_ContextDebugItem` described below. Class description: Wrapper class to generate on-screen debugging output. Method signatures and docstrings: - def __init__(self, key, val): Store the key and generate a string for the value. - def StringRep(self, val): Make a useful string representation ...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class _ContextDebugItem: """Wrapper class to generate on-screen debugging output.""" def __init__(self, key, val): """Store the key and generate a string for the value.""" <|body_0|> def StringRep(self, val): """Make a useful string representation of the given value.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ContextDebugItem: """Wrapper class to generate on-screen debugging output.""" def __init__(self, key, val): """Store the key and generate a string for the value.""" self.key = key if isinstance(val, list): nested_debug_strs = [self.StringRep(v) for v in val] ...
the_stack_v2_python_sparse
appengine/monorail/framework/servlet.py
xinghun61/infra
train
2
79088589a766470ed6f511d543bca622efa67d7f
[ "q, s, index = ([root], '', 0)\nwhile index < len(q):\n root, index = (q[index], index + 1)\n if root:\n s += str(root.val) + ','\n q.extend([root.left, root.right])\n else:\n s += 'N,'\nreturn s", "node = data.strip(',').split(',')\nif len(node) <= 0:\n return None\nhead = TreeNo...
<|body_start_0|> q, s, index = ([root], '', 0) while index < len(q): root, index = (q[index], index + 1) if root: s += str(root.val) + ',' q.extend([root.left, root.right]) else: s += 'N,' return s <|end_body_0|>...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_025978
1,704
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_017515
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:...
662ebc1762c92b6479f224169bfffabc57b16825
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q, s, index = ([root], '', 0) while index < len(q): root, index = (q[index], index + 1) if root: s += str(root.val) + ',' ...
the_stack_v2_python_sparse
serialize-and-deserialize-binary-tree.py
wangqi1996/leetcode
train
0
bc9b32c41fe67561aa66c776b16abe2a9741525a
[ "threading.Thread.__init__(self)\nself.obj = kwargs['object_reference']\nself.process_type = kwargs['process_type']", "if self.process_type == 'decode_pcap':\n self.obj.decode_jflow_dump_on_collector()\nif self.process_type == 'start_tcpdump':\n self.obj.start_tcp_dump_at_collector()\nif self.process_type =...
<|body_start_0|> threading.Thread.__init__(self) self.obj = kwargs['object_reference'] self.process_type = kwargs['process_type'] <|end_body_0|> <|body_start_1|> if self.process_type == 'decode_pcap': self.obj.decode_jflow_dump_on_collector() if self.process_type == ...
Class for multi-threading action for the methods present in decode_jflow_dump.py.
decode_thread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class decode_thread: """Class for multi-threading action for the methods present in decode_jflow_dump.py.""" def __init__(self, **kwargs): """Initializing the constructor""" <|body_0|> def run(self): """Method to run the threads""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_025979
41,381
no_license
[ { "docstring": "Initializing the constructor", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Method to run the threads", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `decode_thread` described below. Class description: Class for multi-threading action for the methods present in decode_jflow_dump.py. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing the constructor - def run(self): Method to run the threads
Implement the Python class `decode_thread` described below. Class description: Class for multi-threading action for the methods present in decode_jflow_dump.py. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing the constructor - def run(self): Method to run the threads <|skeleton|> class...
3966c63d48557b0b94303896eed7a767593a4832
<|skeleton|> class decode_thread: """Class for multi-threading action for the methods present in decode_jflow_dump.py.""" def __init__(self, **kwargs): """Initializing the constructor""" <|body_0|> def run(self): """Method to run the threads""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class decode_thread: """Class for multi-threading action for the methods present in decode_jflow_dump.py.""" def __init__(self, **kwargs): """Initializing the constructor""" threading.Thread.__init__(self) self.obj = kwargs['object_reference'] self.process_type = kwargs['process...
the_stack_v2_python_sparse
NITA/lib/jnpr/toby/services/usf/usf_cgnat_jflow_logging_decode_dump.py
fengyun4623/file
train
0
5f747082af9c50fbed55a9e59c35a8c17d906658
[ "self.logger = logger\nif not isinstance(api, TqApi):\n raise TraderError('必须为tq交易接口类型!')\nself.api = api\nif instrument not in self.api._data.get('quotes', {}):\n raise TraderError(f'发现不存在的合约: {instrument} !')\nself.instrument = instrument\nself._quote = self.api.get_quote(self.instrument)\nself.tsk_cfg = Tr...
<|body_start_0|> self.logger = logger if not isinstance(api, TqApi): raise TraderError('必须为tq交易接口类型!') self.api = api if instrument not in self.api._data.get('quotes', {}): raise TraderError(f'发现不存在的合约: {instrument} !') self.instrument = instrument ...
交易
TradeTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TradeTask: """交易""" def __init__(self, instrument, api, logger): """:param instrument: 合约名称 :param api: API接口实例 :param stra_name: 策略名称(类名) :param stra_params: 策略参数 :param logger: 日志记录接口 :raise TraderError""" <|body_0|> async def req_update_target_pos(self, exp_pos, delta...
stack_v2_sparse_classes_36k_train_025980
4,178
no_license
[ { "docstring": ":param instrument: 合约名称 :param api: API接口实例 :param stra_name: 策略名称(类名) :param stra_params: 策略参数 :param logger: 日志记录接口 :raise TraderError", "name": "__init__", "signature": "def __init__(self, instrument, api, logger)" }, { "docstring": ":param exp_pos: :param delta_change: :param...
3
stack_v2_sparse_classes_30k_val_000117
Implement the Python class `TradeTask` described below. Class description: 交易 Method signatures and docstrings: - def __init__(self, instrument, api, logger): :param instrument: 合约名称 :param api: API接口实例 :param stra_name: 策略名称(类名) :param stra_params: 策略参数 :param logger: 日志记录接口 :raise TraderError - async def req_update...
Implement the Python class `TradeTask` described below. Class description: 交易 Method signatures and docstrings: - def __init__(self, instrument, api, logger): :param instrument: 合约名称 :param api: API接口实例 :param stra_name: 策略名称(类名) :param stra_params: 策略参数 :param logger: 日志记录接口 :raise TraderError - async def req_update...
c55ccb4e29ce30d7a09e6d02195b1e0ed5dcaf0c
<|skeleton|> class TradeTask: """交易""" def __init__(self, instrument, api, logger): """:param instrument: 合约名称 :param api: API接口实例 :param stra_name: 策略名称(类名) :param stra_params: 策略参数 :param logger: 日志记录接口 :raise TraderError""" <|body_0|> async def req_update_target_pos(self, exp_pos, delta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TradeTask: """交易""" def __init__(self, instrument, api, logger): """:param instrument: 合约名称 :param api: API接口实例 :param stra_name: 策略名称(类名) :param stra_params: 策略参数 :param logger: 日志记录接口 :raise TraderError""" self.logger = logger if not isinstance(api, TqApi): raise Tra...
the_stack_v2_python_sparse
ctp/trader.py
zrroyo/winccccc
train
0
f81589595b5d6f558750c690776b6008ef9e4228
[ "sale_return_groups = self.env['sale.return'].sudo().read_group(domain=[('sale_order', '=', self.ids)], fields=['sale_order'], groupby=['sale_order'])\norders = self.browse()\nfor group in sale_return_groups:\n print('_compute_retuns', group)\n sale_order = self.browse(group['sale_order'][0])\n while sale_...
<|body_start_0|> sale_return_groups = self.env['sale.return'].sudo().read_group(domain=[('sale_order', '=', self.ids)], fields=['sale_order'], groupby=['sale_order']) orders = self.browse() for group in sale_return_groups: print('_compute_retuns', group) sale_order = self...
SaleOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaleOrder: def _compute_retuns(self): """method to compute return count""" <|body_0|> def action_open_returns(self): """This function returns an action that displays the sale return orders from sale order""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025981
2,353
no_license
[ { "docstring": "method to compute return count", "name": "_compute_retuns", "signature": "def _compute_retuns(self)" }, { "docstring": "This function returns an action that displays the sale return orders from sale order", "name": "action_open_returns", "signature": "def action_open_retu...
2
stack_v2_sparse_classes_30k_train_004033
Implement the Python class `SaleOrder` described below. Class description: Implement the SaleOrder class. Method signatures and docstrings: - def _compute_retuns(self): method to compute return count - def action_open_returns(self): This function returns an action that displays the sale return orders from sale order
Implement the Python class `SaleOrder` described below. Class description: Implement the SaleOrder class. Method signatures and docstrings: - def _compute_retuns(self): method to compute return count - def action_open_returns(self): This function returns an action that displays the sale return orders from sale order ...
4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14
<|skeleton|> class SaleOrder: def _compute_retuns(self): """method to compute return count""" <|body_0|> def action_open_returns(self): """This function returns an action that displays the sale return orders from sale order""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaleOrder: def _compute_retuns(self): """method to compute return count""" sale_return_groups = self.env['sale.return'].sudo().read_group(domain=[('sale_order', '=', self.ids)], fields=['sale_order'], groupby=['sale_order']) orders = self.browse() for group in sale_return_group...
the_stack_v2_python_sparse
website_return_management/models/sale_order.py
CybroOdoo/CybroAddons
train
209
93699037561ae69199216aa51e3db6fcb4232969
[ "self.fleet_subnet_type = fleet_subnet_type\nself.fleet_tags = fleet_tags\nself.network_params_list = network_params_list", "if dictionary is None:\n return None\nfleet_subnet_type = dictionary.get('fleetSubnetType')\nfleet_tags = None\nif dictionary.get('fleetTags') != None:\n fleet_tags = list()\n for ...
<|body_start_0|> self.fleet_subnet_type = fleet_subnet_type self.fleet_tags = fleet_tags self.network_params_list = network_params_list <|end_body_0|> <|body_start_1|> if dictionary is None: return None fleet_subnet_type = dictionary.get('fleetSubnetType') fl...
Implementation of the 'AwsFleetParams' model. Specifies various resources when deploying a VM to Fleet instances. Attributes: fleet_subnet_type (FleetSubnetTypeEnum): Specifies the subnet type of the fleet. Specifies the type of the fleet subnet. 'kCluster' implies same subnet as of Cluster, valid only for Cloud Editio...
AwsFleetParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AwsFleetParams: """Implementation of the 'AwsFleetParams' model. Specifies various resources when deploying a VM to Fleet instances. Attributes: fleet_subnet_type (FleetSubnetTypeEnum): Specifies the subnet type of the fleet. Specifies the type of the fleet subnet. 'kCluster' implies same subnet ...
stack_v2_sparse_classes_36k_train_025982
2,932
permissive
[ { "docstring": "Constructor for the AwsFleetParams class", "name": "__init__", "signature": "def __init__(self, fleet_subnet_type=None, fleet_tags=None, network_params_list=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary r...
2
null
Implement the Python class `AwsFleetParams` described below. Class description: Implementation of the 'AwsFleetParams' model. Specifies various resources when deploying a VM to Fleet instances. Attributes: fleet_subnet_type (FleetSubnetTypeEnum): Specifies the subnet type of the fleet. Specifies the type of the fleet ...
Implement the Python class `AwsFleetParams` described below. Class description: Implementation of the 'AwsFleetParams' model. Specifies various resources when deploying a VM to Fleet instances. Attributes: fleet_subnet_type (FleetSubnetTypeEnum): Specifies the subnet type of the fleet. Specifies the type of the fleet ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AwsFleetParams: """Implementation of the 'AwsFleetParams' model. Specifies various resources when deploying a VM to Fleet instances. Attributes: fleet_subnet_type (FleetSubnetTypeEnum): Specifies the subnet type of the fleet. Specifies the type of the fleet subnet. 'kCluster' implies same subnet ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AwsFleetParams: """Implementation of the 'AwsFleetParams' model. Specifies various resources when deploying a VM to Fleet instances. Attributes: fleet_subnet_type (FleetSubnetTypeEnum): Specifies the subnet type of the fleet. Specifies the type of the fleet subnet. 'kCluster' implies same subnet as of Cluster...
the_stack_v2_python_sparse
cohesity_management_sdk/models/a_w_s_fleet_params.py
cohesity/management-sdk-python
train
24
a626a9a56a02f87d97b7dc242bbcc957c99f69ad
[ "DenseVectorPrf.__init__(self)\nself.alpha = alpha\nself.beta = beta\nself.gamma = gamma\nself.topk = topk\nself.bottomk = bottomk", "all_candidate_embs = [item.vectors for item in prf_candidates]\nweighted_query_embs = self.alpha * emb_qs\nweighted_mean_pos_doc_embs = self.beta * np.mean(all_candidate_embs[:self...
<|body_start_0|> DenseVectorPrf.__init__(self) self.alpha = alpha self.beta = beta self.gamma = gamma self.topk = topk self.bottomk = bottomk <|end_body_0|> <|body_start_1|> all_candidate_embs = [item.vectors for item in prf_candidates] weighted_query_emb...
DenseVectorRocchioPrf
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenseVectorRocchioPrf: def __init__(self, alpha: float, beta: float, gamma: float, topk: int, bottomk: int): """Parameters ---------- alpha : float Rocchio parameter, controls the weight assigned to the original query embedding. beta : float Rocchio parameter, controls the weight assigne...
stack_v2_sparse_classes_36k_train_025983
7,539
permissive
[ { "docstring": "Parameters ---------- alpha : float Rocchio parameter, controls the weight assigned to the original query embedding. beta : float Rocchio parameter, controls the weight assigned to the positive document embeddings. gamma : float Rocchio parameter, controls the weight assigned to the negative doc...
3
stack_v2_sparse_classes_30k_train_015607
Implement the Python class `DenseVectorRocchioPrf` described below. Class description: Implement the DenseVectorRocchioPrf class. Method signatures and docstrings: - def __init__(self, alpha: float, beta: float, gamma: float, topk: int, bottomk: int): Parameters ---------- alpha : float Rocchio parameter, controls th...
Implement the Python class `DenseVectorRocchioPrf` described below. Class description: Implement the DenseVectorRocchioPrf class. Method signatures and docstrings: - def __init__(self, alpha: float, beta: float, gamma: float, topk: int, bottomk: int): Parameters ---------- alpha : float Rocchio parameter, controls th...
42b354914b230880c91b2e4e70605b472441a9a1
<|skeleton|> class DenseVectorRocchioPrf: def __init__(self, alpha: float, beta: float, gamma: float, topk: int, bottomk: int): """Parameters ---------- alpha : float Rocchio parameter, controls the weight assigned to the original query embedding. beta : float Rocchio parameter, controls the weight assigne...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DenseVectorRocchioPrf: def __init__(self, alpha: float, beta: float, gamma: float, topk: int, bottomk: int): """Parameters ---------- alpha : float Rocchio parameter, controls the weight assigned to the original query embedding. beta : float Rocchio parameter, controls the weight assigned to the posit...
the_stack_v2_python_sparse
pyserini/search/faiss/_prf.py
castorini/pyserini
train
1,070
c368ec03e8ff0fc5a37176fddd566717f641c43d
[ "tid = threading.current_thread().ident\ntemplate_rendered = cls._split_sym_template.render(symset=symset, max_val=max_val)\nwith open('/tmp/rezasim_espresso{}split.txt'.format(tid), 'w') as f:\n f.writelines(template_rendered)\nlogging.debug('Spresso split started...')\ntry:\n espresso_out = subprocess.check...
<|body_start_0|> tid = threading.current_thread().ident template_rendered = cls._split_sym_template.render(symset=symset, max_val=max_val) with open('/tmp/rezasim_espresso{}split.txt'.format(tid), 'w') as f: f.writelines(template_rendered) logging.debug('Spresso split started...
Espresso
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Espresso: def get_splitted_sym_sets(cls, symset, max_val): """:param symset: the symbol set that we want to split :param max_val: the maximum value that the automata accept :return:""" <|body_0|> def make_ste_homogeneous(cls, stride_value, max_val_dim, inp_function): ...
stack_v2_sparse_classes_36k_train_025984
6,302
no_license
[ { "docstring": ":param symset: the symbol set that we want to split :param max_val: the maximum value that the automata accept :return:", "name": "get_splitted_sym_sets", "signature": "def get_splitted_sym_sets(cls, symset, max_val)" }, { "docstring": "this function calls the espresso template f...
3
null
Implement the Python class `Espresso` described below. Class description: Implement the Espresso class. Method signatures and docstrings: - def get_splitted_sym_sets(cls, symset, max_val): :param symset: the symbol set that we want to split :param max_val: the maximum value that the automata accept :return: - def mak...
Implement the Python class `Espresso` described below. Class description: Implement the Espresso class. Method signatures and docstrings: - def get_splitted_sym_sets(cls, symset, max_val): :param symset: the symbol set that we want to split :param max_val: the maximum value that the automata accept :return: - def mak...
eb4243725048da1b55aefb87536dca4e8e46f17c
<|skeleton|> class Espresso: def get_splitted_sym_sets(cls, symset, max_val): """:param symset: the symbol set that we want to split :param max_val: the maximum value that the automata accept :return:""" <|body_0|> def make_ste_homogeneous(cls, stride_value, max_val_dim, inp_function): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Espresso: def get_splitted_sym_sets(cls, symset, max_val): """:param symset: the symbol set that we want to split :param max_val: the maximum value that the automata accept :return:""" tid = threading.current_thread().ident template_rendered = cls._split_sym_template.render(symset=syms...
the_stack_v2_python_sparse
automata/Espresso/espresso.py
anonymousUser0/FCCM2020
train
1
5c6d7f7c7e57052b691e8802dc6d166583c75f53
[ "super().__init__(env, name, seed)\nself.buffer_processing_matrix = self.env.job_generator.buffer_processing_matrix\nnum_resources, _ = self.env.constituency_matrix.shape\nself.priorities = {}\nfor resource in np.arange(num_resources):\n priority_activity = priorities.get(resource, None)\n if priority_activit...
<|body_start_0|> super().__init__(env, name, seed) self.buffer_processing_matrix = self.env.job_generator.buffer_processing_matrix num_resources, _ = self.env.constituency_matrix.shape self.priorities = {} for resource in np.arange(num_resources): priority_activity = ...
CustomActivityPriorityAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomActivityPriorityAgent: def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> None: """Priority policy such that some activities have priority over others. For resources where no priorities are given...
stack_v2_sparse_classes_36k_train_025985
4,341
permissive
[ { "docstring": "Priority policy such that some activities have priority over others. For resources where no priorities are given, activities are chosen randomly. :param env: the environment to stepped through. :param priorities: a dictionary where the keys are the resources and the values are the activity with ...
3
stack_v2_sparse_classes_30k_train_008441
Implement the Python class `CustomActivityPriorityAgent` described below. Class description: Implement the CustomActivityPriorityAgent class. Method signatures and docstrings: - def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> No...
Implement the Python class `CustomActivityPriorityAgent` described below. Class description: Implement the CustomActivityPriorityAgent class. Method signatures and docstrings: - def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> No...
b067eebaa5b57a96efdaed5796aca9f157d32214
<|skeleton|> class CustomActivityPriorityAgent: def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> None: """Priority policy such that some activities have priority over others. For resources where no priorities are given...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomActivityPriorityAgent: def __init__(self, env: crw.ControlledRandomWalk, priorities: Dict, name: str='CustomActivityPriorityAgent', seed: Optional[int]=None) -> None: """Priority policy such that some activities have priority over others. For resources where no priorities are given, activities a...
the_stack_v2_python_sparse
src/snc/agents/general_heuristics/custom_activity_priority_agent.py
stochasticnetworkcontrol/snc
train
9
5b941fbc540cea1ed18cba85a8e27cdfee25479a
[ "self.email = MIMEMultipart()\nself.email['Subject'] = subject\nself.email['To'] = ', '.join(to)\nself.email['From'] = from_addr or EMAIL_HOST_USER\nself.message = message\nself.files = []", "msg = MIMEText(content)\nmsg.add_header('Content-Disposition', 'attachment', filename=filename)\nself.files.append(msg)", ...
<|body_start_0|> self.email = MIMEMultipart() self.email['Subject'] = subject self.email['To'] = ', '.join(to) self.email['From'] = from_addr or EMAIL_HOST_USER self.message = message self.files = [] <|end_body_0|> <|body_start_1|> msg = MIMEText(content) ...
ShinyMail constructs and sends emails.
ShinyMail
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShinyMail: """ShinyMail constructs and sends emails.""" def __init__(self, to, subject, message='', from_addr=None): """Initialize our mail object. to - a list of email addresses subject - a string containing the email subject message - a string containing the body of the email messa...
stack_v2_sparse_classes_36k_train_025986
2,292
no_license
[ { "docstring": "Initialize our mail object. to - a list of email addresses subject - a string containing the email subject message - a string containing the body of the email message (optional) from_addr - a string containing the from address (optional, will be replaced with EMAIL_HOST_USER from the shinymud co...
4
stack_v2_sparse_classes_30k_test_000671
Implement the Python class `ShinyMail` described below. Class description: ShinyMail constructs and sends emails. Method signatures and docstrings: - def __init__(self, to, subject, message='', from_addr=None): Initialize our mail object. to - a list of email addresses subject - a string containing the email subject ...
Implement the Python class `ShinyMail` described below. Class description: ShinyMail constructs and sends emails. Method signatures and docstrings: - def __init__(self, to, subject, message='', from_addr=None): Initialize our mail object. to - a list of email addresses subject - a string containing the email subject ...
c5ccb74e0ba607b006cfd7f9085e1cb9cf927d10
<|skeleton|> class ShinyMail: """ShinyMail constructs and sends emails.""" def __init__(self, to, subject, message='', from_addr=None): """Initialize our mail object. to - a list of email addresses subject - a string containing the email subject message - a string containing the body of the email messa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShinyMail: """ShinyMail constructs and sends emails.""" def __init__(self, to, subject, message='', from_addr=None): """Initialize our mail object. to - a list of email addresses subject - a string containing the email subject message - a string containing the body of the email message (optional)...
the_stack_v2_python_sparse
src/shinymud/lib/shinymail.py
ei-grad/ShinyMUD
train
0
184c024026848f77905e73cbe3d9bf0f0f8a099d
[ "self.values = values\nself.weights = weights\nself.max_weight = max_weight\nself.fcount = 0", "self.fcount += 1\nvalue = (self.values * p).sum()\nweight = (self.weights * p).sum()\nif weight > self.max_weight:\n return 1000000000.0\nreturn -value" ]
<|body_start_0|> self.values = values self.weights = weights self.max_weight = max_weight self.fcount = 0 <|end_body_0|> <|body_start_1|> self.fcount += 1 value = (self.values * p).sum() weight = (self.weights * p).sum() if weight > self.max_weight: ...
Objective for knapsack problem
Objective
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Objective: """Objective for knapsack problem""" def __init__(self, values, weights, max_weight): """Store limits""" <|body_0|> def Evaluate(self, p): """Evaluate a given set of objects""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.values ...
stack_v2_sparse_classes_36k_train_025987
4,412
permissive
[ { "docstring": "Store limits", "name": "__init__", "signature": "def __init__(self, values, weights, max_weight)" }, { "docstring": "Evaluate a given set of objects", "name": "Evaluate", "signature": "def Evaluate(self, p)" } ]
2
stack_v2_sparse_classes_30k_train_007221
Implement the Python class `Objective` described below. Class description: Objective for knapsack problem Method signatures and docstrings: - def __init__(self, values, weights, max_weight): Store limits - def Evaluate(self, p): Evaluate a given set of objects
Implement the Python class `Objective` described below. Class description: Objective for knapsack problem Method signatures and docstrings: - def __init__(self, values, weights, max_weight): Store limits - def Evaluate(self, p): Evaluate a given set of objects <|skeleton|> class Objective: """Objective for knaps...
5445b6f90ab49339ca0fdb71e98d44e6827c95a8
<|skeleton|> class Objective: """Objective for knapsack problem""" def __init__(self, values, weights, max_weight): """Store limits""" <|body_0|> def Evaluate(self, p): """Evaluate a given set of objects""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Objective: """Objective for knapsack problem""" def __init__(self, values, weights, max_weight): """Store limits""" self.values = values self.weights = weights self.max_weight = max_weight self.fcount = 0 def Evaluate(self, p): """Evaluate a given set ...
the_stack_v2_python_sparse
knapsack/knapsack.py
dayoladejo/SwarmOptimization
train
0
e279b3e4b3643b7ec55a725c0dd977412e140801
[ "user_type = request.GET.get('user_type')\nif user_type == USERTYPE_VENDOR:\n return self.render_to_response(context=self.get_context_data(form_name='vendor'))\nelif user_type == USERTYPE_CUSTOMER:\n return self.render_to_response(context=self.get_context_data(form_name='customer'))\nreturn redirect('home')",...
<|body_start_0|> user_type = request.GET.get('user_type') if user_type == USERTYPE_VENDOR: return self.render_to_response(context=self.get_context_data(form_name='vendor')) elif user_type == USERTYPE_CUSTOMER: return self.render_to_response(context=self.get_context_data(f...
Sign up view for user and associated profile.
SignUpView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignUpView: """Sign up view for user and associated profile.""" def get(self, request, *args, **kwargs): """Return form based on user type. Overridden from ProccessMultiFormsView.""" <|body_0|> def post(self, request, *args, **kwargs): """Return form result based...
stack_v2_sparse_classes_36k_train_025988
5,083
permissive
[ { "docstring": "Return form based on user type. Overridden from ProccessMultiFormsView.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Return form result based on user type. Overridden from ProccessMultiFormsView.", "name": "post", "signature":...
4
null
Implement the Python class `SignUpView` described below. Class description: Sign up view for user and associated profile. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return form based on user type. Overridden from ProccessMultiFormsView. - def post(self, request, *args, **kwargs): Ret...
Implement the Python class `SignUpView` described below. Class description: Sign up view for user and associated profile. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return form based on user type. Overridden from ProccessMultiFormsView. - def post(self, request, *args, **kwargs): Ret...
83e97be6066d076fcf3b16f0ca5b16d88912d3f8
<|skeleton|> class SignUpView: """Sign up view for user and associated profile.""" def get(self, request, *args, **kwargs): """Return form based on user type. Overridden from ProccessMultiFormsView.""" <|body_0|> def post(self, request, *args, **kwargs): """Return form result based...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignUpView: """Sign up view for user and associated profile.""" def get(self, request, *args, **kwargs): """Return form based on user type. Overridden from ProccessMultiFormsView.""" user_type = request.GET.get('user_type') if user_type == USERTYPE_VENDOR: return self....
the_stack_v2_python_sparse
users/views.py
Dhinagaran-s/Multi-Vendor-Django-E-Commerce
train
0
8c23c9dd3a43d9ab7ba0eceae004e2eb22dff0ed
[ "s = [gas[i] - cost[i] for i in range(len(gas))]\nif sum(s) < 0:\n return -1\nret = -1\nsum_ = 0\nfor i, num in enumerate(s):\n sum_ += num\n if num >= 0:\n if ret == -1:\n ret = i\n elif sum_ < 0:\n sum_ = 0\n ret = -1\nreturn ret", "length_of_gas_station = len(gas)\nf...
<|body_start_0|> s = [gas[i] - cost[i] for i in range(len(gas))] if sum(s) < 0: return -1 ret = -1 sum_ = 0 for i, num in enumerate(s): sum_ += num if num >= 0: if ret == -1: ret = i elif sum_ < 0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_025989
2,034
no_license
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit1", "signature": "def canCo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" s = [gas[i] - cost[i] for i in range(len(gas))] if sum(s) < 0: return -1 ret = -1 sum_ = 0 for i, num in enumerate(s): sum_ +=...
the_stack_v2_python_sparse
python/leetcode/134_Gas_Station.py
bobcaoge/my-code
train
0
0b2f1764da11de4295e03c7198bdd556ab5aeedf
[ "if not s:\n return 0\nlength = len(s)\nif length == 1:\n return 1\nans = 0\nfor i in range(length):\n for j in range(i + 1, length + 1):\n substring = s[i:j]\n sub_len = len(substring)\n if len(set(substring)) == sub_len:\n ans = max([ans, sub_len])\nreturn ans", "def che...
<|body_start_0|> if not s: return 0 length = len(s) if length == 1: return 1 ans = 0 for i in range(length): for j in range(i + 1, length + 1): substring = s[i:j] sub_len = len(substring) if len(s...
Solution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """A straight forward solution costing O(n^2) time Failed: Exceed time limitation.""" <|body_0|> def lengthOfLongestSubstring_v2(self, s: str) -> int: """Leverage binary-search to reduce the number of itera...
stack_v2_sparse_classes_36k_train_025990
3,108
permissive
[ { "docstring": "A straight forward solution costing O(n^2) time Failed: Exceed time limitation.", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s: str) -> int" }, { "docstring": "Leverage binary-search to reduce the number of iterations. Time: O(nlogn) Fail...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s: str) -> int: A straight forward solution costing O(n^2) time Failed: Exceed time limitation. - def lengthOfLongestSubstring_v2(self, s: str)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s: str) -> int: A straight forward solution costing O(n^2) time Failed: Exceed time limitation. - def lengthOfLongestSubstring_v2(self, s: str)...
226cecde136531341ce23cdf88529345be1912fc
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """A straight forward solution costing O(n^2) time Failed: Exceed time limitation.""" <|body_0|> def lengthOfLongestSubstring_v2(self, s: str) -> int: """Leverage binary-search to reduce the number of itera...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: """A straight forward solution costing O(n^2) time Failed: Exceed time limitation.""" if not s: return 0 length = len(s) if length == 1: return 1 ans = 0 for i in range(length):...
the_stack_v2_python_sparse
Leetcode/Intermediate/Array_and_string/3_Longest_Substring_Without_Repeating_Characters.py
ZR-Huang/AlgorithmsPractices
train
1
7e90ae114aa9ea6108be0adb5f0c6aa7f4d7fd4b
[ "Piece.reset_counters()\nMaterial.reset_counter()\nLocator.reset_counter()\nBones.reset_counter()\nself.__part_count = part_count\nself.__skeleton = skeleton.replace('\\\\', '/')", "section = _SectionData('Global')\nsection.props.append(('VertexCount', Piece.get_global_vertex_count()))\nsection.props.append(('Tri...
<|body_start_0|> Piece.reset_counters() Material.reset_counter() Locator.reset_counter() Bones.reset_counter() self.__part_count = part_count self.__skeleton = skeleton.replace('\\', '/') <|end_body_0|> <|body_start_1|> section = _SectionData('Global') se...
Globall
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Globall: def __init__(self, part_count, skeleton): """Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_025991
2,625
no_license
[ { "docstring": "Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str", "name": "__init__", "signature": "def __init__(self, part_count, skeleton)"...
2
stack_v2_sparse_classes_30k_train_010698
Implement the Python class `Globall` described below. Class description: Implement the Globall class. Method signatures and docstrings: - def __init__(self, part_count, skeleton): Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count:...
Implement the Python class `Globall` described below. Class description: Implement the Globall class. Method signatures and docstrings: - def __init__(self, part_count, skeleton): Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count:...
7b796d30dfd22b7706a93e4419ed913d18d29a44
<|skeleton|> class Globall: def __init__(self, part_count, skeleton): """Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Globall: def __init__(self, part_count, skeleton): """Constructs global for PIM :param part_count: parts counter for current game object (including any parts from PIC and PIT :type part_count: int :param skeleton: file name of the skeleton file :type skeleton: str""" Piece.reset_counters() ...
the_stack_v2_python_sparse
All_In_One/addons/io_scs_tools/exp/pim/globall.py
2434325680/Learnbgame
train
0
a1f1e917998e60f4e249a88929832457858b2e1c
[ "super(FourConvs, self).__init__()\nself.img_size = img_size\nself.in_channels = in_channels\nself.features = nn.Sequential(conv_block(0, in_channels, padding=1, pooling=True), conv_block(1, N_FILTERS, padding=1, pooling=True), conv_block(2, N_FILTERS, padding=1, pooling=True), conv_block(3, N_FILTERS, padding=1, p...
<|body_start_0|> super(FourConvs, self).__init__() self.img_size = img_size self.in_channels = in_channels self.features = nn.Sequential(conv_block(0, in_channels, padding=1, pooling=True), conv_block(1, N_FILTERS, padding=1, pooling=True), conv_block(2, N_FILTERS, padding=1, pooling=Tru...
The base CNN model for MAML (Meta-SGD) for few-shot learning. The architecture is same as of the embedding in MatchingNet.
FourConvs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FourConvs: """The base CNN model for MAML (Meta-SGD) for few-shot learning. The architecture is same as of the embedding in MatchingNet.""" def __init__(self, in_channels, img_size, num_classes): """self.net returns: [N, 64, 1, 1] for Omniglot (28x28) [N, 64, 5, 5] for miniImageNet (...
stack_v2_sparse_classes_36k_train_025992
3,835
no_license
[ { "docstring": "self.net returns: [N, 64, 1, 1] for Omniglot (28x28) [N, 64, 5, 5] for miniImageNet (84x84) self.fc returns: [N, num_classes] Args: in_channels: number of input channels feeding into first conv_block num_classes: number of classes for the task dataset: for the measure of input units for self.fc,...
3
null
Implement the Python class `FourConvs` described below. Class description: The base CNN model for MAML (Meta-SGD) for few-shot learning. The architecture is same as of the embedding in MatchingNet. Method signatures and docstrings: - def __init__(self, in_channels, img_size, num_classes): self.net returns: [N, 64, 1,...
Implement the Python class `FourConvs` described below. Class description: The base CNN model for MAML (Meta-SGD) for few-shot learning. The architecture is same as of the embedding in MatchingNet. Method signatures and docstrings: - def __init__(self, in_channels, img_size, num_classes): self.net returns: [N, 64, 1,...
e90fbdb3520c1b4000aff9e62ace1bdafad72082
<|skeleton|> class FourConvs: """The base CNN model for MAML (Meta-SGD) for few-shot learning. The architecture is same as of the embedding in MatchingNet.""" def __init__(self, in_channels, img_size, num_classes): """self.net returns: [N, 64, 1, 1] for Omniglot (28x28) [N, 64, 5, 5] for miniImageNet (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FourConvs: """The base CNN model for MAML (Meta-SGD) for few-shot learning. The architecture is same as of the embedding in MatchingNet.""" def __init__(self, in_channels, img_size, num_classes): """self.net returns: [N, 64, 1, 1] for Omniglot (28x28) [N, 64, 5, 5] for miniImageNet (84x84) self.f...
the_stack_v2_python_sparse
networks/shallow_convs.py
machanic/MetaAdvDet
train
10
00f37553afdeba66f893aa2794837c277f3902a8
[ "if isinstance(config, DictConfig):\n config = OmegaConf.to_container(config, resolve=True)\n config = OmegaConf.create(config)\nif '_target_' in config:\n instance = hydra.utils.instantiate(config=config, **kwargs)\nelse:\n try:\n instance = cls(cfg=config, **kwargs)\n except:\n cfg = ...
<|body_start_0|> if isinstance(config, DictConfig): config = OmegaConf.to_container(config, resolve=True) config = OmegaConf.create(config) if '_target_' in config: instance = hydra.utils.instantiate(config=config, **kwargs) else: try: ...
Helper Class to instantiate obj from config
Configurable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configurable: """Helper Class to instantiate obj from config""" def from_config_dict(cls, config: DictConfig, **kwargs): """Instantiates object using `DictConfig-based` configuration. You can optionally pass in extra `kwargs`""" <|body_0|> def to_config_dict(self) -> Dic...
stack_v2_sparse_classes_36k_train_025993
20,081
permissive
[ { "docstring": "Instantiates object using `DictConfig-based` configuration. You can optionally pass in extra `kwargs`", "name": "from_config_dict", "signature": "def from_config_dict(cls, config: DictConfig, **kwargs)" }, { "docstring": "Returns object's configuration to config dictionary", ...
2
stack_v2_sparse_classes_30k_train_000957
Implement the Python class `Configurable` described below. Class description: Helper Class to instantiate obj from config Method signatures and docstrings: - def from_config_dict(cls, config: DictConfig, **kwargs): Instantiates object using `DictConfig-based` configuration. You can optionally pass in extra `kwargs` -...
Implement the Python class `Configurable` described below. Class description: Helper Class to instantiate obj from config Method signatures and docstrings: - def from_config_dict(cls, config: DictConfig, **kwargs): Instantiates object using `DictConfig-based` configuration. You can optionally pass in extra `kwargs` -...
1da107e1dcf1f20d6da4ac3f126e22d409a7f92e
<|skeleton|> class Configurable: """Helper Class to instantiate obj from config""" def from_config_dict(cls, config: DictConfig, **kwargs): """Instantiates object using `DictConfig-based` configuration. You can optionally pass in extra `kwargs`""" <|body_0|> def to_config_dict(self) -> Dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Configurable: """Helper Class to instantiate obj from config""" def from_config_dict(cls, config: DictConfig, **kwargs): """Instantiates object using `DictConfig-based` configuration. You can optionally pass in extra `kwargs`""" if isinstance(config, DictConfig): config = Omeg...
the_stack_v2_python_sparse
gale/core_classes.py
benihime91/gale
train
5
1fc57f7242a6b6b1a3d2db12b765352c59e834ae
[ "current_dir = os.path.dirname(os.path.abspath(__file__))\npilot_token_image = self._get_pilot_token_image(pilot)\npilot_token_surface = cairo.ImageSurface.create_from_png(os.path.join(current_dir, pilot_token_image))\nsw, sh = (pilot_token_surface.get_width(), pilot_token_surface.get_height())\nbw, bh = pilot.ship...
<|body_start_0|> current_dir = os.path.dirname(os.path.abspath(__file__)) pilot_token_image = self._get_pilot_token_image(pilot) pilot_token_surface = cairo.ImageSurface.create_from_png(os.path.join(current_dir, pilot_token_image)) sw, sh = (pilot_token_surface.get_width(), pilot_token_s...
Renderer for drawing pilot tokens
PilotRenderer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PilotRenderer: """Renderer for drawing pilot tokens""" def __init__(self, pilot): """Constructor pilot: The pilot to render""" <|body_0|> def render(self, context): """Render this ship context: The Cairo context to render to""" <|body_1|> def _get_ba...
stack_v2_sparse_classes_36k_train_025994
2,771
permissive
[ { "docstring": "Constructor pilot: The pilot to render", "name": "__init__", "signature": "def __init__(self, pilot)" }, { "docstring": "Render this ship context: The Cairo context to render to", "name": "render", "signature": "def render(self, context)" }, { "docstring": "Get th...
4
stack_v2_sparse_classes_30k_test_000560
Implement the Python class `PilotRenderer` described below. Class description: Renderer for drawing pilot tokens Method signatures and docstrings: - def __init__(self, pilot): Constructor pilot: The pilot to render - def render(self, context): Render this ship context: The Cairo context to render to - def _get_base_c...
Implement the Python class `PilotRenderer` described below. Class description: Renderer for drawing pilot tokens Method signatures and docstrings: - def __init__(self, pilot): Constructor pilot: The pilot to render - def render(self, context): Render this ship context: The Cairo context to render to - def _get_base_c...
5760bf9695b5e081b051f29dce1ba1bf2bc94555
<|skeleton|> class PilotRenderer: """Renderer for drawing pilot tokens""" def __init__(self, pilot): """Constructor pilot: The pilot to render""" <|body_0|> def render(self, context): """Render this ship context: The Cairo context to render to""" <|body_1|> def _get_ba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PilotRenderer: """Renderer for drawing pilot tokens""" def __init__(self, pilot): """Constructor pilot: The pilot to render""" current_dir = os.path.dirname(os.path.abspath(__file__)) pilot_token_image = self._get_pilot_token_image(pilot) pilot_token_surface = cairo.ImageS...
the_stack_v2_python_sparse
ui/pilot_renderer.py
ericgreveson/xwing
train
0
a890d2f208fd83076abd4e3541f0606aa5c1ca98
[ "if not value:\n return bytes.decode(value)\nelse:\n raise excep.UpdateMessageError(sub_error=bgp_cons.ERR_MSG_UPDATE_OPTIONAL_ATTR, data=value)", "if value:\n raise excep.UpdateMessageError(sub_error=bgp_cons.ERR_MSG_UPDATE_OPTIONAL_ATTR, data='')\nelse:\n value = 0\nreturn struct.pack('!B', cls.FLAG...
<|body_start_0|> if not value: return bytes.decode(value) else: raise excep.UpdateMessageError(sub_error=bgp_cons.ERR_MSG_UPDATE_OPTIONAL_ATTR, data=value) <|end_body_0|> <|body_start_1|> if value: raise excep.UpdateMessageError(sub_error=bgp_cons.ERR_MSG_UPD...
ATOMIC_AGGREGATE is a well-known discretionary attribute of length 0.
AtomicAggregate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AtomicAggregate: """ATOMIC_AGGREGATE is a well-known discretionary attribute of length 0.""" def parse(cls, value): """parse bgp ATOMIC_AGGREGATE attribute :param value:""" <|body_0|> def construct(cls, value): """construct a ATOMIC_AGGREGATE path attribute :para...
stack_v2_sparse_classes_36k_train_025995
1,948
permissive
[ { "docstring": "parse bgp ATOMIC_AGGREGATE attribute :param value:", "name": "parse", "signature": "def parse(cls, value)" }, { "docstring": "construct a ATOMIC_AGGREGATE path attribute :param value:", "name": "construct", "signature": "def construct(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_014250
Implement the Python class `AtomicAggregate` described below. Class description: ATOMIC_AGGREGATE is a well-known discretionary attribute of length 0. Method signatures and docstrings: - def parse(cls, value): parse bgp ATOMIC_AGGREGATE attribute :param value: - def construct(cls, value): construct a ATOMIC_AGGREGATE...
Implement the Python class `AtomicAggregate` described below. Class description: ATOMIC_AGGREGATE is a well-known discretionary attribute of length 0. Method signatures and docstrings: - def parse(cls, value): parse bgp ATOMIC_AGGREGATE attribute :param value: - def construct(cls, value): construct a ATOMIC_AGGREGATE...
24cbb732d4380ab54d000ac08690e521c60d4f2a
<|skeleton|> class AtomicAggregate: """ATOMIC_AGGREGATE is a well-known discretionary attribute of length 0.""" def parse(cls, value): """parse bgp ATOMIC_AGGREGATE attribute :param value:""" <|body_0|> def construct(cls, value): """construct a ATOMIC_AGGREGATE path attribute :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AtomicAggregate: """ATOMIC_AGGREGATE is a well-known discretionary attribute of length 0.""" def parse(cls, value): """parse bgp ATOMIC_AGGREGATE attribute :param value:""" if not value: return bytes.decode(value) else: raise excep.UpdateMessageError(sub_er...
the_stack_v2_python_sparse
yabgp/message/attribute/atomicaggregate.py
smartbgp/yabgp
train
227
64ea07b4aadc6bc50690ecb76494d408d1c9839f
[ "print('开始构建 IP 树')\nt1 = time.time()\nIPHelper.ip_tree = IPTree()\nwith open(ip_csv_path, newline='') as csvfile:\n reader = csv.reader(csvfile)\n i = 1\n for row in reader:\n ip_start, ip_end, address_code = (row[0], row[1], row[2])\n IPHelper.ip_tree.train(ip_start, ip_end, address_code)\n...
<|body_start_0|> print('开始构建 IP 树') t1 = time.time() IPHelper.ip_tree = IPTree() with open(ip_csv_path, newline='') as csvfile: reader = csv.reader(csvfile) i = 1 for row in reader: ip_start, ip_end, address_code = (row[0], row[1], row[...
IPHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPHelper: def build_tree(ip_csv_path): """构建 IP 树 Keyword arguments: ip_csv_path -- csv 文件路径""" <|body_0|> def load_region(region_excel_path): """导入城市信息 Keyword arguments: argument -- description Return:""" <|body_1|> def start(ip_csv_path: str, region_e...
stack_v2_sparse_classes_36k_train_025996
3,154
no_license
[ { "docstring": "构建 IP 树 Keyword arguments: ip_csv_path -- csv 文件路径", "name": "build_tree", "signature": "def build_tree(ip_csv_path)" }, { "docstring": "导入城市信息 Keyword arguments: argument -- description Return:", "name": "load_region", "signature": "def load_region(region_excel_path)" ...
4
stack_v2_sparse_classes_30k_train_003456
Implement the Python class `IPHelper` described below. Class description: Implement the IPHelper class. Method signatures and docstrings: - def build_tree(ip_csv_path): 构建 IP 树 Keyword arguments: ip_csv_path -- csv 文件路径 - def load_region(region_excel_path): 导入城市信息 Keyword arguments: argument -- description Return: - ...
Implement the Python class `IPHelper` described below. Class description: Implement the IPHelper class. Method signatures and docstrings: - def build_tree(ip_csv_path): 构建 IP 树 Keyword arguments: ip_csv_path -- csv 文件路径 - def load_region(region_excel_path): 导入城市信息 Keyword arguments: argument -- description Return: - ...
6bd8b923dd052ee1aa7efc468c505277b9f2c24f
<|skeleton|> class IPHelper: def build_tree(ip_csv_path): """构建 IP 树 Keyword arguments: ip_csv_path -- csv 文件路径""" <|body_0|> def load_region(region_excel_path): """导入城市信息 Keyword arguments: argument -- description Return:""" <|body_1|> def start(ip_csv_path: str, region_e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPHelper: def build_tree(ip_csv_path): """构建 IP 树 Keyword arguments: ip_csv_path -- csv 文件路径""" print('开始构建 IP 树') t1 = time.time() IPHelper.ip_tree = IPTree() with open(ip_csv_path, newline='') as csvfile: reader = csv.reader(csvfile) i = 1 ...
the_stack_v2_python_sparse
exercises/tree/ip_tree.py
zh826256645/my-algorithm-exercises
train
0
7ac010abe2147be937864db295c5639d316aada6
[ "content = self.get_file_content()\nlabels = []\nfor index in range(self.count):\n labels.append(self.norm(content[index + 8]))\nreturn labels", "label_vec = []\nlabel_value = label\nfor i in range(10):\n if i == label_value:\n label_vec.append(1)\n else:\n label_vec.append(0)\nreturn label...
<|body_start_0|> content = self.get_file_content() labels = [] for index in range(self.count): labels.append(self.norm(content[index + 8])) return labels <|end_body_0|> <|body_start_1|> label_vec = [] label_value = label for i in range(10): ...
The label loader of MNIST
LabelLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelLoader: """The label loader of MNIST""" def load(self): """Load all data and get all labels.""" <|body_0|> def norm(label): """Turn label to 10 dim vector.""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = self.get_file_content() ...
stack_v2_sparse_classes_36k_train_025997
726
no_license
[ { "docstring": "Load all data and get all labels.", "name": "load", "signature": "def load(self)" }, { "docstring": "Turn label to 10 dim vector.", "name": "norm", "signature": "def norm(label)" } ]
2
stack_v2_sparse_classes_30k_train_002930
Implement the Python class `LabelLoader` described below. Class description: The label loader of MNIST Method signatures and docstrings: - def load(self): Load all data and get all labels. - def norm(label): Turn label to 10 dim vector.
Implement the Python class `LabelLoader` described below. Class description: The label loader of MNIST Method signatures and docstrings: - def load(self): Load all data and get all labels. - def norm(label): Turn label to 10 dim vector. <|skeleton|> class LabelLoader: """The label loader of MNIST""" def loa...
4159aa7e272fa1f20a54b8c3a6d13891599962fe
<|skeleton|> class LabelLoader: """The label loader of MNIST""" def load(self): """Load all data and get all labels.""" <|body_0|> def norm(label): """Turn label to 10 dim vector.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelLoader: """The label loader of MNIST""" def load(self): """Load all data and get all labels.""" content = self.get_file_content() labels = [] for index in range(self.count): labels.append(self.norm(content[index + 8])) return labels def norm(l...
the_stack_v2_python_sparse
label_loader.py
administrator-zero/agent_yang
train
0
c1b32fd250783a2cda82b25462eec237db32e35e
[ "self.name = name\nself.defaults_field = defaults_field\nself.set_defaults(defaults)", "if isinstance(defaults, dict):\n self._defaults = defaults\nelif isinstance(defaults, str):\n self._defaults = None\n self._defaults_location = defaults\nelse:\n ty = type(self).__qualname__\n raise TypeError(f'...
<|body_start_0|> self.name = name self.defaults_field = defaults_field self.set_defaults(defaults) <|end_body_0|> <|body_start_1|> if isinstance(defaults, dict): self._defaults = defaults elif isinstance(defaults, str): self._defaults = None s...
Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module.
HasDefaults
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HasDefaults: """Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module.""" def __init__(self, name, defaults, defaults_field): """Initialize a HasDefaults.""" <|body_0|> def set_defaults(self, defaults): "...
stack_v2_sparse_classes_36k_train_025998
15,608
permissive
[ { "docstring": "Initialize a HasDefaults.", "name": "__init__", "signature": "def __init__(self, name, defaults, defaults_field)" }, { "docstring": "Set the defaults.", "name": "set_defaults", "signature": "def set_defaults(self, defaults)" }, { "docstring": "Return defaults for ...
3
stack_v2_sparse_classes_30k_test_000040
Implement the Python class `HasDefaults` described below. Class description: Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module. Method signatures and docstrings: - def __init__(self, name, defaults, defaults_field): Initialize a HasDefaults. - def set_def...
Implement the Python class `HasDefaults` described below. Class description: Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module. Method signatures and docstrings: - def __init__(self, name, defaults, defaults_field): Initialize a HasDefaults. - def set_def...
d7b12c15453079e1a2c4fdae611c5f741574363d
<|skeleton|> class HasDefaults: """Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module.""" def __init__(self, name, defaults, defaults_field): """Initialize a HasDefaults.""" <|body_0|> def set_defaults(self, defaults): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HasDefaults: """Object that can return a defaults dictionary. The defaults can be given as a dictionary or as a path to a module.""" def __init__(self, name, defaults, defaults_field): """Initialize a HasDefaults.""" self.name = name self.defaults_field = defaults_field se...
the_stack_v2_python_sparse
myia/utils/misc.py
breuleux/myia
train
1
3e1727b0970b5ac05619b68d723e329e18be2e8e
[ "super().__init__(Pan.image, x=games.mouse.x, bottom=games.screen.height)\nself.score = games.Text(value=0, size=25, color=color.black, top=5, right=games.screen.width - 10)\ngames.screen.add(self.score)\nself.chef = the_chef\nself.time_born = 25\nself.check_speed = 0", "self.x = games.mouse.x\nif self.left < 0:\...
<|body_start_0|> super().__init__(Pan.image, x=games.mouse.x, bottom=games.screen.height) self.score = games.Text(value=0, size=25, color=color.black, top=5, right=games.screen.width - 10) games.screen.add(self.score) self.chef = the_chef self.time_born = 25 self.check_sp...
Pan, in whom player will catch fall pizza
Pan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pan: """Pan, in whom player will catch fall pizza""" def __init__(self, the_chef): """init object Pan and create object Text for visual count""" <|body_0|> def update(self): """Move object on horizontal in""" <|body_1|> def check_catch(self): ...
stack_v2_sparse_classes_36k_train_025999
10,701
no_license
[ { "docstring": "init object Pan and create object Text for visual count", "name": "__init__", "signature": "def __init__(self, the_chef)" }, { "docstring": "Move object on horizontal in", "name": "update", "signature": "def update(self)" }, { "docstring": "Check, player catch fal...
4
null
Implement the Python class `Pan` described below. Class description: Pan, in whom player will catch fall pizza Method signatures and docstrings: - def __init__(self, the_chef): init object Pan and create object Text for visual count - def update(self): Move object on horizontal in - def check_catch(self): Check, play...
Implement the Python class `Pan` described below. Class description: Pan, in whom player will catch fall pizza Method signatures and docstrings: - def __init__(self, the_chef): init object Pan and create object Text for visual count - def update(self): Move object on horizontal in - def check_catch(self): Check, play...
501aed406bc88e0baebd402e18851f1f2f8ac9da
<|skeleton|> class Pan: """Pan, in whom player will catch fall pizza""" def __init__(self, the_chef): """init object Pan and create object Text for visual count""" <|body_0|> def update(self): """Move object on horizontal in""" <|body_1|> def check_catch(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pan: """Pan, in whom player will catch fall pizza""" def __init__(self, the_chef): """init object Pan and create object Text for visual count""" super().__init__(Pan.image, x=games.mouse.x, bottom=games.screen.height) self.score = games.Text(value=0, size=25, color=color.black, to...
the_stack_v2_python_sparse
_Chapter_11_PYGAME_LIVEWIRES/Homework_1.py
MrVeshij/Michael-Dawson
train
1