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
c073eacd5271b68751dc11dcafad041d624c7057
[ "self.files_downloaded = 0\nself.files_processed = 0\nself.exception_count = 0\nself.now = time_utils.get_utc_now()\nself.grib_processor = GribFileProcessor(station_source)\nself.model_type: ModelEnum = model_type\nif self.model_type == ModelEnum.GFS:\n self.projection = ProjectionEnum.GFS_LONLAT\nelif self.mode...
<|body_start_0|> self.files_downloaded = 0 self.files_processed = 0 self.exception_count = 0 self.now = time_utils.get_utc_now() self.grib_processor = GribFileProcessor(station_source) self.model_type: ModelEnum = model_type if self.model_type == ModelEnum.GFS: ...
Class that orchestrates downloading and processing of GFS weather model grib files from NOAA.
NOAA
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NOAA: """Class that orchestrates downloading and processing of GFS weather model grib files from NOAA.""" def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): """Prep variables""" <|body_0|> def process_model_run_url...
stack_v2_sparse_classes_36k_train_021100
18,846
permissive
[ { "docstring": "Prep variables", "name": "__init__", "signature": "def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED)" }, { "docstring": "Process the urls for a model run.", "name": "process_model_run_urls", "signature": "def proces...
4
null
Implement the Python class `NOAA` described below. Class description: Class that orchestrates downloading and processing of GFS weather model grib files from NOAA. Method signatures and docstrings: - def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): Prep varia...
Implement the Python class `NOAA` described below. Class description: Class that orchestrates downloading and processing of GFS weather model grib files from NOAA. Method signatures and docstrings: - def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): Prep varia...
0ba707b0eddc280240964efa481988df92046e6a
<|skeleton|> class NOAA: """Class that orchestrates downloading and processing of GFS weather model grib files from NOAA.""" def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): """Prep variables""" <|body_0|> def process_model_run_url...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NOAA: """Class that orchestrates downloading and processing of GFS weather model grib files from NOAA.""" def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): """Prep variables""" self.files_downloaded = 0 self.files_processed...
the_stack_v2_python_sparse
api/app/jobs/noaa.py
bcgov/wps
train
35
38ba1d971ae5588a2cb144c3285cc379a600d60a
[ "from . import _vtk\nimage_data = pyvista.read(image_path)\nsuper().__init__(parent, border=False)\nself.SetLayer(0)\nself.InteractiveOff()\nself.SetBackground(self.parent.renderer.GetBackground())\nself._scale = scale\nself._modified_observer = None\nself._prior_window_size = None\nif view_port is not None:\n s...
<|body_start_0|> from . import _vtk image_data = pyvista.read(image_path) super().__init__(parent, border=False) self.SetLayer(0) self.InteractiveOff() self.SetBackground(self.parent.renderer.GetBackground()) self._scale = scale self._modified_observer = N...
BackgroundRenderer for visualizing a background image.
BackgroundRenderer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackgroundRenderer: """BackgroundRenderer for visualizing a background image.""" def __init__(self, parent, image_path, scale=1, view_port=None): """Initialize BackgroundRenderer with an image.""" <|body_0|> def resize(self, *args): """Resize a background rendere...
stack_v2_sparse_classes_36k_train_021101
2,566
permissive
[ { "docstring": "Initialize BackgroundRenderer with an image.", "name": "__init__", "signature": "def __init__(self, parent, image_path, scale=1, view_port=None)" }, { "docstring": "Resize a background renderer.", "name": "resize", "signature": "def resize(self, *args)" } ]
2
stack_v2_sparse_classes_30k_train_010671
Implement the Python class `BackgroundRenderer` described below. Class description: BackgroundRenderer for visualizing a background image. Method signatures and docstrings: - def __init__(self, parent, image_path, scale=1, view_port=None): Initialize BackgroundRenderer with an image. - def resize(self, *args): Resize...
Implement the Python class `BackgroundRenderer` described below. Class description: BackgroundRenderer for visualizing a background image. Method signatures and docstrings: - def __init__(self, parent, image_path, scale=1, view_port=None): Initialize BackgroundRenderer with an image. - def resize(self, *args): Resize...
1b450b23340f367315fc914075d551e0a4df8cc3
<|skeleton|> class BackgroundRenderer: """BackgroundRenderer for visualizing a background image.""" def __init__(self, parent, image_path, scale=1, view_port=None): """Initialize BackgroundRenderer with an image.""" <|body_0|> def resize(self, *args): """Resize a background rendere...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackgroundRenderer: """BackgroundRenderer for visualizing a background image.""" def __init__(self, parent, image_path, scale=1, view_port=None): """Initialize BackgroundRenderer with an image.""" from . import _vtk image_data = pyvista.read(image_path) super().__init__(pa...
the_stack_v2_python_sparse
pyvista/plotting/background_renderer.py
pyvista/pyvista
train
1,885
85036a831bd84fd4f7b1c638cb11886c6c5b2780
[ "super().__init__(input_feature, output_feature)\nif not isinstance(classes, list) or not all((isinstance(x, int) for x in classes)):\n raise ValueError('classes argument should be a list of integers.')\nif no_data_value in classes:\n raise ValueError('classes argument must not contain no_data_value')\nself.c...
<|body_start_0|> super().__init__(input_feature, output_feature) if not isinstance(classes, list) or not all((isinstance(x, int) for x in classes)): raise ValueError('classes argument should be a list of integers.') if no_data_value in classes: raise ValueError('classes a...
Calculates frequencies of each provided class through the temporal dimension.
ClassFrequencyTask
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassFrequencyTask: """Calculates frequencies of each provided class through the temporal dimension.""" def __init__(self, input_feature, output_feature, classes, no_data_value=0): """:param input_feature: A source feature from which to read the values. :type input_feature: an object...
stack_v2_sparse_classes_36k_train_021102
2,137
permissive
[ { "docstring": ":param input_feature: A source feature from which to read the values. :type input_feature: an object supported by the :class:`FeatureParser<eolearn.core.utilities.FeatureParser>` :param output_feature: An output feature to which to write the frequencies. :type output_feature: an object supported...
2
stack_v2_sparse_classes_30k_train_005148
Implement the Python class `ClassFrequencyTask` described below. Class description: Calculates frequencies of each provided class through the temporal dimension. Method signatures and docstrings: - def __init__(self, input_feature, output_feature, classes, no_data_value=0): :param input_feature: A source feature from...
Implement the Python class `ClassFrequencyTask` described below. Class description: Calculates frequencies of each provided class through the temporal dimension. Method signatures and docstrings: - def __init__(self, input_feature, output_feature, classes, no_data_value=0): :param input_feature: A source feature from...
148189e2b92e06059b87f223b596255ccafac86d
<|skeleton|> class ClassFrequencyTask: """Calculates frequencies of each provided class through the temporal dimension.""" def __init__(self, input_feature, output_feature, classes, no_data_value=0): """:param input_feature: A source feature from which to read the values. :type input_feature: an object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassFrequencyTask: """Calculates frequencies of each provided class through the temporal dimension.""" def __init__(self, input_feature, output_feature, classes, no_data_value=0): """:param input_feature: A source feature from which to read the values. :type input_feature: an object supported by...
the_stack_v2_python_sparse
mask/eolearn/mask/mask_counting.py
wouellette/eo-learn
train
2
feba04afbeef611a99d0e05ab339d43c530a3b66
[ "self.strings = self.Node('')\nfor string in strings:\n curr_node = self.strings\n for char in string:\n curr_node.strings.append(string)\n if char not in curr_node.branches:\n curr_node.branches[char] = self.Node(char)\n curr_node = curr_node.branches[char]\n curr_node.stri...
<|body_start_0|> self.strings = self.Node('') for string in strings: curr_node = self.strings for char in string: curr_node.strings.append(string) if char not in curr_node.branches: curr_node.branches[char] = self.Node(char) ...
AutoComplete
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoComplete: def __init__(self, strings): """Constructing a tree from the input strings""" <|body_0|> def lookup(self, qry): """searches the strings tree to find the subtree that contains all strings for the provided substring""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_021103
1,496
no_license
[ { "docstring": "Constructing a tree from the input strings", "name": "__init__", "signature": "def __init__(self, strings)" }, { "docstring": "searches the strings tree to find the subtree that contains all strings for the provided substring", "name": "lookup", "signature": "def lookup(s...
2
stack_v2_sparse_classes_30k_train_019992
Implement the Python class `AutoComplete` described below. Class description: Implement the AutoComplete class. Method signatures and docstrings: - def __init__(self, strings): Constructing a tree from the input strings - def lookup(self, qry): searches the strings tree to find the subtree that contains all strings f...
Implement the Python class `AutoComplete` described below. Class description: Implement the AutoComplete class. Method signatures and docstrings: - def __init__(self, strings): Constructing a tree from the input strings - def lookup(self, qry): searches the strings tree to find the subtree that contains all strings f...
3ad5e09fa556567870840dc6d6ef8545f878962f
<|skeleton|> class AutoComplete: def __init__(self, strings): """Constructing a tree from the input strings""" <|body_0|> def lookup(self, qry): """searches the strings tree to find the subtree that contains all strings for the provided substring""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoComplete: def __init__(self, strings): """Constructing a tree from the input strings""" self.strings = self.Node('') for string in strings: curr_node = self.strings for char in string: curr_node.strings.append(string) if char ...
the_stack_v2_python_sparse
11/solution.py
gergelyrevay/daily_coding_exercises
train
0
3650b6e3202c39cf65ea3b35642380706992ec91
[ "if not root:\n return ''\nresult = []\nmystack = [root]\nwhile mystack:\n node = mystack.pop()\n if not node:\n result.append('#')\n else:\n result.append(str(node.val))\n mystack.append(node.right)\n mystack.append(node.left)\nreturn ','.join(result)", "def helper(mylist,...
<|body_start_0|> if not root: return '' result = [] mystack = [root] while mystack: node = mystack.pop() if not node: result.append('#') else: result.append(str(node.val)) mystack.append(node....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_021104
1,137
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:...
cc7f41e2fb3ed5734c2a5af97e49a5bc17afbceb
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' result = [] mystack = [root] while mystack: node = mystack.pop() if not node: result.ap...
the_stack_v2_python_sparse
面试题37-序列化二叉树.py
Terry-Ma/Leetcode
train
0
1c3604b96d02fbf96a5450f6d743d10a155b450c
[ "super().__init__(file_contents, results)\nself.interpolates_text_or_html = False\nself.format_caller_node = None", "if isinstance(node.func, ast.Attribute) and node.func.attr == 'format':\n if self.format_caller_node is None:\n self.format_caller_node = node.func.value\nelif isinstance(node.func, ast.N...
<|body_start_0|> super().__init__(file_contents, results) self.interpolates_text_or_html = False self.format_caller_node = None <|end_body_0|> <|body_start_1|> if isinstance(node.func, ast.Attribute) and node.func.attr == 'format': if self.format_caller_node is None: ...
Checks if format() interpolates any HTML() or Text() calls. In other words, are Text() or HTML() calls nested inside the call to format(). This visitor is meant to be called on a format() attribute node.
FormatInterpolateVisitor
[ "MIT", "AGPL-3.0-only", "AGPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatInterpolateVisitor: """Checks if format() interpolates any HTML() or Text() calls. In other words, are Text() or HTML() calls nested inside the call to format(). This visitor is meant to be called on a format() attribute node.""" def __init__(self, file_contents, results): """I...
stack_v2_sparse_classes_36k_train_021105
12,510
permissive
[ { "docstring": "Init function. Arguments: file_contents: The contents of the Python file. results: A file results objects to which violations will be added.", "name": "__init__", "signature": "def __init__(self, file_contents, results)" }, { "docstring": "Checks all calls. Remembers the caller o...
3
null
Implement the Python class `FormatInterpolateVisitor` described below. Class description: Checks if format() interpolates any HTML() or Text() calls. In other words, are Text() or HTML() calls nested inside the call to format(). This visitor is meant to be called on a format() attribute node. Method signatures and do...
Implement the Python class `FormatInterpolateVisitor` described below. Class description: Checks if format() interpolates any HTML() or Text() calls. In other words, are Text() or HTML() calls nested inside the call to format(). This visitor is meant to be called on a format() attribute node. Method signatures and do...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class FormatInterpolateVisitor: """Checks if format() interpolates any HTML() or Text() calls. In other words, are Text() or HTML() calls nested inside the call to format(). This visitor is meant to be called on a format() attribute node.""" def __init__(self, file_contents, results): """I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormatInterpolateVisitor: """Checks if format() interpolates any HTML() or Text() calls. In other words, are Text() or HTML() calls nested inside the call to format(). This visitor is meant to be called on a format() attribute node.""" def __init__(self, file_contents, results): """Init function....
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/scripts/xsslint/xsslint/visitors.py
luque/better-ways-of-thinking-about-software
train
3
f6d263115bdf9d3f83851e3fd401b389d7413cf7
[ "self.error_type = None\nif isinstance(element_or_cond, str):\n if element_or_cond not in STANZA_ERRORS:\n raise ValueError('Bad error condition')\nelif element_or_cond.tag.startswith('{'):\n namespace = element_or_cond.tag[1:].split('}', 1)[0]\n if namespace not in STANZA_NAMESPACES:\n raise...
<|body_start_0|> self.error_type = None if isinstance(element_or_cond, str): if element_or_cond not in STANZA_ERRORS: raise ValueError('Bad error condition') elif element_or_cond.tag.startswith('{'): namespace = element_or_cond.tag[1:].split('}', 1)[0] ...
Stanza error element. :Ivariables: - `error_type`: 'type' of the error, one of: 'auth', 'cancel', 'continue', 'modify', 'wait' :Types: - `error_type`: `str`
StanzaErrorElement
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StanzaErrorElement: """Stanza error element. :Ivariables: - `error_type`: 'type' of the error, one of: 'auth', 'cancel', 'continue', 'modify', 'wait' :Types: - `error_type`: `str`""" def __init__(self, element_or_cond, text=None, language=None, error_type=None): """Initialize an Stan...
stack_v2_sparse_classes_36k_train_021106
16,456
permissive
[ { "docstring": "Initialize an StanzaErrorElement object. :Parameters: - `element_or_cond`: XML <error/> element to decode or an error condition name or element. - `text`: optional description to override the default one - `language`: RFC 3066 language tag for the description - `error_type`: 'type' of the error,...
4
null
Implement the Python class `StanzaErrorElement` described below. Class description: Stanza error element. :Ivariables: - `error_type`: 'type' of the error, one of: 'auth', 'cancel', 'continue', 'modify', 'wait' :Types: - `error_type`: `str` Method signatures and docstrings: - def __init__(self, element_or_cond, text=...
Implement the Python class `StanzaErrorElement` described below. Class description: Stanza error element. :Ivariables: - `error_type`: 'type' of the error, one of: 'auth', 'cancel', 'continue', 'modify', 'wait' :Types: - `error_type`: `str` Method signatures and docstrings: - def __init__(self, element_or_cond, text=...
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
<|skeleton|> class StanzaErrorElement: """Stanza error element. :Ivariables: - `error_type`: 'type' of the error, one of: 'auth', 'cancel', 'continue', 'modify', 'wait' :Types: - `error_type`: `str`""" def __init__(self, element_or_cond, text=None, language=None, error_type=None): """Initialize an Stan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StanzaErrorElement: """Stanza error element. :Ivariables: - `error_type`: 'type' of the error, one of: 'auth', 'cancel', 'continue', 'modify', 'wait' :Types: - `error_type`: `str`""" def __init__(self, element_or_cond, text=None, language=None, error_type=None): """Initialize an StanzaErrorElemen...
the_stack_v2_python_sparse
python3-alpha/python-libs/pyxmpp2/error.py
kuri65536/python-for-android
train
280
a02d45d50426a72b18991c0c25da0082ba9e835f
[ "self._dependency_fetcher = ChromeDependencyFetcher(get_repository)\nself._get_repository = get_repository\nself._top_n_frames = top_n_frames\nself._top_n_suspects = top_n_suspects\nself._model = UnnormalizedLogLinearModel(meta_feature, meta_weight)", "annotated_report = CrashReportWithDependencies(report, self._...
<|body_start_0|> self._dependency_fetcher = ChromeDependencyFetcher(get_repository) self._get_repository = get_repository self._top_n_frames = top_n_frames self._top_n_suspects = top_n_suspects self._model = UnnormalizedLogLinearModel(meta_feature, meta_weight) <|end_body_0|> <|...
A ``LogLinearModel``-based implementation of CL classification.
LogLinearChangelistClassifier
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogLinearChangelistClassifier: """A ``LogLinearModel``-based implementation of CL classification.""" def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): """Args: get_repository (callable): a function from DEP urls to ``Repository`` objects...
stack_v2_sparse_classes_36k_train_021107
5,932
permissive
[ { "docstring": "Args: get_repository (callable): a function from DEP urls to ``Repository`` objects, so we can get changelogs and blame for each dep. Notably, to keep the code here generic, we make no assumptions about which subclass of ``Repository`` this function returns. Thus, it is up to the caller to decid...
4
null
Implement the Python class `LogLinearChangelistClassifier` described below. Class description: A ``LogLinearModel``-based implementation of CL classification. Method signatures and docstrings: - def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): Args: get_repository (call...
Implement the Python class `LogLinearChangelistClassifier` described below. Class description: A ``LogLinearModel``-based implementation of CL classification. Method signatures and docstrings: - def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): Args: get_repository (call...
d27ac0b230bedae4bc968515b02927cf9e17c2b7
<|skeleton|> class LogLinearChangelistClassifier: """A ``LogLinearModel``-based implementation of CL classification.""" def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): """Args: get_repository (callable): a function from DEP urls to ``Repository`` objects...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogLinearChangelistClassifier: """A ``LogLinearModel``-based implementation of CL classification.""" def __init__(self, get_repository, meta_feature, meta_weight, top_n_frames=7, top_n_suspects=3): """Args: get_repository (callable): a function from DEP urls to ``Repository`` objects, so we can g...
the_stack_v2_python_sparse
appengine/findit/crash/loglinear/changelist_classifier.py
TrellixVulnTeam/chromium-infra_A6Y5
train
0
b2b1e3f407fe13f0ee61d12232288fbade0d0cb0
[ "from collections import deque\nstack = deque()\nif root == None:\n return\nstack.appendleft(root)\nprev = None\nwhile len(stack) > 0:\n node = stack.popleft()\n if node.right != None:\n rnode = node.right\n stack.appendleft(rnode)\n if node.left != None:\n stack.appendleft(node.lef...
<|body_start_0|> from collections import deque stack = deque() if root == None: return stack.appendleft(root) prev = None while len(stack) > 0: node = stack.popleft() if node.right != None: rnode = node.right ...
Ex114
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ex114: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def flatten0(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|...
stack_v2_sparse_classes_36k_train_021108
2,377
no_license
[ { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": ":type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.", "name": "flatten0",...
2
stack_v2_sparse_classes_30k_train_005124
Implement the Python class `Ex114` described below. Class description: Implement the Ex114 class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def flatten0(self, root): :type root: TreeNode :rtype: void Do not re...
Implement the Python class `Ex114` described below. Class description: Implement the Ex114 class. Method signatures and docstrings: - def flatten(self, root): :type root: TreeNode :rtype: void Do not return anything, modify root in-place instead. - def flatten0(self, root): :type root: TreeNode :rtype: void Do not re...
8f9327a1879949f61b462cc6c82e00e7c27b8b07
<|skeleton|> class Ex114: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|body_0|> def flatten0(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ex114: def flatten(self, root): """:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.""" from collections import deque stack = deque() if root == None: return stack.appendleft(root) prev = None while len(s...
the_stack_v2_python_sparse
LeetCode/Ex100/Ex114.py
JasonVann/CrackingCodingInterview
train
0
7a2b1549ea151dd40cdd291b77560b516a478ab2
[ "context = {}\ntry:\n build = Build.objects.get(id=self.kwargs['pk'])\n context['build'] = build\n context['allocations'] = build.getAutoAllocations()\nexcept Build.DoesNotExist:\n context['error'] = _('No matching build found')\nreturn context", "build = self.get_object()\nform = self.get_form()\ncon...
<|body_start_0|> context = {} try: build = Build.objects.get(id=self.kwargs['pk']) context['build'] = build context['allocations'] = build.getAutoAllocations() except Build.DoesNotExist: context['error'] = _('No matching build found') retur...
View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()
BuildAutoAllocate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildAutoAllocate: """View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()""" def get_context_data(self, *args, **kwargs): """Get the context data for form rendering.""" ...
stack_v2_sparse_classes_36k_train_021109
19,285
permissive
[ { "docstring": "Get the context data for form rendering.", "name": "get_context_data", "signature": "def get_context_data(self, *args, **kwargs)" }, { "docstring": "Handle POST request. Perform auto allocations. - If the form validation passes, perform allocations - Otherwise, the form is passed...
2
stack_v2_sparse_classes_30k_train_010609
Implement the Python class `BuildAutoAllocate` described below. Class description: View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations() Method signatures and docstrings: - def get_context_data(self, *args, **kw...
Implement the Python class `BuildAutoAllocate` described below. Class description: View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations() Method signatures and docstrings: - def get_context_data(self, *args, **kw...
daab81fa2cf6f3ce1760e31d8cd94951c6dffdd2
<|skeleton|> class BuildAutoAllocate: """View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()""" def get_context_data(self, *args, **kwargs): """Get the context data for form rendering.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildAutoAllocate: """View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()""" def get_context_data(self, *args, **kwargs): """Get the context data for form rendering.""" context = {...
the_stack_v2_python_sparse
InvenTree/build/views.py
fritzlim/InvenTree
train
1
4fc7a32c0888f1e407ae4a4706eaaf40051e0623
[ "super(Transpose1dLayer, self).__init__()\nself.upsample = upsample\nreflection_pad = nn.ConstantPad1d(kernel_size // 2, value=0)\nconv1d = nn.Conv1d(in_channels, out_channels, kernel_size, stride)\nconv1d.weight.data.normal_(0.0, 0.02)\nConv1dTrans = nn.ConvTranspose1d(in_channels, out_channels, kernel_size, strid...
<|body_start_0|> super(Transpose1dLayer, self).__init__() self.upsample = upsample reflection_pad = nn.ConstantPad1d(kernel_size // 2, value=0) conv1d = nn.Conv1d(in_channels, out_channels, kernel_size, stride) conv1d.weight.data.normal_(0.0, 0.02) Conv1dTrans = nn.ConvTr...
Package of all 1d Convolution Transpose Layer
Transpose1dLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transpose1dLayer: """Package of all 1d Convolution Transpose Layer""" def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: """Initialize 1d Convolution Transpose Layer package -*-*-*Convolut...
stack_v2_sparse_classes_36k_train_021110
5,819
permissive
[ { "docstring": "Initialize 1d Convolution Transpose Layer package -*-*-*Convolution Transpose summary*-*-*- There isn't a direct back-process to convolution like deconvolution but there is a technique to retrieve most of the information back called \"Convolution Transpose\". Apply convolution with bigger kernel...
2
stack_v2_sparse_classes_30k_train_005065
Implement the Python class `Transpose1dLayer` described below. Class description: Package of all 1d Convolution Transpose Layer Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: Initial...
Implement the Python class `Transpose1dLayer` described below. Class description: Package of all 1d Convolution Transpose Layer Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: Initial...
4eea5339c8ad0aae2861b8f7cc8ea88bdd0852ed
<|skeleton|> class Transpose1dLayer: """Package of all 1d Convolution Transpose Layer""" def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: """Initialize 1d Convolution Transpose Layer package -*-*-*Convolut...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transpose1dLayer: """Package of all 1d Convolution Transpose Layer""" def __init__(self, in_channels, out_channels, kernel_size, stride, padding=11, upsample=None, output_padding=1, use_batch_norm=False) -> NoReturn: """Initialize 1d Convolution Transpose Layer package -*-*-*Convolution Transpose...
the_stack_v2_python_sparse
not_functional/models/architectures/layers/BaseLayers.py
develooper1994/MasterThesis
train
6
cfab4dcf97b6ad5348e377afc949bae31032f067
[ "serial = ''\nqueue = [[root], []]\nwhile queue[0]:\n curNode = queue[0].pop(0)\n if curNode:\n serial += ',' + str(curNode.val)\n queue[1].append(curNode.left)\n queue[1].append(curNode.right)\n else:\n serial += ',N'\n if not queue[0]:\n queue[0], queue[1] = (queue[1...
<|body_start_0|> serial = '' queue = [[root], []] while queue[0]: curNode = queue[0].pop(0) if curNode: serial += ',' + str(curNode.val) queue[1].append(curNode.left) queue[1].append(curNode.right) else: ...
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_021111
1,903
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:...
0404bcce27ff363430e6ab71dbc27a69055fd261
<|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""" serial = '' queue = [[root], []] while queue[0]: curNode = queue[0].pop(0) if curNode: serial += ',' + str(curNode.val) ...
the_stack_v2_python_sparse
Hard/297. Serialize and Deserialize Binary Tree.py
MinecraftDawn/LeetCode
train
1
7b6546addc3fa72622ee9428c98836d67dec6192
[ "self.module_name = module_name\nself.replace_regexp1 = re.compile('([ \"])CSharp_Firebase(?:(?:f[A-Za-z]+_)|_)([^\"(]*)')\nself.replace_regexp2 = re.compile('([ \"])CSharp_([^\"(]*)')", "file_str = file_str.replace('___(', '(').replace('___\"', '\"')\nfile_str = self.replace_regexp1.sub('\\\\g<1>%s_CSharp_\\\\g<...
<|body_start_0|> self.module_name = module_name self.replace_regexp1 = re.compile('([ "])CSharp_Firebase(?:(?:f[A-Za-z]+_)|_)([^"(]*)') self.replace_regexp2 = re.compile('([ "])CSharp_([^"(]*)') <|end_body_0|> <|body_start_1|> file_str = file_str.replace('___(', '(').replace('___"', '"'...
Add a module namespace prefix to all generated C methods.
NamespaceCMethodsCMake
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NamespaceCMethodsCMake: """Add a module namespace prefix to all generated C methods.""" def __init__(self, module_name): """Initialize the instance. Args: module_name: Name of the module to use as a prefix for C methods.""" <|body_0|> def __call__(self, file_str, filenam...
stack_v2_sparse_classes_36k_train_021112
6,554
permissive
[ { "docstring": "Initialize the instance. Args: module_name: Name of the module to use as a prefix for C methods.", "name": "__init__", "signature": "def __init__(self, module_name)" }, { "docstring": "Add a prefix to all generated C methods statements. Args: file_str: This is a string containing...
2
null
Implement the Python class `NamespaceCMethodsCMake` described below. Class description: Add a module namespace prefix to all generated C methods. Method signatures and docstrings: - def __init__(self, module_name): Initialize the instance. Args: module_name: Name of the module to use as a prefix for C methods. - def ...
Implement the Python class `NamespaceCMethodsCMake` described below. Class description: Add a module namespace prefix to all generated C methods. Method signatures and docstrings: - def __init__(self, module_name): Initialize the instance. Args: module_name: Name of the module to use as a prefix for C methods. - def ...
2cb4b45dd14a230aa0e800042e893f8dfb23beda
<|skeleton|> class NamespaceCMethodsCMake: """Add a module namespace prefix to all generated C methods.""" def __init__(self, module_name): """Initialize the instance. Args: module_name: Name of the module to use as a prefix for C methods.""" <|body_0|> def __call__(self, file_str, filenam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NamespaceCMethodsCMake: """Add a module namespace prefix to all generated C methods.""" def __init__(self, module_name): """Initialize the instance. Args: module_name: Name of the module to use as a prefix for C methods.""" self.module_name = module_name self.replace_regexp1 = re....
the_stack_v2_python_sparse
MY_REPOS/misc-experiments/_FIREBFIRE/firebase-unity-sdk/cmake/swig_fix.py
bgoonz/UsefulResourceRepo2.0
train
10
97e3699f4ccc576e52f2e1ae6ae4eef9cf766817
[ "if not isinstance(username, str):\n raise TypeError('Expected username to be of type str.')\nif not isinstance(password, str):\n raise TypeError('Expected password to be of type str.')\nif not isinstance(firstName, str):\n raise TypeError('Expected firstName to be of type str.')\nif not isinstance(lastNam...
<|body_start_0|> if not isinstance(username, str): raise TypeError('Expected username to be of type str.') if not isinstance(password, str): raise TypeError('Expected password to be of type str.') if not isinstance(firstName, str): raise TypeError('Expected fi...
A class that allows interaction with users and their information Attributes ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's last name email : str The user's email address courseIDs : list of str A list of IDs of the c...
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """A class that allows interaction with users and their information Attributes ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's last name email : str The user's email address courseIDs : li...
stack_v2_sparse_classes_36k_train_021113
3,781
no_license
[ { "docstring": "Constructor to build a User object If this object is not being loaded from the database, a unique ID will be generated automatically. Parameters ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's ...
2
stack_v2_sparse_classes_30k_train_019972
Implement the Python class `User` described below. Class description: A class that allows interaction with users and their information Attributes ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's last name email : str ...
Implement the Python class `User` described below. Class description: A class that allows interaction with users and their information Attributes ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's last name email : str ...
4454d9c23db9f0f4b43d5cbee7a5365050947b8f
<|skeleton|> class User: """A class that allows interaction with users and their information Attributes ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's last name email : str The user's email address courseIDs : li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: """A class that allows interaction with users and their information Attributes ---------- username : str The user's login username password : str The user's password firstName : str The user's first name lastName : str The user's last name email : str The user's email address courseIDs : list of str A l...
the_stack_v2_python_sparse
teacherportal/utils/user.py
ArjunRathaur/SAPAMS
train
0
dce69a502b7ba635b7f1ce3554d89c7c59c7fa41
[ "super().__init__()\nself.onaxis_rf_phase = 0\nself.offaxis_rf_phase = 0\nself.offaxis_weight = 1\nself.onaxis_weight = 1\nself.wait_between_injections = 1\nself.onaxis_nrpulses = 5\nself.offaxis_nrpulses = 20\nself.offaxis_inj_with_dpkckr = False\nself.offaxis_dpkckr_strength = -3.5\nself.use_median = False\nself....
<|body_start_0|> super().__init__() self.onaxis_rf_phase = 0 self.offaxis_rf_phase = 0 self.offaxis_weight = 1 self.onaxis_weight = 1 self.wait_between_injections = 1 self.onaxis_nrpulses = 5 self.offaxis_nrpulses = 20 self.offaxis_inj_with_dpkckr ...
.
OptimizeDAParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptimizeDAParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.onaxis_rf_phase = 0 self.offaxis_rf_phase = 0 self.offaxis_w...
stack_v2_sparse_classes_36k_train_021114
25,073
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_009832
Implement the Python class `OptimizeDAParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): .
Implement the Python class `OptimizeDAParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): . <|skeleton|> class OptimizeDAParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" ...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class OptimizeDAParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptimizeDAParams: """.""" def __init__(self): """.""" super().__init__() self.onaxis_rf_phase = 0 self.offaxis_rf_phase = 0 self.offaxis_weight = 1 self.onaxis_weight = 1 self.wait_between_injections = 1 self.onaxis_nrpulses = 5 self...
the_stack_v2_python_sparse
apsuite/commisslib/dynap_opt_rcds.py
lnls-fac/apsuite
train
1
f366cd71bc7b3b0c4fe8f2d92ceda8f59e98d36d
[ "op = '$pull' if unfollow else '$push'\nself.client.Users.users.update_one({'user_id': user_id1}, {op: {'following': user_id2}})\nself.client.Users.users.update_one({'user_id': user_id2}, {op: {'followers': user_id1}})\ni = -1 if unfollow else 1\nself.client.User.users.update_one({'user_id': user_id2}, {'$inc': {'f...
<|body_start_0|> op = '$pull' if unfollow else '$push' self.client.Users.users.update_one({'user_id': user_id1}, {op: {'following': user_id2}}) self.client.Users.users.update_one({'user_id': user_id2}, {op: {'followers': user_id1}}) i = -1 if unfollow else 1 self.client.User.user...
SocialFeatures
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialFeatures: def follow_user(self, user_id1, user_id2, unfollow=False): """user 1 follows or unfollows user 2""" <|body_0|> def fetch_social(self, user_id, followers=False, following=False, counts=True, reposted=False): """gets user social information""" <...
stack_v2_sparse_classes_36k_train_021115
2,436
no_license
[ { "docstring": "user 1 follows or unfollows user 2", "name": "follow_user", "signature": "def follow_user(self, user_id1, user_id2, unfollow=False)" }, { "docstring": "gets user social information", "name": "fetch_social", "signature": "def fetch_social(self, user_id, followers=False, fo...
3
stack_v2_sparse_classes_30k_test_001101
Implement the Python class `SocialFeatures` described below. Class description: Implement the SocialFeatures class. Method signatures and docstrings: - def follow_user(self, user_id1, user_id2, unfollow=False): user 1 follows or unfollows user 2 - def fetch_social(self, user_id, followers=False, following=False, coun...
Implement the Python class `SocialFeatures` described below. Class description: Implement the SocialFeatures class. Method signatures and docstrings: - def follow_user(self, user_id1, user_id2, unfollow=False): user 1 follows or unfollows user 2 - def fetch_social(self, user_id, followers=False, following=False, coun...
134dbf1712a720815978149e7803caa0df206f7a
<|skeleton|> class SocialFeatures: def follow_user(self, user_id1, user_id2, unfollow=False): """user 1 follows or unfollows user 2""" <|body_0|> def fetch_social(self, user_id, followers=False, following=False, counts=True, reposted=False): """gets user social information""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SocialFeatures: def follow_user(self, user_id1, user_id2, unfollow=False): """user 1 follows or unfollows user 2""" op = '$pull' if unfollow else '$push' self.client.Users.users.update_one({'user_id': user_id1}, {op: {'following': user_id2}}) self.client.Users.users.update_one(...
the_stack_v2_python_sparse
utils/social_features.py
ThreadNews/threadnews-backend
train
0
038a932f3f7c9c167dba128def9a9a1f7f291cfe
[ "EasyFrame.__init__(self, title='Color Meter')\nself.rgbLabel = self.addLabel(text='RGB : x000000', row=0, column=0)\nself.canvas = self.addCanvas(row=1, column=0)\nself.canvas['bg'] = 'black'\nself.redScale = self.addScale(label='Red', row=0, column=1, orient=VERTICAL, from_=0, to=255, length=300, tickinterval=15,...
<|body_start_0|> EasyFrame.__init__(self, title='Color Meter') self.rgbLabel = self.addLabel(text='RGB : x000000', row=0, column=0) self.canvas = self.addCanvas(row=1, column=0) self.canvas['bg'] = 'black' self.redScale = self.addScale(label='Red', row=0, column=1, orient=VERTICA...
ColorMeter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorMeter: def __init__(self): """Sets up the window and widgets.""" <|body_0|> def setColor(self, value): """Gets the RGB values from the scales, converts them to hex, and builds a six-digit hex string to update the view.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_021116
2,667
no_license
[ { "docstring": "Sets up the window and widgets.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Gets the RGB values from the scales, converts them to hex, and builds a six-digit hex string to update the view.", "name": "setColor", "signature": "def setColor(sel...
2
stack_v2_sparse_classes_30k_train_015462
Implement the Python class `ColorMeter` described below. Class description: Implement the ColorMeter class. Method signatures and docstrings: - def __init__(self): Sets up the window and widgets. - def setColor(self, value): Gets the RGB values from the scales, converts them to hex, and builds a six-digit hex string ...
Implement the Python class `ColorMeter` described below. Class description: Implement the ColorMeter class. Method signatures and docstrings: - def __init__(self): Sets up the window and widgets. - def setColor(self, value): Gets the RGB values from the scales, converts them to hex, and builds a six-digit hex string ...
eca69d000dc77681a30734b073b2383c97ccc02e
<|skeleton|> class ColorMeter: def __init__(self): """Sets up the window and widgets.""" <|body_0|> def setColor(self, value): """Gets the RGB values from the scales, converts them to hex, and builds a six-digit hex string to update the view.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColorMeter: def __init__(self): """Sets up the window and widgets.""" EasyFrame.__init__(self, title='Color Meter') self.rgbLabel = self.addLabel(text='RGB : x000000', row=0, column=0) self.canvas = self.addCanvas(row=1, column=0) self.canvas['bg'] = 'black' sel...
the_stack_v2_python_sparse
gui/breezy/scaledemo2.py
lforet/robomow
train
11
c1d0e671dd72a56db50f4e33db7de11780c036ff
[ "self.capacity = capacity\nself.dict = {}\nself.linkList = dLink()", "if key in self.dict:\n self.linkList.remove(self.dict[key])\n self.linkList.insert(self.dict[key])\n return self.dict[key].val\nelse:\n return -1", "if key in self.dict:\n self.dict[key].val = value\n self.get(key)\nelif len...
<|body_start_0|> self.capacity = capacity self.dict = {} self.linkList = dLink() <|end_body_0|> <|body_start_1|> if key in self.dict: self.linkList.remove(self.dict[key]) self.linkList.insert(self.dict[key]) return self.dict[key].val else: ...
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_021117
1,659
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
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): :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...
f028e96c17c3ca9788c72368e3593b35eb9fba48
<|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""" self.capacity = capacity self.dict = {} self.linkList = dLink() def get(self, key): """:rtype: int""" if key in self.dict: self.linkList.remove(self.dict[key]) self.li...
the_stack_v2_python_sparse
146_LRU_Cache.py
uniericuni/leetcode
train
3
948465607d5d900b53e50bf6d6c5af150c9f8456
[ "super(ContinuousGenerator, self).__init__()\nself.design_shape = design_shape\nself.latent_size = latent_size\nself.embed_0 = tfkl.Dense(hidden)\nself.embed_0.build((None, 1))\nself.dense_0 = tfkl.Dense(hidden)\nself.dense_0.build((None, latent_size + hidden))\nself.ln_0 = tfkl.LayerNormalization()\nself.ln_0.buil...
<|body_start_0|> super(ContinuousGenerator, self).__init__() self.design_shape = design_shape self.latent_size = latent_size self.embed_0 = tfkl.Dense(hidden) self.embed_0.build((None, 1)) self.dense_0 = tfkl.Dense(hidden) self.dense_0.build((None, latent_size + h...
A Fully Connected Network conditioned on a score
ContinuousGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContinuousGenerator: """A Fully Connected Network conditioned on a score""" def __init__(self, design_shape, latent_size, hidden=50): """Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a l...
stack_v2_sparse_classes_36k_train_021118
30,757
permissive
[ { "docstring": "Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple of integers that represents the shape of a single design for a particular task latent_size: int the number of hidden units in the latent...
2
stack_v2_sparse_classes_30k_train_010486
Implement the Python class `ContinuousGenerator` described below. Class description: A Fully Connected Network conditioned on a score Method signatures and docstrings: - def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel stream...
Implement the Python class `ContinuousGenerator` described below. Class description: A Fully Connected Network conditioned on a score Method signatures and docstrings: - def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel stream...
d46ff40d8b665953afb64a3332ddf1953b8a0766
<|skeleton|> class ContinuousGenerator: """A Fully Connected Network conditioned on a score""" def __init__(self, design_shape, latent_size, hidden=50): """Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContinuousGenerator: """A Fully Connected Network conditioned on a score""" def __init__(self, design_shape, latent_size, hidden=50): """Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple ...
the_stack_v2_python_sparse
design_baselines/mins/nets.py
stjordanis/design-baselines
train
0
3e622629281ddb90510416a664bdbcc3170747ce
[ "if CONFIG.get('feb14_debug_begin', False):\n return True\nreturn datetime.today().strftime('%m-%d') == '02-14'", "if CONFIG.get('feb14_debug_end', False):\n return True\nreturn datetime.today().strftime('%m-%d') == '02-15'" ]
<|body_start_0|> if CONFIG.get('feb14_debug_begin', False): return True return datetime.today().strftime('%m-%d') == '02-14' <|end_body_0|> <|body_start_1|> if CONFIG.get('feb14_debug_end', False): return True return datetime.today().strftime('%m-%d') == '02-15' ...
DateChecker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateChecker: def is_day_active() -> bool: """Сегодня 14-е фев?""" <|body_0|> def is_today_ending() -> bool: """Сегодня 15-е фев?""" <|body_1|> <|end_skeleton|> <|body_start_0|> if CONFIG.get('feb14_debug_begin', False): return True ...
stack_v2_sparse_classes_36k_train_021119
46,228
permissive
[ { "docstring": "Сегодня 14-е фев?", "name": "is_day_active", "signature": "def is_day_active() -> bool" }, { "docstring": "Сегодня 15-е фев?", "name": "is_today_ending", "signature": "def is_today_ending() -> bool" } ]
2
null
Implement the Python class `DateChecker` described below. Class description: Implement the DateChecker class. Method signatures and docstrings: - def is_day_active() -> bool: Сегодня 14-е фев? - def is_today_ending() -> bool: Сегодня 15-е фев?
Implement the Python class `DateChecker` described below. Class description: Implement the DateChecker class. Method signatures and docstrings: - def is_day_active() -> bool: Сегодня 14-е фев? - def is_today_ending() -> bool: Сегодня 15-е фев? <|skeleton|> class DateChecker: def is_day_active() -> bool: ...
d38bd793636fa30e609b148b71b2d7c8047570e3
<|skeleton|> class DateChecker: def is_day_active() -> bool: """Сегодня 14-е фев?""" <|body_0|> def is_today_ending() -> bool: """Сегодня 15-е фев?""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DateChecker: def is_day_active() -> bool: """Сегодня 14-е фев?""" if CONFIG.get('feb14_debug_begin', False): return True return datetime.today().strftime('%m-%d') == '02-14' def is_today_ending() -> bool: """Сегодня 15-е фев?""" if CONFIG.get('feb14_deb...
the_stack_v2_python_sparse
src/dayof/valentine_day_old.py
pongo/rapturebot
train
11
ae3019448dfa736f92c19dfb7aa45a343b497dd8
[ "num = 0\ni = 0\nwhile i < len(A):\n j = i\n temp = 0\n for k in range(j, len(A)):\n temp += A[k]\n if temp == S:\n num += 1\n elif temp > S:\n break\n i += 1\nreturn num", "indexes = [-1] + [ix for ix, v in enumerate(A) if v] + [len(A)]\nans = 0\nif S == 0:\...
<|body_start_0|> num = 0 i = 0 while i < len(A): j = i temp = 0 for k in range(j, len(A)): temp += A[k] if temp == S: num += 1 elif temp > S: break i += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarraysWithSum(self, A, S): """:type A: List[int] :type S: int :rtype: int""" <|body_0|> def numSubarraysWithSum1(self, A, S): """Approach 1: Index of Ones""" <|body_1|> def numSubarraysWithSum2(self, A, S): """Approach 2: Pref...
stack_v2_sparse_classes_36k_train_021120
1,998
no_license
[ { "docstring": ":type A: List[int] :type S: int :rtype: int", "name": "numSubarraysWithSum", "signature": "def numSubarraysWithSum(self, A, S)" }, { "docstring": "Approach 1: Index of Ones", "name": "numSubarraysWithSum1", "signature": "def numSubarraysWithSum1(self, A, S)" }, { ...
3
stack_v2_sparse_classes_30k_train_016442
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarraysWithSum(self, A, S): :type A: List[int] :type S: int :rtype: int - def numSubarraysWithSum1(self, A, S): Approach 1: Index of Ones - def numSubarraysWithSum2(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarraysWithSum(self, A, S): :type A: List[int] :type S: int :rtype: int - def numSubarraysWithSum1(self, A, S): Approach 1: Index of Ones - def numSubarraysWithSum2(self...
5674024fd179120134ab0588e499a5bace2469e2
<|skeleton|> class Solution: def numSubarraysWithSum(self, A, S): """:type A: List[int] :type S: int :rtype: int""" <|body_0|> def numSubarraysWithSum1(self, A, S): """Approach 1: Index of Ones""" <|body_1|> def numSubarraysWithSum2(self, A, S): """Approach 2: Pref...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarraysWithSum(self, A, S): """:type A: List[int] :type S: int :rtype: int""" num = 0 i = 0 while i < len(A): j = i temp = 0 for k in range(j, len(A)): temp += A[k] if temp == S: ...
the_stack_v2_python_sparse
leetcode solution in python/BinarySubarraysWithSum.py
shengchaohua/leetcode-solution
train
3
a6cea7e675be3f3d9101ed90cedaaeafa95c4616
[ "array_rgb = array[:, :, :3]\ninverted_array = array_rgb.copy()\nif array.dtype == np.float32 or array.dtype == np.float64:\n inverted_array = 1.0 - inverted_array\nelse:\n inverted_array = 255 - inverted_array\nreturn inverted_array", "blue_filtered_array = array.copy()\nblue_filtered_array[:, :, 0] = 0\nb...
<|body_start_0|> array_rgb = array[:, :, :3] inverted_array = array_rgb.copy() if array.dtype == np.float32 or array.dtype == np.float64: inverted_array = 1.0 - inverted_array else: inverted_array = 255 - inverted_array return inverted_array <|end_body_0|>...
ColorFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorFilter: def invert(self, array): """Invert the color of the image""" <|body_0|> def to_blue(self, array): """Applies a blue filter to the image""" <|body_1|> def to_green(self, array): """Applies a green filter to the image""" <|body...
stack_v2_sparse_classes_36k_train_021121
2,495
no_license
[ { "docstring": "Invert the color of the image", "name": "invert", "signature": "def invert(self, array)" }, { "docstring": "Applies a blue filter to the image", "name": "to_blue", "signature": "def to_blue(self, array)" }, { "docstring": "Applies a green filter to the image", ...
6
stack_v2_sparse_classes_30k_train_010066
Implement the Python class `ColorFilter` described below. Class description: Implement the ColorFilter class. Method signatures and docstrings: - def invert(self, array): Invert the color of the image - def to_blue(self, array): Applies a blue filter to the image - def to_green(self, array): Applies a green filter to...
Implement the Python class `ColorFilter` described below. Class description: Implement the ColorFilter class. Method signatures and docstrings: - def invert(self, array): Invert the color of the image - def to_blue(self, array): Applies a blue filter to the image - def to_green(self, array): Applies a green filter to...
24358cc6807d86fe5da766bb4505eef29f1e371f
<|skeleton|> class ColorFilter: def invert(self, array): """Invert the color of the image""" <|body_0|> def to_blue(self, array): """Applies a blue filter to the image""" <|body_1|> def to_green(self, array): """Applies a green filter to the image""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColorFilter: def invert(self, array): """Invert the color of the image""" array_rgb = array[:, :, :3] inverted_array = array_rgb.copy() if array.dtype == np.float32 or array.dtype == np.float64: inverted_array = 1.0 - inverted_array else: inverte...
the_stack_v2_python_sparse
day03/ex03/ColorFilter.py
Ghilphar/bootcamp_python
train
0
3223746aa253a2d804635722c639005a0aedba22
[ "super(Network, self).__init__()\nself.feature = NoisyLinear(in_dim[0], 128)\nself.noisy_layer1 = NoisyLinear(128, 128)\nself.noisy_layer2 = NoisyLinear(128, out_dim)", "feature = F.relu(self.feature(x))\nhidden = F.relu(self.noisy_layer1(feature))\nout = self.noisy_layer2(hidden)\nreturn out", "self.feature.re...
<|body_start_0|> super(Network, self).__init__() self.feature = NoisyLinear(in_dim[0], 128) self.noisy_layer1 = NoisyLinear(128, 128) self.noisy_layer2 = NoisyLinear(128, out_dim) <|end_body_0|> <|body_start_1|> feature = F.relu(self.feature(x)) hidden = F.relu(self.nois...
Network
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Network: def __init__(self, in_dim: int, out_dim: int): """Initialization.""" <|body_0|> def forward(self, x: torch.Tensor, dueling: bool) -> torch.Tensor: """Forward method implementation.""" <|body_1|> def reset_noise(self): """Reset all noisy ...
stack_v2_sparse_classes_36k_train_021122
16,237
permissive
[ { "docstring": "Initialization.", "name": "__init__", "signature": "def __init__(self, in_dim: int, out_dim: int)" }, { "docstring": "Forward method implementation.", "name": "forward", "signature": "def forward(self, x: torch.Tensor, dueling: bool) -> torch.Tensor" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_006986
Implement the Python class `Network` described below. Class description: Implement the Network class. Method signatures and docstrings: - def __init__(self, in_dim: int, out_dim: int): Initialization. - def forward(self, x: torch.Tensor, dueling: bool) -> torch.Tensor: Forward method implementation. - def reset_noise...
Implement the Python class `Network` described below. Class description: Implement the Network class. Method signatures and docstrings: - def __init__(self, in_dim: int, out_dim: int): Initialization. - def forward(self, x: torch.Tensor, dueling: bool) -> torch.Tensor: Forward method implementation. - def reset_noise...
027decb59ce97cc7c9d86aba3af9e21b390e4286
<|skeleton|> class Network: def __init__(self, in_dim: int, out_dim: int): """Initialization.""" <|body_0|> def forward(self, x: torch.Tensor, dueling: bool) -> torch.Tensor: """Forward method implementation.""" <|body_1|> def reset_noise(self): """Reset all noisy ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Network: def __init__(self, in_dim: int, out_dim: int): """Initialization.""" super(Network, self).__init__() self.feature = NoisyLinear(in_dim[0], 128) self.noisy_layer1 = NoisyLinear(128, 128) self.noisy_layer2 = NoisyLinear(128, out_dim) def forward(self, x: tor...
the_stack_v2_python_sparse
CybORG/CybORG/Agents/MyDQNAgent/nerual_network.py
yyzpiero/AutomaticCyberOperations
train
0
a01d92f4447e93f3e9fc2a213ef0a58625acb16d
[ "mock_boto_client.return_value = botocore.client.BaseClient()\nbuffer = BytesIO()\nx = np.array(['this on returned', 2, 3])\nnp.save(buffer, x)\nbody = StreamingBody(BytesIO(buffer.getvalue()), len(buffer.getvalue()))\nmock_invoke_endpoint.return_value.invoke_endpoint.return_value = {'Body': body, 'ContentType': 'a...
<|body_start_0|> mock_boto_client.return_value = botocore.client.BaseClient() buffer = BytesIO() x = np.array(['this on returned', 2, 3]) np.save(buffer, x) body = StreamingBody(BytesIO(buffer.getvalue()), len(buffer.getvalue())) mock_invoke_endpoint.return_value.invoke_e...
RunController integration test stubs
TestRunController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRunController: """RunController integration test stubs""" def test_prediction(self, mock_boto_client, mock_invoke_endpoint): """Test case for prediction Call Prediction of specified deployment""" <|body_0|> def test_prediction_no_endpoint_in_target(self, mock_boto_cl...
stack_v2_sparse_classes_36k_train_021123
6,978
permissive
[ { "docstring": "Test case for prediction Call Prediction of specified deployment", "name": "test_prediction", "signature": "def test_prediction(self, mock_boto_client, mock_invoke_endpoint)" }, { "docstring": "Test case for prediction Call Prediction of specified deployment", "name": "test_p...
5
null
Implement the Python class `TestRunController` described below. Class description: RunController integration test stubs Method signatures and docstrings: - def test_prediction(self, mock_boto_client, mock_invoke_endpoint): Test case for prediction Call Prediction of specified deployment - def test_prediction_no_endpo...
Implement the Python class `TestRunController` described below. Class description: RunController integration test stubs Method signatures and docstrings: - def test_prediction(self, mock_boto_client, mock_invoke_endpoint): Test case for prediction Call Prediction of specified deployment - def test_prediction_no_endpo...
8b7db98f46a81b731d0dddfde8e3fb6f91ebc71a
<|skeleton|> class TestRunController: """RunController integration test stubs""" def test_prediction(self, mock_boto_client, mock_invoke_endpoint): """Test case for prediction Call Prediction of specified deployment""" <|body_0|> def test_prediction_no_endpoint_in_target(self, mock_boto_cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestRunController: """RunController integration test stubs""" def test_prediction(self, mock_boto_client, mock_invoke_endpoint): """Test case for prediction Call Prediction of specified deployment""" mock_boto_client.return_value = botocore.client.BaseClient() buffer = BytesIO() ...
the_stack_v2_python_sparse
ops-implementations/sagemaker-service/swagger_server/test_mocked/test_run_controller.py
Rdecoster/open-prediction-service-hub
train
0
f101875066c096b460f981be01afc2809106023a
[ "data = np.asarray(data)\ninit = [[1, data[0]], [0, data[1] - data[0]]]\nengram = np.array(init, dtype=data.dtype)\nnew_row = np.zeros(2, dtype=data.dtype)\nd = np.diff(data)\nfor i in xrange(d.size):\n if d[i] != engram[-1, 1]:\n engram = np.vstack((engram, new_row))\n engram[-1, 1] = d[i]\n en...
<|body_start_0|> data = np.asarray(data) init = [[1, data[0]], [0, data[1] - data[0]]] engram = np.array(init, dtype=data.dtype) new_row = np.zeros(2, dtype=data.dtype) d = np.diff(data) for i in xrange(d.size): if d[i] != engram[-1, 1]: engram...
Simple encode/decode based on delta compression for 1D arrays
DeltaCompress
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeltaCompress: """Simple encode/decode based on delta compression for 1D arrays""" def encode(self, data): """Compress 1D data array into a delta matrix""" <|body_0|> def decode(self, engram): """Extract original 1D data array from a delta matrix""" <|bod...
stack_v2_sparse_classes_36k_train_021124
1,355
permissive
[ { "docstring": "Compress 1D data array into a delta matrix", "name": "encode", "signature": "def encode(self, data)" }, { "docstring": "Extract original 1D data array from a delta matrix", "name": "decode", "signature": "def decode(self, engram)" } ]
2
stack_v2_sparse_classes_30k_train_003562
Implement the Python class `DeltaCompress` described below. Class description: Simple encode/decode based on delta compression for 1D arrays Method signatures and docstrings: - def encode(self, data): Compress 1D data array into a delta matrix - def decode(self, engram): Extract original 1D data array from a delta ma...
Implement the Python class `DeltaCompress` described below. Class description: Simple encode/decode based on delta compression for 1D arrays Method signatures and docstrings: - def encode(self, data): Compress 1D data array into a delta matrix - def decode(self, engram): Extract original 1D data array from a delta ma...
4c69ccd1f635c440f1ebe85328efd1db5bce6957
<|skeleton|> class DeltaCompress: """Simple encode/decode based on delta compression for 1D arrays""" def encode(self, data): """Compress 1D data array into a delta matrix""" <|body_0|> def decode(self, engram): """Extract original 1D data array from a delta matrix""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeltaCompress: """Simple encode/decode based on delta compression for 1D arrays""" def encode(self, data): """Compress 1D data array into a delta matrix""" data = np.asarray(data) init = [[1, data[0]], [0, data[1] - data[0]]] engram = np.array(init, dtype=data.dtype) ...
the_stack_v2_python_sparse
scanr/tools/compress.py
jdmonaco/scanning-paper
train
0
d443527bada8adc6a4169dab68e87850448217a0
[ "super(RMSModel, self).__init__()\nself.el = np.array(model_spec.keys())\nself.rms = np.array(model_spec.values())\nself.alpha, self.beta = fit_power_law(self.el, self.rms)", "if el < 0:\n raise RuntimeError('el = {} < 0'.format(el))\nelif el > 90:\n raise RuntimeError('el = {} > 90'.format(el))\nif 0 <= el...
<|body_start_0|> super(RMSModel, self).__init__() self.el = np.array(model_spec.keys()) self.rms = np.array(model_spec.values()) self.alpha, self.beta = fit_power_law(self.el, self.rms) <|end_body_0|> <|body_start_1|> if el < 0: raise RuntimeError('el = {} < 0'.forma...
RMSModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RMSModel: def __init__(self, model_spec=SNR_8): """???""" <|body_0|> def __call__(self, el): """??? note that el is in [deg]""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(RMSModel, self).__init__() self.el = np.array(model_spec.keys(...
stack_v2_sparse_classes_36k_train_021125
2,471
permissive
[ { "docstring": "???", "name": "__init__", "signature": "def __init__(self, model_spec=SNR_8)" }, { "docstring": "??? note that el is in [deg]", "name": "__call__", "signature": "def __call__(self, el)" } ]
2
stack_v2_sparse_classes_30k_train_006343
Implement the Python class `RMSModel` described below. Class description: Implement the RMSModel class. Method signatures and docstrings: - def __init__(self, model_spec=SNR_8): ??? - def __call__(self, el): ??? note that el is in [deg]
Implement the Python class `RMSModel` described below. Class description: Implement the RMSModel class. Method signatures and docstrings: - def __init__(self, model_spec=SNR_8): ??? - def __call__(self, el): ??? note that el is in [deg] <|skeleton|> class RMSModel: def __init__(self, model_spec=SNR_8): ...
e364be68cb0cadbeea10ca569963b8f99aa7b05b
<|skeleton|> class RMSModel: def __init__(self, model_spec=SNR_8): """???""" <|body_0|> def __call__(self, el): """??? note that el is in [deg]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RMSModel: def __init__(self, model_spec=SNR_8): """???""" super(RMSModel, self).__init__() self.el = np.array(model_spec.keys()) self.rms = np.array(model_spec.values()) self.alpha, self.beta = fit_power_law(self.el, self.rms) def __call__(self, el): """???...
the_stack_v2_python_sparse
pyrsss/gnss/rms_model.py
butala/pyrsss
train
7
953ecfda3700e263db7848b60f962c0369921a2c
[ "if type(N) is not int:\n raise TypeError('N must be int representing number of blocks in the encoder')\nif type(dm) is not int:\n raise TypeError('dm must be int representing dimensionality of model')\nif type(h) is not int:\n raise TypeError('h must be int representing number of heads')\nif type(hidden) ...
<|body_start_0|> if type(N) is not int: raise TypeError('N must be int representing number of blocks in the encoder') if type(dm) is not int: raise TypeError('dm must be int representing dimensionality of model') if type(h) is not int: raise TypeError('h must ...
Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the inputs positional_encoding [numpy.nd...
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the i...
stack_v2_sparse_classes_36k_train_021126
4,656
no_license
[ { "docstring": "Class constructor parameters: N [int]: represents the number of blocks in the encoder dm [int]: represents the dimensionality of the model h [int]: represents the number of heads hidden [int]: represents the number of hidden units in fully connected layer input_vocab [int]: represents the size o...
2
null
Implement the Python class `Encoder` described below. Class description: Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model e...
Implement the Python class `Encoder` described below. Class description: Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model e...
8834b201ca84937365e4dcc0fac978656cdf5293
<|skeleton|> class Encoder: """Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Class to create the encoder for a transformer class constructor: def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1) public instance attribute: N: the number of blocks in the encoder dm: the dimensionality of the model embedding: the embedding layer for the inputs positio...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/9-transformer_encoder.py
ejonakodra/holbertonschool-machine_learning-1
train
0
1d0cc0ae7ebfbd91c6824267f58ed5c722b7b75c
[ "LDC_Info.__init__(self)\nself.ui.setupUi(self.frame)\nself.setTitle(self.name)\nself.status = compat_res[0]\nself.__fill_frame(info_res, compat_res, diag_res)", "controller = info_res.memoryController\nif controller:\n maxMemoryModuleSize = self._check_invalid_values(controller.maxMemoryModuleSize)\n memor...
<|body_start_0|> LDC_Info.__init__(self) self.ui.setupUi(self.frame) self.setTitle(self.name) self.status = compat_res[0] self.__fill_frame(info_res, compat_res, diag_res) <|end_body_0|> <|body_start_1|> controller = info_res.memoryController if controller: ...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de memória.
GUIMemory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIMemory: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de memória.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMemory') com...
stack_v2_sparse_classes_36k_train_021127
4,015
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMemory') compat_res -- Lista com as tuples de resultados de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagnóstico (lista de 'DaigResMemory')", "name": "__init__", "signatu...
3
null
Implement the Python class `GUIMemory` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de memória. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com ...
Implement the Python class `GUIMemory` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de memória. Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- lista com ...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIMemory: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de memória.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMemory') com...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUIMemory: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica com os resultados para o teste de memória.""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMemory') compat_res -- Li...
the_stack_v2_python_sparse
src/libs/memory/gui_memory.py
adrianomelo/ldc-desktop
train
1
d33c8a3fc8fb334916fd3ad081203ec417e8a354
[ "method = 'POST'\npath = self.path('config/access')\nscheme = None\nif address.startswith('https://'):\n scheme, address = ('https', address[8:])\nelif address.startswith('http://'):\n scheme, address = ('http', address[7:])\ndata = {'address': address, 'token': token, 'scheme': scheme}\nresponse = (yield fro...
<|body_start_0|> method = 'POST' path = self.path('config/access') scheme = None if address.startswith('https://'): scheme, address = ('https', address[8:]) elif address.startswith('http://'): scheme, address = ('http', address[7:]) data = {'addres...
ConsulBackend
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsulBackend: def config_access(self, address, token): """Configures the access information for Consul. This is a root protected endpoint. Parameters: address (str): The address of the Consul instance, provided as scheme://host:port token (str): The Consul ACL token to use. Must be a ma...
stack_v2_sparse_classes_36k_train_021128
2,998
permissive
[ { "docstring": "Configures the access information for Consul. This is a root protected endpoint. Parameters: address (str): The address of the Consul instance, provided as scheme://host:port token (str): The Consul ACL token to use. Must be a management type token. Results: bool", "name": "config_access", ...
5
stack_v2_sparse_classes_30k_train_020902
Implement the Python class `ConsulBackend` described below. Class description: Implement the ConsulBackend class. Method signatures and docstrings: - def config_access(self, address, token): Configures the access information for Consul. This is a root protected endpoint. Parameters: address (str): The address of the ...
Implement the Python class `ConsulBackend` described below. Class description: Implement the ConsulBackend class. Method signatures and docstrings: - def config_access(self, address, token): Configures the access information for Consul. This is a root protected endpoint. Parameters: address (str): The address of the ...
03e1bfb6f0404dcf97ce87a98c539027c4e78a37
<|skeleton|> class ConsulBackend: def config_access(self, address, token): """Configures the access information for Consul. This is a root protected endpoint. Parameters: address (str): The address of the Consul instance, provided as scheme://host:port token (str): The Consul ACL token to use. Must be a ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsulBackend: def config_access(self, address, token): """Configures the access information for Consul. This is a root protected endpoint. Parameters: address (str): The address of the Consul instance, provided as scheme://host:port token (str): The Consul ACL token to use. Must be a management type ...
the_stack_v2_python_sparse
aiovault/v1/secret/backends/consul.py
johnnoone/aiovault
train
1
cba652c5afe1e908f94300846fa37995e7f21bd2
[ "self._cpu = cpu.Cpu()\nself._memory_controller = memory.MemoryController()\nself._video_controller = video.VideoController()", "print('System.power_on()')\nself._cpu.power_on()\nself._memory_controller.power_on()\nself._video_controller.power_on()" ]
<|body_start_0|> self._cpu = cpu.Cpu() self._memory_controller = memory.MemoryController() self._video_controller = video.VideoController() <|end_body_0|> <|body_start_1|> print('System.power_on()') self._cpu.power_on() self._memory_controller.power_on() self._vi...
Represents a computer system.
System
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class System: """Represents a computer system.""" def __init__(self): """Creates and initializes the system components.""" <|body_0|> def power_on(self): """Powers on the system components.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._cpu = c...
stack_v2_sparse_classes_36k_train_021129
550
permissive
[ { "docstring": "Creates and initializes the system components.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Powers on the system components.", "name": "power_on", "signature": "def power_on(self)" } ]
2
null
Implement the Python class `System` described below. Class description: Represents a computer system. Method signatures and docstrings: - def __init__(self): Creates and initializes the system components. - def power_on(self): Powers on the system components.
Implement the Python class `System` described below. Class description: Represents a computer system. Method signatures and docstrings: - def __init__(self): Creates and initializes the system components. - def power_on(self): Powers on the system components. <|skeleton|> class System: """Represents a computer s...
2a54293181c1c2b1a2b840ddee4d4d80177efb33
<|skeleton|> class System: """Represents a computer system.""" def __init__(self): """Creates and initializes the system components.""" <|body_0|> def power_on(self): """Powers on the system components.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class System: """Represents a computer system.""" def __init__(self): """Creates and initializes the system components.""" self._cpu = cpu.Cpu() self._memory_controller = memory.MemoryController() self._video_controller = video.VideoController() def power_on(self): ...
the_stack_v2_python_sparse
data/train/python/79af5ca3359d7199f6a3221b325aafcefb287cbfsystem.py
harshp8l/deep-learning-lang-detection
train
0
9320a832ddfba04aee1244a5f67dab0ad25c7a51
[ "data = ma.masked_inside(track['timestamp'], stime, etime)\ntrack = track.compress(data.mask)\ntimes, indices = np.unique(track['timestamp'], return_index=True)\ntrack = track[indices]\ntdifs = np.ediff1d(track['timestamp'], to_begin=1)\nchunk_end_idxs = np.where(tdifs > self.maxtimediff)[0]\nsafe_time_idx = np.whe...
<|body_start_0|> data = ma.masked_inside(track['timestamp'], stime, etime) track = track.compress(data.mask) times, indices = np.unique(track['timestamp'], return_index=True) track = track[indices] tdifs = np.ediff1d(track['timestamp'], to_begin=1) chunk_end_idxs = np.whe...
Cut track and correct it.
OfflineCorrectorService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfflineCorrectorService: """Cut track and correct it.""" def _clean_timestamps(self, track, stime, etime): """Cut track in time and make array with timestamps monotonic. @param track: @type track: @return: @rtype:""" <|body_0|> def correct_track(self, track, stime, etime...
stack_v2_sparse_classes_36k_train_021130
28,613
no_license
[ { "docstring": "Cut track in time and make array with timestamps monotonic. @param track: @type track: @return: @rtype:", "name": "_clean_timestamps", "signature": "def _clean_timestamps(self, track, stime, etime)" }, { "docstring": "Receive raw parsed data, cut it and looks for bad times. @para...
2
null
Implement the Python class `OfflineCorrectorService` described below. Class description: Cut track and correct it. Method signatures and docstrings: - def _clean_timestamps(self, track, stime, etime): Cut track in time and make array with timestamps monotonic. @param track: @type track: @return: @rtype: - def correct...
Implement the Python class `OfflineCorrectorService` described below. Class description: Cut track and correct it. Method signatures and docstrings: - def _clean_timestamps(self, track, stime, etime): Cut track in time and make array with timestamps monotonic. @param track: @type track: @return: @rtype: - def correct...
ebb545cf5abcdc7707fa73e0824c923c5289793c
<|skeleton|> class OfflineCorrectorService: """Cut track and correct it.""" def _clean_timestamps(self, track, stime, etime): """Cut track in time and make array with timestamps monotonic. @param track: @type track: @return: @rtype:""" <|body_0|> def correct_track(self, track, stime, etime...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfflineCorrectorService: """Cut track and correct it.""" def _clean_timestamps(self, track, stime, etime): """Cut track in time and make array with timestamps monotonic. @param track: @type track: @return: @rtype:""" data = ma.masked_inside(track['timestamp'], stime, etime) track ...
the_stack_v2_python_sparse
gorynych/processor/domain/services.py
TBoris/gorynych
train
0
ba11d32089592876d9a015471694f30ac44f6d90
[ "if len(ContentFilter.__UNSAFE_WORDS) == 0:\n _dir = path.dirname(path.abspath(__file__))\n with open(path.join(_dir, '../static/txt/unsafe_words.txt'), 'r') as f:\n lines = f.readlines()\n for l in lines:\n ContentFilter.__UNSAFE_WORDS.append(l.strip())\nreturn ContentFilter.__UNSAFE...
<|body_start_0|> if len(ContentFilter.__UNSAFE_WORDS) == 0: _dir = path.dirname(path.abspath(__file__)) with open(path.join(_dir, '../static/txt/unsafe_words.txt'), 'r') as f: lines = f.readlines() for l in lines: ContentFilter.__UNSAFE...
ContentFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentFilter: def unsafe_words(): """Populates unsafe_words list with the contents of a file in monolith/static/txt folder if the list is still empty. Returns the unsafe words list.""" <|body_0|> def filter_content(message_body) -> bool: """For every word in the mes...
stack_v2_sparse_classes_36k_train_021131
13,119
no_license
[ { "docstring": "Populates unsafe_words list with the contents of a file in monolith/static/txt folder if the list is still empty. Returns the unsafe words list.", "name": "unsafe_words", "signature": "def unsafe_words()" }, { "docstring": "For every word in the message_body string checks if it i...
2
stack_v2_sparse_classes_30k_train_021643
Implement the Python class `ContentFilter` described below. Class description: Implement the ContentFilter class. Method signatures and docstrings: - def unsafe_words(): Populates unsafe_words list with the contents of a file in monolith/static/txt folder if the list is still empty. Returns the unsafe words list. - d...
Implement the Python class `ContentFilter` described below. Class description: Implement the ContentFilter class. Method signatures and docstrings: - def unsafe_words(): Populates unsafe_words list with the contents of a file in monolith/static/txt folder if the list is still empty. Returns the unsafe words list. - d...
3227746a46367d3815c1ed877e7a67417e8de5a1
<|skeleton|> class ContentFilter: def unsafe_words(): """Populates unsafe_words list with the contents of a file in monolith/static/txt folder if the list is still empty. Returns the unsafe words list.""" <|body_0|> def filter_content(message_body) -> bool: """For every word in the mes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContentFilter: def unsafe_words(): """Populates unsafe_words list with the contents of a file in monolith/static/txt folder if the list is still empty. Returns the unsafe words list.""" if len(ContentFilter.__UNSAFE_WORDS) == 0: _dir = path.dirname(path.abspath(__file__)) ...
the_stack_v2_python_sparse
monolith/classes/message.py
Team6ASE2021/MMIAB-PRIMER
train
1
51801a991c13018a0b6018a43b276feb128e0ffa
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Service for ingesting and querying logs.
LoggingServiceV2Servicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoggingServiceV2Servicer: """Service for ingesting and querying logs.""" def DeleteLog(self, request, context): """Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted.""" ...
stack_v2_sparse_classes_36k_train_021132
6,823
permissive
[ { "docstring": "Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted.", "name": "DeleteLog", "signature": "def DeleteLog(self, request, context)" }, { "docstring": "Writes log entries to L...
5
null
Implement the Python class `LoggingServiceV2Servicer` described below. Class description: Service for ingesting and querying logs. Method signatures and docstrings: - def DeleteLog(self, request, context): Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly ...
Implement the Python class `LoggingServiceV2Servicer` described below. Class description: Service for ingesting and querying logs. Method signatures and docstrings: - def DeleteLog(self, request, context): Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly ...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class LoggingServiceV2Servicer: """Service for ingesting and querying logs.""" def DeleteLog(self, request, context): """Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoggingServiceV2Servicer: """Service for ingesting and querying logs.""" def DeleteLog(self, request, context): """Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted.""" context.s...
the_stack_v2_python_sparse
logging/google/cloud/logging_v2/proto/logging_pb2_grpc.py
tswast/google-cloud-python
train
1
5b0500661a868e1922a93a3abd6f634c0d08e8ec
[ "self.name = name\nself.num = num\nself.course = course\nself.classes = classes\nself.teacher = teacher\nself.student = student", "ret = MyPickle.load(settings.schoolinfo)\nfor i in ret.values():\n if self.name == i.name:\n Public.print('%s已经存在!' % self.name, 'error')\n return 0\nself.num = len(r...
<|body_start_0|> self.name = name self.num = num self.course = course self.classes = classes self.teacher = teacher self.student = student <|end_body_0|> <|body_start_1|> ret = MyPickle.load(settings.schoolinfo) for i in ret.values(): if self....
School
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class School: def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): """:param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生""" <|body_0|> def create(self): """创建...
stack_v2_sparse_classes_36k_train_021133
3,775
no_license
[ { "docstring": ":param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生", "name": "__init__", "signature": "def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={})" }, { "docstring": "创建学校 :...
2
stack_v2_sparse_classes_30k_train_014156
Implement the Python class `School` described below. Class description: Implement the School class. Method signatures and docstrings: - def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): :param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher:...
Implement the Python class `School` described below. Class description: Implement the School class. Method signatures and docstrings: - def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): :param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher:...
d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7
<|skeleton|> class School: def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): """:param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生""" <|body_0|> def create(self): """创建...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class School: def __init__(self, name, num=0, classes={}, course={}, teacher={}, student={}): """:param name: 学校名称 :param num: 学校的ID :param classes: 学校包含的所有班级 :param course: 学校包含的所有课程 :param teacher: 学校包含的所有老师 :param student: 包含学校的所有学生""" self.name = name self.num = num self.course =...
the_stack_v2_python_sparse
Homework/day07/core/school.py
214031230/Python21
train
0
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([bert_layer.attention.q_lin.weight, bert_layer.attention.k_lin.weight, bert_layer.attention.v_lin.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([bert_layer.attention.q_lin.bias, bert_layer.attention.k_lin.bias, bert_layer.attention.v_li...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([bert_layer.attention.q_lin.weight, bert_layer.attention.k_lin.weight, bert_layer.attention.v_lin.weight])) self.in_proj_bias = nn.Parameter(torch.cat([bert_layer.attention.q_lin.bias, bert_layer.attention.k_l...
DistilBertLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistilBertLayerBetterTransformer: def __init__(self, bert_layer, config): """A simple conversion of the Distill-BERTLayer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original Distill-BERT Layer where the weights needs to be retrieved.""" <...
stack_v2_sparse_classes_36k_train_021134
43,670
no_license
[ { "docstring": "A simple conversion of the Distill-BERTLayer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original Distill-BERT Layer where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, bert_layer, config)" }, { ...
2
stack_v2_sparse_classes_30k_train_002148
Implement the Python class `DistilBertLayerBetterTransformer` described below. Class description: Implement the DistilBertLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, bert_layer, config): A simple conversion of the Distill-BERTLayer to its `BetterTransformer` implementation. Ar...
Implement the Python class `DistilBertLayerBetterTransformer` described below. Class description: Implement the DistilBertLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, bert_layer, config): A simple conversion of the Distill-BERTLayer to its `BetterTransformer` implementation. Ar...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class DistilBertLayerBetterTransformer: def __init__(self, bert_layer, config): """A simple conversion of the Distill-BERTLayer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original Distill-BERT Layer where the weights needs to be retrieved.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DistilBertLayerBetterTransformer: def __init__(self, bert_layer, config): """A simple conversion of the Distill-BERTLayer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original Distill-BERT Layer where the weights needs to be retrieved.""" super().__init_...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
8e7a48b1ed9eafaaf6a1323470c167f8c67461b7
[ "print('\\n', 'Cette commande vide les tables Category et Product.')\ncat = c.objects.all()\nprod = p.objects.all()\nprint('\\n', 'avant : ')\nprint(' cat / prod > ', len(cat), ' / ', len(prod))\ncat.delete()\nprod.delete()\nprint('\\n', 'après : ')\nprint(' cat / prod > ', len(cat), ' / ', len(prod))", "print('\...
<|body_start_0|> print('\n', 'Cette commande vide les tables Category et Product.') cat = c.objects.all() prod = p.objects.all() print('\n', 'avant : ') print(' cat / prod > ', len(cat), ' / ', len(prod)) cat.delete() prod.delete() print('\n', 'après : ') ...
this class manages the parameters you can pass to python manage.py
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """this class manages the parameters you can pass to python manage.py""" def _drop_db(self): """drops the datas""" <|body_0|> def handle(self, *args, **options): """throws the drop_db function""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021135
949
no_license
[ { "docstring": "drops the datas", "name": "_drop_db", "signature": "def _drop_db(self)" }, { "docstring": "throws the drop_db function", "name": "handle", "signature": "def handle(self, *args, **options)" } ]
2
stack_v2_sparse_classes_30k_test_000018
Implement the Python class `Command` described below. Class description: this class manages the parameters you can pass to python manage.py Method signatures and docstrings: - def _drop_db(self): drops the datas - def handle(self, *args, **options): throws the drop_db function
Implement the Python class `Command` described below. Class description: this class manages the parameters you can pass to python manage.py Method signatures and docstrings: - def _drop_db(self): drops the datas - def handle(self, *args, **options): throws the drop_db function <|skeleton|> class Command: """this...
378244474186a2fe25f91377f3628a1479329f99
<|skeleton|> class Command: """this class manages the parameters you can pass to python manage.py""" def _drop_db(self): """drops the datas""" <|body_0|> def handle(self, *args, **options): """throws the drop_db function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """this class manages the parameters you can pass to python manage.py""" def _drop_db(self): """drops the datas""" print('\n', 'Cette commande vide les tables Category et Product.') cat = c.objects.all() prod = p.objects.all() print('\n', 'avant : ') ...
the_stack_v2_python_sparse
products/management/commands/dropcp.py
blingstand/projet8
train
0
8fc8e783c200f7795328ca0fc1a02d59adac770f
[ "var = list()\ntry:\n for elem in db_mixins:\n for jfilter in jfilters:\n ok = joker.filter_occi_description(elem, jfilter)\n if ok is True:\n var.append(elem)\n logger.debug('===== Get_filtered_mixins: A Mixin document is found =====')\n ...
<|body_start_0|> var = list() try: for elem in db_mixins: for jfilter in jfilters: ok = joker.filter_occi_description(elem, jfilter) if ok is True: var.append(elem) logger.debug('===== Get...
Manager for Mixin documents
MixinManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixinManager: """Manager for Mixin documents""" def get_filtered_mixins(self, jfilters, db_mixins): """Returns mixin documents matching the filter provided Args: @param jfilters: description of the mixin document to retrieve @param db_mixins: mixin descriptions that already exist in ...
stack_v2_sparse_classes_36k_train_021136
8,578
permissive
[ { "docstring": "Returns mixin documents matching the filter provided Args: @param jfilters: description of the mixin document to retrieve @param db_mixins: mixin descriptions that already exist in database", "name": "get_filtered_mixins", "signature": "def get_filtered_mixins(self, jfilters, db_mixins)"...
5
null
Implement the Python class `MixinManager` described below. Class description: Manager for Mixin documents Method signatures and docstrings: - def get_filtered_mixins(self, jfilters, db_mixins): Returns mixin documents matching the filter provided Args: @param jfilters: description of the mixin document to retrieve @p...
Implement the Python class `MixinManager` described below. Class description: Manager for Mixin documents Method signatures and docstrings: - def get_filtered_mixins(self, jfilters, db_mixins): Returns mixin documents matching the filter provided Args: @param jfilters: description of the mixin document to retrieve @p...
9535b721e7b832d72fd7bba6d2a29e76a0d4bdb7
<|skeleton|> class MixinManager: """Manager for Mixin documents""" def get_filtered_mixins(self, jfilters, db_mixins): """Returns mixin documents matching the filter provided Args: @param jfilters: description of the mixin document to retrieve @param db_mixins: mixin descriptions that already exist in ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MixinManager: """Manager for Mixin documents""" def get_filtered_mixins(self, jfilters, db_mixins): """Returns mixin documents matching the filter provided Args: @param jfilters: description of the mixin document to retrieve @param db_mixins: mixin descriptions that already exist in database""" ...
the_stack_v2_python_sparse
pyocni/junglers/managers/mixinManager.py
MarouenMechtri/CNG-Manager
train
1
1ace4b9bce81e93bee6f6edea43cc175547d7e26
[ "if params:\n assert param_types is not None\nreturn cls(is_sql=True, is_table=False, read_operation='process_query_batch', kwargs={'sql': sql, 'params': params, 'param_types': param_types})", "keyset = keyset or KeySet(all_=True)\nif not isinstance(keyset, KeySet):\n raise ValueError('keyset must be an ins...
<|body_start_0|> if params: assert param_types is not None return cls(is_sql=True, is_table=False, read_operation='process_query_batch', kwargs={'sql': sql, 'params': params, 'param_types': param_types}) <|end_body_0|> <|body_start_1|> keyset = keyset or KeySet(all_=True) if...
Encapsulates a spanner read operation.
ReadOperation
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-protobuf", "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadOperation: """Encapsulates a spanner read operation.""" def query(cls, sql, params=None, param_types=None): """A convenient method to construct ReadOperation from sql query. Args: sql: SQL query statement params: (optional) values for parameter replacement. Keys must match the na...
stack_v2_sparse_classes_36k_train_021137
48,677
permissive
[ { "docstring": "A convenient method to construct ReadOperation from sql query. Args: sql: SQL query statement params: (optional) values for parameter replacement. Keys must match the names used in sql param_types: (optional) maps explicit types for one or more param values; required if parameters are passed.", ...
2
stack_v2_sparse_classes_30k_train_016245
Implement the Python class `ReadOperation` described below. Class description: Encapsulates a spanner read operation. Method signatures and docstrings: - def query(cls, sql, params=None, param_types=None): A convenient method to construct ReadOperation from sql query. Args: sql: SQL query statement params: (optional)...
Implement the Python class `ReadOperation` described below. Class description: Encapsulates a spanner read operation. Method signatures and docstrings: - def query(cls, sql, params=None, param_types=None): A convenient method to construct ReadOperation from sql query. Args: sql: SQL query statement params: (optional)...
6d5048e05087ea54abc889ce402ae2a0abb9252b
<|skeleton|> class ReadOperation: """Encapsulates a spanner read operation.""" def query(cls, sql, params=None, param_types=None): """A convenient method to construct ReadOperation from sql query. Args: sql: SQL query statement params: (optional) values for parameter replacement. Keys must match the na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadOperation: """Encapsulates a spanner read operation.""" def query(cls, sql, params=None, param_types=None): """A convenient method to construct ReadOperation from sql query. Args: sql: SQL query statement params: (optional) values for parameter replacement. Keys must match the names used in s...
the_stack_v2_python_sparse
sdks/python/apache_beam/io/gcp/experimental/spannerio.py
apache/beam
train
7,061
4aae3da0b788550e595538611c3d3e22974f5a3a
[ "if len(candles) < cls.n * 3:\n raise ValueError(f'Cannot find support line with fewer than {cls.n * 3} candles')\nprices = np.array([(candle.low + candle.open) / 2.0 for candle in candles])\nprices_smooth = smooth(prices, cls.n + 1, 3)\nprices_dydx = np.zeros(len(candles))\nprices_dydx[1:] = np.subtract(prices_...
<|body_start_0|> if len(candles) < cls.n * 3: raise ValueError(f'Cannot find support line with fewer than {cls.n * 3} candles') prices = np.array([(candle.low + candle.open) / 2.0 for candle in candles]) prices_smooth = smooth(prices, cls.n + 1, 3) prices_dydx = np.zeros(len(...
Finds support and resistance lines.
TrendLineFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrendLineFinder: """Finds support and resistance lines.""" def find_support_line(cls, candles: List[Candle]) -> Optional[PriceLine]: """Returns a support line, if one can be found.""" <|body_0|> def find_resistance_line(cls, candles: List[Candle]) -> Optional[PriceLine]:...
stack_v2_sparse_classes_36k_train_021138
4,651
no_license
[ { "docstring": "Returns a support line, if one can be found.", "name": "find_support_line", "signature": "def find_support_line(cls, candles: List[Candle]) -> Optional[PriceLine]" }, { "docstring": "Returns a resistance line, if one can be found.", "name": "find_resistance_line", "signat...
2
null
Implement the Python class `TrendLineFinder` described below. Class description: Finds support and resistance lines. Method signatures and docstrings: - def find_support_line(cls, candles: List[Candle]) -> Optional[PriceLine]: Returns a support line, if one can be found. - def find_resistance_line(cls, candles: List[...
Implement the Python class `TrendLineFinder` described below. Class description: Finds support and resistance lines. Method signatures and docstrings: - def find_support_line(cls, candles: List[Candle]) -> Optional[PriceLine]: Returns a support line, if one can be found. - def find_resistance_line(cls, candles: List[...
3e067af6840e41d15a6b46ca5f5828000df35321
<|skeleton|> class TrendLineFinder: """Finds support and resistance lines.""" def find_support_line(cls, candles: List[Candle]) -> Optional[PriceLine]: """Returns a support line, if one can be found.""" <|body_0|> def find_resistance_line(cls, candles: List[Candle]) -> Optional[PriceLine]:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrendLineFinder: """Finds support and resistance lines.""" def find_support_line(cls, candles: List[Candle]) -> Optional[PriceLine]: """Returns a support line, if one can be found.""" if len(candles) < cls.n * 3: raise ValueError(f'Cannot find support line with fewer than {cls...
the_stack_v2_python_sparse
backend/tc2/stock_analysis/model_output/TrendLineFinder.py
maxilie/TC2_public
train
0
d2c8f91273b26c75189dd1ab05af4d6c2c29e728
[ "dummy = ListNode(0)\nwhile head:\n q = head.next\n head.next = dummy.next\n dummy.next = head\n head = q\nreturn dummy.next", "if not head or not head.next:\n return head\npre = head\np = pre.next\nr = p.next\npre.next = None\np.next = pre\nwhile r:\n pre = p\n p = r\n r = r.next\n p.n...
<|body_start_0|> dummy = ListNode(0) while head: q = head.next head.next = dummy.next dummy.next = head head = q return dummy.next <|end_body_0|> <|body_start_1|> if not head or not head.next: return head pre = head ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseList3(self, head): """:type head: ListNode :rtype: List...
stack_v2_sparse_classes_36k_train_021139
1,475
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList1", "signature": "def reverseList1(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList2", "signature": "def reverseList2(self, head)" }, { "docstring": ":type head...
3
stack_v2_sparse_classes_30k_train_016696
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList1(self, head): :type head: ListNode :rtype: ListNode - def reverseList2(self, head): :type head: ListNode :rtype: ListNode - def reverseList3(self, head): :type he...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList1(self, head): :type head: ListNode :rtype: ListNode - def reverseList2(self, head): :type head: ListNode :rtype: ListNode - def reverseList3(self, head): :type he...
8dfbb10a87d8a3fdde466ab16fff8b67503e41f4
<|skeleton|> class Solution: def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseList3(self, head): """:type head: ListNode :rtype: List...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList1(self, head): """:type head: ListNode :rtype: ListNode""" dummy = ListNode(0) while head: q = head.next head.next = dummy.next dummy.next = head head = q return dummy.next def reverseList2(self, head...
the_stack_v2_python_sparse
easy/0206.reverse-linked-list.py
codershenghai/PyLeetcode
train
0
e3ede257f882ebdd7d2420fd4520c6f46e7371c7
[ "data = dict()\ndata['north'] = game.north\ndata['east'] = game.east\ndata['south'] = game.south\ndata['west'] = game.west\ndata['northUrl'] = game.north_url\ndata['eastUrl'] = game.east_url\ndata['southUrl'] = game.south_url\ndata['westUrl'] = game.west_url\ndata['northId'] = game.north_id\ndata['eastId'] = game.e...
<|body_start_0|> data = dict() data['north'] = game.north data['east'] = game.east data['south'] = game.south data['west'] = game.west data['northUrl'] = game.north_url data['eastUrl'] = game.east_url data['southUrl'] = game.south_url data['westUrl...
Class for generation of the dict/json representation of a game (Game) and vice versa.
GameSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameSerializer: """Class for generation of the dict/json representation of a game (Game) and vice versa.""" def game_to_dict(game: Game) -> dict: """Generate dict for the game that corresponds to the json description. RoundGenerator is used to generate the rounds for the game. Args: ...
stack_v2_sparse_classes_36k_train_021140
2,604
no_license
[ { "docstring": "Generate dict for the game that corresponds to the json description. RoundGenerator is used to generate the rounds for the game. Args: game: the game to convert Returns: dict representation of the game that can be converted to json", "name": "game_to_dict", "signature": "def game_to_dict...
2
stack_v2_sparse_classes_30k_train_010459
Implement the Python class `GameSerializer` described below. Class description: Class for generation of the dict/json representation of a game (Game) and vice versa. Method signatures and docstrings: - def game_to_dict(game: Game) -> dict: Generate dict for the game that corresponds to the json description. RoundGene...
Implement the Python class `GameSerializer` described below. Class description: Class for generation of the dict/json representation of a game (Game) and vice versa. Method signatures and docstrings: - def game_to_dict(game: Game) -> dict: Generate dict for the game that corresponds to the json description. RoundGene...
73b59f773f138e390951849f982de865d4f667b5
<|skeleton|> class GameSerializer: """Class for generation of the dict/json representation of a game (Game) and vice versa.""" def game_to_dict(game: Game) -> dict: """Generate dict for the game that corresponds to the json description. RoundGenerator is used to generate the rounds for the game. Args: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameSerializer: """Class for generation of the dict/json representation of a game (Game) and vice versa.""" def game_to_dict(game: Game) -> dict: """Generate dict for the game that corresponds to the json description. RoundGenerator is used to generate the rounds for the game. Args: game: the gam...
the_stack_v2_python_sparse
source/jass/ion/game_serializer.py
FAIKUE/DL4G
train
0
c9609a40c4a9a4913b961d70967237983afb7a9d
[ "if state.func_ir is None:\n pm.add_pass(TranslateByteCode, 'analyzing bytecode')\n pm.add_pass(FixupArgs, 'fix up args')\npm.add_pass(IRProcessing, 'processing IR')\npm.add_pass(WithLifting, 'Handle with contexts')\npm.add_pass(DPPYRewriteOverloadedNumPyFunctions, 'Rewrite name of Numpy functions to overload...
<|body_start_0|> if state.func_ir is None: pm.add_pass(TranslateByteCode, 'analyzing bytecode') pm.add_pass(FixupArgs, 'fix up args') pm.add_pass(IRProcessing, 'processing IR') pm.add_pass(WithLifting, 'Handle with contexts') pm.add_pass(DPPYRewriteOverloadedNumPy...
This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.
DPPYPassBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DPPYPassBuilder: """This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.""" def default_numba_nopython_pipeline(state, pm): """Adds the default set of NUMBA passes to t...
stack_v2_sparse_classes_36k_train_021141
5,412
permissive
[ { "docstring": "Adds the default set of NUMBA passes to the pass manager", "name": "default_numba_nopython_pipeline", "signature": "def default_numba_nopython_pipeline(state, pm)" }, { "docstring": "Returns an nopython mode pipeline based PassManager", "name": "define_nopython_pipeline", ...
2
stack_v2_sparse_classes_30k_train_000213
Implement the Python class `DPPYPassBuilder` described below. Class description: This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes. Method signatures and docstrings: - def default_numba_nopython_pipel...
Implement the Python class `DPPYPassBuilder` described below. Class description: This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes. Method signatures and docstrings: - def default_numba_nopython_pipel...
f8b3cc81b65ba75d126c8b3cb603d752eb681c7e
<|skeleton|> class DPPYPassBuilder: """This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.""" def default_numba_nopython_pipeline(state, pm): """Adds the default set of NUMBA passes to t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DPPYPassBuilder: """This is the DPPY pass builder to run Intel GPU/CPU specific code-generation and optimization passes. This pass builder does not offer objectmode and interpreted passes.""" def default_numba_nopython_pipeline(state, pm): """Adds the default set of NUMBA passes to the pass manag...
the_stack_v2_python_sparse
numba_dppy/dppy_passbuilder.py
FermiQ/numba-dppy
train
0
cb04213c180ce25631f43d4739d8ddd8e1744d3a
[ "if nickname is None:\n nickname = generate_unique_nickname(self.model)\nif not email:\n raise ValueError(_('The Email must be set'))\nemail = self.normalize_email(email)\nuser = self.model(email=email, nickname=nickname, **extra_fields)\nif password:\n user.set_password(password)\nuser.save()\nreturn user...
<|body_start_0|> if nickname is None: nickname = generate_unique_nickname(self.model) if not email: raise ValueError(_('The Email must be set')) email = self.normalize_email(email) user = self.model(email=email, nickname=nickname, **extra_fields) if passwo...
Custom user model manager where email is the unique identifiers for authentication instead of usernames.
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password=None, nickname=None, **extra_fields): """Create and save a User with the given email and password.""" <|body...
stack_v2_sparse_classes_36k_train_021142
4,344
no_license
[ { "docstring": "Create and save a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password=None, nickname=None, **extra_fields)" }, { "docstring": "Create and save a SuperUser with the given email and password.", "name": "create_sup...
2
stack_v2_sparse_classes_30k_train_015977
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where email is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, email, password=None, nickname=None, **extra_fields): Create and save a ...
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where email is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, email, password=None, nickname=None, **extra_fields): Create and save a ...
2faa927c60d8b3d27a2a0e8160a60ae647528c49
<|skeleton|> class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password=None, nickname=None, **extra_fields): """Create and save a User with the given email and password.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password=None, nickname=None, **extra_fields): """Create and save a User with the given email and password.""" if nickname is None...
the_stack_v2_python_sparse
backend/project_alpha/web/models.py
asynccat/project-alpha
train
1
5d5c2f9b05352c0372222d7d6328a8f1e949c951
[ "channel = plexus.info\ncfg = self.pyre_configurator\nchannel.indent()\nfor uri, priority in cfg.sources:\n channel.line(f\"{uri}, priority '{priority.name}'\")\nchannel.outdent()\nchannel.log()\nreturn 0", "channel = plexus.info\nprefix = 'merlin' if self.root is None else self.root\nnameserver = self.pyre_na...
<|body_start_0|> channel = plexus.info cfg = self.pyre_configurator channel.indent() for uri, priority in cfg.sources: channel.line(f"{uri}, priority '{priority.name}'") channel.outdent() channel.log() return 0 <|end_body_0|> <|body_start_1|> ...
Display debugging information about this application
Debug
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Debug: """Display debugging information about this application""" def config(self, plexus, **kwds): """Generate a list of encountered configuration files""" <|body_0|> def nfs(self, plexus, **kwds): """Dump the application configuration namespace""" <|bod...
stack_v2_sparse_classes_36k_train_021143
3,984
permissive
[ { "docstring": "Generate a list of encountered configuration files", "name": "config", "signature": "def config(self, plexus, **kwds)" }, { "docstring": "Dump the application configuration namespace", "name": "nfs", "signature": "def nfs(self, plexus, **kwds)" }, { "docstring": "...
3
null
Implement the Python class `Debug` described below. Class description: Display debugging information about this application Method signatures and docstrings: - def config(self, plexus, **kwds): Generate a list of encountered configuration files - def nfs(self, plexus, **kwds): Dump the application configuration names...
Implement the Python class `Debug` described below. Class description: Display debugging information about this application Method signatures and docstrings: - def config(self, plexus, **kwds): Generate a list of encountered configuration files - def nfs(self, plexus, **kwds): Dump the application configuration names...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Debug: """Display debugging information about this application""" def config(self, plexus, **kwds): """Generate a list of encountered configuration files""" <|body_0|> def nfs(self, plexus, **kwds): """Dump the application configuration namespace""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Debug: """Display debugging information about this application""" def config(self, plexus, **kwds): """Generate a list of encountered configuration files""" channel = plexus.info cfg = self.pyre_configurator channel.indent() for uri, priority in cfg.sources: ...
the_stack_v2_python_sparse
packages/merlin/cli/Debug.py
pyre/pyre
train
27
5bde3085aee87c16027318b0f8d74907ab245659
[ "if self._state is None:\n raise DiscordException('Invalid state (no ConnectionState provided)')\nreturn await self._state.http.get_from_cdn(self.url)", "data = await self.read()\nif isinstance(fp, io.BufferedIOBase):\n written = fp.write(data)\n if seek_begin:\n fp.seek(0)\n return written\nel...
<|body_start_0|> if self._state is None: raise DiscordException('Invalid state (no ConnectionState provided)') return await self._state.http.get_from_cdn(self.url) <|end_body_0|> <|body_start_1|> data = await self.read() if isinstance(fp, io.BufferedIOBase): writ...
AssetMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssetMixin: async def read(self) -> bytes: """|coro| Retrieves the content of this asset as a :class:`bytes` object. Raises ------ DiscordException There was no internal connection state. HTTPException Downloading the asset failed. NotFound The asset was deleted. Returns ------- :class:`...
stack_v2_sparse_classes_36k_train_021144
15,837
permissive
[ { "docstring": "|coro| Retrieves the content of this asset as a :class:`bytes` object. Raises ------ DiscordException There was no internal connection state. HTTPException Downloading the asset failed. NotFound The asset was deleted. Returns ------- :class:`bytes` The content of the asset.", "name": "read",...
3
stack_v2_sparse_classes_30k_train_003652
Implement the Python class `AssetMixin` described below. Class description: Implement the AssetMixin class. Method signatures and docstrings: - async def read(self) -> bytes: |coro| Retrieves the content of this asset as a :class:`bytes` object. Raises ------ DiscordException There was no internal connection state. H...
Implement the Python class `AssetMixin` described below. Class description: Implement the AssetMixin class. Method signatures and docstrings: - async def read(self) -> bytes: |coro| Retrieves the content of this asset as a :class:`bytes` object. Raises ------ DiscordException There was no internal connection state. H...
f74eb14d722aa1bc90f9d0478199250d2eb4e81b
<|skeleton|> class AssetMixin: async def read(self) -> bytes: """|coro| Retrieves the content of this asset as a :class:`bytes` object. Raises ------ DiscordException There was no internal connection state. HTTPException Downloading the asset failed. NotFound The asset was deleted. Returns ------- :class:`...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssetMixin: async def read(self) -> bytes: """|coro| Retrieves the content of this asset as a :class:`bytes` object. Raises ------ DiscordException There was no internal connection state. HTTPException Downloading the asset failed. NotFound The asset was deleted. Returns ------- :class:`bytes` The con...
the_stack_v2_python_sparse
discord/asset.py
Rapptz/discord.py
train
15,894
fff7b890da23348a6c8b6afa9e22bb9afec32872
[ "article = ArticleInst.fetch(slug)\nCommentAPIView.check_comment(article=article, key=id)\ncomment_reply = self.get_reply(parent=id, child=key)\nserializer = self.serializer_class(comment_reply)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)", "article = ArticleInst.fetch(slug)\nupdated_reply =...
<|body_start_0|> article = ArticleInst.fetch(slug) CommentAPIView.check_comment(article=article, key=id) comment_reply = self.get_reply(parent=id, child=key) serializer = self.serializer_class(comment_reply) return Response(data=serializer.data, status=status.HTTP_200_OK) <|end_b...
Creates, Updates and Deletes a single reply to an article comment
ReplyAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplyAPIView: """Creates, Updates and Deletes a single reply to an article comment""" def get(self, request, slug, id, key): """Fetches a comment on an article""" <|body_0|> def update(self, request, slug, id, key): """Updates a reply to a comment""" <|bo...
stack_v2_sparse_classes_36k_train_021145
10,918
permissive
[ { "docstring": "Fetches a comment on an article", "name": "get", "signature": "def get(self, request, slug, id, key)" }, { "docstring": "Updates a reply to a comment", "name": "update", "signature": "def update(self, request, slug, id, key)" }, { "docstring": "Removes a reply fro...
4
stack_v2_sparse_classes_30k_train_021360
Implement the Python class `ReplyAPIView` described below. Class description: Creates, Updates and Deletes a single reply to an article comment Method signatures and docstrings: - def get(self, request, slug, id, key): Fetches a comment on an article - def update(self, request, slug, id, key): Updates a reply to a co...
Implement the Python class `ReplyAPIView` described below. Class description: Creates, Updates and Deletes a single reply to an article comment Method signatures and docstrings: - def get(self, request, slug, id, key): Fetches a comment on an article - def update(self, request, slug, id, key): Updates a reply to a co...
b80ad485339dbb02b74d9b2093543bf8173d51de
<|skeleton|> class ReplyAPIView: """Creates, Updates and Deletes a single reply to an article comment""" def get(self, request, slug, id, key): """Fetches a comment on an article""" <|body_0|> def update(self, request, slug, id, key): """Updates a reply to a comment""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReplyAPIView: """Creates, Updates and Deletes a single reply to an article comment""" def get(self, request, slug, id, key): """Fetches a comment on an article""" article = ArticleInst.fetch(slug) CommentAPIView.check_comment(article=article, key=id) comment_reply = self.g...
the_stack_v2_python_sparse
authors/apps/comments/views.py
deferral/ah-django
train
1
b4dad595eae579aca50a8bd7ccf4d3a3ee509cd9
[ "if start > stop:\n stop, start = (start, stop)\nself.start, self.stop = (start, stop)", "if value < self.start or value > self.stop:\n raise error.ValueConstraintError('%s for %r: value %s not within allowed range: %s through %s' % (self.__class__.__name__, client.__class__.__name__, str(value), self.start...
<|body_start_0|> if start > stop: stop, start = (start, stop) self.start, self.stop = (start, stop) <|end_body_0|> <|body_start_1|> if value < self.start or value > self.stop: raise error.ValueConstraintError('%s for %r: value %s not within allowed range: %s through %s' ...
Value must be within start and stop values (inclusive)
ValueRangeConstraint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueRangeConstraint: """Value must be within start and stop values (inclusive)""" def __init__(self, start, stop): """Initialise the SingleValueConstraint with items start -- value below which errors are raised stop -- value above which errors are raised""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_021146
3,782
no_license
[ { "docstring": "Initialise the SingleValueConstraint with items start -- value below which errors are raised stop -- value above which errors are raised", "name": "__init__", "signature": "def __init__(self, start, stop)" }, { "docstring": "Raise errors if value not appropriate for client", ...
2
stack_v2_sparse_classes_30k_train_020510
Implement the Python class `ValueRangeConstraint` described below. Class description: Value must be within start and stop values (inclusive) Method signatures and docstrings: - def __init__(self, start, stop): Initialise the SingleValueConstraint with items start -- value below which errors are raised stop -- value a...
Implement the Python class `ValueRangeConstraint` described below. Class description: Value must be within start and stop values (inclusive) Method signatures and docstrings: - def __init__(self, start, stop): Initialise the SingleValueConstraint with items start -- value below which errors are raised stop -- value a...
256401ac313df2e45c516af1a4d5398f54703b9c
<|skeleton|> class ValueRangeConstraint: """Value must be within start and stop values (inclusive)""" def __init__(self, start, stop): """Initialise the SingleValueConstraint with items start -- value below which errors are raised stop -- value above which errors are raised""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueRangeConstraint: """Value must be within start and stop values (inclusive)""" def __init__(self, start, stop): """Initialise the SingleValueConstraint with items start -- value below which errors are raised stop -- value above which errors are raised""" if start > stop: s...
the_stack_v2_python_sparse
pre/python/lib/python2.7/dist-packages/pysnmp/asn1/constraints.py
ag1455/OpenPLi-PC
train
27
47a075b0f30584e16a3c4366d311b5cad5b685a0
[ "if char == '-':\n return True\nelse:\n return False", "if char.isnumeric():\n return True\nelif self.special_char(char):\n return True\nelse:\n return False", "localstore = []\nfor elem in date:\n bval = self.check_and_store(elem)\n if bval:\n localstore.append(elem)\nresult = ''.jo...
<|body_start_0|> if char == '-': return True else: return False <|end_body_0|> <|body_start_1|> if char.isnumeric(): return True elif self.special_char(char): return True else: return False <|end_body_1|> <|body_start_...
ValidDate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidDate: def special_char(self, char): """Check to see if char is in a list of special date chars""" <|body_0|> def check_and_store(self, char): """Check to see if each char is a number or a special char in my list.""" <|body_1|> def remove_unwanted_ch...
stack_v2_sparse_classes_36k_train_021147
1,269
permissive
[ { "docstring": "Check to see if char is in a list of special date chars", "name": "special_char", "signature": "def special_char(self, char)" }, { "docstring": "Check to see if each char is a number or a special char in my list.", "name": "check_and_store", "signature": "def check_and_st...
3
stack_v2_sparse_classes_30k_train_010118
Implement the Python class `ValidDate` described below. Class description: Implement the ValidDate class. Method signatures and docstrings: - def special_char(self, char): Check to see if char is in a list of special date chars - def check_and_store(self, char): Check to see if each char is a number or a special char...
Implement the Python class `ValidDate` described below. Class description: Implement the ValidDate class. Method signatures and docstrings: - def special_char(self, char): Check to see if char is in a list of special date chars - def check_and_store(self, char): Check to see if each char is a number or a special char...
af80bedfb3e770171f61a505a6715836feb0ed10
<|skeleton|> class ValidDate: def special_char(self, char): """Check to see if char is in a list of special date chars""" <|body_0|> def check_and_store(self, char): """Check to see if each char is a number or a special char in my list.""" <|body_1|> def remove_unwanted_ch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidDate: def special_char(self, char): """Check to see if char is in a list of special date chars""" if char == '-': return True else: return False def check_and_store(self, char): """Check to see if each char is a number or a special char in my l...
the_stack_v2_python_sparse
date/validate.py
stormalone/python-examples
train
0
8f628d9883f132531e7589e207ab2ae7091bff3e
[ "target_type = value.type.target()\nprint(\"'%s' is an array of '%s'.\" % (expr, str(target_type)))\nindex = 0\ntry:\n index = int(raw_input(\"Enter the index of the element you want to explore in '%s': \" % expr))\nexcept ValueError:\n if is_child:\n Explorer.return_to_parent_value()\n return False...
<|body_start_0|> target_type = value.type.target() print("'%s' is an array of '%s'." % (expr, str(target_type))) index = 0 try: index = int(raw_input("Enter the index of the element you want to explore in '%s': " % expr)) except ValueError: if is_child: ...
Internal class used to explore arrays.
ArrayExplorer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArrayExplorer: """Internal class used to explore arrays.""" def explore_expr(expr, value, is_child): """Function to explore array values. See Explorer.explore_expr for more information.""" <|body_0|> def explore_type(name, datatype, is_child): """Function to expl...
stack_v2_sparse_classes_36k_train_021148
26,692
permissive
[ { "docstring": "Function to explore array values. See Explorer.explore_expr for more information.", "name": "explore_expr", "signature": "def explore_expr(expr, value, is_child)" }, { "docstring": "Function to explore array types. See Explorer.explore_type for more information.", "name": "ex...
2
stack_v2_sparse_classes_30k_train_016484
Implement the Python class `ArrayExplorer` described below. Class description: Internal class used to explore arrays. Method signatures and docstrings: - def explore_expr(expr, value, is_child): Function to explore array values. See Explorer.explore_expr for more information. - def explore_type(name, datatype, is_chi...
Implement the Python class `ArrayExplorer` described below. Class description: Internal class used to explore arrays. Method signatures and docstrings: - def explore_expr(expr, value, is_child): Function to explore array values. See Explorer.explore_expr for more information. - def explore_type(name, datatype, is_chi...
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
<|skeleton|> class ArrayExplorer: """Internal class used to explore arrays.""" def explore_expr(expr, value, is_child): """Function to explore array values. See Explorer.explore_expr for more information.""" <|body_0|> def explore_type(name, datatype, is_child): """Function to expl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArrayExplorer: """Internal class used to explore arrays.""" def explore_expr(expr, value, is_child): """Function to explore array values. See Explorer.explore_expr for more information.""" target_type = value.type.target() print("'%s' is an array of '%s'." % (expr, str(target_type...
the_stack_v2_python_sparse
toolchain/riscv/Linux/share/gdb/python/gdb/command/explore.py
bouffalolab/bl_iot_sdk
train
244
b1bf98d5a2673a7878b261bdf63093cff0a8f234
[ "cluster = check_obj(Cluster, cluster_id, 'CLUSTER_NOT_FOUND')\nobj = self.filter_queryset(self.get_queryset().filter(cluster=cluster))\nreturn self.get_page(obj, request, {'cluster_id': cluster_id})", "cluster = check_obj(Cluster, cluster_id, 'CLUSTER_NOT_FOUND')\nserializer = self.serializer_class(data=request....
<|body_start_0|> cluster = check_obj(Cluster, cluster_id, 'CLUSTER_NOT_FOUND') obj = self.filter_queryset(self.get_queryset().filter(cluster=cluster)) return self.get_page(obj, request, {'cluster_id': cluster_id}) <|end_body_0|> <|body_start_1|> cluster = check_obj(Cluster, cluster_id, ...
ClusterServiceList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterServiceList: def get(self, request, cluster_id): """List all services of a specified cluster""" <|body_0|> def post(self, request, cluster_id): """Add service to specified cluster""" <|body_1|> <|end_skeleton|> <|body_start_0|> cluster = chec...
stack_v2_sparse_classes_36k_train_021149
32,530
permissive
[ { "docstring": "List all services of a specified cluster", "name": "get", "signature": "def get(self, request, cluster_id)" }, { "docstring": "Add service to specified cluster", "name": "post", "signature": "def post(self, request, cluster_id)" } ]
2
stack_v2_sparse_classes_30k_train_018391
Implement the Python class `ClusterServiceList` described below. Class description: Implement the ClusterServiceList class. Method signatures and docstrings: - def get(self, request, cluster_id): List all services of a specified cluster - def post(self, request, cluster_id): Add service to specified cluster
Implement the Python class `ClusterServiceList` described below. Class description: Implement the ClusterServiceList class. Method signatures and docstrings: - def get(self, request, cluster_id): List all services of a specified cluster - def post(self, request, cluster_id): Add service to specified cluster <|skelet...
e1c67e3041437ad9e17dccc6c95c5ac02184eddb
<|skeleton|> class ClusterServiceList: def get(self, request, cluster_id): """List all services of a specified cluster""" <|body_0|> def post(self, request, cluster_id): """Add service to specified cluster""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterServiceList: def get(self, request, cluster_id): """List all services of a specified cluster""" cluster = check_obj(Cluster, cluster_id, 'CLUSTER_NOT_FOUND') obj = self.filter_queryset(self.get_queryset().filter(cluster=cluster)) return self.get_page(obj, request, {'clus...
the_stack_v2_python_sparse
api/cluster_views.py
amleshkov/adcm
train
0
c3b1c63209d2f1edf1c70b162fbd6e234dd3b83a
[ "self.size = float(size)\nself.currentSize = 0\nself.avg = 0\nself.queue = []", "self.queue.append(val)\nif self.currentSize == 0:\n self.avg = val\n self.currentSize = 1\n return val\nelif self.currentSize < self.size:\n self.avg = float(self.avg * self.currentSize + val) / (self.currentSize + 1)\n ...
<|body_start_0|> self.size = float(size) self.currentSize = 0 self.avg = 0 self.queue = [] <|end_body_0|> <|body_start_1|> self.queue.append(val) if self.currentSize == 0: self.avg = val self.currentSize = 1 return val elif sel...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.size = float(size) self....
stack_v2_sparse_classes_36k_train_021150
782
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
null
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.size = float(size) self.currentSize = 0 self.avg = 0 self.queue = [] def next(self, val): """:type val: int :rtype: float""" self.queue.append(v...
the_stack_v2_python_sparse
python/346.MovingAverageFromDataStream.py
MaxPoon/Leetcode
train
15
ba7c15ad207b7ca496aae16e0813f29e05dc157d
[ "self.trie = Trie()\nself.historical_sentence = ''\nself.dct = {}\nfor sentence, count in zip(sentences, times):\n self.trie.insert(sentence, count)\n self.dct[sentence] = count", "if c == '#':\n self.trie.insert(self.historical_sentence, 1)\n self.historical_sentence = ''\n return []\nelse:\n s...
<|body_start_0|> self.trie = Trie() self.historical_sentence = '' self.dct = {} for sentence, count in zip(sentences, times): self.trie.insert(sentence, count) self.dct[sentence] = count <|end_body_0|> <|body_start_1|> if c == '#': self.trie.i...
AutocompleteSystem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.trie = Trie() ...
stack_v2_sparse_classes_36k_train_021151
2,307
permissive
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
null
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
1f30ea37af7b60585d168b15d9397143f53c92a1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.trie = Trie() self.historical_sentence = '' self.dct = {} for sentence, count in zip(sentences, times): self.trie.insert(sentence, count) ...
the_stack_v2_python_sparse
design_search_autocomplete_system.py
pranavdave893/Leetcode
train
0
89a228e893e87b20035e03a43537bcf5d1fcf929
[ "super(MaDTwinNet, self).__init__()\nself.mad = MaD(rnn_enc_input_dim=rnn_enc_input_dim, rnn_dec_input_dim=rnn_dec_input_dim, context_length=context_length, original_input_dim=original_input_dim)\nself.twin_net = TwinNet(rnn_dec_input_dim=rnn_dec_input_dim, original_input_dim=original_input_dim, context_length=cont...
<|body_start_0|> super(MaDTwinNet, self).__init__() self.mad = MaD(rnn_enc_input_dim=rnn_enc_input_dim, rnn_dec_input_dim=rnn_dec_input_dim, context_length=context_length, original_input_dim=original_input_dim) self.twin_net = TwinNet(rnn_dec_input_dim=rnn_dec_input_dim, original_input_dim=origi...
MaDTwinNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaDTwinNet: def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): """The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dime...
stack_v2_sparse_classes_36k_train_021152
16,858
no_license
[ { "docstring": "The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dimensionality of the RNN encoder. :type rnn_enc_input_dim: int :param rnn_dec_input_dim: The input dimensionality of the...
2
null
Implement the Python class `MaDTwinNet` described below. Class description: Implement the MaDTwinNet class. Method signatures and docstrings: - def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): The MaD TwinNet as a module. This class implements the MaD TwinNet as a module a...
Implement the Python class `MaDTwinNet` described below. Class description: Implement the MaDTwinNet class. Method signatures and docstrings: - def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): The MaD TwinNet as a module. This class implements the MaD TwinNet as a module a...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MaDTwinNet: def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): """The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dime...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaDTwinNet: def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): """The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dimensionality of ...
the_stack_v2_python_sparse
generated/test_dr_costas_mad_twinnet.py
jansel/pytorch-jit-paritybench
train
35
89d2abb77bba966b4027cbed8649f19a85a05f83
[ "self.ui = ui\nself.file_list_display = FileListDisplay.FileListDisplay(ui=ui)\nself.directory_display = DirectoryDisplay.DirectoryDisplay(ui=ui)\nself.image_display = ImageDisplay.ImageDisplay(ui=ui)\nself.save_image = SaveImage.SaveImage(ui=ui, image_display_object=self.image_display)\nself.stream_display = Strea...
<|body_start_0|> self.ui = ui self.file_list_display = FileListDisplay.FileListDisplay(ui=ui) self.directory_display = DirectoryDisplay.DirectoryDisplay(ui=ui) self.image_display = ImageDisplay.ImageDisplay(ui=ui) self.save_image = SaveImage.SaveImage(ui=ui, image_display_object=...
NOTE: Any method defined in here is a slot intended to control multiple functions in the program (i.e. the clear may operate on the image display, the directory display and the application data).
Slots
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Slots: """NOTE: Any method defined in here is a slot intended to control multiple functions in the program (i.e. the clear may operate on the image display, the directory display and the application data).""" def __init__(self, ui: IPViewWindow): """Instantiation must be the last thi...
stack_v2_sparse_classes_36k_train_021153
4,194
no_license
[ { "docstring": "Instantiation must be the last thing the GUI does. :param ui: IPViewWindow object", "name": "__init__", "signature": "def __init__(self, ui: IPViewWindow)" }, { "docstring": "Slot method for next image called", "name": "next_button_pushed", "signature": "def next_button_p...
4
stack_v2_sparse_classes_30k_train_017438
Implement the Python class `Slots` described below. Class description: NOTE: Any method defined in here is a slot intended to control multiple functions in the program (i.e. the clear may operate on the image display, the directory display and the application data). Method signatures and docstrings: - def __init__(se...
Implement the Python class `Slots` described below. Class description: NOTE: Any method defined in here is a slot intended to control multiple functions in the program (i.e. the clear may operate on the image display, the directory display and the application data). Method signatures and docstrings: - def __init__(se...
840ff86d2d0bce76f09a10af97276d77ef120586
<|skeleton|> class Slots: """NOTE: Any method defined in here is a slot intended to control multiple functions in the program (i.e. the clear may operate on the image display, the directory display and the application data).""" def __init__(self, ui: IPViewWindow): """Instantiation must be the last thi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Slots: """NOTE: Any method defined in here is a slot intended to control multiple functions in the program (i.e. the clear may operate on the image display, the directory display and the application data).""" def __init__(self, ui: IPViewWindow): """Instantiation must be the last thing the GUI do...
the_stack_v2_python_sparse
ip_view_ui/signals_and_slots.py
nellyBoi/IPView
train
0
272d62e15bc6aac4ede42bffccb07a386e4d0f42
[ "self.__screen = screen\nself.__msg = TextboxReflowed(40, TIMEZONE_LABEL.localize())\nself.__list = Listbox(5, scroll=1, returnExit=1)\nself.__utc = Checkbox(TIMEZONE_UTC_CHECKBOX_LABEL.localize(), isOn=0)\nself.__buttonsBar = ButtonBar(self.__screen, [(OK.localize(), 'ok'), (BACK.localize(), 'back')])\nself.__grid...
<|body_start_0|> self.__screen = screen self.__msg = TextboxReflowed(40, TIMEZONE_LABEL.localize()) self.__list = Listbox(5, scroll=1, returnExit=1) self.__utc = Checkbox(TIMEZONE_UTC_CHECKBOX_LABEL.localize(), isOn=0) self.__buttonsBar = ButtonBar(self.__screen, [(OK.localize(),...
Represents the timezone screen
AdjustTimezone
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdjustTimezone: """Represents the timezone screen""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def run(self, tzentries): """Draws the screen @type tzentries: list @param tzentries: list ...
stack_v2_sparse_classes_36k_train_021154
1,972
no_license
[ { "docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance", "name": "__init__", "signature": "def __init__(self, screen)" }, { "docstring": "Draws the screen @type tzentries: list @param tzentries: list of timezone available @rtype: integer @returns: status of ope...
2
stack_v2_sparse_classes_30k_train_008657
Implement the Python class `AdjustTimezone` described below. Class description: Represents the timezone screen Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def run(self, tzentries): Draws the screen @type tzentries: list @p...
Implement the Python class `AdjustTimezone` described below. Class description: Represents the timezone screen Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def run(self, tzentries): Draws the screen @type tzentries: list @p...
1c738fd5e6ee3f8fd4f47acf2207038f20868212
<|skeleton|> class AdjustTimezone: """Represents the timezone screen""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def run(self, tzentries): """Draws the screen @type tzentries: list @param tzentries: list ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdjustTimezone: """Represents the timezone screen""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" self.__screen = screen self.__msg = TextboxReflowed(40, TIMEZONE_LABEL.localize()) self.__list = Listbox(5, scro...
the_stack_v2_python_sparse
zfrobisher-installer/src/viewer/newt/adjusttimezone.py
fedosu85nce/work
train
2
b7cb478d53c56b1c83410727ad572d4df8bdc6c7
[ "super(BaseToolchangerHands, self).__init__(parent)\nif not parent:\n return\nself._parent = parent\nself.handlight_l_command = HandlightCommand(self, self.HAND_L)\nself.handlight_r_command = HandlightCommand(self, self.HAND_R)\nself.toolchanger_l_command = ToolchangerCommand(self, self.HAND_L)\nself.toolchanger...
<|body_start_0|> super(BaseToolchangerHands, self).__init__(parent) if not parent: return self._parent = parent self.handlight_l_command = HandlightCommand(self, self.HAND_L) self.handlight_r_command = HandlightCommand(self, self.HAND_R) self.toolchanger_l_com...
This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands).
BaseToolchangerHands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseToolchangerHands: """This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands).""" def __init__(self, parent): ...
stack_v2_sparse_classes_36k_train_021155
2,200
permissive
[ { "docstring": "Since this class operates requires an access to hrpsys.hrpsys_config.HrpsysConfigurator, valid 'parent' is a must. Otherwise __init__ returns without doing anything. @type parent: hrpsys.hrpsys_config.HrpsysConfigurator @param parent: derived class of HrpsysConfigurator.", "name": "__init__"...
2
null
Implement the Python class `BaseToolchangerHands` described below. Class description: This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands). Meth...
Implement the Python class `BaseToolchangerHands` described below. Class description: This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands). Meth...
03c9e59779a30e2f6dedf2732ad8a46e6ac3c9f0
<|skeleton|> class BaseToolchangerHands: """This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands).""" def __init__(self, parent): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseToolchangerHands: """This class holds methods that are specific to the hands of NEXTAGE OPEN, accompanied with toolchanger. @deprecated: Since version 0.5.1, the functionality in this class is moved to other BaseHands subclasses (e.g. Iros13Hands).""" def __init__(self, parent): """Since this...
the_stack_v2_python_sparse
robot_con/nxt/nxtlib/base_toolchanger_hands.py
kazuki0824/wrs
train
1
44f771ad2aa9d61407b6fb37a4e9a9cc35dbd7df
[ "if len(s) < k:\n return 0\ncount = collections.Counter(s)\nbefore = 0\nresult = 0\nfor i in range(len(s) + 1):\n if i == len(s) and before == 0:\n return len(s)\n if i == len(s) or count[s[i]] < k:\n current = s[before:i]\n if current:\n result = max(result, self.longestSub...
<|body_start_0|> if len(s) < k: return 0 count = collections.Counter(s) before = 0 result = 0 for i in range(len(s) + 1): if i == len(s) and before == 0: return len(s) if i == len(s) or count[s[i]] < k: current =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring_v2(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < k: ...
stack_v2_sparse_classes_36k_train_021156
2,118
no_license
[ { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring", "signature": "def longestSubstring(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring_v2", "signature": "def longestSubstring_v2(self, s, k)" } ]
2
stack_v2_sparse_classes_30k_train_021144
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring_v2(self, s, k): :type s: str :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring_v2(self, s, k): :type s: str :type k: int :rtype: int <|skeleton|> class Solution:...
d6ddbef76dd8630234f669d272d1f8065c6be128
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring_v2(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" if len(s) < k: return 0 count = collections.Counter(s) before = 0 result = 0 for i in range(len(s) + 1): if i == len(s) and before == 0: ...
the_stack_v2_python_sparse
395. Longest Substring with At Least K Repeating Characters.py
Mang0o/leetcode
train
0
50ee6c42e5887c920deac350469bf42a47979829
[ "top_left = Vector(position.x, position.y + size.y)\nbottom_right = Vector(top_left.x + size.x, top_left.y - size.y)\nvertices = [bottom_right.x, bottom_right.y, bottom_right.x, top_left.y, top_left.x, top_left.y, top_left.x, bottom_right.y]\nif texture_coords is None:\n texture_coords = [tex_max, tex_min, tex_m...
<|body_start_0|> top_left = Vector(position.x, position.y + size.y) bottom_right = Vector(top_left.x + size.x, top_left.y - size.y) vertices = [bottom_right.x, bottom_right.y, bottom_right.x, top_left.y, top_left.x, top_left.y, top_left.x, bottom_right.y] if texture_coords is None: ...
Renderer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Renderer: def textured_rectangle(batch: pyglet.graphics.Batch, texture_group: pyglet.graphics.TextureGroup, position: Vector, size: Vector, tex_max: float=1.0, tex_min: float=0.0, texture_coords: List[float]=None): """:param batch: :param texture_group: :param position: bottom left of re...
stack_v2_sparse_classes_36k_train_021157
6,334
no_license
[ { "docstring": ":param batch: :param texture_group: :param position: bottom left of rectangle :param size: :param tex_max: :param tex_min: :param texture_coords: :return:", "name": "textured_rectangle", "signature": "def textured_rectangle(batch: pyglet.graphics.Batch, texture_group: pyglet.graphics.Tex...
3
stack_v2_sparse_classes_30k_train_009298
Implement the Python class `Renderer` described below. Class description: Implement the Renderer class. Method signatures and docstrings: - def textured_rectangle(batch: pyglet.graphics.Batch, texture_group: pyglet.graphics.TextureGroup, position: Vector, size: Vector, tex_max: float=1.0, tex_min: float=0.0, texture_...
Implement the Python class `Renderer` described below. Class description: Implement the Renderer class. Method signatures and docstrings: - def textured_rectangle(batch: pyglet.graphics.Batch, texture_group: pyglet.graphics.TextureGroup, position: Vector, size: Vector, tex_max: float=1.0, tex_min: float=0.0, texture_...
4db01d81b5f153e0bfadd76eab7f7bdc2c53027a
<|skeleton|> class Renderer: def textured_rectangle(batch: pyglet.graphics.Batch, texture_group: pyglet.graphics.TextureGroup, position: Vector, size: Vector, tex_max: float=1.0, tex_min: float=0.0, texture_coords: List[float]=None): """:param batch: :param texture_group: :param position: bottom left of re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Renderer: def textured_rectangle(batch: pyglet.graphics.Batch, texture_group: pyglet.graphics.TextureGroup, position: Vector, size: Vector, tex_max: float=1.0, tex_min: float=0.0, texture_coords: List[float]=None): """:param batch: :param texture_group: :param position: bottom left of rectangle :param...
the_stack_v2_python_sparse
tower_defense/graphics.py
henne90gen/tower_defense
train
1
455a8279a99adf6ea41ac7e11a65df30b753d121
[ "room_id = kwargs['pk']\nroom = Room.objects.get(id=room_id)\nform = self.get_form()\nif form.is_valid():\n return self.form_valid(form, room)\nelse:\n return self.form_invalid(form)", "row = form.cleaned_data.get('row')\nseats_quantity = form.cleaned_data.get('seats_quantity')\nfor i in range(1, seats_quan...
<|body_start_0|> room_id = kwargs['pk'] room = Room.objects.get(id=room_id) form = self.get_form() if form.is_valid(): return self.form_valid(form, room) else: return self.form_invalid(form) <|end_body_0|> <|body_start_1|> row = form.cleaned_data....
AddSeatRow
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddSeatRow: def post(self, request, *args, **kwargs): """Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid.""" <|body_0|> def form_valid(self, form, room): """If the form is valid, redirect to the supplied U...
stack_v2_sparse_classes_36k_train_021158
3,132
permissive
[ { "docstring": "Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "If the form is valid, redirect to the supplied URL.", "name": "form_vali...
3
stack_v2_sparse_classes_30k_train_016849
Implement the Python class `AddSeatRow` described below. Class description: Implement the AddSeatRow class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid. - def form_valid(self...
Implement the Python class `AddSeatRow` described below. Class description: Implement the AddSeatRow class. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid. - def form_valid(self...
d417895904c1a12ba2a9d761d7e60be77b7bcac2
<|skeleton|> class AddSeatRow: def post(self, request, *args, **kwargs): """Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid.""" <|body_0|> def form_valid(self, form, room): """If the form is valid, redirect to the supplied U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddSeatRow: def post(self, request, *args, **kwargs): """Handle POST requests: instantiate a form instance with the passed POST variables and then check if it's valid.""" room_id = kwargs['pk'] room = Room.objects.get(id=room_id) form = self.get_form() if form.is_valid(...
the_stack_v2_python_sparse
ticketflix/room/views.py
DSW-2018-2/Ticketflix
train
3
016b9740c041f6f6e232d6857acb5954adc8a8d3
[ "if not rent_item.user:\n return -9999\nweight = 0\nweight += RentAllocationMatrixWeigher._promo_code(rent_item)\nweight += RentAllocationMatrixWeigher._buy_threshold(rent_item)\nweight += RentAllocationMatrixWeigher._trade_threshold(rent_item)\nweight += RentAllocationMatrixWeigher._rental_threshold(rent_item)\...
<|body_start_0|> if not rent_item.user: return -9999 weight = 0 weight += RentAllocationMatrixWeigher._promo_code(rent_item) weight += RentAllocationMatrixWeigher._buy_threshold(rent_item) weight += RentAllocationMatrixWeigher._trade_threshold(rent_item) weigh...
RentAllocationMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RentAllocationMatrix: def calculate_weight(rent_item): """Calculates weight for ``RentList`` instance based on rent allocation weights (e.g. ``RentAllocationMatrixWeigher._promo_code()``, ``RentAllocationMatrixWeigher._buy_threshold()``) Arguments: - ``rent_item``: ``RentList`` instance"...
stack_v2_sparse_classes_36k_train_021159
8,068
no_license
[ { "docstring": "Calculates weight for ``RentList`` instance based on rent allocation weights (e.g. ``RentAllocationMatrixWeigher._promo_code()``, ``RentAllocationMatrixWeigher._buy_threshold()``) Arguments: - ``rent_item``: ``RentList`` instance", "name": "calculate_weight", "signature": "def calculate_...
2
null
Implement the Python class `RentAllocationMatrix` described below. Class description: Implement the RentAllocationMatrix class. Method signatures and docstrings: - def calculate_weight(rent_item): Calculates weight for ``RentList`` instance based on rent allocation weights (e.g. ``RentAllocationMatrixWeigher._promo_c...
Implement the Python class `RentAllocationMatrix` described below. Class description: Implement the RentAllocationMatrix class. Method signatures and docstrings: - def calculate_weight(rent_item): Calculates weight for ``RentList`` instance based on rent allocation weights (e.g. ``RentAllocationMatrixWeigher._promo_c...
7c3acc39a24c38ae2ee06b71104a24cfbbde8453
<|skeleton|> class RentAllocationMatrix: def calculate_weight(rent_item): """Calculates weight for ``RentList`` instance based on rent allocation weights (e.g. ``RentAllocationMatrixWeigher._promo_code()``, ``RentAllocationMatrixWeigher._buy_threshold()``) Arguments: - ``rent_item``: ``RentList`` instance"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RentAllocationMatrix: def calculate_weight(rent_item): """Calculates weight for ``RentList`` instance based on rent allocation weights (e.g. ``RentAllocationMatrixWeigher._promo_code()``, ``RentAllocationMatrixWeigher._buy_threshold()``) Arguments: - ``rent_item``: ``RentList`` instance""" if ...
the_stack_v2_python_sparse
project/rent/allocation_matrix.py
chrisblythe812/gamemine
train
1
c3e3a17c7372f57758639d672960ab9959474087
[ "cmd = ['python']\nif unbuffered:\n cmd.append('-u')\ncmd.append(script)\nreturn self.m.step(name, cmd + list(args or []), **kwargs)", "program = textwrap.dedent(program)\ncompile(program, '<string>', 'exec', dont_inherit=1)\ntry:\n self(name, self.m.raw_io.input(program, '.py'), **kwargs)\nfinally:\n re...
<|body_start_0|> cmd = ['python'] if unbuffered: cmd.append('-u') cmd.append(script) return self.m.step(name, cmd + list(args or []), **kwargs) <|end_body_0|> <|body_start_1|> program = textwrap.dedent(program) compile(program, '<string>', 'exec', dont_inheri...
PythonApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PythonApi: def __call__(self, name, script, args=None, unbuffered=True, **kwargs): """Return a step to run a python script with arguments.""" <|body_0|> def inline(self, name, program, add_python_log=True, **kwargs): """Run an inline python program as a step. Program...
stack_v2_sparse_classes_36k_train_021160
1,514
no_license
[ { "docstring": "Return a step to run a python script with arguments.", "name": "__call__", "signature": "def __call__(self, name, script, args=None, unbuffered=True, **kwargs)" }, { "docstring": "Run an inline python program as a step. Program is output to a temp file and run when this step exec...
3
null
Implement the Python class `PythonApi` described below. Class description: Implement the PythonApi class. Method signatures and docstrings: - def __call__(self, name, script, args=None, unbuffered=True, **kwargs): Return a step to run a python script with arguments. - def inline(self, name, program, add_python_log=Tr...
Implement the Python class `PythonApi` described below. Class description: Implement the PythonApi class. Method signatures and docstrings: - def __call__(self, name, script, args=None, unbuffered=True, **kwargs): Return a step to run a python script with arguments. - def inline(self, name, program, add_python_log=Tr...
237c7e2c8fd3cf632f3bcdc9cc5da2d47ea7f153
<|skeleton|> class PythonApi: def __call__(self, name, script, args=None, unbuffered=True, **kwargs): """Return a step to run a python script with arguments.""" <|body_0|> def inline(self, name, program, add_python_log=True, **kwargs): """Run an inline python program as a step. Program...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PythonApi: def __call__(self, name, script, args=None, unbuffered=True, **kwargs): """Return a step to run a python script with arguments.""" cmd = ['python'] if unbuffered: cmd.append('-u') cmd.append(script) return self.m.step(name, cmd + list(args or []),...
the_stack_v2_python_sparse
scripts/slave/recipe_modules/python/api.py
bopopescu/build_internal
train
0
8fb1c65061fa08f4f637af5618feb1ee1c532255
[ "if not structure.is_ordered:\n raise ValueError('ASE Atoms only supports ordered structures')\nsymbols = [str(site.specie.symbol) for site in structure]\npositions = [site.coords for site in structure]\ncell = structure.lattice.matrix\nreturn Atoms(symbols=symbols, positions=positions, pbc=True, cell=cell, **kw...
<|body_start_0|> if not structure.is_ordered: raise ValueError('ASE Atoms only supports ordered structures') symbols = [str(site.specie.symbol) for site in structure] positions = [site.coords for site in structure] cell = structure.lattice.matrix return Atoms(symbols=...
Adaptor serves as a bridge between ASE Atoms and pymatgen structure.
AseAtomsAdaptor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AseAtomsAdaptor: """Adaptor serves as a bridge between ASE Atoms and pymatgen structure.""" def get_atoms(structure, **kwargs): """Returns ASE Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure **kwargs: other keyword args to pass into the ASE At...
stack_v2_sparse_classes_36k_train_021161
2,031
permissive
[ { "docstring": "Returns ASE Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure **kwargs: other keyword args to pass into the ASE Atoms constructor Returns: ASE Atoms object", "name": "get_atoms", "signature": "def get_atoms(structure, **kwargs)" }, { "docstr...
2
null
Implement the Python class `AseAtomsAdaptor` described below. Class description: Adaptor serves as a bridge between ASE Atoms and pymatgen structure. Method signatures and docstrings: - def get_atoms(structure, **kwargs): Returns ASE Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Struc...
Implement the Python class `AseAtomsAdaptor` described below. Class description: Adaptor serves as a bridge between ASE Atoms and pymatgen structure. Method signatures and docstrings: - def get_atoms(structure, **kwargs): Returns ASE Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Struc...
62ecae1c7382a41861e3a5d9b9c8dd1207472409
<|skeleton|> class AseAtomsAdaptor: """Adaptor serves as a bridge between ASE Atoms and pymatgen structure.""" def get_atoms(structure, **kwargs): """Returns ASE Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure **kwargs: other keyword args to pass into the ASE At...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AseAtomsAdaptor: """Adaptor serves as a bridge between ASE Atoms and pymatgen structure.""" def get_atoms(structure, **kwargs): """Returns ASE Atoms object from pymatgen structure. Args: structure: pymatgen.core.structure.Structure **kwargs: other keyword args to pass into the ASE Atoms construct...
the_stack_v2_python_sparse
pymatgen/io/ase.py
montoyjh/pymatgen
train
2
ce32b15ea03e11064a2f4ac2212e74a0e50bda54
[ "filepaths = []\nfor filename in cls.xml_filenames:\n filepath = os.path.join(cls._OUTPUT_SUBFOLDER, f'{cls._PREFIX}_{cls._CP_WRITE_UNIT_NUMBER}.save', filename)\n filepaths.append(filepath)\nreturn filepaths", "super().define(spec)\nspec.input('metadata.options.parser_name', valid_type=str, default='quantu...
<|body_start_0|> filepaths = [] for filename in cls.xml_filenames: filepath = os.path.join(cls._OUTPUT_SUBFOLDER, f'{cls._PREFIX}_{cls._CP_WRITE_UNIT_NUMBER}.save', filename) filepaths.append(filepath) return filepaths <|end_body_0|> <|body_start_1|> super().defi...
`CalcJob` implementation for the cp.x code of Quantum ESPRESSO.
CpCalculation
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CpCalculation: """`CalcJob` implementation for the cp.x code of Quantum ESPRESSO.""" def xml_filepaths(cls): """Return a list of relative filepaths of XML files.""" <|body_0|> def define(cls, spec): """Define the process specification.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_021162
6,243
permissive
[ { "docstring": "Return a list of relative filepaths of XML files.", "name": "xml_filepaths", "signature": "def xml_filepaths(cls)" }, { "docstring": "Define the process specification.", "name": "define", "signature": "def define(cls, spec)" }, { "docstring": "Parse CP specific in...
3
stack_v2_sparse_classes_30k_train_005784
Implement the Python class `CpCalculation` described below. Class description: `CalcJob` implementation for the cp.x code of Quantum ESPRESSO. Method signatures and docstrings: - def xml_filepaths(cls): Return a list of relative filepaths of XML files. - def define(cls, spec): Define the process specification. - def ...
Implement the Python class `CpCalculation` described below. Class description: `CalcJob` implementation for the cp.x code of Quantum ESPRESSO. Method signatures and docstrings: - def xml_filepaths(cls): Return a list of relative filepaths of XML files. - def define(cls, spec): Define the process specification. - def ...
7263f92ccabcfc9f828b9da5473e1aefbc4b8eca
<|skeleton|> class CpCalculation: """`CalcJob` implementation for the cp.x code of Quantum ESPRESSO.""" def xml_filepaths(cls): """Return a list of relative filepaths of XML files.""" <|body_0|> def define(cls, spec): """Define the process specification.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CpCalculation: """`CalcJob` implementation for the cp.x code of Quantum ESPRESSO.""" def xml_filepaths(cls): """Return a list of relative filepaths of XML files.""" filepaths = [] for filename in cls.xml_filenames: filepath = os.path.join(cls._OUTPUT_SUBFOLDER, f'{cls....
the_stack_v2_python_sparse
src/aiida_quantumespresso/calculations/cp.py
aiidateam/aiida-quantumespresso
train
56
294a01b88176af7806c788a0138eabd12a3e5e99
[ "self.input_dim = input_dim\nself.output_dim = input_dim\nself.mean = None\nself.covariance_matrix = None\nself.standard_deviation = None\nself.trained = False", "if self.input_dim != data.shape[1]:\n raise ValueError('Wrong data dimensionality.')\nself.mean = numx.mean(data, axis=0).reshape(1, data.shape[1])\...
<|body_start_0|> self.input_dim = input_dim self.output_dim = input_dim self.mean = None self.covariance_matrix = None self.standard_deviation = None self.trained = False <|end_body_0|> <|body_start_1|> if self.input_dim != data.shape[1]: raise ValueE...
Shifts the data having zero mean and scales it having unit variances along the axis.
STANDARIZER
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class STANDARIZER: """Shifts the data having zero mean and scales it having unit variances along the axis.""" def __init__(self, input_dim): """Constructor. :param input_dim: Data dimensionality. :type input_dim: int""" <|body_0|> def train(self, data): """Training the...
stack_v2_sparse_classes_36k_train_021163
13,683
no_license
[ { "docstring": "Constructor. :param input_dim: Data dimensionality. :type input_dim: int", "name": "__init__", "signature": "def __init__(self, input_dim)" }, { "docstring": "Training the model (full batch). :param data: Data for training. :type data: numpy array [num data point, data dimension]...
4
stack_v2_sparse_classes_30k_val_000210
Implement the Python class `STANDARIZER` described below. Class description: Shifts the data having zero mean and scales it having unit variances along the axis. Method signatures and docstrings: - def __init__(self, input_dim): Constructor. :param input_dim: Data dimensionality. :type input_dim: int - def train(self...
Implement the Python class `STANDARIZER` described below. Class description: Shifts the data having zero mean and scales it having unit variances along the axis. Method signatures and docstrings: - def __init__(self, input_dim): Constructor. :param input_dim: Data dimensionality. :type input_dim: int - def train(self...
997879373110b2ee69fba921d46a309443c8e374
<|skeleton|> class STANDARIZER: """Shifts the data having zero mean and scales it having unit variances along the axis.""" def __init__(self, input_dim): """Constructor. :param input_dim: Data dimensionality. :type input_dim: int""" <|body_0|> def train(self, data): """Training the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class STANDARIZER: """Shifts the data having zero mean and scales it having unit variances along the axis.""" def __init__(self, input_dim): """Constructor. :param input_dim: Data dimensionality. :type input_dim: int""" self.input_dim = input_dim self.output_dim = input_dim self...
the_stack_v2_python_sparse
pydeep/preprocessing.py
MelJan/PyDeep
train
50
b22daa7f7a70b6536b155a86a2f36f8e9cdb12e0
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Acl()", "from .access_type import AccessType\nfrom .acl_type import AclType\nfrom .access_type import AccessType\nfrom .acl_type import AclType\nfields: Dict[str, Callable[[Any], None]] = {'accessType': lambda n: setattr(self, 'access_...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Acl() <|end_body_0|> <|body_start_1|> from .access_type import AccessType from .acl_type import AclType from .access_type import AccessType from .acl_type import AclType ...
Acl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Acl: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl""" <|b...
stack_v2_sparse_classes_36k_train_021164
3,338
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_nod...
3
null
Implement the Python class `Acl` described below. Class description: Implement the Acl class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n...
Implement the Python class `Acl` described below. Class description: Implement the Acl class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Acl: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Acl: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Acl: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Acl""" if not parse_node...
the_stack_v2_python_sparse
msgraph/generated/models/external_connectors/acl.py
microsoftgraph/msgraph-sdk-python
train
135
02b31d88c8a36a5182eadce04f9ea031272cad49
[ "super(CBFocalLoss, self).__init__()\nself.beta = beta\nself.gamma = gamma\nself._nums = torch.zeros(len(class_num))\nself.sub_beta = torch.zeros(len(class_num))\nfor i in range(len(class_num)):\n self._nums[i] = class_num[i]\n self.sub_beta[i] = (1 - self.beta) / (1 - math.pow(self.beta, class_num[i]))\nself...
<|body_start_0|> super(CBFocalLoss, self).__init__() self.beta = beta self.gamma = gamma self._nums = torch.zeros(len(class_num)) self.sub_beta = torch.zeros(len(class_num)) for i in range(len(class_num)): self._nums[i] = class_num[i] self.sub_beta...
Class Balanced Focal Loss
CBFocalLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBFocalLoss: """Class Balanced Focal Loss""" def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): """初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param...
stack_v2_sparse_classes_36k_train_021165
2,437
no_license
[ { "docstring": "初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param reduction: 可选`mean`和`sum`", "name": "__init__", "signature": "def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: st...
2
stack_v2_sparse_classes_30k_train_008871
Implement the Python class `CBFocalLoss` described below. Class description: Class Balanced Focal Loss Method signatures and docstrings: - def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): 初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总...
Implement the Python class `CBFocalLoss` described below. Class description: Class Balanced Focal Loss Method signatures and docstrings: - def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): 初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总...
aaeeed86341356d9fd061664f6f7bccf2ac353d0
<|skeleton|> class CBFocalLoss: """Class Balanced Focal Loss""" def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): """初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CBFocalLoss: """Class Balanced Focal Loss""" def __init__(self, class_num: typing.List[int], beta: float=0.99, gamma: float=2.0, reduction: str='mean'): """初始化函数 :param class_num: list类型,表示每种类别对应的样本数,从0开始 :param beta: 表示有效样本数占总样本数的比例,一般选择[0.999, 0.99, 0.9] :param gamma: 表示平衡指数 :param reduction: 可...
the_stack_v2_python_sparse
src/losses/cb_focal_loss.py
jessie0624/nlp-task
train
0
5242f7cee917ad5ba54d93b816adc91da09ae43b
[ "def dfs(root):\n if not root:\n return ''\n left = dfs(root.left)\n right = dfs(root.right)\n return left + ',' + right + ',' + str(root.val)\nreturn dfs(root)", "data = [int(x) for x in data.split(',')]\n\ndef helper(lower=float('-inf'), upper=float('+inf')):\n if not data or data[-1] < lo...
<|body_start_0|> def dfs(root): if not root: return '' left = dfs(root.left) right = dfs(root.right) return left + ',' + right + ',' + str(root.val) return dfs(root) <|end_body_0|> <|body_start_1|> data = [int(x) for x in data.spli...
Codec
[]
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|> def dfs(root):...
stack_v2_sparse_classes_36k_train_021166
955
no_license
[ { "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
stack_v2_sparse_classes_30k_train_019705
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...
0566622daa5849f7deb0cfdc6de2282fb3127f4c
<|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.""" def dfs(root): if not root: return '' left = dfs(root.left) right = dfs(root.right) return left + ',' + right + ',' + str(root.val) ...
the_stack_v2_python_sparse
python/树/449. 序列化和反序列化二叉搜索树.py
Weless/leetcode
train
0
56b771852fe4bc8ae307c38408e1efeaf1fbcee8
[ "layer = [root]\nres = []\nwhile layer:\n next_layer = []\n for x in layer:\n if x:\n next_layer += [x.left, x.right]\n temp = [x.val if x else None for x in layer]\n res += temp\n layer = next_layer\nreturn str(res)", "l = eval(data)\nroot = TreeNode(l[0]) if l[0] != None else No...
<|body_start_0|> layer = [root] res = [] while layer: next_layer = [] for x in layer: if x: next_layer += [x.left, x.right] temp = [x.val if x else None for x in layer] res += temp layer = next_layer ...
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_021167
1,570
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:...
e5dd213411b5c82b07171c3adf4556dcf9c44207
<|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""" layer = [root] res = [] while layer: next_layer = [] for x in layer: if x: next_layer += [x.left, x.right] ...
the_stack_v2_python_sparse
python/449.serialize-and-deserialize-bst.py
songzy12/LeetCode
train
4
ac03b07363e0644afe73ddc8348c18d9a3582ffa
[ "super(TestPmd, self).__init__()\nself.host = host\nself.ssh_prompt = self.host.config.get('cli_user_prompt', self.host.config.get('ssh_user', 'root') + '@')\nself.interactive_prompt = 'testpmd>'\nself.non_interactive_prompt = 'Press enter to exit'\nself.interactive = False\nself.run_status = False", "inserts = r...
<|body_start_0|> super(TestPmd, self).__init__() self.host = host self.ssh_prompt = self.host.config.get('cli_user_prompt', self.host.config.get('ssh_user', 'root') + '@') self.interactive_prompt = 'testpmd>' self.non_interactive_prompt = 'Press enter to exit' self.intera...
TestPmd
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPmd: def __init__(self, host): """Initialize TestPmd class.""" <|body_0|> def start(self, interactive_shell=True, end_options='', timeout=10, **kwargs): """Start testpmd tool. Args: interactive_shell(bool): Interactive shell flag end_options(str): Arguments to be...
stack_v2_sparse_classes_36k_train_021168
5,825
permissive
[ { "docstring": "Initialize TestPmd class.", "name": "__init__", "signature": "def __init__(self, host)" }, { "docstring": "Start testpmd tool. Args: interactive_shell(bool): Interactive shell flag end_options(str): Arguments to be passed after '--' in command line timeout(int): Timeout kwargs(di...
4
stack_v2_sparse_classes_30k_train_008249
Implement the Python class `TestPmd` described below. Class description: Implement the TestPmd class. Method signatures and docstrings: - def __init__(self, host): Initialize TestPmd class. - def start(self, interactive_shell=True, end_options='', timeout=10, **kwargs): Start testpmd tool. Args: interactive_shell(boo...
Implement the Python class `TestPmd` described below. Class description: Implement the TestPmd class. Method signatures and docstrings: - def __init__(self, host): Initialize TestPmd class. - def start(self, interactive_shell=True, end_options='', timeout=10, **kwargs): Start testpmd tool. Args: interactive_shell(boo...
2007bf3fe66edfe704e485141c55caed54fe13aa
<|skeleton|> class TestPmd: def __init__(self, host): """Initialize TestPmd class.""" <|body_0|> def start(self, interactive_shell=True, end_options='', timeout=10, **kwargs): """Start testpmd tool. Args: interactive_shell(bool): Interactive shell flag end_options(str): Arguments to be...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPmd: def __init__(self, host): """Initialize TestPmd class.""" super(TestPmd, self).__init__() self.host = host self.ssh_prompt = self.host.config.get('cli_user_prompt', self.host.config.get('ssh_user', 'root') + '@') self.interactive_prompt = 'testpmd>' sel...
the_stack_v2_python_sparse
taf/testlib/linux/testpmd.py
AndriyZabavskyy/taf
train
0
8202b65efd2e9414410d73fc04decc39c5fd5749
[ "if not graph.is_directed():\n raise ValueError('the graph is not directed')\nself.graph = graph\nself.distance = dict()\nself.parent = dict()\nfor source in self.graph.iternodes():\n self.distance[source] = dict()\n self.parent[source] = dict()\n for target in self.graph.iternodes():\n self.dist...
<|body_start_0|> if not graph.is_directed(): raise ValueError('the graph is not directed') self.graph = graph self.distance = dict() self.parent = dict() for source in self.graph.iternodes(): self.distance[source] = dict() self.parent[source] =...
The Floyd-Warshall algorithm with path reconstruction. Negative cycles are forbidden. Attributes ---------- graph : input directed weighted graph parent : dict-of-dict distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >>> from...
FloydWarshallPaths
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FloydWarshallPaths: """The Floyd-Warshall algorithm with path reconstruction. Negative cycles are forbidden. Attributes ---------- graph : input directed weighted graph parent : dict-of-dict distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graph...
stack_v2_sparse_classes_36k_train_021169
7,754
permissive
[ { "docstring": "The algorithm initialization. Parameters ---------- graph : directed weighted graph", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Finding all shortest paths.", "name": "run", "signature": "def run(self)" }, { "docstring": "Path ...
3
stack_v2_sparse_classes_30k_train_000016
Implement the Python class `FloydWarshallPaths` described below. Class description: The Floyd-Warshall algorithm with path reconstruction. Negative cycles are forbidden. Attributes ---------- graph : input directed weighted graph parent : dict-of-dict distance : dict-of-dict Examples -------- >>> from graphtheory.stru...
Implement the Python class `FloydWarshallPaths` described below. Class description: The Floyd-Warshall algorithm with path reconstruction. Negative cycles are forbidden. Attributes ---------- graph : input directed weighted graph parent : dict-of-dict distance : dict-of-dict Examples -------- >>> from graphtheory.stru...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class FloydWarshallPaths: """The Floyd-Warshall algorithm with path reconstruction. Negative cycles are forbidden. Attributes ---------- graph : input directed weighted graph parent : dict-of-dict distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graph...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FloydWarshallPaths: """The Floyd-Warshall algorithm with path reconstruction. Negative cycles are forbidden. Attributes ---------- graph : input directed weighted graph parent : dict-of-dict distance : dict-of-dict Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.struct...
the_stack_v2_python_sparse
graphtheory/shortestpaths/floydwarshall.py
kgashok/graphs-dict
train
0
02f641620c415a80ffa88f365a8b52e7e2312965
[ "super().__init__(logger)\nself.mappings = {'code_to_type': Container(logger), 'type_to_codes': Container(logger)}\nfor entry in FileHandler(logger, filename):\n slot_type_code = entry.get('slot_type_code')\n slot_type = entry.get('slot_type')\n if slot_type_code in self.get('mappings').get('code_to_type')...
<|body_start_0|> super().__init__(logger) self.mappings = {'code_to_type': Container(logger), 'type_to_codes': Container(logger)} for entry in FileHandler(logger, filename): slot_type_code = entry.get('slot_type_code') slot_type = entry.get('slot_type') if slo...
Slots used to map between LDC's internal code for a slot, and its corresponding external slot name.
SlotMappings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlotMappings: """Slots used to map between LDC's internal code for a slot, and its corresponding external slot name.""" def __init__(self, logger, filename): """Initialize the slots object. Parameters: logger (logger): the logger object filename (str): the name of the file containing...
stack_v2_sparse_classes_36k_train_021170
3,334
no_license
[ { "docstring": "Initialize the slots object. Parameters: logger (logger): the logger object filename (str): the name of the file containing mappings between LDC internal slot code, and external slot name. The file contains tab separated values with header in first line. For example, slot_type_code slot_type evt...
3
stack_v2_sparse_classes_30k_train_014950
Implement the Python class `SlotMappings` described below. Class description: Slots used to map between LDC's internal code for a slot, and its corresponding external slot name. Method signatures and docstrings: - def __init__(self, logger, filename): Initialize the slots object. Parameters: logger (logger): the logg...
Implement the Python class `SlotMappings` described below. Class description: Slots used to map between LDC's internal code for a slot, and its corresponding external slot name. Method signatures and docstrings: - def __init__(self, logger, filename): Initialize the slots object. Parameters: logger (logger): the logg...
a0b379ba0e78e8e5eceeda465f75bba5c288aea4
<|skeleton|> class SlotMappings: """Slots used to map between LDC's internal code for a slot, and its corresponding external slot name.""" def __init__(self, logger, filename): """Initialize the slots object. Parameters: logger (logger): the logger object filename (str): the name of the file containing...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlotMappings: """Slots used to map between LDC's internal code for a slot, and its corresponding external slot name.""" def __init__(self, logger, filename): """Initialize the slots object. Parameters: logger (logger): the logger object filename (str): the name of the file containing mappings bet...
the_stack_v2_python_sparse
python/aida/slot_mappings.py
shahraj81/aida
train
8
317339788e33b0306418d361215735dcf96ebca5
[ "isPalindrome = lambda s: s == s[::-1]\nremove1Char_index = lambda s, i: s[:i] + s[i + 1:]\nl, r = (0, len(s) - 1)\nwhile l < r:\n if s[l] != s[r]:\n leftpart = remove1Char_index(s, l)\n rightpart = remove1Char_index(s, r)\n return isPalindrome(leftpart) or isPalindrome(rightpart)\n l += ...
<|body_start_0|> isPalindrome = lambda s: s == s[::-1] remove1Char_index = lambda s, i: s[:i] + s[i + 1:] l, r = (0, len(s) - 1) while l < r: if s[l] != s[r]: leftpart = remove1Char_index(s, l) rightpart = remove1Char_index(s, r) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def validPalindrome1(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> isPalindrome = lambda s: s == s[::-1] remove1Char_...
stack_v2_sparse_classes_36k_train_021171
1,077
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "validPalindrome", "signature": "def validPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "validPalindrome1", "signature": "def validPalindrome1(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s): :type s: str :rtype: bool - def validPalindrome1(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s): :type s: str :rtype: bool - def validPalindrome1(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def validPalindrome(self, s)...
a0f270c1adce25be11df92877813037f2e73e28b
<|skeleton|> class Solution: def validPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def validPalindrome1(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validPalindrome(self, s): """:type s: str :rtype: bool""" isPalindrome = lambda s: s == s[::-1] remove1Char_index = lambda s, i: s[:i] + s[i + 1:] l, r = (0, len(s) - 1) while l < r: if s[l] != s[r]: leftpart = remove1Char_index...
the_stack_v2_python_sparse
leetcode/680_valid_palindrome_II.py
lvraikkonen/GoodCode
train
0
f5de3d01daea97ef24139abb88537b7e0c1b30ad
[ "self.enable_lambda_based_gc = enable_lambda_based_gc\nself.lambda_function_version = lambda_function_version\nself.tier_type = tier_type\nself.worm_enabled = worm_enabled", "if dictionary is None:\n return None\nenable_lambda_based_gc = dictionary.get('enableLambdaBasedGc')\nlambda_function_version = dictiona...
<|body_start_0|> self.enable_lambda_based_gc = enable_lambda_based_gc self.lambda_function_version = lambda_function_version self.tier_type = tier_type self.worm_enabled = worm_enabled <|end_body_0|> <|body_start_1|> if dictionary is None: return None enable_...
Implementation of the 'ClusterConfigProto_Vault_CloudProperties_AzureProperties' model. TODO: type description here. Attributes: enable_lambda_based_gc (bool): Whether this vault supports Azure function based GC. An Azure function needs to be deployed in the customer's Azure environment. lambda_function_version (int): ...
ClusterConfigProto_Vault_CloudProperties_AzureProperties
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterConfigProto_Vault_CloudProperties_AzureProperties: """Implementation of the 'ClusterConfigProto_Vault_CloudProperties_AzureProperties' model. TODO: type description here. Attributes: enable_lambda_based_gc (bool): Whether this vault supports Azure function based GC. An Azure function needs...
stack_v2_sparse_classes_36k_train_021172
2,887
permissive
[ { "docstring": "Constructor for the ClusterConfigProto_Vault_CloudProperties_AzureProperties class", "name": "__init__", "signature": "def __init__(self, enable_lambda_based_gc=None, lambda_function_version=None, tier_type=None, worm_enabled=None)" }, { "docstring": "Creates an instance of this ...
2
stack_v2_sparse_classes_30k_train_020805
Implement the Python class `ClusterConfigProto_Vault_CloudProperties_AzureProperties` described below. Class description: Implementation of the 'ClusterConfigProto_Vault_CloudProperties_AzureProperties' model. TODO: type description here. Attributes: enable_lambda_based_gc (bool): Whether this vault supports Azure fun...
Implement the Python class `ClusterConfigProto_Vault_CloudProperties_AzureProperties` described below. Class description: Implementation of the 'ClusterConfigProto_Vault_CloudProperties_AzureProperties' model. TODO: type description here. Attributes: enable_lambda_based_gc (bool): Whether this vault supports Azure fun...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ClusterConfigProto_Vault_CloudProperties_AzureProperties: """Implementation of the 'ClusterConfigProto_Vault_CloudProperties_AzureProperties' model. TODO: type description here. Attributes: enable_lambda_based_gc (bool): Whether this vault supports Azure function based GC. An Azure function needs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterConfigProto_Vault_CloudProperties_AzureProperties: """Implementation of the 'ClusterConfigProto_Vault_CloudProperties_AzureProperties' model. TODO: type description here. Attributes: enable_lambda_based_gc (bool): Whether this vault supports Azure function based GC. An Azure function needs to be deploy...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cluster_config_proto_vault_cloud_properties_azure_properties.py
cohesity/management-sdk-python
train
24
b2335e57994164743df1ac49174db7bd7d9e9c54
[ "SeleniumService.__init__(self)\nself.engine = 'duckduckgo'\nself.URLBASE = 'http://duckduckgo.com/html?'", "params = {'q': query, 'kl': 'pl-pl'}\nbrowser_url = '{}{}'.format(self.URLBASE, urlencode(params))\nself.load_page(browser_url)\ntitles = self.get_page_elements_by_class('result__title')\nurls = self.get_p...
<|body_start_0|> SeleniumService.__init__(self) self.engine = 'duckduckgo' self.URLBASE = 'http://duckduckgo.com/html?' <|end_body_0|> <|body_start_1|> params = {'q': query, 'kl': 'pl-pl'} browser_url = '{}{}'.format(self.URLBASE, urlencode(params)) self.load_page(browse...
Specialized service for scraping duckduckgo.com search engine
DuckDuckGoService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DuckDuckGoService: """Specialized service for scraping duckduckgo.com search engine""" def __init__(self): """Initialize virtual browser and set correct url base""" <|body_0|> def process_query(self, query): """Process query and return all titles and snippets in ...
stack_v2_sparse_classes_36k_train_021173
8,761
permissive
[ { "docstring": "Initialize virtual browser and set correct url base", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Process query and return all titles and snippets in one list Arguments: query -- query that we want to answer", "name": "process_query", "signatu...
2
stack_v2_sparse_classes_30k_train_019298
Implement the Python class `DuckDuckGoService` described below. Class description: Specialized service for scraping duckduckgo.com search engine Method signatures and docstrings: - def __init__(self): Initialize virtual browser and set correct url base - def process_query(self, query): Process query and return all ti...
Implement the Python class `DuckDuckGoService` described below. Class description: Specialized service for scraping duckduckgo.com search engine Method signatures and docstrings: - def __init__(self): Initialize virtual browser and set correct url base - def process_query(self, query): Process query and return all ti...
af03252e19075feec3fa478fa271ea3ae8cf8d11
<|skeleton|> class DuckDuckGoService: """Specialized service for scraping duckduckgo.com search engine""" def __init__(self): """Initialize virtual browser and set correct url base""" <|body_0|> def process_query(self, query): """Process query and return all titles and snippets in ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DuckDuckGoService: """Specialized service for scraping duckduckgo.com search engine""" def __init__(self): """Initialize virtual browser and set correct url base""" SeleniumService.__init__(self) self.engine = 'duckduckgo' self.URLBASE = 'http://duckduckgo.com/html?' ...
the_stack_v2_python_sparse
services/SeleniumServices.py
kubasikora/WEDT-Projekt
train
0
cd9aaae27ac8885e03fe3de25078bc4c80ae173e
[ "match = self.rx_interface_name.match(s)\nif not match:\n raise InterfaceTypeError(\"Invalid interface '%s'\" % s)\nt = match.group(1)[:2]\nif t.lower() == 'bu':\n t = 'BE'\nreturn '%s%s' % (t, match.group(2))", "me = ' %s'\nmne = ' %s le %d'\nr = []\nfor prefix, min_len, max_len in pl:\n if min_len == m...
<|body_start_0|> match = self.rx_interface_name.match(s) if not match: raise InterfaceTypeError("Invalid interface '%s'" % s) t = match.group(1)[:2] if t.lower() == 'bu': t = 'BE' return '%s%s' % (t, match.group(2)) <|end_body_0|> <|body_start_1|> ...
Profile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profile: def convert_interface_name(self, s): """MgmtEth0/1/CPU0/0 GigabitEthernet0/2/0/0.1000 Te0/0/1/3 Bundle-Ether1.5011035 Bundle-Ether1.10231016.ip18484""" <|body_0|> def generate_prefix_list(self, name, pl): """Generate prefix list _name_. pl is a list of (pref...
stack_v2_sparse_classes_36k_train_021174
2,215
permissive
[ { "docstring": "MgmtEth0/1/CPU0/0 GigabitEthernet0/2/0/0.1000 Te0/0/1/3 Bundle-Ether1.5011035 Bundle-Ether1.10231016.ip18484", "name": "convert_interface_name", "signature": "def convert_interface_name(self, s)" }, { "docstring": "Generate prefix list _name_. pl is a list of (prefix, min_len, ma...
2
stack_v2_sparse_classes_30k_train_006383
Implement the Python class `Profile` described below. Class description: Implement the Profile class. Method signatures and docstrings: - def convert_interface_name(self, s): MgmtEth0/1/CPU0/0 GigabitEthernet0/2/0/0.1000 Te0/0/1/3 Bundle-Ether1.5011035 Bundle-Ether1.10231016.ip18484 - def generate_prefix_list(self, n...
Implement the Python class `Profile` described below. Class description: Implement the Profile class. Method signatures and docstrings: - def convert_interface_name(self, s): MgmtEth0/1/CPU0/0 GigabitEthernet0/2/0/0.1000 Te0/0/1/3 Bundle-Ether1.5011035 Bundle-Ether1.10231016.ip18484 - def generate_prefix_list(self, n...
aba08dc328296bb0e8e181c2ac9a766e1ec2a0bb
<|skeleton|> class Profile: def convert_interface_name(self, s): """MgmtEth0/1/CPU0/0 GigabitEthernet0/2/0/0.1000 Te0/0/1/3 Bundle-Ether1.5011035 Bundle-Ether1.10231016.ip18484""" <|body_0|> def generate_prefix_list(self, name, pl): """Generate prefix list _name_. pl is a list of (pref...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Profile: def convert_interface_name(self, s): """MgmtEth0/1/CPU0/0 GigabitEthernet0/2/0/0.1000 Te0/0/1/3 Bundle-Ether1.5011035 Bundle-Ether1.10231016.ip18484""" match = self.rx_interface_name.match(s) if not match: raise InterfaceTypeError("Invalid interface '%s'" % s) ...
the_stack_v2_python_sparse
sa/profiles/Cisco/IOSXR/profile.py
ewwwcha/noc
train
1
dc17fb0f49a4c61be892bc5341567d564ca82806
[ "if session is None and slot is None:\n raise LunaException('A slot ID or a session handle must be specified!')\nself.password = password\nself.user = user\nself.session = session\nself.slot = slot\nself._session = None", "if self.session is None:\n self._session = Session(self.slot)\n self.session = sel...
<|body_start_0|> if session is None and slot is None: raise LunaException('A slot ID or a session handle must be specified!') self.password = password self.user = user self.session = session self.slot = slot self._session = None <|end_body_0|> <|body_start_1|...
Session which has a user authenticated; C_Login is run
AuthenticatedSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticatedSession: """Session which has a user authenticated; C_Login is run""" def __init__(self, password, user, session=None, slot=None): """A session can optionally already be open. Otherwise open one on entry. It is an error to omit both session and slot. :param password: use...
stack_v2_sparse_classes_36k_train_021175
3,686
permissive
[ { "docstring": "A session can optionally already be open. Otherwise open one on entry. It is an error to omit both session and slot. :param password: user password :param user: user :param session: session handle of an already open session :param slot: slot number", "name": "__init__", "signature": "def...
3
stack_v2_sparse_classes_30k_train_021057
Implement the Python class `AuthenticatedSession` described below. Class description: Session which has a user authenticated; C_Login is run Method signatures and docstrings: - def __init__(self, password, user, session=None, slot=None): A session can optionally already be open. Otherwise open one on entry. It is an ...
Implement the Python class `AuthenticatedSession` described below. Class description: Session which has a user authenticated; C_Login is run Method signatures and docstrings: - def __init__(self, password, user, session=None, slot=None): A session can optionally already be open. Otherwise open one on entry. It is an ...
1d0b94307b9c92c4f19c3d3fe3bda1be37f4c853
<|skeleton|> class AuthenticatedSession: """Session which has a user authenticated; C_Login is run""" def __init__(self, password, user, session=None, slot=None): """A session can optionally already be open. Otherwise open one on entry. It is an error to omit both session and slot. :param password: use...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticatedSession: """Session which has a user authenticated; C_Login is run""" def __init__(self, password, user, session=None, slot=None): """A session can optionally already be open. Otherwise open one on entry. It is an error to omit both session and slot. :param password: user password :p...
the_stack_v2_python_sparse
pycryptoki/utilities.py
ThalesGroup/pycryptoki
train
29
c2becd509e7392a90aeb931be5a0505ebba94362
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_direction = choice([1, -1]) x_distance = choice([0, 1, 2, 3, 4]) x_step = x_direction *...
一个生成随机漫步数据的类
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_points = num_points self.x_values = [0] ...
stack_v2_sparse_classes_36k_train_021176
2,094
no_license
[ { "docstring": "初始化随机漫步的属性", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(self)" } ]
2
stack_v2_sparse_classes_30k_train_014504
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属性 - def fill_walk(self): 计算随机漫步包含的所有点 <|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初...
c998faa04abf21cf62a539bd57c24440ae939387
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属性""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """计算随机漫步包含的所有点""" while len(self.x_values) < self.num_points: x_...
the_stack_v2_python_sparse
static/Mac/练习/随机漫步/random_walk.py
li-MacBook-Pro/li
train
0
2505cd8105d929f46fe40905a99048f9dfbb78ea
[ "self.root = AncestralTree('A')\nself.B = AncestralTree('B')\nself.C = AncestralTree('C')\nself.D = AncestralTree('D')\nself.E = AncestralTree('E')\nself.F = AncestralTree('F')\nself.G = AncestralTree('G')\nself.H = AncestralTree('H')\nself.I = AncestralTree('I')\nself.B.ancestor = self.root\nself.C.ancestor = self...
<|body_start_0|> self.root = AncestralTree('A') self.B = AncestralTree('B') self.C = AncestralTree('C') self.D = AncestralTree('D') self.E = AncestralTree('E') self.F = AncestralTree('F') self.G = AncestralTree('G') self.H = AncestralTree('H') self...
Class with unittests for YoungestCommonAncestor.py
test_YoungestCommonAncestor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_YoungestCommonAncestor: """Class with unittests for YoungestCommonAncestor.py""" def setUp(self): """SetUp tree for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_021177
1,547
no_license
[ { "docstring": "SetUp tree for tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if returned output is as expected.", "name": "test_ExpectedOutput", "signature": "def test_ExpectedOutput(self)" } ]
2
null
Implement the Python class `test_YoungestCommonAncestor` described below. Class description: Class with unittests for YoungestCommonAncestor.py Method signatures and docstrings: - def setUp(self): SetUp tree for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected.
Implement the Python class `test_YoungestCommonAncestor` described below. Class description: Class with unittests for YoungestCommonAncestor.py Method signatures and docstrings: - def setUp(self): SetUp tree for tests. - def test_ExpectedOutput(self): Checks if returned output is as expected. <|skeleton|> class test...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_YoungestCommonAncestor: """Class with unittests for YoungestCommonAncestor.py""" def setUp(self): """SetUp tree for tests.""" <|body_0|> def test_ExpectedOutput(self): """Checks if returned output is as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_YoungestCommonAncestor: """Class with unittests for YoungestCommonAncestor.py""" def setUp(self): """SetUp tree for tests.""" self.root = AncestralTree('A') self.B = AncestralTree('B') self.C = AncestralTree('C') self.D = AncestralTree('D') self.E = An...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Medium/YoungestCommonAncestor/test_YoubgestCommonAncestor.py
JakubKazimierski/PythonPortfolio
train
9
8f2d20b264f65bbcff282625aa4c42d9052d82ab
[ "view = self.context.get('view', None)\nfields = ('email', 'username', 'phone_number', 'first_name', 'last_name', 'profile')\nif view is not None:\n if view.view_name == 'users' and view.action in view.fields_to_return:\n fields = view.fields_to_return[view.action]['followers']['follower']\nreturn UserMod...
<|body_start_0|> view = self.context.get('view', None) fields = ('email', 'username', 'phone_number', 'first_name', 'last_name', 'profile') if view is not None: if view.view_name == 'users' and view.action in view.fields_to_return: fields = view.fields_to_return[view....
Follow model serializer.
FollowModelSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowModelSerializer: """Follow model serializer.""" def get_follower(self, obj): """Return followers information.""" <|body_0|> def get_followed(self, obj): """Return followers information.""" <|body_1|> <|end_skeleton|> <|body_start_0|> view ...
stack_v2_sparse_classes_36k_train_021178
4,291
no_license
[ { "docstring": "Return followers information.", "name": "get_follower", "signature": "def get_follower(self, obj)" }, { "docstring": "Return followers information.", "name": "get_followed", "signature": "def get_followed(self, obj)" } ]
2
stack_v2_sparse_classes_30k_train_014082
Implement the Python class `FollowModelSerializer` described below. Class description: Follow model serializer. Method signatures and docstrings: - def get_follower(self, obj): Return followers information. - def get_followed(self, obj): Return followers information.
Implement the Python class `FollowModelSerializer` described below. Class description: Follow model serializer. Method signatures and docstrings: - def get_follower(self, obj): Return followers information. - def get_followed(self, obj): Return followers information. <|skeleton|> class FollowModelSerializer: """...
e2f4557e2a85405838c6c9f65f1cb8a5f60a35ba
<|skeleton|> class FollowModelSerializer: """Follow model serializer.""" def get_follower(self, obj): """Return followers information.""" <|body_0|> def get_followed(self, obj): """Return followers information.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FollowModelSerializer: """Follow model serializer.""" def get_follower(self, obj): """Return followers information.""" view = self.context.get('view', None) fields = ('email', 'username', 'phone_number', 'first_name', 'last_name', 'profile') if view is not None: ...
the_stack_v2_python_sparse
apps/users/serializers/follow.py
HebertFerrer/WebMaster-back-end
train
0
7c95171619985a7770772a094f52bad2824d330c
[ "super().__init__(name, entity_id, CATEGORY_SENSOR, *args, **kwargs)\nself._hass = hass\nself._entity_id = entity_id\nserv_temp = add_preload_service(self, SERV_TEMPERATURE_SENSOR)\nself.char_temp = serv_temp.get_characteristic(CHAR_CURRENT_TEMPERATURE)\noverride_properties(self.char_temp, PROP_CELSIUS)\nself.char_...
<|body_start_0|> super().__init__(name, entity_id, CATEGORY_SENSOR, *args, **kwargs) self._hass = hass self._entity_id = entity_id serv_temp = add_preload_service(self, SERV_TEMPERATURE_SENSOR) self.char_temp = serv_temp.get_characteristic(CHAR_CURRENT_TEMPERATURE) overri...
Generate a TemperatureSensor accessory for a temperature sensor. Sensor entity must return temperature in °C, °F.
TemperatureSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemperatureSensor: """Generate a TemperatureSensor accessory for a temperature sensor. Sensor entity must return temperature in °C, °F.""" def __init__(self, hass, entity_id, name, *args, **kwargs): """Initialize a TemperatureSensor accessory object.""" <|body_0|> def up...
stack_v2_sparse_classes_36k_train_021179
3,357
permissive
[ { "docstring": "Initialize a TemperatureSensor accessory object.", "name": "__init__", "signature": "def __init__(self, hass, entity_id, name, *args, **kwargs)" }, { "docstring": "Update temperature after state changed.", "name": "update_state", "signature": "def update_state(self, entit...
2
stack_v2_sparse_classes_30k_train_019061
Implement the Python class `TemperatureSensor` described below. Class description: Generate a TemperatureSensor accessory for a temperature sensor. Sensor entity must return temperature in °C, °F. Method signatures and docstrings: - def __init__(self, hass, entity_id, name, *args, **kwargs): Initialize a TemperatureS...
Implement the Python class `TemperatureSensor` described below. Class description: Generate a TemperatureSensor accessory for a temperature sensor. Sensor entity must return temperature in °C, °F. Method signatures and docstrings: - def __init__(self, hass, entity_id, name, *args, **kwargs): Initialize a TemperatureS...
5c4529d044463083bad73cdbf9d17d8cb2b29afa
<|skeleton|> class TemperatureSensor: """Generate a TemperatureSensor accessory for a temperature sensor. Sensor entity must return temperature in °C, °F.""" def __init__(self, hass, entity_id, name, *args, **kwargs): """Initialize a TemperatureSensor accessory object.""" <|body_0|> def up...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemperatureSensor: """Generate a TemperatureSensor accessory for a temperature sensor. Sensor entity must return temperature in °C, °F.""" def __init__(self, hass, entity_id, name, *args, **kwargs): """Initialize a TemperatureSensor accessory object.""" super().__init__(name, entity_id, C...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_sensors.py
simpss/home-assistant
train
1
565ee0808c7de8bfc0c3aeecc8894f18786e1944
[ "test_data = recipe_test_api.TestData()\ntest_data.expect_exception(EXC.__name__)\nself.assertFalse(test_data.consumed)\nwith test_data.should_raise_exception(EXC()) as should_raise:\n self.assertFalse(should_raise)\nwith test_data.should_raise_exception(ValueError()) as should_raise:\n self.assertTrue(should...
<|body_start_0|> test_data = recipe_test_api.TestData() test_data.expect_exception(EXC.__name__) self.assertFalse(test_data.consumed) with test_data.should_raise_exception(EXC()) as should_raise: self.assertFalse(should_raise) with test_data.should_raise_exception(Val...
TestExpectedException
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestExpectedException: def testRecognizeException(self): """An expected exception is correctly recognized.""" <|body_0|> def testNewException(self): """An unexpected exception results in being told to re-raise .""" <|body_1|> def testDisabledTestData(sel...
stack_v2_sparse_classes_36k_train_021180
1,452
permissive
[ { "docstring": "An expected exception is correctly recognized.", "name": "testRecognizeException", "signature": "def testRecognizeException(self)" }, { "docstring": "An unexpected exception results in being told to re-raise .", "name": "testNewException", "signature": "def testNewExcepti...
3
stack_v2_sparse_classes_30k_train_000314
Implement the Python class `TestExpectedException` described below. Class description: Implement the TestExpectedException class. Method signatures and docstrings: - def testRecognizeException(self): An expected exception is correctly recognized. - def testNewException(self): An unexpected exception results in being ...
Implement the Python class `TestExpectedException` described below. Class description: Implement the TestExpectedException class. Method signatures and docstrings: - def testRecognizeException(self): An expected exception is correctly recognized. - def testNewException(self): An unexpected exception results in being ...
91c13923c1d136dc688527fa39583ef61a3277f7
<|skeleton|> class TestExpectedException: def testRecognizeException(self): """An expected exception is correctly recognized.""" <|body_0|> def testNewException(self): """An unexpected exception results in being told to re-raise .""" <|body_1|> def testDisabledTestData(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestExpectedException: def testRecognizeException(self): """An expected exception is correctly recognized.""" test_data = recipe_test_api.TestData() test_data.expect_exception(EXC.__name__) self.assertFalse(test_data.consumed) with test_data.should_raise_exception(EXC()...
the_stack_v2_python_sparse
recipe_engine/unittests/recipe_test_api_test.py
DalavanCloud/recipes-py
train
1
0089b7f00d19d1d99fa810fad4439e3983192321
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IdentityContainer()", "from .b2x_identity_user_flow import B2xIdentityUserFlow\nfrom .conditional_access_root import ConditionalAccessRoot\nfrom .entity import Entity\nfrom .identity_api_connector import IdentityApiConnector\nfrom .ide...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IdentityContainer() <|end_body_0|> <|body_start_1|> from .b2x_identity_user_flow import B2xIdentityUserFlow from .conditional_access_root import ConditionalAccessRoot from .entit...
IdentityContainer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentityContainer: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityContainer: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_36k_train_021181
4,484
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: IdentityContainer", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `IdentityContainer` described below. Class description: Implement the IdentityContainer class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityContainer: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `IdentityContainer` described below. Class description: Implement the IdentityContainer class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityContainer: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IdentityContainer: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityContainer: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdentityContainer: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IdentityContainer: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Iden...
the_stack_v2_python_sparse
msgraph/generated/models/identity_container.py
microsoftgraph/msgraph-sdk-python
train
135
13642efb5454f2b5e122664dbb346ac8bb65e96c
[ "assert len(panels) == len(labels)\nself.panels, self.labels = (panels, labels)\npx = px_per_unit[unit]\nw, h = (w * px, h * px)\nself.fig = etree.Element('svg', {'version': '1.1', 'width': str(w), 'height': str(h), 'viewBox': f'0 0 {w} {h}'}, nsmap={None: 'http://www.w3.org/2000/svg', 'xlink': 'http://www.w3.org/1...
<|body_start_0|> assert len(panels) == len(labels) self.panels, self.labels = (panels, labels) px = px_per_unit[unit] w, h = (w * px, h * px) self.fig = etree.Element('svg', {'version': '1.1', 'width': str(w), 'height': str(h), 'viewBox': f'0 0 {w} {h}'}, nsmap={None: 'http://www...
A figure, container of all panels and panel labels.
Figure
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Figure: """A figure, container of all panels and panel labels.""" def __init__(self, w, h, panels: List[Panel], labels: List[PanelLabel]): """:param w: desired width of the figure. :param h: desired height of the figure. :param panels: panels to be combined into the figure. :param la...
stack_v2_sparse_classes_36k_train_021182
7,890
permissive
[ { "docstring": ":param w: desired width of the figure. :param h: desired height of the figure. :param panels: panels to be combined into the figure. :param labels: index labels of the panels.", "name": "__init__", "signature": "def __init__(self, w, h, panels: List[Panel], labels: List[PanelLabel])" }...
2
stack_v2_sparse_classes_30k_train_009829
Implement the Python class `Figure` described below. Class description: A figure, container of all panels and panel labels. Method signatures and docstrings: - def __init__(self, w, h, panels: List[Panel], labels: List[PanelLabel]): :param w: desired width of the figure. :param h: desired height of the figure. :param...
Implement the Python class `Figure` described below. Class description: A figure, container of all panels and panel labels. Method signatures and docstrings: - def __init__(self, w, h, panels: List[Panel], labels: List[PanelLabel]): :param w: desired width of the figure. :param h: desired height of the figure. :param...
908f084b36c7387daf0cbfe75f16bab70cf96db9
<|skeleton|> class Figure: """A figure, container of all panels and panel labels.""" def __init__(self, w, h, panels: List[Panel], labels: List[PanelLabel]): """:param w: desired width of the figure. :param h: desired height of the figure. :param panels: panels to be combined into the figure. :param la...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Figure: """A figure, container of all panels and panel labels.""" def __init__(self, w, h, panels: List[Panel], labels: List[PanelLabel]): """:param w: desired width of the figure. :param h: desired height of the figure. :param panels: panels to be combined into the figure. :param labels: index l...
the_stack_v2_python_sparse
analysis/utils/svg_layout.py
DrugowitschLab/motion-structure-identification
train
3
8f628d9883f132531e7589e207ab2ae7091bff3e
[ "actual_type = value.type.strip_typedefs()\nprint(\"The value of '%s' is of type '%s' which is a typedef of type '%s'\" % (expr, str(value.type), str(actual_type)))\nExplorer.explore_expr(expr, value.cast(actual_type), is_child)\nreturn False", "actual_type = datatype.strip_typedefs()\nif is_child:\n print(\"T...
<|body_start_0|> actual_type = value.type.strip_typedefs() print("The value of '%s' is of type '%s' which is a typedef of type '%s'" % (expr, str(value.type), str(actual_type))) Explorer.explore_expr(expr, value.cast(actual_type), is_child) return False <|end_body_0|> <|body_start_1|> ...
Internal class used to explore values whose type is a typedef.
TypedefExplorer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypedefExplorer: """Internal class used to explore values whose type is a typedef.""" def explore_expr(expr, value, is_child): """Function to explore typedef values. See Explorer.explore_expr for more information.""" <|body_0|> def explore_type(name, datatype, is_child):...
stack_v2_sparse_classes_36k_train_021183
26,692
permissive
[ { "docstring": "Function to explore typedef values. See Explorer.explore_expr for more information.", "name": "explore_expr", "signature": "def explore_expr(expr, value, is_child)" }, { "docstring": "Function to explore typedef types. See Explorer.explore_type for more information.", "name":...
2
stack_v2_sparse_classes_30k_train_015965
Implement the Python class `TypedefExplorer` described below. Class description: Internal class used to explore values whose type is a typedef. Method signatures and docstrings: - def explore_expr(expr, value, is_child): Function to explore typedef values. See Explorer.explore_expr for more information. - def explore...
Implement the Python class `TypedefExplorer` described below. Class description: Internal class used to explore values whose type is a typedef. Method signatures and docstrings: - def explore_expr(expr, value, is_child): Function to explore typedef values. See Explorer.explore_expr for more information. - def explore...
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
<|skeleton|> class TypedefExplorer: """Internal class used to explore values whose type is a typedef.""" def explore_expr(expr, value, is_child): """Function to explore typedef values. See Explorer.explore_expr for more information.""" <|body_0|> def explore_type(name, datatype, is_child):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypedefExplorer: """Internal class used to explore values whose type is a typedef.""" def explore_expr(expr, value, is_child): """Function to explore typedef values. See Explorer.explore_expr for more information.""" actual_type = value.type.strip_typedefs() print("The value of '%...
the_stack_v2_python_sparse
toolchain/riscv/Linux/share/gdb/python/gdb/command/explore.py
bouffalolab/bl_iot_sdk
train
244
c60975bdd4787db37265e71df5987a713d4c6fca
[ "if isinstance(include_disabled, bool):\n include_disabled = str(include_disabled).lower()\nyield self.get('usergroups.users.list', params={'usergroup': usergroup, 'include_disabled': include_disabled})", "if isinstance(users, (tuple, list)):\n users = ','.join(users)\nreturn self.post('usergroups.users.upd...
<|body_start_0|> if isinstance(include_disabled, bool): include_disabled = str(include_disabled).lower() yield self.get('usergroups.users.list', params={'usergroup': usergroup, 'include_disabled': include_disabled}) <|end_body_0|> <|body_start_1|> if isinstance(users, (tuple, list))...
Follows the Slack UserGroupUsers API. See https://api.slack.com/methods
UserGroupsUsers
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserGroupsUsers: """Follows the Slack UserGroupUsers API. See https://api.slack.com/methods""" def list(self, usergroup, include_disabled=False): """Lists all users in a usergroup :param usergroup: The usergroup ID :type usergroup: str :param include_disabled: Include disabled users ...
stack_v2_sparse_classes_36k_train_021184
1,563
permissive
[ { "docstring": "Lists all users in a usergroup :param usergroup: The usergroup ID :type usergroup: str :param include_disabled: Include disabled users :type include_disabled: bool :return: A response object to run the API request. :rtype: :class:`Response <Response>` object", "name": "list", "signature"...
2
stack_v2_sparse_classes_30k_train_019604
Implement the Python class `UserGroupsUsers` described below. Class description: Follows the Slack UserGroupUsers API. See https://api.slack.com/methods Method signatures and docstrings: - def list(self, usergroup, include_disabled=False): Lists all users in a usergroup :param usergroup: The usergroup ID :type usergr...
Implement the Python class `UserGroupsUsers` described below. Class description: Follows the Slack UserGroupUsers API. See https://api.slack.com/methods Method signatures and docstrings: - def list(self, usergroup, include_disabled=False): Lists all users in a usergroup :param usergroup: The usergroup ID :type usergr...
98871812797651f73e947bd03d1aef4626d875c8
<|skeleton|> class UserGroupsUsers: """Follows the Slack UserGroupUsers API. See https://api.slack.com/methods""" def list(self, usergroup, include_disabled=False): """Lists all users in a usergroup :param usergroup: The usergroup ID :type usergroup: str :param include_disabled: Include disabled users ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserGroupsUsers: """Follows the Slack UserGroupUsers API. See https://api.slack.com/methods""" def list(self, usergroup, include_disabled=False): """Lists all users in a usergroup :param usergroup: The usergroup ID :type usergroup: str :param include_disabled: Include disabled users :type include...
the_stack_v2_python_sparse
slackest/user_group_users.py
Cox-Automotive/slackest
train
8
4b657313643cb3301f409c88dc9dac0586e25c3a
[ "uptime_str = uptime.split('uptime is ')[1]\nuptime_dict = process_uptime_string(uptime_str)\nself.years = uptime_dict['years']\nself.weeks = uptime_dict['weeks']\nself.days = uptime_dict['days']\nself.hours = uptime_dict['hours']\nself.minutes = uptime_dict['minutes']", "s_in_minute = 60\ns_in_hour = 60 * s_in_m...
<|body_start_0|> uptime_str = uptime.split('uptime is ')[1] uptime_dict = process_uptime_string(uptime_str) self.years = uptime_dict['years'] self.weeks = uptime_dict['weeks'] self.days = uptime_dict['days'] self.hours = uptime_dict['hours'] self.minutes = uptime_...
Uptime class
Uptime
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Uptime: """Uptime class""" def __init__(self, uptime): """Creates Uptime object, takes uptime String as input""" <|body_0|> def uptime_in_seconds(self): """Return uptime in seconds""" <|body_1|> <|end_skeleton|> <|body_start_0|> uptime_str = upt...
stack_v2_sparse_classes_36k_train_021185
2,111
permissive
[ { "docstring": "Creates Uptime object, takes uptime String as input", "name": "__init__", "signature": "def __init__(self, uptime)" }, { "docstring": "Return uptime in seconds", "name": "uptime_in_seconds", "signature": "def uptime_in_seconds(self)" } ]
2
null
Implement the Python class `Uptime` described below. Class description: Uptime class Method signatures and docstrings: - def __init__(self, uptime): Creates Uptime object, takes uptime String as input - def uptime_in_seconds(self): Return uptime in seconds
Implement the Python class `Uptime` described below. Class description: Uptime class Method signatures and docstrings: - def __init__(self, uptime): Creates Uptime object, takes uptime String as input - def uptime_in_seconds(self): Return uptime in seconds <|skeleton|> class Uptime: """Uptime class""" def _...
eaa52cd58cd2f49e0d5e8ccec3795a1098b08f20
<|skeleton|> class Uptime: """Uptime class""" def __init__(self, uptime): """Creates Uptime object, takes uptime String as input""" <|body_0|> def uptime_in_seconds(self): """Return uptime in seconds""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Uptime: """Uptime class""" def __init__(self, uptime): """Creates Uptime object, takes uptime String as input""" uptime_str = uptime.split('uptime is ')[1] uptime_dict = process_uptime_string(uptime_str) self.years = uptime_dict['years'] self.weeks = uptime_dict['w...
the_stack_v2_python_sparse
week9/Uptime.py
gerards/pynet_learning_python
train
0
e767234d860b04d844ab98d7e41aa068f97f0efb
[ "if dispatch in self.poll_answers and (not self.voted):\n temp_poll_answers = self.poll_answers\n temp_poll_answers[dispatch] += 1\n self.poll_answers = temp_poll_answers\n self.voted = True\n self.poll_answer = dispatch\n return json.dumps({'poll_answers': self.poll_answers, 'total': sum(self.pol...
<|body_start_0|> if dispatch in self.poll_answers and (not self.voted): temp_poll_answers = self.poll_answers temp_poll_answers[dispatch] += 1 self.poll_answers = temp_poll_answers self.voted = True self.poll_answer = dispatch return json.d...
Poll Module
PollBlock
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PollBlock: """Poll Module""" def handle_ajax(self, dispatch, data): """Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string""" <|body_0|> def student_view(self, _context): """Renders the student view.""" ...
stack_v2_sparse_classes_36k_train_021186
9,113
permissive
[ { "docstring": "Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string", "name": "handle_ajax", "signature": "def handle_ajax(self, dispatch, data)" }, { "docstring": "Renders the student view.", "name": "student_view", "signature": "def...
5
null
Implement the Python class `PollBlock` described below. Class description: Poll Module Method signatures and docstrings: - def handle_ajax(self, dispatch, data): Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string - def student_view(self, _context): Renders the st...
Implement the Python class `PollBlock` described below. Class description: Poll Module Method signatures and docstrings: - def handle_ajax(self, dispatch, data): Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string - def student_view(self, _context): Renders the st...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class PollBlock: """Poll Module""" def handle_ajax(self, dispatch, data): """Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string""" <|body_0|> def student_view(self, _context): """Renders the student view.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PollBlock: """Poll Module""" def handle_ajax(self, dispatch, data): """Ajax handler. Args: dispatch: string request slug data: dict request data parameters Returns: json string""" if dispatch in self.poll_answers and (not self.voted): temp_poll_answers = self.poll_answers ...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/poll_module.py
luque/better-ways-of-thinking-about-software
train
3
840938d07f9f8269db7570a7e2ea7db348cbbc28
[ "\"\"\"\n Do not return anything, modify board in-place instead.\n \"\"\"\nif len(board) == 0:\n return\nrow, col = (len(board), len(board[0]))\n\ndef fun(i, j, flag):\n dic = [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0, 1], [1, 1]]\n count = 0\n for d in dic:\n x, y =...
<|body_start_0|> """ Do not return anything, modify board in-place instead. """ if len(board) == 0: return row, col = (len(board), len(board[0])) def fun(i, j, flag): dic = [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """执行用时 :104 ms, 在所有 Python3 提交中击败了6.56%的用户 内存消耗 :29.1 MB, 在所有 Python3 提交中击败了10.53%的用户 思路:利用额外的数组记录当前值,最后赋值给原数组 1、copy.deepcopy知识点 :param board: :return:""" <|body_0|> def gameOfLife2(self, board: List[List[int]...
stack_v2_sparse_classes_36k_train_021187
6,464
no_license
[ { "docstring": "执行用时 :104 ms, 在所有 Python3 提交中击败了6.56%的用户 内存消耗 :29.1 MB, 在所有 Python3 提交中击败了10.53%的用户 思路:利用额外的数组记录当前值,最后赋值给原数组 1、copy.deepcopy知识点 :param board: :return:", "name": "gameOfLife", "signature": "def gameOfLife(self, board: List[List[int]]) -> None" }, { "docstring": "执行用时 :144 ms, 在所有 ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board: List[List[int]]) -> None: 执行用时 :104 ms, 在所有 Python3 提交中击败了6.56%的用户 内存消耗 :29.1 MB, 在所有 Python3 提交中击败了10.53%的用户 思路:利用额外的数组记录当前值,最后赋值给原数组 1、copy.deepcopy...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board: List[List[int]]) -> None: 执行用时 :104 ms, 在所有 Python3 提交中击败了6.56%的用户 内存消耗 :29.1 MB, 在所有 Python3 提交中击败了10.53%的用户 思路:利用额外的数组记录当前值,最后赋值给原数组 1、copy.deepcopy...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """执行用时 :104 ms, 在所有 Python3 提交中击败了6.56%的用户 内存消耗 :29.1 MB, 在所有 Python3 提交中击败了10.53%的用户 思路:利用额外的数组记录当前值,最后赋值给原数组 1、copy.deepcopy知识点 :param board: :return:""" <|body_0|> def gameOfLife2(self, board: List[List[int]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """执行用时 :104 ms, 在所有 Python3 提交中击败了6.56%的用户 内存消耗 :29.1 MB, 在所有 Python3 提交中击败了10.53%的用户 思路:利用额外的数组记录当前值,最后赋值给原数组 1、copy.deepcopy知识点 :param board: :return:""" """ Do not return anything, modify board in-place instead...
the_stack_v2_python_sparse
LeetCode/数组/289. Game of Life.py
yiming1012/MyLeetCode
train
2
3f001039742ae63e79e25bbb0459c1be586de6ba
[ "self.state_size = state_size\nself.action_size = action_size\nself.action_high = action_high\nself.action_low = action_low\nself.layer_sizes = layer_sizes\nself.batch_norm_options = batch_norm_options\nself.dropout_options = dropout_options\nself.learning_rate = learning_rate\nself.logger = logger\nself.build_mode...
<|body_start_0|> self.state_size = state_size self.action_size = action_size self.action_high = action_high self.action_low = action_low self.layer_sizes = layer_sizes self.batch_norm_options = batch_norm_options self.dropout_options = dropout_options self...
Standard QNetwork implementation : Actor(Policy) Model
DQNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DQNetwork: """Standard QNetwork implementation : Actor(Policy) Model""" def __init__(self, state_size, action_size, action_high=1.0, action_low=0.0, layer_sizes=(64, 64), batch_norm_options=(True, True), dropout_options=(0, 0), learning_rate=0.0001, logger=None): """Initialise the Ne...
stack_v2_sparse_classes_36k_train_021188
3,237
no_license
[ { "docstring": "Initialise the Network Model with given number of layes defined with given size. Parameters ========== :param state_size : size of the state space. :type state_size : int :param action_size : size of the action space. :type action_size : int :param action_high : Upper bound of the action space. ...
2
stack_v2_sparse_classes_30k_train_003272
Implement the Python class `DQNetwork` described below. Class description: Standard QNetwork implementation : Actor(Policy) Model Method signatures and docstrings: - def __init__(self, state_size, action_size, action_high=1.0, action_low=0.0, layer_sizes=(64, 64), batch_norm_options=(True, True), dropout_options=(0, ...
Implement the Python class `DQNetwork` described below. Class description: Standard QNetwork implementation : Actor(Policy) Model Method signatures and docstrings: - def __init__(self, state_size, action_size, action_high=1.0, action_low=0.0, layer_sizes=(64, 64), batch_norm_options=(True, True), dropout_options=(0, ...
4f16a275121fc631420eb2a9708eafec5b91d494
<|skeleton|> class DQNetwork: """Standard QNetwork implementation : Actor(Policy) Model""" def __init__(self, state_size, action_size, action_high=1.0, action_low=0.0, layer_sizes=(64, 64), batch_norm_options=(True, True), dropout_options=(0, 0), learning_rate=0.0001, logger=None): """Initialise the Ne...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DQNetwork: """Standard QNetwork implementation : Actor(Policy) Model""" def __init__(self, state_size, action_size, action_high=1.0, action_low=0.0, layer_sizes=(64, 64), batch_norm_options=(True, True), dropout_options=(0, 0), learning_rate=0.0001, logger=None): """Initialise the Network Model w...
the_stack_v2_python_sparse
DQN-DDQN/Deep-Q-Network/model/DQNetwork.py
YikangGui/Reinforcement-Learning-Algorithms-Zoo
train
0
c557a2fe8a1257dc82c869ebc002f0d5929b67ad
[ "dict1 = {}\nn = len(matrix)\nfor i in range(n):\n dict1[i] = [0] * n\nfor index1 in range(n):\n for index2 in range(n):\n dict1[index2][n - 1 - index1] = matrix[index1][index2]\nreturn [dict1[i] for i in range(n)]", "n = len(matrix)\nfor index1, index2 in [[i, j] for i in range(n // 2) for j in rang...
<|body_start_0|> dict1 = {} n = len(matrix) for i in range(n): dict1[i] = [0] * n for index1 in range(n): for index2 in range(n): dict1[index2][n - 1 - index1] = matrix[index1][index2] return [dict1[i] for i in range(n)] <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p...
stack_v2_sparse_classes_36k_train_021189
1,514
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "rotate2", "signature": "def rotate2(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",...
2
stack_v2_sparse_classes_30k_train_006468
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate2(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate(self, matrix): :type matrix: List[List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate2(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. - def rotate(self, matrix): :type matrix: List[List[...
bdf5518fb387dfa599964425354115dfad49eb00
<|skeleton|> class Solution: def rotate2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" dict1 = {} n = len(matrix) for i in range(n): dict1[i] = [0] * n for index1 in range(n): for index2 in r...
the_stack_v2_python_sparse
Rotate Image.py
jinxin0924/LeetCode
train
1
f016eed3e5da4170291d6ccc550c63f187ce7f0c
[ "super().__init__(name='continue_predictor')\nself.model_size = model_size\nself.mlp = MLP(model_size=model_size, output_layer_size=1)\ndl_type = tf.keras.mixed_precision.global_policy().compute_dtype or tf.float32\nself.call = tf.function(input_signature=[tf.TensorSpec(shape=[None, get_gru_units(model_size)], dtyp...
<|body_start_0|> super().__init__(name='continue_predictor') self.model_size = model_size self.mlp = MLP(model_size=model_size, output_layer_size=1) dl_type = tf.keras.mixed_precision.global_policy().compute_dtype or tf.float32 self.call = tf.function(input_signature=[tf.TensorSp...
The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simply the mode is used (no stochastic sampling!)....
ContinuePredictor
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContinuePredictor: """The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simpl...
stack_v2_sparse_classes_36k_train_021190
3,620
permissive
[ { "docstring": "Initializes a ContinuePredictor instance. Args: model_size: The \"Model Size\" used according to [1] Appendinx B. Determines the exact size of the underlying MLP.", "name": "__init__", "signature": "def __init__(self, *, model_size: Optional[str]='XS')" }, { "docstring": "Perform...
2
null
Implement the Python class `ContinuePredictor` described below. Class description: The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a B...
Implement the Python class `ContinuePredictor` described below. Class description: The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a B...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class ContinuePredictor: """The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simpl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContinuePredictor: """The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simply the mode is...
the_stack_v2_python_sparse
rllib/algorithms/dreamerv3/tf/models/components/continue_predictor.py
ray-project/ray
train
29,482
6b0a3c65d424a58eca674bfeb5e503dda88075f4
[ "with self.assertRaise(ValueError) as error:\n Yearly_Income('a', 2001)\nself.assertTrue('Invalid type for data passed into this class' in str(error.exception))", "with self.assertRaise(ValueError) as error:\n Yearly_Income(data, 'a')\nself.assertTrue('Improper type for year passed into this class' in str(e...
<|body_start_0|> with self.assertRaise(ValueError) as error: Yearly_Income('a', 2001) self.assertTrue('Invalid type for data passed into this class' in str(error.exception)) <|end_body_0|> <|body_start_1|> with self.assertRaise(ValueError) as error: Yearly_Income(data, '...
Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def income_test1(self): """This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class""" <|body_0|> def income_test2(self): """This function tests to see that the proper Error is raised when s...
stack_v2_sparse_classes_36k_train_021191
1,630
no_license
[ { "docstring": "This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class", "name": "income_test1", "signature": "def income_test1(self)" }, { "docstring": "This function tests to see that the proper Error is raised when somet...
3
stack_v2_sparse_classes_30k_train_002732
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def income_test1(self): This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class - def income_test2(self): This fun...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def income_test1(self): This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class - def income_test2(self): This fun...
f5bb1e51de4f84ab3dd62d3073aee4f56534afa1
<|skeleton|> class Test: def income_test1(self): """This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class""" <|body_0|> def income_test2(self): """This function tests to see that the proper Error is raised when s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: def income_test1(self): """This function tests to see that the proper Error is raised when something besides a dataframe is passed for data into the class""" with self.assertRaise(ValueError) as error: Yearly_Income('a', 2001) self.assertTrue('Invalid type for data pa...
the_stack_v2_python_sparse
sar516/tests.py
ds-ga-1007/assignment9
train
2
fcbf5cc791337372a8eaf2bb91a6ec75d4306cbf
[ "for i in range(1, 664):\n url = 'http://www.xicidaili.com/nt/' + str(i)\n yield Request(url, headers=self.header, callback=self.parse)", "ip_list = response.xpath('//table[@id=\"ip_list\"]/tr')\npre_item = XiciItem()\nfor ip in ip_list[1:]:\n pre_item['ip'] = ip.xpath('td[2]/text()')[0].extract()\n p...
<|body_start_0|> for i in range(1, 664): url = 'http://www.xicidaili.com/nt/' + str(i) yield Request(url, headers=self.header, callback=self.parse) <|end_body_0|> <|body_start_1|> ip_list = response.xpath('//table[@id="ip_list"]/tr') pre_item = XiciItem() for ip ...
XicispiderSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XicispiderSpider: def start_requests(self): """初始url请求返回reponse给解析函数""" <|body_0|> def parse(self, response): """解析每一个url返回的rasponse""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i in range(1, 664): url = 'http://www.xicidaili.com/...
stack_v2_sparse_classes_36k_train_021192
1,310
no_license
[ { "docstring": "初始url请求返回reponse给解析函数", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "解析每一个url返回的rasponse", "name": "parse", "signature": "def parse(self, response)" } ]
2
stack_v2_sparse_classes_30k_test_000602
Implement the Python class `XicispiderSpider` described below. Class description: Implement the XicispiderSpider class. Method signatures and docstrings: - def start_requests(self): 初始url请求返回reponse给解析函数 - def parse(self, response): 解析每一个url返回的rasponse
Implement the Python class `XicispiderSpider` described below. Class description: Implement the XicispiderSpider class. Method signatures and docstrings: - def start_requests(self): 初始url请求返回reponse给解析函数 - def parse(self, response): 解析每一个url返回的rasponse <|skeleton|> class XicispiderSpider: def start_requests(sel...
b2ec55d07736a4bc05be893cdecfef4e01b3cf9d
<|skeleton|> class XicispiderSpider: def start_requests(self): """初始url请求返回reponse给解析函数""" <|body_0|> def parse(self, response): """解析每一个url返回的rasponse""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XicispiderSpider: def start_requests(self): """初始url请求返回reponse给解析函数""" for i in range(1, 664): url = 'http://www.xicidaili.com/nt/' + str(i) yield Request(url, headers=self.header, callback=self.parse) def parse(self, response): """解析每一个url返回的rasponse""" ...
the_stack_v2_python_sparse
crawler/xici/xici/spiders/xicispider.py
PubFork/Myrepo
train
0
b132281c8fcdec7fd36eca56e90b26ebcdedf406
[ "Logger.debug('cmd is get model attribute, method is post.')\nresponse_data = self.query_data()\nreturn Response(json.dumps(response_data), status.HTTP_200_OK)", "Logger.debug('cmd is get model attribute, method is get.')\nresponse_data = self.query_data()\nreturn Response(json.dumps(response_data), status.HTTP_2...
<|body_start_0|> Logger.debug('cmd is get model attribute, method is post.') response_data = self.query_data() return Response(json.dumps(response_data), status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> Logger.debug('cmd is get model attribute, method is get.') response_data ...
获取模型属性接口
ModelAttributeViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelAttributeViewSet: """获取模型属性接口""" def create(self, request): """:param request: :return:""" <|body_0|> def list(self, request): """:param request: :return:""" <|body_1|> def query_data(self): """:return:""" <|body_2|> <|end_skele...
stack_v2_sparse_classes_36k_train_021193
2,633
no_license
[ { "docstring": ":param request: :return:", "name": "create", "signature": "def create(self, request)" }, { "docstring": ":param request: :return:", "name": "list", "signature": "def list(self, request)" }, { "docstring": ":return:", "name": "query_data", "signature": "def...
3
stack_v2_sparse_classes_30k_train_003814
Implement the Python class `ModelAttributeViewSet` described below. Class description: 获取模型属性接口 Method signatures and docstrings: - def create(self, request): :param request: :return: - def list(self, request): :param request: :return: - def query_data(self): :return:
Implement the Python class `ModelAttributeViewSet` described below. Class description: 获取模型属性接口 Method signatures and docstrings: - def create(self, request): :param request: :return: - def list(self, request): :param request: :return: - def query_data(self): :return: <|skeleton|> class ModelAttributeViewSet: ""...
bdc4b0289b520f433fa9f436067b9f355ac132a0
<|skeleton|> class ModelAttributeViewSet: """获取模型属性接口""" def create(self, request): """:param request: :return:""" <|body_0|> def list(self, request): """:param request: :return:""" <|body_1|> def query_data(self): """:return:""" <|body_2|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelAttributeViewSet: """获取模型属性接口""" def create(self, request): """:param request: :return:""" Logger.debug('cmd is get model attribute, method is post.') response_data = self.query_data() return Response(json.dumps(response_data), status.HTTP_200_OK) def list(self, ...
the_stack_v2_python_sparse
gezusercenter/sdk/modelattr_views.py
jiangbingo/usercenter
train
0
c8a590ce80bc311971f7b3f5abdafb166f57c268
[ "md5 = hashlib.md5()\nmd5.update(str)\nreturn md5.hexdigest()", "url = '/createM3U8'\nheaders = HeaderData().Content__Type('application/json').ACCEPT('application/json').getRes()\nbody_data = {'username': 'tester', 'file_id': Api_M3U8().Md5Token(fileid), 'm3u8_url': m3u8_url}\nresponse = send_request('[CreateM3U8...
<|body_start_0|> md5 = hashlib.md5() md5.update(str) return md5.hexdigest() <|end_body_0|> <|body_start_1|> url = '/createM3U8' headers = HeaderData().Content__Type('application/json').ACCEPT('application/json').getRes() body_data = {'username': 'tester', 'file_id': Api_...
Api_M3U8
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Api_M3U8: def Md5Token(self, str): """str to md5 :param str: :return:""" <|body_0|> def CreateM3U8(self, fileid, m3u8_url): """通过该接口创建m3u8 :param fileid: :param m3u8_url: :return:""" <|body_1|> def DeleteM3U8(self, fileid): """通过该接口删除m3u8 :param ...
stack_v2_sparse_classes_36k_train_021194
2,048
no_license
[ { "docstring": "str to md5 :param str: :return:", "name": "Md5Token", "signature": "def Md5Token(self, str)" }, { "docstring": "通过该接口创建m3u8 :param fileid: :param m3u8_url: :return:", "name": "CreateM3U8", "signature": "def CreateM3U8(self, fileid, m3u8_url)" }, { "docstring": "通过...
3
null
Implement the Python class `Api_M3U8` described below. Class description: Implement the Api_M3U8 class. Method signatures and docstrings: - def Md5Token(self, str): str to md5 :param str: :return: - def CreateM3U8(self, fileid, m3u8_url): 通过该接口创建m3u8 :param fileid: :param m3u8_url: :return: - def DeleteM3U8(self, fil...
Implement the Python class `Api_M3U8` described below. Class description: Implement the Api_M3U8 class. Method signatures and docstrings: - def Md5Token(self, str): str to md5 :param str: :return: - def CreateM3U8(self, fileid, m3u8_url): 通过该接口创建m3u8 :param fileid: :param m3u8_url: :return: - def DeleteM3U8(self, fil...
3445b59b29854b70f25da2950016f135aa2a5204
<|skeleton|> class Api_M3U8: def Md5Token(self, str): """str to md5 :param str: :return:""" <|body_0|> def CreateM3U8(self, fileid, m3u8_url): """通过该接口创建m3u8 :param fileid: :param m3u8_url: :return:""" <|body_1|> def DeleteM3U8(self, fileid): """通过该接口删除m3u8 :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Api_M3U8: def Md5Token(self, str): """str to md5 :param str: :return:""" md5 = hashlib.md5() md5.update(str) return md5.hexdigest() def CreateM3U8(self, fileid, m3u8_url): """通过该接口创建m3u8 :param fileid: :param m3u8_url: :return:""" url = '/createM3U8' ...
the_stack_v2_python_sparse
lib/feature/m3u8_segment/m3u8_api.py
namesuqi/zeus
train
0
aad18c13426a86afc0636207535350413a3d8143
[ "super(FNNwithLinear, self).__init__()\nself.input_dim = input_dim\nself.output_dim = output_dim\nself.hidden_dim = hidden_dim\nself.num_hidden_layers = num_hidden_layers\nself.num_layers = num_hidden_layers + 2\nself.hidden_activation = hidden_activation\nself.layers = torch.nn.ModuleList()\nself.layers.append(tor...
<|body_start_0|> super(FNNwithLinear, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.hidden_dim = hidden_dim self.num_hidden_layers = num_hidden_layers self.num_layers = num_hidden_layers + 2 self.hidden_activation = hidden_activatio...
Implements a FNN with parameterizable number of layers, dimensions, and hidden activations. Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network
FNNwithLinear
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FNNwithLinear: """Implements a FNN with parameterizable number of layers, dimensions, and hidden activations. Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network""" def __init__(self, input_dim: int, output_dim: int, hidden_dim: int, num_hidden_l...
stack_v2_sparse_classes_36k_train_021195
3,981
permissive
[ { "docstring": "Bulilds the model :param input_dim: the input dimension :param output_dim: the output dimension :param hidden_dim: the hidden dimension :param num_hidden_layers: the number of hidden layers :param hidden_activation: hidden activation type", "name": "__init__", "signature": "def __init__(...
3
null
Implement the Python class `FNNwithLinear` described below. Class description: Implements a FNN with parameterizable number of layers, dimensions, and hidden activations. Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network Method signatures and docstrings: - def __init__(...
Implement the Python class `FNNwithLinear` described below. Class description: Implements a FNN with parameterizable number of layers, dimensions, and hidden activations. Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network Method signatures and docstrings: - def __init__(...
d10830fef55308d383c98b41b34688a7fceae357
<|skeleton|> class FNNwithLinear: """Implements a FNN with parameterizable number of layers, dimensions, and hidden activations. Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network""" def __init__(self, input_dim: int, output_dim: int, hidden_dim: int, num_hidden_l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FNNwithLinear: """Implements a FNN with parameterizable number of layers, dimensions, and hidden activations. Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network""" def __init__(self, input_dim: int, output_dim: int, hidden_dim: int, num_hidden_layers: int=2,...
the_stack_v2_python_sparse
gym_idsgame/agents/training_agents/models/fnn_w_linear.py
Limmen/gym-idsgame
train
49
c89aa6808e1b01164b218eec582f0e1ba8c1dbdc
[ "indegree = [0 for i in range(numCourses)]\ng = dict()\nfor a, b in prerequisites:\n indegree[b] += 1\n if a not in g:\n g[a] = list()\n g[a].append(b)\nq = list()\nfor i in range(len(indegree)):\n if indegree[i] == 0:\n q.append(i)\ncount = 0\nwhile q:\n course = q.pop()\n count += ...
<|body_start_0|> indegree = [0 for i in range(numCourses)] g = dict() for a, b in prerequisites: indegree[b] += 1 if a not in g: g[a] = list() g[a].append(b) q = list() for i in range(len(indegree)): if indegree[i] =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bo...
stack_v2_sparse_classes_36k_train_021196
2,001
no_license
[ { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinish", "signature": "def canFinish(self, numCourses, prerequisites)" }, { "docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool", "name": "canFinish", "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinish(self, numCourses, prerequisites): :type nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool - def canFinish(self, numCourses, prerequisites): :type nu...
2ecaeed38178819480388b5742bc2ea12009ae16
<|skeleton|> class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" <|body_0|> def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canFinish(self, numCourses, prerequisites): """:type numCourses: int :type prerequisites: List[List[int]] :rtype: bool""" indegree = [0 for i in range(numCourses)] g = dict() for a, b in prerequisites: indegree[b] += 1 if a not in g: ...
the_stack_v2_python_sparse
207.course-schedule.py
LouisYLWang/leetcode_python
train
0
3848fcd96a2a098ec2073c866aaf50668f8b9242
[ "res = 0\nfor num in nums:\n res ^= num\nreturn res", "d = {}\nfor num in nums:\n if num not in d:\n d[num] = 1\n else:\n d[num] += 1\nfor k, v in d.items():\n if v == 1:\n return k", "collect = set()\nfor num in nums:\n if num not in collect:\n collect.add(num)\n e...
<|body_start_0|> res = 0 for num in nums: res ^= num return res <|end_body_0|> <|body_start_1|> d = {} for num in nums: if num not in d: d[num] = 1 else: d[num] += 1 for k, v in d.items(): if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumberAltA(self, nums): """using dict""" <|body_1|> def singleNumberAltB(self, nums): """using set""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_021197
824
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": "using dict", "name": "singleNumberAltA", "signature": "def singleNumberAltA(self, nums)" }, { "docstring": "using set", "name": "singleNu...
3
stack_v2_sparse_classes_30k_train_021312
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumberAltA(self, nums): using dict - def singleNumberAltB(self, nums): using set
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumberAltA(self, nums): using dict - def singleNumberAltB(self, nums): using set <|skeleton|> class S...
4ec4f9fbb0ef07ea13207654a619cfdb709cc78c
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumberAltA(self, nums): """using dict""" <|body_1|> def singleNumberAltB(self, nums): """using set""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" res = 0 for num in nums: res ^= num return res def singleNumberAltA(self, nums): """using dict""" d = {} for num in nums: if num not in d: ...
the_stack_v2_python_sparse
0_single_number.py
gautamgitspace/leetcode_30-day_challenge
train
0
4b323c5f1d3b122b148d45dca3e59db54a99cb52
[ "try:\n Public_Page.debug_NomalTest(driver, title='我的种子', MainWait_Element='.modules.main.views.activities.MainActivity', find_element_id='com.pujitech.pujiejia:id/tv_user_wallet', Wait_Element='.modules.bounspoint.activites.BonusPointsDetailActivity', check_element_id='com.pujitech.pujiejia:id/tv_title')\n P...
<|body_start_0|> try: Public_Page.debug_NomalTest(driver, title='我的种子', MainWait_Element='.modules.main.views.activities.MainActivity', find_element_id='com.pujitech.pujiejia:id/tv_user_wallet', Wait_Element='.modules.bounspoint.activites.BonusPointsDetailActivity', check_element_id='com.pujitech.pu...
MyTorrent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTorrent: def MyTorrent(driver): """先决条件:进入我家页面 :return: None""" <|body_0|> def IntoPurse(driver): """先决条件:进入我家页面 :return: None""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: Public_Page.debug_NomalTest(driver, title='我的种子', MainW...
stack_v2_sparse_classes_36k_train_021198
4,911
no_license
[ { "docstring": "先决条件:进入我家页面 :return: None", "name": "MyTorrent", "signature": "def MyTorrent(driver)" }, { "docstring": "先决条件:进入我家页面 :return: None", "name": "IntoPurse", "signature": "def IntoPurse(driver)" } ]
2
stack_v2_sparse_classes_30k_test_000135
Implement the Python class `MyTorrent` described below. Class description: Implement the MyTorrent class. Method signatures and docstrings: - def MyTorrent(driver): 先决条件:进入我家页面 :return: None - def IntoPurse(driver): 先决条件:进入我家页面 :return: None
Implement the Python class `MyTorrent` described below. Class description: Implement the MyTorrent class. Method signatures and docstrings: - def MyTorrent(driver): 先决条件:进入我家页面 :return: None - def IntoPurse(driver): 先决条件:进入我家页面 :return: None <|skeleton|> class MyTorrent: def MyTorrent(driver): """先决条件:进...
618a47ea572f8fccfbf10f5f50aff1dfffb7b0e3
<|skeleton|> class MyTorrent: def MyTorrent(driver): """先决条件:进入我家页面 :return: None""" <|body_0|> def IntoPurse(driver): """先决条件:进入我家页面 :return: None""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyTorrent: def MyTorrent(driver): """先决条件:进入我家页面 :return: None""" try: Public_Page.debug_NomalTest(driver, title='我的种子', MainWait_Element='.modules.main.views.activities.MainActivity', find_element_id='com.pujitech.pujiejia:id/tv_user_wallet', Wait_Element='.modules.bounspoint.acti...
the_stack_v2_python_sparse
Appium/Hachi_Android/src/ReleasePage/Case04_MyTorrent.py
Fengyongming0311/TANUKI
train
0
393ce01e14959781ac450a66c8a6b22f6b364e59
[ "x = str(x)\na = x[::-1]\nif x == a:\n return True\nelse:\n return False", "if x < 0:\n return False\nelif x % 10 == 0 and x != 0:\n return False\nelse:\n revertedNumber = 0\n while x > revertedNumber:\n revertedNumber = revertedNumber * 10 + x % 10\n x /= 10\n return x == rever...
<|body_start_0|> x = str(x) a = x[::-1] if x == a: return True else: return False <|end_body_0|> <|body_start_1|> if x < 0: return False elif x % 10 == 0 and x != 0: return False else: revertedNumber = 0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindromeStr(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> x = str(x) a = x[::-1] if x == a: ...
stack_v2_sparse_classes_36k_train_021199
1,925
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindromeStr", "signature": "def isPalindromeStr(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_001673
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindromeStr(self, x): :type x: int :rtype: bool - def isPalindrome(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 isPalindromeStr(self, x): :type x: int :rtype: bool - def isPalindrome(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindromeStr(self, x): ...
3f7b2ea959308eb80f4c65be35aaeed666570f80
<|skeleton|> class Solution: def isPalindromeStr(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome(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 isPalindromeStr(self, x): """:type x: int :rtype: bool""" x = str(x) a = x[::-1] if x == a: return True else: return False def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return ...
the_stack_v2_python_sparse
9.回文数.py
dxc19951001/Everyday_LeetCode
train
1