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 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fb876e9557fbaf65f78c669c841a09b0fb61fed3 | [
"self.priority_queue = {}\nif isinstance(values, list):\n try:\n for value, priority in values:\n self.insert(value, priority)\n except ValueError:\n raise TypeError('You need to tuplize your priorities')\nelse:\n raise TypeError('Put your items in a list')",
"if not isinstance(p... | <|body_start_0|>
self.priority_queue = {}
if isinstance(values, list):
try:
for value, priority in values:
self.insert(value, priority)
except ValueError:
raise TypeError('You need to tuplize your priorities')
else:
... | Defines a priority queue. | Priority | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Priority:
"""Defines a priority queue."""
def __init__(self, values=[]):
"""Initalize the queue chain."""
<|body_0|>
def insert(self, value, priority=2):
"""Insert value into Priority Queue based on Priority."""
<|body_1|>
def pop(self):
"""T... | stack_v2_sparse_classes_10k_train_003500 | 1,801 | no_license | [
{
"docstring": "Initalize the queue chain.",
"name": "__init__",
"signature": "def __init__(self, values=[])"
},
{
"docstring": "Insert value into Priority Queue based on Priority.",
"name": "insert",
"signature": "def insert(self, value, priority=2)"
},
{
"docstring": "The the n... | 4 | stack_v2_sparse_classes_30k_train_004401 | Implement the Python class `Priority` described below.
Class description:
Defines a priority queue.
Method signatures and docstrings:
- def __init__(self, values=[]): Initalize the queue chain.
- def insert(self, value, priority=2): Insert value into Priority Queue based on Priority.
- def pop(self): The the next ite... | Implement the Python class `Priority` described below.
Class description:
Defines a priority queue.
Method signatures and docstrings:
- def __init__(self, values=[]): Initalize the queue chain.
- def insert(self, value, priority=2): Insert value into Priority Queue based on Priority.
- def pop(self): The the next ite... | f407fcd0d8cfcd5c7685616137377b3050932b5b | <|skeleton|>
class Priority:
"""Defines a priority queue."""
def __init__(self, values=[]):
"""Initalize the queue chain."""
<|body_0|>
def insert(self, value, priority=2):
"""Insert value into Priority Queue based on Priority."""
<|body_1|>
def pop(self):
"""T... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Priority:
"""Defines a priority queue."""
def __init__(self, values=[]):
"""Initalize the queue chain."""
self.priority_queue = {}
if isinstance(values, list):
try:
for value, priority in values:
self.insert(value, priority)
... | the_stack_v2_python_sparse | src/priority.py | scotist/data-structures | train | 1 |
b086ff106deb5c7a92d5a32ff39423214fabfa86 | [
"a0 = -4.1236\na1 = 13.788\na2 = -26.068\na3 = 26.272\na4 = -14.663\na5 = 4.4954\na6 = -0.6905\na7 = 0.0397\nlog_t = math.log10(temperature)\nf_exp = a0 + a1 * log_t + a2 * log_t ** 2.0 + a3 * log_t ** 3.0 + a4 * log_t ** 4.0 + a5 * log_t ** 5.0 + a6 * log_t ** 6.0 + a7 * log_t ** 7\ng10_thermal_conductivity = 10.0... | <|body_start_0|>
a0 = -4.1236
a1 = 13.788
a2 = -26.068
a3 = 26.272
a4 = -14.663
a5 = 4.4954
a6 = -0.6905
a7 = 0.0397
log_t = math.log10(temperature)
f_exp = a0 + a1 * log_t + a2 * log_t ** 2.0 + a3 * log_t ** 3.0 + a4 * log_t ** 4.0 + a5 * ... | G10NISTMaterialProperties | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class G10NISTMaterialProperties:
def thermal_conductivity(temperature):
"""Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float"""
<|body_0|>
def volumetric_heat_capacity(temperature):
... | stack_v2_sparse_classes_10k_train_003501 | 1,623 | no_license | [
{
"docstring": "Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float",
"name": "thermal_conductivity",
"signature": "def thermal_conductivity(temperature)"
},
{
"docstring": "Calculates volumetric heat ... | 2 | stack_v2_sparse_classes_30k_train_001002 | Implement the Python class `G10NISTMaterialProperties` described below.
Class description:
Implement the G10NISTMaterialProperties class.
Method signatures and docstrings:
- def thermal_conductivity(temperature): Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as flo... | Implement the Python class `G10NISTMaterialProperties` described below.
Class description:
Implement the G10NISTMaterialProperties class.
Method signatures and docstrings:
- def thermal_conductivity(temperature): Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as flo... | 3872a62c01b6d0f7dca97042bbd26b95a2ecc952 | <|skeleton|>
class G10NISTMaterialProperties:
def thermal_conductivity(temperature):
"""Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float"""
<|body_0|>
def volumetric_heat_capacity(temperature):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class G10NISTMaterialProperties:
def thermal_conductivity(temperature):
"""Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float"""
a0 = -4.1236
a1 = 13.788
a2 = -26.068
a3 = 26.272
... | the_stack_v2_python_sparse | source/materials/g10_nist_material_properties.py | MichalWilczek/steam-ansys-modelling | train | 1 | |
94d13429b67386fa0227672b5ce7c89627ff85c6 | [
"if not root:\n return True\nif not root.left and (not root.right):\n return True\nif not root.left or not root.right:\n return False\ndeque = []\ncur = root\ndeque.append(cur)\nwhile deque:\n n = len(deque)\n stack = []\n for i in range(n):\n cur = deque.pop(0)\n if cur:\n ... | <|body_start_0|>
if not root:
return True
if not root.left and (not root.right):
return True
if not root.left or not root.right:
return False
deque = []
cur = root
deque.append(cur)
while deque:
n = len(deque)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric0(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return True
... | stack_v2_sparse_classes_10k_train_003502 | 2,013 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric0",
"signature": "def isSymmetric0(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002641 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric0(self, root): :type root: TreeNode :rtype: bool
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric0(self, root): :type root: TreeNode :rtype: bool
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
<|skeleton|>
class Solution:
def isSymmetri... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def isSymmetric0(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isSymmetric0(self, root):
""":type root: TreeNode :rtype: bool"""
if not root:
return True
if not root.left and (not root.right):
return True
if not root.left or not root.right:
return False
deque = []
cur = root... | the_stack_v2_python_sparse | 剑指 Offer 28. 对称的二叉树.py | yangyuxiang1996/leetcode | train | 0 | |
31f0a64d83123fb73705b02f5c6d8c2aa113a732 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkingHours()",
"from .day_of_week import DayOfWeek\nfrom .time_zone_base import TimeZoneBase\nfrom .day_of_week import DayOfWeek\nfrom .time_zone_base import TimeZoneBase\nfields: Dict[str, Callable[[Any], None]] = {'daysOfWeek': lam... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkingHours()
<|end_body_0|>
<|body_start_1|>
from .day_of_week import DayOfWeek
from .time_zone_base import TimeZoneBase
from .day_of_week import DayOfWeek
from .time_z... | WorkingHours | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkingHours:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkingHours:
"""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: ... | stack_v2_sparse_classes_10k_train_003503 | 3,572 | 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: WorkingHours",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(... | 3 | stack_v2_sparse_classes_30k_test_000098 | Implement the Python class `WorkingHours` described below.
Class description:
Implement the WorkingHours class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkingHours: Creates a new instance of the appropriate class based on discriminator value Ar... | Implement the Python class `WorkingHours` described below.
Class description:
Implement the WorkingHours class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkingHours: Creates a new instance of the appropriate class based on discriminator value Ar... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkingHours:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkingHours:
"""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: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkingHours:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkingHours:
"""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: WorkingHours""... | the_stack_v2_python_sparse | msgraph/generated/models/working_hours.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
0d38f9e18c8ce70021ca88784cdc900323a691ac | [
"if low < high:\n pi = self.partition(lst, low, high)\n self.quick_sort(lst, low, pi - 1)\n self.quick_sort(lst, pi + 1, high)",
"pivot = int((low + high) / 2)\nlst[pivot], lst[high] = (lst[high], lst[pivot])\npivot = high\ni = low - 1\nfor j in range(low, high):\n if lst[j] <= lst[pivot]:\n i ... | <|body_start_0|>
if low < high:
pi = self.partition(lst, low, high)
self.quick_sort(lst, low, pi - 1)
self.quick_sort(lst, pi + 1, high)
<|end_body_0|>
<|body_start_1|>
pivot = int((low + high) / 2)
lst[pivot], lst[high] = (lst[high], lst[pivot])
pivo... | QuickSort | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuickSort:
def quick_sort(self, lst, low, high):
"""Takes a list and sorts it"""
<|body_0|>
def partition(self, lst, low, high):
"""Splits the list by a pivot point Swaps high number from right with low number from left and returns the pivot point"""
<|body_1... | stack_v2_sparse_classes_10k_train_003504 | 1,451 | no_license | [
{
"docstring": "Takes a list and sorts it",
"name": "quick_sort",
"signature": "def quick_sort(self, lst, low, high)"
},
{
"docstring": "Splits the list by a pivot point Swaps high number from right with low number from left and returns the pivot point",
"name": "partition",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_002014 | Implement the Python class `QuickSort` described below.
Class description:
Implement the QuickSort class.
Method signatures and docstrings:
- def quick_sort(self, lst, low, high): Takes a list and sorts it
- def partition(self, lst, low, high): Splits the list by a pivot point Swaps high number from right with low nu... | Implement the Python class `QuickSort` described below.
Class description:
Implement the QuickSort class.
Method signatures and docstrings:
- def quick_sort(self, lst, low, high): Takes a list and sorts it
- def partition(self, lst, low, high): Splits the list by a pivot point Swaps high number from right with low nu... | 687f7b91404fd0f32e8dfc4e76ea9534e98d1c50 | <|skeleton|>
class QuickSort:
def quick_sort(self, lst, low, high):
"""Takes a list and sorts it"""
<|body_0|>
def partition(self, lst, low, high):
"""Splits the list by a pivot point Swaps high number from right with low number from left and returns the pivot point"""
<|body_1... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuickSort:
def quick_sort(self, lst, low, high):
"""Takes a list and sorts it"""
if low < high:
pi = self.partition(lst, low, high)
self.quick_sort(lst, low, pi - 1)
self.quick_sort(lst, pi + 1, high)
def partition(self, lst, low, high):
"""Spli... | the_stack_v2_python_sparse | Final_Capstone_Projects/Classic Algorithms/QuickSort.py | EthanShapiro/PythonCompleteCourse | train | 0 | |
2ae12c270e15950e2a9cf86d55e1865b6a2f354f | [
"QMimeData.__init__(self)\nself._local_instance = data\nif data is not None:\n try:\n pdata = dumps(data)\n except:\n return\n self.setData(self.MIME_TYPE, dumps(data.__class__) + pdata)",
"if isinstance(md, cls):\n return md\nif not md.hasFormat(cls.MIME_TYPE):\n return None\nnmd = c... | <|body_start_0|>
QMimeData.__init__(self)
self._local_instance = data
if data is not None:
try:
pdata = dumps(data)
except:
return
self.setData(self.MIME_TYPE, dumps(data.__class__) + pdata)
<|end_body_0|>
<|body_start_1|>
... | The PyMimeData wraps a Python instance as MIME data. | PyMimeData | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyMimeData:
"""The PyMimeData wraps a Python instance as MIME data."""
def __init__(self, data=None):
"""Initialise the instance."""
<|body_0|>
def coerce(cls, md):
"""Coerce a QMimeData instance to a PyMimeData instance if possible."""
<|body_1|>
de... | stack_v2_sparse_classes_10k_train_003505 | 9,642 | permissive | [
{
"docstring": "Initialise the instance.",
"name": "__init__",
"signature": "def __init__(self, data=None)"
},
{
"docstring": "Coerce a QMimeData instance to a PyMimeData instance if possible.",
"name": "coerce",
"signature": "def coerce(cls, md)"
},
{
"docstring": "Return the in... | 4 | stack_v2_sparse_classes_30k_train_000734 | Implement the Python class `PyMimeData` described below.
Class description:
The PyMimeData wraps a Python instance as MIME data.
Method signatures and docstrings:
- def __init__(self, data=None): Initialise the instance.
- def coerce(cls, md): Coerce a QMimeData instance to a PyMimeData instance if possible.
- def in... | Implement the Python class `PyMimeData` described below.
Class description:
The PyMimeData wraps a Python instance as MIME data.
Method signatures and docstrings:
- def __init__(self, data=None): Initialise the instance.
- def coerce(cls, md): Coerce a QMimeData instance to a PyMimeData instance if possible.
- def in... | 4d42121e4af850ba1bf9a4140c11fe10ba218cdd | <|skeleton|>
class PyMimeData:
"""The PyMimeData wraps a Python instance as MIME data."""
def __init__(self, data=None):
"""Initialise the instance."""
<|body_0|>
def coerce(cls, md):
"""Coerce a QMimeData instance to a PyMimeData instance if possible."""
<|body_1|>
de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PyMimeData:
"""The PyMimeData wraps a Python instance as MIME data."""
def __init__(self, data=None):
"""Initialise the instance."""
QMimeData.__init__(self)
self._local_instance = data
if data is not None:
try:
pdata = dumps(data)
e... | the_stack_v2_python_sparse | yy.py | shyamal388/PythonBlocks | train | 0 |
ed4eb0bcfc0bae64639a6bec0c52ce12cadc8aa9 | [
"self.kids = dict()\nself.val = None\nself.isWord = False",
"current_node = self\nfor idx, letter in enumerate(word):\n if letter not in current_node.kids:\n current_node.kids[letter] = WordDictionary()\n current_node.kids[letter].val = letter\n current_node = current_node.kids[letter]\n if... | <|body_start_0|>
self.kids = dict()
self.val = None
self.isWord = False
<|end_body_0|>
<|body_start_1|>
current_node = self
for idx, letter in enumerate(word):
if letter not in current_node.kids:
current_node.kids[letter] = WordDictionary()
... | WordDictionary | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
<|body_1|>
def search(self, word):
"""Returns if the word i... | stack_v2_sparse_classes_10k_train_003506 | 2,131 | permissive | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adds a word into the data structure. :type word: str :rtype: void",
"name": "addWord",
"signature": "def addWord(self, word)"
},
{
"docstring": "Returns... | 3 | stack_v2_sparse_classes_30k_train_001708 | Implement the Python class `WordDictionary` described below.
Class description:
Implement the WordDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void
- def search(sel... | Implement the Python class `WordDictionary` described below.
Class description:
Implement the WordDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void
- def search(sel... | f462b66ae849f4332a4b150f206dd49c7519e83b | <|skeleton|>
class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
<|body_1|>
def search(self, word):
"""Returns if the word i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
self.kids = dict()
self.val = None
self.isWord = False
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
current_node = self
... | the_stack_v2_python_sparse | LeetCode/DataStructure/trie/word_dictionary.py | hooyao/Coding-Py3 | train | 0 | |
c372fa7fcdfdfbb04fe4dab3378a82e829ff7a10 | [
"if isinstance(model, str):\n model = model.lower()\n if model.startswith('brownian'):\n model = msd.BrownianMotion\n elif model.startswith('anomalous'):\n model = msd.AnomalousDiffusion\n else:\n raise ValueError('Unknown model: ' + model)\nself.msd_fits = [model(md, **kwargs) for ... | <|body_start_0|>
if isinstance(model, str):
model = model.lower()
if model.startswith('brownian'):
model = msd.BrownianMotion
elif model.startswith('anomalous'):
model = msd.AnomalousDiffusion
else:
raise ValueError(... | Fit diffusion parameters to MSDs from square displacement dists | MsdDistFit | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MsdDistFit:
"""Fit diffusion parameters to MSDs from square displacement dists"""
def __init__(self, msd_data, model, weight_data, **kwargs):
"""Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {"brownia... | stack_v2_sparse_classes_10k_train_003507 | 29,188 | permissive | [
{
"docstring": "Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {\"brownian\", \"anomalous\", model class} Model to fit. If \"brownian\", use :py:class:`msd.BrownianMotion`. If \"anomalous\", use :py:class:`msd.AnomalousDiffusion`... | 3 | stack_v2_sparse_classes_30k_train_004278 | Implement the Python class `MsdDistFit` described below.
Class description:
Fit diffusion parameters to MSDs from square displacement dists
Method signatures and docstrings:
- def __init__(self, msd_data, model, weight_data, **kwargs): Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance sh... | Implement the Python class `MsdDistFit` described below.
Class description:
Fit diffusion parameters to MSDs from square displacement dists
Method signatures and docstrings:
- def __init__(self, msd_data, model, weight_data, **kwargs): Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance sh... | 2f953e553f32118c3ad1f244481e5a0ac6c533f0 | <|skeleton|>
class MsdDistFit:
"""Fit diffusion parameters to MSDs from square displacement dists"""
def __init__(self, msd_data, model, weight_data, **kwargs):
"""Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {"brownia... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MsdDistFit:
"""Fit diffusion parameters to MSDs from square displacement dists"""
def __init__(self, msd_data, model, weight_data, **kwargs):
"""Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {"brownian", "anomalou... | the_stack_v2_python_sparse | sdt/motion/msd_dist.py | schuetzgroup/sdt-python | train | 31 |
d295aaa08b9473ce8f33ee75624d17147a66fbac | [
"for addr, comment in comments.items():\n db_comment = session.query(DbComment).filter_by(kb=db_kb, addr=addr).scalar()\n if db_comment is not None:\n if comment == db_comment.comment:\n continue\n db_comment.comment = comment\n else:\n db_comment = DbComment(kb=db_kb, addr=... | <|body_start_0|>
for addr, comment in comments.items():
db_comment = session.query(DbComment).filter_by(kb=db_kb, addr=addr).scalar()
if db_comment is not None:
if comment == db_comment.comment:
continue
db_comment.comment = comment
... | Serialize/unserialize comments to/from a database session. | CommentsSerializer | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommentsSerializer:
"""Serialize/unserialize comments to/from a database session."""
def dump(session, db_kb, comments):
""":param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None"""
<|body_0|>
def load(session, db_kb, kb):
""":param... | stack_v2_sparse_classes_10k_train_003508 | 1,531 | permissive | [
{
"docstring": ":param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None",
"name": "dump",
"signature": "def dump(session, db_kb, comments)"
},
{
"docstring": ":param session: :param DbKnowledgeBase db_kb: :param KnowledgeBase kb: :return:",
"name": "load",
"... | 2 | stack_v2_sparse_classes_30k_train_005100 | Implement the Python class `CommentsSerializer` described below.
Class description:
Serialize/unserialize comments to/from a database session.
Method signatures and docstrings:
- def dump(session, db_kb, comments): :param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None
- def load(sessio... | Implement the Python class `CommentsSerializer` described below.
Class description:
Serialize/unserialize comments to/from a database session.
Method signatures and docstrings:
- def dump(session, db_kb, comments): :param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None
- def load(sessio... | 37e8ca1c3308ec601ad1d7c6bc8081ff38a7cffd | <|skeleton|>
class CommentsSerializer:
"""Serialize/unserialize comments to/from a database session."""
def dump(session, db_kb, comments):
""":param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None"""
<|body_0|>
def load(session, db_kb, kb):
""":param... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CommentsSerializer:
"""Serialize/unserialize comments to/from a database session."""
def dump(session, db_kb, comments):
""":param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None"""
for addr, comment in comments.items():
db_comment = session.quer... | the_stack_v2_python_sparse | angr/angrdb/serializers/comments.py | angr/angr | train | 7,184 |
bffb5b2ec43fe0dda7a7121250061023acb31905 | [
"assert logits.size() == labels.size() and logits.dim() == 2\nloss = soft_dice_cpp.soft_dice_forward(logits, labels, p, smooth)\nctx.vars = (logits, labels, p, smooth)\nreturn loss",
"logits, labels, p, smooth = ctx.vars\ngrads = soft_dice_cpp.soft_dice_backward(grad_output, logits, labels, p, smooth)\nreturn (gr... | <|body_start_0|>
assert logits.size() == labels.size() and logits.dim() == 2
loss = soft_dice_cpp.soft_dice_forward(logits, labels, p, smooth)
ctx.vars = (logits, labels, p, smooth)
return loss
<|end_body_0|>
<|body_start_1|>
logits, labels, p, smooth = ctx.vars
grads = ... | compute backward directly for better numeric stability | SoftDiceLossV3Func | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoftDiceLossV3Func:
"""compute backward directly for better numeric stability"""
def forward(ctx, logits, labels, p, smooth):
"""inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)"""
<|body_0|>
def backward(ctx, grad_output):
"""compute gradient of soft-dic... | stack_v2_sparse_classes_10k_train_003509 | 7,172 | permissive | [
{
"docstring": "inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)",
"name": "forward",
"signature": "def forward(ctx, logits, labels, p, smooth)"
},
{
"docstring": "compute gradient of soft-dice loss",
"name": "backward",
"signature": "def backward(ctx, grad_output)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002678 | Implement the Python class `SoftDiceLossV3Func` described below.
Class description:
compute backward directly for better numeric stability
Method signatures and docstrings:
- def forward(ctx, logits, labels, p, smooth): inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)
- def backward(ctx, grad_output): compute... | Implement the Python class `SoftDiceLossV3Func` described below.
Class description:
compute backward directly for better numeric stability
Method signatures and docstrings:
- def forward(ctx, logits, labels, p, smooth): inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)
- def backward(ctx, grad_output): compute... | 99e04f64fb2ce46c2e6906750a716b93984fbe97 | <|skeleton|>
class SoftDiceLossV3Func:
"""compute backward directly for better numeric stability"""
def forward(ctx, logits, labels, p, smooth):
"""inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)"""
<|body_0|>
def backward(ctx, grad_output):
"""compute gradient of soft-dic... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SoftDiceLossV3Func:
"""compute backward directly for better numeric stability"""
def forward(ctx, logits, labels, p, smooth):
"""inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)"""
assert logits.size() == labels.size() and logits.dim() == 2
loss = soft_dice_cpp.soft_dice_f... | the_stack_v2_python_sparse | soft_dice_loss.py | CoinCheung/pytorch-loss | train | 2,079 |
1f2d00683ef59323cd6789f61f922229dabd7576 | [
"if isinstance(request.auth, ProjectKey):\n return self.respond(status=401)\nif organization_slug:\n if project.organization.slug != organization_slug:\n return self.respond_invalid()\nqueryset = MonitorCheckIn.objects.filter(monitor_id=monitor.id)\nreturn self.paginate(request=request, queryset=querys... | <|body_start_0|>
if isinstance(request.auth, ProjectKey):
return self.respond(status=401)
if organization_slug:
if project.organization.slug != organization_slug:
return self.respond_invalid()
queryset = MonitorCheckIn.objects.filter(monitor_id=monitor.id)... | MonitorCheckInsEndpoint | [
"Apache-2.0",
"BUSL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorCheckInsEndpoint:
def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response:
"""Retrieve a list of check-ins for a monitor"""
<|body_0|>
def post(self, request: Request, project, monitor, organization_slug: str | None=None) -> R... | stack_v2_sparse_classes_10k_train_003510 | 6,229 | permissive | [
{
"docstring": "Retrieve a list of check-ins for a monitor",
"name": "get",
"signature": "def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response"
},
{
"docstring": "Creates a new check-in for a monitor. If `status` is not present, it will be assumed tha... | 2 | null | Implement the Python class `MonitorCheckInsEndpoint` described below.
Class description:
Implement the MonitorCheckInsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: Retrieve a list of check-ins for a monitor
- def ... | Implement the Python class `MonitorCheckInsEndpoint` described below.
Class description:
Implement the MonitorCheckInsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response: Retrieve a list of check-ins for a monitor
- def ... | d9dd4f382f96b5c4576b64cbf015db651556c18b | <|skeleton|>
class MonitorCheckInsEndpoint:
def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response:
"""Retrieve a list of check-ins for a monitor"""
<|body_0|>
def post(self, request: Request, project, monitor, organization_slug: str | None=None) -> R... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MonitorCheckInsEndpoint:
def get(self, request: Request, project, monitor, organization_slug: str | None=None) -> Response:
"""Retrieve a list of check-ins for a monitor"""
if isinstance(request.auth, ProjectKey):
return self.respond(status=401)
if organization_slug:
... | the_stack_v2_python_sparse | src/sentry/api/endpoints/monitor_checkins.py | nagyist/sentry | train | 0 | |
4f7e9addfb39074feb1d322c0bd07b308cf68142 | [
"r1 = requests.get(url=self.asset_api)\nhostname_list = r1.json()\npool = ThreadPoolExecutor(20)\nfor hostname in hostname_list:\n pool.submit(self.task, hostname)",
"try:\n info = get_server_info(self, hostname)\n r1 = requests.post(url=self.asset_api, data=json.dumps(info).encode('utf-8'), headers={'Co... | <|body_start_0|>
r1 = requests.get(url=self.asset_api)
hostname_list = r1.json()
pool = ThreadPoolExecutor(20)
for hostname in hostname_list:
pool.submit(self.task, hostname)
<|end_body_0|>
<|body_start_1|>
try:
info = get_server_info(self, hostname)
... | SshAndSalt | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SshAndSalt:
def handler(self):
"""处理SSH/SALT模式下的资产采集 1. 通过api获取需要采集的主机列表 2. 使用线程池实现并发处理 3. 把所有的主机交给task方法去采集 :return:"""
<|body_0|>
def task(self, hostname):
"""执行采集器,拿到采集结果汇报给API 1. 执行所有的采集器拿到info 2. 汇报info给api :param hostname: :return:"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k_train_003511 | 2,083 | no_license | [
{
"docstring": "处理SSH/SALT模式下的资产采集 1. 通过api获取需要采集的主机列表 2. 使用线程池实现并发处理 3. 把所有的主机交给task方法去采集 :return:",
"name": "handler",
"signature": "def handler(self)"
},
{
"docstring": "执行采集器,拿到采集结果汇报给API 1. 执行所有的采集器拿到info 2. 汇报info给api :param hostname: :return:",
"name": "task",
"signature": "def ta... | 2 | stack_v2_sparse_classes_30k_train_001935 | Implement the Python class `SshAndSalt` described below.
Class description:
Implement the SshAndSalt class.
Method signatures and docstrings:
- def handler(self): 处理SSH/SALT模式下的资产采集 1. 通过api获取需要采集的主机列表 2. 使用线程池实现并发处理 3. 把所有的主机交给task方法去采集 :return:
- def task(self, hostname): 执行采集器,拿到采集结果汇报给API 1. 执行所有的采集器拿到info 2. 汇报i... | Implement the Python class `SshAndSalt` described below.
Class description:
Implement the SshAndSalt class.
Method signatures and docstrings:
- def handler(self): 处理SSH/SALT模式下的资产采集 1. 通过api获取需要采集的主机列表 2. 使用线程池实现并发处理 3. 把所有的主机交给task方法去采集 :return:
- def task(self, hostname): 执行采集器,拿到采集结果汇报给API 1. 执行所有的采集器拿到info 2. 汇报i... | d7fc68d3d23345df5bfb09d4a84686c8b49a5ad7 | <|skeleton|>
class SshAndSalt:
def handler(self):
"""处理SSH/SALT模式下的资产采集 1. 通过api获取需要采集的主机列表 2. 使用线程池实现并发处理 3. 把所有的主机交给task方法去采集 :return:"""
<|body_0|>
def task(self, hostname):
"""执行采集器,拿到采集结果汇报给API 1. 执行所有的采集器拿到info 2. 汇报info给api :param hostname: :return:"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SshAndSalt:
def handler(self):
"""处理SSH/SALT模式下的资产采集 1. 通过api获取需要采集的主机列表 2. 使用线程池实现并发处理 3. 把所有的主机交给task方法去采集 :return:"""
r1 = requests.get(url=self.asset_api)
hostname_list = r1.json()
pool = ThreadPoolExecutor(20)
for hostname in hostname_list:
pool.submit(... | the_stack_v2_python_sparse | CMDB_V2/auto_client/src/engine/base.py | 214031230/Python21 | train | 0 | |
97f992c43987d5bd4ccb1516bf0a4e7b15986bf7 | [
"issue_tracker = helpers.get_issue_tracker_for_testcase(testcase)\nuser_email = helpers.get_user_email()\nif severity is not None:\n severity = helpers.cast(severity, int, 'Invalid value for security severity (%s).' % severity)\nadditional_ccs = []\nif cc_me:\n additional_ccs.append(user_email)\nissue_id, _ =... | <|body_start_0|>
issue_tracker = helpers.get_issue_tracker_for_testcase(testcase)
user_email = helpers.get_user_email()
if severity is not None:
severity = helpers.cast(severity, int, 'Invalid value for security severity (%s).' % severity)
additional_ccs = []
if cc_me... | Handler that creates an issue. | Handler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Handler:
"""Handler that creates an issue."""
def create_issue(testcase, severity, cc_me):
"""Create an issue."""
<|body_0|>
def post(self, testcase):
"""Create an issue."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
issue_tracker = helpers.ge... | stack_v2_sparse_classes_10k_train_003512 | 1,941 | permissive | [
{
"docstring": "Create an issue.",
"name": "create_issue",
"signature": "def create_issue(testcase, severity, cc_me)"
},
{
"docstring": "Create an issue.",
"name": "post",
"signature": "def post(self, testcase)"
}
] | 2 | null | Implement the Python class `Handler` described below.
Class description:
Handler that creates an issue.
Method signatures and docstrings:
- def create_issue(testcase, severity, cc_me): Create an issue.
- def post(self, testcase): Create an issue. | Implement the Python class `Handler` described below.
Class description:
Handler that creates an issue.
Method signatures and docstrings:
- def create_issue(testcase, severity, cc_me): Create an issue.
- def post(self, testcase): Create an issue.
<|skeleton|>
class Handler:
"""Handler that creates an issue."""
... | 6501a839b27a264500244f32bace8bee4d5cb9a2 | <|skeleton|>
class Handler:
"""Handler that creates an issue."""
def create_issue(testcase, severity, cc_me):
"""Create an issue."""
<|body_0|>
def post(self, testcase):
"""Create an issue."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Handler:
"""Handler that creates an issue."""
def create_issue(testcase, severity, cc_me):
"""Create an issue."""
issue_tracker = helpers.get_issue_tracker_for_testcase(testcase)
user_email = helpers.get_user_email()
if severity is not None:
severity = helpers.... | the_stack_v2_python_sparse | src/appengine/handlers/testcase_detail/create_issue.py | google/clusterfuzz | train | 5,420 |
19325c56955871b2a34775b00cfc9cb6ef9afce2 | [
"length = len(nums)\nif not length:\n return 0\nindex = 0\nearlier = None\nwhile index < length:\n if index == 0:\n earlier = nums[index]\n index += 1\n elif nums[index] == earlier:\n for i in range(index + 1, length):\n nums[i - 1] = nums[i]\n nums.pop()\n len... | <|body_start_0|>
length = len(nums)
if not length:
return 0
index = 0
earlier = None
while index < length:
if index == 0:
earlier = nums[index]
index += 1
elif nums[index] == earlier:
for i in ran... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicates_me(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = len(nums)
if no... | stack_v2_sparse_classes_10k_train_003513 | 1,248 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates_me",
"signature": "def removeDuplicates_me(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates",
"signature": "def removeDuplicates(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005204 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates_me(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates_me(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
de... | cefa2f08667de4d2973274de3ff29a31a7d25eda | <|skeleton|>
class Solution:
def removeDuplicates_me(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicates_me(self, nums):
""":type nums: List[int] :rtype: int"""
length = len(nums)
if not length:
return 0
index = 0
earlier = None
while index < length:
if index == 0:
earlier = nums[index]
... | the_stack_v2_python_sparse | play/first/26_Remove_Duplicates_from_Sorted_Array.py | zhangruochi/leetcode | train | 14 | |
bb9c313f4e43ad43334f9e63121f8ab9639d4ccd | [
"self.cluster_entity = cluster_entity\nself.datacenter_entity = datacenter_entity\nself.power_state_config = power_state_config\nself.rename_restored_object_param = rename_restored_object_param\nself.restored_objects_network_config = restored_objects_network_config\nself.storagedomain_entity = storagedomain_entity"... | <|body_start_0|>
self.cluster_entity = cluster_entity
self.datacenter_entity = datacenter_entity
self.power_state_config = power_state_config
self.rename_restored_object_param = rename_restored_object_param
self.restored_objects_network_config = restored_objects_network_config
... | Implementation of the 'RestoreKVMVMsParams' model. TODO: type model description here. Attributes: cluster_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. datacenter_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. power_state_config (Pow... | RestoreKVMVMsParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreKVMVMsParams:
"""Implementation of the 'RestoreKVMVMsParams' model. TODO: type model description here. Attributes: cluster_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. datacenter_entity (EntityProto): Specifies the attributes and the latest stat... | stack_v2_sparse_classes_10k_train_003514 | 4,642 | permissive | [
{
"docstring": "Constructor for the RestoreKVMVMsParams class",
"name": "__init__",
"signature": "def __init__(self, cluster_entity=None, datacenter_entity=None, power_state_config=None, rename_restored_object_param=None, restored_objects_network_config=None, storagedomain_entity=None)"
},
{
"do... | 2 | null | Implement the Python class `RestoreKVMVMsParams` described below.
Class description:
Implementation of the 'RestoreKVMVMsParams' model. TODO: type model description here. Attributes: cluster_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. datacenter_entity (EntityProto): Speci... | Implement the Python class `RestoreKVMVMsParams` described below.
Class description:
Implementation of the 'RestoreKVMVMsParams' model. TODO: type model description here. Attributes: cluster_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. datacenter_entity (EntityProto): Speci... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreKVMVMsParams:
"""Implementation of the 'RestoreKVMVMsParams' model. TODO: type model description here. Attributes: cluster_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. datacenter_entity (EntityProto): Specifies the attributes and the latest stat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RestoreKVMVMsParams:
"""Implementation of the 'RestoreKVMVMsParams' model. TODO: type model description here. Attributes: cluster_entity (EntityProto): Specifies the attributes and the latest statistics about an entity. datacenter_entity (EntityProto): Specifies the attributes and the latest statistics about ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_kvmv_ms_params.py | cohesity/management-sdk-python | train | 24 |
737e211d3b7624f7cadd1f7699e16d496a82375f | [
"user = users.get_current_user()\nif not user:\n self.response.out.write(json.dumps(error_obj('User not logged in.')))\n return\nfriend = self.request.get('email')\nif not friend:\n self.response.out.write(json.dumps(error_obj('Must provide email of friend to add.')))\n return\naccount = user_info.get_u... | <|body_start_0|>
user = users.get_current_user()
if not user:
self.response.out.write(json.dumps(error_obj('User not logged in.')))
return
friend = self.request.get('email')
if not friend:
self.response.out.write(json.dumps(error_obj('Must provide emai... | Friend | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Friend:
def get(self):
"""Get a global friend's availability and blurb."""
<|body_0|>
def post(self):
"""Add a friend"""
<|body_1|>
def delete(self):
"""Remove a friend."""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
user = use... | stack_v2_sparse_classes_10k_train_003515 | 3,414 | no_license | [
{
"docstring": "Get a global friend's availability and blurb.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Add a friend",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Remove a friend.",
"name": "delete",
"signature": "def delete(sel... | 3 | stack_v2_sparse_classes_30k_train_005653 | Implement the Python class `Friend` described below.
Class description:
Implement the Friend class.
Method signatures and docstrings:
- def get(self): Get a global friend's availability and blurb.
- def post(self): Add a friend
- def delete(self): Remove a friend. | Implement the Python class `Friend` described below.
Class description:
Implement the Friend class.
Method signatures and docstrings:
- def get(self): Get a global friend's availability and blurb.
- def post(self): Add a friend
- def delete(self): Remove a friend.
<|skeleton|>
class Friend:
def get(self):
... | 0f121a58617131c01ff76ccca0e46a41aae76db6 | <|skeleton|>
class Friend:
def get(self):
"""Get a global friend's availability and blurb."""
<|body_0|>
def post(self):
"""Add a friend"""
<|body_1|>
def delete(self):
"""Remove a friend."""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Friend:
def get(self):
"""Get a global friend's availability and blurb."""
user = users.get_current_user()
if not user:
self.response.out.write(json.dumps(error_obj('User not logged in.')))
return
friend = self.request.get('email')
if not friend:... | the_stack_v2_python_sparse | controllers/friend.py | ShelleyGoldberg/golight | train | 0 | |
e8936994808e6f1a18a7dabbcf92d1570ab6efee | [
"super(AdaptiveParameterizedStrategy, self).__init__(network, bound)\nself.size = size\nself.history = history\nself.remainder = remainder\nself.sigma = sigma\nself.strategies = [np.random.uniform(-self.bound, self.bound, size=FeatureMatrix.TOTAL_FEATURES) for _ in range(self.size)]\nself.strategy = self.strategies... | <|body_start_0|>
super(AdaptiveParameterizedStrategy, self).__init__(network, bound)
self.size = size
self.history = history
self.remainder = remainder
self.sigma = sigma
self.strategies = [np.random.uniform(-self.bound, self.bound, size=FeatureMatrix.TOTAL_FEATURES) for ... | A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in online; in other words, the strategies are updated while... | AdaptiveParameterizedStrategy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaptiveParameterizedStrategy:
"""A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in... | stack_v2_sparse_classes_10k_train_003516 | 17,144 | permissive | [
{
"docstring": "Create a adaptive parameterized strategy, and initialize its variables. Args: network: A wrapped Keras model with `adapt.Network`. bound: A floating point number indicates the absolute value of minimum and maximum bounds. size: A positive integer. The number of strategies to create at once. hist... | 4 | null | Implement the Python class `AdaptiveParameterizedStrategy` described below.
Class description:
A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, ... | Implement the Python class `AdaptiveParameterizedStrategy` described below.
Class description:
A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, ... | 0b801d2d2e828ac480d1097cb3bdd82b1e25c15b | <|skeleton|>
class AdaptiveParameterizedStrategy:
"""A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AdaptiveParameterizedStrategy:
"""A adaptive and parameterized neuron selection strategy. Adaptive and parameterized neuron selection strategy is a strategy that changes the parameterized neuron selection strategy adaptively with respect to the model, data, or even time. These updates are done in online; in o... | the_stack_v2_python_sparse | code/deep/ReMoS/CV_adv/DNNtest/strategy/adapt.py | jindongwang/transferlearning | train | 12,773 |
ed1c7646e7c7881a3c1e54106d10b3a80bc28d18 | [
"sogouhao_search_consume = 0\ntry:\n for line in data:\n item = line[7].split(',')\n if len(item) >= 5:\n if item[5] == '108':\n sogouhao_search_consume += int(line[0])\nexcept IndexError as err:\n logging.error(err)\n sogouhao_search_consume = 0\nsogouhao_channel_co... | <|body_start_0|>
sogouhao_search_consume = 0
try:
for line in data:
item = line[7].split(',')
if len(item) >= 5:
if item[5] == '108':
sogouhao_search_consume += int(line[0])
except IndexError as err:
... | MonitorWSSogouHaoConsume | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonitorWSSogouHaoConsume:
def sogouhao_channel_search(cls, data):
"""搜狗号详情页消耗"""
<|body_0|>
def sogouhao_channel_back(cls, data):
"""搜狗号回流消耗"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sogouhao_search_consume = 0
try:
for lin... | stack_v2_sparse_classes_10k_train_003517 | 1,706 | no_license | [
{
"docstring": "搜狗号详情页消耗",
"name": "sogouhao_channel_search",
"signature": "def sogouhao_channel_search(cls, data)"
},
{
"docstring": "搜狗号回流消耗",
"name": "sogouhao_channel_back",
"signature": "def sogouhao_channel_back(cls, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000630 | Implement the Python class `MonitorWSSogouHaoConsume` described below.
Class description:
Implement the MonitorWSSogouHaoConsume class.
Method signatures and docstrings:
- def sogouhao_channel_search(cls, data): 搜狗号详情页消耗
- def sogouhao_channel_back(cls, data): 搜狗号回流消耗 | Implement the Python class `MonitorWSSogouHaoConsume` described below.
Class description:
Implement the MonitorWSSogouHaoConsume class.
Method signatures and docstrings:
- def sogouhao_channel_search(cls, data): 搜狗号详情页消耗
- def sogouhao_channel_back(cls, data): 搜狗号回流消耗
<|skeleton|>
class MonitorWSSogouHaoConsume:
... | a35ffc9fc869ac8cadb121c71daa0c977898f8d8 | <|skeleton|>
class MonitorWSSogouHaoConsume:
def sogouhao_channel_search(cls, data):
"""搜狗号详情页消耗"""
<|body_0|>
def sogouhao_channel_back(cls, data):
"""搜狗号回流消耗"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MonitorWSSogouHaoConsume:
def sogouhao_channel_search(cls, data):
"""搜狗号详情页消耗"""
sogouhao_search_consume = 0
try:
for line in data:
item = line[7].split(',')
if len(item) >= 5:
if item[5] == '108':
... | the_stack_v2_python_sparse | monitor_consume/monitor_consume_sogouhao.py | talentrobinho/prometheus_monitor_script | train | 0 | |
a6a96c26543381193d49fdb75a28b734882dbd29 | [
"def reverse(s, start, end):\n l = [c for i, c in enumerate(s) if start <= i < end]\n mid = (end - start) // 2\n length = end - start - 1\n i = 0\n while i < mid:\n t = l[i]\n l[i] = l[length - i]\n l[length - i] = t\n i += 1\n r = ''\n for c in l:\n r += c\n ... | <|body_start_0|>
def reverse(s, start, end):
l = [c for i, c in enumerate(s) if start <= i < end]
mid = (end - start) // 2
length = end - start - 1
i = 0
while i < mid:
t = l[i]
l[i] = l[length - i]
l[len... | 错误答案 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""错误答案"""
def reverseStr1(self, s, k):
""":type s: str :type k: int :rtype: str"""
<|body_0|>
def reverseStr(self, s, k):
""":type s: str :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def reverse(s, start, e... | stack_v2_sparse_classes_10k_train_003518 | 1,429 | no_license | [
{
"docstring": ":type s: str :type k: int :rtype: str",
"name": "reverseStr1",
"signature": "def reverseStr1(self, s, k)"
},
{
"docstring": ":type s: str :type k: int :rtype: str",
"name": "reverseStr",
"signature": "def reverseStr(self, s, k)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000108 | Implement the Python class `Solution` described below.
Class description:
错误答案
Method signatures and docstrings:
- def reverseStr1(self, s, k): :type s: str :type k: int :rtype: str
- def reverseStr(self, s, k): :type s: str :type k: int :rtype: str | Implement the Python class `Solution` described below.
Class description:
错误答案
Method signatures and docstrings:
- def reverseStr1(self, s, k): :type s: str :type k: int :rtype: str
- def reverseStr(self, s, k): :type s: str :type k: int :rtype: str
<|skeleton|>
class Solution:
"""错误答案"""
def reverseStr1(se... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
"""错误答案"""
def reverseStr1(self, s, k):
""":type s: str :type k: int :rtype: str"""
<|body_0|>
def reverseStr(self, s, k):
""":type s: str :type k: int :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""错误答案"""
def reverseStr1(self, s, k):
""":type s: str :type k: int :rtype: str"""
def reverse(s, start, end):
l = [c for i, c in enumerate(s) if start <= i < end]
mid = (end - start) // 2
length = end - start - 1
i = 0
... | the_stack_v2_python_sparse | py/leetcode/541.py | wfeng1991/learnpy | train | 0 |
7c17d30c4143a4114fb3b82a14a6c6f6c6818b94 | [
"url = reverse('api:log-list')\ndata = {'message': 'Anon test', 'severity': 0, 'category': 'test'}\nresponse = self.client.post(url, data)\nself.assertEqual(response.status_code, status.HTTP_201_CREATED)\nentry = LogEntry.objects.filter(user__isnull=True)[0]\nself.assertEqual(entry.message, data['message'])\nself.a... | <|body_start_0|>
url = reverse('api:log-list')
data = {'message': 'Anon test', 'severity': 0, 'category': 'test'}
response = self.client.post(url, data)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
entry = LogEntry.objects.filter(user__isnull=True)[0]
s... | LoggerTestCase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoggerTestCase:
def test_anonymous(self):
"""Anonymous users are allowed to write, but not view, log entries."""
<|body_0|>
def test_regular_user(self):
"""Regular users can write and view their own log entries."""
<|body_1|>
def test_admin_user(self):
... | stack_v2_sparse_classes_10k_train_003519 | 3,603 | permissive | [
{
"docstring": "Anonymous users are allowed to write, but not view, log entries.",
"name": "test_anonymous",
"signature": "def test_anonymous(self)"
},
{
"docstring": "Regular users can write and view their own log entries.",
"name": "test_regular_user",
"signature": "def test_regular_us... | 3 | stack_v2_sparse_classes_30k_train_004954 | Implement the Python class `LoggerTestCase` described below.
Class description:
Implement the LoggerTestCase class.
Method signatures and docstrings:
- def test_anonymous(self): Anonymous users are allowed to write, but not view, log entries.
- def test_regular_user(self): Regular users can write and view their own l... | Implement the Python class `LoggerTestCase` described below.
Class description:
Implement the LoggerTestCase class.
Method signatures and docstrings:
- def test_anonymous(self): Anonymous users are allowed to write, but not view, log entries.
- def test_regular_user(self): Regular users can write and view their own l... | 9baa530f2f3405322f74ccc145641148f253341b | <|skeleton|>
class LoggerTestCase:
def test_anonymous(self):
"""Anonymous users are allowed to write, but not view, log entries."""
<|body_0|>
def test_regular_user(self):
"""Regular users can write and view their own log entries."""
<|body_1|>
def test_admin_user(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoggerTestCase:
def test_anonymous(self):
"""Anonymous users are allowed to write, but not view, log entries."""
url = reverse('api:log-list')
data = {'message': 'Anon test', 'severity': 0, 'category': 'test'}
response = self.client.post(url, data)
self.assertEqual(resp... | the_stack_v2_python_sparse | logger/tests.py | City-of-Turku/munpalvelut_backend | train | 0 | |
cc38e48cb8b5603abdfca0d2efe7236cc18a449c | [
"super().__init__(solver_name)\nself.comp_bench = comp_bench\nself.reset_bench_on_fail = reset_bench_on_fail\nself.make_bench = make_bench",
"super().run_sim()\nresult = 0\nif self.comp_bench:\n result = self.compare_to_benchmark(rtol)\nif self.make_bench or (result != 0 and self.reset_bench_on_fail):\n sel... | <|body_start_0|>
super().__init__(solver_name)
self.comp_bench = comp_bench
self.reset_bench_on_fail = reset_bench_on_fail
self.make_bench = make_bench
<|end_body_0|>
<|body_start_1|>
super().run_sim()
result = 0
if self.comp_bench:
result = self.comp... | A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines. | PyroBenchmark | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyroBenchmark:
"""A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines."""
def __init__(self, solver_name, comp_bench=False, reset_bench_on_fail=False, make_bench=False):
"""Constructor Parameters ---------- solver_name : str Name of solv... | stack_v2_sparse_classes_10k_train_003520 | 11,814 | permissive | [
{
"docstring": "Constructor Parameters ---------- solver_name : str Name of solver to use comp_bench : bool Are we comparing to a benchmark? reset_bench_on_fail : bool Do we reset the benchmark on fail? make_bench : bool Are we storing a benchmark?",
"name": "__init__",
"signature": "def __init__(self, ... | 4 | stack_v2_sparse_classes_30k_train_000109 | Implement the Python class `PyroBenchmark` described below.
Class description:
A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines.
Method signatures and docstrings:
- def __init__(self, solver_name, comp_bench=False, reset_bench_on_fail=False, make_bench=False): Constru... | Implement the Python class `PyroBenchmark` described below.
Class description:
A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines.
Method signatures and docstrings:
- def __init__(self, solver_name, comp_bench=False, reset_bench_on_fail=False, make_bench=False): Constru... | f91789a319caa98dfbc3f496e9953756e6ee3ca9 | <|skeleton|>
class PyroBenchmark:
"""A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines."""
def __init__(self, solver_name, comp_bench=False, reset_bench_on_fail=False, make_bench=False):
"""Constructor Parameters ---------- solver_name : str Name of solv... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PyroBenchmark:
"""A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines."""
def __init__(self, solver_name, comp_bench=False, reset_bench_on_fail=False, make_bench=False):
"""Constructor Parameters ---------- solver_name : str Name of solver to use com... | the_stack_v2_python_sparse | pyro/pyro_sim.py | python-hydro/pyro2 | train | 202 |
b0dbba7e74d26a783de40ad27050539d426db675 | [
"self.threads = []\nself.data = {'candles': [], 'RSI': [], 'candles_ready': False, 'rsi_ready': False}\nself.pill2kill = threading.Event()\nself.trading_data = {}\nself.trading_data['lotage'] = lotage\nself.trading_data['time_period'] = time_period\nself.trading_data['market'] = market",
"t = threading.Thread(tar... | <|body_start_0|>
self.threads = []
self.data = {'candles': [], 'RSI': [], 'candles_ready': False, 'rsi_ready': False}
self.pill2kill = threading.Event()
self.trading_data = {}
self.trading_data['lotage'] = lotage
self.trading_data['time_period'] = time_period
self... | Bot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bot:
def __init__(self, lotage: float, time_period: int, market: str):
"""Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market... | stack_v2_sparse_classes_10k_train_003521 | 2,915 | no_license | [
{
"docstring": "Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market (str): Market to operate in.",
"name": "__init__",
"signature": "def __in... | 6 | stack_v2_sparse_classes_30k_val_000225 | Implement the Python class `Bot` described below.
Class description:
Implement the Bot class.
Method signatures and docstrings:
- def __init__(self, lotage: float, time_period: int, market: str): Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the... | Implement the Python class `Bot` described below.
Class description:
Implement the Bot class.
Method signatures and docstrings:
- def __init__(self, lotage: float, time_period: int, market: str): Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the... | d6efbee05896e4c743f94a2a97b7b8be51bc7770 | <|skeleton|>
class Bot:
def __init__(self, lotage: float, time_period: int, market: str):
"""Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Bot:
def __init__(self, lotage: float, time_period: int, market: str):
"""Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market (str): Market... | the_stack_v2_python_sparse | ta/RSI/BOT/bot.py | cvillarr123/TradingBOTCVI | train | 0 | |
be96b9bf484a3a706e5cb39905bd52c347828982 | [
"perm = CanEditIfOwner()\nfor method in ('GET', 'HEAD', 'OPTIONS'):\n request = Mock(method=method)\n with mute_signals(post_save):\n profile = ProfileFactory.create()\n assert perm.has_object_permission(request, None, profile)",
"perm = CanEditIfOwner()\nfor method in ('POST', 'PATCH', 'PUT'):\n ... | <|body_start_0|>
perm = CanEditIfOwner()
for method in ('GET', 'HEAD', 'OPTIONS'):
request = Mock(method=method)
with mute_signals(post_save):
profile = ProfileFactory.create()
assert perm.has_object_permission(request, None, profile)
<|end_body_0|>
<... | Tests for CanEditIfOwner permissions | CanEditIfOwnerTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CanEditIfOwnerTests:
"""Tests for CanEditIfOwner permissions"""
def test_allow_nonedit(self):
"""Users are allowed to use safe methods without owning the profile."""
<|body_0|>
def test_edit_if_owner(self):
"""Users are allowed to edit their own profile"""
... | stack_v2_sparse_classes_10k_train_003522 | 7,670 | permissive | [
{
"docstring": "Users are allowed to use safe methods without owning the profile.",
"name": "test_allow_nonedit",
"signature": "def test_allow_nonedit(self)"
},
{
"docstring": "Users are allowed to edit their own profile",
"name": "test_edit_if_owner",
"signature": "def test_edit_if_owne... | 3 | null | Implement the Python class `CanEditIfOwnerTests` described below.
Class description:
Tests for CanEditIfOwner permissions
Method signatures and docstrings:
- def test_allow_nonedit(self): Users are allowed to use safe methods without owning the profile.
- def test_edit_if_owner(self): Users are allowed to edit their ... | Implement the Python class `CanEditIfOwnerTests` described below.
Class description:
Tests for CanEditIfOwner permissions
Method signatures and docstrings:
- def test_allow_nonedit(self): Users are allowed to use safe methods without owning the profile.
- def test_edit_if_owner(self): Users are allowed to edit their ... | d6564caca0b7bbfd31e67a751564107fd17d6eb0 | <|skeleton|>
class CanEditIfOwnerTests:
"""Tests for CanEditIfOwner permissions"""
def test_allow_nonedit(self):
"""Users are allowed to use safe methods without owning the profile."""
<|body_0|>
def test_edit_if_owner(self):
"""Users are allowed to edit their own profile"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CanEditIfOwnerTests:
"""Tests for CanEditIfOwner permissions"""
def test_allow_nonedit(self):
"""Users are allowed to use safe methods without owning the profile."""
perm = CanEditIfOwner()
for method in ('GET', 'HEAD', 'OPTIONS'):
request = Mock(method=method)
... | the_stack_v2_python_sparse | profiles/permissions_test.py | mitodl/micromasters | train | 35 |
cdcf088e8b985d64fefc3cb3e2f823bc3f11c140 | [
"self.left_eye_percentage = left_eye_percentage\nself.desired_face_width = desired_face_width\nself.desired_face_height = desired_face_height\nself.predictor = LandmarkPredictor(predictor_type)\nif self.desired_face_height is None:\n self.desired_face_height = self.desired_face_width",
"shape = self.predictor.... | <|body_start_0|>
self.left_eye_percentage = left_eye_percentage
self.desired_face_width = desired_face_width
self.desired_face_height = desired_face_height
self.predictor = LandmarkPredictor(predictor_type)
if self.desired_face_height is None:
self.desired_face_height... | FaceAligner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FaceAligner:
def __init__(self, left_eye_percentage=(0.4, 0.4), desired_face_width=256, desired_face_height=None, predictor_type='dlib'):
"""Define aligner for all images. :param left_eye_percentage: An optional (x, y) tuple with the default shown, specifying the desired output left eye ... | stack_v2_sparse_classes_10k_train_003523 | 4,971 | no_license | [
{
"docstring": "Define aligner for all images. :param left_eye_percentage: An optional (x, y) tuple with the default shown, specifying the desired output left eye position. For this variable, it is common to see percentages within the range of 20-40%. These percentages control how much of the face is visible af... | 2 | stack_v2_sparse_classes_30k_train_004157 | Implement the Python class `FaceAligner` described below.
Class description:
Implement the FaceAligner class.
Method signatures and docstrings:
- def __init__(self, left_eye_percentage=(0.4, 0.4), desired_face_width=256, desired_face_height=None, predictor_type='dlib'): Define aligner for all images. :param left_eye_... | Implement the Python class `FaceAligner` described below.
Class description:
Implement the FaceAligner class.
Method signatures and docstrings:
- def __init__(self, left_eye_percentage=(0.4, 0.4), desired_face_width=256, desired_face_height=None, predictor_type='dlib'): Define aligner for all images. :param left_eye_... | 3d80158f3261ddff2bd455ce883f57d6fc9ede43 | <|skeleton|>
class FaceAligner:
def __init__(self, left_eye_percentage=(0.4, 0.4), desired_face_width=256, desired_face_height=None, predictor_type='dlib'):
"""Define aligner for all images. :param left_eye_percentage: An optional (x, y) tuple with the default shown, specifying the desired output left eye ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FaceAligner:
def __init__(self, left_eye_percentage=(0.4, 0.4), desired_face_width=256, desired_face_height=None, predictor_type='dlib'):
"""Define aligner for all images. :param left_eye_percentage: An optional (x, y) tuple with the default shown, specifying the desired output left eye position. For ... | the_stack_v2_python_sparse | image_alterations_detector/face_transform/face_alignment/face_aligner.py | Giulianini/image-alterations-detector | train | 1 | |
bd6afedc1074725d2f7ced87041e895aeb78ce30 | [
"if not root:\n return ''\nqueue = [root]\nres = []\nwhile queue:\n node = queue.pop(0)\n if node:\n queue.append(node.left)\n queue.append(node.right)\n res.append(str(node.val) if node else '#')\nreturn ','.join(res)",
"if not data:\n return None\nnodes = data.split(',')\nroot = Tre... | <|body_start_0|>
if not root:
return ''
queue = [root]
res = []
while queue:
node = queue.pop(0)
if node:
queue.append(node.left)
queue.append(node.right)
res.append(str(node.val) if node else '#')
re... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_003524 | 3,469 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 0a34a19bb0979d58b511822782098f62cd86b25e | <|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_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
queue = [root]
res = []
while queue:
node = queue.pop(0)
if node:
queue.append(node.lef... | the_stack_v2_python_sparse | Tree/L297_Serialize_Deserialize_Binary_Tree_latest.py | SimonFans/LeetCode | train | 1 | |
baa248e41ea6f18df6c7aa3c048153763c0f80bb | [
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_sampleDescription(data.data)\ndata.clear_data()",
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.update_sampleDescription(data.data)\ndata.clear_data()",
"data_O = []\nfor sample_id in sample_ids_I:\n ... | <|body_start_0|>
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_sampleDescription(data.data)
data.clear_data()
<|end_body_0|>
<|body_start_1|>
data = base_importData()
data.read_csv(filename)
data.format_data()
self.u... | lims_sample_io | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class lims_sample_io:
def import_sampleDescription_add(self, filename):
"""table adds"""
<|body_0|>
def import_sampleDescription_update(self, filename):
"""table updates"""
<|body_1|>
def export_sampleStorage_csv(self, sample_ids_I, filename_O):
"""Exp... | stack_v2_sparse_classes_10k_train_003525 | 1,519 | permissive | [
{
"docstring": "table adds",
"name": "import_sampleDescription_add",
"signature": "def import_sampleDescription_add(self, filename)"
},
{
"docstring": "table updates",
"name": "import_sampleDescription_update",
"signature": "def import_sampleDescription_update(self, filename)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_002023 | Implement the Python class `lims_sample_io` described below.
Class description:
Implement the lims_sample_io class.
Method signatures and docstrings:
- def import_sampleDescription_add(self, filename): table adds
- def import_sampleDescription_update(self, filename): table updates
- def export_sampleStorage_csv(self,... | Implement the Python class `lims_sample_io` described below.
Class description:
Implement the lims_sample_io class.
Method signatures and docstrings:
- def import_sampleDescription_add(self, filename): table adds
- def import_sampleDescription_update(self, filename): table updates
- def export_sampleStorage_csv(self,... | 5dfd73689674953345d523178a67b8dda10e6d47 | <|skeleton|>
class lims_sample_io:
def import_sampleDescription_add(self, filename):
"""table adds"""
<|body_0|>
def import_sampleDescription_update(self, filename):
"""table updates"""
<|body_1|>
def export_sampleStorage_csv(self, sample_ids_I, filename_O):
"""Exp... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class lims_sample_io:
def import_sampleDescription_add(self, filename):
"""table adds"""
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_sampleDescription(data.data)
data.clear_data()
def import_sampleDescription_update(self, filename... | the_stack_v2_python_sparse | SBaaS_LIMS/lims_sample_io.py | dmccloskey/SBaaS_LIMS | train | 0 | |
6ef1aea382600d69f0fc82a1d2e209fcbc44be1c | [
"if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host",
"headers = {'org': org, 'user': user}\nroute_name = ''\nserv... | <|body_start_0|>
if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):
raise Exception('server_ip和server_port必须同时指定')
self._server_ip = server_ip
self._server_port = server_port
self._service_name = service_name
self._host = host
<|end_bod... | TaskClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_... | stack_v2_sparse_classes_10k_train_003526 | 2,733 | permissive | [
{
"docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com",
"name": "__ini... | 2 | stack_v2_sparse_classes_30k_train_005833 | Implement the Python class `TaskClient` described below.
Class description:
Implement the TaskClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与s... | Implement the Python class `TaskClient` described below.
Class description:
Implement the TaskClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与s... | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | <|skeleton|>
class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,serve... | the_stack_v2_python_sparse | webshell_sdk/api/task/task_client.py | easyopsapis/easyops-api-python | train | 5 | |
7a94ad9d127a18976a1a955a87de10af5a8a8653 | [
"item = response.meta['item']\ning_list = []\ning_li = response.xpath('//*[@id=\"__layout\"]//ul[@class=\"recipe-ingredients__list\"]/li')\nfor li in ing_li:\n ing = li.xpath('.//a/text()').extract_first()\n if ing is not None:\n ing_list.append(ing.strip())\nitem['ingredients'] = ', '.join(ing_list)\n... | <|body_start_0|>
item = response.meta['item']
ing_list = []
ing_li = response.xpath('//*[@id="__layout"]//ul[@class="recipe-ingredients__list"]/li')
for li in ing_li:
ing = li.xpath('.//a/text()').extract_first()
if ing is not None:
ing_list.append... | RecipeSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecipeSpider:
def parse_detail(self, response):
"""parse the detail page :param response: :return:"""
<|body_0|>
def parse(self, response):
"""parse the search page :param response: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
item = res... | stack_v2_sparse_classes_10k_train_003527 | 2,885 | no_license | [
{
"docstring": "parse the detail page :param response: :return:",
"name": "parse_detail",
"signature": "def parse_detail(self, response)"
},
{
"docstring": "parse the search page :param response: :return:",
"name": "parse",
"signature": "def parse(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002397 | Implement the Python class `RecipeSpider` described below.
Class description:
Implement the RecipeSpider class.
Method signatures and docstrings:
- def parse_detail(self, response): parse the detail page :param response: :return:
- def parse(self, response): parse the search page :param response: :return: | Implement the Python class `RecipeSpider` described below.
Class description:
Implement the RecipeSpider class.
Method signatures and docstrings:
- def parse_detail(self, response): parse the detail page :param response: :return:
- def parse(self, response): parse the search page :param response: :return:
<|skeleton... | 24deb2f2ca7f859a351ecafe6fb03123a1b7685d | <|skeleton|>
class RecipeSpider:
def parse_detail(self, response):
"""parse the detail page :param response: :return:"""
<|body_0|>
def parse(self, response):
"""parse the search page :param response: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RecipeSpider:
def parse_detail(self, response):
"""parse the detail page :param response: :return:"""
item = response.meta['item']
ing_list = []
ing_li = response.xpath('//*[@id="__layout"]//ul[@class="recipe-ingredients__list"]/li')
for li in ing_li:
ing = ... | the_stack_v2_python_sparse | recipespiders/recipespiders/spiders/recipe.py | yefeichen99/RecipeSE | train | 0 | |
191f0a9757d2661a8c4edc560051284288866f28 | [
"self._para_limit = para_limit\nself._ques_limit = ques_limit\nself._char_limit = char_limit\nself._word_vocab = word_vocab\nself._char_vocab = char_vocab\nself._is_cased_embedding = is_cased_embedding",
"if not self._is_cased_embedding:\n return self._word_vocab[[word.lower() for word in words]]\nresult = np.... | <|body_start_0|>
self._para_limit = para_limit
self._ques_limit = ques_limit
self._char_limit = char_limit
self._word_vocab = word_vocab
self._char_vocab = char_vocab
self._is_cased_embedding = is_cased_embedding
<|end_body_0|>
<|body_start_1|>
if not self._is_ca... | Class that converts tokenized examples into featurized | SQuADDataFeaturizer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SQuADDataFeaturizer:
"""Class that converts tokenized examples into featurized"""
def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding):
"""Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char... | stack_v2_sparse_classes_10k_train_003528 | 37,229 | permissive | [
{
"docstring": "Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char_vocab : Vocab Char-level vocabulary para_limit : int Maximum characters in a paragraph ques_limit : int Maximum characters in a question char_limit : int Maximum characters in a token is_cased_emb... | 3 | stack_v2_sparse_classes_30k_train_005058 | Implement the Python class `SQuADDataFeaturizer` described below.
Class description:
Class that converts tokenized examples into featurized
Method signatures and docstrings:
- def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): Init SQuADDataFeaturizer object Parameters... | Implement the Python class `SQuADDataFeaturizer` described below.
Class description:
Class that converts tokenized examples into featurized
Method signatures and docstrings:
- def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding): Init SQuADDataFeaturizer object Parameters... | 1d54ad8058ec4f8d54b8585ef0819d39140fa74c | <|skeleton|>
class SQuADDataFeaturizer:
"""Class that converts tokenized examples into featurized"""
def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding):
"""Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SQuADDataFeaturizer:
"""Class that converts tokenized examples into featurized"""
def __init__(self, word_vocab, char_vocab, para_limit, ques_limit, char_limit, is_cased_embedding):
"""Init SQuADDataFeaturizer object Parameters ---------- word_vocab : Vocab Word-level vocabulary char_vocab : Voca... | the_stack_v2_python_sparse | scripts/question_answering/data_pipeline.py | MoisesHer/gluon-nlp | train | 1 |
b9c604b3b42c829a4a623e4285a7195674702700 | [
"super(Messenger, self).__init__()\nself.app = app\nself.response_url = response_url\nself.channel = channel\nif thread_ts:\n self['thread_ts'] = thread_ts\nself.client = AsyncWebClient(self.app.config.token)",
"req_args = dict(**self, **kwargs)\napi_url = response_url or self.response_url\nres = await self.cl... | <|body_start_0|>
super(Messenger, self).__init__()
self.app = app
self.response_url = response_url
self.channel = channel
if thread_ts:
self['thread_ts'] = thread_ts
self.client = AsyncWebClient(self.app.config.token)
<|end_body_0|>
<|body_start_1|>
r... | The Messenger class is used to create an object that can respond back to the User with the context of a received Request message. This use is suitable in contexts such as code running in a background thread. | Messenger | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Messenger:
"""The Messenger class is used to create an object that can respond back to the User with the context of a received Request message. This use is suitable in contexts such as code running in a background thread."""
def __init__(self, app, response_url: Optional[str]=None, channel: ... | stack_v2_sparse_classes_10k_train_003529 | 4,568 | permissive | [
{
"docstring": "Creates an instance of a Messenger based on the provided SlackAPp. Parameters ---------- app: SlackApp The app context response_url: Optional[str] If provided, this becomes the default response URL in use with the send() method. channel: Optional[str] If provided, this becomes the default channe... | 3 | stack_v2_sparse_classes_30k_train_001236 | Implement the Python class `Messenger` described below.
Class description:
The Messenger class is used to create an object that can respond back to the User with the context of a received Request message. This use is suitable in contexts such as code running in a background thread.
Method signatures and docstrings:
-... | Implement the Python class `Messenger` described below.
Class description:
The Messenger class is used to create an object that can respond back to the User with the context of a received Request message. This use is suitable in contexts such as code running in a background thread.
Method signatures and docstrings:
-... | 4993dae0819a2e46cd8d7cf4b61d20bd759c8ce0 | <|skeleton|>
class Messenger:
"""The Messenger class is used to create an object that can respond back to the User with the context of a received Request message. This use is suitable in contexts such as code running in a background thread."""
def __init__(self, app, response_url: Optional[str]=None, channel: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Messenger:
"""The Messenger class is used to create an object that can respond back to the User with the context of a received Request message. This use is suitable in contexts such as code running in a background thread."""
def __init__(self, app, response_url: Optional[str]=None, channel: Optional[str]... | the_stack_v2_python_sparse | slackapptk3/messenger.py | jeremyschulman/slackapptk3 | train | 0 |
5976a2dd80d24ba694dad84da69c4cae4b9f5dd8 | [
"super().__init__(n_feat, n_head, dropout)\nself.zero_triu = zero_triu\nself.linear_pos = nn.Linear(n_feat, n_feat, bias=False)\nself.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))\nself.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))\ntorch.nn.init.xavier_uniform_(self.pos_bias_u)\ntorch.nn.in... | <|body_start_0|>
super().__init__(n_feat, n_head, dropout)
self.zero_triu = zero_triu
self.linear_pos = nn.Linear(n_feat, n_feat, bias=False)
self.pos_bias_u = nn.Parameter(torch.Tensor(self.h, self.d_k))
self.pos_bias_v = nn.Parameter(torch.Tensor(self.h, self.d_k))
torc... | Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. zero_triu: Whether to zero the upper triangular part of attention matrix. | RelPositionMultiHeadedAttention | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LGPL-2.1-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. zero_triu: Whether to zero the upper triangular part of attention matri... | stack_v2_sparse_classes_10k_train_003530 | 9,673 | permissive | [
{
"docstring": "Construct an RelPositionMultiHeadedAttention object.",
"name": "__init__",
"signature": "def __init__(self, n_feat, n_head, dropout, zero_triu=False)"
},
{
"docstring": "Compute relative positional encoding. Args: x: Input tensor B X n_head X T X 2T-1 Returns: torch.Tensor: Outpu... | 3 | null | Implement the Python class `RelPositionMultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. zero_triu: Whether to zero the u... | Implement the Python class `RelPositionMultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. zero_triu: Whether to zero the u... | b60c741f746877293bb85eed6806736fc8fa0ffd | <|skeleton|>
class RelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. zero_triu: Whether to zero the upper triangular part of attention matri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RelPositionMultiHeadedAttention:
"""Multi-Head Attention layer with relative position encoding. Paper: https://arxiv.org/abs/1901.02860 Args: n_head: The number of heads. n_feat: The number of features. dropout: Dropout rate. zero_triu: Whether to zero the upper triangular part of attention matrix."""
de... | the_stack_v2_python_sparse | kosmos-2/fairseq/fairseq/modules/espnet_multihead_attention.py | microsoft/unilm | train | 15,313 |
204837e6365227f2b5c9259cee61720831530093 | [
"m = MultiFileInput()\nself.assertTrue(m.needs_multipart_form)\nself.assertFalse(m.is_hidden)",
"m = MultiFileInput({'count': 0})\nr = m.render(name='blah', value='bla', attrs={'id': 'test'})\nself.assert_('<input type=\"file\" name=\"blah[]\" id=\"test0\" />' in r)",
"m = MultiFileInput()\nr = m.render(name='b... | <|body_start_0|>
m = MultiFileInput()
self.assertTrue(m.needs_multipart_form)
self.assertFalse(m.is_hidden)
<|end_body_0|>
<|body_start_1|>
m = MultiFileInput({'count': 0})
r = m.render(name='blah', value='bla', attrs={'id': 'test'})
self.assert_('<input type="file" name... | Tests for the widget itself. | MultiFileInputTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiFileInputTest:
"""Tests for the widget itself."""
def testBasics(self):
"""Make sure the basics are correct (needs_multipart_form & is_hidden)."""
<|body_0|>
def testNoRender(self):
"""Makes sure we show a minimum of 1 input box."""
<|body_1|>
d... | stack_v2_sparse_classes_10k_train_003531 | 3,598 | no_license | [
{
"docstring": "Make sure the basics are correct (needs_multipart_form & is_hidden).",
"name": "testBasics",
"signature": "def testBasics(self)"
},
{
"docstring": "Makes sure we show a minimum of 1 input box.",
"name": "testNoRender",
"signature": "def testNoRender(self)"
},
{
"d... | 4 | stack_v2_sparse_classes_30k_train_003370 | Implement the Python class `MultiFileInputTest` described below.
Class description:
Tests for the widget itself.
Method signatures and docstrings:
- def testBasics(self): Make sure the basics are correct (needs_multipart_form & is_hidden).
- def testNoRender(self): Makes sure we show a minimum of 1 input box.
- def t... | Implement the Python class `MultiFileInputTest` described below.
Class description:
Tests for the widget itself.
Method signatures and docstrings:
- def testBasics(self): Make sure the basics are correct (needs_multipart_form & is_hidden).
- def testNoRender(self): Makes sure we show a minimum of 1 input box.
- def t... | 2791145f62a7e296be859a400499812b394249e9 | <|skeleton|>
class MultiFileInputTest:
"""Tests for the widget itself."""
def testBasics(self):
"""Make sure the basics are correct (needs_multipart_form & is_hidden)."""
<|body_0|>
def testNoRender(self):
"""Makes sure we show a minimum of 1 input box."""
<|body_1|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiFileInputTest:
"""Tests for the widget itself."""
def testBasics(self):
"""Make sure the basics are correct (needs_multipart_form & is_hidden)."""
m = MultiFileInput()
self.assertTrue(m.needs_multipart_form)
self.assertFalse(m.is_hidden)
def testNoRender(self):
... | the_stack_v2_python_sparse | combaragi/ccboard/tests.py | yonseics/yonseics | train | 1 |
b19bc3628f28734fb6190923b6e4ba05e5cccb45 | [
"self.pumps_armed = True\nself.doors_open = False\nself.max_boats = max_boats",
"print('Stopping pumps...')\nself.pumps_armed = False\nprint('Opening doors...')\nself.doors_open = True\nprint('Locke ready for boat transit.')\nreturn self",
"print('Closing doors...')\nself.doors_open = False\nprint('Starting pum... | <|body_start_0|>
self.pumps_armed = True
self.doors_open = False
self.max_boats = max_boats
<|end_body_0|>
<|body_start_1|>
print('Stopping pumps...')
self.pumps_armed = False
print('Opening doors...')
self.doors_open = True
print('Locke ready for boat tr... | A class representing a locke. | Locke | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Locke:
"""A class representing a locke."""
def __init__(self, max_boats):
"""Initializes a Locke class. :max_boats: The maximum number of boats the locke can support."""
<|body_0|>
def __enter__(self):
"""Primes the lock by stoping the pumps and opening the doors... | stack_v2_sparse_classes_10k_train_003532 | 2,014 | no_license | [
{
"docstring": "Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.",
"name": "__init__",
"signature": "def __init__(self, max_boats)"
},
{
"docstring": "Primes the lock by stoping the pumps and opening the doors",
"name": "__enter__",
"signature": "... | 4 | null | Implement the Python class `Locke` described below.
Class description:
A class representing a locke.
Method signatures and docstrings:
- def __init__(self, max_boats): Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.
- def __enter__(self): Primes the lock by stoping the pumps ... | Implement the Python class `Locke` described below.
Class description:
A class representing a locke.
Method signatures and docstrings:
- def __init__(self, max_boats): Initializes a Locke class. :max_boats: The maximum number of boats the locke can support.
- def __enter__(self): Primes the lock by stoping the pumps ... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class Locke:
"""A class representing a locke."""
def __init__(self, max_boats):
"""Initializes a Locke class. :max_boats: The maximum number of boats the locke can support."""
<|body_0|>
def __enter__(self):
"""Primes the lock by stoping the pumps and opening the doors... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Locke:
"""A class representing a locke."""
def __init__(self, max_boats):
"""Initializes a Locke class. :max_boats: The maximum number of boats the locke can support."""
self.pumps_armed = True
self.doors_open = False
self.max_boats = max_boats
def __enter__(self):
... | the_stack_v2_python_sparse | students/anthony_mckeever/lesson_9/activity_1/ballard_lockes.py | JavaRod/SP_Python220B_2019 | train | 1 |
7e603bc83e2f4a647876b23b6d570edec12ec6f4 | [
"self.model = model\nself.file_manager = file_manager\nself.signatures = signatures\nself.options = options",
"export_dir = self.file_manager.next_name()\ntf.saved_model.save(self.model, export_dir, self.signatures, self.options)\nself.file_manager.clean_up()"
] | <|body_start_0|>
self.model = model
self.file_manager = file_manager
self.signatures = signatures
self.options = options
<|end_body_0|>
<|body_start_1|>
export_dir = self.file_manager.next_name()
tf.saved_model.save(self.model, export_dir, self.signatures, self.options)
... | Action that exports the given model as a SavedModel. | ExportSavedModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExportSavedModel:
"""Action that exports the given model as a SavedModel."""
def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None):
"""Initializes the instance. Args: model: The model to export. file_mana... | stack_v2_sparse_classes_10k_train_003533 | 5,540 | permissive | [
{
"docstring": "Initializes the instance. Args: model: The model to export. file_manager: An instance of `ExportFileManager` (or a subclass), that provides file naming and cleanup functionality. signatures: The signatures to forward to `tf.saved_model.save()`. options: Optional options to forward to `tf.saved_m... | 2 | null | Implement the Python class `ExportSavedModel` described below.
Class description:
Action that exports the given model as a SavedModel.
Method signatures and docstrings:
- def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): Initializes ... | Implement the Python class `ExportSavedModel` described below.
Class description:
Action that exports the given model as a SavedModel.
Method signatures and docstrings:
- def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None): Initializes ... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class ExportSavedModel:
"""Action that exports the given model as a SavedModel."""
def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None):
"""Initializes the instance. Args: model: The model to export. file_mana... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExportSavedModel:
"""Action that exports the given model as a SavedModel."""
def __init__(self, model: tf.Module, file_manager: ExportFileManager, signatures, options: Optional[tf.saved_model.SaveOptions]=None):
"""Initializes the instance. Args: model: The model to export. file_manager: An insta... | the_stack_v2_python_sparse | orbit/actions/export_saved_model.py | jianzhnie/models | train | 2 |
bb0b624d45c5420a3f3c2df5737b76e47d58a7a4 | [
"l_bytes = b'\\x00'\nl_int = convert.bigend_2_int(l_bytes)\nself.assertEqual(l_int, 0)",
"l_bytes = b'\\x00\\x00\\x00\\x00'\nl_int = convert.bigend_2_int(l_bytes)\nself.assertEqual(l_int, 0)",
"l_bytes = b'\\x00\\x00\\x01'\nl_int = convert.bigend_2_int(l_bytes)\nself.assertEqual(l_int, 1)",
"l_bytes = b'\\x00... | <|body_start_0|>
l_bytes = b'\x00'
l_int = convert.bigend_2_int(l_bytes)
self.assertEqual(l_int, 0)
<|end_body_0|>
<|body_start_1|>
l_bytes = b'\x00\x00\x00\x00'
l_int = convert.bigend_2_int(l_bytes)
self.assertEqual(l_int, 0)
<|end_body_1|>
<|body_start_2|>
l_b... | Test fetching big endian byte strings | D2_BigEnd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class D2_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero1(self):
"""Convert a datetime to Minutes"""
<|body_0|>
def test_02_zero4(self):
"""Convert a datetime to Minutes"""
<|body_1|>
def test_03_one3(self):
"""Convert a dateti... | stack_v2_sparse_classes_10k_train_003534 | 6,756 | permissive | [
{
"docstring": "Convert a datetime to Minutes",
"name": "test_01_zero1",
"signature": "def test_01_zero1(self)"
},
{
"docstring": "Convert a datetime to Minutes",
"name": "test_02_zero4",
"signature": "def test_02_zero4(self)"
},
{
"docstring": "Convert a datetime to Minutes",
... | 5 | stack_v2_sparse_classes_30k_val_000050 | Implement the Python class `D2_BigEnd` described below.
Class description:
Test fetching big endian byte strings
Method signatures and docstrings:
- def test_01_zero1(self): Convert a datetime to Minutes
- def test_02_zero4(self): Convert a datetime to Minutes
- def test_03_one3(self): Convert a datetime to Minutes
-... | Implement the Python class `D2_BigEnd` described below.
Class description:
Test fetching big endian byte strings
Method signatures and docstrings:
- def test_01_zero1(self): Convert a datetime to Minutes
- def test_02_zero4(self): Convert a datetime to Minutes
- def test_03_one3(self): Convert a datetime to Minutes
-... | a100fc67761a22ae47ed6f21f3c9464e2de5d54f | <|skeleton|>
class D2_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero1(self):
"""Convert a datetime to Minutes"""
<|body_0|>
def test_02_zero4(self):
"""Convert a datetime to Minutes"""
<|body_1|>
def test_03_one3(self):
"""Convert a dateti... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class D2_BigEnd:
"""Test fetching big endian byte strings"""
def test_01_zero1(self):
"""Convert a datetime to Minutes"""
l_bytes = b'\x00'
l_int = convert.bigend_2_int(l_bytes)
self.assertEqual(l_int, 0)
def test_02_zero4(self):
"""Convert a datetime to Minutes"""
... | the_stack_v2_python_sparse | Project/src/Modules/Core/Utilities/_test/test_convert.py | DBrianKimmel/PyHouse | train | 3 |
1a8df46ff42cc89c4eab30b93aec89d51d605c12 | [
"i = bisect.bisect_left(array, value)\nif i != len(array) and array[i] == value:\n return i\nreturn -1",
"assert i >= 0\nassert i < len(word)\nif cache[i] is not None:\n return cache[i]\nfull = word[i:]\nif self._find(dictionary, full) != -1:\n cache[i] = True\n return True\ncache[i] = False\nfor j in... | <|body_start_0|>
i = bisect.bisect_left(array, value)
if i != len(array) and array[i] == value:
return i
return -1
<|end_body_0|>
<|body_start_1|>
assert i >= 0
assert i < len(word)
if cache[i] is not None:
return cache[i]
full = word[i:]
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _find(self, array, value):
"""Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist."""
<|body_0|>
def _wordBreak(self, word, i, dictionary, cache):
"""Checks if word[i:] c... | stack_v2_sparse_classes_10k_train_003535 | 2,379 | permissive | [
{
"docstring": "Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.",
"name": "_find",
"signature": "def _find(self, array, value)"
},
{
"docstring": "Checks if word[i:] can be broken up into words from the speci... | 3 | stack_v2_sparse_classes_30k_train_001185 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _find(self, array, value): Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.
- def _word... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _find(self, array, value): Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.
- def _word... | 363848b7870c8d90f5be0d345204c0bf8eb45daa | <|skeleton|>
class Solution:
def _find(self, array, value):
"""Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist."""
<|body_0|>
def _wordBreak(self, word, i, dictionary, cache):
"""Checks if word[i:] c... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _find(self, array, value):
"""Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist."""
i = bisect.bisect_left(array, value)
if i != len(array) and array[i] == value:
return i
... | the_stack_v2_python_sparse | leetcode/algorithms/word-break/solution.py | kgashok/algorithms | train | 1 | |
4d9c5447d5c09557490f1a6f16236ecb19bf0b34 | [
"self.distinct_tags = [MagicMock(id=1), MagicMock(id=2), MagicMock(id=3)]\nself.profiles = [MagicMock(tags=MagicMock(), id=2), MagicMock(tags=MagicMock(), id=3)]\nself.social_link = MagicMock(spec=SocialLink, account=MagicMock(spec=SocialAccount, expert=MagicMock(spec=Expert, userbase=MagicMock(id=1), id=1)), exper... | <|body_start_0|>
self.distinct_tags = [MagicMock(id=1), MagicMock(id=2), MagicMock(id=3)]
self.profiles = [MagicMock(tags=MagicMock(), id=2), MagicMock(tags=MagicMock(), id=3)]
self.social_link = MagicMock(spec=SocialLink, account=MagicMock(spec=SocialAccount, expert=MagicMock(spec=Expert, userb... | Test case for PushFeeds | TestPushFeeds | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPushFeeds:
"""Test case for PushFeeds"""
def setUp(self):
"""SetUp method for test case"""
<|body_0|>
def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags):
"""test case for method push_feeds_to_streamfeed"""
<|body_1|... | stack_v2_sparse_classes_10k_train_003536 | 20,391 | no_license | [
{
"docstring": "SetUp method for test case",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "test case for method push_feeds_to_streamfeed",
"name": "test_push_feeds_to_streamfeed",
"signature": "def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock... | 4 | stack_v2_sparse_classes_30k_train_001563 | Implement the Python class `TestPushFeeds` described below.
Class description:
Test case for PushFeeds
Method signatures and docstrings:
- def setUp(self): SetUp method for test case
- def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags): test case for method push_feeds_to_streamfeed... | Implement the Python class `TestPushFeeds` described below.
Class description:
Test case for PushFeeds
Method signatures and docstrings:
- def setUp(self): SetUp method for test case
- def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags): test case for method push_feeds_to_streamfeed... | 248a7b406686c0c98e944319a6eca08485104f5d | <|skeleton|>
class TestPushFeeds:
"""Test case for PushFeeds"""
def setUp(self):
"""SetUp method for test case"""
<|body_0|>
def test_push_feeds_to_streamfeed(self, mock_expert_publish_content, mock_parent_tags):
"""test case for method push_feeds_to_streamfeed"""
<|body_1|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPushFeeds:
"""Test case for PushFeeds"""
def setUp(self):
"""SetUp method for test case"""
self.distinct_tags = [MagicMock(id=1), MagicMock(id=2), MagicMock(id=3)]
self.profiles = [MagicMock(tags=MagicMock(), id=2), MagicMock(tags=MagicMock(), id=3)]
self.social_link =... | the_stack_v2_python_sparse | common/feeds/tests.py | skshivammahajan/DRFChat | train | 0 |
d45662f4dd4be5a127e11579b8d510877b610a82 | [
"self.ss = ss\nself.n_step = n_step\nself.interval = step_interval\nself.step_time = step_time\nself.saw_time = saw_time",
"lB = self.interval[0]\nuB = self.interval[1]\nstep_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)]\nstep_vector[0] = self.ss\nu = np.zeros(shape=dim)\nj = 0\nramp_Step = sel... | <|body_start_0|>
self.ss = ss
self.n_step = n_step
self.interval = step_interval
self.step_time = step_time
self.saw_time = saw_time
<|end_body_0|>
<|body_start_1|>
lB = self.interval[0]
uB = self.interval[1]
step_vector = [round(uniform(lB, uB), 1) for _... | SawRandStep | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SawRandStep:
def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
<|body_0|>
d... | stack_v2_sparse_classes_10k_train_003537 | 8,036 | no_license | [
{
"docstring": "Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps",
"name": "__init__",
"signature": "def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_004140 | Implement the Python class `SawRandStep` described below.
Class description:
Implement the SawRandStep class.
Method signatures and docstrings:
- def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None): Settings for a random step sequence Args: step_interval (list): Probability interval <a, ... | Implement the Python class `SawRandStep` described below.
Class description:
Implement the SawRandStep class.
Method signatures and docstrings:
- def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None): Settings for a random step sequence Args: step_interval (list): Probability interval <a, ... | cf548475295f25407ba968546c2fc85c26f9343c | <|skeleton|>
class SawRandStep:
def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
<|body_0|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SawRandStep:
def __init__(self, step_time, saw_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
self.ss = ss
self.n_ste... | the_stack_v2_python_sparse | SourceCode/simulation/signal.py | martin-bachorik/Master-Thesis-Project | train | 0 | |
8de04dfd1d12abade9dd0d0afd7c2cba678cd986 | [
"if p.val < root.val and q.val < root.val:\n return self.lowestCommonAncestor(root.left, p, q)\nelif p.val > root.val and q.val > root.val:\n return self.lowestCommonAncestor(root.right, p, q)\nelse:\n return root",
"p_val = p.val\nq_val = q.val\nwhile root:\n root_val = root.val\n if p_val < root_... | <|body_start_0|>
if p.val < root.val and q.val < root.val:
return self.lowestCommonAncestor(root.left, p, q)
elif p.val > root.val and q.val > root.val:
return self.lowestCommonAncestor(root.right, p, q)
else:
return root
<|end_body_0|>
<|body_start_1|>
... | Solution | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
"""76ms"""
<|body_0|>
def lowestCommonAncestor2(self, root, p, q):
"""64ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if p.val < root.val and q.val < root.val:
return self.lowest... | stack_v2_sparse_classes_10k_train_003538 | 1,776 | permissive | [
{
"docstring": "76ms",
"name": "lowestCommonAncestor",
"signature": "def lowestCommonAncestor(self, root, p, q)"
},
{
"docstring": "64ms",
"name": "lowestCommonAncestor2",
"signature": "def lowestCommonAncestor2(self, root, p, q)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): 76ms
- def lowestCommonAncestor2(self, root, p, q): 64ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): 76ms
- def lowestCommonAncestor2(self, root, p, q): 64ms
<|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q)... | 49a0b03c55d8a702785888d473ef96539265ce9c | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
"""76ms"""
<|body_0|>
def lowestCommonAncestor2(self, root, p, q):
"""64ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor(self, root, p, q):
"""76ms"""
if p.val < root.val and q.val < root.val:
return self.lowestCommonAncestor(root.left, p, q)
elif p.val > root.val and q.val > root.val:
return self.lowestCommonAncestor(root.right, p, q)
el... | the_stack_v2_python_sparse | leetcode/0235_lowest_common_ancestor_of_a_binary_search_tree.py | chaosWsF/Python-Practice | train | 1 | |
0edde025936976aa089bd6cf642279cdd08c7033 | [
"self.chess_game = chess_game\nself.pieces = []\nself._load_pieces()",
"filename = 'images/chess_pieces.bmp'\npiece_ss = SpriteSheet(filename)\npiece_images = piece_ss.load_grid_images(2, 6, x_margin=64, x_padding=72, y_margin=68, y_padding=48)\ncolors = ['black', 'white']\nnames = ['king', 'queen', 'rook', 'bish... | <|body_start_0|>
self.chess_game = chess_game
self.pieces = []
self._load_pieces()
<|end_body_0|>
<|body_start_1|>
filename = 'images/chess_pieces.bmp'
piece_ss = SpriteSheet(filename)
piece_images = piece_ss.load_grid_images(2, 6, x_margin=64, x_padding=72, y_margin=68,... | Represents a set of chess pieces. Each piece is an object of the Piece class. | ChessSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChessSet:
"""Represents a set of chess pieces. Each piece is an object of the Piece class."""
def __init__(self, chess_game):
"""Initialize attributes to represent the overall set of pieces."""
<|body_0|>
def _load_pieces(self):
"""Builds the overall set: - Loads... | stack_v2_sparse_classes_10k_train_003539 | 2,009 | permissive | [
{
"docstring": "Initialize attributes to represent the overall set of pieces.",
"name": "__init__",
"signature": "def __init__(self, chess_game)"
},
{
"docstring": "Builds the overall set: - Loads images from the sprite sheet. - Creates a Piece object, and sets appropriate attributes for that pi... | 2 | stack_v2_sparse_classes_30k_train_000816 | Implement the Python class `ChessSet` described below.
Class description:
Represents a set of chess pieces. Each piece is an object of the Piece class.
Method signatures and docstrings:
- def __init__(self, chess_game): Initialize attributes to represent the overall set of pieces.
- def _load_pieces(self): Builds the... | Implement the Python class `ChessSet` described below.
Class description:
Represents a set of chess pieces. Each piece is an object of the Piece class.
Method signatures and docstrings:
- def __init__(self, chess_game): Initialize attributes to represent the overall set of pieces.
- def _load_pieces(self): Builds the... | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | <|skeleton|>
class ChessSet:
"""Represents a set of chess pieces. Each piece is an object of the Piece class."""
def __init__(self, chess_game):
"""Initialize attributes to represent the overall set of pieces."""
<|body_0|>
def _load_pieces(self):
"""Builds the overall set: - Loads... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChessSet:
"""Represents a set of chess pieces. Each piece is an object of the Piece class."""
def __init__(self, chess_game):
"""Initialize attributes to represent the overall set of pieces."""
self.chess_game = chess_game
self.pieces = []
self._load_pieces()
def _loa... | the_stack_v2_python_sparse | MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Python/pcc_2e-master/beyond_pcc/chess_game/chess_set.py | bgoonz/UsefulResourceRepo2.0 | train | 10 |
f92a88048a86e2361562e7306f88b32e983ab158 | [
"if nums == []:\n return False\ntemp_count_0 = nums[-1]\ntemp_count_1 = min(nums)\nfor i in nums[:-1][::-1]:\n if i < temp_count_0:\n temp_count_1 = max(temp_count_1, i)\n if i > temp_count_0:\n temp_count_0 = i\n if i < temp_count_1:\n return True\nreturn False",
"import sys\nif ... | <|body_start_0|>
if nums == []:
return False
temp_count_0 = nums[-1]
temp_count_1 = min(nums)
for i in nums[:-1][::-1]:
if i < temp_count_0:
temp_count_1 = max(temp_count_1, i)
if i > temp_count_0:
temp_count_0 = i
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool 42ms"""
<|body_0|>
def increasingTriplet_1(self, nums):
""":type nums: List[int] :rtype: bool 35ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if nums == []:
... | stack_v2_sparse_classes_10k_train_003540 | 1,462 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool 42ms",
"name": "increasingTriplet",
"signature": "def increasingTriplet(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool 35ms",
"name": "increasingTriplet_1",
"signature": "def increasingTriplet_1(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool 42ms
- def increasingTriplet_1(self, nums): :type nums: List[int] :rtype: bool 35ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def increasingTriplet(self, nums): :type nums: List[int] :rtype: bool 42ms
- def increasingTriplet_1(self, nums): :type nums: List[int] :rtype: bool 35ms
<|skeleton|>
class Solu... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool 42ms"""
<|body_0|>
def increasingTriplet_1(self, nums):
""":type nums: List[int] :rtype: bool 35ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def increasingTriplet(self, nums):
""":type nums: List[int] :rtype: bool 42ms"""
if nums == []:
return False
temp_count_0 = nums[-1]
temp_count_1 = min(nums)
for i in nums[:-1][::-1]:
if i < temp_count_0:
temp_count_1 = ... | the_stack_v2_python_sparse | IncreasingTripletSubsequence_MID_334.py | 953250587/leetcode-python | train | 2 | |
93b897b9cc2c6728e0447f2b7a13af7b00b44e4c | [
"if self.IDEAL_CUTS or self.INTER_DEP_CUTS or self.INTRA_DEP_CUTS or self.MONITOR_SPLIT:\n return True\nelse:\n return False",
"if self.INTER_DEP_CUTS or self.INTRA_DEP_CUTS:\n return True\nelse:\n return False"
] | <|body_start_0|>
if self.IDEAL_CUTS or self.INTER_DEP_CUTS or self.INTRA_DEP_CUTS or self.MONITOR_SPLIT:
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
if self.INTER_DEP_CUTS or self.INTRA_DEP_CUTS:
return True
else:
return... | Solver | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solver:
def callback_enabled(self):
"""Returns True iff the MILP solver is using a callback function."""
<|body_0|>
def dep_cuts_enabled(self):
"""Returns True iff the MILP solver is using dependency cuts."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_003541 | 5,536 | permissive | [
{
"docstring": "Returns True iff the MILP solver is using a callback function.",
"name": "callback_enabled",
"signature": "def callback_enabled(self)"
},
{
"docstring": "Returns True iff the MILP solver is using dependency cuts.",
"name": "dep_cuts_enabled",
"signature": "def dep_cuts_en... | 2 | stack_v2_sparse_classes_30k_train_003093 | Implement the Python class `Solver` described below.
Class description:
Implement the Solver class.
Method signatures and docstrings:
- def callback_enabled(self): Returns True iff the MILP solver is using a callback function.
- def dep_cuts_enabled(self): Returns True iff the MILP solver is using dependency cuts. | Implement the Python class `Solver` described below.
Class description:
Implement the Solver class.
Method signatures and docstrings:
- def callback_enabled(self): Returns True iff the MILP solver is using a callback function.
- def dep_cuts_enabled(self): Returns True iff the MILP solver is using dependency cuts.
<... | 57e9608041d230b5d78c4f2afb890b81035436a1 | <|skeleton|>
class Solver:
def callback_enabled(self):
"""Returns True iff the MILP solver is using a callback function."""
<|body_0|>
def dep_cuts_enabled(self):
"""Returns True iff the MILP solver is using dependency cuts."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solver:
def callback_enabled(self):
"""Returns True iff the MILP solver is using a callback function."""
if self.IDEAL_CUTS or self.INTER_DEP_CUTS or self.INTRA_DEP_CUTS or self.MONITOR_SPLIT:
return True
else:
return False
def dep_cuts_enabled(self):
... | the_stack_v2_python_sparse | src/Parameters.py | pkouvaros/venus2_vnncomp21 | train | 0 | |
9dff19832ffc2e73d7da91c593a43dbae11123fd | [
"super(SoftDotAttention, self).__init__()\nself.linear_in = nn.Linear(dim, dim, bias=False)\nself.sm = nn.Softmax(dim=1)\nself.linear_out = nn.Linear(dim * 2, dim, bias=False)\nself.tanh = nn.Tanh()\nself.mask = None",
"target = self.linear_in(input).unsqueeze(2)\nattn = torch.bmm(context, target).squeeze(2)\nif ... | <|body_start_0|>
super(SoftDotAttention, self).__init__()
self.linear_in = nn.Linear(dim, dim, bias=False)
self.sm = nn.Softmax(dim=1)
self.linear_out = nn.Linear(dim * 2, dim, bias=False)
self.tanh = nn.Tanh()
self.mask = None
<|end_body_0|>
<|body_start_1|>
tar... | Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT. | SoftDotAttention | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoftDotAttention:
"""Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT."""
def __init__(self, dim):
"""Initialize layer."""
<|body_0|>
def forward(self, input, context, mask=None, attn_only=False, return_logattn=False):
... | stack_v2_sparse_classes_10k_train_003542 | 8,483 | permissive | [
{
"docstring": "Initialize layer.",
"name": "__init__",
"signature": "def __init__(self, dim)"
},
{
"docstring": "Propagate input through the network. input: batch x dim context: batch x sourceL x dim",
"name": "forward",
"signature": "def forward(self, input, context, mask=None, attn_on... | 2 | stack_v2_sparse_classes_30k_test_000011 | Implement the Python class `SoftDotAttention` described below.
Class description:
Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
Method signatures and docstrings:
- def __init__(self, dim): Initialize layer.
- def forward(self, input, context, mask=None, attn_only=Fal... | Implement the Python class `SoftDotAttention` described below.
Class description:
Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT.
Method signatures and docstrings:
- def __init__(self, dim): Initialize layer.
- def forward(self, input, context, mask=None, attn_only=Fal... | c530c9af647d521262b56b717bcc38b0cfc5f1b8 | <|skeleton|>
class SoftDotAttention:
"""Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT."""
def __init__(self, dim):
"""Initialize layer."""
<|body_0|>
def forward(self, input, context, mask=None, attn_only=False, return_logattn=False):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SoftDotAttention:
"""Soft Dot Attention. Ref: http://www.aclweb.org/anthology/D15-1166 Adapted from PyTorch OPEN NMT."""
def __init__(self, dim):
"""Initialize layer."""
super(SoftDotAttention, self).__init__()
self.linear_in = nn.Linear(dim, dim, bias=False)
self.sm = nn.... | the_stack_v2_python_sparse | stanza/models/common/seq2seq_modules.py | stanfordnlp/stanza | train | 4,281 |
4167d038012875409bfb0b38c3dfb21ed523bccc | [
"if context is None:\n context = {}\nif view_type == 'tree':\n view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'stock.location.tree2')])\n if context.get('product_id', ''):\n view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'stock.location.tree')])\n view_... | <|body_start_0|>
if context is None:
context = {}
if view_type == 'tree':
view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'stock.location.tree2')])
if context.get('product_id', ''):
view_id = self.pool.get('ir.ui.view').search(cr, ... | stock_location | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stock_location:
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
"""Changes the view dynamically @return: New arch of view."""
<|body_0|>
def name_get(self, cr, uid, ids, context=None):
"""Inherit fuction ... | stack_v2_sparse_classes_10k_train_003543 | 27,204 | no_license | [
{
"docstring": "Changes the view dynamically @return: New arch of view.",
"name": "fields_view_get",
"signature": "def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False)"
},
{
"docstring": "Inherit fuction to return name (not full hierarchic... | 2 | null | Implement the Python class `stock_location` described below.
Class description:
Implement the stock_location class.
Method signatures and docstrings:
- def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): Changes the view dynamically @return: New arch of view.... | Implement the Python class `stock_location` described below.
Class description:
Implement the stock_location class.
Method signatures and docstrings:
- def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): Changes the view dynamically @return: New arch of view.... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class stock_location:
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
"""Changes the view dynamically @return: New arch of view."""
<|body_0|>
def name_get(self, cr, uid, ids, context=None):
"""Inherit fuction ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class stock_location:
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
"""Changes the view dynamically @return: New arch of view."""
if context is None:
context = {}
if view_type == 'tree':
view_id = self.p... | the_stack_v2_python_sparse | v_7/Dongola/common/stock_multi_company/stock.py | musabahmed/baba | train | 0 | |
c97067a23527757ba5364863fe6c33b4bffd55d4 | [
"super().__init__(**kwargs)\nif align_file_name != '':\n try:\n self.align_file = open(align_file_name, 'r')\n except FileNotFoundError:\n print('ERROR: Alignment file ' + align_file_name + ' not found.')\n exit()\nself.a_frame_extractor = Frame_extractor()\nself.b_frame_extractor = Frame... | <|body_start_0|>
super().__init__(**kwargs)
if align_file_name != '':
try:
self.align_file = open(align_file_name, 'r')
except FileNotFoundError:
print('ERROR: Alignment file ' + align_file_name + ' not found.')
exit()
self.... | Main_link_control | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Main_link_control:
def __init__(self, align_file_name='', a_lang_mark='', b_lang_mark='', **kwargs):
"""overriden block method"""
<|body_0|>
def process_bundle(self, bundle):
"""overriden block method"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_003544 | 1,839 | no_license | [
{
"docstring": "overriden block method",
"name": "__init__",
"signature": "def __init__(self, align_file_name='', a_lang_mark='', b_lang_mark='', **kwargs)"
},
{
"docstring": "overriden block method",
"name": "process_bundle",
"signature": "def process_bundle(self, bundle)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005719 | Implement the Python class `Main_link_control` described below.
Class description:
Implement the Main_link_control class.
Method signatures and docstrings:
- def __init__(self, align_file_name='', a_lang_mark='', b_lang_mark='', **kwargs): overriden block method
- def process_bundle(self, bundle): overriden block met... | Implement the Python class `Main_link_control` described below.
Class description:
Implement the Main_link_control class.
Method signatures and docstrings:
- def __init__(self, align_file_name='', a_lang_mark='', b_lang_mark='', **kwargs): overriden block method
- def process_bundle(self, bundle): overriden block met... | 194446ec1adeec5ef85db3f96b6d8d2876cc8811 | <|skeleton|>
class Main_link_control:
def __init__(self, align_file_name='', a_lang_mark='', b_lang_mark='', **kwargs):
"""overriden block method"""
<|body_0|>
def process_bundle(self, bundle):
"""overriden block method"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Main_link_control:
def __init__(self, align_file_name='', a_lang_mark='', b_lang_mark='', **kwargs):
"""overriden block method"""
super().__init__(**kwargs)
if align_file_name != '':
try:
self.align_file = open(align_file_name, 'r')
except FileNo... | the_stack_v2_python_sparse | udapi-python/udapi/block/valency/control/main_link_control.py | Jankus1994/ud-valency | train | 0 | |
e9ae4336674e6b012f9f2f3d5ccfed0d10133d3f | [
"self.connectivityBoundaries = None\nself.connectivityConnections = None\nself.hierarchyBoundaries = None\nself.dualHierarchyBoundaries = None\nself.hierarchyConnections = None\nself.dualHierarchyConnections = None\nself.contacts = None",
"self.connectivityBoundaries = Cluster.clusterBoundaries(contacts=contacts)... | <|body_start_0|>
self.connectivityBoundaries = None
self.connectivityConnections = None
self.hierarchyBoundaries = None
self.dualHierarchyBoundaries = None
self.hierarchyConnections = None
self.dualHierarchyConnections = None
self.contacts = None
<|end_body_0|>
<... | An instance of this class can contain up to six different clusterings of the same data (see below) Clusters can be formed in the following ways: 1) Clustering based on connectivity All boundaries that are linked to each other via connections (connectors) form a boundary cluster. In the same way, all connections that ar... | MultiCluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiCluster:
"""An instance of this class can contain up to six different clusterings of the same data (see below) Clusters can be formed in the following ways: 1) Clustering based on connectivity All boundaries that are linked to each other via connections (connectors) form a boundary cluster. ... | stack_v2_sparse_classes_10k_train_003545 | 15,116 | permissive | [
{
"docstring": "Initializes attributes",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Clusters boundaries and connections based on connectivity. Arguments: - contacts: (Contacts) specifies contacts between connections and boundaries - topology: if True calculates topo... | 4 | null | Implement the Python class `MultiCluster` described below.
Class description:
An instance of this class can contain up to six different clusterings of the same data (see below) Clusters can be formed in the following ways: 1) Clustering based on connectivity All boundaries that are linked to each other via connections... | Implement the Python class `MultiCluster` described below.
Class description:
An instance of this class can contain up to six different clusterings of the same data (see below) Clusters can be formed in the following ways: 1) Clustering based on connectivity All boundaries that are linked to each other via connections... | 1370bfedae2ad5e6cdd1dc08395eb9e95b4a8596 | <|skeleton|>
class MultiCluster:
"""An instance of this class can contain up to six different clusterings of the same data (see below) Clusters can be formed in the following ways: 1) Clustering based on connectivity All boundaries that are linked to each other via connections (connectors) form a boundary cluster. ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiCluster:
"""An instance of this class can contain up to six different clusterings of the same data (see below) Clusters can be formed in the following ways: 1) Clustering based on connectivity All boundaries that are linked to each other via connections (connectors) form a boundary cluster. In the same w... | the_stack_v2_python_sparse | code/pyto/scene/multi_cluster.py | anmartinezs/pyseg_system | train | 15 |
6d7fbf6a7edb2e3e36dc2299c014c7ed7f64a6c0 | [
"self.credentials = credentials\nhttp = httplib2.Http()\nhttp = self.credentials.authorize(http)\nself.service = build('drive', 'v2', http=http)",
"response = self.service.files().list().execute()\nmimeType = 'application/vnd.google-apps.spreadsheet'\nspreadsheets = []\nfor item in response['items']:\n if item... | <|body_start_0|>
self.credentials = credentials
http = httplib2.Http()
http = self.credentials.authorize(http)
self.service = build('drive', 'v2', http=http)
<|end_body_0|>
<|body_start_1|>
response = self.service.files().list().execute()
mimeType = 'application/vnd.goog... | SimpleDriveClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleDriveClient:
def __init__(self, credentials):
"""We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed."""
<|body_0|>
def get_spreadsheet_list(s... | stack_v2_sparse_classes_10k_train_003546 | 972 | permissive | [
{
"docstring": "We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed.",
"name": "__init__",
"signature": "def __init__(self, credentials)"
},
{
"docstring": "For now it o... | 2 | stack_v2_sparse_classes_30k_train_006536 | Implement the Python class `SimpleDriveClient` described below.
Class description:
Implement the SimpleDriveClient class.
Method signatures and docstrings:
- def __init__(self, credentials): We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the call... | Implement the Python class `SimpleDriveClient` described below.
Class description:
Implement the SimpleDriveClient class.
Method signatures and docstrings:
- def __init__(self, credentials): We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the call... | 0e65331da40cfd3766f1bde17f0a9c7ff6666dea | <|skeleton|>
class SimpleDriveClient:
def __init__(self, credentials):
"""We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed."""
<|body_0|>
def get_spreadsheet_list(s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SimpleDriveClient:
def __init__(self, credentials):
"""We expect some OAuth2 credentials that allow us to authorize the user, so we assume that the access_token is valid. Is the caller's responsability to refresh the tokens if needed."""
self.credentials = credentials
http = httplib2.H... | the_stack_v2_python_sparse | networkx-d3-v2/clients/drive.py | suraj-testing2/Solar_YouTube | train | 0 | |
8d691c210a10487c9a59ae99e732d6d4b3edd9e1 | [
"file_entry = parser_mediator.GetFileEntry()\nfile_system = file_entry.GetFileSystem()\npath_segments = file_system.SplitPath(file_entry.path_spec.location)\nreturn path_segments[-2]",
"command = None\ncontainer_configuration = self._GetJSONValue(json_dict, 'container_config')\nif container_configuration:\n co... | <|body_start_0|>
file_entry = parser_mediator.GetFileEntry()
file_system = file_entry.GetFileSystem()
path_segments = file_system.SplitPath(file_entry.path_spec.location)
return path_segments[-2]
<|end_body_0|>
<|body_start_1|>
command = None
container_configuration = se... | JSON-L parser plugin for Docker layer configuration files. This parser handles per Docker layer configuration files stored in: DOCKER_DIR/graph/<layer_identifier>/json | DockerLayerConfigurationJSONLPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DockerLayerConfigurationJSONLPlugin:
"""JSON-L parser plugin for Docker layer configuration files. This parser handles per Docker layer configuration files stored in: DOCKER_DIR/graph/<layer_identifier>/json"""
def _GetLayerIdentifierFromPath(self, parser_mediator):
"""Extracts a lay... | stack_v2_sparse_classes_10k_train_003547 | 3,407 | permissive | [
{
"docstring": "Extracts a layer (or graph) identifier from a path. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. Returns: str: layer identifier.",
"name": "_GetLayerIdentifierFromPath",
"signature": "def _GetLayerIdentifie... | 3 | null | Implement the Python class `DockerLayerConfigurationJSONLPlugin` described below.
Class description:
JSON-L parser plugin for Docker layer configuration files. This parser handles per Docker layer configuration files stored in: DOCKER_DIR/graph/<layer_identifier>/json
Method signatures and docstrings:
- def _GetLayer... | Implement the Python class `DockerLayerConfigurationJSONLPlugin` described below.
Class description:
JSON-L parser plugin for Docker layer configuration files. This parser handles per Docker layer configuration files stored in: DOCKER_DIR/graph/<layer_identifier>/json
Method signatures and docstrings:
- def _GetLayer... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class DockerLayerConfigurationJSONLPlugin:
"""JSON-L parser plugin for Docker layer configuration files. This parser handles per Docker layer configuration files stored in: DOCKER_DIR/graph/<layer_identifier>/json"""
def _GetLayerIdentifierFromPath(self, parser_mediator):
"""Extracts a lay... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DockerLayerConfigurationJSONLPlugin:
"""JSON-L parser plugin for Docker layer configuration files. This parser handles per Docker layer configuration files stored in: DOCKER_DIR/graph/<layer_identifier>/json"""
def _GetLayerIdentifierFromPath(self, parser_mediator):
"""Extracts a layer (or graph)... | the_stack_v2_python_sparse | plaso/parsers/jsonl_plugins/docker_layer_config.py | log2timeline/plaso | train | 1,506 |
56e41d8c7f3cc19ed777264d7f1d25eb4e3dc884 | [
"self.upload_directory = upload_directory\nself.video_directory = video_directory\nself.db_host = db_host\nself.db_port = db_port",
"res = r.table('videos').insert({'name': orig_filename, 'extension': extension}).run(r.connect(self.db_host, self.db_port, 'vor'))\ngenerated_key = res['generated_keys'][0]\nnew_file... | <|body_start_0|>
self.upload_directory = upload_directory
self.video_directory = video_directory
self.db_host = db_host
self.db_port = db_port
<|end_body_0|>
<|body_start_1|>
res = r.table('videos').insert({'name': orig_filename, 'extension': extension}).run(r.connect(self.db_ho... | Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig. | VideoRepository | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoRepository:
"""Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig."""
def __init__(self, upload_directory, video_directory, db_host, db_port):
"""Konstruktor zum Erzeugen eines neuen Vide... | stack_v2_sparse_classes_10k_train_003548 | 2,057 | permissive | [
{
"docstring": "Konstruktor zum Erzeugen eines neuen VideoRepository. :param video_directory: Pfad des Ordners, in dem Videos gespeichert werden :param db_host: Datenbank Host Adresse :param db_port: Datenbank Port",
"name": "__init__",
"signature": "def __init__(self, upload_directory, video_directory,... | 3 | stack_v2_sparse_classes_30k_train_005937 | Implement the Python class `VideoRepository` described below.
Class description:
Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig.
Method signatures and docstrings:
- def __init__(self, upload_directory, video_directory, db_... | Implement the Python class `VideoRepository` described below.
Class description:
Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig.
Method signatures and docstrings:
- def __init__(self, upload_directory, video_directory, db_... | 9006b85ad5a0084d7501413649e0679ba8adbe63 | <|skeleton|>
class VideoRepository:
"""Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig."""
def __init__(self, upload_directory, video_directory, db_host, db_port):
"""Konstruktor zum Erzeugen eines neuen Vide... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VideoRepository:
"""Die Klasse ist für die Speicherung von Keyframes und Keyframe-Predictions sowie die Abfrage von Keyframe-Metadaten aus der Datenbank zuständig."""
def __init__(self, upload_directory, video_directory, db_host, db_port):
"""Konstruktor zum Erzeugen eines neuen VideoRepository. ... | the_stack_v2_python_sparse | ApplicationServer/repositories/video_repository.py | paltmey/scias | train | 0 |
1fa03615b2b8c9dcb28be94d0f19c1ced3634251 | [
"try:\n response = installers.ComponentInstaller.MakeRequest(url, command_path)\n if not response:\n return None\n code = response.getcode()\n if code and code != 200:\n return None\n text = response.read()\n return cls(text)\nexcept Exception:\n log.debug('Failed to download [{ur... | <|body_start_0|>
try:
response = installers.ComponentInstaller.MakeRequest(url, command_path)
if not response:
return None
code = response.getcode()
if code and code != 200:
return None
text = response.read()
... | Represents a parsed RELEASE_NOTES file. The file should have the general structure of: # Google Cloud SDK - Release Notes Copyright 2014-2015 Google Inc. All rights reserved. ## 0.9.78 (2015/09/16) * Note * Note 2 ## 0.9.77 (2015/09/09) * Note 3 | ReleaseNotes | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReleaseNotes:
"""Represents a parsed RELEASE_NOTES file. The file should have the general structure of: # Google Cloud SDK - Release Notes Copyright 2014-2015 Google Inc. All rights reserved. ## 0.9.78 (2015/09/16) * Note * Note 2 ## 0.9.77 (2015/09/09) * Note 3"""
def FromURL(cls, url, comm... | stack_v2_sparse_classes_10k_train_003549 | 7,636 | permissive | [
{
"docstring": "Parses release notes from the given URL. Any error in downloading or parsing release notes is logged and swallowed and None is returned. Args: url: str, The URL to download and parse. command_path: str, The command that is calling this for instrumenting the user agent for the download. Returns: ... | 5 | null | Implement the Python class `ReleaseNotes` described below.
Class description:
Represents a parsed RELEASE_NOTES file. The file should have the general structure of: # Google Cloud SDK - Release Notes Copyright 2014-2015 Google Inc. All rights reserved. ## 0.9.78 (2015/09/16) * Note * Note 2 ## 0.9.77 (2015/09/09) * No... | Implement the Python class `ReleaseNotes` described below.
Class description:
Represents a parsed RELEASE_NOTES file. The file should have the general structure of: # Google Cloud SDK - Release Notes Copyright 2014-2015 Google Inc. All rights reserved. ## 0.9.78 (2015/09/16) * Note * Note 2 ## 0.9.77 (2015/09/09) * No... | c98b58aeb0994e011df960163541e9379ae7ea06 | <|skeleton|>
class ReleaseNotes:
"""Represents a parsed RELEASE_NOTES file. The file should have the general structure of: # Google Cloud SDK - Release Notes Copyright 2014-2015 Google Inc. All rights reserved. ## 0.9.78 (2015/09/16) * Note * Note 2 ## 0.9.77 (2015/09/09) * Note 3"""
def FromURL(cls, url, comm... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReleaseNotes:
"""Represents a parsed RELEASE_NOTES file. The file should have the general structure of: # Google Cloud SDK - Release Notes Copyright 2014-2015 Google Inc. All rights reserved. ## 0.9.78 (2015/09/16) * Note * Note 2 ## 0.9.77 (2015/09/09) * Note 3"""
def FromURL(cls, url, command_path=None... | the_stack_v2_python_sparse | google-cloud-sdk/.install/.backup/lib/googlecloudsdk/core/updater/release_notes.py | KaranToor/MA450 | train | 1 |
3d94915dffecf863595bc80d4a400bbef49f71bd | [
"self.check_permission()\nself.check_addable_types()\nif self.is_application_pkcs7_mime(message):\n filename = 'message.p7m'\nelse:\n filename = 'message.eml'\ncommand = CreateEmailCommand(self.context, filename, message, message_source=MESSAGE_SOURCE_MAILIN)\nobj = command.execute()\ninitialize_custompropert... | <|body_start_0|>
self.check_permission()
self.check_addable_types()
if self.is_application_pkcs7_mime(message):
filename = 'message.p7m'
else:
filename = 'message.eml'
command = CreateEmailCommand(self.context, filename, message, message_source=MESSAGE_SOU... | This adapter is called form ftw.mail when creating mailed-in mails. We override it and create mail with `CreateEmailCommand` to make sure that creating content programmatically always uses the same code-path. | OGCreateMailInContainer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OGCreateMailInContainer:
"""This adapter is called form ftw.mail when creating mailed-in mails. We override it and create mail with `CreateEmailCommand` to make sure that creating content programmatically always uses the same code-path."""
def create_mail(self, message):
"""Use `Crea... | stack_v2_sparse_classes_10k_train_003550 | 1,800 | no_license | [
{
"docstring": "Use `CreateEmailCommand` to create the mailed-in mail.",
"name": "create_mail",
"signature": "def create_mail(self, message)"
},
{
"docstring": "Return if message is of application/pkcs7-mime media type. As specified by https://tools.ietf.org/html/rfc8551#section-3.5.3.2.",
"... | 2 | null | Implement the Python class `OGCreateMailInContainer` described below.
Class description:
This adapter is called form ftw.mail when creating mailed-in mails. We override it and create mail with `CreateEmailCommand` to make sure that creating content programmatically always uses the same code-path.
Method signatures an... | Implement the Python class `OGCreateMailInContainer` described below.
Class description:
This adapter is called form ftw.mail when creating mailed-in mails. We override it and create mail with `CreateEmailCommand` to make sure that creating content programmatically always uses the same code-path.
Method signatures an... | a01bec6c00d203c21a1b0449f8d489d0033c02b7 | <|skeleton|>
class OGCreateMailInContainer:
"""This adapter is called form ftw.mail when creating mailed-in mails. We override it and create mail with `CreateEmailCommand` to make sure that creating content programmatically always uses the same code-path."""
def create_mail(self, message):
"""Use `Crea... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OGCreateMailInContainer:
"""This adapter is called form ftw.mail when creating mailed-in mails. We override it and create mail with `CreateEmailCommand` to make sure that creating content programmatically always uses the same code-path."""
def create_mail(self, message):
"""Use `CreateEmailComman... | the_stack_v2_python_sparse | opengever/mail/create.py | 4teamwork/opengever.core | train | 19 |
f95e632615a3fca54e4e7388e60e43e25ee6c96b | [
"if self.value is not None:\n return self.value * u.Unit(self.unit)\nelse:\n return np.nan * u.Unit(self.unit)",
"newclass = type(name, (cls, Base), {'__tablename__': tablename, 'file': sqlalchemy.Column(sqlalchemy.String, sqlalchemy.ForeignKey(entrycls.file)), 'entry': sqlalchemy.orm.relationship(entrycls,... | <|body_start_0|>
if self.value is not None:
return self.value * u.Unit(self.unit)
else:
return np.nan * u.Unit(self.unit)
<|end_body_0|>
<|body_start_1|>
newclass = type(name, (cls, Base), {'__tablename__': tablename, 'file': sqlalchemy.Column(sqlalchemy.String, sqlalche... | A mixin object for a cache entry object to inherit, providing the relevant columns and accessors | Cache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cache:
"""A mixin object for a cache entry object to inherit, providing the relevant columns and accessors"""
def get_value(self):
"""Return the current cache value (with appropriate AstroPy units)"""
<|body_0|>
def CacheFactory(cls, name, entrycls, tablename, **kwargs):... | stack_v2_sparse_classes_10k_train_003551 | 23,976 | no_license | [
{
"docstring": "Return the current cache value (with appropriate AstroPy units)",
"name": "get_value",
"signature": "def get_value(self)"
},
{
"docstring": "Create a cache object inside of cls that is itself a SQLAlchemy entry object",
"name": "CacheFactory",
"signature": "def CacheFacto... | 3 | stack_v2_sparse_classes_30k_train_004248 | Implement the Python class `Cache` described below.
Class description:
A mixin object for a cache entry object to inherit, providing the relevant columns and accessors
Method signatures and docstrings:
- def get_value(self): Return the current cache value (with appropriate AstroPy units)
- def CacheFactory(cls, name,... | Implement the Python class `Cache` described below.
Class description:
A mixin object for a cache entry object to inherit, providing the relevant columns and accessors
Method signatures and docstrings:
- def get_value(self): Return the current cache value (with appropriate AstroPy units)
- def CacheFactory(cls, name,... | 514af926494daa52d1e9699ffe295529492117a2 | <|skeleton|>
class Cache:
"""A mixin object for a cache entry object to inherit, providing the relevant columns and accessors"""
def get_value(self):
"""Return the current cache value (with appropriate AstroPy units)"""
<|body_0|>
def CacheFactory(cls, name, entrycls, tablename, **kwargs):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Cache:
"""A mixin object for a cache entry object to inherit, providing the relevant columns and accessors"""
def get_value(self):
"""Return the current cache value (with appropriate AstroPy units)"""
if self.value is not None:
return self.value * u.Unit(self.unit)
els... | the_stack_v2_python_sparse | kepler_utils/database/database.py | brownjustinmichael/KEPLER-Utilities | train | 0 |
010a5eda3d42169112042145140e28c0d5d19a12 | [
"accountInfo = {'username': request.user.username, 'email': request.user.email, 'phone': request.user.phone, 'wechat': request.user.wechat}\naccountForm = AccountForm(accountInfo)\nreturn render(request, 'usermgr/user/account.html', locals())",
"if request.is_ajax():\n resultData = {'ret': None}\n accountFo... | <|body_start_0|>
accountInfo = {'username': request.user.username, 'email': request.user.email, 'phone': request.user.phone, 'wechat': request.user.wechat}
accountForm = AccountForm(accountInfo)
return render(request, 'usermgr/user/account.html', locals())
<|end_body_0|>
<|body_start_1|>
... | 处理用户帐号相关请求 | Account | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Account:
"""处理用户帐号相关请求"""
def get(self, request):
"""处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面"""
<|body_0|>
def post(self, request):
"""处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果"""
<|body_1|>
d... | stack_v2_sparse_classes_10k_train_003552 | 12,349 | no_license | [
{
"docstring": "处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果",
"name": "post",
"signature": "def post(self, request)"
... | 3 | stack_v2_sparse_classes_30k_train_000362 | Implement the Python class `Account` described below.
Class description:
处理用户帐号相关请求
Method signatures and docstrings:
- def get(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面
- def post(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果
- def d... | Implement the Python class `Account` described below.
Class description:
处理用户帐号相关请求
Method signatures and docstrings:
- def get(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面
- def post(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果
- def d... | 26c49e8f525ca57dca27f8de53d15bcab24d00e4 | <|skeleton|>
class Account:
"""处理用户帐号相关请求"""
def get(self, request):
"""处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面"""
<|body_0|>
def post(self, request):
"""处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果"""
<|body_1|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Account:
"""处理用户帐号相关请求"""
def get(self, request):
"""处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面"""
accountInfo = {'username': request.user.username, 'email': request.user.email, 'phone': request.user.phone, 'wechat': request.user.wechat}
accountForm = A... | the_stack_v2_python_sparse | iframe_api/views.py | A35-Zhou/Rental-House-Manager | train | 0 |
1738ed8d4580f1107dfbee9373698fe766ade0ac | [
"ENFORCER.enforce_call(action='identity:get_project_tag', build_target=_build_project_target_enforcement)\nPROVIDERS.resource_api.get_project_tag(project_id, value)\nreturn (None, http_client.NO_CONTENT)",
"ENFORCER.enforce_call(action='identity:create_project_tag', build_target=_build_project_target_enforcement)... | <|body_start_0|>
ENFORCER.enforce_call(action='identity:get_project_tag', build_target=_build_project_target_enforcement)
PROVIDERS.resource_api.get_project_tag(project_id, value)
return (None, http_client.NO_CONTENT)
<|end_body_0|>
<|body_start_1|>
ENFORCER.enforce_call(action='identit... | ProjectTagResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectTagResource:
def get(self, project_id, value):
"""Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}"""
<|body_0|>
def put(self, project_id, value):
"""Add a single tag to a project. PUT /v3/projects/{p... | stack_v2_sparse_classes_10k_train_003553 | 22,149 | permissive | [
{
"docstring": "Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}",
"name": "get",
"signature": "def get(self, project_id, value)"
},
{
"docstring": "Add a single tag to a project. PUT /v3/projects/{project_id}/tags/{value}",
"name":... | 3 | stack_v2_sparse_classes_30k_train_005018 | Implement the Python class `ProjectTagResource` described below.
Class description:
Implement the ProjectTagResource class.
Method signatures and docstrings:
- def get(self, project_id, value): Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}
- def put(self,... | Implement the Python class `ProjectTagResource` described below.
Class description:
Implement the ProjectTagResource class.
Method signatures and docstrings:
- def get(self, project_id, value): Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}
- def put(self,... | 03a0a8146a78682ede9eca12a5a7fdacde2035c8 | <|skeleton|>
class ProjectTagResource:
def get(self, project_id, value):
"""Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}"""
<|body_0|>
def put(self, project_id, value):
"""Add a single tag to a project. PUT /v3/projects/{p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProjectTagResource:
def get(self, project_id, value):
"""Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}"""
ENFORCER.enforce_call(action='identity:get_project_tag', build_target=_build_project_target_enforcement)
PROVIDERS.re... | the_stack_v2_python_sparse | keystone/api/projects.py | sapcc/keystone | train | 0 | |
43491ccb78ad5d926715538405e405a91ea56563 | [
"study_id = filter_params.pop('study_id', None)\nq = SequencingExperimentGenomicFile.query.filter_by(**filter_params)\nfrom dataservice.api.participant.models import Participant\nfrom dataservice.api.biospecimen.models import Biospecimen\nfrom dataservice.api.genomic_file.models import GenomicFile\nfrom dataservice... | <|body_start_0|>
study_id = filter_params.pop('study_id', None)
q = SequencingExperimentGenomicFile.query.filter_by(**filter_params)
from dataservice.api.participant.models import Participant
from dataservice.api.biospecimen.models import Biospecimen
from dataservice.api.genomic_... | SequencingExperimentGenomicFile List API | SequencingExperimentGenomicFileListAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequencingExperimentGenomicFileListAPI:
"""SequencingExperimentGenomicFile List API"""
def get(self, filter_params, after, limit):
"""Get a paginated sequencing_experiment_genomic_files --- template: path: get_list.yml properties: resource: SequencingExperimentGenomicFile"""
... | stack_v2_sparse_classes_10k_train_003554 | 5,985 | permissive | [
{
"docstring": "Get a paginated sequencing_experiment_genomic_files --- template: path: get_list.yml properties: resource: SequencingExperimentGenomicFile",
"name": "get",
"signature": "def get(self, filter_params, after, limit)"
},
{
"docstring": "Create a new sequencing_experiment_genomic_file... | 2 | stack_v2_sparse_classes_30k_train_003097 | Implement the Python class `SequencingExperimentGenomicFileListAPI` described below.
Class description:
SequencingExperimentGenomicFile List API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get a paginated sequencing_experiment_genomic_files --- template: path: get_list.yml properti... | Implement the Python class `SequencingExperimentGenomicFileListAPI` described below.
Class description:
SequencingExperimentGenomicFile List API
Method signatures and docstrings:
- def get(self, filter_params, after, limit): Get a paginated sequencing_experiment_genomic_files --- template: path: get_list.yml properti... | 36ee3fc3d1ba9d1a177274d051fb175c56dd898e | <|skeleton|>
class SequencingExperimentGenomicFileListAPI:
"""SequencingExperimentGenomicFile List API"""
def get(self, filter_params, after, limit):
"""Get a paginated sequencing_experiment_genomic_files --- template: path: get_list.yml properties: resource: SequencingExperimentGenomicFile"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SequencingExperimentGenomicFileListAPI:
"""SequencingExperimentGenomicFile List API"""
def get(self, filter_params, after, limit):
"""Get a paginated sequencing_experiment_genomic_files --- template: path: get_list.yml properties: resource: SequencingExperimentGenomicFile"""
study_id = fi... | the_stack_v2_python_sparse | dataservice/api/sequencing_experiment_genomic_file/resources.py | kids-first/kf-api-dataservice | train | 9 |
5f0ff1eaf11698158d404e3a5d1565c841b9709f | [
"result = []\nfor i in range(len(nums)):\n current = nums[i]\n two_sum = self.twoSum_for_3sum(nums, 0 - current, i)\n if two_sum:\n for ts in two_sum:\n ans = sorted([current] + ts)\n if ans not in result:\n result.append(ans)\nreturn sorted(result)",
"result =... | <|body_start_0|>
result = []
for i in range(len(nums)):
current = nums[i]
two_sum = self.twoSum_for_3sum(nums, 0 - current, i)
if two_sum:
for ts in two_sum:
ans = sorted([current] + ts)
if ans not in result:
... | Solution_A | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_A:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""Hstable method from LC001 Use modified method of two_sum (Above) with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded"""
<|body_0|>
def twoSum_for_3sum(self... | stack_v2_sparse_classes_10k_train_003555 | 8,683 | permissive | [
{
"docstring": "Hstable method from LC001 Use modified method of two_sum (Above) with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded",
"name": "threeSum",
"signature": "def threeSum(self, nums: List[int]) -> List[List[int]]"
},
{
"docstring": "Hel... | 2 | null | Implement the Python class `Solution_A` described below.
Class description:
Implement the Solution_A class.
Method signatures and docstrings:
- def threeSum(self, nums: List[int]) -> List[List[int]]: Hstable method from LC001 Use modified method of two_sum (Above) with every number, check the rest of array for two_su... | Implement the Python class `Solution_A` described below.
Class description:
Implement the Solution_A class.
Method signatures and docstrings:
- def threeSum(self, nums: List[int]) -> List[List[int]]: Hstable method from LC001 Use modified method of two_sum (Above) with every number, check the rest of array for two_su... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class Solution_A:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""Hstable method from LC001 Use modified method of two_sum (Above) with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded"""
<|body_0|>
def twoSum_for_3sum(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution_A:
def threeSum(self, nums: List[int]) -> List[List[int]]:
"""Hstable method from LC001 Use modified method of two_sum (Above) with every number, check the rest of array for two_sum of (0-number) O(N^2), max time limit exceeded"""
result = []
for i in range(len(nums)):
... | the_stack_v2_python_sparse | LeetCode/LC015_3sum.py | jxie0755/Learning_Python | train | 0 | |
af788f1b33b24a6c2c3e80cb974c69b73c94106a | [
"try:\n if AuthorizationService.get_user_authorizations_for_entity(business_identifier):\n response, status = (AffiliationService.find_affiliation(org_id, business_identifier), http_status.HTTP_200_OK)\n else:\n response, status = ({'message': 'Not authorized to perform this action'}, http_statu... | <|body_start_0|>
try:
if AuthorizationService.get_user_authorizations_for_entity(business_identifier):
response, status = (AffiliationService.find_affiliation(org_id, business_identifier), http_status.HTTP_200_OK)
else:
response, status = ({'message': 'Not... | Resource for managing a single affiliation between an org and an entity. | OrgAffiliation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrgAffiliation:
"""Resource for managing a single affiliation between an org and an entity."""
def get(org_id, business_identifier):
"""Get the affiliation by org id and business identifier with authorized user."""
<|body_0|>
def delete(org_id, business_identifier):
... | stack_v2_sparse_classes_10k_train_003556 | 30,185 | permissive | [
{
"docstring": "Get the affiliation by org id and business identifier with authorized user.",
"name": "get",
"signature": "def get(org_id, business_identifier)"
},
{
"docstring": "Delete an affiliation between an org and an entity.",
"name": "delete",
"signature": "def delete(org_id, bus... | 2 | null | Implement the Python class `OrgAffiliation` described below.
Class description:
Resource for managing a single affiliation between an org and an entity.
Method signatures and docstrings:
- def get(org_id, business_identifier): Get the affiliation by org id and business identifier with authorized user.
- def delete(or... | Implement the Python class `OrgAffiliation` described below.
Class description:
Resource for managing a single affiliation between an org and an entity.
Method signatures and docstrings:
- def get(org_id, business_identifier): Get the affiliation by org id and business identifier with authorized user.
- def delete(or... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class OrgAffiliation:
"""Resource for managing a single affiliation between an org and an entity."""
def get(org_id, business_identifier):
"""Get the affiliation by org id and business identifier with authorized user."""
<|body_0|>
def delete(org_id, business_identifier):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrgAffiliation:
"""Resource for managing a single affiliation between an org and an entity."""
def get(org_id, business_identifier):
"""Get the affiliation by org id and business identifier with authorized user."""
try:
if AuthorizationService.get_user_authorizations_for_entit... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/org.py | bcgov/sbc-auth | train | 13 |
d442ff00e10d07440d5024fcbea84182f52c97a8 | [
"BaseWorkerThread.__init__(self)\nself.wq = queue\nself.config = config\nif reqMgr:\n self.reqMgr = reqMgr\nelse:\n self.reqMgr = WorkQueueReqMgrInterface(**self.config)\nself.previousState = {}",
"t = random.randrange(self.idleTime)\nself.logger.info('Sleeping for %d seconds before 1st loop' % t)\ntime.sle... | <|body_start_0|>
BaseWorkerThread.__init__(self)
self.wq = queue
self.config = config
if reqMgr:
self.reqMgr = reqMgr
else:
self.reqMgr = WorkQueueReqMgrInterface(**self.config)
self.previousState = {}
<|end_body_0|>
<|body_start_1|>
t = r... | Polls for requests | WorkQueueManagerReqMgrPoller | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkQueueManagerReqMgrPoller:
"""Polls for requests"""
def __init__(self, queue, config, reqMgr=None):
"""Initialise class members"""
<|body_0|>
def setup(self, parameters):
"""Called at startup - introduce random delay to avoid workers all starting at once"""
... | stack_v2_sparse_classes_10k_train_003557 | 1,352 | permissive | [
{
"docstring": "Initialise class members",
"name": "__init__",
"signature": "def __init__(self, queue, config, reqMgr=None)"
},
{
"docstring": "Called at startup - introduce random delay to avoid workers all starting at once",
"name": "setup",
"signature": "def setup(self, parameters)"
... | 3 | null | Implement the Python class `WorkQueueManagerReqMgrPoller` described below.
Class description:
Polls for requests
Method signatures and docstrings:
- def __init__(self, queue, config, reqMgr=None): Initialise class members
- def setup(self, parameters): Called at startup - introduce random delay to avoid workers all s... | Implement the Python class `WorkQueueManagerReqMgrPoller` described below.
Class description:
Polls for requests
Method signatures and docstrings:
- def __init__(self, queue, config, reqMgr=None): Initialise class members
- def setup(self, parameters): Called at startup - introduce random delay to avoid workers all s... | de110ccf6fc63ef5589b4e871ef4d51d5bce7a25 | <|skeleton|>
class WorkQueueManagerReqMgrPoller:
"""Polls for requests"""
def __init__(self, queue, config, reqMgr=None):
"""Initialise class members"""
<|body_0|>
def setup(self, parameters):
"""Called at startup - introduce random delay to avoid workers all starting at once"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkQueueManagerReqMgrPoller:
"""Polls for requests"""
def __init__(self, queue, config, reqMgr=None):
"""Initialise class members"""
BaseWorkerThread.__init__(self)
self.wq = queue
self.config = config
if reqMgr:
self.reqMgr = reqMgr
else:
... | the_stack_v2_python_sparse | src/python/WMComponent/WorkQueueManager/WorkQueueManagerReqMgrPoller.py | vkuznet/WMCore | train | 0 |
62faaccf74199d4800fa9dd50b65ab42be2e855f | [
"self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32)\nself.event_size = tf.convert_to_tensor(event_size, tf.int32)\nself.data = [tf.cast(c, float_type) if c.dtype is not float_type else c for c in data]\nself.index_feed = index_feed\nself.slice_size = self.index_feed.step\nwith tf.control_d... | <|body_start_0|>
self.num_parallel_calls = tf.convert_to_tensor(num_parallel_calls, tf.int32)
self.event_size = tf.convert_to_tensor(event_size, tf.int32)
self.data = [tf.cast(c, float_type) if c.dtype is not float_type else c for c in data]
self.index_feed = index_feed
self.slic... | DataFeed | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataFeed:
def __init__(self, index_feed: IndexFeed, *data, event_size=1, num_parallel_calls=10):
"""Create a time feed :param index_feed: IndexFeed Pulse of this feed :param data: list of float_type, Tensor, [Nt, ..., D] Data to grab unflattened :param num_parallel_calls:"""
<|bo... | stack_v2_sparse_classes_10k_train_003558 | 18,860 | permissive | [
{
"docstring": "Create a time feed :param index_feed: IndexFeed Pulse of this feed :param data: list of float_type, Tensor, [Nt, ..., D] Data to grab unflattened :param num_parallel_calls:",
"name": "__init__",
"signature": "def __init__(self, index_feed: IndexFeed, *data, event_size=1, num_parallel_cal... | 2 | stack_v2_sparse_classes_30k_train_004361 | Implement the Python class `DataFeed` described below.
Class description:
Implement the DataFeed class.
Method signatures and docstrings:
- def __init__(self, index_feed: IndexFeed, *data, event_size=1, num_parallel_calls=10): Create a time feed :param index_feed: IndexFeed Pulse of this feed :param data: list of flo... | Implement the Python class `DataFeed` described below.
Class description:
Implement the DataFeed class.
Method signatures and docstrings:
- def __init__(self, index_feed: IndexFeed, *data, event_size=1, num_parallel_calls=10): Create a time feed :param index_feed: IndexFeed Pulse of this feed :param data: list of flo... | 2997d60d8cf07f875e42c0b5f07944e9ab7e9d33 | <|skeleton|>
class DataFeed:
def __init__(self, index_feed: IndexFeed, *data, event_size=1, num_parallel_calls=10):
"""Create a time feed :param index_feed: IndexFeed Pulse of this feed :param data: list of float_type, Tensor, [Nt, ..., D] Data to grab unflattened :param num_parallel_calls:"""
<|bo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataFeed:
def __init__(self, index_feed: IndexFeed, *data, event_size=1, num_parallel_calls=10):
"""Create a time feed :param index_feed: IndexFeed Pulse of this feed :param data: list of float_type, Tensor, [Nt, ..., D] Data to grab unflattened :param num_parallel_calls:"""
self.num_parallel_... | the_stack_v2_python_sparse | bayes_filter/feeds.py | Joshuaalbert/bayes_filter | train | 0 | |
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace | [
"super(TriggerVelocity, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._target_velocity = target_velocity",
"new_status = py_trees.common.Status.RUNNING\ndelta_velocity = self._target_velocity - CarlaDataProvider.get_velocity(self._actor)\nif delta_ve... | <|body_start_0|>
super(TriggerVelocity, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._actor = actor
self._target_velocity = target_velocity
<|end_body_0|>
<|body_start_1|>
new_status = py_trees.common.Status.RUNNING
delta_velocit... | This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The condition terminates with SUCCESS, when the ac... | TriggerVelocity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerVelocity:
"""This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The con... | stack_v2_sparse_classes_10k_train_003559 | 18,494 | permissive | [
{
"docstring": "Setup trigger velocity",
"name": "__init__",
"signature": "def __init__(self, actor, target_velocity, name='TriggerVelocity')"
},
{
"docstring": "Check if the actor has the trigger velocity",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003553 | Implement the Python class `TriggerVelocity` described below.
Class description:
This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as... | Implement the Python class `TriggerVelocity` described below.
Class description:
This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as... | 8ab0894b92e1f994802a218002021ee075c405bf | <|skeleton|>
class TriggerVelocity:
"""This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The con... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TriggerVelocity:
"""This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The condition termin... | the_stack_v2_python_sparse | carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py | TinaMenke/Deep-Reinforcement-Learning | train | 9 |
db27e91a31aa202373aea10ca485ebbcc510c6f2 | [
"for value in my_results:\n try:\n with patch('builtins.input', return_value=str(value)):\n game = SubtractSquareGame(True)\n ite_result = minimax_iterative_strategy(game)\n rec_result = minimax_recursive_strategy(game)\n self.assertEqual(ite_result, rec_result)\n except... | <|body_start_0|>
for value in my_results:
try:
with patch('builtins.input', return_value=str(value)):
game = SubtractSquareGame(True)
ite_result = minimax_iterative_strategy(game)
rec_result = minimax_recursive_strategy(game)
... | MinimaxUnitTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MinimaxUnitTests:
def test_result_consistency(self):
"""Too lazy to write one."""
<|body_0|>
def test_iterative_subtract_square(self):
"""Too lazy to write one."""
<|body_1|>
def test_recursive_subtract_square(self):
"""Too lazy to write one."""
... | stack_v2_sparse_classes_10k_train_003560 | 6,359 | no_license | [
{
"docstring": "Too lazy to write one.",
"name": "test_result_consistency",
"signature": "def test_result_consistency(self)"
},
{
"docstring": "Too lazy to write one.",
"name": "test_iterative_subtract_square",
"signature": "def test_iterative_subtract_square(self)"
},
{
"docstri... | 5 | stack_v2_sparse_classes_30k_train_001944 | Implement the Python class `MinimaxUnitTests` described below.
Class description:
Implement the MinimaxUnitTests class.
Method signatures and docstrings:
- def test_result_consistency(self): Too lazy to write one.
- def test_iterative_subtract_square(self): Too lazy to write one.
- def test_recursive_subtract_square(... | Implement the Python class `MinimaxUnitTests` described below.
Class description:
Implement the MinimaxUnitTests class.
Method signatures and docstrings:
- def test_result_consistency(self): Too lazy to write one.
- def test_iterative_subtract_square(self): Too lazy to write one.
- def test_recursive_subtract_square(... | e57707b91f5c67a5a9621019134eba99e4daf001 | <|skeleton|>
class MinimaxUnitTests:
def test_result_consistency(self):
"""Too lazy to write one."""
<|body_0|>
def test_iterative_subtract_square(self):
"""Too lazy to write one."""
<|body_1|>
def test_recursive_subtract_square(self):
"""Too lazy to write one."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MinimaxUnitTests:
def test_result_consistency(self):
"""Too lazy to write one."""
for value in my_results:
try:
with patch('builtins.input', return_value=str(value)):
game = SubtractSquareGame(True)
ite_result = minimax_iterative_... | the_stack_v2_python_sparse | assignment/a2/Penguin Test/minimax_penguin_tests_enhanced(not failing).py | TianyuDu/csc148 | train | 1 | |
224d80417435793a02477f3a21fa2e07224bd4c7 | [
"Readable.__init__(self)\nself.buffer = data_buffer\nself.ptr = 0",
"data_buffer = self.buffer[self.ptr:][:length]\nself.ptr += length\nreturn data_buffer"
] | <|body_start_0|>
Readable.__init__(self)
self.buffer = data_buffer
self.ptr = 0
<|end_body_0|>
<|body_start_1|>
data_buffer = self.buffer[self.ptr:][:length]
self.ptr += length
return data_buffer
<|end_body_1|>
| DataBuffer class that exposes methods to read data from a byte buffer. | DataBuffer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataBuffer:
"""DataBuffer class that exposes methods to read data from a byte buffer."""
def __init__(self, data_buffer):
"""Constructs a new instance based on the specified byte buffer. Args: data_buffer: Buffer to be read."""
<|body_0|>
def read_data(self, length):
... | stack_v2_sparse_classes_10k_train_003561 | 24,811 | permissive | [
{
"docstring": "Constructs a new instance based on the specified byte buffer. Args: data_buffer: Buffer to be read.",
"name": "__init__",
"signature": "def __init__(self, data_buffer)"
},
{
"docstring": "Reads the specified number of bytes and returns them as a buffer.",
"name": "read_data",... | 2 | null | Implement the Python class `DataBuffer` described below.
Class description:
DataBuffer class that exposes methods to read data from a byte buffer.
Method signatures and docstrings:
- def __init__(self, data_buffer): Constructs a new instance based on the specified byte buffer. Args: data_buffer: Buffer to be read.
- ... | Implement the Python class `DataBuffer` described below.
Class description:
DataBuffer class that exposes methods to read data from a byte buffer.
Method signatures and docstrings:
- def __init__(self, data_buffer): Constructs a new instance based on the specified byte buffer. Args: data_buffer: Buffer to be read.
- ... | 7cbba04a2ee16d21309eefad5be6585183a2d5a9 | <|skeleton|>
class DataBuffer:
"""DataBuffer class that exposes methods to read data from a byte buffer."""
def __init__(self, data_buffer):
"""Constructs a new instance based on the specified byte buffer. Args: data_buffer: Buffer to be read."""
<|body_0|>
def read_data(self, length):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataBuffer:
"""DataBuffer class that exposes methods to read data from a byte buffer."""
def __init__(self, data_buffer):
"""Constructs a new instance based on the specified byte buffer. Args: data_buffer: Buffer to be read."""
Readable.__init__(self)
self.buffer = data_buffer
... | the_stack_v2_python_sparse | tensorflow/contrib/ignite/python/ops/ignite_dataset_ops.py | NVIDIA/tensorflow | train | 763 |
a2f72edc82606e21cf58be2fa1e349e4938d1a49 | [
"self.start_number = start_number\nself.rename_pairs = []\nself.zfillsize = None\nself.process_rename()",
"files = os.listdir('.')\nsorted(files)\ntotal_files = len(files)\nself.zfillsize = len(str(total_files))\nfileseq = self.start_number\nfor i, filename in enumerate(files):\n new_filename = str(fileseq).zf... | <|body_start_0|>
self.start_number = start_number
self.rename_pairs = []
self.zfillsize = None
self.process_rename()
<|end_body_0|>
<|body_start_1|>
files = os.listdir('.')
sorted(files)
total_files = len(files)
self.zfillsize = len(str(total_files))
... | This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder. | Renamer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Renamer:
"""This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder."""
def __init__(self, start_number):
"""start_number determines the first prefix ... | stack_v2_sparse_classes_10k_train_003562 | 2,741 | no_license | [
{
"docstring": "start_number determines the first prefix number for renames The numbering goes along the alphanumeric ordering given by sorted(files)",
"name": "__init__",
"signature": "def __init__(self, start_number)"
},
{
"docstring": "Prepare renames",
"name": "prep_rename",
"signatu... | 5 | stack_v2_sparse_classes_30k_train_004326 | Implement the Python class `Renamer` described below.
Class description:
This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `Renamer` described below.
Class description:
This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.
Method signatures and docstrings:
- def __init__(self,... | b4c5642c8d5843846d529630f8d93a7103676539 | <|skeleton|>
class Renamer:
"""This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder."""
def __init__(self, start_number):
"""start_number determines the first prefix ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Renamer:
"""This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder."""
def __init__(self, start_number):
"""start_number determines the first prefix number for re... | the_stack_v2_python_sparse | renameNumberPrefix.py | alclass/bin | train | 0 |
451889ab5189e52f7d163597e870b8db93d815ff | [
"try:\n logger.info('Creating project: %s', project_name)\n response = lookoutvision_client.create_project(ProjectName=project_name)\n project_arn = response['ProjectMetadata']['ProjectArn']\n logger.info('project ARN: %s', project_arn)\nexcept ClientError:\n logger.exception(\"Couldn't create projec... | <|body_start_0|>
try:
logger.info('Creating project: %s', project_name)
response = lookoutvision_client.create_project(ProjectName=project_name)
project_arn = response['ProjectMetadata']['ProjectArn']
logger.info('project ARN: %s', project_arn)
except Clie... | Provides example functions for creating, listing, and deleting Lookout for Vision projects | Projects | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Projects:
"""Provides example functions for creating, listing, and deleting Lookout for Vision projects"""
def create_project(lookoutvision_client, project_name):
"""Creates a new Lookout for Vision project. :param lookoutvision_client: A Boto3 Lookout for Vision client. :param proje... | stack_v2_sparse_classes_10k_train_003563 | 4,466 | permissive | [
{
"docstring": "Creates a new Lookout for Vision project. :param lookoutvision_client: A Boto3 Lookout for Vision client. :param project_name: The name for the new project. :return project_arn: The ARN of the new project.",
"name": "create_project",
"signature": "def create_project(lookoutvision_client,... | 3 | null | Implement the Python class `Projects` described below.
Class description:
Provides example functions for creating, listing, and deleting Lookout for Vision projects
Method signatures and docstrings:
- def create_project(lookoutvision_client, project_name): Creates a new Lookout for Vision project. :param lookoutvisio... | Implement the Python class `Projects` described below.
Class description:
Provides example functions for creating, listing, and deleting Lookout for Vision projects
Method signatures and docstrings:
- def create_project(lookoutvision_client, project_name): Creates a new Lookout for Vision project. :param lookoutvisio... | dec41fb589043ac9d8667aac36fb88a53c3abe50 | <|skeleton|>
class Projects:
"""Provides example functions for creating, listing, and deleting Lookout for Vision projects"""
def create_project(lookoutvision_client, project_name):
"""Creates a new Lookout for Vision project. :param lookoutvision_client: A Boto3 Lookout for Vision client. :param proje... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Projects:
"""Provides example functions for creating, listing, and deleting Lookout for Vision projects"""
def create_project(lookoutvision_client, project_name):
"""Creates a new Lookout for Vision project. :param lookoutvision_client: A Boto3 Lookout for Vision client. :param project_name: The ... | the_stack_v2_python_sparse | python/example_code/lookoutvision/projects.py | awsdocs/aws-doc-sdk-examples | train | 8,240 |
3873f1d51d531597781ee96be4bd04838f03b659 | [
"self.tragaperras = [['╔══', '═══', '══╗'], ['║ ', 'T_P', ' ║'], ['╚══', '═══', '══╝']]\nself.baccarat = [['╔══', '═══', '═══', '══╗'], ['║ B', 'ACC', 'ARA', 'T ║'], ['╚══', '═══', '═══', '══╝']]\nself.dados = [['╔══', '═══', '══╗'], ['║ ', 'DA2', ' ║'], ['╚══', '═══', '══╝']]\nself.ruleta = [['╔══', '═══', '══... | <|body_start_0|>
self.tragaperras = [['╔══', '═══', '══╗'], ['║ ', 'T_P', ' ║'], ['╚══', '═══', '══╝']]
self.baccarat = [['╔══', '═══', '═══', '══╗'], ['║ B', 'ACC', 'ARA', 'T ║'], ['╚══', '═══', '═══', '══╝']]
self.dados = [['╔══', '═══', '══╗'], ['║ ', 'DA2', ' ║'], ['╚══', '═══', '══╝']]
... | O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O CONSTRUCTOR | objetos | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class objetos:
"""O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O CONSTRUCTOR"""
def __init__(self):
"""En el constructor de este objeto tenemos la lista de listas que pr... | stack_v2_sparse_classes_10k_train_003564 | 35,890 | no_license | [
{
"docstring": "En el constructor de este objeto tenemos la lista de listas que printeara cada maquina en el -mapa- Tambien tenemos",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Este metodo se utiliza para exportar las listas de las maquinas que crea el constructor ,... | 2 | stack_v2_sparse_classes_30k_train_000352 | Implement the Python class `objetos` described below.
Class description:
O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O CONSTRUCTOR
Method signatures and docstrings:
- def __init__(self): En el con... | Implement the Python class `objetos` described below.
Class description:
O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O CONSTRUCTOR
Method signatures and docstrings:
- def __init__(self): En el con... | e7649910ea6d71c7f62b659d4ca535e14ea1e554 | <|skeleton|>
class objetos:
"""O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O CONSTRUCTOR"""
def __init__(self):
"""En el constructor de este objeto tenemos la lista de listas que pr... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class objetos:
"""O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O CONSTRUCTOR"""
def __init__(self):
"""En el constructor de este objeto tenemos la lista de listas que printeara cada ... | the_stack_v2_python_sparse | Juanca/Tycoon/clases_tycoon.py | Casino-Pythoniani/Casino | train | 0 |
e3a34467ea47abc57c0fa2f476134433d895f2be | [
"empty = 2147483647\nsteps = ((0, 1), (0, -1), (1, 0), (-1, 0))\ngate = [(ri, ci) for ri, r in enumerate(rooms) for ci, c in enumerate(r) if c == 0]\nfor ri, ci in gate:\n for sr, sc in steps:\n if 0 <= ri + sr < len(rooms) and 0 <= ci + sc < len(rooms[0]) and (rooms[ri + sr][ci + sc] == empty):\n ... | <|body_start_0|>
empty = 2147483647
steps = ((0, 1), (0, -1), (1, 0), (-1, 0))
gate = [(ri, ci) for ri, r in enumerate(rooms) for ci, c in enumerate(r) if c == 0]
for ri, ci in gate:
for sr, sc in steps:
if 0 <= ri + sr < len(rooms) and 0 <= ci + sc < len(room... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wallsAndGates(self, rooms):
""":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead."""
<|body_0|>
def rewrite(self, rooms):
""":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-... | stack_v2_sparse_classes_10k_train_003565 | 3,414 | no_license | [
{
"docstring": ":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead.",
"name": "wallsAndGates",
"signature": "def wallsAndGates(self, rooms)"
},
{
"docstring": ":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place ins... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wallsAndGates(self, rooms): :type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead.
- def rewrite(self, rooms): :type rooms: List[Lis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wallsAndGates(self, rooms): :type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead.
- def rewrite(self, rooms): :type rooms: List[Lis... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def wallsAndGates(self, rooms):
""":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead."""
<|body_0|>
def rewrite(self, rooms):
""":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def wallsAndGates(self, rooms):
""":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead."""
empty = 2147483647
steps = ((0, 1), (0, -1), (1, 0), (-1, 0))
gate = [(ri, ci) for ri, r in enumerate(rooms) for ci, c in enumerate(r... | the_stack_v2_python_sparse | co_google/286_Walls_and_Gates.py | vsdrun/lc_public | train | 6 | |
c2ce97ab822b5f9eb23902211ca40ce393b28ea9 | [
"if 'tipo_pregunta_modal' in self.request.POST and 'texto_pregunta_modal' in self.request.POST:\n post_data = dict(self.request.POST.lists())\n if (len(post_data['tipo_pregunta_modal']) > 0 and len(post_data['texto_pregunta_modal']) > 0) and len(post_data['texto_pregunta_modal']) == len(post_data['tipo_pregun... | <|body_start_0|>
if 'tipo_pregunta_modal' in self.request.POST and 'texto_pregunta_modal' in self.request.POST:
post_data = dict(self.request.POST.lists())
if (len(post_data['tipo_pregunta_modal']) > 0 and len(post_data['texto_pregunta_modal']) > 0) and len(post_data['texto_pregunta_moda... | ! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0 | ConsultaCreate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConsultaCreate:
"""! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0"""
def get_context_data(self, **kwargs):... | stack_v2_sparse_classes_10k_train_003566 | 22,004 | no_license | [
{
"docstring": "! Metodo que permite cargar de nuevo valores en los datos de contexto de la vista @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright GNU/GPLv2 @date 16-02-2017 @param self <b>{object}</b> Objeto que instancia la clase @param kwargs <b>{object}</b> Objeto que contiene los datos de context... | 3 | stack_v2_sparse_classes_30k_train_002405 | Implement the Python class `ConsultaCreate` described below.
Class description:
! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0
Metho... | Implement the Python class `ConsultaCreate` described below.
Class description:
! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0
Metho... | 93cefc3c94c62e66b103510a2f668a419e5c5cae | <|skeleton|>
class ConsultaCreate:
"""! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0"""
def get_context_data(self, **kwargs):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConsultaCreate:
"""! Clase que gestiona la creación de consultas @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 15-02-2017 @version 1.0.0"""
def get_context_data(self, **kwargs):
"""!... | the_stack_v2_python_sparse | consulta/views.py | rudmanmrrod/gestor_consulta | train | 1 |
6ea6bdc86b1e9966be1f165390fa1bc94fbecf96 | [
"length = 0\nwhile root:\n length += 1\n root = root.next\nreturn length",
"if not root:\n return (None, None)\ncur = root\nnew_root = None\nwhile cur:\n if length == 1:\n new_root = cur.next\n cur.next = None\n break\n else:\n cur = cur.next\n length -= 1\nreturn (ro... | <|body_start_0|>
length = 0
while root:
length += 1
root = root.next
return length
<|end_body_0|>
<|body_start_1|>
if not root:
return (None, None)
cur = root
new_root = None
while cur:
if length == 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def get_length_of_linked_list(self, root):
""":type root: ListNode :rtype: int"""
<|body_0|>
def get_linked_list(self, root, length):
""":type root: ListNode :type length: int"""
<|body_1|>
def splitListToParts(self, root, k):
""":type ... | stack_v2_sparse_classes_10k_train_003567 | 1,527 | no_license | [
{
"docstring": ":type root: ListNode :rtype: int",
"name": "get_length_of_linked_list",
"signature": "def get_length_of_linked_list(self, root)"
},
{
"docstring": ":type root: ListNode :type length: int",
"name": "get_linked_list",
"signature": "def get_linked_list(self, root, length)"
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_length_of_linked_list(self, root): :type root: ListNode :rtype: int
- def get_linked_list(self, root, length): :type root: ListNode :type length: int
- def splitListToPar... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_length_of_linked_list(self, root): :type root: ListNode :rtype: int
- def get_linked_list(self, root, length): :type root: ListNode :type length: int
- def splitListToPar... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def get_length_of_linked_list(self, root):
""":type root: ListNode :rtype: int"""
<|body_0|>
def get_linked_list(self, root, length):
""":type root: ListNode :type length: int"""
<|body_1|>
def splitListToParts(self, root, k):
""":type ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def get_length_of_linked_list(self, root):
""":type root: ListNode :rtype: int"""
length = 0
while root:
length += 1
root = root.next
return length
def get_linked_list(self, root, length):
""":type root: ListNode :type length: int"... | the_stack_v2_python_sparse | python/leetcode/725_Split_Linked_List_in_Parts.py | bobcaoge/my-code | train | 0 | |
6ced3c0472633753126be4992303a1f4c315f026 | [
"self.directory = None\nself.testloader = None\nself.attack = None\nself.objective = None\nself.attempts = None\nself.snapshot = None\nself.get_writer = None",
"assert self.directory is not None\nassert len(self.directory) > 0\nassert isinstance(self.testloader, torch.utils.data.DataLoader)\nassert len(self.testl... | <|body_start_0|>
self.directory = None
self.testloader = None
self.attack = None
self.objective = None
self.attempts = None
self.snapshot = None
self.get_writer = None
<|end_body_0|>
<|body_start_1|>
assert self.directory is not None
assert len(se... | Configuration for attacks. | AttackConfig | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttackConfig:
"""Configuration for attacks."""
def __init__(self):
"""Constructor."""
<|body_0|>
def validate(self):
"""Check validity."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.directory = None
self.testloader = None
... | stack_v2_sparse_classes_10k_train_003568 | 16,771 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Check validity.",
"name": "validate",
"signature": "def validate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003643 | Implement the Python class `AttackConfig` described below.
Class description:
Configuration for attacks.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def validate(self): Check validity. | Implement the Python class `AttackConfig` described below.
Class description:
Configuration for attacks.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def validate(self): Check validity.
<|skeleton|>
class AttackConfig:
"""Configuration for attacks."""
def __init__(self):
""... | 736c99b55a77d0c650eae5ced2d8312d13af0baf | <|skeleton|>
class AttackConfig:
"""Configuration for attacks."""
def __init__(self):
"""Constructor."""
<|body_0|>
def validate(self):
"""Check validity."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AttackConfig:
"""Configuration for attacks."""
def __init__(self):
"""Constructor."""
self.directory = None
self.testloader = None
self.attack = None
self.objective = None
self.attempts = None
self.snapshot = None
self.get_writer = None
... | the_stack_v2_python_sparse | common/experiments.py | Adversarial-Intelligence-Group/color-adversarial-training | train | 0 |
0f4ac60b88e0dfd443815bd7af56e1676d0654dd | [
"self.i = 0\nself.start = None\nself.first = None",
"if self.i == 0:\n return\nself.log()\ndt = datetime.now() - self.first\nm = '\\ntotal: {0:,} in {1:,d} seconds'.format(self.i, int(dt.total_seconds()))\nprint(m, file=sys.stderr)",
"if self.i == 0:\n return\ndt = datetime.now() - self.start\nself.start ... | <|body_start_0|>
self.i = 0
self.start = None
self.first = None
<|end_body_0|>
<|body_start_1|>
if self.i == 0:
return
self.log()
dt = datetime.now() - self.first
m = '\ntotal: {0:,} in {1:,d} seconds'.format(self.i, int(dt.total_seconds()))
p... | Writes progress to stderr. | Rate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rate:
"""Writes progress to stderr."""
def __init__(self):
"""Initialize class vars."""
<|body_0|>
def close(self):
"""Write final stats."""
<|body_1|>
def log(self):
"""Write stats."""
<|body_2|>
def tick(self):
"""Incre... | stack_v2_sparse_classes_10k_train_003569 | 4,385 | permissive | [
{
"docstring": "Initialize class vars.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Write final stats.",
"name": "close",
"signature": "def close(self)"
},
{
"docstring": "Write stats.",
"name": "log",
"signature": "def log(self)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_001696 | Implement the Python class `Rate` described below.
Class description:
Writes progress to stderr.
Method signatures and docstrings:
- def __init__(self): Initialize class vars.
- def close(self): Write final stats.
- def log(self): Write stats.
- def tick(self): Increment stats. | Implement the Python class `Rate` described below.
Class description:
Writes progress to stderr.
Method signatures and docstrings:
- def __init__(self): Initialize class vars.
- def close(self): Write final stats.
- def log(self): Write stats.
- def tick(self): Increment stats.
<|skeleton|>
class Rate:
"""Writes... | 9114f75cc8c8085111152ce0ef686a8a12f67f8e | <|skeleton|>
class Rate:
"""Writes progress to stderr."""
def __init__(self):
"""Initialize class vars."""
<|body_0|>
def close(self):
"""Write final stats."""
<|body_1|>
def log(self):
"""Write stats."""
<|body_2|>
def tick(self):
"""Incre... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Rate:
"""Writes progress to stderr."""
def __init__(self):
"""Initialize class vars."""
self.i = 0
self.start = None
self.first = None
def close(self):
"""Write final stats."""
if self.i == 0:
return
self.log()
dt = datetime... | the_stack_v2_python_sparse | gen3_etl/utils/ioutils.py | ohsu-comp-bio/gen3_etl | train | 1 |
0ed711127c75018f363df7b2454d65ba3204fb65 | [
"shader = Shader.load(Shader.SL_GLSL, fragment=frag, vertex=vert)\nShaderRegistry.shaders[identifier] = shader\nprint(f'Registered shader {identifier}')",
"if identifier not in ShaderRegistry.shaders:\n raise NotInRegistryError(identifier)\nreturn ShaderRegistry.shaders.get(identifier)"
] | <|body_start_0|>
shader = Shader.load(Shader.SL_GLSL, fragment=frag, vertex=vert)
ShaderRegistry.shaders[identifier] = shader
print(f'Registered shader {identifier}')
<|end_body_0|>
<|body_start_1|>
if identifier not in ShaderRegistry.shaders:
raise NotInRegistryError(identi... | ShaderRegistry | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShaderRegistry:
def register(identifier: str, frag: str, vert: str):
"""Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects... | stack_v2_sparse_classes_10k_train_003570 | 2,157 | permissive | [
{
"docstring": "Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects are prefixed with 'ce:' Make-A-Toon shaders are prefixed with 'mat:' etc. :para... | 2 | stack_v2_sparse_classes_30k_train_004057 | Implement the Python class `ShaderRegistry` described below.
Class description:
Implement the ShaderRegistry class.
Method signatures and docstrings:
- def register(identifier: str, frag: str, vert: str): Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be for... | Implement the Python class `ShaderRegistry` described below.
Class description:
Implement the ShaderRegistry class.
Method signatures and docstrings:
- def register(identifier: str, frag: str, vert: str): Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be for... | 7847717dda5e2f75f0028c5554bf3f78e5fd8860 | <|skeleton|>
class ShaderRegistry:
def register(identifier: str, frag: str, vert: str):
"""Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ShaderRegistry:
def register(identifier: str, frag: str, vert: str):
"""Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects are prefixed ... | the_stack_v2_python_sparse | ott/ShaderRegistry.py | ttoff/OpenLevelEditor | train | 0 | |
076926b67d83c0fe0984dcb00c3bf0a0a66c9375 | [
"loading_plans = [self.input_seg_loading_plan_path, self.prob_loading_plan_path] + list(self.additional_loading_plan_paths)\nfor loading_plan in loading_plans:\n for tgt in DestVolumeReader(loading_plan).get_source_targets():\n yield tgt",
"v1 = np.prod([2048, 2048, 100])\nm1 = (3685308 + 152132) * 1000... | <|body_start_0|>
loading_plans = [self.input_seg_loading_plan_path, self.prob_loading_plan_path] + list(self.additional_loading_plan_paths)
for loading_plan in loading_plans:
for tgt in DestVolumeReader(loading_plan).get_source_targets():
yield tgt
<|end_body_0|>
<|body_star... | NeuroproofStitchTaskMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeuroproofStitchTaskMixin:
def input(self):
"""Yield the probability volume target and segmentation volume target"""
<|body_0|>
def estimate_memory_usage(self):
"""Return an estimate of bytes of memory required by this task"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_10k_train_003571 | 16,148 | no_license | [
{
"docstring": "Yield the probability volume target and segmentation volume target",
"name": "input",
"signature": "def input(self)"
},
{
"docstring": "Return an estimate of bytes of memory required by this task",
"name": "estimate_memory_usage",
"signature": "def estimate_memory_usage(s... | 2 | stack_v2_sparse_classes_30k_train_001736 | Implement the Python class `NeuroproofStitchTaskMixin` described below.
Class description:
Implement the NeuroproofStitchTaskMixin class.
Method signatures and docstrings:
- def input(self): Yield the probability volume target and segmentation volume target
- def estimate_memory_usage(self): Return an estimate of byt... | Implement the Python class `NeuroproofStitchTaskMixin` described below.
Class description:
Implement the NeuroproofStitchTaskMixin class.
Method signatures and docstrings:
- def input(self): Yield the probability volume target and segmentation volume target
- def estimate_memory_usage(self): Return an estimate of byt... | cf100202997d3c848a21de441e15deb9f975042d | <|skeleton|>
class NeuroproofStitchTaskMixin:
def input(self):
"""Yield the probability volume target and segmentation volume target"""
<|body_0|>
def estimate_memory_usage(self):
"""Return an estimate of bytes of memory required by this task"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NeuroproofStitchTaskMixin:
def input(self):
"""Yield the probability volume target and segmentation volume target"""
loading_plans = [self.input_seg_loading_plan_path, self.prob_loading_plan_path] + list(self.additional_loading_plan_paths)
for loading_plan in loading_plans:
... | the_stack_v2_python_sparse | ariadne_microns_pipeline/tasks/neuroproof_stitch.py | microns-ariadne/pipeline_engine | train | 2 | |
5f157086b85fdb60032052f9e228609e8335e690 | [
"if a > b:\n return self.getOrderSum(b, a)\nelse:\n return self.getOrderSum(a, b)",
"bs = bin(short)[2:][::-1]\nbl = bin(long)[2:][::-1]\nlshort = len(bs)\nllong = len(bl)\ncarry = 0\nrevStr = ''\nfor i in range(lshort):\n s = int(bs[i]) ^ int(bl[i]) ^ carry\n revStr += str(s)\n if [int(bs[i]), int... | <|body_start_0|>
if a > b:
return self.getOrderSum(b, a)
else:
return self.getOrderSum(a, b)
<|end_body_0|>
<|body_start_1|>
bs = bin(short)[2:][::-1]
bl = bin(long)[2:][::-1]
lshort = len(bs)
llong = len(bl)
carry = 0
revStr = ''
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getSum(self, a, b):
""":type a: int :type b: int :rtype: int"""
<|body_0|>
def getOrderSum(self, short, long):
""":type short: int :type long : int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if a > b:
retur... | stack_v2_sparse_classes_10k_train_003572 | 1,711 | no_license | [
{
"docstring": ":type a: int :type b: int :rtype: int",
"name": "getSum",
"signature": "def getSum(self, a, b)"
},
{
"docstring": ":type short: int :type long : int :rtype: int",
"name": "getOrderSum",
"signature": "def getOrderSum(self, short, long)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006491 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSum(self, a, b): :type a: int :type b: int :rtype: int
- def getOrderSum(self, short, long): :type short: int :type long : int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSum(self, a, b): :type a: int :type b: int :rtype: int
- def getOrderSum(self, short, long): :type short: int :type long : int :rtype: int
<|skeleton|>
class Solution:
... | f8b35179b980e55f61bbcd2631fa3a9bf30c40ec | <|skeleton|>
class Solution:
def getSum(self, a, b):
""":type a: int :type b: int :rtype: int"""
<|body_0|>
def getOrderSum(self, short, long):
""":type short: int :type long : int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def getSum(self, a, b):
""":type a: int :type b: int :rtype: int"""
if a > b:
return self.getOrderSum(b, a)
else:
return self.getOrderSum(a, b)
def getOrderSum(self, short, long):
""":type short: int :type long : int :rtype: int"""
... | the_stack_v2_python_sparse | Python Solutions/371 Sum of Two Integers.py | Sue9/Leetcode | train | 0 | |
f4d8b32220926433d2d1a23a2e1371ff284c648b | [
"super(SwinTransformerV2, self).__init__()\nself.patch_size: int = patch_size\nself.patch_embedding: nn.Module = PatchEmbedding(in_channels=in_channels, out_channels=embedding_channels, patch_size=patch_size)\npatch_resolution: Tuple[int, int] = (input_resolution[0] // patch_size, input_resolution[1] // patch_size)... | <|body_start_0|>
super(SwinTransformerV2, self).__init__()
self.patch_size: int = patch_size
self.patch_embedding: nn.Module = PatchEmbedding(in_channels=in_channels, out_channels=embedding_channels, patch_size=patch_size)
patch_resolution: Tuple[int, int] = (input_resolution[0] // patch... | This class implements the Swin Transformer without classification head. | SwinTransformerV2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwinTransformerV2:
"""This class implements the Swin Transformer without classification head."""
def __init__(self, in_channels: int, embedding_channels: int, depths: Tuple[int, ...], input_resolution: Tuple[int, int], number_of_heads: Tuple[int, ...], window_size: int=7, patch_size: int=4, ... | stack_v2_sparse_classes_10k_train_003573 | 41,159 | no_license | [
{
"docstring": "Constructor method :param in_channels: (int) Number of input channels :param depth: (int) Depth of the stage (number of layers) :param downscale: (bool) If true input is downsampled (see Fig. 3 or V1 paper) :param input_resolution: (Tuple[int, int]) Input resolution :param number_of_heads: (int)... | 3 | stack_v2_sparse_classes_30k_train_003300 | Implement the Python class `SwinTransformerV2` described below.
Class description:
This class implements the Swin Transformer without classification head.
Method signatures and docstrings:
- def __init__(self, in_channels: int, embedding_channels: int, depths: Tuple[int, ...], input_resolution: Tuple[int, int], numbe... | Implement the Python class `SwinTransformerV2` described below.
Class description:
This class implements the Swin Transformer without classification head.
Method signatures and docstrings:
- def __init__(self, in_channels: int, embedding_channels: int, depths: Tuple[int, ...], input_resolution: Tuple[int, int], numbe... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SwinTransformerV2:
"""This class implements the Swin Transformer without classification head."""
def __init__(self, in_channels: int, embedding_channels: int, depths: Tuple[int, ...], input_resolution: Tuple[int, int], number_of_heads: Tuple[int, ...], window_size: int=7, patch_size: int=4, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SwinTransformerV2:
"""This class implements the Swin Transformer without classification head."""
def __init__(self, in_channels: int, embedding_channels: int, depths: Tuple[int, ...], input_resolution: Tuple[int, int], number_of_heads: Tuple[int, ...], window_size: int=7, patch_size: int=4, ff_feature_ra... | the_stack_v2_python_sparse | generated/test_ChristophReich1996_Swin_Transformer_V2.py | jansel/pytorch-jit-paritybench | train | 35 |
f8c979dc2a86bdba5795c04bcda89b43fb15d39c | [
"if not is_exe(exe_path):\n msg = '{0} is not an executable'.format(exe_path)\n raise NotExecutableError(msg)\nself._exe_path = exe_path",
"assert lreads != rreads\nself.__build_cmd(lreads, rreads, threads, outdir, prefix)\nif dry_run:\n return self._cmd\nif not os.path.exists(self._outdirname):\n os.... | <|body_start_0|>
if not is_exe(exe_path):
msg = '{0} is not an executable'.format(exe_path)
raise NotExecutableError(msg)
self._exe_path = exe_path
<|end_body_0|>
<|body_start_1|>
assert lreads != rreads
self.__build_cmd(lreads, rreads, threads, outdir, prefix)
... | class for working with paired end read assembly tool Flash | Flash | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Flash:
"""class for working with paired end read assembly tool Flash"""
def __init__(self, exe_path):
"""Instantiate with location of executable"""
<|body_0|>
def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False):
"""Run Flash to merge passed read... | stack_v2_sparse_classes_10k_train_003574 | 3,856 | permissive | [
{
"docstring": "Instantiate with location of executable",
"name": "__init__",
"signature": "def __init__(self, exe_path)"
},
{
"docstring": "Run Flash to merge passed read files - lreads - forward reads - rreads - reverse reads - threads - number of threads for flash to use - outdir - output dir... | 3 | stack_v2_sparse_classes_30k_train_000670 | Implement the Python class `Flash` described below.
Class description:
class for working with paired end read assembly tool Flash
Method signatures and docstrings:
- def __init__(self, exe_path): Instantiate with location of executable
- def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): Run Flash... | Implement the Python class `Flash` described below.
Class description:
class for working with paired end read assembly tool Flash
Method signatures and docstrings:
- def __init__(self, exe_path): Instantiate with location of executable
- def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False): Run Flash... | a3c64198aad3709a5c4d969f48ae0af11fdc25db | <|skeleton|>
class Flash:
"""class for working with paired end read assembly tool Flash"""
def __init__(self, exe_path):
"""Instantiate with location of executable"""
<|body_0|>
def run(self, lreads, rreads, threads, outdir, prefix, dry_run=False):
"""Run Flash to merge passed read... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Flash:
"""class for working with paired end read assembly tool Flash"""
def __init__(self, exe_path):
"""Instantiate with location of executable"""
if not is_exe(exe_path):
msg = '{0} is not an executable'.format(exe_path)
raise NotExecutableError(msg)
self... | the_stack_v2_python_sparse | metapy/pycits/flash.py | peterthorpe5/public_scripts | train | 35 |
c6881ac3ba757298c7ee25369af64002ab0af24e | [
"self.position = pos\nself.direction = direction\nself.right = right",
"u_v = []\nif leaf_type < 0:\n if leaf_type < -3:\n leaf_type = -1\n shape = leaf_geom.blossom(abs(leaf_type + 1))\nelse:\n if leaf_type < 1 or leaf_type > 10:\n leaf_type = 8\n shape = leaf_geom.leaves(leaf_type - 1)... | <|body_start_0|>
self.position = pos
self.direction = direction
self.right = right
<|end_body_0|>
<|body_start_1|>
u_v = []
if leaf_type < 0:
if leaf_type < -3:
leaf_type = -1
shape = leaf_geom.blossom(abs(leaf_type + 1))
else:
... | Class to store data for each leaf in the system | Leaf | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Leaf:
"""Class to store data for each leaf in the system"""
def __init__(self, pos, direction, right):
"""Init method for leaf with position, direction and relative x axis"""
<|body_0|>
def get_shape(cls, leaf_type, g_scale, scale, scale_x):
"""returns the base l... | stack_v2_sparse_classes_10k_train_003575 | 3,470 | no_license | [
{
"docstring": "Init method for leaf with position, direction and relative x axis",
"name": "__init__",
"signature": "def __init__(self, pos, direction, right)"
},
{
"docstring": "returns the base leaf shape mesh",
"name": "get_shape",
"signature": "def get_shape(cls, leaf_type, g_scale,... | 4 | stack_v2_sparse_classes_30k_train_001182 | Implement the Python class `Leaf` described below.
Class description:
Class to store data for each leaf in the system
Method signatures and docstrings:
- def __init__(self, pos, direction, right): Init method for leaf with position, direction and relative x axis
- def get_shape(cls, leaf_type, g_scale, scale, scale_x... | Implement the Python class `Leaf` described below.
Class description:
Class to store data for each leaf in the system
Method signatures and docstrings:
- def __init__(self, pos, direction, right): Init method for leaf with position, direction and relative x axis
- def get_shape(cls, leaf_type, g_scale, scale, scale_x... | 7b796d30dfd22b7706a93e4419ed913d18d29a44 | <|skeleton|>
class Leaf:
"""Class to store data for each leaf in the system"""
def __init__(self, pos, direction, right):
"""Init method for leaf with position, direction and relative x axis"""
<|body_0|>
def get_shape(cls, leaf_type, g_scale, scale, scale_x):
"""returns the base l... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Leaf:
"""Class to store data for each leaf in the system"""
def __init__(self, pos, direction, right):
"""Init method for leaf with position, direction and relative x axis"""
self.position = pos
self.direction = direction
self.right = right
def get_shape(cls, leaf_typ... | the_stack_v2_python_sparse | All_In_One/addons/learnbgame/ch_trees/leaf.py | 2434325680/Learnbgame | train | 0 |
46188758fbda68dd02400a4c68ab39701895dd56 | [
"self.client = sclient.Client(wsdl_file)\nif is_ssl:\n trans = HttpAuthUsingCert('', '')\n self.client.set_options(transport=trans)\nif endpoint is not None:\n self.client.options.location = endpoint\nif is_ssl and username:\n passman = urllib2.HTTPPasswordMgrWithDefaultRealm()\n passman.add_password... | <|body_start_0|>
self.client = sclient.Client(wsdl_file)
if is_ssl:
trans = HttpAuthUsingCert('', '')
self.client.set_options(transport=trans)
if endpoint is not None:
self.client.options.location = endpoint
if is_ssl and username:
passman ... | This class repsent wraper for SOAP client | SoapInterface | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoapInterface:
"""This class repsent wraper for SOAP client"""
def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None):
"""Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True... | stack_v2_sparse_classes_10k_train_003576 | 5,178 | no_license | [
{
"docstring": "Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True then initiate ssl connection @username - username for HTTP authentication (if None then no HTTP authentication) @password - password for HTTP authentication",
"nam... | 3 | null | Implement the Python class `SoapInterface` described below.
Class description:
This class repsent wraper for SOAP client
Method signatures and docstrings:
- def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): Constructor method @wsdl_file - URL representing WSDL file (local or gl... | Implement the Python class `SoapInterface` described below.
Class description:
This class repsent wraper for SOAP client
Method signatures and docstrings:
- def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None): Constructor method @wsdl_file - URL representing WSDL file (local or gl... | e6bc6eb747e39dcacf5f3fd0738d82f16ed0f76d | <|skeleton|>
class SoapInterface:
"""This class repsent wraper for SOAP client"""
def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None):
"""Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SoapInterface:
"""This class repsent wraper for SOAP client"""
def __init__(self, wsdl_file, endpoint=None, is_ssl=False, username=None, password=None):
"""Constructor method @wsdl_file - URL representing WSDL file (local or global URL) @endpoint - SOAP endpoint URL @is_ssl - if True then initiat... | the_stack_v2_python_sparse | FablikFramework/FablikClient/bin/soapClient.py | fabregas/old_projects | train | 0 |
66b0d04f9ff8ff6a25a73968d0081278f7593e60 | [
"if not self.initial:\n intent = get_intent(self.request.session.get('token', False), self.kwargs['aiid'], self.kwargs['intent_name'])\n intent['webhook'] = '' if intent['webhook'] is None else intent['webhook']['endpoint']\n intent['responses'] = settings.TOKENFIELD_DELIMITER.join(intent['responses'])\n ... | <|body_start_0|>
if not self.initial:
intent = get_intent(self.request.session.get('token', False), self.kwargs['aiid'], self.kwargs['intent_name'])
intent['webhook'] = '' if intent['webhook'] is None else intent['webhook']['endpoint']
intent['responses'] = settings.TOKENFIEL... | Single Intent view | IntentsUpdateView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntentsUpdateView:
"""Single Intent view"""
def get_initial(self, **kwargs):
"""Get and prepare Intent data"""
<|body_0|>
def get_context_data(self, **kwargs):
"""Provide intent name for the template"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_003577 | 39,842 | permissive | [
{
"docstring": "Get and prepare Intent data",
"name": "get_initial",
"signature": "def get_initial(self, **kwargs)"
},
{
"docstring": "Provide intent name for the template",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003291 | Implement the Python class `IntentsUpdateView` described below.
Class description:
Single Intent view
Method signatures and docstrings:
- def get_initial(self, **kwargs): Get and prepare Intent data
- def get_context_data(self, **kwargs): Provide intent name for the template | Implement the Python class `IntentsUpdateView` described below.
Class description:
Single Intent view
Method signatures and docstrings:
- def get_initial(self, **kwargs): Get and prepare Intent data
- def get_context_data(self, **kwargs): Provide intent name for the template
<|skeleton|>
class IntentsUpdateView:
... | d632d00f9a22a7a826bba4896a7102b2ac8690ff | <|skeleton|>
class IntentsUpdateView:
"""Single Intent view"""
def get_initial(self, **kwargs):
"""Get and prepare Intent data"""
<|body_0|>
def get_context_data(self, **kwargs):
"""Provide intent name for the template"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IntentsUpdateView:
"""Single Intent view"""
def get_initial(self, **kwargs):
"""Get and prepare Intent data"""
if not self.initial:
intent = get_intent(self.request.session.get('token', False), self.kwargs['aiid'], self.kwargs['intent_name'])
intent['webhook'] = ''... | the_stack_v2_python_sparse | src/studio/views.py | hutomadotAI/web-console | train | 6 |
05752f2fc762a53683dc6d7562d98c4f57b2193f | [
"self.pool = nums\nself.size = len(self.pool)\nself.k = k\nheapq.heapify(self.pool)\nwhile self.size > k:\n heapq.heappop(self.pool)\n self.size -= 1",
"if self.size < self.k:\n heapq.heappush(self.pool, val)\n self.size += 1\nelif val > self.pool[0]:\n heapq.heapreplace(self.pool, val)\nreturn sel... | <|body_start_0|>
self.pool = nums
self.size = len(self.pool)
self.k = k
heapq.heapify(self.pool)
while self.size > k:
heapq.heappop(self.pool)
self.size -= 1
<|end_body_0|>
<|body_start_1|>
if self.size < self.k:
heapq.heappush(self.po... | KthLargest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.pool = nums
self.size = len(self.pool)
... | stack_v2_sparse_classes_10k_train_003578 | 949 | permissive | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001702 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 92156e4b48ba19e3f02e4286b9f733e9769a1dee | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.pool = nums
self.size = len(self.pool)
self.k = k
heapq.heapify(self.pool)
while self.size > k:
heapq.heappop(self.pool)
self.size -= 1
def add(se... | the_stack_v2_python_sparse | src/Python/701-800/703.KthLargest.py | AveryHuo/PeefyLeetCode | train | 0 | |
aaf1cc68b214526cdbe98271be6fc697064772a1 | [
"StaticWidget.__init__(self, name, divclass)\nself.datarange = (min, max, step)\nself.width = width\nself.show_range = show_range\nif default is None:\n self.default = min\nelse:\n self.default = default",
"min, max, step = self.datarange\nimport numpy as np\nreturn np.arange(min, max + step, step)",
"sty... | <|body_start_0|>
StaticWidget.__init__(self, name, divclass)
self.datarange = (min, max, step)
self.width = width
self.show_range = show_range
if default is None:
self.default = min
else:
self.default = default
<|end_body_0|>
<|body_start_1|>
... | Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`. | RangeWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangeWidget:
"""Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`."""
def __init__(self, min, max, step=1, name=None, default=None, width=350, divclass=None... | stack_v2_sparse_classes_10k_train_003579 | 9,315 | permissive | [
{
"docstring": "@param min min value @param max max value @param step step @param name name @param default default value @param width width in pixel @param divclass class for div section @param show_range boolean",
"name": "__init__",
"signature": "def __init__(self, min, max, step=1, name=None, default... | 3 | null | Implement the Python class `RangeWidget` described below.
Class description:
Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`.
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `RangeWidget` described below.
Class description:
Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`.
Method signatures and docstrings:
- def __init__(self,... | 860ec5b9a53bae4fc616076c0b52dbe2a1153d30 | <|skeleton|>
class RangeWidget:
"""Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`."""
def __init__(self, min, max, step=1, name=None, default=None, width=350, divclass=None... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RangeWidget:
"""Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`."""
def __init__(self, min, max, step=1, name=None, default=None, width=350, divclass=None, show_range=... | the_stack_v2_python_sparse | src/pyquickhelper/ipythonhelper/widgets.py | Pandinosaurus/pyquickhelper | train | 0 |
5b1951ca4052c764fabe5b2de4fc4aef32f6bd68 | [
"if n == 1:\n return '1'\nif n == 2:\n return '11'\nresult = '11'\nflag = 2\nwhile flag < n:\n result = self.count(result)\n flag += 1\nreturn result",
"index = []\ncount = []\nindex.append(input[0])\ncount.append(1)\nfor i in range(1, len(input)):\n if input[i] == input[i - 1]:\n count[-1] ... | <|body_start_0|>
if n == 1:
return '1'
if n == 2:
return '11'
result = '11'
flag = 2
while flag < n:
result = self.count(result)
flag += 1
return result
<|end_body_0|>
<|body_start_1|>
index = []
count = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countAndSay(self, n: int) -> str:
"""主函数,控制遍历描述函数的次数 :param n: :return:"""
<|body_0|>
def count(self, input):
"""对上一次结果描述的函数 :param input: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 1:
return '1'
... | stack_v2_sparse_classes_10k_train_003580 | 2,116 | no_license | [
{
"docstring": "主函数,控制遍历描述函数的次数 :param n: :return:",
"name": "countAndSay",
"signature": "def countAndSay(self, n: int) -> str"
},
{
"docstring": "对上一次结果描述的函数 :param input: :return:",
"name": "count",
"signature": "def count(self, input)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005215 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countAndSay(self, n: int) -> str: 主函数,控制遍历描述函数的次数 :param n: :return:
- def count(self, input): 对上一次结果描述的函数 :param input: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countAndSay(self, n: int) -> str: 主函数,控制遍历描述函数的次数 :param n: :return:
- def count(self, input): 对上一次结果描述的函数 :param input: :return:
<|skeleton|>
class Solution:
def count... | fa45cd44c3d4e7b0205833efcdc708d1638cbbe4 | <|skeleton|>
class Solution:
def countAndSay(self, n: int) -> str:
"""主函数,控制遍历描述函数的次数 :param n: :return:"""
<|body_0|>
def count(self, input):
"""对上一次结果描述的函数 :param input: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def countAndSay(self, n: int) -> str:
"""主函数,控制遍历描述函数的次数 :param n: :return:"""
if n == 1:
return '1'
if n == 2:
return '11'
result = '11'
flag = 2
while flag < n:
result = self.count(result)
flag += 1
... | the_stack_v2_python_sparse | Python/t38.py | g-lyc/LeetCode | train | 15 | |
09ceeff88db61da4ecf6a84878bedc5302bdf39a | [
"if self.request.version == 'v6':\n return ScanDetailsSerializerV6\nelif self.request.version == 'v7':\n return ScanDetailsSerializerV6",
"if request.version == 'v6':\n return self._get_v6(request, scan_id)\nelif request.version == 'v7':\n return self._get_v6(request, scan_id)\nraise Http404()",
"tr... | <|body_start_0|>
if self.request.version == 'v6':
return ScanDetailsSerializerV6
elif self.request.version == 'v7':
return ScanDetailsSerializerV6
<|end_body_0|>
<|body_start_1|>
if request.version == 'v6':
return self._get_v6(request, scan_id)
elif r... | This view is the endpoint for retrieving/updating details of a Scan process. | ScansDetailsView | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScansDetailsView:
"""This view is the endpoint for retrieving/updating details of a Scan process."""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API."""
<|body_0|>
def get(self, request, scan_id):
... | stack_v2_sparse_classes_10k_train_003581 | 30,689 | permissive | [
{
"docstring": "Returns the appropriate serializer based off the requests version of the REST API.",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "Retrieves the details for a Scan process and return them in JSON form :param request: the HTTP GET... | 5 | null | Implement the Python class `ScansDetailsView` described below.
Class description:
This view is the endpoint for retrieving/updating details of a Scan process.
Method signatures and docstrings:
- def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API.
- def ge... | Implement the Python class `ScansDetailsView` described below.
Class description:
This view is the endpoint for retrieving/updating details of a Scan process.
Method signatures and docstrings:
- def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API.
- def ge... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class ScansDetailsView:
"""This view is the endpoint for retrieving/updating details of a Scan process."""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API."""
<|body_0|>
def get(self, request, scan_id):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ScansDetailsView:
"""This view is the endpoint for retrieving/updating details of a Scan process."""
def get_serializer_class(self):
"""Returns the appropriate serializer based off the requests version of the REST API."""
if self.request.version == 'v6':
return ScanDetailsSeri... | the_stack_v2_python_sparse | scale/ingest/views.py | kfconsultant/scale | train | 0 |
47c349aa5e51069ba06897e9663fea9d4ec3283c | [
"self.G = G\nself.p = p\nself.q = q",
"G = self.G\np = self.p\nq = self.q\nunnormalized_probs = []\nfor x in G.neighbors(v):\n weight = G[v][x].get('weight', 1.0)\n if x == t:\n unnormalized_probs.append(weight / p)\n elif G.has_edge(x, t):\n unnormalized_probs.append(weight)\n else:\n ... | <|body_start_0|>
self.G = G
self.p = p
self.q = q
<|end_body_0|>
<|body_start_1|>
G = self.G
p = self.p
q = self.q
unnormalized_probs = []
for x in G.neighbors(v):
weight = G[v][x].get('weight', 1.0)
if x == t:
unno... | RandomWalker | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWalker:
def __init__(self, G, p=1, q=1):
""":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes"""
<|body_0|>
def g... | stack_v2_sparse_classes_10k_train_003582 | 3,281 | permissive | [
{
"docstring": ":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes",
"name": "__init__",
"signature": "def __init__(self, G, p=1, q=1)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_005109 | Implement the Python class `RandomWalker` described below.
Class description:
Implement the RandomWalker class.
Method signatures and docstrings:
- def __init__(self, G, p=1, q=1): :param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,all... | Implement the Python class `RandomWalker` described below.
Class description:
Implement the RandomWalker class.
Method signatures and docstrings:
- def __init__(self, G, p=1, q=1): :param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,all... | e41caeb32a07da95364f15b85cad527a67763255 | <|skeleton|>
class RandomWalker:
def __init__(self, G, p=1, q=1):
""":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes"""
<|body_0|>
def g... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomWalker:
def __init__(self, G, p=1, q=1):
""":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes"""
self.G = G
self.p = p
... | the_stack_v2_python_sparse | graphgallery/gallery/nodeclas/utils/walker.py | blindSpoter01/GraphGallery | train | 0 | |
5c237e96143fec9cb11546b8f659c29bff903abc | [
"super().__init__(seed, max_outputs=max_outputs)\nself.glove = torchtext.vocab.GloVe(name='6B', dim='100')\nself.nlp = spacy_nlp if spacy_nlp else spacy.load('en_core_web_sm')\nself.max_outputs = max_outputs\nself.n_similar = n_similar",
"outputs = []\ncandidate_alignments = self.get_alignments(meaning_representa... | <|body_start_0|>
super().__init__(seed, max_outputs=max_outputs)
self.glove = torchtext.vocab.GloVe(name='6B', dim='100')
self.nlp = spacy_nlp if spacy_nlp else spacy.load('en_core_web_sm')
self.max_outputs = max_outputs
self.n_similar = n_similar
<|end_body_0|>
<|body_start_1|>... | MRValueReplacement | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MRValueReplacement:
def __init__(self, seed=0, n_similar=10, max_outputs=1):
"""Method for initializing tools and setting variables."""
<|body_0|>
def generate(self, meaning_representation: dict, reference: str):
"""Method for generating variatios of the MR/utterance... | stack_v2_sparse_classes_10k_train_003583 | 3,530 | permissive | [
{
"docstring": "Method for initializing tools and setting variables.",
"name": "__init__",
"signature": "def __init__(self, seed=0, n_similar=10, max_outputs=1)"
},
{
"docstring": "Method for generating variatios of the MR/utterances.",
"name": "generate",
"signature": "def generate(self... | 5 | stack_v2_sparse_classes_30k_train_005395 | Implement the Python class `MRValueReplacement` described below.
Class description:
Implement the MRValueReplacement class.
Method signatures and docstrings:
- def __init__(self, seed=0, n_similar=10, max_outputs=1): Method for initializing tools and setting variables.
- def generate(self, meaning_representation: dic... | Implement the Python class `MRValueReplacement` described below.
Class description:
Implement the MRValueReplacement class.
Method signatures and docstrings:
- def __init__(self, seed=0, n_similar=10, max_outputs=1): Method for initializing tools and setting variables.
- def generate(self, meaning_representation: dic... | 619bc081fa506778526a1963d19a697367f1d553 | <|skeleton|>
class MRValueReplacement:
def __init__(self, seed=0, n_similar=10, max_outputs=1):
"""Method for initializing tools and setting variables."""
<|body_0|>
def generate(self, meaning_representation: dict, reference: str):
"""Method for generating variatios of the MR/utterance... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MRValueReplacement:
def __init__(self, seed=0, n_similar=10, max_outputs=1):
"""Method for initializing tools and setting variables."""
super().__init__(seed, max_outputs=max_outputs)
self.glove = torchtext.vocab.GloVe(name='6B', dim='100')
self.nlp = spacy_nlp if spacy_nlp els... | the_stack_v2_python_sparse | transformations/mr_value_replacement/transformation.py | dyrson11/NL-Augmenter | train | 1 | |
e4eda1a37903139fa2a3d3ae9e6c4813052ef369 | [
"nums, result, i = (sorted(nums), [], 0)\nwhile i < len(nums) - 2:\n if i == 0 or nums[i] != nums[i - 1]:\n j, k = (i + 1, len(nums) - 1)\n while j < k:\n if nums[i] + nums[j] + nums[k] < 0:\n j += 1\n elif nums[i] + nums[j] + nums[k] > 0:\n k -= ... | <|body_start_0|>
nums, result, i = (sorted(nums), [], 0)
while i < len(nums) - 2:
if i == 0 or nums[i] != nums[i - 1]:
j, k = (i + 1, len(nums) - 1)
while j < k:
if nums[i] + nums[j] + nums[k] < 0:
j += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum2(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums, result, i = (sorted(... | stack_v2_sparse_classes_10k_train_003584 | 12,022 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum2",
"signature": "def threeSum2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004731 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Solution:
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum2(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
nums, result, i = (sorted(nums), [], 0)
while i < len(nums) - 2:
if i == 0 or nums[i] != nums[i - 1]:
j, k = (i + 1, len(nums) - 1)
while j < k:
... | the_stack_v2_python_sparse | leetcode_python/Array/3sum.py | yennanliu/CS_basics | train | 64 | |
089fb1df46a34b3bd5e74344f1261c07a33fe870 | [
"if isinstance(cls, six.class_types):\n init = cls.__init__\n\n def wrapped(*args, **kwargs):\n try:\n warp_self = args[0]\n warp_self.df = None\n init(*args, **kwargs)\n symbol = args[1]\n self._gen_warp_df(warp_self, symbol)\n except Excep... | <|body_start_0|>
if isinstance(cls, six.class_types):
init = cls.__init__
def wrapped(*args, **kwargs):
try:
warp_self = args[0]
warp_self.df = None
init(*args, **kwargs)
symbol = args[1]
... | 做为类装饰器封装替换解析数据统一操作,装饰替换init | HSDataParseWrap | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HSDataParseWrap:
"""做为类装饰器封装替换解析数据统一操作,装饰替换init"""
def __call__(self, cls):
"""只做为数据源解析类的装饰器,统一封装通用的数据解析规范及流程"""
<|body_0|>
def _gen_warp_df(self, warp_self, symbol):
"""封装通用的数据解析规范及流程 :param warp_self: 被封装类init中使用的self对象 :param symbol: 请求的symbol str对象 :return:""... | stack_v2_sparse_classes_10k_train_003585 | 9,806 | permissive | [
{
"docstring": "只做为数据源解析类的装饰器,统一封装通用的数据解析规范及流程",
"name": "__call__",
"signature": "def __call__(self, cls)"
},
{
"docstring": "封装通用的数据解析规范及流程 :param warp_self: 被封装类init中使用的self对象 :param symbol: 请求的symbol str对象 :return:",
"name": "_gen_warp_df",
"signature": "def _gen_warp_df(self, warp_s... | 2 | stack_v2_sparse_classes_30k_train_003581 | Implement the Python class `HSDataParseWrap` described below.
Class description:
做为类装饰器封装替换解析数据统一操作,装饰替换init
Method signatures and docstrings:
- def __call__(self, cls): 只做为数据源解析类的装饰器,统一封装通用的数据解析规范及流程
- def _gen_warp_df(self, warp_self, symbol): 封装通用的数据解析规范及流程 :param warp_self: 被封装类init中使用的self对象 :param symbol: 请求的sy... | Implement the Python class `HSDataParseWrap` described below.
Class description:
做为类装饰器封装替换解析数据统一操作,装饰替换init
Method signatures and docstrings:
- def __call__(self, cls): 只做为数据源解析类的装饰器,统一封装通用的数据解析规范及流程
- def _gen_warp_df(self, warp_self, symbol): 封装通用的数据解析规范及流程 :param warp_self: 被封装类init中使用的self对象 :param symbol: 请求的sy... | f8841331022e8844537a5c5b08d047e2cc328856 | <|skeleton|>
class HSDataParseWrap:
"""做为类装饰器封装替换解析数据统一操作,装饰替换init"""
def __call__(self, cls):
"""只做为数据源解析类的装饰器,统一封装通用的数据解析规范及流程"""
<|body_0|>
def _gen_warp_df(self, warp_self, symbol):
"""封装通用的数据解析规范及流程 :param warp_self: 被封装类init中使用的self对象 :param symbol: 请求的symbol str对象 :return:""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HSDataParseWrap:
"""做为类装饰器封装替换解析数据统一操作,装饰替换init"""
def __call__(self, cls):
"""只做为数据源解析类的装饰器,统一封装通用的数据解析规范及流程"""
if isinstance(cls, six.class_types):
init = cls.__init__
def wrapped(*args, **kwargs):
try:
warp_self = args[0]
... | the_stack_v2_python_sparse | hsstock/service/tx_service.py | hsstock/hsstock | train | 2 |
e0872f3505fff212efa78d8440a7709f3f9e2565 | [
"env.filters['basename'] = os.path.basename\nenv.filters['dirname'] = os.path.dirname\nenv.filters['splitext'] = os.path.splitext\nenv.filters['combine'] = combine\nenv.filters['as_dict'] = as_dict\nenv.filters['ternary'] = ternary\nenv.globals['gpu_count'] = gpu_count\nenv.globals['load_json'] = create_load_json(s... | <|body_start_0|>
env.filters['basename'] = os.path.basename
env.filters['dirname'] = os.path.dirname
env.filters['splitext'] = os.path.splitext
env.filters['combine'] = combine
env.filters['as_dict'] = as_dict
env.filters['ternary'] = ternary
env.globals['gpu_coun... | An evaluation engine which uses Jinja2 for templating. | JinjaEngine | [
"Apache-2.0",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JinjaEngine:
"""An evaluation engine which uses Jinja2 for templating."""
def register_custom_filters(self, env):
"""Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to."""
<|body_0|>... | stack_v2_sparse_classes_10k_train_003586 | 6,185 | permissive | [
{
"docstring": "Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to.",
"name": "register_custom_filters",
"signature": "def register_custom_filters(self, env)"
},
{
"docstring": "Creates a new Jinja2 tem... | 3 | stack_v2_sparse_classes_30k_train_006261 | Implement the Python class `JinjaEngine` described below.
Class description:
An evaluation engine which uses Jinja2 for templating.
Method signatures and docstrings:
- def register_custom_filters(self, env): Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The enviro... | Implement the Python class `JinjaEngine` described below.
Class description:
An evaluation engine which uses Jinja2 for templating.
Method signatures and docstrings:
- def register_custom_filters(self, env): Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The enviro... | fd0c120e50815c1e5be64e5dde964dcd47234556 | <|skeleton|>
class JinjaEngine:
"""An evaluation engine which uses Jinja2 for templating."""
def register_custom_filters(self, env):
"""Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to."""
<|body_0|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JinjaEngine:
"""An evaluation engine which uses Jinja2 for templating."""
def register_custom_filters(self, env):
"""Adds our custom filters to the Jinja2 engine. Arguments --------- env: jinja2.Environment instance. The environment to add the custom filters to."""
env.filters['basename']... | the_stack_v2_python_sparse | kur/engine/jinja_engine.py | deepgram/kur | train | 873 |
b6092eaa5309f1b8468e71d863691f59f8d98fc1 | [
"res = []\nfor ele in nums:\n if ele != 0:\n res.append(ele)\nfor i in range(len(nums)):\n if i < len(res):\n nums[i] = res[i]\n else:\n nums[i] = 0\nreturn nums",
"j = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[j] = nums[i]\n j += 1\nwhile j < len(nums)... | <|body_start_0|>
res = []
for ele in nums:
if ele != 0:
res.append(ele)
for i in range(len(nums)):
if i < len(res):
nums[i] = res[i]
else:
nums[i] = 0
return nums
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes(self, nums):
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes2(self, nums):
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
def moveZeroes3(self, nums):
"""Do no... | stack_v2_sparse_classes_10k_train_003587 | 1,252 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes",
"signature": "def moveZeroes(self, nums)"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes2",
"signature": "def moveZeroes2(self, nums)"
},
{
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums): Do not return anything, modify nums in-place instead.
- def moveZeroes2(self, nums): Do not return anything, modify nums in-place instead.
- def moveZ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums): Do not return anything, modify nums in-place instead.
- def moveZeroes2(self, nums): Do not return anything, modify nums in-place instead.
- def moveZ... | 0ac672a1582707fcaa6b6ad1f2a1d927034447df | <|skeleton|>
class Solution:
def moveZeroes(self, nums):
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes2(self, nums):
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
def moveZeroes3(self, nums):
"""Do no... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def moveZeroes(self, nums):
"""Do not return anything, modify nums in-place instead."""
res = []
for ele in nums:
if ele != 0:
res.append(ele)
for i in range(len(nums)):
if i < len(res):
nums[i] = res[i]
... | the_stack_v2_python_sparse | Chapter01_ArrayProblem/leetcode283.py | HuichuanLI/alogritme-interview | train | 1 | |
9981baaff44d2c5a4e994bc9866d61eb52f65c6d | [
"ret = 0\nsums = defaultdict(int)\nsums[0] += 1\nacc = 0\nfor n in nums:\n acc += n\n for s in sums:\n if (acc - s) % k == 0:\n ret += sums[s]\n sums[acc] += 1\nreturn ret",
"ret = 0\ncnt = [0] * k\ncnt[0] = 1\nacc = 0\nfor n in nums:\n acc += n\n ret += cnt[acc % k]\n cnt[acc ... | <|body_start_0|>
ret = 0
sums = defaultdict(int)
sums[0] += 1
acc = 0
for n in nums:
acc += n
for s in sums:
if (acc - s) % k == 0:
ret += sums[s]
sums[acc] += 1
return ret
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Mar 05, 2023 22:16 TLE"""
<|body_0|>
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Mar 05, 2023 22:20"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ret = 0
... | stack_v2_sparse_classes_10k_train_003588 | 1,821 | no_license | [
{
"docstring": "Mar 05, 2023 22:16 TLE",
"name": "subarraysDivByK",
"signature": "def subarraysDivByK(self, nums: List[int], k: int) -> int"
},
{
"docstring": "Mar 05, 2023 22:20",
"name": "subarraysDivByK",
"signature": "def subarraysDivByK(self, nums: List[int], k: int) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:16 TLE
- def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:20 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:16 TLE
- def subarraysDivByK(self, nums: List[int], k: int) -> int: Mar 05, 2023 22:20
<|skeleton|>
cl... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Mar 05, 2023 22:16 TLE"""
<|body_0|>
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Mar 05, 2023 22:20"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Mar 05, 2023 22:16 TLE"""
ret = 0
sums = defaultdict(int)
sums[0] += 1
acc = 0
for n in nums:
acc += n
for s in sums:
if (acc - s) % k == 0:
... | the_stack_v2_python_sparse | leetcode/solved/1016_Subarray_Sums_Divisible_by_K/solution.py | sungminoh/algorithms | train | 0 | |
985f3f0702992b01585135390a533e1643791ba0 | [
"self.f = f\nself.initArgs = initArgs\nself.initKargs = initKargs",
"updatedArgs = self.initArgs + args\nupdatedKargs = self.initKargs.copy()\nupdatedKargs.update(kargs)\nreturn self.f(*updatedArgs, **updatedKargs)"
] | <|body_start_0|>
self.f = f
self.initArgs = initArgs
self.initKargs = initKargs
<|end_body_0|>
<|body_start_1|>
updatedArgs = self.initArgs + args
updatedKargs = self.initKargs.copy()
updatedKargs.update(kargs)
return self.f(*updatedArgs, **updatedKargs)
<|end_bo... | This class is a curry (think functional programming). The following attributes are used: f This is the function being curried. initArgs, initKargs These are the args and kargs to pass to ``f``. | Curry | [
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Curry:
"""This class is a curry (think functional programming). The following attributes are used: f This is the function being curried. initArgs, initKargs These are the args and kargs to pass to ``f``."""
def __init__(self, f, *initArgs, **initKargs):
"""Accept the initial argument... | stack_v2_sparse_classes_10k_train_003589 | 799 | permissive | [
{
"docstring": "Accept the initial arguments and the function.",
"name": "__init__",
"signature": "def __init__(self, f, *initArgs, **initKargs)"
},
{
"docstring": "Call the function.",
"name": "__call__",
"signature": "def __call__(self, *args, **kargs)"
}
] | 2 | null | Implement the Python class `Curry` described below.
Class description:
This class is a curry (think functional programming). The following attributes are used: f This is the function being curried. initArgs, initKargs These are the args and kargs to pass to ``f``.
Method signatures and docstrings:
- def __init__(self... | Implement the Python class `Curry` described below.
Class description:
This class is a curry (think functional programming). The following attributes are used: f This is the function being curried. initArgs, initKargs These are the args and kargs to pass to ``f``.
Method signatures and docstrings:
- def __init__(self... | d097ca0ad6a6aee2180d32dce6a3322621f655fd | <|skeleton|>
class Curry:
"""This class is a curry (think functional programming). The following attributes are used: f This is the function being curried. initArgs, initKargs These are the args and kargs to pass to ``f``."""
def __init__(self, f, *initArgs, **initKargs):
"""Accept the initial argument... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Curry:
"""This class is a curry (think functional programming). The following attributes are used: f This is the function being curried. initArgs, initKargs These are the args and kargs to pass to ``f``."""
def __init__(self, f, *initArgs, **initKargs):
"""Accept the initial arguments and the fun... | the_stack_v2_python_sparse | recipes/Python/363775_Curry/recipe-363775.py | betty29/code-1 | train | 0 |
573f0f6640abeddeb336cbd27c6cc2b30f540d27 | [
"result = dict(vars(config))\nfor arg in self._ignore_config:\n if arg in result:\n del result[arg]\nreturn result",
"for check_arg, check_value in check_config.items():\n if check_arg not in pickled_config:\n return False\n pickled_value = pickled_config[check_arg]\n if isinstance(check... | <|body_start_0|>
result = dict(vars(config))
for arg in self._ignore_config:
if arg in result:
del result[arg]
return result
<|end_body_0|>
<|body_start_1|>
for check_arg, check_value in check_config.items():
if check_arg not in pickled_config:
... | Class for managing collections of results tied to configuration. | MultiPickle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiPickle:
"""Class for managing collections of results tied to configuration."""
def _get_pickle_config(self, config):
"""Return configuration ready to pickle or compare to pickled. Args: config: See same name argument to `check_for_pickled()` Returns: dict: Dictionary of the conf... | stack_v2_sparse_classes_10k_train_003590 | 8,159 | permissive | [
{
"docstring": "Return configuration ready to pickle or compare to pickled. Args: config: See same name argument to `check_for_pickled()` Returns: dict: Dictionary of the configuration to be pickled or compared to what is pickled.",
"name": "_get_pickle_config",
"signature": "def _get_pickle_config(self... | 6 | stack_v2_sparse_classes_30k_train_004936 | Implement the Python class `MultiPickle` described below.
Class description:
Class for managing collections of results tied to configuration.
Method signatures and docstrings:
- def _get_pickle_config(self, config): Return configuration ready to pickle or compare to pickled. Args: config: See same name argument to `c... | Implement the Python class `MultiPickle` described below.
Class description:
Class for managing collections of results tied to configuration.
Method signatures and docstrings:
- def _get_pickle_config(self, config): Return configuration ready to pickle or compare to pickled. Args: config: See same name argument to `c... | 18f5f35239d3c9ce3ebfd072f5dbc72f5f1532e9 | <|skeleton|>
class MultiPickle:
"""Class for managing collections of results tied to configuration."""
def _get_pickle_config(self, config):
"""Return configuration ready to pickle or compare to pickled. Args: config: See same name argument to `check_for_pickled()` Returns: dict: Dictionary of the conf... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiPickle:
"""Class for managing collections of results tied to configuration."""
def _get_pickle_config(self, config):
"""Return configuration ready to pickle or compare to pickled. Args: config: See same name argument to `check_for_pickled()` Returns: dict: Dictionary of the configuration to ... | the_stack_v2_python_sparse | multi_pickle.py | kpenev/general_purpose_python_modules | train | 0 |
fe0926ccd4252577d0c0192fb2493657c875cd1f | [
"memo = [[-1] * len(grid[0]) for _ in range(len(grid))]\nmemo[0][0] = grid[0][0]\nfor j in range(1, len(grid[0])):\n memo[0][j] = memo[0][j - 1] + grid[0][j]\nfor i in range(1, len(grid)):\n memo[i][0] = memo[i - 1][0] + grid[i][0]\n\ndef short_to(i, j):\n if memo[i][j] >= 0:\n return memo[i][j]\n ... | <|body_start_0|>
memo = [[-1] * len(grid[0]) for _ in range(len(grid))]
memo[0][0] = grid[0][0]
for j in range(1, len(grid[0])):
memo[0][j] = memo[0][j - 1] + grid[0][j]
for i in range(1, len(grid)):
memo[i][0] = memo[i - 1][0] + grid[i][0]
def short_to(i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
"""Dec 28, 2017 19:42"""
<|body_0|>
def minPathSum(self, grid: List[List[int]]) -> int:
"""Apr 23, 2023 21:34"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
memo = [[-1] * len(grid[0]) for _ in range(len(grid))... | stack_v2_sparse_classes_10k_train_003591 | 2,037 | no_license | [
{
"docstring": "Dec 28, 2017 19:42",
"name": "minPathSum",
"signature": "def minPathSum(self, grid)"
},
{
"docstring": "Apr 23, 2023 21:34",
"name": "minPathSum",
"signature": "def minPathSum(self, grid: List[List[int]]) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): Dec 28, 2017 19:42
- def minPathSum(self, grid: List[List[int]]) -> int: Apr 23, 2023 21:34 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): Dec 28, 2017 19:42
- def minPathSum(self, grid: List[List[int]]) -> int: Apr 23, 2023 21:34
<|skeleton|>
class Solution:
def minPathSum(self, gr... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
"""Dec 28, 2017 19:42"""
<|body_0|>
def minPathSum(self, grid: List[List[int]]) -> int:
"""Apr 23, 2023 21:34"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minPathSum(self, grid):
"""Dec 28, 2017 19:42"""
memo = [[-1] * len(grid[0]) for _ in range(len(grid))]
memo[0][0] = grid[0][0]
for j in range(1, len(grid[0])):
memo[0][j] = memo[0][j - 1] + grid[0][j]
for i in range(1, len(grid)):
... | the_stack_v2_python_sparse | leetcode/solved/64_Minimum_Path_Sum/solution.py | sungminoh/algorithms | train | 0 | |
924963f46c7c665d7d7cb546def8fc70383489a9 | [
"self.infn = infn\nself.pdf_input = PdfReader(open(infn, 'rb'))\nself.page_count = len(self.pdf_input.pages)",
"if startpage > endpage or endpage > self.page_count:\n raise ValueError('page_count > endpage > startpage')\npdf_output = PdfWriter()\nfor i in range(startpage, endpage):\n pdf_output.add_page(sel... | <|body_start_0|>
self.infn = infn
self.pdf_input = PdfReader(open(infn, 'rb'))
self.page_count = len(self.pdf_input.pages)
<|end_body_0|>
<|body_start_1|>
if startpage > endpage or endpage > self.page_count:
raise ValueError('page_count > endpage > startpage')
pdf_ou... | PDFSplit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PDFSplit:
def __init__(self, infn):
"""infn: 切分的pdf"""
<|body_0|>
def page2page(self, startpage, endpage):
"""startpage: 从startpage页开始切分,默认从第一页开始切分 endpage:直到endpage页切分结束"""
<|body_1|>
def filenum(self, outfnnum=2):
"""outfnnum: 切分后的pdf数量,默认两份"""... | stack_v2_sparse_classes_10k_train_003592 | 3,769 | no_license | [
{
"docstring": "infn: 切分的pdf",
"name": "__init__",
"signature": "def __init__(self, infn)"
},
{
"docstring": "startpage: 从startpage页开始切分,默认从第一页开始切分 endpage:直到endpage页切分结束",
"name": "page2page",
"signature": "def page2page(self, startpage, endpage)"
},
{
"docstring": "outfnnum: 切分... | 4 | stack_v2_sparse_classes_30k_train_003682 | Implement the Python class `PDFSplit` described below.
Class description:
Implement the PDFSplit class.
Method signatures and docstrings:
- def __init__(self, infn): infn: 切分的pdf
- def page2page(self, startpage, endpage): startpage: 从startpage页开始切分,默认从第一页开始切分 endpage:直到endpage页切分结束
- def filenum(self, outfnnum=2): ou... | Implement the Python class `PDFSplit` described below.
Class description:
Implement the PDFSplit class.
Method signatures and docstrings:
- def __init__(self, infn): infn: 切分的pdf
- def page2page(self, startpage, endpage): startpage: 从startpage页开始切分,默认从第一页开始切分 endpage:直到endpage页切分结束
- def filenum(self, outfnnum=2): ou... | 42afa8f806b0c6b5525177fafb6be22945ac8501 | <|skeleton|>
class PDFSplit:
def __init__(self, infn):
"""infn: 切分的pdf"""
<|body_0|>
def page2page(self, startpage, endpage):
"""startpage: 从startpage页开始切分,默认从第一页开始切分 endpage:直到endpage页切分结束"""
<|body_1|>
def filenum(self, outfnnum=2):
"""outfnnum: 切分后的pdf数量,默认两份"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PDFSplit:
def __init__(self, infn):
"""infn: 切分的pdf"""
self.infn = infn
self.pdf_input = PdfReader(open(infn, 'rb'))
self.page_count = len(self.pdf_input.pages)
def page2page(self, startpage, endpage):
"""startpage: 从startpage页开始切分,默认从第一页开始切分 endpage:直到endpage页切分结束... | the_stack_v2_python_sparse | pdfs/PDFSpliteMerge.py | wnma3mz/Tools | train | 13 | |
32cdc7d3d31e7fe0b6c21899917d01a057c4b87a | [
"with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_regularizer=slim.l2_regularizer(weight_decay), biases_initializer=tf.zeros_initializer()):\n with slim.arg_scope([slim.conv2d], padding='SAME') as arg_sc:\n return arg_sc",
"if rate == 1:\n outputs = slim.repe... | <|body_start_0|>
with slim.arg_scope([slim.conv2d, slim.fully_connected], activation_fn=tf.nn.relu, weights_regularizer=slim.l2_regularizer(weight_decay), biases_initializer=tf.zeros_initializer()):
with slim.arg_scope([slim.conv2d], padding='SAME') as arg_sc:
return arg_sc
<|end_bod... | Contains modified VGG model definition to extract features from Bird's eye view input using pyramid features. | BevVggLfe | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BevVggLfe:
"""Contains modified VGG model definition to extract features from Bird's eye view input using pyramid features."""
def vgg_arg_scope(self, weight_decay=0.0005):
"""Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope."""
... | stack_v2_sparse_classes_10k_train_003593 | 6,290 | no_license | [
{
"docstring": "Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope.",
"name": "vgg_arg_scope",
"signature": "def vgg_arg_scope(self, weight_decay=0.0005)"
},
{
"docstring": "implimentation of dilated convolution by using batch_to_space https:/... | 3 | stack_v2_sparse_classes_30k_train_004218 | Implement the Python class `BevVggLfe` described below.
Class description:
Contains modified VGG model definition to extract features from Bird's eye view input using pyramid features.
Method signatures and docstrings:
- def vgg_arg_scope(self, weight_decay=0.0005): Defines the VGG arg scope. Args: weight_decay: The ... | Implement the Python class `BevVggLfe` described below.
Class description:
Contains modified VGG model definition to extract features from Bird's eye view input using pyramid features.
Method signatures and docstrings:
- def vgg_arg_scope(self, weight_decay=0.0005): Defines the VGG arg scope. Args: weight_decay: The ... | ac8256bd76fe4b81cfc48dc4c0b9d9dc92bc61c6 | <|skeleton|>
class BevVggLfe:
"""Contains modified VGG model definition to extract features from Bird's eye view input using pyramid features."""
def vgg_arg_scope(self, weight_decay=0.0005):
"""Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BevVggLfe:
"""Contains modified VGG model definition to extract features from Bird's eye view input using pyramid features."""
def vgg_arg_scope(self, weight_decay=0.0005):
"""Defines the VGG arg scope. Args: weight_decay: The l2 regularization coefficient. Returns: An arg_scope."""
with ... | the_stack_v2_python_sparse | mlod/core/feature_extractors/bev_vgg_lfe.py | songsanling/MLOD | train | 0 |
8da0d16bb56fef384382aae050836db6a277536e | [
"self.tuples = kargs.pop('tuples', None)\nself.context = kargs.pop('context', None)\nself.form_values = kargs.pop('values', None)\nself.show_key = kargs.pop('show_key', None)\nself.is_empty = True\nsuper().__init__(*args, **kargs)\nif not self.form_values:\n self.form_values = [None] * len(self.tuples)\nfor idx,... | <|body_start_0|>
self.tuples = kargs.pop('tuples', None)
self.context = kargs.pop('context', None)
self.form_values = kargs.pop('values', None)
self.show_key = kargs.pop('show_key', None)
self.is_empty = True
super().__init__(*args, **kargs)
if not self.form_value... | Form to enter values in a row. | EnterActionIn | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnterActionIn:
"""Form to enter values in a row."""
def __init__(self, *args, **kargs):
"""Store parameters and adjust questions, columns, etc."""
<|body_0|>
def get_key_value_pairs(self) -> Tuple[List, List, str, Any]:
"""Extract key/value pairs and primary key/... | stack_v2_sparse_classes_10k_train_003594 | 5,848 | permissive | [
{
"docstring": "Store parameters and adjust questions, columns, etc.",
"name": "__init__",
"signature": "def __init__(self, *args, **kargs)"
},
{
"docstring": "Extract key/value pairs and primary key/value. :return: Tuple with List[keys], List[values], where_field, where_value",
"name": "get... | 2 | null | Implement the Python class `EnterActionIn` described below.
Class description:
Form to enter values in a row.
Method signatures and docstrings:
- def __init__(self, *args, **kargs): Store parameters and adjust questions, columns, etc.
- def get_key_value_pairs(self) -> Tuple[List, List, str, Any]: Extract key/value p... | Implement the Python class `EnterActionIn` described below.
Class description:
Form to enter values in a row.
Method signatures and docstrings:
- def __init__(self, *args, **kargs): Store parameters and adjust questions, columns, etc.
- def get_key_value_pairs(self) -> Tuple[List, List, str, Any]: Extract key/value p... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class EnterActionIn:
"""Form to enter values in a row."""
def __init__(self, *args, **kargs):
"""Store parameters and adjust questions, columns, etc."""
<|body_0|>
def get_key_value_pairs(self) -> Tuple[List, List, str, Any]:
"""Extract key/value pairs and primary key/... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EnterActionIn:
"""Form to enter values in a row."""
def __init__(self, *args, **kargs):
"""Store parameters and adjust questions, columns, etc."""
self.tuples = kargs.pop('tuples', None)
self.context = kargs.pop('context', None)
self.form_values = kargs.pop('values', None)... | the_stack_v2_python_sparse | ontask/action/forms/edit.py | abelardopardo/ontask_b | train | 43 |
6becc63491afcea8937d74abc009985e95b5ae98 | [
"ls = list(s.strip())\nif len(ls) == 0:\n return 0\nsign = -1 if ls[0] == '-' else 1\nif ls[0] in ['-', '+']:\n del ls[0]\nret, i = (0, 0)\nwhile i < len(ls) and ls[i].isdigit():\n ret = ret * 10 + ord(ls[i]) - ord('0')\n i += 1\nreturn max(-2 ** 31, min(sign * ret, 2 ** 31 - 1))",
"num = ['0', '1', '... | <|body_start_0|>
ls = list(s.strip())
if len(ls) == 0:
return 0
sign = -1 if ls[0] == '-' else 1
if ls[0] in ['-', '+']:
del ls[0]
ret, i = (0, 0)
while i < len(ls) and ls[i].isdigit():
ret = ret * 10 + ord(ls[i]) - ord('0')
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myAtoi(self, s):
""":type str: str :rtype: int"""
<|body_0|>
def myAtoi2(self, str):
""":type str: str :rtype: int"""
<|body_1|>
def myAtoi3(self, str):
""":type str: str :rtype: int"""
<|body_2|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_10k_train_003595 | 4,256 | no_license | [
{
"docstring": ":type str: str :rtype: int",
"name": "myAtoi",
"signature": "def myAtoi(self, s)"
},
{
"docstring": ":type str: str :rtype: int",
"name": "myAtoi2",
"signature": "def myAtoi2(self, str)"
},
{
"docstring": ":type str: str :rtype: int",
"name": "myAtoi3",
"s... | 3 | stack_v2_sparse_classes_30k_train_001751 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myAtoi(self, s): :type str: str :rtype: int
- def myAtoi2(self, str): :type str: str :rtype: int
- def myAtoi3(self, str): :type str: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myAtoi(self, s): :type str: str :rtype: int
- def myAtoi2(self, str): :type str: str :rtype: int
- def myAtoi3(self, str): :type str: str :rtype: int
<|skeleton|>
class Solu... | 132d3d901a1e9bb027fc32e2269bc6efc170eee9 | <|skeleton|>
class Solution:
def myAtoi(self, s):
""":type str: str :rtype: int"""
<|body_0|>
def myAtoi2(self, str):
""":type str: str :rtype: int"""
<|body_1|>
def myAtoi3(self, str):
""":type str: str :rtype: int"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def myAtoi(self, s):
""":type str: str :rtype: int"""
ls = list(s.strip())
if len(ls) == 0:
return 0
sign = -1 if ls[0] == '-' else 1
if ls[0] in ['-', '+']:
del ls[0]
ret, i = (0, 0)
while i < len(ls) and ls[i].isdigit(... | the_stack_v2_python_sparse | Leetcode/8. String to Integer (atoi).py | simple5510/Leetcode | train | 0 | |
a60f1010af18b6b99c51a6b6e2da5462620963b0 | [
"for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return (i, j)",
"for i in range(len(nums)):\n dst = target - nums[i]\n if dst in nums and i != nums.index(dst):\n return (i, nums.index(dst))"
] | <|body_start_0|>
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return (i, j)
<|end_body_0|>
<|body_start_1|>
for i in range(len(nums)):
dst = target - nums[i]
if dst in nums and i != n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_10k_train_003596 | 731 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum1",
"signature": "def twoSum1(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
}... | 2 | stack_v2_sparse_classes_30k_train_004300 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | f1d780b7e8b91b4df704651514018143c6931f9d | <|skeleton|>
class Solution:
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return (i, j)
def twoSum(self, nums, targ... | the_stack_v2_python_sparse | ProgramForLeetCode/LeetCode/1_twoSum.py | DQDH/Algorithm_Code | train | 0 | |
3baae2be9cec4db151086ae8aeebcc1d39b7c8a4 | [
"sql = \"SELECT stock_id, rmw_type FROM base_finance.stock_type_style WHERE `date` > '{start}' AND `date` <= '{end}'\".format(start=start, end=end)\ndf = pd.read_sql(sql, cls.engine)\nd = {0: 'W', 1: 'M', 2: 'R'}\ndf['rmw_type'] = df['rmw_type'].apply(lambda x: d.get(x))\ndf = df.dropna()\nreturn df.groupby('rmw_ty... | <|body_start_0|>
sql = "SELECT stock_id, rmw_type FROM base_finance.stock_type_style WHERE `date` > '{start}' AND `date` <= '{end}'".format(start=start, end=end)
df = pd.read_sql(sql, cls.engine)
d = {0: 'W', 1: 'M', 2: 'R'}
df['rmw_type'] = df['rmw_type'].apply(lambda x: d.get(x))
... | FamaFrenchDataloader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FamaFrenchDataloader:
def load_type_rmw(cls, start, end):
"""Robust minus Weak"""
<|body_0|>
def load_type_cma(cls, start, end):
"""Conservative minus Aggressive"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sql = "SELECT stock_id, rmw_type FROM b... | stack_v2_sparse_classes_10k_train_003597 | 6,329 | no_license | [
{
"docstring": "Robust minus Weak",
"name": "load_type_rmw",
"signature": "def load_type_rmw(cls, start, end)"
},
{
"docstring": "Conservative minus Aggressive",
"name": "load_type_cma",
"signature": "def load_type_cma(cls, start, end)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005333 | Implement the Python class `FamaFrenchDataloader` described below.
Class description:
Implement the FamaFrenchDataloader class.
Method signatures and docstrings:
- def load_type_rmw(cls, start, end): Robust minus Weak
- def load_type_cma(cls, start, end): Conservative minus Aggressive | Implement the Python class `FamaFrenchDataloader` described below.
Class description:
Implement the FamaFrenchDataloader class.
Method signatures and docstrings:
- def load_type_rmw(cls, start, end): Robust minus Weak
- def load_type_cma(cls, start, end): Conservative minus Aggressive
<|skeleton|>
class FamaFrenchDa... | 5dc1eed2739ea0f54c48e6de7de03932e1a9091c | <|skeleton|>
class FamaFrenchDataloader:
def load_type_rmw(cls, start, end):
"""Robust minus Weak"""
<|body_0|>
def load_type_cma(cls, start, end):
"""Conservative minus Aggressive"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FamaFrenchDataloader:
def load_type_rmw(cls, start, end):
"""Robust minus Weak"""
sql = "SELECT stock_id, rmw_type FROM base_finance.stock_type_style WHERE `date` > '{start}' AND `date` <= '{end}'".format(start=start, end=end)
df = pd.read_sql(sql, cls.engine)
d = {0: 'W', 1: '... | the_stack_v2_python_sparse | utils/algorithm/fama/share/sqlfactory.py | Chihihiro/index | train | 1 | |
62da1c75cfc3b08a5c306e4bee070e1e3de30cf2 | [
"self.snake = collections.deque([(0, 0)])\nself.snake_set = {(0, 0): 1}\nself.width = width\nself.height = height\nself.food = food\nself.food_index = 0\nself.movement = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}",
"newHead = (self.snake[0][0] + self.movement[direction][0], self.snake[0][1] + self.mov... | <|body_start_0|>
self.snake = collections.deque([(0, 0)])
self.snake_set = {(0, 0): 1}
self.width = width
self.height = height
self.food = food
self.food_index = 0
self.movement = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}
<|end_body_0|>
<|body_start_... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_10k_train_003598 | 15,245 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 2 | null | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a... | the_stack_v2_python_sparse | leetcode_python/Design/design-snake-game.py | yennanliu/CS_basics | train | 64 | |
3db1d0be4ecb42b96f6d49ba71b43cfe5bd9f1b9 | [
"super(WindowedDataStore, self).__init__()\nif int(window_step) != window_step:\n raise ValueError('Must be an integer window_step for now, not %g.' % window_step)\nif window_width is None:\n window_width = int(3 * window_step)\nlogging.info('Initializing AudioDataStore with step of %d and width of %d.', wind... | <|body_start_0|>
super(WindowedDataStore, self).__init__()
if int(window_step) != window_step:
raise ValueError('Must be an integer window_step for now, not %g.' % window_step)
if window_width is None:
window_width = int(3 * window_step)
logging.info('Initializing... | Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows are separated by window_step samples. Note: t... | WindowedDataStore | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowedDataStore:
"""Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows ... | stack_v2_sparse_classes_10k_train_003599 | 13,521 | permissive | [
{
"docstring": "Creates the storage object. Note: this class only handles integer step sizes, so downsampling by a non-integer rate (i.e. 22050 to 100hz) doesn't work. Args: window_step: How many frames to advance each time we grab some data. window_width: Width of the analysis window. If not set, then the defa... | 3 | stack_v2_sparse_classes_30k_train_001628 | Implement the Python class `WindowedDataStore` described below.
Class description:
Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window... | Implement the Python class `WindowedDataStore` described below.
Class description:
Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window... | ffe01f76a03ebbb99d8fec8bcb57247dd17084a7 | <|skeleton|>
class WindowedDataStore:
"""Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WindowedDataStore:
"""Class for storing a signal and pulling fixed-sized windows out to process. Add any number of frames at a time (but don't overfill the buffer). Then it can be pulled out as fixed-sized windows. Each window of data has size (2*half_window_width + 1) x num_features The windows are separated... | the_stack_v2_python_sparse | telluride_decoding/result_store.py | google/telluride_decoding | train | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.