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
38a0c87c79c24c4430ef0a5b66f5467064c2ffd6
[ "self.pivotParameter = None\nself.order = None\nself.localDistance = None", "self.requiredKeywords = set(['pivotParameter', 'order', 'localDistance'])\nself.wrongKeywords = set()\nfor child in xmlNode:\n if child.tag == 'order':\n if child.text in ['0', '1']:\n self.order = float(child.text)\...
<|body_start_0|> self.pivotParameter = None self.order = None self.localDistance = None <|end_body_0|> <|body_start_1|> self.requiredKeywords = set(['pivotParameter', 'order', 'localDistance']) self.wrongKeywords = set() for child in xmlNode: if child.tag == ...
Dynamic Time Warping metrics which can be employed only for historySets
DTW
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DTW: """Dynamic Time Warping metrics which can be employed only for historySets""" def initialize(self, inputDict): """This method initialize the metric object @ In, inputDict, dict, dictionary containing initialization parameters @ Out, none""" <|body_0|> def _localRead...
stack_v2_sparse_classes_36k_train_027600
6,156
permissive
[ { "docstring": "This method initialize the metric object @ In, inputDict, dict, dictionary containing initialization parameters @ Out, none", "name": "initialize", "signature": "def initialize(self, inputDict)" }, { "docstring": "Method that reads the portion of the xml input that belongs to thi...
5
null
Implement the Python class `DTW` described below. Class description: Dynamic Time Warping metrics which can be employed only for historySets Method signatures and docstrings: - def initialize(self, inputDict): This method initialize the metric object @ In, inputDict, dict, dictionary containing initialization paramet...
Implement the Python class `DTW` described below. Class description: Dynamic Time Warping metrics which can be employed only for historySets Method signatures and docstrings: - def initialize(self, inputDict): This method initialize the metric object @ In, inputDict, dict, dictionary containing initialization paramet...
fbee9e3def3c1ee576d1af85f3258cc816ceaaaf
<|skeleton|> class DTW: """Dynamic Time Warping metrics which can be employed only for historySets""" def initialize(self, inputDict): """This method initialize the metric object @ In, inputDict, dict, dictionary containing initialization parameters @ Out, none""" <|body_0|> def _localRead...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DTW: """Dynamic Time Warping metrics which can be employed only for historySets""" def initialize(self, inputDict): """This method initialize the metric object @ In, inputDict, dict, dictionary containing initialization parameters @ Out, none""" self.pivotParameter = None self.ord...
the_stack_v2_python_sparse
framework/Metrics/DTW.py
jbae11/raven
train
0
d114dc29a96f514967e75a8945f43353dbfe08a0
[ "res = ''\n\ndef postOrder(root):\n nonlocal res\n if not root:\n res += '# '\n return\n postOrder(root.left)\n postOrder(root.right)\n res += str(root.val) + ' '\npostOrder(root)\nreturn res", "datas = data.split()\n\ndef deOrder():\n val = datas.pop()\n if val == '#':\n ...
<|body_start_0|> res = '' def postOrder(root): nonlocal res if not root: res += '# ' return postOrder(root.left) postOrder(root.right) res += str(root.val) + ' ' postOrder(root) return res <|end_...
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_027601
907
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_008374
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:...
bcc04d49969654cb44f79218a7ef2fd5c1e5449a
<|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""" res = '' def postOrder(root): nonlocal res if not root: res += '# ' return postOrder(root.left) p...
the_stack_v2_python_sparse
src/0297-Serialize-and-Deserialize-Binary-Tree/0297.py
luliyucoordinate/Leetcode
train
1,575
ddf37877c7d17d389f42ff1651129f159edc0a06
[ "dataseries.DataSeries.__init__(self, *args, **kwargs)\nif not isinstance(self.overlay, fslmelimage.MelodicImage):\n raise ValueError('Overlay is not a MelodicImage')\nself.varNorm = False\nself.disableProperty('varNorm')", "display = self.displayCtx.getDisplay(self.overlay)\nopts = display.opts\ncomponent = o...
<|body_start_0|> dataseries.DataSeries.__init__(self, *args, **kwargs) if not isinstance(self.overlay, fslmelimage.MelodicImage): raise ValueError('Overlay is not a MelodicImage') self.varNorm = False self.disableProperty('varNorm') <|end_body_0|> <|body_start_1|> di...
The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.
MelodicPowerSpectrumSeries
[ "Apache-2.0", "CC-BY-3.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MelodicPowerSpectrumSeries: """The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.""" def __init__(self, *args, **kwargs): ...
stack_v2_sparse_classes_36k_train_027602
19,177
permissive
[ { "docstring": "Create a ``MelodicPowerSpectrumSeries``. All arguments are passed through to the :meth:`PowerSpectrumSeries.__init__` method.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Returns a label that can be used for this ``MelodicPowerSpectr...
3
null
Implement the Python class `MelodicPowerSpectrumSeries` described below. Class description: The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property. Method signat...
Implement the Python class `MelodicPowerSpectrumSeries` described below. Class description: The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property. Method signat...
37b45d034d60660b6de3e4bdf5dd6349ed6d853b
<|skeleton|> class MelodicPowerSpectrumSeries: """The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.""" def __init__(self, *args, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MelodicPowerSpectrumSeries: """The ``MelodicPowerSpectrumSeries`` class encapsulates the power spectrum of the time course for a single component of a :class:`.MelodicImage`. The component is dictated by the :attr:`.NiftiOpts.volume` property.""" def __init__(self, *args, **kwargs): """Create a `...
the_stack_v2_python_sparse
fsleyes/plotting/powerspectrumseries.py
CGSchwarzMayo/fsleyes
train
0
3dd91cc93c8bc86f00eac0d0ee85f03854951643
[ "if not prices:\n return 0\nlowest_buy, max_profit = (prices[0], 0)\nfor i in range(len(prices)):\n lowest_buy = min(prices[i], lowest_buy)\n max_profit = max(prices[i] - lowest_buy, max_profit)\nreturn max_profit", "lowest_buy, max_profit = (2147483647, 0)\nfor price in prices:\n if price < lowest_bu...
<|body_start_0|> if not prices: return 0 lowest_buy, max_profit = (prices[0], 0) for i in range(len(prices)): lowest_buy = min(prices[i], lowest_buy) max_profit = max(prices[i] - lowest_buy, max_profit) return max_profit <|end_body_0|> <|body_start_1|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not prices: return 0 ...
stack_v2_sparse_classes_36k_train_027603
1,138
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_004719
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit1(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit1(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def maxPro...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" if not prices: return 0 lowest_buy, max_profit = (prices[0], 0) for i in range(len(prices)): lowest_buy = min(prices[i], lowest_buy) max_profit = max(prices[i] ...
the_stack_v2_python_sparse
DynamicProgramming/q121_best_time_to_buy_and_sell_stock.py
sevenhe716/LeetCode
train
0
229b8bd0948f2cfb35bd9d404b01a304abfd4d60
[ "if not cls.check_bases(bases):\n raise TypeError('Class %s is not a subclass of TextCommand' % classname)\nc = super(HybridCommandMeta, cls).__new__(cls, classname, bases, dictionary)\nif c:\n win_class = HybridCommandMeta.make_window_version(classname, dictionary)\n app_class = HybridCommandMeta.make_app...
<|body_start_0|> if not cls.check_bases(bases): raise TypeError('Class %s is not a subclass of TextCommand' % classname) c = super(HybridCommandMeta, cls).__new__(cls, classname, bases, dictionary) if c: win_class = HybridCommandMeta.make_window_version(classname, diction...
A TextCommand can use this as its metaclass to automatically create a window command and an application command that will run the given text command for the active window and view. Useful when writing a text command that you want to run as a build system.
HybridCommandMeta
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HybridCommandMeta: """A TextCommand can use this as its metaclass to automatically create a window command and an application command that will run the given text command for the active window and view. Useful when writing a text command that you want to run as a build system.""" def __new__...
stack_v2_sparse_classes_36k_train_027604
17,290
no_license
[ { "docstring": "Creates a WindowCommand that will run this text command. If an is_enabled attribute is defined, the window command will call it as a condition before running the text command.", "name": "__new__", "signature": "def __new__(cls, classname, bases, dictionary)" }, { "docstring": "Fu...
5
stack_v2_sparse_classes_30k_train_009350
Implement the Python class `HybridCommandMeta` described below. Class description: A TextCommand can use this as its metaclass to automatically create a window command and an application command that will run the given text command for the active window and view. Useful when writing a text command that you want to run...
Implement the Python class `HybridCommandMeta` described below. Class description: A TextCommand can use this as its metaclass to automatically create a window command and an application command that will run the given text command for the active window and view. Useful when writing a text command that you want to run...
cd02a3a50e2eb97dd8368b72ea5669784a81dddd
<|skeleton|> class HybridCommandMeta: """A TextCommand can use this as its metaclass to automatically create a window command and an application command that will run the given text command for the active window and view. Useful when writing a text command that you want to run as a build system.""" def __new__...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HybridCommandMeta: """A TextCommand can use this as its metaclass to automatically create a window command and an application command that will run the given text command for the active window and view. Useful when writing a text command that you want to run as a build system.""" def __new__(cls, classna...
the_stack_v2_python_sparse
classes/command_templates.py
kbaskett248/Focus
train
0
937764634aea8e414b00d1cf39c0d92a8b1fa877
[ "if id is None:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects\nelse:\n self.id = id", "if list_dictionaries is None or list_dictionaries is []:\n return '[]'\nreturn json.dumps(list_dictionaries)", "mtlist = []\nmtfile = cls.__name__ + '.json'\nif list_objs:\n for increment in list_objs:...
<|body_start_0|> if id is None: Base.__nb_objects += 1 self.id = Base.__nb_objects else: self.id = id <|end_body_0|> <|body_start_1|> if list_dictionaries is None or list_dictionaries is []: return '[]' return json.dumps(list_dictionaries)...
Fragile. Don't drop
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """Fragile. Don't drop""" def __init__(self, id=None): """Base constructor""" <|body_0|> def to_json_string(list_dictionaries): """return json string""" <|body_1|> def save_to_file(cls, list_objs): """Save list_objs to json string""" ...
stack_v2_sparse_classes_36k_train_027605
1,767
no_license
[ { "docstring": "Base constructor", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "return json string", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "Save list_objs to json string", "name": ...
4
stack_v2_sparse_classes_30k_train_005510
Implement the Python class `Base` described below. Class description: Fragile. Don't drop Method signatures and docstrings: - def __init__(self, id=None): Base constructor - def to_json_string(list_dictionaries): return json string - def save_to_file(cls, list_objs): Save list_objs to json string - def from_json_stri...
Implement the Python class `Base` described below. Class description: Fragile. Don't drop Method signatures and docstrings: - def __init__(self, id=None): Base constructor - def to_json_string(list_dictionaries): return json string - def save_to_file(cls, list_objs): Save list_objs to json string - def from_json_stri...
dcad3daba72465b20fa1d1dee7c728981b5e33b1
<|skeleton|> class Base: """Fragile. Don't drop""" def __init__(self, id=None): """Base constructor""" <|body_0|> def to_json_string(list_dictionaries): """return json string""" <|body_1|> def save_to_file(cls, list_objs): """Save list_objs to json string""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """Fragile. Don't drop""" def __init__(self, id=None): """Base constructor""" if id is None: Base.__nb_objects += 1 self.id = Base.__nb_objects else: self.id = id def to_json_string(list_dictionaries): """return json string"""...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
Christopher-Caswell/holbertonschool-higher_level_programming
train
0
9280b8a652b605b6c18b40ac13aa790e819341b4
[ "content_type = ContentType.objects.get_for_model(instance.__class__)\nobject_id = instance.id\nqueryset = super(UserTrackerManager, self).filter(content_type=content_type, object_id=object_id)\nreturn queryset", "if request.user.is_authenticated:\n viewed_item = self.filter_by_model(instance=instance).filter(...
<|body_start_0|> content_type = ContentType.objects.get_for_model(instance.__class__) object_id = instance.id queryset = super(UserTrackerManager, self).filter(content_type=content_type, object_id=object_id) return queryset <|end_body_0|> <|body_start_1|> if request.user.is_auth...
UserTrackerManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTrackerManager: def filter_by_model(self, instance): """bar assasse model filter mikone""" <|body_0|> def recommended_list(self, request, instance): """ye recommended list bar assasse category va session""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027606
3,879
permissive
[ { "docstring": "bar assasse model filter mikone", "name": "filter_by_model", "signature": "def filter_by_model(self, instance)" }, { "docstring": "ye recommended list bar assasse category va session", "name": "recommended_list", "signature": "def recommended_list(self, request, instance)...
2
stack_v2_sparse_classes_30k_train_017753
Implement the Python class `UserTrackerManager` described below. Class description: Implement the UserTrackerManager class. Method signatures and docstrings: - def filter_by_model(self, instance): bar assasse model filter mikone - def recommended_list(self, request, instance): ye recommended list bar assasse category...
Implement the Python class `UserTrackerManager` described below. Class description: Implement the UserTrackerManager class. Method signatures and docstrings: - def filter_by_model(self, instance): bar assasse model filter mikone - def recommended_list(self, request, instance): ye recommended list bar assasse category...
aef47922fdd6488550881ed9d42bf30a0d33a32a
<|skeleton|> class UserTrackerManager: def filter_by_model(self, instance): """bar assasse model filter mikone""" <|body_0|> def recommended_list(self, request, instance): """ye recommended list bar assasse category va session""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserTrackerManager: def filter_by_model(self, instance): """bar assasse model filter mikone""" content_type = ContentType.objects.get_for_model(instance.__class__) object_id = instance.id queryset = super(UserTrackerManager, self).filter(content_type=content_type, object_id=obj...
the_stack_v2_python_sparse
src/usertrackers/models.py
m3h-D/Myinfoblog
train
0
5796750b78980b4ac77ea21cb1d8cd39b1c538d0
[ "filter_data = dict(self.request.arguments)\nconfigurations = get_all_config_dicts(self.session, filter_data)\ngrouped_configurations = {}\nfor config in configurations:\n if config['section'] not in grouped_configurations:\n grouped_configurations[config['section']] = []\n grouped_configurations[confi...
<|body_start_0|> filter_data = dict(self.request.arguments) configurations = get_all_config_dicts(self.session, filter_data) grouped_configurations = {} for config in configurations: if config['section'] not in grouped_configurations: grouped_configurations[co...
Update framework settings and tool paths.
ConfigurationHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigurationHandler: """Update framework settings and tool paths.""" def get(self): """Return all configuration items. **Example request**: .. sourcecode:: http GET /api/v1/configuration HTTP/1.1 Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Con...
stack_v2_sparse_classes_36k_train_027607
2,791
permissive
[ { "docstring": "Return all configuration items. **Example request**: .. sourcecode:: http GET /api/v1/configuration HTTP/1.1 Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { \"status\": \"success\", \"data\": [ { \"dirty\": false, \"key\": \"AT...
2
stack_v2_sparse_classes_30k_train_003254
Implement the Python class `ConfigurationHandler` described below. Class description: Update framework settings and tool paths. Method signatures and docstrings: - def get(self): Return all configuration items. **Example request**: .. sourcecode:: http GET /api/v1/configuration HTTP/1.1 Accept: application/json **Exa...
Implement the Python class `ConfigurationHandler` described below. Class description: Update framework settings and tool paths. Method signatures and docstrings: - def get(self): Return all configuration items. **Example request**: .. sourcecode:: http GET /api/v1/configuration HTTP/1.1 Accept: application/json **Exa...
240825989a3850241b6b5dba6bcae1042a5dc384
<|skeleton|> class ConfigurationHandler: """Update framework settings and tool paths.""" def get(self): """Return all configuration items. **Example request**: .. sourcecode:: http GET /api/v1/configuration HTTP/1.1 Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Con...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigurationHandler: """Update framework settings and tool paths.""" def get(self): """Return all configuration items. **Example request**: .. sourcecode:: http GET /api/v1/configuration HTTP/1.1 Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: ap...
the_stack_v2_python_sparse
owtf/api/handlers/config.py
owtf/owtf
train
1,683
5159c412f7c30d9092558bdee9c06cbfcf490bf0
[ "if os.path.exists(fname):\n self.file = open(fname, 'rb')\n self.magic_t, self.elsize, _, self.dim, _ = _read_header(self.file, False)\n self.gz = False\nelse:\n import gzip\n self.file = gzip.open(fname + '.gz', 'rb')\n self.magic_t, self.elsize, _, self.dim, _ = _read_header(self.file, False, T...
<|body_start_0|> if os.path.exists(fname): self.file = open(fname, 'rb') self.magic_t, self.elsize, _, self.dim, _ = _read_header(self.file, False) self.gz = False else: import gzip self.file = gzip.open(fname + '.gz', 'rb') self.ma...
FTFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FTFile: def __init__(self, fname, scale=1, dtype=None): """Tests: >>> f = FTFile('/data/lisa/data/nist/by_class/digits/digits_test_labels.ft')""" <|body_0|> def skip(self, num): """Skips `num` items in the file. If `num` is negative, skips size-num. Tests: >>> f = FT...
stack_v2_sparse_classes_36k_train_027608
9,679
permissive
[ { "docstring": "Tests: >>> f = FTFile('/data/lisa/data/nist/by_class/digits/digits_test_labels.ft')", "name": "__init__", "signature": "def __init__(self, fname, scale=1, dtype=None)" }, { "docstring": "Skips `num` items in the file. If `num` is negative, skips size-num. Tests: >>> f = FTFile('/...
3
stack_v2_sparse_classes_30k_train_003756
Implement the Python class `FTFile` described below. Class description: Implement the FTFile class. Method signatures and docstrings: - def __init__(self, fname, scale=1, dtype=None): Tests: >>> f = FTFile('/data/lisa/data/nist/by_class/digits/digits_test_labels.ft') - def skip(self, num): Skips `num` items in the fi...
Implement the Python class `FTFile` described below. Class description: Implement the FTFile class. Method signatures and docstrings: - def __init__(self, fname, scale=1, dtype=None): Tests: >>> f = FTFile('/data/lisa/data/nist/by_class/digits/digits_test_labels.ft') - def skip(self, num): Skips `num` items in the fi...
7881458caaf2f5ab82b130ee50cb933cf12f6de7
<|skeleton|> class FTFile: def __init__(self, fname, scale=1, dtype=None): """Tests: >>> f = FTFile('/data/lisa/data/nist/by_class/digits/digits_test_labels.ft')""" <|body_0|> def skip(self, num): """Skips `num` items in the file. If `num` is negative, skips size-num. Tests: >>> f = FT...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FTFile: def __init__(self, fname, scale=1, dtype=None): """Tests: >>> f = FTFile('/data/lisa/data/nist/by_class/digits/digits_test_labels.ft')""" if os.path.exists(fname): self.file = open(fname, 'rb') self.magic_t, self.elsize, _, self.dim, _ = _read_header(self.file, ...
the_stack_v2_python_sparse
datasets/ift6266/datasets/ftfile.py
sauravbiswasiupr/image_transformations
train
0
56ce47752cabfbc1604a1d051a305a6a741bfae4
[ "res = 0\nn = len(nums)\nevs = [nums[x] for x in range(n) if x % 2 == 0]\nods = [nums[x] for x in range(n) if x % 2 != 0]\nreturn sum((min(evs[x], ods[x]) for x in range(n / 2)))", "nums.sort()\nneg = []\nres = 0\nres += self.get_sum(nums)\nreturn res" ]
<|body_start_0|> res = 0 n = len(nums) evs = [nums[x] for x in range(n) if x % 2 == 0] ods = [nums[x] for x in range(n) if x % 2 != 0] return sum((min(evs[x], ods[x]) for x in range(n / 2))) <|end_body_0|> <|body_start_1|> nums.sort() neg = [] res = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def get_sum(self, nums): """Doc""" <|body_0|> def arrayPairSum(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 n = len(nums) evs = [nums[x] for x in range(n) if x % ...
stack_v2_sparse_classes_36k_train_027609
517
no_license
[ { "docstring": "Doc", "name": "get_sum", "signature": "def get_sum(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "arrayPairSum", "signature": "def arrayPairSum(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_sum(self, nums): Doc - def arrayPairSum(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_sum(self, nums): Doc - def arrayPairSum(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def get_sum(self, nums): """Doc""" ...
b00f649598a6e57af30b517baa304f3094345f6d
<|skeleton|> class Solution: def get_sum(self, nums): """Doc""" <|body_0|> def arrayPairSum(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def get_sum(self, nums): """Doc""" res = 0 n = len(nums) evs = [nums[x] for x in range(n) if x % 2 == 0] ods = [nums[x] for x in range(n) if x % 2 != 0] return sum((min(evs[x], ods[x]) for x in range(n / 2))) def arrayPairSum(self, nums): ...
the_stack_v2_python_sparse
array_pair_sum.py
grewy/practice_py
train
0
51f56fb37962b9359abc76f42f1d2731b8b11e46
[ "super().__init__(axis, sample_weight, from_logits, ignore_index, cutoff, label_smooth, reduction, name)\nself.smooth = smooth\nself.is_logsoftmax = False\nself.need_target_onehot = True\nself.is_multiselection = False\nself._built = True", "if self.is_logsoftmax:\n output = exp(output)\nreduce_axes = list(ran...
<|body_start_0|> super().__init__(axis, sample_weight, from_logits, ignore_index, cutoff, label_smooth, reduction, name) self.smooth = smooth self.is_logsoftmax = False self.need_target_onehot = True self.is_multiselection = False self._built = True <|end_body_0|> <|body...
This criterion combines :func:`nn.LogSoftmax` and :func:`nn.NLLLoss` in one single class. It is useful when training a classification problem with `C` classes. If provided, the optional argument :attr:`weight` should be a 1D `Tensor` assigning weight to each of the classes. This is particularly useful when you have an ...
DiceLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiceLoss: """This criterion combines :func:`nn.LogSoftmax` and :func:`nn.NLLLoss` in one single class. It is useful when training a classification problem with `C` classes. If provided, the optional argument :attr:`weight` should be a 1D `Tensor` assigning weight to each of the classes. This is p...
stack_v2_sparse_classes_36k_train_027610
35,108
permissive
[ { "docstring": "Args: axis (int): the axis where the class label is. sample_weight (): from_logits (): ignore_index (): cutoff (): label_smooth (): reduction (string): name (stringf):", "name": "__init__", "signature": "def __init__(self, smooth=1.0, axis=-1, sample_weight=None, from_logits=False, ignor...
2
stack_v2_sparse_classes_30k_train_008427
Implement the Python class `DiceLoss` described below. Class description: This criterion combines :func:`nn.LogSoftmax` and :func:`nn.NLLLoss` in one single class. It is useful when training a classification problem with `C` classes. If provided, the optional argument :attr:`weight` should be a 1D `Tensor` assigning w...
Implement the Python class `DiceLoss` described below. Class description: This criterion combines :func:`nn.LogSoftmax` and :func:`nn.NLLLoss` in one single class. It is useful when training a classification problem with `C` classes. If provided, the optional argument :attr:`weight` should be a 1D `Tensor` assigning w...
8d0726c77836599238004252485cad971fca31bc
<|skeleton|> class DiceLoss: """This criterion combines :func:`nn.LogSoftmax` and :func:`nn.NLLLoss` in one single class. It is useful when training a classification problem with `C` classes. If provided, the optional argument :attr:`weight` should be a 1D `Tensor` assigning weight to each of the classes. This is p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiceLoss: """This criterion combines :func:`nn.LogSoftmax` and :func:`nn.NLLLoss` in one single class. It is useful when training a classification problem with `C` classes. If provided, the optional argument :attr:`weight` should be a 1D `Tensor` assigning weight to each of the classes. This is particularly u...
the_stack_v2_python_sparse
trident/optims/tensorflow_losses.py
yingkung/trident
train
0
1ab16b9729a3c1b686096029639b287cb9201cb7
[ "org_id = self.get_organization(request)\norg = Organization.objects.get(pk=org_id)\ndatasets = []\nfor d in ImportRecord.objects.filter(super_organization=org):\n importfiles = [obj_to_dict(f) for f in d.files]\n dataset = obj_to_dict(d)\n dataset['importfiles'] = importfiles\n if d.last_modified_by:\n...
<|body_start_0|> org_id = self.get_organization(request) org = Organization.objects.get(pk=org_id) datasets = [] for d in ImportRecord.objects.filter(super_organization=org): importfiles = [obj_to_dict(f) for f in d.files] dataset = obj_to_dict(d) data...
DatasetViewSet
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetViewSet: def list(self, request): """Retrieves all datasets for the user's organization.""" <|body_0|> def update(self, request, pk=None): """Updates the name of a dataset (ImportRecord).""" <|body_1|> def retrieve(self, request, pk=None): ...
stack_v2_sparse_classes_36k_train_027611
8,810
permissive
[ { "docstring": "Retrieves all datasets for the user's organization.", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Updates the name of a dataset (ImportRecord).", "name": "update", "signature": "def update(self, request, pk=None)" }, { "docstring": "R...
6
null
Implement the Python class `DatasetViewSet` described below. Class description: Implement the DatasetViewSet class. Method signatures and docstrings: - def list(self, request): Retrieves all datasets for the user's organization. - def update(self, request, pk=None): Updates the name of a dataset (ImportRecord). - def...
Implement the Python class `DatasetViewSet` described below. Class description: Implement the DatasetViewSet class. Method signatures and docstrings: - def list(self, request): Retrieves all datasets for the user's organization. - def update(self, request, pk=None): Updates the name of a dataset (ImportRecord). - def...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class DatasetViewSet: def list(self, request): """Retrieves all datasets for the user's organization.""" <|body_0|> def update(self, request, pk=None): """Updates the name of a dataset (ImportRecord).""" <|body_1|> def retrieve(self, request, pk=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetViewSet: def list(self, request): """Retrieves all datasets for the user's organization.""" org_id = self.get_organization(request) org = Organization.objects.get(pk=org_id) datasets = [] for d in ImportRecord.objects.filter(super_organization=org): i...
the_stack_v2_python_sparse
seed/views/v3/datasets.py
SEED-platform/seed
train
108
62773eb73917c27b01cb5ee11edba17b531017cc
[ "super(littleConv, self).__init__()\nself.main = nn.Sequential(nn.Conv2d(num_channels, 64, 4, 2, 1, bias=False), nn.ReLU(True), nn.BatchNorm2d(64), nn.Conv2d(64, 128, 4, 2, 1, bias=False), nn.ReLU(True), nn.BatchNorm2d(128), nn.Conv2d(128, 256, 4, 2, 1, bias=False), nn.ReLU(True), nn.BatchNorm2d(256), nn.Conv2d(256...
<|body_start_0|> super(littleConv, self).__init__() self.main = nn.Sequential(nn.Conv2d(num_channels, 64, 4, 2, 1, bias=False), nn.ReLU(True), nn.BatchNorm2d(64), nn.Conv2d(64, 128, 4, 2, 1, bias=False), nn.ReLU(True), nn.BatchNorm2d(128), nn.Conv2d(128, 256, 4, 2, 1, bias=False), nn.ReLU(True), nn.Batc...
Class encoder
littleConv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class littleConv: """Class encoder""" def __init__(self, c_dim, z_dim=200, num_channels=1, std=0.02): """Initialization conv -> ReLU x 4 -> (mu, sigma)""" <|body_0|> def init_weights(self): """Weight Initialization""" <|body_1|> def forward(self, input): ...
stack_v2_sparse_classes_36k_train_027612
3,780
no_license
[ { "docstring": "Initialization conv -> ReLU x 4 -> (mu, sigma)", "name": "__init__", "signature": "def __init__(self, c_dim, z_dim=200, num_channels=1, std=0.02)" }, { "docstring": "Weight Initialization", "name": "init_weights", "signature": "def init_weights(self)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_010399
Implement the Python class `littleConv` described below. Class description: Class encoder Method signatures and docstrings: - def __init__(self, c_dim, z_dim=200, num_channels=1, std=0.02): Initialization conv -> ReLU x 4 -> (mu, sigma) - def init_weights(self): Weight Initialization - def forward(self, input): Defin...
Implement the Python class `littleConv` described below. Class description: Class encoder Method signatures and docstrings: - def __init__(self, c_dim, z_dim=200, num_channels=1, std=0.02): Initialization conv -> ReLU x 4 -> (mu, sigma) - def init_weights(self): Weight Initialization - def forward(self, input): Defin...
21c0bf459388bd616a64afc1a34441123b1f41fe
<|skeleton|> class littleConv: """Class encoder""" def __init__(self, c_dim, z_dim=200, num_channels=1, std=0.02): """Initialization conv -> ReLU x 4 -> (mu, sigma)""" <|body_0|> def init_weights(self): """Weight Initialization""" <|body_1|> def forward(self, input): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class littleConv: """Class encoder""" def __init__(self, c_dim, z_dim=200, num_channels=1, std=0.02): """Initialization conv -> ReLU x 4 -> (mu, sigma)""" super(littleConv, self).__init__() self.main = nn.Sequential(nn.Conv2d(num_channels, 64, 4, 2, 1, bias=False), nn.ReLU(True), nn.Bat...
the_stack_v2_python_sparse
classification/models/littleConv.py
CHOcho-quan/CS385ML
train
1
f57f8c67a69c06f9a5ecfa2a4448e33dce196d67
[ "self.stock = {}\nfor order_item, order_value in items_dictionary.items():\n self.stock[order_item] = Item(order_item, order_value)", "item_in_stock = self.stock.get(item.name, None)\nif item_in_stock:\n return item_in_stock.quantity\nelse:\n return 0", "item_in_stock = self.stock.get(order_item.name, ...
<|body_start_0|> self.stock = {} for order_item, order_value in items_dictionary.items(): self.stock[order_item] = Item(order_item, order_value) <|end_body_0|> <|body_start_1|> item_in_stock = self.stock.get(item.name, None) if item_in_stock: return item_in_stock...
This is the implementation of the Inventory class, which keeps stocks item available in a warehouse
Inventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inventory: """This is the implementation of the Inventory class, which keeps stocks item available in a warehouse""" def __init__(self, items_dictionary): """This method initializes an instance of the the Inventory Input: items_dictionary (dict) - Specifies how much of a particular i...
stack_v2_sparse_classes_36k_train_027613
1,874
no_license
[ { "docstring": "This method initializes an instance of the the Inventory Input: items_dictionary (dict) - Specifies how much of a particular item is present", "name": "__init__", "signature": "def __init__(self, items_dictionary)" }, { "docstring": "Aim: Checks how much of an item is in the inve...
3
stack_v2_sparse_classes_30k_train_017298
Implement the Python class `Inventory` described below. Class description: This is the implementation of the Inventory class, which keeps stocks item available in a warehouse Method signatures and docstrings: - def __init__(self, items_dictionary): This method initializes an instance of the the Inventory Input: items...
Implement the Python class `Inventory` described below. Class description: This is the implementation of the Inventory class, which keeps stocks item available in a warehouse Method signatures and docstrings: - def __init__(self, items_dictionary): This method initializes an instance of the the Inventory Input: items...
090727798af5ddaa948bcfd05924481ba1b45d1c
<|skeleton|> class Inventory: """This is the implementation of the Inventory class, which keeps stocks item available in a warehouse""" def __init__(self, items_dictionary): """This method initializes an instance of the the Inventory Input: items_dictionary (dict) - Specifies how much of a particular i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Inventory: """This is the implementation of the Inventory class, which keeps stocks item available in a warehouse""" def __init__(self, items_dictionary): """This method initializes an instance of the the Inventory Input: items_dictionary (dict) - Specifies how much of a particular item is presen...
the_stack_v2_python_sparse
inventory-allocator/Inventory.py
Priyansdesai/recruiting-exercises
train
0
2ef2d4c6fec829adb6502f7c13ec3acaa227ec87
[ "self._input_size = input_size\nself._num_classes = num_classes\nself._num_channels = num_channels\nself._image_field_key = image_field_key\nself._label_field_key = label_field_key\nself._dtype = dtype\nself._label_dtype = label_dtype", "image = tf.io.decode_raw(data[self._image_field_key], tf.as_dtype(tf.float32...
<|body_start_0|> self._input_size = input_size self._num_classes = num_classes self._num_channels = num_channels self._image_field_key = image_field_key self._label_field_key = label_field_key self._dtype = dtype self._label_dtype = label_dtype <|end_body_0|> <|b...
Parser to parse an image and its annotations into a dictionary of tensors.
Parser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser: """Parser to parse an image and its annotations into a dictionary of tensors.""" def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_key: str='image/class/label', dtype: str='float32', label_dtype: str...
stack_v2_sparse_classes_36k_train_027614
4,231
permissive
[ { "docstring": "Initializes parameters for parsing annotations in the dataset. Args: input_size: The input tensor size of [height, width, volume] of input image. num_classes: The number of classes to be segmented. num_channels: The channel of input images. image_field_key: A `str` of the key name to encoded ima...
4
stack_v2_sparse_classes_30k_train_000788
Implement the Python class `Parser` described below. Class description: Parser to parse an image and its annotations into a dictionary of tensors. Method signatures and docstrings: - def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_...
Implement the Python class `Parser` described below. Class description: Parser to parse an image and its annotations into a dictionary of tensors. Method signatures and docstrings: - def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class Parser: """Parser to parse an image and its annotations into a dictionary of tensors.""" def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_key: str='image/class/label', dtype: str='float32', label_dtype: str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parser: """Parser to parse an image and its annotations into a dictionary of tensors.""" def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_key: str='image/class/label', dtype: str='float32', label_dtype: str='float32'): ...
the_stack_v2_python_sparse
official/projects/volumetric_models/dataloaders/segmentation_input_3d.py
jianzhnie/models
train
2
4f13b37cf7239e4fc3e6a88bc36c2126c8395cbf
[ "self.root = root\nself.root.geometry(f'{WIDTH}x{HEIGHT}')\ngrid_configure(self.root, 2, 0, row_weights=[1, 1, 20])\nself._init_menu()\nself._init_viz()", "self.menu = tk.Menu(master=self.root, relief='raised')\nself.root.config(menu=self.menu)\nself.menu_config = tk.Menu(master=self.menu, tearoff=0)\nself.menu.a...
<|body_start_0|> self.root = root self.root.geometry(f'{WIDTH}x{HEIGHT}') grid_configure(self.root, 2, 0, row_weights=[1, 1, 20]) self._init_menu() self._init_viz() <|end_body_0|> <|body_start_1|> self.menu = tk.Menu(master=self.root, relief='raised') self.root.c...
ScientistView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScientistView: def __init__(self, root): """GUI initialization""" <|body_0|> def _init_menu(self): """Menu initialization""" <|body_1|> def _init_viz(self): """Visualization initialization""" <|body_2|> def activate_viz(self): ...
stack_v2_sparse_classes_36k_train_027615
3,535
permissive
[ { "docstring": "GUI initialization", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": "Menu initialization", "name": "_init_menu", "signature": "def _init_menu(self)" }, { "docstring": "Visualization initialization", "name": "_init_viz", "sign...
4
stack_v2_sparse_classes_30k_train_013596
Implement the Python class `ScientistView` described below. Class description: Implement the ScientistView class. Method signatures and docstrings: - def __init__(self, root): GUI initialization - def _init_menu(self): Menu initialization - def _init_viz(self): Visualization initialization - def activate_viz(self): a...
Implement the Python class `ScientistView` described below. Class description: Implement the ScientistView class. Method signatures and docstrings: - def __init__(self, root): GUI initialization - def _init_menu(self): Menu initialization - def _init_viz(self): Visualization initialization - def activate_viz(self): a...
272d88be7ab617a58d3f241d10f4f9fd17b91cbc
<|skeleton|> class ScientistView: def __init__(self, root): """GUI initialization""" <|body_0|> def _init_menu(self): """Menu initialization""" <|body_1|> def _init_viz(self): """Visualization initialization""" <|body_2|> def activate_viz(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScientistView: def __init__(self, root): """GUI initialization""" self.root = root self.root.geometry(f'{WIDTH}x{HEIGHT}') grid_configure(self.root, 2, 0, row_weights=[1, 1, 20]) self._init_menu() self._init_viz() def _init_menu(self): """Menu initi...
the_stack_v2_python_sparse
system/scientist/view/main.py
thuchula6792/AutoOED
train
0
599335427fffc97d46e9023de8f0dba1753c4857
[ "self.passive_copy_preference_server_guid_list = passive_copy_preference_server_guid_list\nself.passive_only = passive_only\nself.use_user_specified_passive_preference_order = use_user_specified_passive_preference_order", "if dictionary is None:\n return None\npassive_copy_preference_server_guid_list = diction...
<|body_start_0|> self.passive_copy_preference_server_guid_list = passive_copy_preference_server_guid_list self.passive_only = passive_only self.use_user_specified_passive_preference_order = use_user_specified_passive_preference_order <|end_body_0|> <|body_start_1|> if dictionary is None...
Implementation of the 'ExchangeDAGProtectionPreference' model. Specifies the information about the preference order while choosing between which database copy of the database which is part of DAG should be protected. Attributes: passive_copy_preference_server_guid_list (list of string): Specifies the preference order o...
ExchangeDAGProtectionPreference
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExchangeDAGProtectionPreference: """Implementation of the 'ExchangeDAGProtectionPreference' model. Specifies the information about the preference order while choosing between which database copy of the database which is part of DAG should be protected. Attributes: passive_copy_preference_server_g...
stack_v2_sparse_classes_36k_train_027616
3,474
permissive
[ { "docstring": "Constructor for the ExchangeDAGProtectionPreference class", "name": "__init__", "signature": "def __init__(self, passive_copy_preference_server_guid_list=None, passive_only=None, use_user_specified_passive_preference_order=None)" }, { "docstring": "Creates an instance of this mod...
2
stack_v2_sparse_classes_30k_train_005914
Implement the Python class `ExchangeDAGProtectionPreference` described below. Class description: Implementation of the 'ExchangeDAGProtectionPreference' model. Specifies the information about the preference order while choosing between which database copy of the database which is part of DAG should be protected. Attri...
Implement the Python class `ExchangeDAGProtectionPreference` described below. Class description: Implementation of the 'ExchangeDAGProtectionPreference' model. Specifies the information about the preference order while choosing between which database copy of the database which is part of DAG should be protected. Attri...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ExchangeDAGProtectionPreference: """Implementation of the 'ExchangeDAGProtectionPreference' model. Specifies the information about the preference order while choosing between which database copy of the database which is part of DAG should be protected. Attributes: passive_copy_preference_server_g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExchangeDAGProtectionPreference: """Implementation of the 'ExchangeDAGProtectionPreference' model. Specifies the information about the preference order while choosing between which database copy of the database which is part of DAG should be protected. Attributes: passive_copy_preference_server_guid_list (lis...
the_stack_v2_python_sparse
cohesity_management_sdk/models/exchange_dag_protection_preference.py
cohesity/management-sdk-python
train
24
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._name = f'{name} Drum {color}'\nself._color = color\nself._unit_of_measurement = PERCENTAGE\nself._id_suffix = f'_drum_{color}'", "if self.syncthru.is_online():\n self._attributes = self.syncthru.drum_status().get(self._color, {})\n self._state = self._attributes.get(...
<|body_start_0|> super().__init__(syncthru, name) self._name = f'{name} Drum {color}' self._color = color self._unit_of_measurement = PERCENTAGE self._id_suffix = f'_drum_{color}' <|end_body_0|> <|body_start_1|> if self.syncthru.is_online(): self._attributes ...
Implementation of a Samsung Printer toner sensor platform.
SyncThruDrumSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruDrumSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" <|body_...
stack_v2_sparse_classes_36k_train_027617
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name, color)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_014320
Implement the Python class `SyncThruDrumSensor` described below. Class description: Implementation of a Samsung Printer toner sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, color): Initialize the sensor. - def update(self): Get the latest data from SyncThru and update the stat...
Implement the Python class `SyncThruDrumSensor` described below. Class description: Implementation of a Samsung Printer toner sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, color): Initialize the sensor. - def update(self): Get the latest data from SyncThru and update the stat...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruDrumSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyncThruDrumSensor: """Implementation of a Samsung Printer toner sensor platform.""" def __init__(self, syncthru, name, color): """Initialize the sensor.""" super().__init__(syncthru, name) self._name = f'{name} Drum {color}' self._color = color self._unit_of_measu...
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
a83cd5f7267b566e3b482e1ab6acec71a54a0d8c
[ "data = parse(filename)\ntotal = 0\nfor equation in data:\n total += p1_eval(equation)\nreturn total", "data = parse(filename)\ntotal = 0\nfor equation in data:\n total += p2_eval(equation)\nreturn total" ]
<|body_start_0|> data = parse(filename) total = 0 for equation in data: total += p1_eval(equation) return total <|end_body_0|> <|body_start_1|> data = parse(filename) total = 0 for equation in data: total += p2_eval(equation) retur...
AoC 2020 Day 18
Day18
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day18: """AoC 2020 Day 18""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 18 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2020 day 18 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027618
3,361
no_license
[ { "docstring": "Given a filename, solve 2020 day 18 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2020 day 18 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_011139
Implement the Python class `Day18` described below. Class description: AoC 2020 Day 18 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2020 day 18 part 1 - def part2(filename: str) -> int: Given a filename, solve 2020 day 18 part 2
Implement the Python class `Day18` described below. Class description: AoC 2020 Day 18 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2020 day 18 part 1 - def part2(filename: str) -> int: Given a filename, solve 2020 day 18 part 2 <|skeleton|> class Day18: """AoC 202...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day18: """AoC 2020 Day 18""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 18 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2020 day 18 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day18: """AoC 2020 Day 18""" def part1(filename: str) -> int: """Given a filename, solve 2020 day 18 part 1""" data = parse(filename) total = 0 for equation in data: total += p1_eval(equation) return total def part2(filename: str) -> int: "...
the_stack_v2_python_sparse
2020/python2020/aoc/day18.py
mreishus/aoc
train
16
a3365003191c1ce10b7709b99d7a085d92f282c9
[ "super().__init__(category, owner, ttl=ttl)\nself.lock_id_seq = itertools.count()\nself.items: Dict[str, Set[str]] = {}\nself.items_condition = Condition()", "def is_ready():\n for locked in self.items.values():\n if locked.intersection(items_set):\n metrics[f'lock_{self.category}_misses'] +=...
<|body_start_0|> super().__init__(category, owner, ttl=ttl) self.lock_id_seq = itertools.count() self.items: Dict[str, Set[str]] = {} self.items_condition = Condition() <|end_body_0|> <|body_start_1|> def is_ready(): for locked in self.items.values(): ...
Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```
ProcessLock
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessLock: """Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```""" def __init__(self, category: str, own...
stack_v2_sparse_classes_36k_train_027619
2,673
permissive
[ { "docstring": ":param category: Lock category name :param owner: Lock owner id :param ttl: Default lock ttl in seconds", "name": "__init__", "signature": "def __init__(self, category: str, owner: str, ttl: Optional[float]=None)" }, { "docstring": "Acquire lock by list of items", "name": "ac...
3
stack_v2_sparse_classes_30k_train_000762
Implement the Python class `ProcessLock` described below. Class description: Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ``` Metho...
Implement the Python class `ProcessLock` described below. Class description: Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ``` Metho...
6e6d71574e9b9d822bec572cc629a0ea73604a59
<|skeleton|> class ProcessLock: """Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```""" def __init__(self, category: str, own...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessLock: """Distributed locking primitive. Allows exclusive access to all requested items within category between the threads of single process. Example ------- ``` lock = ProcessLock("test", "test:12") with lock.acquire(["obj1", "obj2"]): ... ```""" def __init__(self, category: str, owner: str, ttl:...
the_stack_v2_python_sparse
core/lock/process.py
nocproject/noc
train
105
a34dee34c65159293b8e595fd0ea592df2f3d049
[ "@lru_cache(None)\ndef dfs(index: int, remain: int) -> int:\n if index == len(goods):\n return 0\n res = dfs(index + 1, remain)\n cost, score = goods[index]\n if remain >= cost:\n res = max(res, dfs(index + 1, remain - cost) + score)\n return res\ngoods = [(cur, next - cur) for cur, nex...
<|body_start_0|> @lru_cache(None) def dfs(index: int, remain: int) -> int: if index == len(goods): return 0 res = dfs(index + 1, remain) cost, score = goods[index] if remain >= cost: res = max(res, dfs(index + 1, remain - co...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximumProfit(self, A: List[int], B: List[int], k: int) -> int: """2564 ms""" <|body_0|> def maximumProfit2(self, A: List[int], B: List[int], k: int) -> int: """852 ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> @lru_cache(None) ...
stack_v2_sparse_classes_36k_train_027620
1,192
no_license
[ { "docstring": "2564 ms", "name": "maximumProfit", "signature": "def maximumProfit(self, A: List[int], B: List[int], k: int) -> int" }, { "docstring": "852 ms", "name": "maximumProfit2", "signature": "def maximumProfit2(self, A: List[int], B: List[int], k: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumProfit(self, A: List[int], B: List[int], k: int) -> int: 2564 ms - def maximumProfit2(self, A: List[int], B: List[int], k: int) -> int: 852 ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumProfit(self, A: List[int], B: List[int], k: int) -> int: 2564 ms - def maximumProfit2(self, A: List[int], B: List[int], k: int) -> int: 852 ms <|skeleton|> class Solu...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def maximumProfit(self, A: List[int], B: List[int], k: int) -> int: """2564 ms""" <|body_0|> def maximumProfit2(self, A: List[int], B: List[int], k: int) -> int: """852 ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maximumProfit(self, A: List[int], B: List[int], k: int) -> int: """2564 ms""" @lru_cache(None) def dfs(index: int, remain: int) -> int: if index == len(goods): return 0 res = dfs(index + 1, remain) cost, score = goods[in...
the_stack_v2_python_sparse
11_动态规划/背包问题/01背包/2291. Maximum Profit From Trading Stocks.py
981377660LMT/algorithm-study
train
225
dfe5f02b50716f99ace689d257d999318f32bf80
[ "def dfs(nums, k, val):\n \"\"\"\n Check if there is a subset with sum equal to val\n k: the number of elements to check. Current subset should be [0..k-1]\n Reduce this problem into two sub-problems:\n 1. Do search val in [0..k-2]\n 2. Do search val-nums[k-...
<|body_start_0|> def dfs(nums, k, val): """ Check if there is a subset with sum equal to val k: the number of elements to check. Current subset should be [0..k-1] Reduce this problem into two sub-problems: 1. Do search v...
@ eBay dp Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input: [1, 5, 11, 5] Output: true Explana...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """@ eBay dp Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input...
stack_v2_sparse_classes_36k_train_027621
3,413
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition_recursive", "signature": "def canPartition_recursive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canPartition_dp", "signature": "def canPartition_dp(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_001474
Implement the Python class `Solution` described below. Class description: @ eBay dp Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array siz...
Implement the Python class `Solution` described below. Class description: @ eBay dp Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array siz...
cbe6a7e7f05eccb4f9c5fce8651c0d87e5168516
<|skeleton|> class Solution: """@ eBay dp Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """@ eBay dp Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input: [1, 5, 11, ...
the_stack_v2_python_sparse
src/dp/leetcode416_PartitionEqualSubsetSum.py
apepkuss/Cracking-Leetcode-in-Python
train
2
dd24ee8c8805e85348974c914551a1525393978c
[ "def wrapper(*arg):\n t1 = time.clock()\n res = func(*arg)\n t2 = time.clock()\n print('%0.3fms' % ((t2 - t1) * 1000.0))\n return res\nreturn wrapper", "@wraps(f)\ndef wrapp(*args, **kwargs):\n time_start = round(time.time(), 5)\n result = f(*args, **kwargs)\n time_end = round(time.time(),...
<|body_start_0|> def wrapper(*arg): t1 = time.clock() res = func(*arg) t2 = time.clock() print('%0.3fms' % ((t2 - t1) * 1000.0)) return res return wrapper <|end_body_0|> <|body_start_1|> @wraps(f) def wrapp(*args, **kwargs): ...
Decorators
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decorators: def decor0(self, func): """декоратор 0, позволяющий вместе с результатом функции возвращать время ее работы""" <|body_0|> def decor1(self, f): """декоратор 1, позволяющий вместе с результатом функции возвращать время ее работы""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_027622
3,283
no_license
[ { "docstring": "декоратор 0, позволяющий вместе с результатом функции возвращать время ее работы", "name": "decor0", "signature": "def decor0(self, func)" }, { "docstring": "декоратор 1, позволяющий вместе с результатом функции возвращать время ее работы", "name": "decor1", "signature": ...
5
stack_v2_sparse_classes_30k_train_019296
Implement the Python class `Decorators` described below. Class description: Implement the Decorators class. Method signatures and docstrings: - def decor0(self, func): декоратор 0, позволяющий вместе с результатом функции возвращать время ее работы - def decor1(self, f): декоратор 1, позволяющий вместе с результатом ...
Implement the Python class `Decorators` described below. Class description: Implement the Decorators class. Method signatures and docstrings: - def decor0(self, func): декоратор 0, позволяющий вместе с результатом функции возвращать время ее работы - def decor1(self, f): декоратор 1, позволяющий вместе с результатом ...
c3225516640d872b97139a5c2919d216d5370b17
<|skeleton|> class Decorators: def decor0(self, func): """декоратор 0, позволяющий вместе с результатом функции возвращать время ее работы""" <|body_0|> def decor1(self, f): """декоратор 1, позволяющий вместе с результатом функции возвращать время ее работы""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decorators: def decor0(self, func): """декоратор 0, позволяющий вместе с результатом функции возвращать время ее работы""" def wrapper(*arg): t1 = time.clock() res = func(*arg) t2 = time.clock() print('%0.3fms' % ((t2 - t1) * 1000.0)) ...
the_stack_v2_python_sparse
Homework11-20+22.03/Task0(decors).py
Twicer/Homeworks
train
0
74d2eb33645925e71f2abbb450e02ec2a2db890b
[ "self.name = name\nself.org_no = org_no\nself.uni_customer_no = uni_customer_no\nself.created_before = APIHelper.RFC3339DateTime(created_before) if created_before else None\nself.created_after = APIHelper.RFC3339DateTime(created_after) if created_after else None\nself.last_modified_before = APIHelper.RFC3339DateTim...
<|body_start_0|> self.name = name self.org_no = org_no self.uni_customer_no = uni_customer_no self.created_before = APIHelper.RFC3339DateTime(created_before) if created_before else None self.created_after = APIHelper.RFC3339DateTime(created_after) if created_after else None ...
Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TODO: type description here. created_after (dateti...
AccountSearchFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountSearchFilter: """Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TOD...
stack_v2_sparse_classes_36k_train_027623
4,978
permissive
[ { "docstring": "Constructor for the AccountSearchFilter class", "name": "__init__", "signature": "def __init__(self, name=None, org_no=None, uni_customer_no=None, created_before=None, created_after=None, last_modified_before=None, last_modified_after=None, dealer_name=None, dealer_reference=None, enable...
2
stack_v2_sparse_classes_30k_train_013166
Implement the Python class `AccountSearchFilter` described below. Class description: Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type descripti...
Implement the Python class `AccountSearchFilter` described below. Class description: Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type descripti...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class AccountSearchFilter: """Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TOD...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountSearchFilter: """Implementation of the 'AccountSearchFilter' model. TODO: type model description here. Attributes: name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created_before (datetime): TODO: type descr...
the_stack_v2_python_sparse
idfy_rest_client/models/account_search_filter.py
dealflowteam/Idfy
train
0
312d98cc9a1d211b5c6bccf390a19ca0c3251c49
[ "existing_rows = self.select(table, columns)\nunique = diff(existing_rows, values, y_only=True)\nkeys = self.get_primary_key_vals(table)\npk_col = self.get_primary_key(table)\npk_index = columns.index(pk_col)\nto_insert, to_update = ([], [])\nfor index, row in enumerate(unique):\n if row[pk_index] not in keys:\n...
<|body_start_0|> existing_rows = self.select(table, columns) unique = diff(existing_rows, values, y_only=True) keys = self.get_primary_key_vals(table) pk_col = self.get_primary_key(table) pk_index = columns.index(pk_col) to_insert, to_update = ([], []) for index, ...
Insert
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Insert: def insert_uniques(self, table, columns, values): """Insert multiple rows into a table that do not already exist. If the rows primary key already exists, the rows values will be updated. If the rows primary key does not exists, a new row will be inserted""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_027624
3,676
permissive
[ { "docstring": "Insert multiple rows into a table that do not already exist. If the rows primary key already exists, the rows values will be updated. If the rows primary key does not exists, a new row will be inserted", "name": "insert_uniques", "signature": "def insert_uniques(self, table, columns, val...
3
stack_v2_sparse_classes_30k_train_010499
Implement the Python class `Insert` described below. Class description: Implement the Insert class. Method signatures and docstrings: - def insert_uniques(self, table, columns, values): Insert multiple rows into a table that do not already exist. If the rows primary key already exists, the rows values will be updated...
Implement the Python class `Insert` described below. Class description: Implement the Insert class. Method signatures and docstrings: - def insert_uniques(self, table, columns, values): Insert multiple rows into a table that do not already exist. If the rows primary key already exists, the rows values will be updated...
6964f718f4b72eb30f2259adfcfaf3090526c53d
<|skeleton|> class Insert: def insert_uniques(self, table, columns, values): """Insert multiple rows into a table that do not already exist. If the rows primary key already exists, the rows values will be updated. If the rows primary key does not exists, a new row will be inserted""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Insert: def insert_uniques(self, table, columns, values): """Insert multiple rows into a table that do not already exist. If the rows primary key already exists, the rows values will be updated. If the rows primary key does not exists, a new row will be inserted""" existing_rows = self.select(...
the_stack_v2_python_sparse
mysql/toolkit/components/manipulate/insert.py
sfneal/mysql-toolkit
train
6
7f059613ef04f577e94365a2aa502c6eb26ccbbc
[ "super().__init__(framework=framework)\nassert schedule_timesteps > 0\nself.schedule_timesteps = schedule_timesteps\nself.initial_p = initial_p\nself.decay_rate = decay_rate", "if self.framework == 'torch' and torch and isinstance(t, torch.Tensor):\n t = t.float()\nreturn self.initial_p * self.decay_rate ** (t...
<|body_start_0|> super().__init__(framework=framework) assert schedule_timesteps > 0 self.schedule_timesteps = schedule_timesteps self.initial_p = initial_p self.decay_rate = decay_rate <|end_body_0|> <|body_start_1|> if self.framework == 'torch' and torch and isinstance...
ExponentialSchedule
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExponentialSchedule: def __init__(self, schedule_timesteps, framework, initial_p=1.0, decay_rate=0.1): """Exponential decay schedule from initial_p to final_p over schedule_timesteps. After this many time steps always `final_p` is returned. Agrs: schedule_timesteps (int): Number of time ...
stack_v2_sparse_classes_36k_train_027625
1,632
permissive
[ { "docstring": "Exponential decay schedule from initial_p to final_p over schedule_timesteps. After this many time steps always `final_p` is returned. Agrs: schedule_timesteps (int): Number of time steps for which to linearly anneal initial_p to final_p initial_p (float): Initial output value. decay_rate (float...
2
stack_v2_sparse_classes_30k_train_019885
Implement the Python class `ExponentialSchedule` described below. Class description: Implement the ExponentialSchedule class. Method signatures and docstrings: - def __init__(self, schedule_timesteps, framework, initial_p=1.0, decay_rate=0.1): Exponential decay schedule from initial_p to final_p over schedule_timeste...
Implement the Python class `ExponentialSchedule` described below. Class description: Implement the ExponentialSchedule class. Method signatures and docstrings: - def __init__(self, schedule_timesteps, framework, initial_p=1.0, decay_rate=0.1): Exponential decay schedule from initial_p to final_p over schedule_timeste...
a03cd14a50d87d58effea1d749391af530d7609c
<|skeleton|> class ExponentialSchedule: def __init__(self, schedule_timesteps, framework, initial_p=1.0, decay_rate=0.1): """Exponential decay schedule from initial_p to final_p over schedule_timesteps. After this many time steps always `final_p` is returned. Agrs: schedule_timesteps (int): Number of time ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExponentialSchedule: def __init__(self, schedule_timesteps, framework, initial_p=1.0, decay_rate=0.1): """Exponential decay schedule from initial_p to final_p over schedule_timesteps. After this many time steps always `final_p` is returned. Agrs: schedule_timesteps (int): Number of time steps for whic...
the_stack_v2_python_sparse
rllib/utils/schedules/exponential_schedule.py
ray-project/maze-raylit
train
5
6b1fab8fc003b11352e9d8a062cd525e7569b399
[ "try:\n self.User.objects.get(email=email)\n return 'user_existed'\nexcept self.User.DoesNotExist:\n return None", "try:\n self.User.objects.get(phone=phone)\n return 'user_existed'\nexcept self.User.DoesNotExist:\n return None", "try:\n self.User.objects.get(phone=phone)\n return None\n...
<|body_start_0|> try: self.User.objects.get(email=email) return 'user_existed' except self.User.DoesNotExist: return None <|end_body_0|> <|body_start_1|> try: self.User.objects.get(phone=phone) return 'user_existed' except self...
验证码基类
VerificationBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerificationBase: """验证码基类""" def user_email_none(self, email): """发送邮箱验证码用于 用户 or 商家 注册""" <|body_0|> def user_phone_none(self, phone): """发送手机号验证码用于用户 or 商家 注册""" <|body_1|> def user_phone_exist(self, phone): """发送手机验证码用于商家注册""" <|b...
stack_v2_sparse_classes_36k_train_027626
9,344
permissive
[ { "docstring": "发送邮箱验证码用于 用户 or 商家 注册", "name": "user_email_none", "signature": "def user_email_none(self, email)" }, { "docstring": "发送手机号验证码用于用户 or 商家 注册", "name": "user_phone_none", "signature": "def user_phone_none(self, phone)" }, { "docstring": "发送手机验证码用于商家注册", "name": ...
4
stack_v2_sparse_classes_30k_train_017483
Implement the Python class `VerificationBase` described below. Class description: 验证码基类 Method signatures and docstrings: - def user_email_none(self, email): 发送邮箱验证码用于 用户 or 商家 注册 - def user_phone_none(self, phone): 发送手机号验证码用于用户 or 商家 注册 - def user_phone_exist(self, phone): 发送手机验证码用于商家注册 - def user_email_exist(self, ...
Implement the Python class `VerificationBase` described below. Class description: 验证码基类 Method signatures and docstrings: - def user_email_none(self, email): 发送邮箱验证码用于 用户 or 商家 注册 - def user_phone_none(self, phone): 发送手机号验证码用于用户 or 商家 注册 - def user_phone_exist(self, phone): 发送手机验证码用于商家注册 - def user_email_exist(self, ...
13cb59130d15e782f78bc5148409bef0f1c516e0
<|skeleton|> class VerificationBase: """验证码基类""" def user_email_none(self, email): """发送邮箱验证码用于 用户 or 商家 注册""" <|body_0|> def user_phone_none(self, phone): """发送手机号验证码用于用户 or 商家 注册""" <|body_1|> def user_phone_exist(self, phone): """发送手机验证码用于商家注册""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerificationBase: """验证码基类""" def user_email_none(self, email): """发送邮箱验证码用于 用户 or 商家 注册""" try: self.User.objects.get(email=email) return 'user_existed' except self.User.DoesNotExist: return None def user_phone_none(self, phone): "...
the_stack_v2_python_sparse
user_app/views/verification_code.py
lmyfzx/Django-Mall
train
0
c3125a0d0eef093a3321d450f5a836bd3dfc81fe
[ "user = auth.get_current_user()\nif not user:\n return self.error('not authenticated', 401)\ntoken = UserApiToken.query.filter(UserApiToken.user == user).one_or_none()\nreturn self.respond_with_schema(token_schema, token)", "user = auth.get_current_user()\nif not user:\n return self.error('not authenticated...
<|body_start_0|> user = auth.get_current_user() if not user: return self.error('not authenticated', 401) token = UserApiToken.query.filter(UserApiToken.user == user).one_or_none() return self.respond_with_schema(token_schema, token) <|end_body_0|> <|body_start_1|> us...
UserTokenResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTokenResource: def get(self): """Return the API token for the user.""" <|body_0|> def post(self): """Create a new API token for the user.""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = auth.get_current_user() if not user: ...
stack_v2_sparse_classes_36k_train_027627
1,278
permissive
[ { "docstring": "Return the API token for the user.", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new API token for the user.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `UserTokenResource` described below. Class description: Implement the UserTokenResource class. Method signatures and docstrings: - def get(self): Return the API token for the user. - def post(self): Create a new API token for the user.
Implement the Python class `UserTokenResource` described below. Class description: Implement the UserTokenResource class. Method signatures and docstrings: - def get(self): Return the API token for the user. - def post(self): Create a new API token for the user. <|skeleton|> class UserTokenResource: def get(sel...
6d4a490c19ebe406b551641a022ca08f26c21fcb
<|skeleton|> class UserTokenResource: def get(self): """Return the API token for the user.""" <|body_0|> def post(self): """Create a new API token for the user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserTokenResource: def get(self): """Return the API token for the user.""" user = auth.get_current_user() if not user: return self.error('not authenticated', 401) token = UserApiToken.query.filter(UserApiToken.user == user).one_or_none() return self.respond_...
the_stack_v2_python_sparse
zeus/api/resources/user_token.py
getsentry/zeus
train
222
5b8ac5314640320d9c6bb845602cc412f1877306
[ "if allow_version and format_or_version == '1.0.0':\n return OutputFormat.XML\nif allow_version and format_or_version == '2.0.0':\n return OutputFormat.JSON\nif '/' in format_or_version:\n format_or_version = get_extension(format_or_version, dot=False)\nreturn super(OutputFormat, cls).get(str(format_or_ver...
<|body_start_0|> if allow_version and format_or_version == '1.0.0': return OutputFormat.XML if allow_version and format_or_version == '2.0.0': return OutputFormat.JSON if '/' in format_or_version: format_or_version = get_extension(format_or_version, dot=False)...
Renderer output formats for :term:`CLI`, `OpenAPI` and HTTP response content generation.
OutputFormat
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputFormat: """Renderer output formats for :term:`CLI`, `OpenAPI` and HTTP response content generation.""" def get(cls, format_or_version, default=JSON, allow_version=True): """Resolve the applicable output format. :param format_or_version: Either a :term:`WPS` version, a known val...
stack_v2_sparse_classes_36k_train_027628
34,693
permissive
[ { "docstring": "Resolve the applicable output format. :param format_or_version: Either a :term:`WPS` version, a known value for a ``f``/``format`` query parameter, or an ``Accept`` header that can be mapped to one of the supported output formats. :param default: Default output format if none could be resolved. ...
2
stack_v2_sparse_classes_30k_train_002773
Implement the Python class `OutputFormat` described below. Class description: Renderer output formats for :term:`CLI`, `OpenAPI` and HTTP response content generation. Method signatures and docstrings: - def get(cls, format_or_version, default=JSON, allow_version=True): Resolve the applicable output format. :param for...
Implement the Python class `OutputFormat` described below. Class description: Renderer output formats for :term:`CLI`, `OpenAPI` and HTTP response content generation. Method signatures and docstrings: - def get(cls, format_or_version, default=JSON, allow_version=True): Resolve the applicable output format. :param for...
f07cfea0776af6c5797d2a2e06566d1e77858213
<|skeleton|> class OutputFormat: """Renderer output formats for :term:`CLI`, `OpenAPI` and HTTP response content generation.""" def get(cls, format_or_version, default=JSON, allow_version=True): """Resolve the applicable output format. :param format_or_version: Either a :term:`WPS` version, a known val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutputFormat: """Renderer output formats for :term:`CLI`, `OpenAPI` and HTTP response content generation.""" def get(cls, format_or_version, default=JSON, allow_version=True): """Resolve the applicable output format. :param format_or_version: Either a :term:`WPS` version, a known value for a ``f`...
the_stack_v2_python_sparse
weaver/formats.py
crim-ca/weaver
train
22
968567c98a74c5f5a1bba207d50b0bffa7535fc6
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn CalendarSharingMessage()", "from .calendar_sharing_message_action import CalendarSharingMessageAction\nfrom .message import Message\nfrom .calendar_sharing_message_action import CalendarSharingMessageAction\nfrom .message import Messag...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return CalendarSharingMessage() <|end_body_0|> <|body_start_1|> from .calendar_sharing_message_action import CalendarSharingMessageAction from .message import Message from .calendar_sha...
CalendarSharingMessage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalendarSharingMessage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessage: """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 ...
stack_v2_sparse_classes_36k_train_027629
3,281
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: CalendarSharingMessage", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
null
Implement the Python class `CalendarSharingMessage` described below. Class description: Implement the CalendarSharingMessage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessage: Creates a new instance of the appropriate class b...
Implement the Python class `CalendarSharingMessage` described below. Class description: Implement the CalendarSharingMessage class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessage: Creates a new instance of the appropriate class b...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class CalendarSharingMessage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessage: """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 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalendarSharingMessage: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> CalendarSharingMessage: """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 Ret...
the_stack_v2_python_sparse
msgraph/generated/models/calendar_sharing_message.py
microsoftgraph/msgraph-sdk-python
train
135
aaf06090255286caa526f1d98760fdde623367cb
[ "jewels_set = set(J)\nret = 0\nfor c in S:\n if c in jewels_set:\n ret += 1\nreturn ret", "jewels_map = {}\nfor c in J:\n jewels_map[c] = 1\nret = 0\nfor c in S:\n if jewels_map.get(c, 0) == 1:\n ret += 1\nreturn ret" ]
<|body_start_0|> jewels_set = set(J) ret = 0 for c in S: if c in jewels_set: ret += 1 return ret <|end_body_0|> <|body_start_1|> jewels_map = {} for c in J: jewels_map[c] = 1 ret = 0 for c in S: if jewel...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_0|> def numJewelsInStones1(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> jewels_set = set(J) ...
stack_v2_sparse_classes_36k_train_027630
730
no_license
[ { "docstring": ":type J: str :type S: str :rtype: int", "name": "numJewelsInStones", "signature": "def numJewelsInStones(self, J, S)" }, { "docstring": ":type J: str :type S: str :rtype: int", "name": "numJewelsInStones1", "signature": "def numJewelsInStones1(self, J, S)" } ]
2
stack_v2_sparse_classes_30k_train_018990
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numJewelsInStones(self, J, S): :type J: str :type S: str :rtype: int - def numJewelsInStones1(self, J, S): :type J: str :type S: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numJewelsInStones(self, J, S): :type J: str :type S: str :rtype: int - def numJewelsInStones1(self, J, S): :type J: str :type S: str :rtype: int <|skeleton|> class Solution:...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_0|> def numJewelsInStones1(self, J, S): """:type J: str :type S: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numJewelsInStones(self, J, S): """:type J: str :type S: str :rtype: int""" jewels_set = set(J) ret = 0 for c in S: if c in jewels_set: ret += 1 return ret def numJewelsInStones1(self, J, S): """:type J: str :type S:...
the_stack_v2_python_sparse
python/leetcode_bak/771_Jewels_and_Stones.py
bobcaoge/my-code
train
0
60ed32f60505eda82276a4f77abdcf7a7f9abee5
[ "builder = GraphBuilder()\na = Value('a')\nb = Value('b')\nc = Value('c')\nops = Sum()\nbuilder.add(c).with_ops(ops)\nbuilder.add(b).with_ops(ops).with_dependant(c)\nbuilder.add(a).with_ops(ops).with_dependant(c)\nbuilder.add(1).with_dependant(a)\nbuilder.add(2).with_dependant(a)\nbuilder.add(3).with_dependant(b)\n...
<|body_start_0|> builder = GraphBuilder() a = Value('a') b = Value('b') c = Value('c') ops = Sum() builder.add(c).with_ops(ops) builder.add(b).with_ops(ops).with_dependant(c) builder.add(a).with_ops(ops).with_dependant(c) builder.add(1).with_depend...
DagTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DagTest: def test_simple(self): """Test evaluation of a simple arithmetic tree""" <|body_0|> def test_disparate(self): """Test evaluation of two disconnected graphs in a single object""" <|body_1|> def test_proxy(self): """Test replacement of ope...
stack_v2_sparse_classes_36k_train_027631
5,150
no_license
[ { "docstring": "Test evaluation of a simple arithmetic tree", "name": "test_simple", "signature": "def test_simple(self)" }, { "docstring": "Test evaluation of two disconnected graphs in a single object", "name": "test_disparate", "signature": "def test_disparate(self)" }, { "doc...
5
null
Implement the Python class `DagTest` described below. Class description: Implement the DagTest class. Method signatures and docstrings: - def test_simple(self): Test evaluation of a simple arithmetic tree - def test_disparate(self): Test evaluation of two disconnected graphs in a single object - def test_proxy(self):...
Implement the Python class `DagTest` described below. Class description: Implement the DagTest class. Method signatures and docstrings: - def test_simple(self): Test evaluation of a simple arithmetic tree - def test_disparate(self): Test evaluation of two disconnected graphs in a single object - def test_proxy(self):...
5813fa8b589b7b80d6bc09fb3e7362bb637d8d99
<|skeleton|> class DagTest: def test_simple(self): """Test evaluation of a simple arithmetic tree""" <|body_0|> def test_disparate(self): """Test evaluation of two disconnected graphs in a single object""" <|body_1|> def test_proxy(self): """Test replacement of ope...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DagTest: def test_simple(self): """Test evaluation of a simple arithmetic tree""" builder = GraphBuilder() a = Value('a') b = Value('b') c = Value('c') ops = Sum() builder.add(c).with_ops(ops) builder.add(b).with_ops(ops).with_dependant(c) ...
the_stack_v2_python_sparse
src/app/test-server/test_dag.py
Radhika-Envision/Upmark
train
0
ebe18aa4e505eef9e01190484fb2682040ad6920
[ "res = []\n\ndef preorder(root):\n if not root:\n res.append('#')\n return\n res.append(str(root.val))\n preorder(root.left)\n preorder(root.right)\npreorder(root)\nreturn ','.join(res)", "queue = deque()\nfor d in data.split(','):\n queue.append(d)\n\ndef recursion(data):\n if not...
<|body_start_0|> res = [] def preorder(root): if not root: res.append('#') return res.append(str(root.val)) preorder(root.left) preorder(root.right) preorder(root) return ','.join(res) <|end_body_0|> <|body...
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_027632
2,642
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:...
f0ad1e671de99574e00b4e78391d001677d60d82
<|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""" res = [] def preorder(root): if not root: res.append('#') return res.append(str(root.val)) preorder(root.left...
the_stack_v2_python_sparse
hard/Serialize_And_Deserialize_Binary_Tree.py
junghyun4425/myleetcode
train
0
c017564474bc8acdf5dc261e94bb3511259eb62a
[ "sketch = Sketch.query.get_with_acl(sketch_id)\nif not sketch:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.')\nif not sketch.has_permission(current_user, 'read'):\n abort(HTTP_STATUS_CODE_FORBIDDEN, 'User does not have read access controls on sketch.')\nstories = []\nfor story in Story.q...
<|body_start_0|> sketch = Sketch.query.get_with_acl(sketch_id) if not sketch: abort(HTTP_STATUS_CODE_NOT_FOUND, 'No sketch found with this ID.') if not sketch.has_permission(current_user, 'read'): abort(HTTP_STATUS_CODE_FORBIDDEN, 'User does not have read access controls ...
Resource to get all stories for a sketch or to create a new story.
StoryListResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoryListResource: """Resource to get all stories for a sketch or to create a new story.""" def get(self, sketch_id): """Handles GET request to the resource. Args: sketch_id: Integer primary key for a sketch database model Returns: Stories in JSON (instance of flask.wrappers.Response...
stack_v2_sparse_classes_36k_train_027633
9,982
permissive
[ { "docstring": "Handles GET request to the resource. Args: sketch_id: Integer primary key for a sketch database model Returns: Stories in JSON (instance of flask.wrappers.Response)", "name": "get", "signature": "def get(self, sketch_id)" }, { "docstring": "Handles POST request to the resource. A...
2
null
Implement the Python class `StoryListResource` described below. Class description: Resource to get all stories for a sketch or to create a new story. Method signatures and docstrings: - def get(self, sketch_id): Handles GET request to the resource. Args: sketch_id: Integer primary key for a sketch database model Retu...
Implement the Python class `StoryListResource` described below. Class description: Resource to get all stories for a sketch or to create a new story. Method signatures and docstrings: - def get(self, sketch_id): Handles GET request to the resource. Args: sketch_id: Integer primary key for a sketch database model Retu...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class StoryListResource: """Resource to get all stories for a sketch or to create a new story.""" def get(self, sketch_id): """Handles GET request to the resource. Args: sketch_id: Integer primary key for a sketch database model Returns: Stories in JSON (instance of flask.wrappers.Response...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StoryListResource: """Resource to get all stories for a sketch or to create a new story.""" def get(self, sketch_id): """Handles GET request to the resource. Args: sketch_id: Integer primary key for a sketch database model Returns: Stories in JSON (instance of flask.wrappers.Response)""" ...
the_stack_v2_python_sparse
timesketch/api/v1/resources/story.py
google/timesketch
train
2,263
3667a6c0b11f3cbe4f6c1bac746f63742f239fd4
[ "Settings.constructSettings()\nMainFramework.settings = Settings.getSettings()\nlogging.info('construct settings successfully')", "try:\n wb_plan = self.settings.loadPanFileAndSetCaseNumber()\n wk_plan_sheet = wb_plan['Sheet1']\n for test_case_number in range(2, self.settings.TestCaseNumbers + 2):\n ...
<|body_start_0|> Settings.constructSettings() MainFramework.settings = Settings.getSettings() logging.info('construct settings successfully') <|end_body_0|> <|body_start_1|> try: wb_plan = self.settings.loadPanFileAndSetCaseNumber() wk_plan_sheet = wb_plan['Sheet...
a circulator
MainFramework
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainFramework: """a circulator""" def setUpClass(cls): """set up before execute test""" <|body_0|> def test_execute(self): """execute each test step by step""" <|body_1|> def tearDownClass(cls): """generate HTML report after execute test fini...
stack_v2_sparse_classes_36k_train_027634
4,747
no_license
[ { "docstring": "set up before execute test", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "execute each test step by step", "name": "test_execute", "signature": "def test_execute(self)" }, { "docstring": "generate HTML report after execute test finis...
3
null
Implement the Python class `MainFramework` described below. Class description: a circulator Method signatures and docstrings: - def setUpClass(cls): set up before execute test - def test_execute(self): execute each test step by step - def tearDownClass(cls): generate HTML report after execute test finished
Implement the Python class `MainFramework` described below. Class description: a circulator Method signatures and docstrings: - def setUpClass(cls): set up before execute test - def test_execute(self): execute each test step by step - def tearDownClass(cls): generate HTML report after execute test finished <|skeleto...
ac197b0a73a5ba62cf2e2133399853a7bf678d3c
<|skeleton|> class MainFramework: """a circulator""" def setUpClass(cls): """set up before execute test""" <|body_0|> def test_execute(self): """execute each test step by step""" <|body_1|> def tearDownClass(cls): """generate HTML report after execute test fini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainFramework: """a circulator""" def setUpClass(cls): """set up before execute test""" Settings.constructSettings() MainFramework.settings = Settings.getSettings() logging.info('construct settings successfully') def test_execute(self): """execute each test st...
the_stack_v2_python_sparse
SeleniumPythonFramework/src/main_framework.py
xuanyuanchl/AutomationFrameworks
train
2
82a4f2137c89ee6aa3b9eaa799afeece6364bea8
[ "datasets = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True)\nself.data_train = datasets['train']\nself.data_valid = datasets['validation']\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)", "pt = tfds.deprecated.text.SubwordTextEncoder.build_from_corpus((pt.numpy() for p...
<|body_start_0|> datasets = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True) self.data_train = datasets['train'] self.data_valid = datasets['validation'] self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train) <|end_body_0|> <|body_start_1|> pt ...
Class
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Class""" def __init__(self): """Initialize""" <|body_0|> def tokenize_dataset(self, data): """Method""" <|body_1|> <|end_skeleton|> <|body_start_0|> datasets = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True) self...
stack_v2_sparse_classes_36k_train_027635
751
no_license
[ { "docstring": "Initialize", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" } ]
2
null
Implement the Python class `Dataset` described below. Class description: Class Method signatures and docstrings: - def __init__(self): Initialize - def tokenize_dataset(self, data): Method
Implement the Python class `Dataset` described below. Class description: Class Method signatures and docstrings: - def __init__(self): Initialize - def tokenize_dataset(self, data): Method <|skeleton|> class Dataset: """Class""" def __init__(self): """Initialize""" <|body_0|> def tokeni...
b5e8f1253309567ca7be71b9575a150de1be3820
<|skeleton|> class Dataset: """Class""" def __init__(self): """Initialize""" <|body_0|> def tokenize_dataset(self, data): """Method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Class""" def __init__(self): """Initialize""" datasets = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True) self.data_train = datasets['train'] self.data_valid = datasets['validation'] self.tokenizer_pt, self.tokenizer_en = self.tokenize_datas...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/0-dataset.py
jadsm98/holbertonschool-machine_learning
train
0
fcc49692f1522fe4cd91f45539cfab743bde6903
[ "if len(strs) == 1:\n return strs[0]\nans = ''\nstrs.sort(key=lambda x: len(x))\nfor i in range(len(strs[0])):\n substr = strs[0][:i + 1]\n for other in strs[1:]:\n not_prefix = False\n for k in range(len(substr)):\n if substr[k] != other[k]:\n not_prefix = True\n ...
<|body_start_0|> if len(strs) == 1: return strs[0] ans = '' strs.sort(key=lambda x: len(x)) for i in range(len(strs[0])): substr = strs[0][:i + 1] for other in strs[1:]: not_prefix = False for k in range(len(substr)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix2(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(strs) == 1: ...
stack_v2_sparse_classes_36k_train_027636
2,282
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix2", "signature": "def longestCommonPrefix2(self, strs)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix2(self, strs): :type strs: List[str] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix2(self, strs): :type strs: List[str] :rtype: str <|skeleton|> class Solution: ...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix2(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" if len(strs) == 1: return strs[0] ans = '' strs.sort(key=lambda x: len(x)) for i in range(len(strs[0])): substr = strs[0][:i + 1] for other in strs...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00014.Longest Common Prefix.py
roger6blog/LeetCode
train
0
1c7d2f05f112fe0cc7903e99deee3399dbda45ea
[ "ou = 0\nji = 1\nlength = len(A)\nwhile ou < length and ji < length:\n while ou < length and A[ou] % 2 == 0:\n ou += 2\n if ou < length and ji < length:\n A[ou], A[ji] = (A[ji], A[ou])\n while ji < length and A[ji] % 2 != 0:\n ji += 2\n if ou < length and ji < length:\n A[ji]...
<|body_start_0|> ou = 0 ji = 1 length = len(A) while ou < length and ji < length: while ou < length and A[ou] % 2 == 0: ou += 2 if ou < length and ji < length: A[ou], A[ji] = (A[ji], A[ou]) while ji < length and A[ji] % ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortArrayByParityII(self, A: List[int]) -> List[int]: """func: 双指针法 param {list} return {list}""" <|body_0|> def sortArrayByParityII2(self, A: List[int]) -> List[int]: """func: 遍历一遍数组把所有的偶数放进 ans[0],ans[2],ans[4],依次类推。 再遍历一遍数组把所有的奇数依次放进 ans[1],ans[3],an...
stack_v2_sparse_classes_36k_train_027637
1,599
no_license
[ { "docstring": "func: 双指针法 param {list} return {list}", "name": "sortArrayByParityII", "signature": "def sortArrayByParityII(self, A: List[int]) -> List[int]" }, { "docstring": "func: 遍历一遍数组把所有的偶数放进 ans[0],ans[2],ans[4],依次类推。 再遍历一遍数组把所有的奇数依次放进 ans[1],ans[3],ans[5],依次类推。 param {list} return {list...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParityII(self, A: List[int]) -> List[int]: func: 双指针法 param {list} return {list} - def sortArrayByParityII2(self, A: List[int]) -> List[int]: func: 遍历一遍数组把所有的偶数放进 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortArrayByParityII(self, A: List[int]) -> List[int]: func: 双指针法 param {list} return {list} - def sortArrayByParityII2(self, A: List[int]) -> List[int]: func: 遍历一遍数组把所有的偶数放进 ...
62c9dc7f04d6f4122274e82427901af55af113f9
<|skeleton|> class Solution: def sortArrayByParityII(self, A: List[int]) -> List[int]: """func: 双指针法 param {list} return {list}""" <|body_0|> def sortArrayByParityII2(self, A: List[int]) -> List[int]: """func: 遍历一遍数组把所有的偶数放进 ans[0],ans[2],ans[4],依次类推。 再遍历一遍数组把所有的奇数依次放进 ans[1],ans[3],an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortArrayByParityII(self, A: List[int]) -> List[int]: """func: 双指针法 param {list} return {list}""" ou = 0 ji = 1 length = len(A) while ou < length and ji < length: while ou < length and A[ou] % 2 == 0: ou += 2 if ou <...
the_stack_v2_python_sparse
双指针/932.py
CodingProgrammer/Algorithm
train
0
cfa46d65a20a4a901beed2eb9fbdc2c25b80f446
[ "if root is None:\n return ''\ns = str(root.val)\nif root.children:\n for child in root.children:\n s += '{' + self.serialize(child) + '}'\nreturn s", "start = data.find('{')\nif start < 0:\n return Node(int(data), []) if data else None\nroot, loc = (Node(int(data[:start]), []), 0)\nfor index, cha...
<|body_start_0|> if root is None: return '' s = str(root.val) if root.children: for child in root.children: s += '{' + self.serialize(child) + '}' return s <|end_body_0|> <|body_start_1|> start = data.find('{') if start < 0: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_027638
1,314
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
stack_v2_sparse_classes_30k_train_000621
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
63442050851125b4358b0046e0f52255086793c6
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|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: Node :rtype: str""" if root is None: return '' s = str(root.val) if root.children: for child in root.children: s += '{' + self.serialize(child) + '}' ...
the_stack_v2_python_sparse
serializeDeserializeTree.py
SarthakDubey/Algorithms_and_Data_Structures_in_Python
train
1
eac0161a70cd6ae7415ac33de27bbd97916a5be8
[ "res = 0\nflag = 0\ncount = {}\nfor i in s:\n if i in count:\n count[i] += 1\n else:\n count[i] = 1\nfor c in count.values():\n if c % 2 == 0:\n res += c\n else:\n res += c - 1\n flag = 1\nif flag == 1:\n return res + 1\nreturn res", "letter = [chr(i) for i in ran...
<|body_start_0|> res = 0 flag = 0 count = {} for i in s: if i in count: count[i] += 1 else: count[i] = 1 for c in count.values(): if c % 2 == 0: res += c else: res += c...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 flag = 0 count = {} for i...
stack_v2_sparse_classes_36k_train_027639
1,286
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_005889
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: int - def longestPalindrome(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: int - def longestPalindrome(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestPalindrome(self,...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: int""" res = 0 flag = 0 count = {} for i in s: if i in count: count[i] += 1 else: count[i] = 1 for c in count.values(): if c % 2...
the_stack_v2_python_sparse
code/409#Longest Palindrome.py
EachenKuang/LeetCode
train
28
21a44d601ba534026203509f13c85f04e5ea12ac
[ "super(TabularQAttackerBotAgent, self).__init__(game_config)\nif q_table_path is None:\n raise ValueError('Cannot create a TabularQAttackerBotAgent without specifying the path to the Q-table')\nself.q_table_path = q_table_path\nself.Q = np.load(q_table_path)", "actions = list(range(self.game_config.num_attack_...
<|body_start_0|> super(TabularQAttackerBotAgent, self).__init__(game_config) if q_table_path is None: raise ValueError('Cannot create a TabularQAttackerBotAgent without specifying the path to the Q-table') self.q_table_path = q_table_path self.Q = np.load(q_table_path) <|end_...
Class implementing an attack policy that acts greedily according to a given Q-table
TabularQAttackerBotAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TabularQAttackerBotAgent: """Class implementing an attack policy that acts greedily according to a given Q-table""" def __init__(self, game_config: GameConfig, q_table_path: str=None): """Constructor, initializes the policy :param game_config: the game configuration""" <|body...
stack_v2_sparse_classes_36k_train_027640
2,005
permissive
[ { "docstring": "Constructor, initializes the policy :param game_config: the game configuration", "name": "__init__", "signature": "def __init__(self, game_config: GameConfig, q_table_path: str=None)" }, { "docstring": "Samples an action from the policy. :param game_state: the game state :return:...
2
stack_v2_sparse_classes_30k_train_017427
Implement the Python class `TabularQAttackerBotAgent` described below. Class description: Class implementing an attack policy that acts greedily according to a given Q-table Method signatures and docstrings: - def __init__(self, game_config: GameConfig, q_table_path: str=None): Constructor, initializes the policy :pa...
Implement the Python class `TabularQAttackerBotAgent` described below. Class description: Class implementing an attack policy that acts greedily according to a given Q-table Method signatures and docstrings: - def __init__(self, game_config: GameConfig, q_table_path: str=None): Constructor, initializes the policy :pa...
d10830fef55308d383c98b41b34688a7fceae357
<|skeleton|> class TabularQAttackerBotAgent: """Class implementing an attack policy that acts greedily according to a given Q-table""" def __init__(self, game_config: GameConfig, q_table_path: str=None): """Constructor, initializes the policy :param game_config: the game configuration""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TabularQAttackerBotAgent: """Class implementing an attack policy that acts greedily according to a given Q-table""" def __init__(self, game_config: GameConfig, q_table_path: str=None): """Constructor, initializes the policy :param game_config: the game configuration""" super(TabularQAttac...
the_stack_v2_python_sparse
gym_idsgame/agents/training_agents/q_learning/tabular_q_learning/tabular_q_attacker_bot_agent.py
Limmen/gym-idsgame
train
49
5762f256dc366fd4f990c4aab5d2940aa6ff5eb2
[ "super(MeasureAfterSuccessScenario, self).__init__(egp=egp, request_cycle=request_cycle, request_prob=request_prob, min_pairs=min_pairs, max_pairs=max_pairs, min_fidelity=min_fidelity, tmax_pair=tmax_pair, num_requests=num_requests, purpose_id=purpose_id, priority=priority, store=store, atomic=atomic, t0=t0)\nself....
<|body_start_0|> super(MeasureAfterSuccessScenario, self).__init__(egp=egp, request_cycle=request_cycle, request_prob=request_prob, min_pairs=min_pairs, max_pairs=max_pairs, min_fidelity=min_fidelity, tmax_pair=tmax_pair, num_requests=num_requests, purpose_id=purpose_id, priority=priority, store=store, atomic=a...
MeasureAfterSuccessScenario
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasureAfterSuccessScenario: def __init__(self, egp, request_cycle, request_prob=1, min_pairs=1, max_pairs=1, min_fidelity=0.2, tmax_pair=0, num_requests=0, purpose_id=1, priority=10, store=False, atomic=False, t0=0): """A simulation scenario that will immediately measure any entangled q...
stack_v2_sparse_classes_36k_train_027641
23,433
permissive
[ { "docstring": "A simulation scenario that will immediately measure any entangled qubits generated by the EGP. EGP simulation scenario that schedules create calls onto the EGP and acts as a higher layer protocol that can collect the ok messages and errors returned by the EGP operation. A request is scheduled ev...
3
stack_v2_sparse_classes_30k_train_021569
Implement the Python class `MeasureAfterSuccessScenario` described below. Class description: Implement the MeasureAfterSuccessScenario class. Method signatures and docstrings: - def __init__(self, egp, request_cycle, request_prob=1, min_pairs=1, max_pairs=1, min_fidelity=0.2, tmax_pair=0, num_requests=0, purpose_id=1...
Implement the Python class `MeasureAfterSuccessScenario` described below. Class description: Implement the MeasureAfterSuccessScenario class. Method signatures and docstrings: - def __init__(self, egp, request_cycle, request_prob=1, min_pairs=1, max_pairs=1, min_fidelity=0.2, tmax_pair=0, num_requests=0, purpose_id=1...
552f4b59d4deb5e838b21d569b5c4fd835fa1494
<|skeleton|> class MeasureAfterSuccessScenario: def __init__(self, egp, request_cycle, request_prob=1, min_pairs=1, max_pairs=1, min_fidelity=0.2, tmax_pair=0, num_requests=0, purpose_id=1, priority=10, store=False, atomic=False, t0=0): """A simulation scenario that will immediately measure any entangled q...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeasureAfterSuccessScenario: def __init__(self, egp, request_cycle, request_prob=1, min_pairs=1, max_pairs=1, min_fidelity=0.2, tmax_pair=0, num_requests=0, purpose_id=1, priority=10, store=False, atomic=False, t0=0): """A simulation scenario that will immediately measure any entangled qubits generate...
the_stack_v2_python_sparse
qlinklayer/scenario.py
SoftwareQuTech/QLinkLayerSimulations
train
9
7c3468c1036066a2fceabc8abd2cbb06a707d7e0
[ "if lang in self.ASIAN_TYPED_LANGUAGES:\n super(sppasNumAsianType, self).__init__(lang, dictionary)\nelse:\n raise sppasValueError(lang, str(sppasNumBase.ASIAN_TYPED_LANGUAGES))\nfor i in sppasNumAsianType.NUMBER_LIST:\n if self._lang_dict.is_unk(str(i)):\n raise sppasValueError(self._lang_dict, str...
<|body_start_0|> if lang in self.ASIAN_TYPED_LANGUAGES: super(sppasNumAsianType, self).__init__(lang, dictionary) else: raise sppasValueError(lang, str(sppasNumBase.ASIAN_TYPED_LANGUAGES)) for i in sppasNumAsianType.NUMBER_LIST: if self._lang_dict.is_unk(str(i...
sppasNumAsianType
[ "MIT", "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasNumAsianType: def __init__(self, lang=None, dictionary=None): """Create an instance of sppasNumAsianType :param lang: (str) name of the language""" <|body_0|> def _tenth_of_thousands(self, number): """Return the "wordified" version of a tenth of a thousand numbe...
stack_v2_sparse_classes_36k_train_027642
4,832
permissive
[ { "docstring": "Create an instance of sppasNumAsianType :param lang: (str) name of the language", "name": "__init__", "signature": "def __init__(self, lang=None, dictionary=None)" }, { "docstring": "Return the \"wordified\" version of a tenth of a thousand number Returns the word corresponding t...
3
stack_v2_sparse_classes_30k_train_003941
Implement the Python class `sppasNumAsianType` described below. Class description: Implement the sppasNumAsianType class. Method signatures and docstrings: - def __init__(self, lang=None, dictionary=None): Create an instance of sppasNumAsianType :param lang: (str) name of the language - def _tenth_of_thousands(self, ...
Implement the Python class `sppasNumAsianType` described below. Class description: Implement the sppasNumAsianType class. Method signatures and docstrings: - def __init__(self, lang=None, dictionary=None): Create an instance of sppasNumAsianType :param lang: (str) name of the language - def _tenth_of_thousands(self, ...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasNumAsianType: def __init__(self, lang=None, dictionary=None): """Create an instance of sppasNumAsianType :param lang: (str) name of the language""" <|body_0|> def _tenth_of_thousands(self, number): """Return the "wordified" version of a tenth of a thousand numbe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sppasNumAsianType: def __init__(self, lang=None, dictionary=None): """Create an instance of sppasNumAsianType :param lang: (str) name of the language""" if lang in self.ASIAN_TYPED_LANGUAGES: super(sppasNumAsianType, self).__init__(lang, dictionary) else: raise ...
the_stack_v2_python_sparse
sppas/sppas/src/annotations/TextNorm/num2text/num_asian_lang.py
mirfan899/MTTS
train
0
7bc1783af65e3191d92d49d03a6a53ff5acd504c
[ "super().__init__()\nself.dense_h_h4 = nn.Linear(n_hidden, n_hidden * 4)\nself.activation = nn.GELU()\nself.dense_h4_h = nn.Linear(n_hidden * 4, n_hidden)", "x = self.dense_h_h4(x)\nx = self.activation(x)\nx = self.dense_h4_h(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.dense_h_h4 = nn.Linear(n_hidden, n_hidden * 4) self.activation = nn.GELU() self.dense_h4_h = nn.Linear(n_hidden * 4, n_hidden) <|end_body_0|> <|body_start_1|> x = self.dense_h_h4(x) x = self.activation(x) x = self.dense_h4...
## Feedforward Network
FFNLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FFNLayer: """## Feedforward Network""" def __init__(self, n_hidden: int=6144): """:param n_hidden: is the embedding size""" <|body_0|> def forward(self, x: torch.Tensor): """:param x: has shape `[batch_size, seq_len, n_hidden]`""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_027643
13,522
no_license
[ { "docstring": ":param n_hidden: is the embedding size", "name": "__init__", "signature": "def __init__(self, n_hidden: int=6144)" }, { "docstring": ":param x: has shape `[batch_size, seq_len, n_hidden]`", "name": "forward", "signature": "def forward(self, x: torch.Tensor)" } ]
2
stack_v2_sparse_classes_30k_train_000611
Implement the Python class `FFNLayer` described below. Class description: ## Feedforward Network Method signatures and docstrings: - def __init__(self, n_hidden: int=6144): :param n_hidden: is the embedding size - def forward(self, x: torch.Tensor): :param x: has shape `[batch_size, seq_len, n_hidden]`
Implement the Python class `FFNLayer` described below. Class description: ## Feedforward Network Method signatures and docstrings: - def __init__(self, n_hidden: int=6144): :param n_hidden: is the embedding size - def forward(self, x: torch.Tensor): :param x: has shape `[batch_size, seq_len, n_hidden]` <|skeleton|> ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class FFNLayer: """## Feedforward Network""" def __init__(self, n_hidden: int=6144): """:param n_hidden: is the embedding size""" <|body_0|> def forward(self, x: torch.Tensor): """:param x: has shape `[batch_size, seq_len, n_hidden]`""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FFNLayer: """## Feedforward Network""" def __init__(self, n_hidden: int=6144): """:param n_hidden: is the embedding size""" super().__init__() self.dense_h_h4 = nn.Linear(n_hidden, n_hidden * 4) self.activation = nn.GELU() self.dense_h4_h = nn.Linear(n_hidden * 4, ...
the_stack_v2_python_sparse
generated/test_labmlai_neox.py
jansel/pytorch-jit-paritybench
train
35
d3282307ef6ab6885b00a49eea9b3477644a4f65
[ "if nums == []:\n return\nroot_val = max(nums)\nroot_idx = nums.index(root_val)\nroot = TreeNode(root_val)\nroot.left = self.constructMaximumBinaryTree(nums[:root_idx])\nroot.right = self.constructMaximumBinaryTree(nums[root_idx + 1:])\nreturn root", "if len(nums) == 0:\n return None\nstack = []\nfor num in...
<|body_start_0|> if nums == []: return root_val = max(nums) root_idx = nums.index(root_val) root = TreeNode(root_val) root.left = self.constructMaximumBinaryTree(nums[:root_idx]) root.right = self.constructMaximumBinaryTree(nums[root_idx + 1:]) return ...
Recursive solution Stats: O(n^2) runtime -- need to find max for every single num in worse case
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Recursive solution Stats: O(n^2) runtime -- need to find max for every single num in worse case""" def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_0|> def constructMaximumBinaryTree(self, nums): """:typ...
stack_v2_sparse_classes_36k_train_027644
1,897
no_license
[ { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "constructMaximumBinaryTree", "signature": "def constructMaximumBinaryTree(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "constructMaximumBinaryTree", "signature": "def constructMaximumBin...
2
stack_v2_sparse_classes_30k_train_016470
Implement the Python class `Solution` described below. Class description: Recursive solution Stats: O(n^2) runtime -- need to find max for every single num in worse case Method signatures and docstrings: - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def constructMaximumBinaryT...
Implement the Python class `Solution` described below. Class description: Recursive solution Stats: O(n^2) runtime -- need to find max for every single num in worse case Method signatures and docstrings: - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def constructMaximumBinaryT...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: """Recursive solution Stats: O(n^2) runtime -- need to find max for every single num in worse case""" def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_0|> def constructMaximumBinaryTree(self, nums): """:typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Recursive solution Stats: O(n^2) runtime -- need to find max for every single num in worse case""" def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" if nums == []: return root_val = max(nums) root_idx = nums.i...
the_stack_v2_python_sparse
654-max-binary_tree.py
stevestar888/leetcode-problems
train
2
f3c2e4533417e6a493e634bf4091e7f6bcb93dbf
[ "self.chron_schedule = chron_schedule\nself.max_reminders = max_reminders\nself.email = email\nself.sms = sms\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nchron_schedule = dictionary.get('chronSchedule')\nmax_reminders = dictionary.get('maxReminders')\nemail = No...
<|body_start_0|> self.chron_schedule = chron_schedule self.max_reminders = max_reminders self.email = email self.sms = sms self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None chron_sche...
Implementation of the 'Reminder188' model. Here you can setup email/sms notifications reminding the signers that they have unsigned documents. Attributes: chron_schedule (string): Define a chron expression to control the interval of the reminders (Use utc time). We use quartz cron expressions, read more about it here: ...
Reminder188
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reminder188: """Implementation of the 'Reminder188' model. Here you can setup email/sms notifications reminding the signers that they have unsigned documents. Attributes: chron_schedule (string): Define a chron expression to control the interval of the reminders (Use utc time). We use quartz cron...
stack_v2_sparse_classes_36k_train_027645
3,499
permissive
[ { "docstring": "Constructor for the Reminder188 class", "name": "__init__", "signature": "def __init__(self, chron_schedule=None, max_reminders=None, email=None, sms=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictiona...
2
null
Implement the Python class `Reminder188` described below. Class description: Implementation of the 'Reminder188' model. Here you can setup email/sms notifications reminding the signers that they have unsigned documents. Attributes: chron_schedule (string): Define a chron expression to control the interval of the remin...
Implement the Python class `Reminder188` described below. Class description: Implementation of the 'Reminder188' model. Here you can setup email/sms notifications reminding the signers that they have unsigned documents. Attributes: chron_schedule (string): Define a chron expression to control the interval of the remin...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Reminder188: """Implementation of the 'Reminder188' model. Here you can setup email/sms notifications reminding the signers that they have unsigned documents. Attributes: chron_schedule (string): Define a chron expression to control the interval of the reminders (Use utc time). We use quartz cron...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reminder188: """Implementation of the 'Reminder188' model. Here you can setup email/sms notifications reminding the signers that they have unsigned documents. Attributes: chron_schedule (string): Define a chron expression to control the interval of the reminders (Use utc time). We use quartz cron expressions,...
the_stack_v2_python_sparse
idfy_rest_client/models/reminder_188.py
dealflowteam/Idfy
train
0
22e16b7044620e303415369fdf25b03a7db23921
[ "super().__init__(coordinator=coordinator)\nself._service_key = service_key\nself.entity_id = f'{SENSOR_DOMAIN}.{service}_{description.key}'\nself.entity_description = description\nself._attr_unique_id = f'{coordinator.config_entry.entry_id}_{service_key}_{description.key}'\nself._attr_device_info = DeviceInfo(entr...
<|body_start_0|> super().__init__(coordinator=coordinator) self._service_key = service_key self.entity_id = f'{SENSOR_DOMAIN}.{service}_{description.key}' self.entity_description = description self._attr_unique_id = f'{coordinator.config_entry.entry_id}_{service_key}_{description...
Defines an P1 Monitor sensor.
P1MonitorSensorEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class P1MonitorSensorEntity: """Defines an P1 Monitor sensor.""" def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None: """Initialize ...
stack_v2_sparse_classes_36k_train_027646
11,570
permissive
[ { "docstring": "Initialize P1 Monitor sensor.", "name": "__init__", "signature": "def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None" }, { ...
2
null
Implement the Python class `P1MonitorSensorEntity` described below. Class description: Defines an P1 Monitor sensor. Method signatures and docstrings: - def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', '...
Implement the Python class `P1MonitorSensorEntity` described below. Class description: Defines an P1 Monitor sensor. Method signatures and docstrings: - def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', '...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class P1MonitorSensorEntity: """Defines an P1 Monitor sensor.""" def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None: """Initialize ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class P1MonitorSensorEntity: """Defines an P1 Monitor sensor.""" def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None: """Initialize P1 Monitor se...
the_stack_v2_python_sparse
homeassistant/components/p1_monitor/sensor.py
konnected-io/home-assistant
train
24
1c585f5c401c87591a6dd2ac654fcc2390ee2943
[ "self.snake = deque()\nself.snake.append([0, 0])\nself.snake_set = set()\nself.snake_set.add((0, 0))\nself.score = 0\nself.food = deque()\nfor ele in food:\n self.food.append(ele)\nself.width = width\nself.height = height\nself.directions = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}", "head = self....
<|body_start_0|> self.snake = deque() self.snake.append([0, 0]) self.snake_set = set() self.snake_set.add((0, 0)) self.score = 0 self.food = deque() for ele in food: self.food.append(ele) self.width = width self.height = height ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_36k_train_027647
2,425
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
stack_v2_sparse_classes_30k_train_006206
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
9b38a7742a819ac3795ea295e371e26bb5bfc28c
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
353. Design Snake Game.py
dundunmao/LeetCode2019
train
0
4dbbcf3dfff4a5869f24b96809f25d1690474439
[ "super().__init__(object_list, per_page, orphans, allow_empty_first_page)\nself.now_page = int(now_page)\nself.max_display_page = int(max_display_page)", "if self.num_pages < self.max_display_page:\n return range(1, self.num_pages + 1)\nhalf_page = int(self.max_display_page // 2)\nif self.now_page <= half_page...
<|body_start_0|> super().__init__(object_list, per_page, orphans, allow_empty_first_page) self.now_page = int(now_page) self.max_display_page = int(max_display_page) <|end_body_0|> <|body_start_1|> if self.num_pages < self.max_display_page: return range(1, self.num_pages + 1...
MyPaginator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyPaginator: def __init__(self, now_page, max_display_page, object_list, per_page, orphans=0, allow_empty_first_page=True): """对这个类进行重写 :param now_page: 当前页数 :param max_display_page: 最大展示页数, 如果数据量很大, 我们只能让他动态的展示最大页数""" <|body_0|> def page_range(self): """重写这个页码范围显示办法...
stack_v2_sparse_classes_36k_train_027648
1,588
no_license
[ { "docstring": "对这个类进行重写 :param now_page: 当前页数 :param max_display_page: 最大展示页数, 如果数据量很大, 我们只能让他动态的展示最大页数", "name": "__init__", "signature": "def __init__(self, now_page, max_display_page, object_list, per_page, orphans=0, allow_empty_first_page=True)" }, { "docstring": "重写这个页码范围显示办法 :return: 返回自...
2
stack_v2_sparse_classes_30k_train_017096
Implement the Python class `MyPaginator` described below. Class description: Implement the MyPaginator class. Method signatures and docstrings: - def __init__(self, now_page, max_display_page, object_list, per_page, orphans=0, allow_empty_first_page=True): 对这个类进行重写 :param now_page: 当前页数 :param max_display_page: 最大展示页...
Implement the Python class `MyPaginator` described below. Class description: Implement the MyPaginator class. Method signatures and docstrings: - def __init__(self, now_page, max_display_page, object_list, per_page, orphans=0, allow_empty_first_page=True): 对这个类进行重写 :param now_page: 当前页数 :param max_display_page: 最大展示页...
8106b160411027e52676a3093188f819a18dd793
<|skeleton|> class MyPaginator: def __init__(self, now_page, max_display_page, object_list, per_page, orphans=0, allow_empty_first_page=True): """对这个类进行重写 :param now_page: 当前页数 :param max_display_page: 最大展示页数, 如果数据量很大, 我们只能让他动态的展示最大页数""" <|body_0|> def page_range(self): """重写这个页码范围显示办法...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyPaginator: def __init__(self, now_page, max_display_page, object_list, per_page, orphans=0, allow_empty_first_page=True): """对这个类进行重写 :param now_page: 当前页数 :param max_display_page: 最大展示页数, 如果数据量很大, 我们只能让他动态的展示最大页数""" super().__init__(object_list, per_page, orphans, allow_empty_first_page) ...
the_stack_v2_python_sparse
cst/MyPaginator.py
shalouzaixiayu/Django-Web
train
1
f95c21747e1138c18742f474651a3ba08acf832f
[ "category = Category.objects.as_admin(request.user, project_id, category_id)\nserializer = CategorySerializer(category)\nreturn Response(serializer.data)", "category = Category.objects.as_admin(request.user, project_id, category_id)\nserializer = CategorySerializer(category, data=request.data, partial=True, field...
<|body_start_0|> category = Category.objects.as_admin(request.user, project_id, category_id) serializer = CategorySerializer(category) return Response(serializer.data) <|end_body_0|> <|body_start_1|> category = Category.objects.as_admin(request.user, project_id, category_id) ser...
API endpoints for a category in the AJAX API.
CategoryUpdate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryUpdate: """API endpoints for a category in the AJAX API.""" def get(self, request, project_id, category_id): """Handles the GET request. Parameters ---------- request : rest_framework.request.Request Object representing the request project_id : int Identifies the project in t...
stack_v2_sparse_classes_36k_train_027649
31,602
permissive
[ { "docstring": "Handles the GET request. Parameters ---------- request : rest_framework.request.Request Object representing the request project_id : int Identifies the project in the database category_id : int Identifies the category in the database Return ------ rest_framework.response.Response Response to the...
2
null
Implement the Python class `CategoryUpdate` described below. Class description: API endpoints for a category in the AJAX API. Method signatures and docstrings: - def get(self, request, project_id, category_id): Handles the GET request. Parameters ---------- request : rest_framework.request.Request Object representing...
Implement the Python class `CategoryUpdate` described below. Class description: API endpoints for a category in the AJAX API. Method signatures and docstrings: - def get(self, request, project_id, category_id): Handles the GET request. Parameters ---------- request : rest_framework.request.Request Object representing...
16d31b5207de9f699fc01054baad1fe65ad1c3ca
<|skeleton|> class CategoryUpdate: """API endpoints for a category in the AJAX API.""" def get(self, request, project_id, category_id): """Handles the GET request. Parameters ---------- request : rest_framework.request.Request Object representing the request project_id : int Identifies the project in t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoryUpdate: """API endpoints for a category in the AJAX API.""" def get(self, request, project_id, category_id): """Handles the GET request. Parameters ---------- request : rest_framework.request.Request Object representing the request project_id : int Identifies the project in the database c...
the_stack_v2_python_sparse
geokey/categories/views.py
NeolithEra/geokey
train
0
1813abf401214184a47e0f68daeb9397d7fffd2e
[ "self.driver.switch_to.default_content()\nself.driver.switch_to.frame(self.frame_menu)\nif not self.menu_snmp.is_visible():\n self.menu_system_maintenance.click()\nself.menu_snmp.click()\nself.driver.switch_to.default_content()\nself.driver.switch_to.frame(self.frame_main)", "self.driver.switch_to.default_cont...
<|body_start_0|> self.driver.switch_to.default_content() self.driver.switch_to.frame(self.frame_menu) if not self.menu_snmp.is_visible(): self.menu_system_maintenance.click() self.menu_snmp.click() self.driver.switch_to.default_content() self.driver.switch_to....
Selenium Page Object Model: Menu Navigation.
MenuNavigator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MenuNavigator: """Selenium Page Object Model: Menu Navigation.""" def open_sysmain_snmp(self): """Navigate the menus to open the SNMP configuration panel.""" <|body_0|> def open_sysmain_management(self, tab: Link): """Navigate the menus to open the SNMP configura...
stack_v2_sparse_classes_36k_train_027650
3,160
permissive
[ { "docstring": "Navigate the menus to open the SNMP configuration panel.", "name": "open_sysmain_snmp", "signature": "def open_sysmain_snmp(self)" }, { "docstring": "Navigate the menus to open the SNMP configuration panel.", "name": "open_sysmain_management", "signature": "def open_sysma...
5
stack_v2_sparse_classes_30k_train_001732
Implement the Python class `MenuNavigator` described below. Class description: Selenium Page Object Model: Menu Navigation. Method signatures and docstrings: - def open_sysmain_snmp(self): Navigate the menus to open the SNMP configuration panel. - def open_sysmain_management(self, tab: Link): Navigate the menus to op...
Implement the Python class `MenuNavigator` described below. Class description: Selenium Page Object Model: Menu Navigation. Method signatures and docstrings: - def open_sysmain_snmp(self): Navigate the menus to open the SNMP configuration panel. - def open_sysmain_management(self, tab: Link): Navigate the menus to op...
0b3e96b892fb332a1252fc231b30561b2374071f
<|skeleton|> class MenuNavigator: """Selenium Page Object Model: Menu Navigation.""" def open_sysmain_snmp(self): """Navigate the menus to open the SNMP configuration panel.""" <|body_0|> def open_sysmain_management(self, tab: Link): """Navigate the menus to open the SNMP configura...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MenuNavigator: """Selenium Page Object Model: Menu Navigation.""" def open_sysmain_snmp(self): """Navigate the menus to open the SNMP configuration panel.""" self.driver.switch_to.default_content() self.driver.switch_to.frame(self.frame_menu) if not self.menu_snmp.is_visib...
the_stack_v2_python_sparse
draytekwebadmin/pages/menu_navigator.py
dMajoIT/Draytek-Web-Auto-Configuration
train
0
61b4ed94a064db234aba21de68d1ecd81cffc9fa
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn IosHomeScreenFolder()", "from .ios_home_screen_folder_page import IosHomeScreenFolderPage\nfrom .ios_home_screen_item import IosHomeScreenItem\nfrom .ios_home_screen_folder_page import IosHomeScreenFolderPage\nfrom .ios_home_screen_ite...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return IosHomeScreenFolder() <|end_body_0|> <|body_start_1|> from .ios_home_screen_folder_page import IosHomeScreenFolderPage from .ios_home_screen_item import IosHomeScreenItem from .i...
A folder containing pages of apps and web clips on the Home Screen.
IosHomeScreenFolder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IosHomeScreenFolder: """A folder containing pages of apps and web clips on the Home Screen.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenFolder: """Creates a new instance of the appropriate class based on discriminator value Args: parse...
stack_v2_sparse_classes_36k_train_027651
2,589
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: IosHomeScreenFolder", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
null
Implement the Python class `IosHomeScreenFolder` described below. Class description: A folder containing pages of apps and web clips on the Home Screen. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenFolder: Creates a new instance of the a...
Implement the Python class `IosHomeScreenFolder` described below. Class description: A folder containing pages of apps and web clips on the Home Screen. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenFolder: Creates a new instance of the a...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class IosHomeScreenFolder: """A folder containing pages of apps and web clips on the Home Screen.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenFolder: """Creates a new instance of the appropriate class based on discriminator value Args: parse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IosHomeScreenFolder: """A folder containing pages of apps and web clips on the Home Screen.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> IosHomeScreenFolder: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pa...
the_stack_v2_python_sparse
msgraph/generated/models/ios_home_screen_folder.py
microsoftgraph/msgraph-sdk-python
train
135
f82cdf9cae7087f97bd0d929c1c672c938c762f7
[ "table_name, key_name = store.cls_infos[tname][:2]\ndata = values.copy()\n_id = data.pop(key_name, None)\nif _id is None:\n if not store.cls_infos[tname][AUTO_INC_IDX]:\n raise KeyError\n _id = auto_inc(store, table_name)\n if tname == 'player':\n _id = int(str(_id) + config.serverNo)\n va...
<|body_start_0|> table_name, key_name = store.cls_infos[tname][:2] data = values.copy() _id = data.pop(key_name, None) if _id is None: if not store.cls_infos[tname][AUTO_INC_IDX]: raise KeyError _id = auto_inc(store, table_name) if tnam...
保存(新增或者更新)
SaveProc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveProc: """保存(新增或者更新)""" def simple(store, tname, values): """简单保存,保存序列化字典""" <|body_0|> def multi(store, tname, objs, insert): """批量保存,只支持批量新增或者批量修改,不要混新增和修改""" <|body_1|> <|end_skeleton|> <|body_start_0|> table_name, key_name = store.cls_inf...
stack_v2_sparse_classes_36k_train_027652
15,019
no_license
[ { "docstring": "简单保存,保存序列化字典", "name": "simple", "signature": "def simple(store, tname, values)" }, { "docstring": "批量保存,只支持批量新增或者批量修改,不要混新增和修改", "name": "multi", "signature": "def multi(store, tname, objs, insert)" } ]
2
null
Implement the Python class `SaveProc` described below. Class description: 保存(新增或者更新) Method signatures and docstrings: - def simple(store, tname, values): 简单保存,保存序列化字典 - def multi(store, tname, objs, insert): 批量保存,只支持批量新增或者批量修改,不要混新增和修改
Implement the Python class `SaveProc` described below. Class description: 保存(新增或者更新) Method signatures and docstrings: - def simple(store, tname, values): 简单保存,保存序列化字典 - def multi(store, tname, objs, insert): 批量保存,只支持批量新增或者批量修改,不要混新增和修改 <|skeleton|> class SaveProc: """保存(新增或者更新)""" def simple(store, tname, ...
026f95bd073288a273f64c339b1d414ff09df6e9
<|skeleton|> class SaveProc: """保存(新增或者更新)""" def simple(store, tname, values): """简单保存,保存序列化字典""" <|body_0|> def multi(store, tname, objs, insert): """批量保存,只支持批量新增或者批量修改,不要混新增和修改""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaveProc: """保存(新增或者更新)""" def simple(store, tname, values): """简单保存,保存序列化字典""" table_name, key_name = store.cls_infos[tname][:2] data = values.copy() _id = data.pop(key_name, None) if _id is None: if not store.cls_infos[tname][AUTO_INC_IDX]: ...
the_stack_v2_python_sparse
code/lib/store/mongodb.py
hw233/gsdld_pokemon2
train
0
76eb52def293791c2c576ee9926e7ca84d2a3360
[ "from .system import System\nsys: System = System.current()\nret = sys._op_cache.get_circt_mod(self)\nif ret is None:\n return sys._create_circt_mod(self)\nreturn ret", "if len(self.generators) > 0:\n return msft.MSFTModuleOp(symbol, [(n, t._type) for n, t in self.inputs], [(n, t._type) for n, t in self.out...
<|body_start_0|> from .system import System sys: System = System.current() ret = sys._op_cache.get_circt_mod(self) if ret is None: return sys._create_circt_mod(self) return ret <|end_body_0|> <|body_start_1|> if len(self.generators) > 0: return ms...
Defines how a `Module` gets built. Extend the base class and customize.
ModuleBuilder
[ "LLVM-exception", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleBuilder: """Defines how a `Module` gets built. Extend the base class and customize.""" def circt_mod(self): """Get the raw CIRCT operation for the module definition. DO NOT store the returned value!!! It needs to get reaped after the current action (e.g. instantiation, generati...
stack_v2_sparse_classes_36k_train_027653
23,396
permissive
[ { "docstring": "Get the raw CIRCT operation for the module definition. DO NOT store the returned value!!! It needs to get reaped after the current action (e.g. instantiation, generation). Memory safety when interacting with native code can be painful.", "name": "circt_mod", "signature": "def circt_mod(s...
4
null
Implement the Python class `ModuleBuilder` described below. Class description: Defines how a `Module` gets built. Extend the base class and customize. Method signatures and docstrings: - def circt_mod(self): Get the raw CIRCT operation for the module definition. DO NOT store the returned value!!! It needs to get reap...
Implement the Python class `ModuleBuilder` described below. Class description: Defines how a `Module` gets built. Extend the base class and customize. Method signatures and docstrings: - def circt_mod(self): Get the raw CIRCT operation for the module definition. DO NOT store the returned value!!! It needs to get reap...
e6057090973eb8a428dce9d3e9ddb63ec4088b55
<|skeleton|> class ModuleBuilder: """Defines how a `Module` gets built. Extend the base class and customize.""" def circt_mod(self): """Get the raw CIRCT operation for the module definition. DO NOT store the returned value!!! It needs to get reaped after the current action (e.g. instantiation, generati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModuleBuilder: """Defines how a `Module` gets built. Extend the base class and customize.""" def circt_mod(self): """Get the raw CIRCT operation for the module definition. DO NOT store the returned value!!! It needs to get reaped after the current action (e.g. instantiation, generation). Memory s...
the_stack_v2_python_sparse
frontends/PyCDE/src/module.py
llvm/circt
train
1,242
03a373cb1aaa5410629fd2820cc9f6ba06efb8d2
[ "current_user = User.objects.get(pk=request.auth.user.id)\ntry:\n job = Job.objects.get(pk=request.data['job'], user=current_user)\nexcept Job.DoesNotExist as ex:\n return Response({'reason': ex.args[0]}, status=status.HTTP_404_NOT_FOUND)\nnote = JobNote()\nnote.author = current_user\nnote.job = job\nnote.con...
<|body_start_0|> current_user = User.objects.get(pk=request.auth.user.id) try: job = Job.objects.get(pk=request.data['job'], user=current_user) except Job.DoesNotExist as ex: return Response({'reason': ex.args[0]}, status=status.HTTP_404_NOT_FOUND) note = JobNote(...
JobNoteView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobNoteView: def create(self, request): """Handle POST requests to create new job note""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for a specific job note""" <|body_1|> def list(self, request): """Handle GET request...
stack_v2_sparse_classes_36k_train_027654
3,704
no_license
[ { "docstring": "Handle POST requests to create new job note", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Handle GET requests for a specific job note", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" }, { "docstring": "Han...
5
stack_v2_sparse_classes_30k_train_020273
Implement the Python class `JobNoteView` described below. Class description: Implement the JobNoteView class. Method signatures and docstrings: - def create(self, request): Handle POST requests to create new job note - def retrieve(self, request, pk=None): Handle GET requests for a specific job note - def list(self, ...
Implement the Python class `JobNoteView` described below. Class description: Implement the JobNoteView class. Method signatures and docstrings: - def create(self, request): Handle POST requests to create new job note - def retrieve(self, request, pk=None): Handle GET requests for a specific job note - def list(self, ...
12cb34b9a290a8445e8baaa6c454dd386a01fe29
<|skeleton|> class JobNoteView: def create(self, request): """Handle POST requests to create new job note""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for a specific job note""" <|body_1|> def list(self, request): """Handle GET request...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobNoteView: def create(self, request): """Handle POST requests to create new job note""" current_user = User.objects.get(pk=request.auth.user.id) try: job = Job.objects.get(pk=request.data['job'], user=current_user) except Job.DoesNotExist as ex: return...
the_stack_v2_python_sparse
apptrakzapi/views/job_note.py
nswalters/AppTrakz-API
train
0
baf5c2a9cff42f62d9b7da9f67955c9625444a67
[ "if type(data) is not np.ndarray or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nmean = np.mean(data, axis=1).reshape((data.shape[0], 1))\nself.mean = mean\nself.cov = np.matmul(data - self.mean,...
<|body_start_0|> if type(data) is not np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data points') mean = np.mean(data, axis=1).reshape((data.shape[0], 1)) s...
Multinormal Class
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """Multinormal Class""" def __init__(self, data): """Class contructor""" <|body_0|> def pdf(self, x): """public instance method that calculates the PDF at a data point""" <|body_1|> <|end_skeleton|> <|body_start_0|> if type(data) is...
stack_v2_sparse_classes_36k_train_027655
1,454
no_license
[ { "docstring": "Class contructor", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "public instance method that calculates the PDF at a data point", "name": "pdf", "signature": "def pdf(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_006305
Implement the Python class `MultiNormal` described below. Class description: Multinormal Class Method signatures and docstrings: - def __init__(self, data): Class contructor - def pdf(self, x): public instance method that calculates the PDF at a data point
Implement the Python class `MultiNormal` described below. Class description: Multinormal Class Method signatures and docstrings: - def __init__(self, data): Class contructor - def pdf(self, x): public instance method that calculates the PDF at a data point <|skeleton|> class MultiNormal: """Multinormal Class""" ...
cfc519b3290a1b8ecd6dc94f70c5220538ee7aa0
<|skeleton|> class MultiNormal: """Multinormal Class""" def __init__(self, data): """Class contructor""" <|body_0|> def pdf(self, x): """public instance method that calculates the PDF at a data point""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """Multinormal Class""" def __init__(self, data): """Class contructor""" if type(data) is not np.ndarray or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multi...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
shincap8/holbertonschool-machine_learning
train
0
eb99e8040780d0bf89416f894726fc7d2d97cddc
[ "self.Z_map = Z_map\nperiods = list(Z_map.keys())\nvalues = list(Z_map.values())\nself.f = np.array([1 / x for x in periods[::-1]])\nself.omega = 2 * math.pi * self.f\nself.Zxx_interp = CubicSpline(self.omega, [x[0, 0] for x in values[::-1]], extrapolate=False)\nself.Zxy_interp = CubicSpline(self.omega, [x[0, 1] fo...
<|body_start_0|> self.Z_map = Z_map periods = list(Z_map.keys()) values = list(Z_map.values()) self.f = np.array([1 / x for x in periods[::-1]]) self.omega = 2 * math.pi * self.f self.Zxx_interp = CubicSpline(self.omega, [x[0, 0] for x in values[::-1]], extrapolate=False)...
Zw_interpolator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Zw_interpolator: def __init__(self, Z_map, extrapolate0=False): """Construct a cubic-spline 3-D E-M transfer function interpolater using the information in *Z_map* returned from :func:`parse_xml` as the function samples. If *extrapolate0*, then 0s are inserted in the transfer function re...
stack_v2_sparse_classes_36k_train_027656
15,502
permissive
[ { "docstring": "Construct a cubic-spline 3-D E-M transfer function interpolater using the information in *Z_map* returned from :func:`parse_xml` as the function samples. If *extrapolate0*, then 0s are inserted in the transfer function response where extrapolation would occur (this happens when transfer function...
2
stack_v2_sparse_classes_30k_train_002790
Implement the Python class `Zw_interpolator` described below. Class description: Implement the Zw_interpolator class. Method signatures and docstrings: - def __init__(self, Z_map, extrapolate0=False): Construct a cubic-spline 3-D E-M transfer function interpolater using the information in *Z_map* returned from :func:...
Implement the Python class `Zw_interpolator` described below. Class description: Implement the Zw_interpolator class. Method signatures and docstrings: - def __init__(self, Z_map, extrapolate0=False): Construct a cubic-spline 3-D E-M transfer function interpolater using the information in *Z_map* returned from :func:...
e364be68cb0cadbeea10ca569963b8f99aa7b05b
<|skeleton|> class Zw_interpolator: def __init__(self, Z_map, extrapolate0=False): """Construct a cubic-spline 3-D E-M transfer function interpolater using the information in *Z_map* returned from :func:`parse_xml` as the function samples. If *extrapolate0*, then 0s are inserted in the transfer function re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Zw_interpolator: def __init__(self, Z_map, extrapolate0=False): """Construct a cubic-spline 3-D E-M transfer function interpolater using the information in *Z_map* returned from :func:`parse_xml` as the function samples. If *extrapolate0*, then 0s are inserted in the transfer function response where e...
the_stack_v2_python_sparse
pyrsss/emtf/calc_e_3d.py
butala/pyrsss
train
7
6e4435718141c981c035f16699d94327133d63fd
[ "var_data = self.loadCustomData(save_filename=save_filename)\nif var_data:\n width = var_data.get('width', -1)\n height = var_data.get('height', -1)\n if width > 0 and height > 0:\n self.SetSize(wx.Size(width, height))\n x = var_data.get('x', -1)\n y = var_data.get('y', -1)\n if x <= 0 and ...
<|body_start_0|> var_data = self.loadCustomData(save_filename=save_filename) if var_data: width = var_data.get('width', -1) height = var_data.get('height', -1) if width > 0 and height > 0: self.SetSize(wx.Size(width, height)) x = var_data.g...
Manager for storing properties of wxPython forms.
iqStoredWxFormsManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqStoredWxFormsManager: """Manager for storing properties of wxPython forms.""" def loadCustomProperties(self, save_filename=None): """Load custom properties. :param save_filename: Stored file name. :return: True/False.""" <|body_0|> def saveCustomProperties(self, save_f...
stack_v2_sparse_classes_36k_train_027657
1,564
no_license
[ { "docstring": "Load custom properties. :param save_filename: Stored file name. :return: True/False.", "name": "loadCustomProperties", "signature": "def loadCustomProperties(self, save_filename=None)" }, { "docstring": "Save custom properties. :param save_filename: Stored file name. :return: Tru...
2
stack_v2_sparse_classes_30k_train_018328
Implement the Python class `iqStoredWxFormsManager` described below. Class description: Manager for storing properties of wxPython forms. Method signatures and docstrings: - def loadCustomProperties(self, save_filename=None): Load custom properties. :param save_filename: Stored file name. :return: True/False. - def s...
Implement the Python class `iqStoredWxFormsManager` described below. Class description: Manager for storing properties of wxPython forms. Method signatures and docstrings: - def loadCustomProperties(self, save_filename=None): Load custom properties. :param save_filename: Stored file name. :return: True/False. - def s...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqStoredWxFormsManager: """Manager for storing properties of wxPython forms.""" def loadCustomProperties(self, save_filename=None): """Load custom properties. :param save_filename: Stored file name. :return: True/False.""" <|body_0|> def saveCustomProperties(self, save_f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iqStoredWxFormsManager: """Manager for storing properties of wxPython forms.""" def loadCustomProperties(self, save_filename=None): """Load custom properties. :param save_filename: Stored file name. :return: True/False.""" var_data = self.loadCustomData(save_filename=save_filename) ...
the_stack_v2_python_sparse
iq/engine/wx/stored_wx_form_manager.py
XHermitOne/iq_framework
train
1
298a0fd207189d1adcb5c82b6d53c16d8b3815bb
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn PlannerPlanDetails()", "from .entity import Entity\nfrom .planner_category_descriptions import PlannerCategoryDescriptions\nfrom .planner_user_ids import PlannerUserIds\nfrom .entity import Entity\nfrom .planner_category_descriptions i...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return PlannerPlanDetails() <|end_body_0|> <|body_start_1|> from .entity import Entity from .planner_category_descriptions import PlannerCategoryDescriptions from .planner_user_ids impo...
PlannerPlanDetails
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlannerPlanDetails: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerPlanDetails: """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 obje...
stack_v2_sparse_classes_36k_train_027658
3,086
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: PlannerPlanDetails", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_...
3
stack_v2_sparse_classes_30k_train_021099
Implement the Python class `PlannerPlanDetails` described below. Class description: Implement the PlannerPlanDetails class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerPlanDetails: Creates a new instance of the appropriate class based on disc...
Implement the Python class `PlannerPlanDetails` described below. Class description: Implement the PlannerPlanDetails class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerPlanDetails: Creates a new instance of the appropriate class based on disc...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class PlannerPlanDetails: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerPlanDetails: """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 obje...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlannerPlanDetails: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PlannerPlanDetails: """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: Pl...
the_stack_v2_python_sparse
msgraph/generated/models/planner_plan_details.py
microsoftgraph/msgraph-sdk-python
train
135
74cada21c63162ab8915a1fd637e80d2a82fa9ff
[ "super(BaseWatcherBuilder, self).__init__()\nself._logger = None\nself.node = node\nself.parameters = parameters\nself.event = event\nself.name = name\nself.output = output\nself._product = None\nself._output_file = None\nself._arguments = None\nreturn", "if self._arguments is None:\n try:\n self._argum...
<|body_start_0|> super(BaseWatcherBuilder, self).__init__() self._logger = None self.node = node self.parameters = parameters self.event = event self.name = name self.output = output self._product = None self._output_file = None self._argum...
A class to base other builders on
BaseWatcherBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseWatcherBuilder: """A class to base other builders on""" def __init__(self, node, parameters, output, name=None, event=None): """:param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add...
stack_v2_sparse_classes_36k_train_027659
7,765
permissive
[ { "docstring": ":param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the output file - `event`: event to watch to decide when to stop", "name": "__init__", "signature": "def __init__(self, node, parame...
3
null
Implement the Python class `BaseWatcherBuilder` described below. Class description: A class to base other builders on Method signatures and docstrings: - def __init__(self, node, parameters, output, name=None, event=None): :param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`...
Implement the Python class `BaseWatcherBuilder` described below. Class description: A class to base other builders on Method signatures and docstrings: - def __init__(self, node, parameters, output, name=None, event=None): :param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class BaseWatcherBuilder: """A class to base other builders on""" def __init__(self, node, parameters, output, name=None, event=None): """:param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseWatcherBuilder: """A class to base other builders on""" def __init__(self, node, parameters, output, name=None, event=None): """:param: - `node`: device to watch - `parameters`: named tuple built from config file - `output`: storageobject to send output to - `name`: a name to add to the outpu...
the_stack_v2_python_sparse
apetools/builders/subbuilders/logwatcherbuilders.py
russell-n/oldape
train
0
558a0153cc127a1e24d017c22e9d8f437bcee1a2
[ "if head is None:\n return None\nif head.next is None:\n return head\np1, c1 = (ListNode(-1), head)\np2, c2 = (head, head.next)\nhead = c2\nwhile True:\n p1.next = c2\n p2.next = c1\n temp = c1.next\n c1.next = c2.next\n c2.next = temp\n if c1.next and c1.next.next:\n p1, c1 = (c1, c1...
<|body_start_0|> if head is None: return None if head.next is None: return head p1, c1 = (ListNode(-1), head) p2, c2 = (head, head.next) head = c2 while True: p1.next = c2 p2.next = c1 temp = c1.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def print_list(self, head): """:type head: ListNode :rtype: None""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head is None: return None ...
stack_v2_sparse_classes_36k_train_027660
3,198
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "swapPairs", "signature": "def swapPairs(self, head)" }, { "docstring": ":type head: ListNode :rtype: None", "name": "print_list", "signature": "def print_list(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_021140
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def print_list(self, head): :type head: ListNode :rtype: None
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def print_list(self, head): :type head: ListNode :rtype: None <|skeleton|> class Solution: def swapPairs(...
b155895c90169ec97372b2517f556fd50deac2bc
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def print_list(self, head): """:type head: ListNode :rtype: None""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" if head is None: return None if head.next is None: return head p1, c1 = (ListNode(-1), head) p2, c2 = (head, head.next) head = c2 while True: ...
the_stack_v2_python_sparse
linked_list_swap_node_pairs.py
claytonjwong/Sandbox-Python
train
0
88000392ff7ed945a764d5d379e590379727bad8
[ "super().__init__()\nself.enc = enc\nself.dec = dec\nself.timestep = timestep\nself.seq_len = seq_len\nself.decoder_start = 0 if timestep == seq_len else timestep", "_, (hn, cn) = self.enc(*args)\ndevice = hn.device\nseq_cont_data = args[1]\nseq_cat_data = args[0]\nbatch_size = seq_cont_data.shape[0]\ndecoder_inp...
<|body_start_0|> super().__init__() self.enc = enc self.dec = dec self.timestep = timestep self.seq_len = seq_len self.decoder_start = 0 if timestep == seq_len else timestep <|end_body_0|> <|body_start_1|> _, (hn, cn) = self.enc(*args) device = hn.device ...
Teacher Training based autoencoder.
AutoencoderTeacherTraining
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoencoderTeacherTraining: """Teacher Training based autoencoder.""" def __init__(self, enc, dec, timestep=15, seq_len=15): """Initialize model with params.""" <|body_0|> def forward(self, *args): """Run a forward pass of model over the data.""" <|body_1...
stack_v2_sparse_classes_36k_train_027661
15,906
permissive
[ { "docstring": "Initialize model with params.", "name": "__init__", "signature": "def __init__(self, enc, dec, timestep=15, seq_len=15)" }, { "docstring": "Run a forward pass of model over the data.", "name": "forward", "signature": "def forward(self, *args)" }, { "docstring": "R...
3
stack_v2_sparse_classes_30k_train_018384
Implement the Python class `AutoencoderTeacherTraining` described below. Class description: Teacher Training based autoencoder. Method signatures and docstrings: - def __init__(self, enc, dec, timestep=15, seq_len=15): Initialize model with params. - def forward(self, *args): Run a forward pass of model over the data...
Implement the Python class `AutoencoderTeacherTraining` described below. Class description: Teacher Training based autoencoder. Method signatures and docstrings: - def __init__(self, enc, dec, timestep=15, seq_len=15): Initialize model with params. - def forward(self, *args): Run a forward pass of model over the data...
9cdbf270487751a0ad6862b2fea2ccc0e23a0b67
<|skeleton|> class AutoencoderTeacherTraining: """Teacher Training based autoencoder.""" def __init__(self, enc, dec, timestep=15, seq_len=15): """Initialize model with params.""" <|body_0|> def forward(self, *args): """Run a forward pass of model over the data.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoencoderTeacherTraining: """Teacher Training based autoencoder.""" def __init__(self, enc, dec, timestep=15, seq_len=15): """Initialize model with params.""" super().__init__() self.enc = enc self.dec = dec self.timestep = timestep self.seq_len = seq_len...
the_stack_v2_python_sparse
caspr/models/model_wrapper.py
microsoft/CASPR
train
29
dce5a55cac443f3df30378f99e8f7a4789e40c2a
[ "hostname = 'nosuchname'\ntimedgethostbyname(hostname, 5)\nckey = '%s_lookup' % hostname\nip = cache.get(ckey)\nself.assertEqual(ip, None)", "hostname = 'localhost'\ntimedgethostbyname(hostname, 5)\nckey = '%s_lookup' % hostname\nip = cache.get(ckey)\nself.assertEqual(ip, '127.0.0.1')" ]
<|body_start_0|> hostname = 'nosuchname' timedgethostbyname(hostname, 5) ckey = '%s_lookup' % hostname ip = cache.get(ckey) self.assertEqual(ip, None) <|end_body_0|> <|body_start_1|> hostname = 'localhost' timedgethostbyname(hostname, 5) ckey = '%s_lookup...
UtilsTests
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilsTests: def test_timedgethostbyname_nosuchname(self): """timedgethostbyname() stores IP's in Django cache. A none existing key should return None.""" <|body_0|> def test_timedgethostbyname_localhost(self): """timedgethostbyname() should cache an IP for a hostname...
stack_v2_sparse_classes_36k_train_027662
840
permissive
[ { "docstring": "timedgethostbyname() stores IP's in Django cache. A none existing key should return None.", "name": "test_timedgethostbyname_nosuchname", "signature": "def test_timedgethostbyname_nosuchname(self)" }, { "docstring": "timedgethostbyname() should cache an IP for a hostname passed t...
2
stack_v2_sparse_classes_30k_train_010120
Implement the Python class `UtilsTests` described below. Class description: Implement the UtilsTests class. Method signatures and docstrings: - def test_timedgethostbyname_nosuchname(self): timedgethostbyname() stores IP's in Django cache. A none existing key should return None. - def test_timedgethostbyname_localhos...
Implement the Python class `UtilsTests` described below. Class description: Implement the UtilsTests class. Method signatures and docstrings: - def test_timedgethostbyname_nosuchname(self): timedgethostbyname() stores IP's in Django cache. A none existing key should return None. - def test_timedgethostbyname_localhos...
64d9f42fc4298f6d0854441f0e514ecb042bfd9d
<|skeleton|> class UtilsTests: def test_timedgethostbyname_nosuchname(self): """timedgethostbyname() stores IP's in Django cache. A none existing key should return None.""" <|body_0|> def test_timedgethostbyname_localhost(self): """timedgethostbyname() should cache an IP for a hostname...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UtilsTests: def test_timedgethostbyname_nosuchname(self): """timedgethostbyname() stores IP's in Django cache. A none existing key should return None.""" hostname = 'nosuchname' timedgethostbyname(hostname, 5) ckey = '%s_lookup' % hostname ip = cache.get(ckey) s...
the_stack_v2_python_sparse
assets/tests.py
continual-delivery/stratahq
train
1
c97bdc9758500115d00dd12e74d8b9f2a1772596
[ "self.groups: set[LcnAddr] = set()\nself.groups_known = asyncio.Event()\nsuper().__init__(addr_conn, num_tries, timeout_msec)", "if isinstance(inp, inputs.ModStatusGroups):\n if not inp.dynamic:\n self.groups.update(inp.groups)\n self.groups_known.set()\n await self.cancel()", "if not fa...
<|body_start_0|> self.groups: set[LcnAddr] = set() self.groups_known = asyncio.Event() super().__init__(addr_conn, num_tries, timeout_msec) <|end_body_0|> <|body_start_1|> if isinstance(inp, inputs.ModStatusGroups): if not inp.dynamic: self.groups.update(inp....
Request handler to request static group membership of a module.
GroupMembershipStaticRequestHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupMembershipStaticRequestHandler: """Request handler to request static group membership of a module.""" def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): """Initialize class instance.""" <|body_0|> async def async_process_input...
stack_v2_sparse_classes_36k_train_027663
24,302
permissive
[ { "docstring": "Initialize class instance.", "name": "__init__", "signature": "def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500)" }, { "docstring": "Process incoming input object. Method to handle incoming commands for this specific request handler.", ...
4
stack_v2_sparse_classes_30k_test_000286
Implement the Python class `GroupMembershipStaticRequestHandler` described below. Class description: Request handler to request static group membership of a module. Method signatures and docstrings: - def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): Initialize class instance....
Implement the Python class `GroupMembershipStaticRequestHandler` described below. Class description: Request handler to request static group membership of a module. Method signatures and docstrings: - def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): Initialize class instance....
00b45d5dcec8fccd4b13d218ac56194f44959e68
<|skeleton|> class GroupMembershipStaticRequestHandler: """Request handler to request static group membership of a module.""" def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): """Initialize class instance.""" <|body_0|> async def async_process_input...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupMembershipStaticRequestHandler: """Request handler to request static group membership of a module.""" def __init__(self, addr_conn: ModuleConnection, num_tries: int=3, timeout_msec: int=1500): """Initialize class instance.""" self.groups: set[LcnAddr] = set() self.groups_know...
the_stack_v2_python_sparse
pypck/request_handlers.py
alengwenus/pypck
train
6
dbf08522c773933fcd1634c4a91876ba93fd76f8
[ "from random import randint\n\ndef helper(left: int, right: int) -> 'TreeNode':\n if left > right:\n return None\n pivot = left + (left + right) // 2\n if (left + right) % 2:\n pivot += randint(0, 1)\n root = TreeNode(nums[pivot])\n root.left = helper(left, pivot - 1)\n root.right = ...
<|body_start_0|> from random import randint def helper(left: int, right: int) -> 'TreeNode': if left > right: return None pivot = left + (left + right) // 2 if (left + right) % 2: pivot += randint(0, 1) root = TreeNode(nums...
BinarySearchTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySearchTree: def convert(self, nums: List[int]) -> 'TreeNode': """Approach: Recursion with right mid elem as root node Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:""" <|body_0|> def convert_(self, nums: List[int]) -> 'TreeNode': """Approach...
stack_v2_sparse_classes_36k_train_027664
2,175
no_license
[ { "docstring": "Approach: Recursion with right mid elem as root node Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:", "name": "convert", "signature": "def convert(self, nums: List[int]) -> 'TreeNode'" }, { "docstring": "Approach: Recursion with right mid elem as root node Tim...
3
null
Implement the Python class `BinarySearchTree` described below. Class description: Implement the BinarySearchTree class. Method signatures and docstrings: - def convert(self, nums: List[int]) -> 'TreeNode': Approach: Recursion with right mid elem as root node Time Complexity: O(N) Space Complexity: O(N) :param nums: :...
Implement the Python class `BinarySearchTree` described below. Class description: Implement the BinarySearchTree class. Method signatures and docstrings: - def convert(self, nums: List[int]) -> 'TreeNode': Approach: Recursion with right mid elem as root node Time Complexity: O(N) Space Complexity: O(N) :param nums: :...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BinarySearchTree: def convert(self, nums: List[int]) -> 'TreeNode': """Approach: Recursion with right mid elem as root node Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:""" <|body_0|> def convert_(self, nums: List[int]) -> 'TreeNode': """Approach...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinarySearchTree: def convert(self, nums: List[int]) -> 'TreeNode': """Approach: Recursion with right mid elem as root node Time Complexity: O(N) Space Complexity: O(N) :param nums: :return:""" from random import randint def helper(left: int, right: int) -> 'TreeNode': if ...
the_stack_v2_python_sparse
revisited_2021/tree/sorted_array_to_bst.py
Shiv2157k/leet_code
train
1
fb8dd6d4cc33516382820700188dfb5442ceadbe
[ "super().__init__()\nif len(kernel_sizes) != len(dilations):\n raise ValueError(f'kernel_sizes and dilations length must match, got kernel_sizes={len(kernel_sizes)} dilations={len(dilations)}.')\npads = tuple((same_padding(k, d) for k, d in zip(kernel_sizes, dilations)))\nself.convs = nn.ModuleList()\nfor k, d, ...
<|body_start_0|> super().__init__() if len(kernel_sizes) != len(dilations): raise ValueError(f'kernel_sizes and dilations length must match, got kernel_sizes={len(kernel_sizes)} dilations={len(dilations)}.') pads = tuple((same_padding(k, d) for k, d in zip(kernel_sizes, dilations))) ...
A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework for Automatic Segmentation of COVID-19 Pneumonia Lesions from CT Images. https:...
SimpleASPP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleASPP: """A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework for Automatic Segmentation of COVID-19 Pn...
stack_v2_sparse_classes_36k_train_027665
4,380
permissive
[ { "docstring": "Args: spatial_dims: number of spatial dimensions, could be 1, 2, or 3. in_channels: number of input channels. conv_out_channels: number of output channels of each atrous conv. The final number of output channels is conv_out_channels * len(kernel_sizes). kernel_sizes: a sequence of four convoluti...
2
null
Implement the Python class `SimpleASPP` described below. Class description: A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework fo...
Implement the Python class `SimpleASPP` described below. Class description: A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework fo...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SimpleASPP: """A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework for Automatic Segmentation of COVID-19 Pn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleASPP: """A simplified version of the atrous spatial pyramid pooling (ASPP) module. Chen et al., Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation. https://arxiv.org/abs/1802.02611 Wang et al., A Noise-robust Framework for Automatic Segmentation of COVID-19 Pneumonia Lesio...
the_stack_v2_python_sparse
monai/networks/blocks/aspp.py
Project-MONAI/MONAI
train
4,805
27e81e336fa7b33e2e4dff6c3eb0598e261850e7
[ "async for batch in self.batches(in_q):\n content_q_by_type = defaultdict(lambda: Q(pk=None))\n for declarative_content in batch:\n model_type = type(declarative_content.content)\n unit_key = declarative_content.content.natural_key_dict()\n content_q_by_type[model_type] = content_q_by_typ...
<|body_start_0|> async for batch in self.batches(in_q): content_q_by_type = defaultdict(lambda: Q(pk=None)) for declarative_content in batch: model_type = type(declarative_content.content) unit_key = declarative_content.content.natural_key_dict() ...
A Stages API stage that saves :attr:`DeclarativeContent.content` objects and saves its related :class:`~pulpcore.plugin.models.ContentArtifact` and :class:`~pulpcore.plugin.models.RemoteArtifact` objects too. This stage expects :class:`~pulpcore.plugin.stages.DeclarativeContent` units from `in_q` and inspects their ass...
QueryExistingContentUnits
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryExistingContentUnits: """A Stages API stage that saves :attr:`DeclarativeContent.content` objects and saves its related :class:`~pulpcore.plugin.models.ContentArtifact` and :class:`~pulpcore.plugin.models.RemoteArtifact` objects too. This stage expects :class:`~pulpcore.plugin.stages.Declara...
stack_v2_sparse_classes_36k_train_027666
6,533
no_license
[ { "docstring": "The coroutine for this stage. Args: in_q (:class:`asyncio.Queue`): The queue to receive :class:`~pulpcore.plugin.stages.DeclarativeContent` objects from. out_q (:class:`asyncio.Queue`): The queue to put :class:`~pulpcore.plugin.stages.DeclarativeContent` into. Returns: The coroutine for this sta...
2
stack_v2_sparse_classes_30k_train_020647
Implement the Python class `QueryExistingContentUnits` described below. Class description: A Stages API stage that saves :attr:`DeclarativeContent.content` objects and saves its related :class:`~pulpcore.plugin.models.ContentArtifact` and :class:`~pulpcore.plugin.models.RemoteArtifact` objects too. This stage expects ...
Implement the Python class `QueryExistingContentUnits` described below. Class description: A Stages API stage that saves :attr:`DeclarativeContent.content` objects and saves its related :class:`~pulpcore.plugin.models.ContentArtifact` and :class:`~pulpcore.plugin.models.RemoteArtifact` objects too. This stage expects ...
f667ec77eb5325ae68d091eac7dbd1d22b0b33f0
<|skeleton|> class QueryExistingContentUnits: """A Stages API stage that saves :attr:`DeclarativeContent.content` objects and saves its related :class:`~pulpcore.plugin.models.ContentArtifact` and :class:`~pulpcore.plugin.models.RemoteArtifact` objects too. This stage expects :class:`~pulpcore.plugin.stages.Declara...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryExistingContentUnits: """A Stages API stage that saves :attr:`DeclarativeContent.content` objects and saves its related :class:`~pulpcore.plugin.models.ContentArtifact` and :class:`~pulpcore.plugin.models.RemoteArtifact` objects too. This stage expects :class:`~pulpcore.plugin.stages.DeclarativeContent` ...
the_stack_v2_python_sparse
synchronize_refactor/trashbin/queryandsavecontent.py
asmacdo/sandbox
train
0
4f98552f0e559f617ec311f4d3261eceae59e4d2
[ "res_list = []\nif root is None:\n return res_list\nres_left_list = self.postorderTraversal(root.left)\nres_list += res_left_list\nres_right_list = self.postorderTraversal(root.right)\nres_list += res_right_list\nres_list.append(root.val)\nreturn res_list", "res_list = []\nif root is None:\n return res_list...
<|body_start_0|> res_list = [] if root is None: return res_list res_left_list = self.postorderTraversal(root.left) res_list += res_left_list res_right_list = self.postorderTraversal(root.right) res_list += res_right_list res_list.append(root.val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorderTraversal(self, root): """递归法 :type root: TreeNode :rtype: List[int]""" <|body_0|> def postorderTraversal2(self, root): """递归法 :type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal3(self, root): """迭代法...
stack_v2_sparse_classes_36k_train_027667
2,642
no_license
[ { "docstring": "递归法 :type root: TreeNode :rtype: List[int]", "name": "postorderTraversal", "signature": "def postorderTraversal(self, root)" }, { "docstring": "递归法 :type root: TreeNode :rtype: List[int]", "name": "postorderTraversal2", "signature": "def postorderTraversal2(self, root)" ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): 递归法 :type root: TreeNode :rtype: List[int] - def postorderTraversal2(self, root): 递归法 :type root: TreeNode :rtype: List[int] - def postorderTr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): 递归法 :type root: TreeNode :rtype: List[int] - def postorderTraversal2(self, root): 递归法 :type root: TreeNode :rtype: List[int] - def postorderTr...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def postorderTraversal(self, root): """递归法 :type root: TreeNode :rtype: List[int]""" <|body_0|> def postorderTraversal2(self, root): """递归法 :type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal3(self, root): """迭代法...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def postorderTraversal(self, root): """递归法 :type root: TreeNode :rtype: List[int]""" res_list = [] if root is None: return res_list res_left_list = self.postorderTraversal(root.left) res_list += res_left_list res_right_list = self.postorder...
the_stack_v2_python_sparse
leetcode/145.py
yanggelinux/algorithm-data-structure
train
0
2890f57dc91465d8636f31769d006e8708045dec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Print()", "from .print_connector import PrintConnector\nfrom .printer import Printer\nfrom .printer_share import PrinterShare\nfrom .print_operation import PrintOperation\nfrom .print_service import PrintService\nfrom .print_settings i...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Print() <|end_body_0|> <|body_start_1|> from .print_connector import PrintConnector from .printer import Printer from .printer_share import PrinterShare from .print_opera...
Print
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Print: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Print: """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: Print""" ...
stack_v2_sparse_classes_36k_train_027668
5,372
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: Print", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_n...
3
null
Implement the Python class `Print` described below. Class description: Implement the Print class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Print: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
Implement the Python class `Print` described below. Class description: Implement the Print class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Print: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Print: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Print: """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: Print""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Print: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Print: """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: Print""" if not pars...
the_stack_v2_python_sparse
msgraph/generated/models/print.py
microsoftgraph/msgraph-sdk-python
train
135
e48c83471542a278e0ebfb29d6ca3eea740e630a
[ "b = bin(n)[2:]\nb = '0' * (32 - len(b)) + b\nreturn int(b[::-1], 2)", "n = (n & 2863311530) >> 1 | (n & 1431655765) << 1\nn = (n & 3435973836) >> 2 | (n & 858993459) << 2\nn = (n & 4042322160) >> 4 | (n & 252645135) << 4\nn = (n & 4278255360) >> 8 | (n & 16711935) << 8\nreturn (n & 4294901760) >> 16 | (n & 65535...
<|body_start_0|> b = bin(n)[2:] b = '0' * (32 - len(b)) + b return int(b[::-1], 2) <|end_body_0|> <|body_start_1|> n = (n & 2863311530) >> 1 | (n & 1431655765) << 1 n = (n & 3435973836) >> 2 | (n & 858993459) << 2 n = (n & 4042322160) >> 4 | (n & 252645135) << 4 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseBits(self, n): """转成二进制的字符串来翻转""" <|body_0|> def reverseBits_2(self, n): """不依赖任何语言特性的实现""" <|body_1|> <|end_skeleton|> <|body_start_0|> b = bin(n)[2:] b = '0' * (32 - len(b)) + b return int(b[::-1], 2) <|end_bod...
stack_v2_sparse_classes_36k_train_027669
584
permissive
[ { "docstring": "转成二进制的字符串来翻转", "name": "reverseBits", "signature": "def reverseBits(self, n)" }, { "docstring": "不依赖任何语言特性的实现", "name": "reverseBits_2", "signature": "def reverseBits_2(self, n)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseBits(self, n): 转成二进制的字符串来翻转 - def reverseBits_2(self, n): 不依赖任何语言特性的实现
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseBits(self, n): 转成二进制的字符串来翻转 - def reverseBits_2(self, n): 不依赖任何语言特性的实现 <|skeleton|> class Solution: def reverseBits(self, n): """转成二进制的字符串来翻转""" ...
d203aecd1afe1af13a0384a9c657c8424aab322d
<|skeleton|> class Solution: def reverseBits(self, n): """转成二进制的字符串来翻转""" <|body_0|> def reverseBits_2(self, n): """不依赖任何语言特性的实现""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseBits(self, n): """转成二进制的字符串来翻转""" b = bin(n)[2:] b = '0' * (32 - len(b)) + b return int(b[::-1], 2) def reverseBits_2(self, n): """不依赖任何语言特性的实现""" n = (n & 2863311530) >> 1 | (n & 1431655765) << 1 n = (n & 3435973836) >> 2 | (n ...
the_stack_v2_python_sparse
easy/Q190_ReserveBits.py
Kaciras/leetcode
train
0
3e626f92e92602192afb86f04d6408699dbc6959
[ "self.image = image\nself.T_camera_world = T_camera_world\nself.obj_key = obj_key\nself.stable_pose = stable_pose", "if self.stable_pose is None:\n T_obj_world = RigidTransform(from_frame='obj', to_frame='world')\nelse:\n T_obj_world = self.stable_pose.T_obj_table.as_frames('obj', 'world')\nT_camera_obj = T...
<|body_start_0|> self.image = image self.T_camera_world = T_camera_world self.obj_key = obj_key self.stable_pose = stable_pose <|end_body_0|> <|body_start_1|> if self.stable_pose is None: T_obj_world = RigidTransform(from_frame='obj', to_frame='world') else: ...
Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.
ObjectRender
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectRender: """Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.""" def __init__(self, image, T_camera_world=RigidTransform(from_frame='camera', to_frame='table'), obj_key=...
stack_v2_sparse_classes_36k_train_027670
3,973
permissive
[ { "docstring": "Create an ObjectRender. Parameters ---------- image : :obj:`Image` The image to be encapsulated. T_camera_world : :obj:`autolab_core.RigidTransform` A rigid transform from camera to world coordinates (positions the camera in the world). TODO -- this should be renamed. obj_key : :obj:`str`, optio...
2
stack_v2_sparse_classes_30k_train_005426
Implement the Python class `ObjectRender` described below. Class description: Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer. Method signatures and docstrings: - def __init__(self, image, T_camera_w...
Implement the Python class `ObjectRender` described below. Class description: Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer. Method signatures and docstrings: - def __init__(self, image, T_camera_w...
61217d65f040d536e54804150ce8abcf97343410
<|skeleton|> class ObjectRender: """Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.""" def __init__(self, image, T_camera_world=RigidTransform(from_frame='camera', to_frame='table'), obj_key=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObjectRender: """Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.""" def __init__(self, image, T_camera_world=RigidTransform(from_frame='camera', to_frame='table'), obj_key=None, stable_...
the_stack_v2_python_sparse
perception/object_render.py
jhu-lcsr/good_robot
train
95
2d56f0a72a916d220b9ad9f32d5544b596c80c10
[ "if all((isinstance(x, numbers.Number) for x in [R, P, A, B, O])):\n self.R = max(0, R)\n self.P = max(0, min(P, 1))\n self.A = A\n self.B = B\n self.O = O\n self.name = name\n self._constants = model_constants\nelse:\n raise TypeError('First five arguments must be numeric.')", "epsilon = ...
<|body_start_0|> if all((isinstance(x, numbers.Number) for x in [R, P, A, B, O])): self.R = max(0, R) self.P = max(0, min(P, 1)) self.A = A self.B = B self.O = O self.name = name self._constants = model_constants else: ...
Environment
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Environment: def __init__(self, R, P, A, B, O, name=''): """Creates an Environment instance with given properties""" <|body_0|> def evaluate(self, t): """Returns environment value E and cue C for given time t""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027671
1,205
permissive
[ { "docstring": "Creates an Environment instance with given properties", "name": "__init__", "signature": "def __init__(self, R, P, A, B, O, name='')" }, { "docstring": "Returns environment value E and cue C for given time t", "name": "evaluate", "signature": "def evaluate(self, t)" } ]
2
stack_v2_sparse_classes_30k_train_002900
Implement the Python class `Environment` described below. Class description: Implement the Environment class. Method signatures and docstrings: - def __init__(self, R, P, A, B, O, name=''): Creates an Environment instance with given properties - def evaluate(self, t): Returns environment value E and cue C for given t...
Implement the Python class `Environment` described below. Class description: Implement the Environment class. Method signatures and docstrings: - def __init__(self, R, P, A, B, O, name=''): Creates an Environment instance with given properties - def evaluate(self, t): Returns environment value E and cue C for given t...
c516968deb177c876079afada902ba3a2320d77f
<|skeleton|> class Environment: def __init__(self, R, P, A, B, O, name=''): """Creates an Environment instance with given properties""" <|body_0|> def evaluate(self, t): """Returns environment value E and cue C for given time t""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Environment: def __init__(self, R, P, A, B, O, name=''): """Creates an Environment instance with given properties""" if all((isinstance(x, numbers.Number) for x in [R, P, A, B, O])): self.R = max(0, R) self.P = max(0, min(P, 1)) self.A = A self.B...
the_stack_v2_python_sparse
src/environment.py
pengzug/cces-sem-botero
train
0
945d1d70883afcd6b84dfbe6c7457509e94f9623
[ "params = kwarg['params']\ncmd = 'bridge mdb {} '.format(command)\nreturn cmd", "params = kwarg['params']\ncmd = 'bridge mdb {} '.format(command)\nreturn cmd" ]
<|body_start_0|> params = kwarg['params'] cmd = 'bridge mdb {} '.format(command) return cmd <|end_body_0|> <|body_start_1|> params = kwarg['params'] cmd = 'bridge mdb {} '.format(command) return cmd <|end_body_1|>
The corresponding commands display mdb entries, add new entries, and delete old ones.
LinuxBridgeMdbImpl
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinuxBridgeMdbImpl: """The corresponding commands display mdb entries, add new entries, and delete old ones.""" def format_update(self, command, *argv, **kwarg): """bridge mdb { add | del } dev DEV port PORT grp GROUP [ permanent | temp ] [ vid VID ]""" <|body_0|> def fo...
stack_v2_sparse_classes_36k_train_027672
820
permissive
[ { "docstring": "bridge mdb { add | del } dev DEV port PORT grp GROUP [ permanent | temp ] [ vid VID ]", "name": "format_update", "signature": "def format_update(self, command, *argv, **kwarg)" }, { "docstring": "bridge mdb show [ dev DEV ]", "name": "format_show", "signature": "def forma...
2
stack_v2_sparse_classes_30k_train_021165
Implement the Python class `LinuxBridgeMdbImpl` described below. Class description: The corresponding commands display mdb entries, add new entries, and delete old ones. Method signatures and docstrings: - def format_update(self, command, *argv, **kwarg): bridge mdb { add | del } dev DEV port PORT grp GROUP [ permane...
Implement the Python class `LinuxBridgeMdbImpl` described below. Class description: The corresponding commands display mdb entries, add new entries, and delete old ones. Method signatures and docstrings: - def format_update(self, command, *argv, **kwarg): bridge mdb { add | del } dev DEV port PORT grp GROUP [ permane...
e4c8221e18cd94e7424c30e12eb0fb82f7767267
<|skeleton|> class LinuxBridgeMdbImpl: """The corresponding commands display mdb entries, add new entries, and delete old ones.""" def format_update(self, command, *argv, **kwarg): """bridge mdb { add | del } dev DEV port PORT grp GROUP [ permanent | temp ] [ vid VID ]""" <|body_0|> def fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinuxBridgeMdbImpl: """The corresponding commands display mdb entries, add new entries, and delete old ones.""" def format_update(self, command, *argv, **kwarg): """bridge mdb { add | del } dev DEV port PORT grp GROUP [ permanent | temp ] [ vid VID ]""" params = kwarg['params'] cm...
the_stack_v2_python_sparse
Amazon_Framework/DentOsTestbedLib/src/dent_os_testbed/lib/bridge/linux/linux_bridge_mdb_impl.py
tld3daniel/testing
train
0
0a7790123676e528073c1ac474a916fcd4fe8062
[ "qs = self.get_query_set()\nif user is not None:\n qs = qs.filter(user=user)\nif search_key is not None:\n qs = qs.filter(search_key=search_key)\nif collapsed is True:\n initial_list_qs = qs.values('user_query').order_by().annotate(times_seen=models.Count('user_query'))\n return initial_list_qs.values('...
<|body_start_0|> qs = self.get_query_set() if user is not None: qs = qs.filter(user=user) if search_key is not None: qs = qs.filter(search_key=search_key) if collapsed is True: initial_list_qs = qs.values('user_query').order_by().annotate(times_seen=mo...
SavedSearchManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SavedSearchManager: def most_recent(self, user=None, search_key=None, collapsed=True, threshold=1): """Returns the most recently seen queries. By default, only shows collapsed queries. This means that if the same query was executed several times in a row, only the most recent is shown an...
stack_v2_sparse_classes_36k_train_027673
29,990
no_license
[ { "docstring": "Returns the most recently seen queries. By default, only shows collapsed queries. This means that if the same query was executed several times in a row, only the most recent is shown and a count of ``times_seen`` is additionally provided. If you want to saw all queries (regardless of duplicates)...
2
null
Implement the Python class `SavedSearchManager` described below. Class description: Implement the SavedSearchManager class. Method signatures and docstrings: - def most_recent(self, user=None, search_key=None, collapsed=True, threshold=1): Returns the most recently seen queries. By default, only shows collapsed queri...
Implement the Python class `SavedSearchManager` described below. Class description: Implement the SavedSearchManager class. Method signatures and docstrings: - def most_recent(self, user=None, search_key=None, collapsed=True, threshold=1): Returns the most recently seen queries. By default, only shows collapsed queri...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class SavedSearchManager: def most_recent(self, user=None, search_key=None, collapsed=True, threshold=1): """Returns the most recently seen queries. By default, only shows collapsed queries. This means that if the same query was executed several times in a row, only the most recent is shown an...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SavedSearchManager: def most_recent(self, user=None, search_key=None, collapsed=True, threshold=1): """Returns the most recently seen queries. By default, only shows collapsed queries. This means that if the same query was executed several times in a row, only the most recent is shown and a count of `...
the_stack_v2_python_sparse
repoData/toastdriven-saved_searches/allPythonContent.py
aCoffeeYin/pyreco
train
0
f995504d94d30dcbf82e32553b3c348b1b29da55
[ "SafeASTTraversal.__init__(self, tree)\nself.payoffScript = payoffScript\nself.variables = variables\nself.builtnodes = {}", "self._add_variables()\nself.postorder()\n'A zero start node Id means that the tree has no statements \\n (it can still have declarations). '\nstartNodeId = len(self.ast) > 1 and...
<|body_start_0|> SafeASTTraversal.__init__(self, tree) self.payoffScript = payoffScript self.variables = variables self.builtnodes = {} <|end_body_0|> <|body_start_1|> self._add_variables() self.postorder() 'A zero start node Id means that the tree has no stateme...
Traverse tree and write to a FObject representation for execution
FUDMCValuationFunctionBuilder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FUDMCValuationFunctionBuilder: """Traverse tree and write to a FObject representation for execution""" def __init__(self, payoffScript, tree, variables): """Initialize FUDMCValuationFunctionBuilder payoffScript -- an FUDMCScriptPayoff instance tree -- final tree representation of PEL...
stack_v2_sparse_classes_36k_train_027674
3,052
no_license
[ { "docstring": "Initialize FUDMCValuationFunctionBuilder payoffScript -- an FUDMCScriptPayoff instance tree -- final tree representation of PEL code, McAstNode variables-- list of variables", "name": "__init__", "signature": "def __init__(self, payoffScript, tree, variables)" }, { "docstring": "...
4
null
Implement the Python class `FUDMCValuationFunctionBuilder` described below. Class description: Traverse tree and write to a FObject representation for execution Method signatures and docstrings: - def __init__(self, payoffScript, tree, variables): Initialize FUDMCValuationFunctionBuilder payoffScript -- an FUDMCScrip...
Implement the Python class `FUDMCValuationFunctionBuilder` described below. Class description: Traverse tree and write to a FObject representation for execution Method signatures and docstrings: - def __init__(self, payoffScript, tree, variables): Initialize FUDMCValuationFunctionBuilder payoffScript -- an FUDMCScrip...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class FUDMCValuationFunctionBuilder: """Traverse tree and write to a FObject representation for execution""" def __init__(self, payoffScript, tree, variables): """Initialize FUDMCValuationFunctionBuilder payoffScript -- an FUDMCScriptPayoff instance tree -- final tree representation of PEL...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FUDMCValuationFunctionBuilder: """Traverse tree and write to a FObject representation for execution""" def __init__(self, payoffScript, tree, variables): """Initialize FUDMCValuationFunctionBuilder payoffScript -- an FUDMCScriptPayoff instance tree -- final tree representation of PEL code, McAstN...
the_stack_v2_python_sparse
Extensions/UDMCMod/FPythonCode/FUDMC_CPP.py
webclinic017/fa-absa-py3
train
0
fd5393ff8fe32578fbb7acc3dd53e79475098142
[ "super(PointerNetwork, self).__init__()\nself._score_type = score_type\nself._name = name\nself._hidden_size = hidden_size\nself._init_scale = init_scale", "input_dim = len(q.shape)\nif input_dim == 2:\n q = layers.unsqueeze(q, [1])\nif self._score_type == 'dot_prod':\n ptr_score = layers.matmul(q, v, trans...
<|body_start_0|> super(PointerNetwork, self).__init__() self._score_type = score_type self._name = name self._hidden_size = hidden_size self._init_scale = init_scale <|end_body_0|> <|body_start_1|> input_dim = len(q.shape) if input_dim == 2: q = layer...
Pointer Network
PointerNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerNetwork: """Pointer Network""" def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): """init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): fo...
stack_v2_sparse_classes_36k_train_027675
5,544
permissive
[ { "docstring": "init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): for init fc param. used when score_type is affine or std. default is 0.1 hidden_size (int): only used when score_type=std.", "name": "__i...
2
null
Implement the Python class `PointerNetwork` described below. Class description: Pointer Network Method signatures and docstrings: - def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for p...
Implement the Python class `PointerNetwork` described below. Class description: Pointer Network Method signatures and docstrings: - def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for p...
e08f3cb7b9db4c837000316c791542580ba02624
<|skeleton|> class PointerNetwork: """Pointer Network""" def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): """init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointerNetwork: """Pointer Network""" def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): """init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): for init fc par...
the_stack_v2_python_sparse
NLP/DuSQL-Baseline/text2sql/models/pointer_network.py
ajayvbabu/Research
train
0
43845e3ec61dd8805073af5bd2c0bf7afb20db52
[ "expected_type = kwargs.pop('expected_type', None)\nsuper(BitbucketCloudBase, self).__init__(url, *args, **kwargs)\nif expected_type is not None and (not expected_type == self.get_data('type')):\n raise ValueError('Expected type of data is [{}], got [{}].'.format(expected_type, self.get_data('type')))", "links...
<|body_start_0|> expected_type = kwargs.pop('expected_type', None) super(BitbucketCloudBase, self).__init__(url, *args, **kwargs) if expected_type is not None and (not expected_type == self.get_data('type')): raise ValueError('Expected type of data is [{}], got [{}].'.format(expected...
BitbucketCloudBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BitbucketCloudBase: def __init__(self, url, *args, **kwargs): """Init the rest api wrapper :param url: string: The base url used for the rest api. :param *args: list: The fixed arguments for the AtlassianRestApi. :param **kwargs: dict: The keyword arguments for the AtlassianRestApi. :ret...
stack_v2_sparse_classes_36k_train_027676
4,094
permissive
[ { "docstring": "Init the rest api wrapper :param url: string: The base url used for the rest api. :param *args: list: The fixed arguments for the AtlassianRestApi. :param **kwargs: dict: The keyword arguments for the AtlassianRestApi. :return: nothing", "name": "__init__", "signature": "def __init__(sel...
4
stack_v2_sparse_classes_30k_val_000280
Implement the Python class `BitbucketCloudBase` described below. Class description: Implement the BitbucketCloudBase class. Method signatures and docstrings: - def __init__(self, url, *args, **kwargs): Init the rest api wrapper :param url: string: The base url used for the rest api. :param *args: list: The fixed argu...
Implement the Python class `BitbucketCloudBase` described below. Class description: Implement the BitbucketCloudBase class. Method signatures and docstrings: - def __init__(self, url, *args, **kwargs): Init the rest api wrapper :param url: string: The base url used for the rest api. :param *args: list: The fixed argu...
bb1c0f2d4187ba8efa1a838cd0041b54c944fee8
<|skeleton|> class BitbucketCloudBase: def __init__(self, url, *args, **kwargs): """Init the rest api wrapper :param url: string: The base url used for the rest api. :param *args: list: The fixed arguments for the AtlassianRestApi. :param **kwargs: dict: The keyword arguments for the AtlassianRestApi. :ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BitbucketCloudBase: def __init__(self, url, *args, **kwargs): """Init the rest api wrapper :param url: string: The base url used for the rest api. :param *args: list: The fixed arguments for the AtlassianRestApi. :param **kwargs: dict: The keyword arguments for the AtlassianRestApi. :return: nothing""...
the_stack_v2_python_sparse
atlassian/bitbucket/cloud/base.py
atlassian-api/atlassian-python-api
train
1,130
8c5d3028a982f74a580479b0a66eaf298f1600fd
[ "self.capacity = capacity\nself.queue = DLL()\nself.mapping = {}", "if key not in self.mapping:\n return -1\nnode = self.mapping[key]\nself.queue.update(node)\nreturn node.val", "if key in self.mapping:\n node = self.mapping[key]\n node.val = value\n self.queue.update(node)\n return\nnode = Node(...
<|body_start_0|> self.capacity = capacity self.queue = DLL() self.mapping = {} <|end_body_0|> <|body_start_1|> if key not in self.mapping: return -1 node = self.mapping[key] self.queue.update(node) return node.val <|end_body_1|> <|body_start_2|> ...
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_027677
2,822
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_001501
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...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|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.queue = DLL() self.mapping = {} def get(self, key): """:rtype: int""" if key not in self.mapping: return -1 node = self.mapping[key] ...
the_stack_v2_python_sparse
python_1_to_1000/146_LRU_Cache.py
jakehoare/leetcode
train
58
16d2159a79e1bf886a49d7db52e067aa0a2b22f3
[ "self._caffe = kwargs.pop('caffe')\nkwargs.setdefault('label_suffix', '')\nsuper(FullProductForm, self).__init__(*args, **kwargs)\nself.fields['product'].label = 'Produkt'\nself.fields['amount'].label = u'Ilość'\nself.fields['product'].empty_label = None\nself.fields['product'].queryset = Product.objects.filter(caf...
<|body_start_0|> self._caffe = kwargs.pop('caffe') kwargs.setdefault('label_suffix', '') super(FullProductForm, self).__init__(*args, **kwargs) self.fields['product'].label = 'Produkt' self.fields['amount'].label = u'Ilość' self.fields['product'].empty_label = None ...
Responsible for setting up a FullProduct - Product with its amount.
FullProductForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullProductForm: """Responsible for setting up a FullProduct - Product with its amount.""" def __init__(self, *args, **kwargs): """Initialize all FullProduct's fields.""" <|body_0|> def save(self, commit=True): """Override of save method, to add Caffe relation.""...
stack_v2_sparse_classes_36k_train_027678
5,569
permissive
[ { "docstring": "Initialize all FullProduct's fields.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Override of save method, to add Caffe relation.", "name": "save", "signature": "def save(self, commit=True)" } ]
2
stack_v2_sparse_classes_30k_train_017727
Implement the Python class `FullProductForm` described below. Class description: Responsible for setting up a FullProduct - Product with its amount. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize all FullProduct's fields. - def save(self, commit=True): Override of save method, to ...
Implement the Python class `FullProductForm` described below. Class description: Responsible for setting up a FullProduct - Product with its amount. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize all FullProduct's fields. - def save(self, commit=True): Override of save method, to ...
cdb7f5edb29255c7e874eaa6231621063210a8b0
<|skeleton|> class FullProductForm: """Responsible for setting up a FullProduct - Product with its amount.""" def __init__(self, *args, **kwargs): """Initialize all FullProduct's fields.""" <|body_0|> def save(self, commit=True): """Override of save method, to add Caffe relation.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FullProductForm: """Responsible for setting up a FullProduct - Product with its amount.""" def __init__(self, *args, **kwargs): """Initialize all FullProduct's fields.""" self._caffe = kwargs.pop('caffe') kwargs.setdefault('label_suffix', '') super(FullProductForm, self)._...
the_stack_v2_python_sparse
caffe/reports/forms.py
VirrageS/io-kawiarnie
train
3
1c59d473751f81e5464c4f2ee6203f87ef7f71a9
[ "mgr = execute_simple_run(self, slurm_sched_class=SlurmScheduler)\nrun = mgr.get_last_run()\nself.check_run_OK(run)\nself.assertTrue(run.is_complete())\nself.assertTrue(run.is_successful())\nself.assertIsNone(run.clean())\nself.assertIsNone(run.complete_clean())", "mgr = execute_nested_run(self, slurm_sched_class...
<|body_start_0|> mgr = execute_simple_run(self, slurm_sched_class=SlurmScheduler) run = mgr.get_last_run() self.check_run_OK(run) self.assertTrue(run.is_complete()) self.assertTrue(run.is_successful()) self.assertIsNone(run.clean()) self.assertIsNone(run.complete_...
SlurmExecutionTests
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlurmExecutionTests: def test_simple_run(self): """Execute a simple run.""" <|body_0|> def test_nested_run(self): """Execute a nested run.""" <|body_1|> <|end_skeleton|> <|body_start_0|> mgr = execute_simple_run(self, slurm_sched_class=SlurmSchedule...
stack_v2_sparse_classes_36k_train_027679
9,814
permissive
[ { "docstring": "Execute a simple run.", "name": "test_simple_run", "signature": "def test_simple_run(self)" }, { "docstring": "Execute a nested run.", "name": "test_nested_run", "signature": "def test_nested_run(self)" } ]
2
null
Implement the Python class `SlurmExecutionTests` described below. Class description: Implement the SlurmExecutionTests class. Method signatures and docstrings: - def test_simple_run(self): Execute a simple run. - def test_nested_run(self): Execute a nested run.
Implement the Python class `SlurmExecutionTests` described below. Class description: Implement the SlurmExecutionTests class. Method signatures and docstrings: - def test_simple_run(self): Execute a simple run. - def test_nested_run(self): Execute a nested run. <|skeleton|> class SlurmExecutionTests: def test_s...
76bc8f289f66fb133f78cb6d5689568b7d015915
<|skeleton|> class SlurmExecutionTests: def test_simple_run(self): """Execute a simple run.""" <|body_0|> def test_nested_run(self): """Execute a nested run.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlurmExecutionTests: def test_simple_run(self): """Execute a simple run.""" mgr = execute_simple_run(self, slurm_sched_class=SlurmScheduler) run = mgr.get_last_run() self.check_run_OK(run) self.assertTrue(run.is_complete()) self.assertTrue(run.is_successful()) ...
the_stack_v2_python_sparse
kive/fleet/tests_slurmscheduler.py
dmacmillan/Kive
train
1
400b20c58fb2011d271c03239a5ec9c7c53ec302
[ "if value is None:\n return None\nreturn json.dumps(value, separators=self.separators)", "if value is None:\n return None\nreturn json.loads(value)" ]
<|body_start_0|> if value is None: return None return json.dumps(value, separators=self.separators) <|end_body_0|> <|body_start_1|> if value is None: return None return json.loads(value) <|end_body_1|>
A JSONType is stored in the db as a string and we interact with it like a dict.
JSONType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONType: """A JSONType is stored in the db as a string and we interact with it like a dict.""" def process_bind_param(self, value, dialect=None): """Dump our value to a form our db recognizes (a string).""" <|body_0|> def process_result_value(self, value, dialect=None):...
stack_v2_sparse_classes_36k_train_027680
3,117
permissive
[ { "docstring": "Dump our value to a form our db recognizes (a string).", "name": "process_bind_param", "signature": "def process_bind_param(self, value, dialect=None)" }, { "docstring": "Convert what we get from the db into a json dict", "name": "process_result_value", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_012956
Implement the Python class `JSONType` described below. Class description: A JSONType is stored in the db as a string and we interact with it like a dict. Method signatures and docstrings: - def process_bind_param(self, value, dialect=None): Dump our value to a form our db recognizes (a string). - def process_result_v...
Implement the Python class `JSONType` described below. Class description: A JSONType is stored in the db as a string and we interact with it like a dict. Method signatures and docstrings: - def process_bind_param(self, value, dialect=None): Dump our value to a form our db recognizes (a string). - def process_result_v...
b88183ac00b88f5dff9c01ad87a46da9e3615d9e
<|skeleton|> class JSONType: """A JSONType is stored in the db as a string and we interact with it like a dict.""" def process_bind_param(self, value, dialect=None): """Dump our value to a form our db recognizes (a string).""" <|body_0|> def process_result_value(self, value, dialect=None):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONType: """A JSONType is stored in the db as a string and we interact with it like a dict.""" def process_bind_param(self, value, dialect=None): """Dump our value to a form our db recognizes (a string).""" if value is None: return None return json.dumps(value, separa...
the_stack_v2_python_sparse
replication_handler/models/database.py
Yelp/mysql_streamer
train
433
6f3fd8eb9860a76f1195f4394e208050710f33fa
[ "try:\n html = etree.HTML(content.lower())\n subject = html.xpath('//ul[@class=\"img\"]/li')\n subject_urls = list()\n for sub in subject:\n a_href = sub[0].get('href')\n subject_urls.append(a_href)\n return subject_urls\nexcept Exception as e:\n print(str(e))\n return list()", ...
<|body_start_0|> try: html = etree.HTML(content.lower()) subject = html.xpath('//ul[@class="img"]/li') subject_urls = list() for sub in subject: a_href = sub[0].get('href') subject_urls.append(a_href) return subject_urls...
HtmlParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HtmlParser: def parse_main_subjects(self, content): """解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']""" <|body_0|> def parse_subject_mj_info(self, content): """获取具体模特大图页面开头的模特信息 :param content: 一个类别的模特页面内容 :return: {'count': 该模特具备图总数, ...
stack_v2_sparse_classes_36k_train_027681
1,773
permissive
[ { "docstring": "解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']", "name": "parse_main_subjects", "signature": "def parse_main_subjects(self, content)" }, { "docstring": "获取具体模特大图页面开头的模特信息 :param content: 一个类别的模特页面内容 :return: {'count': 该模特具备图总数, 'mj_name': 模特名字}", ...
3
stack_v2_sparse_classes_30k_train_007629
Implement the Python class `HtmlParser` described below. Class description: Implement the HtmlParser class. Method signatures and docstrings: - def parse_main_subjects(self, content): 解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面'] - def parse_subject_mj_info(self, content): 获取具体模特大图页面开头...
Implement the Python class `HtmlParser` described below. Class description: Implement the HtmlParser class. Method signatures and docstrings: - def parse_main_subjects(self, content): 解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面'] - def parse_subject_mj_info(self, content): 获取具体模特大图页面开头...
6303c2df24ef3d15be205a8599ed58e7bc5ddb8a
<|skeleton|> class HtmlParser: def parse_main_subjects(self, content): """解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']""" <|body_0|> def parse_subject_mj_info(self, content): """获取具体模特大图页面开头的模特信息 :param content: 一个类别的模特页面内容 :return: {'count': 该模特具备图总数, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HtmlParser: def parse_main_subjects(self, content): """解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']""" try: html = etree.HTML(content.lower()) subject = html.xpath('//ul[@class="img"]/li') subject_urls = list() fo...
the_stack_v2_python_sparse
MeiTuLuSpider/html_parser.py
motiondepp/SmallReptileTraining
train
0
4691c5a6155b170641d0c6920b2f1fa040a74cde
[ "super().__init__()\nself.vocab_size = vocab_size\nself.output_size = output_size\nself.rnn_size = rnn_size\nself.bpe = bpe\nif bpe:\n self.embedding = nn.Embedding(num_embeddings=vocab_size, embedding_dim=embedding_size, padding_idx=0)\nelse:\n self.enc_embedding = nn.Embedding(num_embeddings=vocab_size, emb...
<|body_start_0|> super().__init__() self.vocab_size = vocab_size self.output_size = output_size self.rnn_size = rnn_size self.bpe = bpe if bpe: self.embedding = nn.Embedding(num_embeddings=vocab_size, embedding_dim=embedding_size, padding_idx=0) else: ...
Seq2Seq
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Seq2Seq: def __init__(self, vocab_size, rnn_size, embedding_size, output_size, enc_seq_len, dec_seq_len, bpe): """The Model class implements the LSTM-LM model. Feel free to initialize any variables that you find necessary in the constructor. :param vocab_size: The number of unique tokens...
stack_v2_sparse_classes_36k_train_027682
5,462
no_license
[ { "docstring": "The Model class implements the LSTM-LM model. Feel free to initialize any variables that you find necessary in the constructor. :param vocab_size: The number of unique tokens in the input :param rnn_size: The size of hidden cells in LSTM/GRU :param embedding_size: The dimension of embedding spac...
2
stack_v2_sparse_classes_30k_train_012688
Implement the Python class `Seq2Seq` described below. Class description: Implement the Seq2Seq class. Method signatures and docstrings: - def __init__(self, vocab_size, rnn_size, embedding_size, output_size, enc_seq_len, dec_seq_len, bpe): The Model class implements the LSTM-LM model. Feel free to initialize any vari...
Implement the Python class `Seq2Seq` described below. Class description: Implement the Seq2Seq class. Method signatures and docstrings: - def __init__(self, vocab_size, rnn_size, embedding_size, output_size, enc_seq_len, dec_seq_len, bpe): The Model class implements the LSTM-LM model. Feel free to initialize any vari...
f7e5b911ce6902eae067c20240ac565a3f2b8fbd
<|skeleton|> class Seq2Seq: def __init__(self, vocab_size, rnn_size, embedding_size, output_size, enc_seq_len, dec_seq_len, bpe): """The Model class implements the LSTM-LM model. Feel free to initialize any variables that you find necessary in the constructor. :param vocab_size: The number of unique tokens...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Seq2Seq: def __init__(self, vocab_size, rnn_size, embedding_size, output_size, enc_seq_len, dec_seq_len, bpe): """The Model class implements the LSTM-LM model. Feel free to initialize any variables that you find necessary in the constructor. :param vocab_size: The number of unique tokens in the input ...
the_stack_v2_python_sparse
multilingual/model.py
ziyaoh/comp-ling
train
0
521525415731cd451b4392eadfd6f355bf47c883
[ "self.set_peaks(peakfinder)\nself.gain = None\nself.cal = None\nself.fit_channels = []\nself.fit_snrs = []\nself.fit_energies = []\nself.reset()", "self.gain = None\nself.cal = None\nself.fit_channels = []\nself.fit_snrs = []\nself.fit_energies = []", "if not isinstance(peakfinder, PeakFinder):\n raise AutoC...
<|body_start_0|> self.set_peaks(peakfinder) self.gain = None self.cal = None self.fit_channels = [] self.fit_snrs = [] self.fit_energies = [] self.reset() <|end_body_0|> <|body_start_1|> self.gain = None self.cal = None self.fit_channels =...
Automatically calibrate a spectrum by convolving it with a filter. A note on nomenclature: for historic reasons, 'channels' is used in autocal.py for generic uncalibrated x-axis values. A 'channel' is no longer necessarily an integer channel number (i.e., bin) from a multi-channel analyzer, but could for instance be a ...
AutoCalibrator
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoCalibrator: """Automatically calibrate a spectrum by convolving it with a filter. A note on nomenclature: for historic reasons, 'channels' is used in autocal.py for generic uncalibrated x-axis values. A 'channel' is no longer necessarily an integer channel number (i.e., bin) from a multi-chan...
stack_v2_sparse_classes_36k_train_027683
10,991
permissive
[ { "docstring": "Initialize the calibration with a spectrum and kernel.", "name": "__init__", "signature": "def __init__(self, peakfinder)" }, { "docstring": "Reset all of the members.", "name": "reset", "signature": "def reset(self)" }, { "docstring": "Use the peaks found by the ...
5
stack_v2_sparse_classes_30k_train_013422
Implement the Python class `AutoCalibrator` described below. Class description: Automatically calibrate a spectrum by convolving it with a filter. A note on nomenclature: for historic reasons, 'channels' is used in autocal.py for generic uncalibrated x-axis values. A 'channel' is no longer necessarily an integer chann...
Implement the Python class `AutoCalibrator` described below. Class description: Automatically calibrate a spectrum by convolving it with a filter. A note on nomenclature: for historic reasons, 'channels' is used in autocal.py for generic uncalibrated x-axis values. A 'channel' is no longer necessarily an integer chann...
d459a17dbdb0e458218637fc323bef7821c5cb5c
<|skeleton|> class AutoCalibrator: """Automatically calibrate a spectrum by convolving it with a filter. A note on nomenclature: for historic reasons, 'channels' is used in autocal.py for generic uncalibrated x-axis values. A 'channel' is no longer necessarily an integer channel number (i.e., bin) from a multi-chan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoCalibrator: """Automatically calibrate a spectrum by convolving it with a filter. A note on nomenclature: for historic reasons, 'channels' is used in autocal.py for generic uncalibrated x-axis values. A 'channel' is no longer necessarily an integer channel number (i.e., bin) from a multi-channel analyzer,...
the_stack_v2_python_sparse
becquerel/core/autocal.py
lbl-anp/becquerel
train
41
68b7e1d666c8e12f2128e3e382243f1bafa60ee0
[ "super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length)\nself.velocities = dat.getVelocities(frame, *self.particles)\nself.vmin, self.vmax = amplogwidth(self.velocities)\ntry:\n self.vmin = np.log10(kwargs['vmin'])\nexcept (...
<|body_start_0|> super().__init__(dat, frame, box_size, centre, arrow_width=arrow_width, arrow_head_width=arrow_head_width, arrow_head_length=arrow_head_length) self.velocities = dat.getVelocities(frame, *self.particles) self.vmin, self.vmax = amplogwidth(self.velocities) try: ...
Plotting class specific to 'velocity' mode.
Velocity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Velocity: """Plotting class specific to 'velocity' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs): """Initialises and plots f...
stack_v2_sparse_classes_36k_train_027684
24,676
permissive
[ { "docstring": "Initialises and plots figure. Parameters ---------- dat : active_work.read.Dat Data object. frame : int Frame to render. box_size : float Length of the square box to render. centre : 2-uple like Centre of the box to render. arrow_width : float Width of the arrows. arrow_head_width : float Width ...
2
stack_v2_sparse_classes_30k_train_020433
Implement the Python class `Velocity` described below. Class description: Plotting class specific to 'velocity' mode. Method signatures and docstrings: - def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_l...
Implement the Python class `Velocity` described below. Class description: Plotting class specific to 'velocity' mode. Method signatures and docstrings: - def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_l...
99107a0d4935296b673f67469c1e2bd258954b9b
<|skeleton|> class Velocity: """Plotting class specific to 'velocity' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs): """Initialises and plots f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Velocity: """Plotting class specific to 'velocity' mode.""" def __init__(self, dat, frame, box_size, centre, arrow_width=_arrow_width, arrow_head_width=_arrow_head_width, arrow_head_length=_arrow_head_length, pad=_colormap_label_pad, label=False, **kwargs): """Initialises and plots figure. Parame...
the_stack_v2_python_sparse
frame.py
yketa/active_work
train
1
0a63623e867dcd0367f8ab7ea08ba1e903061791
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Process()", "from .file_hash import FileHash\nfrom .process_integrity_level import ProcessIntegrityLevel\nfrom .file_hash import FileHash\nfrom .process_integrity_level import ProcessIntegrityLevel\nfields: Dict[str, Callable[[Any], No...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Process() <|end_body_0|> <|body_start_1|> from .file_hash import FileHash from .process_integrity_level import ProcessIntegrityLevel from .file_hash import FileHash from ...
Process
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Process: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: """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: Process"""...
stack_v2_sparse_classes_36k_train_027685
6,144
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: Process", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse...
3
stack_v2_sparse_classes_30k_val_000085
Implement the Python class `Process` described below. Class description: Implement the Process class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
Implement the Python class `Process` described below. Class description: Implement the Process class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Process: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: """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: Process"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Process: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: """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: Process""" if no...
the_stack_v2_python_sparse
msgraph/generated/models/process.py
microsoftgraph/msgraph-sdk-python
train
135
439dd7901491ca85ab43d578ec12be286c266767
[ "headers = {}\nheaders['Host'] = [self.input]\nreturn self.doRequest(self.localOptions['backend'], headers=headers)", "if 'not censored' in body:\n self.report['trans_http_proxy'] = False\nelse:\n self.report['trans_http_proxy'] = True" ]
<|body_start_0|> headers = {} headers['Host'] = [self.input] return self.doRequest(self.localOptions['backend'], headers=headers) <|end_body_0|> <|body_start_1|> if 'not censored' in body: self.report['trans_http_proxy'] = False else: self.report['trans_h...
This test is aimed at detecting the presence of a transparent HTTP proxy and enumerating the sites that are being censored by it.
HTTPHost
[ "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPHost: """This test is aimed at detecting the presence of a transparent HTTP proxy and enumerating the sites that are being censored by it.""" def test_send_host_header(self): """Stuffs the HTTP Host header field with the site to be tested for censorship and does an HTTP request o...
stack_v2_sparse_classes_36k_train_027686
1,593
permissive
[ { "docstring": "Stuffs the HTTP Host header field with the site to be tested for censorship and does an HTTP request of this kind to our backend. We randomize the HTTP User Agent headers.", "name": "test_send_host_header", "signature": "def test_send_host_header(self)" }, { "docstring": "XXX thi...
2
stack_v2_sparse_classes_30k_train_020472
Implement the Python class `HTTPHost` described below. Class description: This test is aimed at detecting the presence of a transparent HTTP proxy and enumerating the sites that are being censored by it. Method signatures and docstrings: - def test_send_host_header(self): Stuffs the HTTP Host header field with the si...
Implement the Python class `HTTPHost` described below. Class description: This test is aimed at detecting the presence of a transparent HTTP proxy and enumerating the sites that are being censored by it. Method signatures and docstrings: - def test_send_host_header(self): Stuffs the HTTP Host header field with the si...
28241124e6094b224f4a3b4f6c0a8e8a69a7eeb6
<|skeleton|> class HTTPHost: """This test is aimed at detecting the presence of a transparent HTTP proxy and enumerating the sites that are being censored by it.""" def test_send_host_header(self): """Stuffs the HTTP Host header field with the site to be tested for censorship and does an HTTP request o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTTPHost: """This test is aimed at detecting the presence of a transparent HTTP proxy and enumerating the sites that are being censored by it.""" def test_send_host_header(self): """Stuffs the HTTP Host header field with the site to be tested for censorship and does an HTTP request of this kind t...
the_stack_v2_python_sparse
nettests/core/http_host.py
jonmtoz/ooni-probe
train
0
a9eb50d347c6fd6763e225f6980f9ab861645760
[ "copy = dictionary.copy()\ncount = 0\nwhile count < length / unit:\n count += 1\n word = s[start:start + unit]\n if word in copy and copy[word] > 0:\n start += unit\n copy[word] -= 1\n else:\n return False\nreturn True", "result = {}\nkeys = set(words)\nfor key in keys:\n resul...
<|body_start_0|> copy = dictionary.copy() count = 0 while count < length / unit: count += 1 word = s[start:start + unit] if word in copy and copy[word] > 0: start += unit copy[word] -= 1 else: return ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def match(self, s, start, length, dictionary, unit): """>>> s = Solution() >>> text = "barfoothefoobarman" >>> words = {"foo": 1, "bar": 1} >>> length = 6 >>> s.match(text, 0, length, words, 3) True >>> s.match(text, 3, length, words, 3) False >>> s.match(text, 6, length, words...
stack_v2_sparse_classes_36k_train_027687
2,148
no_license
[ { "docstring": ">>> s = Solution() >>> text = \"barfoothefoobarman\" >>> words = {\"foo\": 1, \"bar\": 1} >>> length = 6 >>> s.match(text, 0, length, words, 3) True >>> s.match(text, 3, length, words, 3) False >>> s.match(text, 6, length, words, 3) False >>> s.match(text, 9, length, words, 3) True >>> s.match(t...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def match(self, s, start, length, dictionary, unit): >>> s = Solution() >>> text = "barfoothefoobarman" >>> words = {"foo": 1, "bar": 1} >>> length = 6 >>> s.match(text, 0, lengt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def match(self, s, start, length, dictionary, unit): >>> s = Solution() >>> text = "barfoothefoobarman" >>> words = {"foo": 1, "bar": 1} >>> length = 6 >>> s.match(text, 0, lengt...
3b13a02f9c8273f9794a57b948d2655792707f37
<|skeleton|> class Solution: def match(self, s, start, length, dictionary, unit): """>>> s = Solution() >>> text = "barfoothefoobarman" >>> words = {"foo": 1, "bar": 1} >>> length = 6 >>> s.match(text, 0, length, words, 3) True >>> s.match(text, 3, length, words, 3) False >>> s.match(text, 6, length, words...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def match(self, s, start, length, dictionary, unit): """>>> s = Solution() >>> text = "barfoothefoobarman" >>> words = {"foo": 1, "bar": 1} >>> length = 6 >>> s.match(text, 0, length, words, 3) True >>> s.match(text, 3, length, words, 3) False >>> s.match(text, 6, length, words, 3) False >>>...
the_stack_v2_python_sparse
substring_with_concatenation.py
gsy/leetcode
train
1
0f7cc20ef0161682bf3642ac6b6aa00f37974164
[ "for iam_policy_map in resource_from_api:\n iam_policy = iam_policy_map['iam_policy']\n bindings = iam_policy.get('bindings', [])\n for binding in bindings:\n members = binding.get('members', [])\n for member in members:\n member_type, member_name, member_domain = parser.parse_memb...
<|body_start_0|> for iam_policy_map in resource_from_api: iam_policy = iam_policy_map['iam_policy'] bindings = iam_policy.get('bindings', []) for binding in bindings: members = binding.get('members', []) for member in members: ...
Pipeline to load project IAM policies data into Inventory.
LoadProjectsIamPoliciesPipeline
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadProjectsIamPoliciesPipeline: """Pipeline to load project IAM policies data into Inventory.""" def _transform(self, resource_from_api): """Yield an iterator of loadable iam policies. Args: resource_from_api (iterable): IAM policies as per-project dictionary. Example: {'project_num...
stack_v2_sparse_classes_36k_train_027688
4,687
permissive
[ { "docstring": "Yield an iterator of loadable iam policies. Args: resource_from_api (iterable): IAM policies as per-project dictionary. Example: {'project_number': 11111, 'iam_policy': policy} https://cloud.google.com/resource-manager/reference/rest/Shared.Types/Policy Yields: iterable: Loadable iam policies, a...
3
stack_v2_sparse_classes_30k_train_002926
Implement the Python class `LoadProjectsIamPoliciesPipeline` described below. Class description: Pipeline to load project IAM policies data into Inventory. Method signatures and docstrings: - def _transform(self, resource_from_api): Yield an iterator of loadable iam policies. Args: resource_from_api (iterable): IAM p...
Implement the Python class `LoadProjectsIamPoliciesPipeline` described below. Class description: Pipeline to load project IAM policies data into Inventory. Method signatures and docstrings: - def _transform(self, resource_from_api): Yield an iterator of loadable iam policies. Args: resource_from_api (iterable): IAM p...
a6a1aa7464cda2ad5948e3e8876eb8dded5e2514
<|skeleton|> class LoadProjectsIamPoliciesPipeline: """Pipeline to load project IAM policies data into Inventory.""" def _transform(self, resource_from_api): """Yield an iterator of loadable iam policies. Args: resource_from_api (iterable): IAM policies as per-project dictionary. Example: {'project_num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoadProjectsIamPoliciesPipeline: """Pipeline to load project IAM policies data into Inventory.""" def _transform(self, resource_from_api): """Yield an iterator of loadable iam policies. Args: resource_from_api (iterable): IAM policies as per-project dictionary. Example: {'project_number': 11111, ...
the_stack_v2_python_sparse
google/cloud/security/inventory/pipelines/load_projects_iam_policies_pipeline.py
shimizu19691210/forseti-security
train
1
77e76addd3928f0121f333fcca306eea7ce8cec2
[ "user_qs = User.objects.select_related('org', 'parent', 'org__subscription', 'org__subscription__current_usage').filter(id=pk)\nif len(user_qs) < 1:\n resp = {'detail': 'User not found.'}\n return Response(resp, status=400)\nuser = user_qs[0]\nuser_details = get_profile_details(user)\nreturn Response(user_det...
<|body_start_0|> user_qs = User.objects.select_related('org', 'parent', 'org__subscription', 'org__subscription__current_usage').filter(id=pk) if len(user_qs) < 1: resp = {'detail': 'User not found.'} return Response(resp, status=400) user = user_qs[0] user_detail...
ProfileViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileViewSet: def retrieve(self, request, pk, format=None): """Response: --- { 'id': 12, 'username': 'username', 'name': 'name1', 'phone': '+88017XXXXXXXX', 'image': 'url, 'email': 'manager.email', 'domain_choices': {}, 'domain': 2, 'location_interval': 120, 'org_id': 12, 'oid': 'gp-12...
stack_v2_sparse_classes_36k_train_027689
27,493
no_license
[ { "docstring": "Response: --- { 'id': 12, 'username': 'username', 'name': 'name1', 'phone': '+88017XXXXXXXX', 'image': 'url, 'email': 'manager.email', 'domain_choices': {}, 'domain': 2, 'location_interval': 120, 'org_id': 12, 'oid': 'gp-121', 'org_name': 'Grameenphone Ltd.', 'day_start': time string, 'day_end':...
2
null
Implement the Python class `ProfileViewSet` described below. Class description: Implement the ProfileViewSet class. Method signatures and docstrings: - def retrieve(self, request, pk, format=None): Response: --- { 'id': 12, 'username': 'username', 'name': 'name1', 'phone': '+88017XXXXXXXX', 'image': 'url, 'email': 'm...
Implement the Python class `ProfileViewSet` described below. Class description: Implement the ProfileViewSet class. Method signatures and docstrings: - def retrieve(self, request, pk, format=None): Response: --- { 'id': 12, 'username': 'username', 'name': 'name1', 'phone': '+88017XXXXXXXX', 'image': 'url, 'email': 'm...
11be165f85cda0ffe7a237d011de562d3dc64135
<|skeleton|> class ProfileViewSet: def retrieve(self, request, pk, format=None): """Response: --- { 'id': 12, 'username': 'username', 'name': 'name1', 'phone': '+88017XXXXXXXX', 'image': 'url, 'email': 'manager.email', 'domain_choices': {}, 'domain': 2, 'location_interval': 120, 'org_id': 12, 'oid': 'gp-12...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileViewSet: def retrieve(self, request, pk, format=None): """Response: --- { 'id': 12, 'username': 'username', 'name': 'name1', 'phone': '+88017XXXXXXXX', 'image': 'url, 'email': 'manager.email', 'domain_choices': {}, 'domain': 2, 'location_interval': 120, 'org_id': 12, 'oid': 'gp-121', 'org_name'...
the_stack_v2_python_sparse
apps/user/views.py
ash018/FFTracker
train
0
ece2375ae0180955a9d0138170f02968e169ee1b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn NetworkInfo()", "from .network_connection_type import NetworkConnectionType\nfrom .network_transport_protocol import NetworkTransportProtocol\nfrom .trace_route_hop import TraceRouteHop\nfrom .wifi_band import WifiBand\nfrom .wifi_radi...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return NetworkInfo() <|end_body_0|> <|body_start_1|> from .network_connection_type import NetworkConnectionType from .network_transport_protocol import NetworkTransportProtocol from .tr...
NetworkInfo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkInfo: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> NetworkInfo: """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: Ne...
stack_v2_sparse_classes_36k_train_027690
11,094
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: NetworkInfo", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(p...
3
null
Implement the Python class `NetworkInfo` described below. Class description: Implement the NetworkInfo class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> NetworkInfo: Creates a new instance of the appropriate class based on discriminator value Args:...
Implement the Python class `NetworkInfo` described below. Class description: Implement the NetworkInfo class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> NetworkInfo: Creates a new instance of the appropriate class based on discriminator value Args:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class NetworkInfo: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> NetworkInfo: """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: Ne...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetworkInfo: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> NetworkInfo: """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: NetworkInfo""" ...
the_stack_v2_python_sparse
msgraph/generated/models/call_records/network_info.py
microsoftgraph/msgraph-sdk-python
train
135
e02b0aabb5008b838b7f54d4af78aca0cc8ac449
[ "Parametre.__init__(self, 'créer', 'create')\nself.schema = '<cle>'\nself.aide_courte = 'crée une diligence maudite'\nself.aide_longue = \"Cette commande permet de créer une diligence maudite. Vous devez préciser la clé de la diligence à créer, sachant qu'elle ne peut pas être une clé de zone existante, car la clé ...
<|body_start_0|> Parametre.__init__(self, 'créer', 'create') self.schema = '<cle>' self.aide_courte = 'crée une diligence maudite' self.aide_longue = "Cette commande permet de créer une diligence maudite. Vous devez préciser la clé de la diligence à créer, sachant qu'elle ne peut pas êtr...
Commande 'diligence créer'.
PrmCreer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmCreer: """Commande 'diligence créer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre._...
stack_v2_sparse_classes_36k_train_027691
3,158
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmCreer` described below. Class description: Commande 'diligence créer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmCreer` described below. Class description: Commande 'diligence créer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmCreer: """Commande 'diligence...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmCreer: """Commande 'diligence créer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmCreer: """Commande 'diligence créer'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'créer', 'create') self.schema = '<cle>' self.aide_courte = 'crée une diligence maudite' self.aide_longue = "Cette commande permet de créer une ...
the_stack_v2_python_sparse
src/secondaires/diligence/commandes/diligence/creer.py
vincent-lg/tsunami
train
5
d1af9dce8b10ec4c9d8f7390c500db47f300e7aa
[ "data = self.get_json()\ntry:\n rund = ObservingRunPost.load(data)\nexcept ValidationError as exc:\n return self.error(f'Invalid/missing parameters: {exc.normalized_messages()}')\nrun = ObservingRun(**rund)\nrun.owner_id = self.associated_user_object.id\nDBSession().add(run)\nself.verify_and_commit()\nself.pu...
<|body_start_0|> data = self.get_json() try: rund = ObservingRunPost.load(data) except ValidationError as exc: return self.error(f'Invalid/missing parameters: {exc.normalized_messages()}') run = ObservingRun(**rund) run.owner_id = self.associated_user_obje...
ObservingRunHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservingRunHandler: def post(self): """--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object propert...
stack_v2_sparse_classes_36k_train_027692
8,089
permissive
[ { "docstring": "--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: id: type: in...
4
null
Implement the Python class `ObservingRunHandler` described below. Class description: Implement the ObservingRunHandler class. Method signatures and docstrings: - def post(self): --- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: ...
Implement the Python class `ObservingRunHandler` described below. Class description: Implement the ObservingRunHandler class. Method signatures and docstrings: - def post(self): --- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: ...
2433d5ae0b2f41faac3c76ed4ae8d9a4da5522fb
<|skeleton|> class ObservingRunHandler: def post(self): """--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object propert...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservingRunHandler: def post(self): """--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: typ...
the_stack_v2_python_sparse
skyportal/handlers/api/observingrun.py
dmitryduev/skyportal
train
1
dfd23da41dd63393803aa00f5af8d6519239947b
[ "if v <= 0:\n raise ValueError('max_tokens must be a positive integer')\nreturn v", "model = available_models[self.model_name.value]\nkwargs = model._lc_kwargs\nsecrets = {secret: getattr(model, secret) for secret in model.lc_secrets.keys()}\nkwargs.update(secrets)\nmodel_kwargs = kwargs.get('model_kwargs', {}...
<|body_start_0|> if v <= 0: raise ValueError('max_tokens must be a positive integer') return v <|end_body_0|> <|body_start_1|> model = available_models[self.model_name.value] kwargs = model._lc_kwargs secrets = {secret: getattr(model, secret) for secret in model.lc_s...
OpenAI LLM configuration.
OpenAIModelConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenAIModelConfig: """OpenAI LLM configuration.""" def max_tokens_must_be_positive(cls, v): """Validate that max_tokens is a positive integer.""" <|body_0|> def get_model(self) -> BaseLanguageModel: """Get the model from the configuration. Returns: BaseLanguageMo...
stack_v2_sparse_classes_36k_train_027693
12,618
no_license
[ { "docstring": "Validate that max_tokens is a positive integer.", "name": "max_tokens_must_be_positive", "signature": "def max_tokens_must_be_positive(cls, v)" }, { "docstring": "Get the model from the configuration. Returns: BaseLanguageModel: The model.", "name": "get_model", "signatur...
2
stack_v2_sparse_classes_30k_val_000174
Implement the Python class `OpenAIModelConfig` described below. Class description: OpenAI LLM configuration. Method signatures and docstrings: - def max_tokens_must_be_positive(cls, v): Validate that max_tokens is a positive integer. - def get_model(self) -> BaseLanguageModel: Get the model from the configuration. Re...
Implement the Python class `OpenAIModelConfig` described below. Class description: OpenAI LLM configuration. Method signatures and docstrings: - def max_tokens_must_be_positive(cls, v): Validate that max_tokens is a positive integer. - def get_model(self) -> BaseLanguageModel: Get the model from the configuration. Re...
616cec5c43a0757495a4134c0c325e46a0b18d3b
<|skeleton|> class OpenAIModelConfig: """OpenAI LLM configuration.""" def max_tokens_must_be_positive(cls, v): """Validate that max_tokens is a positive integer.""" <|body_0|> def get_model(self) -> BaseLanguageModel: """Get the model from the configuration. Returns: BaseLanguageMo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpenAIModelConfig: """OpenAI LLM configuration.""" def max_tokens_must_be_positive(cls, v): """Validate that max_tokens is a positive integer.""" if v <= 0: raise ValueError('max_tokens must be a positive integer') return v def get_model(self) -> BaseLanguageModel...
the_stack_v2_python_sparse
module_text_llm/module_text_llm/helpers/models/openai.py
ls1intum/Athena
train
11
7bbdb4a0556da7432319aafb8b61ae2fd39a4aa5
[ "if self.instance.paid:\n return\nself.instance.status = order_status.RECEIVED\nself.instance.payment_psp_reference = psp_reference\nself.instance.paid = True\nself.instance.save()\nnew_adyen_response = AdyenResponse(order=self.instance, content=raw_data)\nnew_adyen_response.save()\nlogger.info('Order %s is paid...
<|body_start_0|> if self.instance.paid: return self.instance.status = order_status.RECEIVED self.instance.payment_psp_reference = psp_reference self.instance.paid = True self.instance.save() new_adyen_response = AdyenResponse(order=self.instance, content=raw_d...
Payment seriazlier class
OrderPaymentSeriazlier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderPaymentSeriazlier: """Payment seriazlier class""" def complete_payment(self, psp_reference, raw_data=None): """Handle logic when a payment of order is completed""" <|body_0|> def refund_payment(self): """Handle logic when a payment of order is completed""" ...
stack_v2_sparse_classes_36k_train_027694
1,298
no_license
[ { "docstring": "Handle logic when a payment of order is completed", "name": "complete_payment", "signature": "def complete_payment(self, psp_reference, raw_data=None)" }, { "docstring": "Handle logic when a payment of order is completed", "name": "refund_payment", "signature": "def refun...
2
null
Implement the Python class `OrderPaymentSeriazlier` described below. Class description: Payment seriazlier class Method signatures and docstrings: - def complete_payment(self, psp_reference, raw_data=None): Handle logic when a payment of order is completed - def refund_payment(self): Handle logic when a payment of or...
Implement the Python class `OrderPaymentSeriazlier` described below. Class description: Payment seriazlier class Method signatures and docstrings: - def complete_payment(self, psp_reference, raw_data=None): Handle logic when a payment of order is completed - def refund_payment(self): Handle logic when a payment of or...
2f50b3815474845dd8c08f2a6f0213d5da3a5413
<|skeleton|> class OrderPaymentSeriazlier: """Payment seriazlier class""" def complete_payment(self, psp_reference, raw_data=None): """Handle logic when a payment of order is completed""" <|body_0|> def refund_payment(self): """Handle logic when a payment of order is completed""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderPaymentSeriazlier: """Payment seriazlier class""" def complete_payment(self, psp_reference, raw_data=None): """Handle logic when a payment of order is completed""" if self.instance.paid: return self.instance.status = order_status.RECEIVED self.instance.pay...
the_stack_v2_python_sparse
core/serializers/payment.py
raviteja2250/tabletop-backend-develop
train
0
506b6b95b08ae588ba13acfd67b4c3e7e39be39e
[ "self.lib = abstract.sdk.triggers.processrestart.libs.processrestart.ProcessRestartLib(device=uut, process=self.process, abstract=abstract, verify_exclude=self.verify_exclude, obj=self)\ntry:\n self.lib.process_information()\nexcept Exception as e:\n self.skipped(\"Issue getting information about '{p}' proces...
<|body_start_0|> self.lib = abstract.sdk.triggers.processrestart.libs.processrestart.ProcessRestartLib(device=uut, process=self.process, abstract=abstract, verify_exclude=self.verify_exclude, obj=self) try: self.lib.process_information() except Exception as e: self.skippe...
Trigger class for ProcessCliRestart action
TriggerProcessRestart
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerProcessRestart: """Trigger class for ProcessCliRestart action""" def verify_prerequisite(self, uut, abstract, steps): """Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstr...
stack_v2_sparse_classes_36k_train_027695
4,222
permissive
[ { "docstring": "Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object Returns: None Raises: pyATS Results", "name": "verify_prerequisite"...
3
null
Implement the Python class `TriggerProcessRestart` described below. Class description: Trigger class for ProcessCliRestart action Method signatures and docstrings: - def verify_prerequisite(self, uut, abstract, steps): Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to t...
Implement the Python class `TriggerProcessRestart` described below. Class description: Trigger class for ProcessCliRestart action Method signatures and docstrings: - def verify_prerequisite(self, uut, abstract, steps): Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to t...
e42e51475cddcb10f5c7814d0fe892ac865742ba
<|skeleton|> class TriggerProcessRestart: """Trigger class for ProcessCliRestart action""" def verify_prerequisite(self, uut, abstract, steps): """Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TriggerProcessRestart: """Trigger class for ProcessCliRestart action""" def verify_prerequisite(self, uut, abstract, steps): """Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`): ...
the_stack_v2_python_sparse
pkgs/sdk-pkg/src/genie/libs/sdk/triggers/processrestart/processrestart.py
CiscoTestAutomation/genielibs
train
109
076d1b8ec7f07af7351596ea7a9d26ea26313b1d
[ "super().__init__(hass, _LOGGER, name=f'octoprint-{config_entry.entry_id}', update_interval=timedelta(seconds=interval))\nself.config_entry = config_entry\nself._octoprint = octoprint\nself._printer_offline = False\nself.data = {'printer': None, 'job': None, 'last_read_time': None}", "printer = None\ntry:\n jo...
<|body_start_0|> super().__init__(hass, _LOGGER, name=f'octoprint-{config_entry.entry_id}', update_interval=timedelta(seconds=interval)) self.config_entry = config_entry self._octoprint = octoprint self._printer_offline = False self.data = {'printer': None, 'job': None, 'last_rea...
Class to manage fetching Octoprint data.
OctoprintDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OctoprintDataUpdateCoordinator: """Class to manage fetching Octoprint data.""" def __init__(self, hass: HomeAssistant, octoprint: OctoprintClient, config_entry: ConfigEntry, interval: int) -> None: """Initialize.""" <|body_0|> async def _async_update_data(self): ...
stack_v2_sparse_classes_36k_train_027696
3,236
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, octoprint: OctoprintClient, config_entry: ConfigEntry, interval: int) -> None" }, { "docstring": "Update data via API.", "name": "_async_update_data", "signature": "async def _async_up...
3
null
Implement the Python class `OctoprintDataUpdateCoordinator` described below. Class description: Class to manage fetching Octoprint data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, octoprint: OctoprintClient, config_entry: ConfigEntry, interval: int) -> None: Initialize. - async def _a...
Implement the Python class `OctoprintDataUpdateCoordinator` described below. Class description: Class to manage fetching Octoprint data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, octoprint: OctoprintClient, config_entry: ConfigEntry, interval: int) -> None: Initialize. - async def _a...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OctoprintDataUpdateCoordinator: """Class to manage fetching Octoprint data.""" def __init__(self, hass: HomeAssistant, octoprint: OctoprintClient, config_entry: ConfigEntry, interval: int) -> None: """Initialize.""" <|body_0|> async def _async_update_data(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OctoprintDataUpdateCoordinator: """Class to manage fetching Octoprint data.""" def __init__(self, hass: HomeAssistant, octoprint: OctoprintClient, config_entry: ConfigEntry, interval: int) -> None: """Initialize.""" super().__init__(hass, _LOGGER, name=f'octoprint-{config_entry.entry_id}'...
the_stack_v2_python_sparse
homeassistant/components/octoprint/coordinator.py
home-assistant/core
train
35,501
43fa2352ea7a7ea3317f4233ab22dd198969999a
[ "exception_multiple_object_returned = False\ncreated = False\nif not party_id_temp:\n success = False\n status = 'MISSING_PARTY_TEMP_ID'\nelif not party_name:\n success = False\n status = 'MISSING_PARTY_NAME'\nelse:\n updated_values = {'party_abbreviation': party_abbreviation, 'ctcl_uuid': ctcl_uuid,...
<|body_start_0|> exception_multiple_object_returned = False created = False if not party_id_temp: success = False status = 'MISSING_PARTY_TEMP_ID' elif not party_name: success = False status = 'MISSING_PARTY_NAME' else: ...
PartyManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartyManager: def update_or_create_party(self, party_id_temp='', party_name='', party_abbreviation='', ctcl_uuid=''): """Either update or create a party entry.""" <|body_0|> def retrieve_all_party_names_and_ids(self): """Retrieves party name and corresponding party_i...
stack_v2_sparse_classes_36k_train_027697
4,946
permissive
[ { "docstring": "Either update or create a party entry.", "name": "update_or_create_party", "signature": "def update_or_create_party(self, party_id_temp='', party_name='', party_abbreviation='', ctcl_uuid='')" }, { "docstring": "Retrieves party name and corresponding party_id_temp from the databa...
2
null
Implement the Python class `PartyManager` described below. Class description: Implement the PartyManager class. Method signatures and docstrings: - def update_or_create_party(self, party_id_temp='', party_name='', party_abbreviation='', ctcl_uuid=''): Either update or create a party entry. - def retrieve_all_party_na...
Implement the Python class `PartyManager` described below. Class description: Implement the PartyManager class. Method signatures and docstrings: - def update_or_create_party(self, party_id_temp='', party_name='', party_abbreviation='', ctcl_uuid=''): Either update or create a party entry. - def retrieve_all_party_na...
be2c1367e8263f2cdcf3bd2e27e6cd4a6f35af68
<|skeleton|> class PartyManager: def update_or_create_party(self, party_id_temp='', party_name='', party_abbreviation='', ctcl_uuid=''): """Either update or create a party entry.""" <|body_0|> def retrieve_all_party_names_and_ids(self): """Retrieves party name and corresponding party_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PartyManager: def update_or_create_party(self, party_id_temp='', party_name='', party_abbreviation='', ctcl_uuid=''): """Either update or create a party entry.""" exception_multiple_object_returned = False created = False if not party_id_temp: success = False ...
the_stack_v2_python_sparse
party/models.py
nickelser/WeVoteServer
train
1
5cbc3c3b2f9b8e7f6030b3ca57f807ec2f7e5ff5
[ "if root is None:\n return 0\nif root.val == sum:\n return 1 + self.calculate(root.left, 0) + self.calculate(root.right, 0)\nelse:\n sum -= root.val\nreturn self.calculate(root.left, sum) + self.calculate(root.right, sum)", "if root is None:\n return 0\nreturn self.calculate(root, sum) + self.pathSum(...
<|body_start_0|> if root is None: return 0 if root.val == sum: return 1 + self.calculate(root.left, 0) + self.calculate(root.right, 0) else: sum -= root.val return self.calculate(root.left, sum) + self.calculate(root.right, sum) <|end_body_0|> <|body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calculate(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> i...
stack_v2_sparse_classes_36k_train_027698
953
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: int", "name": "calculate", "signature": "def calculate(self, root, sum)" }, { "docstring": ":type root: TreeNode :type sum: int :rtype: List[List[int]]", "name": "pathSum", "signature": "def pathSum(self, root, sum)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculate(self, root, sum): :type root: TreeNode :type sum: int :rtype: int - def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculate(self, root, sum): :type root: TreeNode :type sum: int :rtype: int - def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: List[List[int]] <|ske...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def calculate(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def calculate(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" if root is None: return 0 if root.val == sum: return 1 + self.calculate(root.left, 0) + self.calculate(root.right, 0) else: sum -= root.val ...
the_stack_v2_python_sparse
leetcode/pathSum-437.py
pittcat/Algorithm_Practice
train
0
bd3a352089c1a6a8c5b80fabaf252dc2b30bf8be
[ "if self.request.user.is_superuser:\n return self.queryset\nreturn self.queryset.filter(user=self.request.user)", "instance = self.get_object()\nif instance.contest.publish_date < timezone.now():\n raise exceptions.PermissionDenied('You cannot delete already published submission sets.')\ninstance.submission...
<|body_start_0|> if self.request.user.is_superuser: return self.queryset return self.queryset.filter(user=self.request.user) <|end_body_0|> <|body_start_1|> instance = self.get_object() if instance.contest.publish_date < timezone.now(): raise exceptions.Permissio...
SubmissionSetViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionSetViewSet: def get_queryset(self): """Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions""" <|body_0|> def destroy(self, request, *args, **kwargs): """Destroy the instance...
stack_v2_sparse_classes_36k_train_027699
5,658
permissive
[ { "docstring": "Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Destroy the instance and all related submissions.", "name...
2
stack_v2_sparse_classes_30k_train_004539
Implement the Python class `SubmissionSetViewSet` described below. Class description: Implement the SubmissionSetViewSet class. Method signatures and docstrings: - def get_queryset(self): Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submis...
Implement the Python class `SubmissionSetViewSet` described below. Class description: Implement the SubmissionSetViewSet class. Method signatures and docstrings: - def get_queryset(self): Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submis...
d9876e37d8057009c10ef0c4d23a2b04d322f4eb
<|skeleton|> class SubmissionSetViewSet: def get_queryset(self): """Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions""" <|body_0|> def destroy(self, request, *args, **kwargs): """Destroy the instance...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubmissionSetViewSet: def get_queryset(self): """Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions""" if self.request.user.is_superuser: return self.queryset return self.queryset.filter(us...
the_stack_v2_python_sparse
src/rolca/core/api/views.py
dblenkus/rolca
train
0