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
1e61779e52647fd16914a2185937e7fcb36471a2
[ "self.name = kwargs.get('name')\nself.code = kwargs.get('code')\nself.active = kwargs.get('active')", "db.session.add(self)\nif commit is True:\n db.session.commit()", "search = kwargs.get('search', None)\nsort_by = kwargs.get('sort_by', 'active')\norder_by = kwargs.get('order_by', 'asc')\nlimit = kwargs.get...
<|body_start_0|> self.name = kwargs.get('name') self.code = kwargs.get('code') self.active = kwargs.get('active') <|end_body_0|> <|body_start_1|> db.session.add(self) if commit is True: db.session.commit() <|end_body_1|> <|body_start_2|> search = kwargs.get(...
permission table model
Permission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Permission: """permission table model""" def __init__(self, **kwargs): """constructor.""" <|body_0|> def save(self, commit=True): """Permission save method.""" <|body_1|> def get_permission(self, **kwargs): """this is common method for returi...
stack_v2_sparse_classes_36k_train_017300
3,209
no_license
[ { "docstring": "constructor.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Permission save method.", "name": "save", "signature": "def save(self, commit=True)" }, { "docstring": "this is common method for returing list of permission includin...
3
stack_v2_sparse_classes_30k_train_017327
Implement the Python class `Permission` described below. Class description: permission table model Method signatures and docstrings: - def __init__(self, **kwargs): constructor. - def save(self, commit=True): Permission save method. - def get_permission(self, **kwargs): this is common method for returing list of perm...
Implement the Python class `Permission` described below. Class description: permission table model Method signatures and docstrings: - def __init__(self, **kwargs): constructor. - def save(self, commit=True): Permission save method. - def get_permission(self, **kwargs): this is common method for returing list of perm...
4dc5f5e816e3c461b8a60c5f61c7eafc08050579
<|skeleton|> class Permission: """permission table model""" def __init__(self, **kwargs): """constructor.""" <|body_0|> def save(self, commit=True): """Permission save method.""" <|body_1|> def get_permission(self, **kwargs): """this is common method for returi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Permission: """permission table model""" def __init__(self, **kwargs): """constructor.""" self.name = kwargs.get('name') self.code = kwargs.get('code') self.active = kwargs.get('active') def save(self, commit=True): """Permission save method.""" db.ses...
the_stack_v2_python_sparse
app/models/permission.py
ekramulmostafa/ms-auth
train
0
07905726a5db63eb096298a5896643f33a573a64
[ "if preprocessors is None:\n self.preprocessors = []\nelse:\n self.preprocessors = preprocessors", "X = []\nY = []\nfor i, imagePath in enumerate(imagePaths):\n image = cv2.imread(imagePath)\n label = imagePath.split(os.path.sep)[-2]\n if self.preprocessors is not None:\n for p in self.prepr...
<|body_start_0|> if preprocessors is None: self.preprocessors = [] else: self.preprocessors = preprocessors <|end_body_0|> <|body_start_1|> X = [] Y = [] for i, imagePath in enumerate(imagePaths): image = cv2.imread(imagePath) labe...
Loads images using full image paths into memoery. Attributes: preprocessors: array of image preprocessors to apply to images upon loading
MemoryDataLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemoryDataLoader: """Loads images using full image paths into memoery. Attributes: preprocessors: array of image preprocessors to apply to images upon loading""" def __init__(self, preprocessors=None): """Initialise the class""" <|body_0|> def load(self, imagePaths, verb...
stack_v2_sparse_classes_36k_train_017301
1,849
no_license
[ { "docstring": "Initialise the class", "name": "__init__", "signature": "def __init__(self, preprocessors=None)" }, { "docstring": "Load the data set, both images and their labels, returning two lists *in memory* :param imagePaths: list holding the full path to each image. Each image is stored i...
2
stack_v2_sparse_classes_30k_train_002016
Implement the Python class `MemoryDataLoader` described below. Class description: Loads images using full image paths into memoery. Attributes: preprocessors: array of image preprocessors to apply to images upon loading Method signatures and docstrings: - def __init__(self, preprocessors=None): Initialise the class -...
Implement the Python class `MemoryDataLoader` described below. Class description: Loads images using full image paths into memoery. Attributes: preprocessors: array of image preprocessors to apply to images upon loading Method signatures and docstrings: - def __init__(self, preprocessors=None): Initialise the class -...
e9f2010715fa06f50095d05684617c86e18ca661
<|skeleton|> class MemoryDataLoader: """Loads images using full image paths into memoery. Attributes: preprocessors: array of image preprocessors to apply to images upon loading""" def __init__(self, preprocessors=None): """Initialise the class""" <|body_0|> def load(self, imagePaths, verb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemoryDataLoader: """Loads images using full image paths into memoery. Attributes: preprocessors: array of image preprocessors to apply to images upon loading""" def __init__(self, preprocessors=None): """Initialise the class""" if preprocessors is None: self.preprocessors = [...
the_stack_v2_python_sparse
dltoolkit/iomisc/memorydataloader.py
GeoffBreemer/DLToolkit
train
2
0c537649fc89f3a6db7c05b8ef1c75265fe7524d
[ "if reflection_table.get_flags(reflection_table.flags.integrated_prf).count(True) == 0:\n raise NoProfilesException('WARNING: No profile-integrated reflections found')\nselection = reflection_table.get_flags(reflection_table.flags.integrated, all=True)\nreflection_table = reflection_table.select(selection)\nlogg...
<|body_start_0|> if reflection_table.get_flags(reflection_table.flags.integrated_prf).count(True) == 0: raise NoProfilesException('WARNING: No profile-integrated reflections found') selection = reflection_table.get_flags(reflection_table.flags.integrated, all=True) reflection_table =...
Reduction methods for data with sum and profile intensities. Only reflections with valid values for all intensity types are retained.
SumAndPrfIntensityReducer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SumAndPrfIntensityReducer: """Reduction methods for data with sum and profile intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select reflections successfully integrated by sum and prf methods."""...
stack_v2_sparse_classes_36k_train_017302
38,270
permissive
[ { "docstring": "Select reflections successfully integrated by sum and prf methods.", "name": "reduce_on_intensities", "signature": "def reduce_on_intensities(reflection_table)" }, { "docstring": "Apply corrections to the intensities and variances (partiality, lp, qe).", "name": "apply_scalin...
2
null
Implement the Python class `SumAndPrfIntensityReducer` described below. Class description: Reduction methods for data with sum and profile intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select refle...
Implement the Python class `SumAndPrfIntensityReducer` described below. Class description: Reduction methods for data with sum and profile intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select refle...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class SumAndPrfIntensityReducer: """Reduction methods for data with sum and profile intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select reflections successfully integrated by sum and prf methods."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SumAndPrfIntensityReducer: """Reduction methods for data with sum and profile intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select reflections successfully integrated by sum and prf methods.""" if r...
the_stack_v2_python_sparse
src/dials/util/filter_reflections.py
dials/dials
train
71
ae24b7eea7a73b587ec50156b601339ef5e3ae8d
[ "parameters = json_parameters()\nbytes_param = param_get(parameters, 'bytes')\ntry:\n set_global_account_limit(account=account, rse_expression=rse_expression, bytes_=bytes_param, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))\nexcept AccessDenied as error:\n return generate_http_error_fla...
<|body_start_0|> parameters = json_parameters() bytes_param = param_get(parameters, 'bytes') try: set_global_account_limit(account=account, rse_expression=rse_expression, bytes_=bytes_param, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')) except AccessDeni...
GlobalAccountLimit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalAccountLimit: def post(self, account, rse_expression): """--- summary: Create or update a global account limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse_expression in: pat...
stack_v2_sparse_classes_36k_train_017303
7,826
permissive
[ { "docstring": "--- summary: Create or update a global account limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse_expression in: path description: The rse expression for the accountlimit. schema: type: st...
2
null
Implement the Python class `GlobalAccountLimit` described below. Class description: Implement the GlobalAccountLimit class. Method signatures and docstrings: - def post(self, account, rse_expression): --- summary: Create or update a global account limit tags: - Account Limit parameters: - name: account in: path descr...
Implement the Python class `GlobalAccountLimit` described below. Class description: Implement the GlobalAccountLimit class. Method signatures and docstrings: - def post(self, account, rse_expression): --- summary: Create or update a global account limit tags: - Account Limit parameters: - name: account in: path descr...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class GlobalAccountLimit: def post(self, account, rse_expression): """--- summary: Create or update a global account limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse_expression in: pat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GlobalAccountLimit: def post(self, account, rse_expression): """--- summary: Create or update a global account limit tags: - Account Limit parameters: - name: account in: path description: The account for the accountlimit. schema: type: string style: simple - name: rse_expression in: path description:...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/accountlimits.py
rucio/rucio
train
232
f0955abce3bbed3d9dcbe822f4cf9b27d298063f
[ "datasets = []\nfor output_name, artifact_view in object.outputs.items():\n df = artifact_view.read()\n if type(df) is not pd.DataFrame:\n logger.warning('`%s` is not a pd.DataFrame. You can only visualize statistics of steps that output pandas dataframes. Skipping this output..' % output_name)\n el...
<|body_start_0|> datasets = [] for output_name, artifact_view in object.outputs.items(): df = artifact_view.read() if type(df) is not pd.DataFrame: logger.warning('`%s` is not a pd.DataFrame. You can only visualize statistics of steps that output pandas dataframes...
The base implementation of a ZenML Visualizer.
FacetStatisticsVisualizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacetStatisticsVisualizer: """The base implementation of a ZenML Visualizer.""" def visualize(self, object: StepView, magic: bool=False, *args: Any, **kwargs: Any) -> None: """Method to visualize components Args: object: StepView fetched from run.get_step(). magic: Whether to render ...
stack_v2_sparse_classes_36k_train_017304
3,760
permissive
[ { "docstring": "Method to visualize components Args: object: StepView fetched from run.get_step(). magic: Whether to render in a Jupyter notebook or not.", "name": "visualize", "signature": "def visualize(self, object: StepView, magic: bool=False, *args: Any, **kwargs: Any) -> None" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_010864
Implement the Python class `FacetStatisticsVisualizer` described below. Class description: The base implementation of a ZenML Visualizer. Method signatures and docstrings: - def visualize(self, object: StepView, magic: bool=False, *args: Any, **kwargs: Any) -> None: Method to visualize components Args: object: StepVi...
Implement the Python class `FacetStatisticsVisualizer` described below. Class description: The base implementation of a ZenML Visualizer. Method signatures and docstrings: - def visualize(self, object: StepView, magic: bool=False, *args: Any, **kwargs: Any) -> None: Method to visualize components Args: object: StepVi...
f1499e9c3fee00fd1d66de14cab66c4472c0085d
<|skeleton|> class FacetStatisticsVisualizer: """The base implementation of a ZenML Visualizer.""" def visualize(self, object: StepView, magic: bool=False, *args: Any, **kwargs: Any) -> None: """Method to visualize components Args: object: StepView fetched from run.get_step(). magic: Whether to render ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FacetStatisticsVisualizer: """The base implementation of a ZenML Visualizer.""" def visualize(self, object: StepView, magic: bool=False, *args: Any, **kwargs: Any) -> None: """Method to visualize components Args: object: StepView fetched from run.get_step(). magic: Whether to render in a Jupyter ...
the_stack_v2_python_sparse
src/zenml/integrations/facets/visualizers/facet_statistics_visualizer.py
stefannica/zenml
train
0
a42a230ab4361afd86e23e9d3ffe3088e8904dc0
[ "result = []\n\ndef preorder(root):\n if not root:\n result.append('#')\n else:\n result.append(str(root.val))\n preorder(root.left)\n preorder(root.right)\npreorder(root)\nreturn ','.join(result)", "q = collections.deque(data.split(','))\n\ndef build_tree():\n char = q.poplef...
<|body_start_0|> result = [] def preorder(root): if not root: result.append('#') else: result.append(str(root.val)) preorder(root.left) preorder(root.right) preorder(root) return ','.join(result) <|e...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_017305
1,416
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
ca71572677d2b2a2aed94bb60d6ec88cc486a7f3
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" result = [] def preorder(root): if not root: result.append('#') else: result.append(str(root.val)) preord...
the_stack_v2_python_sparse
Leetcode/297.py
syzdemonhunter/Coding_Exercises
train
1
745c59bc6de73fd163c0cb2f51f55a0f2afec99f
[ "self.arr = [homepage] + [None for _ in range(5000)]\nself.max = 0\nself.curr = 0", "self.curr += 1\nself.arr[self.curr] = url\nself.max = self.curr", "ret = max(0, self.curr - steps)\nself.curr = ret\nreturn self.arr[self.curr]", "ret = min(self.max, self.curr + steps)\nself.curr = ret\nreturn self.arr[self....
<|body_start_0|> self.arr = [homepage] + [None for _ in range(5000)] self.max = 0 self.curr = 0 <|end_body_0|> <|body_start_1|> self.curr += 1 self.arr[self.curr] = url self.max = self.curr <|end_body_1|> <|body_start_2|> ret = max(0, self.curr - steps) ...
BrowserHistory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserHistory: def __init__(self, homepage): """:type homepage: str""" <|body_0|> def visit(self, url): """:type url: str :rtype: None""" <|body_1|> def back(self, steps): """:type steps: int :rtype: str""" <|body_2|> def forward(se...
stack_v2_sparse_classes_36k_train_017306
1,237
no_license
[ { "docstring": ":type homepage: str", "name": "__init__", "signature": "def __init__(self, homepage)" }, { "docstring": ":type url: str :rtype: None", "name": "visit", "signature": "def visit(self, url)" }, { "docstring": ":type steps: int :rtype: str", "name": "back", "s...
4
null
Implement the Python class `BrowserHistory` described below. Class description: Implement the BrowserHistory class. Method signatures and docstrings: - def __init__(self, homepage): :type homepage: str - def visit(self, url): :type url: str :rtype: None - def back(self, steps): :type steps: int :rtype: str - def forw...
Implement the Python class `BrowserHistory` described below. Class description: Implement the BrowserHistory class. Method signatures and docstrings: - def __init__(self, homepage): :type homepage: str - def visit(self, url): :type url: str :rtype: None - def back(self, steps): :type steps: int :rtype: str - def forw...
18f82f9b17a287abe3f318118691b62607e61ff9
<|skeleton|> class BrowserHistory: def __init__(self, homepage): """:type homepage: str""" <|body_0|> def visit(self, url): """:type url: str :rtype: None""" <|body_1|> def back(self, steps): """:type steps: int :rtype: str""" <|body_2|> def forward(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrowserHistory: def __init__(self, homepage): """:type homepage: str""" self.arr = [homepage] + [None for _ in range(5000)] self.max = 0 self.curr = 0 def visit(self, url): """:type url: str :rtype: None""" self.curr += 1 self.arr[self.curr] = url ...
the_stack_v2_python_sparse
Leetcode/create_DS/1472_design_browser_history.py
harshsodi/DSA
train
0
552ade656a7227c08e92b54eb49e154016d1fdaa
[ "super().__init__(x, y, w, h)\nself.delta_x = delta_x\nself.delta_y = delta_y\nself.main_x = main_x\nself.main_y = main_y\nself.color1 = color1\nself.color2 = color2\nself._redraw = True", "for event in events:\n pass\nif self._redraw:\n self.draw(surface)", "self.clip(surface, True)\nfor x in range(0, se...
<|body_start_0|> super().__init__(x, y, w, h) self.delta_x = delta_x self.delta_y = delta_y self.main_x = main_x self.main_y = main_y self.color1 = color1 self.color2 = color2 self._redraw = True <|end_body_0|> <|body_start_1|> for event in events...
Hilfsklasse zum Zeichnen eines Gitters, anhand dessen die Pixelpositionen Elemente dann leichter abgelesen werden können.
GridWidget
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GridWidget: """Hilfsklasse zum Zeichnen eines Gitters, anhand dessen die Pixelpositionen Elemente dann leichter abgelesen werden können.""" def __init__(self, x, y, w, h, delta_x, delta_y, main_x, main_y, color1, color2): """Konstruktor. @param x: X-Position @param y: Y-Position @par...
stack_v2_sparse_classes_36k_train_017307
2,309
permissive
[ { "docstring": "Konstruktor. @param x: X-Position @param y: Y-Position @param w: Breite @param h: Höhe @param delta_x: Rastergröße in X-Richtung @param delta_y: Rastergröße in Y-Richtung @param main_x: Eine vertikale Hauptlinie alle x Kästchen @param main_y: Eine horizontale Hauptlinie alle y Kästchen @param co...
3
null
Implement the Python class `GridWidget` described below. Class description: Hilfsklasse zum Zeichnen eines Gitters, anhand dessen die Pixelpositionen Elemente dann leichter abgelesen werden können. Method signatures and docstrings: - def __init__(self, x, y, w, h, delta_x, delta_y, main_x, main_y, color1, color2): Ko...
Implement the Python class `GridWidget` described below. Class description: Hilfsklasse zum Zeichnen eines Gitters, anhand dessen die Pixelpositionen Elemente dann leichter abgelesen werden können. Method signatures and docstrings: - def __init__(self, x, y, w, h, delta_x, delta_y, main_x, main_y, color1, color2): Ko...
a849035d7bad7f3cabe8a0f2e0bbd68942c3f1b1
<|skeleton|> class GridWidget: """Hilfsklasse zum Zeichnen eines Gitters, anhand dessen die Pixelpositionen Elemente dann leichter abgelesen werden können.""" def __init__(self, x, y, w, h, delta_x, delta_y, main_x, main_y, color1, color2): """Konstruktor. @param x: X-Position @param y: Y-Position @par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GridWidget: """Hilfsklasse zum Zeichnen eines Gitters, anhand dessen die Pixelpositionen Elemente dann leichter abgelesen werden können.""" def __init__(self, x, y, w, h, delta_x, delta_y, main_x, main_y, color1, color2): """Konstruktor. @param x: X-Position @param y: Y-Position @param w: Breite ...
the_stack_v2_python_sparse
03 Python/Smart Home Dashboard/aufgabe/widgets/grid.py
DennisSchulmeister/dhbwka-wwi-iottech-quellcodes
train
0
227e9c0d530164309b58c8f47b232c0764dd31f2
[ "fLOG(__file__, self._testMethodName, OutputPrint=__name__ == '__main__')\nthi = os.path.abspath(os.path.dirname(__file__))\nsrc_ = os.path.normpath(os.path.join(thi, '..', '..', 'src'))\ncheck_pep8(src_, fLOG=fLOG, verbose=False, run_cmd_filter=_run_cmd_filter, pylint_ignore=('C0103', 'C1801', 'R1705', 'W0108', 'W...
<|body_start_0|> fLOG(__file__, self._testMethodName, OutputPrint=__name__ == '__main__') thi = os.path.abspath(os.path.dirname(__file__)) src_ = os.path.normpath(os.path.join(thi, '..', '..', 'src')) check_pep8(src_, fLOG=fLOG, verbose=False, run_cmd_filter=_run_cmd_filter, pylint_ignor...
Test style.
TestCodeStyle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCodeStyle: """Test style.""" def test_style_src(self): """Checks style of source files.""" <|body_0|> def test_style_test(self): """Checks style of tests files.""" <|body_1|> <|end_skeleton|> <|body_start_0|> fLOG(__file__, self._testMethodN...
stack_v2_sparse_classes_36k_train_017308
2,977
permissive
[ { "docstring": "Checks style of source files.", "name": "test_style_src", "signature": "def test_style_src(self)" }, { "docstring": "Checks style of tests files.", "name": "test_style_test", "signature": "def test_style_test(self)" } ]
2
stack_v2_sparse_classes_30k_train_016415
Implement the Python class `TestCodeStyle` described below. Class description: Test style. Method signatures and docstrings: - def test_style_src(self): Checks style of source files. - def test_style_test(self): Checks style of tests files.
Implement the Python class `TestCodeStyle` described below. Class description: Test style. Method signatures and docstrings: - def test_style_src(self): Checks style of source files. - def test_style_test(self): Checks style of tests files. <|skeleton|> class TestCodeStyle: """Test style.""" def test_style_...
36033021726144e66fd420cc902f32187a650b18
<|skeleton|> class TestCodeStyle: """Test style.""" def test_style_src(self): """Checks style of source files.""" <|body_0|> def test_style_test(self): """Checks style of tests files.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCodeStyle: """Test style.""" def test_style_src(self): """Checks style of source files.""" fLOG(__file__, self._testMethodName, OutputPrint=__name__ == '__main__') thi = os.path.abspath(os.path.dirname(__file__)) src_ = os.path.normpath(os.path.join(thi, '..', '..', 's...
the_stack_v2_python_sparse
_unittests/ut_module/test_code_style.py
sdpython/ensae_projects
train
1
a76c0a5311d456fe929a1f060cae6b9fe799fcba
[ "def helper(root):\n if not root:\n return None\n left_tail = helper(root.left)\n right_tail = helper(root.right)\n if not left_tail and (not right_tail):\n return root\n elif left_tail and right_tail:\n root.right, left_tail.right = (root.left, root.right)\n root.left = N...
<|body_start_0|> def helper(root): if not root: return None left_tail = helper(root.left) right_tail = helper(root.right) if not left_tail and (not right_tail): return root elif left_tail and right_tail: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" <|body_0|> def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" ...
stack_v2_sparse_classes_36k_train_017309
2,316
no_license
[ { "docstring": ":type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": ":type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.", "name": "flatten", ...
3
stack_v2_sparse_classes_30k_val_001009
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: None Do not return anything, modify root in-place instead. - def flatten(self, root): :type root: TreeNode :rtype: None Do n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: None Do not return anything, modify root in-place instead. - def flatten(self, root): :type root: TreeNode :rtype: None Do n...
63b7eedc720c1ce14880b80744dcd5ef7107065c
<|skeleton|> class Solution: def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" <|body_0|> def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" def helper(root): if not root: return None left_tail = helper(root.left) right_tail = helper(root.right) ...
the_stack_v2_python_sparse
problems/flatten.py
joddiy/leetcode
train
1
ddc91e66dab5ca248634c6d49449d7d8cf04ab92
[ "self.rewardval = 1.5\nactions = [('left', [1, 0, 0]), ('middle', [0, 1, 0]), ('right', [0, 0, 1])]\nself.num_orientations = 3\nself.num_shapes = 3\nself.num_colours = 2\nself.presentationtime = 0.5\nself.rewardtime = 0.1\nself.presentationperiod = [0, self.presentationtime]\nself.rewardperiod = [self.presentationt...
<|body_start_0|> self.rewardval = 1.5 actions = [('left', [1, 0, 0]), ('middle', [0, 1, 0]), ('right', [0, 0, 1])] self.num_orientations = 3 self.num_shapes = 3 self.num_colours = 2 self.presentationtime = 0.5 self.rewardtime = 0.1 self.presentationperiod ...
Environment to recreate the task from Badre et al. (2010) 'Frontal cortex and the discovery of abstract action rules.' :input action: vector representing action selected by agent :output state: vector representing current state :output reward: reward value
BadreEnvironment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BadreEnvironment: """Environment to recreate the task from Badre et al. (2010) 'Frontal cortex and the discovery of abstract action rules.' :input action: vector representing action selected by agent :output state: vector representing current state :output reward: reward value""" def __init_...
stack_v2_sparse_classes_36k_train_017310
7,395
no_license
[ { "docstring": "Set up task parameters. :param flat: if True, no hierarchical relationship between stimuli and reward; if False, stimuli-response rewards will be dependent on colour", "name": "__init__", "signature": "def __init__(self, flat=False)" }, { "docstring": "Update state/reward each ti...
4
stack_v2_sparse_classes_30k_train_012070
Implement the Python class `BadreEnvironment` described below. Class description: Environment to recreate the task from Badre et al. (2010) 'Frontal cortex and the discovery of abstract action rules.' :input action: vector representing action selected by agent :output state: vector representing current state :output r...
Implement the Python class `BadreEnvironment` described below. Class description: Environment to recreate the task from Badre et al. (2010) 'Frontal cortex and the discovery of abstract action rules.' :input action: vector representing action selected by agent :output state: vector representing current state :output r...
09668925404454997bac63cf56c176cde381f614
<|skeleton|> class BadreEnvironment: """Environment to recreate the task from Badre et al. (2010) 'Frontal cortex and the discovery of abstract action rules.' :input action: vector representing action selected by agent :output state: vector representing current state :output reward: reward value""" def __init_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BadreEnvironment: """Environment to recreate the task from Badre et al. (2010) 'Frontal cortex and the discovery of abstract action rules.' :input action: vector representing action selected by agent :output state: vector representing current state :output reward: reward value""" def __init__(self, flat=...
the_stack_v2_python_sparse
hrlproject/environment/badreenvironment.py
amoliu/nhrlmodel
train
0
134eb205c3cd9e5af7b1b56dec10a468e539243f
[ "self.root = root\nself.stack = []\nfake_root = root\nif root is not None:\n self.stack.append(root)\n while fake_root.left is not None:\n self.stack.append(fake_root.left)\n fake_root = fake_root.left", "if len(self.stack) == 0:\n return False\nreturn True", "if self.hasNext:\n next_n...
<|body_start_0|> self.root = root self.stack = [] fake_root = root if root is not None: self.stack.append(root) while fake_root.left is not None: self.stack.append(fake_root.left) fake_root = fake_root.left <|end_body_0|> <|body_st...
BSTIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.root = root ...
stack_v2_sparse_classes_36k_train_017311
1,075
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasNext(self)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" } ]
3
null
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int <|skeleton|> class BSTIterator: def __init__(self, root...
4aa3a3a0da8b911e140446352debb9b567b6d78b
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSTIterator: def __init__(self, root): """:type root: TreeNode""" self.root = root self.stack = [] fake_root = root if root is not None: self.stack.append(root) while fake_root.left is not None: self.stack.append(fake_root.left) ...
the_stack_v2_python_sparse
binary_search_tree_iterator_173.py
adiggo/leetcode_py
train
0
c72910de0f5cf5a9acc34a992751c48cebd79329
[ "if package is None:\n package = Package.from_resource_ids()\nself.package = package\nmd = self.package.to_sql()\nsqlite_path = Path(base_dir) / f'{db_name}.sqlite'\nif not sqlite_path.exists():\n raise RuntimeError(f'{sqlite_path} not initialized! Run `alembic upgrade head`.')\nsuper().__init__(base_dir, db_...
<|body_start_0|> if package is None: package = Package.from_resource_ids() self.package = package md = self.package.to_sql() sqlite_path = Path(base_dir) / f'{db_name}.sqlite' if not sqlite_path.exists(): raise RuntimeError(f'{sqlite_path} not initialized!...
IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class.
PudlSQLiteIOManager
[ "CC-BY-4.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PudlSQLiteIOManager: """IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class.""" def __init__(self, base_dir: str, db_name: str, packa...
stack_v2_sparse_classes_36k_train_017312
31,261
permissive
[ { "docstring": "Initialize PudlSQLiteIOManager. Args: base_dir: base directory where all the step outputs which use this object manager will be stored in. db_name: the name of sqlite database. package: Package object that contains collections of :class:`pudl.metadata.classes.Resources` objects and methods for v...
4
null
Implement the Python class `PudlSQLiteIOManager` described below. Class description: IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class. Method signatures and...
Implement the Python class `PudlSQLiteIOManager` described below. Class description: IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class. Method signatures and...
6afae8aade053408f23ac4332d5cbb438ab72dc6
<|skeleton|> class PudlSQLiteIOManager: """IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class.""" def __init__(self, base_dir: str, db_name: str, packa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PudlSQLiteIOManager: """IO Manager that writes and retrieves dataframes from a SQLite database. This class extends the SQLiteIOManager class to manage database metadata and dtypes using the :class:`pudl.metadata.classes.Package` class.""" def __init__(self, base_dir: str, db_name: str, package: Package |...
the_stack_v2_python_sparse
src/pudl/io_managers.py
catalyst-cooperative/pudl
train
382
de4c27e6dd386378912efd8a8db95cc3d1ac9025
[ "fields = super(RoomInviteKeySerializer, self).get_fields()\nif self.context['request'].user.is_staff:\n fields['room'].queryset = Room.objects.all()\nelse:\n fields['room'].queryset = Room.objects.filter(admins__in=[self.context['request'].user])\nreturn fields", "request_user = self.context['request'].use...
<|body_start_0|> fields = super(RoomInviteKeySerializer, self).get_fields() if self.context['request'].user.is_staff: fields['room'].queryset = Room.objects.all() else: fields['room'].queryset = Room.objects.filter(admins__in=[self.context['request'].user]) return...
Serializer associated with RoomInviteKey model.
RoomInviteKeySerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoomInviteKeySerializer: """Serializer associated with RoomInviteKey model.""" def get_fields(self): """Overrides queryset for 'room' field.""" <|body_0|> def create(self, validated_data): """Overrides creation of new object. Sets creator field.""" <|body...
stack_v2_sparse_classes_36k_train_017313
7,167
no_license
[ { "docstring": "Overrides queryset for 'room' field.", "name": "get_fields", "signature": "def get_fields(self)" }, { "docstring": "Overrides creation of new object. Sets creator field.", "name": "create", "signature": "def create(self, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_000737
Implement the Python class `RoomInviteKeySerializer` described below. Class description: Serializer associated with RoomInviteKey model. Method signatures and docstrings: - def get_fields(self): Overrides queryset for 'room' field. - def create(self, validated_data): Overrides creation of new object. Sets creator fie...
Implement the Python class `RoomInviteKeySerializer` described below. Class description: Serializer associated with RoomInviteKey model. Method signatures and docstrings: - def get_fields(self): Overrides queryset for 'room' field. - def create(self, validated_data): Overrides creation of new object. Sets creator fie...
1545b7bf8c01c439a2f8385358a0b3d09dddf4b3
<|skeleton|> class RoomInviteKeySerializer: """Serializer associated with RoomInviteKey model.""" def get_fields(self): """Overrides queryset for 'room' field.""" <|body_0|> def create(self, validated_data): """Overrides creation of new object. Sets creator field.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoomInviteKeySerializer: """Serializer associated with RoomInviteKey model.""" def get_fields(self): """Overrides queryset for 'room' field.""" fields = super(RoomInviteKeySerializer, self).get_fields() if self.context['request'].user.is_staff: fields['room'].queryset ...
the_stack_v2_python_sparse
api/serializers.py
mszan/chat-backend
train
0
5a0aa3c571a2b2c460401d7837dc71a3d28d2ad7
[ "self.transformed_collection: list[TiTransform] = []\nfor ti_dict in self.ti_dicts:\n self.transformed_collection.append(TiTransform(ti_dict, self.transforms))", "self.process()\nbatch = {'group': [], 'indicator': []}\nself.log.trace(f'feature=ti-transform-batch, ti-count={len(self.transformed_collection)}')\n...
<|body_start_0|> self.transformed_collection: list[TiTransform] = [] for ti_dict in self.ti_dicts: self.transformed_collection.append(TiTransform(ti_dict, self.transforms)) <|end_body_0|> <|body_start_1|> self.process() batch = {'group': [], 'indicator': []} self.log...
Mappings
TiTransforms
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TiTransforms: """Mappings""" def process(self): """Process the mapping.""" <|body_0|> def batch(self) -> dict: """Return the data in batch format.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.transformed_collection: list[TiTransform] = [...
stack_v2_sparse_classes_36k_train_017314
6,246
permissive
[ { "docstring": "Process the mapping.", "name": "process", "signature": "def process(self)" }, { "docstring": "Return the data in batch format.", "name": "batch", "signature": "def batch(self) -> dict" } ]
2
stack_v2_sparse_classes_30k_train_016554
Implement the Python class `TiTransforms` described below. Class description: Mappings Method signatures and docstrings: - def process(self): Process the mapping. - def batch(self) -> dict: Return the data in batch format.
Implement the Python class `TiTransforms` described below. Class description: Mappings Method signatures and docstrings: - def process(self): Process the mapping. - def batch(self) -> dict: Return the data in batch format. <|skeleton|> class TiTransforms: """Mappings""" def process(self): """Process...
30dc147e40d63d1082ec2a5e6c62005b60c29c37
<|skeleton|> class TiTransforms: """Mappings""" def process(self): """Process the mapping.""" <|body_0|> def batch(self) -> dict: """Return the data in batch format.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TiTransforms: """Mappings""" def process(self): """Process the mapping.""" self.transformed_collection: list[TiTransform] = [] for ti_dict in self.ti_dicts: self.transformed_collection.append(TiTransform(ti_dict, self.transforms)) def batch(self) -> dict: ...
the_stack_v2_python_sparse
tcex/api/tc/ti_transform/ti_transform.py
ThreatConnect-Inc/tcex
train
24
bac71bc0083e45eccfd200f32632e5115cdb9a51
[ "self._G = G\nself._Ro = Ro.copy()\nself._r = r\nif Ro.ndim == 2:\n self._Ro2 = cholesky(Ro)\nelse:\n self._Ro2 = sqrt(Ro)", "G = self._G\nRo = self._Ro\nr = self._r\nnvar, ne = ensemble.shape\nanl = np.empty_like(ensemble)\nmu = ensemble.mean(axis=1)\nU = ensemble - mu[:, None]\nV = G(ensemble)\nV = V - V....
<|body_start_0|> self._G = G self._Ro = Ro.copy() self._r = r if Ro.ndim == 2: self._Ro2 = cholesky(Ro) else: self._Ro2 = sqrt(Ro) <|end_body_0|> <|body_start_1|> G = self._G Ro = self._Ro r = self._r nvar, ne = ensemble.sh...
Object for performing ensemble kalman filter The observation model is given by: obs = G(pred) + eta with Var (eta) = Ro.
EnKFAnalysis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnKFAnalysis: """Object for performing ensemble kalman filter The observation model is given by: obs = G(pred) + eta with Var (eta) = Ro.""" def __init__(self, G, Ro, r=1.0): """TODO: Docstring for __init__. Args: G: observation operator with signature G(arr, axis=0, i=Ellipsis) Ro (...
stack_v2_sparse_classes_36k_train_017315
10,503
no_license
[ { "docstring": "TODO: Docstring for __init__. Args: G: observation operator with signature G(arr, axis=0, i=Ellipsis) Ro (2d or 1d array): observation noise covariance", "name": "__init__", "signature": "def __init__(self, G, Ro, r=1.0)" }, { "docstring": "Preform EnKF analysis :ensemble: ensemb...
2
stack_v2_sparse_classes_30k_train_016809
Implement the Python class `EnKFAnalysis` described below. Class description: Object for performing ensemble kalman filter The observation model is given by: obs = G(pred) + eta with Var (eta) = Ro. Method signatures and docstrings: - def __init__(self, G, Ro, r=1.0): TODO: Docstring for __init__. Args: G: observatio...
Implement the Python class `EnKFAnalysis` described below. Class description: Object for performing ensemble kalman filter The observation model is given by: obs = G(pred) + eta with Var (eta) = Ro. Method signatures and docstrings: - def __init__(self, G, Ro, r=1.0): TODO: Docstring for __init__. Args: G: observatio...
6cf38886fad397dd90c2a2590e469e354d61e809
<|skeleton|> class EnKFAnalysis: """Object for performing ensemble kalman filter The observation model is given by: obs = G(pred) + eta with Var (eta) = Ro.""" def __init__(self, G, Ro, r=1.0): """TODO: Docstring for __init__. Args: G: observation operator with signature G(arr, axis=0, i=Ellipsis) Ro (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnKFAnalysis: """Object for performing ensemble kalman filter The observation model is given by: obs = G(pred) + eta with Var (eta) = Ro.""" def __init__(self, G, Ro, r=1.0): """TODO: Docstring for __init__. Args: G: observation operator with signature G(arr, axis=0, i=Ellipsis) Ro (2d or 1d arra...
the_stack_v2_python_sparse
python/gnl/filter/ensemble.py
nbren12/gnl
train
1
4eca387528e53aa20835173db4bbc588aa27c96d
[ "super().__init__()\nself.attn = attn\nself.ffn = ffn\nself.skiplayers = clones(SkipLayer(ffn.d, drop), 2)\nself.d = ffn.d", "x = self.skiplayers[0](x, lambda x: self.attn(x, x, x, mask))\nx = self.skiplayers[1](x, self.ffn)\nreturn x" ]
<|body_start_0|> super().__init__() self.attn = attn self.ffn = ffn self.skiplayers = clones(SkipLayer(ffn.d, drop), 2) self.d = ffn.d <|end_body_0|> <|body_start_1|> x = self.skiplayers[0](x, lambda x: self.attn(x, x, x, mask)) x = self.skiplayers[1](x, self.ffn...
EncoderLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderLayer: def __init__(self, attn, ffn, drop): """attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection""" <|body_0|> def forward(self, x, mask): """x:(N,T,D) mask:(N,1,T) return:(N,T,D)""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_017316
11,927
no_license
[ { "docstring": "attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection", "name": "__init__", "signature": "def __init__(self, attn, ffn, drop)" }, { "docstring": "x:(N,T,D) mask:(N,1,T) return:(N,T,D)", "name": "forward", "signature": "def forward(self, x, m...
2
stack_v2_sparse_classes_30k_train_017333
Implement the Python class `EncoderLayer` described below. Class description: Implement the EncoderLayer class. Method signatures and docstrings: - def __init__(self, attn, ffn, drop): attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection - def forward(self, x, mask): x:(N,T,D) mask:(N,...
Implement the Python class `EncoderLayer` described below. Class description: Implement the EncoderLayer class. Method signatures and docstrings: - def __init__(self, attn, ffn, drop): attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection - def forward(self, x, mask): x:(N,T,D) mask:(N,...
24e60f24b6e442db22507adddd6bf3e2c343c013
<|skeleton|> class EncoderLayer: def __init__(self, attn, ffn, drop): """attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection""" <|body_0|> def forward(self, x, mask): """x:(N,T,D) mask:(N,1,T) return:(N,T,D)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderLayer: def __init__(self, attn, ffn, drop): """attn:MultiAttentionLayer ffn:feed forward Layer drop:drop factor for skip connection""" super().__init__() self.attn = attn self.ffn = ffn self.skiplayers = clones(SkipLayer(ffn.d, drop), 2) self.d = ffn.d ...
the_stack_v2_python_sparse
daily/8/pytorch_tutoral/nmt/model.py
mckjzhangxk/deepAI
train
1
fbcf65e16ccaaeb3a973dd02c1d2ee07354f0ade
[ "import collections\nself.cache = collections.OrderedDict()\nself.capacity = capacity", "ret = self.cache.pop(key, -1)\nif ret != -1:\n self.cache[key] = ret\nreturn ret", "self.cache.pop(key, None)\nif len(self.cache) == self.capacity:\n self.cache.popitem(last=False)\nself.cache[key] = value" ]
<|body_start_0|> import collections self.cache = collections.OrderedDict() self.capacity = capacity <|end_body_0|> <|body_start_1|> ret = self.cache.pop(key, -1) if ret != -1: self.cache[key] = ret return ret <|end_body_1|> <|body_start_2|> self.cach...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_017317
681
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_009168
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
88a822c48ef50187507d0f75ce65ecc39e849839
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" import collections self.cache = collections.OrderedDict() self.capacity = capacity def get(self, key): """:rtype: int""" ret = self.cache.pop(key, -1) if ret != -1: self.c...
the_stack_v2_python_sparse
captainhcg/py/146-lru-cache.py
captainhcg/leetcode-in-py-and-go
train
1
494a504bcc1fa537c969086058df07c0bf99520f
[ "with catch(self):\n out = (yield self.project_versions_service.select(fields='log', conds={'name': prj_name, 'version': version}, ct=False, one=True))\n data = {'log': json.loads(out['log']), 'update_time': out['update_time']}\n self.success(data)", "with catch(self):\n data_id = (yield self.project_...
<|body_start_0|> with catch(self): out = (yield self.project_versions_service.select(fields='log', conds={'name': prj_name, 'version': version}, ct=False, one=True)) data = {'log': json.loads(out['log']), 'update_time': out['update_time']} self.success(data) <|end_body_0|> <...
ProjectImageLogHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectImageLogHandler: def get(self, prj_name, version): """@api {get} /api/project/([\\w\\W]+)/image/([\\w\\W]+)/log 获取相关项目的某一版本的构建日志 @apiName ProjectImageLogHandler @apiGroup Project @apiParam {String} prj_name 项目名字 @apiParam {String} version 版本 @apiSuccessExample Success-Response: HT...
stack_v2_sparse_classes_36k_train_017318
20,395
no_license
[ { "docstring": "@api {get} /api/project/([\\\\w\\\\W]+)/image/([\\\\w\\\\W]+)/log 获取相关项目的某一版本的构建日志 @apiName ProjectImageLogHandler @apiGroup Project @apiParam {String} prj_name 项目名字 @apiParam {String} version 版本 @apiSuccessExample Success-Response: HTTP/1.1 200 OK { \"status\":0, \"msg\": \"success\", \"data\":...
2
stack_v2_sparse_classes_30k_train_013473
Implement the Python class `ProjectImageLogHandler` described below. Class description: Implement the ProjectImageLogHandler class. Method signatures and docstrings: - def get(self, prj_name, version): @api {get} /api/project/([\\w\\W]+)/image/([\\w\\W]+)/log 获取相关项目的某一版本的构建日志 @apiName ProjectImageLogHandler @apiGroup...
Implement the Python class `ProjectImageLogHandler` described below. Class description: Implement the ProjectImageLogHandler class. Method signatures and docstrings: - def get(self, prj_name, version): @api {get} /api/project/([\\w\\W]+)/image/([\\w\\W]+)/log 获取相关项目的某一版本的构建日志 @apiName ProjectImageLogHandler @apiGroup...
0b09280afe5b764a485b3bf6e760aaf9a68bc4d5
<|skeleton|> class ProjectImageLogHandler: def get(self, prj_name, version): """@api {get} /api/project/([\\w\\W]+)/image/([\\w\\W]+)/log 获取相关项目的某一版本的构建日志 @apiName ProjectImageLogHandler @apiGroup Project @apiParam {String} prj_name 项目名字 @apiParam {String} version 版本 @apiSuccessExample Success-Response: HT...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectImageLogHandler: def get(self, prj_name, version): """@api {get} /api/project/([\\w\\W]+)/image/([\\w\\W]+)/log 获取相关项目的某一版本的构建日志 @apiName ProjectImageLogHandler @apiGroup Project @apiParam {String} prj_name 项目名字 @apiParam {String} version 版本 @apiSuccessExample Success-Response: HTTP/1.1 200 OK ...
the_stack_v2_python_sparse
handler/project/project.py
pickCloud/TenCloud_Backend
train
0
4e1c462f55a847c42174321211330c2bbcc9858d
[ "result = self.helper_find_target(root, k)\nprint(result)\nreturn True if result[1] else False", "if compliments is None and pairs is None:\n compliments = set()\n pairs = []\nif node is None:\n return (False, pairs)\nif node.val in compliments:\n pairs.append((node.val, k - node.val))\n return (Tr...
<|body_start_0|> result = self.helper_find_target(root, k) print(result) return True if result[1] else False <|end_body_0|> <|body_start_1|> if compliments is None and pairs is None: compliments = set() pairs = [] if node is None: return (Fals...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" <|body_0|> def helper_find_target(self, node, k, compliments=None, pairs=None): """Helper function to traverse the tree and find the pairs""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_017319
1,528
permissive
[ { "docstring": ":type root: TreeNode :type k: int :rtype: bool", "name": "findTarget", "signature": "def findTarget(self, root, k)" }, { "docstring": "Helper function to traverse the tree and find the pairs", "name": "helper_find_target", "signature": "def helper_find_target(self, node, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool - def helper_find_target(self, node, k, compliments=None, pairs=None): Helper function to traverse t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool - def helper_find_target(self, node, k, compliments=None, pairs=None): Helper function to traverse t...
547c200b627c774535bc22880b16d5390183aeba
<|skeleton|> class Solution: def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" <|body_0|> def helper_find_target(self, node, k, compliments=None, pairs=None): """Helper function to traverse the tree and find the pairs""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" result = self.helper_find_target(root, k) print(result) return True if result[1] else False def helper_find_target(self, node, k, compliments=None, pairs=None): """Helper ...
the_stack_v2_python_sparse
easy/653_two_sum_in_bst.py
Sukhrobjon/leetcode
train
0
14111f31d02a5272747019078e08e245fbab4399
[ "log.msg('connectionLost')\nlog.err(reason)\nreactor.callLater(5, shutdown)", "defer = DBPOOL.runInteraction(real_parser, data)\ndefer.addCallback(write_memcache)\ndefer.addErrback(common.email_error, data)\ndefer.addErrback(log.err)" ]
<|body_start_0|> log.msg('connectionLost') log.err(reason) reactor.callLater(5, shutdown) <|end_body_0|> <|body_start_1|> defer = DBPOOL.runInteraction(real_parser, data) defer.addCallback(write_memcache) defer.addErrback(common.email_error, data) defer.addErrbac...
I receive products from ldmbridge and process them 1 by 1 :)
MyProductIngestor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyProductIngestor: """I receive products from ldmbridge and process them 1 by 1 :)""" def connectionLost(self, reason): """called when the connection is lost""" <|body_0|> def process_data(self, data): """Process the product""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_017320
3,601
permissive
[ { "docstring": "called when the connection is lost", "name": "connectionLost", "signature": "def connectionLost(self, reason)" }, { "docstring": "Process the product", "name": "process_data", "signature": "def process_data(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_012362
Implement the Python class `MyProductIngestor` described below. Class description: I receive products from ldmbridge and process them 1 by 1 :) Method signatures and docstrings: - def connectionLost(self, reason): called when the connection is lost - def process_data(self, data): Process the product
Implement the Python class `MyProductIngestor` described below. Class description: I receive products from ldmbridge and process them 1 by 1 :) Method signatures and docstrings: - def connectionLost(self, reason): called when the connection is lost - def process_data(self, data): Process the product <|skeleton|> cla...
e9ca4c4ad0a6e5a6e6479a84d86fd21ad2a0be00
<|skeleton|> class MyProductIngestor: """I receive products from ldmbridge and process them 1 by 1 :)""" def connectionLost(self, reason): """called when the connection is lost""" <|body_0|> def process_data(self, data): """Process the product""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyProductIngestor: """I receive products from ldmbridge and process them 1 by 1 :)""" def connectionLost(self, reason): """called when the connection is lost""" log.msg('connectionLost') log.err(reason) reactor.callLater(5, shutdown) def process_data(self, data): ...
the_stack_v2_python_sparse
parsers/afos_dump.py
xlia/pyWWA
train
0
0582fe1d0c3100afd8d4baa29f0fbca1dbf47097
[ "super(GCN, self).__init__()\nself.blocks = [build_graph_conv_layers(hidden_dim, affinity_matrix, 1, gconv_class, name='gconv0', kernel_initializer=kernel_initializer, bias_initializer=bias_initializer, **kwargs)]\nif use_non_local:\n self.blocks.append(GraphNonLocal())\nfor i in range(num_residual_gconv_blocks)...
<|body_start_0|> super(GCN, self).__init__() self.blocks = [build_graph_conv_layers(hidden_dim, affinity_matrix, 1, gconv_class, name='gconv0', kernel_initializer=kernel_initializer, bias_initializer=bias_initializer, **kwargs)] if use_non_local: self.blocks.append(GraphNonLocal()) ...
Implements Graph Convolutional Network.
GCN
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GCN: """Implements Graph Convolutional Network.""" def __init__(self, output_dim, affinity_matrix, gconv_class, hidden_dim=128, num_residual_gconv_blocks=4, num_layers_per_block=2, use_non_local=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', **kwargs): """Initia...
stack_v2_sparse_classes_36k_train_017321
30,548
permissive
[ { "docstring": "Initializer. Args: output_dim: An integer for the dimension of the output. affinity_matrix: A tensor for the keypoint affinity matrix. gconv_class: A graph convolutional class to use. hidden_dim: An integer for the dimension of layers. num_residual_gconv_blocks: An integer for the number of resi...
2
null
Implement the Python class `GCN` described below. Class description: Implements Graph Convolutional Network. Method signatures and docstrings: - def __init__(self, output_dim, affinity_matrix, gconv_class, hidden_dim=128, num_residual_gconv_blocks=4, num_layers_per_block=2, use_non_local=True, kernel_initializer='glo...
Implement the Python class `GCN` described below. Class description: Implements Graph Convolutional Network. Method signatures and docstrings: - def __init__(self, output_dim, affinity_matrix, gconv_class, hidden_dim=128, num_residual_gconv_blocks=4, num_layers_per_block=2, use_non_local=True, kernel_initializer='glo...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class GCN: """Implements Graph Convolutional Network.""" def __init__(self, output_dim, affinity_matrix, gconv_class, hidden_dim=128, num_residual_gconv_blocks=4, num_layers_per_block=2, use_non_local=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', **kwargs): """Initia...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GCN: """Implements Graph Convolutional Network.""" def __init__(self, output_dim, affinity_matrix, gconv_class, hidden_dim=128, num_residual_gconv_blocks=4, num_layers_per_block=2, use_non_local=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', **kwargs): """Initializer. Args: ...
the_stack_v2_python_sparse
poem/cv_mim/models.py
Jimmy-INL/google-research
train
1
b85b73b2e9056d0fff481e76b9554389f41d086f
[ "super(FasterBackbone, self).__init__()\nself.backbone = SpResNetDet(depth=depth, block=block, code=code, pretrained=pretrained, pretrained_arch=pretrained_arch)\nself.adaptiveAvgPool2d = AdaptiveAvgPool2d(output_size=(1, 1))\nself.view = View()\nout_plane = out_plane or self.backbone.out_channels\nself.head = Line...
<|body_start_0|> super(FasterBackbone, self).__init__() self.backbone = SpResNetDet(depth=depth, block=block, code=code, pretrained=pretrained, pretrained_arch=pretrained_arch) self.adaptiveAvgPool2d = AdaptiveAvgPool2d(output_size=(1, 1)) self.view = View() out_plane = out_plane...
Create ResNet SearchSpace.
FasterBackbone
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterBackbone: """Create ResNet SearchSpace.""" def __init__(self, code=None, depth=18, base_channel=64, out_plane=2048, stage=4, num_class=1000, small_input=True, block='BasicBlock', pretrained_arch=None, pretrained=None): """Create layers. :param num_reps: number of layers :type n...
stack_v2_sparse_classes_36k_train_017322
1,931
permissive
[ { "docstring": "Create layers. :param num_reps: number of layers :type num_reqs: int :param items: channel and stride of every layer :type items: dict :param num_class: number of class :type num_class: int", "name": "__init__", "signature": "def __init__(self, code=None, depth=18, base_channel=64, out_p...
2
null
Implement the Python class `FasterBackbone` described below. Class description: Create ResNet SearchSpace. Method signatures and docstrings: - def __init__(self, code=None, depth=18, base_channel=64, out_plane=2048, stage=4, num_class=1000, small_input=True, block='BasicBlock', pretrained_arch=None, pretrained=None):...
Implement the Python class `FasterBackbone` described below. Class description: Create ResNet SearchSpace. Method signatures and docstrings: - def __init__(self, code=None, depth=18, base_channel=64, out_plane=2048, stage=4, num_class=1000, small_input=True, block='BasicBlock', pretrained_arch=None, pretrained=None):...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class FasterBackbone: """Create ResNet SearchSpace.""" def __init__(self, code=None, depth=18, base_channel=64, out_plane=2048, stage=4, num_class=1000, small_input=True, block='BasicBlock', pretrained_arch=None, pretrained=None): """Create layers. :param num_reps: number of layers :type n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FasterBackbone: """Create ResNet SearchSpace.""" def __init__(self, code=None, depth=18, base_channel=64, out_plane=2048, stage=4, num_class=1000, small_input=True, block='BasicBlock', pretrained_arch=None, pretrained=None): """Create layers. :param num_reps: number of layers :type num_reqs: int ...
the_stack_v2_python_sparse
zeus/networks/faster_backbone.py
huawei-noah/xingtian
train
308
1cf0621b2bf28318bab9a2e89315d2289c07c658
[ "list.sort(nums)\nresult = []\nfor i, first in enumerate(nums[:-1]):\n if i > 0 and nums[i] == nums[i - 1]:\n continue\n head, tail = (i + 1, len(nums) - 1)\n while head < tail:\n second, third = (nums[head], nums[tail])\n sec_n_thr = -(second + third)\n if first < sec_n_thr:\n ...
<|body_start_0|> list.sort(nums) result = [] for i, first in enumerate(nums[:-1]): if i > 0 and nums[i] == nums[i - 1]: continue head, tail = (i + 1, len(nums) - 1) while head < tail: second, third = (nums[head], nums[tail]) ...
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 threeSumFailed(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> list.sort(nums) ...
stack_v2_sparse_classes_36k_train_017323
2,389
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSumFailed", "signature": "def threeSumFailed(self, nums)" } ]
2
null
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 threeSumFailed(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSumFailed(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Soluti...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSumFailed(self, nums): """:type nums: List[int] :rtype: List[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]]""" list.sort(nums) result = [] for i, first in enumerate(nums[:-1]): if i > 0 and nums[i] == nums[i - 1]: continue head, tail = (i + 1, len(nums) - 1) ...
the_stack_v2_python_sparse
cs_notes/two_pointers/threesum.py
hwc1824/LeetCodeSolution
train
0
bec9173988dc9f13288740b2606ed8e6a2ae4572
[ "self.radius = radius\nself.x_center = x_center\nself.y_center = y_center", "while x ** 2 + y ** 2 > self.radius ** 2:\n x = random.choice([1, -1]) * random.uniform(0, self.radius)\n y = random.choice([1, -1]) * random.uniform(0, self.radius)\nreturn [self.x_center + x, self.y_center + y]" ]
<|body_start_0|> self.radius = radius self.x_center = x_center self.y_center = y_center <|end_body_0|> <|body_start_1|> while x ** 2 + y ** 2 > self.radius ** 2: x = random.choice([1, -1]) * random.uniform(0, self.radius) y = random.choice([1, -1]) * random.unifo...
RandPoint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandPoint: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.radius = rad...
stack_v2_sparse_classes_36k_train_017324
3,885
no_license
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
stack_v2_sparse_classes_30k_train_006280
Implement the Python class `RandPoint` described below. Class description: Implement the RandPoint class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `RandPoint` described below. Class description: Implement the RandPoint class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class R...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class RandPoint: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandPoint: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.radius = radius self.x_center = x_center self.y_center = y_center def randPoint(self): """:rtype: List[float]""" while x **...
the_stack_v2_python_sparse
0.算法/20180822.py
unlimitediw/CheckCode
train
0
08e2e20e7b3fa046fc9d926ccfe1d9e4cc8322cb
[ "self.chassis_id = chassis_id\nself.chassis_name = chassis_name\nself.chassis_serial = chassis_serial\nself.location = location\nself.rack_id = rack_id", "if dictionary is None:\n return None\nchassis_id = dictionary.get('chassisId')\nchassis_name = dictionary.get('chassisName')\nchassis_serial = dictionary.ge...
<|body_start_0|> self.chassis_id = chassis_id self.chassis_name = chassis_name self.chassis_serial = chassis_serial self.location = location self.rack_id = rack_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None chassis_id = diction...
Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by default. chassis_serial (string): Chassis s...
ChassisInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChassisInfo: """Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by defa...
stack_v2_sparse_classes_36k_train_017325
2,429
permissive
[ { "docstring": "Constructor for the ChassisInfo class", "name": "__init__", "signature": "def __init__(self, chassis_id=None, chassis_name=None, chassis_serial=None, location=None, rack_id=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)...
2
stack_v2_sparse_classes_30k_train_009628
Implement the Python class `ChassisInfo` described below. Class description: Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This cou...
Implement the Python class `ChassisInfo` described below. Class description: Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This cou...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ChassisInfo: """Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by defa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChassisInfo: """Implementation of the 'ChassisInfo' model. ChassisInfo is the struct for the Chassis. Attributes: chassis_id (long|int): ChassisId is a unique id assigned to the chassis. chassis_name (string): ChassisName is the name of the chassis. This could be the chassis serial number by default. chassis_...
the_stack_v2_python_sparse
cohesity_management_sdk/models/chassis_info.py
cohesity/management-sdk-python
train
24
3951715254438363f25a026404c0c1e019c6b0e7
[ "super(LiveLink, self).__init__()\nself._subsets = subsets\nself._listen = True", "def subset_in_link(message):\n return message.sender in self._subsets\nhub.subscribe(self, SubsetUpdateMessage, filter=subset_in_link)", "state, style = (reference.subset_state, reference.style)\nfor subset in self._subsets:\n...
<|body_start_0|> super(LiveLink, self).__init__() self._subsets = subsets self._listen = True <|end_body_0|> <|body_start_1|> def subset_in_link(message): return message.sender in self._subsets hub.subscribe(self, SubsetUpdateMessage, filter=subset_in_link) <|end_bod...
An object to keep subsets in sync
LiveLink
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LiveLink: """An object to keep subsets in sync""" def __init__(self, subsets): """Create a new link instance :param subsets: A list of class:`~glue.core.subset.Subset` instances to link""" <|body_0|> def register_to_hub(self, hub): """Register the link object to ...
stack_v2_sparse_classes_36k_train_017326
1,874
no_license
[ { "docstring": "Create a new link instance :param subsets: A list of class:`~glue.core.subset.Subset` instances to link", "name": "__init__", "signature": "def __init__(self, subsets)" }, { "docstring": "Register the link object to the hub, to receive messages when any subset is updated. :param ...
4
stack_v2_sparse_classes_30k_train_006126
Implement the Python class `LiveLink` described below. Class description: An object to keep subsets in sync Method signatures and docstrings: - def __init__(self, subsets): Create a new link instance :param subsets: A list of class:`~glue.core.subset.Subset` instances to link - def register_to_hub(self, hub): Registe...
Implement the Python class `LiveLink` described below. Class description: An object to keep subsets in sync Method signatures and docstrings: - def __init__(self, subsets): Create a new link instance :param subsets: A list of class:`~glue.core.subset.Subset` instances to link - def register_to_hub(self, hub): Registe...
e7d869363c7784c3a7d8f8b73a4b17fb21208b44
<|skeleton|> class LiveLink: """An object to keep subsets in sync""" def __init__(self, subsets): """Create a new link instance :param subsets: A list of class:`~glue.core.subset.Subset` instances to link""" <|body_0|> def register_to_hub(self, hub): """Register the link object to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LiveLink: """An object to keep subsets in sync""" def __init__(self, subsets): """Create a new link instance :param subsets: A list of class:`~glue.core.subset.Subset` instances to link""" super(LiveLink, self).__init__() self._subsets = subsets self._listen = True de...
the_stack_v2_python_sparse
glue/core/live_link.py
drphilmarshall/glue
train
0
a95c60fe03d416d6c469acf94b3bf55ecf0919ea
[ "self._data_access = data_access\nself._scenario_info = scenario_info\nself.grid = grid\nself.ct = ct\nself.scenario_id = scenario_info['id']\nself.REL_TMP_DIR = self._data_access.tmp_folder(self.scenario_id)", "description = self._data_access.description\nprint(f'--> Creating temporary folder on {description} fo...
<|body_start_0|> self._data_access = data_access self._scenario_info = scenario_info self.grid = grid self.ct = ct self.scenario_id = scenario_info['id'] self.REL_TMP_DIR = self._data_access.tmp_folder(self.scenario_id) <|end_body_0|> <|body_start_1|> description...
Prepares scenario for execution. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario_info: scenario information. :param powersimdata.input.grid.Grid grid: a Grid object. :param dict ct: change table.
SimulationInput
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationInput: """Prepares scenario for execution. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario_info: scenario information. :param powersimdata.input.grid.Grid grid: a Grid object. :param dict ct: change table.""" def __init__...
stack_v2_sparse_classes_36k_train_017327
9,166
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, data_access, scenario_info, grid, ct)" }, { "docstring": "Creates folder on server that will enclose simulation inputs.", "name": "create_folder", "signature": "def create_folder(self)" }, { "docs...
4
stack_v2_sparse_classes_30k_train_011138
Implement the Python class `SimulationInput` described below. Class description: Prepares scenario for execution. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario_info: scenario information. :param powersimdata.input.grid.Grid grid: a Grid object. :param dict...
Implement the Python class `SimulationInput` described below. Class description: Prepares scenario for execution. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario_info: scenario information. :param powersimdata.input.grid.Grid grid: a Grid object. :param dict...
2fa9fb907fd55a96ffd3d584614b47af79a0bda8
<|skeleton|> class SimulationInput: """Prepares scenario for execution. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario_info: scenario information. :param powersimdata.input.grid.Grid grid: a Grid object. :param dict ct: change table.""" def __init__...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulationInput: """Prepares scenario for execution. :param powersimdata.data_access.data_access.DataAccess data_access: data access object. :param dict scenario_info: scenario information. :param powersimdata.input.grid.Grid grid: a Grid object. :param dict ct: change table.""" def __init__(self, data_a...
the_stack_v2_python_sparse
powersimdata/scenario/execute.py
abhinavgairola/PowerSimData
train
0
e04f857ccfad76cbf06f8c74727bc55653faa71a
[ "if norm_factory is None:\n norm_factory = nn.BatchNorm2d\nself.norm_factory = norm_factory", "stride = 1\nprojection = None\nif downsample > 1:\n stride = downsample\nif downsample > 1 or channels_in != channels_out:\n projection = nn.Sequential(nn.Conv2d(channels_in, channels_out, stride=stride, kernel...
<|body_start_0|> if norm_factory is None: norm_factory = nn.BatchNorm2d self.norm_factory = norm_factory <|end_body_0|> <|body_start_1|> stride = 1 projection = None if downsample > 1: stride = downsample if downsample > 1 or channels_in != channe...
Factory wrapper for ``torchvision`` ResNet blocks.
ResNetBlockFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNetBlockFactory: """Factory wrapper for ``torchvision`` ResNet blocks.""" def __init__(self, norm_factory: Optional[Callable[[int], nn.Module]]=None): """Args: norm_factory: A factory object to produce the normalization layers used in the ResNet blocks. Defaults to batch norm.""" ...
stack_v2_sparse_classes_36k_train_017328
6,999
permissive
[ { "docstring": "Args: norm_factory: A factory object to produce the normalization layers used in the ResNet blocks. Defaults to batch norm.", "name": "__init__", "signature": "def __init__(self, norm_factory: Optional[Callable[[int], nn.Module]]=None)" }, { "docstring": "Create ResNet block. Arg...
2
stack_v2_sparse_classes_30k_train_012092
Implement the Python class `ResNetBlockFactory` described below. Class description: Factory wrapper for ``torchvision`` ResNet blocks. Method signatures and docstrings: - def __init__(self, norm_factory: Optional[Callable[[int], nn.Module]]=None): Args: norm_factory: A factory object to produce the normalization laye...
Implement the Python class `ResNetBlockFactory` described below. Class description: Factory wrapper for ``torchvision`` ResNet blocks. Method signatures and docstrings: - def __init__(self, norm_factory: Optional[Callable[[int], nn.Module]]=None): Args: norm_factory: A factory object to produce the normalization laye...
a27e329cd30337995c359160a0d878bf331c13fb
<|skeleton|> class ResNetBlockFactory: """Factory wrapper for ``torchvision`` ResNet blocks.""" def __init__(self, norm_factory: Optional[Callable[[int], nn.Module]]=None): """Args: norm_factory: A factory object to produce the normalization layers used in the ResNet blocks. Defaults to batch norm.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResNetBlockFactory: """Factory wrapper for ``torchvision`` ResNet blocks.""" def __init__(self, norm_factory: Optional[Callable[[int], nn.Module]]=None): """Args: norm_factory: A factory object to produce the normalization layers used in the ResNet blocks. Defaults to batch norm.""" if no...
the_stack_v2_python_sparse
quantnn/models/pytorch/torchvision.py
simonpf/quantnn
train
7
51ab87ffe3c4c6d7e73e92b6659dd96a2e60a366
[ "COEFFS = self.COEFFS[imt]\nR = self._compute_term_d(COEFFS, rup.mag, dists.rrup)\nmean = 10 ** self._compute_mean(COEFFS, rup.mag, R)\nif isinstance(imt, (PGA, SA)):\n mean = np.log(mean / (g * 100.0))\nelse:\n mean = np.log(mean)\nc1_rrup = _compute_C1_term(COEFFS, dists.rrup)\nlog_phi_ss = 1.0\nstddevs = s...
<|body_start_0|> COEFFS = self.COEFFS[imt] R = self._compute_term_d(COEFFS, rup.mag, dists.rrup) mean = 10 ** self._compute_mean(COEFFS, rup.mag, R) if isinstance(imt, (PGA, SA)): mean = np.log(mean / (g * 100.0)) else: mean = np.log(mean) c1_rrup ...
This function implements the GMPE developed by Ben Edwards and Donath Fah and published as "A Stochastic Ground-Motion Model for Switzerland" Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 78–98, February 2013. The GMPE was parametrized by Carlo Cauzzi to be implemented in OpenQuake. This class ...
EdwardsFah2013Foreland10Bars
[ "AGPL-3.0-only", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdwardsFah2013Foreland10Bars: """This function implements the GMPE developed by Ben Edwards and Donath Fah and published as "A Stochastic Ground-Motion Model for Switzerland" Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 78–98, February 2013. The GMPE was parametrized by ...
stack_v2_sparse_classes_36k_train_017329
5,506
permissive
[ { "docstring": "compute mean for Foreland", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Compute distance term: original implementation from Carlo Cauzzi if M > 5.5 rmin = 0.55; elseif M > 4.7 rmin = -2.067...
2
null
Implement the Python class `EdwardsFah2013Foreland10Bars` described below. Class description: This function implements the GMPE developed by Ben Edwards and Donath Fah and published as "A Stochastic Ground-Motion Model for Switzerland" Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 78–98, Febru...
Implement the Python class `EdwardsFah2013Foreland10Bars` described below. Class description: This function implements the GMPE developed by Ben Edwards and Donath Fah and published as "A Stochastic Ground-Motion Model for Switzerland" Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 78–98, Febru...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class EdwardsFah2013Foreland10Bars: """This function implements the GMPE developed by Ben Edwards and Donath Fah and published as "A Stochastic Ground-Motion Model for Switzerland" Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 78–98, February 2013. The GMPE was parametrized by ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EdwardsFah2013Foreland10Bars: """This function implements the GMPE developed by Ben Edwards and Donath Fah and published as "A Stochastic Ground-Motion Model for Switzerland" Bulletin of the Seismological Society of America, Vol. 103, No. 1, pp. 78–98, February 2013. The GMPE was parametrized by Carlo Cauzzi ...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/edwards_fah_2013f.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
4992579fbfbb1cfc387409773e6ea138466b8b56
[ "if n == 1:\n return 1\nprev = isBadVersion(n)\nfor i in range(n - 1, 0, -1):\n now = isBadVersion(i)\n if prev != now:\n return i + 1\n prev = now\nreturn 1", "left, right = (1, n)\nwhile left < right:\n mid = left + (right - left) // 2\n if isBadVersion(mid):\n right = mid\n e...
<|body_start_0|> if n == 1: return 1 prev = isBadVersion(n) for i in range(n - 1, 0, -1): now = isBadVersion(i) if prev != now: return i + 1 prev = now return 1 <|end_body_0|> <|body_start_1|> left, right = (1, n) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def first_bad_version(self, n: int) -> int: """暴力搜索。(超时了)""" <|body_0|> def first_bad_version_2(self, n: int) -> int: """二分搜索。""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 1: return 1 prev = isBadVersion(n) ...
stack_v2_sparse_classes_36k_train_017330
3,364
no_license
[ { "docstring": "暴力搜索。(超时了)", "name": "first_bad_version", "signature": "def first_bad_version(self, n: int) -> int" }, { "docstring": "二分搜索。", "name": "first_bad_version_2", "signature": "def first_bad_version_2(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def first_bad_version(self, n: int) -> int: 暴力搜索。(超时了) - def first_bad_version_2(self, n: int) -> int: 二分搜索。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def first_bad_version(self, n: int) -> int: 暴力搜索。(超时了) - def first_bad_version_2(self, n: int) -> int: 二分搜索。 <|skeleton|> class Solution: def first_bad_version(self, n: int...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class Solution: def first_bad_version(self, n: int) -> int: """暴力搜索。(超时了)""" <|body_0|> def first_bad_version_2(self, n: int) -> int: """二分搜索。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def first_bad_version(self, n: int) -> int: """暴力搜索。(超时了)""" if n == 1: return 1 prev = isBadVersion(n) for i in range(n - 1, 0, -1): now = isBadVersion(i) if prev != now: return i + 1 prev = now ...
the_stack_v2_python_sparse
0278_first-bad-version.py
Nigirimeshi/leetcode
train
0
0d6fc9deadf77ac22c187d4788460e8e869b0360
[ "self._nodenet.is_flowbuilder_active = True\nyield\nself._nodenet.is_flowbuilder_active = False\nself._nodenet.update_flow_graphs()", "source = source_node if source_node == 'worldadapter' else source_node.uid\ntarget = target_node if target_node == 'worldadapter' else target_node.uid\nreturn self._nodenet.flow(s...
<|body_start_0|> self._nodenet.is_flowbuilder_active = True yield self._nodenet.is_flowbuilder_active = False self._nodenet.update_flow_graphs() <|end_body_0|> <|body_start_1|> source = source_node if source_node == 'worldadapter' else source_node.uid target = target_nod...
Flow-extension to netapi. Intended to work with flow-engine type nodenets
FlowNetAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowNetAPI: """Flow-extension to netapi. Intended to work with flow-engine type nodenets""" def flowbuilder(self): """Contextmanager to prevent the nodenet from compiling flow-graphs. Will compile when the context is left. Usage: with netapi.flowbuilder: # create & connect flow modul...
stack_v2_sparse_classes_36k_train_017331
2,504
permissive
[ { "docstring": "Contextmanager to prevent the nodenet from compiling flow-graphs. Will compile when the context is left. Usage: with netapi.flowbuilder: # create & connect flow modules nodenet.step()", "name": "flowbuilder", "signature": "def flowbuilder(self)" }, { "docstring": "Create a flow c...
3
stack_v2_sparse_classes_30k_train_006114
Implement the Python class `FlowNetAPI` described below. Class description: Flow-extension to netapi. Intended to work with flow-engine type nodenets Method signatures and docstrings: - def flowbuilder(self): Contextmanager to prevent the nodenet from compiling flow-graphs. Will compile when the context is left. Usag...
Implement the Python class `FlowNetAPI` described below. Class description: Flow-extension to netapi. Intended to work with flow-engine type nodenets Method signatures and docstrings: - def flowbuilder(self): Contextmanager to prevent the nodenet from compiling flow-graphs. Will compile when the context is left. Usag...
35ef3b48d9da255939e8e7af0e00bbcc98597602
<|skeleton|> class FlowNetAPI: """Flow-extension to netapi. Intended to work with flow-engine type nodenets""" def flowbuilder(self): """Contextmanager to prevent the nodenet from compiling flow-graphs. Will compile when the context is left. Usage: with netapi.flowbuilder: # create & connect flow modul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlowNetAPI: """Flow-extension to netapi. Intended to work with flow-engine type nodenets""" def flowbuilder(self): """Contextmanager to prevent the nodenet from compiling flow-graphs. Will compile when the context is left. Usage: with netapi.flowbuilder: # create & connect flow modules nodenet.st...
the_stack_v2_python_sparse
micropsi_core/nodenet/flow_netapi.py
Doik/micropsi2
train
0
852592373ddb19250e93c83ea058f0521ed99b8c
[ "for idx in range(len(nums)):\n high = min(len(nums), idx + k + 1)\n demoset = set(nums[idx + 1:high])\n if nums[idx] in demoset:\n return True\nreturn False", "\"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: bool\n \"\"\"\nnumDict = {}\nfor i in range(len(nums)...
<|body_start_0|> for idx in range(len(nums)): high = min(len(nums), idx + k + 1) demoset = set(nums[idx + 1:high]) if nums[idx] in demoset: return True return False <|end_body_0|> <|body_start_1|> """ :type nums: List[int] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_017332
843
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def containsNearbyDuplicate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate2", "signature": "def contai...
2
stack_v2_sparse_classes_30k_train_001386
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate2(self, nums, k): :type nums: List[int] :type k: int :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate2(self, nums, k): :type nums: List[int] :type k: int :rty...
829f918a0d4d94da5fd3004768421974fbe056e7
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" for idx in range(len(nums)): high = min(len(nums), idx + k + 1) demoset = set(nums[idx + 1:high]) if nums[idx] in demoset: return True...
the_stack_v2_python_sparse
leetcode/easy/easy 201-400/219_存在重复元素 II.py
Weikoi/OJ_Python
train
0
9b8f4b4482a2ae6120de26a7212e81fd62e02f1a
[ "flags.AddUsername(parser)\nflags.AddCluster(parser, False)\nflags.AddRegion(parser)", "client = api_util.AlloyDBClient(self.ReleaseTrack())\nalloydb_client = client.alloydb_client\nalloydb_messages = client.alloydb_messages\nuser_ref = client.resource_parser.Create('alloydb.projects.locations.clusters.users', pr...
<|body_start_0|> flags.AddUsername(parser) flags.AddCluster(parser, False) flags.AddRegion(parser) <|end_body_0|> <|body_start_1|> client = api_util.AlloyDBClient(self.ReleaseTrack()) alloydb_client = client.alloydb_client alloydb_messages = client.alloydb_messages ...
Deletes an AlloyDB user in a given cluster.
Delete
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Delete: """Deletes an AlloyDB user in a given cluster.""" def Args(parser): """Specifies additional command flags. Args: parser: argparse.Parser, Parser object for command line inputs""" <|body_0|> def Run(self, args): """Constructs and sends request. Args: args:...
stack_v2_sparse_classes_36k_train_017333
2,683
permissive
[ { "docstring": "Specifies additional command flags. Args: parser: argparse.Parser, Parser object for command line inputs", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Constructs and sends request. Args: args: argparse.Namespace, An object that contains the values for the a...
2
null
Implement the Python class `Delete` described below. Class description: Deletes an AlloyDB user in a given cluster. Method signatures and docstrings: - def Args(parser): Specifies additional command flags. Args: parser: argparse.Parser, Parser object for command line inputs - def Run(self, args): Constructs and sends...
Implement the Python class `Delete` described below. Class description: Deletes an AlloyDB user in a given cluster. Method signatures and docstrings: - def Args(parser): Specifies additional command flags. Args: parser: argparse.Parser, Parser object for command line inputs - def Run(self, args): Constructs and sends...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Delete: """Deletes an AlloyDB user in a given cluster.""" def Args(parser): """Specifies additional command flags. Args: parser: argparse.Parser, Parser object for command line inputs""" <|body_0|> def Run(self, args): """Constructs and sends request. Args: args:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Delete: """Deletes an AlloyDB user in a given cluster.""" def Args(parser): """Specifies additional command flags. Args: parser: argparse.Parser, Parser object for command line inputs""" flags.AddUsername(parser) flags.AddCluster(parser, False) flags.AddRegion(parser) ...
the_stack_v2_python_sparse
lib/surface/alloydb/users/delete.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
a53e087755e68a914c78f7111832e1ae9f2be1a8
[ "self.pb_prm = pb_prm\nself.var_fac = self.compute_variables_factors(dvv_low, dvv_upp)\nself.obj_fac = self.compute_objective_factor(grad)\nself.con_fac = self.compute_constraints_factors(jac)", "var_fac = np.zeros(len(dvv_low))\nfor i, (v_low, v_upp) in enumerate(zip(dvv_low, dvv_upp)):\n fact = max(abs(v_low...
<|body_start_0|> self.pb_prm = pb_prm self.var_fac = self.compute_variables_factors(dvv_low, dvv_upp) self.obj_fac = self.compute_objective_factor(grad) self.con_fac = self.compute_constraints_factors(jac) <|end_body_0|> <|body_start_1|> var_fac = np.zeros(len(dvv_low)) ...
`Scaling` class computes the scaling factors of decision variables, objective function, defects constraints and constraints Jacobian. Parameters ---------- dvv_low : array Decision variables lower boundaries vector dvv_upp : array Decision variables upper boundaries vector jac : <cppad_py sparse jacobian object> Sparse...
Scaling
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scaling: """`Scaling` class computes the scaling factors of decision variables, objective function, defects constraints and constraints Jacobian. Parameters ---------- dvv_low : array Decision variables lower boundaries vector dvv_upp : array Decision variables upper boundaries vector jac : <cppa...
stack_v2_sparse_classes_36k_train_017334
5,077
no_license
[ { "docstring": "Initialiation of the `Scaling` class", "name": "__init__", "signature": "def __init__(self, dvv_low, dvv_upp, jac, grad, pb_prm)" }, { "docstring": "Computation of the variables scale factors array Parameters ---------- dvv_low : array Decision variables lower boundaries vector d...
5
null
Implement the Python class `Scaling` described below. Class description: `Scaling` class computes the scaling factors of decision variables, objective function, defects constraints and constraints Jacobian. Parameters ---------- dvv_low : array Decision variables lower boundaries vector dvv_upp : array Decision variab...
Implement the Python class `Scaling` described below. Class description: `Scaling` class computes the scaling factors of decision variables, objective function, defects constraints and constraints Jacobian. Parameters ---------- dvv_low : array Decision variables lower boundaries vector dvv_upp : array Decision variab...
9d4b1809e868aec674d6bf3c48958b23418290e7
<|skeleton|> class Scaling: """`Scaling` class computes the scaling factors of decision variables, objective function, defects constraints and constraints Jacobian. Parameters ---------- dvv_low : array Decision variables lower boundaries vector dvv_upp : array Decision variables upper boundaries vector jac : <cppa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Scaling: """`Scaling` class computes the scaling factors of decision variables, objective function, defects constraints and constraints Jacobian. Parameters ---------- dvv_low : array Decision variables lower boundaries vector dvv_upp : array Decision variables upper boundaries vector jac : <cppad_py sparse j...
the_stack_v2_python_sparse
collocation/scaling.py
TomSemblanet/Asteroid-Retrieval-Mission
train
1
f2b013223c23c3c03bc64d6b986eee74f2fa1b3c
[ "if l1 is None:\n return l2\nelif l2 is None:\n return l1\nelif l1.val < l2.val:\n l1.next = self.mergeTwoLists(l1.next, l2)\n return l1\nelse:\n l2.next = self.mergeTwoLists(l1, l2.next)\n return l2", "if l1 is None:\n return l2\nelif l2 is None:\n return l1\nelif l1.val < l2.val:\n l1...
<|body_start_0|> if l1 is None: return l2 elif l2 is None: return l1 elif l1.val < l2.val: l1.next = self.mergeTwoLists(l1.next, l2) return l1 else: l2.next = self.mergeTwoLists(l1, l2.next) return l2 <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """我们可以递归的定义两个链表的合并操作 当链表l1为空,则不用合并直接为l2,当链表l2为空时候,则直接返回l1 当链表l1 l2均不为空,则递归的遍历l1,l2 不过我们要判断 l1 和 l2 哪一个链表的头节点的值更小,然后递归的决定 下一个添加到结果里的节点。如果两个链表有一个为空,递归结束。 :param l1: :param l2: :return:""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_017335
5,708
no_license
[ { "docstring": "我们可以递归的定义两个链表的合并操作 当链表l1为空,则不用合并直接为l2,当链表l2为空时候,则直接返回l1 当链表l1 l2均不为空,则递归的遍历l1,l2 不过我们要判断 l1 和 l2 哪一个链表的头节点的值更小,然后递归的决定 下一个添加到结果里的节点。如果两个链表有一个为空,递归结束。 :param l1: :param l2: :return:", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode" ...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 我们可以递归的定义两个链表的合并操作 当链表l1为空,则不用合并直接为l2,当链表l2为空时候,则直接返回l1 当链表l1 l2均不为空,则递归的遍历l1,l2 不过我们要判断 l1 和 l2 哪一个链表的头节点的值更小,然后...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 我们可以递归的定义两个链表的合并操作 当链表l1为空,则不用合并直接为l2,当链表l2为空时候,则直接返回l1 当链表l1 l2均不为空,则递归的遍历l1,l2 不过我们要判断 l1 和 l2 哪一个链表的头节点的值更小,然后...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """我们可以递归的定义两个链表的合并操作 当链表l1为空,则不用合并直接为l2,当链表l2为空时候,则直接返回l1 当链表l1 l2均不为空,则递归的遍历l1,l2 不过我们要判断 l1 和 l2 哪一个链表的头节点的值更小,然后递归的决定 下一个添加到结果里的节点。如果两个链表有一个为空,递归结束。 :param l1: :param l2: :return:""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """我们可以递归的定义两个链表的合并操作 当链表l1为空,则不用合并直接为l2,当链表l2为空时候,则直接返回l1 当链表l1 l2均不为空,则递归的遍历l1,l2 不过我们要判断 l1 和 l2 哪一个链表的头节点的值更小,然后递归的决定 下一个添加到结果里的节点。如果两个链表有一个为空,递归结束。 :param l1: :param l2: :return:""" if l1 is None: retur...
the_stack_v2_python_sparse
LeetCode_practice/LinkedList/0021_MergeTwoSortedLists.py
LeBron-Jian/BasicAlgorithmPractice
train
13
7c1956ded9c2d30e3ad20b6e6f687ab937659de3
[ "self.xyz_w = util.xy_to_xyz(white)\nself.surround = surround\nself.yn = adapting_luminance\nself.d = discounting\nself.ram = self.calc_ram()\nself.iram = alg.inv(self.ram)", "lms = alg.dot(M, self.xyz_w)\na = []\ns = sum(lms)\nfor c in lms:\n l = 3.0 * c / s\n p = (1.0 + alg.nth_root(self.yn, 3) + l) / (1....
<|body_start_0|> self.xyz_w = util.xy_to_xyz(white) self.surround = surround self.yn = adapting_luminance self.d = discounting self.ram = self.calc_ram() self.iram = alg.inv(self.ram) <|end_body_0|> <|body_start_1|> lms = alg.dot(M, self.xyz_w) a = [] ...
RLAB environment.
Environment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Environment: """RLAB environment.""" def __init__(self, white: VectorLike, adapting_luminance: float, surround: float, discounting: float) -> None: """Initialize.""" <|body_0|> def calc_ram(self) -> Matrix: """Calculate RAM.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_017336
3,447
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, white: VectorLike, adapting_luminance: float, surround: float, discounting: float) -> None" }, { "docstring": "Calculate RAM.", "name": "calc_ram", "signature": "def calc_ram(self) -> Matrix" } ]
2
stack_v2_sparse_classes_30k_train_005133
Implement the Python class `Environment` described below. Class description: RLAB environment. Method signatures and docstrings: - def __init__(self, white: VectorLike, adapting_luminance: float, surround: float, discounting: float) -> None: Initialize. - def calc_ram(self) -> Matrix: Calculate RAM.
Implement the Python class `Environment` described below. Class description: RLAB environment. Method signatures and docstrings: - def __init__(self, white: VectorLike, adapting_luminance: float, surround: float, discounting: float) -> None: Initialize. - def calc_ram(self) -> Matrix: Calculate RAM. <|skeleton|> cla...
ad4d779bff57a65b7c77cda0b79c10cf904eb817
<|skeleton|> class Environment: """RLAB environment.""" def __init__(self, white: VectorLike, adapting_luminance: float, surround: float, discounting: float) -> None: """Initialize.""" <|body_0|> def calc_ram(self) -> Matrix: """Calculate RAM.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Environment: """RLAB environment.""" def __init__(self, white: VectorLike, adapting_luminance: float, surround: float, discounting: float) -> None: """Initialize.""" self.xyz_w = util.xy_to_xyz(white) self.surround = surround self.yn = adapting_luminance self.d = d...
the_stack_v2_python_sparse
lib/coloraide/spaces/rlab.py
facelessuser/ColorHelper
train
279
90d7f72b61728fcea07b2a84f7dd75f7e4bfa464
[ "if channels is ...:\n channels = CHANNELS_DEFAULT\nelse:\n channels = validate_channels(channels)\nif frame_length is ...:\n frame_length = FRAME_LENGTH_DEFAULT\nelse:\n frame_length = validate_frame_length(frame_length)\nif sampling_rate is ...:\n sampling_rate = SAMPLING_RATE_DEFAULT\nelse:\n s...
<|body_start_0|> if channels is ...: channels = CHANNELS_DEFAULT else: channels = validate_channels(channels) if frame_length is ...: frame_length = FRAME_LENGTH_DEFAULT else: frame_length = validate_frame_length(frame_length) if sa...
Attributes ---------- buffer_type : `type<CCharArrayType>` C char array type for creating buffer. channels : `int` The number of channels. (1 if mono, 2 if stereo.) frame_length : `int` The length of a frame in milliseconds. frame_size : `int` The size of a frame in bytes. sampling_rate : `int` The number of samples pe...
AudioSettings
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioSettings: """Attributes ---------- buffer_type : `type<CCharArrayType>` C char array type for creating buffer. channels : `int` The number of channels. (1 if mono, 2 if stereo.) frame_length : `int` The length of a frame in milliseconds. frame_size : `int` The size of a frame in bytes. sampl...
stack_v2_sparse_classes_36k_train_017337
6,797
permissive
[ { "docstring": "Creates a new audio setting. Parameters ---------- channels : `int`, Optional (Keyword only) The number of channels. frame_length : `int`, Optional (Keyword only) The length of a frame in milliseconds. sampling_rate : `int`, Optional (Keyword only) The number of samples per second that are taken...
5
stack_v2_sparse_classes_30k_train_012775
Implement the Python class `AudioSettings` described below. Class description: Attributes ---------- buffer_type : `type<CCharArrayType>` C char array type for creating buffer. channels : `int` The number of channels. (1 if mono, 2 if stereo.) frame_length : `int` The length of a frame in milliseconds. frame_size : `i...
Implement the Python class `AudioSettings` described below. Class description: Attributes ---------- buffer_type : `type<CCharArrayType>` C char array type for creating buffer. channels : `int` The number of channels. (1 if mono, 2 if stereo.) frame_length : `int` The length of a frame in milliseconds. frame_size : `i...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class AudioSettings: """Attributes ---------- buffer_type : `type<CCharArrayType>` C char array type for creating buffer. channels : `int` The number of channels. (1 if mono, 2 if stereo.) frame_length : `int` The length of a frame in milliseconds. frame_size : `int` The size of a frame in bytes. sampl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AudioSettings: """Attributes ---------- buffer_type : `type<CCharArrayType>` C char array type for creating buffer. channels : `int` The number of channels. (1 if mono, 2 if stereo.) frame_length : `int` The length of a frame in milliseconds. frame_size : `int` The size of a frame in bytes. sampling_rate : `i...
the_stack_v2_python_sparse
hata/discord/voice/audio_settings/audio_settings.py
HuyaneMatsu/hata
train
3
790cac03cc5eae07c54741f3bc0e008689f3ffd8
[ "self.table: typing.Dict[str, typing.Dict[int, typing.List[DnsResource]]] = {}\nself.ptrs: typing.Dict[str, str] = {}\nself._cache: typing.Optional[typing.List[Service]] = None", "self._cache = None\nfor record in message.answers + message.resources:\n if record.qtype == QueryType.PTR and record.qname.startswi...
<|body_start_0|> self.table: typing.Dict[str, typing.Dict[int, typing.List[DnsResource]]] = {} self.ptrs: typing.Dict[str, str] = {} self._cache: typing.Optional[typing.List[Service]] = None <|end_body_0|> <|body_start_1|> self._cache = None for record in message.answers + messa...
Parse zeroconf services from records in DNS messages.
ServiceParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceParser: """Parse zeroconf services from records in DNS messages.""" def __init__(self) -> None: """Initialize a new ServiceParser instance.""" <|body_0|> def add_message(self, message: DnsMessage) -> 'ServiceParser': """Add message to with records to parse...
stack_v2_sparse_classes_36k_train_017338
18,548
permissive
[ { "docstring": "Initialize a new ServiceParser instance.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Add message to with records to parse.", "name": "add_message", "signature": "def add_message(self, message: DnsMessage) -> 'ServiceParser'" }, {...
3
stack_v2_sparse_classes_30k_train_009555
Implement the Python class `ServiceParser` described below. Class description: Parse zeroconf services from records in DNS messages. Method signatures and docstrings: - def __init__(self) -> None: Initialize a new ServiceParser instance. - def add_message(self, message: DnsMessage) -> 'ServiceParser': Add message to ...
Implement the Python class `ServiceParser` described below. Class description: Parse zeroconf services from records in DNS messages. Method signatures and docstrings: - def __init__(self) -> None: Initialize a new ServiceParser instance. - def add_message(self, message: DnsMessage) -> 'ServiceParser': Add message to ...
05ca46d2a8bbc8e725ad63794d14b2d1fb9913fa
<|skeleton|> class ServiceParser: """Parse zeroconf services from records in DNS messages.""" def __init__(self) -> None: """Initialize a new ServiceParser instance.""" <|body_0|> def add_message(self, message: DnsMessage) -> 'ServiceParser': """Add message to with records to parse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceParser: """Parse zeroconf services from records in DNS messages.""" def __init__(self) -> None: """Initialize a new ServiceParser instance.""" self.table: typing.Dict[str, typing.Dict[int, typing.List[DnsResource]]] = {} self.ptrs: typing.Dict[str, str] = {} self._c...
the_stack_v2_python_sparse
pyatv/core/mdns.py
postlund/pyatv
train
749
ed94486254899116b94770c0259e0fb6dc50c06d
[ "date_formatter = date.getLocaleFormatter(self.request, 'date', 'long')\n\ndef _q_data_item(q):\n item = {}\n item['qid'] = 'q_%s' % q.question_id\n if q.question_number:\n item['subject'] = u'Q %s %s' % (q.question_number, q.short_name)\n else:\n item['subject'] = q.short_name\n item['...
<|body_start_0|> date_formatter = date.getLocaleFormatter(self.request, 'date', 'long') def _q_data_item(q): item = {} item['qid'] = 'q_%s' % q.question_id if q.question_number: item['subject'] = u'Q %s %s' % (q.question_number, q.short_name) ...
QuestionInStateViewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionInStateViewlet: def _setData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|> <|body_start_0|> date_formatter = date.getLocaleFormatter(self.request, 'date', 'long') ...
stack_v2_sparse_classes_36k_train_017339
27,657
no_license
[ { "docstring": "return the data of the query", "name": "_setData", "signature": "def _setData(self)" }, { "docstring": "refresh the query", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_012785
Implement the Python class `QuestionInStateViewlet` described below. Class description: Implement the QuestionInStateViewlet class. Method signatures and docstrings: - def _setData(self): return the data of the query - def update(self): refresh the query
Implement the Python class `QuestionInStateViewlet` described below. Class description: Implement the QuestionInStateViewlet class. Method signatures and docstrings: - def _setData(self): return the data of the query - def update(self): refresh the query <|skeleton|> class QuestionInStateViewlet: def _setData(s...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class QuestionInStateViewlet: def _setData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionInStateViewlet: def _setData(self): """return the data of the query""" date_formatter = date.getLocaleFormatter(self.request, 'date', 'long') def _q_data_item(q): item = {} item['qid'] = 'q_%s' % q.question_id if q.question_number: ...
the_stack_v2_python_sparse
bungeni.main/branches/mr/bungeni/ui/viewlets/workspace.py
malangalanga/bungeni-portal
train
0
9f950ffafbc44a94e8fa0c0d4744684c6c4755f7
[ "self.msg = u''\nself.nonce_str = nonce_str\nself.body = body\nself.out_trade_no = out_trade_no\nself.total_fee = total_fee\nself.spbill_create_ip = spbill_create_ip\nself.current_time = current_timestamp()\nself.us = None\nself.qrcode = None", "self.us = UnifiedorderService(self.nonce_str, self.body, self.out_tr...
<|body_start_0|> self.msg = u'' self.nonce_str = nonce_str self.body = body self.out_trade_no = out_trade_no self.total_fee = total_fee self.spbill_create_ip = spbill_create_ip self.current_time = current_timestamp() self.us = None self.qrcode = No...
扫码支付Service
NativeService
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NativeService: """扫码支付Service""" def __init__(self, nonce_str, body, out_trade_no, total_fee, spbill_create_ip=''): """@param nonce_str: 32位内随机字符串 @param body: 订单信息 @param out_trade_no: 商户订单号(交易ID) @param total_fee: 交易金额 @param spbill_create_ip: 客户端请求IP地址""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_017340
15,431
permissive
[ { "docstring": "@param nonce_str: 32位内随机字符串 @param body: 订单信息 @param out_trade_no: 商户订单号(交易ID) @param total_fee: 交易金额 @param spbill_create_ip: 客户端请求IP地址", "name": "__init__", "signature": "def __init__(self, nonce_str, body, out_trade_no, total_fee, spbill_create_ip='')" }, { "docstring": "检查", ...
3
null
Implement the Python class `NativeService` described below. Class description: 扫码支付Service Method signatures and docstrings: - def __init__(self, nonce_str, body, out_trade_no, total_fee, spbill_create_ip=''): @param nonce_str: 32位内随机字符串 @param body: 订单信息 @param out_trade_no: 商户订单号(交易ID) @param total_fee: 交易金额 @param...
Implement the Python class `NativeService` described below. Class description: 扫码支付Service Method signatures and docstrings: - def __init__(self, nonce_str, body, out_trade_no, total_fee, spbill_create_ip=''): @param nonce_str: 32位内随机字符串 @param body: 订单信息 @param out_trade_no: 商户订单号(交易ID) @param total_fee: 交易金额 @param...
469444e33ef8a57d024e02c76040b1a7a6df983d
<|skeleton|> class NativeService: """扫码支付Service""" def __init__(self, nonce_str, body, out_trade_no, total_fee, spbill_create_ip=''): """@param nonce_str: 32位内随机字符串 @param body: 订单信息 @param out_trade_no: 商户订单号(交易ID) @param total_fee: 交易金额 @param spbill_create_ip: 客户端请求IP地址""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NativeService: """扫码支付Service""" def __init__(self, nonce_str, body, out_trade_no, total_fee, spbill_create_ip=''): """@param nonce_str: 32位内随机字符串 @param body: 订单信息 @param out_trade_no: 商户订单号(交易ID) @param total_fee: 交易金额 @param spbill_create_ip: 客户端请求IP地址""" self.msg = u'' self.no...
the_stack_v2_python_sparse
app/services/api/pay_weixin.py
lanshizhen/theonestore
train
0
41efb067070f7f17ae7570d8d5b251f49f89fa52
[ "try:\n ip = ipaddress.ip_address(data.strip())\n if isinstance(ip, ipaddress.IPv4Address):\n return IpAddr(ip.exploded, None)\n if isinstance(ip, ipaddress.IPv6Address):\n return IpAddr(None, ip.exploded)\n return IpAddr(None, None)\nexcept ValueError:\n return IpAddr(None, None)", "...
<|body_start_0|> try: ip = ipaddress.ip_address(data.strip()) if isinstance(ip, ipaddress.IPv4Address): return IpAddr(ip.exploded, None) if isinstance(ip, ipaddress.IPv6Address): return IpAddr(None, ip.exploded) return IpAddr(None, ...
Get the external IPv4 and/or IPv6 address as seen from ip.dnshome.de. Depending on the type of your connection one or the other address may be `None`. Also the presence of an IPv4 address does not guarantee that inbound connections can be instantiated from external endpoints (see: DS-Lite and IPv6 tunneling). Relies on...
DeDnshomeWebPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeDnshomeWebPlugin: """Get the external IPv4 and/or IPv6 address as seen from ip.dnshome.de. Depending on the type of your connection one or the other address may be `None`. Also the presence of an IPv4 address does not guarantee that inbound connections can be instantiated from external endpoint...
stack_v2_sparse_classes_36k_train_017341
3,328
permissive
[ { "docstring": "Extracts the IPs from data. Expects `data` to be an UTF-8 string holding either an single IPv4 or an IPv6 address. Args: data: Data to extract the IP from Returns: An `IpAddr` which may hold the IPv4 or IPv6 Address found.", "name": "extract_ip", "signature": "def extract_ip(data: AnyStr...
3
stack_v2_sparse_classes_30k_train_021541
Implement the Python class `DeDnshomeWebPlugin` described below. Class description: Get the external IPv4 and/or IPv6 address as seen from ip.dnshome.de. Depending on the type of your connection one or the other address may be `None`. Also the presence of an IPv4 address does not guarantee that inbound connections can...
Implement the Python class `DeDnshomeWebPlugin` described below. Class description: Get the external IPv4 and/or IPv6 address as seen from ip.dnshome.de. Depending on the type of your connection one or the other address may be `None`. Also the presence of an IPv4 address does not guarantee that inbound connections can...
1ee437426e21eb19d2bbd8fefe3b5d446071b0eb
<|skeleton|> class DeDnshomeWebPlugin: """Get the external IPv4 and/or IPv6 address as seen from ip.dnshome.de. Depending on the type of your connection one or the other address may be `None`. Also the presence of an IPv4 address does not guarantee that inbound connections can be instantiated from external endpoint...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeDnshomeWebPlugin: """Get the external IPv4 and/or IPv6 address as seen from ip.dnshome.de. Depending on the type of your connection one or the other address may be `None`. Also the presence of an IPv4 address does not guarantee that inbound connections can be instantiated from external endpoints (see: DS-Li...
the_stack_v2_python_sparse
plugins/addr_dnshome_de.py
leamas/ddupdate
train
45
cc2c825f163c75d6aba81cd1bfae822e20fd95ae
[ "queryset = obj.detalles_entrada.all()\nif self.context['fecha_inicio']:\n queryset = queryset.filter(entrada__fecha__gte=self.context['fecha_inicio'])\nif self.context['fecha_fin']:\n queryset = queryset.filter(entrada__fecha__lte=self.context['fecha_fin'])\nreturn queryset.count()", "queryset = obj.detall...
<|body_start_0|> queryset = obj.detalles_entrada.all() if self.context['fecha_inicio']: queryset = queryset.filter(entrada__fecha__gte=self.context['fecha_inicio']) if self.context['fecha_fin']: queryset = queryset.filter(entrada__fecha__lte=self.context['fecha_fin']) ...
EquipoSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EquipoSerializer: def get_cantidad_entrada(self, obj): """Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int""" ...
stack_v2_sparse_classes_36k_train_017342
4,844
no_license
[ { "docstring": "Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int", "name": "get_cantidad_entrada", "signature": "def get_cantidad...
4
stack_v2_sparse_classes_30k_train_002692
Implement the Python class `EquipoSerializer` described below. Class description: Implement the EquipoSerializer class. Method signatures and docstrings: - def get_cantidad_entrada(self, obj): Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado p...
Implement the Python class `EquipoSerializer` described below. Class description: Implement the EquipoSerializer class. Method signatures and docstrings: - def get_cantidad_entrada(self, obj): Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado p...
0e37786d7173abe820fd10b094ffcc2db9593a9c
<|skeleton|> class EquipoSerializer: def get_cantidad_entrada(self, obj): """Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EquipoSerializer: def get_cantidad_entrada(self, obj): """Para obtener la cantidad de :model:`kardex.EntradaDetalle` en el rango de fechas seleccionado. Depende del contexto enviado por la vista, recibe `fecha_inicio` o `fecha_salida` como parámetros opcionales. Returns: TYPE: int""" queryset ...
the_stack_v2_python_sparse
src/apps/kardex/serializers.py
jinchuika/app-suni
train
7
d2a79b9bd186d9371388dca9e563c22ffd559de5
[ "query = self\nper_page = None\npage = 1 if page is None else page\nif isinstance(pagination, (list, tuple)):\n per_page = pagination[0] if len(pagination) > 0 else per_page\n page = pagination[1] if len(pagination) > 1 else page\nelse:\n per_page = pagination\nif per_page:\n query = query.limit(per_pag...
<|body_start_0|> query = self per_page = None page = 1 if page is None else page if isinstance(pagination, (list, tuple)): per_page = pagination[0] if len(pagination) > 0 else per_page page = pagination[1] if len(pagination) > 1 else page else: ...
Query
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: def paginate(self, pagination, page=None): """Return paginated query. Args: pagination (tuple|int): A ``tuple`` containing ``(per_page, page)`` or an ``int`` value for ``per_page``. Returns: Query: New :class:`Query` instance with ``limit`` and ``offset`` parameters applied.""" ...
stack_v2_sparse_classes_36k_train_017343
2,891
permissive
[ { "docstring": "Return paginated query. Args: pagination (tuple|int): A ``tuple`` containing ``(per_page, page)`` or an ``int`` value for ``per_page``. Returns: Query: New :class:`Query` instance with ``limit`` and ``offset`` parameters applied.", "name": "paginate", "signature": "def paginate(self, pag...
2
null
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def paginate(self, pagination, page=None): Return paginated query. Args: pagination (tuple|int): A ``tuple`` containing ``(per_page, page)`` or an ``int`` value for ``per_page``. Retur...
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def paginate(self, pagination, page=None): Return paginated query. Args: pagination (tuple|int): A ``tuple`` containing ``(per_page, page)`` or an ``int`` value for ``per_page``. Retur...
4fc11d3ad48e4b5016f53256015e3eed2157daae
<|skeleton|> class Query: def paginate(self, pagination, page=None): """Return paginated query. Args: pagination (tuple|int): A ``tuple`` containing ``(per_page, page)`` or an ``int`` value for ``per_page``. Returns: Query: New :class:`Query` instance with ``limit`` and ``offset`` parameters applied.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Query: def paginate(self, pagination, page=None): """Return paginated query. Args: pagination (tuple|int): A ``tuple`` containing ``(per_page, page)`` or an ``int`` value for ``per_page``. Returns: Query: New :class:`Query` instance with ``limit`` and ``offset`` parameters applied.""" query = ...
the_stack_v2_python_sparse
flex/db/query.py
centergy/flex
train
0
a1a9988b81af10cf805ff86f887f095d043d4de7
[ "models = list(set(request.inputs.keys()).intersection(self.tuple_inputs.keys()))\nif len(models) > 1:\n raise NotImplementedError('Multi-model simulations are not supported. ')\nname = models.pop()\nparams = self.parse_tuple(request.inputs.pop(name)[0])\nmodel = get_model(name)(workdir=self.workdir)\nmodel.conf...
<|body_start_0|> models = list(set(request.inputs.keys()).intersection(self.tuple_inputs.keys())) if len(models) > 1: raise NotImplementedError('Multi-model simulations are not supported. ') name = models.pop() params = self.parse_tuple(request.inputs.pop(name)[0]) mo...
RealtimeForecastProcess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RealtimeForecastProcess: def model(self, request): """Return model class.""" <|body_0|> def meteo(self, request): """Fetch the latest forecast from ECCC. Returns ------- list List of input file paths.""" <|body_1|> def run(self, model, ts, kwds): ...
stack_v2_sparse_classes_36k_train_017344
2,925
permissive
[ { "docstring": "Return model class.", "name": "model", "signature": "def model(self, request)" }, { "docstring": "Fetch the latest forecast from ECCC. Returns ------- list List of input file paths.", "name": "meteo", "signature": "def meteo(self, request)" }, { "docstring": "Init...
3
null
Implement the Python class `RealtimeForecastProcess` described below. Class description: Implement the RealtimeForecastProcess class. Method signatures and docstrings: - def model(self, request): Return model class. - def meteo(self, request): Fetch the latest forecast from ECCC. Returns ------- list List of input fi...
Implement the Python class `RealtimeForecastProcess` described below. Class description: Implement the RealtimeForecastProcess class. Method signatures and docstrings: - def model(self, request): Return model class. - def meteo(self, request): Fetch the latest forecast from ECCC. Returns ------- list List of input fi...
6a7e654633644dbfedd863b4bd019704445b293a
<|skeleton|> class RealtimeForecastProcess: def model(self, request): """Return model class.""" <|body_0|> def meteo(self, request): """Fetch the latest forecast from ECCC. Returns ------- list List of input file paths.""" <|body_1|> def run(self, model, ts, kwds): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RealtimeForecastProcess: def model(self, request): """Return model class.""" models = list(set(request.inputs.keys()).intersection(self.tuple_inputs.keys())) if len(models) > 1: raise NotImplementedError('Multi-model simulations are not supported. ') name = models.p...
the_stack_v2_python_sparse
raven/processes/wps_realtime_forecast.py
ApahSaroj/raven
train
0
84c7b4672491ecd3605e73296a97ef10b2a7eeac
[ "if self.end and self.start and (self.start >= self.end):\n self.not_valid('Start date after end date?', 'Consistency error', self.start)\nif not self.end and (not self.duration):\n self.not_valid('Either end or a duration must be specified', 'Consistency Error', self.end)\nif self.end is not None:\n self....
<|body_start_0|> if self.end and self.start and (self.start >= self.end): self.not_valid('Start date after end date?', 'Consistency error', self.start) if not self.end and (not self.duration): self.not_valid('Either end or a duration must be specified', 'Consistency Error', self....
Command to create a new Sprint
CreateSprintCommand
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateSprintCommand: """Command to create a new Sprint""" def consistency_validation(self, env): """Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start <...
stack_v2_sparse_classes_36k_train_017345
46,751
no_license
[ { "docstring": "Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start < end if end is not present, duration must be if duration is not present, end must be", "name": "consistency_...
3
stack_v2_sparse_classes_30k_train_003410
Implement the Python class `CreateSprintCommand` described below. Class description: Command to create a new Sprint Method signatures and docstrings: - def consistency_validation(self, env): Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now w...
Implement the Python class `CreateSprintCommand` described below. Class description: Command to create a new Sprint Method signatures and docstrings: - def consistency_validation(self, env): Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now w...
1059b76554363004887b2a60953957f413b80bb0
<|skeleton|> class CreateSprintCommand: """Command to create a new Sprint""" def consistency_validation(self, env): """Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateSprintCommand: """Command to create a new Sprint""" def consistency_validation(self, env): """Validate the consistency of dates and duration together, the individual parameter format validation has already occurred, now we check the relation between them, in particular: start < end if end i...
the_stack_v2_python_sparse
agilo/scrum/sprint/controller.py
djangsters/agilo
train
0
72de027ad380186edcd59b98e76f4f1eb3effbe9
[ "self.layers = layers\nself.feature_n = feature_n\nself.codeword_w = np.ones(feature_n + 2)\nself.codeword_w[0] = action_n\nfor i in range(self.feature_n):\n self.codeword_w[i + 1] = self.codeword_w[i] * layers", "scaled_floats = tuple((f * self.layers * self.layers for f in floats))\nfeatures = []\nfor layer ...
<|body_start_0|> self.layers = layers self.feature_n = feature_n self.codeword_w = np.ones(feature_n + 2) self.codeword_w[0] = action_n for i in range(self.feature_n): self.codeword_w[i + 1] = self.codeword_w[i] * layers <|end_body_0|> <|body_start_1|> scaled...
砖瓦编码
TileCoderMAT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TileCoderMAT: """砖瓦编码""" def __init__(self, layers, feature_n, action_n): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" <|body_0|> def __call__(self, floats=(), ints=()): """将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 features 不同层次的编码的位置1*fe...
stack_v2_sparse_classes_36k_train_017346
22,277
no_license
[ { "docstring": "layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征", "name": "__init__", "signature": "def __init__(self, layers, feature_n, action_n)" }, { "docstring": "将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 features 不同层次的编码的位置1*feature_num的向量", "name": "__call__", "sig...
2
stack_v2_sparse_classes_30k_train_007008
Implement the Python class `TileCoderMAT` described below. Class description: 砖瓦编码 Method signatures and docstrings: - def __init__(self, layers, feature_n, action_n): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 - def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 fe...
Implement the Python class `TileCoderMAT` described below. Class description: 砖瓦编码 Method signatures and docstrings: - def __init__(self, layers, feature_n, action_n): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 - def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 fe...
e6526e9e38fcb5be91b46cb40715c15242198a0b
<|skeleton|> class TileCoderMAT: """砖瓦编码""" def __init__(self, layers, feature_n, action_n): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" <|body_0|> def __call__(self, floats=(), ints=()): """将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 features 不同层次的编码的位置1*fe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TileCoderMAT: """砖瓦编码""" def __init__(self, layers, feature_n, action_n): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" self.layers = layers self.feature_n = feature_n self.codeword_w = np.ones(feature_n + 2) self.codeword_w[0] = action_n for i in range(self...
the_stack_v2_python_sparse
mountain_car/function_approx.py
lwzswufe/gym_learning
train
0
8885641fff3d93ed476588707ac6eda451bb76ae
[ "self.description = description\nself.mount_path = mount_path\nself.name = name\nself.protocol = protocol\nself.skip_validation = skip_validation\nself.mtype = mtype", "if dictionary is None:\n return None\ndescription = dictionary.get('description')\nmount_path = dictionary.get('mountPath')\nname = dictionary...
<|body_start_0|> self.description = description self.mount_path = mount_path self.name = name self.protocol = protocol self.skip_validation = skip_validation self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None ...
Implementation of the 'NasProtectionSource' model. Specifies a Protection Source in a Generic NAS environment. Attributes: description (string): Specifies a description about the Protection Source. mount_path (string): Specifies the mount path of this NAS. For example, for a NFS mount point, this should be in the forma...
NasProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NasProtectionSource: """Implementation of the 'NasProtectionSource' model. Specifies a Protection Source in a Generic NAS environment. Attributes: description (string): Specifies a description about the Protection Source. mount_path (string): Specifies the mount path of this NAS. For example, for...
stack_v2_sparse_classes_36k_train_017347
3,401
permissive
[ { "docstring": "Constructor for the NasProtectionSource class", "name": "__init__", "signature": "def __init__(self, description=None, mount_path=None, name=None, protocol=None, skip_validation=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictio...
2
null
Implement the Python class `NasProtectionSource` described below. Class description: Implementation of the 'NasProtectionSource' model. Specifies a Protection Source in a Generic NAS environment. Attributes: description (string): Specifies a description about the Protection Source. mount_path (string): Specifies the m...
Implement the Python class `NasProtectionSource` described below. Class description: Implementation of the 'NasProtectionSource' model. Specifies a Protection Source in a Generic NAS environment. Attributes: description (string): Specifies a description about the Protection Source. mount_path (string): Specifies the m...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NasProtectionSource: """Implementation of the 'NasProtectionSource' model. Specifies a Protection Source in a Generic NAS environment. Attributes: description (string): Specifies a description about the Protection Source. mount_path (string): Specifies the mount path of this NAS. For example, for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NasProtectionSource: """Implementation of the 'NasProtectionSource' model. Specifies a Protection Source in a Generic NAS environment. Attributes: description (string): Specifies a description about the Protection Source. mount_path (string): Specifies the mount path of this NAS. For example, for a NFS mount ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/nas_protection_source.py
cohesity/management-sdk-python
train
24
a86ad0c5bd0dc696ac6657777d322a54e00a15fa
[ "if self._facets is Undefined:\n self._facets = self.normalize_facets(self.facets)\nreturn self._facets", "facets = OrderedDict()\nraw_facets = self.request.GET.get(self.facets_kwarg)\nif raw_facets:\n for raw_facet in raw_facets.split(','):\n facet = raw_facet.split(':', 1)\n if len(facet) ==...
<|body_start_0|> if self._facets is Undefined: self._facets = self.normalize_facets(self.facets) return self._facets <|end_body_0|> <|body_start_1|> facets = OrderedDict() raw_facets = self.request.GET.get(self.facets_kwarg) if raw_facets: for raw_facet i...
FacetedSearchView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacetedSearchView: def get_facets(self): """Returns a list containing all available facets.""" <|body_0|> def get_selected_facets(self): """Returns a list of facets which the user has selected.""" <|body_1|> def normalize_facets(self, facets): ""...
stack_v2_sparse_classes_36k_train_017348
14,538
permissive
[ { "docstring": "Returns a list containing all available facets.", "name": "get_facets", "signature": "def get_facets(self)" }, { "docstring": "Returns a list of facets which the user has selected.", "name": "get_selected_facets", "signature": "def get_selected_facets(self)" }, { ...
3
null
Implement the Python class `FacetedSearchView` described below. Class description: Implement the FacetedSearchView class. Method signatures and docstrings: - def get_facets(self): Returns a list containing all available facets. - def get_selected_facets(self): Returns a list of facets which the user has selected. - d...
Implement the Python class `FacetedSearchView` described below. Class description: Implement the FacetedSearchView class. Method signatures and docstrings: - def get_facets(self): Returns a list containing all available facets. - def get_selected_facets(self): Returns a list of facets which the user has selected. - d...
1ef9a42d4eaa70d9b3e6e7fa519396c1e1174fcb
<|skeleton|> class FacetedSearchView: def get_facets(self): """Returns a list containing all available facets.""" <|body_0|> def get_selected_facets(self): """Returns a list of facets which the user has selected.""" <|body_1|> def normalize_facets(self, facets): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FacetedSearchView: def get_facets(self): """Returns a list containing all available facets.""" if self._facets is Undefined: self._facets = self.normalize_facets(self.facets) return self._facets def get_selected_facets(self): """Returns a list of facets which t...
the_stack_v2_python_sparse
yepes/views/search.py
samuelmaudo/yepes
train
0
b96937635cf96f6a7ac975bd9d0ce72647d5c854
[ "if x < 0:\n return False\ns = str(x)\nn = len(s)\ni, j = (0, n - 1)\nwhile i <= j:\n if s[i] == s[j]:\n i += 1\n j -= 1\n else:\n return False\nreturn True", "if x < 0:\n return False\ns = str(x)\nn = len(s)\nif n % 2 == 0:\n i, j = (n // 2 - 1, n // 2)\nelse:\n i, j = (n /...
<|body_start_0|> if x < 0: return False s = str(x) n = len(s) i, j = (0, n - 1) while i <= j: if s[i] == s[j]: i += 1 j -= 1 else: return False return True <|end_body_0|> <|body_start_1|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome2(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False s = str(x) n ...
stack_v2_sparse_classes_36k_train_017349
1,233
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome2", "signature": "def isPalindrome2(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_012067
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome2(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome2(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
f2c4f727689567e00ee06560132fca55a6fd9286
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome2(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False s = str(x) n = len(s) i, j = (0, n - 1) while i <= j: if s[i] == s[j]: i += 1 j -= 1 else: ...
the_stack_v2_python_sparse
leetcode/9_Palindrome_Number.py
JianxiangWang/python-journey
train
1
1493ec4828bb4c25aad7835ba328369d198064eb
[ "if product:\n return self.get_query_set().filter(doer=user, item__product=product).order_by('-start')\nreturn self.get_query_set().filter(doer=user).order_by('-start')", "cs = [[], [], []]\nfor t in self.tasks.get_query_set():\n if t.end:\n cs[2].append(t)\n elif t.start:\n cs[1].append(t)...
<|body_start_0|> if product: return self.get_query_set().filter(doer=user, item__product=product).order_by('-start') return self.get_query_set().filter(doer=user).order_by('-start') <|end_body_0|> <|body_start_1|> cs = [[], [], []] for t in self.tasks.get_query_set(): ...
Manager of model SprintTask
TaskManager
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskManager: """Manager of model SprintTask""" def query_by_user(self, user, product=None): """Query by user and product.""" <|body_0|> def group_by_status(self, product): """Get all tasks and separate them into a list of undone, doing, and done list.""" ...
stack_v2_sparse_classes_36k_train_017350
2,133
permissive
[ { "docstring": "Query by user and product.", "name": "query_by_user", "signature": "def query_by_user(self, user, product=None)" }, { "docstring": "Get all tasks and separate them into a list of undone, doing, and done list.", "name": "group_by_status", "signature": "def group_by_status(...
3
stack_v2_sparse_classes_30k_train_004276
Implement the Python class `TaskManager` described below. Class description: Manager of model SprintTask Method signatures and docstrings: - def query_by_user(self, user, product=None): Query by user and product. - def group_by_status(self, product): Get all tasks and separate them into a list of undone, doing, and d...
Implement the Python class `TaskManager` described below. Class description: Manager of model SprintTask Method signatures and docstrings: - def query_by_user(self, user, product=None): Query by user and product. - def group_by_status(self, product): Get all tasks and separate them into a list of undone, doing, and d...
8a3451ed17799f1921b3128fb69be1bf3925c564
<|skeleton|> class TaskManager: """Manager of model SprintTask""" def query_by_user(self, user, product=None): """Query by user and product.""" <|body_0|> def group_by_status(self, product): """Get all tasks and separate them into a list of undone, doing, and done list.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskManager: """Manager of model SprintTask""" def query_by_user(self, user, product=None): """Query by user and product.""" if product: return self.get_query_set().filter(doer=user, item__product=product).order_by('-start') return self.get_query_set().filter(doer=user...
the_stack_v2_python_sparse
TeaScrum/backlog/managers.py
tedwen/tea-scrum
train
0
1c971354eafd0d3480bcaa7f497529ac00a9a6f0
[ "if not triangle:\n return 0\nlen_v = len(triangle)\nif len_v == 1:\n return triangle[0][0]\ndp = [0] * len_v\ndp[0] = triangle[0][0]\nfor i in xrange(1, len_v):\n tmp_v = dp[0]\n dp[0] += triangle[i][0]\n for j in xrange(1, i):\n res = min(dp[j], tmp_v)\n tmp_v = dp[j]\n dp[j] =...
<|body_start_0|> if not triangle: return 0 len_v = len(triangle) if len_v == 1: return triangle[0][0] dp = [0] * len_v dp[0] = triangle[0][0] for i in xrange(1, len_v): tmp_v = dp[0] dp[0] += triangle[i][0] for j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotal2(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not triangl...
stack_v2_sparse_classes_36k_train_017351
1,884
no_license
[ { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle)" }, { "docstring": ":type triangle: List[List[int]] :rtype: int", "name": "minimumTotal2", "signature": "def minimumTotal2(self, triangle)" } ]
2
stack_v2_sparse_classes_30k_train_013755
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotal2(self, triangle): :type triangle: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int - def minimumTotal2(self, triangle): :type triangle: List[List[int]] :rtype: int <|skeleton|> class...
db2d0b05020a1fcb9f0cfaf9386f79daeaad759e
<|skeleton|> class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_0|> def minimumTotal2(self, triangle): """:type triangle: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minimumTotal(self, triangle): """:type triangle: List[List[int]] :rtype: int""" if not triangle: return 0 len_v = len(triangle) if len_v == 1: return triangle[0][0] dp = [0] * len_v dp[0] = triangle[0][0] for i in xr...
the_stack_v2_python_sparse
leetcode/dynamic_programming/120_minimum_total.py
longgb246/MLlearn
train
0
30497cd61ffc7f4cb05e1627c2f22a3cfbeda795
[ "match_pattern = '{{0: <{}}} from {{1}}'.format(longest_match_len - 1)\nmatches = sorted((match for match in matches))\nsession.write_line()\nwith use_ipopo(context) as ipopo:\n for name in matches:\n name = name.strip()\n details = ipopo.get_instance_details(name)\n description = 'of {facto...
<|body_start_0|> match_pattern = '{{0: <{}}} from {{1}}'.format(longest_match_len - 1) matches = sorted((match for match in matches)) session.write_line() with use_ipopo(context) as ipopo: for name in matches: name = name.strip() details = ipop...
Completes an iPOPO Component instance name
ComponentInstanceCompleter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentInstanceCompleter: """Completes an iPOPO Component instance name""" def display_hook(prompt, session, context, matches, longest_match_len): """Displays the available services matches and the service details :param prompt: Shell prompt string :param session: Current shell ses...
stack_v2_sparse_classes_36k_train_017352
10,339
permissive
[ { "docstring": "Displays the available services matches and the service details :param prompt: Shell prompt string :param session: Current shell session (for display) :param context: BundleContext of the shell :param matches: List of words matching the substitution :param longest_match_len: Length of the larges...
2
null
Implement the Python class `ComponentInstanceCompleter` described below. Class description: Completes an iPOPO Component instance name Method signatures and docstrings: - def display_hook(prompt, session, context, matches, longest_match_len): Displays the available services matches and the service details :param prom...
Implement the Python class `ComponentInstanceCompleter` described below. Class description: Completes an iPOPO Component instance name Method signatures and docstrings: - def display_hook(prompt, session, context, matches, longest_match_len): Displays the available services matches and the service details :param prom...
1d0add361ca219da8fdf72bb9ba8cb0ade01ad2f
<|skeleton|> class ComponentInstanceCompleter: """Completes an iPOPO Component instance name""" def display_hook(prompt, session, context, matches, longest_match_len): """Displays the available services matches and the service details :param prompt: Shell prompt string :param session: Current shell ses...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentInstanceCompleter: """Completes an iPOPO Component instance name""" def display_hook(prompt, session, context, matches, longest_match_len): """Displays the available services matches and the service details :param prompt: Shell prompt string :param session: Current shell session (for dis...
the_stack_v2_python_sparse
pelix/shell/completion/ipopo.py
tcalmant/ipopo
train
67
f6974a8da3b1d63f686e10f3ce4aef2c31e5decd
[ "super(FINN, self).__init__()\nself.device = device\nself.Nx = u.size()[1]\nself.BC = th.tensor(BC, dtype=th.float).to(device=self.device)\nself.mode = mode\nself.cfg = config\nif not learn_coeff:\n self.D = th.tensor(D, dtype=th.float).to(device=self.device)\nelse:\n self.D = nn.Parameter(th.tensor(D, dtype=...
<|body_start_0|> super(FINN, self).__init__() self.device = device self.Nx = u.size()[1] self.BC = th.tensor(BC, dtype=th.float).to(device=self.device) self.mode = mode self.cfg = config if not learn_coeff: self.D = th.tensor(D, dtype=th.float).to(devi...
This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (or the flux multiplier) and reac...
FINN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FINN: """This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (...
stack_v2_sparse_classes_36k_train_017353
25,024
no_license
[ { "docstring": "Constructor. Inputs: :param u: the unknown variable :type u: th.tensor[len(t), Nx, Ny, num_vars] :param D: diffusion coefficient :type D: np.array[num_vars] --- th.tensor is also accepted :param BC: the boundary condition values. In case of Dirichlet BC, this contains the scalar values. In case ...
3
stack_v2_sparse_classes_30k_train_018494
Implement the Python class `FINN` described below. Class description: This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which ...
Implement the Python class `FINN` described below. Class description: This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which ...
82b4eac6b55be3b44e736f139ed50256c4415f0c
<|skeleton|> class FINN: """This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FINN: """This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (or the flux m...
the_stack_v2_python_sparse
models/finn_poly/finn.py
CognitiveModeling/finn
train
28
27c729152c67f7ff08ca4035d91291c2cdd65ac1
[ "self.all_snaps = []\nget_snap_calls = 'commands -f \"endpoint~{id} missed_snapshot,method=get\"'\nsnap_calls = get_dicted(self.rbkcli.call_back(get_snap_calls))\nfor calls in snap_calls:\n org_call = calls['endpoint'].split('{id}')[0]\n if 'unmanaged' in org_call:\n continue\n objects = get_dicted(...
<|body_start_0|> self.all_snaps = [] get_snap_calls = 'commands -f "endpoint~{id} missed_snapshot,method=get"' snap_calls = get_dicted(self.rbkcli.call_back(get_snap_calls)) for calls in snap_calls: org_call = calls['endpoint'].split('{id}')[0] if 'unmanaged' in o...
AllMissedSnaps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllMissedSnaps: def execute(self, args): """.""" <|body_0|> def get_snap_from_objects(self, objects, org_call, calls): """.""" <|body_1|> def add_relevant_fields(self, snap, obj, keys, org_call): """.""" <|body_2|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_017354
2,588
permissive
[ { "docstring": ".", "name": "execute", "signature": "def execute(self, args)" }, { "docstring": ".", "name": "get_snap_from_objects", "signature": "def get_snap_from_objects(self, objects, org_call, calls)" }, { "docstring": ".", "name": "add_relevant_fields", "signature"...
3
stack_v2_sparse_classes_30k_train_005196
Implement the Python class `AllMissedSnaps` described below. Class description: Implement the AllMissedSnaps class. Method signatures and docstrings: - def execute(self, args): . - def get_snap_from_objects(self, objects, org_call, calls): . - def add_relevant_fields(self, snap, obj, keys, org_call): .
Implement the Python class `AllMissedSnaps` described below. Class description: Implement the AllMissedSnaps class. Method signatures and docstrings: - def execute(self, args): . - def get_snap_from_objects(self, objects, org_call, calls): . - def add_relevant_fields(self, snap, obj, keys, org_call): . <|skeleton|> ...
62bbb20d15c78d2554d7258bdae655452ac826c7
<|skeleton|> class AllMissedSnaps: def execute(self, args): """.""" <|body_0|> def get_snap_from_objects(self, objects, org_call, calls): """.""" <|body_1|> def add_relevant_fields(self, snap, obj, keys, org_call): """.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllMissedSnaps: def execute(self, args): """.""" self.all_snaps = [] get_snap_calls = 'commands -f "endpoint~{id} missed_snapshot,method=get"' snap_calls = get_dicted(self.rbkcli.call_back(get_snap_calls)) for calls in snap_calls: org_call = calls['endpoint'...
the_stack_v2_python_sparse
scripts/default/all_missed_snapshots.py
rubrikinc/rbkcli
train
12
abd5c1a29f7f6d7625c832f7e1b9434b41a5d1dd
[ "self.aliyunrequest.set_action_name('DescribeLoadBalancers')\nif not isinstance(config, list):\n return self.MResponse(code=20001, msg='config不是列表', status=False)\nself.Mconfig(config)\nresponse = self.aliyunapiclient.do_action_with_exception(self.aliyunrequest)\nreturn response", "self.aliyunrequest.set_actio...
<|body_start_0|> self.aliyunrequest.set_action_name('DescribeLoadBalancers') if not isinstance(config, list): return self.MResponse(code=20001, msg='config不是列表', status=False) self.Mconfig(config) response = self.aliyunapiclient.do_action_with_exception(self.aliyunrequest) ...
实例API
ALiYunApiSLB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ALiYunApiSLB: """实例API""" def DescribeLoadBalancers(self, config): """查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" <|body_0|> def DescribeLoadBalancerAttribute(self, config): """查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" ...
stack_v2_sparse_classes_36k_train_017355
7,651
no_license
[ { "docstring": "查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式", "name": "DescribeLoadBalancers", "signature": "def DescribeLoadBalancers(self, config)" }, { "docstring": "查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return: 根据自己配置输出格式", "name": "DescribeLoadBalancerAttribute", "...
5
stack_v2_sparse_classes_30k_train_009751
Implement the Python class `ALiYunApiSLB` described below. Class description: 实例API Method signatures and docstrings: - def DescribeLoadBalancers(self, config): 查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式 - def DescribeLoadBalancerAttribute(self, config): 查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return...
Implement the Python class `ALiYunApiSLB` described below. Class description: 实例API Method signatures and docstrings: - def DescribeLoadBalancers(self, config): 查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式 - def DescribeLoadBalancerAttribute(self, config): 查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return...
401ad869298d55a6cb2f78442385f67f40b9db52
<|skeleton|> class ALiYunApiSLB: """实例API""" def DescribeLoadBalancers(self, config): """查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" <|body_0|> def DescribeLoadBalancerAttribute(self, config): """查询指定负载均衡实例的详细信息。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ALiYunApiSLB: """实例API""" def DescribeLoadBalancers(self, config): """查询已创建的负载均衡实例。 :param config: [{}]数据类型 :return: 根据自己配置输出格式""" self.aliyunrequest.set_action_name('DescribeLoadBalancers') if not isinstance(config, list): return self.MResponse(code=20001, msg='config...
the_stack_v2_python_sparse
utils/maliyun/aliyunapi.py
Alotofwater/cookcmdb
train
8
cf0f1d32e5913e5e367b061f753b062971421ffa
[ "s = str(num)\na = b = 1\nfor i in range(2, len(s) + 1):\n a, b = (a + b if '10' <= s[i - 2:i] <= '25' else a, a)\nreturn a", "a = b = 1\ny = num % 10\nwhile num != 0:\n num //= 10\n x = num % 10\n a, b = (a + b if 10 <= 10 * x + y <= 25 else a, a)\n y = x\nreturn a" ]
<|body_start_0|> s = str(num) a = b = 1 for i in range(2, len(s) + 1): a, b = (a + b if '10' <= s[i - 2:i] <= '25' else a, a) return a <|end_body_0|> <|body_start_1|> a = b = 1 y = num % 10 while num != 0: num //= 10 x = num % ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def translateNum_1(self, num: int) -> int: """方法一:字符串遍历 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(num) ),其决定了循环次数。 空间复杂度 O(N): 字符串 s 使用 O(N) 大小的额外空间。 :param num: :return:""" <|body_0|> def translateNum_2(self, num: int) -> int: """方法二:数字求余 时间复杂度 O(N): N 为字符串...
stack_v2_sparse_classes_36k_train_017356
1,777
no_license
[ { "docstring": "方法一:字符串遍历 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(num) ),其决定了循环次数。 空间复杂度 O(N): 字符串 s 使用 O(N) 大小的额外空间。 :param num: :return:", "name": "translateNum_1", "signature": "def translateNum_1(self, num: int) -> int" }, { "docstring": "方法二:数字求余 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(nu...
2
stack_v2_sparse_classes_30k_train_013357
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def translateNum_1(self, num: int) -> int: 方法一:字符串遍历 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(num) ),其决定了循环次数。 空间复杂度 O(N): 字符串 s 使用 O(N) 大小的额外空间。 :param num: :return: - def trans...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def translateNum_1(self, num: int) -> int: 方法一:字符串遍历 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(num) ),其决定了循环次数。 空间复杂度 O(N): 字符串 s 使用 O(N) 大小的额外空间。 :param num: :return: - def trans...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def translateNum_1(self, num: int) -> int: """方法一:字符串遍历 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(num) ),其决定了循环次数。 空间复杂度 O(N): 字符串 s 使用 O(N) 大小的额外空间。 :param num: :return:""" <|body_0|> def translateNum_2(self, num: int) -> int: """方法二:数字求余 时间复杂度 O(N): N 为字符串...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def translateNum_1(self, num: int) -> int: """方法一:字符串遍历 时间复杂度 O(N): N 为字符串 s 的长度(即数字 num 的位数 log(num) ),其决定了循环次数。 空间复杂度 O(N): 字符串 s 使用 O(N) 大小的额外空间。 :param num: :return:""" s = str(num) a = b = 1 for i in range(2, len(s) + 1): a, b = (a + b if '10' <= s[i ...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/translateNum.py
MaoningGuan/LeetCode
train
3
458090b2507a2a0c3971b26d26739aa775269574
[ "favs = get_favs(request)\nfavs = favs.filter(itinerary__pk=itinerary_pk)\nif favs.exists():\n for fav in favs.all():\n fav.date_deleted = datetime.today()\n fav.save()\nreturn Response({'status': 'ok', 'count': get_favs_count(request), 'count_it': get_it_count_favs(request)})", "for fav_id in se...
<|body_start_0|> favs = get_favs(request) favs = favs.filter(itinerary__pk=itinerary_pk) if favs.exists(): for fav in favs.all(): fav.date_deleted = datetime.today() fav.save() return Response({'status': 'ok', 'count': get_favs_count(request), ...
DeleteItineraryFavAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteItineraryFavAPIView: def get(self, request, itinerary_pk): """Delete a Fav set date_deleted = now TODO""" <|body_0|> def post(self, request, *args, **kwargs): """Delete several Favs at a time set date_deleted = now""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_017357
15,319
no_license
[ { "docstring": "Delete a Fav set date_deleted = now TODO", "name": "get", "signature": "def get(self, request, itinerary_pk)" }, { "docstring": "Delete several Favs at a time set date_deleted = now", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `DeleteItineraryFavAPIView` described below. Class description: Implement the DeleteItineraryFavAPIView class. Method signatures and docstrings: - def get(self, request, itinerary_pk): Delete a Fav set date_deleted = now TODO - def post(self, request, *args, **kwargs): Delete several Favs a...
Implement the Python class `DeleteItineraryFavAPIView` described below. Class description: Implement the DeleteItineraryFavAPIView class. Method signatures and docstrings: - def get(self, request, itinerary_pk): Delete a Fav set date_deleted = now TODO - def post(self, request, *args, **kwargs): Delete several Favs a...
8a15fc387d20b12d16c171c2d8928a9b9d4ba5e1
<|skeleton|> class DeleteItineraryFavAPIView: def get(self, request, itinerary_pk): """Delete a Fav set date_deleted = now TODO""" <|body_0|> def post(self, request, *args, **kwargs): """Delete several Favs at a time set date_deleted = now""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeleteItineraryFavAPIView: def get(self, request, itinerary_pk): """Delete a Fav set date_deleted = now TODO""" favs = get_favs(request) favs = favs.filter(itinerary__pk=itinerary_pk) if favs.exists(): for fav in favs.all(): fav.date_deleted = dateti...
the_stack_v2_python_sparse
users/views.py
montenegrop/djangotravelportal
train
0
b73ffda33853681d59c795061ab508641444e095
[ "if len(s) == 0:\n self.answer = True\ncur_string = ''\nfor i in range(min(max_len, len(s))):\n cur_string += s[i]\n if cur_string in words:\n self.is_word_break(s[i + 1:], words, max_len)", "if len(wordDict) == 0:\n return False\nself.answer = False\nmax_len = len(max(wordDict, key=len))\nself...
<|body_start_0|> if len(s) == 0: self.answer = True cur_string = '' for i in range(min(max_len, len(s))): cur_string += s[i] if cur_string in words: self.is_word_break(s[i + 1:], words, max_len) <|end_body_0|> <|body_start_1|> if len(w...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_word_break(self, s, words, max_len): """s: string words: set with words""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s)...
stack_v2_sparse_classes_36k_train_017358
1,243
no_license
[ { "docstring": "s: string words: set with words", "name": "is_word_break", "signature": "def is_word_break(self, s, words, max_len)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" } ]
2
stack_v2_sparse_classes_30k_train_017095
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_word_break(self, s, words, max_len): s: string words: set with words - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_word_break(self, s, words, max_len): s: string words: set with words - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool <|skeleton|> ...
98f02403996e62d358d7ca589902698346ac91ec
<|skeleton|> class Solution: def is_word_break(self, s, words, max_len): """s: string words: set with words""" <|body_0|> def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def is_word_break(self, s, words, max_len): """s: string words: set with words""" if len(s) == 0: self.answer = True cur_string = '' for i in range(min(max_len, len(s))): cur_string += s[i] if cur_string in words: se...
the_stack_v2_python_sparse
onsite_solutions/139_word_break.py
owoshch/LeetCode
train
1
95b9f8e7658791f13284705bf355b3866f0d38bf
[ "BaseMessage.__init__(self, txt=txt.replace('\\t', ' ') + '\\x19o', identifier=identifier or '', time=time)\nif txt.startswith('/me '):\n me = True\n txt = '\\x19%s}%s\\x19o' % (dump_tuple(get_theme().COLOR_ME_MESSAGE), txt[4:])\nelse:\n me = False\nself.txt = txt\nself.delayed = delayed or history\nsel...
<|body_start_0|> BaseMessage.__init__(self, txt=txt.replace('\t', ' ') + '\x19o', identifier=identifier or '', time=time) if txt.startswith('/me '): me = True txt = '\x19%s}%s\x19o' % (dump_tuple(get_theme().COLOR_ME_MESSAGE), txt[4:]) else: me = False ...
Message
[ "Zlib", "CC-BY-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: def __init__(self, txt: str, nickname: Optional[str], time: Optional[datetime]=None, nick_color: Optional[Tuple]=None, delayed: bool=False, history: bool=False, user: Optional[User]=None, identifier: Optional[str]='', highlight: bool=False, old_message: Optional[Message]=None, revisions...
stack_v2_sparse_classes_36k_train_017359
8,066
permissive
[ { "docstring": "Create a new Message object with parameters, check for /me messages, and delayed messages", "name": "__init__", "signature": "def __init__(self, txt: str, nickname: Optional[str], time: Optional[datetime]=None, nick_color: Optional[Tuple]=None, delayed: bool=False, history: bool=False, u...
4
null
Implement the Python class `Message` described below. Class description: Implement the Message class. Method signatures and docstrings: - def __init__(self, txt: str, nickname: Optional[str], time: Optional[datetime]=None, nick_color: Optional[Tuple]=None, delayed: bool=False, history: bool=False, user: Optional[User...
Implement the Python class `Message` described below. Class description: Implement the Message class. Method signatures and docstrings: - def __init__(self, txt: str, nickname: Optional[str], time: Optional[datetime]=None, nick_color: Optional[Tuple]=None, delayed: bool=False, history: bool=False, user: Optional[User...
7f1e9b080c33272004374ac760aa2f346f9a22e9
<|skeleton|> class Message: def __init__(self, txt: str, nickname: Optional[str], time: Optional[datetime]=None, nick_color: Optional[Tuple]=None, delayed: bool=False, history: bool=False, user: Optional[User]=None, identifier: Optional[str]='', highlight: bool=False, old_message: Optional[Message]=None, revisions...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Message: def __init__(self, txt: str, nickname: Optional[str], time: Optional[datetime]=None, nick_color: Optional[Tuple]=None, delayed: bool=False, history: bool=False, user: Optional[User]=None, identifier: Optional[str]='', highlight: bool=False, old_message: Optional[Message]=None, revisions: int=0, jid: ...
the_stack_v2_python_sparse
poezio/ui/types.py
jubalh/poezio
train
0
f650d03c5a1e93b3354b1802c043fea55ad5aa9a
[ "ls = list(range(1, n + 1))\nres = ''\nk -= 1\nwhile ls:\n m = math.factorial(len(ls) - 1)\n i, k = (k // m, k % m)\n res += str(ls[i])\n ls.pop(i)\nreturn res", "from itertools import permutations\nres = sorted(permutations(list(range(1, n + 1))))\nprint(res)\nreturn ''.join([str(x) for x in res[k - ...
<|body_start_0|> ls = list(range(1, n + 1)) res = '' k -= 1 while ls: m = math.factorial(len(ls) - 1) i, k = (k // m, k % m) res += str(ls[i]) ls.pop(i) return res <|end_body_0|> <|body_start_1|> from itertools import permu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getPermutation(self, n: int, k: int) -> str: """先固定第一位 第一位的索引为 k//(n-1)! (k=k-1, n为列表长度) 然后数组中删掉被固定的那位,然后再拿剩下数组和k%(n-1)重复上一步 :param n: :param k: :return:""" <|body_0|> def getPermutation2(self, n: int, k: int) -> str: """超时 生成全排列 :param n: :param k: :re...
stack_v2_sparse_classes_36k_train_017360
2,286
no_license
[ { "docstring": "先固定第一位 第一位的索引为 k//(n-1)! (k=k-1, n为列表长度) 然后数组中删掉被固定的那位,然后再拿剩下数组和k%(n-1)重复上一步 :param n: :param k: :return:", "name": "getPermutation", "signature": "def getPermutation(self, n: int, k: int) -> str" }, { "docstring": "超时 生成全排列 :param n: :param k: :return:", "name": "getPermutat...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation(self, n: int, k: int) -> str: 先固定第一位 第一位的索引为 k//(n-1)! (k=k-1, n为列表长度) 然后数组中删掉被固定的那位,然后再拿剩下数组和k%(n-1)重复上一步 :param n: :param k: :return: - def getPermutation2(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation(self, n: int, k: int) -> str: 先固定第一位 第一位的索引为 k//(n-1)! (k=k-1, n为列表长度) 然后数组中删掉被固定的那位,然后再拿剩下数组和k%(n-1)重复上一步 :param n: :param k: :return: - def getPermutation2(s...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def getPermutation(self, n: int, k: int) -> str: """先固定第一位 第一位的索引为 k//(n-1)! (k=k-1, n为列表长度) 然后数组中删掉被固定的那位,然后再拿剩下数组和k%(n-1)重复上一步 :param n: :param k: :return:""" <|body_0|> def getPermutation2(self, n: int, k: int) -> str: """超时 生成全排列 :param n: :param k: :re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getPermutation(self, n: int, k: int) -> str: """先固定第一位 第一位的索引为 k//(n-1)! (k=k-1, n为列表长度) 然后数组中删掉被固定的那位,然后再拿剩下数组和k%(n-1)重复上一步 :param n: :param k: :return:""" ls = list(range(1, n + 1)) res = '' k -= 1 while ls: m = math.factorial(len(ls) - 1) ...
the_stack_v2_python_sparse
60_第k个排列.py
lovehhf/LeetCode
train
0
8b4df5191bee1968669ef6c5ee63ce0d9fd1c76b
[ "\"\"\"\n if not root: return \"\"\n stack, out = [root], []\n while stack:\n cur = stack.pop()\n out.append(cur.val)\n for child in filter(None, [cur.right, cur.left]):\n stack += [child]\n\n print(out)\n return ' '.join(map(str, ou...
<|body_start_0|> """ if not root: return "" stack, out = [root], [] while stack: cur = stack.pop() out.append(cur.val) for child in filter(None, [cur.right, cur.left]): stack += [c...
Codec
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ ...
stack_v2_sparse_classes_36k_train_017361
4,562
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
4ea4c1579c28308455be4dfa02bd45ebd88b2d0a
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" """ if not root: return "" stack, out = [root], [] while stack: cur = stack.pop() out.append(cur.val) ...
the_stack_v2_python_sparse
src/trees/deserialize_serialize.py
way2arun/datastructures_algorithms
train
1
4cd2ea55932ce61a87b4123cedfdc7ca9c572a52
[ "logger.debug('Init container received terminate request, terminating.')\nawait error('Init container received terminating request.', self.communicator)\nfor task in asyncio.all_tasks():\n task.cancel()", "await self.communicator.send_command(Message.command('update_status', 'PP'))\nif DATA_ALL_VOLUME_SHARED:\...
<|body_start_0|> logger.debug('Init container received terminate request, terminating.') await error('Init container received terminating request.', self.communicator) for task in asyncio.all_tasks(): task.cancel() <|end_body_0|> <|body_start_1|> await self.communicator.send...
Protocol class.
InitProtocol
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitProtocol: """Protocol class.""" async def post_terminate(self, message: Message, identity: PeerIdentity): """Handle post-terminate command.""" <|body_0|> async def transfer_missing_data(self): """Transfer missing data. :raises RuntimeError: when data transfer...
stack_v2_sparse_classes_36k_train_017362
6,353
permissive
[ { "docstring": "Handle post-terminate command.", "name": "post_terminate", "signature": "async def post_terminate(self, message: Message, identity: PeerIdentity)" }, { "docstring": "Transfer missing data. :raises RuntimeError: when data transfer error occurs.", "name": "transfer_missing_data...
2
stack_v2_sparse_classes_30k_train_004636
Implement the Python class `InitProtocol` described below. Class description: Protocol class. Method signatures and docstrings: - async def post_terminate(self, message: Message, identity: PeerIdentity): Handle post-terminate command. - async def transfer_missing_data(self): Transfer missing data. :raises RuntimeErro...
Implement the Python class `InitProtocol` described below. Class description: Protocol class. Method signatures and docstrings: - async def post_terminate(self, message: Message, identity: PeerIdentity): Handle post-terminate command. - async def transfer_missing_data(self): Transfer missing data. :raises RuntimeErro...
11a06a9d741dcc999253246919a0abc12127fd2a
<|skeleton|> class InitProtocol: """Protocol class.""" async def post_terminate(self, message: Message, identity: PeerIdentity): """Handle post-terminate command.""" <|body_0|> async def transfer_missing_data(self): """Transfer missing data. :raises RuntimeError: when data transfer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InitProtocol: """Protocol class.""" async def post_terminate(self, message: Message, identity: PeerIdentity): """Handle post-terminate command.""" logger.debug('Init container received terminate request, terminating.') await error('Init container received terminating request.', se...
the_stack_v2_python_sparse
resolwe/flow/executors/init_container.py
romunov/resolwe
train
0
7cf88e1645d8accf7097a420974ba659944b7549
[ "self.sampler = sampler\nself.ntype = ntype\nself.g = g\nself.textset = textset", "heads, tails, neg_tails = batches[0]\npos_graph, neg_graph, blocks = self.sampler.sample_from_item_pairs(heads, tails, neg_tails)\nassign_features_to_blocks(blocks, self.g, self.textset, self.ntype)\nreturn (pos_graph, neg_graph, b...
<|body_start_0|> self.sampler = sampler self.ntype = ntype self.g = g self.textset = textset <|end_body_0|> <|body_start_1|> heads, tails, neg_tails = batches[0] pos_graph, neg_graph, blocks = self.sampler.sample_from_item_pairs(heads, tails, neg_tails) assign_fe...
PinSAGECollator class.
PinSAGECollator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PinSAGECollator: """PinSAGECollator class.""" def __init__(self, sampler, g, ntype, textset): """Constructor for PinSAGECollator class. Args: sampler (NeighborSampler): node neighbor sampler object g (dgl.DGLGraph): bipartite user-item graph ntype (str): item node name textset (torch...
stack_v2_sparse_classes_36k_train_017363
12,447
no_license
[ { "docstring": "Constructor for PinSAGECollator class. Args: sampler (NeighborSampler): node neighbor sampler object g (dgl.DGLGraph): bipartite user-item graph ntype (str): item node name textset (torchtext.data.Dataset): text features imgset (dict): image features", "name": "__init__", "signature": "d...
3
stack_v2_sparse_classes_30k_train_002147
Implement the Python class `PinSAGECollator` described below. Class description: PinSAGECollator class. Method signatures and docstrings: - def __init__(self, sampler, g, ntype, textset): Constructor for PinSAGECollator class. Args: sampler (NeighborSampler): node neighbor sampler object g (dgl.DGLGraph): bipartite u...
Implement the Python class `PinSAGECollator` described below. Class description: PinSAGECollator class. Method signatures and docstrings: - def __init__(self, sampler, g, ntype, textset): Constructor for PinSAGECollator class. Args: sampler (NeighborSampler): node neighbor sampler object g (dgl.DGLGraph): bipartite u...
f1c385e46d2d5475b28dec91b57a933ac81c23c5
<|skeleton|> class PinSAGECollator: """PinSAGECollator class.""" def __init__(self, sampler, g, ntype, textset): """Constructor for PinSAGECollator class. Args: sampler (NeighborSampler): node neighbor sampler object g (dgl.DGLGraph): bipartite user-item graph ntype (str): item node name textset (torch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PinSAGECollator: """PinSAGECollator class.""" def __init__(self, sampler, g, ntype, textset): """Constructor for PinSAGECollator class. Args: sampler (NeighborSampler): node neighbor sampler object g (dgl.DGLGraph): bipartite user-item graph ntype (str): item node name textset (torchtext.data.Dat...
the_stack_v2_python_sparse
projects/project_19/src/pinsage/sampler.py
amuamushu/projects-2020-2021
train
0
34c66274cdb233c734e8edf1826fa119e8bd66b8
[ "daepath = geo_cfg['room']\nself.planes = []\nmesh = co.Collada(daepath)\nfor obj in mesh.scene.objects('geometry'):\n for triset in obj.primitives():\n if type(triset) != co.triangleset.BoundTriangleSet:\n log.info('Warning: non-supported primitive ignored!')\n continue\n for...
<|body_start_0|> daepath = geo_cfg['room'] self.planes = [] mesh = co.Collada(daepath) for obj in mesh.scene.objects('geometry'): for triset in obj.primitives(): if type(triset) != co.triangleset.BoundTriangleSet: log.info('Warning: non-sup...
Geometry
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geometry: def __init__(self, geo_cfg, alpha, s): """Set up the room geometry from the .dae file Geometry consists of: Volume, Total ara and an array of plane objects. Each plane object will be processed in a c++ class and have the following att: - name (string) - bounding box (bool) - li...
stack_v2_sparse_classes_36k_train_017364
18,836
no_license
[ { "docstring": "Set up the room geometry from the .dae file Geometry consists of: Volume, Total ara and an array of plane objects. Each plane object will be processed in a c++ class and have the following att: - name (string) - bounding box (bool) - list of vertices (Eigen<double> - Nvert x 3) - normal (Eigen<d...
2
stack_v2_sparse_classes_30k_train_005074
Implement the Python class `Geometry` described below. Class description: Implement the Geometry class. Method signatures and docstrings: - def __init__(self, geo_cfg, alpha, s): Set up the room geometry from the .dae file Geometry consists of: Volume, Total ara and an array of plane objects. Each plane object will b...
Implement the Python class `Geometry` described below. Class description: Implement the Geometry class. Method signatures and docstrings: - def __init__(self, geo_cfg, alpha, s): Set up the room geometry from the .dae file Geometry consists of: Volume, Total ara and an array of plane objects. Each plane object will b...
345be1496d2c3f59f0aaa3594977f495c80f50e3
<|skeleton|> class Geometry: def __init__(self, geo_cfg, alpha, s): """Set up the room geometry from the .dae file Geometry consists of: Volume, Total ara and an array of plane objects. Each plane object will be processed in a c++ class and have the following att: - name (string) - bounding box (bool) - li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Geometry: def __init__(self, geo_cfg, alpha, s): """Set up the room geometry from the .dae file Geometry consists of: Volume, Total ara and an array of plane objects. Each plane object will be processed in a c++ class and have the following att: - name (string) - bounding box (bool) - list of vertices...
the_stack_v2_python_sparse
ra/room.py
pokjnb/ra
train
0
c269c168242c6f86c358680f55ed1a7c13876847
[ "self.bg_color = (230, 230, 230)\nself.bullet_width = 15\nself.bullet_height = 3\nself.bullet_color = (60, 60, 60)\nself.bullet_allowed = 3\nself.target_width = 40\nself.target_height = 40\nself.target_color = (0, 230, 230)\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()", "self.ship_speed = 6.0\nse...
<|body_start_0|> self.bg_color = (230, 230, 230) self.bullet_width = 15 self.bullet_height = 3 self.bullet_color = (60, 60, 60) self.bullet_allowed = 3 self.target_width = 40 self.target_height = 40 self.target_color = (0, 230, 230) self.speedup_sc...
this class give us information like screen width, hight etc.
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """this class give us information like screen width, hight etc.""" def __init__(self): """information about game.""" <|body_0|> def initialize_dynamic_settings(self): """Initialize settings that change throught the game.""" <|body_1|> def i...
stack_v2_sparse_classes_36k_train_017365
1,207
no_license
[ { "docstring": "information about game.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Initialize settings that change throught the game.", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { "docstring": "I...
3
stack_v2_sparse_classes_30k_train_007937
Implement the Python class `Settings` described below. Class description: this class give us information like screen width, hight etc. Method signatures and docstrings: - def __init__(self): information about game. - def initialize_dynamic_settings(self): Initialize settings that change throught the game. - def incre...
Implement the Python class `Settings` described below. Class description: this class give us information like screen width, hight etc. Method signatures and docstrings: - def __init__(self): information about game. - def initialize_dynamic_settings(self): Initialize settings that change throught the game. - def incre...
eb40f515564fe781eaaf5202165e06be6b22b34d
<|skeleton|> class Settings: """this class give us information like screen width, hight etc.""" def __init__(self): """information about game.""" <|body_0|> def initialize_dynamic_settings(self): """Initialize settings that change throught the game.""" <|body_1|> def i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """this class give us information like screen width, hight etc.""" def __init__(self): """information about game.""" self.bg_color = (230, 230, 230) self.bullet_width = 15 self.bullet_height = 3 self.bullet_color = (60, 60, 60) self.bullet_allowed...
the_stack_v2_python_sparse
TargetPractice/settings.py
noshah/Python_Practice
train
0
9a271f9b08b3c1b6fd0d99f87872cbeb78d93115
[ "if db_field.name == 'user':\n kwargs['queryset'] = User.objects.filter(id=request.user.id)\n kwargs['initial'] = request.user.id\nelif db_field.name == 'topic' and (not request.user.is_superuser):\n kwargs['queryset'] = Topic.objects.filter(id__in=request.user.profile.topics.all())\nreturn super(MaterialA...
<|body_start_0|> if db_field.name == 'user': kwargs['queryset'] = User.objects.filter(id=request.user.id) kwargs['initial'] = request.user.id elif db_field.name == 'topic' and (not request.user.is_superuser): kwargs['queryset'] = Topic.objects.filter(id__in=request.us...
MaterialAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaterialAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" <|body_0|> def formfield_for_manytomany(self, db_field, request, **kwargs): """Limits the choices of prof...
stack_v2_sparse_classes_36k_train_017366
9,167
permissive
[ { "docstring": "Assigns default value for User field. limits Topics field to user's topics.", "name": "formfield_for_foreignkey", "signature": "def formfield_for_foreignkey(self, db_field, request, **kwargs)" }, { "docstring": "Limits the choices of professors for the limit of user.", "name"...
3
stack_v2_sparse_classes_30k_train_017388
Implement the Python class `MaterialAdmin` described below. Class description: Implement the MaterialAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): Assigns default value for User field. limits Topics field to user's topics. - def formfield_for_manytom...
Implement the Python class `MaterialAdmin` described below. Class description: Implement the MaterialAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): Assigns default value for User field. limits Topics field to user's topics. - def formfield_for_manytom...
70638c121ea85ff0e6a650c5f2641b0b3b04d6d0
<|skeleton|> class MaterialAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" <|body_0|> def formfield_for_manytomany(self, db_field, request, **kwargs): """Limits the choices of prof...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaterialAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" if db_field.name == 'user': kwargs['queryset'] = User.objects.filter(id=request.user.id) kwargs['initial'] =...
the_stack_v2_python_sparse
cms/admin.py
Ibrahem3amer/bala7
train
0
6efa6c275d8c110a5c176c2ef483c601bc164466
[ "try:\n registry = oai_registry_api.get_by_id(registry_id)\n all_errors = oai_registry_api.harvest_registry(registry)\n if len(all_errors) > 0:\n raise exceptions_oai.OAIAPISerializeLabelledException(errors=all_errors, status_code=status.HTTP_400_BAD_REQUEST)\n else:\n content = OaiPmhMess...
<|body_start_0|> try: registry = oai_registry_api.get_by_id(registry_id) all_errors = oai_registry_api.harvest_registry(registry) if len(all_errors) > 0: raise exceptions_oai.OAIAPISerializeLabelledException(errors=all_errors, status_code=status.HTTP_400_BAD_R...
Harvest
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Harvest: def patch(self, request, registry_id): """Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server error""" <|bo...
stack_v2_sparse_classes_36k_train_017367
16,118
permissive
[ { "docstring": "Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server error", "name": "patch", "signature": "def patch(self, request, registry...
2
stack_v2_sparse_classes_30k_train_013097
Implement the Python class `Harvest` described below. Class description: Implement the Harvest class. Method signatures and docstrings: - def patch(self, request, registry_id): Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - co...
Implement the Python class `Harvest` described below. Class description: Implement the Harvest class. Method signatures and docstrings: - def patch(self, request, registry_id): Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - co...
e41fd9c5a75b51dc626995e753a5840f238a557d
<|skeleton|> class Harvest: def patch(self, request, registry_id): """Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server error""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Harvest: def patch(self, request, registry_id): """Harvest a given registry (Data provider) Args: request: HTTP request registry_id: ObjectId Returns: - code: 200 content: Success message - code: 404 content: Object was not found - code: 500 content: Internal server error""" try: r...
the_stack_v2_python_sparse
core_oaipmh_harvester_app/rest/oai_registry/views.py
faical-yannick-congo/core_oaipmh_harvester_app
train
0
e1da0feea2edc13ac0f90162c6c837db4410add5
[ "self._slide = slide\nself._slide_height = height\nself._slide_width = width", "if contextType is '2d':\n return CanvasRenderingContext2D(self)\nreturn None", "if contextType is '2d':\n return True\nreturn False" ]
<|body_start_0|> self._slide = slide self._slide_height = height self._slide_width = width <|end_body_0|> <|body_start_1|> if contextType is '2d': return CanvasRenderingContext2D(self) return None <|end_body_1|> <|body_start_2|> if contextType is '2d': ...
Canvas
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Canvas: def __init__(self, slide, height, width): """Create a new Canvas interface to a provided python-pptx `Slide`. Parameters ---------- slide : Slide python-pptx Slide height : int Height of Slide in EMUs width : int Width of Slide in EMUs""" <|body_0|> def getContext(se...
stack_v2_sparse_classes_36k_train_017368
1,351
permissive
[ { "docstring": "Create a new Canvas interface to a provided python-pptx `Slide`. Parameters ---------- slide : Slide python-pptx Slide height : int Height of Slide in EMUs width : int Width of Slide in EMUs", "name": "__init__", "signature": "def __init__(self, slide, height, width)" }, { "docst...
3
stack_v2_sparse_classes_30k_train_002102
Implement the Python class `Canvas` described below. Class description: Implement the Canvas class. Method signatures and docstrings: - def __init__(self, slide, height, width): Create a new Canvas interface to a provided python-pptx `Slide`. Parameters ---------- slide : Slide python-pptx Slide height : int Height o...
Implement the Python class `Canvas` described below. Class description: Implement the Canvas class. Method signatures and docstrings: - def __init__(self, slide, height, width): Create a new Canvas interface to a provided python-pptx `Slide`. Parameters ---------- slide : Slide python-pptx Slide height : int Height o...
1223e4abbc30de76359c8deefd5463c4c0eb7712
<|skeleton|> class Canvas: def __init__(self, slide, height, width): """Create a new Canvas interface to a provided python-pptx `Slide`. Parameters ---------- slide : Slide python-pptx Slide height : int Height of Slide in EMUs width : int Width of Slide in EMUs""" <|body_0|> def getContext(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Canvas: def __init__(self, slide, height, width): """Create a new Canvas interface to a provided python-pptx `Slide`. Parameters ---------- slide : Slide python-pptx Slide height : int Height of Slide in EMUs width : int Width of Slide in EMUs""" self._slide = slide self._slide_height ...
the_stack_v2_python_sparse
canvas/canvas.py
ARLM-Attic/pptx-canvas
train
0
9e5075ee9dede3456c1d95ff91a5c0d325e99e33
[ "if kwargs_numerics is None:\n kwargs_numerics = {'interpol_grid_num': 200, 'log_integration': True, 'max_integrate': 100, 'min_integrate': 0.001}\nif analytic_kinematics is True:\n anisotropy_model = kwargs_model.get('anisotropy_model')\n if not anisotropy_model == 'OM':\n raise ValueError('analyti...
<|body_start_0|> if kwargs_numerics is None: kwargs_numerics = {'interpol_grid_num': 200, 'log_integration': True, 'max_integrate': 100, 'min_integrate': 0.001} if analytic_kinematics is True: anisotropy_model = kwargs_model.get('anisotropy_model') if not anisotropy_m...
this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models The class supports any mass and light distribution (and superposition thereof) that has a 3d correspondance in ...
GalkinModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GalkinModel: """this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models The class supports any mass and light distribution (and superposition th...
stack_v2_sparse_classes_36k_train_017369
5,211
permissive
[ { "docstring": ":param kwargs_model: keyword arguments describing the model components :param kwargs_cosmo: keyword arguments that define the cosmology in terms of the angular diameter distances involved :param kwargs_numerics: numerics keyword arguments :param analytic_kinematics: bool, if True uses the analyt...
2
null
Implement the Python class `GalkinModel` described below. Class description: this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models The class supports any mass and l...
Implement the Python class `GalkinModel` described below. Class description: this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models The class supports any mass and l...
73c9645f26f6983fe7961104075ebe8bf7a4b54c
<|skeleton|> class GalkinModel: """this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models The class supports any mass and light distribution (and superposition th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GalkinModel: """this class handles all the kinematic modeling aspects of Galkin Excluded are observational conditions (seeing, aperture etc) Major class to compute velocity dispersion measurements given light and mass models The class supports any mass and light distribution (and superposition thereof) that h...
the_stack_v2_python_sparse
lenstronomy/GalKin/galkin_model.py
lenstronomy/lenstronomy
train
41
bdf1846a15040aad5e9e839466171a5537aa62b8
[ "m, n = (len(text1), len(text2))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n if text1[i - 1] == text2[j - 1]:\n dp[i][j] = 1 + dp[i - 1][j - 1]\n else:\n dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])\nreturn dp[-1][-1]", ...
<|body_start_0|> m, n = (len(text1), len(text2)) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(1, n + 1): if text1[i - 1] == text2[j - 1]: dp[i][j] = 1 + dp[i - 1][j - 1] else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonSubsequence(self, text1, text2): """:type text1: str :type text2: str :rtype: int :desc 最长公共子序列 不连续""" <|body_0|> def LCstring(string1, string2): """最长公共子串 连续""" <|body_1|> <|end_skeleton|> <|body_start_0|> m, n = (len(tex...
stack_v2_sparse_classes_36k_train_017370
1,358
no_license
[ { "docstring": ":type text1: str :type text2: str :rtype: int :desc 最长公共子序列 不连续", "name": "longestCommonSubsequence", "signature": "def longestCommonSubsequence(self, text1, text2)" }, { "docstring": "最长公共子串 连续", "name": "LCstring", "signature": "def LCstring(string1, string2)" } ]
2
stack_v2_sparse_classes_30k_train_006150
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonSubsequence(self, text1, text2): :type text1: str :type text2: str :rtype: int :desc 最长公共子序列 不连续 - def LCstring(string1, string2): 最长公共子串 连续
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonSubsequence(self, text1, text2): :type text1: str :type text2: str :rtype: int :desc 最长公共子序列 不连续 - def LCstring(string1, string2): 最长公共子串 连续 <|skeleton|> class ...
08b3d9cab3c1806c37d36587372b1e8fb1683f64
<|skeleton|> class Solution: def longestCommonSubsequence(self, text1, text2): """:type text1: str :type text2: str :rtype: int :desc 最长公共子序列 不连续""" <|body_0|> def LCstring(string1, string2): """最长公共子串 连续""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonSubsequence(self, text1, text2): """:type text1: str :type text2: str :rtype: int :desc 最长公共子序列 不连续""" m, n = (len(text1), len(text2)) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(1, n + 1): ...
the_stack_v2_python_sparse
history/1143.Longest-Common-Subsequence.py
HonniLin/leetcode
train
0
99a26e8c24ac601a004a388ef112efe993191dc6
[ "context = super().get_context_data(**kwargs)\ncontext['only_action_list'] = self.only_action_list\nreturn context", "form_kwargs = super().get_form_kwargs()\nform_kwargs['workflow'] = self.workflow\nreturn form_kwargs", "to_include = []\nfor idx, a_id in enumerate(self.workflow.actions.values_list('id', flat=T...
<|body_start_0|> context = super().get_context_data(**kwargs) context['only_action_list'] = self.only_action_list return context <|end_body_0|> <|body_start_1|> form_kwargs = super().get_form_kwargs() form_kwargs['workflow'] = self.workflow return form_kwargs <|end_body_...
View to request information to export a workflow.
WorkflowActionExportView
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowActionExportView: """View to request information to export a workflow.""" def get_context_data(self, **kwargs): """Store the workflow in the context.""" <|body_0|> def get_form_kwargs(self): """Set some required parameters in the form context.""" ...
stack_v2_sparse_classes_36k_train_017371
3,538
permissive
[ { "docstring": "Store the workflow in the context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Set some required parameters in the form context.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "do...
3
null
Implement the Python class `WorkflowActionExportView` described below. Class description: View to request information to export a workflow. Method signatures and docstrings: - def get_context_data(self, **kwargs): Store the workflow in the context. - def get_form_kwargs(self): Set some required parameters in the form...
Implement the Python class `WorkflowActionExportView` described below. Class description: View to request information to export a workflow. Method signatures and docstrings: - def get_context_data(self, **kwargs): Store the workflow in the context. - def get_form_kwargs(self): Set some required parameters in the form...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class WorkflowActionExportView: """View to request information to export a workflow.""" def get_context_data(self, **kwargs): """Store the workflow in the context.""" <|body_0|> def get_form_kwargs(self): """Set some required parameters in the form context.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowActionExportView: """View to request information to export a workflow.""" def get_context_data(self, **kwargs): """Store the workflow in the context.""" context = super().get_context_data(**kwargs) context['only_action_list'] = self.only_action_list return context ...
the_stack_v2_python_sparse
ontask/workflow/views/import_export.py
abelardopardo/ontask_b
train
43
9cec36a720c8794bf155db1873724b4f8f74be3a
[ "start = 0\nif len(s) == 0:\n return ''\nif len(s) == 1:\n return s\nlongest = s[0]\nwhile start < len(s) - 1:\n end = start + 1\n while end < len(s):\n flag = True\n for i in range((end - start + 1) // 2):\n if s[i + start] != s[end - i]:\n flag = False\n ...
<|body_start_0|> start = 0 if len(s) == 0: return '' if len(s) == 1: return s longest = s[0] while start < len(s) - 1: end = start + 1 while end < len(s): flag = True for i in range((end - start + 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome3(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> start = 0 if len(s) == 0: return '' ...
stack_v2_sparse_classes_36k_train_017372
1,664
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome3", "signature": "def longestPalindrome3(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome3(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome3(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def longestPalindrome(self...
715e301068432c12b35169728390b64a8d4f83a2
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome3(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" start = 0 if len(s) == 0: return '' if len(s) == 1: return s longest = s[0] while start < len(s) - 1: end = start + 1 while end < len(s): ...
the_stack_v2_python_sparse
codes_1-50/5_Longest_Palindromic_Substring.py
GuodongQi/LeetCode
train
0
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return ScanDetailsSerializerV6\nelif self.request.version == 'v7':\n return ScanDetailsSerializerV6", "if request.version == 'v6':\n return self._get_v6(request, scan_id)\nelif request.version == 'v7':\n return self._get_v6(request, scan_id)\nraise Http404()", "tr...
<|body_start_0|> if self.request.version == 'v6': return ScanDetailsSerializerV6 elif self.request.version == 'v7': return ScanDetailsSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6': return self._get_v6(request, scan_id) elif r...
This view is the endpoint for retrieving/updating details of a Scan process.
ScansDetailsView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScansDetailsView: """This view is the endpoint for retrieving/updating details of a Scan process.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def get(self, request, scan_id): ...
stack_v2_sparse_classes_36k_train_017373
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Retrieves the details for a Scan process and return them in JSON form :param request: the HTTP GET...
5
stack_v2_sparse_classes_30k_train_016897
Implement the Python class `ScansDetailsView` described below. Class description: This view is the endpoint for retrieving/updating details of a Scan process. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def ge...
Implement the Python class `ScansDetailsView` described below. Class description: This view is the endpoint for retrieving/updating details of a Scan process. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def ge...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class ScansDetailsView: """This view is the endpoint for retrieving/updating details of a Scan process.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def get(self, request, scan_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScansDetailsView: """This view is the endpoint for retrieving/updating details of a Scan process.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" if self.request.version == 'v6': return ScanDetailsSeri...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
949c003aad0a09b1d9537bbdc99ea55e183b515c
[ "self.base_url = 'https://follow-api-ms.juejin.im/v1/getUserFollowerList'\nself.user_id = ''\nself.src = 'web'\nself.before = ''\nself.param = {}\nself.user_list = []\nself.json_file = 'follower_user.json'", "headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko...
<|body_start_0|> self.base_url = 'https://follow-api-ms.juejin.im/v1/getUserFollowerList' self.user_id = '' self.src = 'web' self.before = '' self.param = {} self.user_list = [] self.json_file = 'follower_user.json' <|end_body_0|> <|body_start_1|> headers...
抓取掘金用户的关注者
GetFollwerUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetFollwerUser: """抓取掘金用户的关注者""" def __init__(self): """初始化变量""" <|body_0|> def get_users(self): """获取一页的用户""" <|body_1|> def get_follower_follower_user(self, user_id): """获取关注者的关注者""" <|body_2|> def run(self, user_id): "...
stack_v2_sparse_classes_36k_train_017374
4,031
no_license
[ { "docstring": "初始化变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "获取一页的用户", "name": "get_users", "signature": "def get_users(self)" }, { "docstring": "获取关注者的关注者", "name": "get_follower_follower_user", "signature": "def get_follower_follower_...
4
stack_v2_sparse_classes_30k_train_020820
Implement the Python class `GetFollwerUser` described below. Class description: 抓取掘金用户的关注者 Method signatures and docstrings: - def __init__(self): 初始化变量 - def get_users(self): 获取一页的用户 - def get_follower_follower_user(self, user_id): 获取关注者的关注者 - def run(self, user_id): 开始爬取
Implement the Python class `GetFollwerUser` described below. Class description: 抓取掘金用户的关注者 Method signatures and docstrings: - def __init__(self): 初始化变量 - def get_users(self): 获取一页的用户 - def get_follower_follower_user(self, user_id): 获取关注者的关注者 - def run(self, user_id): 开始爬取 <|skeleton|> class GetFollwerUser: """抓...
85252128df681c472acda8ae2467c4426612f9b6
<|skeleton|> class GetFollwerUser: """抓取掘金用户的关注者""" def __init__(self): """初始化变量""" <|body_0|> def get_users(self): """获取一页的用户""" <|body_1|> def get_follower_follower_user(self, user_id): """获取关注者的关注者""" <|body_2|> def run(self, user_id): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetFollwerUser: """抓取掘金用户的关注者""" def __init__(self): """初始化变量""" self.base_url = 'https://follow-api-ms.juejin.im/v1/getUserFollowerList' self.user_id = '' self.src = 'web' self.before = '' self.param = {} self.user_list = [] self.json_file ...
the_stack_v2_python_sparse
取个队名真难-C/day18/follower_user_to_next.py
lxiaokai/team-learning-python
train
12
df1cd06580e53bb0453fbe6134048516ffc7ce8c
[ "sel = Selector(response)\nurl = sel.xpath(\"//img[@alt='Agenda']/parent::a//@href\").extract()\nurl = response.url + url[0]\nyield Request(url, self.parse_calendar)", "sel = Selector(response)\nnote = sel.xpath(\"//p[@id='observacao']//text()\").extract()\ntitle = sel.xpath(\"//div[@id='agenda']//h1//text()\").e...
<|body_start_0|> sel = Selector(response) url = sel.xpath("//img[@alt='Agenda']/parent::a//@href").extract() url = response.url + url[0] yield Request(url, self.parse_calendar) <|end_body_0|> <|body_start_1|> sel = Selector(response) note = sel.xpath("//p[@id='observacao...
Spider - agenda do simples nacional.
CalendarSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarSpider: """Spider - agenda do simples nacional.""" def parse(self, response): """Realiza o parse do body da página web.""" <|body_0|> def parse_calendar(self, response): """Realiza o parse da agenda.""" <|body_1|> def print_calendar(self, cal...
stack_v2_sparse_classes_36k_train_017375
2,039
no_license
[ { "docstring": "Realiza o parse do body da página web.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Realiza o parse da agenda.", "name": "parse_calendar", "signature": "def parse_calendar(self, response)" }, { "docstring": "Imprime o calendário."...
3
stack_v2_sparse_classes_30k_train_016333
Implement the Python class `CalendarSpider` described below. Class description: Spider - agenda do simples nacional. Method signatures and docstrings: - def parse(self, response): Realiza o parse do body da página web. - def parse_calendar(self, response): Realiza o parse da agenda. - def print_calendar(self, calenda...
Implement the Python class `CalendarSpider` described below. Class description: Spider - agenda do simples nacional. Method signatures and docstrings: - def parse(self, response): Realiza o parse do body da página web. - def parse_calendar(self, response): Realiza o parse da agenda. - def print_calendar(self, calenda...
05092ed0fdbe519187e68d93c80fee21e811688b
<|skeleton|> class CalendarSpider: """Spider - agenda do simples nacional.""" def parse(self, response): """Realiza o parse do body da página web.""" <|body_0|> def parse_calendar(self, response): """Realiza o parse da agenda.""" <|body_1|> def print_calendar(self, cal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalendarSpider: """Spider - agenda do simples nacional.""" def parse(self, response): """Realiza o parse do body da página web.""" sel = Selector(response) url = sel.xpath("//img[@alt='Agenda']/parent::a//@href").extract() url = response.url + url[0] yield Request(...
the_stack_v2_python_sparse
week7/simples_nacional/simples_nacional/spiders/calendar_spider.py
paulofreitasnobrega/coursera-introducao-a-ciencia-da-computacao-com-python-parte-2
train
5
455f3a217ed24caa596121879c3d4554527f7a10
[ "self.capacity = capacity\nself.dict = dict()\nself.head, self.tail = (None, None)", "if key in self.dict:\n node = self.dict[key]\n if node == self.head:\n return node.val\n node.prev.next = node.next\n if node == self.tail:\n self.tail = node.prev\n else:\n node.next.prev = n...
<|body_start_0|> self.capacity = capacity self.dict = dict() self.head, self.tail = (None, None) <|end_body_0|> <|body_start_1|> if key in self.dict: node = self.dict[key] if node == self.head: return node.val node.prev.next = node.nex...
LRUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_017376
2,568
permissive
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
ebebd1104b1947324fbaae304b44465f80803c8b
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.dict = dict() self.head, self.tail = (None, None) def get(self, key): """:type key: int :rtype: int""" if key in self.dict: node = self.dict[key] ...
the_stack_v2_python_sparse
interview/leet/146_LRU_Cache.py
eroicaleo/LearningPython
train
4
fbe4c6027d08b59e01fd42122a3a3b3cd85a82f2
[ "def inorder(node):\n if not node:\n return []\n return inorder(node.left) + [node] + inorder(node.right)\ncurrent = inorder(root)\nactual = sorted(current, key=lambda x: x.val)\nswaped = []\nfor i, (a, b) in enumerate(zip(current, actual)):\n if a != b:\n a.val, b.val = (b.val, a.val)\n ...
<|body_start_0|> def inorder(node): if not node: return [] return inorder(node.left) + [node] + inorder(node.right) current = inorder(root) actual = sorted(current, key=lambda x: x.val) swaped = [] for i, (a, b) in enumerate(zip(current, ac...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def recoverTree(self, root): """08/15/2018 00:23 Space complexity: O(n)""" <|body_0|> def recoverTree(self, root): """08/15/2018 00:55 Space complexity: O(1)""" <|body_1|> def recoverTree(self, root): """08/15/2018 03:31""" <|bo...
stack_v2_sparse_classes_36k_train_017377
5,275
no_license
[ { "docstring": "08/15/2018 00:23 Space complexity: O(n)", "name": "recoverTree", "signature": "def recoverTree(self, root)" }, { "docstring": "08/15/2018 00:55 Space complexity: O(1)", "name": "recoverTree", "signature": "def recoverTree(self, root)" }, { "docstring": "08/15/2018...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root): 08/15/2018 00:23 Space complexity: O(n) - def recoverTree(self, root): 08/15/2018 00:55 Space complexity: O(1) - def recoverTree(self, root): 08/15/2...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root): 08/15/2018 00:23 Space complexity: O(n) - def recoverTree(self, root): 08/15/2018 00:55 Space complexity: O(1) - def recoverTree(self, root): 08/15/2...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def recoverTree(self, root): """08/15/2018 00:23 Space complexity: O(n)""" <|body_0|> def recoverTree(self, root): """08/15/2018 00:55 Space complexity: O(1)""" <|body_1|> def recoverTree(self, root): """08/15/2018 03:31""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def recoverTree(self, root): """08/15/2018 00:23 Space complexity: O(n)""" def inorder(node): if not node: return [] return inorder(node.left) + [node] + inorder(node.right) current = inorder(root) actual = sorted(current, key=l...
the_stack_v2_python_sparse
leetcode/solved/99_Recover_Binary_Search_Tree/solution.py
sungminoh/algorithms
train
0
0fe18c0d612f4563567a6184d9b54bbba96db82e
[ "if not user.is_active:\n return False\nperm_type = perm.split('.')[1].split('_')[0]\nif obj is None:\n app_label = perm.split('.')[0]\n model_label = perm.split('_')[1]\n model = apps.get_model(app_label, model_label)\n perm_manager = model\nelse:\n perm_manager = obj\ntry:\n is_authorized = p...
<|body_start_0|> if not user.is_active: return False perm_type = perm.split('.')[1].split('_')[0] if obj is None: app_label = perm.split('.')[0] model_label = perm.split('_')[1] model = apps.get_model(app_label, model_label) perm_manage...
OrchestraPermissionBackend
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrchestraPermissionBackend: def has_perm(self, user, perm, obj=None): """perm 'app.action_model'""" <|body_0|> def has_module_perms(self, user, app_label): """Returns True if user_obj has any permissions in the given app_label.""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_017378
1,431
permissive
[ { "docstring": "perm 'app.action_model'", "name": "has_perm", "signature": "def has_perm(self, user, perm, obj=None)" }, { "docstring": "Returns True if user_obj has any permissions in the given app_label.", "name": "has_module_perms", "signature": "def has_module_perms(self, user, app_l...
2
null
Implement the Python class `OrchestraPermissionBackend` described below. Class description: Implement the OrchestraPermissionBackend class. Method signatures and docstrings: - def has_perm(self, user, perm, obj=None): perm 'app.action_model' - def has_module_perms(self, user, app_label): Returns True if user_obj has ...
Implement the Python class `OrchestraPermissionBackend` described below. Class description: Implement the OrchestraPermissionBackend class. Method signatures and docstrings: - def has_perm(self, user, perm, obj=None): perm 'app.action_model' - def has_module_perms(self, user, app_label): Returns True if user_obj has ...
49c84f13a8f92427b01231615136549fb5be3a78
<|skeleton|> class OrchestraPermissionBackend: def has_perm(self, user, perm, obj=None): """perm 'app.action_model'""" <|body_0|> def has_module_perms(self, user, app_label): """Returns True if user_obj has any permissions in the given app_label.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrchestraPermissionBackend: def has_perm(self, user, perm, obj=None): """perm 'app.action_model'""" if not user.is_active: return False perm_type = perm.split('.')[1].split('_')[0] if obj is None: app_label = perm.split('.')[0] model_label = ...
the_stack_v2_python_sparse
orchestra/permissions/auth.py
Ro9ueAdmin/django-orchestra
train
0
bccb8bb1060a716bb8aa9ae49cc7158b32ad8a7e
[ "self.limit = params.get('limit', 10)\nself.offset = params.get('offset', 0)\nself.count = 0\nself.others = None", "self.request = request\norg_objects = []\norg_data = dataset.get('data')\nfor date in org_data:\n if date.get('org_entities'):\n for entry in date.get('org_entities'):\n org_obj...
<|body_start_0|> self.limit = params.get('limit', 10) self.offset = params.get('offset', 0) self.count = 0 self.others = None <|end_body_0|> <|body_start_1|> self.request = request org_objects = [] org_data = dataset.get('data') for date in org_data: ...
A paginator of org units.
OrgUnitPagination
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrgUnitPagination: """A paginator of org units.""" def __init__(self, params): """Set the parameters.""" <|body_0|> def paginate_queryset(self, dataset, request, view=None): """Override queryset pagination.""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_017379
10,415
permissive
[ { "docstring": "Set the parameters.", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Override queryset pagination.", "name": "paginate_queryset", "signature": "def paginate_queryset(self, dataset, request, view=None)" } ]
2
null
Implement the Python class `OrgUnitPagination` described below. Class description: A paginator of org units. Method signatures and docstrings: - def __init__(self, params): Set the parameters. - def paginate_queryset(self, dataset, request, view=None): Override queryset pagination.
Implement the Python class `OrgUnitPagination` described below. Class description: A paginator of org units. Method signatures and docstrings: - def __init__(self, params): Set the parameters. - def paginate_queryset(self, dataset, request, view=None): Override queryset pagination. <|skeleton|> class OrgUnitPaginati...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class OrgUnitPagination: """A paginator of org units.""" def __init__(self, params): """Set the parameters.""" <|body_0|> def paginate_queryset(self, dataset, request, view=None): """Override queryset pagination.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrgUnitPagination: """A paginator of org units.""" def __init__(self, params): """Set the parameters.""" self.limit = params.get('limit', 10) self.offset = params.get('offset', 0) self.count = 0 self.others = None def paginate_queryset(self, dataset, request, ...
the_stack_v2_python_sparse
koku/api/common/pagination.py
project-koku/koku
train
225
c29a43b382d84f96582e7cab0eb52baf35c280fe
[ "with schema_context(self.schema_name):\n query_settings = UserSettings.objects.all().first()\n if not query_settings:\n self.assertEqual(get_cost_type(self.request_context['request']), KOKU_DEFAULT_COST_TYPE)\n else:\n cost_type = query_settings.settings['cost_type']\n self.assertEqua...
<|body_start_0|> with schema_context(self.schema_name): query_settings = UserSettings.objects.all().first() if not query_settings: self.assertEqual(get_cost_type(self.request_context['request']), KOKU_DEFAULT_COST_TYPE) else: cost_type = query_...
Test general functions in utils
GeneralUtilsTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralUtilsTest: """Test general functions in utils""" def test_get_cost_type(self): """Test the get_cost_type function in utils.""" <|body_0|> def test_get_currency(self): """Test the get_currency function in utils.""" <|body_1|> def test_get_user_...
stack_v2_sparse_classes_36k_train_017380
20,013
permissive
[ { "docstring": "Test the get_cost_type function in utils.", "name": "test_get_cost_type", "signature": "def test_get_cost_type(self)" }, { "docstring": "Test the get_currency function in utils.", "name": "test_get_currency", "signature": "def test_get_currency(self)" }, { "docstr...
3
stack_v2_sparse_classes_30k_test_000657
Implement the Python class `GeneralUtilsTest` described below. Class description: Test general functions in utils Method signatures and docstrings: - def test_get_cost_type(self): Test the get_cost_type function in utils. - def test_get_currency(self): Test the get_currency function in utils. - def test_get_user_sett...
Implement the Python class `GeneralUtilsTest` described below. Class description: Test general functions in utils Method signatures and docstrings: - def test_get_cost_type(self): Test the get_cost_type function in utils. - def test_get_currency(self): Test the get_currency function in utils. - def test_get_user_sett...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class GeneralUtilsTest: """Test general functions in utils""" def test_get_cost_type(self): """Test the get_cost_type function in utils.""" <|body_0|> def test_get_currency(self): """Test the get_currency function in utils.""" <|body_1|> def test_get_user_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneralUtilsTest: """Test general functions in utils""" def test_get_cost_type(self): """Test the get_cost_type function in utils.""" with schema_context(self.schema_name): query_settings = UserSettings.objects.all().first() if not query_settings: s...
the_stack_v2_python_sparse
koku/api/test_utils.py
project-koku/koku
train
225
31706784ec74c41b6b3a8cc04181959cdfb72400
[ "q = Path.all()\nq.filter('parent_c_key =', self.get_namekey())\nq.filter('name =', name)\npobjs = list(q.fetch(1))\nif not pobjs:\n return None\nreturn pobjs[0].get_content()", "q = Path.all()\nq.filter('parent_c_key =', self.get_namekey())\nif type:\n if isinstance(type, basestring):\n q.filter('ct...
<|body_start_0|> q = Path.all() q.filter('parent_c_key =', self.get_namekey()) q.filter('name =', name) pobjs = list(q.fetch(1)) if not pobjs: return None return pobjs[0].get_content() <|end_body_0|> <|body_start_1|> q = Path.all() q.filter('p...
A model class to perform as folder, storeing other object in one.
Folder
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Folder: """A model class to perform as folder, storeing other object in one.""" def get_child(self, name): """A method to obtain child object that has given name as its name.""" <|body_0|> def get_childs(self, start=0, end=-1, order='-created_at', type=None): """...
stack_v2_sparse_classes_36k_train_017381
10,914
permissive
[ { "docstring": "A method to obtain child object that has given name as its name.", "name": "get_child", "signature": "def get_child(self, name)" }, { "docstring": "A method to obtain multiple child object based on given parameters start, end and order. If end is not given, it returns count of BA...
5
null
Implement the Python class `Folder` described below. Class description: A model class to perform as folder, storeing other object in one. Method signatures and docstrings: - def get_child(self, name): A method to obtain child object that has given name as its name. - def get_childs(self, start=0, end=-1, order='-crea...
Implement the Python class `Folder` described below. Class description: A model class to perform as folder, storeing other object in one. Method signatures and docstrings: - def get_child(self, name): A method to obtain child object that has given name as its name. - def get_childs(self, start=0, end=-1, order='-crea...
e1209f7d44d1c59ff9d373b7d89d414f31a9c28b
<|skeleton|> class Folder: """A model class to perform as folder, storeing other object in one.""" def get_child(self, name): """A method to obtain child object that has given name as its name.""" <|body_0|> def get_childs(self, start=0, end=-1, order='-created_at', type=None): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Folder: """A model class to perform as folder, storeing other object in one.""" def get_child(self, name): """A method to obtain child object that has given name as its name.""" q = Path.all() q.filter('parent_c_key =', self.get_namekey()) q.filter('name =', name) ...
the_stack_v2_python_sparse
applications/aha.application.coreblog3/application/model/basictype.py
Letractively/aha-gae
train
0
ac342445dc54cb5cbdf99be5a724344298a3a93f
[ "if request.user.is_authenticated and (not request.user.is_superuser):\n anuncios_count = self.model.objects.filter(owner=request.user, is_premium=False).count()\n if not (request.user.is_premium or request.user.anuncios_premium) and anuncios_count >= anuncios_settings.ANUNCIO_MAX_ANUNCIOS:\n messages....
<|body_start_0|> if request.user.is_authenticated and (not request.user.is_superuser): anuncios_count = self.model.objects.filter(owner=request.user, is_premium=False).count() if not (request.user.is_premium or request.user.anuncios_premium) and anuncios_count >= anuncios_settings.ANUNCI...
Form para crear anuncios.
AnuncioCreateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnuncioCreateView: """Form para crear anuncios.""" def dispatch(self, request, *args, **kwargs): """Comprobar que puede poner un anuncio. Comprueba si es usuario premium o si tiene menos de ANUNCIO_MAX_ANUNCIOS. El superuser, no tiene limites.""" <|body_0|> def get_initi...
stack_v2_sparse_classes_36k_train_017382
17,452
no_license
[ { "docstring": "Comprobar que puede poner un anuncio. Comprueba si es usuario premium o si tiene menos de ANUNCIO_MAX_ANUNCIOS. El superuser, no tiene limites.", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Añade el id usuario y la categoría ...
3
null
Implement the Python class `AnuncioCreateView` described below. Class description: Form para crear anuncios. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Comprobar que puede poner un anuncio. Comprueba si es usuario premium o si tiene menos de ANUNCIO_MAX_ANUNCIOS. El superuser, n...
Implement the Python class `AnuncioCreateView` described below. Class description: Form para crear anuncios. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Comprobar que puede poner un anuncio. Comprueba si es usuario premium o si tiene menos de ANUNCIO_MAX_ANUNCIOS. El superuser, n...
44b8d2934105ccbf02ff6c20896aa8c2b1746eaa
<|skeleton|> class AnuncioCreateView: """Form para crear anuncios.""" def dispatch(self, request, *args, **kwargs): """Comprobar que puede poner un anuncio. Comprueba si es usuario premium o si tiene menos de ANUNCIO_MAX_ANUNCIOS. El superuser, no tiene limites.""" <|body_0|> def get_initi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnuncioCreateView: """Form para crear anuncios.""" def dispatch(self, request, *args, **kwargs): """Comprobar que puede poner un anuncio. Comprueba si es usuario premium o si tiene menos de ANUNCIO_MAX_ANUNCIOS. El superuser, no tiene limites.""" if request.user.is_authenticated and (not ...
the_stack_v2_python_sparse
src/apps/anuncios/views.py
snicoper/ofervivienda
train
1
c899e22e9df7803cf7355350d79c20373d19a2d0
[ "options = super()._default_experiment_options()\noptions.gate_type = XGate\noptions.add_sx = True\noptions.add_xp_circuit = True\nreturn options", "options = super()._default_analysis_options()\noptions.angle_per_gate = np.pi\noptions.phase_offset = np.pi / 2\nreturn options" ]
<|body_start_0|> options = super()._default_experiment_options() options.gate_type = XGate options.add_sx = True options.add_xp_circuit = True return options <|end_body_0|> <|body_start_1|> options = super()._default_analysis_options() options.angle_per_gate = np...
A fine amplitude experiment with all the options set for the :math:`\\pi`-rotation. # section: overview :class:`FineXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.
FineXAmplitude
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FineXAmplitude: """A fine amplitude experiment with all the options set for the :math:`\\pi`-rotation. # section: overview :class:`FineXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.""" def _default_experiment_options(cls...
stack_v2_sparse_classes_36k_train_017383
14,447
permissive
[ { "docstring": "Default values for the fine amplitude experiment. Experiment Options: gate_type (Type): FineXAmplitude calibrates an XGate. add_sx (bool): This option is True by default when calibrating gates with a target angle per gate of :math:`\\\\pi` as this increases the sensitivity of the experiment. add...
2
stack_v2_sparse_classes_30k_train_017320
Implement the Python class `FineXAmplitude` described below. Class description: A fine amplitude experiment with all the options set for the :math:`\\pi`-rotation. # section: overview :class:`FineXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options. Met...
Implement the Python class `FineXAmplitude` described below. Class description: A fine amplitude experiment with all the options set for the :math:`\\pi`-rotation. # section: overview :class:`FineXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options. Met...
e95ad826943a58c2b2899feb0dd6952cb8a0f5cf
<|skeleton|> class FineXAmplitude: """A fine amplitude experiment with all the options set for the :math:`\\pi`-rotation. # section: overview :class:`FineXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.""" def _default_experiment_options(cls...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FineXAmplitude: """A fine amplitude experiment with all the options set for the :math:`\\pi`-rotation. # section: overview :class:`FineXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.""" def _default_experiment_options(cls) -> Options:...
the_stack_v2_python_sparse
qiskit_experiments/library/calibration/fine_amplitude.py
abhishak3/qiskit-experiments
train
0
37b0c67adabbc081ca3f843ed03c73828c946d1a
[ "self.pos = to_deg(pos)\nself.name = name\nself.comp = list()\nlog.info(\"Source '\" + name + \"' added\\n\")", "code = self.name + '::' + str(len(self.comp) + 1)\nmodel_cpy = copy.deepcopy(model)\nmodel_cpy.register(code, self.pos)\nself.comp.append(model_cpy)\nlog.info('Added component ' + code + ' with model '...
<|body_start_0|> self.pos = to_deg(pos) self.name = name self.comp = list() log.info("Source '" + name + "' added\n") <|end_body_0|> <|body_start_1|> code = self.name + '::' + str(len(self.comp) + 1) model_cpy = copy.deepcopy(model) model_cpy.register(code, self....
A generic source of electromagnetic waves with several components.
Source
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Source: """A generic source of electromagnetic waves with several components.""" def __init__(self, name, pos): """:param name: a name of the source""" <|body_0|> def add_component(self, model): """Defines a new component from a model.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_017384
9,759
no_license
[ { "docstring": ":param name: a name of the source", "name": "__init__", "signature": "def __init__(self, name, pos)" }, { "docstring": "Defines a new component from a model.", "name": "add_component", "signature": "def add_component(self, model)" }, { "docstring": "Projects all c...
3
stack_v2_sparse_classes_30k_train_008284
Implement the Python class `Source` described below. Class description: A generic source of electromagnetic waves with several components. Method signatures and docstrings: - def __init__(self, name, pos): :param name: a name of the source - def add_component(self, model): Defines a new component from a model. - def ...
Implement the Python class `Source` described below. Class description: A generic source of electromagnetic waves with several components. Method signatures and docstrings: - def __init__(self, name, pos): :param name: a name of the source - def add_component(self, model): Defines a new component from a model. - def ...
d6a4256895a2e5bbb905dbdb3807cf708b4e5592
<|skeleton|> class Source: """A generic source of electromagnetic waves with several components.""" def __init__(self, name, pos): """:param name: a name of the source""" <|body_0|> def add_component(self, model): """Defines a new component from a model.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Source: """A generic source of electromagnetic waves with several components.""" def __init__(self, name, pos): """:param name: a name of the source""" self.pos = to_deg(pos) self.name = name self.comp = list() log.info("Source '" + name + "' added\n") def add...
the_stack_v2_python_sparse
acalib/synthetic/vu.py
Python3pkg/acalib
train
0
1edfff648a58740f3bd71f485105cad2d5d84656
[ "ConfigParameters.__init__(self)\nself._name = 'PSConfigParameters'\nself.declareBaseParameters()\nif __name__ == '__main__':\n self.fname_cp = './confpars-def.txt'\n self.readParametersFromFile()", "self.list_of_sources = None\nself.instr_dir = self.declareParameter(name='INSTRUMENT_DIR', val_def='/cds/dat...
<|body_start_0|> ConfigParameters.__init__(self) self._name = 'PSConfigParameters' self.declareBaseParameters() if __name__ == '__main__': self.fname_cp = './confpars-def.txt' self.readParametersFromFile() <|end_body_0|> <|body_start_1|> self.list_of_sour...
A storage of configuration parameters for Experiment Monitor (EM) project.
PSConfigParameters
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSConfigParameters: """A storage of configuration parameters for Experiment Monitor (EM) project.""" def __init__(self, fname=None): """fname: str - the file name with configuration parameters, if not specified then use default.""" <|body_0|> def declareBaseParameters(se...
stack_v2_sparse_classes_36k_train_017385
4,203
permissive
[ { "docstring": "fname: str - the file name with configuration parameters, if not specified then use default.", "name": "__init__", "signature": "def __init__(self, fname=None)" }, { "docstring": "Declaration of common paramaters for all PS apps", "name": "declareBaseParameters", "signatu...
2
stack_v2_sparse_classes_30k_train_012834
Implement the Python class `PSConfigParameters` described below. Class description: A storage of configuration parameters for Experiment Monitor (EM) project. Method signatures and docstrings: - def __init__(self, fname=None): fname: str - the file name with configuration parameters, if not specified then use default...
Implement the Python class `PSConfigParameters` described below. Class description: A storage of configuration parameters for Experiment Monitor (EM) project. Method signatures and docstrings: - def __init__(self, fname=None): fname: str - the file name with configuration parameters, if not specified then use default...
7f0401960ceb46551fd926d932c59e96297df6b0
<|skeleton|> class PSConfigParameters: """A storage of configuration parameters for Experiment Monitor (EM) project.""" def __init__(self, fname=None): """fname: str - the file name with configuration parameters, if not specified then use default.""" <|body_0|> def declareBaseParameters(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PSConfigParameters: """A storage of configuration parameters for Experiment Monitor (EM) project.""" def __init__(self, fname=None): """fname: str - the file name with configuration parameters, if not specified then use default.""" ConfigParameters.__init__(self) self._name = 'PSC...
the_stack_v2_python_sparse
psana/psana/pyalgos/generic/PSConfigParameters.py
slac-lcls/lcls2
train
19
8d23dcef39ba91dad029d9acc60e671ae972281b
[ "try:\n return_data = ''\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))", "try:\n return_data = ''\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_dat...
<|body_start_0|> try: return_data = '' return Response(json.dumps(return_data)) except Exception as e: return_data = {'status': '404', 'result': str(e)} return Response(json.dumps(return_data)) <|end_body_0|> <|body_start_1|> try: retu...
WorkFlowEvalConf
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkFlowEvalConf: def post(self, request, nnid, ver): """This API is for set node parameters This node is for evaluation of train result You can choose 3 diffrent kind of test method (n fold, random, extra test set) --- # Class Name : WorkFlowEvalConf # Description: Set Test method and t...
stack_v2_sparse_classes_36k_train_017386
2,971
permissive
[ { "docstring": "This API is for set node parameters This node is for evaluation of train result You can choose 3 diffrent kind of test method (n fold, random, extra test set) --- # Class Name : WorkFlowEvalConf # Description: Set Test method and test data source", "name": "post", "signature": "def post(...
4
stack_v2_sparse_classes_30k_train_004011
Implement the Python class `WorkFlowEvalConf` described below. Class description: Implement the WorkFlowEvalConf class. Method signatures and docstrings: - def post(self, request, nnid, ver): This API is for set node parameters This node is for evaluation of train result You can choose 3 diffrent kind of test method ...
Implement the Python class `WorkFlowEvalConf` described below. Class description: Implement the WorkFlowEvalConf class. Method signatures and docstrings: - def post(self, request, nnid, ver): This API is for set node parameters This node is for evaluation of train result You can choose 3 diffrent kind of test method ...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class WorkFlowEvalConf: def post(self, request, nnid, ver): """This API is for set node parameters This node is for evaluation of train result You can choose 3 diffrent kind of test method (n fold, random, extra test set) --- # Class Name : WorkFlowEvalConf # Description: Set Test method and t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkFlowEvalConf: def post(self, request, nnid, ver): """This API is for set node parameters This node is for evaluation of train result You can choose 3 diffrent kind of test method (n fold, random, extra test set) --- # Class Name : WorkFlowEvalConf # Description: Set Test method and test data sourc...
the_stack_v2_python_sparse
api/views/workflow_eval_conf.py
yurimkoo/tensormsa
train
1
7740d476d7cc1b61a9786784769380751a38135c
[ "if self.action == 'list':\n permission_classes = [permissions.IsAuthenticated]\nelse:\n return super().get_permissions()\nreturn [permission() for permission in permission_classes]", "context = super().get_serializer_context()\ncontext['course_id'] = self.kwargs['course_id']\nreturn context", "queryset =...
<|body_start_0|> if self.action == 'list': permission_classes = [permissions.IsAuthenticated] else: return super().get_permissions() return [permission() for permission in permission_classes] <|end_body_0|> <|body_start_1|> context = super().get_serializer_contex...
API ViewSet for all interactions with course accesses. GET /api/courses/<course_id|course_code>/accesses/:<course_access_id> Return list of all course accesses related to the logged-in user or one course access if an id is provided. POST /api/courses/<course_id|course_code>/accesses/ with expected data: - user: str - r...
CourseAccessViewSet
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseAccessViewSet: """API ViewSet for all interactions with course accesses. GET /api/courses/<course_id|course_code>/accesses/:<course_access_id> Return list of all course accesses related to the logged-in user or one course access if an id is provided. POST /api/courses/<course_id|course_code...
stack_v2_sparse_classes_36k_train_017387
30,756
permissive
[ { "docstring": "User only needs to be authenticated to list course accesses", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Extra context provided to the serializer class.", "name": "get_serializer_context", "signature": "def get_serializer_contex...
3
stack_v2_sparse_classes_30k_train_020628
Implement the Python class `CourseAccessViewSet` described below. Class description: API ViewSet for all interactions with course accesses. GET /api/courses/<course_id|course_code>/accesses/:<course_access_id> Return list of all course accesses related to the logged-in user or one course access if an id is provided. P...
Implement the Python class `CourseAccessViewSet` described below. Class description: API ViewSet for all interactions with course accesses. GET /api/courses/<course_id|course_code>/accesses/:<course_access_id> Return list of all course accesses related to the logged-in user or one course access if an id is provided. P...
6571a67d020715358fec807a1137f89bdf4b305a
<|skeleton|> class CourseAccessViewSet: """API ViewSet for all interactions with course accesses. GET /api/courses/<course_id|course_code>/accesses/:<course_access_id> Return list of all course accesses related to the logged-in user or one course access if an id is provided. POST /api/courses/<course_id|course_code...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseAccessViewSet: """API ViewSet for all interactions with course accesses. GET /api/courses/<course_id|course_code>/accesses/:<course_access_id> Return list of all course accesses related to the logged-in user or one course access if an id is provided. POST /api/courses/<course_id|course_code>/accesses/ w...
the_stack_v2_python_sparse
src/backend/joanie/core/api/client.py
openfun/joanie
train
13
1e27a0cd7e1f975678c76f51b457b4892efc0954
[ "if monosaccharide_codes is None:\n self.monosaccharide_codes = get_default_monosaccharide_codes()\nself.parser = self._create_gsl_parser()", "glycan_string = glycosciences_to_cfg(glycan_string)\nparsed_result = self.parser.parseString(glycan_string)\nresults = parse_gsl_structure_to_graph(parsed_result, parse...
<|body_start_0|> if monosaccharide_codes is None: self.monosaccharide_codes = get_default_monosaccharide_codes() self.parser = self._create_gsl_parser() <|end_body_0|> <|body_start_1|> glycan_string = glycosciences_to_cfg(glycan_string) parsed_result = self.parser.parseStrin...
A parser for Glycoscience Laboratory (Imperial College London) glycan strings. Provides access to a parser object that can be used to parse glycan strings.
GSLGlycanParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GSLGlycanParser: """A parser for Glycoscience Laboratory (Imperial College London) glycan strings. Provides access to a parser object that can be used to parse glycan strings.""" def __init__(self, monosaccharide_codes=None): """Create a parser object which can then be used to parse ...
stack_v2_sparse_classes_36k_train_017388
15,637
permissive
[ { "docstring": "Create a parser object which can then be used to parse multiple GSL glycan strings. Args: monosaccharide_codes (list, optional): A list of monosaccharide codes to initialise the parser with. If `None`, then uses the KEGG list of glycan codes, with the addition of `G-ol`, which appears in the CFG...
3
stack_v2_sparse_classes_30k_train_008775
Implement the Python class `GSLGlycanParser` described below. Class description: A parser for Glycoscience Laboratory (Imperial College London) glycan strings. Provides access to a parser object that can be used to parse glycan strings. Method signatures and docstrings: - def __init__(self, monosaccharide_codes=None)...
Implement the Python class `GSLGlycanParser` described below. Class description: A parser for Glycoscience Laboratory (Imperial College London) glycan strings. Provides access to a parser object that can be used to parse glycan strings. Method signatures and docstrings: - def __init__(self, monosaccharide_codes=None)...
2faa2856f370dbe5893d0e0f4e0082c956939335
<|skeleton|> class GSLGlycanParser: """A parser for Glycoscience Laboratory (Imperial College London) glycan strings. Provides access to a parser object that can be used to parse glycan strings.""" def __init__(self, monosaccharide_codes=None): """Create a parser object which can then be used to parse ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GSLGlycanParser: """A parser for Glycoscience Laboratory (Imperial College London) glycan strings. Provides access to a parser object that can be used to parse glycan strings.""" def __init__(self, monosaccharide_codes=None): """Create a parser object which can then be used to parse multiple GSL ...
the_stack_v2_python_sparse
ccarl/glycan_parsers/gsl_parser.py
andrewguy/CCARL
train
3
857c65221ad76bd49928546a7a2fc6022a145c31
[ "s = ''\nfor i in [1000, 100, 10, 1]:\n ret, num = divmod(num, i)\n if ret == 0:\n continue\n if ret * i in roman_dict:\n s += roman_dict[ret * i]\n elif ret > 5:\n s += roman_dict[5 * i] + roman_dict[i] * (ret - 5)\n else:\n s += roman_dict[i] * ret\nreturn s", "s = ''\...
<|body_start_0|> s = '' for i in [1000, 100, 10, 1]: ret, num = divmod(num, i) if ret == 0: continue if ret * i in roman_dict: s += roman_dict[ret * i] elif ret > 5: s += roman_dict[5 * i] + roman_dict[i] * (...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intToRoman(self, num): """:type num: int :rtype: str""" <|body_0|> def intToRoman2(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = '' for i in [1000, 100, 10, 1]: ret, n...
stack_v2_sparse_classes_36k_train_017389
1,838
permissive
[ { "docstring": ":type num: int :rtype: str", "name": "intToRoman", "signature": "def intToRoman(self, num)" }, { "docstring": ":type num: int :rtype: str", "name": "intToRoman2", "signature": "def intToRoman2(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intToRoman(self, num): :type num: int :rtype: str - def intToRoman2(self, num): :type num: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intToRoman(self, num): :type num: int :rtype: str - def intToRoman2(self, num): :type num: int :rtype: str <|skeleton|> class Solution: def intToRoman(self, num): ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def intToRoman(self, num): """:type num: int :rtype: str""" <|body_0|> def intToRoman2(self, num): """:type num: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intToRoman(self, num): """:type num: int :rtype: str""" s = '' for i in [1000, 100, 10, 1]: ret, num = divmod(num, i) if ret == 0: continue if ret * i in roman_dict: s += roman_dict[ret * i] e...
the_stack_v2_python_sparse
src/12-IntegerToRoman.py
Jiezhi/myleetcode
train
1
8e73fe7b8dd0aceaaa4c0739085c488d2649a286
[ "new_type = CarType(name=validated_data.get('name'), car_model=validated_data.get('car_model'))\nnew_type.save()\nreturn new_type", "instance.name = validated_data.get('name', instance.name)\ninstance.car_model = validated_data.get('car_model', instance.car_model)\ninstance.save()\nreturn instance" ]
<|body_start_0|> new_type = CarType(name=validated_data.get('name'), car_model=validated_data.get('car_model')) new_type.save() return new_type <|end_body_0|> <|body_start_1|> instance.name = validated_data.get('name', instance.name) instance.car_model = validated_data.get('car_...
CarTypeSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CarTypeSerializer: def create(self, validated_data): """create and return new 'CarType' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `CarType` instance""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_017390
6,342
no_license
[ { "docstring": "create and return new 'CarType' instance", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `CarType` instance", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_002114
Implement the Python class `CarTypeSerializer` described below. Class description: Implement the CarTypeSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'CarType' instance - def update(self, instance, validated_data): Update and return an existing `CarType`...
Implement the Python class `CarTypeSerializer` described below. Class description: Implement the CarTypeSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'CarType' instance - def update(self, instance, validated_data): Update and return an existing `CarType`...
dba8d1fdb96889e41328e792816a4968cbeb1ed4
<|skeleton|> class CarTypeSerializer: def create(self, validated_data): """create and return new 'CarType' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `CarType` instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CarTypeSerializer: def create(self, validated_data): """create and return new 'CarType' instance""" new_type = CarType(name=validated_data.get('name'), car_model=validated_data.get('car_model')) new_type.save() return new_type def update(self, instance, validated_data): ...
the_stack_v2_python_sparse
cars_web/cars_app/serializers.py
Ignisor/cars_scrapper
train
0
9427d6600bbc0fed4ba2078f66cff819d9ba124a
[ "self.npart = npart\nself.ndim = ndim\nself.bounds = bounds", "if self.bounds == None:\n self.swarm = np.random.random((self.npart, self.ndim))\nelse:\n self.swarm = np.zeros((self.npart, self.ndim))\n lo = self.bounds.Lower()\n hi = self.bounds.Upper()\n for i in range(self.npart):\n for j ...
<|body_start_0|> self.npart = npart self.ndim = ndim self.bounds = bounds <|end_body_0|> <|body_start_1|> if self.bounds == None: self.swarm = np.random.random((self.npart, self.ndim)) else: self.swarm = np.zeros((self.npart, self.ndim)) lo = ...
Initialize a swarm uniformly
RandomInitializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomInitializer: """Initialize a swarm uniformly""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" <|body_0|> def InitializeSwarm(self): """Return a randomly initialized swarm""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_017391
1,422
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, npart=10, ndim=3, bounds=None)" }, { "docstring": "Return a randomly initialized swarm", "name": "InitializeSwarm", "signature": "def InitializeSwarm(self)" } ]
2
stack_v2_sparse_classes_30k_train_004121
Implement the Python class `RandomInitializer` described below. Class description: Initialize a swarm uniformly Method signatures and docstrings: - def __init__(self, npart=10, ndim=3, bounds=None): Constructor - def InitializeSwarm(self): Return a randomly initialized swarm
Implement the Python class `RandomInitializer` described below. Class description: Initialize a swarm uniformly Method signatures and docstrings: - def __init__(self, npart=10, ndim=3, bounds=None): Constructor - def InitializeSwarm(self): Return a randomly initialized swarm <|skeleton|> class RandomInitializer: ...
5445b6f90ab49339ca0fdb71e98d44e6827c95a8
<|skeleton|> class RandomInitializer: """Initialize a swarm uniformly""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" <|body_0|> def InitializeSwarm(self): """Return a randomly initialized swarm""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomInitializer: """Initialize a swarm uniformly""" def __init__(self, npart=10, ndim=3, bounds=None): """Constructor""" self.npart = npart self.ndim = ndim self.bounds = bounds def InitializeSwarm(self): """Return a randomly initialized swarm""" if ...
the_stack_v2_python_sparse
RandomInitializer.py
dayoladejo/SwarmOptimization
train
0
6d71b426d167a3c8d983b1ffb07ebbce9783741a
[ "HandlerInterface.__init__(self)\nself.alertDBOperations = None\nlogging.debug('MinorAlertHandler Initialized...')", "logging.debug('\\n\\nMinorAlertHandler is handling Payload: ' + payload)\nself.alertDBOperations = Operation(dbConfig)\nalertPayload = AlertPayload()\nalertPayload.load(payload)\nalertPayload['Sev...
<|body_start_0|> HandlerInterface.__init__(self) self.alertDBOperations = None logging.debug('MinorAlertHandler Initialized...') <|end_body_0|> <|body_start_1|> logging.debug('\n\nMinorAlertHandler is handling Payload: ' + payload) self.alertDBOperations = Operation(dbConfig) ...
_MinorAlertHandler_ MinorAlertHandler performs action in response to MinorAlert event. The payload information should be passed to log file
MinorAlertHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinorAlertHandler: """_MinorAlertHandler_ MinorAlertHandler performs action in response to MinorAlert event. The payload information should be passed to log file""" def __init__(self): """_init_ Constructor""" <|body_0|> def handleError(self, payload): """_handle...
stack_v2_sparse_classes_36k_train_017392
1,843
no_license
[ { "docstring": "_init_ Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "_handleError_", "name": "handleError", "signature": "def handleError(self, payload)" } ]
2
stack_v2_sparse_classes_30k_train_017891
Implement the Python class `MinorAlertHandler` described below. Class description: _MinorAlertHandler_ MinorAlertHandler performs action in response to MinorAlert event. The payload information should be passed to log file Method signatures and docstrings: - def __init__(self): _init_ Constructor - def handleError(se...
Implement the Python class `MinorAlertHandler` described below. Class description: _MinorAlertHandler_ MinorAlertHandler performs action in response to MinorAlert event. The payload information should be passed to log file Method signatures and docstrings: - def __init__(self): _init_ Constructor - def handleError(se...
c99608e3e349397fdd1b0b5c011bf4f33a1c3aad
<|skeleton|> class MinorAlertHandler: """_MinorAlertHandler_ MinorAlertHandler performs action in response to MinorAlert event. The payload information should be passed to log file""" def __init__(self): """_init_ Constructor""" <|body_0|> def handleError(self, payload): """_handle...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinorAlertHandler: """_MinorAlertHandler_ MinorAlertHandler performs action in response to MinorAlert event. The payload information should be passed to log file""" def __init__(self): """_init_ Constructor""" HandlerInterface.__init__(self) self.alertDBOperations = None l...
the_stack_v2_python_sparse
src/python/AlertHandler/Handlers/MinorAlertHandler.py
giffels/PRODAGENT
train
0
d48cfdcf7c832d7ab459c0a1e9f7d98a1398e882
[ "super(RelacionPadreHijoForm, self).__init__(*args, **kwargs)\nself.fields['padre'] = forms.ModelChoiceField(queryset=item.get_fase().get_item_estado(EstadoDeItem.APROBADO, EstadoDeItem.EN_LINEA_BASE).exclude(id=item.id))\nself.item = item", "padre = self.cleaned_data['padre']\nhijo = self.item\nif gestion_de_ite...
<|body_start_0|> super(RelacionPadreHijoForm, self).__init__(*args, **kwargs) self.fields['padre'] = forms.ModelChoiceField(queryset=item.get_fase().get_item_estado(EstadoDeItem.APROBADO, EstadoDeItem.EN_LINEA_BASE).exclude(id=item.id)) self.item = item <|end_body_0|> <|body_start_1|> p...
Form que permite la creación de un nueva relacion padre-hijo entre item. Es necesario especificar un padre para el item. Campos: -padre: Item, futuro padre del item selecionado
RelacionPadreHijoForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelacionPadreHijoForm: """Form que permite la creación de un nueva relacion padre-hijo entre item. Es necesario especificar un padre para el item. Campos: -padre: Item, futuro padre del item selecionado""" def __init__(self, *args, item=None, **kwargs): """Constructor de la clase Rel...
stack_v2_sparse_classes_36k_train_017393
12,403
no_license
[ { "docstring": "Constructor de la clase RelacionPadreHijoForm. Los items candidatos para el campo Padre son seleccionados de la misma fase y que estan aprobados. Argumentos: - item: Item, items que esten estado aprobado", "name": "__init__", "signature": "def __init__(self, *args, item=None, **kwargs)" ...
2
null
Implement the Python class `RelacionPadreHijoForm` described below. Class description: Form que permite la creación de un nueva relacion padre-hijo entre item. Es necesario especificar un padre para el item. Campos: -padre: Item, futuro padre del item selecionado Method signatures and docstrings: - def __init__(self,...
Implement the Python class `RelacionPadreHijoForm` described below. Class description: Form que permite la creación de un nueva relacion padre-hijo entre item. Es necesario especificar un padre para el item. Campos: -padre: Item, futuro padre del item selecionado Method signatures and docstrings: - def __init__(self,...
423e79d437b8666f9508b4b0eeb2be67533b8b2d
<|skeleton|> class RelacionPadreHijoForm: """Form que permite la creación de un nueva relacion padre-hijo entre item. Es necesario especificar un padre para el item. Campos: -padre: Item, futuro padre del item selecionado""" def __init__(self, *args, item=None, **kwargs): """Constructor de la clase Rel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelacionPadreHijoForm: """Form que permite la creación de un nueva relacion padre-hijo entre item. Es necesario especificar un padre para el item. Campos: -padre: Item, futuro padre del item selecionado""" def __init__(self, *args, item=None, **kwargs): """Constructor de la clase RelacionPadreHij...
the_stack_v2_python_sparse
gestion_de_item/forms.py
jbust97/proyecto_is2
train
0
2d238817366df2702990d6d077524275b689a3a2
[ "Inventory.__init__(self, product_code, description, market_price, rental_price)\nself.material = material\nself.size = size", "output_dict = Inventory.return_as_dictionary(self)\noutput_dict['material'] = self.material\noutput_dict['size'] = self.size\nreturn output_dict" ]
<|body_start_0|> Inventory.__init__(self, product_code, description, market_price, rental_price) self.material = material self.size = size <|end_body_0|> <|body_start_1|> output_dict = Inventory.return_as_dictionary(self) output_dict['material'] = self.material output_di...
Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value
Furniture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Furniture: """Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value""" def __init__(self, product_code, description, market_price, rental_pric...
stack_v2_sparse_classes_36k_train_017394
1,759
no_license
[ { "docstring": "Create instance of furniture object Args: product_code (alphanumeric): Unique product code description (string): Description of product market_price (numeric): Product price rental_price (numeric): Product rental price material (string): Product material size (string): Product size", "name":...
2
stack_v2_sparse_classes_30k_train_000556
Implement the Python class `Furniture` described below. Class description: Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value Method signatures and docstrings: - def...
Implement the Python class `Furniture` described below. Class description: Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value Method signatures and docstrings: - def...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Furniture: """Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value""" def __init__(self, product_code, description, market_price, rental_pric...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Furniture: """Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value""" def __init__(self, product_code, description, market_price, rental_price, material, ...
the_stack_v2_python_sparse
students/gregdevore/lesson01/assignment/inventory_management/furniture_class.py
JavaRod/SP_Python220B_2019
train
1
6b6035f266aa5ace5cd2f7ec54030f257c50eded
[ "for i in range(1, len(s)):\n if s[i] != '1':\n return set(s[i:]) == {'0'}\nreturn True", "sum_ = abs(goal - sum(nums))\nif sum_ == 0:\n return 0\nn = sum_ // limit\nm = sum_ % limit\nif m == 0:\n return n\nelse:\n return 1 + n" ]
<|body_start_0|> for i in range(1, len(s)): if s[i] != '1': return set(s[i:]) == {'0'} return True <|end_body_0|> <|body_start_1|> sum_ = abs(goal - sum(nums)) if sum_ == 0: return 0 n = sum_ // limit m = sum_ % limit if m ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkOnesSegment(self, s: str) -> bool: """给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:""" <|body_0|> def minElements(self, nums: List[int], limit: int, goal: int) -> int: """给你一个整数数组 nums ,和两个整数 li...
stack_v2_sparse_classes_36k_train_017395
2,524
no_license
[ { "docstring": "给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:", "name": "checkOnesSegment", "signature": "def checkOnesSegment(self, s: str) -> bool" }, { "docstring": "给你一个整数数组 nums ,和两个整数 limit 与 goal 。数组 nums 有一条重要属性:abs(nums[i]) <= limit ...
2
stack_v2_sparse_classes_30k_train_011635
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkOnesSegment(self, s: str) -> bool: 给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return: - def minElements(self, nums: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkOnesSegment(self, s: str) -> bool: 给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return: - def minElements(self, nums: List...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class Solution: def checkOnesSegment(self, s: str) -> bool: """给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:""" <|body_0|> def minElements(self, nums: List[int], limit: int, goal: int) -> int: """给你一个整数数组 nums ,和两个整数 li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkOnesSegment(self, s: str) -> bool: """给你一个二进制字符串 s ,该字符串 不含前导零 。 如果 s 最多包含 一个由连续的 '1' 组成的字段 ,返回 true​​​ 。否则,返回 false 。 :param s: :return:""" for i in range(1, len(s)): if s[i] != '1': return set(s[i:]) == {'0'} return True def minElem...
the_stack_v2_python_sparse
Code/weekly_contest/Week_231.py
NiceToMeeetU/ToGetReady
train
0
b6154bb2bb724306b5313ea7b1f8b5c113752f15
[ "user = request.user\ncheck_user_status(user)\nprofile = SubscriberProfile.objects.get(user_id=user.id)\nif not profile:\n raise ObjectDoesNotExist('No subscriber profile found with owner user id of this: ' + str(user_id))\nreturn JsonResponse(model_to_dict(profile))", "body = request.data\nuser = request.user...
<|body_start_0|> user = request.user check_user_status(user) profile = SubscriberProfile.objects.get(user_id=user.id) if not profile: raise ObjectDoesNotExist('No subscriber profile found with owner user id of this: ' + str(user_id)) return JsonResponse(model_to_dict(...
SubscriberProfile get and update view
SubscriberProfileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscriberProfileView: """SubscriberProfile get and update view""" def get(self, request): """Retrieves a SubscriberProfile record from the database""" <|body_0|> def put(self, request): """Modifies a SubscriberProfile record in the database""" <|body_1|>...
stack_v2_sparse_classes_36k_train_017396
2,711
no_license
[ { "docstring": "Retrieves a SubscriberProfile record from the database", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Modifies a SubscriberProfile record in the database", "name": "put", "signature": "def put(self, request)" } ]
2
null
Implement the Python class `SubscriberProfileView` described below. Class description: SubscriberProfile get and update view Method signatures and docstrings: - def get(self, request): Retrieves a SubscriberProfile record from the database - def put(self, request): Modifies a SubscriberProfile record in the database
Implement the Python class `SubscriberProfileView` described below. Class description: SubscriberProfile get and update view Method signatures and docstrings: - def get(self, request): Retrieves a SubscriberProfile record from the database - def put(self, request): Modifies a SubscriberProfile record in the database ...
2707062c9a9a8bb4baca955e8a60ba08cc9f8953
<|skeleton|> class SubscriberProfileView: """SubscriberProfile get and update view""" def get(self, request): """Retrieves a SubscriberProfile record from the database""" <|body_0|> def put(self, request): """Modifies a SubscriberProfile record in the database""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscriberProfileView: """SubscriberProfile get and update view""" def get(self, request): """Retrieves a SubscriberProfile record from the database""" user = request.user check_user_status(user) profile = SubscriberProfile.objects.get(user_id=user.id) if not profi...
the_stack_v2_python_sparse
backend/subscriber_profile/views.py
MochiTarts/Find-Dining-The-Bridge
train
1
e0bb5704cc0150b18d7a8e2b8faa03f83f6ee6ec
[ "self.PlayerList.delete(0, tk.END)\ndata = self.txtPlayer.get()\ndata = data.lower()\nself.allPlayers = SystemToolKit.readFile(Config.PlayerFile)\nself.orderedList = []\nfor i, j in enumerate(self.allPlayers):\n if self.allPlayers[j]['First name'].lower() == data or self.allPlayers[j]['Last name'].lower() == dat...
<|body_start_0|> self.PlayerList.delete(0, tk.END) data = self.txtPlayer.get() data = data.lower() self.allPlayers = SystemToolKit.readFile(Config.PlayerFile) self.orderedList = [] for i, j in enumerate(self.allPlayers): if self.allPlayers[j]['First name'].low...
Methods: GetPlayer RemovePlayer Variables: allPlayers - Contains a instance of the player file orderedList - contains player ids
RemovePlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemovePlayer: """Methods: GetPlayer RemovePlayer Variables: allPlayers - Contains a instance of the player file orderedList - contains player ids""" def GetPlayer(self): """Adds players to the orderedList Lsit and the Player List onscreen""" <|body_0|> def RemovePlayer(s...
stack_v2_sparse_classes_36k_train_017397
6,212
no_license
[ { "docstring": "Adds players to the orderedList Lsit and the Player List onscreen", "name": "GetPlayer", "signature": "def GetPlayer(self)" }, { "docstring": "Remove a player from the system", "name": "RemovePlayer", "signature": "def RemovePlayer(self)" } ]
2
stack_v2_sparse_classes_30k_train_013440
Implement the Python class `RemovePlayer` described below. Class description: Methods: GetPlayer RemovePlayer Variables: allPlayers - Contains a instance of the player file orderedList - contains player ids Method signatures and docstrings: - def GetPlayer(self): Adds players to the orderedList Lsit and the Player Li...
Implement the Python class `RemovePlayer` described below. Class description: Methods: GetPlayer RemovePlayer Variables: allPlayers - Contains a instance of the player file orderedList - contains player ids Method signatures and docstrings: - def GetPlayer(self): Adds players to the orderedList Lsit and the Player Li...
6420f365540d935906178691fbb5e46b6a31c6b5
<|skeleton|> class RemovePlayer: """Methods: GetPlayer RemovePlayer Variables: allPlayers - Contains a instance of the player file orderedList - contains player ids""" def GetPlayer(self): """Adds players to the orderedList Lsit and the Player List onscreen""" <|body_0|> def RemovePlayer(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemovePlayer: """Methods: GetPlayer RemovePlayer Variables: allPlayers - Contains a instance of the player file orderedList - contains player ids""" def GetPlayer(self): """Adds players to the orderedList Lsit and the Player List onscreen""" self.PlayerList.delete(0, tk.END) data ...
the_stack_v2_python_sparse
RemovePlayer.py
Lamppost122/Controlled-assessment-Final
train
0
1b3bb40606ed4163316e6a35418de901600f559f
[ "ret = 0\nnums.sort()\nn = len(nums)\nfor k in range(n - 1, 1, -1):\n i = 0\n j = k - 1\n while i < j:\n if nums[i] + nums[j] > nums[k]:\n ret += j - i\n j -= 1\n else:\n i += 1\nreturn ret", "ret = 0\nnums.sort()\nn = len(nums)\nfor i in range(n - 2):\n ...
<|body_start_0|> ret = 0 nums.sort() n = len(nums) for k in range(n - 1, 1, -1): i = 0 j = k - 1 while i < j: if nums[i] + nums[j] > nums[k]: ret += j - i j -= 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def triangleNumber(self, nums: List[int]) -> int: """b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)""" <|body_0|> def triangleNumber_error(self, nums: List[int]) -> int: """b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)...
stack_v2_sparse_classes_36k_train_017398
2,446
no_license
[ { "docstring": "b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)", "name": "triangleNumber", "signature": "def triangleNumber(self, nums: List[int]) -> int" }, { "docstring": "b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)", "name": "triangleNumber_error",...
3
stack_v2_sparse_classes_30k_train_020059
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def triangleNumber(self, nums: List[int]) -> int: b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2) - def triangleNumber_error(self, nums: List[int]) -> int: b - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def triangleNumber(self, nums: List[int]) -> int: b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2) - def triangleNumber_error(self, nums: List[int]) -> int: b - ...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def triangleNumber(self, nums: List[int]) -> int: """b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)""" <|body_0|> def triangleNumber_error(self, nums: List[int]) -> int: """b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def triangleNumber(self, nums: List[int]) -> int: """b - a < c < a + b Brute force O(n^3) 3 sums Three-pointers O(n^2)""" ret = 0 nums.sort() n = len(nums) for k in range(n - 1, 1, -1): i = 0 j = k - 1 while i < j: ...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/611 Valid Triangle Number.py
syurskyi/Algorithms_and_Data_Structure
train
4
ee3995f36d7769e51544e3923d793ae6fefee84d
[ "question = '你喜欢吃什么食物?'\nmy_surey = AnonymousSurvey(question)\nmy_surey.store_respone('蛋糕')\n'核实-蛋糕在AnonymousSurvey类的responses列表内'\nself.assertIn('蛋糕', my_surey.responses)", "question = '你喜欢吃什么食物?'\nmy_surey = AnonymousSurvey(question)\nresponses = ['蛋糕', '草莓', '巧克力']\nfor response in responses:\n my_surey.sto...
<|body_start_0|> question = '你喜欢吃什么食物?' my_surey = AnonymousSurvey(question) my_surey.store_respone('蛋糕') '核实-蛋糕在AnonymousSurvey类的responses列表内' self.assertIn('蛋糕', my_surey.responses) <|end_body_0|> <|body_start_1|> question = '你喜欢吃什么食物?' my_surey = AnonymousSurv...
针对 AnonymousSurvey 类的测试
TestAnonymousSurvey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnonymousSurvey: """针对 AnonymousSurvey 类的测试""" def test_store_single_respone(self): """测试单个答案会被妥善地存储""" <|body_0|> def test_store_three_respone(self): """测试三个答案会被妥善地存储""" <|body_1|> <|end_skeleton|> <|body_start_0|> question = '你喜欢吃什么食物?' ...
stack_v2_sparse_classes_36k_train_017399
1,843
no_license
[ { "docstring": "测试单个答案会被妥善地存储", "name": "test_store_single_respone", "signature": "def test_store_single_respone(self)" }, { "docstring": "测试三个答案会被妥善地存储", "name": "test_store_three_respone", "signature": "def test_store_three_respone(self)" } ]
2
stack_v2_sparse_classes_30k_train_006813
Implement the Python class `TestAnonymousSurvey` described below. Class description: 针对 AnonymousSurvey 类的测试 Method signatures and docstrings: - def test_store_single_respone(self): 测试单个答案会被妥善地存储 - def test_store_three_respone(self): 测试三个答案会被妥善地存储
Implement the Python class `TestAnonymousSurvey` described below. Class description: 针对 AnonymousSurvey 类的测试 Method signatures and docstrings: - def test_store_single_respone(self): 测试单个答案会被妥善地存储 - def test_store_three_respone(self): 测试三个答案会被妥善地存储 <|skeleton|> class TestAnonymousSurvey: """针对 AnonymousSurvey 类的测...
525a3a6cec25b540734acc2c8d033a11706cf01a
<|skeleton|> class TestAnonymousSurvey: """针对 AnonymousSurvey 类的测试""" def test_store_single_respone(self): """测试单个答案会被妥善地存储""" <|body_0|> def test_store_three_respone(self): """测试三个答案会被妥善地存储""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAnonymousSurvey: """针对 AnonymousSurvey 类的测试""" def test_store_single_respone(self): """测试单个答案会被妥善地存储""" question = '你喜欢吃什么食物?' my_surey = AnonymousSurvey(question) my_surey.store_respone('蛋糕') '核实-蛋糕在AnonymousSurvey类的responses列表内' self.assertIn('蛋糕', my...
the_stack_v2_python_sparse
group_one/lesson_11_1.py
shyan520/python
train
0