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
7c0ab126e91e2070d3083d35d923c24aa5d4a667
[ "atmos_var = list(AtmosphericCoefficients)\nfmap = {Workflow.STANDARD: atmos_var, Workflow.NBAR: atmos_var[0:8], Workflow.SBT: atmos_var[8:]}\nreturn fmap.get(self)", "albs = list(Albedos)\namap = {Workflow.STANDARD: albs, Workflow.NBAR: albs[0:-1], Workflow.SBT: [albs[-1]]}\nreturn amap.get(self)", "products =...
<|body_start_0|> atmos_var = list(AtmosphericCoefficients) fmap = {Workflow.STANDARD: atmos_var, Workflow.NBAR: atmos_var[0:8], Workflow.SBT: atmos_var[8:]} return fmap.get(self) <|end_body_0|> <|body_start_1|> albs = list(Albedos) amap = {Workflow.STANDARD: albs, Workflow.NBAR:...
Represents the different workflow that wagl can run. *standard* Indicates both NBAR and SBT workflows will run *nbar* Indicates NBAR only *sbt* Indicates SBT only
Workflow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Workflow: """Represents the different workflow that wagl can run. *standard* Indicates both NBAR and SBT workflows will run *nbar* Indicates NBAR only *sbt* Indicates SBT only""" def atmos_coefficients(self): """Returns the atmospheric coefficients names used for interpolation for a ...
stack_v2_sparse_classes_36k_train_024400
16,541
permissive
[ { "docstring": "Returns the atmospheric coefficients names used for interpolation for a given Workflow.<option>.", "name": "atmos_coefficients", "signature": "def atmos_coefficients(self)" }, { "docstring": "Returns the albedo names used for specific Atmospheric evaluations for a given Workflow....
3
stack_v2_sparse_classes_30k_train_011622
Implement the Python class `Workflow` described below. Class description: Represents the different workflow that wagl can run. *standard* Indicates both NBAR and SBT workflows will run *nbar* Indicates NBAR only *sbt* Indicates SBT only Method signatures and docstrings: - def atmos_coefficients(self): Returns the atm...
Implement the Python class `Workflow` described below. Class description: Represents the different workflow that wagl can run. *standard* Indicates both NBAR and SBT workflows will run *nbar* Indicates NBAR only *sbt* Indicates SBT only Method signatures and docstrings: - def atmos_coefficients(self): Returns the atm...
4ae3670681b872530f59c57ab537a45d1b09c009
<|skeleton|> class Workflow: """Represents the different workflow that wagl can run. *standard* Indicates both NBAR and SBT workflows will run *nbar* Indicates NBAR only *sbt* Indicates SBT only""" def atmos_coefficients(self): """Returns the atmospheric coefficients names used for interpolation for a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Workflow: """Represents the different workflow that wagl can run. *standard* Indicates both NBAR and SBT workflows will run *nbar* Indicates NBAR only *sbt* Indicates SBT only""" def atmos_coefficients(self): """Returns the atmospheric coefficients names used for interpolation for a given Workflo...
the_stack_v2_python_sparse
wagl/constants.py
GeoscienceAustralia/wagl
train
25
23b32436319af76879df6d66ac2cd6150f038e0a
[ "if len(s) % 2:\n return False\ntemp = {')': '(', '}': '{', ']': '['}\ndemo = []\nfor i in s:\n if i not in temp:\n demo.append(i)\n if i in temp and demo:\n flag = demo.pop()\n if flag == temp.get(i):\n continue\n else:\n demo.extend([flag, i])\nreturn dem...
<|body_start_0|> if len(s) % 2: return False temp = {')': '(', '}': '{', ']': '['} demo = [] for i in s: if i not in temp: demo.append(i) if i in temp and demo: flag = demo.pop() if flag == temp.get(i): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid(self, s): """利用字典序列,和栈的特性进行 :type s: str :rtype: bool""" <|body_0|> def isValid1(self, s): """优化后 :param s: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) % 2: return False temp = {')': '...
stack_v2_sparse_classes_36k_train_024401
1,302
no_license
[ { "docstring": "利用字典序列,和栈的特性进行 :type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" }, { "docstring": "优化后 :param s: :return:", "name": "isValid1", "signature": "def isValid1(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_014312
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): 利用字典序列,和栈的特性进行 :type s: str :rtype: bool - def isValid1(self, s): 优化后 :param s: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): 利用字典序列,和栈的特性进行 :type s: str :rtype: bool - def isValid1(self, s): 优化后 :param s: :return: <|skeleton|> class Solution: def isValid(self, s): ""...
f5de348cbc00fc24ca0282235fac6d819817d005
<|skeleton|> class Solution: def isValid(self, s): """利用字典序列,和栈的特性进行 :type s: str :rtype: bool""" <|body_0|> def isValid1(self, s): """优化后 :param s: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValid(self, s): """利用字典序列,和栈的特性进行 :type s: str :rtype: bool""" if len(s) % 2: return False temp = {')': '(', '}': '{', ']': '['} demo = [] for i in s: if i not in temp: demo.append(i) if i in temp and d...
the_stack_v2_python_sparse
10-20/20.py
hubogle/PythonCode
train
0
87547abef77d2ade2bf5e6297be67934062a420d
[ "if N == 0:\n return 0\nif N == 1:\n return 1\nreturn self.fib(N - 1) + self.fib(N - 2)", "if N == 0:\n return 0\nif N == 1:\n return 1\na = 0\nb = 1\nfor i in range(N - 1):\n a, b = (b, a + b)\nreturn b" ]
<|body_start_0|> if N == 0: return 0 if N == 1: return 1 return self.fib(N - 1) + self.fib(N - 2) <|end_body_0|> <|body_start_1|> if N == 0: return 0 if N == 1: return 1 a = 0 b = 1 for i in range(N - 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fib1(self, N): """:type N: int :rtype: int""" <|body_0|> def fib(self, N): """:type N: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if N == 0: return 0 if N == 1: return 1 retu...
stack_v2_sparse_classes_36k_train_024402
647
no_license
[ { "docstring": ":type N: int :rtype: int", "name": "fib1", "signature": "def fib1(self, N)" }, { "docstring": ":type N: int :rtype: int", "name": "fib", "signature": "def fib(self, N)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib1(self, N): :type N: int :rtype: int - def fib(self, N): :type N: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib1(self, N): :type N: int :rtype: int - def fib(self, N): :type N: int :rtype: int <|skeleton|> class Solution: def fib1(self, N): """:type N: int :rtype: int...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def fib1(self, N): """:type N: int :rtype: int""" <|body_0|> def fib(self, N): """:type N: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fib1(self, N): """:type N: int :rtype: int""" if N == 0: return 0 if N == 1: return 1 return self.fib(N - 1) + self.fib(N - 2) def fib(self, N): """:type N: int :rtype: int""" if N == 0: return 0 if ...
the_stack_v2_python_sparse
python/leetcode_bak/509_Fibonacci_Number.py
bobcaoge/my-code
train
0
54d0880a9f717d6c635f670547c351655ba950b2
[ "Serializable._init(self, locals())\nsuper().__init__(min_rollouts=min_rollouts, min_steps=min_steps)\nself.env = env\nself.policy = policy\nself.bernoulli_reset = bernoulli_reset\nif self.policy.device == 'cuda':\n mp.set_start_method('spawn', force=True)\nself.pool = SamplerPool(num_envs)\nif seed is not None:...
<|body_start_0|> Serializable._init(self, locals()) super().__init__(min_rollouts=min_rollouts, min_steps=min_steps) self.env = env self.policy = policy self.bernoulli_reset = bernoulli_reset if self.policy.device == 'cuda': mp.set_start_method('spawn', force=...
Class for sampling from multiple environments in parallel
ParallelSampler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParallelSampler: """Class for sampling from multiple environments in parallel""" def __init__(self, env, policy, num_envs: int, *, min_rollouts: int=None, min_steps: int=None, bernoulli_reset: bool=None, seed: int=None): """Constructor :param env: environment to sample from :param po...
stack_v2_sparse_classes_36k_train_024403
4,523
permissive
[ { "docstring": "Constructor :param env: environment to sample from :param policy: policy to act in the environment (can also be an exploration strategy) :param num_envs: number of parallel samplers :param min_rollouts: minimum number of complete rollouts to sample. :param min_steps: minimum total number of step...
3
stack_v2_sparse_classes_30k_train_005265
Implement the Python class `ParallelSampler` described below. Class description: Class for sampling from multiple environments in parallel Method signatures and docstrings: - def __init__(self, env, policy, num_envs: int, *, min_rollouts: int=None, min_steps: int=None, bernoulli_reset: bool=None, seed: int=None): Con...
Implement the Python class `ParallelSampler` described below. Class description: Class for sampling from multiple environments in parallel Method signatures and docstrings: - def __init__(self, env, policy, num_envs: int, *, min_rollouts: int=None, min_steps: int=None, bernoulli_reset: bool=None, seed: int=None): Con...
a6c982862e2ab39a9f65d1c09aa59d9a8b7ac6c5
<|skeleton|> class ParallelSampler: """Class for sampling from multiple environments in parallel""" def __init__(self, env, policy, num_envs: int, *, min_rollouts: int=None, min_steps: int=None, bernoulli_reset: bool=None, seed: int=None): """Constructor :param env: environment to sample from :param po...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParallelSampler: """Class for sampling from multiple environments in parallel""" def __init__(self, env, policy, num_envs: int, *, min_rollouts: int=None, min_steps: int=None, bernoulli_reset: bool=None, seed: int=None): """Constructor :param env: environment to sample from :param policy: policy ...
the_stack_v2_python_sparse
Pyrado/pyrado/sampling/parallel_sampler.py
jacarvalho/SimuRLacra
train
0
f7a7e5a57027c960d0b6b2749eae5408d92ed49d
[ "DataUnitSettings.__init__(self, n)\nself.set('Type', 'Merging')\nself.registerCounted('IntensityTransferFunction', 1)\nself.register('AlphaTransferFunction', 1)\nself.register('AlphaMode')\nself.registerCounted('PreviewChannel')\ntf = vtkbxd.vtkIntensityTransferFunction()\nself.set('AlphaTransferFunction', tf)\nse...
<|body_start_0|> DataUnitSettings.__init__(self, n) self.set('Type', 'Merging') self.registerCounted('IntensityTransferFunction', 1) self.register('AlphaTransferFunction', 1) self.register('AlphaMode') self.registerCounted('PreviewChannel') tf = vtkbxd.vtkIntensit...
Description: Stores color merging related settings
MergingSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MergingSettings: """Description: Stores color merging related settings""" def __init__(self, n=-1): """Constructor""" <|body_0|> def initialize(self, dataunit, channels, timepoints): """Set initial values for settings based on number of channels and timepoints"""...
stack_v2_sparse_classes_36k_train_024404
2,749
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, n=-1)" }, { "docstring": "Set initial values for settings based on number of channels and timepoints", "name": "initialize", "signature": "def initialize(self, dataunit, channels, timepoints)" }, { ...
3
null
Implement the Python class `MergingSettings` described below. Class description: Description: Stores color merging related settings Method signatures and docstrings: - def __init__(self, n=-1): Constructor - def initialize(self, dataunit, channels, timepoints): Set initial values for settings based on number of chann...
Implement the Python class `MergingSettings` described below. Class description: Description: Stores color merging related settings Method signatures and docstrings: - def __init__(self, n=-1): Constructor - def initialize(self, dataunit, channels, timepoints): Set initial values for settings based on number of chann...
ea8bafa073de5090bd8f83fb4f5ca16669d0211f
<|skeleton|> class MergingSettings: """Description: Stores color merging related settings""" def __init__(self, n=-1): """Constructor""" <|body_0|> def initialize(self, dataunit, channels, timepoints): """Set initial values for settings based on number of channels and timepoints"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MergingSettings: """Description: Stores color merging related settings""" def __init__(self, n=-1): """Constructor""" DataUnitSettings.__init__(self, n) self.set('Type', 'Merging') self.registerCounted('IntensityTransferFunction', 1) self.register('AlphaTransferFun...
the_stack_v2_python_sparse
Graphs/LX-2/molecule_otsu = False/BioImageXD-1.0/Modules/Task/Merging/MergingSettings.py
giacomo21/Image-analysis
train
1
0526585efaaadbcc4b2c714332cfae535e6da068
[ "self.build_logs = []\nself.build_stages = build_stages or self.build_stages\nself.build_context = {**(self.DEFAULT_CONTEXT or {}), **(kwargs or {})}\nself.logger = logger", "broken_stage = None\nfor index, stage in enumerate(self.build_stages):\n try:\n self._do_stage(stage)\n self.logger.debug(...
<|body_start_0|> self.build_logs = [] self.build_stages = build_stages or self.build_stages self.build_context = {**(self.DEFAULT_CONTEXT or {}), **(kwargs or {})} self.logger = logger <|end_body_0|> <|body_start_1|> broken_stage = None for index, stage in enumerate(self...
A robust class that helps us build arbitrary experiments.
ExperimentBuilder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExperimentBuilder: """A robust class that helps us build arbitrary experiments.""" def __init__(self, build_stages: Sequence=None, logger=None, **kwargs): """Args: build_stages: The sequence of build stages that you want.""" <|body_0|> def build(self) -> bool: ""...
stack_v2_sparse_classes_36k_train_024405
13,721
permissive
[ { "docstring": "Args: build_stages: The sequence of build stages that you want.", "name": "__init__", "signature": "def __init__(self, build_stages: Sequence=None, logger=None, **kwargs)" }, { "docstring": "The build method. Returns: A boolean indicating whether or not the build went to completi...
3
stack_v2_sparse_classes_30k_train_017547
Implement the Python class `ExperimentBuilder` described below. Class description: A robust class that helps us build arbitrary experiments. Method signatures and docstrings: - def __init__(self, build_stages: Sequence=None, logger=None, **kwargs): Args: build_stages: The sequence of build stages that you want. - def...
Implement the Python class `ExperimentBuilder` described below. Class description: A robust class that helps us build arbitrary experiments. Method signatures and docstrings: - def __init__(self, build_stages: Sequence=None, logger=None, **kwargs): Args: build_stages: The sequence of build stages that you want. - def...
053714ecfbceeb2f27f73ebee3ae890726874693
<|skeleton|> class ExperimentBuilder: """A robust class that helps us build arbitrary experiments.""" def __init__(self, build_stages: Sequence=None, logger=None, **kwargs): """Args: build_stages: The sequence of build stages that you want.""" <|body_0|> def build(self) -> bool: ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExperimentBuilder: """A robust class that helps us build arbitrary experiments.""" def __init__(self, build_stages: Sequence=None, logger=None, **kwargs): """Args: build_stages: The sequence of build stages that you want.""" self.build_logs = [] self.build_stages = build_stages or...
the_stack_v2_python_sparse
studies/experiment_builder.py
lookit/lookit-api
train
12
f95e632615a3fca54e4e7388e60e43e25ee6c96b
[ "if self.value is not None:\n return self.value * u.Unit(self.unit)\nelse:\n return np.nan * u.Unit(self.unit)", "newclass = type(name, (cls, Base), {'__tablename__': tablename, 'file': sqlalchemy.Column(sqlalchemy.String, sqlalchemy.ForeignKey(entrycls.file)), 'entry': sqlalchemy.orm.relationship(entrycls,...
<|body_start_0|> if self.value is not None: return self.value * u.Unit(self.unit) else: return np.nan * u.Unit(self.unit) <|end_body_0|> <|body_start_1|> newclass = type(name, (cls, Base), {'__tablename__': tablename, 'file': sqlalchemy.Column(sqlalchemy.String, sqlalche...
A mixin object for a cache entry object to inherit, providing the relevant columns and accessors
Cache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cache: """A mixin object for a cache entry object to inherit, providing the relevant columns and accessors""" def get_value(self): """Return the current cache value (with appropriate AstroPy units)""" <|body_0|> def CacheFactory(cls, name, entrycls, tablename, **kwargs):...
stack_v2_sparse_classes_36k_train_024406
23,976
no_license
[ { "docstring": "Return the current cache value (with appropriate AstroPy units)", "name": "get_value", "signature": "def get_value(self)" }, { "docstring": "Create a cache object inside of cls that is itself a SQLAlchemy entry object", "name": "CacheFactory", "signature": "def CacheFacto...
3
stack_v2_sparse_classes_30k_train_015581
Implement the Python class `Cache` described below. Class description: A mixin object for a cache entry object to inherit, providing the relevant columns and accessors Method signatures and docstrings: - def get_value(self): Return the current cache value (with appropriate AstroPy units) - def CacheFactory(cls, name,...
Implement the Python class `Cache` described below. Class description: A mixin object for a cache entry object to inherit, providing the relevant columns and accessors Method signatures and docstrings: - def get_value(self): Return the current cache value (with appropriate AstroPy units) - def CacheFactory(cls, name,...
514af926494daa52d1e9699ffe295529492117a2
<|skeleton|> class Cache: """A mixin object for a cache entry object to inherit, providing the relevant columns and accessors""" def get_value(self): """Return the current cache value (with appropriate AstroPy units)""" <|body_0|> def CacheFactory(cls, name, entrycls, tablename, **kwargs):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cache: """A mixin object for a cache entry object to inherit, providing the relevant columns and accessors""" def get_value(self): """Return the current cache value (with appropriate AstroPy units)""" if self.value is not None: return self.value * u.Unit(self.unit) els...
the_stack_v2_python_sparse
kepler_utils/database/database.py
brownjustinmichael/KEPLER-Utilities
train
0
660469b9df4a2cf10b891f8bde46f0bdcbb77077
[ "host_port = data_server.split(':')\nif len(host_port) == 1:\n self.data_server = 'localhost:' + data_server\nelif not len(host_port[0]):\n self.data_server = 'localhost' + data_server\nelse:\n self.data_server = data_server\nself.websocket = None\nself.back_seconds = back_seconds\nself.cleanup_interval = ...
<|body_start_0|> host_port = data_server.split(':') if len(host_port) == 1: self.data_server = 'localhost:' + data_server elif not len(host_port[0]): self.data_server = 'localhost' + data_server else: self.data_server = data_server self.websock...
CachedDataWriter
[ "MIT", "CC-BY-NC-4.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedDataWriter: def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): """Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port...
stack_v2_sparse_classes_36k_train_024407
6,222
permissive
[ { "docstring": "Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port on which to look for data server back_seconds Number of seconds of back data to hold in cache cleanup_interval Remove old data every N seconds update_interval Serv...
3
stack_v2_sparse_classes_30k_train_015781
Implement the Python class `CachedDataWriter` described below. Class description: Implement the CachedDataWriter class. Method signatures and docstrings: - def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): Feed passed records to a Ca...
Implement the Python class `CachedDataWriter` described below. Class description: Implement the CachedDataWriter class. Method signatures and docstrings: - def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): Feed passed records to a Ca...
ba77d3958075abd21ff94a396e4a97879962ac0c
<|skeleton|> class CachedDataWriter: def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): """Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CachedDataWriter: def __init__(self, data_server, start_server=False, back_seconds=480, cleanup_interval=6, update_interval=1, max_backup=60 * 60 * 24): """Feed passed records to a CachedDataServer via a websocket. Expects records in DASRecord or dict formats. ``` data_server [host:]port on which to l...
the_stack_v2_python_sparse
logger/writers/cached_data_writer.py
timburbank/openrvdas
train
0
3f83768c5a7eedde914eed225b6aca5165f1d72b
[ "slide = openslide.OpenSlide(wsi_name)\ndimensions = slide.dimensions\nlevels = slide.level_count\nlevel = levels - 1\ndownsample = slide.level_downsamples[level]\nprint(level, downsample)\nthumbnail_rgb = cv2.cvtColor(np.asarray(slide.read_region((0, 0), level, slide.level_dimensions[level]).convert('RGB')), cv2.C...
<|body_start_0|> slide = openslide.OpenSlide(wsi_name) dimensions = slide.dimensions levels = slide.level_count level = levels - 1 downsample = slide.level_downsamples[level] print(level, downsample) thumbnail_rgb = cv2.cvtColor(np.asarray(slide.read_region((0, 0)...
WSIROI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WSIROI: def __init__(self, wsi_name): """get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle""" ...
stack_v2_sparse_classes_36k_train_024408
5,710
no_license
[ { "docstring": "get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle", "name": "__init__", "signature": "def __init__(...
2
stack_v2_sparse_classes_30k_train_013733
Implement the Python class `WSIROI` described below. Class description: Implement the WSIROI class. Method signatures and docstrings: - def __init__(self, wsi_name): get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in...
Implement the Python class `WSIROI` described below. Class description: Implement the WSIROI class. Method signatures and docstrings: - def __init__(self, wsi_name): get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in...
d77cec4438364deab94c37b45bdfde3e0b03b879
<|skeleton|> class WSIROI: def __init__(self, wsi_name): """get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WSIROI: def __init__(self, wsi_name): """get a circle roi of wsi file, it should encampus almost all the cells area :param wsi_name: wsi full file name :return dimensions: slide width,height in level 0 :return center: center x,y of roi circle :return radius: radius of roi circle""" slide = ope...
the_stack_v2_python_sparse
train_c1/roi_extract/WSI_ROI.py
liyu10000/tct
train
15
e06972728f124a062bb6bfa5cc9e3e229bb5d43a
[ "if coins == [] or amount == 0:\n return 0\ncoins = sorted(coins)\ndp = [-1 for i in range(amount + 1)]\nfor i in range(coins[0], amount + 1):\n if i in coins:\n dp[i] = 1\n else:\n for k in range(1, i // 2 + 1):\n print(k, i)\n if dp[i - k] != -1 and dp[k] != -1:\n ...
<|body_start_0|> if coins == [] or amount == 0: return 0 coins = sorted(coins) dp = [-1 for i in range(amount + 1)] for i in range(coins[0], amount + 1): if i in coins: dp[i] = 1 else: for k in range(1, i // 2 + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange_1(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int 572ms bfs""" <|body_1|> def coinChange_2(s...
stack_v2_sparse_classes_36k_train_024409
3,462
no_license
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int 572ms bfs", "name": "coinChange_1", "signature": "def coinChange_1(self,...
4
stack_v2_sparse_classes_30k_train_011445
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange_1(self, coins, amount): :type coins: List[int] :type amount: int :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange_1(self, coins, amount): :type coins: List[int] :type amount: int :rtype...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange_1(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int 572ms bfs""" <|body_1|> def coinChange_2(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" if coins == [] or amount == 0: return 0 coins = sorted(coins) dp = [-1 for i in range(amount + 1)] for i in range(coins[0], amount + 1): if ...
the_stack_v2_python_sparse
CoinChange_MID_322.py
953250587/leetcode-python
train
2
2a07bcc04983f593bda280931fc8d0c029d486ae
[ "if set(ransomNote) > set(magazine):\n return False\nres = list(ransomNote)\nfor i in list(magazine):\n if i in res:\n res.remove(i)\n else:\n pass\nif len(res) > 0:\n return False\nelse:\n return True", "if set(ransomNote) > set(magazine):\n return False\nchar_dict = {}\nfor i in ...
<|body_start_0|> if set(ransomNote) > set(magazine): return False res = list(ransomNote) for i in list(magazine): if i in res: res.remove(i) else: pass if len(res) > 0: return False else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct2(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> def can...
stack_v2_sparse_classes_36k_train_024410
2,064
no_license
[ { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct", "signature": "def canConstruct(self, ransomNote, magazine)" }, { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct2", "signature": "def canConstruct...
3
stack_v2_sparse_classes_30k_train_006507
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct2(self, ransomNote, magazine): :type ransomNote: str :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct2(self, ransomNote, magazine): :type ransomNote: str :type ...
829f918a0d4d94da5fd3004768421974fbe056e7
<|skeleton|> class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct2(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> def can...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" if set(ransomNote) > set(magazine): return False res = list(ransomNote) for i in list(magazine): if i in res: res.remove(...
the_stack_v2_python_sparse
leetcode/easy/easy 201-400/383_赎金信.py
Weikoi/OJ_Python
train
0
7016cf523071438599b010b38e3a4bb9ffbeed4f
[ "super().__init__()\nself.message = message\nself.status_code = status_code", "response = jsonify({'message': self.message, 'status': self.status_code})\nresponse.status_code = self.status_code\nreturn response" ]
<|body_start_0|> super().__init__() self.message = message self.status_code = status_code <|end_body_0|> <|body_start_1|> response = jsonify({'message': self.message, 'status': self.status_code}) response.status_code = self.status_code return response <|end_body_1|>
Error class for API HTTP errors.
ApiHTTPError
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiHTTPError: """Error class for API HTTP errors.""" def __init__(self, message, status_code): """Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.""" <|body_0|> def build_response(self): """...
stack_v2_sparse_classes_36k_train_024411
1,531
permissive
[ { "docstring": "Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.", "name": "__init__", "signature": "def __init__(self, message, status_code)" }, { "docstring": "Create a response object. Returns: Response object (instance ...
2
stack_v2_sparse_classes_30k_train_005391
Implement the Python class `ApiHTTPError` described below. Class description: Error class for API HTTP errors. Method signatures and docstrings: - def __init__(self, message, status_code): Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code. - def b...
Implement the Python class `ApiHTTPError` described below. Class description: Error class for API HTTP errors. Method signatures and docstrings: - def __init__(self, message, status_code): Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code. - def b...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class ApiHTTPError: """Error class for API HTTP errors.""" def __init__(self, message, status_code): """Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.""" <|body_0|> def build_response(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiHTTPError: """Error class for API HTTP errors.""" def __init__(self, message, status_code): """Initialize the class with a custom error message. Args: message: Description of the error. status_code: HTTP status code.""" super().__init__() self.message = message self.sta...
the_stack_v2_python_sparse
timesketch/lib/errors.py
google/timesketch
train
2,263
c5fcf14ec8d1ab9af39ec57f8e3481680d489d2b
[ "self.screen_height = screen_height\nself.screen_width = screen_width\nself.history_length = n_history\nself.action_size = action_size\nself.w = {}\nself.q = self.build_network()", "initializer = tf.truncated_normal_initializer(0, 0.02)\nself.s_t = tf.placeholder('float32', [None, self.screen_height, self.screen_...
<|body_start_0|> self.screen_height = screen_height self.screen_width = screen_width self.history_length = n_history self.action_size = action_size self.w = {} self.q = self.build_network() <|end_body_0|> <|body_start_1|> initializer = tf.truncated_normal_initial...
Q関数を計算するネットワーク
QFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QFunction: """Q関数を計算するネットワーク""" def __init__(self, screen_height, screen_width, n_history, action_size): """:param screen_height: 画面サイズ(縦) :param screen_width: 画面サイズ(横) :param n_history: ヒストリー(数) :param action_size: 行動パタン数""" <|body_0|> def build_network(self): "...
stack_v2_sparse_classes_36k_train_024412
4,460
no_license
[ { "docstring": ":param screen_height: 画面サイズ(縦) :param screen_width: 画面サイズ(横) :param n_history: ヒストリー(数) :param action_size: 行動パタン数", "name": "__init__", "signature": "def __init__(self, screen_height, screen_width, n_history, action_size)" }, { "docstring": "計算グラフの構築 :return: 計算結果", "name": ...
4
stack_v2_sparse_classes_30k_train_009728
Implement the Python class `QFunction` described below. Class description: Q関数を計算するネットワーク Method signatures and docstrings: - def __init__(self, screen_height, screen_width, n_history, action_size): :param screen_height: 画面サイズ(縦) :param screen_width: 画面サイズ(横) :param n_history: ヒストリー(数) :param action_size: 行動パタン数 - de...
Implement the Python class `QFunction` described below. Class description: Q関数を計算するネットワーク Method signatures and docstrings: - def __init__(self, screen_height, screen_width, n_history, action_size): :param screen_height: 画面サイズ(縦) :param screen_width: 画面サイズ(横) :param n_history: ヒストリー(数) :param action_size: 行動パタン数 - de...
9ed6ba3f452da34a1271cf81c338dd687bd2c3d4
<|skeleton|> class QFunction: """Q関数を計算するネットワーク""" def __init__(self, screen_height, screen_width, n_history, action_size): """:param screen_height: 画面サイズ(縦) :param screen_width: 画面サイズ(横) :param n_history: ヒストリー(数) :param action_size: 行動パタン数""" <|body_0|> def build_network(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QFunction: """Q関数を計算するネットワーク""" def __init__(self, screen_height, screen_width, n_history, action_size): """:param screen_height: 画面サイズ(縦) :param screen_width: 画面サイズ(横) :param n_history: ヒストリー(数) :param action_size: 行動パタン数""" self.screen_height = screen_height self.screen_width = ...
the_stack_v2_python_sparse
Interface201712/DeepQNetwork/src/qfunction.py
acroquest/interface-sample-code
train
4
3d298b52eda0cc5ae0f6f056f631ad9f50ae34c9
[ "length = len(nums)\nself.d = {}\nself.a = nums\nself.build(0, length, 0)", "if left == right - 1:\n self.d[p] = self.a[left]\n return\nmid = left + (right - left) // 2\nchdleft = 2 * p + 1\nchdright = 2 * p + 2\nself.build(left, mid, chdleft)\nself.build(mid, right, chdright)\nself.d[p] = self.d[chdleft] +...
<|body_start_0|> length = len(nums) self.d = {} self.a = nums self.build(0, length, 0) <|end_body_0|> <|body_start_1|> if left == right - 1: self.d[p] = self.a[left] return mid = left + (right - left) // 2 chdleft = 2 * p + 1 chdri...
非完美二叉树版本, 即二分法分割区间
segmentTree
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class segmentTree: """非完美二叉树版本, 即二分法分割区间""" def __init__(self, nums) -> None: """p 代表 [left, right) eg: 0 -> [0, length) 1 -> [0, mid) 2 -> [mid, length) 注意, 这里d的数据类型dict是更优选择, 因为对nums 进行递归的二分法分割区间, 会导致 二叉树并非是完全二叉树,会出现大量不连续的叶子结点,然而不连续的叶子结点仍然会占用索引空间 如果用list,这个索引必须有值 如果用dict, 则会节省很多索引空间 eg: ...
stack_v2_sparse_classes_36k_train_024413
4,234
permissive
[ { "docstring": "p 代表 [left, right) eg: 0 -> [0, length) 1 -> [0, mid) 2 -> [mid, length) 注意, 这里d的数据类型dict是更优选择, 因为对nums 进行递归的二分法分割区间, 会导致 二叉树并非是完全二叉树,会出现大量不连续的叶子结点,然而不连续的叶子结点仍然会占用索引空间 如果用list,这个索引必须有值 如果用dict, 则会节省很多索引空间 eg: 21 6 15 3 3 9 6 1 2 (3) 4 5 (6)", "name": "__init__", "signature": "def __init_...
4
stack_v2_sparse_classes_30k_train_011207
Implement the Python class `segmentTree` described below. Class description: 非完美二叉树版本, 即二分法分割区间 Method signatures and docstrings: - def __init__(self, nums) -> None: p 代表 [left, right) eg: 0 -> [0, length) 1 -> [0, mid) 2 -> [mid, length) 注意, 这里d的数据类型dict是更优选择, 因为对nums 进行递归的二分法分割区间, 会导致 二叉树并非是完全二叉树,会出现大量不连续的叶子结点,然而不连...
Implement the Python class `segmentTree` described below. Class description: 非完美二叉树版本, 即二分法分割区间 Method signatures and docstrings: - def __init__(self, nums) -> None: p 代表 [left, right) eg: 0 -> [0, length) 1 -> [0, mid) 2 -> [mid, length) 注意, 这里d的数据类型dict是更优选择, 因为对nums 进行递归的二分法分割区间, 会导致 二叉树并非是完全二叉树,会出现大量不连续的叶子结点,然而不连...
65549f72c565d9f11641c86d6cef9c7988805817
<|skeleton|> class segmentTree: """非完美二叉树版本, 即二分法分割区间""" def __init__(self, nums) -> None: """p 代表 [left, right) eg: 0 -> [0, length) 1 -> [0, mid) 2 -> [mid, length) 注意, 这里d的数据类型dict是更优选择, 因为对nums 进行递归的二分法分割区间, 会导致 二叉树并非是完全二叉树,会出现大量不连续的叶子结点,然而不连续的叶子结点仍然会占用索引空间 如果用list,这个索引必须有值 如果用dict, 则会节省很多索引空间 eg: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class segmentTree: """非完美二叉树版本, 即二分法分割区间""" def __init__(self, nums) -> None: """p 代表 [left, right) eg: 0 -> [0, length) 1 -> [0, mid) 2 -> [mid, length) 注意, 这里d的数据类型dict是更优选择, 因为对nums 进行递归的二分法分割区间, 会导致 二叉树并非是完全二叉树,会出现大量不连续的叶子结点,然而不连续的叶子结点仍然会占用索引空间 如果用list,这个索引必须有值 如果用dict, 则会节省很多索引空间 eg: 21 6 15 3 3 9...
the_stack_v2_python_sparse
utils/segmentTree.py
wisesky/LeetCode-Practice
train
0
fadd1b35a55ccd455a36cc9762dadd375d3588c9
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_step = self.get_step()\n y_step = self.get_step()\n if x_step == 0 and y_step == 0:\n continue\n x_position = self.x_values[-1] + x_step\n y_position = self.y_values[-1]...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_step = self.get_step() y_step = self.get_step() if x_step == 0 and y_step == 0: ...
A class to generate random walks.
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """A class to generate random walks.""" def __init__(self, num_points=5000): """Initialize attributes of a walk.""" <|body_0|> def fill_walk(self): """Calculate all the points in the walk.""" <|body_1|> def get_step(self): """Deci...
stack_v2_sparse_classes_36k_train_024414
1,891
no_license
[ { "docstring": "Initialize attributes of a walk.", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "Calculate all the points in the walk.", "name": "fill_walk", "signature": "def fill_walk(self)" }, { "docstring": "Decide which direction t...
3
stack_v2_sparse_classes_30k_train_014042
Implement the Python class `RandomWalk` described below. Class description: A class to generate random walks. Method signatures and docstrings: - def __init__(self, num_points=5000): Initialize attributes of a walk. - def fill_walk(self): Calculate all the points in the walk. - def get_step(self): Decide which direct...
Implement the Python class `RandomWalk` described below. Class description: A class to generate random walks. Method signatures and docstrings: - def __init__(self, num_points=5000): Initialize attributes of a walk. - def fill_walk(self): Calculate all the points in the walk. - def get_step(self): Decide which direct...
8c07b988dae03570a86cabf998169c2631b1f80c
<|skeleton|> class RandomWalk: """A class to generate random walks.""" def __init__(self, num_points=5000): """Initialize attributes of a walk.""" <|body_0|> def fill_walk(self): """Calculate all the points in the walk.""" <|body_1|> def get_step(self): """Deci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """A class to generate random walks.""" def __init__(self, num_points=5000): """Initialize attributes of a walk.""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """Calculate all the points in the walk.""...
the_stack_v2_python_sparse
chapter_15/exercises/15_10_2_plotly_rw.py
xerifeazeitona/PCC_Data_Visualization
train
0
cc15e2111cd96a422debe0d6bf491ae7cdd6723a
[ "self.tower_id = kwargs.get('tower_id')\nself.hp = kwargs.get('hp')\nself.max_hp = kwargs.get('max_hp')", "self.tower_id = kwargs['tower_id']\nself.hp = kwargs['hp']\nself.max_hp = kwargs['max_hp']", "ret = {}\nret['tower_id'] = sockutil.dump(self.tower_id)\nret['hp'] = sockutil.dump(self.hp)\nret['max_hp'] = s...
<|body_start_0|> self.tower_id = kwargs.get('tower_id') self.hp = kwargs.get('hp') self.max_hp = kwargs.get('max_hp') <|end_body_0|> <|body_start_1|> self.tower_id = kwargs['tower_id'] self.hp = kwargs['hp'] self.max_hp = kwargs['max_hp'] <|end_body_1|> <|body_start_2|>...
TowerHpSyncRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TowerHpSyncRequest: def __init__(self, **kwargs): """Params: tower_id: int hp: int max_hp: int""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """dump -> dict""" <|body_2|> <|en...
stack_v2_sparse_classes_36k_train_024415
26,590
no_license
[ { "docstring": "Params: tower_id: int hp: int max_hp: int", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "load from dict Exception: KeyError", "name": "load", "signature": "def load(self, **kwargs)" }, { "docstring": "dump -> dict", "name"...
3
stack_v2_sparse_classes_30k_train_003029
Implement the Python class `TowerHpSyncRequest` described below. Class description: Implement the TowerHpSyncRequest class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: tower_id: int hp: int max_hp: int - def load(self, **kwargs): load from dict Exception: KeyError - def dump(self): dump ...
Implement the Python class `TowerHpSyncRequest` described below. Class description: Implement the TowerHpSyncRequest class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: tower_id: int hp: int max_hp: int - def load(self, **kwargs): load from dict Exception: KeyError - def dump(self): dump ...
aa0b2697e295889e8c23a7104889ea95f2a4b6b1
<|skeleton|> class TowerHpSyncRequest: def __init__(self, **kwargs): """Params: tower_id: int hp: int max_hp: int""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """dump -> dict""" <|body_2|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TowerHpSyncRequest: def __init__(self, **kwargs): """Params: tower_id: int hp: int max_hp: int""" self.tower_id = kwargs.get('tower_id') self.hp = kwargs.get('hp') self.max_hp = kwargs.get('max_hp') def load(self, **kwargs): """load from dict Exception: KeyError"""...
the_stack_v2_python_sparse
message.py
songhui17/Server
train
0
1751b860b944036eaecf29e0979f04b566a6358a
[ "self.label = label\nself.size = self.label.size()\nself.current_zoom = 1\nself.pixmap = None", "shape = pixel_array.shape\nif pixel_array.max() <= 1:\n pixel_array *= 255\n pixel_array = np.rint(pixel_array)\ndesired_dtype = np.uint8\nif pixel_array.dtype != np.uint8:\n pixel_array = pixel_array.astype(...
<|body_start_0|> self.label = label self.size = self.label.size() self.current_zoom = 1 self.pixmap = None <|end_body_0|> <|body_start_1|> shape = pixel_array.shape if pixel_array.max() <= 1: pixel_array *= 255 pixel_array = np.rint(pixel_array) ...
views and rescales images
ImageViewer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageViewer: """views and rescales images""" def __init__(self, label): """Parameters ---------- label : QLabel, the container for drawing the images into""" <|body_0|> def draw_pixels(self, pixel_array): """draw image from given pixels (colored or greyscale) Par...
stack_v2_sparse_classes_36k_train_024416
2,780
no_license
[ { "docstring": "Parameters ---------- label : QLabel, the container for drawing the images into", "name": "__init__", "signature": "def __init__(self, label)" }, { "docstring": "draw image from given pixels (colored or greyscale) Parameters ---------- pixel_array : numpy array, array of pixels, ...
3
stack_v2_sparse_classes_30k_train_001761
Implement the Python class `ImageViewer` described below. Class description: views and rescales images Method signatures and docstrings: - def __init__(self, label): Parameters ---------- label : QLabel, the container for drawing the images into - def draw_pixels(self, pixel_array): draw image from given pixels (colo...
Implement the Python class `ImageViewer` described below. Class description: views and rescales images Method signatures and docstrings: - def __init__(self, label): Parameters ---------- label : QLabel, the container for drawing the images into - def draw_pixels(self, pixel_array): draw image from given pixels (colo...
638304e5211d53e029e66217848a6580157843ab
<|skeleton|> class ImageViewer: """views and rescales images""" def __init__(self, label): """Parameters ---------- label : QLabel, the container for drawing the images into""" <|body_0|> def draw_pixels(self, pixel_array): """draw image from given pixels (colored or greyscale) Par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageViewer: """views and rescales images""" def __init__(self, label): """Parameters ---------- label : QLabel, the container for drawing the images into""" self.label = label self.size = self.label.size() self.current_zoom = 1 self.pixmap = None def draw_pix...
the_stack_v2_python_sparse
Python/src/masterarbeit/UI/imageview.py
ChrFr/Masterarbeit
train
0
49354c5e7ff56cc3fa9d9932a448eb82a55ec140
[ "if k % 10 not in [1, 3, 7, 9]:\n return -1\nremainder = 0\nfor length_N in range(1, k + 1):\n remainder = (remainder * 10 + 1) % k\n if remainder == 0:\n return length_N", "if k % 10 not in [1, 3, 7, 9]:\n return -1\nret = 0\ntmp = 0\nwhile True:\n tmp = tmp * 10 + 1\n if tmp % k == 0:\n...
<|body_start_0|> if k % 10 not in [1, 3, 7, 9]: return -1 remainder = 0 for length_N in range(1, k + 1): remainder = (remainder * 10 + 1) % k if remainder == 0: return length_N <|end_body_0|> <|body_start_1|> if k % 10 not in [1, 3, 7,...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def smallestRepunitDivByK(self, k: int) -> int: """Note: the last num to be 1 means the last num of k must be one of 1, 3, 7, 9 Runtime: 84 ms, faster than 27.03% Memory Usage: 14.3 MB, less than 65.77% 1 <= k <= 10^5 :param k: :return:""" <|body_0|> def smallestRe...
stack_v2_sparse_classes_36k_train_024417
1,937
permissive
[ { "docstring": "Note: the last num to be 1 means the last num of k must be one of 1, 3, 7, 9 Runtime: 84 ms, faster than 27.03% Memory Usage: 14.3 MB, less than 65.77% 1 <= k <= 10^5 :param k: :return:", "name": "smallestRepunitDivByK", "signature": "def smallestRepunitDivByK(self, k: int) -> int" }, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestRepunitDivByK(self, k: int) -> int: Note: the last num to be 1 means the last num of k must be one of 1, 3, 7, 9 Runtime: 84 ms, faster than 27.03% Memory Usage: 14.3...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def smallestRepunitDivByK(self, k: int) -> int: Note: the last num to be 1 means the last num of k must be one of 1, 3, 7, 9 Runtime: 84 ms, faster than 27.03% Memory Usage: 14.3...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def smallestRepunitDivByK(self, k: int) -> int: """Note: the last num to be 1 means the last num of k must be one of 1, 3, 7, 9 Runtime: 84 ms, faster than 27.03% Memory Usage: 14.3 MB, less than 65.77% 1 <= k <= 10^5 :param k: :return:""" <|body_0|> def smallestRe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def smallestRepunitDivByK(self, k: int) -> int: """Note: the last num to be 1 means the last num of k must be one of 1, 3, 7, 9 Runtime: 84 ms, faster than 27.03% Memory Usage: 14.3 MB, less than 65.77% 1 <= k <= 10^5 :param k: :return:""" if k % 10 not in [1, 3, 7, 9]: r...
the_stack_v2_python_sparse
src/1015-SmallestIntegerDivisibleByK.py
Jiezhi/myleetcode
train
1
f187006e01fc57789e714d7778b7868779b7bbe4
[ "try:\n updated_count = self.update_order_count()\nexcept Exception:\n return HttpResponseBadRequest()\nelse:\n return JsonResponse({'count': updated_count})", "product_id = self.request.POST['product_id']\ncount = int(self.request.POST['updated_order_count'])\nproduct = get_object_or_404(BaseProduct, id...
<|body_start_0|> try: updated_count = self.update_order_count() except Exception: return HttpResponseBadRequest() else: return JsonResponse({'count': updated_count}) <|end_body_0|> <|body_start_1|> product_id = self.request.POST['product_id'] ...
View for setting re-order counts.
UpdateOrderCount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateOrderCount: """View for setting re-order counts.""" def post(self, *args, **kwargs): """Update re-order counts.""" <|body_0|> def update_order_count(self): """Update re-order count.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_024418
6,889
no_license
[ { "docstring": "Update re-order counts.", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "Update re-order count.", "name": "update_order_count", "signature": "def update_order_count(self)" } ]
2
stack_v2_sparse_classes_30k_train_008501
Implement the Python class `UpdateOrderCount` described below. Class description: View for setting re-order counts. Method signatures and docstrings: - def post(self, *args, **kwargs): Update re-order counts. - def update_order_count(self): Update re-order count.
Implement the Python class `UpdateOrderCount` described below. Class description: View for setting re-order counts. Method signatures and docstrings: - def post(self, *args, **kwargs): Update re-order counts. - def update_order_count(self): Update re-order count. <|skeleton|> class UpdateOrderCount: """View for ...
ba51d4e304b1aeb296fa2fe16611c892fcdbd471
<|skeleton|> class UpdateOrderCount: """View for setting re-order counts.""" def post(self, *args, **kwargs): """Update re-order counts.""" <|body_0|> def update_order_count(self): """Update re-order count.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateOrderCount: """View for setting re-order counts.""" def post(self, *args, **kwargs): """Update re-order counts.""" try: updated_count = self.update_order_count() except Exception: return HttpResponseBadRequest() else: return JsonRe...
the_stack_v2_python_sparse
restock/views.py
stcstores/stcadmin
train
0
1f101d000607535901dd27ba5eb89224ce07dde0
[ "@lru_cache(None)\ndef dfs(i, b, l):\n print(i)\n if i == len(heights) - 1:\n return i\n diff = heights[i + 1] - heights[i]\n if diff <= 0:\n return dfs(i + 1, b, l)\n ret = [i]\n if l:\n ret.append(dfs(i + 1, b, l - 1))\n if b >= diff:\n ret.append(dfs(i + 1, b - di...
<|body_start_0|> @lru_cache(None) def dfs(i, b, l): print(i) if i == len(heights) - 1: return i diff = heights[i + 1] - heights[i] if diff <= 0: return dfs(i + 1, b, l) ret = [i] if l: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: """05/13/2021 09:46 TLE. DFS Time complexity: O(n*b*l) Space complexity: O(n*b*l)""" <|body_0|> def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: ...
stack_v2_sparse_classes_36k_train_024419
10,443
no_license
[ { "docstring": "05/13/2021 09:46 TLE. DFS Time complexity: O(n*b*l) Space complexity: O(n*b*l)", "name": "furthestBuilding", "signature": "def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int" }, { "docstring": "05/13/2021 10:01 Use a ladder first. If we found larger ...
3
stack_v2_sparse_classes_30k_val_000253
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: 05/13/2021 09:46 TLE. DFS Time complexity: O(n*b*l) Space complexity: O(n*b*l) - def furthestBui...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: 05/13/2021 09:46 TLE. DFS Time complexity: O(n*b*l) Space complexity: O(n*b*l) - def furthestBui...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: """05/13/2021 09:46 TLE. DFS Time complexity: O(n*b*l) Space complexity: O(n*b*l)""" <|body_0|> def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def furthestBuilding(self, heights: List[int], bricks: int, ladders: int) -> int: """05/13/2021 09:46 TLE. DFS Time complexity: O(n*b*l) Space complexity: O(n*b*l)""" @lru_cache(None) def dfs(i, b, l): print(i) if i == len(heights) - 1: ...
the_stack_v2_python_sparse
leetcode/solved/1762_Furthest_Building_You_Can_Reach/solution.py
sungminoh/algorithms
train
0
4d81df1ab07122491ca151f300cdcbe28d6f5d6f
[ "batch_size, n, _ = xyz1.size()\n_, m, _ = xyz2.size()\ndevice = xyz1.device\nxyz1 = xyz1.contiguous()\nxyz2 = xyz2.contiguous()\ndist1 = torch.zeros(batch_size, n).to(device)\ndist2 = torch.zeros(batch_size, m).to(device)\nidx1 = torch.zeros(batch_size, n).type(torch.IntTensor).to(device)\nidx2 = torch.zeros(batch...
<|body_start_0|> batch_size, n, _ = xyz1.size() _, m, _ = xyz2.size() device = xyz1.device xyz1 = xyz1.contiguous() xyz2 = xyz2.contiguous() dist1 = torch.zeros(batch_size, n).to(device) dist2 = torch.zeros(batch_size, m).to(device) idx1 = torch.zeros(batc...
This is an implementation of the 2D Chamfer Distance. It has been used in the paper `Oriented RepPoints for Aerial Object Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`.
ChamferDistanceFunction
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChamferDistanceFunction: """This is an implementation of the 2D Chamfer Distance. It has been used in the paper `Oriented RepPoints for Aerial Object Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`.""" def forward(ctx, xyz1: Tensor, xyz2: Tensor) -> Sequence[Tensor]: """Ar...
stack_v2_sparse_classes_36k_train_024420
3,374
permissive
[ { "docstring": "Args: xyz1 (Tensor): Point set with shape (B, N, 2). xyz2 (Tensor): Point set with shape (B, N, 2). Returns: Sequence[Tensor]: - dist1 (Tensor): Chamfer distance (xyz1 to xyz2) with shape (B, N). - dist2 (Tensor): Chamfer distance (xyz2 to xyz1) with shape (B, N). - idx1 (Tensor): Index of chamf...
2
null
Implement the Python class `ChamferDistanceFunction` described below. Class description: This is an implementation of the 2D Chamfer Distance. It has been used in the paper `Oriented RepPoints for Aerial Object Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`. Method signatures and docstrings: - def forward...
Implement the Python class `ChamferDistanceFunction` described below. Class description: This is an implementation of the 2D Chamfer Distance. It has been used in the paper `Oriented RepPoints for Aerial Object Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`. Method signatures and docstrings: - def forward...
6e9ee26718b22961d5c34caca4108413b1b7b3af
<|skeleton|> class ChamferDistanceFunction: """This is an implementation of the 2D Chamfer Distance. It has been used in the paper `Oriented RepPoints for Aerial Object Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`.""" def forward(ctx, xyz1: Tensor, xyz2: Tensor) -> Sequence[Tensor]: """Ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChamferDistanceFunction: """This is an implementation of the 2D Chamfer Distance. It has been used in the paper `Oriented RepPoints for Aerial Object Detection (CVPR 2022) <https://arxiv.org/abs/2105.11111>_`.""" def forward(ctx, xyz1: Tensor, xyz2: Tensor) -> Sequence[Tensor]: """Args: xyz1 (Ten...
the_stack_v2_python_sparse
mmcv/ops/chamfer_distance.py
open-mmlab/mmcv
train
5,319
4406a3e8d5e4a86d8e52abdac2b187e7773c5f98
[ "gtk.Button.__init__(self)\nself.test_ticker = 0\nself.progress_buffer = PowerProgressBuffer()\nself.connect('expose-event', self.expose_progressbar)", "cr = widget.window.cairo_create()\nrect = widget.allocation\nself.progress_buffer.render(cr, rect)\npropagate_expose(widget, event)\nreturn True" ]
<|body_start_0|> gtk.Button.__init__(self) self.test_ticker = 0 self.progress_buffer = PowerProgressBuffer() self.connect('expose-event', self.expose_progressbar) <|end_body_0|> <|body_start_1|> cr = widget.window.cairo_create() rect = widget.allocation self.prog...
Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker
PowerProgressBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerProgressBar: """Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker""" def __init__(self): """Initialize progress bar.""" <|body_0|> def expose_progressbar(self, widget, event): """Internal callback for `expose` signal.""" ...
stack_v2_sparse_classes_36k_train_024421
4,596
no_license
[ { "docstring": "Initialize progress bar.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Internal callback for `expose` signal.", "name": "expose_progressbar", "signature": "def expose_progressbar(self, widget, event)" } ]
2
stack_v2_sparse_classes_30k_train_017195
Implement the Python class `PowerProgressBar` described below. Class description: Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker Method signatures and docstrings: - def __init__(self): Initialize progress bar. - def expose_progressbar(self, widget, event): Internal callback for `ex...
Implement the Python class `PowerProgressBar` described below. Class description: Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker Method signatures and docstrings: - def __init__(self): Initialize progress bar. - def expose_progressbar(self, widget, event): Internal callback for `ex...
1b83a035a4dfd57a2ba87c453f6b394d506c98f1
<|skeleton|> class PowerProgressBar: """Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker""" def __init__(self): """Initialize progress bar.""" <|body_0|> def expose_progressbar(self, widget, event): """Internal callback for `expose` signal.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PowerProgressBar: """Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker""" def __init__(self): """Initialize progress bar.""" gtk.Button.__init__(self) self.test_ticker = 0 self.progress_buffer = PowerProgressBuffer() self.connect('e...
the_stack_v2_python_sparse
modules/power/src/power_progressbar.py
electricface/deepin-system-settings
train
0
689d76af86e49a2de96b33e7c197fbdb37dfaac5
[ "cur, pre = (head, None)\nwhile cur:\n tmp = cur.next\n cur.next = pre\n pre = cur\n cur = tmp\nreturn pre", "def recur(cur, pre):\n if not cur:\n return pre\n res = recur(cur.next, cur)\n cur.next = pre\n return res\nreturn recur(head, None)" ]
<|body_start_0|> cur, pre = (head, None) while cur: tmp = cur.next cur.next = pre pre = cur cur = tmp return pre <|end_body_0|> <|body_start_1|> def recur(cur, pre): if not cur: return pre res = recu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(head: ListNode) -> ListNode: """Iteration T(n) = O(n) S(n) = O(n) :param head: :return:""" <|body_0|> def reverseList2(head: ListNode) -> ListNode: """Recursion T(n) = O(n) S(n) = O(n) :param head: :return:""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_024422
1,382
no_license
[ { "docstring": "Iteration T(n) = O(n) S(n) = O(n) :param head: :return:", "name": "reverseList", "signature": "def reverseList(head: ListNode) -> ListNode" }, { "docstring": "Recursion T(n) = O(n) S(n) = O(n) :param head: :return:", "name": "reverseList2", "signature": "def reverseList2(...
2
stack_v2_sparse_classes_30k_train_013753
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(head: ListNode) -> ListNode: Iteration T(n) = O(n) S(n) = O(n) :param head: :return: - def reverseList2(head: ListNode) -> ListNode: Recursion T(n) = O(n) S(n) = ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(head: ListNode) -> ListNode: Iteration T(n) = O(n) S(n) = O(n) :param head: :return: - def reverseList2(head: ListNode) -> ListNode: Recursion T(n) = O(n) S(n) = ...
b1680014ce3f55ba952a1e64241c0cbb783cc436
<|skeleton|> class Solution: def reverseList(head: ListNode) -> ListNode: """Iteration T(n) = O(n) S(n) = O(n) :param head: :return:""" <|body_0|> def reverseList2(head: ListNode) -> ListNode: """Recursion T(n) = O(n) S(n) = O(n) :param head: :return:""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(head: ListNode) -> ListNode: """Iteration T(n) = O(n) S(n) = O(n) :param head: :return:""" cur, pre = (head, None) while cur: tmp = cur.next cur.next = pre pre = cur cur = tmp return pre def reverseL...
the_stack_v2_python_sparse
24.py
sun510001/leetcode_jianzhi_offer_2
train
0
9185c159e4bf7d09fe85272ae235f7210e097ca8
[ "try:\n avatar_size = int(request.GET.get('avatar_size', AVATAR_DEFAULT_SIZE))\nexcept ValueError:\n avatar_size = AVATAR_DEFAULT_SIZE\ntry:\n if not is_group_member(group_id, request.user.username):\n error_msg = 'Permission denied.'\n return api_error(status.HTTP_403_FORBIDDEN, error_msg)\n...
<|body_start_0|> try: avatar_size = int(request.GET.get('avatar_size', AVATAR_DEFAULT_SIZE)) except ValueError: avatar_size = AVATAR_DEFAULT_SIZE try: if not is_group_member(group_id, request.user.username): error_msg = 'Permission denied.' ...
GroupMembers
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupMembers: def get(self, request, group_id, format=None): """Get all group members.""" <|body_0|> def post(self, request, group_id): """Add a group member.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: avatar_size = int(request...
stack_v2_sparse_classes_36k_train_024423
12,521
permissive
[ { "docstring": "Get all group members.", "name": "get", "signature": "def get(self, request, group_id, format=None)" }, { "docstring": "Add a group member.", "name": "post", "signature": "def post(self, request, group_id)" } ]
2
stack_v2_sparse_classes_30k_train_014792
Implement the Python class `GroupMembers` described below. Class description: Implement the GroupMembers class. Method signatures and docstrings: - def get(self, request, group_id, format=None): Get all group members. - def post(self, request, group_id): Add a group member.
Implement the Python class `GroupMembers` described below. Class description: Implement the GroupMembers class. Method signatures and docstrings: - def get(self, request, group_id, format=None): Get all group members. - def post(self, request, group_id): Add a group member. <|skeleton|> class GroupMembers: def ...
13b3ed26a04248211ef91ca70dccc617be27a3c3
<|skeleton|> class GroupMembers: def get(self, request, group_id, format=None): """Get all group members.""" <|body_0|> def post(self, request, group_id): """Add a group member.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupMembers: def get(self, request, group_id, format=None): """Get all group members.""" try: avatar_size = int(request.GET.get('avatar_size', AVATAR_DEFAULT_SIZE)) except ValueError: avatar_size = AVATAR_DEFAULT_SIZE try: if not is_group_me...
the_stack_v2_python_sparse
fhs/usr/share/python/syncwerk/restapi/restapi/api2/endpoints/group_members.py
syncwerk/syncwerk-server-restapi
train
0
a79e5de7854b46710b57fcd83a8dabe7b0b69fe7
[ "self.user = user\nself.auth = passwordMD5\nself.enc = passwordDES\nself.host = host\nself.port = port", "if number:\n oid += '.' + str(number)\ntry:\n errorIndication, errorStatus, errorIndex, varBinds = next(getCmd(SnmpEngine(), UsmUserData(self.user, self.auth, self.enc), UdpTransportTarget((self.host, s...
<|body_start_0|> self.user = user self.auth = passwordMD5 self.enc = passwordDES self.host = host self.port = port <|end_body_0|> <|body_start_1|> if number: oid += '.' + str(number) try: errorIndication, errorStatus, errorIndex, varBinds ...
SnmpWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnmpWrapper: def __init__(self, host, user, passwordMD5, passwordDES, port=161): """Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used...
stack_v2_sparse_classes_36k_train_024424
7,826
permissive
[ { "docstring": "Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used for the snmp connection :type port: int :param user: User used for the snmp connection :typ...
3
stack_v2_sparse_classes_30k_test_000443
Implement the Python class `SnmpWrapper` described below. Class description: Implement the SnmpWrapper class. Method signatures and docstrings: - def __init__(self, host, user, passwordMD5, passwordDES, port=161): Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification a...
Implement the Python class `SnmpWrapper` described below. Class description: Implement the SnmpWrapper class. Method signatures and docstrings: - def __init__(self, host, user, passwordMD5, passwordDES, port=161): Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification a...
e4c552023334f709b9586f664b7e049036133d33
<|skeleton|> class SnmpWrapper: def __init__(self, host, user, passwordMD5, passwordDES, port=161): """Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnmpWrapper: def __init__(self, host, user, passwordMD5, passwordDES, port=161): """Create a new snmp connection wrapper for a host. This wrapper uses SNMPv3 with MD for authentification and DES for encryption. :param host: Host or IP to connect to :param host: str :param port: Port used for the snmp ...
the_stack_v2_python_sparse
src/insalata/helper/SnmpWrapper.py
tumi8/INSALATA
train
6
7fa8bcabe3058659ff60d174aabde619ddcdf990
[ "d = Hexagon([2, 1, 3, 2, 1, 3])\nself.assertEqual(d.bottom, 3)\nself.assertEqual(d.ll, 1)\nself.assertEqual(d.hl, 2)\nself.assertEqual(d.lr, 2)\nself.assertEqual(d.low, 7)\nself.assertEqual(d.hi, 15)", "test = '1 1 1 1 1 1'\nself.assertEqual(calculate(test), '6')\nself.assertEqual(list(get_inputs(test)), [1, 1, ...
<|body_start_0|> d = Hexagon([2, 1, 3, 2, 1, 3]) self.assertEqual(d.bottom, 3) self.assertEqual(d.ll, 1) self.assertEqual(d.hl, 2) self.assertEqual(d.lr, 2) self.assertEqual(d.low, 7) self.assertEqual(d.hi, 15) <|end_body_0|> <|body_start_1|> test = '1 1 ...
unitTests
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class unitTests: def test_Hexagon_class__basic_functions(self): """Hexagon class basic functions testing""" <|body_0|> def test_sample_tests(self): """Quiz sample tests. Add to separate lines""" <|body_1|> def test_time_limit_test(self): """Quiz time l...
stack_v2_sparse_classes_36k_train_024425
4,648
permissive
[ { "docstring": "Hexagon class basic functions testing", "name": "test_Hexagon_class__basic_functions", "signature": "def test_Hexagon_class__basic_functions(self)" }, { "docstring": "Quiz sample tests. Add to separate lines", "name": "test_sample_tests", "signature": "def test_sample_tes...
3
stack_v2_sparse_classes_30k_train_009775
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_Hexagon_class__basic_functions(self): Hexagon class basic functions testing - def test_sample_tests(self): Quiz sample tests. Add to separate lines - def test_time_lim...
Implement the Python class `unitTests` described below. Class description: Implement the unitTests class. Method signatures and docstrings: - def test_Hexagon_class__basic_functions(self): Hexagon class basic functions testing - def test_sample_tests(self): Quiz sample tests. Add to separate lines - def test_time_lim...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class unitTests: def test_Hexagon_class__basic_functions(self): """Hexagon class basic functions testing""" <|body_0|> def test_sample_tests(self): """Quiz sample tests. Add to separate lines""" <|body_1|> def test_time_limit_test(self): """Quiz time l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class unitTests: def test_Hexagon_class__basic_functions(self): """Hexagon class basic functions testing""" d = Hexagon([2, 1, 3, 2, 1, 3]) self.assertEqual(d.bottom, 3) self.assertEqual(d.ll, 1) self.assertEqual(d.hl, 2) self.assertEqual(d.lr, 2) self.assertE...
the_stack_v2_python_sparse
codeforces/560C_hexagon.py
snsokolov/contests
train
1
5c6d1ecab9c2806da2262d58ed9ffa15499e9708
[ "super().__init__()\nself.args = quant_arc_interface.args\nself.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * quant_arc_interface.second_qubits))\nself.qai = quant_arc_interface", "q_in = torch.tanh(input_features) * np.pi / 2.0\nq_in = q_in.to(self.args.device)\nq_out = torch.Tensor...
<|body_start_0|> super().__init__() self.args = quant_arc_interface.args self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * quant_arc_interface.second_qubits)) self.qai = quant_arc_interface <|end_body_0|> <|body_start_1|> q_in = torch.tanh(input_fe...
Torch module implementing the *dressed* quantum net.
QNet_2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QNet_2: """Torch module implementing the *dressed* quantum net.""" def __init__(self, quant_arc_interface): """Definition of the *dressed* layout.""" <|body_0|> def forward(self, input_features): """Defining how tensors are supposed to move through the *dressed* ...
stack_v2_sparse_classes_36k_train_024426
2,951
permissive
[ { "docstring": "Definition of the *dressed* layout.", "name": "__init__", "signature": "def __init__(self, quant_arc_interface)" }, { "docstring": "Defining how tensors are supposed to move through the *dressed* quantum net.", "name": "forward", "signature": "def forward(self, input_feat...
2
stack_v2_sparse_classes_30k_train_002677
Implement the Python class `QNet_2` described below. Class description: Torch module implementing the *dressed* quantum net. Method signatures and docstrings: - def __init__(self, quant_arc_interface): Definition of the *dressed* layout. - def forward(self, input_features): Defining how tensors are supposed to move t...
Implement the Python class `QNet_2` described below. Class description: Torch module implementing the *dressed* quantum net. Method signatures and docstrings: - def __init__(self, quant_arc_interface): Definition of the *dressed* layout. - def forward(self, input_features): Defining how tensors are supposed to move t...
8126691b43bddc2b1a96f73ab35d04d1af200d7a
<|skeleton|> class QNet_2: """Torch module implementing the *dressed* quantum net.""" def __init__(self, quant_arc_interface): """Definition of the *dressed* layout.""" <|body_0|> def forward(self, input_features): """Defining how tensors are supposed to move through the *dressed* ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QNet_2: """Torch module implementing the *dressed* quantum net.""" def __init__(self, quant_arc_interface): """Definition of the *dressed* layout.""" super().__init__() self.args = quant_arc_interface.args self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.a...
the_stack_v2_python_sparse
model/dvqc_layers.py
zzh237/quanthmc
train
0
aba344f93ba667a4e11784ef20e97c77e1944cac
[ "super().__init__(always_apply, p)\nself.denormalize = denormalize\nself.move_channels_dim = move_channels_dim", "if len(img.shape) == 2:\n img = img.unsqueeze(0)\nreturn utils.tensor_to_ndimage(img, denormalize=self.denormalize, move_channels_dim=self.move_channels_dim)" ]
<|body_start_0|> super().__init__(always_apply, p) self.denormalize = denormalize self.move_channels_dim = move_channels_dim <|end_body_0|> <|body_start_1|> if len(img.shape) == 2: img = img.unsqueeze(0) return utils.tensor_to_ndimage(img, denormalize=self.denormaliz...
Casts torch.tensor to numpy array
TensorToImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorToImage: """Casts torch.tensor to numpy array""" def __init__(self, denormalize: bool=False, move_channels_dim: bool=True, always_apply: bool=False, p: float=1.0): """Args: denormalize (bool): if True, multiply image(s) by ImageNet std and add ImageNet mean move_channels_dim (b...
stack_v2_sparse_classes_36k_train_024427
2,537
permissive
[ { "docstring": "Args: denormalize (bool): if True, multiply image(s) by ImageNet std and add ImageNet mean move_channels_dim (bool): if True, convert [B]xCxHxW tensor to [B]xHxWxC format always_apply (bool): need to apply this transform anyway p (float): probability for this transform", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_013273
Implement the Python class `TensorToImage` described below. Class description: Casts torch.tensor to numpy array Method signatures and docstrings: - def __init__(self, denormalize: bool=False, move_channels_dim: bool=True, always_apply: bool=False, p: float=1.0): Args: denormalize (bool): if True, multiply image(s) b...
Implement the Python class `TensorToImage` described below. Class description: Casts torch.tensor to numpy array Method signatures and docstrings: - def __init__(self, denormalize: bool=False, move_channels_dim: bool=True, always_apply: bool=False, p: float=1.0): Args: denormalize (bool): if True, multiply image(s) b...
75ffa808e2bbb9071a169a1a9c813deb6a69a797
<|skeleton|> class TensorToImage: """Casts torch.tensor to numpy array""" def __init__(self, denormalize: bool=False, move_channels_dim: bool=True, always_apply: bool=False, p: float=1.0): """Args: denormalize (bool): if True, multiply image(s) by ImageNet std and add ImageNet mean move_channels_dim (b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TensorToImage: """Casts torch.tensor to numpy array""" def __init__(self, denormalize: bool=False, move_channels_dim: bool=True, always_apply: bool=False, p: float=1.0): """Args: denormalize (bool): if True, multiply image(s) by ImageNet std and add ImageNet mean move_channels_dim (bool): if True...
the_stack_v2_python_sparse
catalyst_rl/contrib/data/cv/transforms/tensor.py
catalyst-team/catalyst-rl
train
50
159478130f9b55b6e36a9462c5e19f47b6b86290
[ "self.startingCity = startingCity\nself.disease = disease\nself.citiesHitByOutbreak = citiesHitByOutbreak\nself.citiesHitByOutbreak.add(startingCity)", "for city in self.startingCity.adjacentCities:\n if city not in self.citiesHitByOutbreak:\n city.infect(1, disease=self.disease)\n self.citiesHit...
<|body_start_0|> self.startingCity = startingCity self.disease = disease self.citiesHitByOutbreak = citiesHitByOutbreak self.citiesHitByOutbreak.add(startingCity) <|end_body_0|> <|body_start_1|> for city in self.startingCity.adjacentCities: if city not in self.cities...
Represents a disease outbreak in a given city
Outbreak
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Outbreak: """Represents a disease outbreak in a given city""" def __init__(self, startingCity, disease, citiesHitByOutbreak): """Initialize the Breakout""" <|body_0|> def breakout(self): """Have the breakout occur in the Starting City""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_024428
686
no_license
[ { "docstring": "Initialize the Breakout", "name": "__init__", "signature": "def __init__(self, startingCity, disease, citiesHitByOutbreak)" }, { "docstring": "Have the breakout occur in the Starting City", "name": "breakout", "signature": "def breakout(self)" } ]
2
stack_v2_sparse_classes_30k_train_008975
Implement the Python class `Outbreak` described below. Class description: Represents a disease outbreak in a given city Method signatures and docstrings: - def __init__(self, startingCity, disease, citiesHitByOutbreak): Initialize the Breakout - def breakout(self): Have the breakout occur in the Starting City
Implement the Python class `Outbreak` described below. Class description: Represents a disease outbreak in a given city Method signatures and docstrings: - def __init__(self, startingCity, disease, citiesHitByOutbreak): Initialize the Breakout - def breakout(self): Have the breakout occur in the Starting City <|skel...
d59bdf5bc2a17ca4575d7c07dd81746590d7b308
<|skeleton|> class Outbreak: """Represents a disease outbreak in a given city""" def __init__(self, startingCity, disease, citiesHitByOutbreak): """Initialize the Breakout""" <|body_0|> def breakout(self): """Have the breakout occur in the Starting City""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Outbreak: """Represents a disease outbreak in a given city""" def __init__(self, startingCity, disease, citiesHitByOutbreak): """Initialize the Breakout""" self.startingCity = startingCity self.disease = disease self.citiesHitByOutbreak = citiesHitByOutbreak self.c...
the_stack_v2_python_sparse
src/Level/Disease/Outbreak/outbreak.py
ldunekac/Pandemic
train
0
897d047195d2587387f17e3c0c48f754dfe50b88
[ "try:\n return self.values_list('id', 'data_last_updated')\nexcept self.model.DoesNotExist:\n logger.info('Courses did not exist', exc_info=True)\nreturn Course.objects.none()", "sorted_courses = sorted(self.all(), key=lambda course: course.determine_date_start())\nearliest_start = None\nif len(sorted_cours...
<|body_start_0|> try: return self.values_list('id', 'data_last_updated') except self.model.DoesNotExist: logger.info('Courses did not exist', exc_info=True) return Course.objects.none() <|end_body_0|> <|body_start_1|> sorted_courses = sorted(self.all(), key=lambd...
CourseQuerySet
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseQuerySet: def get_supported_courses(self) -> QuerySet: """Returns the list of supported courses from the database :return: [List of supported course ids and data_last_updated] :rtype: [CourseQuerySet containing a list of tuples, int and datetime]""" <|body_0|> def earl...
stack_v2_sparse_classes_36k_train_024429
18,891
permissive
[ { "docstring": "Returns the list of supported courses from the database :return: [List of supported course ids and data_last_updated] :rtype: [CourseQuerySet containing a list of tuples, int and datetime]", "name": "get_supported_courses", "signature": "def get_supported_courses(self) -> QuerySet" }, ...
3
stack_v2_sparse_classes_30k_train_002269
Implement the Python class `CourseQuerySet` described below. Class description: Implement the CourseQuerySet class. Method signatures and docstrings: - def get_supported_courses(self) -> QuerySet: Returns the list of supported courses from the database :return: [List of supported course ids and data_last_updated] :rt...
Implement the Python class `CourseQuerySet` described below. Class description: Implement the CourseQuerySet class. Method signatures and docstrings: - def get_supported_courses(self) -> QuerySet: Returns the list of supported courses from the database :return: [List of supported course ids and data_last_updated] :rt...
acadb1c8073a16835ca7fc19bcedaf1eba1dff44
<|skeleton|> class CourseQuerySet: def get_supported_courses(self) -> QuerySet: """Returns the list of supported courses from the database :return: [List of supported course ids and data_last_updated] :rtype: [CourseQuerySet containing a list of tuples, int and datetime]""" <|body_0|> def earl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseQuerySet: def get_supported_courses(self) -> QuerySet: """Returns the list of supported courses from the database :return: [List of supported course ids and data_last_updated] :rtype: [CourseQuerySet containing a list of tuples, int and datetime]""" try: return self.values_li...
the_stack_v2_python_sparse
dashboard/models.py
tl-its-umich-edu/my-learning-analytics
train
36
622f12835203db30c5f6571e786a545dca94fb7f
[ "if driver is None:\n caps = {}\n caps['platformName'] = 'Android'\n caps['deviceName'] = 'hogwarts'\n caps['appPackage'] = 'com.xueqiu.android'\n caps['appActivity'] = '.common.MainActivity'\n caps['noReset'] = 'True'\n caps['skipDeviceInitialization'] = 'true'\n caps['skipServerInstallatio...
<|body_start_0|> if driver is None: caps = {} caps['platformName'] = 'Android' caps['deviceName'] = 'hogwarts' caps['appPackage'] = 'com.xueqiu.android' caps['appActivity'] = '.common.MainActivity' caps['noReset'] = 'True' caps[...
BasePage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasePage: def __init__(self, driver=None): """初始化应用""" <|body_0|> def find(self, by, locator=None): """查找元素""" <|body_1|> def parse_yaml(self, path, func_name): """步骤驱动 :path yaml文件 :func_name 功能模块名称""" <|body_2|> def parse(self, ste...
stack_v2_sparse_classes_36k_train_024430
3,659
no_license
[ { "docstring": "初始化应用", "name": "__init__", "signature": "def __init__(self, driver=None)" }, { "docstring": "查找元素", "name": "find", "signature": "def find(self, by, locator=None)" }, { "docstring": "步骤驱动 :path yaml文件 :func_name 功能模块名称", "name": "parse_yaml", "signature":...
4
stack_v2_sparse_classes_30k_train_004644
Implement the Python class `BasePage` described below. Class description: Implement the BasePage class. Method signatures and docstrings: - def __init__(self, driver=None): 初始化应用 - def find(self, by, locator=None): 查找元素 - def parse_yaml(self, path, func_name): 步骤驱动 :path yaml文件 :func_name 功能模块名称 - def parse(self, ste...
Implement the Python class `BasePage` described below. Class description: Implement the BasePage class. Method signatures and docstrings: - def __init__(self, driver=None): 初始化应用 - def find(self, by, locator=None): 查找元素 - def parse_yaml(self, path, func_name): 步骤驱动 :path yaml文件 :func_name 功能模块名称 - def parse(self, ste...
eb3d3aabb8706a0ba649061e5f1aebfb307c5b1d
<|skeleton|> class BasePage: def __init__(self, driver=None): """初始化应用""" <|body_0|> def find(self, by, locator=None): """查找元素""" <|body_1|> def parse_yaml(self, path, func_name): """步骤驱动 :path yaml文件 :func_name 功能模块名称""" <|body_2|> def parse(self, ste...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasePage: def __init__(self, driver=None): """初始化应用""" if driver is None: caps = {} caps['platformName'] = 'Android' caps['deviceName'] = 'hogwarts' caps['appPackage'] = 'com.xueqiu.android' caps['appActivity'] = '.common.MainActivity...
the_stack_v2_python_sparse
frame_project/实战2/base_page.py
sunyanfen1995/HGWZ_syf
train
0
34dbe35d42b501daf8b23c54c9cf2a63851c9ea8
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DeviceManagementPartner()", "from .device_management_partner_app_type import DeviceManagementPartnerAppType\nfrom .device_management_partner_assignment import DeviceManagementPartnerAssignment\nfrom .device_management_partner_tenant_st...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DeviceManagementPartner() <|end_body_0|> <|body_start_1|> from .device_management_partner_app_type import DeviceManagementPartnerAppType from .device_management_partner_assignment import...
Entity which represents a connection to device management partner.
DeviceManagementPartner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceManagementPartner: """Entity which represents a connection to device management partner.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementPartner: """Creates a new instance of the appropriate class based on discriminator value Args...
stack_v2_sparse_classes_36k_train_024431
5,829
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: DeviceManagementPartner", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
null
Implement the Python class `DeviceManagementPartner` described below. Class description: Entity which represents a connection to device management partner. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementPartner: Creates a new instance o...
Implement the Python class `DeviceManagementPartner` described below. Class description: Entity which represents a connection to device management partner. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementPartner: Creates a new instance o...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DeviceManagementPartner: """Entity which represents a connection to device management partner.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementPartner: """Creates a new instance of the appropriate class based on discriminator value Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceManagementPartner: """Entity which represents a connection to device management partner.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementPartner: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
the_stack_v2_python_sparse
msgraph/generated/models/device_management_partner.py
microsoftgraph/msgraph-sdk-python
train
135
09c7424c8ec69a5c553edb61479dbfc114804e6f
[ "dp = [0] * (1 + target)\ndp[0] = 1\nfor t in range(1, 1 + target):\n for num in nums:\n if t >= num:\n dp[t] += dp[t - num]\nreturn dp[t]", "def count(target, memo):\n if target == 0:\n return 1\n elif target < 0:\n return 0\n else:\n if target in memo:\n ...
<|body_start_0|> dp = [0] * (1 + target) dp[0] = 1 for t in range(1, 1 + target): for num in nums: if t >= num: dp[t] += dp[t - num] return dp[t] <|end_body_0|> <|body_start_1|> def count(target, memo): if target == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def combinationSum5(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_024432
1,780
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "combinationSum4", "signature": "def combinationSum4(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "combinationSum5", "signature": "def combinationSum5(se...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def combinationSum5(self, nums, target): :type nums: List[int] :type target: int :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def combinationSum5(self, nums, target): :type nums: List[int] :type target: int :r...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def combinationSum5(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum4(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" dp = [0] * (1 + target) dp[0] = 1 for t in range(1, 1 + target): for num in nums: if t >= num: dp[t] += dp[t - num] ...
the_stack_v2_python_sparse
code377CombinationSumIV.py
cybelewang/leetcode-python
train
0
19bc98cea88c15bfa271dbb33b989e493b6d3943
[ "self.env = env\nself.devices = [dev for dev in self.env.id_map.values() if hasattr(dev, 'hw') and hasattr(dev.hw, 'stress_tool_attributes')]\nself.workers = get_workers(workers)\nif self.workers:\n self.workers['time'] = None", "for dev in self.devices:\n try:\n dev.ui.start_workload(**self.workers)...
<|body_start_0|> self.env = env self.devices = [dev for dev in self.env.id_map.values() if hasattr(dev, 'hw') and hasattr(dev.hw, 'stress_tool_attributes')] self.workers = get_workers(workers) if self.workers: self.workers['time'] = None <|end_body_0|> <|body_start_1|> ...
Main functionality for workload manipulation.
WorkloadContinuous
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkloadContinuous: """Main functionality for workload manipulation.""" def __init__(self, env, workers): """Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance""" <|body_0|> def start_on_nodes(self): ""...
stack_v2_sparse_classes_36k_train_024433
10,313
permissive
[ { "docstring": "Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance", "name": "__init__", "signature": "def __init__(self, env, workers)" }, { "docstring": "Start workload on devices.", "name": "start_on_nodes", "signature": "de...
5
null
Implement the Python class `WorkloadContinuous` described below. Class description: Main functionality for workload manipulation. Method signatures and docstrings: - def __init__(self, env, workers): Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance - def ...
Implement the Python class `WorkloadContinuous` described below. Class description: Main functionality for workload manipulation. Method signatures and docstrings: - def __init__(self, env, workers): Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance - def ...
2007bf3fe66edfe704e485141c55caed54fe13aa
<|skeleton|> class WorkloadContinuous: """Main functionality for workload manipulation.""" def __init__(self, env, workers): """Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance""" <|body_0|> def start_on_nodes(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkloadContinuous: """Main functionality for workload manipulation.""" def __init__(self, env, workers): """Initialize WorkloadContinuous object instance. Args: env(testlib.common3.Environment): TAF environment instance""" self.env = env self.devices = [dev for dev in self.env.id...
the_stack_v2_python_sparse
taf/plugins/pytest_workload.py
AndriyZabavskyy/taf
train
0
7b5b202f5fb9b5bb65200cce885a715e89577958
[ "qs = self\nif start_year:\n qs = qs.filter(date__year__gte=start_year)\nif end_year:\n qs = qs.filter(date__year__lte=end_year)\nreturn qs", "qs: 'SearchableModelQuerySet' = self\nsearchable_fields = qs.model.get_searchable_fields()\nif query and searchable_fields:\n search_query = SearchQuery(query)\n ...
<|body_start_0|> qs = self if start_year: qs = qs.filter(date__year__gte=start_year) if end_year: qs = qs.filter(date__year__lte=end_year) return qs <|end_body_0|> <|body_start_1|> qs: 'SearchableModelQuerySet' = self searchable_fields = qs.model....
A queryset for a searchable model.
SearchableModelQuerySet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchableModelQuerySet: """A queryset for a searchable model.""" def filter_by_date(self, start_year: Optional[int]=None, end_year: Optional[int]=None) -> 'SearchableModelQuerySet': """Return a queryset filtered by start_year and/or end_year.""" <|body_0|> def search(se...
stack_v2_sparse_classes_36k_train_024434
3,091
no_license
[ { "docstring": "Return a queryset filtered by start_year and/or end_year.", "name": "filter_by_date", "signature": "def filter_by_date(self, start_year: Optional[int]=None, end_year: Optional[int]=None) -> 'SearchableModelQuerySet'" }, { "docstring": "Return search results from apps.occurrences....
2
null
Implement the Python class `SearchableModelQuerySet` described below. Class description: A queryset for a searchable model. Method signatures and docstrings: - def filter_by_date(self, start_year: Optional[int]=None, end_year: Optional[int]=None) -> 'SearchableModelQuerySet': Return a queryset filtered by start_year ...
Implement the Python class `SearchableModelQuerySet` described below. Class description: A queryset for a searchable model. Method signatures and docstrings: - def filter_by_date(self, start_year: Optional[int]=None, end_year: Optional[int]=None) -> 'SearchableModelQuerySet': Return a queryset filtered by start_year ...
edea4e5b0c382c604db2c3fbb58dc73e57de8431
<|skeleton|> class SearchableModelQuerySet: """A queryset for a searchable model.""" def filter_by_date(self, start_year: Optional[int]=None, end_year: Optional[int]=None) -> 'SearchableModelQuerySet': """Return a queryset filtered by start_year and/or end_year.""" <|body_0|> def search(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchableModelQuerySet: """A queryset for a searchable model.""" def filter_by_date(self, start_year: Optional[int]=None, end_year: Optional[int]=None) -> 'SearchableModelQuerySet': """Return a queryset filtered by start_year and/or end_year.""" qs = self if start_year: ...
the_stack_v2_python_sparse
apps/search/models/manager.py
RealGuy69/modularhistory
train
0
c4c99da4678bbc66262b97261134950d3e3dcf38
[ "self.w = w\nself.size = sum(w)\nself.a_weights = [w[0]]\nfor k in w[1:]:\n self.a_weights.append(self.a_weights[-1] + k)\nprint(self.a_weights)", "r = random.randrange(self.size) + 1\ni, j = (0, len(self.a_weights) - 1)\nwhile i < j:\n mid = (i + j) // 2\n if self.a_weights[mid] == r:\n return mi...
<|body_start_0|> self.w = w self.size = sum(w) self.a_weights = [w[0]] for k in w[1:]: self.a_weights.append(self.a_weights[-1] + k) print(self.a_weights) <|end_body_0|> <|body_start_1|> r = random.randrange(self.size) + 1 i, j = (0, len(self.a_weight...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.w = w self.size = sum(w) self.a_weights = [w[0]] for k in w[1:]: ...
stack_v2_sparse_classes_36k_train_024435
1,521
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
696a25f8597e2a5bc5ab788924418d6423160af1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.w = w self.size = sum(w) self.a_weights = [w[0]] for k in w[1:]: self.a_weights.append(self.a_weights[-1] + k) print(self.a_weights) def pickIndex(self): """:rtype: int""" ...
the_stack_v2_python_sparse
p_y/528_random_pick_with_weight.py
tooyoungtoosimplesometimesnaive/probable-octo-potato
train
0
cafb159579d543b5449e3e7310365682175dbad8
[ "a = [(k, len(list(v))) for k, v in itertools.groupby(name)]\nb = [(k, len(list(v))) for k, v in itertools.groupby(typed)]\nif len(a) != len(b):\n return False\nn = len(a)\nfor i in range(n):\n ka, va = a[i]\n kb, vb = b[i]\n if ka != kb or va > vb:\n return False\nreturn True", "m, n = (len(na...
<|body_start_0|> a = [(k, len(list(v))) for k, v in itertools.groupby(name)] b = [(k, len(list(v))) for k, v in itertools.groupby(typed)] if len(a) != len(b): return False n = len(a) for i in range(n): ka, va = a[i] kb, vb = b[i] if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isLongPressedName1(self, name: str, typed: str) -> bool: """思路: 1. 通过itertools.groupby统计每个字符连续出现的次数 2. 将字符串name和typed对应的字符k和连续出现的频次v存储到列表a,b中 3. 如果a和b的长度不同,返回False 4. 如果a和b的长度相同,则判断每一位的字符是否相同且b中的个数是否大于等于a中 @param name: @param typed: @return:""" <|body_0|> def i...
stack_v2_sparse_classes_36k_train_024436
2,830
no_license
[ { "docstring": "思路: 1. 通过itertools.groupby统计每个字符连续出现的次数 2. 将字符串name和typed对应的字符k和连续出现的频次v存储到列表a,b中 3. 如果a和b的长度不同,返回False 4. 如果a和b的长度相同,则判断每一位的字符是否相同且b中的个数是否大于等于a中 @param name: @param typed: @return:", "name": "isLongPressedName1", "signature": "def isLongPressedName1(self, name: str, typed: str) -> bool"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isLongPressedName1(self, name: str, typed: str) -> bool: 思路: 1. 通过itertools.groupby统计每个字符连续出现的次数 2. 将字符串name和typed对应的字符k和连续出现的频次v存储到列表a,b中 3. 如果a和b的长度不同,返回False 4. 如果a和b的长度相同...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isLongPressedName1(self, name: str, typed: str) -> bool: 思路: 1. 通过itertools.groupby统计每个字符连续出现的次数 2. 将字符串name和typed对应的字符k和连续出现的频次v存储到列表a,b中 3. 如果a和b的长度不同,返回False 4. 如果a和b的长度相同...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def isLongPressedName1(self, name: str, typed: str) -> bool: """思路: 1. 通过itertools.groupby统计每个字符连续出现的次数 2. 将字符串name和typed对应的字符k和连续出现的频次v存储到列表a,b中 3. 如果a和b的长度不同,返回False 4. 如果a和b的长度相同,则判断每一位的字符是否相同且b中的个数是否大于等于a中 @param name: @param typed: @return:""" <|body_0|> def i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isLongPressedName1(self, name: str, typed: str) -> bool: """思路: 1. 通过itertools.groupby统计每个字符连续出现的次数 2. 将字符串name和typed对应的字符k和连续出现的频次v存储到列表a,b中 3. 如果a和b的长度不同,返回False 4. 如果a和b的长度相同,则判断每一位的字符是否相同且b中的个数是否大于等于a中 @param name: @param typed: @return:""" a = [(k, len(list(v))) for k, v in ...
the_stack_v2_python_sparse
LeetCode/双指针(two points)/925. 长按键入.py
yiming1012/MyLeetCode
train
2
1d79b8cbafa0d0ce513f5833a699b1bacf9b8feb
[ "if self.parent.ct is None:\n pn.state.notifications.warning('no CT found', duration=3000)\nelse:\n self.parent.ct = remove_ring_artifact(arrays=self.parent.ct, kernel_size=self.kernel_size, sub_division=self.sub_division, correction_range=self.correction_range)\n self.status = True\n pn.state.notificat...
<|body_start_0|> if self.parent.ct is None: pn.state.notifications.warning('no CT found', duration=3000) else: self.parent.ct = remove_ring_artifact(arrays=self.parent.ct, kernel_size=self.kernel_size, sub_division=self.sub_division, correction_range=self.correction_range) ...
Ring removal widget. widget of ring artifact removal filter from iMars3D, must have a parent widget with valid ct stack.
RemoveRingArtifact
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoveRingArtifact: """Ring removal widget. widget of ring artifact removal filter from iMars3D, must have a parent widget with valid ct stack.""" def apply(self): """Apply ring removal.""" <|body_0|> def panel(self, width=200): """App card view.""" <|bod...
stack_v2_sparse_classes_36k_train_024437
2,746
permissive
[ { "docstring": "Apply ring removal.", "name": "apply", "signature": "def apply(self)" }, { "docstring": "App card view.", "name": "panel", "signature": "def panel(self, width=200)" } ]
2
stack_v2_sparse_classes_30k_val_000713
Implement the Python class `RemoveRingArtifact` described below. Class description: Ring removal widget. widget of ring artifact removal filter from iMars3D, must have a parent widget with valid ct stack. Method signatures and docstrings: - def apply(self): Apply ring removal. - def panel(self, width=200): App card v...
Implement the Python class `RemoveRingArtifact` described below. Class description: Ring removal widget. widget of ring artifact removal filter from iMars3D, must have a parent widget with valid ct stack. Method signatures and docstrings: - def apply(self): Apply ring removal. - def panel(self, width=200): App card v...
7c9dea7a3a7877af1bafdfb71da8fb018d5d828f
<|skeleton|> class RemoveRingArtifact: """Ring removal widget. widget of ring artifact removal filter from iMars3D, must have a parent widget with valid ct stack.""" def apply(self): """Apply ring removal.""" <|body_0|> def panel(self, width=200): """App card view.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoveRingArtifact: """Ring removal widget. widget of ring artifact removal filter from iMars3D, must have a parent widget with valid ct stack.""" def apply(self): """Apply ring removal.""" if self.parent.ct is None: pn.state.notifications.warning('no CT found', duration=3000)...
the_stack_v2_python_sparse
src/imars3d/ui/widgets/ring_removal.py
ornlneutronimaging/iMars3D
train
3
335b880191e9349a66646dd97b2e29674e73e486
[ "self.marker = marker\nself.left = left\nself.right = right\nself.fill = fill\nself.fill_left = fill_left", "left, marked, right = (format_updatable(i, pbar) for i in (self.left, self.marker, self.right))\nwidth -= len(left) + len(right)\nif pbar.maxval:\n marked *= int(pbar.currval / pbar.maxval * width)\nels...
<|body_start_0|> self.marker = marker self.left = left self.right = right self.fill = fill self.fill_left = fill_left <|end_body_0|> <|body_start_1|> left, marked, right = (format_updatable(i, pbar) for i in (self.left, self.marker, self.right)) width -= len(left...
A progress bar which stretches to fill the line.
Bar
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bar: """A progress bar which stretches to fill the line.""" def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): """Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left...
stack_v2_sparse_classes_36k_train_024438
13,457
permissive
[ { "docstring": "Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right - string or updatable object to use as a right border fill - character to use for the empty part of the progress bar fill_left - whether to ...
2
stack_v2_sparse_classes_30k_train_000751
Implement the Python class `Bar` described below. Class description: A progress bar which stretches to fill the line. Method signatures and docstrings: - def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): Creates a customizable progress bar. marker - string or updatable object to use as a ...
Implement the Python class `Bar` described below. Class description: A progress bar which stretches to fill the line. Method signatures and docstrings: - def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): Creates a customizable progress bar. marker - string or updatable object to use as a ...
aa56ad1db9b53c0cd33d41e06303293817640047
<|skeleton|> class Bar: """A progress bar which stretches to fill the line.""" def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): """Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bar: """A progress bar which stretches to fill the line.""" def __init__(self, marker='#', left='|', right='|', fill=' ', fill_left=True): """Creates a customizable progress bar. marker - string or updatable object to use as a marker left - string or updatable object to use as a left border right...
the_stack_v2_python_sparse
src/pyunicorn/utils/progressbar/widgets.py
pik-copan/pyunicorn
train
194
7c0ba5548847f848a4c0e358ab4d5ea2fe81461f
[ "if 1 != bool(toolbar) + bool(title):\n raise ValueError('Just one of toolbar or title should be given')\nif not toolbar:\n toolbar = QToolBar(title)\ntoolbar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)\nself.addTab(toolbar, toolbar.windowTitle())\ntoolbar.setToolButtonStyle(Qt.ToolButtonTextUnd...
<|body_start_0|> if 1 != bool(toolbar) + bool(title): raise ValueError('Just one of toolbar or title should be given') if not toolbar: toolbar = QToolBar(title) toolbar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) self.addTab(toolbar, toolbar.windowTi...
A ribbon with helpers for containing toolbars
ToolbarRibbon
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToolbarRibbon: """A ribbon with helpers for containing toolbars""" def add_toolbar(self, title=None, toolbar=None): """Creates, adds and returns a QToolBar""" <|body_0|> def create_button(self, action=None, icon=None, text=None, menu=None, tooltip=None, properties={}): ...
stack_v2_sparse_classes_36k_train_024439
2,405
permissive
[ { "docstring": "Creates, adds and returns a QToolBar", "name": "add_toolbar", "signature": "def add_toolbar(self, title=None, toolbar=None)" }, { "docstring": "Returns a QToolButton", "name": "create_button", "signature": "def create_button(self, action=None, icon=None, text=None, menu=N...
3
stack_v2_sparse_classes_30k_train_006930
Implement the Python class `ToolbarRibbon` described below. Class description: A ribbon with helpers for containing toolbars Method signatures and docstrings: - def add_toolbar(self, title=None, toolbar=None): Creates, adds and returns a QToolBar - def create_button(self, action=None, icon=None, text=None, menu=None,...
Implement the Python class `ToolbarRibbon` described below. Class description: A ribbon with helpers for containing toolbars Method signatures and docstrings: - def add_toolbar(self, title=None, toolbar=None): Creates, adds and returns a QToolBar - def create_button(self, action=None, icon=None, text=None, menu=None,...
51e11407db838b8847ae8cc973b670c1cdc7d6d5
<|skeleton|> class ToolbarRibbon: """A ribbon with helpers for containing toolbars""" def add_toolbar(self, title=None, toolbar=None): """Creates, adds and returns a QToolBar""" <|body_0|> def create_button(self, action=None, icon=None, text=None, menu=None, tooltip=None, properties={}): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToolbarRibbon: """A ribbon with helpers for containing toolbars""" def add_toolbar(self, title=None, toolbar=None): """Creates, adds and returns a QToolBar""" if 1 != bool(toolbar) + bool(title): raise ValueError('Just one of toolbar or title should be given') if not t...
the_stack_v2_python_sparse
inselect-master/inselect/gui/toolbar_ribbon.py
zyken/BachelorProject
train
0
0a2c25a7a8b9724a84d5979d6e733ecae030c40e
[ "session = request.session\nif not session:\n return None\nuser_id = session.get('auth_user_id', None)\nuser = OSFUser.load(user_id)\nif not user:\n return None\nif waffle.switch_is_active(features.ENFORCE_CSRF):\n self.enforce_csrf(request)\ncheck_user(user)\nreturn (user, None)", "reason = CSRFCheck()....
<|body_start_0|> session = request.session if not session: return None user_id = session.get('auth_user_id', None) user = OSFUser.load(user_id) if not user: return None if waffle.switch_is_active(features.ENFORCE_CSRF): self.enforce_csr...
Custom DRF authentication class for API call with OSF cookie/session.
OSFSessionAuthentication
[ "MIT", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-warranty-disclaimer", "AGPL-3.0-only", "LGPL-2.0-or-later", "LicenseRef-scancode-proprietary-license", "MPL-1.1", "CPAL-1.0", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSFSessionAuthentication: """Custom DRF authentication class for API call with OSF cookie/session.""" def authenticate(self, request): """If request bears an OSF cookie, retrieve the session and verify the user. :param request: the request :return: the user""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_024440
10,193
permissive
[ { "docstring": "If request bears an OSF cookie, retrieve the session and verify the user. :param request: the request :return: the user", "name": "authenticate", "signature": "def authenticate(self, request)" }, { "docstring": "Same implementation as django-rest-framework's SessionAuthentication...
2
null
Implement the Python class `OSFSessionAuthentication` described below. Class description: Custom DRF authentication class for API call with OSF cookie/session. Method signatures and docstrings: - def authenticate(self, request): If request bears an OSF cookie, retrieve the session and verify the user. :param request:...
Implement the Python class `OSFSessionAuthentication` described below. Class description: Custom DRF authentication class for API call with OSF cookie/session. Method signatures and docstrings: - def authenticate(self, request): If request bears an OSF cookie, retrieve the session and verify the user. :param request:...
a3e0a0b9ddda5dd75fc8248d58f3bcdeece0323e
<|skeleton|> class OSFSessionAuthentication: """Custom DRF authentication class for API call with OSF cookie/session.""" def authenticate(self, request): """If request bears an OSF cookie, retrieve the session and verify the user. :param request: the request :return: the user""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OSFSessionAuthentication: """Custom DRF authentication class for API call with OSF cookie/session.""" def authenticate(self, request): """If request bears an OSF cookie, retrieve the session and verify the user. :param request: the request :return: the user""" session = request.session ...
the_stack_v2_python_sparse
api/base/authentication/drf.py
CenterForOpenScience/osf.io
train
683
0e7893f5afb9b76b96163b231cd8dbc8c536dadc
[ "for mutationData in mutationData_I:\n if 'mutation_data' in mutationData and type(mutationData['mutation_data']) == type('string'):\n mutationData['mutation_data'] = eval(mutationData['mutation_data'])\n if 'mutation_genes' in mutationData and type(mutationData['mutation_genes']) == type('string'):\n ...
<|body_start_0|> for mutationData in mutationData_I: if 'mutation_data' in mutationData and type(mutationData['mutation_data']) == type('string'): mutationData['mutation_data'] = eval(mutationData['mutation_data']) if 'mutation_genes' in mutationData and type(mutationData...
stage01_resequencing_gd_dependencies
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stage01_resequencing_gd_dependencies: def format_mutationData(self, mutationData_I): """converts '{}' to {}""" <|body_0|> def import_gd(self, filename, experiment_id='', sample_name=''): """import and parse .gd file INPUT: filename = string, directory and filename of...
stack_v2_sparse_classes_36k_train_024441
7,400
permissive
[ { "docstring": "converts '{}' to {}", "name": "format_mutationData", "signature": "def format_mutationData(self, mutationData_I)" }, { "docstring": "import and parse .gd file INPUT: filename = string, directory and filename of the .gd file OPTIONAL INPUT: the following are optional for analyzing...
5
stack_v2_sparse_classes_30k_train_006993
Implement the Python class `stage01_resequencing_gd_dependencies` described below. Class description: Implement the stage01_resequencing_gd_dependencies class. Method signatures and docstrings: - def format_mutationData(self, mutationData_I): converts '{}' to {} - def import_gd(self, filename, experiment_id='', sampl...
Implement the Python class `stage01_resequencing_gd_dependencies` described below. Class description: Implement the stage01_resequencing_gd_dependencies class. Method signatures and docstrings: - def format_mutationData(self, mutationData_I): converts '{}' to {} - def import_gd(self, filename, experiment_id='', sampl...
760049eec734a3f02a1172af68b20198713b785e
<|skeleton|> class stage01_resequencing_gd_dependencies: def format_mutationData(self, mutationData_I): """converts '{}' to {}""" <|body_0|> def import_gd(self, filename, experiment_id='', sample_name=''): """import and parse .gd file INPUT: filename = string, directory and filename of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stage01_resequencing_gd_dependencies: def format_mutationData(self, mutationData_I): """converts '{}' to {}""" for mutationData in mutationData_I: if 'mutation_data' in mutationData and type(mutationData['mutation_data']) == type('string'): mutationData['mutation_da...
the_stack_v2_python_sparse
SBaaS_resequencing/stage01_resequencing_gd_dependencies.py
dmccloskey/SBaaS_resequencing
train
0
ef883a8c3b5db22bf83c58765c7bf09f88657fc7
[ "print('build SetRank')\nself.hparams = ultra.utils.hparams.HParams(d_model=256, num_heads=8, num_layers=2, diff=64, rate=0.0, initializer=None, output_size=1)\nself.hparams.parse(hparams_str)\nself.initializer = None\nif self.hparams.initializer == 'constant':\n self.initializer = tf.constant_initializer(0.001)...
<|body_start_0|> print('build SetRank') self.hparams = ultra.utils.hparams.HParams(d_model=256, num_heads=8, num_layers=2, diff=64, rate=0.0, initializer=None, output_size=1) self.hparams.parse(hparams_str) self.initializer = None if self.hparams.initializer == 'constant': ...
The SetRank model for learning to rank. This class implements the SetRank model for ranking. See the following paper for more information. * Liang Pang, Jun Xu, Qingyao Ai, Yanyan Lan, Xueqi Cheng, Jirong Wen. 2020. SetRank: Learning a Permutation-Invariant Ranking Model for Information Retrieval. In Proceedings of SIG...
SetRank
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetRank: """The SetRank model for learning to rank. This class implements the SetRank model for ranking. See the following paper for more information. * Liang Pang, Jun Xu, Qingyao Ai, Yanyan Lan, Xueqi Cheng, Jirong Wen. 2020. SetRank: Learning a Permutation-Invariant Ranking Model for Informati...
stack_v2_sparse_classes_36k_train_024442
10,418
permissive
[ { "docstring": "Create the network. Args: hparams_str: (String) The hyper-parameters used to build the network.", "name": "__init__", "signature": "def __init__(self, hparams_str)" }, { "docstring": "Create the SetRank model (no supports for noisy parameters) Args: input_list: (list<tf.tensor>) ...
2
stack_v2_sparse_classes_30k_train_015512
Implement the Python class `SetRank` described below. Class description: The SetRank model for learning to rank. This class implements the SetRank model for ranking. See the following paper for more information. * Liang Pang, Jun Xu, Qingyao Ai, Yanyan Lan, Xueqi Cheng, Jirong Wen. 2020. SetRank: Learning a Permutatio...
Implement the Python class `SetRank` described below. Class description: The SetRank model for learning to rank. This class implements the SetRank model for ranking. See the following paper for more information. * Liang Pang, Jun Xu, Qingyao Ai, Yanyan Lan, Xueqi Cheng, Jirong Wen. 2020. SetRank: Learning a Permutatio...
89ffcaeb1049627d90518c2045dad7a996dfe2aa
<|skeleton|> class SetRank: """The SetRank model for learning to rank. This class implements the SetRank model for ranking. See the following paper for more information. * Liang Pang, Jun Xu, Qingyao Ai, Yanyan Lan, Xueqi Cheng, Jirong Wen. 2020. SetRank: Learning a Permutation-Invariant Ranking Model for Informati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SetRank: """The SetRank model for learning to rank. This class implements the SetRank model for ranking. See the following paper for more information. * Liang Pang, Jun Xu, Qingyao Ai, Yanyan Lan, Xueqi Cheng, Jirong Wen. 2020. SetRank: Learning a Permutation-Invariant Ranking Model for Information Retrieval....
the_stack_v2_python_sparse
ultra/ranking_model/SetRank.py
ULTR-Community/ULTRA
train
281
88dcc442cbac7b19a70aa27995ca9021b06639fd
[ "self.__api_token = api_token\nself.__api_token_authorization_url = api_token_authorization_url\nself.__auth = Authentication()", "self.__auth.update_api_token_authorization_url(self.__api_token_authorization_url)\nself.__auth.update_api_token(self.__api_token)\nself.__auth.update_auth_type(LoginTypes.API_TOKEN.v...
<|body_start_0|> self.__api_token = api_token self.__api_token_authorization_url = api_token_authorization_url self.__auth = Authentication() <|end_body_0|> <|body_start_1|> self.__auth.update_api_token_authorization_url(self.__api_token_authorization_url) self.__auth.update_api...
Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well.
ApiKeyAuthentication
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiKeyAuthentication: """Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well.""" def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: O...
stack_v2_sparse_classes_36k_train_024443
1,496
permissive
[ { "docstring": ":param api_token_authorization_url: Authorization URL - Same as login --api-token-authorization-server-url. :param api_token: API Token - Same as login --api-token.", "name": "__init__", "signature": "def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: Optional...
2
null
Implement the Python class `ApiKeyAuthentication` described below. Class description: Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well. Method signatures and docstrings: - def __init__...
Implement the Python class `ApiKeyAuthentication` described below. Class description: Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well. Method signatures and docstrings: - def __init__...
9ac18145c6a32e0c3ae035b99796e87184a53522
<|skeleton|> class ApiKeyAuthentication: """Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well.""" def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: O...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiKeyAuthentication: """Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well.""" def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: Optional[str]=...
the_stack_v2_python_sparse
projects/vdk-control-cli/src/vdk/internal/control/auth/apikey_auth.py
savadev/versatile-data-kit
train
0
3bedee9173cfd4b6163910c548982ab086ddefec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn LoginPageLayoutConfiguration()", "from .layout_template_type import LayoutTemplateType\nfrom .layout_template_type import LayoutTemplateType\nfields: Dict[str, Callable[[Any], None]] = {'isFooterShown': lambda n: setattr(self, 'is_foot...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return LoginPageLayoutConfiguration() <|end_body_0|> <|body_start_1|> from .layout_template_type import LayoutTemplateType from .layout_template_type import LayoutTemplateType fields: D...
LoginPageLayoutConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPageLayoutConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: """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...
stack_v2_sparse_classes_36k_train_024444
3,646
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: LoginPageLayoutConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_disc...
3
stack_v2_sparse_classes_30k_train_011845
Implement the Python class `LoginPageLayoutConfiguration` described below. Class description: Implement the LoginPageLayoutConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: Creates a new instance of the a...
Implement the Python class `LoginPageLayoutConfiguration` described below. Class description: Implement the LoginPageLayoutConfiguration class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class LoginPageLayoutConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginPageLayoutConfiguration: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> LoginPageLayoutConfiguration: """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...
the_stack_v2_python_sparse
msgraph/generated/models/login_page_layout_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
0c0813e31c49d554d24899e597976eb6350f6bd3
[ "self.word = word\nself.acc = acc\nself.start = start\nself.end = end", "if other is None:\n return 1\nreturn int(not (self.word == other.word and self.acc == other.acc and (self.start == other.start) and (self.end == other.end)))" ]
<|body_start_0|> self.word = word self.acc = acc self.start = start self.end = end <|end_body_0|> <|body_start_1|> if other is None: return 1 return int(not (self.word == other.word and self.acc == other.acc and (self.start == other.start) and (self.end == ot...
A word on which the mouse id hovering above. This class should have enough info to make it unique, so we know when we have left the word.
_WordContext
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _WordContext: """A word on which the mouse id hovering above. This class should have enough info to make it unique, so we know when we have left the word.""" def __init__(self, word, acc, start, end): """Initialize a word context. Arguments: - word: The string of the word we are on. ...
stack_v2_sparse_classes_36k_train_024445
12,279
no_license
[ { "docstring": "Initialize a word context. Arguments: - word: The string of the word we are on. - acc: The accessible object that contains the word. - start: The start offset of the word in the text. - end: The end offset of the word in the text.", "name": "__init__", "signature": "def __init__(self, wo...
2
null
Implement the Python class `_WordContext` described below. Class description: A word on which the mouse id hovering above. This class should have enough info to make it unique, so we know when we have left the word. Method signatures and docstrings: - def __init__(self, word, acc, start, end): Initialize a word conte...
Implement the Python class `_WordContext` described below. Class description: A word on which the mouse id hovering above. This class should have enough info to make it unique, so we know when we have left the word. Method signatures and docstrings: - def __init__(self, word, acc, start, end): Initialize a word conte...
d08f7bf370a82b6970387bb9f165d374a9d9092b
<|skeleton|> class _WordContext: """A word on which the mouse id hovering above. This class should have enough info to make it unique, so we know when we have left the word.""" def __init__(self, word, acc, start, end): """Initialize a word context. Arguments: - word: The string of the word we are on. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _WordContext: """A word on which the mouse id hovering above. This class should have enough info to make it unique, so we know when we have left the word.""" def __init__(self, word, acc, start, end): """Initialize a word context. Arguments: - word: The string of the word we are on. - acc: The ac...
the_stack_v2_python_sparse
usr/share/python-support/gnome-orca/orca/mouse_review.py
haniokasai/netwalker-rootfs
train
2
2a4b32b7977df65eaafbbd14d7c21a8e3f38dd4e
[ "self.hp = hp\nself.hunger = hunger\nself.thirst = thirst\nself.stamina = stamina", "if 0 <= self.hp + hp_diff <= 100:\n self.hp = self.hp + hp_diff\nelif self.hp + hp_diff <= 0:\n self.hp = 0\nelse:\n self.hp = 100", "if 0 <= self.hunger + hunger_diff <= 100:\n self.hunger = self.hunger + hunger_di...
<|body_start_0|> self.hp = hp self.hunger = hunger self.thirst = thirst self.stamina = stamina <|end_body_0|> <|body_start_1|> if 0 <= self.hp + hp_diff <= 100: self.hp = self.hp + hp_diff elif self.hp + hp_diff <= 0: self.hp = 0 else: ...
Statistics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Statistics: def __init__(self, hp, hunger, thirst, stamina): """Create a statistic object. Used to determine some object state (usually player's). :param hp: Health points :param hunger: Hunger (it rises) :param thirst: Thirst (also rises) :param stamina: Stamina points that decrease."""...
stack_v2_sparse_classes_36k_train_024446
2,154
no_license
[ { "docstring": "Create a statistic object. Used to determine some object state (usually player's). :param hp: Health points :param hunger: Hunger (it rises) :param thirst: Thirst (also rises) :param stamina: Stamina points that decrease.", "name": "__init__", "signature": "def __init__(self, hp, hunger,...
5
stack_v2_sparse_classes_30k_train_012461
Implement the Python class `Statistics` described below. Class description: Implement the Statistics class. Method signatures and docstrings: - def __init__(self, hp, hunger, thirst, stamina): Create a statistic object. Used to determine some object state (usually player's). :param hp: Health points :param hunger: Hu...
Implement the Python class `Statistics` described below. Class description: Implement the Statistics class. Method signatures and docstrings: - def __init__(self, hp, hunger, thirst, stamina): Create a statistic object. Used to determine some object state (usually player's). :param hp: Health points :param hunger: Hu...
c42a1038bc63e3c4c7a4e6618415ae9a8fe1585e
<|skeleton|> class Statistics: def __init__(self, hp, hunger, thirst, stamina): """Create a statistic object. Used to determine some object state (usually player's). :param hp: Health points :param hunger: Hunger (it rises) :param thirst: Thirst (also rises) :param stamina: Stamina points that decrease."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Statistics: def __init__(self, hp, hunger, thirst, stamina): """Create a statistic object. Used to determine some object state (usually player's). :param hp: Health points :param hunger: Hunger (it rises) :param thirst: Thirst (also rises) :param stamina: Stamina points that decrease.""" self....
the_stack_v2_python_sparse
src/entities/Statistics.py
emkarcinos/DSZI_Survival
train
0
af2524f76b65ebca9fda2884b50c2495fd1745f5
[ "s = croc_scan.Scanner()\nself.assertEqual(s.re_token.pattern, '#')\nself.assertEqual(s.comment_to_eol, ['#'])\nself.assertEqual(s.comment_start, None)\nself.assertEqual(s.comment_end, None)", "s = croc_scan.Scanner()\ns.re_token = re.compile('([\\\\:\\\\\"\\\\(\\\\)])')\ns.comment_to_eol = [':']\ns.comment_start...
<|body_start_0|> s = croc_scan.Scanner() self.assertEqual(s.re_token.pattern, '#') self.assertEqual(s.comment_to_eol, ['#']) self.assertEqual(s.comment_start, None) self.assertEqual(s.comment_end, None) <|end_body_0|> <|body_start_1|> s = croc_scan.Scanner() s.re...
Tests for croc_scan.Scanner.
TestScanner
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestScanner: """Tests for croc_scan.Scanner.""" def testInit(self): """Test __init()__.""" <|body_0|> def testScanLines(self): """Test ScanLines().""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = croc_scan.Scanner() self.assertEqual(...
stack_v2_sparse_classes_36k_train_024447
7,181
permissive
[ { "docstring": "Test __init()__.", "name": "testInit", "signature": "def testInit(self)" }, { "docstring": "Test ScanLines().", "name": "testScanLines", "signature": "def testScanLines(self)" } ]
2
stack_v2_sparse_classes_30k_train_019696
Implement the Python class `TestScanner` described below. Class description: Tests for croc_scan.Scanner. Method signatures and docstrings: - def testInit(self): Test __init()__. - def testScanLines(self): Test ScanLines().
Implement the Python class `TestScanner` described below. Class description: Tests for croc_scan.Scanner. Method signatures and docstrings: - def testInit(self): Test __init()__. - def testScanLines(self): Test ScanLines(). <|skeleton|> class TestScanner: """Tests for croc_scan.Scanner.""" def testInit(self...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class TestScanner: """Tests for croc_scan.Scanner.""" def testInit(self): """Test __init()__.""" <|body_0|> def testScanLines(self): """Test ScanLines().""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestScanner: """Tests for croc_scan.Scanner.""" def testInit(self): """Test __init()__.""" s = croc_scan.Scanner() self.assertEqual(s.re_token.pattern, '#') self.assertEqual(s.comment_to_eol, ['#']) self.assertEqual(s.comment_start, None) self.assertEqual(s...
the_stack_v2_python_sparse
tools/code_coverage/croc_scan_test.py
metux/chromium-suckless
train
5
c12e937c4718da223b566e8370eaf4066e41203d
[ "ver_args = [{'name': 'ns_key', 'arg': ns_key, 't': EMUNamespaceKey}, {'name': 'mac', 'arg': mac, 't': 'mac'}]\nEMUValidator.verify(ver_args)\nself.ns_key = ns_key\nself.mac = Mac(mac)", "if add_ns:\n res = self.ns_key.conv_to_dict(True)\nelse:\n res = {}\nif to_bytes:\n res.update({'mac': self.mac.V()})...
<|body_start_0|> ver_args = [{'name': 'ns_key', 'arg': ns_key, 't': EMUNamespaceKey}, {'name': 'mac', 'arg': mac, 't': 'mac'}] EMUValidator.verify(ver_args) self.ns_key = ns_key self.mac = Mac(mac) <|end_body_0|> <|body_start_1|> if add_ns: res = self.ns_key.conv_to_...
EMUClientKey
[ "GPL-1.0-or-later", "GPL-2.0-or-later", "GPL-2.0-only", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EMUClientKey: def __init__(self, ns_key, mac): """Creating client key for identification clients in emu. .. code-block:: python mac = Mac('00:00:00:70:00:01') # creating a Mac obj ns_key = EMUNamespaceKey(vport = 0) # creating ns_key with no vlans c_key = EMUClientKey(ns_key, mac.V()) # ...
stack_v2_sparse_classes_36k_train_024448
21,620
permissive
[ { "docstring": "Creating client key for identification clients in emu. .. code-block:: python mac = Mac('00:00:00:70:00:01') # creating a Mac obj ns_key = EMUNamespaceKey(vport = 0) # creating ns_key with no vlans c_key = EMUClientKey(ns_key, mac.V()) # creating client key, notice mac converted to list of bytes...
2
null
Implement the Python class `EMUClientKey` described below. Class description: Implement the EMUClientKey class. Method signatures and docstrings: - def __init__(self, ns_key, mac): Creating client key for identification clients in emu. .. code-block:: python mac = Mac('00:00:00:70:00:01') # creating a Mac obj ns_key ...
Implement the Python class `EMUClientKey` described below. Class description: Implement the EMUClientKey class. Method signatures and docstrings: - def __init__(self, ns_key, mac): Creating client key for identification clients in emu. .. code-block:: python mac = Mac('00:00:00:70:00:01') # creating a Mac obj ns_key ...
564fb7ba2a003065270a9bcc9946e7a7473f668e
<|skeleton|> class EMUClientKey: def __init__(self, ns_key, mac): """Creating client key for identification clients in emu. .. code-block:: python mac = Mac('00:00:00:70:00:01') # creating a Mac obj ns_key = EMUNamespaceKey(vport = 0) # creating ns_key with no vlans c_key = EMUClientKey(ns_key, mac.V()) # ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EMUClientKey: def __init__(self, ns_key, mac): """Creating client key for identification clients in emu. .. code-block:: python mac = Mac('00:00:00:70:00:01') # creating a Mac obj ns_key = EMUNamespaceKey(vport = 0) # creating ns_key with no vlans c_key = EMUClientKey(ns_key, mac.V()) # creating clien...
the_stack_v2_python_sparse
scripts/automation/trex_control_plane/interactive/trex/emu/trex_emu_profile.py
ramakristipati/trex-core
train
0
9148f2098152e77d7510ab487bb43bc635cf6c27
[ "if n == 0 or n == 1:\n return 1\ncount = 0\nfor i in range(1, n + 1):\n count += self.numTrees(i - 1) * self.numTrees(n - i)\nreturn count", "def helper(n, memo):\n if n in memo:\n return memo[n]\n count = 0\n for i in range(1, n + 1):\n count += helper(i - 1, memo) * helper(n - i, m...
<|body_start_0|> if n == 0 or n == 1: return 1 count = 0 for i in range(1, n + 1): count += self.numTrees(i - 1) * self.numTrees(n - i) return count <|end_body_0|> <|body_start_1|> def helper(n, memo): if n in memo: return memo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTrees(self, n: int) -> int: """https://youtu.be/GgP75HAvrlY?t=694""" <|body_0|> def numTrees(self, n: int) -> int: """memoization""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0 or n == 1: return 1 coun...
stack_v2_sparse_classes_36k_train_024449
1,449
no_license
[ { "docstring": "https://youtu.be/GgP75HAvrlY?t=694", "name": "numTrees", "signature": "def numTrees(self, n: int) -> int" }, { "docstring": "memoization", "name": "numTrees", "signature": "def numTrees(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n: int) -> int: https://youtu.be/GgP75HAvrlY?t=694 - def numTrees(self, n: int) -> int: memoization
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n: int) -> int: https://youtu.be/GgP75HAvrlY?t=694 - def numTrees(self, n: int) -> int: memoization <|skeleton|> class Solution: def numTrees(self, n: in...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def numTrees(self, n: int) -> int: """https://youtu.be/GgP75HAvrlY?t=694""" <|body_0|> def numTrees(self, n: int) -> int: """memoization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTrees(self, n: int) -> int: """https://youtu.be/GgP75HAvrlY?t=694""" if n == 0 or n == 1: return 1 count = 0 for i in range(1, n + 1): count += self.numTrees(i - 1) * self.numTrees(n - i) return count def numTrees(self, n: i...
the_stack_v2_python_sparse
Leetcode/96. Unique Binary Search Trees.py
brlala/Educative-Grokking-Coding-Exercise
train
3
4563077ff3381d2ed09dcade02d0b22123451d66
[ "if exists('command', name):\n self.name = name\nelse:\n raise NameError('No command called: %s' % name)", "output = self.name\nfor arg in args:\n output += ' '\n if isinstance(arg, ServerVar):\n output += arg.getName\n else:\n output += str(arg)\nForceServerCommand(output)" ]
<|body_start_0|> if exists('command', name): self.name = name else: raise NameError('No command called: %s' % name) <|end_body_0|> <|body_start_1|> output = self.name for arg in args: output += ' ' if isinstance(arg, ServerVar): ...
Class to pretend to be a direct access function for console commands.
CommandProxy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandProxy: """Class to pretend to be a direct access function for console commands.""" def __init__(self, name): """The name of the console command. Raises an exception if it doesn't exist.""" <|body_0|> def __call__(self, *args): """If the command proxy is in...
stack_v2_sparse_classes_36k_train_024450
18,315
permissive
[ { "docstring": "The name of the console command. Raises an exception if it doesn't exist.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "If the command proxy is invoked, call back.", "name": "__call__", "signature": "def __call__(self, *args)" } ]
2
stack_v2_sparse_classes_30k_train_010491
Implement the Python class `CommandProxy` described below. Class description: Class to pretend to be a direct access function for console commands. Method signatures and docstrings: - def __init__(self, name): The name of the console command. Raises an exception if it doesn't exist. - def __call__(self, *args): If th...
Implement the Python class `CommandProxy` described below. Class description: Class to pretend to be a direct access function for console commands. Method signatures and docstrings: - def __init__(self, name): The name of the console command. Raises an exception if it doesn't exist. - def __call__(self, *args): If th...
3ea8ddb2c855dc1986244a650fa23475fc69ca7f
<|skeleton|> class CommandProxy: """Class to pretend to be a direct access function for console commands.""" def __init__(self, name): """The name of the console command. Raises an exception if it doesn't exist.""" <|body_0|> def __call__(self, *args): """If the command proxy is in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandProxy: """Class to pretend to be a direct access function for console commands.""" def __init__(self, name): """The name of the console command. Raises an exception if it doesn't exist.""" if exists('command', name): self.name = name else: raise Name...
the_stack_v2_python_sparse
addons/source-python/plugins/es_emulator/eventscripts/es.py
Ayuto/EventScripts-Emulator
train
17
bb9a0ed7a0b379f64f4d943505a505603ca6a76a
[ "self.module = module.strip()\nself.index = int(index)\nself.function = function.strip() if function is not None else None\nself.sourceFile = sourceFile.strip() if sourceFile is not None else None\nself.line = int(line) if line is not None else None\nself.variables = variables\nself.warningAboutCorrectness = warnin...
<|body_start_0|> self.module = module.strip() self.index = int(index) self.function = function.strip() if function is not None else None self.sourceFile = sourceFile.strip() if sourceFile is not None else None self.line = int(line) if line is not None else None self.varia...
This class represents a particular frame of the thread's stack. It includes various information about the execution including variables and source info
Frame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Frame: """This class represents a particular frame of the thread's stack. It includes various information about the execution including variables and source info""" def __init__(self, module, index, function=None, sourceFile=None, line=None, variables=None, warningAboutCorrectness=False): ...
stack_v2_sparse_classes_36k_train_024451
2,304
no_license
[ { "docstring": "Initializer for the Frame. Takes in the module, stack index as required parameters since they should be available, regardless of debugger used (or symbols available). Optionally, we can also give the function name, source file name, line number, list of variable.Variable objects, and a warning a...
3
stack_v2_sparse_classes_30k_train_006994
Implement the Python class `Frame` described below. Class description: This class represents a particular frame of the thread's stack. It includes various information about the execution including variables and source info Method signatures and docstrings: - def __init__(self, module, index, function=None, sourceFile...
Implement the Python class `Frame` described below. Class description: This class represents a particular frame of the thread's stack. It includes various information about the execution including variables and source info Method signatures and docstrings: - def __init__(self, module, index, function=None, sourceFile...
26dfbd75be06923c13cb8577011186177267d886
<|skeleton|> class Frame: """This class represents a particular frame of the thread's stack. It includes various information about the execution including variables and source info""" def __init__(self, module, index, function=None, sourceFile=None, line=None, variables=None, warningAboutCorrectness=False): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Frame: """This class represents a particular frame of the thread's stack. It includes various information about the execution including variables and source info""" def __init__(self, module, index, function=None, sourceFile=None, line=None, variables=None, warningAboutCorrectness=False): """Init...
the_stack_v2_python_sparse
pydumpanalyzer/frame.py
youyong123/pydumpanalyzer
train
0
05ebf26c1a0213d51fa6ffadcc85ab2ab5272c1b
[ "nodes = [(root, 0)]\nvalues = []\nwhile nodes:\n cur, h = nodes.pop()\n values.append(cur.val)\n if cur.left:\n nodes.append((cur.left, h + 1))\n if cur.right:\n nodes.append((cur.right, h + 1))\nvalues.sort()\nnew = [values[i + 1] - values[i] for i in range(len(values) - 1)]\nres = min(n...
<|body_start_0|> nodes = [(root, 0)] values = [] while nodes: cur, h = nodes.pop() values.append(cur.val) if cur.left: nodes.append((cur.left, h + 1)) if cur.right: nodes.append((cur.right, h + 1)) values.sor...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def getMinimumDifference2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nodes = [(root, 0)] ...
stack_v2_sparse_classes_36k_train_024452
1,588
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "getMinimumDifference", "signature": "def getMinimumDifference(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "getMinimumDifference2", "signature": "def getMinimumDifference2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_020978
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int - def getMinimumDifference2(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int - def getMinimumDifference2(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def getMinimumDifference2(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" nodes = [(root, 0)] values = [] while nodes: cur, h = nodes.pop() values.append(cur.val) if cur.left: nodes.append((cur.left, h + 1)) ...
the_stack_v2_python_sparse
530. Minimum Absolute Difference in BST/difference.py
Macielyoung/LeetCode
train
1
eea2a584452065b1043f96208edcb91001725974
[ "self.key = key\nself._set_key_parms(['encode_column', 'decode_column', 'encode_len', 'decode_len', 'preprocess'])\nself._set_prhb_parms(['encode_column', 'decode_column', 'encode_len', 'decode_len', 'preprocess'])", "if 'conf' not in self.__dict__:\n self.conf = self.get_view_obj(self.key)\nreturn self.conf['...
<|body_start_0|> self.key = key self._set_key_parms(['encode_column', 'decode_column', 'encode_len', 'decode_len', 'preprocess']) self._set_prhb_parms(['encode_column', 'decode_column', 'encode_len', 'decode_len', 'preprocess']) <|end_body_0|> <|body_start_1|> if 'conf' not in self.__di...
WorkflowFeedFr2Seq
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowFeedFr2Seq: def __init__(self, key=None): """init key variable :param key: :return:""" <|body_0|> def get_encode_column(self): """:param node_id: :return:""" <|body_1|> def get_decode_column(self): """:param node_id: :return:""" <...
stack_v2_sparse_classes_36k_train_024453
1,644
permissive
[ { "docstring": "init key variable :param key: :return:", "name": "__init__", "signature": "def __init__(self, key=None)" }, { "docstring": ":param node_id: :return:", "name": "get_encode_column", "signature": "def get_encode_column(self)" }, { "docstring": ":param node_id: :retur...
6
null
Implement the Python class `WorkflowFeedFr2Seq` described below. Class description: Implement the WorkflowFeedFr2Seq class. Method signatures and docstrings: - def __init__(self, key=None): init key variable :param key: :return: - def get_encode_column(self): :param node_id: :return: - def get_decode_column(self): :p...
Implement the Python class `WorkflowFeedFr2Seq` described below. Class description: Implement the WorkflowFeedFr2Seq class. Method signatures and docstrings: - def __init__(self, key=None): init key variable :param key: :return: - def get_encode_column(self): :param node_id: :return: - def get_decode_column(self): :p...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class WorkflowFeedFr2Seq: def __init__(self, key=None): """init key variable :param key: :return:""" <|body_0|> def get_encode_column(self): """:param node_id: :return:""" <|body_1|> def get_decode_column(self): """:param node_id: :return:""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowFeedFr2Seq: def __init__(self, key=None): """init key variable :param key: :return:""" self.key = key self._set_key_parms(['encode_column', 'decode_column', 'encode_len', 'decode_len', 'preprocess']) self._set_prhb_parms(['encode_column', 'decode_column', 'encode_len', ...
the_stack_v2_python_sparse
master/workflow/preprocess/workflow_feed_fr2seq.py
yurimkoo/tensormsa
train
1
eccaa1363fa7709a008ce5ce0c45ddbab37ac8e2
[ "timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_posix_time.PosixTime(timestamp=timestamp)", "query_hash = hash(query)\nevent_data = ChromeAutofillEventData()\nevent_data.creation_time = self._GetDateTimeRowValue(query_hash, row, 'date_created'...
<|body_start_0|> timestamp = self._GetRowValue(query_hash, row, value_name) if timestamp is None: return None return dfdatetime_posix_time.PosixTime(timestamp=timestamp) <|end_body_0|> <|body_start_1|> query_hash = hash(query) event_data = ChromeAutofillEventData() ...
SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data
ChromeAutofillPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromeAutofillPlugin: """SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value ...
stack_v2_sparse_classes_36k_train_024454
3,665
permissive
[ { "docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.PosixTime: date and time value or None if not available.", "name...
2
stack_v2_sparse_classes_30k_train_015399
Implement the Python class `ChromeAutofillPlugin` described below. Class description: SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data Method signatures and docstrings: - def _GetDateTimeRowValue(self, query...
Implement the Python class `ChromeAutofillPlugin` described below. Class description: SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data Method signatures and docstrings: - def _GetDateTimeRowValue(self, query...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class ChromeAutofillPlugin: """SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromeAutofillPlugin: """SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row....
the_stack_v2_python_sparse
plaso/parsers/sqlite_plugins/chrome_autofill.py
log2timeline/plaso
train
1,506
f7729324f9db7fedb092e66658d83e9438510894
[ "self.update_func = update_func\nself.bond_agg_func = bond_agg_func\nself.atom_agg_func = atom_agg_func\nsuper().__init__(**kwargs)", "info_list = [graph[Index.STATES]]\nif self.bond_agg_func is not None:\n bond_agg = self.bond_agg_func(graph)\n info_list.append(bond_agg)\nif self.atom_agg_func is not None:...
<|body_start_0|> self.update_func = update_func self.bond_agg_func = bond_agg_func self.atom_agg_func = atom_agg_func super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> info_list = [graph[Index.STATES]] if self.bond_agg_func is not None: bond_agg = se...
u^\\prime = Update(\\bar e^\\prime⊕\\bar v^\\prime⊕u)
ConcatBondAtomState
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConcatBondAtomState: """u^\\prime = Update(\\bar e^\\prime⊕\\bar v^\\prime⊕u)""" def __init__(self, update_func: Callable, bond_agg_func: Callable=None, atom_agg_func: Callable=None, **kwargs): """Args: update_func (callable): the core update function bond_agg_func (callable): functi...
stack_v2_sparse_classes_36k_train_024455
2,731
permissive
[ { "docstring": "Args: update_func (callable): the core update function bond_agg_func (callable): function to aggregate bond to state atom_agg_func (callable): function to aggregate atom to state **kwargs:", "name": "__init__", "signature": "def __init__(self, update_func: Callable, bond_agg_func: Callab...
3
stack_v2_sparse_classes_30k_train_005103
Implement the Python class `ConcatBondAtomState` described below. Class description: u^\\prime = Update(\\bar e^\\prime⊕\\bar v^\\prime⊕u) Method signatures and docstrings: - def __init__(self, update_func: Callable, bond_agg_func: Callable=None, atom_agg_func: Callable=None, **kwargs): Args: update_func (callable): ...
Implement the Python class `ConcatBondAtomState` described below. Class description: u^\\prime = Update(\\bar e^\\prime⊕\\bar v^\\prime⊕u) Method signatures and docstrings: - def __init__(self, update_func: Callable, bond_agg_func: Callable=None, atom_agg_func: Callable=None, **kwargs): Args: update_func (callable): ...
1f89ecb564b2691c810cd106c3476b15a8699bb7
<|skeleton|> class ConcatBondAtomState: """u^\\prime = Update(\\bar e^\\prime⊕\\bar v^\\prime⊕u)""" def __init__(self, update_func: Callable, bond_agg_func: Callable=None, atom_agg_func: Callable=None, **kwargs): """Args: update_func (callable): the core update function bond_agg_func (callable): functi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConcatBondAtomState: """u^\\prime = Update(\\bar e^\\prime⊕\\bar v^\\prime⊕u)""" def __init__(self, update_func: Callable, bond_agg_func: Callable=None, atom_agg_func: Callable=None, **kwargs): """Args: update_func (callable): the core update function bond_agg_func (callable): function to aggrega...
the_stack_v2_python_sparse
m3gnet/layers/_state.py
materialsvirtuallab/m3gnet
train
175
2cd48f6afb39bfe750591c393d2f1dc14cd99eb3
[ "self.lin_state = lin_state\nself.lin_tau = np.zeros(2)\nself.horizon = 2000\nself.dt = dt\nself.twip = Robot_Model()\nself.reference_x_d = lin_state[3]\nself.reference_yaw_d = lin_state[5]\nself.integral_error_x_d = 0\nself.integral_error_yaw_d = 0\nself.state_dim = 6\nself.state_integral_dim = 2\nself.control_dim...
<|body_start_0|> self.lin_state = lin_state self.lin_tau = np.zeros(2) self.horizon = 2000 self.dt = dt self.twip = Robot_Model() self.reference_x_d = lin_state[3] self.reference_yaw_d = lin_state[5] self.integral_error_x_d = 0 self.integral_error_...
This is a small class that computes an LQR control law using integral actions for the yaw and pitch angular velocities
LQI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LQI: """This is a small class that computes an LQR control law using integral actions for the yaw and pitch angular velocities""" def __init__(self, lin_state=None, lin_tau=None, horizon=None, dt=None): """Args: lin_state (np.array): linearization state lin_tau (np.array): linearizat...
stack_v2_sparse_classes_36k_train_024456
5,100
no_license
[ { "docstring": "Args: lin_state (np.array): linearization state lin_tau (np.array): linearization control inputs horizon (int): how much to look into the future for optimizing the gains dt (int): desidered sampling time", "name": "__init__", "signature": "def __init__(self, lin_state=None, lin_tau=None,...
3
stack_v2_sparse_classes_30k_train_017861
Implement the Python class `LQI` described below. Class description: This is a small class that computes an LQR control law using integral actions for the yaw and pitch angular velocities Method signatures and docstrings: - def __init__(self, lin_state=None, lin_tau=None, horizon=None, dt=None): Args: lin_state (np.a...
Implement the Python class `LQI` described below. Class description: This is a small class that computes an LQR control law using integral actions for the yaw and pitch angular velocities Method signatures and docstrings: - def __init__(self, lin_state=None, lin_tau=None, horizon=None, dt=None): Args: lin_state (np.a...
a5e6956422458048ecc9d00c6a5ab821ac820514
<|skeleton|> class LQI: """This is a small class that computes an LQR control law using integral actions for the yaw and pitch angular velocities""" def __init__(self, lin_state=None, lin_tau=None, horizon=None, dt=None): """Args: lin_state (np.array): linearization state lin_tau (np.array): linearizat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LQI: """This is a small class that computes an LQR control law using integral actions for the yaw and pitch angular velocities""" def __init__(self, lin_state=None, lin_tau=None, horizon=None, dt=None): """Args: lin_state (np.array): linearization state lin_tau (np.array): linearization control i...
the_stack_v2_python_sparse
python_scripts/controllers/lqi.py
giulioturrisi/Self-Balancing-Robot
train
12
4733ce1f17759607c870d2a127c71c2ab2e8744c
[ "super(WrapDecoderLayer, self).__init__(name_scope)\nself._prepare_decoder_layer = PrepareEncoderDecoderLayer(self.full_name(), trg_vocab_size, d_model, max_length, prepostprocess_dropout, word_emb_param_name=word_emb_param_names[1], pos_enc_param_name=pos_enc_param_names[1])\nself._decoder_layer = DecoderLayer(sel...
<|body_start_0|> super(WrapDecoderLayer, self).__init__(name_scope) self._prepare_decoder_layer = PrepareEncoderDecoderLayer(self.full_name(), trg_vocab_size, d_model, max_length, prepostprocess_dropout, word_emb_param_name=word_emb_param_names[1], pos_enc_param_name=pos_enc_param_names[1]) self...
decoder
WrapDecoderLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WrapDecoderLayer: """decoder""" def __init__(self, name_scope, trg_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd, weight_sharing, gather_idx=None): """The wrapper...
stack_v2_sparse_classes_36k_train_024457
40,228
permissive
[ { "docstring": "The wrapper assembles together all needed layers for the encoder.", "name": "__init__", "signature": "def __init__(self, name_scope, trg_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd,...
2
null
Implement the Python class `WrapDecoderLayer` described below. Class description: decoder Method signatures and docstrings: - def __init__(self, name_scope, trg_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postp...
Implement the Python class `WrapDecoderLayer` described below. Class description: decoder Method signatures and docstrings: - def __init__(self, name_scope, trg_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postp...
420527996b6da60ca401717a734329f126ed0680
<|skeleton|> class WrapDecoderLayer: """decoder""" def __init__(self, name_scope, trg_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd, weight_sharing, gather_idx=None): """The wrapper...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WrapDecoderLayer: """decoder""" def __init__(self, name_scope, trg_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd, weight_sharing, gather_idx=None): """The wrapper assembles to...
the_stack_v2_python_sparse
dygraph/transformer/model.py
chenbjin/models
train
3
2662eab3094ce1b4b0db9369edac940ffe9ada52
[ "arg_dict = req.environ['wsgiorg.routing_args'][1]\naction = arg_dict['action']\nmethod = getattr(self, action)\ndel arg_dict['controller']\ndel arg_dict['action']\nif 'format' in arg_dict:\n del arg_dict['format']\narg_dict['request'] = req\nresult = method(**arg_dict)\nif isinstance(result, dict) or result is ...
<|body_start_0|> arg_dict = req.environ['wsgiorg.routing_args'][1] action = arg_dict['action'] method = getattr(self, action) del arg_dict['controller'] del arg_dict['action'] if 'format' in arg_dict: del arg_dict['format'] arg_dict['request'] = req ...
WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. They raise a webob.exc exception, or r...
Controller
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. ...
stack_v2_sparse_classes_36k_train_024458
29,625
permissive
[ { "docstring": "Call the method specified in req.environ by RoutesMiddleware.", "name": "__call__", "signature": "def __call__(self, req)" }, { "docstring": "Serialize the given dict to the provided content_type. Uses self._serialization_metadata if it exists, which is a dict mapping MIME types ...
3
stack_v2_sparse_classes_30k_train_014895
Implement the Python class `Controller` described below. Class description: WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argume...
Implement the Python class `Controller` described below. Class description: WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argume...
dde31aae392b80341f6440eb38db1583563d7d1f
<|skeleton|> class Controller: """WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """WSGI app that dispatched to methods. WSGI app that reads routing information supplied by RoutesMiddleware and calls the requested action method upon itself. All action methods must, in addition to their normal parameters, accept a 'req' argument which is the incoming wsgi.Request. They raise a ...
the_stack_v2_python_sparse
neutron/wsgi.py
openstack/neutron
train
1,174
3ae4efa831d26ebb99510e9e375a0af638082e0f
[ "self.connections.add(self)\nif self.application.settings['hide_scoreboard']:\n self.write_message('pause')\nelse:\n self.write_message(Scoreboard.now(self))", "Scoreboard.update_gamestate(self)\nif self.application.settings['hide_scoreboard']:\n self.write_message('pause')\nelse:\n self.write_message...
<|body_start_0|> self.connections.add(self) if self.application.settings['hide_scoreboard']: self.write_message('pause') else: self.write_message(Scoreboard.now(self)) <|end_body_0|> <|body_start_1|> Scoreboard.update_gamestate(self) if self.application.s...
Get Score data via websocket
ScoreboardDataSocketHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScoreboardDataSocketHandler: """Get Score data via websocket""" def open(self): """When we receive a new websocket connect""" <|body_0|> def on_message(self, message): """We ignore messages if there are more than 1 every 3 seconds""" <|body_1|> def o...
stack_v2_sparse_classes_36k_train_024459
14,374
permissive
[ { "docstring": "When we receive a new websocket connect", "name": "open", "signature": "def open(self)" }, { "docstring": "We ignore messages if there are more than 1 every 3 seconds", "name": "on_message", "signature": "def on_message(self, message)" }, { "docstring": "Lost conn...
3
null
Implement the Python class `ScoreboardDataSocketHandler` described below. Class description: Get Score data via websocket Method signatures and docstrings: - def open(self): When we receive a new websocket connect - def on_message(self, message): We ignore messages if there are more than 1 every 3 seconds - def on_cl...
Implement the Python class `ScoreboardDataSocketHandler` described below. Class description: Get Score data via websocket Method signatures and docstrings: - def open(self): When we receive a new websocket connect - def on_message(self, message): We ignore messages if there are more than 1 every 3 seconds - def on_cl...
de44dd6ef86dd5b97524d0e438d0441922099930
<|skeleton|> class ScoreboardDataSocketHandler: """Get Score data via websocket""" def open(self): """When we receive a new websocket connect""" <|body_0|> def on_message(self, message): """We ignore messages if there are more than 1 every 3 seconds""" <|body_1|> def o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScoreboardDataSocketHandler: """Get Score data via websocket""" def open(self): """When we receive a new websocket connect""" self.connections.add(self) if self.application.settings['hide_scoreboard']: self.write_message('pause') else: self.write_me...
the_stack_v2_python_sparse
handlers/ScoreboardHandlers.py
moloch--/RootTheBox
train
804
948995d75b155f58606de2bf219bbdfac92388ff
[ "assert isinstance(input_integer, int), 'Invalid input type -- int expected'\nsuper().__init__(self.PROBLEM_NAME)\nself.input_integer = int(input_integer)", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nsign = 1\nif self.input_integer < 0:\n sign = -1\n self.input_integer = abs(self.input_inte...
<|body_start_0|> assert isinstance(input_integer, int), 'Invalid input type -- int expected' super().__init__(self.PROBLEM_NAME) self.input_integer = int(input_integer) <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) sign = 1 if ...
ReverseIntegers
ReverseIntegers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReverseIntegers: """ReverseIntegers""" def __init__(self, input_integer): """Reverse Integers Args: input_integer: input_integer to be reversed Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Note: O(n) (runtime) and O(1) (space) so...
stack_v2_sparse_classes_36k_train_024460
1,860
no_license
[ { "docstring": "Reverse Integers Args: input_integer: input_integer to be reversed Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_integer)" }, { "docstring": "Solve the problem Note: O(n) (runtime) and O(1) (space) solution works by using the modulo opera...
2
null
Implement the Python class `ReverseIntegers` described below. Class description: ReverseIntegers Method signatures and docstrings: - def __init__(self, input_integer): Reverse Integers Args: input_integer: input_integer to be reversed Returns: None Raises: None - def solve(self): Solve the problem Note: O(n) (runtime...
Implement the Python class `ReverseIntegers` described below. Class description: ReverseIntegers Method signatures and docstrings: - def __init__(self, input_integer): Reverse Integers Args: input_integer: input_integer to be reversed Returns: None Raises: None - def solve(self): Solve the problem Note: O(n) (runtime...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class ReverseIntegers: """ReverseIntegers""" def __init__(self, input_integer): """Reverse Integers Args: input_integer: input_integer to be reversed Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Note: O(n) (runtime) and O(1) (space) so...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReverseIntegers: """ReverseIntegers""" def __init__(self, input_integer): """Reverse Integers Args: input_integer: input_integer to be reversed Returns: None Raises: None""" assert isinstance(input_integer, int), 'Invalid input type -- int expected' super().__init__(self.PROBLEM_N...
the_stack_v2_python_sparse
python/problems/math/reverse_integers.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
17cac3f29858b7edb8053fab35a6f5e04545cc6f
[ "super(MySQLLastScanTable, self).__init__(db_dict, dbtype, verbose)\nself.connectdb(db_dict, verbose)\nself._load_table()", "sql = 'UPDATE LastScan SET LastScan = %s WHERE ScanID = 1 VALUES (%s)'\ntry:\n cursor = self.connection.cursor()\n cursor.execute(sql, tuple(timestamp))\n audit_logger = get_logger...
<|body_start_0|> super(MySQLLastScanTable, self).__init__(db_dict, dbtype, verbose) self.connectdb(db_dict, verbose) self._load_table() <|end_body_0|> <|body_start_1|> sql = 'UPDATE LastScan SET LastScan = %s WHERE ScanID = 1 VALUES (%s)' try: cursor = self.connectio...
My SQL initialization and methods for last scan table
MySQLLastScanTable
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLLastScanTable: """My SQL initialization and methods for last scan table""" def __init__(self, db_dict, dbtype, verbose): """Read the input file into a dictionary.""" <|body_0|> def update(self, timestamp): """Insert the provided time stamp into the only reco...
stack_v2_sparse_classes_36k_train_024461
6,482
permissive
[ { "docstring": "Read the input file into a dictionary.", "name": "__init__", "signature": "def __init__(self, db_dict, dbtype, verbose)" }, { "docstring": "Insert the provided time stamp into the only record in the table.", "name": "update", "signature": "def update(self, timestamp)" }...
2
stack_v2_sparse_classes_30k_train_015604
Implement the Python class `MySQLLastScanTable` described below. Class description: My SQL initialization and methods for last scan table Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Read the input file into a dictionary. - def update(self, timestamp): Insert the provided time sta...
Implement the Python class `MySQLLastScanTable` described below. Class description: My SQL initialization and methods for last scan table Method signatures and docstrings: - def __init__(self, db_dict, dbtype, verbose): Read the input file into a dictionary. - def update(self, timestamp): Insert the provided time sta...
9c60b3489f02592bd9099b8719ca23ae43a9eaa5
<|skeleton|> class MySQLLastScanTable: """My SQL initialization and methods for last scan table""" def __init__(self, db_dict, dbtype, verbose): """Read the input file into a dictionary.""" <|body_0|> def update(self, timestamp): """Insert the provided time stamp into the only reco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQLLastScanTable: """My SQL initialization and methods for last scan table""" def __init__(self, db_dict, dbtype, verbose): """Read the input file into a dictionary.""" super(MySQLLastScanTable, self).__init__(db_dict, dbtype, verbose) self.connectdb(db_dict, verbose) se...
the_stack_v2_python_sparse
smipyping/_lastscantable.py
KSchopmeyer/smipyping
train
0
fa8c9a9edef240c14da0f1af18ac1daf130fbd36
[ "Parametre.__init__(self, 'liste', 'list')\nself.aide_courte = 'liste les news letters existantes'\nself.aide_longue = 'Cette commande liste les news letters existantes ainsi que leur statut.'", "newsletters = list(importeur.information.newsletters)\nif len(newsletters) == 0:\n personnage << \"Aucune news lett...
<|body_start_0|> Parametre.__init__(self, 'liste', 'list') self.aide_courte = 'liste les news letters existantes' self.aide_longue = 'Cette commande liste les news letters existantes ainsi que leur statut.' <|end_body_0|> <|body_start_1|> newsletters = list(importeur.information.newslet...
Commande 'newsletter liste'.
PrmListe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmListe: """Commande 'newsletter liste'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre...
stack_v2_sparse_classes_36k_train_024462
3,072
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre.", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmListe` described below. Class description: Commande 'newsletter liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre.
Implement the Python class `PrmListe` described below. Class description: Commande 'newsletter liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre. <|skeleton|> class PrmListe: """Commande 'newslet...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmListe: """Commande 'newsletter liste'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmListe: """Commande 'newsletter liste'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'liste', 'list') self.aide_courte = 'liste les news letters existantes' self.aide_longue = 'Cette commande liste les news letters existantes ainsi que ...
the_stack_v2_python_sparse
src/primaires/information/commandes/newsletter/liste.py
vincent-lg/tsunami
train
5
de21f436a468c78da32e569c0a96aad67011c85e
[ "settings = self.settings\nbuild_type = settings['build_type']\nbuild_target = settings.get('build_target', '').strip()\nif build_type == 'cmake':\n build_type = 'make'\ncmd = [config['exe_paths']['infer'], 'run', '--no-progress-bar', '--'] + shlex.split(build_type)\nif build_type == 'xcodebuild':\n xcode_con...
<|body_start_0|> settings = self.settings build_type = settings['build_type'] build_target = settings.get('build_target', '').strip() if build_type == 'cmake': build_type = 'make' cmd = [config['exe_paths']['infer'], 'run', '--no-progress-bar', '--'] + shlex.split(bui...
Review Bot tool to run FBInfer.
FBInferTool
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FBInferTool: """Review Bot tool to run FBInfer.""" def build_base_command(self, **kwargs): """Build the base command line used to review files. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unicode: The base command line.""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_024463
10,998
permissive
[ { "docstring": "Build the base command line used to review files. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unicode: The base command line.", "name": "build_base_command", "signature": "def build_base_command(self, **kwargs)" }, { "docstring": "Perform a revie...
4
null
Implement the Python class `FBInferTool` described below. Class description: Review Bot tool to run FBInfer. Method signatures and docstrings: - def build_base_command(self, **kwargs): Build the base command line used to review files. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unico...
Implement the Python class `FBInferTool` described below. Class description: Review Bot tool to run FBInfer. Method signatures and docstrings: - def build_base_command(self, **kwargs): Build the base command line used to review files. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unico...
b59b566e127b5ef1b08f3189f1aa0194b7437d94
<|skeleton|> class FBInferTool: """Review Bot tool to run FBInfer.""" def build_base_command(self, **kwargs): """Build the base command line used to review files. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unicode: The base command line.""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FBInferTool: """Review Bot tool to run FBInfer.""" def build_base_command(self, **kwargs): """Build the base command line used to review files. Args: **kwargs (dict, unused): Additional keyword arguments. Returns: list of unicode: The base command line.""" settings = self.settings ...
the_stack_v2_python_sparse
bot/reviewbot/tools/fbinfer.py
reviewboard/ReviewBot
train
110
e8c704b87c9c494d65f8048b9a6c1e036f7adbee
[ "product_config = ProductConfig.objects.get(pk=pk)\nif product_config.product_stautus != new_status:\n detail_dict = {'word': 'product_stautus', 'name': '产品配置状态', 'new_value': dict(PRODUCT_STATUS)[new_status], 'old_value': dict(PRODUCT_STATUS)[product_config.product_stautus], 'log_id': log_id}\n DetailLog.obj...
<|body_start_0|> product_config = ProductConfig.objects.get(pk=pk) if product_config.product_stautus != new_status: detail_dict = {'word': 'product_stautus', 'name': '产品配置状态', 'new_value': dict(PRODUCT_STATUS)[new_status], 'old_value': dict(PRODUCT_STATUS)[product_config.product_stautus], 'l...
ProConfigLog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProConfigLog: def status_change(self, pk, log_id, new_status): """产品配置状态记录 :param pk: :param log_id: :param new_status: :return:""" <|body_0|> def porconfig_apply(self, pk, data, log_id): """产品配置修改 :param pk: :param data: 修改后的数据 :param log_id: :return:""" <|b...
stack_v2_sparse_classes_36k_train_024464
30,222
no_license
[ { "docstring": "产品配置状态记录 :param pk: :param log_id: :param new_status: :return:", "name": "status_change", "signature": "def status_change(self, pk, log_id, new_status)" }, { "docstring": "产品配置修改 :param pk: :param data: 修改后的数据 :param log_id: :return:", "name": "porconfig_apply", "signatur...
2
null
Implement the Python class `ProConfigLog` described below. Class description: Implement the ProConfigLog class. Method signatures and docstrings: - def status_change(self, pk, log_id, new_status): 产品配置状态记录 :param pk: :param log_id: :param new_status: :return: - def porconfig_apply(self, pk, data, log_id): 产品配置修改 :par...
Implement the Python class `ProConfigLog` described below. Class description: Implement the ProConfigLog class. Method signatures and docstrings: - def status_change(self, pk, log_id, new_status): 产品配置状态记录 :param pk: :param log_id: :param new_status: :return: - def porconfig_apply(self, pk, data, log_id): 产品配置修改 :par...
ff4f09a00a0efb4571fa90c6b32f8b55ce2aa6c4
<|skeleton|> class ProConfigLog: def status_change(self, pk, log_id, new_status): """产品配置状态记录 :param pk: :param log_id: :param new_status: :return:""" <|body_0|> def porconfig_apply(self, pk, data, log_id): """产品配置修改 :param pk: :param data: 修改后的数据 :param log_id: :return:""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProConfigLog: def status_change(self, pk, log_id, new_status): """产品配置状态记录 :param pk: :param log_id: :param new_status: :return:""" product_config = ProductConfig.objects.get(pk=pk) if product_config.product_stautus != new_status: detail_dict = {'word': 'product_stautus', '...
the_stack_v2_python_sparse
applications/log_manage/views.py
z991/neng_backend
train
1
ee2c16e77bae27854b7f286bbcd6490cc65b4467
[ "dict_ql = {}\ndict_qu = {}\ncount = int_fmt % 10\nfor i in range(0, count):\n str_qu = str_quanta[i * 3:(i + 1) * 3]\n str_ql = str_quanta[(i + count) * 3:(i + count + 1) * 3]\n headers = quanta_headers(int_fmt)\n dict_ql[headers[i]] = int(str_ql)\n dict_qu[headers[i]] = int(str_qu)\nreturn (dict_qu...
<|body_start_0|> dict_ql = {} dict_qu = {} count = int_fmt % 10 for i in range(0, count): str_qu = str_quanta[i * 3:(i + 1) * 3] str_ql = str_quanta[(i + count) * 3:(i + count + 1) * 3] headers = quanta_headers(int_fmt) dict_ql[headers[i]] ...
Manages entries of .lin files
LinConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinConverter: """Manages entries of .lin files""" def __read_quanta(str_quanta, int_fmt): """convert quanta from .cat to dict returns (dict_upper, dict_lower)""" <|body_0|> def __write_quanta(dict_qu, dict_ql, int_fmt): """convert quanta from (dict,dict) to .cat ...
stack_v2_sparse_classes_36k_train_024465
11,597
no_license
[ { "docstring": "convert quanta from .cat to dict returns (dict_upper, dict_lower)", "name": "__read_quanta", "signature": "def __read_quanta(str_quanta, int_fmt)" }, { "docstring": "convert quanta from (dict,dict) to .cat str", "name": "__write_quanta", "signature": "def __write_quanta(d...
4
stack_v2_sparse_classes_30k_train_015934
Implement the Python class `LinConverter` described below. Class description: Manages entries of .lin files Method signatures and docstrings: - def __read_quanta(str_quanta, int_fmt): convert quanta from .cat to dict returns (dict_upper, dict_lower) - def __write_quanta(dict_qu, dict_ql, int_fmt): convert quanta from...
Implement the Python class `LinConverter` described below. Class description: Manages entries of .lin files Method signatures and docstrings: - def __read_quanta(str_quanta, int_fmt): convert quanta from .cat to dict returns (dict_upper, dict_lower) - def __write_quanta(dict_qu, dict_ql, int_fmt): convert quanta from...
57bda76b211c8efd3bd24bd2895bd57ea855003e
<|skeleton|> class LinConverter: """Manages entries of .lin files""" def __read_quanta(str_quanta, int_fmt): """convert quanta from .cat to dict returns (dict_upper, dict_lower)""" <|body_0|> def __write_quanta(dict_qu, dict_ql, int_fmt): """convert quanta from (dict,dict) to .cat ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinConverter: """Manages entries of .lin files""" def __read_quanta(str_quanta, int_fmt): """convert quanta from .cat to dict returns (dict_upper, dict_lower)""" dict_ql = {} dict_qu = {} count = int_fmt % 10 for i in range(0, count): str_qu = str_quant...
the_stack_v2_python_sparse
pickett/converters.py
kiraboris/scanner
train
0
0bc1995012f335dc23954956458b64443310c7f2
[ "super(AdamWeightDecayOptimizer, self).__init__(False, name)\nself.learning_rate = learning_rate\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay\nself.pretrained_param_names = pretrained_param...
<|body_start_0|> super(AdamWeightDecayOptimizer, self).__init__(False, name) self.learning_rate = learning_rate self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_from_weight_decay = exclude_fro...
A basic Adam optimizer that includes "correct" L2 weight decay.
AdamWeightDecayOptimizer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='A...
stack_v2_sparse_classes_36k_train_024466
10,781
permissive
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='AdamWeightDecayOpt...
4
null
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
ac9447064195e06de48cc91ff642f7fffa28ffe8
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='AdamWeightDeca...
the_stack_v2_python_sparse
language/xsp/model/adam_weight_decay.py
google-research/language
train
1,567
69ca788be8767ce87ae06f432912259dc4651fc2
[ "user = UserProfile.objects.filter(Q(email=email) | Q(username=username)).first()\nif user is None:\n raise AuthenticationError('Not user found with this email.')\nif not user.is_active:\n raise AuthenticationError('This account is deactivate.')\nif not user.approved:\n raise AuthenticationError('This acco...
<|body_start_0|> user = UserProfile.objects.filter(Q(email=email) | Q(username=username)).first() if user is None: raise AuthenticationError('Not user found with this email.') if not user.is_active: raise AuthenticationError('This account is deactivate.') if not u...
Serializer for the user authentication object.
AuthTokenSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthTokenSerializer: """Serializer for the user authentication object.""" def authenticate_user(self, email: str=None, username: str=None, password: str=None) -> Any: """Authenticate with username and password. Args: email: username: password: Returns: User.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_024467
2,704
no_license
[ { "docstring": "Authenticate with username and password. Args: email: username: password: Returns: User.", "name": "authenticate_user", "signature": "def authenticate_user(self, email: str=None, username: str=None, password: str=None) -> Any" }, { "docstring": "Validate a member with credentials...
2
stack_v2_sparse_classes_30k_train_011220
Implement the Python class `AuthTokenSerializer` described below. Class description: Serializer for the user authentication object. Method signatures and docstrings: - def authenticate_user(self, email: str=None, username: str=None, password: str=None) -> Any: Authenticate with username and password. Args: email: use...
Implement the Python class `AuthTokenSerializer` described below. Class description: Serializer for the user authentication object. Method signatures and docstrings: - def authenticate_user(self, email: str=None, username: str=None, password: str=None) -> Any: Authenticate with username and password. Args: email: use...
47c9a2a3c724589b77299ca33aa60a291ada33ef
<|skeleton|> class AuthTokenSerializer: """Serializer for the user authentication object.""" def authenticate_user(self, email: str=None, username: str=None, password: str=None) -> Any: """Authenticate with username and password. Args: email: username: password: Returns: User.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthTokenSerializer: """Serializer for the user authentication object.""" def authenticate_user(self, email: str=None, username: str=None, password: str=None) -> Any: """Authenticate with username and password. Args: email: username: password: Returns: User.""" user = UserProfile.objects....
the_stack_v2_python_sparse
core/backend/endpoints/user/serializers.py
msadour/german_memo
train
0
6c5a3b06f472a4521768ba3f0f668ec284c646e2
[ "super().__init__()\nself.in_channels = in_channels\nself.hidden_channels = hidden_channels\nself.out_channels = out_channels\nself.forget_bias = forget_bias\npadding = (kernel_size // 2, kernel_size // 2)\nkernel_size = (kernel_size, kernel_size)\nself.conv_w1 = nn.Conv2d(in_channels=in_channels + hidden_channels ...
<|body_start_0|> super().__init__() self.in_channels = in_channels self.hidden_channels = hidden_channels self.out_channels = out_channels self.forget_bias = forget_bias padding = (kernel_size // 2, kernel_size // 2) kernel_size = (kernel_size, kernel_size) ...
CausalLSTM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CausalLSTM: def __init__(self, in_channels: int, hidden_channels: int, out_channels: int, kernel_size: int, forget_bias: float=0.01): """:param in_channels: 输入通道数 :param hidden_channels: 隐藏层通道数 :param out_channels: 输出通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量""" <|body...
stack_v2_sparse_classes_36k_train_024468
3,830
permissive
[ { "docstring": ":param in_channels: 输入通道数 :param hidden_channels: 隐藏层通道数 :param out_channels: 输出通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量", "name": "__init__", "signature": "def __init__(self, in_channels: int, hidden_channels: int, out_channels: int, kernel_size: int, forget_bias: float=0.0...
2
stack_v2_sparse_classes_30k_train_010396
Implement the Python class `CausalLSTM` described below. Class description: Implement the CausalLSTM class. Method signatures and docstrings: - def __init__(self, in_channels: int, hidden_channels: int, out_channels: int, kernel_size: int, forget_bias: float=0.01): :param in_channels: 输入通道数 :param hidden_channels: 隐藏...
Implement the Python class `CausalLSTM` described below. Class description: Implement the CausalLSTM class. Method signatures and docstrings: - def __init__(self, in_channels: int, hidden_channels: int, out_channels: int, kernel_size: int, forget_bias: float=0.01): :param in_channels: 输入通道数 :param hidden_channels: 隐藏...
d8079d6ceb3a41a06552bb3d88298327d0645d57
<|skeleton|> class CausalLSTM: def __init__(self, in_channels: int, hidden_channels: int, out_channels: int, kernel_size: int, forget_bias: float=0.01): """:param in_channels: 输入通道数 :param hidden_channels: 隐藏层通道数 :param out_channels: 输出通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CausalLSTM: def __init__(self, in_channels: int, hidden_channels: int, out_channels: int, kernel_size: int, forget_bias: float=0.01): """:param in_channels: 输入通道数 :param hidden_channels: 隐藏层通道数 :param out_channels: 输出通道数 :param kernel_size: 卷积核尺寸 :param forget_bias: 偏移量""" super().__init__() ...
the_stack_v2_python_sparse
study/models/PredRNNpp/CausalLSTM.py
hechentao/STudy
train
0
a8a6c1d68952704daaa743f5c9df47d31eadfb57
[ "username = self.cleaned_data['username']\nif User.objects.filter(username=username):\n raise forms.ValidationError('Nombre de usuario ya registrado.')\nreturn username", "password = self.cleaned_data['password']\npassword2 = self.cleaned_data['password2']\nif password != password2:\n raise forms.Validation...
<|body_start_0|> username = self.cleaned_data['username'] if User.objects.filter(username=username): raise forms.ValidationError('Nombre de usuario ya registrado.') return username <|end_body_0|> <|body_start_1|> password = self.cleaned_data['password'] password2 = s...
RegistroUserForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistroUserForm: def clean_username(self): """Comprueba que no exista un username igual en la db""" <|body_0|> def clean_password2(self): """Comprueba que password y password2 sean iguales.""" <|body_1|> <|end_skeleton|> <|body_start_0|> username =...
stack_v2_sparse_classes_36k_train_024469
47,643
no_license
[ { "docstring": "Comprueba que no exista un username igual en la db", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Comprueba que password y password2 sean iguales.", "name": "clean_password2", "signature": "def clean_password2(self)" } ]
2
null
Implement the Python class `RegistroUserForm` described below. Class description: Implement the RegistroUserForm class. Method signatures and docstrings: - def clean_username(self): Comprueba que no exista un username igual en la db - def clean_password2(self): Comprueba que password y password2 sean iguales.
Implement the Python class `RegistroUserForm` described below. Class description: Implement the RegistroUserForm class. Method signatures and docstrings: - def clean_username(self): Comprueba que no exista un username igual en la db - def clean_password2(self): Comprueba que password y password2 sean iguales. <|skel...
3e3726ec4af1a665aa22360e15a62134333bf853
<|skeleton|> class RegistroUserForm: def clean_username(self): """Comprueba que no exista un username igual en la db""" <|body_0|> def clean_password2(self): """Comprueba que password y password2 sean iguales.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegistroUserForm: def clean_username(self): """Comprueba que no exista un username igual en la db""" username = self.cleaned_data['username'] if User.objects.filter(username=username): raise forms.ValidationError('Nombre de usuario ya registrado.') return username ...
the_stack_v2_python_sparse
SGMGU/forms.py
marioriguera/egresadosmario
train
0
443482f3c27e976106ae17a09deb3ecf4c8b5dfd
[ "import hashlib\nh = hashlib.sha1(user.password + unicode(user.last_activity) + unicode(user.id)).hexdigest()[::2]\nreturn '%s-%s' % (int_to_base36(user.id), h)", "try:\n ts_b36 = token.split('-')[0]\nexcept ValueError:\n return False\ntry:\n uid = base36_to_int(ts_b36)\nexcept ValueError:\n return Fa...
<|body_start_0|> import hashlib h = hashlib.sha1(user.password + unicode(user.last_activity) + unicode(user.id)).hexdigest()[::2] return '%s-%s' % (int_to_base36(user.id), h) <|end_body_0|> <|body_start_1|> try: ts_b36 = token.split('-')[0] except ValueError: ...
Class for generating tokens during password reset.
PasswordResetTokenGenerator
[ "Apache-2.0", "LicenseRef-scancode-philippe-de-muyter" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordResetTokenGenerator: """Class for generating tokens during password reset.""" def make_token(user): """@parameter{user,User} instance of the User whom Token should be generated for @returns{string} Token with timestamp generated for specified User""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_024470
3,357
permissive
[ { "docstring": "@parameter{user,User} instance of the User whom Token should be generated for @returns{string} Token with timestamp generated for specified User", "name": "make_token", "signature": "def make_token(user)" }, { "docstring": "@parameter{user,User} instance of the User whose Token s...
2
null
Implement the Python class `PasswordResetTokenGenerator` described below. Class description: Class for generating tokens during password reset. Method signatures and docstrings: - def make_token(user): @parameter{user,User} instance of the User whom Token should be generated for @returns{string} Token with timestamp ...
Implement the Python class `PasswordResetTokenGenerator` described below. Class description: Class for generating tokens during password reset. Method signatures and docstrings: - def make_token(user): @parameter{user,User} instance of the User whom Token should be generated for @returns{string} Token with timestamp ...
b2fb9f4318aeb6dde1e8babca32da527943f1fb4
<|skeleton|> class PasswordResetTokenGenerator: """Class for generating tokens during password reset.""" def make_token(user): """@parameter{user,User} instance of the User whom Token should be generated for @returns{string} Token with timestamp generated for specified User""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PasswordResetTokenGenerator: """Class for generating tokens during password reset.""" def make_token(user): """@parameter{user,User} instance of the User whom Token should be generated for @returns{string} Token with timestamp generated for specified User""" import hashlib h = has...
the_stack_v2_python_sparse
dev_cloud/core/utils/registration/recovery_password/token_generator.py
Dev-Cloud-Platform/Dev-Cloud
train
1
7937eab41ff5b687237bc2a7b6b9837ccb63c797
[ "super().__init__(**kwargs)\nself.problem_reference = AlphaBetaAgentProblem\nself.problem = None", "grid, remaining_gas = perception\nstate = (grid, self.player_number, remaining_gas, remaining_gas, 0, 0)\nreturn state", "self.initial_state = self.__perception_to_state(perception)\nself.problem = self.problem_r...
<|body_start_0|> super().__init__(**kwargs) self.problem_reference = AlphaBetaAgentProblem self.problem = None <|end_body_0|> <|body_start_1|> grid, remaining_gas = perception state = (grid, self.player_number, remaining_gas, remaining_gas, 0, 0) return state <|end_body_...
The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter.
AlphaBetaAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaBetaAgent: """The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter.""" def __init__(self, **kwargs): """Like some other agents we pr...
stack_v2_sparse_classes_36k_train_024471
44,047
permissive
[ { "docstring": "Like some other agents we provided, here we also initialize the reference to the problem and its instantiation that will be set by get_action.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Converts a perception into a start to be used by the...
3
stack_v2_sparse_classes_30k_train_013157
Implement the Python class `AlphaBetaAgent` described below. Class description: The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter. Method signatures and docstrings: - d...
Implement the Python class `AlphaBetaAgent` described below. Class description: The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter. Method signatures and docstrings: - d...
89b67b61817500aad359c64c7f43fcc2f1ef0698
<|skeleton|> class AlphaBetaAgent: """The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter.""" def __init__(self, **kwargs): """Like some other agents we pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlphaBetaAgent: """The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter.""" def __init__(self, **kwargs): """Like some other agents we provided, here ...
the_stack_v2_python_sparse
EP2/ep2.py
ricardokojo/MAC0425-2019
train
1
58866ee60673eaf9f16a9b87092f67b90f6198da
[ "Report.__init__(self, database, options, user)\nself._user = user\nmenu = options.menu\nself.title_string = menu.get_option_by_name('title').get_value()\nself.image_size = menu.get_option_by_name('imgsize').get_value()\nself.subtitle_string = menu.get_option_by_name('subtitle').get_value()\nself.footer_string = me...
<|body_start_0|> Report.__init__(self, database, options, user) self._user = user menu = options.menu self.title_string = menu.get_option_by_name('title').get_value() self.image_size = menu.get_option_by_name('imgsize').get_value() self.subtitle_string = menu.get_option_b...
This report class generates a title page for a book.
SimpleBookTitle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleBookTitle: """This report class generates a title page for a book.""" def __init__(self, database, options, user): """Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for t...
stack_v2_sparse_classes_36k_train_024472
7,532
no_license
[ { "docstring": "Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance This report needs the following parameters (class variables) that come in the options class...
2
null
Implement the Python class `SimpleBookTitle` described below. Class description: This report class generates a title page for a book. Method signatures and docstrings: - def __init__(self, database, options, user): Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS databa...
Implement the Python class `SimpleBookTitle` described below. Class description: This report class generates a title page for a book. Method signatures and docstrings: - def __init__(self, database, options, user): Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS databa...
0c79561bed7ff42c88714edbc85197fa9235e188
<|skeleton|> class SimpleBookTitle: """This report class generates a title page for a book.""" def __init__(self, database, options, user): """Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleBookTitle: """This report class generates a title page for a book.""" def __init__(self, database, options, user): """Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report us...
the_stack_v2_python_sparse
plugins/textreport/simplebooktitle.py
balrok/gramps_addon
train
2
bda5306d0e866cfb26711576c9d15bde4457cb9b
[ "item = {'id': self.next_item_id, 'checked': False, 'description': item_description}\nself.checklist_items['%d' % self.next_item_id] = item\nself.next_item_id += 1\nself.save()\nreturn item", "if isinstance(item_id, int):\n item_id = '%d' % item_id\nif item_id in self.checklist_items:\n item = self.checklis...
<|body_start_0|> item = {'id': self.next_item_id, 'checked': False, 'description': item_description} self.checklist_items['%d' % self.next_item_id] = item self.next_item_id += 1 self.save() return item <|end_body_0|> <|body_start_1|> if isinstance(item_id, int): ...
A checklist is a list of items to keep track of during a review. Items are stored in JSON format in the following manner: :: checklist_items: { id: { 'id': '123', 'checked': true, 'description': 'Remember to look for bugs' }, ... }
ReviewChecklist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewChecklist: """A checklist is a list of items to keep track of during a review. Items are stored in JSON format in the following manner: :: checklist_items: { id: { 'id': '123', 'checked': true, 'description': 'Remember to look for bugs' }, ... }""" def add_item(self, item_description):...
stack_v2_sparse_classes_36k_train_024473
3,412
no_license
[ { "docstring": "Add and return the new checklist item. Args: item_description (str): The text for the checklist item. Returns: dict: The newly-added checklist item.", "name": "add_item", "signature": "def add_item(self, item_description)" }, { "docstring": "Modify and return the checklist item s...
3
stack_v2_sparse_classes_30k_train_014192
Implement the Python class `ReviewChecklist` described below. Class description: A checklist is a list of items to keep track of during a review. Items are stored in JSON format in the following manner: :: checklist_items: { id: { 'id': '123', 'checked': true, 'description': 'Remember to look for bugs' }, ... } Metho...
Implement the Python class `ReviewChecklist` described below. Class description: A checklist is a list of items to keep track of during a review. Items are stored in JSON format in the following manner: :: checklist_items: { id: { 'id': '123', 'checked': true, 'description': 'Remember to look for bugs' }, ... } Metho...
c192db4557a48b46d43821497ea92d79bbe15f6d
<|skeleton|> class ReviewChecklist: """A checklist is a list of items to keep track of during a review. Items are stored in JSON format in the following manner: :: checklist_items: { id: { 'id': '123', 'checked': true, 'description': 'Remember to look for bugs' }, ... }""" def add_item(self, item_description):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReviewChecklist: """A checklist is a list of items to keep track of during a review. Items are stored in JSON format in the following manner: :: checklist_items: { id: { 'id': '123', 'checked': true, 'description': 'Remember to look for bugs' }, ... }""" def add_item(self, item_description): """A...
the_stack_v2_python_sparse
rbchecklist/rbchecklist/models.py
reviewboard/rb-extension-pack
train
19
0d3b1c5c4a3d355b11dd903fd4a0ef8daff4389a
[ "result = []\nidx_map = {}\nsum_set = set()\nfor i in range(2, len(nums)):\n pairs = self.twoSum(nums[:i], -nums[i])\n for pair in pairs:\n tmp_list = [pair[0], pair[1], nums[i]]\n tmp_list.sort()\n s = ','.join((str(val) for val in tmp_list))\n if s not in sum_set:\n su...
<|body_start_0|> result = [] idx_map = {} sum_set = set() for i in range(2, len(nums)): pairs = self.twoSum(nums[:i], -nums[i]) for pair in pairs: tmp_list = [pair[0], pair[1], nums[i]] tmp_list.sort() s = ','.join((...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = ...
stack_v2_sparse_classes_36k_train_024474
4,226
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_013007
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] <|skeleton|> ...
4b3944ae13ccf20e9df252f3c434f6600878293c
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" result = [] idx_map = {} sum_set = set() for i in range(2, len(nums)): pairs = self.twoSum(nums[:i], -nums[i]) for pair in pairs: tmp_list = [...
the_stack_v2_python_sparse
3sum.py
jingjinghaha/LeetCode
train
0
e64e4d49439822cd34fb99dc9c3afaac3185e65f
[ "self.pin = pin\nself.pin.setmode(INPUT)\nlogging.info('re_recept_io created attached on %s' % self.pin)", "timeout = time.time() + timeout\nwhile self.pin.get() == HIGH:\n if time.time() > timeout:\n return None\nnow = time.time()\nwhile self.pin.get() == LOW:\n if time.time() > timeout:\n re...
<|body_start_0|> self.pin = pin self.pin.setmode(INPUT) logging.info('re_recept_io created attached on %s' % self.pin) <|end_body_0|> <|body_start_1|> timeout = time.time() + timeout while self.pin.get() == HIGH: if time.time() > timeout: return None ...
Recepteur Radio Fréquence
rf_recept_io
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class rf_recept_io: """Recepteur Radio Fréquence""" def __init__(self, pin): """Initialisation -pin pin_io pin data du recepteur RF""" <|body_0|> def pulseIn(self, timeout=1): """Lecture d'une pulsation Renvoie la durée de la pulsation (temps à LOW)""" <|body_1...
stack_v2_sparse_classes_36k_train_024475
7,123
permissive
[ { "docstring": "Initialisation -pin pin_io pin data du recepteur RF", "name": "__init__", "signature": "def __init__(self, pin)" }, { "docstring": "Lecture d'une pulsation Renvoie la durée de la pulsation (temps à LOW)", "name": "pulseIn", "signature": "def pulseIn(self, timeout=1)" },...
5
null
Implement the Python class `rf_recept_io` described below. Class description: Recepteur Radio Fréquence Method signatures and docstrings: - def __init__(self, pin): Initialisation -pin pin_io pin data du recepteur RF - def pulseIn(self, timeout=1): Lecture d'une pulsation Renvoie la durée de la pulsation (temps à LOW...
Implement the Python class `rf_recept_io` described below. Class description: Recepteur Radio Fréquence Method signatures and docstrings: - def __init__(self, pin): Initialisation -pin pin_io pin data du recepteur RF - def pulseIn(self, timeout=1): Lecture d'une pulsation Renvoie la durée de la pulsation (temps à LOW...
46c4f9369964b2f9108f2776bf74f24ccdc71e7f
<|skeleton|> class rf_recept_io: """Recepteur Radio Fréquence""" def __init__(self, pin): """Initialisation -pin pin_io pin data du recepteur RF""" <|body_0|> def pulseIn(self, timeout=1): """Lecture d'une pulsation Renvoie la durée de la pulsation (temps à LOW)""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class rf_recept_io: """Recepteur Radio Fréquence""" def __init__(self, pin): """Initialisation -pin pin_io pin data du recepteur RF""" self.pin = pin self.pin.setmode(INPUT) logging.info('re_recept_io created attached on %s' % self.pin) def pulseIn(self, timeout=1): ...
the_stack_v2_python_sparse
FGPIO/rf_recept_io.py
FredThx/FGPIO
train
0
7d467e6ae5580e94ec26e8ac819ab828759af036
[ "def memoize(i, j):\n if i == 0 or j == 0:\n return cache[i][j]\n if cache[i][j] != 0:\n return cache[i][j]\n cache[i][j] = min(memoize(i, j - 1), memoize(i - 1, j)) + grid[i][j]\n return cache[i][j]\nm, n = (len(grid), len(grid[0]))\nif m <= 0 or n <= 0:\n return 0\ncache = [[0 for _ i...
<|body_start_0|> def memoize(i, j): if i == 0 or j == 0: return cache[i][j] if cache[i][j] != 0: return cache[i][j] cache[i][j] = min(memoize(i, j - 1), memoize(i - 1, j)) + grid[i][j] return cache[i][j] m, n = (len(grid), l...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, grid: List[List[int]]) -> int: """状态转移方程:自顶向下 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]""" <|body_0|> def minPathSum1(self, grid: List[List[int]]) -> int: """状态转移方程:自底向上 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]""" ...
stack_v2_sparse_classes_36k_train_024476
4,225
permissive
[ { "docstring": "状态转移方程:自顶向下 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]", "name": "minPathSum", "signature": "def minPathSum(self, grid: List[List[int]]) -> int" }, { "docstring": "状态转移方程:自底向上 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]", "name": "minPathSum1", "signature...
4
stack_v2_sparse_classes_30k_test_001084
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid: List[List[int]]) -> int: 状态转移方程:自顶向下 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j] - def minPathSum1(self, grid: List[List[int]]) -> int: 状态转移方程:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid: List[List[int]]) -> int: 状态转移方程:自顶向下 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j] - def minPathSum1(self, grid: List[List[int]]) -> int: 状态转移方程:...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def minPathSum(self, grid: List[List[int]]) -> int: """状态转移方程:自顶向下 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]""" <|body_0|> def minPathSum1(self, grid: List[List[int]]) -> int: """状态转移方程:自底向上 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minPathSum(self, grid: List[List[int]]) -> int: """状态转移方程:自顶向下 dp[m][n] = min(dp[m][n-1], dp[m-1][n]) + grid[i][j]""" def memoize(i, j): if i == 0 or j == 0: return cache[i][j] if cache[i][j] != 0: return cache[i][j] ...
the_stack_v2_python_sparse
64-minimum-path-sum.py
yuenliou/leetcode
train
0
53df62dd3d3b94ed5e2f30602c9400c8a9033310
[ "self.nums, prev = (list(), 0)\nfor num in nums:\n prev += num\n self.nums.append(prev)", "if i > 0:\n return self.nums[j] - self.nums[i - 1]\nelse:\n return self.nums[j]" ]
<|body_start_0|> self.nums, prev = (list(), 0) for num in nums: prev += num self.nums.append(prev) <|end_body_0|> <|body_start_1|> if i > 0: return self.nums[j] - self.nums[i - 1] else: return self.nums[j] <|end_body_1|>
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nums, prev = (list(), 0) for num in nums: ...
stack_v2_sparse_classes_36k_train_024477
1,007
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
stack_v2_sparse_classes_30k_train_005907
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
6e4894c2d80413b13dc247d1783afd709ad984c8
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.nums, prev = (list(), 0) for num in nums: prev += num self.nums.append(prev) def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" if i > 0: ret...
the_stack_v2_python_sparse
leet_code303.py
tejamupparaju/LeetCode_Python
train
2
df4d3c58825ba83a47f08c1c2dac58d23b94e7aa
[ "n = len(nums)\n\n@lru_cache(None)\ndef dfs(total):\n if total > target:\n return 0\n if total == target:\n return 1\n result = 0\n for num in nums:\n result += dfs(total + num)\n return result\nreturn dfs(0)", "dp = [0] * (target + 1)\ndp[0] = 1\nfor i in range(1, target + 1):...
<|body_start_0|> n = len(nums) @lru_cache(None) def dfs(total): if total > target: return 0 if total == target: return 1 result = 0 for num in nums: result += dfs(total + num) return resu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" <|body_0|> def combinationSum4(self, nums: List[int], target: int) -> int: """DP, Time: O(n*target), Space: O(target)""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_024478
980
no_license
[ { "docstring": "DFS", "name": "combinationSum4", "signature": "def combinationSum4(self, nums: List[int], target: int) -> int" }, { "docstring": "DP, Time: O(n*target), Space: O(target)", "name": "combinationSum4", "signature": "def combinationSum4(self, nums: List[int], target: int) -> ...
2
stack_v2_sparse_classes_30k_train_002812
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums: List[int], target: int) -> int: DFS - def combinationSum4(self, nums: List[int], target: int) -> int: DP, Time: O(n*target), Space: O(target)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums: List[int], target: int) -> int: DFS - def combinationSum4(self, nums: List[int], target: int) -> int: DP, Time: O(n*target), Space: O(target) <|s...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" <|body_0|> def combinationSum4(self, nums: List[int], target: int) -> int: """DP, Time: O(n*target), Space: O(target)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" n = len(nums) @lru_cache(None) def dfs(total): if total > target: return 0 if total == target: return 1 result = 0 ...
the_stack_v2_python_sparse
python/377-Combination Sum IV.py
cwza/leetcode
train
0
a388a3252656e046f945c827b53f38990382404e
[ "def encode_extra_types(obj):\n \"\"\"MessagePack hook to serialize extra types.\n\n The recipe took from the MessagePack for Python docs:\n https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type\n\n Supported types:\n - Django models (through `...
<|body_start_0|> def encode_extra_types(obj): """MessagePack hook to serialize extra types. The recipe took from the MessagePack for Python docs: https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type Supported typ...
Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serialization: https://docs.djangoproject.com/en/...
Serializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Serializer: """Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serializati...
stack_v2_sparse_classes_36k_train_024479
3,850
permissive
[ { "docstring": "Serialize the `data`.", "name": "serialize", "signature": "def serialize(data)" }, { "docstring": "Deserialize the `data`.", "name": "deserialize", "signature": "def deserialize(data)" } ]
2
stack_v2_sparse_classes_30k_train_003575
Implement the Python class `Serializer` described below. Class description: Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utiliti...
Implement the Python class `Serializer` described below. Class description: Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utiliti...
09a2ffdde45a1553abd09b5b3e595402b6e6c9b1
<|skeleton|> class Serializer: """Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serializati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Serializer: """Serialize/deserialize Python collection with Django models. Serialize/deserialize the data with the MessagePack like Redis Channels layer backend does. If `data` contains Django models, then it is serialized by the Django serialization utilities. For details see: Django serialization: https://d...
the_stack_v2_python_sparse
channels_graphql_ws/serializer.py
datadvance/DjangoChannelsGraphqlWs
train
295
cc68dacb7911c51d9fbabba9f8059b54d4fbe569
[ "driver = SeleniumDriver(self.driver)\noutletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath())\nfreqInputElem = '//div[8]/div[2]/form[2]/p[2]/input'\nenableBtn = '//div[8]/div[2]/form[1]/button[2]'\nip_addr_ping = '//div[8]/div[2]/form[2]/p[1]/input'\nfrequency = 0\nfor outletBox in outletBoxList:\n ...
<|body_start_0|> driver = SeleniumDriver(self.driver) outletBoxList = self.driver.find_elements_by_xpath(outlet_box_xpath()) freqInputElem = '//div[8]/div[2]/form[2]/p[2]/input' enableBtn = '//div[8]/div[2]/form[1]/button[2]' ip_addr_ping = '//div[8]/div[2]/form[2]/p[1]/input' ...
OutletFrequency
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutletFrequency: def test_frequency_zero_input(self): """Set the Frequency to zero (0) Verify that a warning notification appears letting you know the valid range of cycle delay values Verify that the input has a red border to show an error.""" <|body_0|> def test_frequency_...
stack_v2_sparse_classes_36k_train_024480
2,773
no_license
[ { "docstring": "Set the Frequency to zero (0) Verify that a warning notification appears letting you know the valid range of cycle delay values Verify that the input has a red border to show an error.", "name": "test_frequency_zero_input", "signature": "def test_frequency_zero_input(self)" }, { ...
2
stack_v2_sparse_classes_30k_train_015232
Implement the Python class `OutletFrequency` described below. Class description: Implement the OutletFrequency class. Method signatures and docstrings: - def test_frequency_zero_input(self): Set the Frequency to zero (0) Verify that a warning notification appears letting you know the valid range of cycle delay values...
Implement the Python class `OutletFrequency` described below. Class description: Implement the OutletFrequency class. Method signatures and docstrings: - def test_frequency_zero_input(self): Set the Frequency to zero (0) Verify that a warning notification appears letting you know the valid range of cycle delay values...
62a122ad98b85e0cf3c929d40c1d9699badc4f89
<|skeleton|> class OutletFrequency: def test_frequency_zero_input(self): """Set the Frequency to zero (0) Verify that a warning notification appears letting you know the valid range of cycle delay values Verify that the input has a red border to show an error.""" <|body_0|> def test_frequency_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutletFrequency: def test_frequency_zero_input(self): """Set the Frequency to zero (0) Verify that a warning notification appears letting you know the valid range of cycle delay values Verify that the input has a red border to show an error.""" driver = SeleniumDriver(self.driver) outl...
the_stack_v2_python_sparse
Outlet-RackLink_Tests/Outlets-Test/outlet_frequency_test.py
barrosg1/rlnk-select-test-automation
train
0
ff4f6e2dc0077c13b563c1bf64c67f0eb576480e
[ "super(UpdatePoliciesExecuteWebhookTest, self).setUp()\nself.cooldown = 1\nself.create_group_response = self.autoscale_behaviors.create_scaling_group_given(gc_min_entities=self.gc_min_entities_alt, gc_cooldown=0)\nself.group = self.create_group_response.entity\nself.policy_up = {'change': 2, 'cooldown': self.cooldo...
<|body_start_0|> super(UpdatePoliciesExecuteWebhookTest, self).setUp() self.cooldown = 1 self.create_group_response = self.autoscale_behaviors.create_scaling_group_given(gc_min_entities=self.gc_min_entities_alt, gc_cooldown=0) self.group = self.create_group_response.entity self.p...
System tests to verify executing webhooks for updated scaling policies.
UpdatePoliciesExecuteWebhookTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdatePoliciesExecuteWebhookTest: """System tests to verify executing webhooks for updated scaling policies.""" def setUp(self): """Create a scaling group with min entities > 0, scale up with cooldown 1 sec""" <|body_0|> def test_scale_up_execute_webhook(self): "...
stack_v2_sparse_classes_36k_train_024481
6,525
permissive
[ { "docstring": "Create a scaling group with min entities > 0, scale up with cooldown 1 sec", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Update a scale up policy and verify execution of such a policy using its webhook", "name": "test_scale_up_execute_webhook", "sig...
6
null
Implement the Python class `UpdatePoliciesExecuteWebhookTest` described below. Class description: System tests to verify executing webhooks for updated scaling policies. Method signatures and docstrings: - def setUp(self): Create a scaling group with min entities > 0, scale up with cooldown 1 sec - def test_scale_up_...
Implement the Python class `UpdatePoliciesExecuteWebhookTest` described below. Class description: System tests to verify executing webhooks for updated scaling policies. Method signatures and docstrings: - def setUp(self): Create a scaling group with min entities > 0, scale up with cooldown 1 sec - def test_scale_up_...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class UpdatePoliciesExecuteWebhookTest: """System tests to verify executing webhooks for updated scaling policies.""" def setUp(self): """Create a scaling group with min entities > 0, scale up with cooldown 1 sec""" <|body_0|> def test_scale_up_execute_webhook(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdatePoliciesExecuteWebhookTest: """System tests to verify executing webhooks for updated scaling policies.""" def setUp(self): """Create a scaling group with min entities > 0, scale up with cooldown 1 sec""" super(UpdatePoliciesExecuteWebhookTest, self).setUp() self.cooldown = 1...
the_stack_v2_python_sparse
autoscale_cloudroast/test_repo/autoscale/system/policies/test_system_update_policy_execute_webhook.py
rackerlabs/otter
train
20
275bd4d23db2e240d10f0672cd793d34bbb19ee6
[ "inline_response = InlineResponse()\ninline_response.new_index, inline_response.new_string, inline_response.new_string_unresolved = (inline_request.next_index + 1, '', '')\nif inline_response.new_index >= len(inline_request.source_text) or inline_request.source_text[inline_response.new_index] == ParserHelper.newlin...
<|body_start_0|> inline_response = InlineResponse() inline_response.new_index, inline_response.new_string, inline_response.new_string_unresolved = (inline_request.next_index + 1, '', '') if inline_response.new_index >= len(inline_request.source_text) or inline_request.source_text[inline_response...
Class to help with the parsing of backslash inline elements.
InlineBackslashHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InlineBackslashHelper: """Class to help with the parsing of backslash inline elements.""" def handle_inline_backslash(inline_request: InlineRequest, add_text_signature: bool=True) -> InlineResponse: """Handle the inline case of having a backslash.""" <|body_0|> def handl...
stack_v2_sparse_classes_36k_train_024482
4,904
permissive
[ { "docstring": "Handle the inline case of having a backslash.", "name": "handle_inline_backslash", "signature": "def handle_inline_backslash(inline_request: InlineRequest, add_text_signature: bool=True) -> InlineResponse" }, { "docstring": "Handle the processing of backslashes for anything other...
2
stack_v2_sparse_classes_30k_train_021052
Implement the Python class `InlineBackslashHelper` described below. Class description: Class to help with the parsing of backslash inline elements. Method signatures and docstrings: - def handle_inline_backslash(inline_request: InlineRequest, add_text_signature: bool=True) -> InlineResponse: Handle the inline case of...
Implement the Python class `InlineBackslashHelper` described below. Class description: Class to help with the parsing of backslash inline elements. Method signatures and docstrings: - def handle_inline_backslash(inline_request: InlineRequest, add_text_signature: bool=True) -> InlineResponse: Handle the inline case of...
2b5f72910ca0a7dfab022bc9b037bb1aeab9fe77
<|skeleton|> class InlineBackslashHelper: """Class to help with the parsing of backslash inline elements.""" def handle_inline_backslash(inline_request: InlineRequest, add_text_signature: bool=True) -> InlineResponse: """Handle the inline case of having a backslash.""" <|body_0|> def handl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InlineBackslashHelper: """Class to help with the parsing of backslash inline elements.""" def handle_inline_backslash(inline_request: InlineRequest, add_text_signature: bool=True) -> InlineResponse: """Handle the inline case of having a backslash.""" inline_response = InlineResponse() ...
the_stack_v2_python_sparse
pymarkdown/inline/inline_backslash_helper.py
jackdewinter/pymarkdown
train
43
1e413ecc1e6295cae223887a236bb81c47fbdbbc
[ "if not isinstance(estimator, PropensityEstimator):\n raise TypeError(f'PropensityPredictor must be initialized with PropensityEstimator. Received ({type(estimator)}) instead.')\nsuper().__init__(estimator)", "propensity = self.estimator.compute_propensity(X, a, treatment_values=a.max())\npropensity_matrix = s...
<|body_start_0|> if not isinstance(estimator, PropensityEstimator): raise TypeError(f'PropensityPredictor must be initialized with PropensityEstimator. Received ({type(estimator)}) instead.') super().__init__(estimator) <|end_body_0|> <|body_start_1|> propensity = self.estimator.com...
Generate evaluation predictions for PropensityEstimator models.
PropensityPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropensityPredictor: """Generate evaluation predictions for PropensityEstimator models.""" def __init__(self, estimator): """Args: estimator (PropensityEstimator):""" <|body_0|> def predict(self, X, a): """Predict on data. Args: X (pd.DataFrame): Covariates. a (p...
stack_v2_sparse_classes_36k_train_024483
8,664
permissive
[ { "docstring": "Args: estimator (PropensityEstimator):", "name": "__init__", "signature": "def __init__(self, estimator)" }, { "docstring": "Predict on data. Args: X (pd.DataFrame): Covariates. a (pd.Series): Target variable - treatment assignment Returns: PropensityEvaluatorPredictions", "n...
2
stack_v2_sparse_classes_30k_train_015351
Implement the Python class `PropensityPredictor` described below. Class description: Generate evaluation predictions for PropensityEstimator models. Method signatures and docstrings: - def __init__(self, estimator): Args: estimator (PropensityEstimator): - def predict(self, X, a): Predict on data. Args: X (pd.DataFra...
Implement the Python class `PropensityPredictor` described below. Class description: Generate evaluation predictions for PropensityEstimator models. Method signatures and docstrings: - def __init__(self, estimator): Args: estimator (PropensityEstimator): - def predict(self, X, a): Predict on data. Args: X (pd.DataFra...
9f0ddb4696d580cf0a529a6c6ce98b40b34e3796
<|skeleton|> class PropensityPredictor: """Generate evaluation predictions for PropensityEstimator models.""" def __init__(self, estimator): """Args: estimator (PropensityEstimator):""" <|body_0|> def predict(self, X, a): """Predict on data. Args: X (pd.DataFrame): Covariates. a (p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PropensityPredictor: """Generate evaluation predictions for PropensityEstimator models.""" def __init__(self, estimator): """Args: estimator (PropensityEstimator):""" if not isinstance(estimator, PropensityEstimator): raise TypeError(f'PropensityPredictor must be initialized w...
the_stack_v2_python_sparse
causallib/evaluation/predictor.py
vishalbelsare/causallib
train
0
301d75a534aea9eefb43b223f8f8041d56b2cd13
[ "if not root:\n return None\nleft = self.invertTree(root.left)\nright = self.invertTree(root.right)\nroot.left = right\nroot.right = left\nreturn root", "if not root:\n return None\nq = deque([root])\nwhile len(q) > 0:\n node = q.popleft()\n temp = node.left\n node.left = node.right\n node.right...
<|body_start_0|> if not root: return None left = self.invertTree(root.left) right = self.invertTree(root.right) root.left = right root.right = left return root <|end_body_0|> <|body_start_1|> if not root: return None q = deque([roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode Recursive solution""" <|body_0|> def invertTree1(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_024484
1,056
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode Recursive solution", "name": "invertTree", "signature": "def invertTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree1", "signature": "def invertTree1(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_015265
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode Recursive solution - def invertTree1(self, root): :type root: TreeNode :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode Recursive solution - def invertTree1(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> class Solu...
385ca03d51c8892eccf9ca5b920158d569edc375
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode Recursive solution""" <|body_0|> def invertTree1(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode Recursive solution""" if not root: return None left = self.invertTree(root.left) right = self.invertTree(root.right) root.left = right root.right = left return roo...
the_stack_v2_python_sparse
Leetcode/BSTQuestions/invertbinarytree.py
nanaboat/data-structures
train
0
2561a14ad041f5c5ebb5b87554359e6d76aa71dd
[ "if not nums:\n return 0\nres = nums[0] + self.rob1(nums[2:-1])\nreturn max(res, self.rob1(nums[1:]))", "if len(nums) == 0:\n return 0\nif len(nums) == 1:\n return nums[0]\nlist = [nums[0], max(nums[0], nums[1])]\nfor x in nums[2:]:\n list = [list[1], max(list[0] + x, list[1])]\nreturn list[1]" ]
<|body_start_0|> if not nums: return 0 res = nums[0] + self.rob1(nums[2:-1]) return max(res, self.rob1(nums[1:])) <|end_body_0|> <|body_start_1|> if len(nums) == 0: return 0 if len(nums) == 1: return nums[0] list = [nums[0], max(nums[0...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 res = nums[0] + se...
stack_v2_sparse_classes_36k_train_024485
793
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "rob1", "signature": "def rob1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_011433
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob1(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 rob(self, nums): :type nums: List[int] :rtype: int - def rob1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, nums): "...
64747eb172c2ecb3c889830246f3282669516e10
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob1(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 rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 res = nums[0] + self.rob1(nums[2:-1]) return max(res, self.rob1(nums[1:])) def rob1(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) ==...
the_stack_v2_python_sparse
LC/213.py
szhu3210/LeetCode_Solutions
train
2
d9cc48bb471dff3af59fef3a4f854ef0ea273374
[ "self.assertRaises(IndexError, self.c.remove, 1)\n' Disallow removal of negative indices '\nself.assertRaises(IndexError, self.c.remove, -1)", "self.assertRaises(ValueError, self.c.update_lines, {'a': 0, 'b': 0})\n' Must not allow replacement of lines with a larger set of lines '\nself.assertRaises(ValueError, se...
<|body_start_0|> self.assertRaises(IndexError, self.c.remove, 1) ' Disallow removal of negative indices ' self.assertRaises(IndexError, self.c.remove, -1) <|end_body_0|> <|body_start_1|> self.assertRaises(ValueError, self.c.update_lines, {'a': 0, 'b': 0}) ' Must not allow replac...
CascadeSanity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CascadeSanity: def test_remove_sanity(self): """Cascades must not allow removal of gate indices that don't exist""" <|body_0|> def test_update_lines_sanity(self): """Must not allow replacement of lines with a set of lines that is smaller""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_024486
7,951
no_license
[ { "docstring": "Cascades must not allow removal of gate indices that don't exist", "name": "test_remove_sanity", "signature": "def test_remove_sanity(self)" }, { "docstring": "Must not allow replacement of lines with a set of lines that is smaller", "name": "test_update_lines_sanity", "s...
2
stack_v2_sparse_classes_30k_train_003063
Implement the Python class `CascadeSanity` described below. Class description: Implement the CascadeSanity class. Method signatures and docstrings: - def test_remove_sanity(self): Cascades must not allow removal of gate indices that don't exist - def test_update_lines_sanity(self): Must not allow replacement of lines...
Implement the Python class `CascadeSanity` described below. Class description: Implement the CascadeSanity class. Method signatures and docstrings: - def test_remove_sanity(self): Cascades must not allow removal of gate indices that don't exist - def test_update_lines_sanity(self): Must not allow replacement of lines...
905eac3318f767575f89c336ccff549c8a091598
<|skeleton|> class CascadeSanity: def test_remove_sanity(self): """Cascades must not allow removal of gate indices that don't exist""" <|body_0|> def test_update_lines_sanity(self): """Must not allow replacement of lines with a set of lines that is smaller""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CascadeSanity: def test_remove_sanity(self): """Cascades must not allow removal of gate indices that don't exist""" self.assertRaises(IndexError, self.c.remove, 1) ' Disallow removal of negative indices ' self.assertRaises(IndexError, self.c.remove, -1) def test_update_lin...
the_stack_v2_python_sparse
revsim/unit.py
RevLogic/GA
train
0
dcf0091324d309732450e58736c2d6c9a881c7b6
[ "super().__init__()\nself.voxel_size = tf.constant(voxel_size, dtype=tf.float32)\nself.point_cloud_range = point_cloud_range\nself.points_range_min = tf.constant(point_cloud_range[:3], dtype=tf.float32)\nself.points_range_max = tf.constant(point_cloud_range[3:], dtype=tf.float32)\nself.max_num_points = max_num_poin...
<|body_start_0|> super().__init__() self.voxel_size = tf.constant(voxel_size, dtype=tf.float32) self.point_cloud_range = point_cloud_range self.points_range_min = tf.constant(point_cloud_range[:3], dtype=tf.float32) self.points_range_max = tf.constant(point_cloud_range[3:], dtype...
PointPillarsVoxelization
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointPillarsVoxelization: def __init__(self, voxel_size, point_cloud_range, max_num_points=32, max_voxels=[16000, 40000]): """Voxelization layer for the PointPillars model. Args: voxel_size: voxel edge lengths with format [x, y, z]. point_cloud_range: The valid range of point coordinates...
stack_v2_sparse_classes_36k_train_024487
44,660
permissive
[ { "docstring": "Voxelization layer for the PointPillars model. Args: voxel_size: voxel edge lengths with format [x, y, z]. point_cloud_range: The valid range of point coordinates as [x_min, y_min, z_min, x_max, y_max, z_max]. max_num_points: The maximum number of points per voxel. max_voxels: The maximum number...
2
stack_v2_sparse_classes_30k_val_000237
Implement the Python class `PointPillarsVoxelization` described below. Class description: Implement the PointPillarsVoxelization class. Method signatures and docstrings: - def __init__(self, voxel_size, point_cloud_range, max_num_points=32, max_voxels=[16000, 40000]): Voxelization layer for the PointPillars model. Ar...
Implement the Python class `PointPillarsVoxelization` described below. Class description: Implement the PointPillarsVoxelization class. Method signatures and docstrings: - def __init__(self, voxel_size, point_cloud_range, max_num_points=32, max_voxels=[16000, 40000]): Voxelization layer for the PointPillars model. Ar...
51482281dc180786e7563c73c12ac5df89289748
<|skeleton|> class PointPillarsVoxelization: def __init__(self, voxel_size, point_cloud_range, max_num_points=32, max_voxels=[16000, 40000]): """Voxelization layer for the PointPillars model. Args: voxel_size: voxel edge lengths with format [x, y, z]. point_cloud_range: The valid range of point coordinates...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointPillarsVoxelization: def __init__(self, voxel_size, point_cloud_range, max_num_points=32, max_voxels=[16000, 40000]): """Voxelization layer for the PointPillars model. Args: voxel_size: voxel edge lengths with format [x, y, z]. point_cloud_range: The valid range of point coordinates as [x_min, y_...
the_stack_v2_python_sparse
ml3d/tf/models/point_pillars.py
CosmosHua/Open3D-ML
train
0
596f97199aa592c87476c8eb4d9a44080f7ff03d
[ "self.ticker = ticker\nself.source = source\nif self.source != 'yahoo':\n raise SourceNotSupported('Only Yahoo! Finance is supported at the moment.')\nself.start = pd.to_datetime(start)\nself.end = pd.to_datetime(end)\nself.data_path = data_path", "try:\n data = web.DataReader(self.ticker, self.source, self...
<|body_start_0|> self.ticker = ticker self.source = source if self.source != 'yahoo': raise SourceNotSupported('Only Yahoo! Finance is supported at the moment.') self.start = pd.to_datetime(start) self.end = pd.to_datetime(end) self.data_path = data_path <|end...
A class used to collect historical prices from the Yahoo! Finance database Attributes ---------- ticker : str Asset ticker start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store the fetched data Methods ---------- fetch() Fetch the historical data from th...
Collector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collector: """A class used to collect historical prices from the Yahoo! Finance database Attributes ---------- ticker : str Asset ticker start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store the fetched data Methods ---------- fetc...
stack_v2_sparse_classes_36k_train_024488
3,511
permissive
[ { "docstring": "Parameters ---------- ticker : str Asset ticker, look up on Yahoo! Finance e.g. 'BTC-USD' for Bitcoin start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store the fetched data", "name": "__init__", "signature": "def __init__(...
3
stack_v2_sparse_classes_30k_train_015147
Implement the Python class `Collector` described below. Class description: A class used to collect historical prices from the Yahoo! Finance database Attributes ---------- ticker : str Asset ticker start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store t...
Implement the Python class `Collector` described below. Class description: A class used to collect historical prices from the Yahoo! Finance database Attributes ---------- ticker : str Asset ticker start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store t...
b2e47cc8a3d94d69fd7b6fea85b43850a5329509
<|skeleton|> class Collector: """A class used to collect historical prices from the Yahoo! Finance database Attributes ---------- ticker : str Asset ticker start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store the fetched data Methods ---------- fetc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collector: """A class used to collect historical prices from the Yahoo! Finance database Attributes ---------- ticker : str Asset ticker start : str Starting date in YYYY-MM-DD format end : str Ending date in YYYY-MM-DD format data_path : str Path to store the fetched data Methods ---------- fetch() Fetch the...
the_stack_v2_python_sparse
base_trading/data.py
dang-trung/base-trading
train
3
66ab92cf377d558ad3276f356fc0cbfc1fc137f9
[ "if len(prices) == 0:\n return 0\nL = [0] * len(prices)\nP = [0] * len(prices)\nL[0] = prices[0]\nP[0] = 0\nfor i in range(1, len(prices)):\n L[i] = min(prices[i], L[i - 1])\n P[i] = max(prices[i] - L[i], P[i - 1])\nreturn max(P)", "if len(prices) <= 1:\n return 0\nprofit = [prices[i] - prices[i - 1] ...
<|body_start_0|> if len(prices) == 0: return 0 L = [0] * len(prices) P = [0] * len(prices) L[0] = prices[0] P[0] = 0 for i in range(1, len(prices)): L[i] = min(prices[i], L[i - 1]) P[i] = max(prices[i] - L[i], P[i - 1]) return m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int DP O(n) space, can be reduced to O(1)""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int DP in terms of max subarray sum""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_024489
1,745
no_license
[ { "docstring": ":type prices: List[int] :rtype: int DP O(n) space, can be reduced to O(1)", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int DP in terms of max subarray sum", "name": "maxProfit", "signature": "def maxP...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int DP O(n) space, can be reduced to O(1) - def maxProfit(self, prices): :type prices: List[int] :rtype: int DP in te...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int DP O(n) space, can be reduced to O(1) - def maxProfit(self, prices): :type prices: List[int] :rtype: int DP in te...
9746205998338fb4d7fd51300a21149c4181fc8f
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int DP O(n) space, can be reduced to O(1)""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int DP in terms of max subarray sum""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int DP O(n) space, can be reduced to O(1)""" if len(prices) == 0: return 0 L = [0] * len(prices) P = [0] * len(prices) L[0] = prices[0] P[0] = 0 for i in range(1, len(p...
the_stack_v2_python_sparse
leetcode/dp/6_stock.py
RuizhenMai/academic-blog
train
0
9c9bc50f2e744722f9ed0d0e6dfcadef2fcb0703
[ "len_nums = len(nums)\nfor i in range(len_nums - 1, -1, -1):\n if nums[i] != 0:\n continue\n for j in range(i, len_nums - 1):\n if nums[j] == 0:\n nums[j], nums[j + 1] = (nums[j + 1], nums[j])\nprint(nums)", "zero_pos = 0\nfor not_zero_pos in range(len(nums)):\n if nums[not_zero_...
<|body_start_0|> len_nums = len(nums) for i in range(len_nums - 1, -1, -1): if nums[i] != 0: continue for j in range(i, len_nums - 1): if nums[j] == 0: nums[j], nums[j + 1] = (nums[j + 1], nums[j]) print(nums) <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后""" <|body_0|> def moveZeroes(self, nums: List[int]) -> None: """20191002 执行用时 :60 ms, 在所有 Python3 提交中击败了95.87% 的...
stack_v2_sparse_classes_36k_train_024490
1,619
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后", "name": "moveZeroes2", "signature": "def moveZeroes2(self, nums: List[int]) -> None" }, { "docstring": "20191002 执行用时 :60 ms, 在所有 Python3 提交中击败了95.87% 的用户 内存消耗 :15 MB, 在所有 Python3 提交中击...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后 - def moveZeroes(self, nums: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后 - def moveZeroes(self, nums: List[in...
99a3abf1774933af73a8405f9b59e5e64906bca4
<|skeleton|> class Solution: def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后""" <|body_0|> def moveZeroes(self, nums: List[int]) -> None: """20191002 执行用时 :60 ms, 在所有 Python3 提交中击败了95.87% 的...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后""" len_nums = len(nums) for i in range(len_nums - 1, -1, -1): if nums[i] != 0: continue for...
the_stack_v2_python_sparse
2018年力扣高频算法面试题汇总/移动零.py
iamkissg/leetcode
train
0
b39795708d4d5963a24f4d4d564ecaca3d3cfd45
[ "is_unenrolled_access_enabled = COURSE_ENABLE_UNENROLLED_ACCESS_FLAG.is_enabled(self.course_key)\nis_course_outline_publicly_visible = full_course_outline.course_visibility in [CourseVisibility.PUBLIC, CourseVisibility.PUBLIC_OUTLINE]\nif is_unenrolled_access_enabled and is_course_outline_publicly_visible:\n ret...
<|body_start_0|> is_unenrolled_access_enabled = COURSE_ENABLE_UNENROLLED_ACCESS_FLAG.is_enabled(self.course_key) is_course_outline_publicly_visible = full_course_outline.course_visibility in [CourseVisibility.PUBLIC, CourseVisibility.PUBLIC_OUTLINE] if is_unenrolled_access_enabled and is_course_...
Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.
EnrollmentOutlineProcessor
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnrollmentOutlineProcessor: """Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.""" def usage_keys_to_remove(self, full_course_outline): """Return sequences/sections to be removed""" <|body_0|> def inaccessible_sequences(self, ...
stack_v2_sparse_classes_36k_train_024491
1,997
permissive
[ { "docstring": "Return sequences/sections to be removed", "name": "usage_keys_to_remove", "signature": "def usage_keys_to_remove(self, full_course_outline)" }, { "docstring": "Return a set/frozenset of Sequence UsageKeys that are not accessible.", "name": "inaccessible_sequences", "signa...
2
stack_v2_sparse_classes_30k_train_002391
Implement the Python class `EnrollmentOutlineProcessor` described below. Class description: Simple OutlineProcessor that removes items based on Enrollment and course visibility setting. Method signatures and docstrings: - def usage_keys_to_remove(self, full_course_outline): Return sequences/sections to be removed - d...
Implement the Python class `EnrollmentOutlineProcessor` described below. Class description: Simple OutlineProcessor that removes items based on Enrollment and course visibility setting. Method signatures and docstrings: - def usage_keys_to_remove(self, full_course_outline): Return sequences/sections to be removed - d...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class EnrollmentOutlineProcessor: """Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.""" def usage_keys_to_remove(self, full_course_outline): """Return sequences/sections to be removed""" <|body_0|> def inaccessible_sequences(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnrollmentOutlineProcessor: """Simple OutlineProcessor that removes items based on Enrollment and course visibility setting.""" def usage_keys_to_remove(self, full_course_outline): """Return sequences/sections to be removed""" is_unenrolled_access_enabled = COURSE_ENABLE_UNENROLLED_ACCESS...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content/learning_sequences/api/processors/enrollment.py
luque/better-ways-of-thinking-about-software
train
3
498d9a59d7333b2cd9d22f1493eb2b77673a7f7b
[ "local_links = set()\nwith requests.Session() as req:\n html_text = req.get(url).text\n soup = BeautifulSoup(html_text, 'html.parser')\n for link in soup.find_all('a', href=True):\n anchor_tag = link.get('href')\n if anchor_tag.startswith(('/', '#')):\n local = url + anchor_tag\n ...
<|body_start_0|> local_links = set() with requests.Session() as req: html_text = req.get(url).text soup = BeautifulSoup(html_text, 'html.parser') for link in soup.find_all('a', href=True): anchor_tag = link.get('href') if anchor_tag.sta...
Crawl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crawl: def get_local_links(self, url): """Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_024492
3,486
no_license
[ { "docstring": "Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain", "name": "get_local_links", "signature": "def get_local_links(self, u...
3
stack_v2_sparse_classes_30k_train_013083
Implement the Python class `Crawl` described below. Class description: Implement the Crawl class. Method signatures and docstrings: - def get_local_links(self, url): Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://...
Implement the Python class `Crawl` described below. Class description: Implement the Crawl class. Method signatures and docstrings: - def get_local_links(self, url): Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://...
1a7094d0dca08ef9f8a481565e8344043c662aa5
<|skeleton|> class Crawl: def get_local_links(self, url): """Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crawl: def get_local_links(self, url): """Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain""" local_links = set() wit...
the_stack_v2_python_sparse
web_crawler/web_crawl.py
SakthiKishore/Python
train
0
3b3d7befb23716bf7854f0e5230ac58b75397526
[ "this_grid_search_object = a_star_search.GridSearch(binary_region_matrix=BINARY_REGION_MATRIX_WITH_PATH)\nthese_visited_rows, these_visited_columns = a_star_search.run_a_star(grid_search_object=this_grid_search_object, start_row=START_ROW, start_column=START_COLUMN, end_row=END_ROW, end_column=END_COLUMN)\nself.ass...
<|body_start_0|> this_grid_search_object = a_star_search.GridSearch(binary_region_matrix=BINARY_REGION_MATRIX_WITH_PATH) these_visited_rows, these_visited_columns = a_star_search.run_a_star(grid_search_object=this_grid_search_object, start_row=START_ROW, start_column=START_COLUMN, end_row=END_ROW, end_c...
Each method is a unit test for a_star_search.py.
AStarSearchTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AStarSearchTests: """Each method is a unit test for a_star_search.py.""" def test_run_a_star_path_exists(self): """Ensures correct output from run_a_star. In this case, path to goal exists.""" <|body_0|> def test_run_a_star_path_not_exists(self): """Ensures corre...
stack_v2_sparse_classes_36k_train_024493
2,528
permissive
[ { "docstring": "Ensures correct output from run_a_star. In this case, path to goal exists.", "name": "test_run_a_star_path_exists", "signature": "def test_run_a_star_path_exists(self)" }, { "docstring": "Ensures correct output from run_a_star. In this case, *no* path to goal exists.", "name"...
2
null
Implement the Python class `AStarSearchTests` described below. Class description: Each method is a unit test for a_star_search.py. Method signatures and docstrings: - def test_run_a_star_path_exists(self): Ensures correct output from run_a_star. In this case, path to goal exists. - def test_run_a_star_path_not_exists...
Implement the Python class `AStarSearchTests` described below. Class description: Each method is a unit test for a_star_search.py. Method signatures and docstrings: - def test_run_a_star_path_exists(self): Ensures correct output from run_a_star. In this case, path to goal exists. - def test_run_a_star_path_not_exists...
95b99a16fdaa67dae69586c7f7c76e27ccd4b89a
<|skeleton|> class AStarSearchTests: """Each method is a unit test for a_star_search.py.""" def test_run_a_star_path_exists(self): """Ensures correct output from run_a_star. In this case, path to goal exists.""" <|body_0|> def test_run_a_star_path_not_exists(self): """Ensures corre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AStarSearchTests: """Each method is a unit test for a_star_search.py.""" def test_run_a_star_path_exists(self): """Ensures correct output from run_a_star. In this case, path to goal exists.""" this_grid_search_object = a_star_search.GridSearch(binary_region_matrix=BINARY_REGION_MATRIX_WIT...
the_stack_v2_python_sparse
generalexam/ge_utils/a_star_search_test.py
thunderhoser/GeneralExam
train
4
398bd7c9720b63d49338d057c88085d6eea67d32
[ "n = len(nums)\nfinish = False\nif n == 1:\n return nums\nfor i in range(n - 2, -1, -1):\n cur = nums[i]\n if finish:\n break\n for j in range(n - 1, i, -1):\n if cur < nums[j]:\n nums[i], nums[j] = (nums[j], cur)\n temp = nums[i + 1:]\n temp.sort()\n ...
<|body_start_0|> n = len(nums) finish = False if n == 1: return nums for i in range(n - 2, -1, -1): cur = nums[i] if finish: break for j in range(n - 1, i, -1): if cur < nums[j]: nums[i], ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation1(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_024494
1,357
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "nextPermutation1", "signature": "def nextPermutation1(self, nums: List[int]) -> None" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def n...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation1(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums: List[int]) -> None: Do not return any...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation1(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums: List[int]) -> None: Do not return any...
2ae3529366227efb5f2ad81a8b039ad71e8d1ed5
<|skeleton|> class Solution: def nextPermutation1(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation1(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" n = len(nums) finish = False if n == 1: return nums for i in range(n - 2, -1, -1): cur = nums[i] if finish: ...
the_stack_v2_python_sparse
Leetcode300/31. Next Permutation.py
LYXalex/Leetcode-PythonSolution
train
1
a89af693fff9347b1baed5cb6e33c575bc0c47ab
[ "res = []\nfor s in strs:\n res.append(str(len(s)))\n res.append('/')\n res.append(s)\nreturn ''.join(res)", "strs = []\ni = 0\nnum = 0\nwhile i < len(s):\n if s[i].isdigit():\n num = num * 10 + int(s[i])\n i += 1\n elif s[i] == '/':\n i += 1\n strs.append(s[i:i + num])\...
<|body_start_0|> res = [] for s in strs: res.append(str(len(s))) res.append('/') res.append(s) return ''.join(res) <|end_body_0|> <|body_start_1|> strs = [] i = 0 num = 0 while i < len(s): if s[i].isdigit(): ...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: 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_024495
3,656
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_012314
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 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: ...
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 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: ...
188befbfb7080ba1053ee1f7187b177b64cf42d2
<|skeleton|> class Codec1: 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 Codec1: 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.append(str(len(s))) res.append('/') res.append(s) return ''.join(res) def decode(self, s): ...
the_stack_v2_python_sparse
0271. Encode and Decode Strings.py
pwang867/LeetCode-Solutions-Python
train
0
fef620bf78c997dbb489bbe788d6da598ae849cb
[ "section1 = Sections.objects.create(name='section1')\nstages = Stages.objects.bulk_create([Stages(name='stage1', f_section=section1), Stages(name='stage2', f_section=section1)])\nQuestions.objects.bulk_create([Questions(name='question1', f_stage=stages[0]), Questions(name='question2', f_stage=stages[0]), Questions(...
<|body_start_0|> section1 = Sections.objects.create(name='section1') stages = Stages.objects.bulk_create([Stages(name='stage1', f_section=section1), Stages(name='stage2', f_section=section1)]) Questions.objects.bulk_create([Questions(name='question1', f_stage=stages[0]), Questions(name='question...
Test for GET department with unlogin user by id
DepartmentMiddlewareTestCases
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepartmentMiddlewareTestCases: """Test for GET department with unlogin user by id""" def setUp(self): """Create new department and fill questions""" <|body_0|> def test_get_valid_department_no_login_user(self): """Test for GET Department with id '2' with unlogin ...
stack_v2_sparse_classes_36k_train_024496
1,633
no_license
[ { "docstring": "Create new department and fill questions", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test for GET Department with id '2' with unlogin user and get error", "name": "test_get_valid_department_no_login_user", "signature": "def test_get_valid_departme...
2
null
Implement the Python class `DepartmentMiddlewareTestCases` described below. Class description: Test for GET department with unlogin user by id Method signatures and docstrings: - def setUp(self): Create new department and fill questions - def test_get_valid_department_no_login_user(self): Test for GET Department with...
Implement the Python class `DepartmentMiddlewareTestCases` described below. Class description: Test for GET department with unlogin user by id Method signatures and docstrings: - def setUp(self): Create new department and fill questions - def test_get_valid_department_no_login_user(self): Test for GET Department with...
f448ec0453818d55c5c9d30aaa4f19e1d7ca5867
<|skeleton|> class DepartmentMiddlewareTestCases: """Test for GET department with unlogin user by id""" def setUp(self): """Create new department and fill questions""" <|body_0|> def test_get_valid_department_no_login_user(self): """Test for GET Department with id '2' with unlogin ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepartmentMiddlewareTestCases: """Test for GET department with unlogin user by id""" def setUp(self): """Create new department and fill questions""" section1 = Sections.objects.create(name='section1') stages = Stages.objects.bulk_create([Stages(name='stage1', f_section=section1), ...
the_stack_v2_python_sparse
Portfolio/tech-interview/techinterview/techinterview/middleware/test_login_middleware.py
HeCToR74/Python
train
1
0d7435c9c3f78fea8212d02288beb662458c31ff
[ "if request.GET.get('search'):\n request_terms = request.GET.get('search')\n search_terms_array = request_terms.split()\n initial_term = search_terms_array[0]\n keywords = Keyword.objects.filter(Q(name__icontains=initial_term))\n if len(search_terms_array) > 1:\n for term in range(1, len(searc...
<|body_start_0|> if request.GET.get('search'): request_terms = request.GET.get('search') search_terms_array = request_terms.split() initial_term = search_terms_array[0] keywords = Keyword.objects.filter(Q(name__icontains=initial_term)) if len(search_te...
KeywordList
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordList: def get(self, request, format=None): """List all keywords (tags, skills) or result list if you use ?search=term%of%search --- parameters: - name: search required: false type: string paramType: query - name: pagination required: false type: string paramType: query""" ...
stack_v2_sparse_classes_36k_train_024497
30,608
permissive
[ { "docstring": "List all keywords (tags, skills) or result list if you use ?search=term%of%search --- parameters: - name: search required: false type: string paramType: query - name: pagination required: false type: string paramType: query", "name": "get", "signature": "def get(self, request, format=Non...
2
stack_v2_sparse_classes_30k_train_003450
Implement the Python class `KeywordList` described below. Class description: Implement the KeywordList class. Method signatures and docstrings: - def get(self, request, format=None): List all keywords (tags, skills) or result list if you use ?search=term%of%search --- parameters: - name: search required: false type: ...
Implement the Python class `KeywordList` described below. Class description: Implement the KeywordList class. Method signatures and docstrings: - def get(self, request, format=None): List all keywords (tags, skills) or result list if you use ?search=term%of%search --- parameters: - name: search required: false type: ...
73728463badb3bfd4413aa0f7aeb44a9606fdfea
<|skeleton|> class KeywordList: def get(self, request, format=None): """List all keywords (tags, skills) or result list if you use ?search=term%of%search --- parameters: - name: search required: false type: string paramType: query - name: pagination required: false type: string paramType: query""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeywordList: def get(self, request, format=None): """List all keywords (tags, skills) or result list if you use ?search=term%of%search --- parameters: - name: search required: false type: string paramType: query - name: pagination required: false type: string paramType: query""" if request.GET...
the_stack_v2_python_sparse
administrator/views.py
belatrix/BackendAllStars
train
5
a3fb11125327941029f3aac982634227fd2828d4
[ "self.domain = domain\nself.name = name\nself.sid = sid\nself.mtype = mtype", "if dictionary is None:\n return None\ndomain = dictionary.get('domain')\nname = dictionary.get('name')\nsid = dictionary.get('sid')\nmtype = dictionary.get('type')\nreturn cls(domain, name, sid, mtype)" ]
<|body_start_0|> self.domain = domain self.name = name self.sid = sid self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None domain = dictionary.get('domain') name = dictionary.get('name') sid = dictionary.get('s...
Implementation of the 'SmbPrincipal' model. TODO: type description here. Attributes: domain (string): Specifies domain name of the principal. name (string): Specifies name of the SMB principal which may be a group or user. sid (string): Specifies unique Security ID (SID) of the principal that look similar to windows do...
SmbPrincipal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmbPrincipal: """Implementation of the 'SmbPrincipal' model. TODO: type description here. Attributes: domain (string): Specifies domain name of the principal. name (string): Specifies name of the SMB principal which may be a group or user. sid (string): Specifies unique Security ID (SID) of the p...
stack_v2_sparse_classes_36k_train_024498
1,977
permissive
[ { "docstring": "Constructor for the SmbPrincipal class", "name": "__init__", "signature": "def __init__(self, domain=None, name=None, sid=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the ob...
2
null
Implement the Python class `SmbPrincipal` described below. Class description: Implementation of the 'SmbPrincipal' model. TODO: type description here. Attributes: domain (string): Specifies domain name of the principal. name (string): Specifies name of the SMB principal which may be a group or user. sid (string): Spec...
Implement the Python class `SmbPrincipal` described below. Class description: Implementation of the 'SmbPrincipal' model. TODO: type description here. Attributes: domain (string): Specifies domain name of the principal. name (string): Specifies name of the SMB principal which may be a group or user. sid (string): Spec...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SmbPrincipal: """Implementation of the 'SmbPrincipal' model. TODO: type description here. Attributes: domain (string): Specifies domain name of the principal. name (string): Specifies name of the SMB principal which may be a group or user. sid (string): Specifies unique Security ID (SID) of the p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmbPrincipal: """Implementation of the 'SmbPrincipal' model. TODO: type description here. Attributes: domain (string): Specifies domain name of the principal. name (string): Specifies name of the SMB principal which may be a group or user. sid (string): Specifies unique Security ID (SID) of the principal that...
the_stack_v2_python_sparse
cohesity_management_sdk/models/smb_principal.py
cohesity/management-sdk-python
train
24
2374a404e6cb541abf41163cf1585f57c28df2b7
[ "super().__init__(inputs=[inputs], outputs=[outputs], input_count=1, output_count=1)\nself.__keys = keys_to_change\nself.__distance = distance\nself.__atoms_buffer = list()\nself.__counter = 0", "if len(self.__atoms_buffer) < self.__counter + 1:\n self.__atoms_buffer.append(data)\nelse:\n atom_1 = self.__at...
<|body_start_0|> super().__init__(inputs=[inputs], outputs=[outputs], input_count=1, output_count=1) self.__keys = keys_to_change self.__distance = distance self.__atoms_buffer = list() self.__counter = 0 <|end_body_0|> <|body_start_1|> if len(self.__atoms_buffer) < self...
Applies an operation to the i atom's keys and i+c atom's keys. Inputs: Single stream ordered by datetime. Outputs: Single stream containing n - c atoms, whose fields are the result of the given operation between the atoms at positions i and i+c in the input Stream. Such fields are the only fields of the output data.
PhaseFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhaseFilter: """Applies an operation to the i atom's keys and i+c atom's keys. Inputs: Single stream ordered by datetime. Outputs: Single stream containing n - c atoms, whose fields are the result of the given operation between the atoms at positions i and i+c in the input Stream. Such fields are...
stack_v2_sparse_classes_36k_train_024499
4,418
no_license
[ { "docstring": "Parameters: inputs : str Input stream name. All atoms in the Stream will be treated as if they had all of the keys in `keys_to_change`. outputs : str Output stream name. keys_to_change : Mapping[str, Callable] A mapping of each key that needs to be modified along with the operation to use. Such ...
2
stack_v2_sparse_classes_30k_train_000260
Implement the Python class `PhaseFilter` described below. Class description: Applies an operation to the i atom's keys and i+c atom's keys. Inputs: Single stream ordered by datetime. Outputs: Single stream containing n - c atoms, whose fields are the result of the given operation between the atoms at positions i and i...
Implement the Python class `PhaseFilter` described below. Class description: Applies an operation to the i atom's keys and i+c atom's keys. Inputs: Single stream ordered by datetime. Outputs: Single stream containing n - c atoms, whose fields are the result of the given operation between the atoms at positions i and i...
5d1fce470eeb31f5cc75cadfc06d9d2908736052
<|skeleton|> class PhaseFilter: """Applies an operation to the i atom's keys and i+c atom's keys. Inputs: Single stream ordered by datetime. Outputs: Single stream containing n - c atoms, whose fields are the result of the given operation between the atoms at positions i and i+c in the input Stream. Such fields are...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhaseFilter: """Applies an operation to the i atom's keys and i+c atom's keys. Inputs: Single stream ordered by datetime. Outputs: Single stream containing n - c atoms, whose fields are the result of the given operation between the atoms at positions i and i+c in the input Stream. Such fields are the only fie...
the_stack_v2_python_sparse
otri/filtering/filters/phase_filter.py
OTRI-Unipd/OTRI
train
0