blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cc10a6146830a1de30f6f3d90ec2d7c3c2cfe1d0 | [
"super().__init__()\nself.encoder = smp.encoders.get_encoder(encoder_name, in_channels=in_channels, depth=encoder_depth, weights=encoder_weights)\nencoder_out_channels = [c * 2 for c in self.encoder.out_channels[1:]]\nencoder_out_channels.insert(0, self.encoder.out_channels[0])\ntry:\n UnetDecoder = smp.decoders... | <|body_start_0|>
super().__init__()
self.encoder = smp.encoders.get_encoder(encoder_name, in_channels=in_channels, depth=encoder_depth, weights=encoder_weights)
encoder_out_channels = [c * 2 for c in self.encoder.out_channels[1:]]
encoder_out_channels.insert(0, self.encoder.out_channels[... | Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652 | FCSiamConc | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FCSiamConc:
"""Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652"""
def __init__(self, encoder_name: str='resnet34', encoder_depth: int=5, encoder_weights: Optional[st... | stack_v2_sparse_classes_75kplus_train_070500 | 8,273 | permissive | [
{
"docstring": "Initialize a new FCSiamConc model. Args: encoder_name: Name of the classification model that will be used as an encoder (a.k.a backbone) to extract features of different spatial resolution encoder_depth: A number of stages used in encoder in range [3, 5]. two times smaller in spatial dimensions ... | 2 | stack_v2_sparse_classes_30k_train_054269 | Implement the Python class `FCSiamConc` described below.
Class description:
Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652
Method signatures and docstrings:
- def __init__(self, encoder_name... | Implement the Python class `FCSiamConc` described below.
Class description:
Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652
Method signatures and docstrings:
- def __init__(self, encoder_name... | 29985861614b3b93f9ef5389469ebb98570de7dd | <|skeleton|>
class FCSiamConc:
"""Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652"""
def __init__(self, encoder_name: str='resnet34', encoder_depth: int=5, encoder_weights: Optional[st... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FCSiamConc:
"""Fully-convolutional Siamese Concatenation (FC-Siam-conc). If you use this model in your research, please cite the following paper: * https://doi.org/10.1109/ICIP.2018.8451652"""
def __init__(self, encoder_name: str='resnet34', encoder_depth: int=5, encoder_weights: Optional[str]='imagenet'... | the_stack_v2_python_sparse | torchgeo/models/fcsiam.py | microsoft/torchgeo | train | 1,724 |
edb13a0c4e93c6c72e628c4fde7ebcf111bff9c9 | [
"prefixes: Set[str] = set()\nfor prefix, name in (key.split('/', 1) for key in keys if '/' in key):\n if name in self.__KNOWN_MARKERS:\n prefixes.add(prefix)\n elif prefix in self.__KNOWN_PREFIXES:\n prefixes.add(prefix)\n elif any((prefix.endswith(f'.{p}') for p in self.__KNOWN_PREFIXES)):\n... | <|body_start_0|>
prefixes: Set[str] = set()
for prefix, name in (key.split('/', 1) for key in keys if '/' in key):
if name in self.__KNOWN_MARKERS:
prefixes.add(prefix)
elif prefix in self.__KNOWN_PREFIXES:
prefixes.add(prefix)
elif any... | A mixin to detect annotations of other Kopf-based operators. The detection of other Kopf-based operators' annotations should prevent "ping-pong" effects of multiple operators handling the same resources: (1) operator A persists its state into an object; (2) operator B believes it is a valid essential change and reacts;... | StorageKeyMarkingConvention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StorageKeyMarkingConvention:
"""A mixin to detect annotations of other Kopf-based operators. The detection of other Kopf-based operators' annotations should prevent "ping-pong" effects of multiple operators handling the same resources: (1) operator A persists its state into an object; (2) operato... | stack_v2_sparse_classes_75kplus_train_070501 | 13,196 | permissive | [
{
"docstring": "Detect annotation prefixes managed by any other Kopf-based operators.",
"name": "_detect_marked_prefixes",
"signature": "def _detect_marked_prefixes(self, keys: Collection[str]) -> Collection[str]"
},
{
"docstring": "Store a Kopf-branding marker to make this operator's prefix det... | 2 | stack_v2_sparse_classes_30k_train_041771 | Implement the Python class `StorageKeyMarkingConvention` described below.
Class description:
A mixin to detect annotations of other Kopf-based operators. The detection of other Kopf-based operators' annotations should prevent "ping-pong" effects of multiple operators handling the same resources: (1) operator A persist... | Implement the Python class `StorageKeyMarkingConvention` described below.
Class description:
A mixin to detect annotations of other Kopf-based operators. The detection of other Kopf-based operators' annotations should prevent "ping-pong" effects of multiple operators handling the same resources: (1) operator A persist... | 538df59b88d1aab7b985d703483497f73c6c4783 | <|skeleton|>
class StorageKeyMarkingConvention:
"""A mixin to detect annotations of other Kopf-based operators. The detection of other Kopf-based operators' annotations should prevent "ping-pong" effects of multiple operators handling the same resources: (1) operator A persists its state into an object; (2) operato... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StorageKeyMarkingConvention:
"""A mixin to detect annotations of other Kopf-based operators. The detection of other Kopf-based operators' annotations should prevent "ping-pong" effects of multiple operators handling the same resources: (1) operator A persists its state into an object; (2) operator B believes ... | the_stack_v2_python_sparse | kopf/_cogs/configs/conventions.py | nolar/kopf | train | 1,627 |
607a68fa5cfcfaeceb162e7229cb0c6af4c33223 | [
"super(StreamWrite, self).__init__()\nimport os\nself.fileType, self.fileName, self.path, self.fileNum = config.get_file_data()\nself.enable = config.WriteEnable\nself.choice = choice\nself.write_block = config.write_block\nfor i in os.listdir(self.path):\n if self.fileName == os.path.splitext(i)[0].split(sep='-... | <|body_start_0|>
super(StreamWrite, self).__init__()
import os
self.fileType, self.fileName, self.path, self.fileNum = config.get_file_data()
self.enable = config.WriteEnable
self.choice = choice
self.write_block = config.write_block
for i in os.listdir(self.path)... | --Handles Writing streamed data to files-- Makes a local copy of the relevant configuration options and writes the specified output format file of the incoming stream data until global config option StreamEnable == False | StreamWrite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StreamWrite:
"""--Handles Writing streamed data to files-- Makes a local copy of the relevant configuration options and writes the specified output format file of the incoming stream data until global config option StreamEnable == False"""
def __init__(self, config, choice, session_update, b... | stack_v2_sparse_classes_75kplus_train_070502 | 5,376 | no_license | [
{
"docstring": ":param config: configData class object :param choice: :param session_update: :param buffer: :param time_buffer:",
"name": "__init__",
"signature": "def __init__(self, config, choice, session_update, buffer, time_buffer)"
},
{
"docstring": "writes up to two columns of text in a si... | 2 | null | Implement the Python class `StreamWrite` described below.
Class description:
--Handles Writing streamed data to files-- Makes a local copy of the relevant configuration options and writes the specified output format file of the incoming stream data until global config option StreamEnable == False
Method signatures an... | Implement the Python class `StreamWrite` described below.
Class description:
--Handles Writing streamed data to files-- Makes a local copy of the relevant configuration options and writes the specified output format file of the incoming stream data until global config option StreamEnable == False
Method signatures an... | f55dd30e0c99c8160418b6484bde3cd695b3e5a1 | <|skeleton|>
class StreamWrite:
"""--Handles Writing streamed data to files-- Makes a local copy of the relevant configuration options and writes the specified output format file of the incoming stream data until global config option StreamEnable == False"""
def __init__(self, config, choice, session_update, b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StreamWrite:
"""--Handles Writing streamed data to files-- Makes a local copy of the relevant configuration options and writes the specified output format file of the incoming stream data until global config option StreamEnable == False"""
def __init__(self, config, choice, session_update, buffer, time_b... | the_stack_v2_python_sparse | Handlers/FileIOHandler.py | DAsh0244/Plotting_applet | train | 0 |
c0b879709e1cc761c4a4db22824405de09a147cf | [
"self.k = k\nself.nums = nums\nheapq.heapify(self.nums)\nwhile len(self.nums) > self.k:\n heapq.heappop(self.nums)",
"if len(self.nums) < self.k:\n heapq.heappush(self.nums, val)\nelif val > self.nums[0]:\n heapq.heappushpop(self.nums, val)\nreturn self.nums[0]"
] | <|body_start_0|>
self.k = k
self.nums = nums
heapq.heapify(self.nums)
while len(self.nums) > self.k:
heapq.heappop(self.nums)
<|end_body_0|>
<|body_start_1|>
if len(self.nums) < self.k:
heapq.heappush(self.nums, val)
elif val > self.nums[0]:
... | KthLargest3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest3:
def __init__(self, k: int, nums: List[int]):
"""Time complexity: O(N), where N is the number of elements in nums"""
<|body_0|>
def add(self, val: int) -> int:
"""Time complexity: O(logN), where N is the number of elements in nums"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_070503 | 6,443 | no_license | [
{
"docstring": "Time complexity: O(N), where N is the number of elements in nums",
"name": "__init__",
"signature": "def __init__(self, k: int, nums: List[int])"
},
{
"docstring": "Time complexity: O(logN), where N is the number of elements in nums",
"name": "add",
"signature": "def add(... | 2 | stack_v2_sparse_classes_30k_train_019073 | Implement the Python class `KthLargest3` described below.
Class description:
Implement the KthLargest3 class.
Method signatures and docstrings:
- def __init__(self, k: int, nums: List[int]): Time complexity: O(N), where N is the number of elements in nums
- def add(self, val: int) -> int: Time complexity: O(logN), wh... | Implement the Python class `KthLargest3` described below.
Class description:
Implement the KthLargest3 class.
Method signatures and docstrings:
- def __init__(self, k: int, nums: List[int]): Time complexity: O(N), where N is the number of elements in nums
- def add(self, val: int) -> int: Time complexity: O(logN), wh... | 642e6dd2c3cd65704c90d6e06a392bdae2ddd644 | <|skeleton|>
class KthLargest3:
def __init__(self, k: int, nums: List[int]):
"""Time complexity: O(N), where N is the number of elements in nums"""
<|body_0|>
def add(self, val: int) -> int:
"""Time complexity: O(logN), where N is the number of elements in nums"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest3:
def __init__(self, k: int, nums: List[int]):
"""Time complexity: O(N), where N is the number of elements in nums"""
self.k = k
self.nums = nums
heapq.heapify(self.nums)
while len(self.nums) > self.k:
heapq.heappop(self.nums)
def add(self, v... | the_stack_v2_python_sparse | LeetCode/703.Kth_Largest_Element_in_a_Stream.py | viiicky/Problem-Solving | train | 0 | |
8313bc6b7a9a6d8c1d645f97e48e95ddf8c0d392 | [
"self.textctrl = wx.TextCtrl(sctpanel, -1, '', wx.DefaultPosition, wx.Size(1000, 10))\nhbox = wx.BoxSizer(wx.HORIZONTAL)\nbutton_fetch_file = wx.Button(sctpanel, -1, label=label)\nbutton_fetch_file.Bind(wx.EVT_BUTTON, self.get_highlighted_file_name)\nhbox.Add(button_fetch_file, proportion=0, flag=wx.ALIGN_LEFT | wx... | <|body_start_0|>
self.textctrl = wx.TextCtrl(sctpanel, -1, '', wx.DefaultPosition, wx.Size(1000, 10))
hbox = wx.BoxSizer(wx.HORIZONTAL)
button_fetch_file = wx.Button(sctpanel, -1, label=label)
button_fetch_file.Bind(wx.EVT_BUTTON, self.get_highlighted_file_name)
hbox.Add(button_f... | Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue() | TextBox | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextBox:
"""Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()"""
def __init__(self, s... | stack_v2_sparse_classes_75kplus_train_070504 | 24,507 | permissive | [
{
"docstring": ":param sctpanel: SCTPanel Class :param label: Label to display on the button",
"name": "__init__",
"signature": "def __init__(self, sctpanel, label='')"
},
{
"docstring": "Fetch path to file highlighted in the Overlay list.",
"name": "get_highlighted_file_name",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_041628 | Implement the Python class `TextBox` described below.
Class description:
Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.... | Implement the Python class `TextBox` described below.
Class description:
Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.... | 81ebad505180ab18270eb926cca4a134996f8c45 | <|skeleton|>
class TextBox:
"""Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()"""
def __init__(self, s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TextBox:
"""Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()"""
def __init__(self, sctpanel, labe... | the_stack_v2_python_sparse | contrib/fsl_integration/sct_plugin.py | PaulBautin/spinalcordtoolbox | train | 1 |
b9a2a33d52eecba9be99ddd2b50c5118ea9e0671 | [
"element = ElementTree.Element(self.name, attrib={'type': FieldConstants.DATE})\nelement = self._set_nil(element, lambda value: value.isoformat())\nreturn element",
"text = element.text\nif text:\n return datetime.datetime.strptime(text, self.DATE_FORMAT).date()\nelse:\n return None"
] | <|body_start_0|>
element = ElementTree.Element(self.name, attrib={'type': FieldConstants.DATE})
element = self._set_nil(element, lambda value: value.isoformat())
return element
<|end_body_0|>
<|body_start_1|>
text = element.text
if text:
return datetime.datetime.strp... | The DateField represents a field which value will be parsed to Highrise specific date format | DateField | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DateField:
"""The DateField represents a field which value will be parsed to Highrise specific date format"""
def encode(self):
""":return: :rtype: xml.etree.ElementTree.Element"""
<|body_0|>
def decode(self, element):
""":param element: the element which needs t... | stack_v2_sparse_classes_75kplus_train_070505 | 1,048 | permissive | [
{
"docstring": ":return: :rtype: xml.etree.ElementTree.Element",
"name": "encode",
"signature": "def encode(self)"
},
{
"docstring": ":param element: the element which needs to be parsed :type element: xml.etree.ElementTree.Element :return: datetime.date :rtype: the parsed date object",
"nam... | 2 | stack_v2_sparse_classes_30k_train_024134 | Implement the Python class `DateField` described below.
Class description:
The DateField represents a field which value will be parsed to Highrise specific date format
Method signatures and docstrings:
- def encode(self): :return: :rtype: xml.etree.ElementTree.Element
- def decode(self, element): :param element: the ... | Implement the Python class `DateField` described below.
Class description:
The DateField represents a field which value will be parsed to Highrise specific date format
Method signatures and docstrings:
- def encode(self): :return: :rtype: xml.etree.ElementTree.Element
- def decode(self, element): :param element: the ... | 1519e4fb105f62882c2e7bc81065d994649558d8 | <|skeleton|>
class DateField:
"""The DateField represents a field which value will be parsed to Highrise specific date format"""
def encode(self):
""":return: :rtype: xml.etree.ElementTree.Element"""
<|body_0|>
def decode(self, element):
""":param element: the element which needs t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DateField:
"""The DateField represents a field which value will be parsed to Highrise specific date format"""
def encode(self):
""":return: :rtype: xml.etree.ElementTree.Element"""
element = ElementTree.Element(self.name, attrib={'type': FieldConstants.DATE})
element = self._set_n... | the_stack_v2_python_sparse | highton/fields/date_field.py | seibert-media/Highton | train | 20 |
ab0777c5c4d07a60037c5fa9a69c0eaa9c140fa9 | [
"try:\n del args['tearoff']\nexcept:\n pass\nif not binder:\n binder = master\nif not hasattr(master, 'tk'):\n master = master.canvas\nself.binder = binder\nMenu.__init__(self, master, tearoff=0, **args)\nself.__bindWithId = bindWithId\nif bindWithId is None:\n self.__binding = self.binder.bind('<But... | <|body_start_0|>
try:
del args['tearoff']
except:
pass
if not binder:
binder = master
if not hasattr(master, 'tk'):
master = master.canvas
self.binder = binder
Menu.__init__(self, master, tearoff=0, **args)
self.__bi... | Classe permettant de faire un menu en clic-droit. | RMenu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RMenu:
"""Classe permettant de faire un menu en clic-droit."""
def __init__(self, master=None, andInside=False, binder=None, bindWithId=None, **args):
"""Constructeur du RMenu. @param master: master du tkinter.Menu() que cet widget est. @param andInside: binder sur tout les widgets t... | stack_v2_sparse_classes_75kplus_train_070506 | 3,606 | no_license | [
{
"docstring": "Constructeur du RMenu. @param master: master du tkinter.Menu() que cet widget est. @param andInside: binder sur tout les widgets trouvés dedans de manière récursive ? @param biner: le widget binder avec la méthode bind. Si None : master sera utilisé. @param bindWithId: permet de bind seulement u... | 4 | stack_v2_sparse_classes_30k_train_015517 | Implement the Python class `RMenu` described below.
Class description:
Classe permettant de faire un menu en clic-droit.
Method signatures and docstrings:
- def __init__(self, master=None, andInside=False, binder=None, bindWithId=None, **args): Constructeur du RMenu. @param master: master du tkinter.Menu() que cet wi... | Implement the Python class `RMenu` described below.
Class description:
Classe permettant de faire un menu en clic-droit.
Method signatures and docstrings:
- def __init__(self, master=None, andInside=False, binder=None, bindWithId=None, **args): Constructeur du RMenu. @param master: master du tkinter.Menu() que cet wi... | f59e9d491fe1d60654fad5357474763e4755f13a | <|skeleton|>
class RMenu:
"""Classe permettant de faire un menu en clic-droit."""
def __init__(self, master=None, andInside=False, binder=None, bindWithId=None, **args):
"""Constructeur du RMenu. @param master: master du tkinter.Menu() que cet widget est. @param andInside: binder sur tout les widgets t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RMenu:
"""Classe permettant de faire un menu en clic-droit."""
def __init__(self, master=None, andInside=False, binder=None, bindWithId=None, **args):
"""Constructeur du RMenu. @param master: master du tkinter.Menu() que cet widget est. @param andInside: binder sur tout les widgets trouvés dedans... | the_stack_v2_python_sparse | TaskManager/util/widgets/RMenu.py | Zetrypio/TaskManager | train | 2 |
ade518d8dc6f5b8bea5cda4cfb40e9ee382323cc | [
"driver = obj.driver\nWebDriverWait(driver, 100).until(lambda driver: driver.find_element_by_name(self.locator))\nelem = driver.find_element_by_name(self.locator)\nelem.clear()\nelem.send_keys(value)",
"driver = obj.driver\nWebDriverWait(driver, 100).until(lambda driver: driver.find_element_by_name(self.locator))... | <|body_start_0|>
driver = obj.driver
WebDriverWait(driver, 100).until(lambda driver: driver.find_element_by_name(self.locator))
elem = driver.find_element_by_name(self.locator)
elem.clear()
elem.send_keys(value)
<|end_body_0|>
<|body_start_1|>
driver = obj.driver
... | Base page class that is initialized on every page object class. | BasePageElement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasePageElement:
"""Base page class that is initialized on every page object class."""
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
<|body_0|>
def __get__(self, obj, owner):
"""Gets the next of the specified object"""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_070507 | 1,550 | no_license | [
{
"docstring": "Sets the text to the value supplied",
"name": "__set__",
"signature": "def __set__(self, obj, value)"
},
{
"docstring": "Gets the next of the specified object",
"name": "__get__",
"signature": "def __get__(self, obj, owner)"
}
] | 2 | null | Implement the Python class `BasePageElement` described below.
Class description:
Base page class that is initialized on every page object class.
Method signatures and docstrings:
- def __set__(self, obj, value): Sets the text to the value supplied
- def __get__(self, obj, owner): Gets the next of the specified object | Implement the Python class `BasePageElement` described below.
Class description:
Base page class that is initialized on every page object class.
Method signatures and docstrings:
- def __set__(self, obj, value): Sets the text to the value supplied
- def __get__(self, obj, owner): Gets the next of the specified object... | 1e44ef7b2fbe0701131946b68e074451bac2ffa5 | <|skeleton|>
class BasePageElement:
"""Base page class that is initialized on every page object class."""
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
<|body_0|>
def __get__(self, obj, owner):
"""Gets the next of the specified object"""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasePageElement:
"""Base page class that is initialized on every page object class."""
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
driver = obj.driver
WebDriverWait(driver, 100).until(lambda driver: driver.find_element_by_name(self.locator))
el... | the_stack_v2_python_sparse | demo/selenium/page_object/element.py | leizhen10000/crawler | train | 0 |
6ced01b005d905c3a622fc55d1629cf98e835c1c | [
"super(AudioTextVideoFusion, self).__init__(name=name)\nself._audio_backbone = audio_backbone\nself._audio_model_kwargs = audio_model_kwargs or {}\nself._text_backbone = text_backbone\nself._text_model_kwargs = text_model_kwargs or {}\nself._video_backbone = video_backbone\nself._video_model_kwargs = video_model_kw... | <|body_start_0|>
super(AudioTextVideoFusion, self).__init__(name=name)
self._audio_backbone = audio_backbone
self._audio_model_kwargs = audio_model_kwargs or {}
self._text_backbone = text_backbone
self._text_model_kwargs = text_model_kwargs or {}
self._video_backbone = vi... | Module to fuse audio, text and video for joint embedding learning. | AudioTextVideoFusion | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AudioTextVideoFusion:
"""Module to fuse audio, text and video for joint embedding learning."""
def __init__(self, audio_backbone='resnet18', audio_model_kwargs=None, text_backbone='linear', text_model_kwargs=None, video_backbone='resnet50', video_model_kwargs=None, name='audio_text_video_mod... | stack_v2_sparse_classes_75kplus_train_070508 | 7,989 | permissive | [
{
"docstring": "Initialize the AudioTextVideoFusion class. Args: audio_backbone: Backbone for audio. audio_model_kwargs: Other specific parameters to pass to the audio module. text_backbone: The base language model name. text_model_kwargs: Other specific parameters to pass to the text module. video_backbone: Th... | 2 | stack_v2_sparse_classes_30k_train_008888 | Implement the Python class `AudioTextVideoFusion` described below.
Class description:
Module to fuse audio, text and video for joint embedding learning.
Method signatures and docstrings:
- def __init__(self, audio_backbone='resnet18', audio_model_kwargs=None, text_backbone='linear', text_model_kwargs=None, video_back... | Implement the Python class `AudioTextVideoFusion` described below.
Class description:
Module to fuse audio, text and video for joint embedding learning.
Method signatures and docstrings:
- def __init__(self, audio_backbone='resnet18', audio_model_kwargs=None, text_backbone='linear', text_model_kwargs=None, video_back... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class AudioTextVideoFusion:
"""Module to fuse audio, text and video for joint embedding learning."""
def __init__(self, audio_backbone='resnet18', audio_model_kwargs=None, text_backbone='linear', text_model_kwargs=None, video_backbone='resnet50', video_model_kwargs=None, name='audio_text_video_mod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AudioTextVideoFusion:
"""Module to fuse audio, text and video for joint embedding learning."""
def __init__(self, audio_backbone='resnet18', audio_model_kwargs=None, text_backbone='linear', text_model_kwargs=None, video_backbone='resnet50', video_model_kwargs=None, name='audio_text_video_model', **kwargs... | the_stack_v2_python_sparse | vatt/modeling/backbones/multimodal.py | Jimmy-INL/google-research | train | 1 |
247cd6ad5582de9e5bb3beffebee50f5eb828674 | [
"super(FPA, self).__init__()\nchannels_mid = int(channels / 4)\nself.channels_cond = channels\nself.conv_master = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False)\nself.bn_master = nn.BatchNorm2d(channels)\nself.conv_gpb = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False)\nself.bn... | <|body_start_0|>
super(FPA, self).__init__()
channels_mid = int(channels / 4)
self.channels_cond = channels
self.conv_master = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False)
self.bn_master = nn.BatchNorm2d(channels)
self.conv_gpb = nn.Conv2d(self.chann... | FPA | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FPA:
def __init__(self, channels=2048):
"""Feature Pyramid Attention :type channels: int"""
<|body_0|>
def forward(self, x):
""":param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_070509 | 9,063 | permissive | [
{
"docstring": "Feature Pyramid Attention :type channels: int",
"name": "__init__",
"signature": "def __init__(self, channels=2048)"
},
{
"docstring": ":param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]",
"name": "forward",
"signature": "def forward(self,... | 2 | stack_v2_sparse_classes_30k_train_041614 | Implement the Python class `FPA` described below.
Class description:
Implement the FPA class.
Method signatures and docstrings:
- def __init__(self, channels=2048): Feature Pyramid Attention :type channels: int
- def forward(self, x): :param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w] | Implement the Python class `FPA` described below.
Class description:
Implement the FPA class.
Method signatures and docstrings:
- def __init__(self, channels=2048): Feature Pyramid Attention :type channels: int
- def forward(self, x): :param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]... | fc93419b5edb917100450f45254d68ad372c15b5 | <|skeleton|>
class FPA:
def __init__(self, channels=2048):
"""Feature Pyramid Attention :type channels: int"""
<|body_0|>
def forward(self, x):
""":param x: Shape: [b, 2048, h, w] :return: out: Feature maps. Shape: [b, 2048, h, w]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FPA:
def __init__(self, channels=2048):
"""Feature Pyramid Attention :type channels: int"""
super(FPA, self).__init__()
channels_mid = int(channels / 4)
self.channels_cond = channels
self.conv_master = nn.Conv2d(self.channels_cond, channels, kernel_size=1, bias=False)
... | the_stack_v2_python_sparse | 2021届毕设-语义分割-CascadePSP/models/pan/network.py | lqwrl542293/JL-Yang_CV | train | 14 | |
82fe6c87cf83102cdfd1210d66201176e4acd41b | [
"if n < 3:\n return n\none_step_before, two_steps_before = (2, 1)\nall_ways = 0\nfor _ in range(3, n + 1):\n all_ways = one_step_before + two_steps_before\n two_steps_before = one_step_before\n one_step_before = all_ways\nreturn all_ways",
"dp = [0] * (n + 1)\ndp[0] = 1\nwhile True:\n dp2 = [0] * (... | <|body_start_0|>
if n < 3:
return n
one_step_before, two_steps_before = (2, 1)
all_ways = 0
for _ in range(3, n + 1):
all_ways = one_step_before + two_steps_before
two_steps_before = one_step_before
one_step_before = all_ways
return... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def climbStairs(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def climbStairs2(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n < 3:
return n
one_step_before, two_steps_be... | stack_v2_sparse_classes_75kplus_train_070510 | 945 | permissive | [
{
"docstring": ":type n: int :rtype: int",
"name": "climbStairs",
"signature": "def climbStairs(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "climbStairs2",
"signature": "def climbStairs2(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020715 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n): :type n: int :rtype: int
- def climbStairs2(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n): :type n: int :rtype: int
- def climbStairs2(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def climbStairs(self, n):
""":... | c8bf33af30569177c5276ffcd72a8d93ba4c402a | <|skeleton|>
class Solution:
def climbStairs(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def climbStairs2(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def climbStairs(self, n):
""":type n: int :rtype: int"""
if n < 3:
return n
one_step_before, two_steps_before = (2, 1)
all_ways = 0
for _ in range(3, n + 1):
all_ways = one_step_before + two_steps_before
two_steps_before = o... | the_stack_v2_python_sparse | 1-100/61-70/70-climbingStairs/climbingStairs.py | xuychen/Leetcode | train | 0 | |
5a9d44d0f051cebea90f9ae4c100f87488109118 | [
"self.timeout = timeout\ntry:\n self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, timeout=self.timeout)\nexcept Exception as e:\n self.errored(\"Section failed due to: '{e}'\".format(e=e))\nfor stp in steps.details:\n if stp.result.name == 'skipped':\n self.skipped('... | <|body_start_0|>
self.timeout = timeout
try:
self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, timeout=self.timeout)
except Exception as e:
self.errored("Section failed due to: '{e}'".format(e=e))
for stp in steps.details:
... | Trigger class for Switchover action | TriggerSwitchover | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerSwitchover:
"""Trigger class for Switchover action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstrac... | stack_v2_sparse_classes_75kplus_train_070511 | 11,289 | 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 timeout (`timeout obj`): Timeout Object Returns: None Raises: pyATS Res... | 4 | stack_v2_sparse_classes_30k_train_019025 | Implement the Python class `TriggerSwitchover` described below.
Class description:
Trigger class for Switchover action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the... | Implement the Python class `TriggerSwitchover` described below.
Class description:
Trigger class for Switchover action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the... | 880a341030f53739ce509154a041030a842ee672 | <|skeleton|>
class TriggerSwitchover:
"""Trigger class for Switchover action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstrac... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TriggerSwitchover:
"""Trigger class for Switchover action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""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`): Ab... | the_stack_v2_python_sparse | pkgs/sdk-pkg/src/genie/libs/sdk/triggers/ha/ha.py | karmoham/genielibs | train | 0 |
5aa51a872ad751d5b317083a23cf1c833ef9e80b | [
"self.out_neighbors = out_neighbors\nself.in_neighbors = in_neighbors\nself.num_nodes = num_nodes\nself.num_edges = num_edges\nself.true_block_assignment = true_block_assignment",
"self.out_neighbors = graph.out_neighbors\nself.in_neighbors = graph.in_neighbors\nself.num_nodes = graph.num_nodes\nself.num_edges = ... | <|body_start_0|>
self.out_neighbors = out_neighbors
self.in_neighbors = in_neighbors
self.num_nodes = num_nodes
self.num_edges = num_edges
self.true_block_assignment = true_block_assignment
<|end_body_0|>
<|body_start_1|>
self.out_neighbors = graph.out_neighbors
... | Holds the graph variables that do not change due to partitioning. | Graph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Graph:
"""Holds the graph variables that do not change due to partitioning."""
def __init__(self, out_neighbors: List[np.ndarray], in_neighbors: List[np.ndarray], num_nodes: int, num_edges: int, true_block_assignment: np.ndarray=None) -> None:
"""Creates a new Graph object. Parameter... | stack_v2_sparse_classes_75kplus_train_070512 | 11,396 | permissive | [
{
"docstring": "Creates a new Graph object. Parameters --------- out_neighbors : List[np.ndarray] the outgoing edges from each node in_neighbors : List[np.ndarray] the incoming edges to each node num_nodes : int the number of nodes in the graph num_edges : int the number of edges in the graph true_block_assignm... | 5 | null | Implement the Python class `Graph` described below.
Class description:
Holds the graph variables that do not change due to partitioning.
Method signatures and docstrings:
- def __init__(self, out_neighbors: List[np.ndarray], in_neighbors: List[np.ndarray], num_nodes: int, num_edges: int, true_block_assignment: np.nda... | Implement the Python class `Graph` described below.
Class description:
Holds the graph variables that do not change due to partitioning.
Method signatures and docstrings:
- def __init__(self, out_neighbors: List[np.ndarray], in_neighbors: List[np.ndarray], num_nodes: int, num_edges: int, true_block_assignment: np.nda... | d98365f90cca4741e2a66d3cbdcb2dae3d123697 | <|skeleton|>
class Graph:
"""Holds the graph variables that do not change due to partitioning."""
def __init__(self, out_neighbors: List[np.ndarray], in_neighbors: List[np.ndarray], num_nodes: int, num_edges: int, true_block_assignment: np.ndarray=None) -> None:
"""Creates a new Graph object. Parameter... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Graph:
"""Holds the graph variables that do not change due to partitioning."""
def __init__(self, out_neighbors: List[np.ndarray], in_neighbors: List[np.ndarray], num_nodes: int, num_edges: int, true_block_assignment: np.ndarray=None) -> None:
"""Creates a new Graph object. Parameters --------- o... | the_stack_v2_python_sparse | StochasticBlockPartition/code/python/graph.py | ffrankies/GraphChallenge | train | 0 |
d74548cae2c7de2c0dbac01bcf6f9beb4b72553d | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessPackageAssignmentReviewSettings()",
"from .access_review_expiration_behavior import AccessReviewExpirationBehavior\nfrom .entitlement_management_schedule import EntitlementManagementSchedule\nfrom .subject_set import SubjectSet\n... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return AccessPackageAssignmentReviewSettings()
<|end_body_0|>
<|body_start_1|>
from .access_review_expiration_behavior import AccessReviewExpirationBehavior
from .entitlement_management_schedul... | AccessPackageAssignmentReviewSettings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccessPackageAssignmentReviewSettings:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d... | stack_v2_sparse_classes_75kplus_train_070513 | 5,820 | 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: AccessPackageAssignmentReviewSettings",
"name": "create_from_discriminator_value",
"signature": "def create_... | 3 | stack_v2_sparse_classes_30k_train_017727 | Implement the Python class `AccessPackageAssignmentReviewSettings` described below.
Class description:
Implement the AccessPackageAssignmentReviewSettings class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: Crea... | Implement the Python class `AccessPackageAssignmentReviewSettings` described below.
Class description:
Implement the AccessPackageAssignmentReviewSettings class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings: Crea... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AccessPackageAssignmentReviewSettings:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccessPackageAssignmentReviewSettings:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignmentReviewSettings:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v... | the_stack_v2_python_sparse | msgraph/generated/models/access_package_assignment_review_settings.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
e73e09568ba6f3a6037f9a3b38e529cf64696430 | [
"super(ResNetRegressor, self).__init__(model_name=model_name, model_save_directory=model_save_directory)\nself.nb_epochs = nb_epochs\nself.batch_size = batch_size\nself.callbacks = callbacks\nself.random_state = random_state\nself.verbose = verbose\nself._is_fitted = False",
"save_best_model = False\ninput_layer,... | <|body_start_0|>
super(ResNetRegressor, self).__init__(model_name=model_name, model_save_directory=model_save_directory)
self.nb_epochs = nb_epochs
self.batch_size = batch_size
self.callbacks = callbacks
self.random_state = random_state
self.verbose = verbose
self... | Residual Network (ResNet). Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py Network originally defined in: @inproceedings{wang2017time, title={Time series classification from scratch with deep neural networks: A strong baseline}, author={Wang, Zhigua... | ResNetRegressor | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResNetRegressor:
"""Residual Network (ResNet). Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py Network originally defined in: @inproceedings{wang2017time, title={Time series classification from scratch with deep neural network... | stack_v2_sparse_classes_75kplus_train_070514 | 6,038 | permissive | [
{
"docstring": ":param nb_epochs: int, the number of epochs to train the model :param batch_size: int, specifying the length of the 1D convolution window :param callbacks: list of tf.keras.callbacks.Callback objects :param random_state: int, seed to any needed random actions :param verbose: boolean, whether to ... | 3 | null | Implement the Python class `ResNetRegressor` described below.
Class description:
Residual Network (ResNet). Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py Network originally defined in: @inproceedings{wang2017time, title={Time series classificatio... | Implement the Python class `ResNetRegressor` described below.
Class description:
Residual Network (ResNet). Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py Network originally defined in: @inproceedings{wang2017time, title={Time series classificatio... | b565b7499f58f43da7314f1bf26eccce94e88134 | <|skeleton|>
class ResNetRegressor:
"""Residual Network (ResNet). Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py Network originally defined in: @inproceedings{wang2017time, title={Time series classification from scratch with deep neural network... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResNetRegressor:
"""Residual Network (ResNet). Adapted from the implementation from Fawaz et. al https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py Network originally defined in: @inproceedings{wang2017time, title={Time series classification from scratch with deep neural networks: A strong b... | the_stack_v2_python_sparse | sktime_dl/regression/_resnet.py | sktime/sktime-dl | train | 586 |
8f2462a6c18d7cd3c92e6103115fce38b0e2ac3f | [
"self.title = title\nself.description = description\nself.notification = notification\nself.contact_details = contact_details\nself.advanced = advanced\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\ntitle = dictionary.get('title')\ndescription = dictionary.get('des... | <|body_start_0|>
self.title = title
self.description = description
self.notification = notification
self.contact_details = contact_details
self.advanced = advanced
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is... | Implementation of the 'UpdateDocumentRequest' model. TODO: type model description here. Attributes: title (string): TODO: type description here. description (string): TODO: type description here. notification (Notification): Setup your own notification texts, and specify specail settings. Info: you also has to setup no... | UpdateDocumentRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateDocumentRequest:
"""Implementation of the 'UpdateDocumentRequest' model. TODO: type model description here. Attributes: title (string): TODO: type description here. description (string): TODO: type description here. notification (Notification): Setup your own notification texts, and specify... | stack_v2_sparse_classes_75kplus_train_070515 | 3,489 | permissive | [
{
"docstring": "Constructor for the UpdateDocumentRequest class",
"name": "__init__",
"signature": "def __init__(self, title=None, description=None, notification=None, contact_details=None, advanced=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dict... | 2 | stack_v2_sparse_classes_30k_train_040501 | Implement the Python class `UpdateDocumentRequest` described below.
Class description:
Implementation of the 'UpdateDocumentRequest' model. TODO: type model description here. Attributes: title (string): TODO: type description here. description (string): TODO: type description here. notification (Notification): Setup y... | Implement the Python class `UpdateDocumentRequest` described below.
Class description:
Implementation of the 'UpdateDocumentRequest' model. TODO: type model description here. Attributes: title (string): TODO: type description here. description (string): TODO: type description here. notification (Notification): Setup y... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class UpdateDocumentRequest:
"""Implementation of the 'UpdateDocumentRequest' model. TODO: type model description here. Attributes: title (string): TODO: type description here. description (string): TODO: type description here. notification (Notification): Setup your own notification texts, and specify... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdateDocumentRequest:
"""Implementation of the 'UpdateDocumentRequest' model. TODO: type model description here. Attributes: title (string): TODO: type description here. description (string): TODO: type description here. notification (Notification): Setup your own notification texts, and specify specail sett... | the_stack_v2_python_sparse | idfy_rest_client/models/update_document_request.py | dealflowteam/Idfy | train | 0 |
41e81ac46e3924dddcb4aa47a0cb83e3f22b3925 | [
"self.type = destination_type\nself.path = path\nself.file = None\ntry:\n os.remove(path)\nexcept OSError:\n pass",
"self.file = open(self.path, 'w', encoding='utf-8')\nif self.type == FileType.XML:\n self.file.write('<?xml version=\"1W.0\" encoding=\"UTF-8\"?><items>')",
"assert self.file is not None\... | <|body_start_0|>
self.type = destination_type
self.path = path
self.file = None
try:
os.remove(path)
except OSError:
pass
<|end_body_0|>
<|body_start_1|>
self.file = open(self.path, 'w', encoding='utf-8')
if self.type == FileType.XML:
... | Запись в файл. | Writer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Writer:
"""Запись в файл."""
def __init__(self, destination_type: FileType, path: str) -> None:
"""Нужно, когда хотим записывать разметки по одной (экономия памяти). :param destination_type: тип файла. :param path: путь к файлу."""
<|body_0|>
def open(self) -> None:
... | stack_v2_sparse_classes_75kplus_train_070516 | 3,710 | permissive | [
{
"docstring": "Нужно, когда хотим записывать разметки по одной (экономия памяти). :param destination_type: тип файла. :param path: путь к файлу.",
"name": "__init__",
"signature": "def __init__(self, destination_type: FileType, path: str) -> None"
},
{
"docstring": "Открываем файл, вызывать до ... | 6 | stack_v2_sparse_classes_30k_train_018102 | Implement the Python class `Writer` described below.
Class description:
Запись в файл.
Method signatures and docstrings:
- def __init__(self, destination_type: FileType, path: str) -> None: Нужно, когда хотим записывать разметки по одной (экономия памяти). :param destination_type: тип файла. :param path: путь к файлу... | Implement the Python class `Writer` described below.
Class description:
Запись в файл.
Method signatures and docstrings:
- def __init__(self, destination_type: FileType, path: str) -> None: Нужно, когда хотим записывать разметки по одной (экономия памяти). :param destination_type: тип файла. :param path: путь к файлу... | 3d114f92dec08c16d28e7e5a1076cd7ea871043f | <|skeleton|>
class Writer:
"""Запись в файл."""
def __init__(self, destination_type: FileType, path: str) -> None:
"""Нужно, когда хотим записывать разметки по одной (экономия памяти). :param destination_type: тип файла. :param path: путь к файлу."""
<|body_0|>
def open(self) -> None:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Writer:
"""Запись в файл."""
def __init__(self, destination_type: FileType, path: str) -> None:
"""Нужно, когда хотим записывать разметки по одной (экономия памяти). :param destination_type: тип файла. :param path: путь к файлу."""
self.type = destination_type
self.path = path
... | the_stack_v2_python_sparse | rupo/files/writer.py | IlyaGusev/rupo | train | 185 |
0432b4a890f5f992f5ee9eb1ed4b81c665267411 | [
"make_test_data()\nurl = reverse('areas')\nself.client.login(username='secretary', password='secretary+password')\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)",
"make_test_data()\naugment_data()\nareas = Group.objects.filter(type='area', state='active')\nurl = reverse('areas_view'... | <|body_start_0|>
make_test_data()
url = reverse('areas')
self.client.login(username='secretary', password='secretary+password')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
<|end_body_0|>
<|body_start_1|>
make_test_data()
augment_da... | MainTestCase | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainTestCase:
def test_main(self):
"""Main Test"""
<|body_0|>
def test_view(self):
"""View Test"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
make_test_data()
url = reverse('areas')
self.client.login(username='secretary', password=... | stack_v2_sparse_classes_75kplus_train_070517 | 1,226 | permissive | [
{
"docstring": "Main Test",
"name": "test_main",
"signature": "def test_main(self)"
},
{
"docstring": "View Test",
"name": "test_view",
"signature": "def test_view(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026517 | Implement the Python class `MainTestCase` described below.
Class description:
Implement the MainTestCase class.
Method signatures and docstrings:
- def test_main(self): Main Test
- def test_view(self): View Test | Implement the Python class `MainTestCase` described below.
Class description:
Implement the MainTestCase class.
Method signatures and docstrings:
- def test_main(self): Main Test
- def test_view(self): View Test
<|skeleton|>
class MainTestCase:
def test_main(self):
"""Main Test"""
<|body_0|>
... | 5af455fbe6b0c7e60b8af360718345ba044597a4 | <|skeleton|>
class MainTestCase:
def test_main(self):
"""Main Test"""
<|body_0|>
def test_view(self):
"""View Test"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MainTestCase:
def test_main(self):
"""Main Test"""
make_test_data()
url = reverse('areas')
self.client.login(username='secretary', password='secretary+password')
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_view(self)... | the_stack_v2_python_sparse | ietf/secr/areas/tests.py | wpjesus/codematch | train | 1 | |
249d238735486a4b05a95f50630a217968e8694d | [
"request = pecan.request\ncontext = request.environ['context']\ntransfer_accepts = self.central_api.get_zone_transfer_accept(context, transfer_accept_id)\nreturn self._view.show(context, request, transfer_accepts)",
"request = pecan.request\nresponse = pecan.response\ncontext = request.environ['context']\nbody = ... | <|body_start_0|>
request = pecan.request
context = request.environ['context']
transfer_accepts = self.central_api.get_zone_transfer_accept(context, transfer_accept_id)
return self._view.show(context, request, transfer_accepts)
<|end_body_0|>
<|body_start_1|>
request = pecan.requ... | TransferAcceptsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransferAcceptsController:
def get_one(self, transfer_accept_id):
"""Get transfer_accepts"""
<|body_0|>
def post_all(self):
"""Create ZoneTransferAccept"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
request = pecan.request
context = reques... | stack_v2_sparse_classes_75kplus_train_070518 | 2,693 | permissive | [
{
"docstring": "Get transfer_accepts",
"name": "get_one",
"signature": "def get_one(self, transfer_accept_id)"
},
{
"docstring": "Create ZoneTransferAccept",
"name": "post_all",
"signature": "def post_all(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018163 | Implement the Python class `TransferAcceptsController` described below.
Class description:
Implement the TransferAcceptsController class.
Method signatures and docstrings:
- def get_one(self, transfer_accept_id): Get transfer_accepts
- def post_all(self): Create ZoneTransferAccept | Implement the Python class `TransferAcceptsController` described below.
Class description:
Implement the TransferAcceptsController class.
Method signatures and docstrings:
- def get_one(self, transfer_accept_id): Get transfer_accepts
- def post_all(self): Create ZoneTransferAccept
<|skeleton|>
class TransferAcceptsC... | e8f4a3d9d27ec987ed6da0dbe91c83bbaf2db6e1 | <|skeleton|>
class TransferAcceptsController:
def get_one(self, transfer_accept_id):
"""Get transfer_accepts"""
<|body_0|>
def post_all(self):
"""Create ZoneTransferAccept"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TransferAcceptsController:
def get_one(self, transfer_accept_id):
"""Get transfer_accepts"""
request = pecan.request
context = request.environ['context']
transfer_accepts = self.central_api.get_zone_transfer_accept(context, transfer_accept_id)
return self._view.show(con... | the_stack_v2_python_sparse | designate/api/v2/controllers/zones/tasks/transfer_accepts.py | jhedden/designate | train | 0 | |
27795f00e36f7107860a27c3d8853a1f2fcb3169 | [
"super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=TIME_BETWEEN_UPDATES)\nself._weather_api = TrafikverketWeather(async_get_clientsession(hass), entry.data[CONF_API_KEY])\nself._station = entry.data[CONF_STATION]",
"try:\n weatherdata = await self._weather_api.async_get_weather(self._station)\nexcep... | <|body_start_0|>
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=TIME_BETWEEN_UPDATES)
self._weather_api = TrafikverketWeather(async_get_clientsession(hass), entry.data[CONF_API_KEY])
self._station = entry.data[CONF_STATION]
<|end_body_0|>
<|body_start_1|>
try:
... | A Sensibo Data Update Coordinator. | TVDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TVDataUpdateCoordinator:
"""A Sensibo Data Update Coordinator."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the Sensibo coordinator."""
<|body_0|>
async def _async_update_data(self) -> WeatherStationInfo:
"""Fetch data fro... | stack_v2_sparse_classes_75kplus_train_070519 | 1,881 | permissive | [
{
"docstring": "Initialize the Sensibo coordinator.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None"
},
{
"docstring": "Fetch data from Trafikverket.",
"name": "_async_update_data",
"signature": "async def _async_update_data(self) -... | 2 | stack_v2_sparse_classes_30k_train_027100 | Implement the Python class `TVDataUpdateCoordinator` described below.
Class description:
A Sensibo Data Update Coordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the Sensibo coordinator.
- async def _async_update_data(self) -> WeatherStatio... | Implement the Python class `TVDataUpdateCoordinator` described below.
Class description:
A Sensibo Data Update Coordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: Initialize the Sensibo coordinator.
- async def _async_update_data(self) -> WeatherStatio... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class TVDataUpdateCoordinator:
"""A Sensibo Data Update Coordinator."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the Sensibo coordinator."""
<|body_0|>
async def _async_update_data(self) -> WeatherStationInfo:
"""Fetch data fro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TVDataUpdateCoordinator:
"""A Sensibo Data Update Coordinator."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Initialize the Sensibo coordinator."""
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=TIME_BETWEEN_UPDATES)
self._weather_api = T... | the_stack_v2_python_sparse | homeassistant/components/trafikverket_weatherstation/coordinator.py | home-assistant/core | train | 35,501 |
cacd8ed164dd86cee7aa6a47d724ce9f43cc852f | [
"self._inverse_index = dict()\nself._dcount = 0\nfor file in os.listdir(directory):\n self._dcount += 1\n file = Document(directory + '/' + file)\n word_list = file.get_words()\n for word in word_list:\n if word not in self._inverse_index.keys():\n self._inverse_index[word] = [file]\n ... | <|body_start_0|>
self._inverse_index = dict()
self._dcount = 0
for file in os.listdir(directory):
self._dcount += 1
file = Document(directory + '/' + file)
word_list = file.get_words()
for word in word_list:
if word not in self._inv... | SearchEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchEngine:
def __init__(self, directory):
"""Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears."""
<|body_0|>
def _calculate_idf(self, term):
"""Fro... | stack_v2_sparse_classes_75kplus_train_070520 | 2,841 | no_license | [
{
"docstring": "Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears.",
"name": "__init__",
"signature": "def __init__(self, directory)"
},
{
"docstring": "From the given term, functi... | 3 | stack_v2_sparse_classes_30k_train_017271 | Implement the Python class `SearchEngine` described below.
Class description:
Implement the SearchEngine class.
Method signatures and docstrings:
- def __init__(self, directory): Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents... | Implement the Python class `SearchEngine` described below.
Class description:
Implement the SearchEngine class.
Method signatures and docstrings:
- def __init__(self, directory): Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents... | c480d2f7203f8ae2f78abd87aa7f743ead30cca4 | <|skeleton|>
class SearchEngine:
def __init__(self, directory):
"""Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears."""
<|body_0|>
def _calculate_idf(self, term):
"""Fro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SearchEngine:
def __init__(self, directory):
"""Initialize SearchEngine by creating the object from a given directory name, which has an inverse index that maps each word to the documents in which the word appears."""
self._inverse_index = dict()
self._dcount = 0
for file in os... | the_stack_v2_python_sparse | Advanced Data Programming/hw4/search_engine.py | getachew67/UW-Python-AI-Coursework-Projects | train | 0 | |
4891077b67943375a0724ff567039f0c30228bdc | [
"super().__init__()\nLSTMCell.global_count += 1\nself.step = 0\nself.size = size\nself.name = name if name else 'lstmcell{0}'.format(LSTMCell.global_count)\nself.data_layout = data_layout\nself.weights = list(make_iterable(weights))\nif len(self.weights) > 2:\n raise ValueError('`LSTMCell` has at most two weight... | <|body_start_0|>
super().__init__()
LSTMCell.global_count += 1
self.step = 0
self.size = size
self.name = name if name else 'lstmcell{0}'.format(LSTMCell.global_count)
self.data_layout = data_layout
self.weights = list(make_iterable(weights))
if len(self.w... | Long short-term memory cell. | LSTMCell | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSTMCell:
"""Long short-term memory cell."""
def __init__(self, size, bias=True, weights=[], name=None, data_layout='data_parallel'):
"""Initialize LSTM cell. Args: size (int): Size of output tensor. bias (bool): Whether to apply biases after linearity. weights (`Weights` or iterator... | stack_v2_sparse_classes_75kplus_train_070521 | 18,287 | permissive | [
{
"docstring": "Initialize LSTM cell. Args: size (int): Size of output tensor. bias (bool): Whether to apply biases after linearity. weights (`Weights` or iterator of `Weights`): Weights in fully-connected layer. There are at most two - a matrix ((4*size) x (input_size+size) dimensions) and a bias (4*size entri... | 2 | stack_v2_sparse_classes_30k_test_001067 | Implement the Python class `LSTMCell` described below.
Class description:
Long short-term memory cell.
Method signatures and docstrings:
- def __init__(self, size, bias=True, weights=[], name=None, data_layout='data_parallel'): Initialize LSTM cell. Args: size (int): Size of output tensor. bias (bool): Whether to app... | Implement the Python class `LSTMCell` described below.
Class description:
Long short-term memory cell.
Method signatures and docstrings:
- def __init__(self, size, bias=True, weights=[], name=None, data_layout='data_parallel'): Initialize LSTM cell. Args: size (int): Size of output tensor. bias (bool): Whether to app... | e8cf85eed2acbd3383892bf7cb2d88b44c194f4f | <|skeleton|>
class LSTMCell:
"""Long short-term memory cell."""
def __init__(self, size, bias=True, weights=[], name=None, data_layout='data_parallel'):
"""Initialize LSTM cell. Args: size (int): Size of output tensor. bias (bool): Whether to apply biases after linearity. weights (`Weights` or iterator... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LSTMCell:
"""Long short-term memory cell."""
def __init__(self, size, bias=True, weights=[], name=None, data_layout='data_parallel'):
"""Initialize LSTM cell. Args: size (int): Size of output tensor. bias (bool): Whether to apply biases after linearity. weights (`Weights` or iterator of `Weights`... | the_stack_v2_python_sparse | python/lbann/modules/rnn.py | LLNL/lbann | train | 225 |
7880ff5909acaf97cca2c01e0eb6c92056a5296c | [
"self.result = 0\nself.dfs(root)\nreturn self.result",
"if not node:\n return 0\nl = self.dfs(node.left)\nr = self.dfs(node.right)\nself.result = max(self.result, l + r)\nreturn max(l, r) + 1"
] | <|body_start_0|>
self.result = 0
self.dfs(root)
return self.result
<|end_body_0|>
<|body_start_1|>
if not node:
return 0
l = self.dfs(node.left)
r = self.dfs(node.right)
self.result = max(self.result, l + r)
return max(l, r) + 1
<|end_body_1|>... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def diameterOfBinaryTree(self, root):
"""Improved solution. Original solution had a very useless `diam` variable with an unneccessary block for computing it. We don't need to check if node.left and node.right exist since we've already configured them to return zero if they are ... | stack_v2_sparse_classes_75kplus_train_070522 | 1,795 | no_license | [
{
"docstring": "Improved solution. Original solution had a very useless `diam` variable with an unneccessary block for computing it. We don't need to check if node.left and node.right exist since we've already configured them to return zero if they are null. :type root: TreeNode :rtype: int",
"name": "diame... | 2 | stack_v2_sparse_classes_30k_train_043160 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def diameterOfBinaryTree(self, root): Improved solution. Original solution had a very useless `diam` variable with an unneccessary block for computing it. We don't need to check ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def diameterOfBinaryTree(self, root): Improved solution. Original solution had a very useless `diam` variable with an unneccessary block for computing it. We don't need to check ... | f4cd43f082b58d4410008af49325770bc84d3aba | <|skeleton|>
class Solution:
def diameterOfBinaryTree(self, root):
"""Improved solution. Original solution had a very useless `diam` variable with an unneccessary block for computing it. We don't need to check if node.left and node.right exist since we've already configured them to return zero if they are ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def diameterOfBinaryTree(self, root):
"""Improved solution. Original solution had a very useless `diam` variable with an unneccessary block for computing it. We don't need to check if node.left and node.right exist since we've already configured them to return zero if they are null. :type ro... | the_stack_v2_python_sparse | 543.Diameter_of_a_Binary_Tree.py | welsny/solutions | train | 1 | |
eac719fddf9cc4c0142ed22cf7f00c9cf8672da8 | [
"homepage = HomePage(self.driver)\nhomepage.homepage_public()\ntime.sleep(2)\nerror_mes = homepage.find_element('xpath=>//*[@id=\"num2\"]/div/div[1]/span[2]').text\ntry:\n assert error_mes != u'--'\n print('公募数据 pass.')\nexcept Exception as e:\n print('公募数据 fail', format(e))\n print(error_mes)\ntime.sle... | <|body_start_0|>
homepage = HomePage(self.driver)
homepage.homepage_public()
time.sleep(2)
error_mes = homepage.find_element('xpath=>//*[@id="num2"]/div/div[1]/span[2]').text
try:
assert error_mes != u'--'
print('公募数据 pass.')
except Exception as e:... | 首页 | TestHomePage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestHomePage:
"""首页"""
def test_homepage_case1(self):
"""公募数据"""
<|body_0|>
def test_homepage_case2(self):
"""私募数据"""
<|body_1|>
def test_homepage_case3(self):
"""私募综合业绩指数"""
<|body_2|>
def test_homepage_case4(self):
"""私... | stack_v2_sparse_classes_75kplus_train_070523 | 3,501 | no_license | [
{
"docstring": "公募数据",
"name": "test_homepage_case1",
"signature": "def test_homepage_case1(self)"
},
{
"docstring": "私募数据",
"name": "test_homepage_case2",
"signature": "def test_homepage_case2(self)"
},
{
"docstring": "私募综合业绩指数",
"name": "test_homepage_case3",
"signature... | 6 | stack_v2_sparse_classes_30k_train_040944 | Implement the Python class `TestHomePage` described below.
Class description:
首页
Method signatures and docstrings:
- def test_homepage_case1(self): 公募数据
- def test_homepage_case2(self): 私募数据
- def test_homepage_case3(self): 私募综合业绩指数
- def test_homepage_case4(self): 私募分策略业绩指数情况
- def test_homepage_case5(self): 私募基金管理人... | Implement the Python class `TestHomePage` described below.
Class description:
首页
Method signatures and docstrings:
- def test_homepage_case1(self): 公募数据
- def test_homepage_case2(self): 私募数据
- def test_homepage_case3(self): 私募综合业绩指数
- def test_homepage_case4(self): 私募分策略业绩指数情况
- def test_homepage_case5(self): 私募基金管理人... | 7fcf3a99add164e34f85784b9041fcbccacf39ff | <|skeleton|>
class TestHomePage:
"""首页"""
def test_homepage_case1(self):
"""公募数据"""
<|body_0|>
def test_homepage_case2(self):
"""私募数据"""
<|body_1|>
def test_homepage_case3(self):
"""私募综合业绩指数"""
<|body_2|>
def test_homepage_case4(self):
"""私... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestHomePage:
"""首页"""
def test_homepage_case1(self):
"""公募数据"""
homepage = HomePage(self.driver)
homepage.homepage_public()
time.sleep(2)
error_mes = homepage.find_element('xpath=>//*[@id="num2"]/div/div[1]/span[2]').text
try:
assert error_mes ... | the_stack_v2_python_sparse | testsuites/test_homepage.py | huning2009/test_fram | train | 0 |
0bfbd884377492309d28a0524b1cb9193b8981e6 | [
"self.pieces_chessboard = pieces_chessboard\nself.pieces_chessboard_01 = pieces_chessboard_01\nself.joined_matrix_2 = joined_matrix_2\nself.per_matrix_02 = per_matrix_02",
"king = 6 * np.ones((2, 1), dtype=int)\nqueen = 5 * np.ones((2, 1), dtype=int)\nrook = 4 * np.ones((2, 2), dtype=int)\nbishop = 3 * np.ones((2... | <|body_start_0|>
self.pieces_chessboard = pieces_chessboard
self.pieces_chessboard_01 = pieces_chessboard_01
self.joined_matrix_2 = joined_matrix_2
self.per_matrix_02 = per_matrix_02
<|end_body_0|>
<|body_start_1|>
king = 6 * np.ones((2, 1), dtype=int)
queen = 5 * np.one... | Chess class | Chess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Chess:
"""Chess class"""
def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02):
"""Constructor, initialize the chessboard"""
<|body_0|>
def board_in(self):
"""Prints the chessboard configuration in the format"""
<|bod... | stack_v2_sparse_classes_75kplus_train_070524 | 3,078 | no_license | [
{
"docstring": "Constructor, initialize the chessboard",
"name": "__init__",
"signature": "def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02)"
},
{
"docstring": "Prints the chessboard configuration in the format",
"name": "board_in",
"signature": ... | 4 | stack_v2_sparse_classes_30k_val_001133 | Implement the Python class `Chess` described below.
Class description:
Chess class
Method signatures and docstrings:
- def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): Constructor, initialize the chessboard
- def board_in(self): Prints the chessboard configuration in the fo... | Implement the Python class `Chess` described below.
Class description:
Chess class
Method signatures and docstrings:
- def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): Constructor, initialize the chessboard
- def board_in(self): Prints the chessboard configuration in the fo... | c055c7ac8090dc8c54180fba39dcf975171c5cd1 | <|skeleton|>
class Chess:
"""Chess class"""
def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02):
"""Constructor, initialize the chessboard"""
<|body_0|>
def board_in(self):
"""Prints the chessboard configuration in the format"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Chess:
"""Chess class"""
def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02):
"""Constructor, initialize the chessboard"""
self.pieces_chessboard = pieces_chessboard
self.pieces_chessboard_01 = pieces_chessboard_01
self.joined_matrix... | the_stack_v2_python_sparse | desafio-04/caviuna/python/op_04_xadrez.py | OsProgramadores/op-desafios | train | 130 |
dd35b01847f28840fdcbcf459a3066856aa5a064 | [
"options = {'shapeOptions': {'color': color.info}}\nkwargs.setdefault('marker', {})\nkwargs.setdefault('circlemarker', {})\nkwargs.setdefault('polyline', {})\nkwargs.setdefault('rectangle', options)\nkwargs.setdefault('circle', options)\nkwargs.setdefault('polygon', options)\nself.m = m\nsuper().__init__(**kwargs)"... | <|body_start_0|>
options = {'shapeOptions': {'color': color.info}}
kwargs.setdefault('marker', {})
kwargs.setdefault('circlemarker', {})
kwargs.setdefault('polyline', {})
kwargs.setdefault('rectangle', options)
kwargs.setdefault('circle', options)
kwargs.setdefaul... | DrawControl | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DrawControl:
def __init__(self, m: ipl.Map, **kwargs) -> None:
"""A custom DrawingControl object to handle edition of features. Args: m: the map on which he drawControl is displayed kwargs: any available arguments from a ipyleaflet.DrawingControl"""
<|body_0|>
def show(self)... | stack_v2_sparse_classes_75kplus_train_070525 | 3,000 | permissive | [
{
"docstring": "A custom DrawingControl object to handle edition of features. Args: m: the map on which he drawControl is displayed kwargs: any available arguments from a ipyleaflet.DrawingControl",
"name": "__init__",
"signature": "def __init__(self, m: ipl.Map, **kwargs) -> None"
},
{
"docstri... | 5 | stack_v2_sparse_classes_30k_train_020021 | Implement the Python class `DrawControl` described below.
Class description:
Implement the DrawControl class.
Method signatures and docstrings:
- def __init__(self, m: ipl.Map, **kwargs) -> None: A custom DrawingControl object to handle edition of features. Args: m: the map on which he drawControl is displayed kwargs... | Implement the Python class `DrawControl` described below.
Class description:
Implement the DrawControl class.
Method signatures and docstrings:
- def __init__(self, m: ipl.Map, **kwargs) -> None: A custom DrawingControl object to handle edition of features. Args: m: the map on which he drawControl is displayed kwargs... | b26c7d698659d5c5a2029d02fc94dcd9daf0df98 | <|skeleton|>
class DrawControl:
def __init__(self, m: ipl.Map, **kwargs) -> None:
"""A custom DrawingControl object to handle edition of features. Args: m: the map on which he drawControl is displayed kwargs: any available arguments from a ipyleaflet.DrawingControl"""
<|body_0|>
def show(self)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DrawControl:
def __init__(self, m: ipl.Map, **kwargs) -> None:
"""A custom DrawingControl object to handle edition of features. Args: m: the map on which he drawControl is displayed kwargs: any available arguments from a ipyleaflet.DrawingControl"""
options = {'shapeOptions': {'color': color.i... | the_stack_v2_python_sparse | sepal_ui/mapping/draw_control.py | 12rambau/sepal_ui | train | 17 | |
f2d93c1fba1ba5bf9e70e2a0746beef33c73937e | [
"filename = 'password_SILO.txt'\nwith open(filename) as f:\n userpass = [x.strip().split(':', 1) for x in f]\nusername = userpass[0][0]\npassword = userpass[0][1]\nself.usr = username\nself.pwd = password\nself.baseurl = baseurl",
"payload = {'format': 'Alldata', 'station': station_no, 'start': start, 'finish'... | <|body_start_0|>
filename = 'password_SILO.txt'
with open(filename) as f:
userpass = [x.strip().split(':', 1) for x in f]
username = userpass[0][0]
password = userpass[0][1]
self.usr = username
self.pwd = password
self.baseurl = baseurl
<|end_body_0|>
... | Legacy SILO Access class, because for some reason the perfectly functional new SILO has been decomissioned... | SILO | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SILO:
"""Legacy SILO Access class, because for some reason the perfectly functional new SILO has been decomissioned..."""
def __init__(self):
"""Parameters ---------- usr : str The account username for access to the legacy SILO API pwd : str The password for the account"""
<|... | stack_v2_sparse_classes_75kplus_train_070526 | 4,337 | permissive | [
{
"docstring": "Parameters ---------- usr : str The account username for access to the legacy SILO API pwd : str The password for the account",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "get data station_no : int The SILO station number start : int The start time fo... | 3 | stack_v2_sparse_classes_30k_train_031504 | Implement the Python class `SILO` described below.
Class description:
Legacy SILO Access class, because for some reason the perfectly functional new SILO has been decomissioned...
Method signatures and docstrings:
- def __init__(self): Parameters ---------- usr : str The account username for access to the legacy SILO... | Implement the Python class `SILO` described below.
Class description:
Legacy SILO Access class, because for some reason the perfectly functional new SILO has been decomissioned...
Method signatures and docstrings:
- def __init__(self): Parameters ---------- usr : str The account username for access to the legacy SILO... | f578e0fbb76e328859dedfd31f98c83b902288fe | <|skeleton|>
class SILO:
"""Legacy SILO Access class, because for some reason the perfectly functional new SILO has been decomissioned..."""
def __init__(self):
"""Parameters ---------- usr : str The account username for access to the legacy SILO API pwd : str The password for the account"""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SILO:
"""Legacy SILO Access class, because for some reason the perfectly functional new SILO has been decomissioned..."""
def __init__(self):
"""Parameters ---------- usr : str The account username for access to the legacy SILO API pwd : str The password for the account"""
filename = 'pas... | the_stack_v2_python_sparse | SILO.py | tony-caine/Wiski-Data-Scripts | train | 0 |
ae4c923a26bf1f8cd1bd8039078c957125ca73ae | [
"self.elements = GameElements()\nself.tanks = pygame.sprite.Group()\nself.walls = pygame.sprite.Group()\nself.sprites = pygame.sprite.Group()\nself.bonus_spawn_time = 0\nself.npc_number = 0\nfor wall in self.elements.obstacles:\n self.sprites.add(wall)\n self.walls.add(wall)",
"self.elements.players = [Play... | <|body_start_0|>
self.elements = GameElements()
self.tanks = pygame.sprite.Group()
self.walls = pygame.sprite.Group()
self.sprites = pygame.sprite.Group()
self.bonus_spawn_time = 0
self.npc_number = 0
for wall in self.elements.obstacles:
self.sprites.a... | Base class for game instance. | GameData | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameData:
"""Base class for game instance."""
def __init__(self):
"""Initializes game with default values."""
<|body_0|>
def clear(self):
"""Clears Game Data to initial values."""
<|body_1|>
def add_npcs(self, number):
"""Adds AI controlled t... | stack_v2_sparse_classes_75kplus_train_070527 | 21,421 | no_license | [
{
"docstring": "Initializes game with default values.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Clears Game Data to initial values.",
"name": "clear",
"signature": "def clear(self)"
},
{
"docstring": "Adds AI controlled tanks to game. :param numbe... | 5 | stack_v2_sparse_classes_30k_train_054700 | Implement the Python class `GameData` described below.
Class description:
Base class for game instance.
Method signatures and docstrings:
- def __init__(self): Initializes game with default values.
- def clear(self): Clears Game Data to initial values.
- def add_npcs(self, number): Adds AI controlled tanks to game. :... | Implement the Python class `GameData` described below.
Class description:
Base class for game instance.
Method signatures and docstrings:
- def __init__(self): Initializes game with default values.
- def clear(self): Clears Game Data to initial values.
- def add_npcs(self, number): Adds AI controlled tanks to game. :... | 51a2f2ecc09a05672a2c3deb00ab8c273d3b756b | <|skeleton|>
class GameData:
"""Base class for game instance."""
def __init__(self):
"""Initializes game with default values."""
<|body_0|>
def clear(self):
"""Clears Game Data to initial values."""
<|body_1|>
def add_npcs(self, number):
"""Adds AI controlled t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameData:
"""Base class for game instance."""
def __init__(self):
"""Initializes game with default values."""
self.elements = GameElements()
self.tanks = pygame.sprite.Group()
self.walls = pygame.sprite.Group()
self.sprites = pygame.sprite.Group()
self.bonu... | the_stack_v2_python_sparse | game_core/game_data.py | asmodeii/tanki | train | 0 |
eb483c5b0ac940b8f4f7bee78cf8476a8757352b | [
"contribution = self.get_contribution(request.user, project_id, contribution_id)\ncomment = self.get_comment(contribution, comment_id)\nreturn self.update_and_respond(request, contribution, comment)",
"contribution = self.get_contribution(request.user, project_id, contribution_id)\ncomment = self.get_comment(cont... | <|body_start_0|>
contribution = self.get_contribution(request.user, project_id, contribution_id)
comment = self.get_comment(contribution, comment_id)
return self.update_and_respond(request, contribution, comment)
<|end_body_0|>
<|body_start_1|>
contribution = self.get_contribution(reque... | Public API for a single comment. | SingleCommentAPIView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleCommentAPIView:
"""Public API for a single comment."""
def patch(self, request, project_id, contribution_id, comment_id):
"""Handle PATCH request. Update the comment. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : in... | stack_v2_sparse_classes_75kplus_train_070528 | 11,610 | permissive | [
{
"docstring": "Handle PATCH request. Update the comment. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : int Identifies the project in the database. contribution_id : int Identifies the contribution in the database. comment_id : int Identifies the co... | 2 | stack_v2_sparse_classes_30k_train_029809 | Implement the Python class `SingleCommentAPIView` described below.
Class description:
Public API for a single comment.
Method signatures and docstrings:
- def patch(self, request, project_id, contribution_id, comment_id): Handle PATCH request. Update the comment. Parameters ---------- request : rest_framework.request... | Implement the Python class `SingleCommentAPIView` described below.
Class description:
Public API for a single comment.
Method signatures and docstrings:
- def patch(self, request, project_id, contribution_id, comment_id): Handle PATCH request. Update the comment. Parameters ---------- request : rest_framework.request... | 16d31b5207de9f699fc01054baad1fe65ad1c3ca | <|skeleton|>
class SingleCommentAPIView:
"""Public API for a single comment."""
def patch(self, request, project_id, contribution_id, comment_id):
"""Handle PATCH request. Update the comment. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SingleCommentAPIView:
"""Public API for a single comment."""
def patch(self, request, project_id, contribution_id, comment_id):
"""Handle PATCH request. Update the comment. Parameters ---------- request : rest_framework.request.Request Object representing the request. project_id : int Identifies ... | the_stack_v2_python_sparse | geokey/contributions/views/comments.py | NeolithEra/geokey | train | 0 |
a694e15bf51f2506caa1f6b5290abfc28dd4ea9c | [
"if not inorder:\n return None\nreturn self.buildTreeFromInPost(inorder, 0, len(inorder) - 1, postorder, 0, len(postorder) - 1)",
"if iB > iE or pB > pE:\n return None\nif iB == iE:\n return TreeNode(inorder[iE])\nroot = TreeNode(postorder[pE])\nmid = inorder.index(postorder[pE])\nleftLen = mid - iB\nroo... | <|body_start_0|>
if not inorder:
return None
return self.buildTreeFromInPost(inorder, 0, len(inorder) - 1, postorder, 0, len(postorder) - 1)
<|end_body_0|>
<|body_start_1|>
if iB > iE or pB > pE:
return None
if iB == iE:
return TreeNode(inorder[iE])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def buildTree(self, inorder, postorder):
""":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode"""
<|body_0|>
def buildTreeFromInPost(self, inorder, iB, iE, postorder, pB, pE):
"""根据中根和后根遍历构建二叉树。后跟遍历的最后一个是根。 :param inorder: List[int] :param... | stack_v2_sparse_classes_75kplus_train_070529 | 1,473 | no_license | [
{
"docstring": ":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode",
"name": "buildTree",
"signature": "def buildTree(self, inorder, postorder)"
},
{
"docstring": "根据中根和后根遍历构建二叉树。后跟遍历的最后一个是根。 :param inorder: List[int] :param iB:int :param iE:int :param postorder: List[int] :par... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode
- def buildTreeFromInPost(self, inorder, iB, iE, postorder, pB, pE):... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buildTree(self, inorder, postorder): :type inorder: List[int] :type postorder: List[int] :rtype: TreeNode
- def buildTreeFromInPost(self, inorder, iB, iE, postorder, pB, pE):... | 96adb6c04c344e792e35dc70dc45eb76b5402008 | <|skeleton|>
class Solution:
def buildTree(self, inorder, postorder):
""":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode"""
<|body_0|>
def buildTreeFromInPost(self, inorder, iB, iE, postorder, pB, pE):
"""根据中根和后根遍历构建二叉树。后跟遍历的最后一个是根。 :param inorder: List[int] :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def buildTree(self, inorder, postorder):
""":type inorder: List[int] :type postorder: List[int] :rtype: TreeNode"""
if not inorder:
return None
return self.buildTreeFromInPost(inorder, 0, len(inorder) - 1, postorder, 0, len(postorder) - 1)
def buildTreeFromIn... | the_stack_v2_python_sparse | JiQiang/leetcode_py/tree/ConstructBinaryTreefromInorderAndPostorderTraversal106.py | Hearen/AlgorithmHackers | train | 10 | |
5f0ad5bf9f797ad65e7de45d3304e476aca461fd | [
"self.is_disposed = False\nself.action: Action = action or noop\nself.lock = RLock()\nsuper().__init__()",
"dispose = False\nwith self.lock:\n if not self.is_disposed:\n dispose = True\n self.is_disposed = True\nif dispose:\n self.action()"
] | <|body_start_0|>
self.is_disposed = False
self.action: Action = action or noop
self.lock = RLock()
super().__init__()
<|end_body_0|>
<|body_start_1|>
dispose = False
with self.lock:
if not self.is_disposed:
dispose = True
self.... | Main disposable class | Disposable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Disposable:
"""Main disposable class"""
def __init__(self, action: Optional[typing.Action]=None) -> None:
"""Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run a... | stack_v2_sparse_classes_75kplus_train_070530 | 1,132 | permissive | [
{
"docstring": "Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run at most once. Returns: The disposable object that runs the given action upon disposal.",
"name": "__init__",
"sign... | 2 | stack_v2_sparse_classes_30k_train_050096 | Implement the Python class `Disposable` described below.
Class description:
Main disposable class
Method signatures and docstrings:
- def __init__(self, action: Optional[typing.Action]=None) -> None: Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the fi... | Implement the Python class `Disposable` described below.
Class description:
Main disposable class
Method signatures and docstrings:
- def __init__(self, action: Optional[typing.Action]=None) -> None: Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the fi... | af1663d35810fdcd4c25a3ed2e8f0d71b55c341d | <|skeleton|>
class Disposable:
"""Main disposable class"""
def __init__(self, action: Optional[typing.Action]=None) -> None:
"""Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Disposable:
"""Main disposable class"""
def __init__(self, action: Optional[typing.Action]=None) -> None:
"""Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run at most once. ... | the_stack_v2_python_sparse | reactivex/disposable/disposable.py | ReactiveX/RxPY | train | 4,764 |
2a037915945f649fae7a46781b97c90b36ccad35 | [
"item = super(ItemJSONSerializer, self).transform_record(pid, record, links_factory=links_factory, **kwargs)\nself.filter_circulation(item)\nreturn item",
"hit = super(ItemJSONSerializer, self).transform_search_hit(pid, record_hit, links_factory=links_factory, **kwargs)\nself.filter_circulation(hit)\nreturn hit",... | <|body_start_0|>
item = super(ItemJSONSerializer, self).transform_record(pid, record, links_factory=links_factory, **kwargs)
self.filter_circulation(item)
return item
<|end_body_0|>
<|body_start_1|>
hit = super(ItemJSONSerializer, self).transform_search_hit(pid, record_hit, links_factor... | Serialize and filter item circulation status. | ItemJSONSerializer | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemJSONSerializer:
"""Serialize and filter item circulation status."""
def transform_record(self, pid, record, links_factory=None, **kwargs):
"""Transform record into an intermediate representation."""
<|body_0|>
def transform_search_hit(self, pid, record_hit, links_fac... | stack_v2_sparse_classes_75kplus_train_070531 | 2,030 | permissive | [
{
"docstring": "Transform record into an intermediate representation.",
"name": "transform_record",
"signature": "def transform_record(self, pid, record, links_factory=None, **kwargs)"
},
{
"docstring": "Transform search result hit into an intermediate representation.",
"name": "transform_se... | 3 | stack_v2_sparse_classes_30k_train_011507 | Implement the Python class `ItemJSONSerializer` described below.
Class description:
Serialize and filter item circulation status.
Method signatures and docstrings:
- def transform_record(self, pid, record, links_factory=None, **kwargs): Transform record into an intermediate representation.
- def transform_search_hit(... | Implement the Python class `ItemJSONSerializer` described below.
Class description:
Serialize and filter item circulation status.
Method signatures and docstrings:
- def transform_record(self, pid, record, links_factory=None, **kwargs): Transform record into an intermediate representation.
- def transform_search_hit(... | 42ba282968d0aa28fb1bfc71d0709685165aaec4 | <|skeleton|>
class ItemJSONSerializer:
"""Serialize and filter item circulation status."""
def transform_record(self, pid, record, links_factory=None, **kwargs):
"""Transform record into an intermediate representation."""
<|body_0|>
def transform_search_hit(self, pid, record_hit, links_fac... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ItemJSONSerializer:
"""Serialize and filter item circulation status."""
def transform_record(self, pid, record, links_factory=None, **kwargs):
"""Transform record into an intermediate representation."""
item = super(ItemJSONSerializer, self).transform_record(pid, record, links_factory=lin... | the_stack_v2_python_sparse | invenio_app_ils/records/serializers/item.py | equadon/invenio-app-ils | train | 0 |
e6bb83e59a9e423d76f580473df5618233398072 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A set of methods for async voice recognition. | AsyncRecognizerServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsyncRecognizerServicer:
"""A set of methods for async voice recognition."""
def RecognizeFile(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetRecognition(self, request, context):
"""Missing associated doc... | stack_v2_sparse_classes_75kplus_train_070532 | 7,372 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "RecognizeFile",
"signature": "def RecognizeFile(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetRecognition",
"signature": "def GetRecogn... | 2 | stack_v2_sparse_classes_30k_train_017991 | Implement the Python class `AsyncRecognizerServicer` described below.
Class description:
A set of methods for async voice recognition.
Method signatures and docstrings:
- def RecognizeFile(self, request, context): Missing associated documentation comment in .proto file.
- def GetRecognition(self, request, context): M... | Implement the Python class `AsyncRecognizerServicer` described below.
Class description:
A set of methods for async voice recognition.
Method signatures and docstrings:
- def RecognizeFile(self, request, context): Missing associated documentation comment in .proto file.
- def GetRecognition(self, request, context): M... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class AsyncRecognizerServicer:
"""A set of methods for async voice recognition."""
def RecognizeFile(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetRecognition(self, request, context):
"""Missing associated doc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AsyncRecognizerServicer:
"""A set of methods for async voice recognition."""
def RecognizeFile(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | yandex/cloud/ai/stt/v3/stt_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
28ec64779078f456a17c5e1ccd7c461b993b83d2 | [
"super(_Bottleneck, self).__init__()\nself.in_channels = in_channels\nself.mid_channels = mid_channels\nself.out_channels = out_channels\nself.stride = stride\nself.dilate = dilate\nself.groups = groups\nself.initialW = initialW\nself.bn_kwargs = bn_kwargs\nself.residual_conv = residual_conv\nwith self.init_scope()... | <|body_start_0|>
super(_Bottleneck, self).__init__()
self.in_channels = in_channels
self.mid_channels = mid_channels
self.out_channels = out_channels
self.stride = stride
self.dilate = dilate
self.groups = groups
self.initialW = initialW
self.bn_kw... | Bottleneck in ResNet-v2 with pre-activation setting. | _Bottleneck | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Bottleneck:
"""Bottleneck in ResNet-v2 with pre-activation setting."""
def __init__(self, in_channels, mid_channels, out_channels, stride=1, pad=1, dilate=1, groups=1, initialW=None, bn_kwargs={}, residual_conv=False):
"""CTOR"""
<|body_0|>
def forward(self, x):
... | stack_v2_sparse_classes_75kplus_train_070533 | 7,508 | permissive | [
{
"docstring": "CTOR",
"name": "__init__",
"signature": "def __init__(self, in_channels, mid_channels, out_channels, stride=1, pad=1, dilate=1, groups=1, initialW=None, bn_kwargs={}, residual_conv=False)"
},
{
"docstring": "forward computation",
"name": "forward",
"signature": "def forwa... | 2 | stack_v2_sparse_classes_30k_train_051491 | Implement the Python class `_Bottleneck` described below.
Class description:
Bottleneck in ResNet-v2 with pre-activation setting.
Method signatures and docstrings:
- def __init__(self, in_channels, mid_channels, out_channels, stride=1, pad=1, dilate=1, groups=1, initialW=None, bn_kwargs={}, residual_conv=False): CTOR... | Implement the Python class `_Bottleneck` described below.
Class description:
Bottleneck in ResNet-v2 with pre-activation setting.
Method signatures and docstrings:
- def __init__(self, in_channels, mid_channels, out_channels, stride=1, pad=1, dilate=1, groups=1, initialW=None, bn_kwargs={}, residual_conv=False): CTOR... | 0ca435433b9953e33656173c4d60ebd61c5c5e87 | <|skeleton|>
class _Bottleneck:
"""Bottleneck in ResNet-v2 with pre-activation setting."""
def __init__(self, in_channels, mid_channels, out_channels, stride=1, pad=1, dilate=1, groups=1, initialW=None, bn_kwargs={}, residual_conv=False):
"""CTOR"""
<|body_0|>
def forward(self, x):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _Bottleneck:
"""Bottleneck in ResNet-v2 with pre-activation setting."""
def __init__(self, in_channels, mid_channels, out_channels, stride=1, pad=1, dilate=1, groups=1, initialW=None, bn_kwargs={}, residual_conv=False):
"""CTOR"""
super(_Bottleneck, self).__init__()
self.in_channe... | the_stack_v2_python_sparse | chainerlp/links/models/resnet_v2.py | MetaVai/gradient-scaling | train | 0 |
ee71d4441c1093bb9cbaad9fc1cd22130f02f486 | [
"self.name = 'Step'\nself.voltage = []\nself.camera = False\nself.time = 0\nself.read_line(line)\nself.line = line\nself.channels = channels",
"columns = line.rstrip('\\n').split('\\t')\ncolumns = [x.rstrip().lstrip() for x in columns]\nself.name = columns[0]\nself.time = get_standard_unit(columns[1])\nself.volta... | <|body_start_0|>
self.name = 'Step'
self.voltage = []
self.camera = False
self.time = 0
self.read_line(line)
self.line = line
self.channels = channels
<|end_body_0|>
<|body_start_1|>
columns = line.rstrip('\n').split('\t')
columns = [x.rstrip().ls... | ChipStep | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChipStep:
def __init__(self, line, channels):
"""Microchip method as Step, time, Voltage, Camera options for each line in the method (*in that order). :param line:"""
<|body_0|>
def read_line(self, line):
"""Read information from a tab seperated line. column order: N... | stack_v2_sparse_classes_75kplus_train_070534 | 39,006 | no_license | [
{
"docstring": "Microchip method as Step, time, Voltage, Camera options for each line in the method (*in that order). :param line:",
"name": "__init__",
"signature": "def __init__(self, line, channels)"
},
{
"docstring": "Read information from a tab seperated line. column order: Name, Time, Volt... | 2 | stack_v2_sparse_classes_30k_train_044798 | Implement the Python class `ChipStep` described below.
Class description:
Implement the ChipStep class.
Method signatures and docstrings:
- def __init__(self, line, channels): Microchip method as Step, time, Voltage, Camera options for each line in the method (*in that order). :param line:
- def read_line(self, line)... | Implement the Python class `ChipStep` described below.
Class description:
Implement the ChipStep class.
Method signatures and docstrings:
- def __init__(self, line, channels): Microchip method as Step, time, Voltage, Camera options for each line in the method (*in that order). :param line:
- def read_line(self, line)... | 52d03cda199d99264338acf885910b6c065bc049 | <|skeleton|>
class ChipStep:
def __init__(self, line, channels):
"""Microchip method as Step, time, Voltage, Camera options for each line in the method (*in that order). :param line:"""
<|body_0|>
def read_line(self, line):
"""Read information from a tab seperated line. column order: N... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChipStep:
def __init__(self, line, channels):
"""Microchip method as Step, time, Voltage, Camera options for each line in the method (*in that order). :param line:"""
self.name = 'Step'
self.voltage = []
self.camera = False
self.time = 0
self.read_line(line)
... | the_stack_v2_python_sparse | L4/AutomatedControl.py | brae-pete/AutomatedCE | train | 0 | |
a9447dc8e0281bbe261e10880375e13b3b33a98e | [
"super().__init__()\nself.env = env\nself.policy = policy\nself.name = name\nself.service_interval = service_interval\nself.task_variability = task_variability\nself.terminal = terminal\nself.child = None",
"token.worked_by(self)\npolicy_job = self.policy.request(self, token)\nservice_time = (yield policy_job.req... | <|body_start_0|>
super().__init__()
self.env = env
self.policy = policy
self.name = name
self.service_interval = service_interval
self.task_variability = task_variability
self.terminal = terminal
self.child = None
<|end_body_0|>
<|body_start_1|>
t... | UserTask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserTask:
def __init__(self, env, policy, name, service_interval, task_variability, terminal=False):
"""Initializes a user task object. :param env: simpy environment. :param policy: assigned policy to be used by the user task. :param name: descriptive name. :param service_interval: mean ... | stack_v2_sparse_classes_75kplus_train_070535 | 6,685 | no_license | [
{
"docstring": "Initializes a user task object. :param env: simpy environment. :param policy: assigned policy to be used by the user task. :param name: descriptive name. :param service_interval: mean of service interval to be sampled. :param task_variability: per user task variability to be used for sampling us... | 2 | stack_v2_sparse_classes_30k_train_019884 | Implement the Python class `UserTask` described below.
Class description:
Implement the UserTask class.
Method signatures and docstrings:
- def __init__(self, env, policy, name, service_interval, task_variability, terminal=False): Initializes a user task object. :param env: simpy environment. :param policy: assigned ... | Implement the Python class `UserTask` described below.
Class description:
Implement the UserTask class.
Method signatures and docstrings:
- def __init__(self, env, policy, name, service_interval, task_variability, terminal=False): Initializes a user task object. :param env: simpy environment. :param policy: assigned ... | 9065c8e86f50f0d014e6a6159b7be379087a17c1 | <|skeleton|>
class UserTask:
def __init__(self, env, policy, name, service_interval, task_variability, terminal=False):
"""Initializes a user task object. :param env: simpy environment. :param policy: assigned policy to be used by the user task. :param name: descriptive name. :param service_interval: mean ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserTask:
def __init__(self, env, policy, name, service_interval, task_variability, terminal=False):
"""Initializes a user task object. :param env: simpy environment. :param policy: assigned policy to be used by the user task. :param name: descriptive name. :param service_interval: mean of service int... | the_stack_v2_python_sparse | elements/workflow_process_elements.py | fkocovski/optimaltaskassignment | train | 0 | |
cb0cca6f71942f303f5495a93fccc26dea1345dc | [
"from sklearn import preprocessing\nimport _pickle as cPickle\ndf = data[var].values.reshape(-1, 1)\ndic = {}\nif method == 'std':\n std = preprocessing.StandardScaler().fit(df)\n dic['mean'] = float(std.mean_)\n dic['scale'] = float(std.scale_)\nelif method == 'minmax':\n mm = preprocessing.MinMaxScale... | <|body_start_0|>
from sklearn import preprocessing
import _pickle as cPickle
df = data[var].values.reshape(-1, 1)
dic = {}
if method == 'std':
std = preprocessing.StandardScaler().fit(df)
dic['mean'] = float(std.mean_)
dic['scale'] = float(std.... | Data_Scaler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data_Scaler:
def fit(self, data, var, method='std'):
"""进行标准化归一化的fit,并将fit的结果保存为pkl文件"""
<|body_0|>
def pickles(self, var, scale_pkl_path, dic=None):
"""判断某个pkl文件是否存在,不存在则生成pkl文件"""
<|body_1|>
def transform(self, data, var, scale_pkl_path, method='std'):... | stack_v2_sparse_classes_75kplus_train_070536 | 2,778 | no_license | [
{
"docstring": "进行标准化归一化的fit,并将fit的结果保存为pkl文件",
"name": "fit",
"signature": "def fit(self, data, var, method='std')"
},
{
"docstring": "判断某个pkl文件是否存在,不存在则生成pkl文件",
"name": "pickles",
"signature": "def pickles(self, var, scale_pkl_path, dic=None)"
},
{
"docstring": "利用fit的标准,再对pkl... | 3 | null | Implement the Python class `Data_Scaler` described below.
Class description:
Implement the Data_Scaler class.
Method signatures and docstrings:
- def fit(self, data, var, method='std'): 进行标准化归一化的fit,并将fit的结果保存为pkl文件
- def pickles(self, var, scale_pkl_path, dic=None): 判断某个pkl文件是否存在,不存在则生成pkl文件
- def transform(self, da... | Implement the Python class `Data_Scaler` described below.
Class description:
Implement the Data_Scaler class.
Method signatures and docstrings:
- def fit(self, data, var, method='std'): 进行标准化归一化的fit,并将fit的结果保存为pkl文件
- def pickles(self, var, scale_pkl_path, dic=None): 判断某个pkl文件是否存在,不存在则生成pkl文件
- def transform(self, da... | cc25cb60f1c1c89b4591bbdaec8db1eeba818377 | <|skeleton|>
class Data_Scaler:
def fit(self, data, var, method='std'):
"""进行标准化归一化的fit,并将fit的结果保存为pkl文件"""
<|body_0|>
def pickles(self, var, scale_pkl_path, dic=None):
"""判断某个pkl文件是否存在,不存在则生成pkl文件"""
<|body_1|>
def transform(self, data, var, scale_pkl_path, method='std'):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Data_Scaler:
def fit(self, data, var, method='std'):
"""进行标准化归一化的fit,并将fit的结果保存为pkl文件"""
from sklearn import preprocessing
import _pickle as cPickle
df = data[var].values.reshape(-1, 1)
dic = {}
if method == 'std':
std = preprocessing.StandardScaler(... | the_stack_v2_python_sparse | bus_drop/loans_drop/feature_engineering/scale.py | xeon-ye/dgg-pro | train | 0 | |
4c2029253e56b9b73e5667710ff338dc19911c91 | [
"member_check = Group.objects.get_or_create(name='member')\nmember_group = Group.objects.get(name='member')\nuser = get_user_model().objects.create(**validated_data)\nuser.is_active = False\nuser.set_password(validated_data['password'])\nmember_group.user_set.add(user)\ncode = ActivationCode.objects.create(user=use... | <|body_start_0|>
member_check = Group.objects.get_or_create(name='member')
member_group = Group.objects.get(name='member')
user = get_user_model().objects.create(**validated_data)
user.is_active = False
user.set_password(validated_data['password'])
member_group.user_set.a... | Serializer for the users object | UserSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSerializer:
"""Serializer for the users object"""
def create(self, validated_data):
"""Create a new user with encrypted password and return it"""
<|body_0|>
def update(self, instance, validated_data):
"""Update a user, settin the password correctly and return... | stack_v2_sparse_classes_75kplus_train_070537 | 2,159 | permissive | [
{
"docstring": "Create a new user with encrypted password and return it",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Update a user, settin the password correctly and return it",
"name": "update",
"signature": "def update(self, instance, validated... | 2 | stack_v2_sparse_classes_30k_train_036725 | Implement the Python class `UserSerializer` described below.
Class description:
Serializer for the users object
Method signatures and docstrings:
- def create(self, validated_data): Create a new user with encrypted password and return it
- def update(self, instance, validated_data): Update a user, settin the password... | Implement the Python class `UserSerializer` described below.
Class description:
Serializer for the users object
Method signatures and docstrings:
- def create(self, validated_data): Create a new user with encrypted password and return it
- def update(self, instance, validated_data): Update a user, settin the password... | 62964dfbeb45c2d55d837c6bfe5b14125fabb816 | <|skeleton|>
class UserSerializer:
"""Serializer for the users object"""
def create(self, validated_data):
"""Create a new user with encrypted password and return it"""
<|body_0|>
def update(self, instance, validated_data):
"""Update a user, settin the password correctly and return... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserSerializer:
"""Serializer for the users object"""
def create(self, validated_data):
"""Create a new user with encrypted password and return it"""
member_check = Group.objects.get_or_create(name='member')
member_group = Group.objects.get(name='member')
user = get_user_m... | the_stack_v2_python_sparse | backend/apps/user/serializers.py | Vturnus/critterco-dev | train | 0 |
20eb97d6eebd246ed1ccce4410c85deb2748a8f7 | [
"super(MLP, self).__init__()\nself.linear_layers = nn.ModuleList()\nif len(n_hidden) == 0:\n self.linear_layers.append(nn.Linear(n_inputs, n_classes))\nelse:\n for i in range(len(n_hidden)):\n if i == 0:\n n_in = n_inputs\n else:\n n_in = n_hidden[i - 1]\n self.linea... | <|body_start_0|>
super(MLP, self).__init__()
self.linear_layers = nn.ModuleList()
if len(n_hidden) == 0:
self.linear_layers.append(nn.Linear(n_inputs, n_classes))
else:
for i in range(len(n_hidden)):
if i == 0:
n_in = n_inputs
... | This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward. | MLP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MLP:
"""This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward."""
def __init__(self, n_inputs, n_hidden, n_classes):
"""Initializes MLP object. Args: n_inputs: number ... | stack_v2_sparse_classes_75kplus_train_070538 | 2,665 | no_license | [
{
"docstring": "Initializes MLP object. Args: n_inputs: number of inputs. n_hidden: list of ints, specifies the number of units in each linear layer. If the list is empty, the MLP will not have any linear layers, and the model will simply perform a multinomial logistic regression. n_classes: number of classes o... | 2 | stack_v2_sparse_classes_30k_train_003862 | Implement the Python class `MLP` described below.
Class description:
This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.
Method signatures and docstrings:
- def __init__(self, n_inputs, n_hidden, n_... | Implement the Python class `MLP` described below.
Class description:
This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.
Method signatures and docstrings:
- def __init__(self, n_inputs, n_hidden, n_... | 7f56384b5dcb71d3c432cca47b65f25acf847208 | <|skeleton|>
class MLP:
"""This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward."""
def __init__(self, n_inputs, n_hidden, n_classes):
"""Initializes MLP object. Args: n_inputs: number ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MLP:
"""This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward."""
def __init__(self, n_inputs, n_hidden, n_classes):
"""Initializes MLP object. Args: n_inputs: number of inputs. n_... | the_stack_v2_python_sparse | assignment_1/code/mlp_pytorch.py | MichelleAppel/deep-learning | train | 1 |
32436fda51618c7580b85df24372d10da94932ad | [
"query = Query(ResistType.collection, service_id=self._client.service_id)\nquery.add_term(field=ResistType.id_field, value=self.resist_type_id)\nreturn InstanceProxy(ResistType, query, client=self._client)",
"if self.data.target_type_id is None:\n return None\nreturn TargetType(self.data.target_type_id)",
"q... | <|body_start_0|>
query = Query(ResistType.collection, service_id=self._client.service_id)
query.add_term(field=ResistType.id_field, value=self.resist_type_id)
return InstanceProxy(ResistType, query, client=self._client)
<|end_body_0|>
<|body_start_1|>
if self.data.target_type_id is None... | An effect acting on a character. Effects are usually created by an :class:`~auraxium.ps2.Ability` or are the result of a weapon firing. Access the corresponding :class:`EffectType` instance via the :meth:`Effect.type` method for information on generic parameters. .. note:: The relationship between :class:`Effect` and :... | Effect | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Effect:
"""An effect acting on a character. Effects are usually created by an :class:`~auraxium.ps2.Ability` or are the result of a weapon firing. Access the corresponding :class:`EffectType` instance via the :meth:`Effect.type` method for information on generic parameters. .. note:: The relation... | stack_v2_sparse_classes_75kplus_train_070539 | 10,551 | permissive | [
{
"docstring": "Return the resist type of the effect. This returns an :class:`auraxium.InstanceProxy`.",
"name": "resist_type",
"signature": "def resist_type(self) -> InstanceProxy[ResistType]"
},
{
"docstring": "Return the target type of this effect.",
"name": "target_type",
"signature"... | 3 | stack_v2_sparse_classes_30k_train_050747 | Implement the Python class `Effect` described below.
Class description:
An effect acting on a character. Effects are usually created by an :class:`~auraxium.ps2.Ability` or are the result of a weapon firing. Access the corresponding :class:`EffectType` instance via the :meth:`Effect.type` method for information on gen... | Implement the Python class `Effect` described below.
Class description:
An effect acting on a character. Effects are usually created by an :class:`~auraxium.ps2.Ability` or are the result of a weapon firing. Access the corresponding :class:`EffectType` instance via the :meth:`Effect.type` method for information on gen... | 23dcf927a199c8d7c917d89fe96b470a34cf4bba | <|skeleton|>
class Effect:
"""An effect acting on a character. Effects are usually created by an :class:`~auraxium.ps2.Ability` or are the result of a weapon firing. Access the corresponding :class:`EffectType` instance via the :meth:`Effect.type` method for information on generic parameters. .. note:: The relation... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Effect:
"""An effect acting on a character. Effects are usually created by an :class:`~auraxium.ps2.Ability` or are the result of a weapon firing. Access the corresponding :class:`EffectType` instance via the :meth:`Effect.type` method for information on generic parameters. .. note:: The relationship between ... | the_stack_v2_python_sparse | auraxium/ps2/_effect.py | leonhard-s/auraxium | train | 29 |
26fc0086323210d04d7c3eb48e1d51c5bbf009bd | [
"from pip._internal.commands.show import search_packages_info\npackages_info = list(search_packages_info([package_name]))\nif len(packages_info) == 0:\n raise Exception(f'package {package_name} not found')\nif isinstance(packages_info[0], dict):\n files = packages_info[0]['files']\n location = packages_inf... | <|body_start_0|>
from pip._internal.commands.show import search_packages_info
packages_info = list(search_packages_info([package_name]))
if len(packages_info) == 0:
raise Exception(f'package {package_name} not found')
if isinstance(packages_info[0], dict):
files =... | Tool to work with setup.py dependencies. | DependenciesTool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DependenciesTool:
"""Tool to work with setup.py dependencies."""
def get_package_files(package_name: str) -> List[Path]:
"""Get package files list."""
<|body_0|>
def clean_dependency_name(dependecy_specification: str) -> str:
"""Get dependency name from dependenc... | stack_v2_sparse_classes_75kplus_train_070540 | 10,606 | permissive | [
{
"docstring": "Get package files list.",
"name": "get_package_files",
"signature": "def get_package_files(package_name: str) -> List[Path]"
},
{
"docstring": "Get dependency name from dependency specification.",
"name": "clean_dependency_name",
"signature": "def clean_dependency_name(de... | 2 | stack_v2_sparse_classes_30k_train_033774 | Implement the Python class `DependenciesTool` described below.
Class description:
Tool to work with setup.py dependencies.
Method signatures and docstrings:
- def get_package_files(package_name: str) -> List[Path]: Get package files list.
- def clean_dependency_name(dependecy_specification: str) -> str: Get dependenc... | Implement the Python class `DependenciesTool` described below.
Class description:
Tool to work with setup.py dependencies.
Method signatures and docstrings:
- def get_package_files(package_name: str) -> List[Path]: Get package files list.
- def clean_dependency_name(dependecy_specification: str) -> str: Get dependenc... | bec49adaeba661d8d0f03ac9935dc89f39d95a0d | <|skeleton|>
class DependenciesTool:
"""Tool to work with setup.py dependencies."""
def get_package_files(package_name: str) -> List[Path]:
"""Get package files list."""
<|body_0|>
def clean_dependency_name(dependecy_specification: str) -> str:
"""Get dependency name from dependenc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DependenciesTool:
"""Tool to work with setup.py dependencies."""
def get_package_files(package_name: str) -> List[Path]:
"""Get package files list."""
from pip._internal.commands.show import search_packages_info
packages_info = list(search_packages_info([package_name]))
if... | the_stack_v2_python_sparse | scripts/check_imports_and_dependencies.py | fetchai/agents-aea | train | 192 |
fae33b1f82e046685bc49eabc32d474b99b91da2 | [
"self.input_list = [['HTML', 'C#'], ['C#', 'Python'], ['Python', 'HTML']]\nself.input_results = [0, 0, 1]\nself.output = 'Python'\nreturn (self.input_list, self.input_results, self.output)",
"input_list, input_results, output = self.setUp()\noutput_method = tournamentWinner(input_list, input_results)\nself.assert... | <|body_start_0|>
self.input_list = [['HTML', 'C#'], ['C#', 'Python'], ['Python', 'HTML']]
self.input_results = [0, 0, 1]
self.output = 'Python'
return (self.input_list, self.input_results, self.output)
<|end_body_0|>
<|body_start_1|>
input_list, input_results, output = self.setU... | Class with unittests for TournamentWinner.py | test_TournamentWinner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_TournamentWinner:
"""Class with unittests for TournamentWinner.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_ExpectedOutput(self):
"""Checks if returned output is as expected."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_070541 | 1,093 | no_license | [
{
"docstring": "Sets up input.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Checks if returned output is as expected.",
"name": "test_ExpectedOutput",
"signature": "def test_ExpectedOutput(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008127 | Implement the Python class `test_TournamentWinner` described below.
Class description:
Class with unittests for TournamentWinner.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_ExpectedOutput(self): Checks if returned output is as expected. | Implement the Python class `test_TournamentWinner` described below.
Class description:
Class with unittests for TournamentWinner.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_ExpectedOutput(self): Checks if returned output is as expected.
<|skeleton|>
class test_TournamentWinner:
... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class test_TournamentWinner:
"""Class with unittests for TournamentWinner.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_ExpectedOutput(self):
"""Checks if returned output is as expected."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class test_TournamentWinner:
"""Class with unittests for TournamentWinner.py"""
def setUp(self):
"""Sets up input."""
self.input_list = [['HTML', 'C#'], ['C#', 'Python'], ['Python', 'HTML']]
self.input_results = [0, 0, 1]
self.output = 'Python'
return (self.input_list, s... | the_stack_v2_python_sparse | AlgoExpert_algorithms/Easy/TournamentWinner/test_TournamentWinner.py | JakubKazimierski/PythonPortfolio | train | 9 |
9df367ae7bf2c03b282d33055e337522adac1133 | [
"qry = Account.query.order_by(desc(Account.enabled), Account.account_name)\nif ROLE_ADMIN not in session['user'].roles:\n qry = qry.filter(Account.account_id.in_(session['accounts']))\naccounts = qry.all()\nif accounts:\n return self.make_response({'message': None, 'accounts': [x.to_json(is_admin=ROLE_ADMIN i... | <|body_start_0|>
qry = Account.query.order_by(desc(Account.enabled), Account.account_name)
if ROLE_ADMIN not in session['user'].roles:
qry = qry.filter(Account.account_id.in_(session['accounts']))
accounts = qry.all()
if accounts:
return self.make_response({'messa... | AccountList | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountList:
def get(self):
"""List all accounts"""
<|body_0|>
def post(self):
"""Create a new account"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
qry = Account.query.order_by(desc(Account.enabled), Account.account_name)
if ROLE_ADMIN no... | stack_v2_sparse_classes_75kplus_train_070542 | 6,203 | permissive | [
{
"docstring": "List all accounts",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a new account",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_036159 | Implement the Python class `AccountList` described below.
Class description:
Implement the AccountList class.
Method signatures and docstrings:
- def get(self): List all accounts
- def post(self): Create a new account | Implement the Python class `AccountList` described below.
Class description:
Implement the AccountList class.
Method signatures and docstrings:
- def get(self): List all accounts
- def post(self): Create a new account
<|skeleton|>
class AccountList:
def get(self):
"""List all accounts"""
<|body_... | eede56521800ee31f174072b12bc51f01d5fb10c | <|skeleton|>
class AccountList:
def get(self):
"""List all accounts"""
<|body_0|>
def post(self):
"""Create a new account"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccountList:
def get(self):
"""List all accounts"""
qry = Account.query.order_by(desc(Account.enabled), Account.account_name)
if ROLE_ADMIN not in session['user'].roles:
qry = qry.filter(Account.account_id.in_(session['accounts']))
accounts = qry.all()
if ac... | the_stack_v2_python_sparse | backend/cloud_inquisitor/plugins/views/accounts.py | rgodishela/cloud-inquisitor | train | 0 | |
d4683bc00e0e4951bddff38a472dd3e36c55e160 | [
"lib_farm.add_role_to_farm(context, farm, role_options=['winchef'])\nfarm.launch()\nserver = lib_server.wait_server_status(context, cloud, farm, status=ServerStatus.RUNNING)\nservers['M1'] = server\nlib_server.assert_scalarizr_log_errors(cloud, server)\nlifecycle.assert_szr_version_last(server)\nnode = cloud.get_no... | <|body_start_0|>
lib_farm.add_role_to_farm(context, farm, role_options=['winchef'])
farm.launch()
server = lib_server.wait_server_status(context, cloud, farm, status=ServerStatus.RUNNING)
servers['M1'] = server
lib_server.assert_scalarizr_log_errors(cloud, server)
lifecyc... | Windows server provision with chef | TestChefProvisionWindows | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestChefProvisionWindows:
"""Windows server provision with chef"""
def test_bootstrapping_with_chef(self, context: dict, cloud: Cloud, farm: Farm, servers: dict):
"""Bootstrapping with chef"""
<|body_0|>
def test_chef_solo_bootstrapping(self, context: dict, cloud: Cloud,... | stack_v2_sparse_classes_75kplus_train_070543 | 9,415 | no_license | [
{
"docstring": "Bootstrapping with chef",
"name": "test_bootstrapping_with_chef",
"signature": "def test_bootstrapping_with_chef(self, context: dict, cloud: Cloud, farm: Farm, servers: dict)"
},
{
"docstring": "Bootstrapping role with chef-solo",
"name": "test_chef_solo_bootstrapping",
"... | 4 | null | Implement the Python class `TestChefProvisionWindows` described below.
Class description:
Windows server provision with chef
Method signatures and docstrings:
- def test_bootstrapping_with_chef(self, context: dict, cloud: Cloud, farm: Farm, servers: dict): Bootstrapping with chef
- def test_chef_solo_bootstrapping(se... | Implement the Python class `TestChefProvisionWindows` described below.
Class description:
Windows server provision with chef
Method signatures and docstrings:
- def test_bootstrapping_with_chef(self, context: dict, cloud: Cloud, farm: Farm, servers: dict): Bootstrapping with chef
- def test_chef_solo_bootstrapping(se... | 87b212e5b35a328b0a3c4d502847989a4d4fd897 | <|skeleton|>
class TestChefProvisionWindows:
"""Windows server provision with chef"""
def test_bootstrapping_with_chef(self, context: dict, cloud: Cloud, farm: Farm, servers: dict):
"""Bootstrapping with chef"""
<|body_0|>
def test_chef_solo_bootstrapping(self, context: dict, cloud: Cloud,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestChefProvisionWindows:
"""Windows server provision with chef"""
def test_bootstrapping_with_chef(self, context: dict, cloud: Cloud, farm: Farm, servers: dict):
"""Bootstrapping with chef"""
lib_farm.add_role_to_farm(context, farm, role_options=['winchef'])
farm.launch()
... | the_stack_v2_python_sparse | scalarizr/lifecycle/test_provision_windows.py | Scalr/revizor-tests | train | 0 |
4956c92527f892b1662be74cf1a84939442427d0 | [
"self.mass = mass\nself.pos = np.array(pos, dtype=float)\nself.vel = np.array(vel, dtype=float)\nsuper().__init__(group)\nself.radius = radius\nself.color = pygame.Color(color)\nself.image = pygame.Surface((2 * self.radius, 2 * self.radius), pygame.SRCALPHA)\npygame.draw.circle(self.image, self.color, (self.radius,... | <|body_start_0|>
self.mass = mass
self.pos = np.array(pos, dtype=float)
self.vel = np.array(vel, dtype=float)
super().__init__(group)
self.radius = radius
self.color = pygame.Color(color)
self.image = pygame.Surface((2 * self.radius, 2 * self.radius), pygame.SRCAL... | Represents a planet or a star. | Body | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Body:
"""Represents a planet or a star."""
def __init__(self, group, mass, pos, vel, radius, color='#2aff00'):
"""Creates a body with given parameters, adds it to the group of bodies."""
<|body_0|>
def update(self, window_size):
"""Moves the image of the body."""... | stack_v2_sparse_classes_75kplus_train_070544 | 4,451 | no_license | [
{
"docstring": "Creates a body with given parameters, adds it to the group of bodies.",
"name": "__init__",
"signature": "def __init__(self, group, mass, pos, vel, radius, color='#2aff00')"
},
{
"docstring": "Moves the image of the body.",
"name": "update",
"signature": "def update(self,... | 2 | stack_v2_sparse_classes_30k_train_030959 | Implement the Python class `Body` described below.
Class description:
Represents a planet or a star.
Method signatures and docstrings:
- def __init__(self, group, mass, pos, vel, radius, color='#2aff00'): Creates a body with given parameters, adds it to the group of bodies.
- def update(self, window_size): Moves the ... | Implement the Python class `Body` described below.
Class description:
Represents a planet or a star.
Method signatures and docstrings:
- def __init__(self, group, mass, pos, vel, radius, color='#2aff00'): Creates a body with given parameters, adds it to the group of bodies.
- def update(self, window_size): Moves the ... | 4b3c3ddc20ceb8c7693f526f684a2be1f8621397 | <|skeleton|>
class Body:
"""Represents a planet or a star."""
def __init__(self, group, mass, pos, vel, radius, color='#2aff00'):
"""Creates a body with given parameters, adds it to the group of bodies."""
<|body_0|>
def update(self, window_size):
"""Moves the image of the body."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Body:
"""Represents a planet or a star."""
def __init__(self, group, mass, pos, vel, radius, color='#2aff00'):
"""Creates a body with given parameters, adds it to the group of bodies."""
self.mass = mass
self.pos = np.array(pos, dtype=float)
self.vel = np.array(vel, dtype=... | the_stack_v2_python_sparse | lab8/body.py | python-practice-b02-006/tambovtsev | train | 0 |
e0a53901534e449ecc180b8056d3ab5d78a028ac | [
"ds = data_util.get_color_mnist_dataset(split='test', batch_size=100, shuffle=False, drop_remainder=False, buffer_size=1000)\ndata_dict = data_util.get_ds_data(ds)\nself.assertEqual(data_dict['inputs'].shape, (10000, 32, 32, 3))\nself.assertEqual(data_dict['labels'].shape, (10000,))",
"inputs = np.ones((100, 5), ... | <|body_start_0|>
ds = data_util.get_color_mnist_dataset(split='test', batch_size=100, shuffle=False, drop_remainder=False, buffer_size=1000)
data_dict = data_util.get_ds_data(ds)
self.assertEqual(data_dict['inputs'].shape, (10000, 32, 32, 3))
self.assertEqual(data_dict['labels'].shape, (... | Tests data util functions. | TestDataUtilFunctions | [
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDataUtilFunctions:
"""Tests data util functions."""
def test_get_ds_data(self):
"""Tests get_ds_data function."""
<|body_0|>
def test_construct_dataset(self):
"""Tests construct_dataset function."""
<|body_1|>
def test_construct_sub_dataset(self)... | stack_v2_sparse_classes_75kplus_train_070545 | 6,224 | permissive | [
{
"docstring": "Tests get_ds_data function.",
"name": "test_get_ds_data",
"signature": "def test_get_ds_data(self)"
},
{
"docstring": "Tests construct_dataset function.",
"name": "test_construct_dataset",
"signature": "def test_construct_dataset(self)"
},
{
"docstring": "Tests co... | 3 | stack_v2_sparse_classes_30k_train_039626 | Implement the Python class `TestDataUtilFunctions` described below.
Class description:
Tests data util functions.
Method signatures and docstrings:
- def test_get_ds_data(self): Tests get_ds_data function.
- def test_construct_dataset(self): Tests construct_dataset function.
- def test_construct_sub_dataset(self): Te... | Implement the Python class `TestDataUtilFunctions` described below.
Class description:
Tests data util functions.
Method signatures and docstrings:
- def test_get_ds_data(self): Tests get_ds_data function.
- def test_construct_dataset(self): Tests construct_dataset function.
- def test_construct_sub_dataset(self): Te... | c1ae273841592fce4c993bf35cdd0a6424e73da4 | <|skeleton|>
class TestDataUtilFunctions:
"""Tests data util functions."""
def test_get_ds_data(self):
"""Tests get_ds_data function."""
<|body_0|>
def test_construct_dataset(self):
"""Tests construct_dataset function."""
<|body_1|>
def test_construct_sub_dataset(self)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestDataUtilFunctions:
"""Tests data util functions."""
def test_get_ds_data(self):
"""Tests get_ds_data function."""
ds = data_util.get_color_mnist_dataset(split='test', batch_size=100, shuffle=False, drop_remainder=False, buffer_size=1000)
data_dict = data_util.get_ds_data(ds)
... | the_stack_v2_python_sparse | active_selective_prediction/utils/data_util_test.py | ishine/google-research | train | 0 |
a3ec11f21cf137454025e4ef75105c0bf6918407 | [
"self.root = SuffixTrieNode()\nfor i in range(len(text)):\n self.root.insert_suffix(text[i:], i)",
"indexes = self.root.search(pattern)\nif indexes is None:\n print('Pattern %r not found' % pattern)\n return None\nindices = ', '.join((str(i - len(pattern)) for i in indexes))\nprint('Pattern %r found at p... | <|body_start_0|>
self.root = SuffixTrieNode()
for i in range(len(text)):
self.root.insert_suffix(text[i:], i)
<|end_body_0|>
<|body_start_1|>
indexes = self.root.search(pattern)
if indexes is None:
print('Pattern %r not found' % pattern)
return None
... | Implements insert and search functionality in suffix trie. | SuffixTrie | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuffixTrie:
"""Implements insert and search functionality in suffix trie."""
def __init__(self, text):
"""Initializes and builds a trie of suffixes for given test string."""
<|body_0|>
def search(self, pattern):
"""Prints all occurrences of pattern in suffix trie... | stack_v2_sparse_classes_75kplus_train_070546 | 3,491 | no_license | [
{
"docstring": "Initializes and builds a trie of suffixes for given test string.",
"name": "__init__",
"signature": "def __init__(self, text)"
},
{
"docstring": "Prints all occurrences of pattern in suffix trie.",
"name": "search",
"signature": "def search(self, pattern)"
}
] | 2 | stack_v2_sparse_classes_30k_train_046580 | Implement the Python class `SuffixTrie` described below.
Class description:
Implements insert and search functionality in suffix trie.
Method signatures and docstrings:
- def __init__(self, text): Initializes and builds a trie of suffixes for given test string.
- def search(self, pattern): Prints all occurrences of p... | Implement the Python class `SuffixTrie` described below.
Class description:
Implements insert and search functionality in suffix trie.
Method signatures and docstrings:
- def __init__(self, text): Initializes and builds a trie of suffixes for given test string.
- def search(self, pattern): Prints all occurrences of p... | 062c628f5364414b257b7ba67c97999726128237 | <|skeleton|>
class SuffixTrie:
"""Implements insert and search functionality in suffix trie."""
def __init__(self, text):
"""Initializes and builds a trie of suffixes for given test string."""
<|body_0|>
def search(self, pattern):
"""Prints all occurrences of pattern in suffix trie... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SuffixTrie:
"""Implements insert and search functionality in suffix trie."""
def __init__(self, text):
"""Initializes and builds a trie of suffixes for given test string."""
self.root = SuffixTrieNode()
for i in range(len(text)):
self.root.insert_suffix(text[i:], i)
... | the_stack_v2_python_sparse | Level-3/pattern_matching_using_suffix_tries.py | hansrajdas/algorithms | train | 80 |
daaedc4d37aed9872e8e607cea152120df431497 | [
"super(ResBlk, self).__init__()\nself.conv1 = nn.Conv2d(ch_in, ch_out, kernel_size=3, stride=stride, padding=1)\nself.bn1 = nn.BatchNorm2d(ch_out)\nself.conv2 = nn.Conv2d(ch_out, ch_out, kernel_size=3, stride=1, padding=1)\nself.bn2 = nn.BatchNorm2d(ch_out)\nself.extra = nn.Sequential()\nif ch_out != ch_in:\n se... | <|body_start_0|>
super(ResBlk, self).__init__()
self.conv1 = nn.Conv2d(ch_in, ch_out, kernel_size=3, stride=stride, padding=1)
self.bn1 = nn.BatchNorm2d(ch_out)
self.conv2 = nn.Conv2d(ch_out, ch_out, kernel_size=3, stride=1, padding=1)
self.bn2 = nn.BatchNorm2d(ch_out)
se... | resnet block | ResBlk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResBlk:
"""resnet block"""
def __init__(self, ch_in, ch_out, stride=1):
""":param ch_in: :param ch_out:"""
<|body_0|>
def forward(self, x):
""":param x: [b, ch, h, w] :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(ResBlk, self)._... | stack_v2_sparse_classes_75kplus_train_070547 | 12,300 | no_license | [
{
"docstring": ":param ch_in: :param ch_out:",
"name": "__init__",
"signature": "def __init__(self, ch_in, ch_out, stride=1)"
},
{
"docstring": ":param x: [b, ch, h, w] :return:",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_046125 | Implement the Python class `ResBlk` described below.
Class description:
resnet block
Method signatures and docstrings:
- def __init__(self, ch_in, ch_out, stride=1): :param ch_in: :param ch_out:
- def forward(self, x): :param x: [b, ch, h, w] :return: | Implement the Python class `ResBlk` described below.
Class description:
resnet block
Method signatures and docstrings:
- def __init__(self, ch_in, ch_out, stride=1): :param ch_in: :param ch_out:
- def forward(self, x): :param x: [b, ch, h, w] :return:
<|skeleton|>
class ResBlk:
"""resnet block"""
def __init... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class ResBlk:
"""resnet block"""
def __init__(self, ch_in, ch_out, stride=1):
""":param ch_in: :param ch_out:"""
<|body_0|>
def forward(self, x):
""":param x: [b, ch, h, w] :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResBlk:
"""resnet block"""
def __init__(self, ch_in, ch_out, stride=1):
""":param ch_in: :param ch_out:"""
super(ResBlk, self).__init__()
self.conv1 = nn.Conv2d(ch_in, ch_out, kernel_size=3, stride=stride, padding=1)
self.bn1 = nn.BatchNorm2d(ch_out)
self.conv2 = n... | the_stack_v2_python_sparse | generated/test_dragen1860_Deep_Learning_with_PyTorch_Tutorials.py | jansel/pytorch-jit-paritybench | train | 35 |
f34e291d37e57dc602c62d47000df76508559087 | [
"self.mostVotedByTime = dict()\nself.mostVoted = dict()\nmaxVotes = 0\nperson = 0\nfor i, t in enumerate(times):\n if persons[i] not in self.mostVoted.keys():\n self.mostVoted[persons[i]] = 1\n else:\n self.mostVoted[persons[i]] += 1\n if maxVotes <= self.mostVoted[persons[i]]:\n maxVo... | <|body_start_0|>
self.mostVotedByTime = dict()
self.mostVoted = dict()
maxVotes = 0
person = 0
for i, t in enumerate(times):
if persons[i] not in self.mostVoted.keys():
self.mostVoted[persons[i]] = 1
else:
self.mostVoted[per... | TopVotedCandidate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.mostVotedByTime = dict()
... | stack_v2_sparse_classes_75kplus_train_070548 | 2,534 | no_license | [
{
"docstring": ":type persons: List[int] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, persons, times)"
},
{
"docstring": ":type t: int :rtype: int",
"name": "q",
"signature": "def q(self, t)"
}
] | 2 | stack_v2_sparse_classes_30k_train_045453 | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def q(self, t): :type t: int :rtype: int | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def q(self, t): :type t: int :rtype: int
<|skeleton|>
class TopVotedCandi... | 4d7e675c795c841f99ca95b8b60c4995bcb632fb | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
self.mostVotedByTime = dict()
self.mostVoted = dict()
maxVotes = 0
person = 0
for i, t in enumerate(times):
if persons[i] not in self.mostVot... | the_stack_v2_python_sparse | 911_Online Election.py | stephenchenxj/myLeetCode | train | 0 | |
381789bae6d2d87363a5e0c651b765565a2019c1 | [
"self.folder_base = folder\nsuper().__init__(folder, image_extension='JPG')\nif not self.explicit_extrinsics_paths:\n self.explicit_extrinsics_paths = self.__generate_extrinsics_from_reconstruction()",
"reconstruction_path = os.path.join(self.folder_base, 'reconstruction', 'data.mat')\nextrinsics_path_template... | <|body_start_0|>
self.folder_base = folder
super().__init__(folder, image_extension='JPG')
if not self.explicit_extrinsics_paths:
self.explicit_extrinsics_paths = self.__generate_extrinsics_from_reconstruction()
<|end_body_0|>
<|body_start_1|>
reconstruction_path = os.path.j... | Simple loader class that reads from a folder on disk. Folder layout structure: - RGB Images: images/ - Extrinsics data (optional): extrinsics/ - numpy array with the same name as images If explicit intrinsics are not provided, the exif data will be used. | LundDatasetLoader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LundDatasetLoader:
"""Simple loader class that reads from a folder on disk. Folder layout structure: - RGB Images: images/ - Extrinsics data (optional): extrinsics/ - numpy array with the same name as images If explicit intrinsics are not provided, the exif data will be used."""
def __init__... | stack_v2_sparse_classes_75kplus_train_070549 | 2,397 | permissive | [
{
"docstring": "Initialize object to load image data from a specified folder on disk Args: folder: the base folder for a given scene.",
"name": "__init__",
"signature": "def __init__(self, folder: str) -> None"
},
{
"docstring": "Extract extrinsics from mat file and stores them as numpy arrays. ... | 2 | stack_v2_sparse_classes_30k_train_002408 | Implement the Python class `LundDatasetLoader` described below.
Class description:
Simple loader class that reads from a folder on disk. Folder layout structure: - RGB Images: images/ - Extrinsics data (optional): extrinsics/ - numpy array with the same name as images If explicit intrinsics are not provided, the exif ... | Implement the Python class `LundDatasetLoader` described below.
Class description:
Simple loader class that reads from a folder on disk. Folder layout structure: - RGB Images: images/ - Extrinsics data (optional): extrinsics/ - numpy array with the same name as images If explicit intrinsics are not provided, the exif ... | 245fb4d90bf6d63d45af8f77a4debfe46ea52ff0 | <|skeleton|>
class LundDatasetLoader:
"""Simple loader class that reads from a folder on disk. Folder layout structure: - RGB Images: images/ - Extrinsics data (optional): extrinsics/ - numpy array with the same name as images If explicit intrinsics are not provided, the exif data will be used."""
def __init__... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LundDatasetLoader:
"""Simple loader class that reads from a folder on disk. Folder layout structure: - RGB Images: images/ - Extrinsics data (optional): extrinsics/ - numpy array with the same name as images If explicit intrinsics are not provided, the exif data will be used."""
def __init__(self, folder... | the_stack_v2_python_sparse | gtsfm/loader/lund_dataset_loader.py | asa/gtsfm | train | 0 |
1a377148a15c828d853b411460db5c68578e0a84 | [
"combined = {}\nfor key, value in (dict_1 or {}).items():\n combined[key] = value\nfor key, value in (dict_2 or {}).items():\n combined[key] = value\nreturn combined",
"optional_params = {}\nfor key, value in params.items():\n if value is not None:\n optional_params[key] = value\nreturn optional_p... | <|body_start_0|>
combined = {}
for key, value in (dict_1 or {}).items():
combined[key] = value
for key, value in (dict_2 or {}).items():
combined[key] = value
return combined
<|end_body_0|>
<|body_start_1|>
optional_params = {}
for key, value in p... | Utility functions | Utils | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Utils:
"""Utility functions"""
def combine_dicts(dict_1, dict_2):
"""Creates a new dictionary which is the union of two dictionaries with a shallow copy of the elements"""
<|body_0|>
def optional_params(params):
"""Creates a new dictionary by making a shallow cop... | stack_v2_sparse_classes_75kplus_train_070550 | 894 | permissive | [
{
"docstring": "Creates a new dictionary which is the union of two dictionaries with a shallow copy of the elements",
"name": "combine_dicts",
"signature": "def combine_dicts(dict_1, dict_2)"
},
{
"docstring": "Creates a new dictionary by making a shallow copy of an existing dictionary, but excl... | 2 | stack_v2_sparse_classes_30k_train_020578 | Implement the Python class `Utils` described below.
Class description:
Utility functions
Method signatures and docstrings:
- def combine_dicts(dict_1, dict_2): Creates a new dictionary which is the union of two dictionaries with a shallow copy of the elements
- def optional_params(params): Creates a new dictionary by... | Implement the Python class `Utils` described below.
Class description:
Utility functions
Method signatures and docstrings:
- def combine_dicts(dict_1, dict_2): Creates a new dictionary which is the union of two dictionaries with a shallow copy of the elements
- def optional_params(params): Creates a new dictionary by... | 9fcce0ef584151feefbfc7b5c259f6a7bcd7b5f3 | <|skeleton|>
class Utils:
"""Utility functions"""
def combine_dicts(dict_1, dict_2):
"""Creates a new dictionary which is the union of two dictionaries with a shallow copy of the elements"""
<|body_0|>
def optional_params(params):
"""Creates a new dictionary by making a shallow cop... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Utils:
"""Utility functions"""
def combine_dicts(dict_1, dict_2):
"""Creates a new dictionary which is the union of two dictionaries with a shallow copy of the elements"""
combined = {}
for key, value in (dict_1 or {}).items():
combined[key] = value
for key, va... | the_stack_v2_python_sparse | copyxnat/xnat_backend/utis.py | tomdoel/copyxnat | train | 1 |
5bbcb74042e434d67b2911ef4e3efb0e94777094 | [
"curr = self\nfor letter in word:\n if not curr.data:\n curr.data = {}\n if not curr.data.get(letter, None):\n curr.data[letter] = Trie()\n curr = curr.data[letter]\nelse:\n curr.endWord = True",
"flag = False\ncurr = self\nfor letter in partial:\n if not curr.data:\n break\n ... | <|body_start_0|>
curr = self
for letter in word:
if not curr.data:
curr.data = {}
if not curr.data.get(letter, None):
curr.data[letter] = Trie()
curr = curr.data[letter]
else:
curr.endWord = True
<|end_body_0|>
<|bo... | Trie | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trie:
def include(self, word):
"""Includes a word in the trie"""
<|body_0|>
def findPartial(self, partial):
"""Looks for a substring of a string in the trie"""
<|body_1|>
def countPartial(self, partial):
"""Counts the number of strings that conta... | stack_v2_sparse_classes_75kplus_train_070551 | 2,172 | no_license | [
{
"docstring": "Includes a word in the trie",
"name": "include",
"signature": "def include(self, word)"
},
{
"docstring": "Looks for a substring of a string in the trie",
"name": "findPartial",
"signature": "def findPartial(self, partial)"
},
{
"docstring": "Counts the number of ... | 3 | stack_v2_sparse_classes_30k_train_051563 | Implement the Python class `Trie` described below.
Class description:
Implement the Trie class.
Method signatures and docstrings:
- def include(self, word): Includes a word in the trie
- def findPartial(self, partial): Looks for a substring of a string in the trie
- def countPartial(self, partial): Counts the number ... | Implement the Python class `Trie` described below.
Class description:
Implement the Trie class.
Method signatures and docstrings:
- def include(self, word): Includes a word in the trie
- def findPartial(self, partial): Looks for a substring of a string in the trie
- def countPartial(self, partial): Counts the number ... | 6bcaf681ccdbf5a5557fd3fd4e9df357dc80c7a8 | <|skeleton|>
class Trie:
def include(self, word):
"""Includes a word in the trie"""
<|body_0|>
def findPartial(self, partial):
"""Looks for a substring of a string in the trie"""
<|body_1|>
def countPartial(self, partial):
"""Counts the number of strings that conta... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Trie:
def include(self, word):
"""Includes a word in the trie"""
curr = self
for letter in word:
if not curr.data:
curr.data = {}
if not curr.data.get(letter, None):
curr.data[letter] = Trie()
curr = curr.data[letter]
... | the_stack_v2_python_sparse | HackerRank/contacts.py | LFBianchi/pythonWs | train | 0 | |
d4c9a1af89607b2529b693978665c7443fbaf517 | [
"result = []\nArr = list(s1)\nif Arr:\n self.Permutation(0, Arr, result)\nprint(result)\nsize = len(s1)\nfor low in range(len(s2) - size):\n high = low + (size - 1)\n subS = s2[low:high + 1]\n if subS in result:\n return True\nreturn False",
"if i == len(Arr) - 1:\n temp = ''.join(Arr)\n ... | <|body_start_0|>
result = []
Arr = list(s1)
if Arr:
self.Permutation(0, Arr, result)
print(result)
size = len(s1)
for low in range(len(s2) - size):
high = low + (size - 1)
subS = s2[low:high + 1]
if subS in result:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
"""滑动窗口:判断是否包含排列(相当于双指针)"""
<|body_0|>
def Permutation(self, i, Arr, result):
"""DFS:字符串全排列,i可以理解为第i层"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
Arr = list(s1)
... | stack_v2_sparse_classes_75kplus_train_070552 | 1,873 | no_license | [
{
"docstring": "滑动窗口:判断是否包含排列(相当于双指针)",
"name": "checkInclusion",
"signature": "def checkInclusion(self, s1: str, s2: str) -> bool"
},
{
"docstring": "DFS:字符串全排列,i可以理解为第i层",
"name": "Permutation",
"signature": "def Permutation(self, i, Arr, result)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkInclusion(self, s1: str, s2: str) -> bool: 滑动窗口:判断是否包含排列(相当于双指针)
- def Permutation(self, i, Arr, result): DFS:字符串全排列,i可以理解为第i层 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkInclusion(self, s1: str, s2: str) -> bool: 滑动窗口:判断是否包含排列(相当于双指针)
- def Permutation(self, i, Arr, result): DFS:字符串全排列,i可以理解为第i层
<|skeleton|>
class Solution:
def che... | 4e4f739402b95691f6c91411da26d7d3bfe042b6 | <|skeleton|>
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
"""滑动窗口:判断是否包含排列(相当于双指针)"""
<|body_0|>
def Permutation(self, i, Arr, result):
"""DFS:字符串全排列,i可以理解为第i层"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
"""滑动窗口:判断是否包含排列(相当于双指针)"""
result = []
Arr = list(s1)
if Arr:
self.Permutation(0, Arr, result)
print(result)
size = len(s1)
for low in range(len(s2) - size):
high = lo... | the_stack_v2_python_sparse | leetcode/567.字符串的排列.py | hugechuanqi/Algorithms-and-Data-Structures | train | 3 | |
c50c6a34d2542123a1d42138e238ad2d9a697568 | [
"issue_template = IssueTemplate.objects.get(owner=owner, repo=repo)\nserializer = IssueTemplateSerializer(issue_template)\nreturn Response(serializer.data)",
"issue_template = IssueTemplate.objects.filter(owner=owner, repo=repo)\nif issue_template:\n serializer = IssueTemplateSerializer(issue_template[0])\n ... | <|body_start_0|>
issue_template = IssueTemplate.objects.get(owner=owner, repo=repo)
serializer = IssueTemplateSerializer(issue_template)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
issue_template = IssueTemplate.objects.filter(owner=owner, repo=repo)
if issu... | IssueTemplateView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IssueTemplateView:
def get(self, request, owner, repo, token_auth):
"""return if a repository issue template or not"""
<|body_0|>
def post(self, request, owner, repo, token_auth):
"""Post a new object"""
<|body_1|>
def put(self, request, owner, repo, tok... | stack_v2_sparse_classes_75kplus_train_070553 | 3,583 | permissive | [
{
"docstring": "return if a repository issue template or not",
"name": "get",
"signature": "def get(self, request, owner, repo, token_auth)"
},
{
"docstring": "Post a new object",
"name": "post",
"signature": "def post(self, request, owner, repo, token_auth)"
},
{
"docstring": "U... | 3 | stack_v2_sparse_classes_30k_train_043721 | Implement the Python class `IssueTemplateView` described below.
Class description:
Implement the IssueTemplateView class.
Method signatures and docstrings:
- def get(self, request, owner, repo, token_auth): return if a repository issue template or not
- def post(self, request, owner, repo, token_auth): Post a new obj... | Implement the Python class `IssueTemplateView` described below.
Class description:
Implement the IssueTemplateView class.
Method signatures and docstrings:
- def get(self, request, owner, repo, token_auth): return if a repository issue template or not
- def post(self, request, owner, repo, token_auth): Post a new obj... | 3f031eac9559a10fdcf70a88ee4c548cf93e4ac2 | <|skeleton|>
class IssueTemplateView:
def get(self, request, owner, repo, token_auth):
"""return if a repository issue template or not"""
<|body_0|>
def post(self, request, owner, repo, token_auth):
"""Post a new object"""
<|body_1|>
def put(self, request, owner, repo, tok... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IssueTemplateView:
def get(self, request, owner, repo, token_auth):
"""return if a repository issue template or not"""
issue_template = IssueTemplate.objects.get(owner=owner, repo=repo)
serializer = IssueTemplateSerializer(issue_template)
return Response(serializer.data)
d... | the_stack_v2_python_sparse | hubcare/metrics/community_metrics/issue_template/views.py | fga-eps-mds/2019.1-hubcare-api | train | 7 | |
7a76768f600a22465cfc08608bbc7dee71a9176d | [
"querier = wt_uu.CreateGenericWebTestQuerier()\nwith self.assertRaises(RuntimeError):\n querier._StripPrefixFromTestId('foobar')",
"querier = wt_uu.CreateGenericWebTestQuerier()\ntest_ids = [prefix + 'a' for prefix in queries.KNOWN_TEST_ID_PREFIXES]\nfor t in test_ids:\n stripped = querier._StripPrefixFromT... | <|body_start_0|>
querier = wt_uu.CreateGenericWebTestQuerier()
with self.assertRaises(RuntimeError):
querier._StripPrefixFromTestId('foobar')
<|end_body_0|>
<|body_start_1|>
querier = wt_uu.CreateGenericWebTestQuerier()
test_ids = [prefix + 'a' for prefix in queries.KNOWN_TE... | StripPrefixFromTestIdUnittest | [
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StripPrefixFromTestIdUnittest:
def testUnknownPrefix(self) -> None:
"""Tests that an error is raised if an unknown prefix is found."""
<|body_0|>
def testKnownPrefixes(self) -> None:
"""Tests that all known prefixes are properly stripped."""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus_train_070554 | 21,966 | permissive | [
{
"docstring": "Tests that an error is raised if an unknown prefix is found.",
"name": "testUnknownPrefix",
"signature": "def testUnknownPrefix(self) -> None"
},
{
"docstring": "Tests that all known prefixes are properly stripped.",
"name": "testKnownPrefixes",
"signature": "def testKnow... | 2 | stack_v2_sparse_classes_30k_train_039967 | Implement the Python class `StripPrefixFromTestIdUnittest` described below.
Class description:
Implement the StripPrefixFromTestIdUnittest class.
Method signatures and docstrings:
- def testUnknownPrefix(self) -> None: Tests that an error is raised if an unknown prefix is found.
- def testKnownPrefixes(self) -> None:... | Implement the Python class `StripPrefixFromTestIdUnittest` described below.
Class description:
Implement the StripPrefixFromTestIdUnittest class.
Method signatures and docstrings:
- def testUnknownPrefix(self) -> None: Tests that an error is raised if an unknown prefix is found.
- def testKnownPrefixes(self) -> None:... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class StripPrefixFromTestIdUnittest:
def testUnknownPrefix(self) -> None:
"""Tests that an error is raised if an unknown prefix is found."""
<|body_0|>
def testKnownPrefixes(self) -> None:
"""Tests that all known prefixes are properly stripped."""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StripPrefixFromTestIdUnittest:
def testUnknownPrefix(self) -> None:
"""Tests that an error is raised if an unknown prefix is found."""
querier = wt_uu.CreateGenericWebTestQuerier()
with self.assertRaises(RuntimeError):
querier._StripPrefixFromTestId('foobar')
def testK... | the_stack_v2_python_sparse | third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries_unittest.py | chromium/chromium | train | 17,408 | |
d4dc40bf7a332deec1897b906841d36346e50be3 | [
"try:\n fichier_reader = dossier_source.reader(self.nom_fichier)\n donnees_csv = []\n for ligne in fichier_reader:\n donnees_ligne = self.extraction_ligne(ligne)\n if donnees_ligne == -1:\n continue\n donnees_csv.append(donnees_ligne)\n self.donnees = donnees_csv[1:]\n ... | <|body_start_0|>
try:
fichier_reader = dossier_source.reader(self.nom_fichier)
donnees_csv = []
for ligne in fichier_reader:
donnees_ligne = self.extraction_ligne(ligne)
if donnees_ligne == -1:
continue
donne... | Classe de base des classes d'importation de données Attributs de classe (à définir dans les sous-classes) : nom_fichier Le nom relatif du fichier à charger libelle Un intitulé pour les messages d'erreur cles La liste des colonnes à charger | SubFichier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubFichier:
"""Classe de base des classes d'importation de données Attributs de classe (à définir dans les sous-classes) : nom_fichier Le nom relatif du fichier à charger libelle Un intitulé pour les messages d'erreur cles La liste des colonnes à charger"""
def __init__(self, dossier_source)... | stack_v2_sparse_classes_75kplus_train_070555 | 1,756 | no_license | [
{
"docstring": "initialisation et importation des données :param dossier_source: Une instance de la classe dossier.DossierSource",
"name": "__init__",
"signature": "def __init__(self, dossier_source)"
},
{
"docstring": "extracte une ligne de données du csv :param ligne: ligne lue du fichier :ret... | 2 | null | Implement the Python class `SubFichier` described below.
Class description:
Classe de base des classes d'importation de données Attributs de classe (à définir dans les sous-classes) : nom_fichier Le nom relatif du fichier à charger libelle Un intitulé pour les messages d'erreur cles La liste des colonnes à charger
Me... | Implement the Python class `SubFichier` described below.
Class description:
Classe de base des classes d'importation de données Attributs de classe (à définir dans les sous-classes) : nom_fichier Le nom relatif du fichier à charger libelle Un intitulé pour les messages d'erreur cles La liste des colonnes à charger
Me... | ad1f9ccb3f7b86688638b15888120ca72f8e10eb | <|skeleton|>
class SubFichier:
"""Classe de base des classes d'importation de données Attributs de classe (à définir dans les sous-classes) : nom_fichier Le nom relatif du fichier à charger libelle Un intitulé pour les messages d'erreur cles La liste des colonnes à charger"""
def __init__(self, dossier_source)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubFichier:
"""Classe de base des classes d'importation de données Attributs de classe (à définir dans les sous-classes) : nom_fichier Le nom relatif du fichier à charger libelle Un intitulé pour les messages d'erreur cles La liste des colonnes à charger"""
def __init__(self, dossier_source):
"""... | the_stack_v2_python_sparse | importes/subfichier.py | gusthiot/PySubsEl-V2 | train | 1 |
e4a1c5af29a56b044cbf7c464b3bb528461ba2be | [
"nlri_list = []\nwhile nlri_data:\n if nlri_data == b'\\x00\\x00':\n nlri_data = nlri_data[2:]\n continue\n if isinstance(nlri_data[0], int):\n prefix_bit_len = int(nlri_data[0])\n else:\n prefix_bit_len = ord(nlri_data[0:1])\n if prefix_bit_len % 8 == 0:\n prefix_byte... | <|body_start_0|>
nlri_list = []
while nlri_data:
if nlri_data == b'\x00\x00':
nlri_data = nlri_data[2:]
continue
if isinstance(nlri_data[0], int):
prefix_bit_len = int(nlri_data[0])
else:
prefix_bit_len =... | IPv6Unicast | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPv6Unicast:
def parse(cls, nlri_data):
"""decode IPv6 NLRI data :param nlri_data: NLRI raw hex data :return: return the results after decoding."""
<|body_0|>
def construct(cls, nlri_list):
"""Construct NLRI from list to hex data :param nlri_list: :return:"""
... | stack_v2_sparse_classes_75kplus_train_070556 | 2,596 | permissive | [
{
"docstring": "decode IPv6 NLRI data :param nlri_data: NLRI raw hex data :return: return the results after decoding.",
"name": "parse",
"signature": "def parse(cls, nlri_data)"
},
{
"docstring": "Construct NLRI from list to hex data :param nlri_list: :return:",
"name": "construct",
"sig... | 2 | null | Implement the Python class `IPv6Unicast` described below.
Class description:
Implement the IPv6Unicast class.
Method signatures and docstrings:
- def parse(cls, nlri_data): decode IPv6 NLRI data :param nlri_data: NLRI raw hex data :return: return the results after decoding.
- def construct(cls, nlri_list): Construct ... | Implement the Python class `IPv6Unicast` described below.
Class description:
Implement the IPv6Unicast class.
Method signatures and docstrings:
- def parse(cls, nlri_data): decode IPv6 NLRI data :param nlri_data: NLRI raw hex data :return: return the results after decoding.
- def construct(cls, nlri_list): Construct ... | 24cbb732d4380ab54d000ac08690e521c60d4f2a | <|skeleton|>
class IPv6Unicast:
def parse(cls, nlri_data):
"""decode IPv6 NLRI data :param nlri_data: NLRI raw hex data :return: return the results after decoding."""
<|body_0|>
def construct(cls, nlri_list):
"""Construct NLRI from list to hex data :param nlri_list: :return:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IPv6Unicast:
def parse(cls, nlri_data):
"""decode IPv6 NLRI data :param nlri_data: NLRI raw hex data :return: return the results after decoding."""
nlri_list = []
while nlri_data:
if nlri_data == b'\x00\x00':
nlri_data = nlri_data[2:]
continu... | the_stack_v2_python_sparse | yabgp/message/attribute/nlri/ipv6_unicast.py | smartbgp/yabgp | train | 227 | |
e538e26a3316f7b60fd55e220443cb05870a4bb3 | [
"if not s:\n return ''\nif len(s) == 1:\n return s\nret = ''\nfor i in range(len(s)):\n l = r = i\n while r < len(s) and s[l] == s[r]:\n r += 1\n if len(ret) < r - l:\n ret = s[l:r]\n l -= 1\n while l >= 0 and r < len(s) and (s[l] == s[r]):\n l -= 1\n r += 1\n if ... | <|body_start_0|>
if not s:
return ''
if len(s) == 1:
return s
ret = ''
for i in range(len(s)):
l = r = i
while r < len(s) and s[l] == s[r]:
r += 1
if len(ret) < r - l:
ret = s[l:r]
l -... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
"""Time complexity:O(N*N) Spave complexity:O(N) 验证通过,性能不错 Runtime: 728 ms, faster than 91.18% of Python3 online submissions for Longest Palindromic Substring. Memory Usage: 14.1 MB, less than 76.49% of Python3 online submissions for Longest Palin... | stack_v2_sparse_classes_75kplus_train_070557 | 3,775 | no_license | [
{
"docstring": "Time complexity:O(N*N) Spave complexity:O(N) 验证通过,性能不错 Runtime: 728 ms, faster than 91.18% of Python3 online submissions for Longest Palindromic Substring. Memory Usage: 14.1 MB, less than 76.49% of Python3 online submissions for Longest Palindromic Substring. :param s: :return:",
"name": "l... | 2 | stack_v2_sparse_classes_30k_train_005210 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): Time complexity:O(N*N) Spave complexity:O(N) 验证通过,性能不错 Runtime: 728 ms, faster than 91.18% of Python3 online submissions for Longest Palindromic S... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): Time complexity:O(N*N) Spave complexity:O(N) 验证通过,性能不错 Runtime: 728 ms, faster than 91.18% of Python3 online submissions for Longest Palindromic S... | 6a7267b8b784283a760de7775089b936a0e97617 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
"""Time complexity:O(N*N) Spave complexity:O(N) 验证通过,性能不错 Runtime: 728 ms, faster than 91.18% of Python3 online submissions for Longest Palindromic Substring. Memory Usage: 14.1 MB, less than 76.49% of Python3 online submissions for Longest Palin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestPalindrome(self, s):
"""Time complexity:O(N*N) Spave complexity:O(N) 验证通过,性能不错 Runtime: 728 ms, faster than 91.18% of Python3 online submissions for Longest Palindromic Substring. Memory Usage: 14.1 MB, less than 76.49% of Python3 online submissions for Longest Palindromic Substri... | the_stack_v2_python_sparse | leetcode/5_longest_palindromic_substring/longest_palindromic_substring.py | liuyanhui/leetcode-py | train | 0 | |
898cd9b4302787c91ff2a1e0a2233aafc65e601e | [
"maxNum = n + 1\ndp = [maxNum] * maxNum\ndp[0] = 0\nfor i in range(1, maxNum):\n dp[i] = min([dp[i - j * j] for j in range(1, int(i ** 0.5) + 1)]) + 1\nreturn dp[-1]",
"squares = [i * i for i in range(1, int(n ** 0.5) + 1)]\nd, q, nq = (1, {n}, set())\nwhile q:\n for node in q:\n for square in square... | <|body_start_0|>
maxNum = n + 1
dp = [maxNum] * maxNum
dp[0] = 0
for i in range(1, maxNum):
dp[i] = min([dp[i - j * j] for j in range(1, int(i ** 0.5) + 1)]) + 1
return dp[-1]
<|end_body_0|>
<|body_start_1|>
squares = [i * i for i in range(1, int(n ** 0.5) + ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . .... | stack_v2_sparse_classes_75kplus_train_070558 | 1,727 | no_license | [
{
"docstring": "Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . . . dp[13] = Min{ dp[13-1*1]+1, dp[13-2*2]+1, dp[13-3*3]+1 ... | 2 | stack_v2_sparse_classes_30k_train_002816 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n: int) -> int: Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n: int) -> int: Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def numSquares(self, n: int) -> int:
"""Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . .... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numSquares(self, n: int) -> int:
"""Use dynamic programming: dp[0] = 0 dp[1] = dp[0]+1 = 1 dp[2] = dp[1]+1 = 2 dp[3] = dp[2]+1 = 3 dp[4] = Min{ dp[4-1*1]+1, dp[4-2*2]+1 } = Min{ dp[3]+1, dp[0]+1 } = 1 dp[5] = Min{ dp[5-1*1]+1, dp[5-2*2]+1 } = Min{ dp[4]+1, dp[1]+1 } = 2 . . . dp[13] = Mi... | the_stack_v2_python_sparse | 2020/perfect_squares.py | eronekogin/leetcode | train | 0 | |
a833f577d1af2f695af5733b963a3b54dcc695d4 | [
"with self.Session() as session:\n obj = session.scalars(Obj.select(self.current_user).where(Obj.id == obj_id)).first()\n if obj is None:\n return self.error(f'Cannot find source with id \"{obj_id}\". ')\n stmt = sa.select(PhotStat).where(PhotStat.obj_id == obj_id)\n phot_stat = session.scalars(s... | <|body_start_0|>
with self.Session() as session:
obj = session.scalars(Obj.select(self.current_user).where(Obj.id == obj_id)).first()
if obj is None:
return self.error(f'Cannot find source with id "{obj_id}". ')
stmt = sa.select(PhotStat).where(PhotStat.obj_id... | PhotStatHandler | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhotStatHandler:
def get(self, obj_id=None):
"""--- description: retrieve the PhotStat associated with the obj_id. tags: - photometry parameters: - in: path name: obj_id required: true schema: type: string description: object ID to get statistics on responses: 200: content: application/j... | stack_v2_sparse_classes_75kplus_train_070559 | 27,539 | permissive | [
{
"docstring": "--- description: retrieve the PhotStat associated with the obj_id. tags: - photometry parameters: - in: path name: obj_id required: true schema: type: string description: object ID to get statistics on responses: 200: content: application/json: schema: PhotStat 400: content: application/json: sc... | 4 | stack_v2_sparse_classes_30k_test_002223 | Implement the Python class `PhotStatHandler` described below.
Class description:
Implement the PhotStatHandler class.
Method signatures and docstrings:
- def get(self, obj_id=None): --- description: retrieve the PhotStat associated with the obj_id. tags: - photometry parameters: - in: path name: obj_id required: true... | Implement the Python class `PhotStatHandler` described below.
Class description:
Implement the PhotStatHandler class.
Method signatures and docstrings:
- def get(self, obj_id=None): --- description: retrieve the PhotStat associated with the obj_id. tags: - photometry parameters: - in: path name: obj_id required: true... | 161d3532ba3ba059446addcdac58ca96f39e9636 | <|skeleton|>
class PhotStatHandler:
def get(self, obj_id=None):
"""--- description: retrieve the PhotStat associated with the obj_id. tags: - photometry parameters: - in: path name: obj_id required: true schema: type: string description: object ID to get statistics on responses: 200: content: application/j... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhotStatHandler:
def get(self, obj_id=None):
"""--- description: retrieve the PhotStat associated with the obj_id. tags: - photometry parameters: - in: path name: obj_id required: true schema: type: string description: object ID to get statistics on responses: 200: content: application/json: schema: P... | the_stack_v2_python_sparse | skyportal/handlers/api/phot_stat.py | skyportal/skyportal | train | 80 | |
9d30580d978c8e065762f9e64511abdd5f52db37 | [
"if self.context['vote_type'] == 'upvote':\n if AnswerUpVoteRelation.objects.filter(user=self.context['request'].user, answer=value).exists():\n raise serializers.ValidationError('이미 추천한 답변입니다.')\n return value\nelif self.context['vote_type'] == 'downvote':\n if AnswerDownVoteRelation.objects.filter... | <|body_start_0|>
if self.context['vote_type'] == 'upvote':
if AnswerUpVoteRelation.objects.filter(user=self.context['request'].user, answer=value).exists():
raise serializers.ValidationError('이미 추천한 답변입니다.')
return value
elif self.context['vote_type'] == 'downvote... | 답변 추천/비추천을 위한 Serializer | AnswerVoteRelationSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnswerVoteRelationSerializer:
"""답변 추천/비추천을 위한 Serializer"""
def validate_answer(self, value):
"""이미 추천/비추천한 답변인지 확인"""
<|body_0|>
def create(self, validated_data):
"""추천/비추천 모두 AnswerVoteRelationSerializer를 공통으로 사용하게 하기 위해서, APIView에서 어떤 분야인지를 판별해주는, self.contex... | stack_v2_sparse_classes_75kplus_train_070560 | 1,976 | no_license | [
{
"docstring": "이미 추천/비추천한 답변인지 확인",
"name": "validate_answer",
"signature": "def validate_answer(self, value)"
},
{
"docstring": "추천/비추천 모두 AnswerVoteRelationSerializer를 공통으로 사용하게 하기 위해서, APIView에서 어떤 분야인지를 판별해주는, self.context['vote_type']을 받아옴",
"name": "create",
"signature": "def crea... | 2 | null | Implement the Python class `AnswerVoteRelationSerializer` described below.
Class description:
답변 추천/비추천을 위한 Serializer
Method signatures and docstrings:
- def validate_answer(self, value): 이미 추천/비추천한 답변인지 확인
- def create(self, validated_data): 추천/비추천 모두 AnswerVoteRelationSerializer를 공통으로 사용하게 하기 위해서, APIView에서 어떤 분야인... | Implement the Python class `AnswerVoteRelationSerializer` described below.
Class description:
답변 추천/비추천을 위한 Serializer
Method signatures and docstrings:
- def validate_answer(self, value): 이미 추천/비추천한 답변인지 확인
- def create(self, validated_data): 추천/비추천 모두 AnswerVoteRelationSerializer를 공통으로 사용하게 하기 위해서, APIView에서 어떤 분야인... | 399064b62a7c8049b37efd77a98f17a903754070 | <|skeleton|>
class AnswerVoteRelationSerializer:
"""답변 추천/비추천을 위한 Serializer"""
def validate_answer(self, value):
"""이미 추천/비추천한 답변인지 확인"""
<|body_0|>
def create(self, validated_data):
"""추천/비추천 모두 AnswerVoteRelationSerializer를 공통으로 사용하게 하기 위해서, APIView에서 어떤 분야인지를 판별해주는, self.contex... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnswerVoteRelationSerializer:
"""답변 추천/비추천을 위한 Serializer"""
def validate_answer(self, value):
"""이미 추천/비추천한 답변인지 확인"""
if self.context['vote_type'] == 'upvote':
if AnswerUpVoteRelation.objects.filter(user=self.context['request'].user, answer=value).exists():
r... | the_stack_v2_python_sparse | nanum/users/serializers/relation/vote.py | markui/nanum-project | train | 1 |
cf54d9bf5a263143aaa8bcd2b00dc7d57e3b251a | [
"if self.request.version == 'v6':\n return BatchDetailsSerializerV6\nelif self.request.version == 'v7':\n return BatchDetailsSerializerV6",
"if request.version == 'v6':\n return self._retrieve_v6(batch_id)\nelif request.version == 'v7':\n return self._retrieve_v6(batch_id)\nraise Http404()",
"if req... | <|body_start_0|>
if self.request.version == 'v6':
return BatchDetailsSerializerV6
elif self.request.version == 'v7':
return BatchDetailsSerializerV6
<|end_body_0|>
<|body_start_1|>
if request.version == 'v6':
return self._retrieve_v6(batch_id)
elif re... | This view is the endpoint for a specific batch | BatchDetailsView | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchDetailsView:
"""This view is the endpoint for a specific batch"""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API"""
<|body_0|>
def retrieve(self, request, batch_id):
"""Retrieves the detai... | stack_v2_sparse_classes_75kplus_train_070561 | 14,601 | permissive | [
{
"docstring": "Returns the appropriate serializer based off the requests version of the REST API",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "Retrieves the details for a batch and returns them in JSON form :param request: the HTTP GET reques... | 5 | stack_v2_sparse_classes_30k_train_026066 | Implement the Python class `BatchDetailsView` described below.
Class description:
This view is the endpoint for a specific batch
Method signatures and docstrings:
- def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API
- def retrieve(self, request, batch_id)... | Implement the Python class `BatchDetailsView` described below.
Class description:
This view is the endpoint for a specific batch
Method signatures and docstrings:
- def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API
- def retrieve(self, request, batch_id)... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class BatchDetailsView:
"""This view is the endpoint for a specific batch"""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API"""
<|body_0|>
def retrieve(self, request, batch_id):
"""Retrieves the detai... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BatchDetailsView:
"""This view is the endpoint for a specific batch"""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API"""
if self.request.version == 'v6':
return BatchDetailsSerializerV6
elif self.req... | the_stack_v2_python_sparse | scale/batch/views.py | kfconsultant/scale | train | 0 |
fdd278d93cd72a5aa76e8e87cbb2c1125ff4dce8 | [
"def get_kth(num1, start1, nums2, start2, k):\n if start1 >= len(nums1):\n return nums2[start2 + k - 1]\n if start2 >= len(nums2):\n return nums1[start1 + k - 1]\n if k == 1:\n return min(nums1[start1], nums2[start2])\n mid1, mid2 = (float('inf'), float('inf'))\n if start1 + k //... | <|body_start_0|>
def get_kth(num1, start1, nums2, start2, k):
if start1 >= len(nums1):
return nums2[start2 + k - 1]
if start2 >= len(nums2):
return nums1[start1 + k - 1]
if k == 1:
return min(nums1[start1], nums2[start2])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMedianSortedArrays(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: float"""
<|body_0|>
def findMedianSortedArrays_v2(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: float"""
<|body_... | stack_v2_sparse_classes_75kplus_train_070562 | 6,196 | no_license | [
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float",
"name": "findMedianSortedArrays",
"signature": "def findMedianSortedArrays(self, nums1, nums2)"
},
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float",
"name": "findMedianSortedArrays_v2",
... | 4 | stack_v2_sparse_classes_30k_train_024434 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float
- def findMedianSortedArrays_v2(self, nums1, nums2): :type nums1: List... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float
- def findMedianSortedArrays_v2(self, nums1, nums2): :type nums1: List... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def findMedianSortedArrays(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: float"""
<|body_0|>
def findMedianSortedArrays_v2(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: float"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findMedianSortedArrays(self, nums1, nums2):
""":type nums1: List[int] :type nums2: List[int] :rtype: float"""
def get_kth(num1, start1, nums2, start2, k):
if start1 >= len(nums1):
return nums2[start2 + k - 1]
if start2 >= len(nums2):
... | the_stack_v2_python_sparse | src/lt_4.py | oxhead/CodingYourWay | train | 0 | |
287e0a912440098489d420c807f79bae48e26798 | [
"lHead, lTail, rHead, rTail = (None, None, None, None)\nwhile head:\n if head.val < x:\n if lHead == None:\n lHead = head\n lTail = head\n else:\n lTail.next = head\n lTail = lTail.next\n elif rHead == None:\n rHead = head\n rTail = head\... | <|body_start_0|>
lHead, lTail, rHead, rTail = (None, None, None, None)
while head:
if head.val < x:
if lHead == None:
lHead = head
lTail = head
else:
lTail.next = head
lTail = lTai... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_0|>
def partition2(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
lHead, l... | stack_v2_sparse_classes_75kplus_train_070563 | 1,836 | no_license | [
{
"docstring": ":type head: ListNode :type x: int :rtype: ListNode",
"name": "partition",
"signature": "def partition(self, head, x)"
},
{
"docstring": ":type head: ListNode :type x: int :rtype: ListNode",
"name": "partition2",
"signature": "def partition2(self, head, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011537 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
- def partition2(self, head, x): :type head: ListNode :type x: int :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
- def partition2(self, head, x): :type head: ListNode :type x: int :rtype: ListNode
<|skeleton|>... | ab49373ff3fc306a03a90de02e1801b8cbe520d7 | <|skeleton|>
class Solution:
def partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_0|>
def partition2(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def partition(self, head, x):
""":type head: ListNode :type x: int :rtype: ListNode"""
lHead, lTail, rHead, rTail = (None, None, None, None)
while head:
if head.val < x:
if lHead == None:
lHead = head
lTail =... | the_stack_v2_python_sparse | explore/list/086.py | yiguid/LeetCodePractise | train | 0 | |
0da3f1f9f427925576cb578dfc55922db7e5b4d9 | [
"json_data = {'method': 'core.playback.get_state', 'jsonrpc': '2.0', 'prams': {}, 'id': 1}\npayload = json.dumps(json_data)\ntry:\n ret = requests.post('http://127.0.0.1:6680/mopidy/rpc', headers={'Content-Type': 'application/json'}, data=payload)\nexcept requests.exceptions.ConnectionError:\n raise MopidyErr... | <|body_start_0|>
json_data = {'method': 'core.playback.get_state', 'jsonrpc': '2.0', 'prams': {}, 'id': 1}
payload = json.dumps(json_data)
try:
ret = requests.post('http://127.0.0.1:6680/mopidy/rpc', headers={'Content-Type': 'application/json'}, data=payload)
except requests.... | Mopidy music player. | MopidyPlayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MopidyPlayer:
"""Mopidy music player."""
def is_playing():
"""Check if currently playing."""
<|body_0|>
def pause():
"""Play."""
<|body_1|>
def play():
"""Play."""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
json_data = {'m... | stack_v2_sparse_classes_75kplus_train_070564 | 2,474 | permissive | [
{
"docstring": "Check if currently playing.",
"name": "is_playing",
"signature": "def is_playing()"
},
{
"docstring": "Play.",
"name": "pause",
"signature": "def pause()"
},
{
"docstring": "Play.",
"name": "play",
"signature": "def play()"
}
] | 3 | null | Implement the Python class `MopidyPlayer` described below.
Class description:
Mopidy music player.
Method signatures and docstrings:
- def is_playing(): Check if currently playing.
- def pause(): Play.
- def play(): Play. | Implement the Python class `MopidyPlayer` described below.
Class description:
Mopidy music player.
Method signatures and docstrings:
- def is_playing(): Check if currently playing.
- def pause(): Play.
- def play(): Play.
<|skeleton|>
class MopidyPlayer:
"""Mopidy music player."""
def is_playing():
... | d088479b59ee2a68ca157d5e8896bdd49f4534c5 | <|skeleton|>
class MopidyPlayer:
"""Mopidy music player."""
def is_playing():
"""Check if currently playing."""
<|body_0|>
def pause():
"""Play."""
<|body_1|>
def play():
"""Play."""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MopidyPlayer:
"""Mopidy music player."""
def is_playing():
"""Check if currently playing."""
json_data = {'method': 'core.playback.get_state', 'jsonrpc': '2.0', 'prams': {}, 'id': 1}
payload = json.dumps(json_data)
try:
ret = requests.post('http://127.0.0.1:668... | the_stack_v2_python_sparse | scoreboard/util/mopidy.py | brunosmmm/chainball-sboard | train | 0 |
c0899e6908d17fa420db081ab048060a047e6149 | [
"super(PostProcessor, self).__init__()\nself.score_thresh = score_thresh\nself.nms = nms\nself.detections_per_img = detections_per_img\nif box_coder is None:\n box_coder = BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))\nself.box_coder = box_coder\nself.cls_agnostic_bbox_reg = cls_agnostic_bbox_reg\nself.bbox_aug_enabl... | <|body_start_0|>
super(PostProcessor, self).__init__()
self.score_thresh = score_thresh
self.nms = nms
self.detections_per_img = detections_per_img
if box_coder is None:
box_coder = BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))
self.box_coder = box_coder
se... | From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results | PostProcessor | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostProcessor:
"""From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results"""
def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, bbox_aug_... | stack_v2_sparse_classes_75kplus_train_070565 | 7,298 | permissive | [
{
"docstring": "Arguments: score_thresh (float) nms (float) detections_per_img (int) box_coder (BoxCoder)",
"name": "__init__",
"signature": "def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, bbox_aug_enabled=False)"
},
{
"docstri... | 4 | null | Implement the Python class `PostProcessor` described below.
Class description:
From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results
Method signatures and docstrings:
- def __init__(self, score_thresh=0.05, nms=0.5, detections... | Implement the Python class `PostProcessor` described below.
Class description:
From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results
Method signatures and docstrings:
- def __init__(self, score_thresh=0.05, nms=0.5, detections... | 9304c9f59fde013f158ac338fc80171c0e8cda5d | <|skeleton|>
class PostProcessor:
"""From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results"""
def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, bbox_aug_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PostProcessor:
"""From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results"""
def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, bbox_aug_enabled=False... | the_stack_v2_python_sparse | models/object_detection/pytorch/maskrcnn/maskrcnn-benchmark/maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py | IntelAI/models | train | 609 |
4857aa54f2a310f63bc63e1a319873d919846cf9 | [
"payload = {'token': self._token}\nif cursor is not None:\n payload['cursor'] = cursor\nif limit is not None:\n payload['limit'] = limit\nreturn self._get('apps.permissions.users.list', payload=payload, **kwargs)",
"if scopes is not None:\n scopes = comma_separated_string(scopes)\npayload = {'token': sel... | <|body_start_0|>
payload = {'token': self._token}
if cursor is not None:
payload['cursor'] = cursor
if limit is not None:
payload['limit'] = limit
return self._get('apps.permissions.users.list', payload=payload, **kwargs)
<|end_body_0|>
<|body_start_1|>
i... | Users | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Users:
def list(self, cursor: str=None, limit: int=None, **kwargs) -> Response:
"""Returns list of user grants and corresponding scopes this app has on a team. https://api.slack.com/methods/apps.permissions.users.list :param token: Authentication token bearing required scopes. :type str:... | stack_v2_sparse_classes_75kplus_train_070566 | 11,913 | permissive | [
{
"docstring": "Returns list of user grants and corresponding scopes this app has on a team. https://api.slack.com/methods/apps.permissions.users.list :param token: Authentication token bearing required scopes. :type str: e.g. xxxx-xxxxxxxxx-xxxx :param cursor: Paginate through collections of data by setting th... | 2 | null | Implement the Python class `Users` described below.
Class description:
Implement the Users class.
Method signatures and docstrings:
- def list(self, cursor: str=None, limit: int=None, **kwargs) -> Response: Returns list of user grants and corresponding scopes this app has on a team. https://api.slack.com/methods/apps... | Implement the Python class `Users` described below.
Class description:
Implement the Users class.
Method signatures and docstrings:
- def list(self, cursor: str=None, limit: int=None, **kwargs) -> Response: Returns list of user grants and corresponding scopes this app has on a team. https://api.slack.com/methods/apps... | c40be4854a26084e1a368a975e220d613c14d8d8 | <|skeleton|>
class Users:
def list(self, cursor: str=None, limit: int=None, **kwargs) -> Response:
"""Returns list of user grants and corresponding scopes this app has on a team. https://api.slack.com/methods/apps.permissions.users.list :param token: Authentication token bearing required scopes. :type str:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Users:
def list(self, cursor: str=None, limit: int=None, **kwargs) -> Response:
"""Returns list of user grants and corresponding scopes this app has on a team. https://api.slack.com/methods/apps.permissions.users.list :param token: Authentication token bearing required scopes. :type str: e.g. xxxx-xxx... | the_stack_v2_python_sparse | slack_time/methods/apps.py | jackwardell/SlackTime | train | 2 | |
51b556ae5268bd51fc2bcc206b0b3cf2f0eb27c6 | [
"super(PredictDataset, self).__init__(fp, fr, standardize_proteins, standardize_rnas, verbose)\nself.to_predict = to_predict\nif self.to_predict is not None:\n self.Fp = self.Fp[self.to_predict]",
"if self.verbose:\n print('\\nPreparing dataset (%d protein%s and %d RNA%s)...' % (self.Fp.shape[1], (self.Fp.s... | <|body_start_0|>
super(PredictDataset, self).__init__(fp, fr, standardize_proteins, standardize_rnas, verbose)
self.to_predict = to_predict
if self.to_predict is not None:
self.Fp = self.Fp[self.to_predict]
<|end_body_0|>
<|body_start_1|>
if self.verbose:
print('... | Test dataset. | PredictDataset | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PredictDataset:
"""Test dataset."""
def __init__(self, fp, fr, to_predict=None, standardize_proteins=False, standardize_rnas=False, verbose=True):
"""Constructor. Parameters ---------- fp : str The name of the HDF5 file containing features for the proteins. fr : str The name of the H... | stack_v2_sparse_classes_75kplus_train_070567 | 9,073 | permissive | [
{
"docstring": "Constructor. Parameters ---------- fp : str The name of the HDF5 file containing features for the proteins. fr : str The name of the HDF5 file containing features for the RNAs. to_predict : list (default : None) List of proteins from Fp to predict. If None all the proteins will be predicted. sta... | 2 | stack_v2_sparse_classes_30k_train_013055 | Implement the Python class `PredictDataset` described below.
Class description:
Test dataset.
Method signatures and docstrings:
- def __init__(self, fp, fr, to_predict=None, standardize_proteins=False, standardize_rnas=False, verbose=True): Constructor. Parameters ---------- fp : str The name of the HDF5 file contain... | Implement the Python class `PredictDataset` described below.
Class description:
Test dataset.
Method signatures and docstrings:
- def __init__(self, fp, fr, to_predict=None, standardize_proteins=False, standardize_rnas=False, verbose=True): Constructor. Parameters ---------- fp : str The name of the HDF5 file contain... | 840007ae9da2bb89ba5a60769e3bc885579c0a39 | <|skeleton|>
class PredictDataset:
"""Test dataset."""
def __init__(self, fp, fr, to_predict=None, standardize_proteins=False, standardize_rnas=False, verbose=True):
"""Constructor. Parameters ---------- fp : str The name of the HDF5 file containing features for the proteins. fr : str The name of the H... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PredictDataset:
"""Test dataset."""
def __init__(self, fp, fr, to_predict=None, standardize_proteins=False, standardize_rnas=False, verbose=True):
"""Constructor. Parameters ---------- fp : str The name of the HDF5 file containing features for the proteins. fr : str The name of the HDF5 file cont... | the_stack_v2_python_sparse | rnacommender/data.py | xflicsu/RNAcommender | train | 0 |
6d881277323a483bee20d73cf88984d82a7318e3 | [
"exec(self__.remove_indent(txt__).replace('\\r\\n', '\\n'))\nD = dict(locals())\ndel D['txt__']\ndel D['section__']\ndel D['self__']\nreturn D",
"L = []\ntxt_ = txt_.replace('\\t', ' ' * 4)\nfor line in txt_.split('\\n'):\n if not line[:4].strip():\n line = line[4:]\n L.append(line)\nreturn '\\n'.joi... | <|body_start_0|>
exec(self__.remove_indent(txt__).replace('\r\n', '\n'))
D = dict(locals())
del D['txt__']
del D['section__']
del D['self__']
return D
<|end_body_0|>
<|body_start_1|>
L = []
txt_ = txt_.replace('\t', ' ' * 4)
for line in txt_.split... | Read "Python" INI Files | ReadPyIni | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReadPyIni:
"""Read "Python" INI Files"""
def process_section(self__, section__, txt__):
"""Convert the variables in evaluable `txt_` to a dict Read a .pyini file (section contents have an optional single indent), i.e. ['section 1', 'section2'] my_variable = range(2) -> {'section 1': ... | stack_v2_sparse_classes_75kplus_train_070568 | 1,176 | permissive | [
{
"docstring": "Convert the variables in evaluable `txt_` to a dict Read a .pyini file (section contents have an optional single indent), i.e. ['section 1', 'section2'] my_variable = range(2) -> {'section 1': {'my_variable': [0, 1, 2]}, 'section 2': {'my_variable': [0, 1, 2]}} (any python expression is allowed)... | 2 | null | Implement the Python class `ReadPyIni` described below.
Class description:
Read "Python" INI Files
Method signatures and docstrings:
- def process_section(self__, section__, txt__): Convert the variables in evaluable `txt_` to a dict Read a .pyini file (section contents have an optional single indent), i.e. ['section... | Implement the Python class `ReadPyIni` described below.
Class description:
Read "Python" INI Files
Method signatures and docstrings:
- def process_section(self__, section__, txt__): Convert the variables in evaluable `txt_` to a dict Read a .pyini file (section contents have an optional single indent), i.e. ['section... | 93a70ece896eaaea9bfcd32de52b21c16aad8e65 | <|skeleton|>
class ReadPyIni:
"""Read "Python" INI Files"""
def process_section(self__, section__, txt__):
"""Convert the variables in evaluable `txt_` to a dict Read a .pyini file (section contents have an optional single indent), i.e. ['section 1', 'section2'] my_variable = range(2) -> {'section 1': ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReadPyIni:
"""Read "Python" INI Files"""
def process_section(self__, section__, txt__):
"""Convert the variables in evaluable `txt_` to a dict Read a .pyini file (section contents have an optional single indent), i.e. ['section 1', 'section2'] my_variable = range(2) -> {'section 1': {'my_variable... | the_stack_v2_python_sparse | speedysvc/toolkit/py_ini/read/ReadPyIni.py | mcyph/speedysvc | train | 9 |
47a2344dde34deb1af4a49840057086e5567530e | [
"super().__init__()\nlogger.debug('Create PaddleVectorConnectionHandler to process the vector request')\nself.vector_engine = vector_engine\nself.executor = self.vector_engine.executor\nself.task = self.vector_engine.executor.task\nself.model = self.vector_engine.executor.model\nself.config = self.vector_engine.exe... | <|body_start_0|>
super().__init__()
logger.debug('Create PaddleVectorConnectionHandler to process the vector request')
self.vector_engine = vector_engine
self.executor = self.vector_engine.executor
self.task = self.vector_engine.executor.task
self.model = self.vector_engi... | PaddleVectorConnectionHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaddleVectorConnectionHandler:
def __init__(self, vector_engine):
"""The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine"""
<|body_0|>
def run(self, audio_data, task='spk'):
... | stack_v2_sparse_classes_75kplus_train_070569 | 7,306 | permissive | [
{
"docstring": "The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine",
"name": "__init__",
"signature": "def __init__(self, vector_engine)"
},
{
"docstring": "The connection process the http request a... | 4 | stack_v2_sparse_classes_30k_train_049899 | Implement the Python class `PaddleVectorConnectionHandler` described below.
Class description:
Implement the PaddleVectorConnectionHandler class.
Method signatures and docstrings:
- def __init__(self, vector_engine): The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: ... | Implement the Python class `PaddleVectorConnectionHandler` described below.
Class description:
Implement the PaddleVectorConnectionHandler class.
Method signatures and docstrings:
- def __init__(self, vector_engine): The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: ... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class PaddleVectorConnectionHandler:
def __init__(self, vector_engine):
"""The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine"""
<|body_0|>
def run(self, audio_data, task='spk'):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PaddleVectorConnectionHandler:
def __init__(self, vector_engine):
"""The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine"""
super().__init__()
logger.debug('Create PaddleVectorConnectionHan... | the_stack_v2_python_sparse | paddlespeech/server/engine/vector/python/vector_engine.py | anniyanvr/DeepSpeech-1 | train | 0 | |
1781283123fc6f0b588685d198934d84a15dea34 | [
"if os.path.exists(path):\n return path\nelif os.access(os.path.dirname(path), os.W_OK):\n return path\nraise argparse.ArgumentTypeError('%s is an invalid file path' % path)",
"if os.path.splitext(path)[-1].lower() != 'pdf':\n path = path + '.pdf'\nreturn Validator.ValidatePath(path)",
"ival = int(val)... | <|body_start_0|>
if os.path.exists(path):
return path
elif os.access(os.path.dirname(path), os.W_OK):
return path
raise argparse.ArgumentTypeError('%s is an invalid file path' % path)
<|end_body_0|>
<|body_start_1|>
if os.path.splitext(path)[-1].lower() != 'pdf':... | A helper class with validation methods for argparse. | Validator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Validator:
"""A helper class with validation methods for argparse."""
def ValidatePath(path):
"""An argparse validation method to make sure a file path is writable."""
<|body_0|>
def ValidatePdfPath(path):
"""An argparse validation method to make sure a pdf file ... | stack_v2_sparse_classes_75kplus_train_070570 | 36,701 | permissive | [
{
"docstring": "An argparse validation method to make sure a file path is writable.",
"name": "ValidatePath",
"signature": "def ValidatePath(path)"
},
{
"docstring": "An argparse validation method to make sure a pdf file path is writable. Validates a file path to make sure it is writable and als... | 3 | stack_v2_sparse_classes_30k_train_030299 | Implement the Python class `Validator` described below.
Class description:
A helper class with validation methods for argparse.
Method signatures and docstrings:
- def ValidatePath(path): An argparse validation method to make sure a file path is writable.
- def ValidatePdfPath(path): An argparse validation method to ... | Implement the Python class `Validator` described below.
Class description:
A helper class with validation methods for argparse.
Method signatures and docstrings:
- def ValidatePath(path): An argparse validation method to make sure a file path is writable.
- def ValidatePdfPath(path): An argparse validation method to ... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class Validator:
"""A helper class with validation methods for argparse."""
def ValidatePath(path):
"""An argparse validation method to make sure a file path is writable."""
<|body_0|>
def ValidatePdfPath(path):
"""An argparse validation method to make sure a pdf file ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Validator:
"""A helper class with validation methods for argparse."""
def ValidatePath(path):
"""An argparse validation method to make sure a file path is writable."""
if os.path.exists(path):
return path
elif os.access(os.path.dirname(path), os.W_OK):
retu... | the_stack_v2_python_sparse | tools/android/appstats.py | chromium/chromium | train | 17,408 |
3feea7c6b1ede24f6ed8f7f2943916e3d3d1abce | [
"self.alphabet = alphabet\nif key is None:\n key = random.randint(0, len(alphabet) - 1)\nelif key != key % (len(alphabet) + 1):\n raise CryptographyException\nself.key = key",
"cipher_message = ''\nfor letter in message:\n if letter in self.alphabet:\n pos = self.alphabet.find(letter)\n cip... | <|body_start_0|>
self.alphabet = alphabet
if key is None:
key = random.randint(0, len(alphabet) - 1)
elif key != key % (len(alphabet) + 1):
raise CryptographyException
self.key = key
<|end_body_0|>
<|body_start_1|>
cipher_message = ''
for letter i... | Caesar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Caesar:
def __init__(self, alphabet, key=None):
"""Constructor de clase que tiene como parámetro todos los atributos que necesita el algoritmo de cifrado de César. Parámetro: alphabet -- el alfabeto sobre quien se cifra el mensaje. key -- el tamaño del desplazamiento sobre el alfabeto, s... | stack_v2_sparse_classes_75kplus_train_070571 | 1,992 | no_license | [
{
"docstring": "Constructor de clase que tiene como parámetro todos los atributos que necesita el algoritmo de cifrado de César. Parámetro: alphabet -- el alfabeto sobre quien se cifra el mensaje. key -- el tamaño del desplazamiento sobre el alfabeto, si es None, se debe de escoger una llave aleatoria, válida."... | 3 | stack_v2_sparse_classes_30k_train_050662 | Implement the Python class `Caesar` described below.
Class description:
Implement the Caesar class.
Method signatures and docstrings:
- def __init__(self, alphabet, key=None): Constructor de clase que tiene como parámetro todos los atributos que necesita el algoritmo de cifrado de César. Parámetro: alphabet -- el alf... | Implement the Python class `Caesar` described below.
Class description:
Implement the Caesar class.
Method signatures and docstrings:
- def __init__(self, alphabet, key=None): Constructor de clase que tiene como parámetro todos los atributos que necesita el algoritmo de cifrado de César. Parámetro: alphabet -- el alf... | d57a0574ac76dcbff8feab69ee4ffba153e1f2a9 | <|skeleton|>
class Caesar:
def __init__(self, alphabet, key=None):
"""Constructor de clase que tiene como parámetro todos los atributos que necesita el algoritmo de cifrado de César. Parámetro: alphabet -- el alfabeto sobre quien se cifra el mensaje. key -- el tamaño del desplazamiento sobre el alfabeto, s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Caesar:
def __init__(self, alphabet, key=None):
"""Constructor de clase que tiene como parámetro todos los atributos que necesita el algoritmo de cifrado de César. Parámetro: alphabet -- el alfabeto sobre quien se cifra el mensaje. key -- el tamaño del desplazamiento sobre el alfabeto, si es None, se ... | the_stack_v2_python_sparse | Practica1/caesar_cipher.py | VictorBis/Criptografia | train | 0 | |
28b03e2d1e9a9e2c1d3f112d060475886d4f0ed5 | [
"def preorder(root):\n if root:\n vals.append(root.val)\n preorder(root.left)\n preorder(root.right)\nvals = []\npreorder(root)\nreturn ' '.join(map(str, vals))",
"preorder = list(map(int, data.split()))\ninorder = sorted(preorder)\n\ndef buildBST(preorder, inorder):\n if not preorder:\... | <|body_start_0|>
def preorder(root):
if root:
vals.append(root.val)
preorder(root.left)
preorder(root.right)
vals = []
preorder(root)
return ' '.join(map(str, vals))
<|end_body_0|>
<|body_start_1|>
preorder = list(map(i... | Codec | [
"MIT"
] | 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_75kplus_train_070572 | 1,414 | permissive | [
{
"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_038337 | 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:... | 3719f5cb059eefd66b83eb8ae990652f4b7fd124 | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def preorder(root):
if root:
vals.append(root.val)
preorder(root.left)
preorder(root.right)
vals = []
preorder... | the_stack_v2_python_sparse | Python3/0449-Serialize-and-Deserialize-BST/soln.py | wyaadarsh/LeetCode-Solutions | train | 0 | |
972e4fde2fa6cc544ab77f7b486b983b4782cda0 | [
"self.gpus = gpus\ntransformer_primitive = []\ntransformer_primitive.append(T.Resize(size=i_shape))\nif h_flip > 0:\n transformer_primitive.append(T.RandomHorizontalFlip(p=h_flip))\nif t_crop:\n transformer_primitive.append(T.RandomCrop(size=i_shape))\ntransformer_primitive.append(T.ToTensor())\nif rea:\n ... | <|body_start_0|>
self.gpus = gpus
transformer_primitive = []
transformer_primitive.append(T.Resize(size=i_shape))
if h_flip > 0:
transformer_primitive.append(T.RandomHorizontalFlip(p=h_flip))
if t_crop:
transformer_primitive.append(T.RandomCrop(size=i_shap... | ClassedGenerator returns images only for the specified classes | ClassedGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassedGenerator:
"""ClassedGenerator returns images only for the specified classes"""
def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0, h_flip=0.0, t_crop=False, rea=False, **kwargs):
"""Data ge... | stack_v2_sparse_classes_75kplus_train_070573 | 4,424 | no_license | [
{
"docstring": "Data generator for training and testing. Args: gpus (int): Number of GPUs i_shape (int, int): 2D Image shape normalization_mean (float): Value to pass as mean normalization parameter to pytorch Normalization normalization_std (float): Value to pass as std normalization parameter to pytorch Norma... | 2 | stack_v2_sparse_classes_30k_train_002500 | Implement the Python class `ClassedGenerator` described below.
Class description:
ClassedGenerator returns images only for the specified classes
Method signatures and docstrings:
- def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0... | Implement the Python class `ClassedGenerator` described below.
Class description:
ClassedGenerator returns images only for the specified classes
Method signatures and docstrings:
- def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0... | 4938936dbf08b5331275d4413dbad51acbaf7da9 | <|skeleton|>
class ClassedGenerator:
"""ClassedGenerator returns images only for the specified classes"""
def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0, h_flip=0.0, t_crop=False, rea=False, **kwargs):
"""Data ge... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClassedGenerator:
"""ClassedGenerator returns images only for the specified classes"""
def __init__(self, preload='', gpus=1, i_shape=(128, 128), normalization_mean=0.5, normalization_std=0.5, normalization_scale=1.0 / 255.0, h_flip=0.0, t_crop=False, rea=False, **kwargs):
"""Data generator for t... | the_stack_v2_python_sparse | generators/ClassedGenerator.py | asuprem/ODIN | train | 7 |
091de85115b94fa0a83a87880e0d12f6ea83c386 | [
"if not isinstance(event_tag, event.EventTag):\n raise TypeError\njson_dict = {u'__type__': u'EventTag'}\nfor attribute_name, attribute_value in iter(event_tag.__dict__.items()):\n if attribute_value is None:\n continue\n if isinstance(attribute_value, py2to3.BYTES_TYPE):\n attribute_value = ... | <|body_start_0|>
if not isinstance(event_tag, event.EventTag):
raise TypeError
json_dict = {u'__type__': u'EventTag'}
for attribute_name, attribute_value in iter(event_tag.__dict__.items()):
if attribute_value is None:
continue
if isinstance(at... | A class that implements an event object JSON encoder. | _EventObjectJSONEncoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _EventObjectJSONEncoder:
"""A class that implements an event object JSON encoder."""
def _ConvertEventTagToDict(self, event_tag):
"""Converts an event tag object into a JSON dictionary. The resulting dictionary of the JSON serialized objects consists of: { '__type__': 'EventTag' ... ... | stack_v2_sparse_classes_75kplus_train_070574 | 28,710 | permissive | [
{
"docstring": "Converts an event tag object into a JSON dictionary. The resulting dictionary of the JSON serialized objects consists of: { '__type__': 'EventTag' ... } Here '__type__' indicates the object base type. In this case 'EventTag'. The rest of the elements of the dictionary make up the event tag objec... | 3 | stack_v2_sparse_classes_30k_train_014141 | Implement the Python class `_EventObjectJSONEncoder` described below.
Class description:
A class that implements an event object JSON encoder.
Method signatures and docstrings:
- def _ConvertEventTagToDict(self, event_tag): Converts an event tag object into a JSON dictionary. The resulting dictionary of the JSON seri... | Implement the Python class `_EventObjectJSONEncoder` described below.
Class description:
A class that implements an event object JSON encoder.
Method signatures and docstrings:
- def _ConvertEventTagToDict(self, event_tag): Converts an event tag object into a JSON dictionary. The resulting dictionary of the JSON seri... | 923797fc00664fa9e3277781b0334d6eed5664fd | <|skeleton|>
class _EventObjectJSONEncoder:
"""A class that implements an event object JSON encoder."""
def _ConvertEventTagToDict(self, event_tag):
"""Converts an event tag object into a JSON dictionary. The resulting dictionary of the JSON serialized objects consists of: { '__type__': 'EventTag' ... ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _EventObjectJSONEncoder:
"""A class that implements an event object JSON encoder."""
def _ConvertEventTagToDict(self, event_tag):
"""Converts an event tag object into a JSON dictionary. The resulting dictionary of the JSON serialized objects consists of: { '__type__': 'EventTag' ... } Here '__typ... | the_stack_v2_python_sparse | plaso/serializer/json_serializer.py | CNR-ITTIG/plasodfaxp | train | 1 |
dfbcb3b087d2782c558f82e2180c105eda741817 | [
"self.id = id\nself.popSize = pop_size\nself.params = parameters\nself.patients = []\nself.cohortOutcomes = CohortOutcomes()",
"for i in range(self.popSize):\n patient = Patient(id=self.id * self.popSize + i, parameters=self.params)\n self.patients.append(patient)\nfor patient in self.patients:\n patient... | <|body_start_0|>
self.id = id
self.popSize = pop_size
self.params = parameters
self.patients = []
self.cohortOutcomes = CohortOutcomes()
<|end_body_0|>
<|body_start_1|>
for i in range(self.popSize):
patient = Patient(id=self.id * self.popSize + i, parameters=... | Cohort | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cohort:
def __init__(self, id, pop_size, parameters):
"""create a cohort of patients :param id: cohort ID :param pop_size: population size of this cohort :param parameters: parameters"""
<|body_0|>
def simulate(self, sim_length):
"""simulate the cohort of patients ov... | stack_v2_sparse_classes_75kplus_train_070575 | 25,015 | no_license | [
{
"docstring": "create a cohort of patients :param id: cohort ID :param pop_size: population size of this cohort :param parameters: parameters",
"name": "__init__",
"signature": "def __init__(self, id, pop_size, parameters)"
},
{
"docstring": "simulate the cohort of patients over the specified n... | 2 | null | Implement the Python class `Cohort` described below.
Class description:
Implement the Cohort class.
Method signatures and docstrings:
- def __init__(self, id, pop_size, parameters): create a cohort of patients :param id: cohort ID :param pop_size: population size of this cohort :param parameters: parameters
- def sim... | Implement the Python class `Cohort` described below.
Class description:
Implement the Cohort class.
Method signatures and docstrings:
- def __init__(self, id, pop_size, parameters): create a cohort of patients :param id: cohort ID :param pop_size: population size of this cohort :param parameters: parameters
- def sim... | 5ece89f06846b95cf8b571c2373b3044742cc840 | <|skeleton|>
class Cohort:
def __init__(self, id, pop_size, parameters):
"""create a cohort of patients :param id: cohort ID :param pop_size: population size of this cohort :param parameters: parameters"""
<|body_0|>
def simulate(self, sim_length):
"""simulate the cohort of patients ov... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Cohort:
def __init__(self, id, pop_size, parameters):
"""create a cohort of patients :param id: cohort ID :param pop_size: population size of this cohort :param parameters: parameters"""
self.id = id
self.popSize = pop_size
self.params = parameters
self.patients = []
... | the_stack_v2_python_sparse | MarkovModelClasses.py | kennyguna/urine_LAM_model | train | 0 | |
30cc6899eeebca39d6974a9cf1f251b627d138d4 | [
"import main\nmain.moteur_1_ra.set(position)\nmoteur_right_arm_1(position)",
"import main\nmain.moteur_2_ra.set(position)\nmoteur_right_arm_2(position)",
"import main\nmain.moteur_3_ra.set(position)\nmoteur_right_arm_3(position)",
"import main\nmain.moteur_4_ra.set(position)\nmoteur_right_arm_4(position)"
] | <|body_start_0|>
import main
main.moteur_1_ra.set(position)
moteur_right_arm_1(position)
<|end_body_0|>
<|body_start_1|>
import main
main.moteur_2_ra.set(position)
moteur_right_arm_2(position)
<|end_body_1|>
<|body_start_2|>
import main
main.moteur_3_ra.... | right_arm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class right_arm:
def shoulder_x(position: int):
"""position en % du mouvement total"""
<|body_0|>
def shoulder_y(position: int):
"""position en % du mouvement total"""
<|body_1|>
def shoulder_z(position: int):
"""position en % du mouvement total"""
... | stack_v2_sparse_classes_75kplus_train_070576 | 18,170 | no_license | [
{
"docstring": "position en % du mouvement total",
"name": "shoulder_x",
"signature": "def shoulder_x(position: int)"
},
{
"docstring": "position en % du mouvement total",
"name": "shoulder_y",
"signature": "def shoulder_y(position: int)"
},
{
"docstring": "position en % du mouve... | 4 | stack_v2_sparse_classes_30k_train_035561 | Implement the Python class `right_arm` described below.
Class description:
Implement the right_arm class.
Method signatures and docstrings:
- def shoulder_x(position: int): position en % du mouvement total
- def shoulder_y(position: int): position en % du mouvement total
- def shoulder_z(position: int): position en %... | Implement the Python class `right_arm` described below.
Class description:
Implement the right_arm class.
Method signatures and docstrings:
- def shoulder_x(position: int): position en % du mouvement total
- def shoulder_y(position: int): position en % du mouvement total
- def shoulder_z(position: int): position en %... | 68872f2845464b151ab0ddc809cef1d758e4a703 | <|skeleton|>
class right_arm:
def shoulder_x(position: int):
"""position en % du mouvement total"""
<|body_0|>
def shoulder_y(position: int):
"""position en % du mouvement total"""
<|body_1|>
def shoulder_z(position: int):
"""position en % du mouvement total"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class right_arm:
def shoulder_x(position: int):
"""position en % du mouvement total"""
import main
main.moteur_1_ra.set(position)
moteur_right_arm_1(position)
def shoulder_y(position: int):
"""position en % du mouvement total"""
import main
main.moteur_2_... | the_stack_v2_python_sparse | body.py | ppgg88/InMoov_app | train | 1 | |
e4edc08b032b046f4fe3c14908c561e746d59b62 | [
"if self.columns:\n return [column.id_ for column in self.columns]\nreturn []",
"if self.columns:\n return {column.id_: column for column in self.columns}\nreturn {}",
"if self.columns is None:\n raise ValueError('Please load individual data set to see columns.')\nif ids is None:\n return [column.na... | <|body_start_0|>
if self.columns:
return [column.id_ for column in self.columns]
return []
<|end_body_0|>
<|body_start_1|>
if self.columns:
return {column.id_: column for column in self.columns}
return {}
<|end_body_1|>
<|body_start_2|>
if self.columns i... | DatasetSummary | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatasetSummary:
def column_ids(self) -> List[int]:
"""List of column ids in same order as `columns`"""
<|body_0|>
def column_index(self) -> Dict[int, RawColumn]:
"""Dict of column id to `RawColumn`"""
<|body_1|>
def column_names(self, ids: Optional[List[... | stack_v2_sparse_classes_75kplus_train_070577 | 1,820 | permissive | [
{
"docstring": "List of column ids in same order as `columns`",
"name": "column_ids",
"signature": "def column_ids(self) -> List[int]"
},
{
"docstring": "Dict of column id to `RawColumn`",
"name": "column_index",
"signature": "def column_index(self) -> Dict[int, RawColumn]"
},
{
... | 3 | null | Implement the Python class `DatasetSummary` described below.
Class description:
Implement the DatasetSummary class.
Method signatures and docstrings:
- def column_ids(self) -> List[int]: List of column ids in same order as `columns`
- def column_index(self) -> Dict[int, RawColumn]: Dict of column id to `RawColumn`
- ... | Implement the Python class `DatasetSummary` described below.
Class description:
Implement the DatasetSummary class.
Method signatures and docstrings:
- def column_ids(self) -> List[int]: List of column ids in same order as `columns`
- def column_index(self) -> Dict[int, RawColumn]: Dict of column id to `RawColumn`
- ... | 67a4a094767cb8e5f01956f20f5ca7726781614a | <|skeleton|>
class DatasetSummary:
def column_ids(self) -> List[int]:
"""List of column ids in same order as `columns`"""
<|body_0|>
def column_index(self) -> Dict[int, RawColumn]:
"""Dict of column id to `RawColumn`"""
<|body_1|>
def column_names(self, ids: Optional[List[... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DatasetSummary:
def column_ids(self) -> List[int]:
"""List of column ids in same order as `columns`"""
if self.columns:
return [column.id_ for column in self.columns]
return []
def column_index(self) -> Dict[int, RawColumn]:
"""Dict of column id to `RawColumn`"... | the_stack_v2_python_sparse | src/mf_horizon_client/data_structures/dataset_summary.py | MF-HORIZON/mf-horizon-python-client | train | 0 | |
fba118f6411ab1b6da8beab2da11217db3e69650 | [
"assert len(dim) == 2, 'Must specify only x and y dimensions.'\nself.dim = dim\nself.lattice = ((np.random.rand(*dim) < 0.5) * 2.0 - 1).astype(np.int8)\nself.J = J\nif type(h) is float or type(h) is type(int):\n self.h = np.zeros(dim) + h\nelse:\n self.h = h or np.zeros(dim)\nself.rng = rng or np.random.Rando... | <|body_start_0|>
assert len(dim) == 2, 'Must specify only x and y dimensions.'
self.dim = dim
self.lattice = ((np.random.rand(*dim) < 0.5) * 2.0 - 1).astype(np.int8)
self.J = J
if type(h) is float or type(h) is type(int):
self.h = np.zeros(dim) + h
else:
... | Simulation of the ferromagnetic Ising model on a 2D periodic lattice with quenched disorder in the local fields. | Ising2D | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ising2D:
"""Simulation of the ferromagnetic Ising model on a 2D periodic lattice with quenched disorder in the local fields."""
def __init__(self, dim, J, h=0, rng=None):
"""Parameters ---------- dim : tuple Pair describing the length of the system along the x and y dimensions. J : f... | stack_v2_sparse_classes_75kplus_train_070578 | 4,285 | permissive | [
{
"docstring": "Parameters ---------- dim : tuple Pair describing the length of the system along the x and y dimensions. J : float h : ndarray or float,0 Field at every lattice point. rng : np.random.RandomState,None",
"name": "__init__",
"signature": "def __init__(self, dim, J, h=0, rng=None)"
},
{... | 3 | stack_v2_sparse_classes_30k_train_008729 | Implement the Python class `Ising2D` described below.
Class description:
Simulation of the ferromagnetic Ising model on a 2D periodic lattice with quenched disorder in the local fields.
Method signatures and docstrings:
- def __init__(self, dim, J, h=0, rng=None): Parameters ---------- dim : tuple Pair describing the... | Implement the Python class `Ising2D` described below.
Class description:
Simulation of the ferromagnetic Ising model on a 2D periodic lattice with quenched disorder in the local fields.
Method signatures and docstrings:
- def __init__(self, dim, J, h=0, rng=None): Parameters ---------- dim : tuple Pair describing the... | f25863705f8e459771ef60ea51c4bd6587904c78 | <|skeleton|>
class Ising2D:
"""Simulation of the ferromagnetic Ising model on a 2D periodic lattice with quenched disorder in the local fields."""
def __init__(self, dim, J, h=0, rng=None):
"""Parameters ---------- dim : tuple Pair describing the length of the system along the x and y dimensions. J : f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ising2D:
"""Simulation of the ferromagnetic Ising model on a 2D periodic lattice with quenched disorder in the local fields."""
def __init__(self, dim, J, h=0, rng=None):
"""Parameters ---------- dim : tuple Pair describing the length of the system along the x and y dimensions. J : float h : ndar... | the_stack_v2_python_sparse | coniii/ising/automaton.py | eltrompetero/coniii | train | 18 |
9b18ef873d67b7af910fe5409c3df1ba7955de69 | [
"if not encryption_method or not parent:\n raise ValueError('Missing encryption method or parent value.')\nsuper(EncryptedStreamPathSpec, self).__init__(parent=parent, **kwargs)\nself.cipher_mode = cipher_mode\nself.encryption_method = encryption_method\nself.initialization_vector = initialization_vector\nself.k... | <|body_start_0|>
if not encryption_method or not parent:
raise ValueError('Missing encryption method or parent value.')
super(EncryptedStreamPathSpec, self).__init__(parent=parent, **kwargs)
self.cipher_mode = cipher_mode
self.encryption_method = encryption_method
sel... | Encrypted stream path specification. Attributes: cipher_mode (str): cipher mode. encryption_method (str): method used to the encrypt the data. initialization_vector (bytes): initialization vector. key (bytes): key. | EncryptedStreamPathSpec | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncryptedStreamPathSpec:
"""Encrypted stream path specification. Attributes: cipher_mode (str): cipher mode. encryption_method (str): method used to the encrypt the data. initialization_vector (bytes): initialization vector. key (bytes): key."""
def __init__(self, cipher_mode=None, encryptio... | stack_v2_sparse_classes_75kplus_train_070579 | 2,414 | permissive | [
{
"docstring": "Initializes a path specification. Note that the encrypted stream path specification must have a parent. Args: cipher_mode (Optional[str]): cipher mode. encryption_method (Optional[str]): method used to the encrypt the data. initialization_vector (Optional[bytes]): initialization vector. key (Opt... | 2 | stack_v2_sparse_classes_30k_train_001092 | Implement the Python class `EncryptedStreamPathSpec` described below.
Class description:
Encrypted stream path specification. Attributes: cipher_mode (str): cipher mode. encryption_method (str): method used to the encrypt the data. initialization_vector (bytes): initialization vector. key (bytes): key.
Method signatu... | Implement the Python class `EncryptedStreamPathSpec` described below.
Class description:
Encrypted stream path specification. Attributes: cipher_mode (str): cipher mode. encryption_method (str): method used to the encrypt the data. initialization_vector (bytes): initialization vector. key (bytes): key.
Method signatu... | 28756d910e951a22c5f0b2bcf5184f055a19d544 | <|skeleton|>
class EncryptedStreamPathSpec:
"""Encrypted stream path specification. Attributes: cipher_mode (str): cipher mode. encryption_method (str): method used to the encrypt the data. initialization_vector (bytes): initialization vector. key (bytes): key."""
def __init__(self, cipher_mode=None, encryptio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EncryptedStreamPathSpec:
"""Encrypted stream path specification. Attributes: cipher_mode (str): cipher mode. encryption_method (str): method used to the encrypt the data. initialization_vector (bytes): initialization vector. key (bytes): key."""
def __init__(self, cipher_mode=None, encryption_method=None... | the_stack_v2_python_sparse | dfvfs/path/encrypted_stream_path_spec.py | log2timeline/dfvfs | train | 197 |
db81a34fea7d975f6789b013737d7250bb5eba8c | [
"super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=DEFAULT_SCAN_INTERVAL))\nself._api = HERETransitApi(api_key)\nself.config = config",
"origin, destination, arrival, departure = prepare_parameters(self.hass, self.config)\n_LOGGER.debug('Requesting transit route for origin: %s, destin... | <|body_start_0|>
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=DEFAULT_SCAN_INTERVAL))
self._api = HERETransitApi(api_key)
self.config = config
<|end_body_0|>
<|body_start_1|>
origin, destination, arrival, departure = prepare_parameters(self.hass, self.c... | HERETravelTime DataUpdateCoordinator. | HERETransitDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HERETransitDataUpdateCoordinator:
"""HERETravelTime DataUpdateCoordinator."""
def __init__(self, hass: HomeAssistant, api_key: str, config: HERETravelTimeConfig) -> None:
"""Initialize."""
<|body_0|>
async def _async_update_data(self) -> HERETravelTimeData | None:
... | stack_v2_sparse_classes_75kplus_train_070580 | 12,892 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, api_key: str, config: HERETravelTimeConfig) -> None"
},
{
"docstring": "Get the latest data from the HERE Routing API.",
"name": "_async_update_data",
"signature": "async def _async_up... | 3 | null | Implement the Python class `HERETransitDataUpdateCoordinator` described below.
Class description:
HERETravelTime DataUpdateCoordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, api_key: str, config: HERETravelTimeConfig) -> None: Initialize.
- async def _async_update_data(self) -> H... | Implement the Python class `HERETransitDataUpdateCoordinator` described below.
Class description:
HERETravelTime DataUpdateCoordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, api_key: str, config: HERETravelTimeConfig) -> None: Initialize.
- async def _async_update_data(self) -> H... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class HERETransitDataUpdateCoordinator:
"""HERETravelTime DataUpdateCoordinator."""
def __init__(self, hass: HomeAssistant, api_key: str, config: HERETravelTimeConfig) -> None:
"""Initialize."""
<|body_0|>
async def _async_update_data(self) -> HERETravelTimeData | None:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HERETransitDataUpdateCoordinator:
"""HERETravelTime DataUpdateCoordinator."""
def __init__(self, hass: HomeAssistant, api_key: str, config: HERETravelTimeConfig) -> None:
"""Initialize."""
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=DEFAULT_SCAN_INTERVAL... | the_stack_v2_python_sparse | homeassistant/components/here_travel_time/coordinator.py | home-assistant/core | train | 35,501 |
d2b3f6a2bbe920f80a8c253d6aac2a2d80347b6e | [
"margin = max(VectorUtil.find_max(abs(x)), VectorUtil.find_max(abs(y)), VectorUtil.find_max(abs(z)))\nmargin = margin * 2\nreturn margin",
"u = np.linspace(0, 2 * np.pi, 100)\nv = np.linspace(0, np.pi, 100)\nx_sphere = max_coordinates * np.outer(np.cos(u), np.sin(v))\ny_sphere = max_coordinates * np.outer(np.sin(... | <|body_start_0|>
margin = max(VectorUtil.find_max(abs(x)), VectorUtil.find_max(abs(y)), VectorUtil.find_max(abs(z)))
margin = margin * 2
return margin
<|end_body_0|>
<|body_start_1|>
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)
x_sphere = max_coordin... | DrawUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DrawUtil:
def calculate_margin_max_coordinates(x, y, z):
"""Will calculate max element from three integers vectors :param x: integer vector x :param y: integer vector y :param z: integer vector z :return: Double of max value found in three parameters"""
<|body_0|>
def draw_s... | stack_v2_sparse_classes_75kplus_train_070581 | 2,566 | no_license | [
{
"docstring": "Will calculate max element from three integers vectors :param x: integer vector x :param y: integer vector y :param z: integer vector z :return: Double of max value found in three parameters",
"name": "calculate_margin_max_coordinates",
"signature": "def calculate_margin_max_coordinates(... | 3 | stack_v2_sparse_classes_30k_train_006957 | Implement the Python class `DrawUtil` described below.
Class description:
Implement the DrawUtil class.
Method signatures and docstrings:
- def calculate_margin_max_coordinates(x, y, z): Will calculate max element from three integers vectors :param x: integer vector x :param y: integer vector y :param z: integer vect... | Implement the Python class `DrawUtil` described below.
Class description:
Implement the DrawUtil class.
Method signatures and docstrings:
- def calculate_margin_max_coordinates(x, y, z): Will calculate max element from three integers vectors :param x: integer vector x :param y: integer vector y :param z: integer vect... | 59c327a0ef80740e1c6967729d9472aac2afd1b5 | <|skeleton|>
class DrawUtil:
def calculate_margin_max_coordinates(x, y, z):
"""Will calculate max element from three integers vectors :param x: integer vector x :param y: integer vector y :param z: integer vector z :return: Double of max value found in three parameters"""
<|body_0|>
def draw_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DrawUtil:
def calculate_margin_max_coordinates(x, y, z):
"""Will calculate max element from three integers vectors :param x: integer vector x :param y: integer vector y :param z: integer vector z :return: Double of max value found in three parameters"""
margin = max(VectorUtil.find_max(abs(x))... | the_stack_v2_python_sparse | VecStatsGraph/util/DrawUtil.py | IvanDragoJr/VecStatsGraph3d | train | 0 | |
e7b67711de98cbb7519f9c349191482a62314b9b | [
"if data is None:\n if lambtha < 1:\n raise ValueError('lambtha must be a positive value')\n else:\n self.lambtha = lambtha\nelse:\n if not isinstance(data, list):\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple valu... | <|body_start_0|>
if data is None:
if lambtha < 1:
raise ValueError('lambtha must be a positive value')
else:
self.lambtha = lambtha
else:
if not isinstance(data, list):
raise TypeError('data must be a list')
... | The Poisson class | Poisson | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Poisson:
"""The Poisson class"""
def __init__(self, data=None, lambtha=1.0):
"""Init lambtha of data"""
<|body_0|>
def factorial(self, n):
"""n factorial"""
<|body_1|>
def pmf(self, k):
"""The probability mass function of Poisson"""
<... | stack_v2_sparse_classes_75kplus_train_070582 | 1,609 | no_license | [
{
"docstring": "Init lambtha of data",
"name": "__init__",
"signature": "def __init__(self, data=None, lambtha=1.0)"
},
{
"docstring": "n factorial",
"name": "factorial",
"signature": "def factorial(self, n)"
},
{
"docstring": "The probability mass function of Poisson",
"name... | 4 | stack_v2_sparse_classes_30k_train_035557 | Implement the Python class `Poisson` described below.
Class description:
The Poisson class
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Init lambtha of data
- def factorial(self, n): n factorial
- def pmf(self, k): The probability mass function of Poisson
- def cdf(self, k): The Cum... | Implement the Python class `Poisson` described below.
Class description:
The Poisson class
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Init lambtha of data
- def factorial(self, n): n factorial
- def pmf(self, k): The probability mass function of Poisson
- def cdf(self, k): The Cum... | 4200798bdbbe828db94e5585b62a595e3a96c3e6 | <|skeleton|>
class Poisson:
"""The Poisson class"""
def __init__(self, data=None, lambtha=1.0):
"""Init lambtha of data"""
<|body_0|>
def factorial(self, n):
"""n factorial"""
<|body_1|>
def pmf(self, k):
"""The probability mass function of Poisson"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Poisson:
"""The Poisson class"""
def __init__(self, data=None, lambtha=1.0):
"""Init lambtha of data"""
if data is None:
if lambtha < 1:
raise ValueError('lambtha must be a positive value')
else:
self.lambtha = lambtha
else:
... | the_stack_v2_python_sparse | math/0x03-probability/poisson.py | JohnCook17/holbertonschool-machine_learning | train | 3 |
c3250ebbf8a0bd9fd553a42e790e2f911c95d57f | [
"super(GamePRF, self).__init__()\nself.required_queries, self.prf, self.key_len, self.input_len = (required_queries, prf, key_len, input_len)\nif output_len == None:\n self.output_len = input_len\nelse:\n self.output_len = output_len\nself.key = ''\nself.messages = {}\nself.world = None",
"self.answered_que... | <|body_start_0|>
super(GamePRF, self).__init__()
self.required_queries, self.prf, self.key_len, self.input_len = (required_queries, prf, key_len, input_len)
if output_len == None:
self.output_len = input_len
else:
self.output_len = output_len
self.key = ''... | This game is used to test whether a candidate function is a good pseudo-random function or not. Adversaries playing this game have access to an fn oracle. | GamePRF | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GamePRF:
"""This game is used to test whether a candidate function is a good pseudo-random function or not. Adversaries playing this game have access to an fn oracle."""
def __init__(self, required_queries, prf, key_len, input_len, output_len=None):
""":param prf: This must be a call... | stack_v2_sparse_classes_75kplus_train_070583 | 3,710 | no_license | [
{
"docstring": ":param prf: This must be a callable python function that takes two inputs, k and x where k is a key of length key_len and x is a message of length input_len. :param key_len: Length of the key (in bytes) used in the function that will be tested with this game. :param input_len: Length of the inpu... | 4 | stack_v2_sparse_classes_30k_train_026305 | Implement the Python class `GamePRF` described below.
Class description:
This game is used to test whether a candidate function is a good pseudo-random function or not. Adversaries playing this game have access to an fn oracle.
Method signatures and docstrings:
- def __init__(self, required_queries, prf, key_len, inp... | Implement the Python class `GamePRF` described below.
Class description:
This game is used to test whether a candidate function is a good pseudo-random function or not. Adversaries playing this game have access to an fn oracle.
Method signatures and docstrings:
- def __init__(self, required_queries, prf, key_len, inp... | 9014f5a9bf7021bef9f5cc4aa5b16424ca83dee9 | <|skeleton|>
class GamePRF:
"""This game is used to test whether a candidate function is a good pseudo-random function or not. Adversaries playing this game have access to an fn oracle."""
def __init__(self, required_queries, prf, key_len, input_len, output_len=None):
""":param prf: This must be a call... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GamePRF:
"""This game is used to test whether a candidate function is a good pseudo-random function or not. Adversaries playing this game have access to an fn oracle."""
def __init__(self, required_queries, prf, key_len, input_len, output_len=None):
""":param prf: This must be a callable python f... | the_stack_v2_python_sparse | src/playcrypt/games/game_prf.py | UCSDCSE107/playcrypt | train | 2 |
7e9c7980f15c1ceb926fd185489a13e483643af5 | [
"if not p:\n return 0\nsbs = collections.defaultdict(int)\nfor i in range(len(p)):\n s = p[i]\n if i + sbs[s] >= len(p):\n continue\n if p[i + sbs[s]] != chr((ord(p[i]) - ord('a') + sbs[s]) % 26 + ord('a')):\n continue\n l = 1\n for j in range(i + 1, len(p) + 1):\n l = j - i\n... | <|body_start_0|>
if not p:
return 0
sbs = collections.defaultdict(int)
for i in range(len(p)):
s = p[i]
if i + sbs[s] >= len(p):
continue
if p[i + sbs[s]] != chr((ord(p[i]) - ord('a') + sbs[s]) % 26 + ord('a')):
cont... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findSubstringInWraproundString1(self, p):
""":type p: str :rtype: int"""
<|body_0|>
def findSubstringInWraproundString(self, p):
""":type p: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not p:
return 0... | stack_v2_sparse_classes_75kplus_train_070584 | 4,903 | permissive | [
{
"docstring": ":type p: str :rtype: int",
"name": "findSubstringInWraproundString1",
"signature": "def findSubstringInWraproundString1(self, p)"
},
{
"docstring": ":type p: str :rtype: int",
"name": "findSubstringInWraproundString",
"signature": "def findSubstringInWraproundString(self,... | 2 | stack_v2_sparse_classes_30k_train_037226 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSubstringInWraproundString1(self, p): :type p: str :rtype: int
- def findSubstringInWraproundString(self, p): :type p: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findSubstringInWraproundString1(self, p): :type p: str :rtype: int
- def findSubstringInWraproundString(self, p): :type p: str :rtype: int
<|skeleton|>
class Solution:
... | 2830c7e2ada8dfd3dcdda7c06846116d4f944a27 | <|skeleton|>
class Solution:
def findSubstringInWraproundString1(self, p):
""":type p: str :rtype: int"""
<|body_0|>
def findSubstringInWraproundString(self, p):
""":type p: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findSubstringInWraproundString1(self, p):
""":type p: str :rtype: int"""
if not p:
return 0
sbs = collections.defaultdict(int)
for i in range(len(p)):
s = p[i]
if i + sbs[s] >= len(p):
continue
if p[i... | the_stack_v2_python_sparse | leetcode/medium/Unique_Substrings_in_Wraparound_String.py | shhuan/algorithms | train | 0 | |
6e0106d132008a306f6f3fa57250301aa5f8ffe8 | [
"a, b = (1, 1)\nfor index in range(len(s)):\n tmp = 0\n if 0 < int(s[index]) <= 9:\n tmp += b\n if index - 1 >= 0 and 9 < int(s[index - 1:index + 1]) <= 26:\n tmp += a\n a, b = (b, tmp)\nreturn b",
"cache = [0] * len(s)\nfor index in range(len(s)):\n if 0 < int(s[index]) <= 9:\n ... | <|body_start_0|>
a, b = (1, 1)
for index in range(len(s)):
tmp = 0
if 0 < int(s[index]) <= 9:
tmp += b
if index - 1 >= 0 and 9 < int(s[index - 1:index + 1]) <= 26:
tmp += a
a, b = (b, tmp)
return b
<|end_body_0|>
<|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numDecodings(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def numDecodingsWithExtraMemory(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
a, b = (1, 1)
for index in range(len(s)):
... | stack_v2_sparse_classes_75kplus_train_070585 | 2,743 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "numDecodings",
"signature": "def numDecodings(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "numDecodingsWithExtraMemory",
"signature": "def numDecodingsWithExtraMemory(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007878 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s): :type s: str :rtype: int
- def numDecodingsWithExtraMemory(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 numDecodings(self, s): :type s: str :rtype: int
- def numDecodingsWithExtraMemory(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def numDecodings(self,... | 578323a87edc11e09daaec34bc9d61561240b2b8 | <|skeleton|>
class Solution:
def numDecodings(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def numDecodingsWithExtraMemory(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numDecodings(self, s):
""":type s: str :rtype: int"""
a, b = (1, 1)
for index in range(len(s)):
tmp = 0
if 0 < int(s[index]) <= 9:
tmp += b
if index - 1 >= 0 and 9 < int(s[index - 1:index + 1]) <= 26:
tmp... | the_stack_v2_python_sparse | Ways to Decode.py | salman6049/Dynamic-Programming | train | 1 | |
9ee2298062fb0153b54bfb6f616e084551999668 | [
"if root == None:\n return True\nelse:\n return self.judge(root.left, root.right)",
"if left == None and right != None:\n return False\nelif left != None and right == None:\n return False\nelif left == None and right == None:\n return True\nelif left.val != right.val:\n return False\nelse:\n ... | <|body_start_0|>
if root == None:
return True
else:
return self.judge(root.left, root.right)
<|end_body_0|>
<|body_start_1|>
if left == None and right != None:
return False
elif left != None and right == None:
return False
elif lef... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def is_symmetric_1(self, root: TreeNode) -> bool:
"""递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:"""
<|body_0|>
def judge(self, left, right):
"""递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩子和右节点的右孩子是否想等 :param left: :param right: :return:"""
... | stack_v2_sparse_classes_75kplus_train_070586 | 3,606 | no_license | [
{
"docstring": "递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:",
"name": "is_symmetric_1",
"signature": "def is_symmetric_1(self, root: TreeNode) -> bool"
},
{
"docstring": "递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩子和右节点的右孩子是否想等 :param left: :param right: :return:",
"name": "judge",
... | 3 | stack_v2_sparse_classes_30k_train_022324 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_symmetric_1(self, root: TreeNode) -> bool: 递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:
- def judge(self, left, right): 递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_symmetric_1(self, root: TreeNode) -> bool: 递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:
- def judge(self, left, right): 递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩... | f68e60dd1d8bb010cdae88e6273b3fac4ea48776 | <|skeleton|>
class Solution:
def is_symmetric_1(self, root: TreeNode) -> bool:
"""递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:"""
<|body_0|>
def judge(self, left, right):
"""递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩子和右节点的右孩子是否想等 :param left: :param right: :return:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def is_symmetric_1(self, root: TreeNode) -> bool:
"""递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:"""
if root == None:
return True
else:
return self.judge(root.left, root.right)
def judge(self, left, right):
"""递归法判断左右节点是否对称, 左节点的... | the_stack_v2_python_sparse | tree/101_isSymmetric.py | liying123456/python_leetcode | train | 0 | |
76a8514174f085c2be10de28e0f55850a77d892e | [
"super(DeepAndCrossNetworkModel, self).__init__()\nself.deep = DNNLayer(output_size=deep_output_size, layer_sizes=deep_layer_sizes, inputs_size=inputs_size, dropout_p=deep_dropout_p, activation=deep_activation)\nself.cross = CrossNetworkLayer(num_layers=cross_num_layers, inputs_size=inputs_size)\ncat_size = deep_ou... | <|body_start_0|>
super(DeepAndCrossNetworkModel, self).__init__()
self.deep = DNNLayer(output_size=deep_output_size, layer_sizes=deep_layer_sizes, inputs_size=inputs_size, dropout_p=deep_dropout_p, activation=deep_activation)
self.cross = CrossNetworkLayer(num_layers=cross_num_layers, inputs_siz... | DeepAndCrossNetworkModel is a model of deep and cross network, which is a model of a concatenation of deep neural network and cross network, and finally pass to a fully connect layer for the output. :Reference: #. `Ruoxi Wang et al, 2017. Deep & Cross Network for Ad Click Predictions <https://arxiv.org/abs/1708.05123>`... | DeepAndCrossNetworkModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeepAndCrossNetworkModel:
"""DeepAndCrossNetworkModel is a model of deep and cross network, which is a model of a concatenation of deep neural network and cross network, and finally pass to a fully connect layer for the output. :Reference: #. `Ruoxi Wang et al, 2017. Deep & Cross Network for Ad C... | stack_v2_sparse_classes_75kplus_train_070587 | 3,373 | permissive | [
{
"docstring": "initialize deep adn cross network Args: inputs_size (int): size of inputs tensor deep_output_size (int): size of outputs of deep neural network deep_layer_sizes (List[int]): sizes of layers in deep neural network cross_num_layers (int): number of layers in cross network output_size (int, optiona... | 2 | stack_v2_sparse_classes_30k_train_033483 | Implement the Python class `DeepAndCrossNetworkModel` described below.
Class description:
DeepAndCrossNetworkModel is a model of deep and cross network, which is a model of a concatenation of deep neural network and cross network, and finally pass to a fully connect layer for the output. :Reference: #. `Ruoxi Wang et ... | Implement the Python class `DeepAndCrossNetworkModel` described below.
Class description:
DeepAndCrossNetworkModel is a model of deep and cross network, which is a model of a concatenation of deep neural network and cross network, and finally pass to a fully connect layer for the output. :Reference: #. `Ruoxi Wang et ... | 8b4cdbd5ed126a86da3bd9ef1665a6985dedc07c | <|skeleton|>
class DeepAndCrossNetworkModel:
"""DeepAndCrossNetworkModel is a model of deep and cross network, which is a model of a concatenation of deep neural network and cross network, and finally pass to a fully connect layer for the output. :Reference: #. `Ruoxi Wang et al, 2017. Deep & Cross Network for Ad C... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeepAndCrossNetworkModel:
"""DeepAndCrossNetworkModel is a model of deep and cross network, which is a model of a concatenation of deep neural network and cross network, and finally pass to a fully connect layer for the output. :Reference: #. `Ruoxi Wang et al, 2017. Deep & Cross Network for Ad Click Predicti... | the_stack_v2_python_sparse | torecsys/models/ctr/deep_and_cross_network.py | codeants2012/torecsys | train | 0 |
2db57ec560f5916c5fdf2a96ce9d6b158fe5ee45 | [
"mapping = {'processing': 'process', 'created_at': 'create_time', 'succeeded': 'succeed'}\nif 'order_field' in params and params['order_field'] in mapping:\n params['order_field'] = mapping[params['order_field']]\nreturn super(Task, cls).list(session, paginated=paginated, **params)",
"request = self._prepare_r... | <|body_start_0|>
mapping = {'processing': 'process', 'created_at': 'create_time', 'succeeded': 'succeed'}
if 'order_field' in params and params['order_field'] in mapping:
params['order_field'] = mapping[params['order_field']]
return super(Task, cls).list(session, paginated=paginated,... | Task | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Task:
def list(cls, session, paginated=False, **params):
"""Override to mapping query parameters In order to be PEP8 compatible, we rename some attributes. When the query parameter 'order_field' is set to one of these attributes, we need map it back to the name on server side. This resou... | stack_v2_sparse_classes_75kplus_train_070588 | 6,042 | permissive | [
{
"docstring": "Override to mapping query parameters In order to be PEP8 compatible, we rename some attributes. When the query parameter 'order_field' is set to one of these attributes, we need map it back to the name on server side. This resource object list generator handles pagination and takes query params ... | 2 | stack_v2_sparse_classes_30k_train_005699 | Implement the Python class `Task` described below.
Class description:
Implement the Task class.
Method signatures and docstrings:
- def list(cls, session, paginated=False, **params): Override to mapping query parameters In order to be PEP8 compatible, we rename some attributes. When the query parameter 'order_field' ... | Implement the Python class `Task` described below.
Class description:
Implement the Task class.
Method signatures and docstrings:
- def list(cls, session, paginated=False, **params): Override to mapping query parameters In order to be PEP8 compatible, we rename some attributes. When the query parameter 'order_field' ... | 60d75438d71ffb7998f5dc407ffa890cc98d3171 | <|skeleton|>
class Task:
def list(cls, session, paginated=False, **params):
"""Override to mapping query parameters In order to be PEP8 compatible, we rename some attributes. When the query parameter 'order_field' is set to one of these attributes, we need map it back to the name on server side. This resou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Task:
def list(cls, session, paginated=False, **params):
"""Override to mapping query parameters In order to be PEP8 compatible, we rename some attributes. When the query parameter 'order_field' is set to one of these attributes, we need map it back to the name on server side. This resource object lis... | the_stack_v2_python_sparse | openstack/cdn/v1/task.py | huaweicloudsdk/sdk-python | train | 20 | |
68024d45a6397e03ccc2bd7a7bfe9c0bd4ec51c5 | [
"self.client.post('/lists/new', data={'item_text': 'A new list item'})\nself.assertEqual(Item.objects.count(), 1)\nnew_item = Item.objects.first()\nself.assertEqual(new_item.text, 'A new list item')",
"response = self.client.post('/lists/new', data={'item_text': 'A new list item'})\nnew_list = List.objects.first(... | <|body_start_0|>
self.client.post('/lists/new', data={'item_text': 'A new list item'})
self.assertEqual(Item.objects.count(), 1)
new_item = Item.objects.first()
self.assertEqual(new_item.text, 'A new list item')
<|end_body_0|>
<|body_start_1|>
response = self.client.post('/lists... | NewListTest provides tests for creating a new list | NewListTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewListTest:
"""NewListTest provides tests for creating a new list"""
def test_saving_a_post_request(self):
"""Tests if a simple POST request is actually saved"""
<|body_0|>
def test_redirects_after_post(self):
"""Tests if we're redirected after a POST"""
... | stack_v2_sparse_classes_75kplus_train_070589 | 6,998 | no_license | [
{
"docstring": "Tests if a simple POST request is actually saved",
"name": "test_saving_a_post_request",
"signature": "def test_saving_a_post_request(self)"
},
{
"docstring": "Tests if we're redirected after a POST",
"name": "test_redirects_after_post",
"signature": "def test_redirects_a... | 2 | null | Implement the Python class `NewListTest` described below.
Class description:
NewListTest provides tests for creating a new list
Method signatures and docstrings:
- def test_saving_a_post_request(self): Tests if a simple POST request is actually saved
- def test_redirects_after_post(self): Tests if we're redirected af... | Implement the Python class `NewListTest` described below.
Class description:
NewListTest provides tests for creating a new list
Method signatures and docstrings:
- def test_saving_a_post_request(self): Tests if a simple POST request is actually saved
- def test_redirects_after_post(self): Tests if we're redirected af... | 41651b51cade98cd4fe22c248ac67ba90ce68f25 | <|skeleton|>
class NewListTest:
"""NewListTest provides tests for creating a new list"""
def test_saving_a_post_request(self):
"""Tests if a simple POST request is actually saved"""
<|body_0|>
def test_redirects_after_post(self):
"""Tests if we're redirected after a POST"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NewListTest:
"""NewListTest provides tests for creating a new list"""
def test_saving_a_post_request(self):
"""Tests if a simple POST request is actually saved"""
self.client.post('/lists/new', data={'item_text': 'A new list item'})
self.assertEqual(Item.objects.count(), 1)
... | the_stack_v2_python_sparse | tdd-python/project01/superlists/lists/tests.py | fbidu/Etudes | train | 2 |
447a5ffcda44bfc1c757ac8da2f22c0d3253cb1d | [
"if model._meta.app_label in settings.DATABASE_APPS_MAPPING:\n return settings.DATABASE_APPS_MAPPING[model._meta.app_label]\nreturn None",
"if model._meta.app_label in settings.DATABASE_APPS_MAPPING:\n return settings.DATABASE_APPS_MAPPING[model._meta.app_label]\nreturn None",
"db1 = settings.DATABASE_APP... | <|body_start_0|>
if model._meta.app_label in settings.DATABASE_APPS_MAPPING:
return settings.DATABASE_APPS_MAPPING[model._meta.app_label]
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label in settings.DATABASE_APPS_MAPPING:
return settings.DATABASE_APPS... | A router to control all database operations on models in the supplier application. | SupplierMgrRouter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SupplierMgrRouter:
"""A router to control all database operations on models in the supplier application."""
def db_for_read(self, model, **hints):
"""Attempts to read supplier_mgr models go to supplier_mgr."""
<|body_0|>
def db_for_write(self, model, **hints):
""... | stack_v2_sparse_classes_75kplus_train_070590 | 2,162 | no_license | [
{
"docstring": "Attempts to read supplier_mgr models go to supplier_mgr.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Attempts to write supplier_mgr models go to supplier_mgr.",
"name": "db_for_write",
"signature": "def db_for_write(sel... | 4 | stack_v2_sparse_classes_30k_train_049362 | Implement the Python class `SupplierMgrRouter` described below.
Class description:
A router to control all database operations on models in the supplier application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read supplier_mgr models go to supplier_mgr.
- def db_for_write(s... | Implement the Python class `SupplierMgrRouter` described below.
Class description:
A router to control all database operations on models in the supplier application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read supplier_mgr models go to supplier_mgr.
- def db_for_write(s... | b57173d445b4ecce282a7035e8ffdd42e5d79959 | <|skeleton|>
class SupplierMgrRouter:
"""A router to control all database operations on models in the supplier application."""
def db_for_read(self, model, **hints):
"""Attempts to read supplier_mgr models go to supplier_mgr."""
<|body_0|>
def db_for_write(self, model, **hints):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SupplierMgrRouter:
"""A router to control all database operations on models in the supplier application."""
def db_for_read(self, model, **hints):
"""Attempts to read supplier_mgr models go to supplier_mgr."""
if model._meta.app_label in settings.DATABASE_APPS_MAPPING:
return ... | the_stack_v2_python_sparse | apps/db_router.py | cpf1993/assist_test | train | 1 |
fa6035d8192666f1a8b0f3dd543e2ac97d291c67 | [
"source_dir = os.path.join(os.path.dirname(dir_path), 'image')\ntarget_dir = os.path.join(os.path.dirname(dir_path), 'image_target')\nself.imageutil = ImageUtils(source_dir, target_dir)",
"print('欢迎来到图片处理页面'.center(100, '*'))\nmenu = ['文件夹下所有图片缩略功能', '获取件夹下所有图片大小数据并且保存到excel']\nfor i in range(len(menu)):\n pri... | <|body_start_0|>
source_dir = os.path.join(os.path.dirname(dir_path), 'image')
target_dir = os.path.join(os.path.dirname(dir_path), 'image_target')
self.imageutil = ImageUtils(source_dir, target_dir)
<|end_body_0|>
<|body_start_1|>
print('欢迎来到图片处理页面'.center(100, '*'))
menu = ['文... | 图片操作类 | ImageManage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageManage:
"""图片操作类"""
def __init__(self):
"""初始化"""
<|body_0|>
def image_page(self):
"""图片处理页面"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
source_dir = os.path.join(os.path.dirname(dir_path), 'image')
target_dir = os.path.join(os.... | stack_v2_sparse_classes_75kplus_train_070591 | 1,225 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "图片处理页面",
"name": "image_page",
"signature": "def image_page(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002410 | Implement the Python class `ImageManage` described below.
Class description:
图片操作类
Method signatures and docstrings:
- def __init__(self): 初始化
- def image_page(self): 图片处理页面 | Implement the Python class `ImageManage` described below.
Class description:
图片操作类
Method signatures and docstrings:
- def __init__(self): 初始化
- def image_page(self): 图片处理页面
<|skeleton|>
class ImageManage:
"""图片操作类"""
def __init__(self):
"""初始化"""
<|body_0|>
def image_page(self):
... | 173f3a5fa24176df4c53bd36771cc733a1221dfd | <|skeleton|>
class ImageManage:
"""图片操作类"""
def __init__(self):
"""初始化"""
<|body_0|>
def image_page(self):
"""图片处理页面"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageManage:
"""图片操作类"""
def __init__(self):
"""初始化"""
source_dir = os.path.join(os.path.dirname(dir_path), 'image')
target_dir = os.path.join(os.path.dirname(dir_path), 'image_target')
self.imageutil = ImageUtils(source_dir, target_dir)
def image_page(self):
... | the_stack_v2_python_sparse | 0303system-yanchunwei/joker_work/core/image_page.py | Joker2018goon/myGitRepo | train | 1 |
1f45d7634752d535e2fae7d0c26f04eedfae0b39 | [
"super(MeshPooling, self).__init__()\nself.cached = cached\nself.index = index\nself.face = face",
"if self.matrix is None or not self.cached:\n self.face, self.index = unsubdivide(x.pos, x.face)[1:]\nx.pos = x.pos[self.index]\nx.norm = x.norm[self.index]\nx.face = self.face\nif len(args) == 0:\n return x\n... | <|body_start_0|>
super(MeshPooling, self).__init__()
self.cached = cached
self.index = index
self.face = face
<|end_body_0|>
<|body_start_1|>
if self.matrix is None or not self.cached:
self.face, self.index = unsubdivide(x.pos, x.face)[1:]
x.pos = x.pos[self.... | A class representing a mesh pooling layer. It supposes the input mesh is trivially poolable Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input index : LongTensor the vertices indices face : LongTensor the topology tensor Methods ------- forward(x, *args) pools the ... | MeshPooling | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeshPooling:
"""A class representing a mesh pooling layer. It supposes the input mesh is trivially poolable Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input index : LongTensor the vertices indices face : LongTensor the topology tensor Metho... | stack_v2_sparse_classes_75kplus_train_070592 | 1,745 | permissive | [
{
"docstring": "Parameters ---------- index : LongTensor (optional) the vertices indices (default is None) face : LongTensor (optional) the topology tensor (default is None) cached : bool (optional) if True caches the pooling data, otherwise computes it at every input (default is True)",
"name": "__init__",... | 2 | stack_v2_sparse_classes_30k_train_018526 | Implement the Python class `MeshPooling` described below.
Class description:
A class representing a mesh pooling layer. It supposes the input mesh is trivially poolable Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input index : LongTensor the vertices indices face... | Implement the Python class `MeshPooling` described below.
Class description:
A class representing a mesh pooling layer. It supposes the input mesh is trivially poolable Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input index : LongTensor the vertices indices face... | 2615b66dd4addfd5c03d9d91a24c7da414294308 | <|skeleton|>
class MeshPooling:
"""A class representing a mesh pooling layer. It supposes the input mesh is trivially poolable Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input index : LongTensor the vertices indices face : LongTensor the topology tensor Metho... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MeshPooling:
"""A class representing a mesh pooling layer. It supposes the input mesh is trivially poolable Attributes ---------- cached : bool if True caches the pooling data, otherwise computes it at every input index : LongTensor the vertices indices face : LongTensor the topology tensor Methods ------- fo... | the_stack_v2_python_sparse | ACME/layer/MeshPooling.py | mauriziokovacic/ACME | train | 3 |
521b6e2bd7559ee63bed15b41c4a0d8c27130f72 | [
"order = []\n\ndef pre_order(root):\n if not root:\n return None\n order.append(root.val)\n for each_child in root.children:\n pre_order(each_child)\n order.append('#')\npre_order(root)\nreturn ','.join(order)",
"if data is None or data == '':\n return None\ndata = data.split(',')\nst... | <|body_start_0|>
order = []
def pre_order(root):
if not root:
return None
order.append(root.val)
for each_child in root.children:
pre_order(each_child)
order.append('#')
pre_order(root)
return ','.join(order... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus_train_070593 | 1,278 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: 'Node') -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def des... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | 80cca595dc688ca67c1ebb45b339e724ec09c374 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
order = []
def pre_order(root):
if not root:
return None
order.append(root.val)
for each_child in root.children:
... | the_stack_v2_python_sparse | Concepts/Standard_Problems/428.Serialize_Deserialize_n-ary-Tree.py | Dinesh94Singh/PythonArchivedSolutions | train | 0 | |
4a6cd231bc1ab9337260633317550acfca1f08ec | [
"if hasattr(value, '__class__') and value.__class__.__name__ == 'color':\n return value.copy()\nelif isinstance(value, list):\n return [self._copy_val(v) for v in value]\nelse:\n return copy.deepcopy(value)",
"raw = {}\nfor key, val in self.items():\n raw[key] = self._copy_val(val)\nreturn raw",
"fr... | <|body_start_0|>
if hasattr(value, '__class__') and value.__class__.__name__ == 'color':
return value.copy()
elif isinstance(value, list):
return [self._copy_val(v) for v in value]
else:
return copy.deepcopy(value)
<|end_body_0|>
<|body_start_1|>
raw ... | [x] TODO: -------- Rebuild in not allowing the NOT_CONFIGURABLE fields to be overridden by the user. We will have to do this when the configuration is overridden. | ColorsDoc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ColorsDoc:
"""[x] TODO: -------- Rebuild in not allowing the NOT_CONFIGURABLE fields to be overridden by the user. We will have to do this when the configuration is overridden."""
def _copy_val(self, value):
"""[!] IMPORTANT: -------------- Before we initialize the settings with the ... | stack_v2_sparse_classes_75kplus_train_070594 | 11,129 | no_license | [
{
"docstring": "[!] IMPORTANT: -------------- Before we initialize the settings with the ConfigDoc instances, settings.as_dict() is called which will perform a deepcopy of the read raw settings. This means we have to allow the copying of str instances.",
"name": "_copy_val",
"signature": "def _copy_val(... | 3 | null | Implement the Python class `ColorsDoc` described below.
Class description:
[x] TODO: -------- Rebuild in not allowing the NOT_CONFIGURABLE fields to be overridden by the user. We will have to do this when the configuration is overridden.
Method signatures and docstrings:
- def _copy_val(self, value): [!] IMPORTANT: -... | Implement the Python class `ColorsDoc` described below.
Class description:
[x] TODO: -------- Rebuild in not allowing the NOT_CONFIGURABLE fields to be overridden by the user. We will have to do this when the configuration is overridden.
Method signatures and docstrings:
- def _copy_val(self, value): [!] IMPORTANT: -... | 3570992d48ca4d12b0e535ba9ba3a63f9cc334a3 | <|skeleton|>
class ColorsDoc:
"""[x] TODO: -------- Rebuild in not allowing the NOT_CONFIGURABLE fields to be overridden by the user. We will have to do this when the configuration is overridden."""
def _copy_val(self, value):
"""[!] IMPORTANT: -------------- Before we initialize the settings with the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ColorsDoc:
"""[x] TODO: -------- Rebuild in not allowing the NOT_CONFIGURABLE fields to be overridden by the user. We will have to do this when the configuration is overridden."""
def _copy_val(self, value):
"""[!] IMPORTANT: -------------- Before we initialize the settings with the ConfigDoc ins... | the_stack_v2_python_sparse | termx/config/sections.py | nickmflorin/termx | train | 1 |
01ed6cde8562041887f4c0ac5f338ba3d8d5b174 | [
"self._created = False\nSubComponent.set_parent(self, new_parent, init)\nif self.index == -1 or self.index > self._parent.wx_obj.GetColumnCount():\n self.index = self._parent.wx_obj.GetColumnCount()\nself._parent.wx_obj.InsertColumn(self.index, self.text, self._align, self.width)\nself._created = True",
"if se... | <|body_start_0|>
self._created = False
SubComponent.set_parent(self, new_parent, init)
if self.index == -1 or self.index > self._parent.wx_obj.GetColumnCount():
self.index = self._parent.wx_obj.GetColumnCount()
self._parent.wx_obj.InsertColumn(self.index, self.text, self._ali... | ListView sub-component to handle heading, align and width of columns | ListColumn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListColumn:
"""ListView sub-component to handle heading, align and width of columns"""
def set_parent(self, new_parent, init=False):
"""Associate the header to the control (it could be recreated)"""
<|body_0|>
def __del__(self):
"""Hook to remove the column from ... | stack_v2_sparse_classes_75kplus_train_070595 | 19,709 | no_license | [
{
"docstring": "Associate the header to the control (it could be recreated)",
"name": "set_parent",
"signature": "def set_parent(self, new_parent, init=False)"
},
{
"docstring": "Hook to remove the column from the wx ListCtrl when deleted",
"name": "__del__",
"signature": "def __del__(se... | 3 | null | Implement the Python class `ListColumn` described below.
Class description:
ListView sub-component to handle heading, align and width of columns
Method signatures and docstrings:
- def set_parent(self, new_parent, init=False): Associate the header to the control (it could be recreated)
- def __del__(self): Hook to re... | Implement the Python class `ListColumn` described below.
Class description:
ListView sub-component to handle heading, align and width of columns
Method signatures and docstrings:
- def set_parent(self, new_parent, init=False): Associate the header to the control (it could be recreated)
- def __del__(self): Hook to re... | 19fe289b151c38b075d0d62146d1b838222eaa7f | <|skeleton|>
class ListColumn:
"""ListView sub-component to handle heading, align and width of columns"""
def set_parent(self, new_parent, init=False):
"""Associate the header to the control (it could be recreated)"""
<|body_0|>
def __del__(self):
"""Hook to remove the column from ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListColumn:
"""ListView sub-component to handle heading, align and width of columns"""
def set_parent(self, new_parent, init=False):
"""Associate the header to the control (it could be recreated)"""
self._created = False
SubComponent.set_parent(self, new_parent, init)
if s... | the_stack_v2_python_sparse | gui/controls/listview.py | oscarvogel/guiabm | train | 0 |
3205407c2ea11c8216c971e2491bac6e221987ab | [
"self.l = []\ni = 0\nwhile i < max(len(v1), len(v2)):\n if i < len(v1):\n self.l.append(v1[i])\n if i < len(v2):\n self.l.append(v2[i])\n i = i + 1\nself.index = 0",
"nextEle = self.l[self.index]\nself.index = self.index + 1\nreturn nextEle",
"if self.index < len(self.l):\n return True... | <|body_start_0|>
self.l = []
i = 0
while i < max(len(v1), len(v2)):
if i < len(v1):
self.l.append(v1[i])
if i < len(v2):
self.l.append(v2[i])
i = i + 1
self.index = 0
<|end_body_0|>
<|body_start_1|>
nextEle = se... | ZigzagIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_75kplus_train_070596 | 970 | no_license | [
{
"docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]",
"name": "__init__",
"signature": "def __init__(self, v1, v2)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"name"... | 3 | stack_v2_sparse_classes_30k_train_026712 | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | 0a2e0e4a5176c02910d7718c42903d10a6c47a5f | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
self.l = []
i = 0
while i < max(len(v1), len(v2)):
if i < len(v1):
self.l.append(v1[i])
if i < len(v2):
... | the_stack_v2_python_sparse | Zigzag_Iterator.py | baichuan/Leetcode | train | 0 | |
7dfdf18767a6ae32e0dce76325cd25279ebabf35 | [
"if 'X-API-KEY' in request.headers:\n apiKey = request.headers['X-API-KEY']\n adminKeyCheck = apiFunc.isValidAdminKey(apiKey)\n if adminKeyCheck is True:\n args = roleArgs.parse_args()\n if 'username' and 'role' in args:\n username = args['username']\n role = args['role'... | <|body_start_0|>
if 'X-API-KEY' in request.headers:
apiKey = request.headers['X-API-KEY']
adminKeyCheck = apiFunc.isValidAdminKey(apiKey)
if adminKeyCheck is True:
args = roleArgs.parse_args()
if 'username' and 'role' in args:
... | api_1_RoleMgmt | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class api_1_RoleMgmt:
def post(self):
"""Add a role to a user - **Admin API Key Required**"""
<|body_0|>
def delete(self):
"""Remove a role from a user - **Admin API Key Required**"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if 'X-API-KEY' in request.... | stack_v2_sparse_classes_75kplus_train_070597 | 11,275 | permissive | [
{
"docstring": "Add a role to a user - **Admin API Key Required**",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Remove a role from a user - **Admin API Key Required**",
"name": "delete",
"signature": "def delete(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027770 | Implement the Python class `api_1_RoleMgmt` described below.
Class description:
Implement the api_1_RoleMgmt class.
Method signatures and docstrings:
- def post(self): Add a role to a user - **Admin API Key Required**
- def delete(self): Remove a role from a user - **Admin API Key Required** | Implement the Python class `api_1_RoleMgmt` described below.
Class description:
Implement the api_1_RoleMgmt class.
Method signatures and docstrings:
- def post(self): Add a role to a user - **Admin API Key Required**
- def delete(self): Remove a role from a user - **Admin API Key Required**
<|skeleton|>
class api_1... | 9088c44616a2e94f6771216af6f22c241064e321 | <|skeleton|>
class api_1_RoleMgmt:
def post(self):
"""Add a role to a user - **Admin API Key Required**"""
<|body_0|>
def delete(self):
"""Remove a role from a user - **Admin API Key Required**"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class api_1_RoleMgmt:
def post(self):
"""Add a role to a user - **Admin API Key Required**"""
if 'X-API-KEY' in request.headers:
apiKey = request.headers['X-API-KEY']
adminKeyCheck = apiFunc.isValidAdminKey(apiKey)
if adminKeyCheck is True:
args = ... | the_stack_v2_python_sparse | blueprints/apis/user_ns.py | codions-forks/flask-nginx-rtmp-manager | train | 1 | |
60b6f295ddd87b82012757600032b51d757b62d4 | [
"self.key = key\nself.overwrite = overwrite\nself.value = value\nself.variable_type = variable_type",
"def output(app, *args, **kwargs):\n \"\"\"Call the function and store or append return value.\n\n Args:\n app (class): The instance of the App class \"self\".\n \"\"\"\n ... | <|body_start_0|>
self.key = key
self.overwrite = overwrite
self.value = value
self.variable_type = variable_type
<|end_body_0|>
<|body_start_1|>
def output(app, *args, **kwargs):
"""Call the function and store or append return value.
Args:
... | Write the App output variables to Redis. This decorator will take the functions return value and write the data to Redis using the key and variable_type. An optional hard coded value can be passed, which will override the return value. If multiple value are provided for the same output variable there is an option to ov... | WriteOutput | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WriteOutput:
"""Write the App output variables to Redis. This decorator will take the functions return value and write the data to Redis using the key and variable_type. An optional hard coded value can be passed, which will override the return value. If multiple value are provided for the same o... | stack_v2_sparse_classes_75kplus_train_070598 | 22,792 | permissive | [
{
"docstring": "Initialize Class Properties. Args: key (str): The name of the playbook output variable. variable_type (str): The type for the playbook output variable. Supported types are: String, Binary, KeyValue, TCEntity, TCEnhancedEntity, StringArray, BinaryArray, KeyValueArray, TCEntityArray, TCEnhancedEnt... | 2 | null | Implement the Python class `WriteOutput` described below.
Class description:
Write the App output variables to Redis. This decorator will take the functions return value and write the data to Redis using the key and variable_type. An optional hard coded value can be passed, which will override the return value. If mul... | Implement the Python class `WriteOutput` described below.
Class description:
Write the App output variables to Redis. This decorator will take the functions return value and write the data to Redis using the key and variable_type. An optional hard coded value can be passed, which will override the return value. If mul... | 78680f055f4259e31f0b4989a5695604108d9fdd | <|skeleton|>
class WriteOutput:
"""Write the App output variables to Redis. This decorator will take the functions return value and write the data to Redis using the key and variable_type. An optional hard coded value can be passed, which will override the return value. If multiple value are provided for the same o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WriteOutput:
"""Write the App output variables to Redis. This decorator will take the functions return value and write the data to Redis using the key and variable_type. An optional hard coded value can be passed, which will override the return value. If multiple value are provided for the same output variabl... | the_stack_v2_python_sparse | tcex/decorators/app_decorators.py | brikardtc/tcex | train | 0 |
e449e7d1c34871c58ccdbb9e7564c4d0e664f25d | [
"if x == 0:\n return 0\nleft = 1\nright = x // 2\nwhile left < right:\n mid = left + right + 1 >> 1\n square = mid * mid\n if square > x:\n right = mid - 1\n else:\n left = mid\nreturn left",
"if x == 0:\n return 0\ncur = 1\nwhile True:\n pre = cur\n cur = (cur + x / cur) / 2... | <|body_start_0|>
if x == 0:
return 0
left = 1
right = x // 2
while left < right:
mid = left + right + 1 >> 1
square = mid * mid
if square > x:
right = mid - 1
else:
left = mid
return left
... | # 二分法 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x == 0:
return 0
left = 1
right... | stack_v2_sparse_classes_75kplus_train_070599 | 1,468 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt1",
"signature": "def mySqrt1(self, x)"
},
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt",
"signature": "def mySqrt(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027395 | Implement the Python class `Solution` described below.
Class description:
# 二分法
Method signatures and docstrings:
- def mySqrt1(self, x): :type x: int :rtype: int
- def mySqrt(self, x): :type x: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
# 二分法
Method signatures and docstrings:
- def mySqrt1(self, x): :type x: int :rtype: int
- def mySqrt(self, x): :type x: int :rtype: int
<|skeleton|>
class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: in... | f831fd9603592ae5bee3679924f962a3ebce381c | <|skeleton|>
class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""# 二分法"""
def mySqrt1(self, x):
""":type x: int :rtype: int"""
if x == 0:
return 0
left = 1
right = x // 2
while left < right:
mid = left + right + 1 >> 1
square = mid * mid
if square > x:
... | the_stack_v2_python_sparse | old/t20190918_mySqrt/mySqrt.py | GongFuXiong/leetcode | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.