blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f46c2a9fa132e5d31b807af2497b1875e9045f47 | [
"try:\n optimizer = getattr(torch.optim, config.get('train.optimizer.default.type'))\n return optimizer(KgeOptimizer._get_parameters_and_optimizer_args(config, model), **config.get('train.optimizer.default.args'))\nexcept AttributeError:\n raise ValueError(f\"Could not create optimizer {config.get('train.o... | <|body_start_0|>
try:
optimizer = getattr(torch.optim, config.get('train.optimizer.default.type'))
return optimizer(KgeOptimizer._get_parameters_and_optimizer_args(config, model), **config.get('train.optimizer.default.args'))
except AttributeError:
raise ValueError(f"... | Wraps torch optimizers | KgeOptimizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KgeOptimizer:
"""Wraps torch optimizers"""
def create(config, model):
"""Factory method for optimizer creation"""
<|body_0|>
def _get_parameters_and_optimizer_args(config, model):
"""Group named parameters by regex strings provided with optimizer args. Constructs... | stack_v2_sparse_classes_36k_train_016800 | 6,476 | permissive | [
{
"docstring": "Factory method for optimizer creation",
"name": "create",
"signature": "def create(config, model)"
},
{
"docstring": "Group named parameters by regex strings provided with optimizer args. Constructs a list of dictionaries of the form: [ { \"name\": name of parameter group \"param... | 2 | stack_v2_sparse_classes_30k_val_000742 | Implement the Python class `KgeOptimizer` described below.
Class description:
Wraps torch optimizers
Method signatures and docstrings:
- def create(config, model): Factory method for optimizer creation
- def _get_parameters_and_optimizer_args(config, model): Group named parameters by regex strings provided with optim... | Implement the Python class `KgeOptimizer` described below.
Class description:
Wraps torch optimizers
Method signatures and docstrings:
- def create(config, model): Factory method for optimizer creation
- def _get_parameters_and_optimizer_args(config, model): Group named parameters by regex strings provided with optim... | 00de5127dd7fdc0d0d921a6dffda09a30dbd3d7d | <|skeleton|>
class KgeOptimizer:
"""Wraps torch optimizers"""
def create(config, model):
"""Factory method for optimizer creation"""
<|body_0|>
def _get_parameters_and_optimizer_args(config, model):
"""Group named parameters by regex strings provided with optimizer args. Constructs... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KgeOptimizer:
"""Wraps torch optimizers"""
def create(config, model):
"""Factory method for optimizer creation"""
try:
optimizer = getattr(torch.optim, config.get('train.optimizer.default.type'))
return optimizer(KgeOptimizer._get_parameters_and_optimizer_args(conf... | the_stack_v2_python_sparse | kge/util/optimizer.py | uma-pi1/kge | train | 706 |
0d5b0980006d7d84f441efd1bf72c8524f437176 | [
"super().__init__(parent=parent)\nx_label, y_label = plot_labels[AnalysisType.ROI_PROJ]\nself.setLabel('bottom', x_label)\nself.setLabel('left', y_label)\nself.setTitle('ROI projection (average over train)')\nself._plot = self.plotCurve(pen=FColor.mkPen('p'))",
"proj = data.roi.proj\nx = proj.x\ny = proj.y\nif y ... | <|body_start_0|>
super().__init__(parent=parent)
x_label, y_label = plot_labels[AnalysisType.ROI_PROJ]
self.setLabel('bottom', x_label)
self.setLabel('left', y_label)
self.setTitle('ROI projection (average over train)')
self._plot = self.plotCurve(pen=FColor.mkPen('p'))
<... | RoiProjPlot class. Widget for visualizing the average ROI projection over a train. | RoiProjPlot | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoiProjPlot:
"""RoiProjPlot class. Widget for visualizing the average ROI projection over a train."""
def __init__(self, *, parent=None):
"""Initialization."""
<|body_0|>
def updateF(self, data):
"""Override."""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_016801 | 8,044 | permissive | [
{
"docstring": "Initialization.",
"name": "__init__",
"signature": "def __init__(self, *, parent=None)"
},
{
"docstring": "Override.",
"name": "updateF",
"signature": "def updateF(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001022 | Implement the Python class `RoiProjPlot` described below.
Class description:
RoiProjPlot class. Widget for visualizing the average ROI projection over a train.
Method signatures and docstrings:
- def __init__(self, *, parent=None): Initialization.
- def updateF(self, data): Override. | Implement the Python class `RoiProjPlot` described below.
Class description:
RoiProjPlot class. Widget for visualizing the average ROI projection over a train.
Method signatures and docstrings:
- def __init__(self, *, parent=None): Initialization.
- def updateF(self, data): Override.
<|skeleton|>
class RoiProjPlot:
... | a6ee28040b15ae8d110570bd9f3c37e5a3e70fc0 | <|skeleton|>
class RoiProjPlot:
"""RoiProjPlot class. Widget for visualizing the average ROI projection over a train."""
def __init__(self, *, parent=None):
"""Initialization."""
<|body_0|>
def updateF(self, data):
"""Override."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoiProjPlot:
"""RoiProjPlot class. Widget for visualizing the average ROI projection over a train."""
def __init__(self, *, parent=None):
"""Initialization."""
super().__init__(parent=parent)
x_label, y_label = plot_labels[AnalysisType.ROI_PROJ]
self.setLabel('bottom', x_l... | the_stack_v2_python_sparse | extra_foam/gui/image_tool/corrected_view.py | European-XFEL/EXtra-foam | train | 8 |
2f9ece28686590645c682044e131c640ca2ccc4f | [
"user = getUser(username)\nif user is None:\n raise UnknownUserError([username])\ncreateTwitterUser(user, uid)",
"result = getTwitterUsers(uids=[uid]).one()\nif result is not None:\n return result[0]\nelse:\n return None"
] | <|body_start_0|>
user = getUser(username)
if user is None:
raise UnknownUserError([username])
createTwitterUser(user, uid)
<|end_body_0|>
<|body_start_1|>
result = getTwitterUsers(uids=[uid]).one()
if result is not None:
return result[0]
else:
... | The public API for L{TwitterUser}s in the model layer. | TwitterUserAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwitterUserAPI:
"""The public API for L{TwitterUser}s in the model layer."""
def create(self, username, uid):
"""Create a L{TwitterUser} mapping a UID to the specified username. @param username: The L{User.username} the UID is for. @param uid: The Twitter UID for the specified Fluidi... | stack_v2_sparse_classes_36k_train_016802 | 9,808 | permissive | [
{
"docstring": "Create a L{TwitterUser} mapping a UID to the specified username. @param username: The L{User.username} the UID is for. @param uid: The Twitter UID for the specified Fluidinfo user. @raise UnknownUserError: Raised if the specified L{User} doesn't exist.",
"name": "create",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_002383 | Implement the Python class `TwitterUserAPI` described below.
Class description:
The public API for L{TwitterUser}s in the model layer.
Method signatures and docstrings:
- def create(self, username, uid): Create a L{TwitterUser} mapping a UID to the specified username. @param username: The L{User.username} the UID is ... | Implement the Python class `TwitterUserAPI` described below.
Class description:
The public API for L{TwitterUser}s in the model layer.
Method signatures and docstrings:
- def create(self, username, uid): Create a L{TwitterUser} mapping a UID to the specified username. @param username: The L{User.username} the UID is ... | b5a8c8349f3eaf3364cc4efba4736c3e33b30d96 | <|skeleton|>
class TwitterUserAPI:
"""The public API for L{TwitterUser}s in the model layer."""
def create(self, username, uid):
"""Create a L{TwitterUser} mapping a UID to the specified username. @param username: The L{User.username} the UID is for. @param uid: The Twitter UID for the specified Fluidi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwitterUserAPI:
"""The public API for L{TwitterUser}s in the model layer."""
def create(self, username, uid):
"""Create a L{TwitterUser} mapping a UID to the specified username. @param username: The L{User.username} the UID is for. @param uid: The Twitter UID for the specified Fluidinfo user. @ra... | the_stack_v2_python_sparse | fluiddb/model/user.py | fluidinfo/fluiddb | train | 3 |
2023e7b3edaf3a7eb84ed8b03866b7003d3e83b7 | [
"if direction == 'left':\n if cs.craftable_scroll_page > 0:\n cs.craftable_scroll_page -= 1\nelse:\n cs.craftable_scroll_page += 1",
"item_name = ''\ncounter = 0\nfor key, value in cs.craftable_items.items():\n if cs.craftable_scroll_page == counter:\n item_name = key\n counter += 1\nini... | <|body_start_0|>
if direction == 'left':
if cs.craftable_scroll_page > 0:
cs.craftable_scroll_page -= 1
else:
cs.craftable_scroll_page += 1
<|end_body_0|>
<|body_start_1|>
item_name = ''
counter = 0
for key, value in cs.craftable_items.ite... | Screen for the crafting menu | CraftingScreen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CraftingScreen:
"""Screen for the crafting menu"""
def scroll_craftables(self, direction):
"""Go up or down in the current inventory category page"""
<|body_0|>
def craft(self):
"""Craft the chosen item and remove used materials"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k_train_016803 | 1,696 | no_license | [
{
"docstring": "Go up or down in the current inventory category page",
"name": "scroll_craftables",
"signature": "def scroll_craftables(self, direction)"
},
{
"docstring": "Craft the chosen item and remove used materials",
"name": "craft",
"signature": "def craft(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005708 | Implement the Python class `CraftingScreen` described below.
Class description:
Screen for the crafting menu
Method signatures and docstrings:
- def scroll_craftables(self, direction): Go up or down in the current inventory category page
- def craft(self): Craft the chosen item and remove used materials | Implement the Python class `CraftingScreen` described below.
Class description:
Screen for the crafting menu
Method signatures and docstrings:
- def scroll_craftables(self, direction): Go up or down in the current inventory category page
- def craft(self): Craft the chosen item and remove used materials
<|skeleton|>... | 49918b9cb34d928d17460d2da6f026404a4c62fd | <|skeleton|>
class CraftingScreen:
"""Screen for the crafting menu"""
def scroll_craftables(self, direction):
"""Go up or down in the current inventory category page"""
<|body_0|>
def craft(self):
"""Craft the chosen item and remove used materials"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CraftingScreen:
"""Screen for the crafting menu"""
def scroll_craftables(self, direction):
"""Go up or down in the current inventory category page"""
if direction == 'left':
if cs.craftable_scroll_page > 0:
cs.craftable_scroll_page -= 1
else:
... | the_stack_v2_python_sparse | Implementation/PythonFiles/Screens/screen_crafting.py | IoanaParfene/Survive | train | 2 |
4992ca924ae1eda0db1eebd2229a64057548637c | [
"self._name = name or 'bond'\nif holiday_calendar is None:\n holiday_calendar = dates.create_holiday_calendar(weekend_mask=dates.WeekendMask.SATURDAY_SUNDAY)\nwith tf.name_scope(self._name):\n self._dtype = dtype\n self._settlement_date = dates.convert_to_date_tensor(settlement_date)\n self._maturity_da... | <|body_start_0|>
self._name = name or 'bond'
if holiday_calendar is None:
holiday_calendar = dates.create_holiday_calendar(weekend_mask=dates.WeekendMask.SATURDAY_SUNDAY)
with tf.name_scope(self._name):
self._dtype = dtype
self._settlement_date = dates.convert... | Represents a batch of fixed coupon bonds. Bonds are fixed income securities where the issuer makes periodic payments (or coupons) on a principal amount (also known as the face value) based on a fixed annualized interest rate. The payments are made periodically (for example quarterly or semi-annually) where the last pay... | Bond | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bond:
"""Represents a batch of fixed coupon bonds. Bonds are fixed income securities where the issuer makes periodic payments (or coupons) on a principal amount (also known as the face value) based on a fixed annualized interest rate. The payments are made periodically (for example quarterly or s... | stack_v2_sparse_classes_36k_train_016804 | 8,789 | permissive | [
{
"docstring": "Initialize a batch of fixed coupon bonds. Args: settlement_date: A rank 1 `DateTensor` specifying the settlement date of the bonds. maturity_date: A rank 1 `DateTensor` specifying the maturity dates of the bonds. The shape of the input should be the same as that of `settlement_date`. coupon_spec... | 3 | stack_v2_sparse_classes_30k_train_002387 | Implement the Python class `Bond` described below.
Class description:
Represents a batch of fixed coupon bonds. Bonds are fixed income securities where the issuer makes periodic payments (or coupons) on a principal amount (also known as the face value) based on a fixed annualized interest rate. The payments are made p... | Implement the Python class `Bond` described below.
Class description:
Represents a batch of fixed coupon bonds. Bonds are fixed income securities where the issuer makes periodic payments (or coupons) on a principal amount (also known as the face value) based on a fixed annualized interest rate. The payments are made p... | 0d3a2193c0f2d320b65e602cf01d7a617da484df | <|skeleton|>
class Bond:
"""Represents a batch of fixed coupon bonds. Bonds are fixed income securities where the issuer makes periodic payments (or coupons) on a principal amount (also known as the face value) based on a fixed annualized interest rate. The payments are made periodically (for example quarterly or s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bond:
"""Represents a batch of fixed coupon bonds. Bonds are fixed income securities where the issuer makes periodic payments (or coupons) on a principal amount (also known as the face value) based on a fixed annualized interest rate. The payments are made periodically (for example quarterly or semi-annually)... | the_stack_v2_python_sparse | tf_quant_finance/experimental/instruments/bond.py | google/tf-quant-finance | train | 4,165 |
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_36k_train_016805 | 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_val_000522 | 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_36k | 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 |
797fb86cf9178532e27180ac3077fb00ec8b66ae | [
"self.root = root\nself.stack = []\nself.first = False",
"if self.root is None:\n return False\nif self.first is False:\n return True\nnode = self.stack[-1]\nif node.right is not None:\n return True\nelse:\n i = len(self.stack) - 1\n while i > 0:\n if self.stack[i - 1].left == self.stack[i]:... | <|body_start_0|>
self.root = root
self.stack = []
self.first = False
<|end_body_0|>
<|body_start_1|>
if self.root is None:
return False
if self.first is False:
return True
node = self.stack[-1]
if node.right is not None:
return... | BSTIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def hasNext(self):
""":rtype: bool"""
<|body_1|>
def next(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.root = root
... | stack_v2_sparse_classes_36k_train_016806 | 1,929 | no_license | [
{
"docstring": ":type root: TreeNode",
"name": "__init__",
"signature": "def __init__(self, root)"
},
{
"docstring": ":rtype: bool",
"name": "hasNext",
"signature": "def hasNext(self)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_013268 | Implement the Python class `BSTIterator` described below.
Class description:
Implement the BSTIterator class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def hasNext(self): :rtype: bool
- def next(self): :rtype: int | Implement the Python class `BSTIterator` described below.
Class description:
Implement the BSTIterator class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def hasNext(self): :rtype: bool
- def next(self): :rtype: int
<|skeleton|>
class BSTIterator:
def __init__(self, root... | 8075fbb40987d5e6af8d30941a19fa48a3320f56 | <|skeleton|>
class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def hasNext(self):
""":rtype: bool"""
<|body_1|>
def next(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
self.root = root
self.stack = []
self.first = False
def hasNext(self):
""":rtype: bool"""
if self.root is None:
return False
if self.first is False:
return Tru... | the_stack_v2_python_sparse | p173/Solution.py | carwestsam/leetCode | train | 4 | |
f8a63997dcdb6c3e20c089ff5ff2ab99692e9ead | [
"self.host = host\nself.user = user\nself.password = password\nself.port = 22",
"try:\n t = paramiko.Transport((self.host, self.port))\n t.connect(username=self.user, password=self.password)\n sftp = paramiko.SFTPClient.from_transport(t)\nexcept:\n return (None, None)\nreturn (sftp, t)",
"myprint('r... | <|body_start_0|>
self.host = host
self.user = user
self.password = password
self.port = 22
<|end_body_0|>
<|body_start_1|>
try:
t = paramiko.Transport((self.host, self.port))
t.connect(username=self.user, password=self.password)
sftp = paramik... | upload file to remote host , or download file from remote host | SFTP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SFTP:
"""upload file to remote host , or download file from remote host"""
def __init__(self, host, user, password):
"""init host, user, password, and port default 22"""
<|body_0|>
def connect(self):
"""Connect remote host ,return sftp object"""
<|body_1|... | stack_v2_sparse_classes_36k_train_016807 | 8,680 | no_license | [
{
"docstring": "init host, user, password, and port default 22",
"name": "__init__",
"signature": "def __init__(self, host, user, password)"
},
{
"docstring": "Connect remote host ,return sftp object",
"name": "connect",
"signature": "def connect(self)"
},
{
"docstring": "upload ... | 4 | null | Implement the Python class `SFTP` described below.
Class description:
upload file to remote host , or download file from remote host
Method signatures and docstrings:
- def __init__(self, host, user, password): init host, user, password, and port default 22
- def connect(self): Connect remote host ,return sftp object... | Implement the Python class `SFTP` described below.
Class description:
upload file to remote host , or download file from remote host
Method signatures and docstrings:
- def __init__(self, host, user, password): init host, user, password, and port default 22
- def connect(self): Connect remote host ,return sftp object... | c77c8c4795f2b9359106836a4d2af38aafbf025c | <|skeleton|>
class SFTP:
"""upload file to remote host , or download file from remote host"""
def __init__(self, host, user, password):
"""init host, user, password, and port default 22"""
<|body_0|>
def connect(self):
"""Connect remote host ,return sftp object"""
<|body_1|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SFTP:
"""upload file to remote host , or download file from remote host"""
def __init__(self, host, user, password):
"""init host, user, password, and port default 22"""
self.host = host
self.user = user
self.password = password
self.port = 22
def connect(self... | the_stack_v2_python_sparse | Day10/src/myFabric.py | wenchong2008/learning | train | 0 |
8864d787ac7f07affc5a8a3c4d1380681d1c182f | [
"self.date = None\nself.start_serial_time = None\nself.end_serial_time = None\nself.transect_duration_sec = None\nself.ens_duration_sec = None",
"self.date = date_in\nself.start_serial_time = start_in\nself.end_serial_time = end_in\nself.transect_duration_sec = float(end_in - start_in)\nself.ens_duration_sec = en... | <|body_start_0|>
self.date = None
self.start_serial_time = None
self.end_serial_time = None
self.transect_duration_sec = None
self.ens_duration_sec = None
<|end_body_0|>
<|body_start_1|>
self.date = date_in
self.start_serial_time = start_in
self.end_seria... | This stores the date and time data in Python compatible format. Attributes ---------- date: str Measurement date as mm/dd/yyyy start_serial_time: float Python serial time for start of transect (seconds since 1/1/1970), timestamp end_serial_time: float Python serial time for end of transect (seconds since 1/1/1970), tim... | DateTime | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DateTime:
"""This stores the date and time data in Python compatible format. Attributes ---------- date: str Measurement date as mm/dd/yyyy start_serial_time: float Python serial time for start of transect (seconds since 1/1/1970), timestamp end_serial_time: float Python serial time for end of tr... | stack_v2_sparse_classes_36k_train_016808 | 3,086 | permissive | [
{
"docstring": "Initialize class and instance variables.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Populate data in object. Parameters ---------- date_in: str Measurement date as mm/dd/yyyy start_in: float Python serial time for start of transect. end_in: float P... | 3 | stack_v2_sparse_classes_30k_train_003437 | Implement the Python class `DateTime` described below.
Class description:
This stores the date and time data in Python compatible format. Attributes ---------- date: str Measurement date as mm/dd/yyyy start_serial_time: float Python serial time for start of transect (seconds since 1/1/1970), timestamp end_serial_time:... | Implement the Python class `DateTime` described below.
Class description:
This stores the date and time data in Python compatible format. Attributes ---------- date: str Measurement date as mm/dd/yyyy start_serial_time: float Python serial time for start of transect (seconds since 1/1/1970), timestamp end_serial_time:... | d82e18bcd8183c16ed2a9f57639933fac133624b | <|skeleton|>
class DateTime:
"""This stores the date and time data in Python compatible format. Attributes ---------- date: str Measurement date as mm/dd/yyyy start_serial_time: float Python serial time for start of transect (seconds since 1/1/1970), timestamp end_serial_time: float Python serial time for end of tr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DateTime:
"""This stores the date and time data in Python compatible format. Attributes ---------- date: str Measurement date as mm/dd/yyyy start_serial_time: float Python serial time for start of transect (seconds since 1/1/1970), timestamp end_serial_time: float Python serial time for end of transect (secon... | the_stack_v2_python_sparse | Classes/DateTime.py | ricorx7/QRevPy | train | 0 |
0c0057735c8aed188032bf401b29a37aca7c081e | [
"self.key = settings.PERMISSION_KEY\nself.mode = AES.MODE_ECB\nself.prefix = settings.PERMISSION_PREFIX",
"length = 32\nif len(text) > length:\n return ''\ntext = ''.join(random.sample(self.prefix, length - len(text))) + text\nencryptor = AES.new(self.key, self.mode)\ncurrent_time = time.time()\nself.save_to_a... | <|body_start_0|>
self.key = settings.PERMISSION_KEY
self.mode = AES.MODE_ECB
self.prefix = settings.PERMISSION_PREFIX
<|end_body_0|>
<|body_start_1|>
length = 32
if len(text) > length:
return ''
text = ''.join(random.sample(self.prefix, length - len(text))) +... | preceeding class for AuthList | KSMP_Permission | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KSMP_Permission:
"""preceeding class for AuthList"""
def __init__(self):
"""initiate object properties"""
<|body_0|>
def set_permission(self, text):
"""params: text allways is username 16*n bytes return: encoded auth code"""
<|body_1|>
def get_permis... | stack_v2_sparse_classes_36k_train_016809 | 2,888 | no_license | [
{
"docstring": "initiate object properties",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "params: text allways is username 16*n bytes return: encoded auth code",
"name": "set_permission",
"signature": "def set_permission(self, text)"
},
{
"docstring": ... | 6 | stack_v2_sparse_classes_30k_train_014656 | Implement the Python class `KSMP_Permission` described below.
Class description:
preceeding class for AuthList
Method signatures and docstrings:
- def __init__(self): initiate object properties
- def set_permission(self, text): params: text allways is username 16*n bytes return: encoded auth code
- def get_permission... | Implement the Python class `KSMP_Permission` described below.
Class description:
preceeding class for AuthList
Method signatures and docstrings:
- def __init__(self): initiate object properties
- def set_permission(self, text): params: text allways is username 16*n bytes return: encoded auth code
- def get_permission... | 7f801a569a396a27371d0831752595877c224a6b | <|skeleton|>
class KSMP_Permission:
"""preceeding class for AuthList"""
def __init__(self):
"""initiate object properties"""
<|body_0|>
def set_permission(self, text):
"""params: text allways is username 16*n bytes return: encoded auth code"""
<|body_1|>
def get_permis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KSMP_Permission:
"""preceeding class for AuthList"""
def __init__(self):
"""initiate object properties"""
self.key = settings.PERMISSION_KEY
self.mode = AES.MODE_ECB
self.prefix = settings.PERMISSION_PREFIX
def set_permission(self, text):
"""params: text allwa... | the_stack_v2_python_sparse | Python_projects/flask_projects/unicorn_project/session/permission.py | sdtimothy8/Coding | train | 0 |
6449243f07327101a2eaa009506ec67d49b74395 | [
"try:\n user = User.objects.get(pk=data)\nexcept User.DoesNotExist:\n raise serializers.ValidationError('Invalid passenger')\ncircle = self.context['circle']\ntry:\n membership = Membership.objects.get(user=user, circle=circle, is_active=True)\nexcept Membership.DoesNotExists:\n raise serializers.Valida... | <|body_start_0|>
try:
user = User.objects.get(pk=data)
except User.DoesNotExist:
raise serializers.ValidationError('Invalid passenger')
circle = self.context['circle']
try:
membership = Membership.objects.get(user=user, circle=circle, is_active=True)
... | Join Ride Serializer. | JoinRideSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JoinRideSerializer:
"""Join Ride Serializer."""
def validate_passenger(self, data):
"""Verify passenger exists and is a circle member."""
<|body_0|>
def validate(self, data):
"""Verify rides allow new passengers."""
<|body_1|>
def update(self, instan... | stack_v2_sparse_classes_36k_train_016810 | 5,840 | permissive | [
{
"docstring": "Verify passenger exists and is a circle member.",
"name": "validate_passenger",
"signature": "def validate_passenger(self, data)"
},
{
"docstring": "Verify rides allow new passengers.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": ... | 3 | stack_v2_sparse_classes_30k_train_010978 | Implement the Python class `JoinRideSerializer` described below.
Class description:
Join Ride Serializer.
Method signatures and docstrings:
- def validate_passenger(self, data): Verify passenger exists and is a circle member.
- def validate(self, data): Verify rides allow new passengers.
- def update(self, instance, ... | Implement the Python class `JoinRideSerializer` described below.
Class description:
Join Ride Serializer.
Method signatures and docstrings:
- def validate_passenger(self, data): Verify passenger exists and is a circle member.
- def validate(self, data): Verify rides allow new passengers.
- def update(self, instance, ... | 642576deaf569663d5dbc0d5820cfbc49c17fd2e | <|skeleton|>
class JoinRideSerializer:
"""Join Ride Serializer."""
def validate_passenger(self, data):
"""Verify passenger exists and is a circle member."""
<|body_0|>
def validate(self, data):
"""Verify rides allow new passengers."""
<|body_1|>
def update(self, instan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JoinRideSerializer:
"""Join Ride Serializer."""
def validate_passenger(self, data):
"""Verify passenger exists and is a circle member."""
try:
user = User.objects.get(pk=data)
except User.DoesNotExist:
raise serializers.ValidationError('Invalid passenger')
... | the_stack_v2_python_sparse | cride/rides/serializers/rides.py | stalinch98/Advanced_Django | train | 2 |
94fb0df41205889150d3492c1f6b46c08a3b3503 | [
"send_str = ''\nfor s in strs:\n len_s = len(s)\n len_int = len(str(len_s))\n send_str += '0' * (4 - len_int) + str(len_s) + s\nreturn send_str",
"receive_strs = []\np = 0\nwhile p < len(s):\n len_s = int(s[p:p + 4])\n ss = s[p + 4:p + len_s + 4]\n receive_strs.append(ss)\n p = p + len_s + 4\... | <|body_start_0|>
send_str = ''
for s in strs:
len_s = len(s)
len_int = len(str(len_s))
send_str += '0' * (4 - len_int) + str(len_s) + s
return send_str
<|end_body_0|>
<|body_start_1|>
receive_strs = []
p = 0
while p < len(s):
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_016811 | 891 | no_license | [
{
"docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str",
"name": "encode",
"signature": "def encode(self, strs)"
},
{
"docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]",
"name": "decode",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_000486 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | d3b5128291906069c8ee477b9834a633c70c440f | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
send_str = ''
for s in strs:
len_s = len(s)
len_int = len(str(len_s))
send_str += '0' * (4 - len_int) + str(len_s) + s
return... | the_stack_v2_python_sparse | submission/python/python/0271.py | FoxerLee/Leetcode | train | 1 | |
96bd0c9246a0692c905e7b20da948804fe63c2d8 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AuditResource()",
"from .audit_property import AuditProperty\nfrom .audit_property import AuditProperty\nfields: Dict[str, Callable[[Any], None]] = {'auditResourceType': lambda n: setattr(self, 'audit_resource_type', n.get_str_value())... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return AuditResource()
<|end_body_0|>
<|body_start_1|>
from .audit_property import AuditProperty
from .audit_property import AuditProperty
fields: Dict[str, Callable[[Any], None]] = {'a... | A class containing the properties for Audit Resource. | AuditResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuditResource:
"""A class containing the properties for Audit Resource."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuditResource:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to u... | stack_v2_sparse_classes_36k_train_016812 | 3,477 | 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: AuditResource",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value... | 3 | stack_v2_sparse_classes_30k_train_011994 | Implement the Python class `AuditResource` described below.
Class description:
A class containing the properties for Audit Resource.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuditResource: Creates a new instance of the appropriate class based on ... | Implement the Python class `AuditResource` described below.
Class description:
A class containing the properties for Audit Resource.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuditResource: Creates a new instance of the appropriate class based on ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AuditResource:
"""A class containing the properties for Audit Resource."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuditResource:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to u... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuditResource:
"""A class containing the properties for Audit Resource."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuditResource:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read th... | the_stack_v2_python_sparse | msgraph/generated/models/audit_resource.py | microsoftgraph/msgraph-sdk-python | train | 135 |
18a986925e2e8bf1b4f45ec1f4cdc3312485112d | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | The greeting service definition. | GreeterServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GreeterServicer:
"""The greeting service definition."""
def SayHello(self, request, context):
"""Sends a greeting"""
<|body_0|>
def SayHelloAgain(self, request, context):
"""Sends another greeting"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_016813 | 2,740 | permissive | [
{
"docstring": "Sends a greeting",
"name": "SayHello",
"signature": "def SayHello(self, request, context)"
},
{
"docstring": "Sends another greeting",
"name": "SayHelloAgain",
"signature": "def SayHelloAgain(self, request, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012889 | Implement the Python class `GreeterServicer` described below.
Class description:
The greeting service definition.
Method signatures and docstrings:
- def SayHello(self, request, context): Sends a greeting
- def SayHelloAgain(self, request, context): Sends another greeting | Implement the Python class `GreeterServicer` described below.
Class description:
The greeting service definition.
Method signatures and docstrings:
- def SayHello(self, request, context): Sends a greeting
- def SayHelloAgain(self, request, context): Sends another greeting
<|skeleton|>
class GreeterServicer:
"""T... | 44e819e713c3885e38c99c16dc73b7d7478acfe8 | <|skeleton|>
class GreeterServicer:
"""The greeting service definition."""
def SayHello(self, request, context):
"""Sends a greeting"""
<|body_0|>
def SayHelloAgain(self, request, context):
"""Sends another greeting"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GreeterServicer:
"""The greeting service definition."""
def SayHello(self, request, context):
"""Sends a greeting"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def... | the_stack_v2_python_sparse | endpoints/getting-started-grpc/helloworld_pb2_grpc.py | GoogleCloudPlatform/python-docs-samples | train | 7,035 |
50a2241e571b188277e4497d3c0965683db3acda | [
"Thread.__init__(self)\nself.queue = queue\nself.daemon = True\nself.start()",
"while True:\n func, args, kargs, result = self.queue.get()\n try:\n val = func(*args, **kargs)\n result.put(val, False)\n except Exception as e:\n LOGGER.exception(e)\n result.put(e, True)\n fin... | <|body_start_0|>
Thread.__init__(self)
self.queue = queue
self.daemon = True
self.start()
<|end_body_0|>
<|body_start_1|>
while True:
func, args, kargs, result = self.queue.get()
try:
val = func(*args, **kargs)
result.put(v... | Thread executing callables from queue. | Worker | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Worker:
"""Thread executing callables from queue."""
def __init__(self, queue):
"""Initalize. Args: queue (Queue): A queue."""
<|body_0|>
def run(self):
"""Run the worker."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Thread.__init__(self)
... | stack_v2_sparse_classes_36k_train_016814 | 3,470 | permissive | [
{
"docstring": "Initalize. Args: queue (Queue): A queue.",
"name": "__init__",
"signature": "def __init__(self, queue)"
},
{
"docstring": "Run the worker.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | null | Implement the Python class `Worker` described below.
Class description:
Thread executing callables from queue.
Method signatures and docstrings:
- def __init__(self, queue): Initalize. Args: queue (Queue): A queue.
- def run(self): Run the worker. | Implement the Python class `Worker` described below.
Class description:
Thread executing callables from queue.
Method signatures and docstrings:
- def __init__(self, queue): Initalize. Args: queue (Queue): A queue.
- def run(self): Run the worker.
<|skeleton|>
class Worker:
"""Thread executing callables from que... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class Worker:
"""Thread executing callables from queue."""
def __init__(self, queue):
"""Initalize. Args: queue (Queue): A queue."""
<|body_0|>
def run(self):
"""Run the worker."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Worker:
"""Thread executing callables from queue."""
def __init__(self, queue):
"""Initalize. Args: queue (Queue): A queue."""
Thread.__init__(self)
self.queue = queue
self.daemon = True
self.start()
def run(self):
"""Run the worker."""
while T... | the_stack_v2_python_sparse | google/cloud/forseti/common/util/threadpool.py | kevensen/forseti-security | train | 1 |
d7abfe5ff429b3d5fd8ffcbbb3960273d88b767f | [
"form = FormService.get_by_id(form_id)\nif form is None:\n raise BadRequest('No such form')\nform_field = FormFieldService.get_by_id(form_field_id)\nif form_field is None:\n raise BadRequest(\"There's no field with this ID\")\nif form_field.form_id != form.id:\n raise BadRequest('This field does not belong... | <|body_start_0|>
form = FormService.get_by_id(form_id)
if form is None:
raise BadRequest('No such form')
form_field = FormFieldService.get_by_id(form_field_id)
if form_field is None:
raise BadRequest("There's no field with this ID")
if form_field.form_id !... | FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete | FormFieldAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormFieldAPI:
"""FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete"""
def get(self, form_id, form_field_id):
"""Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form"""
<|body_0|... | stack_v2_sparse_classes_36k_train_016815 | 10,042 | no_license | [
{
"docstring": "Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form",
"name": "get",
"signature": "def get(self, form_id, form_field_id)"
},
{
"docstring": "Update field within a form :param form_id: ID of the form :param form_field_... | 3 | stack_v2_sparse_classes_30k_train_020414 | Implement the Python class `FormFieldAPI` described below.
Class description:
FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete
Method signatures and docstrings:
- def get(self, form_id, form_field_id): Get field from a form :param form_id: ID of the form :param form_field_id: ID ... | Implement the Python class `FormFieldAPI` described below.
Class description:
FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete
Method signatures and docstrings:
- def get(self, form_id, form_field_id): Get field from a form :param form_id: ID of the form :param form_field_id: ID ... | 7344e4bd1cc977781b35a2ad1b38ff0d270163b7 | <|skeleton|>
class FormFieldAPI:
"""FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete"""
def get(self, form_id, form_field_id):
"""Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form"""
<|body_0|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FormFieldAPI:
"""FormField api url: '/forms/{form_id}/fields/{form_field_id}' methods: get, put, delete"""
def get(self, form_id, form_field_id):
"""Get field from a form :param form_id: ID of the form :param form_field_id: ID of the field contained within a form"""
form = FormService.get... | the_stack_v2_python_sparse | src/app/routers/form_field.py | Lv-474-Python/ngfg | train | 0 |
35aba2df40eeff2793ccfa02505ad40fda7e51a3 | [
"n = len(regular)\nOFFSET = 2 * n\nadjMap = defaultdict(lambda: defaultdict(lambda: INF))\nfor pre, cur in pairwise(range(n + 1)):\n adjMap[pre][cur] = regular[pre]\n adjMap[pre][pre + OFFSET] = expressCost\n adjMap[pre + OFFSET][pre] = 0\n adjMap[pre + OFFSET][cur + OFFSET] = express[pre]\ndist = defau... | <|body_start_0|>
n = len(regular)
OFFSET = 2 * n
adjMap = defaultdict(lambda: defaultdict(lambda: INF))
for pre, cur in pairwise(range(n + 1)):
adjMap[pre][cur] = regular[pre]
adjMap[pre][pre + OFFSET] = expressCost
adjMap[pre + OFFSET][pre] = 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]:
"""注意到原图有环,所以通用的方法是 dijkstra 求最短路"""
<|body_0|>
def minimumCosts2(self, A: List[int], B: List[int], C: int) -> List[int]:
"""将每个车站视为一个点(缩点),那么转移就是拓扑序dp了"""
... | stack_v2_sparse_classes_36k_train_016816 | 2,105 | no_license | [
{
"docstring": "注意到原图有环,所以通用的方法是 dijkstra 求最短路",
"name": "minimumCosts",
"signature": "def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]"
},
{
"docstring": "将每个车站视为一个点(缩点),那么转移就是拓扑序dp了",
"name": "minimumCosts2",
"signature": "def minimumCosts2(... | 2 | stack_v2_sparse_classes_30k_train_010744 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: 注意到原图有环,所以通用的方法是 dijkstra 求最短路
- def minimumCosts2(self, A: List[int], B: List[int]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]: 注意到原图有环,所以通用的方法是 dijkstra 求最短路
- def minimumCosts2(self, A: List[int], B: List[int]... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]:
"""注意到原图有环,所以通用的方法是 dijkstra 求最短路"""
<|body_0|>
def minimumCosts2(self, A: List[int], B: List[int], C: int) -> List[int]:
"""将每个车站视为一个点(缩点),那么转移就是拓扑序dp了"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minimumCosts(self, regular: List[int], express: List[int], expressCost: int) -> List[int]:
"""注意到原图有环,所以通用的方法是 dijkstra 求最短路"""
n = len(regular)
OFFSET = 2 * n
adjMap = defaultdict(lambda: defaultdict(lambda: INF))
for pre, cur in pairwise(range(n + 1)):
... | the_stack_v2_python_sparse | 11_动态规划/dp分类/线性dp/2361. Minimum Costs Using the Train Line-火车站问题.py | 981377660LMT/algorithm-study | train | 225 | |
766be83cc655ff0b53c0855b1d6f963f1da1f34b | [
"json_data = data()\ntry:\n parameter = loads(json_data)\nexcept ValueError:\n raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')\ntry:\n bytes = parameter['bytes']\nexcept KeyError as exception:\n if exception.args[0] == 'type':\n raise generate_http_error(40... | <|body_start_0|>
json_data = data()
try:
parameter = loads(json_data)
except ValueError:
raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')
try:
bytes = parameter['bytes']
except KeyError as exception:
... | AccountLimit | LocalAccountLimit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalAccountLimit:
"""AccountLimit"""
def POST(self, account, rse):
"""Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Auth-Account: Account identifier. :param X-Rucio-Auth-Token... | stack_v2_sparse_classes_36k_train_016817 | 7,903 | permissive | [
{
"docstring": "Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Auth-Account: Account identifier. :param X-Rucio-Auth-Token: As an 32 character hex string. :param account: Account name. :param rse: RSE name... | 2 | null | Implement the Python class `LocalAccountLimit` described below.
Class description:
AccountLimit
Method signatures and docstrings:
- def POST(self, account, rse): Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Au... | Implement the Python class `LocalAccountLimit` described below.
Class description:
AccountLimit
Method signatures and docstrings:
- def POST(self, account, rse): Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Au... | bf33d9441d3b4ff160a392eed56724f635a03fe6 | <|skeleton|>
class LocalAccountLimit:
"""AccountLimit"""
def POST(self, account, rse):
"""Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Auth-Account: Account identifier. :param X-Rucio-Auth-Token... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalAccountLimit:
"""AccountLimit"""
def POST(self, account, rse):
"""Create or update an account limit. HTTP Success: 201 Created HTTP Error: 400 Bad Request 401 Unauthorized 404 Not Found 500 Internal Error :param X-Rucio-Auth-Account: Account identifier. :param X-Rucio-Auth-Token: As an 32 ch... | the_stack_v2_python_sparse | lib/rucio/web/rest/webpy/v1/account_limit.py | viveknigam3003/rucio | train | 1 |
17a72335b0bb0fafd28aea427463b994b9be72be | [
"self.mq = []\nself.mc = 0\nself.sq = []\nself.sc = 0",
"if self.mc == 0:\n heappush(self.mq, -num)\n self.mc += 1\n return\nif self.sc == 0:\n self.sc += 1\n if num < -self.mq[0]:\n tmp = heappop(self.mq)\n heappush(self.sq, -tmp)\n heappush(self.mq, -num)\n else:\n ... | <|body_start_0|>
self.mq = []
self.mc = 0
self.sq = []
self.sc = 0
<|end_body_0|>
<|body_start_1|>
if self.mc == 0:
heappush(self.mq, -num)
self.mc += 1
return
if self.sc == 0:
self.sc += 1
if num < -self.mq[0]:... | MedianFinder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: void"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_016818 | 2,285 | no_license | [
{
"docstring": "initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type num: int :rtype: void",
"name": "addNum",
"signature": "def addNum(self, num)"
},
{
"docstring": ":rtype: float",
"name": "findMedian",
"s... | 3 | null | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: void
- def findMedian(self): :rtype: float | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: void
- def findMedian(self): :rtype: float
<|skeleton|>
class Me... | 690adf05774a1c500d6c9160223dab7bcc38ccc1 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: void"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
self.mq = []
self.mc = 0
self.sq = []
self.sc = 0
def addNum(self, num):
""":type num: int :rtype: void"""
if self.mc == 0:
heappush(self.mq, -num)
... | the_stack_v2_python_sparse | 295. Find Median from Data Stream.py | supersj/LeetCode | train | 2 | |
4dc16a5d39996a53ca72a26386ae91c277faf7a7 | [
"timestamp, instrument_string = self._parse_timestamp(original_data)\nif timestamp:\n if self.next_decorator == None:\n return (original_data, chained_data)\n else:\n self.next_decorator.handle_incoming_data(original_data, chained_data)\nelse:\n raise InstrumentDataException(error_code=InstEr... | <|body_start_0|>
timestamp, instrument_string = self._parse_timestamp(original_data)
if timestamp:
if self.next_decorator == None:
return (original_data, chained_data)
else:
self.next_decorator.handle_incoming_data(original_data, chained_data)
... | A decorator that decodes RSN timestamps in the data stream The decorator decodes timestamps from the data stream and does the appropriate thing with them down the line. This may involve modifying the chained_data parameter. | RSNTimestampDecorator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RSNTimestampDecorator:
"""A decorator that decodes RSN timestamps in the data stream The decorator decodes timestamps from the data stream and does the appropriate thing with them down the line. This may involve modifying the chained_data parameter."""
def handle_incoming_data(self, original... | stack_v2_sparse_classes_36k_train_016819 | 5,922 | no_license | [
{
"docstring": "Pulls timestamp out of the original_data argument",
"name": "handle_incoming_data",
"signature": "def handle_incoming_data(self, original_data=None, chained_data=None)"
},
{
"docstring": "Parse a string to see if it matches the given regex. If so, get the timestamp out and return... | 2 | stack_v2_sparse_classes_30k_train_005912 | Implement the Python class `RSNTimestampDecorator` described below.
Class description:
A decorator that decodes RSN timestamps in the data stream The decorator decodes timestamps from the data stream and does the appropriate thing with them down the line. This may involve modifying the chained_data parameter.
Method ... | Implement the Python class `RSNTimestampDecorator` described below.
Class description:
A decorator that decodes RSN timestamps in the data stream The decorator decodes timestamps from the data stream and does the appropriate thing with them down the line. This may involve modifying the chained_data parameter.
Method ... | 1d5dbd711b9e5e26837aa1e737124605bdd606e4 | <|skeleton|>
class RSNTimestampDecorator:
"""A decorator that decodes RSN timestamps in the data stream The decorator decodes timestamps from the data stream and does the appropriate thing with them down the line. This may involve modifying the chained_data parameter."""
def handle_incoming_data(self, original... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RSNTimestampDecorator:
"""A decorator that decodes RSN timestamps in the data stream The decorator decodes timestamps from the data stream and does the appropriate thing with them down the line. This may involve modifying the chained_data parameter."""
def handle_incoming_data(self, original_data=None, c... | the_stack_v2_python_sparse | ion/agents/instrument/data_decorator.py | ooici-dm/coi-services | train | 4 |
3e6c5418e3d758fa7ba00ad034288c3e2eaacf06 | [
"self.entity_description = description\nslug = slugify(description.key.replace('/', '_'))\nself.entity_id = f'sensor.{slug}'",
"@callback\ndef message_received(message):\n \"\"\"Handle new MQTT messages.\"\"\"\n if self.entity_description.state is not None:\n self._attr_native_value = self.entity_des... | <|body_start_0|>
self.entity_description = description
slug = slugify(description.key.replace('/', '_'))
self.entity_id = f'sensor.{slug}'
<|end_body_0|>
<|body_start_1|>
@callback
def message_received(message):
"""Handle new MQTT messages."""
if self.ent... | Representation of a DSMR sensor that is updated via MQTT. | DSMRSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DSMRSensor:
"""Representation of a DSMR sensor that is updated via MQTT."""
def __init__(self, description: DSMRReaderSensorEntityDescription) -> None:
"""Initialize the sensor."""
<|body_0|>
async def async_added_to_hass(self):
"""Subscribe to MQTT events."""
... | stack_v2_sparse_classes_36k_train_016820 | 1,510 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, description: DSMRReaderSensorEntityDescription) -> None"
},
{
"docstring": "Subscribe to MQTT events.",
"name": "async_added_to_hass",
"signature": "async def async_added_to_hass(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005601 | Implement the Python class `DSMRSensor` described below.
Class description:
Representation of a DSMR sensor that is updated via MQTT.
Method signatures and docstrings:
- def __init__(self, description: DSMRReaderSensorEntityDescription) -> None: Initialize the sensor.
- async def async_added_to_hass(self): Subscribe ... | Implement the Python class `DSMRSensor` described below.
Class description:
Representation of a DSMR sensor that is updated via MQTT.
Method signatures and docstrings:
- def __init__(self, description: DSMRReaderSensorEntityDescription) -> None: Initialize the sensor.
- async def async_added_to_hass(self): Subscribe ... | 8de7966104911bca6f855a1755a6d71a07afb9de | <|skeleton|>
class DSMRSensor:
"""Representation of a DSMR sensor that is updated via MQTT."""
def __init__(self, description: DSMRReaderSensorEntityDescription) -> None:
"""Initialize the sensor."""
<|body_0|>
async def async_added_to_hass(self):
"""Subscribe to MQTT events."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DSMRSensor:
"""Representation of a DSMR sensor that is updated via MQTT."""
def __init__(self, description: DSMRReaderSensorEntityDescription) -> None:
"""Initialize the sensor."""
self.entity_description = description
slug = slugify(description.key.replace('/', '_'))
self... | the_stack_v2_python_sparse | homeassistant/components/dsmr_reader/sensor.py | AlexxIT/home-assistant | train | 9 |
a0fbfd71c4c5e2facae06d5f226181f92e29c5dd | [
"output = []\naccounts = []\nfor x in ids:\n if x not in accounts:\n accounts.append(x)\n else:\n output.append(x)\nreturn output",
"if context is None:\n context = {}\ndata = self.read(cr, uid, ids, context=context)[0]\nobj_account = self.pool.get('account.account')\nchild_ids = obj_accoun... | <|body_start_0|>
output = []
accounts = []
for x in ids:
if x not in accounts:
accounts.append(x)
else:
output.append(x)
return output
<|end_body_0|>
<|body_start_1|>
if context is None:
context = {}
dat... | This model to update consolidation chart of account and validate the account not belong in consolidate accounts | account_tree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_tree:
"""This model to update consolidation chart of account and validate the account not belong in consolidate accounts"""
def uniq(self, cr, uid, ids):
"""Get account id from all charts of account @return: List of account ids"""
<|body_0|>
def validate_move(sel... | stack_v2_sparse_classes_36k_train_016821 | 4,112 | no_license | [
{
"docstring": "Get account id from all charts of account @return: List of account ids",
"name": "uniq",
"signature": "def uniq(self, cr, uid, ids)"
},
{
"docstring": "Validate all accounts belong in consolidation account or not @return: dictionary of values",
"name": "validate_move",
"s... | 3 | stack_v2_sparse_classes_30k_train_002764 | Implement the Python class `account_tree` described below.
Class description:
This model to update consolidation chart of account and validate the account not belong in consolidate accounts
Method signatures and docstrings:
- def uniq(self, cr, uid, ids): Get account id from all charts of account @return: List of acc... | Implement the Python class `account_tree` described below.
Class description:
This model to update consolidation chart of account and validate the account not belong in consolidate accounts
Method signatures and docstrings:
- def uniq(self, cr, uid, ids): Get account id from all charts of account @return: List of acc... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class account_tree:
"""This model to update consolidation chart of account and validate the account not belong in consolidate accounts"""
def uniq(self, cr, uid, ids):
"""Get account id from all charts of account @return: List of account ids"""
<|body_0|>
def validate_move(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class account_tree:
"""This model to update consolidation chart of account and validate the account not belong in consolidate accounts"""
def uniq(self, cr, uid, ids):
"""Get account id from all charts of account @return: List of account ids"""
output = []
accounts = []
for x in... | the_stack_v2_python_sparse | v_7/GDS/common_shamil_v3/account_custom/wizard/account_tree.py | musabahmed/baba | train | 0 |
766c6b3798e19b1ae42a131b7dcde7b1ffbec1c0 | [
"serialized_rule = serialize(rule, request.user, RuleSerializer(request.GET.getlist('expand', [])))\nerrors = []\nfor action in serialized_rule.get('actions', []):\n if action.get('_sentry_app_installation') and action.get('_sentry_app_component'):\n installation = SentryAppInstallation(**action.get('_sen... | <|body_start_0|>
serialized_rule = serialize(rule, request.user, RuleSerializer(request.GET.getlist('expand', [])))
errors = []
for action in serialized_rule.get('actions', []):
if action.get('_sentry_app_installation') and action.get('_sentry_app_component'):
install... | ProjectRuleDetailsEndpoint | [
"Apache-2.0",
"BUSL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectRuleDetailsEndpoint:
def get(self, request: Request, project, rule) -> Response:
"""Retrieve a rule Return details on an individual rule. {method} {path}"""
<|body_0|>
def put(self, request: Request, project, rule) -> Response:
"""Update a rule Update various ... | stack_v2_sparse_classes_36k_train_016822 | 7,186 | permissive | [
{
"docstring": "Retrieve a rule Return details on an individual rule. {method} {path}",
"name": "get",
"signature": "def get(self, request: Request, project, rule) -> Response"
},
{
"docstring": "Update a rule Update various attributes for the given rule. {method} {path} {{ \"name\": \"My rule n... | 3 | null | Implement the Python class `ProjectRuleDetailsEndpoint` described below.
Class description:
Implement the ProjectRuleDetailsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project, rule) -> Response: Retrieve a rule Return details on an individual rule. {method} {path}
- def put(se... | Implement the Python class `ProjectRuleDetailsEndpoint` described below.
Class description:
Implement the ProjectRuleDetailsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project, rule) -> Response: Retrieve a rule Return details on an individual rule. {method} {path}
- def put(se... | d9dd4f382f96b5c4576b64cbf015db651556c18b | <|skeleton|>
class ProjectRuleDetailsEndpoint:
def get(self, request: Request, project, rule) -> Response:
"""Retrieve a rule Return details on an individual rule. {method} {path}"""
<|body_0|>
def put(self, request: Request, project, rule) -> Response:
"""Update a rule Update various ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectRuleDetailsEndpoint:
def get(self, request: Request, project, rule) -> Response:
"""Retrieve a rule Return details on an individual rule. {method} {path}"""
serialized_rule = serialize(rule, request.user, RuleSerializer(request.GET.getlist('expand', [])))
errors = []
for... | the_stack_v2_python_sparse | src/sentry/api/endpoints/project_rule_details.py | nagyist/sentry | train | 0 | |
fa2751a9294b848831347ed228b6789c8d9406e2 | [
"if isinstance(user, int):\n userinfo = await self.db.users.find_one({'user_id': str(user)})\n if not userinfo:\n await ctx.send('Discord user with ID `{}` not found.'.format(user))\n return\n user = discord.Object(user)\nchat_block = time.time() + bantime.total_seconds()\ntry:\n await sel... | <|body_start_0|>
if isinstance(user, int):
userinfo = await self.db.users.find_one({'user_id': str(user)})
if not userinfo:
await ctx.send('Discord user with ID `{}` not found.'.format(user))
return
user = discord.Object(user)
chat_bloc... | User-related administration commands | Users | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Users:
"""User-related administration commands"""
async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]):
"""Ban user from getting experience."""
<|body_0|>
async def setlevel(self, ctx, user:... | stack_v2_sparse_classes_36k_train_016823 | 2,971 | permissive | [
{
"docstring": "Ban user from getting experience.",
"name": "xpban",
"signature": "async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int])"
},
{
"docstring": "Set a user's level manually.",
"name": "setlevel",
... | 2 | stack_v2_sparse_classes_30k_test_000303 | Implement the Python class `Users` described below.
Class description:
User-related administration commands
Method signatures and docstrings:
- async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]): Ban user from getting experience.
- asy... | Implement the Python class `Users` described below.
Class description:
User-related administration commands
Method signatures and docstrings:
- async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]): Ban user from getting experience.
- asy... | c977b1d127629b858235b23dd86e5fe0756d1edb | <|skeleton|>
class Users:
"""User-related administration commands"""
async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]):
"""Ban user from getting experience."""
<|body_0|>
async def setlevel(self, ctx, user:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Users:
"""User-related administration commands"""
async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]):
"""Ban user from getting experience."""
if isinstance(user, int):
userinfo = await self.db.u... | the_stack_v2_python_sparse | leveler/commands/lvladmin/users.py | fixator10/Fixator10-Cogs | train | 90 |
531328a7203522f625b1e1d7157e9d0d3de657c3 | [
"self._claim_embedding_path = claim_embedding_path\nself._claim_id_path = claim_id_path\nself._wiki_embedding_dir = wiki_embedding_dir\nself._n_shards = n_shards\nself._batch_size = batch_size\nself._l2_norm = l2_norm\nself._copy_to_tmp = copy_to_tmp\nself._device = device\nself._wiki_embeddings: Optional[tf.Tensor... | <|body_start_0|>
self._claim_embedding_path = claim_embedding_path
self._claim_id_path = claim_id_path
self._wiki_embedding_dir = wiki_embedding_dir
self._n_shards = n_shards
self._batch_size = batch_size
self._l2_norm = l2_norm
self._copy_to_tmp = copy_to_tmp
... | Index that can be used for brute for neighbor search. | Index | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Index:
"""Index that can be used for brute for neighbor search."""
def __init__(self, *, claim_embedding_path, claim_id_path, wiki_embedding_dir, n_shards, copy_to_tmp, device='/CPU:0', batch_size=256, l2_norm=False):
"""Configure index. Claim ids and embeddings are related through t... | stack_v2_sparse_classes_36k_train_016824 | 14,914 | permissive | [
{
"docstring": "Configure index. Claim ids and embeddings are related through their position (eg, first embedding corresponds to first id). Args: claim_embedding_path: Path to claim embeddings claim_id_path: Path to claim ids wiki_embedding_dir: Directory of .npy embedding files n_shards: Number of shards to re... | 5 | null | Implement the Python class `Index` described below.
Class description:
Index that can be used for brute for neighbor search.
Method signatures and docstrings:
- def __init__(self, *, claim_embedding_path, claim_id_path, wiki_embedding_dir, n_shards, copy_to_tmp, device='/CPU:0', batch_size=256, l2_norm=False): Config... | Implement the Python class `Index` described below.
Class description:
Index that can be used for brute for neighbor search.
Method signatures and docstrings:
- def __init__(self, *, claim_embedding_path, claim_id_path, wiki_embedding_dir, n_shards, copy_to_tmp, device='/CPU:0', batch_size=256, l2_norm=False): Config... | ac9447064195e06de48cc91ff642f7fffa28ffe8 | <|skeleton|>
class Index:
"""Index that can be used for brute for neighbor search."""
def __init__(self, *, claim_embedding_path, claim_id_path, wiki_embedding_dir, n_shards, copy_to_tmp, device='/CPU:0', batch_size=256, l2_norm=False):
"""Configure index. Claim ids and embeddings are related through t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Index:
"""Index that can be used for brute for neighbor search."""
def __init__(self, *, claim_embedding_path, claim_id_path, wiki_embedding_dir, n_shards, copy_to_tmp, device='/CPU:0', batch_size=256, l2_norm=False):
"""Configure index. Claim ids and embeddings are related through their position... | the_stack_v2_python_sparse | language/serene/wiki_index.py | google-research/language | train | 1,567 |
49a2a02e594b2b0ccd9629a6cbfe124cef682943 | [
"if prefix == 'schema' or Schema.get(id=prefix, ignore=404):\n self.set_status(200)\nelse:\n self.set_status(404)",
"args = json_decode(self.request.body)\nprefix = args['namespace']\nurl = args['url']\nassert prefix != 'schema', 'cannot rewrite core schema.'\nif Schema.get(id=prefix, ignore=404):\n self... | <|body_start_0|>
if prefix == 'schema' or Schema.get(id=prefix, ignore=404):
self.set_status(200)
else:
self.set_status(404)
<|end_body_0|>
<|body_start_1|>
args = json_decode(self.request.body)
prefix = args['namespace']
url = args['url']
assert ... | Registered Schema Repository Check - HEAD ./api/registry/<schema> Create - POST ./api/registry Fetch - GET ./api/registry Fetch - GET ./api/registry?user=<username> Fetch - GET ./api/registry/<schema>/<class> Remove - DELETE ./api/registry/<schema> | RegistryHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistryHandler:
"""Registered Schema Repository Check - HEAD ./api/registry/<schema> Create - POST ./api/registry Fetch - GET ./api/registry Fetch - GET ./api/registry?user=<username> Fetch - GET ./api/registry/<schema>/<class> Remove - DELETE ./api/registry/<schema>"""
def head(self, prefi... | stack_v2_sparse_classes_36k_train_016825 | 5,437 | no_license | [
{
"docstring": "Check the existance of a schema by its prefix.",
"name": "head",
"signature": "def head(self, prefix)"
},
{
"docstring": "Create a new schema entry in the registry.",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Access the registry. - List all ... | 4 | stack_v2_sparse_classes_30k_train_011963 | Implement the Python class `RegistryHandler` described below.
Class description:
Registered Schema Repository Check - HEAD ./api/registry/<schema> Create - POST ./api/registry Fetch - GET ./api/registry Fetch - GET ./api/registry?user=<username> Fetch - GET ./api/registry/<schema>/<class> Remove - DELETE ./api/registr... | Implement the Python class `RegistryHandler` described below.
Class description:
Registered Schema Repository Check - HEAD ./api/registry/<schema> Create - POST ./api/registry Fetch - GET ./api/registry Fetch - GET ./api/registry?user=<username> Fetch - GET ./api/registry/<schema>/<class> Remove - DELETE ./api/registr... | a1579b2711c733315518ca37b3fed4e3cc330234 | <|skeleton|>
class RegistryHandler:
"""Registered Schema Repository Check - HEAD ./api/registry/<schema> Create - POST ./api/registry Fetch - GET ./api/registry Fetch - GET ./api/registry?user=<username> Fetch - GET ./api/registry/<schema>/<class> Remove - DELETE ./api/registry/<schema>"""
def head(self, prefi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegistryHandler:
"""Registered Schema Repository Check - HEAD ./api/registry/<schema> Create - POST ./api/registry Fetch - GET ./api/registry Fetch - GET ./api/registry?user=<username> Fetch - GET ./api/registry/<schema>/<class> Remove - DELETE ./api/registry/<schema>"""
def head(self, prefix):
"... | the_stack_v2_python_sparse | discovery/api/handlers/registry.py | Sage-Bionetworks/discovery-app | train | 0 |
9c5ed29738d15b269eef85d27998fce8bf9813d6 | [
"self._x_table = np.arange(x_start, x_end, x_step)\nself._func_value_table = func(self._x_table)\nself.x_start = x_start\nself.x_end = x_end\nself.x_step = x_step",
"assert np.all(ar_x < self.x_end) & np.all(ar_x > self.x_start), 'lookup value out of range'\nar_index = self._func_value_table.size * (ar_x - self.x... | <|body_start_0|>
self._x_table = np.arange(x_start, x_end, x_step)
self._func_value_table = func(self._x_table)
self.x_start = x_start
self.x_end = x_end
self.x_step = x_step
<|end_body_0|>
<|body_start_1|>
assert np.all(ar_x < self.x_end) & np.all(ar_x > self.x_start), ... | LinearInterpTable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearInterpTable:
def __init__(self, func, x_start, x_end, x_step):
""":param func: a function with a 1D array argument :type x_start: float64 :type x_end: float64 :type x_step: float64"""
<|body_0|>
def eval(self, ar_x):
""":type ar_x: np.multiarray.ndarray :rtype:... | stack_v2_sparse_classes_36k_train_016826 | 1,342 | permissive | [
{
"docstring": ":param func: a function with a 1D array argument :type x_start: float64 :type x_end: float64 :type x_step: float64",
"name": "__init__",
"signature": "def __init__(self, func, x_start, x_end, x_step)"
},
{
"docstring": ":type ar_x: np.multiarray.ndarray :rtype: np.multiarray.ndar... | 2 | null | Implement the Python class `LinearInterpTable` described below.
Class description:
Implement the LinearInterpTable class.
Method signatures and docstrings:
- def __init__(self, func, x_start, x_end, x_step): :param func: a function with a 1D array argument :type x_start: float64 :type x_end: float64 :type x_step: flo... | Implement the Python class `LinearInterpTable` described below.
Class description:
Implement the LinearInterpTable class.
Method signatures and docstrings:
- def __init__(self, func, x_start, x_end, x_step): :param func: a function with a 1D array argument :type x_start: float64 :type x_end: float64 :type x_step: flo... | deed114b4cadd4971caec68e2838a5fac39827b1 | <|skeleton|>
class LinearInterpTable:
def __init__(self, func, x_start, x_end, x_step):
""":param func: a function with a 1D array argument :type x_start: float64 :type x_end: float64 :type x_step: float64"""
<|body_0|>
def eval(self, ar_x):
""":type ar_x: np.multiarray.ndarray :rtype:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearInterpTable:
def __init__(self, func, x_start, x_end, x_step):
""":param func: a function with a 1D array argument :type x_start: float64 :type x_end: float64 :type x_step: float64"""
self._x_table = np.arange(x_start, x_end, x_step)
self._func_value_table = func(self._x_table)
... | the_stack_v2_python_sparse | lookup_table.py | yishayv/lyacorr | train | 2 | |
46b16821eb4a4cd1181339fdc65b71ee8877c021 | [
"if not root:\n return []\nres, temp, queue, flag = ([], [], [root], 1)\nwhile queue:\n for i in range(len(queue)):\n node = queue.pop(0)\n temp.append(node.val)\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\n res.app... | <|body_start_0|>
if not root:
return []
res, temp, queue, flag = ([], [], [root], 1)
while queue:
for i in range(len(queue)):
node = queue.pop(0)
temp.append(node.val)
if node.left:
queue.append(node.left... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def zigzagLevelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_0|>
def zigzagLevelOrder_v0(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not roo... | stack_v2_sparse_classes_36k_train_016827 | 2,554 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "zigzagLevelOrder",
"signature": "def zigzagLevelOrder(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "zigzagLevelOrder_v0",
"signature": "def zigzagLevelOrder_v0(self, root)"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def zigzagLevelOrder(self, root): :type root: TreeNode :rtype: List[List[int]]
- def zigzagLevelOrder_v0(self, root): :type root: TreeNode :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def zigzagLevelOrder(self, root): :type root: TreeNode :rtype: List[List[int]]
- def zigzagLevelOrder_v0(self, root): :type root: TreeNode :rtype: List[List[int]]
<|skeleton|>
c... | b5e09f24e8e96454dc99e20281e853fb9fcc85ed | <|skeleton|>
class Solution:
def zigzagLevelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_0|>
def zigzagLevelOrder_v0(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def zigzagLevelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
if not root:
return []
res, temp, queue, flag = ([], [], [root], 1)
while queue:
for i in range(len(queue)):
node = queue.pop(0)
... | the_stack_v2_python_sparse | python/103_Binary_Tree_Zigzag_Level_Order_Traversal.py | Moby5/myleetcode | train | 2 | |
1bdafd9e5b0ad3ee8d00343ec1c26c0da8e4534d | [
"concept_parsers.ConceptParser.ForResource('--location', resource_args.GetLocationResourceSpec(), group_help='The location you want to list the connection profiles for.', required=True).AddToParser(parser)\nresource_args.AddConnectionProfileDiscoverResourceArg(parser)\ncp_flags.AddDepthGroup(parser)\ncp_flags.AddRd... | <|body_start_0|>
concept_parsers.ConceptParser.ForResource('--location', resource_args.GetLocationResourceSpec(), group_help='The location you want to list the connection profiles for.', required=True).AddToParser(parser)
resource_args.AddConnectionProfileDiscoverResourceArg(parser)
cp_flags.Add... | Base class for discovering Datastream connection profiles. | _Discover | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Discover:
"""Base class for discovering Datastream connection profiles."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positio... | stack_v2_sparse_classes_36k_train_016828 | 3,598 | permissive | [
{
"docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring"... | 2 | null | Implement the Python class `_Discover` described below.
Class description:
Base class for discovering Datastream connection profiles.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add argument... | Implement the Python class `_Discover` described below.
Class description:
Base class for discovering Datastream connection profiles.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add argument... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class _Discover:
"""Base class for discovering Datastream connection profiles."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Discover:
"""Base class for discovering Datastream connection profiles."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments... | the_stack_v2_python_sparse | lib/surface/datastream/connection_profiles/discover.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
7323510c968e4b105e35bb897dfea5d07607faaa | [
"re = PresentCarHandle(centralTollLogin).additionalRecording(send_data['parkName'], send_data['carNum'], send_data['enterTime'])\nresult = re['status']\nAssertions().assert_in_text(result, expect['centralAdditionalRecord'])",
"re = PresentCarHandle(centralTollLogin).centraPay(send_data['carNum'])\nresult = re['pa... | <|body_start_0|>
re = PresentCarHandle(centralTollLogin).additionalRecording(send_data['parkName'], send_data['carNum'], send_data['enterTime'])
result = re['status']
Assertions().assert_in_text(result, expect['centralAdditionalRecord'])
<|end_body_0|>
<|body_start_1|>
re = PresentCarHa... | 中央收费处补录车牌 | TestCentralAdditionalRecord | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCentralAdditionalRecord:
"""中央收费处补录车牌"""
def test_centralAdditionalRecord(self, centralTollLogin, send_data, expect):
"""中央-补录车牌"""
<|body_0|>
def test_centryPay(self, centralTollLogin, send_data, expect):
"""中央查费-收费"""
<|body_1|>
def test_checkC... | stack_v2_sparse_classes_36k_train_016829 | 2,683 | no_license | [
{
"docstring": "中央-补录车牌",
"name": "test_centralAdditionalRecord",
"signature": "def test_centralAdditionalRecord(self, centralTollLogin, send_data, expect)"
},
{
"docstring": "中央查费-收费",
"name": "test_centryPay",
"signature": "def test_centryPay(self, centralTollLogin, send_data, expect)"... | 6 | null | Implement the Python class `TestCentralAdditionalRecord` described below.
Class description:
中央收费处补录车牌
Method signatures and docstrings:
- def test_centralAdditionalRecord(self, centralTollLogin, send_data, expect): 中央-补录车牌
- def test_centryPay(self, centralTollLogin, send_data, expect): 中央查费-收费
- def test_checkCentr... | Implement the Python class `TestCentralAdditionalRecord` described below.
Class description:
中央收费处补录车牌
Method signatures and docstrings:
- def test_centralAdditionalRecord(self, centralTollLogin, send_data, expect): 中央-补录车牌
- def test_centryPay(self, centralTollLogin, send_data, expect): 中央查费-收费
- def test_checkCentr... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class TestCentralAdditionalRecord:
"""中央收费处补录车牌"""
def test_centralAdditionalRecord(self, centralTollLogin, send_data, expect):
"""中央-补录车牌"""
<|body_0|>
def test_centryPay(self, centralTollLogin, send_data, expect):
"""中央查费-收费"""
<|body_1|>
def test_checkC... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestCentralAdditionalRecord:
"""中央收费处补录车牌"""
def test_centralAdditionalRecord(self, centralTollLogin, send_data, expect):
"""中央-补录车牌"""
re = PresentCarHandle(centralTollLogin).additionalRecording(send_data['parkName'], send_data['carNum'], send_data['enterTime'])
result = re['stat... | the_stack_v2_python_sparse | test_suite/centralTollCollectionRoom/presentCarHandle/test_centralAdditionalRecord.py | oyebino/pomp_api | train | 1 |
b7b9efe57ce3cd746390e1de414961405bce4196 | [
"if hasattr(info.context, 'repo_cache_middleware_complete'):\n return next(root, info, **args)\nif info.operation.operation == 'mutation':\n try:\n self.flush_repo_cache(info.operation, info.variable_values)\n except UnknownRepo as e:\n logger.warning(f'Mutation {info.operation.name} not asso... | <|body_start_0|>
if hasattr(info.context, 'repo_cache_middleware_complete'):
return next(root, info, **args)
if info.operation.operation == 'mutation':
try:
self.flush_repo_cache(info.operation, info.variable_values)
except UnknownRepo as e:
... | RepositoryCacheMiddleware | [
"MIT",
"LicenseRef-scancode-dco-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepositoryCacheMiddleware:
def resolve(self, next, root, info, **args):
"""This segment of the middleware attempts to capture specific mutations and use the info for given repositories to flush the corresponding cache input. For example, if you stop a Project container, this callback wil... | stack_v2_sparse_classes_36k_train_016830 | 4,223 | permissive | [
{
"docstring": "This segment of the middleware attempts to capture specific mutations and use the info for given repositories to flush the corresponding cache input. For example, if you stop a Project container, this callback will capture the owner and repository name, and then flush the Redis cache for that re... | 2 | null | Implement the Python class `RepositoryCacheMiddleware` described below.
Class description:
Implement the RepositoryCacheMiddleware class.
Method signatures and docstrings:
- def resolve(self, next, root, info, **args): This segment of the middleware attempts to capture specific mutations and use the info for given re... | Implement the Python class `RepositoryCacheMiddleware` described below.
Class description:
Implement the RepositoryCacheMiddleware class.
Method signatures and docstrings:
- def resolve(self, next, root, info, **args): This segment of the middleware attempts to capture specific mutations and use the info for given re... | 70fe6b39b87b1c56351f2b4c551b6f1693813e4f | <|skeleton|>
class RepositoryCacheMiddleware:
def resolve(self, next, root, info, **args):
"""This segment of the middleware attempts to capture specific mutations and use the info for given repositories to flush the corresponding cache input. For example, if you stop a Project container, this callback wil... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RepositoryCacheMiddleware:
def resolve(self, next, root, info, **args):
"""This segment of the middleware attempts to capture specific mutations and use the info for given repositories to flush the corresponding cache input. For example, if you stop a Project container, this callback will capture the ... | the_stack_v2_python_sparse | packages/gtmapi/lmsrvcore/middleware/cache.py | griffinmilsap/gigantum-client | train | 0 | |
42d24dd25b5e5d8bb177b155f101cb2ec1c02718 | [
"def dfs(index: int, curCost: int) -> None:\n nonlocal res\n if index == len(toppingCosts):\n if abs(curCost - target) < abs(res - target) or (abs(curCost - target) == abs(res - target) and curCost < res):\n res = curCost\n return\n dfs(index + 1, curCost)\n dfs(index + 1, curCo... | <|body_start_0|>
def dfs(index: int, curCost: int) -> None:
nonlocal res
if index == len(toppingCosts):
if abs(curCost - target) < abs(res - target) or (abs(curCost - target) == abs(res - target) and curCost < res):
res = curCost
return... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def closestCost(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int:
"""dfs代替三进制枚举会更快 并且更好剪枝"""
<|body_0|>
def closestCost2(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int:
"""三进制枚举 每次需要重新计算cost 所以不如dfs里携带curCos... | stack_v2_sparse_classes_36k_train_016831 | 2,201 | no_license | [
{
"docstring": "dfs代替三进制枚举会更快 并且更好剪枝",
"name": "closestCost",
"signature": "def closestCost(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int"
},
{
"docstring": "三进制枚举 每次需要重新计算cost 所以不如dfs里携带curCost快",
"name": "closestCost2",
"signature": "def closestCost2(self, ba... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def closestCost(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int: dfs代替三进制枚举会更快 并且更好剪枝
- def closestCost2(self, baseCosts: list[int], toppingCosts: list[i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def closestCost(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int: dfs代替三进制枚举会更快 并且更好剪枝
- def closestCost2(self, baseCosts: list[int], toppingCosts: list[i... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def closestCost(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int:
"""dfs代替三进制枚举会更快 并且更好剪枝"""
<|body_0|>
def closestCost2(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int:
"""三进制枚举 每次需要重新计算cost 所以不如dfs里携带curCos... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def closestCost(self, baseCosts: list[int], toppingCosts: list[int], target: int) -> int:
"""dfs代替三进制枚举会更快 并且更好剪枝"""
def dfs(index: int, curCost: int) -> None:
nonlocal res
if index == len(toppingCosts):
if abs(curCost - target) < abs(res - tar... | the_stack_v2_python_sparse | 21_位运算/二进制枚举与三进制枚举/三进制枚举/1774. 最接近目标价格的甜点成本-dfs.py | 981377660LMT/algorithm-study | train | 225 | |
f29dd8f61f0491cf45bc566ff43f6a469032e233 | [
"ret = 'zz'\nfor letter in letters:\n if letter > target:\n ret = min(letter, ret)\nreturn ret if ret != 'zz' else min(letters)",
"for letter in letters:\n if letter > target:\n return letter\nreturn letters[0]",
"if target >= letters[-1]:\n return letters[0]\nstart = 0\nend = len(letters... | <|body_start_0|>
ret = 'zz'
for letter in letters:
if letter > target:
ret = min(letter, ret)
return ret if ret != 'zz' else min(letters)
<|end_body_0|>
<|body_start_1|>
for letter in letters:
if letter > target:
return letter
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextGreatestLetter1(self, letters, target):
""":type letters: List[str] :type target: str :rtype: str"""
<|body_0|>
def nextGreatestLetter2(self, letters, target):
""":type letters: List[str] :type target: str :rtype: str"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_016832 | 1,413 | no_license | [
{
"docstring": ":type letters: List[str] :type target: str :rtype: str",
"name": "nextGreatestLetter1",
"signature": "def nextGreatestLetter1(self, letters, target)"
},
{
"docstring": ":type letters: List[str] :type target: str :rtype: str",
"name": "nextGreatestLetter2",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_002001 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextGreatestLetter1(self, letters, target): :type letters: List[str] :type target: str :rtype: str
- def nextGreatestLetter2(self, letters, target): :type letters: List[str] ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextGreatestLetter1(self, letters, target): :type letters: List[str] :type target: str :rtype: str
- def nextGreatestLetter2(self, letters, target): :type letters: List[str] ... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def nextGreatestLetter1(self, letters, target):
""":type letters: List[str] :type target: str :rtype: str"""
<|body_0|>
def nextGreatestLetter2(self, letters, target):
""":type letters: List[str] :type target: str :rtype: str"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nextGreatestLetter1(self, letters, target):
""":type letters: List[str] :type target: str :rtype: str"""
ret = 'zz'
for letter in letters:
if letter > target:
ret = min(letter, ret)
return ret if ret != 'zz' else min(letters)
def n... | the_stack_v2_python_sparse | python/leetcode_bak/744_Find_Smallest_Letter_Greater_Than_Target.py | bobcaoge/my-code | train | 0 | |
17fcdfb0e94493d58fab386764d7a0dd2a58df65 | [
"super().__init__(data)\ncoloring = config.get_option_from_section(consts.DisplayOptions.FLAMEGRAPH.value, 'coloring')\nself.display_options = self.DisplayOptions(coloring)\nself.svg_temp_file = str(file.TempFileName())",
"stacks_temp_file = str(file.TempFileName())\ncounts = collections.Counter()\nstack_data = s... | <|body_start_0|>
super().__init__(data)
coloring = config.get_option_from_section(consts.DisplayOptions.FLAMEGRAPH.value, 'coloring')
self.display_options = self.DisplayOptions(coloring)
self.svg_temp_file = str(file.TempFileName())
<|end_body_0|>
<|body_start_1|>
stacks_temp_fi... | The class representing flamegraphs. | Flamegraph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Flamegraph:
"""The class representing flamegraphs."""
def __init__(self, data):
"""Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph"""
<|body_0|>
def _make(self):
"""Uses ... | stack_v2_sparse_classes_36k_train_016833 | 3,399 | permissive | [
{
"docstring": "Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "Uses Brendan Gregg's flamegraph tool to convert data to fl... | 3 | stack_v2_sparse_classes_30k_train_015673 | Implement the Python class `Flamegraph` described below.
Class description:
The class representing flamegraphs.
Method signatures and docstrings:
- def __init__(self, data): Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph
- d... | Implement the Python class `Flamegraph` described below.
Class description:
The class representing flamegraphs.
Method signatures and docstrings:
- def __init__(self, data): Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph
- d... | d36c3203cefdd4690ba2ecf076e5e9fca05cbc80 | <|skeleton|>
class Flamegraph:
"""The class representing flamegraphs."""
def __init__(self, data):
"""Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph"""
<|body_0|>
def _make(self):
"""Uses ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Flamegraph:
"""The class representing flamegraphs."""
def __init__(self, data):
"""Initialise the flamegraph. :param data: A `data_io.StackData` object that encapsulated the collected data we want to display as a flamegraph"""
super().__init__(data)
coloring = config.get_option_fr... | the_stack_v2_python_sparse | marple/display/interface/flamegraph.py | ensoft/marple | train | 7 |
fa36979389cb770ff74ed792b25fa2d13f9d76e8 | [
"super(ParsimonyClade, self).__init__(branch_length, name, clades, confidence, color, width)\nself.sets = sets\nself.score = score\nself.show_scores = False",
"obj = type(self).__new__(self.__class__)\nobj.__dict__.update(self.__dict__)\nreturn obj"
] | <|body_start_0|>
super(ParsimonyClade, self).__init__(branch_length, name, clades, confidence, color, width)
self.sets = sets
self.score = score
self.show_scores = False
<|end_body_0|>
<|body_start_1|>
obj = type(self).__new__(self.__class__)
obj.__dict__.update(self.__d... | Class extending Bio.Phylo.BaseTree.Clade. Stores base sets and parsimony scores. | ParsimonyClade | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParsimonyClade:
"""Class extending Bio.Phylo.BaseTree.Clade. Stores base sets and parsimony scores."""
def __init__(self, branch_length=None, name=None, clades=None, confidence=None, color=None, width=None, sets=None, score=0):
"""Constructor. sets: list of sets containing bases (for... | stack_v2_sparse_classes_36k_train_016834 | 6,190 | no_license | [
{
"docstring": "Constructor. sets: list of sets containing bases (for each site in a sequence) score: parsimony score belonging to this clade",
"name": "__init__",
"signature": "def __init__(self, branch_length=None, name=None, clades=None, confidence=None, color=None, width=None, sets=None, score=0)"
... | 2 | stack_v2_sparse_classes_30k_train_014862 | Implement the Python class `ParsimonyClade` described below.
Class description:
Class extending Bio.Phylo.BaseTree.Clade. Stores base sets and parsimony scores.
Method signatures and docstrings:
- def __init__(self, branch_length=None, name=None, clades=None, confidence=None, color=None, width=None, sets=None, score=... | Implement the Python class `ParsimonyClade` described below.
Class description:
Class extending Bio.Phylo.BaseTree.Clade. Stores base sets and parsimony scores.
Method signatures and docstrings:
- def __init__(self, branch_length=None, name=None, clades=None, confidence=None, color=None, width=None, sets=None, score=... | 89fc68c4354d35bfb7e41212bc3eaf44e8591422 | <|skeleton|>
class ParsimonyClade:
"""Class extending Bio.Phylo.BaseTree.Clade. Stores base sets and parsimony scores."""
def __init__(self, branch_length=None, name=None, clades=None, confidence=None, color=None, width=None, sets=None, score=0):
"""Constructor. sets: list of sets containing bases (for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParsimonyClade:
"""Class extending Bio.Phylo.BaseTree.Clade. Stores base sets and parsimony scores."""
def __init__(self, branch_length=None, name=None, clades=None, confidence=None, color=None, width=None, sets=None, score=0):
"""Constructor. sets: list of sets containing bases (for each site in... | the_stack_v2_python_sparse | src/maximum_parsimony/tools/parsimony.py | qianlivia/computational_biology | train | 0 |
82bcf6f3e4e0aa2c11e809dc982b412cccaa331f | [
"def helper(i):\n if i == 1:\n return '0'\n s = helper(i - 1)\n t = ''\n for c in s:\n if c == '0':\n t += '01'\n else:\n t += '10'\n print(t)\n return t\ns = helper(n)\nreturn int(s[k - 1])",
"if n == 1:\n return 0\nif n == 2:\n if k == 1:\n ... | <|body_start_0|>
def helper(i):
if i == 1:
return '0'
s = helper(i - 1)
t = ''
for c in s:
if c == '0':
t += '01'
else:
t += '10'
print(t)
return t
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kthGrammarTLE(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_0|>
def kthGrammar(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def helper(i):
if i == 1... | stack_v2_sparse_classes_36k_train_016835 | 1,902 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: int",
"name": "kthGrammarTLE",
"signature": "def kthGrammarTLE(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: int",
"name": "kthGrammar",
"signature": "def kthGrammar(self, n, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003899 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthGrammarTLE(self, n, k): :type n: int :type k: int :rtype: int
- def kthGrammar(self, n, k): :type n: int :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthGrammarTLE(self, n, k): :type n: int :type k: int :rtype: int
- def kthGrammar(self, n, k): :type n: int :type k: int :rtype: int
<|skeleton|>
class Solution:
def kt... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def kthGrammarTLE(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_0|>
def kthGrammar(self, n, k):
""":type n: int :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kthGrammarTLE(self, n, k):
""":type n: int :type k: int :rtype: int"""
def helper(i):
if i == 1:
return '0'
s = helper(i - 1)
t = ''
for c in s:
if c == '0':
t += '01'
... | the_stack_v2_python_sparse | K/K-thSymbolinGrammar.py | bssrdf/pyleet | train | 2 | |
7660bc1ded61b97d305e35ac17ce9bcf33faf71c | [
"self.handler = handler\nself.db = DB(handler.application)\npass",
"for item in res:\n item['img_url'] = self.db.get_article_img_list(item['id'], num)\nreturn res",
"if isinstance(db_res, list):\n for i in xrange(0, len(db_res)):\n db_res[i] = self.filter_db_res(db_res[i])\nelif isinstance(db_res, ... | <|body_start_0|>
self.handler = handler
self.db = DB(handler.application)
pass
<|end_body_0|>
<|body_start_1|>
for item in res:
item['img_url'] = self.db.get_article_img_list(item['id'], num)
return res
<|end_body_1|>
<|body_start_2|>
if isinstance(db_res, l... | Base class for all account process modules 初始化数据库,缓存,短信服务 | Processor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Processor:
"""Base class for all account process modules 初始化数据库,缓存,短信服务"""
def __init__(self, handler):
"""Constructor"""
<|body_0|>
def add_img(self, res, num=0):
"""Add img_url to solr result"""
<|body_1|>
def filter_db_res(self, db_res):
"... | stack_v2_sparse_classes_36k_train_016836 | 1,612 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, handler)"
},
{
"docstring": "Add img_url to solr result",
"name": "add_img",
"signature": "def add_img(self, res, num=0)"
},
{
"docstring": "判断是否是list,分解为dict, 将dict中不能变为json的部分过滤或做处理",
"name":... | 3 | stack_v2_sparse_classes_30k_train_013198 | Implement the Python class `Processor` described below.
Class description:
Base class for all account process modules 初始化数据库,缓存,短信服务
Method signatures and docstrings:
- def __init__(self, handler): Constructor
- def add_img(self, res, num=0): Add img_url to solr result
- def filter_db_res(self, db_res): 判断是否是list,分解为... | Implement the Python class `Processor` described below.
Class description:
Base class for all account process modules 初始化数据库,缓存,短信服务
Method signatures and docstrings:
- def __init__(self, handler): Constructor
- def add_img(self, res, num=0): Add img_url to solr result
- def filter_db_res(self, db_res): 判断是否是list,分解为... | 62d5d8201d4b19d55f7ba0c33f9a91badacc7fbe | <|skeleton|>
class Processor:
"""Base class for all account process modules 初始化数据库,缓存,短信服务"""
def __init__(self, handler):
"""Constructor"""
<|body_0|>
def add_img(self, res, num=0):
"""Add img_url to solr result"""
<|body_1|>
def filter_db_res(self, db_res):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Processor:
"""Base class for all account process modules 初始化数据库,缓存,短信服务"""
def __init__(self, handler):
"""Constructor"""
self.handler = handler
self.db = DB(handler.application)
pass
def add_img(self, res, num=0):
"""Add img_url to solr result"""
for ... | the_stack_v2_python_sparse | module/base_processor.py | giphub/gip | train | 1 |
793211123ee95283a6c2ea10f19aea9c6ca1cf29 | [
"noise = np.random.randn(x.size)\nNx = len(x)\nsignal_power = 1 / Nx * np.sum(x * x)\nnoise_power = 1 / Nx * np.sum(noise * noise)\nnoise_variance = signal_power / 10 ** (snr / 10)\nnoise = np.sqrt(noise_variance / noise_power) * noise\ny = x + noise\nreturn (y, noise)",
"I = I.reshape(-1, 1)\nIn = In.reshape(-1,... | <|body_start_0|>
noise = np.random.randn(x.size)
Nx = len(x)
signal_power = 1 / Nx * np.sum(x * x)
noise_power = 1 / Nx * np.sum(noise * noise)
noise_variance = signal_power / 10 ** (snr / 10)
noise = np.sqrt(noise_variance / noise_power) * noise
y = x + noise
... | Noisy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Noisy:
def Gnoisegen(self, x, snr):
"""Generate Gaussian white noise according to the set SNR, return noisy speech :param x: clean speech signal :param snr: SNR [dB] :return y: noisy speech :return noise: gaussian white noise"""
<|body_0|>
def SNR_singlech(self, I, In):
... | stack_v2_sparse_classes_36k_train_016837 | 1,914 | permissive | [
{
"docstring": "Generate Gaussian white noise according to the set SNR, return noisy speech :param x: clean speech signal :param snr: SNR [dB] :return y: noisy speech :return noise: gaussian white noise",
"name": "Gnoisegen",
"signature": "def Gnoisegen(self, x, snr)"
},
{
"docstring": "calculat... | 3 | stack_v2_sparse_classes_30k_train_014047 | Implement the Python class `Noisy` described below.
Class description:
Implement the Noisy class.
Method signatures and docstrings:
- def Gnoisegen(self, x, snr): Generate Gaussian white noise according to the set SNR, return noisy speech :param x: clean speech signal :param snr: SNR [dB] :return y: noisy speech :ret... | Implement the Python class `Noisy` described below.
Class description:
Implement the Noisy class.
Method signatures and docstrings:
- def Gnoisegen(self, x, snr): Generate Gaussian white noise according to the set SNR, return noisy speech :param x: clean speech signal :param snr: SNR [dB] :return y: noisy speech :ret... | 0074ad1d519387a75d5eca42c77f4d6966eb0a0e | <|skeleton|>
class Noisy:
def Gnoisegen(self, x, snr):
"""Generate Gaussian white noise according to the set SNR, return noisy speech :param x: clean speech signal :param snr: SNR [dB] :return y: noisy speech :return noise: gaussian white noise"""
<|body_0|>
def SNR_singlech(self, I, In):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Noisy:
def Gnoisegen(self, x, snr):
"""Generate Gaussian white noise according to the set SNR, return noisy speech :param x: clean speech signal :param snr: SNR [dB] :return y: noisy speech :return noise: gaussian white noise"""
noise = np.random.randn(x.size)
Nx = len(x)
signa... | the_stack_v2_python_sparse | Chapter6_VoiceActivityDetection/Noisy.py | BarryZM/Python_Speech_SZY | train | 0 | |
ba38a2f65c3802efcbda9d5b727ca3b97add63bf | [
"super(CrossValidationJointFusionWorkflow, self).__init__(name=name, **kwargs)\nself.csv_file = File(value=os.path.abspath(csv_file), exists=True)\nself.hasHeader = traits.Bool(hasHeader)\nself.sample_size = traits.Int(size)\nself.config['execution'] = {'remove_unnecessary_outputs': 'true'}",
"csvReader = CSVRead... | <|body_start_0|>
super(CrossValidationJointFusionWorkflow, self).__init__(name=name, **kwargs)
self.csv_file = File(value=os.path.abspath(csv_file), exists=True)
self.hasHeader = traits.Bool(hasHeader)
self.sample_size = traits.Int(size)
self.config['execution'] = {'remove_unnece... | Nipype workflow for Multi-Label Atlas Fusion cross-validation experiment :param Workflow: | CrossValidationJointFusionWorkflow | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrossValidationJointFusionWorkflow:
"""Nipype workflow for Multi-Label Atlas Fusion cross-validation experiment :param Workflow:"""
def __init__(self, csv_file=None, size=0, hasHeader=False, name='CrossValidationJointFusionWorkflow', **kwargs):
"""This function... :param self: :param... | stack_v2_sparse_classes_36k_train_016838 | 18,518 | permissive | [
{
"docstring": "This function... :param self: :param csv_file: :param size: :param hasHeader: :param name: :param **kwargs: :return:",
"name": "__init__",
"signature": "def __init__(self, csv_file=None, size=0, hasHeader=False, name='CrossValidationJointFusionWorkflow', **kwargs)"
},
{
"docstrin... | 3 | stack_v2_sparse_classes_30k_train_020741 | Implement the Python class `CrossValidationJointFusionWorkflow` described below.
Class description:
Nipype workflow for Multi-Label Atlas Fusion cross-validation experiment :param Workflow:
Method signatures and docstrings:
- def __init__(self, csv_file=None, size=0, hasHeader=False, name='CrossValidationJointFusionW... | Implement the Python class `CrossValidationJointFusionWorkflow` described below.
Class description:
Nipype workflow for Multi-Label Atlas Fusion cross-validation experiment :param Workflow:
Method signatures and docstrings:
- def __init__(self, csv_file=None, size=0, hasHeader=False, name='CrossValidationJointFusionW... | 64bb590918a188b660225e44ae54c1072f3a8056 | <|skeleton|>
class CrossValidationJointFusionWorkflow:
"""Nipype workflow for Multi-Label Atlas Fusion cross-validation experiment :param Workflow:"""
def __init__(self, csv_file=None, size=0, hasHeader=False, name='CrossValidationJointFusionWorkflow', **kwargs):
"""This function... :param self: :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CrossValidationJointFusionWorkflow:
"""Nipype workflow for Multi-Label Atlas Fusion cross-validation experiment :param Workflow:"""
def __init__(self, csv_file=None, size=0, hasHeader=False, name='CrossValidationJointFusionWorkflow', **kwargs):
"""This function... :param self: :param csv_file: :p... | the_stack_v2_python_sparse | AutoWorkup/BAW/workflows/crossValidate.py | BRAINSia/BRAINSTools | train | 101 |
5f44da1901832f91793177a730c44144ce4e3399 | [
"TrafficLightHandler.num_tl = 0\nTrafficLightHandler.list_tl_actor = []\nTrafficLightHandler.list_tv_loc = []\nTrafficLightHandler.list_stopline_wps = []\nTrafficLightHandler.list_stopline_vtx = []\nall_actors = alf_world._world.get_actors()\nfor _actor in all_actors:\n if 'traffic_light' in _actor.type_id:\n ... | <|body_start_0|>
TrafficLightHandler.num_tl = 0
TrafficLightHandler.list_tl_actor = []
TrafficLightHandler.list_tv_loc = []
TrafficLightHandler.list_stopline_wps = []
TrafficLightHandler.list_stopline_vtx = []
all_actors = alf_world._world.get_actors()
for _actor ... | This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for the current color state of the traffic light. ... | TrafficLightHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrafficLightHandler:
"""This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for... | stack_v2_sparse_classes_36k_train_016839 | 30,805 | permissive | [
{
"docstring": "Args: alf_world (World): an instance of the World class defined in alf.environments.carla_sensors.",
"name": "reset",
"signature": "def reset(alf_world)"
},
{
"docstring": "Get the list of stop line vertices satisfying both the color and distance conditions for a given query loca... | 2 | stack_v2_sparse_classes_30k_train_000750 | Implement the Python class `TrafficLightHandler` described below.
Class description:
This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traf... | Implement the Python class `TrafficLightHandler` described below.
Class description:
This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traf... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class TrafficLightHandler:
"""This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrafficLightHandler:
"""This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for the current ... | the_stack_v2_python_sparse | alf/environments/carla_env/carla_utils.py | HorizonRobotics/alf | train | 288 |
05250288d534bf7dd82b7478cddbf836e36b767f | [
"if samples is None or lines is None:\n msg = 'Samples and lines are required inputs! Samples: {ns} Lines: {nl}'.format(ns=samples, nl=lines)\n raise TypeError(msg)\ndriver = gdal.GetDriverByName(fmt)\nself.outds = driver.Create(out_fname, samples, lines, bands, dtype)\nself.nodata = nodata\nself.geobox = geo... | <|body_start_0|>
if samples is None or lines is None:
msg = 'Samples and lines are required inputs! Samples: {ns} Lines: {nl}'.format(ns=samples, nl=lines)
raise TypeError(msg)
driver = gdal.GetDriverByName(fmt)
self.outds = driver.Create(out_fname, samples, lines, bands,... | TiledOutput | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TiledOutput:
def __init__(self, out_fname, samples=None, lines=None, bands=1, geobox=None, fmt='ENVI', nodata=None, dtype=gdal.GDT_Byte):
"""A class to aid in data processing using a tiling scheme. The `TiledOutput` class takes care of writing each tile/chunk of data to disk. :param out_... | stack_v2_sparse_classes_36k_train_016840 | 10,754 | permissive | [
{
"docstring": "A class to aid in data processing using a tiling scheme. The `TiledOutput` class takes care of writing each tile/chunk of data to disk. :param out_fname: A string containing the full filepath name used for creating the image on disk. :param samples: An integer indicating the number of samples/co... | 6 | null | Implement the Python class `TiledOutput` described below.
Class description:
Implement the TiledOutput class.
Method signatures and docstrings:
- def __init__(self, out_fname, samples=None, lines=None, bands=1, geobox=None, fmt='ENVI', nodata=None, dtype=gdal.GDT_Byte): A class to aid in data processing using a tilin... | Implement the Python class `TiledOutput` described below.
Class description:
Implement the TiledOutput class.
Method signatures and docstrings:
- def __init__(self, out_fname, samples=None, lines=None, bands=1, geobox=None, fmt='ENVI', nodata=None, dtype=gdal.GDT_Byte): A class to aid in data processing using a tilin... | 4ae3670681b872530f59c57ab537a45d1b09c009 | <|skeleton|>
class TiledOutput:
def __init__(self, out_fname, samples=None, lines=None, bands=1, geobox=None, fmt='ENVI', nodata=None, dtype=gdal.GDT_Byte):
"""A class to aid in data processing using a tiling scheme. The `TiledOutput` class takes care of writing each tile/chunk of data to disk. :param out_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TiledOutput:
def __init__(self, out_fname, samples=None, lines=None, bands=1, geobox=None, fmt='ENVI', nodata=None, dtype=gdal.GDT_Byte):
"""A class to aid in data processing using a tiling scheme. The `TiledOutput` class takes care of writing each tile/chunk of data to disk. :param out_fname: A strin... | the_stack_v2_python_sparse | wagl/tiling.py | GeoscienceAustralia/wagl | train | 25 | |
ef9f95557d67947839d44312021f7fcf007b1fc0 | [
"if not settings.DEBUG:\n return {}\nreturn {'athlete': {'name': 'Domen Blenkuš', 'age': '28', 'weight': 74.5}, 'measurements': [{'power': 120, 'heart_rate': 128}, {'power': 140, 'heart_rate': 135}, {'power': 160, 'heart_rate': 145}, {'power': 180, 'heart_rate': 143}, {'power': 200, 'heart_rate': 147}, {'power':... | <|body_start_0|>
if not settings.DEBUG:
return {}
return {'athlete': {'name': 'Domen Blenkuš', 'age': '28', 'weight': 74.5}, 'measurements': [{'power': 120, 'heart_rate': 128}, {'power': 140, 'heart_rate': 135}, {'power': 160, 'heart_rate': 145}, {'power': 180, 'heart_rate': 143}, {'power': ... | Conconi Test view. | ConconiTestView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConconiTestView:
"""Conconi Test view."""
def get_initial(self):
"""Return initial values if ``DEBUG`` setting is set to ``True``."""
<|body_0|>
def _save_data(self, forms):
"""Save data."""
<|body_1|>
def forms_valid(self, forms):
"""Save da... | stack_v2_sparse_classes_36k_train_016841 | 3,198 | permissive | [
{
"docstring": "Return initial values if ``DEBUG`` setting is set to ``True``.",
"name": "get_initial",
"signature": "def get_initial(self)"
},
{
"docstring": "Save data.",
"name": "_save_data",
"signature": "def _save_data(self, forms)"
},
{
"docstring": "Save data, make report ... | 3 | stack_v2_sparse_classes_30k_train_007500 | Implement the Python class `ConconiTestView` described below.
Class description:
Conconi Test view.
Method signatures and docstrings:
- def get_initial(self): Return initial values if ``DEBUG`` setting is set to ``True``.
- def _save_data(self, forms): Save data.
- def forms_valid(self, forms): Save data, make report... | Implement the Python class `ConconiTestView` described below.
Class description:
Conconi Test view.
Method signatures and docstrings:
- def get_initial(self): Return initial values if ``DEBUG`` setting is set to ``True``.
- def _save_data(self, forms): Save data.
- def forms_valid(self, forms): Save data, make report... | bae6105812c2f2414d0c10ddd465bf589503f61a | <|skeleton|>
class ConconiTestView:
"""Conconi Test view."""
def get_initial(self):
"""Return initial values if ``DEBUG`` setting is set to ``True``."""
<|body_0|>
def _save_data(self, forms):
"""Save data."""
<|body_1|>
def forms_valid(self, forms):
"""Save da... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConconiTestView:
"""Conconi Test view."""
def get_initial(self):
"""Return initial values if ``DEBUG`` setting is set to ``True``."""
if not settings.DEBUG:
return {}
return {'athlete': {'name': 'Domen Blenkuš', 'age': '28', 'weight': 74.5}, 'measurements': [{'power': ... | the_stack_v2_python_sparse | src/lactolyse/views/conconi_test.py | dblenkus/lactolyse | train | 2 |
8ab790e5e7698918328ef756c57d1d53b14a1f47 | [
"conditions_data = self.get(conditions_key)\nif not conditions_data:\n return None\ntry:\n return ConditionSet.deserialize(form_cls.base_fields[conditions_key].choices, conditions_data, choice_kwargs={'local_site': self.local_site, 'matching': True})\nexcept Exception:\n logger.exception('Unable to load ba... | <|body_start_0|>
conditions_data = self.get(conditions_key)
if not conditions_data:
return None
try:
return ConditionSet.deserialize(form_cls.base_fields[conditions_key].choices, conditions_data, choice_kwargs={'local_site': self.local_site, 'matching': True})
exc... | Stored configuration for a particular integration. This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information. | IntegrationConfig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntegrationConfig:
"""Stored configuration for a particular integration. This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information."""
def load_conditions(self, form... | stack_v2_sparse_classes_36k_train_016842 | 4,601 | permissive | [
{
"docstring": "Load a set of conditions from the configuration. This loads and deserializes a set of conditions from the configuration stored in the provided key. Those conditions can then be matched by the caller. If the conditions are not found, this will return ``None``. If the conditions cannot be deserial... | 2 | null | Implement the Python class `IntegrationConfig` described below.
Class description:
Stored configuration for a particular integration. This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information.... | Implement the Python class `IntegrationConfig` described below.
Class description:
Stored configuration for a particular integration. This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information.... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class IntegrationConfig:
"""Stored configuration for a particular integration. This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information."""
def load_conditions(self, form... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IntegrationConfig:
"""Stored configuration for a particular integration. This contains configuration settings for a given instance of an integration, along with state indicating if that integration is to be enabled and user-specified identifying information."""
def load_conditions(self, form_cls, conditi... | the_stack_v2_python_sparse | reviewboard/integrations/models.py | reviewboard/reviewboard | train | 1,141 |
87b5271cda51864f1ed0b973ba23ab6631183665 | [
"getcontext().prec = 3\ni = Decimal(str(obj.alertObj.orbit.i))\ne = Decimal(str(obj.alertObj.orbit.e))\nq = Decimal(str(obj.alertObj.orbit.q))\nh = Decimal(str(obj.alertObj.orbit.h_v))\na = q / (Decimal(1) - e)\nresult = a <= Decimal('4.35') and a >= Decimal('4.25')\nif result:\n msg = '<p>a: %.3f<br/>' % a\n ... | <|body_start_0|>
getcontext().prec = 3
i = Decimal(str(obj.alertObj.orbit.i))
e = Decimal(str(obj.alertObj.orbit.e))
q = Decimal(str(obj.alertObj.orbit.q))
h = Decimal(str(obj.alertObj.orbit.h_v))
a = q / (Decimal(1) - e)
result = a <= Decimal('4.35') and a >= Dec... | Thule_Family | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Thule_Family:
def IsThuleFam(self, obj):
"""Return True if obj has 4.25 AU <= a <=4.35 AU q = a * ( 1 - e ) @param obj: DerivedObject instance"""
<|body_0|>
def evaluate(self):
"""Return Derived Objects that have a been submitted to the MPC that contain a tracklet wi... | stack_v2_sparse_classes_36k_train_016843 | 2,408 | no_license | [
{
"docstring": "Return True if obj has 4.25 AU <= a <=4.35 AU q = a * ( 1 - e ) @param obj: DerivedObject instance",
"name": "IsThuleFam",
"signature": "def IsThuleFam(self, obj)"
},
{
"docstring": "Return Derived Objects that have a been submitted to the MPC that contain a tracklet with a diges... | 2 | stack_v2_sparse_classes_30k_train_000955 | Implement the Python class `Thule_Family` described below.
Class description:
Implement the Thule_Family class.
Method signatures and docstrings:
- def IsThuleFam(self, obj): Return True if obj has 4.25 AU <= a <=4.35 AU q = a * ( 1 - e ) @param obj: DerivedObject instance
- def evaluate(self): Return Derived Objects... | Implement the Python class `Thule_Family` described below.
Class description:
Implement the Thule_Family class.
Method signatures and docstrings:
- def IsThuleFam(self, obj): Return True if obj has 4.25 AU <= a <=4.35 AU q = a * ( 1 - e ) @param obj: DerivedObject instance
- def evaluate(self): Return Derived Objects... | 06858b7e935243da7a3f55b3e5097d6440e0c1c2 | <|skeleton|>
class Thule_Family:
def IsThuleFam(self, obj):
"""Return True if obj has 4.25 AU <= a <=4.35 AU q = a * ( 1 - e ) @param obj: DerivedObject instance"""
<|body_0|>
def evaluate(self):
"""Return Derived Objects that have a been submitted to the MPC that contain a tracklet wi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Thule_Family:
def IsThuleFam(self, obj):
"""Return True if obj has 4.25 AU <= a <=4.35 AU q = a * ( 1 - e ) @param obj: DerivedObject instance"""
getcontext().prec = 3
i = Decimal(str(obj.alertObj.orbit.i))
e = Decimal(str(obj.alertObj.orbit.e))
q = Decimal(str(obj.aler... | the_stack_v2_python_sparse | python/MOPS/Alerts/plugins/thule_family.py | ldenneau/mopsng | train | 0 | |
5e54d82341e337781415fb6e706c334c9ff018eb | [
"size = len(heights)\nheights = [0] + heights + [0]\nsize += 2\nres = 0\nfor i in range(1, size):\n left = i\n right = i\n for j in range(i - 1, -1, -1):\n if heights[j] < heights[i]:\n left = j\n break\n for j in range(i + 1, size, 1):\n if heights[j] < heights[i]:\n... | <|body_start_0|>
size = len(heights)
heights = [0] + heights + [0]
size += 2
res = 0
for i in range(1, size):
left = i
right = i
for j in range(i - 1, -1, -1):
if heights[j] < heights[i]:
left = j
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea2(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
size = len(hei... | stack_v2_sparse_classes_36k_train_016844 | 1,394 | no_license | [
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea",
"signature": "def largestRectangleArea(self, heights)"
},
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea2",
"signature": "def largestRectangleArea2(self, heights)"... | 2 | stack_v2_sparse_classes_30k_train_013383 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
- def largestRectangleArea2(self, heights): :type heights: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
- def largestRectangleArea2(self, heights): :type heights: List[int] :rtype: int
<|skeleton|>
class... | 46191f2adfd3687259a670b93dd7912f1fa7db82 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea2(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
size = len(heights)
heights = [0] + heights + [0]
size += 2
res = 0
for i in range(1, size):
left = i
right = i
for j in range(i - 1... | the_stack_v2_python_sparse | Week_01/solution84_largest_rectangle_area.py | hongfeng2013/algorithm009-class01 | train | 0 | |
c3a83b2ab52c1dd286afdd619b85fb5a1e297690 | [
"if not board:\n return False\nfor i in range(len(board)):\n for j in range(len(board[0])):\n if self.dfs(board, i, j, word):\n return True\nreturn False",
"if len(word) == 0:\n return True\nif i < 0 or i >= len(board) or j < 0 or (j >= len(board[0])) or (board[i][j] != word[0]):\n r... | <|body_start_0|>
if not board:
return False
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(board, i, j, word):
return True
return False
<|end_body_0|>
<|body_start_1|>
if len(word) == 0:
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def exist(self, board, word):
""":type board: List[List[str]] :type word: str :rtype: bool"""
<|body_0|>
def dfs(self, board, i, j, word):
""":type board: List[List[str]] :type i: next loc row :type i: next loc col :type word: str :rtype: bool"""
<|... | stack_v2_sparse_classes_36k_train_016845 | 1,874 | no_license | [
{
"docstring": ":type board: List[List[str]] :type word: str :rtype: bool",
"name": "exist",
"signature": "def exist(self, board, word)"
},
{
"docstring": ":type board: List[List[str]] :type i: next loc row :type i: next loc col :type word: str :rtype: bool",
"name": "dfs",
"signature": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): :type board: List[List[str]] :type word: str :rtype: bool
- def dfs(self, board, i, j, word): :type board: List[List[str]] :type i: next loc row :ty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): :type board: List[List[str]] :type word: str :rtype: bool
- def dfs(self, board, i, j, word): :type board: List[List[str]] :type i: next loc row :ty... | b77130a0133cd40990c4d7096db5e388de67cbf2 | <|skeleton|>
class Solution:
def exist(self, board, word):
""":type board: List[List[str]] :type word: str :rtype: bool"""
<|body_0|>
def dfs(self, board, i, j, word):
""":type board: List[List[str]] :type i: next loc row :type i: next loc col :type word: str :rtype: bool"""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def exist(self, board, word):
""":type board: List[List[str]] :type word: str :rtype: bool"""
if not board:
return False
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(board, i, j, word):
retu... | the_stack_v2_python_sparse | 79.WordSearch.py | flavorfan/MyLeetCode | train | 0 | |
d71c8d3c1dfa3fdb5b5a6ba9b19102b9791ca71c | [
"janez = User.objects.create(username='Janez', password='geslo')\nTopic.objects.create(body='Recent topic', author=janez)\nTopic.objects.create(body='Old topic', author=janez, date=timezone.now() - datetime.timedelta(days=30))\nComment.objects.create(topic=Topic.objects.get(body='Recent topic'), body='Comment', aut... | <|body_start_0|>
janez = User.objects.create(username='Janez', password='geslo')
Topic.objects.create(body='Recent topic', author=janez)
Topic.objects.create(body='Old topic', author=janez, date=timezone.now() - datetime.timedelta(days=30))
Comment.objects.create(topic=Topic.objects.get(... | Class representing tests connected to the forum app | ArticleTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArticleTests:
"""Class representing tests connected to the forum app"""
def setUp(self):
"""Method that sets up all of the objects used in the test class"""
<|body_0|>
def test_if_recent(self):
"""Tests whether the is_recent topic works correctly"""
<|bod... | stack_v2_sparse_classes_36k_train_016846 | 1,345 | no_license | [
{
"docstring": "Method that sets up all of the objects used in the test class",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Tests whether the is_recent topic works correctly",
"name": "test_if_recent",
"signature": "def test_if_recent(self)"
},
{
"docstring... | 3 | stack_v2_sparse_classes_30k_train_018031 | Implement the Python class `ArticleTests` described below.
Class description:
Class representing tests connected to the forum app
Method signatures and docstrings:
- def setUp(self): Method that sets up all of the objects used in the test class
- def test_if_recent(self): Tests whether the is_recent topic works corre... | Implement the Python class `ArticleTests` described below.
Class description:
Class representing tests connected to the forum app
Method signatures and docstrings:
- def setUp(self): Method that sets up all of the objects used in the test class
- def test_if_recent(self): Tests whether the is_recent topic works corre... | 88ea46883f95a87c5dce384e137848916e51d34e | <|skeleton|>
class ArticleTests:
"""Class representing tests connected to the forum app"""
def setUp(self):
"""Method that sets up all of the objects used in the test class"""
<|body_0|>
def test_if_recent(self):
"""Tests whether the is_recent topic works correctly"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArticleTests:
"""Class representing tests connected to the forum app"""
def setUp(self):
"""Method that sets up all of the objects used in the test class"""
janez = User.objects.create(username='Janez', password='geslo')
Topic.objects.create(body='Recent topic', author=janez)
... | the_stack_v2_python_sparse | backend/forum/tests.py | aljazb/Website | train | 0 |
033eb2fb968ccc450c809a6587941154c2cf3b8f | [
"if len(trust) == 0:\n return 1\nhashmap = dict()\nfor a, b in trust:\n if a not in hashmap:\n hashmap[a] = [1, 0]\n else:\n hashmap[a][0] += 1\n if b not in hashmap:\n hashmap[b] = [0, 1]\n else:\n hashmap[b][1] += 1\nfor p in hashmap:\n if hashmap[p][0] == 0 and hashm... | <|body_start_0|>
if len(trust) == 0:
return 1
hashmap = dict()
for a, b in trust:
if a not in hashmap:
hashmap[a] = [1, 0]
else:
hashmap[a][0] += 1
if b not in hashmap:
hashmap[b] = [0, 1]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findJudge(self, N: int, trust) -> int:
"""哈希表 :param N: :param list[list[int]] trust: :return:"""
<|body_0|>
def findJudge2(self, N: int, trust) -> int:
"""只有是社会名流的入度-出度=N-1 :param N: :param list[list[int]] trust: :return:"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_016847 | 2,379 | no_license | [
{
"docstring": "哈希表 :param N: :param list[list[int]] trust: :return:",
"name": "findJudge",
"signature": "def findJudge(self, N: int, trust) -> int"
},
{
"docstring": "只有是社会名流的入度-出度=N-1 :param N: :param list[list[int]] trust: :return:",
"name": "findJudge2",
"signature": "def findJudge2(... | 2 | stack_v2_sparse_classes_30k_train_003767 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findJudge(self, N: int, trust) -> int: 哈希表 :param N: :param list[list[int]] trust: :return:
- def findJudge2(self, N: int, trust) -> int: 只有是社会名流的入度-出度=N-1 :param N: :param l... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findJudge(self, N: int, trust) -> int: 哈希表 :param N: :param list[list[int]] trust: :return:
- def findJudge2(self, N: int, trust) -> int: 只有是社会名流的入度-出度=N-1 :param N: :param l... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def findJudge(self, N: int, trust) -> int:
"""哈希表 :param N: :param list[list[int]] trust: :return:"""
<|body_0|>
def findJudge2(self, N: int, trust) -> int:
"""只有是社会名流的入度-出度=N-1 :param N: :param list[list[int]] trust: :return:"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findJudge(self, N: int, trust) -> int:
"""哈希表 :param N: :param list[list[int]] trust: :return:"""
if len(trust) == 0:
return 1
hashmap = dict()
for a, b in trust:
if a not in hashmap:
hashmap[a] = [1, 0]
else:
... | the_stack_v2_python_sparse | 华为题库/找到小镇法官.py | 2226171237/Algorithmpractice | train | 0 | |
76f8c05b4d88a698dd9f078ca275b3866ebba2b8 | [
"Parametre.__init__(self, 'emote', 'emote')\nself.schema = '<nom_familier> <message>'\nself.aide_courte = 'fait agir votre familier'\nself.aide_longue = \"Cette commande est identique à la commande %emote% mais pour votre familier : elle vous permet de donner un ordre, comme si le familier faisait un %emote%. Les m... | <|body_start_0|>
Parametre.__init__(self, 'emote', 'emote')
self.schema = '<nom_familier> <message>'
self.aide_courte = 'fait agir votre familier'
self.aide_longue = "Cette commande est identique à la commande %emote% mais pour votre familier : elle vous permet de donner un ordre, comme ... | Commande 'familier emote'. | PrmEmote | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmEmote:
"""Commande 'familier emote'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametre.__... | stack_v2_sparse_classes_36k_train_016848 | 3,084 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007963 | Implement the Python class `PrmEmote` described below.
Class description:
Commande 'familier emote'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmEmote` described below.
Class description:
Commande 'familier emote'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmEmote:
"""Commande 'familier e... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmEmote:
"""Commande 'familier emote'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmEmote:
"""Commande 'familier emote'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'emote', 'emote')
self.schema = '<nom_familier> <message>'
self.aide_courte = 'fait agir votre familier'
self.aide_longue = "Cette commande est i... | the_stack_v2_python_sparse | src/secondaires/familier/commandes/familier/emote.py | vincent-lg/tsunami | train | 5 |
3da61189bcb27a2637d3f969b0ed5973df48a43e | [
"selector = 'li.gallerybox .gallerytext p a::attr(href)'\nfor href in response.css(selector).extract():\n yield Request(f'{self.base_url}{href}', callback=self.parse_item)",
"name_sel = \"meta[property='og:title']::attr(content)\"\nprice_sel = \"//tr[th//text()[contains(., 'Cost(s)')]]/td/div/text()\"\nname = ... | <|body_start_0|>
selector = 'li.gallerybox .gallerytext p a::attr(href)'
for href in response.css(selector).extract():
yield Request(f'{self.base_url}{href}', callback=self.parse_item)
<|end_body_0|>
<|body_start_1|>
name_sel = "meta[property='og:title']::attr(content)"
pric... | Defines the ZeldaItemsSpider | ZeldaItemsSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZeldaItemsSpider:
"""Defines the ZeldaItemsSpider"""
def parse(self, response):
"""Retrieve the links to the items"""
<|body_0|>
def parse_item(self, response):
"""Retrieve the item details"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
selecto... | stack_v2_sparse_classes_36k_train_016849 | 1,055 | no_license | [
{
"docstring": "Retrieve the links to the items",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "Retrieve the item details",
"name": "parse_item",
"signature": "def parse_item(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007590 | Implement the Python class `ZeldaItemsSpider` described below.
Class description:
Defines the ZeldaItemsSpider
Method signatures and docstrings:
- def parse(self, response): Retrieve the links to the items
- def parse_item(self, response): Retrieve the item details | Implement the Python class `ZeldaItemsSpider` described below.
Class description:
Defines the ZeldaItemsSpider
Method signatures and docstrings:
- def parse(self, response): Retrieve the links to the items
- def parse_item(self, response): Retrieve the item details
<|skeleton|>
class ZeldaItemsSpider:
"""Defines... | 0d7ba4cb394edc2f228a67200b5d9b69123025ea | <|skeleton|>
class ZeldaItemsSpider:
"""Defines the ZeldaItemsSpider"""
def parse(self, response):
"""Retrieve the links to the items"""
<|body_0|>
def parse_item(self, response):
"""Retrieve the item details"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZeldaItemsSpider:
"""Defines the ZeldaItemsSpider"""
def parse(self, response):
"""Retrieve the links to the items"""
selector = 'li.gallerybox .gallerytext p a::attr(href)'
for href in response.css(selector).extract():
yield Request(f'{self.base_url}{href}', callback=... | the_stack_v2_python_sparse | data-retrieval/crawl/spiders/zelda_items.py | jitsejan/architecture-patterns-with-python | train | 5 |
c55115cbdfedee65b12683debb025d43596f4d7f | [
"is_merchant = self.checkout_session.is_merchant_address()\nif is_merchant or shipping_addr.country.iso_3166_1_a2 != 'US':\n try:\n user_addr = user.addresses.get(hash=shipping_addr.generate_hash())\n except ObjectDoesNotExist:\n user_addr = UserAddress(user=user)\n user_addr.is_merchant ... | <|body_start_0|>
is_merchant = self.checkout_session.is_merchant_address()
if is_merchant or shipping_addr.country.iso_3166_1_a2 != 'US':
try:
user_addr = user.addresses.get(hash=shipping_addr.generate_hash())
except ObjectDoesNotExist:
user_addr =... | OrderPlacementMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderPlacementMixin:
def update_address_book(self, user, shipping_addr):
"""extend Oscar functionality by setting the is_merchant attribute based on the data saved in session We don't save US addresses in address book as we don't allow shipments within the US anymore"""
<|body_0|... | stack_v2_sparse_classes_36k_train_016850 | 2,234 | no_license | [
{
"docstring": "extend Oscar functionality by setting the is_merchant attribute based on the data saved in session We don't save US addresses in address book as we don't allow shipments within the US anymore",
"name": "update_address_book",
"signature": "def update_address_book(self, user, shipping_addr... | 2 | null | Implement the Python class `OrderPlacementMixin` described below.
Class description:
Implement the OrderPlacementMixin class.
Method signatures and docstrings:
- def update_address_book(self, user, shipping_addr): extend Oscar functionality by setting the is_merchant attribute based on the data saved in session We do... | Implement the Python class `OrderPlacementMixin` described below.
Class description:
Implement the OrderPlacementMixin class.
Method signatures and docstrings:
- def update_address_book(self, user, shipping_addr): extend Oscar functionality by setting the is_merchant attribute based on the data saved in session We do... | 8c3286e9a7da8f4ae0401a81c8037585b3bb7ba6 | <|skeleton|>
class OrderPlacementMixin:
def update_address_book(self, user, shipping_addr):
"""extend Oscar functionality by setting the is_merchant attribute based on the data saved in session We don't save US addresses in address book as we don't allow shipments within the US anymore"""
<|body_0|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrderPlacementMixin:
def update_address_book(self, user, shipping_addr):
"""extend Oscar functionality by setting the is_merchant attribute based on the data saved in session We don't save US addresses in address book as we don't allow shipments within the US anymore"""
is_merchant = self.chec... | the_stack_v2_python_sparse | apps/checkout/mixins.py | embedded1/django-package-forwarding | train | 0 | |
3eaf42276629e55a2632c84547234fab76f8d879 | [
"g = Pipeline.__call__(self, *args, **kwargs)\ngs = g.glyph.glyph_source\nif not 'mode' in kwargs:\n gs.glyph_source = gs.glyph_list[-1]\ngs.glyph_position = 'tail'\ngs.glyph_source.center = (0.0, 0.0, 0.5)\ng.glyph.glyph.orient = False\nif not 'color' in kwargs:\n g.glyph.color_mode = 'color_by_scalar'\nif n... | <|body_start_0|>
g = Pipeline.__call__(self, *args, **kwargs)
gs = g.glyph.glyph_source
if not 'mode' in kwargs:
gs.glyph_source = gs.glyph_list[-1]
gs.glyph_position = 'tail'
gs.glyph_source.center = (0.0, 0.0, 0.5)
g.glyph.glyph.orient = False
if not... | 2012.2.21 custom version of BarChart. It has two more keyword arguments, x_scale, y_scale, which is in charge of the lateral_scale in the X and Y direction. Plots vertical glyphs (like bars) scaled vertical, to do histogram-like plots. This functions accepts a wide variety of inputs, with positions given in 2-D or in 3... | CustomBarChart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomBarChart:
"""2012.2.21 custom version of BarChart. It has two more keyword arguments, x_scale, y_scale, which is in charge of the lateral_scale in the X and Y direction. Plots vertical glyphs (like bars) scaled vertical, to do histogram-like plots. This functions accepts a wide variety of i... | stack_v2_sparse_classes_36k_train_016851 | 5,432 | no_license | [
{
"docstring": "Override the call to be able to scale automaticaly the axis.",
"name": "__call__",
"signature": "def __call__(self, *args, **kwargs)"
},
{
"docstring": "2012.2.21 this function determines the set of possible keys in kwargs. add two keywords, x_scale, y_scale. Returns all the trai... | 2 | stack_v2_sparse_classes_30k_train_007663 | Implement the Python class `CustomBarChart` described below.
Class description:
2012.2.21 custom version of BarChart. It has two more keyword arguments, x_scale, y_scale, which is in charge of the lateral_scale in the X and Y direction. Plots vertical glyphs (like bars) scaled vertical, to do histogram-like plots. Thi... | Implement the Python class `CustomBarChart` described below.
Class description:
2012.2.21 custom version of BarChart. It has two more keyword arguments, x_scale, y_scale, which is in charge of the lateral_scale in the X and Y direction. Plots vertical glyphs (like bars) scaled vertical, to do histogram-like plots. Thi... | b9333b85daed71032a1cba766585d0be1986ffdb | <|skeleton|>
class CustomBarChart:
"""2012.2.21 custom version of BarChart. It has two more keyword arguments, x_scale, y_scale, which is in charge of the lateral_scale in the X and Y direction. Plots vertical glyphs (like bars) scaled vertical, to do histogram-like plots. This functions accepts a wide variety of i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomBarChart:
"""2012.2.21 custom version of BarChart. It has two more keyword arguments, x_scale, y_scale, which is in charge of the lateral_scale in the X and Y direction. Plots vertical glyphs (like bars) scaled vertical, to do histogram-like plots. This functions accepts a wide variety of inputs, with p... | the_stack_v2_python_sparse | pymodule/plot/yh_mayavi.py | polyactis/gwasmodules | train | 0 |
5e94920ec3f7aece10243db2afd9ebc2db742f65 | [
"super(ResistiveWall, self).__init__(*args, **kwargs)\nself.pipe_radius = np.array([pipe_radius]).flatten()\nself.resistive_wall_length = resistive_wall_length\nself.conductivity = conductivity\nself.dt_min = dt_min\nself.Yokoya_X1 = Yokoya_X1\nself.Yokoya_Y1 = Yokoya_Y1\nself.Yokoya_X2 = Yokoya_X2\nself.Yokoya_Y2 ... | <|body_start_0|>
super(ResistiveWall, self).__init__(*args, **kwargs)
self.pipe_radius = np.array([pipe_radius]).flatten()
self.resistive_wall_length = resistive_wall_length
self.conductivity = conductivity
self.dt_min = dt_min
self.Yokoya_X1 = Yokoya_X1
self.Yoko... | Class to describe the wake functions originating from a resistive wall impedance. | ResistiveWall | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResistiveWall:
"""Class to describe the wake functions originating from a resistive wall impedance."""
def __init__(self, pipe_radius, resistive_wall_length, conductivity, dt_min, Yokoya_X1, Yokoya_Y1, Yokoya_X2, Yokoya_Y2, n_turns_wake=1, *args, **kwargs):
"""General constructor to ... | stack_v2_sparse_classes_36k_train_016852 | 28,906 | permissive | [
{
"docstring": "General constructor to create a ResistiveWall WakeSource object describing the wake functions of a resistive wall impedance. The parameter 'n_turns_wake' defines how many turns are considered for the multiturn wakes. It is 1 by default, i.e. multiturn wakes are off.",
"name": "__init__",
... | 3 | null | Implement the Python class `ResistiveWall` described below.
Class description:
Class to describe the wake functions originating from a resistive wall impedance.
Method signatures and docstrings:
- def __init__(self, pipe_radius, resistive_wall_length, conductivity, dt_min, Yokoya_X1, Yokoya_Y1, Yokoya_X2, Yokoya_Y2, ... | Implement the Python class `ResistiveWall` described below.
Class description:
Class to describe the wake functions originating from a resistive wall impedance.
Method signatures and docstrings:
- def __init__(self, pipe_radius, resistive_wall_length, conductivity, dt_min, Yokoya_X1, Yokoya_Y1, Yokoya_X2, Yokoya_Y2, ... | b238bf3fbea02fcfaf8795ee54cc0e3134de477a | <|skeleton|>
class ResistiveWall:
"""Class to describe the wake functions originating from a resistive wall impedance."""
def __init__(self, pipe_radius, resistive_wall_length, conductivity, dt_min, Yokoya_X1, Yokoya_Y1, Yokoya_X2, Yokoya_Y2, n_turns_wake=1, *args, **kwargs):
"""General constructor to ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResistiveWall:
"""Class to describe the wake functions originating from a resistive wall impedance."""
def __init__(self, pipe_radius, resistive_wall_length, conductivity, dt_min, Yokoya_X1, Yokoya_Y1, Yokoya_X2, Yokoya_Y2, n_turns_wake=1, *args, **kwargs):
"""General constructor to create a Resi... | the_stack_v2_python_sparse | PyHEADTAIL/impedances/wakes.py | PyCOMPLETE/PyHEADTAIL | train | 39 |
2253945e78d2af5578497bb51b23cc8d9f441bb7 | [
"data = deque()\n\ndef code(node):\n if node is None:\n data.appendleft(None)\n return\n data.appendleft(node.val)\n code(node.left)\n code(node.right)\ncode(root)\nreturn data",
"def decode():\n value = data.pop()\n if value is None:\n return None\n node = TreeNode(value... | <|body_start_0|>
data = deque()
def code(node):
if node is None:
data.appendleft(None)
return
data.appendleft(node.val)
code(node.left)
code(node.right)
code(root)
return data
<|end_body_0|>
<|body_start_1|... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_016853 | 1,564 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_016099 | 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:... | 97246c26483637b95198ed2ef76e234d3c0194dc | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
data = deque()
def code(node):
if node is None:
data.appendleft(None)
return
data.appendleft(node.val)
code(n... | the_stack_v2_python_sparse | coding/leetcode/fb/serialize_and_deserialize_binary_treev1.py | baites/examples | train | 4 | |
b55bc9fd469789a0ea79742a8569f8bd3aee2356 | [
"num_examples = x.shape[0]\none_hot_size = 21\nN = 11\nkeep_mask = T.addbroadcast(self.s_rng.binomial(size=(num_examples, 1), p=1 - self.corruption_level, dtype='int8'), 1)\nfor i in range(N):\n pvals = T.alloc(1.0 / one_hot_size, one_hot_size)\n if i == 0:\n one_hot = self.s_rng.multinomial(size=(num_... | <|body_start_0|>
num_examples = x.shape[0]
one_hot_size = 21
N = 11
keep_mask = T.addbroadcast(self.s_rng.binomial(size=(num_examples, 1), p=1 - self.corruption_level, dtype='int8'), 1)
for i in range(N):
pvals = T.alloc(1.0 / one_hot_size, one_hot_size)
i... | Corrupts a one-hot vector by changing active element with some probability. | ProteinOneHotCorruptor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProteinOneHotCorruptor:
"""Corrupts a one-hot vector by changing active element with some probability."""
def _corrupt(self, x):
"""Corrupts a single tensor_like object. Parameters ---------- x : tensor_like Theano symbolic representing a (mini)batch of inputs to be corrupted, with t... | stack_v2_sparse_classes_36k_train_016854 | 1,838 | no_license | [
{
"docstring": "Corrupts a single tensor_like object. Parameters ---------- x : tensor_like Theano symbolic representing a (mini)batch of inputs to be corrupted, with the first dimension indexing training examples and the second indexing data dimensions. Returns ------- corrupted : tensor_like Theano symbolic r... | 2 | stack_v2_sparse_classes_30k_train_011145 | Implement the Python class `ProteinOneHotCorruptor` described below.
Class description:
Corrupts a one-hot vector by changing active element with some probability.
Method signatures and docstrings:
- def _corrupt(self, x): Corrupts a single tensor_like object. Parameters ---------- x : tensor_like Theano symbolic rep... | Implement the Python class `ProteinOneHotCorruptor` described below.
Class description:
Corrupts a one-hot vector by changing active element with some probability.
Method signatures and docstrings:
- def _corrupt(self, x): Corrupts a single tensor_like object. Parameters ---------- x : tensor_like Theano symbolic rep... | 0c84220b801f42cc5a95a7ee5fcaa73ad5b3ed50 | <|skeleton|>
class ProteinOneHotCorruptor:
"""Corrupts a one-hot vector by changing active element with some probability."""
def _corrupt(self, x):
"""Corrupts a single tensor_like object. Parameters ---------- x : tensor_like Theano symbolic representing a (mini)batch of inputs to be corrupted, with t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProteinOneHotCorruptor:
"""Corrupts a one-hot vector by changing active element with some probability."""
def _corrupt(self, x):
"""Corrupts a single tensor_like object. Parameters ---------- x : tensor_like Theano symbolic representing a (mini)batch of inputs to be corrupted, with the first dime... | the_stack_v2_python_sparse | dataset_corruption.py | MM88/SVC_amino | train | 0 |
5d1aadb7c69aab49f4a3ba6a4c20d9919aaa38fb | [
"style = wx.CB_READONLY | wx.CB_DROPDOWN\niqBitmapComboBox.__init__(self, parent, id=wx.NewId(), size=DEFAULT_COMBO_SIZE, style=style)\nif compare_funcs:\n self.appendItems(compare_funcs)",
"selection = self.getCurrentSelection()\nif selection >= 0:\n return self.items[selection]\nreturn None"
] | <|body_start_0|>
style = wx.CB_READONLY | wx.CB_DROPDOWN
iqBitmapComboBox.__init__(self, parent, id=wx.NewId(), size=DEFAULT_COMBO_SIZE, style=style)
if compare_funcs:
self.appendItems(compare_funcs)
<|end_body_0|>
<|body_start_1|>
selection = self.getCurrentSelection()
... | Select requisite comparison function combobox class. | iqFuncComboBox | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iqFuncComboBox:
"""Select requisite comparison function combobox class."""
def __init__(self, parent, compare_funcs=None):
"""Constructor."""
<|body_0|>
def getSelectedFunc(self):
"""Get selected function data."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_016855 | 19,825 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, parent, compare_funcs=None)"
},
{
"docstring": "Get selected function data.",
"name": "getSelectedFunc",
"signature": "def getSelectedFunc(self)"
}
] | 2 | null | Implement the Python class `iqFuncComboBox` described below.
Class description:
Select requisite comparison function combobox class.
Method signatures and docstrings:
- def __init__(self, parent, compare_funcs=None): Constructor.
- def getSelectedFunc(self): Get selected function data. | Implement the Python class `iqFuncComboBox` described below.
Class description:
Select requisite comparison function combobox class.
Method signatures and docstrings:
- def __init__(self, parent, compare_funcs=None): Constructor.
- def getSelectedFunc(self): Get selected function data.
<|skeleton|>
class iqFuncCombo... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iqFuncComboBox:
"""Select requisite comparison function combobox class."""
def __init__(self, parent, compare_funcs=None):
"""Constructor."""
<|body_0|>
def getSelectedFunc(self):
"""Get selected function data."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class iqFuncComboBox:
"""Select requisite comparison function combobox class."""
def __init__(self, parent, compare_funcs=None):
"""Constructor."""
style = wx.CB_READONLY | wx.CB_DROPDOWN
iqBitmapComboBox.__init__(self, parent, id=wx.NewId(), size=DEFAULT_COMBO_SIZE, style=style)
... | the_stack_v2_python_sparse | iq/components/wx_filterchoicectrl/filter_builder_ctrl.py | XHermitOne/iq_framework | train | 1 |
30ba9c21f32cea9d098dc8596f28ec061def3b8a | [
"step3()\nshili = login_shili\nr = shili.login('halo', '123456')\nassert '首页' in r.text\nprint(r.text)",
"step3_1()\nshili = login_shili\nr = shili.login('halo', '23541232')\nassert '登录' in r.text",
"step3_2()\nshili = login_shili\nr = shili.login('halo', 'asdddddddddasdwqfaf')\nassert '登录' in r.text",
"step3... | <|body_start_0|>
step3()
shili = login_shili
r = shili.login('halo', '123456')
assert '首页' in r.text
print(r.text)
<|end_body_0|>
<|body_start_1|>
step3_1()
shili = login_shili
r = shili.login('halo', '23541232')
assert '登录' in r.text
<|end_body_1... | Test_login | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_login:
def test_1213(self, login_shili):
"""接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:a... | stack_v2_sparse_classes_36k_train_016856 | 8,089 | no_license | [
{
"docstring": "接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:account=halo&password=123456",
"name": "test_1213",
... | 5 | stack_v2_sparse_classes_30k_train_020763 | Implement the Python class `Test_login` described below.
Class description:
Implement the Test_login class.
Method signatures and docstrings:
- def test_1213(self, login_shili): 接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: applic... | Implement the Python class `Test_login` described below.
Class description:
Implement the Test_login class.
Method signatures and docstrings:
- def test_1213(self, login_shili): 接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: applic... | c3ca50f34dedb3d400fd303957198c4ca006a821 | <|skeleton|>
class Test_login:
def test_1213(self, login_shili):
"""接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_login:
def test_1213(self, login_shili):
"""接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:account=halo&pa... | the_stack_v2_python_sparse | project_hrun/test_login_registers/test_regist_login.py | haloyazhou/halo_1 | train | 0 | |
6b5b8b863ee843e6d049c532323d9f9982ceb79f | [
"self.graph = graph\noptions = {'with_labels': False, 'node_shape': 'o', 'node_color': '#B71C1C', 'edge_color': '#455A64', 'node_size': 200, 'font_color': '#006064', 'width': 1, 'draw_edge_labels': False}\nfor option, val in kwargs.items():\n options[option] = val\nself.options = options",
"ax.set_title(title,... | <|body_start_0|>
self.graph = graph
options = {'with_labels': False, 'node_shape': 'o', 'node_color': '#B71C1C', 'edge_color': '#455A64', 'node_size': 200, 'font_color': '#006064', 'width': 1, 'draw_edge_labels': False}
for option, val in kwargs.items():
options[option] = val
... | GraphDrawer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphDrawer:
def __init__(self, graph: Graph, **kwargs) -> None:
"""[summary] Arguments: graph {Graph} -- [description]"""
<|body_0|>
def draw(self, ax: SubplotBase, title: str='') -> None:
"""[summary] Arguments: ax {SubplotBase} -- [description] Keyword Arguments: ... | stack_v2_sparse_classes_36k_train_016857 | 1,607 | no_license | [
{
"docstring": "[summary] Arguments: graph {Graph} -- [description]",
"name": "__init__",
"signature": "def __init__(self, graph: Graph, **kwargs) -> None"
},
{
"docstring": "[summary] Arguments: ax {SubplotBase} -- [description] Keyword Arguments: title {str} -- [description] (default: {''})",
... | 2 | stack_v2_sparse_classes_30k_train_008555 | Implement the Python class `GraphDrawer` described below.
Class description:
Implement the GraphDrawer class.
Method signatures and docstrings:
- def __init__(self, graph: Graph, **kwargs) -> None: [summary] Arguments: graph {Graph} -- [description]
- def draw(self, ax: SubplotBase, title: str='') -> None: [summary] ... | Implement the Python class `GraphDrawer` described below.
Class description:
Implement the GraphDrawer class.
Method signatures and docstrings:
- def __init__(self, graph: Graph, **kwargs) -> None: [summary] Arguments: graph {Graph} -- [description]
- def draw(self, ax: SubplotBase, title: str='') -> None: [summary] ... | 407d96939eabb294d2193ebaffe57649b75373b5 | <|skeleton|>
class GraphDrawer:
def __init__(self, graph: Graph, **kwargs) -> None:
"""[summary] Arguments: graph {Graph} -- [description]"""
<|body_0|>
def draw(self, ax: SubplotBase, title: str='') -> None:
"""[summary] Arguments: ax {SubplotBase} -- [description] Keyword Arguments: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphDrawer:
def __init__(self, graph: Graph, **kwargs) -> None:
"""[summary] Arguments: graph {Graph} -- [description]"""
self.graph = graph
options = {'with_labels': False, 'node_shape': 'o', 'node_color': '#B71C1C', 'edge_color': '#455A64', 'node_size': 200, 'font_color': '#006064',... | the_stack_v2_python_sparse | src/crawler/viz/drawer.py | chrisPiemonte/argonaut | train | 8 | |
6ae2a5d02c4da06fb0a46b721b807cc34759ef2e | [
"if data is None:\n if n <= 0:\n raise ValueError('n must be a positive value')\n elif p <= 0 or p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\n else:\n self.n = int(n)\n self.p = float(p)\nelif type(data) != list:\n TypeError('data must be a list')\n... | <|body_start_0|>
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
elif p <= 0 or p >= 1:
raise ValueError('p must be greater than 0 and less than 1')
else:
self.n = int(n)
self.p = float... | docs | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""docs"""
def __init__(self, data=None, n=1, p=0.5):
"""docs"""
<|body_0|>
def pmf(self, k):
"""docs"""
<|body_1|>
def cdf(self, k):
"""docs"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
if data is None:
... | stack_v2_sparse_classes_36k_train_016858 | 1,581 | no_license | [
{
"docstring": "docs",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "docs",
"name": "pmf",
"signature": "def pmf(self, k)"
},
{
"docstring": "docs",
"name": "cdf",
"signature": "def cdf(self, k)"
}
] | 3 | stack_v2_sparse_classes_30k_train_020577 | Implement the Python class `Binomial` described below.
Class description:
docs
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): docs
- def pmf(self, k): docs
- def cdf(self, k): docs | Implement the Python class `Binomial` described below.
Class description:
docs
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): docs
- def pmf(self, k): docs
- def cdf(self, k): docs
<|skeleton|>
class Binomial:
"""docs"""
def __init__(self, data=None, n=1, p=0.5):
"""d... | 5f86dee95f4d1c32014d0d74a368f342ff3ce6f7 | <|skeleton|>
class Binomial:
"""docs"""
def __init__(self, data=None, n=1, p=0.5):
"""docs"""
<|body_0|>
def pmf(self, k):
"""docs"""
<|body_1|>
def cdf(self, k):
"""docs"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binomial:
"""docs"""
def __init__(self, data=None, n=1, p=0.5):
"""docs"""
if data is None:
if n <= 0:
raise ValueError('n must be a positive value')
elif p <= 0 or p >= 1:
raise ValueError('p must be greater than 0 and less than 1')... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | d1sd41n/holbertonschool-machine_learning | train | 0 |
d4bf322be501cd9bfbf4c71d03cc1afaa6da019b | [
"self._path = path\nself._summary_dirs: List[Path] = []\nevent_files = self._discover_event_files(self._path)\ncb_summaries = self._discover_cerebras_summary_dirs(event_files)\nself._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries)\nif not self._summary_dirs:\n logging.warning(f'Could not find any... | <|body_start_0|>
self._path = path
self._summary_dirs: List[Path] = []
event_files = self._discover_event_files(self._path)
cb_summaries = self._discover_cerebras_summary_dirs(event_files)
self._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries)
if not self._... | Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live run. As more data becomes available, calling the ... | TensorSummaryReader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TensorSummaryReader:
"""Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live ru... | stack_v2_sparse_classes_36k_train_016859 | 16,325 | permissive | [
{
"docstring": "Constructs a `TensorSummaryReader` instance. Args: path: Path to a Tensorboard events file or a directory containing Tensorboard events files. Location of tensor summaries are inferred from these events files as there is a one-to-one mapping from Tensorboard events files and tensor summary direc... | 6 | stack_v2_sparse_classes_30k_train_003353 | Implement the Python class `TensorSummaryReader` described below.
Class description:
Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching.... | Implement the Python class `TensorSummaryReader` described below.
Class description:
Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching.... | 97bdaf4460ace1681ad437b07ba33f0e179f5ca4 | <|skeleton|>
class TensorSummaryReader:
"""Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live ru... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TensorSummaryReader:
"""Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live run. As more da... | the_stack_v2_python_sparse | modelzoo/common/pytorch/summaries/tensor_summary.py | Cerebras/modelzoo | train | 644 |
124c6612bf3fa823f865ffcee035f72521988bfe | [
"super(BiRNN, self).__init__(**kwargs)\nself.embedding = nn.Embedding(len(vocab), embed_size)\nself.encoder = rnn.LSTM(num_hiddens, num_layers=num_layers, bidirectional=True, input_size=embed_size)\nself.decoder = nn.Dense(2)",
"embeddings = self.embedding(inputs.T)\nstates = self.encoder(embeddings)\nencoding = ... | <|body_start_0|>
super(BiRNN, self).__init__(**kwargs)
self.embedding = nn.Embedding(len(vocab), embed_size)
self.encoder = rnn.LSTM(num_hiddens, num_layers=num_layers, bidirectional=True, input_size=embed_size)
self.decoder = nn.Dense(2)
<|end_body_0|>
<|body_start_1|>
embeddin... | BiRNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiRNN:
def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs):
"""1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :p... | stack_v2_sparse_classes_36k_train_016860 | 6,973 | no_license | [
{
"docstring": "1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :param kwargs:",
"name": "__init__",
"signature": "def __init__(self, vocab, embed_siz... | 2 | null | Implement the Python class `BiRNN` described below.
Class description:
Implement the BiRNN class.
Method signatures and docstrings:
- def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): 1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作... | Implement the Python class `BiRNN` described below.
Class description:
Implement the BiRNN class.
Method signatures and docstrings:
- def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs): 1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作... | cfca78f2d351caa58092ce5e6b955347aba6637e | <|skeleton|>
class BiRNN:
def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs):
"""1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BiRNN:
def __init__(self, vocab, embed_size, num_hiddens, num_layers, **kwargs):
"""1、在此模型中,每个词先通过嵌入层得到特征向量; 2、使用双向循环神经网络对特征序列进一步编码,从而得到序列信息; 3、将编码后的序列信息通过全连接层变换成输出 将双向长短期记忆在最初时间步和最终时间步的隐藏状态连结,作为特征序列的编码信息 传递给输出层分类 :param vocab: :param embed_size: :param num_hiddens: :param num_layers: :param kwargs:""... | the_stack_v2_python_sparse | NLP_exercise/NLP_exercise/text_emotion_classification.py | Jeff654/my_machine_learning | train | 1 | |
a9ceafab490122dac75b3d293f5f2c34a175258a | [
"super().__init__()\nself.set_config({'integrator_dict': integrator_dict, 'B_dict': B_dict, 't0': t0, 't_end': t_end, 'q0_dict': q0_dict, 'dq0_dict': dq0_dict, 'ddq0_dict': ddq0_dict, 'use_parallel': False, 'global_solver': PCPGsolver(), 'preconditioner': DirichletPreconditioner(), 'scaling': MultiplicityScaling()}... | <|body_start_0|>
super().__init__()
self.set_config({'integrator_dict': integrator_dict, 'B_dict': B_dict, 't0': t0, 't_end': t_end, 'q0_dict': q0_dict, 'dq0_dict': dq0_dict, 'ddq0_dict': ddq0_dict, 'use_parallel': False, 'global_solver': PCPGsolver(), 'preconditioner': DirichletPreconditioner(), 'scali... | FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration | LinearDynamicFetiSolver | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearDynamicFetiSolver:
"""FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration"""
def __init__(self, integrator_dict, ... | stack_v2_sparse_classes_36k_train_016861 | 13,384 | permissive | [
{
"docstring": "Parameters ---------- integrator_dict : dict integrator-objects describing the dynamic behavior of the local problems. For detailed specifications on the Integrator-class see `Basics of time-integration` or `Requirements to an Integrator-Class` and for the required API the :class:`~amfeti.local_... | 3 | stack_v2_sparse_classes_30k_train_021338 | Implement the Python class `LinearDynamicFetiSolver` described below.
Class description:
FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration
Meth... | Implement the Python class `LinearDynamicFetiSolver` described below.
Class description:
FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration
Meth... | be209dffe4d170aca735f1e912fd5cb448502119 | <|skeleton|>
class LinearDynamicFetiSolver:
"""FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration"""
def __init__(self, integrator_dict, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearDynamicFetiSolver:
"""FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration"""
def __init__(self, integrator_dict, B_dict, t0, t... | the_stack_v2_python_sparse | amfeti/feti_solvers/dynamic_feti_solver.py | AppliedMechanics/AMfeti | train | 3 |
e2064189ead1822de08470740c14e6e499e797b4 | [
"try:\n self.balanced_height_check(node)\nexcept self.NotBalancedError:\n return False\nreturn True",
"if not node:\n return 0\nleft_height = self.balanced_height_check(node.left)\nright_height = self.balanced_height_check(node.right)\nif abs(left_height - right_height) > 1:\n raise self.NotBalancedEr... | <|body_start_0|>
try:
self.balanced_height_check(node)
except self.NotBalancedError:
return False
return True
<|end_body_0|>
<|body_start_1|>
if not node:
return 0
left_height = self.balanced_height_check(node.left)
right_height = self... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def is_balanced(self, node):
"""Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:"""
<|body_0|>
def balanced_height_check(self, node):
"""Get the height of the tree. Also check that the tree is ... | stack_v2_sparse_classes_36k_train_016862 | 1,593 | no_license | [
{
"docstring": "Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:",
"name": "is_balanced",
"signature": "def is_balanced(self, node)"
},
{
"docstring": "Get the height of the tree. Also check that the tree is balanced.",
"name": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_balanced(self, node): Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:
- def balanced_height_check(self, no... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def is_balanced(self, node): Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:
- def balanced_height_check(self, no... | 9cfc663c5bb382f9983eb82e60344bd290e7284b | <|skeleton|>
class Solution:
def is_balanced(self, node):
"""Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:"""
<|body_0|>
def balanced_height_check(self, node):
"""Get the height of the tree. Also check that the tree is ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def is_balanced(self, node):
"""Return True if the depth of children at any node differs by more than 1. :param node: The node to check :return:"""
try:
self.balanced_height_check(node)
except self.NotBalancedError:
return False
return True
... | the_stack_v2_python_sparse | c4/4_4_check_balanced.py | ltn100/ctci | train | 0 | |
205a917014fe4ffadf6aa7c7284ca32f206ea7b1 | [
"self.bus_number = bus_number\nself.controller_type = controller_type\nself.unit_number = unit_number",
"if dictionary is None:\n return None\nbus_number = dictionary.get('busNumber')\ncontroller_type = dictionary.get('controllerType')\nunit_number = dictionary.get('unitNumber')\nreturn cls(bus_number, control... | <|body_start_0|>
self.bus_number = bus_number
self.controller_type = controller_type
self.unit_number = unit_number
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
bus_number = dictionary.get('busNumber')
controller_type = dictionary.get('c... | Implementation of the 'DiskUnit' model. Specifies information about a disk unit in a controller. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. unit_number (long|int): Specifies the disk fil... | DiskUnit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiskUnit:
"""Implementation of the 'DiskUnit' model. Specifies information about a disk unit in a controller. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. unit_numbe... | stack_v2_sparse_classes_36k_train_016863 | 1,994 | permissive | [
{
"docstring": "Constructor for the DiskUnit class",
"name": "__init__",
"signature": "def __init__(self, bus_number=None, controller_type=None, unit_number=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of... | 2 | null | Implement the Python class `DiskUnit` described below.
Class description:
Implementation of the 'DiskUnit' model. Specifies information about a disk unit in a controller. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller... | Implement the Python class `DiskUnit` described below.
Class description:
Implementation of the 'DiskUnit' model. Specifies information about a disk unit in a controller. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class DiskUnit:
"""Implementation of the 'DiskUnit' model. Specifies information about a disk unit in a controller. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. unit_numbe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiskUnit:
"""Implementation of the 'DiskUnit' model. Specifies information about a disk unit in a controller. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. unit_number (long|int):... | the_stack_v2_python_sparse | cohesity_management_sdk/models/disk_unit.py | cohesity/management-sdk-python | train | 24 |
7513b936056db28a6a62f662f805fbc43148b426 | [
"result = deepcopy(Nat.zero)\nfor _ in range(x):\n result = Nat.S(result)\nreturn result",
"if not isinstance(x, FuncTerm) or x.sort != Nat.sort:\n raise ValueError('to_int function expects a nat.')\nif x == Nat.zero:\n return 0\nif isinstance(x, FuncTerm) and x.function == Nat.S:\n return 1 + cls.to_... | <|body_start_0|>
result = deepcopy(Nat.zero)
for _ in range(x):
result = Nat.S(result)
return result
<|end_body_0|>
<|body_start_1|>
if not isinstance(x, FuncTerm) or x.sort != Nat.sort:
raise ValueError('to_int function expects a nat.')
if x == Nat.zero:... | Nat | [
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Nat:
def from_int(cls, x: int) -> Term:
"""Converts an integer to a nat."""
<|body_0|>
def to_int(cls, x: Term) -> int:
"""Converts a nat to an int."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = deepcopy(Nat.zero)
for _ in range(x... | stack_v2_sparse_classes_36k_train_016864 | 6,439 | permissive | [
{
"docstring": "Converts an integer to a nat.",
"name": "from_int",
"signature": "def from_int(cls, x: int) -> Term"
},
{
"docstring": "Converts a nat to an int.",
"name": "to_int",
"signature": "def to_int(cls, x: Term) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_000459 | Implement the Python class `Nat` described below.
Class description:
Implement the Nat class.
Method signatures and docstrings:
- def from_int(cls, x: int) -> Term: Converts an integer to a nat.
- def to_int(cls, x: Term) -> int: Converts a nat to an int. | Implement the Python class `Nat` described below.
Class description:
Implement the Nat class.
Method signatures and docstrings:
- def from_int(cls, x: int) -> Term: Converts an integer to a nat.
- def to_int(cls, x: Term) -> int: Converts a nat to an int.
<|skeleton|>
class Nat:
def from_int(cls, x: int) -> Ter... | 9e8351bfe49b09da17eaa7862572e9b09c45e13c | <|skeleton|>
class Nat:
def from_int(cls, x: int) -> Term:
"""Converts an integer to a nat."""
<|body_0|>
def to_int(cls, x: Term) -> int:
"""Converts a nat to an int."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Nat:
def from_int(cls, x: int) -> Term:
"""Converts an integer to a nat."""
result = deepcopy(Nat.zero)
for _ in range(x):
result = Nat.S(result)
return result
def to_int(cls, x: Term) -> int:
"""Converts a nat to an int."""
if not isinstance(x,... | the_stack_v2_python_sparse | theories/symcollab/theories/old/_nat_old.py | symcollab/CryptoSolve | train | 1 | |
568bc8b7c327a414e176f397298fca068106f5cb | [
"if root != None:\n if root.left != None or root.right != None:\n root.left, root.right = (root.right, root.left)\n self.invertTree(root.left)\n self.invertTree(root.right)\nreturn root",
"if p != None and q != None:\n if p.val != q.val:\n return False\n if self.isSameTree(p.l... | <|body_start_0|>
if root != None:
if root.left != None or root.right != None:
root.left, root.right = (root.right, root.left)
self.invertTree(root.left)
self.invertTree(root.right)
return root
<|end_body_0|>
<|body_start_1|>
if p != No... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def isSameTree(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
<|body_1|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype... | stack_v2_sparse_classes_36k_train_016865 | 1,353 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: TreeNode",
"name": "invertTree",
"signature": "def invertTree(self, root)"
},
{
"docstring": ":type p: TreeNode :type q: TreeNode :rtype: bool",
"name": "isSameTree",
"signature": "def isSameTree(self, p, q)"
},
{
"docstring": ":type r... | 3 | stack_v2_sparse_classes_30k_train_002463 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invertTree(self, root): :type root: TreeNode :rtype: TreeNode
- def isSameTree(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
- def isSymmetric(self, root): :t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def invertTree(self, root): :type root: TreeNode :rtype: TreeNode
- def isSameTree(self, p, q): :type p: TreeNode :type q: TreeNode :rtype: bool
- def isSymmetric(self, root): :t... | 7a1c3aba65f338f6e11afd2864dabd2b26142b6c | <|skeleton|>
class Solution:
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
<|body_0|>
def isSameTree(self, p, q):
""":type p: TreeNode :type q: TreeNode :rtype: bool"""
<|body_1|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def invertTree(self, root):
""":type root: TreeNode :rtype: TreeNode"""
if root != None:
if root.left != None or root.right != None:
root.left, root.right = (root.right, root.left)
self.invertTree(root.left)
self.invertTree(... | the_stack_v2_python_sparse | exercise/leetcode/python_src/by2017_Sep/Leet101.py | SS4G/AlgorithmTraining | train | 2 | |
90afdc512039bb722b75b668f4fcf1aa2a511ad9 | [
"self.DNA = DNA\nself.k = kmer\nself.pseudocounts = pseudocount\nself.MotifMatrix = None\nself.ProfileMatrix = None\nself.BestProfileMatrix = None\nself.BestMotif = None\nself.setOfMotifs = {x: [] for x in range(len(DNA))}\nfor i in self.setOfMotifs:\n for kmerSeq in range(len(DNA[i]) - self.k + 1):\n seq... | <|body_start_0|>
self.DNA = DNA
self.k = kmer
self.pseudocounts = pseudocount
self.MotifMatrix = None
self.ProfileMatrix = None
self.BestProfileMatrix = None
self.BestMotif = None
self.setOfMotifs = {x: [] for x in range(len(DNA))}
for i in self.se... | The following class will find the consensus kmer. | RandomizedMotif | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedMotif:
"""The following class will find the consensus kmer."""
def __init__(self, DNA, kmer, pseudocount):
"""Set up the class for needed action."""
<|body_0|>
def RandomMotifSearch(self):
"""Main algorithm to find the consensus Motif."""
<|body... | stack_v2_sparse_classes_36k_train_016866 | 10,527 | no_license | [
{
"docstring": "Set up the class for needed action.",
"name": "__init__",
"signature": "def __init__(self, DNA, kmer, pseudocount)"
},
{
"docstring": "Main algorithm to find the consensus Motif.",
"name": "RandomMotifSearch",
"signature": "def RandomMotifSearch(self)"
},
{
"docst... | 6 | stack_v2_sparse_classes_30k_train_006116 | Implement the Python class `RandomizedMotif` described below.
Class description:
The following class will find the consensus kmer.
Method signatures and docstrings:
- def __init__(self, DNA, kmer, pseudocount): Set up the class for needed action.
- def RandomMotifSearch(self): Main algorithm to find the consensus Mot... | Implement the Python class `RandomizedMotif` described below.
Class description:
The following class will find the consensus kmer.
Method signatures and docstrings:
- def __init__(self, DNA, kmer, pseudocount): Set up the class for needed action.
- def RandomMotifSearch(self): Main algorithm to find the consensus Mot... | 0faa3fb468c784a1f7afb078cb3753d8ac356222 | <|skeleton|>
class RandomizedMotif:
"""The following class will find the consensus kmer."""
def __init__(self, DNA, kmer, pseudocount):
"""Set up the class for needed action."""
<|body_0|>
def RandomMotifSearch(self):
"""Main algorithm to find the consensus Motif."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomizedMotif:
"""The following class will find the consensus kmer."""
def __init__(self, DNA, kmer, pseudocount):
"""Set up the class for needed action."""
self.DNA = DNA
self.k = kmer
self.pseudocounts = pseudocount
self.MotifMatrix = None
self.ProfileM... | the_stack_v2_python_sparse | Assignment3/randomizedMotifSearch.py | mabdulqa/BME205 | train | 0 |
8368b26db219b23c5d2f64e1b2c7593c828f1334 | [
"super(IperfTest, self).__init__()\nself.sender_command = sender_command\nself.receiver_command = receiver_command\nself.wait_events = wait_events\nself._sleep = sleep\nself._kill = None\nreturn",
"if self._kill is None:\n self._kill = KillAll(name='iperf')\nreturn self._kill",
"if self._sleep is None:\n ... | <|body_start_0|>
super(IperfTest, self).__init__()
self.sender_command = sender_command
self.receiver_command = receiver_command
self.wait_events = wait_events
self._sleep = sleep
self._kill = None
return
<|end_body_0|>
<|body_start_1|>
if self._kill is N... | The Iperf Test runs a single iperf test. | IperfTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IperfTest:
"""The Iperf Test runs a single iperf test."""
def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None):
""":param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server... | stack_v2_sparse_classes_36k_train_016867 | 4,384 | permissive | [
{
"docstring": ":param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server parameters - `sleep`: A Sleep object with the sleep time preset - `wait_events`: list of events to wait for",
"name": "__init__",
"signature": "def __init__(s... | 5 | stack_v2_sparse_classes_30k_train_005580 | Implement the Python class `IperfTest` described below.
Class description:
The Iperf Test runs a single iperf test.
Method signatures and docstrings:
- def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): :param: - `sender_command`: an IperfCommand bundled with client paramete... | Implement the Python class `IperfTest` described below.
Class description:
The Iperf Test runs a single iperf test.
Method signatures and docstrings:
- def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None): :param: - `sender_command`: an IperfCommand bundled with client paramete... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class IperfTest:
"""The Iperf Test runs a single iperf test."""
def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None):
""":param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IperfTest:
"""The Iperf Test runs a single iperf test."""
def __init__(self, sender_command=None, receiver_command=None, sleep=None, wait_events=None):
""":param: - `sender_command`: an IperfCommand bundled with client parameters - `receiver_command`: IperfCommand bundled with server parameters -... | the_stack_v2_python_sparse | apetools/tools/iperftest.py | russell-n/oldape | train | 0 |
1551cf21b02340673adabca151988a906dc0f1ae | [
"length = len(array)\nif length < 2:\n return array\nmiddle = length // 2\nleft = Merge.merge_sort(array[:middle])\nright = Merge.merge_sort(array[middle:])\nreturn Merge.merge(left, right)",
"new = []\nleft_index, right_index = (0, 0)\nlen_left, len_right = (len(left), len(right))\nwhile left_index < len_left... | <|body_start_0|>
length = len(array)
if length < 2:
return array
middle = length // 2
left = Merge.merge_sort(array[:middle])
right = Merge.merge_sort(array[middle:])
return Merge.merge(left, right)
<|end_body_0|>
<|body_start_1|>
new = []
lef... | Contains various merge sort implementations. http://en.wikipedia.org/wiki/Merge_sort | Merge | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Merge:
"""Contains various merge sort implementations. http://en.wikipedia.org/wiki/Merge_sort"""
def merge_sort(array):
"""A basic implementation of merge sort. Despite enjoying a lower worst case time complexity, quick sort often outperforms merge sort in practical cases. Uses the ... | stack_v2_sparse_classes_36k_train_016868 | 14,101 | no_license | [
{
"docstring": "A basic implementation of merge sort. Despite enjoying a lower worst case time complexity, quick sort often outperforms merge sort in practical cases. Uses the helper function merge(). Inplace: No Time complexity: all O(nlogn)",
"name": "merge_sort",
"signature": "def merge_sort(array)"
... | 2 | stack_v2_sparse_classes_30k_train_018830 | Implement the Python class `Merge` described below.
Class description:
Contains various merge sort implementations. http://en.wikipedia.org/wiki/Merge_sort
Method signatures and docstrings:
- def merge_sort(array): A basic implementation of merge sort. Despite enjoying a lower worst case time complexity, quick sort o... | Implement the Python class `Merge` described below.
Class description:
Contains various merge sort implementations. http://en.wikipedia.org/wiki/Merge_sort
Method signatures and docstrings:
- def merge_sort(array): A basic implementation of merge sort. Despite enjoying a lower worst case time complexity, quick sort o... | c88059dc66297af577ad2b8afa4e0ac0ad622915 | <|skeleton|>
class Merge:
"""Contains various merge sort implementations. http://en.wikipedia.org/wiki/Merge_sort"""
def merge_sort(array):
"""A basic implementation of merge sort. Despite enjoying a lower worst case time complexity, quick sort often outperforms merge sort in practical cases. Uses the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Merge:
"""Contains various merge sort implementations. http://en.wikipedia.org/wiki/Merge_sort"""
def merge_sort(array):
"""A basic implementation of merge sort. Despite enjoying a lower worst case time complexity, quick sort often outperforms merge sort in practical cases. Uses the helper functi... | the_stack_v2_python_sparse | codes/BuildLinks1.02/test_input/sort_codes/pysort.py | DaHuO/Supergraph | train | 2 |
e38004649af2eb2df5b254c93781728017b50f1c | [
"super().__init__(name, address, terminator=terminator, **kwargs)\nfor quantity in ['VOLT', 'CURR', 'RES', 'FRES', 'TEMP']:\n channel = Keithley_Sense(self, quantity.lower(), quantity)\n self.add_submodule(quantity.lower(), channel)\nself.add_parameter('active_terminal', label='active terminal', get_cmd='ROUT... | <|body_start_0|>
super().__init__(name, address, terminator=terminator, **kwargs)
for quantity in ['VOLT', 'CURR', 'RES', 'FRES', 'TEMP']:
channel = Keithley_Sense(self, quantity.lower(), quantity)
self.add_submodule(quantity.lower(), channel)
self.add_parameter('active_t... | This is the qcodes driver for a Keithley DMM6500 digital multimeter. | Keithley_6500 | [
"GPL-2.0-only",
"GPL-2.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Keithley_6500:
"""This is the qcodes driver for a Keithley DMM6500 digital multimeter."""
def __init__(self, name: str, address: str, terminator='\n', **kwargs):
"""Initialize instance of digital multimeter Keithley6500. Check if scanner card is inserted. Args: name: Name of instrume... | stack_v2_sparse_classes_36k_train_016869 | 6,513 | permissive | [
{
"docstring": "Initialize instance of digital multimeter Keithley6500. Check if scanner card is inserted. Args: name: Name of instrument address: Address of instrument terminator: Termination character for SCPI commands **kwargs: Keyword arguments to pass to __init__ function of VisaInstrument class",
"nam... | 2 | stack_v2_sparse_classes_30k_train_016372 | Implement the Python class `Keithley_6500` described below.
Class description:
This is the qcodes driver for a Keithley DMM6500 digital multimeter.
Method signatures and docstrings:
- def __init__(self, name: str, address: str, terminator='\n', **kwargs): Initialize instance of digital multimeter Keithley6500. Check ... | Implement the Python class `Keithley_6500` described below.
Class description:
This is the qcodes driver for a Keithley DMM6500 digital multimeter.
Method signatures and docstrings:
- def __init__(self, name: str, address: str, terminator='\n', **kwargs): Initialize instance of digital multimeter Keithley6500. Check ... | e07c9f23339ab00b0f4c4cc46711593d88f7fc84 | <|skeleton|>
class Keithley_6500:
"""This is the qcodes driver for a Keithley DMM6500 digital multimeter."""
def __init__(self, name: str, address: str, terminator='\n', **kwargs):
"""Initialize instance of digital multimeter Keithley6500. Check if scanner card is inserted. Args: name: Name of instrume... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Keithley_6500:
"""This is the qcodes driver for a Keithley DMM6500 digital multimeter."""
def __init__(self, name: str, address: str, terminator='\n', **kwargs):
"""Initialize instance of digital multimeter Keithley6500. Check if scanner card is inserted. Args: name: Name of instrument address: A... | the_stack_v2_python_sparse | qcodes_contrib_drivers/drivers/Tektronix/Keithley_6500.py | QCoDeS/Qcodes_contrib_drivers | train | 32 |
4e2922325f0c6dba3a9dbc3144e780db8f2071fe | [
"self.project_name = project_name\nself.bucket = bucket\nself.prefix = prefix",
"try:\n from google.cloud import storage\nexcept ImportError:\n raise ValueError('Could not import google-cloud-storage python package. Please it install it with `pip install google-cloud-storage`.')\nclient = storage.Client(pro... | <|body_start_0|>
self.project_name = project_name
self.bucket = bucket
self.prefix = prefix
<|end_body_0|>
<|body_start_1|>
try:
from google.cloud import storage
except ImportError:
raise ValueError('Could not import google-cloud-storage python package. P... | Loading logic for loading documents from GCS. | GCSDirectoryLoader | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GCSDirectoryLoader:
"""Loading logic for loading documents from GCS."""
def __init__(self, project_name: str, bucket: str, prefix: str=''):
"""Initialize with bucket and key name."""
<|body_0|>
def load(self) -> List[Document]:
"""Load documents."""
<|bod... | stack_v2_sparse_classes_36k_train_016870 | 1,215 | permissive | [
{
"docstring": "Initialize with bucket and key name.",
"name": "__init__",
"signature": "def __init__(self, project_name: str, bucket: str, prefix: str='')"
},
{
"docstring": "Load documents.",
"name": "load",
"signature": "def load(self) -> List[Document]"
}
] | 2 | stack_v2_sparse_classes_30k_train_015178 | Implement the Python class `GCSDirectoryLoader` described below.
Class description:
Loading logic for loading documents from GCS.
Method signatures and docstrings:
- def __init__(self, project_name: str, bucket: str, prefix: str=''): Initialize with bucket and key name.
- def load(self) -> List[Document]: Load docume... | Implement the Python class `GCSDirectoryLoader` described below.
Class description:
Loading logic for loading documents from GCS.
Method signatures and docstrings:
- def __init__(self, project_name: str, bucket: str, prefix: str=''): Initialize with bucket and key name.
- def load(self) -> List[Document]: Load docume... | b8f29af7f3c24cf3a4554bebfa2053064467fbdb | <|skeleton|>
class GCSDirectoryLoader:
"""Loading logic for loading documents from GCS."""
def __init__(self, project_name: str, bucket: str, prefix: str=''):
"""Initialize with bucket and key name."""
<|body_0|>
def load(self) -> List[Document]:
"""Load documents."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GCSDirectoryLoader:
"""Loading logic for loading documents from GCS."""
def __init__(self, project_name: str, bucket: str, prefix: str=''):
"""Initialize with bucket and key name."""
self.project_name = project_name
self.bucket = bucket
self.prefix = prefix
def load(s... | the_stack_v2_python_sparse | langchain/document_loaders/gcs_directory.py | microsoft/MM-REACT | train | 705 |
a161139a64886902e8f007b34a46617d2614aaa5 | [
"self.file_name = file_name\nself.header = None\nself.data = None\nself.model = None\nself._read_file()",
"with open(self.file_name, 'rb') as f:\n new_test = struct.unpack('<l', f.read(8)[4:])[0]\nf.close()\nwith open(self.file_name, 'rb') as f:\n old_test = struct.unpack('<h', f.read(6)[4:])[0]\nf.close()\... | <|body_start_0|>
self.file_name = file_name
self.header = None
self.data = None
self.model = None
self._read_file()
<|end_body_0|>
<|body_start_1|>
with open(self.file_name, 'rb') as f:
new_test = struct.unpack('<l', f.read(8)[4:])[0]
f.close()
... | A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information. | DpFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DpFile:
"""A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information.""... | stack_v2_sparse_classes_36k_train_016871 | 5,404 | no_license | [
{
"docstring": "DpFile instance constructor. Arguments: file_name - The filename for the data file.",
"name": "__init__",
"signature": "def __init__(self, file_name)"
},
{
"docstring": "Read the data file.",
"name": "_read_file",
"signature": "def _read_file(self)"
},
{
"docstrin... | 4 | stack_v2_sparse_classes_30k_train_004645 | Implement the Python class `DpFile` described below.
Class description:
A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance... | Implement the Python class `DpFile` described below.
Class description:
A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance... | 743167940f700374755ea273b90da66befae1ba4 | <|skeleton|>
class DpFile:
"""A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DpFile:
"""A class that holds the information from one file output by a D&P Instruments Model 103F MicroFT or Model 202 TurboFT. Attributes: file_name - The data file name. header - A DpHeader instance holding the header information. data - A DpData instance holding the radiometric information."""
def __... | the_stack_v2_python_sparse | tes/models/dp_models/dp_file.py | max19951001/TES | train | 0 |
cebb7a734f14a44005ed5d34d9ab2f014153bd00 | [
"cur_node = head\npre_node = None\nwhile cur_node:\n next_node = cur_node.next\n cur_node.next = pre_node\n pre_node = cur_node\n cur_node = next_node\nreturn pre_node",
"if not head or not head.next:\n return head\np = self.reverseList2(head.next)\nhead.next.next = head\nhead.next = None\nreturn p... | <|body_start_0|>
cur_node = head
pre_node = None
while cur_node:
next_node = cur_node.next
cur_node.next = pre_node
pre_node = cur_node
cur_node = next_node
return pre_node
<|end_body_0|>
<|body_start_1|>
if not head or not head.ne... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
"""翻转链表,迭代方式 :param head: :return:"""
<|body_0|>
def reverseList2(self, head: ListNode) -> ListNode:
"""递归 :param head: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cur_node = ... | stack_v2_sparse_classes_36k_train_016872 | 1,076 | no_license | [
{
"docstring": "翻转链表,迭代方式 :param head: :return:",
"name": "reverseList",
"signature": "def reverseList(self, head: ListNode) -> ListNode"
},
{
"docstring": "递归 :param head: :return:",
"name": "reverseList2",
"signature": "def reverseList2(self, head: ListNode) -> ListNode"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head: ListNode) -> ListNode: 翻转链表,迭代方式 :param head: :return:
- def reverseList2(self, head: ListNode) -> ListNode: 递归 :param head: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head: ListNode) -> ListNode: 翻转链表,迭代方式 :param head: :return:
- def reverseList2(self, head: ListNode) -> ListNode: 递归 :param head: :return:
<|skeleton|>
cl... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
"""翻转链表,迭代方式 :param head: :return:"""
<|body_0|>
def reverseList2(self, head: ListNode) -> ListNode:
"""递归 :param head: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseList(self, head: ListNode) -> ListNode:
"""翻转链表,迭代方式 :param head: :return:"""
cur_node = head
pre_node = None
while cur_node:
next_node = cur_node.next
cur_node.next = pre_node
pre_node = cur_node
cur_node = n... | the_stack_v2_python_sparse | Interview_preparation/tencent/ReverseList.py | yinhuax/leet_code | train | 0 | |
ef8aa88f2aa0f9589df25608805abbc2e31ec9a9 | [
"args = parser.parse_args()\ntask_id = args.get('task_id')\nrely_task_id = args.get('rely_task_id')\nrequest_id = args.get('request_id')\nsubmitter = args.get('submitter')\npage = args.get('pgnum')\nif not page:\n page = 1\noptions = {'page': page, 'task_id': task_id, 'rely_task_id': rely_task_id, 'request_id': ... | <|body_start_0|>
args = parser.parse_args()
task_id = args.get('task_id')
rely_task_id = args.get('rely_task_id')
request_id = args.get('request_id')
submitter = args.get('submitter')
page = args.get('pgnum')
if not page:
page = 1
options = {'p... | LogTask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogTask:
def get(self):
"""获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: page type: int description: 页码 - name: submitter... | stack_v2_sparse_classes_36k_train_016873 | 3,859 | no_license | [
{
"docstring": "获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: page type: int description: 页码 - name: submitter type: string in: query description... | 2 | null | Implement the Python class `LogTask` described below.
Class description:
Implement the LogTask class.
Method signatures and docstrings:
- def get(self): 获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id typ... | Implement the Python class `LogTask` described below.
Class description:
Implement the LogTask class.
Method signatures and docstrings:
- def get(self): 获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id typ... | 73246bbd492fd991e0329b9a011b5380b11a1618 | <|skeleton|>
class LogTask:
def get(self):
"""获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: page type: int description: 页码 - name: submitter... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogTask:
def get(self):
"""获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: page type: int description: 页码 - name: submitter type: string ... | the_stack_v2_python_sparse | app/main/base/apis/task_logs.py | zhouliang0v0/naguan-kpy | train | 0 | |
4d0c70af6593109ec214ddf4a46e2b3a38aae4fd | [
"n = len(nums)\nnums.sort()\nsubset = []\nfor i in range(2 ** n, 2 ** (n + 1)):\n bitmask = bin(i)[3:]\n sub = []\n for j in range(n):\n if bitmask[j] == '1':\n sub.append(nums[j])\n if sub not in subset:\n subset.append(sub)\nreturn subset",
"def back_track(nums, index, path,... | <|body_start_0|>
n = len(nums)
nums.sort()
subset = []
for i in range(2 ** n, 2 ** (n + 1)):
bitmask = bin(i)[3:]
sub = []
for j in range(n):
if bitmask[j] == '1':
sub.append(nums[j])
if sub not in subset... | Subset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subset:
def get_all_via_bit_manipulation(self, nums: List[int]) -> List[List[int]]:
"""Approach: Lexicographic (Binary Sorted) subsets Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:"""
<|body_0|>
def get_all(self, nums: List[int]) -> List[List... | stack_v2_sparse_classes_36k_train_016874 | 1,439 | no_license | [
{
"docstring": "Approach: Lexicographic (Binary Sorted) subsets Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:",
"name": "get_all_via_bit_manipulation",
"signature": "def get_all_via_bit_manipulation(self, nums: List[int]) -> List[List[int]]"
},
{
"docstring": "Ap... | 2 | stack_v2_sparse_classes_30k_train_013053 | Implement the Python class `Subset` described below.
Class description:
Implement the Subset class.
Method signatures and docstrings:
- def get_all_via_bit_manipulation(self, nums: List[int]) -> List[List[int]]: Approach: Lexicographic (Binary Sorted) subsets Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :... | Implement the Python class `Subset` described below.
Class description:
Implement the Subset class.
Method signatures and docstrings:
- def get_all_via_bit_manipulation(self, nums: List[int]) -> List[List[int]]: Approach: Lexicographic (Binary Sorted) subsets Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Subset:
def get_all_via_bit_manipulation(self, nums: List[int]) -> List[List[int]]:
"""Approach: Lexicographic (Binary Sorted) subsets Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:"""
<|body_0|>
def get_all(self, nums: List[int]) -> List[List... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Subset:
def get_all_via_bit_manipulation(self, nums: List[int]) -> List[List[int]]:
"""Approach: Lexicographic (Binary Sorted) subsets Time Complexity: O(N * 2^N) Space Complexity: O(N * 2^N) :param nums: :return:"""
n = len(nums)
nums.sort()
subset = []
for i in range(... | the_stack_v2_python_sparse | revisited/math_and_strings/recursion_memoization_dp/subset_ii.py | Shiv2157k/leet_code | train | 1 | |
6d86cb4dea10bbdeda6d0ec1638b00c21f5eb51b | [
"tag_dict = dict()\nmi = MonitoracaoInterfaces(ix=self.ix)\nv4_vlan_regex = compile('as\\\\d+-tr(\\\\s|\\\\-\\\\d+)')\nv6_vlan_regex = compile('as\\\\d+-tr-v6(\\\\s|\\\\-\\\\d+)')\ntag_id_regex = compile('\\\\((\\\\d+)\\\\)')\nsw_list = self.get_all_switches()\nfor switch in sw_list:\n for port in switch.port_se... | <|body_start_0|>
tag_dict = dict()
mi = MonitoracaoInterfaces(ix=self.ix)
v4_vlan_regex = compile('as\\d+-tr(\\s|\\-\\d+)')
v6_vlan_regex = compile('as\\d+-tr-v6(\\s|\\-\\d+)')
tag_id_regex = compile('\\((\\d+)\\)')
sw_list = self.get_all_switches()
for switch in ... | This class defines queries relates to VLAN Allocation | AlocacaoDeVlans | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlocacaoDeVlans:
"""This class defines queries relates to VLAN Allocation"""
def get_production_vlans_name(self):
"""This method gets the vlan names used by nikiti, generated by method get_port_status, implemented in MonitoracaoInterfaces class. Returns: A dict with vlan name and the... | stack_v2_sparse_classes_36k_train_016875 | 17,741 | permissive | [
{
"docstring": "This method gets the vlan names used by nikiti, generated by method get_port_status, implemented in MonitoracaoInterfaces class. Returns: A dict with vlan name and the tag id. tag_dict = { 'as1234-tr': '2010', 'as4321-tr-v6': '2011' ... }",
"name": "get_production_vlans_name",
"signature... | 2 | null | Implement the Python class `AlocacaoDeVlans` described below.
Class description:
This class defines queries relates to VLAN Allocation
Method signatures and docstrings:
- def get_production_vlans_name(self): This method gets the vlan names used by nikiti, generated by method get_port_status, implemented in Monitoraca... | Implement the Python class `AlocacaoDeVlans` described below.
Class description:
This class defines queries relates to VLAN Allocation
Method signatures and docstrings:
- def get_production_vlans_name(self): This method gets the vlan names used by nikiti, generated by method get_port_status, implemented in Monitoraca... | 6ed8cec23b06bccb1edf57e6b67af017f9a162d3 | <|skeleton|>
class AlocacaoDeVlans:
"""This class defines queries relates to VLAN Allocation"""
def get_production_vlans_name(self):
"""This method gets the vlan names used by nikiti, generated by method get_port_status, implemented in MonitoracaoInterfaces class. Returns: A dict with vlan name and the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlocacaoDeVlans:
"""This class defines queries relates to VLAN Allocation"""
def get_production_vlans_name(self):
"""This method gets the vlan names used by nikiti, generated by method get_port_status, implemented in MonitoracaoInterfaces class. Returns: A dict with vlan name and the tag id. tag_... | the_stack_v2_python_sparse | ipaxi/ixbr_api/core/utils/nikiti/queries.py | tatubola/xpto | train | 0 |
e0f3c963db63487c2b31c08017b1dc714fd35ff3 | [
"try:\n sym = table.lookup(cls._builtin_name)\n if type(sym) is Symbol:\n if not sym.is_unresolved:\n raise InternalError(f\"A symbol with the same name as builtin '{sym.name}' exists but has an interface of '{sym.interface}' instead of being unresolved.\")\n sym.specialise(DataTypeSy... | <|body_start_0|>
try:
sym = table.lookup(cls._builtin_name)
if type(sym) is Symbol:
if not sym.is_unresolved:
raise InternalError(f"A symbol with the same name as builtin '{sym.name}' exists but has an interface of '{sym.interface}' instead of being un... | Base class which all LFRic builtins subclass. Contains a builtin call, a description of its required interface and the arguments to be passed to it. | LFRicBuiltinFunctor | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFRicBuiltinFunctor:
"""Base class which all LFRic builtins subclass. Contains a builtin call, a description of its required interface and the arguments to be passed to it."""
def create(cls, table, arguments):
"""An appropriate DataTypeSymbol is created and added to the supplied sym... | stack_v2_sparse_classes_36k_train_016876 | 8,947 | permissive | [
{
"docstring": "An appropriate DataTypeSymbol is created and added to the supplied symbol table (if it does not already contain one). This is then passed to the create() method in the base class to create an instance of an LFRic builtin call with the supplied list of arguments. :param table: the symbol table to... | 2 | null | Implement the Python class `LFRicBuiltinFunctor` described below.
Class description:
Base class which all LFRic builtins subclass. Contains a builtin call, a description of its required interface and the arguments to be passed to it.
Method signatures and docstrings:
- def create(cls, table, arguments): An appropriat... | Implement the Python class `LFRicBuiltinFunctor` described below.
Class description:
Base class which all LFRic builtins subclass. Contains a builtin call, a description of its required interface and the arguments to be passed to it.
Method signatures and docstrings:
- def create(cls, table, arguments): An appropriat... | 0b149bc5a76ca85c1dd086c3aa813102d0d04b56 | <|skeleton|>
class LFRicBuiltinFunctor:
"""Base class which all LFRic builtins subclass. Contains a builtin call, a description of its required interface and the arguments to be passed to it."""
def create(cls, table, arguments):
"""An appropriate DataTypeSymbol is created and added to the supplied sym... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFRicBuiltinFunctor:
"""Base class which all LFRic builtins subclass. Contains a builtin call, a description of its required interface and the arguments to be passed to it."""
def create(cls, table, arguments):
"""An appropriate DataTypeSymbol is created and added to the supplied symbol table (if... | the_stack_v2_python_sparse | src/psyclone/domain/lfric/algorithm/psyir/lfric_kernel_functor.py | stfc/PSyclone | train | 100 |
dec15e3d57cee6d22de2450fa64d084bcd37e05d | [
"self.redirect_settings = redirect_settings\nself.signer_info = signer_info\nself.extra_info = extra_info\nself.ui = ui\nself.notifications = notifications\nself.tags = tags\nself.order = order\nself.required = required\nself.sign_url_expires = APIHelper.RFC3339DateTime(sign_url_expires) if sign_url_expires else No... | <|body_start_0|>
self.redirect_settings = redirect_settings
self.signer_info = signer_info
self.extra_info = extra_info
self.ui = ui
self.notifications = notifications
self.tags = tags
self.order = order
self.required = required
self.sign_url_expir... | Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_info (ExtraInfoSignerRequest): Coming soon: Do ... | UpdateSignerRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateSignerRequest:
"""Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_... | stack_v2_sparse_classes_36k_train_016877 | 5,602 | permissive | [
{
"docstring": "Constructor for the UpdateSignerRequest class",
"name": "__init__",
"signature": "def __init__(self, redirect_settings=None, signer_info=None, extra_info=None, ui=None, notifications=None, tags=None, order=None, required=None, sign_url_expires=None, additional_properties={})"
},
{
... | 2 | null | Implement the Python class `UpdateSignerRequest` described below.
Class description:
Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and emai... | Implement the Python class `UpdateSignerRequest` described below.
Class description:
Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and emai... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class UpdateSignerRequest:
"""Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateSignerRequest:
"""Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_info (ExtraIn... | the_stack_v2_python_sparse | idfy_rest_client/models/update_signer_request.py | dealflowteam/Idfy | train | 0 |
0132dc083eb758960dcacd643c9800d0a004ba22 | [
"residual = cls.conv_bn(input_x, filters, **conv_params)\nresidual = cls.activation(residual)\nmix_residuals = list()\nmix_kernel_nums = filters * cls.MIX_KERNEL_RATIO\nmix_kernel_nums = mix_kernel_nums.astype(np.int)\nfor i, kernel_size in enumerate(cls.MIX_KERNEL_SIZES):\n mix_residual = keras.layers.Lambda(la... | <|body_start_0|>
residual = cls.conv_bn(input_x, filters, **conv_params)
residual = cls.activation(residual)
mix_residuals = list()
mix_kernel_nums = filters * cls.MIX_KERNEL_RATIO
mix_kernel_nums = mix_kernel_nums.astype(np.int)
for i, kernel_size in enumerate(cls.MIX_KE... | MixNet 18:不是论文中的MixNet的结构 只是借鉴了MixNet的不同kernel size mix到一起的想法,同时也使用depthwise 不使用depthwise的话,就是resnext 18了 | MixNet18 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MixNet18:
"""MixNet 18:不是论文中的MixNet的结构 只是借鉴了MixNet的不同kernel size mix到一起的想法,同时也使用depthwise 不使用depthwise的话,就是resnext 18了"""
def _mix_residual_block(cls, input_x, filters, is_nin=True, **conv_params):
"""一个残差模块里的 block input-> conv+bn->relu-> conv+bn-> add->relu-> |-----> conv(1 X 1)+bn... | stack_v2_sparse_classes_36k_train_016878 | 3,734 | permissive | [
{
"docstring": "一个残差模块里的 block input-> conv+bn->relu-> conv+bn-> add->relu-> |-----> conv(1 X 1)+bn ------>| :param input_x: 残差block的输入 :param filters: 卷积核数,残差运算后的channel数 :param is_nin: shortcut是否需要进行NIN运算 :param conv_params: 卷积参数,参见 BasicBackbone.convolution :return: 卷积块运算之后的tensor",
"name": "_mix_residua... | 3 | stack_v2_sparse_classes_30k_train_018947 | Implement the Python class `MixNet18` described below.
Class description:
MixNet 18:不是论文中的MixNet的结构 只是借鉴了MixNet的不同kernel size mix到一起的想法,同时也使用depthwise 不使用depthwise的话,就是resnext 18了
Method signatures and docstrings:
- def _mix_residual_block(cls, input_x, filters, is_nin=True, **conv_params): 一个残差模块里的 block input-> con... | Implement the Python class `MixNet18` described below.
Class description:
MixNet 18:不是论文中的MixNet的结构 只是借鉴了MixNet的不同kernel size mix到一起的想法,同时也使用depthwise 不使用depthwise的话,就是resnext 18了
Method signatures and docstrings:
- def _mix_residual_block(cls, input_x, filters, is_nin=True, **conv_params): 一个残差模块里的 block input-> con... | 8f2d722e4067aef0c8a9cc29f76d958c0f97fb9f | <|skeleton|>
class MixNet18:
"""MixNet 18:不是论文中的MixNet的结构 只是借鉴了MixNet的不同kernel size mix到一起的想法,同时也使用depthwise 不使用depthwise的话,就是resnext 18了"""
def _mix_residual_block(cls, input_x, filters, is_nin=True, **conv_params):
"""一个残差模块里的 block input-> conv+bn->relu-> conv+bn-> add->relu-> |-----> conv(1 X 1)+bn... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MixNet18:
"""MixNet 18:不是论文中的MixNet的结构 只是借鉴了MixNet的不同kernel size mix到一起的想法,同时也使用depthwise 不使用depthwise的话,就是resnext 18了"""
def _mix_residual_block(cls, input_x, filters, is_nin=True, **conv_params):
"""一个残差模块里的 block input-> conv+bn->relu-> conv+bn-> add->relu-> |-----> conv(1 X 1)+bn ------>| :pa... | the_stack_v2_python_sparse | backbone/mixnet18.py | zheng-yuwei/YOLOv3-tensorflow | train | 5 |
2d220ce0e11d2de8852501396885a42e07b7aef5 | [
"module = mojom.Module('test_module', 'test_namespace')\nstruct_data = {'name': 'SomeStruct', 'enums': [], 'constants': [], 'fields': [{'name': 'field1', 'kind': 'i32'}, {'name': 'field2', 'kind': 'i32', 'ordinal': 10}, {'name': 'field3', 'kind': 'i32', 'default': 15}]}\nstruct = data.StructFromData(module, struct_... | <|body_start_0|>
module = mojom.Module('test_module', 'test_namespace')
struct_data = {'name': 'SomeStruct', 'enums': [], 'constants': [], 'fields': [{'name': 'field1', 'kind': 'i32'}, {'name': 'field2', 'kind': 'i32', 'ordinal': 10}, {'name': 'field3', 'kind': 'i32', 'default': 15}]}
struct = d... | DataTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTest:
def testStructDataConversion(self):
"""Tests that a struct can be converted from data."""
<|body_0|>
def testUnionDataConversion(self):
"""Tests that a union can be converted from data."""
<|body_1|>
def testImportFromDataNoMissingImports(self)... | stack_v2_sparse_classes_36k_train_016879 | 5,831 | permissive | [
{
"docstring": "Tests that a struct can be converted from data.",
"name": "testStructDataConversion",
"signature": "def testStructDataConversion(self)"
},
{
"docstring": "Tests that a union can be converted from data.",
"name": "testUnionDataConversion",
"signature": "def testUnionDataCo... | 6 | null | Implement the Python class `DataTest` described below.
Class description:
Implement the DataTest class.
Method signatures and docstrings:
- def testStructDataConversion(self): Tests that a struct can be converted from data.
- def testUnionDataConversion(self): Tests that a union can be converted from data.
- def test... | Implement the Python class `DataTest` described below.
Class description:
Implement the DataTest class.
Method signatures and docstrings:
- def testStructDataConversion(self): Tests that a struct can be converted from data.
- def testUnionDataConversion(self): Tests that a union can be converted from data.
- def test... | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | <|skeleton|>
class DataTest:
def testStructDataConversion(self):
"""Tests that a struct can be converted from data."""
<|body_0|>
def testUnionDataConversion(self):
"""Tests that a union can be converted from data."""
<|body_1|>
def testImportFromDataNoMissingImports(self)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataTest:
def testStructDataConversion(self):
"""Tests that a struct can be converted from data."""
module = mojom.Module('test_module', 'test_namespace')
struct_data = {'name': 'SomeStruct', 'enums': [], 'constants': [], 'fields': [{'name': 'field1', 'kind': 'i32'}, {'name': 'field2',... | the_stack_v2_python_sparse | mojo/public/tools/bindings/pylib/mojom_tests/generate/data_unittest.py | Samsung/Castanets | train | 58 | |
150d245e9b16f36f45c8f2f9d3f60b49340962c6 | [
"test_file = 'add_furniture_test.csv'\nadd_furniture(test_file, 'Bob Bobbo', 'LT02', 'Cloth Couch', 17.0)\nadd_furniture(test_file, 'Jane Jano', 'TT339', 'Dining Room Table', 25.32)\ntest_result = []\nwith open(test_file, 'r') as read_file:\n for line in reader(read_file):\n test_result.append(line)\nself... | <|body_start_0|>
test_file = 'add_furniture_test.csv'
add_furniture(test_file, 'Bob Bobbo', 'LT02', 'Cloth Couch', 17.0)
add_furniture(test_file, 'Jane Jano', 'TT339', 'Dining Room Table', 25.32)
test_result = []
with open(test_file, 'r') as read_file:
for line in rea... | Unit tests for the inventory functions. | InventoryUnitTesting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InventoryUnitTesting:
"""Unit tests for the inventory functions."""
def test_add_furniture_unit(self):
"""Unit test of the add_furniture function."""
<|body_0|>
def test_single_customer(self):
"""Unit test of the single_customer function"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_016880 | 1,611 | no_license | [
{
"docstring": "Unit test of the add_furniture function.",
"name": "test_add_furniture_unit",
"signature": "def test_add_furniture_unit(self)"
},
{
"docstring": "Unit test of the single_customer function",
"name": "test_single_customer",
"signature": "def test_single_customer(self)"
}
... | 2 | null | Implement the Python class `InventoryUnitTesting` described below.
Class description:
Unit tests for the inventory functions.
Method signatures and docstrings:
- def test_add_furniture_unit(self): Unit test of the add_furniture function.
- def test_single_customer(self): Unit test of the single_customer function | Implement the Python class `InventoryUnitTesting` described below.
Class description:
Unit tests for the inventory functions.
Method signatures and docstrings:
- def test_add_furniture_unit(self): Unit test of the add_furniture function.
- def test_single_customer(self): Unit test of the single_customer function
<|s... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class InventoryUnitTesting:
"""Unit tests for the inventory functions."""
def test_add_furniture_unit(self):
"""Unit test of the add_furniture function."""
<|body_0|>
def test_single_customer(self):
"""Unit test of the single_customer function"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InventoryUnitTesting:
"""Unit tests for the inventory functions."""
def test_add_furniture_unit(self):
"""Unit test of the add_furniture function."""
test_file = 'add_furniture_test.csv'
add_furniture(test_file, 'Bob Bobbo', 'LT02', 'Cloth Couch', 17.0)
add_furniture(test_... | the_stack_v2_python_sparse | students/joel_rhode/lesson_8/assignment/test_inventory.py | JavaRod/SP_Python220B_2019 | train | 1 |
c6a550a378f2cda7e85b6bd609568186edf62a06 | [
"filters, keywords = rest_utils.parse_filters_kwargs(request, ['session'])\nsession = keywords.get('session')\nif not session:\n session = env_api.Session.get_or_create_or_delete(request, environment)\nenv = api.muranoclient(request).environments.get_model(environment, '/', session)\nif env:\n return env['?']... | <|body_start_0|>
filters, keywords = rest_utils.parse_filters_kwargs(request, ['session'])
session = keywords.get('session')
if not session:
session = env_api.Session.get_or_create_or_delete(request, environment)
env = api.muranoclient(request).environments.get_model(environm... | API for Murano components Metadata | EnvironmentsMetadata | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnvironmentsMetadata:
"""API for Murano components Metadata"""
def get(self, request, environment):
"""Get a metadata object for an environment Example GET: http://localhost/api/app-catalog/environments/123/metadata The following get parameters may be passed in the GET request: :para... | stack_v2_sparse_classes_36k_train_016881 | 6,096 | permissive | [
{
"docstring": "Get a metadata object for an environment Example GET: http://localhost/api/app-catalog/environments/123/metadata The following get parameters may be passed in the GET request: :param environment: identifier of the environment Any additionally a \"session\" parameter should be passed through the ... | 2 | null | Implement the Python class `EnvironmentsMetadata` described below.
Class description:
API for Murano components Metadata
Method signatures and docstrings:
- def get(self, request, environment): Get a metadata object for an environment Example GET: http://localhost/api/app-catalog/environments/123/metadata The followi... | Implement the Python class `EnvironmentsMetadata` described below.
Class description:
API for Murano components Metadata
Method signatures and docstrings:
- def get(self, request, environment): Get a metadata object for an environment Example GET: http://localhost/api/app-catalog/environments/123/metadata The followi... | 54e2ea8a71385b1c7624b3d2c8056bd8a2c2e2f7 | <|skeleton|>
class EnvironmentsMetadata:
"""API for Murano components Metadata"""
def get(self, request, environment):
"""Get a metadata object for an environment Example GET: http://localhost/api/app-catalog/environments/123/metadata The following get parameters may be passed in the GET request: :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EnvironmentsMetadata:
"""API for Murano components Metadata"""
def get(self, request, environment):
"""Get a metadata object for an environment Example GET: http://localhost/api/app-catalog/environments/123/metadata The following get parameters may be passed in the GET request: :param environment... | the_stack_v2_python_sparse | muranodashboard/api/rest/environments.py | openstack/murano-dashboard | train | 38 |
c07954632f02a0e80ce1a16fa245513d8c4c0c95 | [
"if isinstance(dst, Repository):\n return self.from_folds(dst, is_existing_deleted, **kwargs)\nelse:\n return self.from_folders(dst, is_existing_deleted, **kwargs)",
"dst = Path(dst)\nif is_existing_deleted:\n rmtree(dst, ignore_errors=True)\ndst.mkdir(mode=511, parents=True, exist_ok=True)\nfor csv, rea... | <|body_start_0|>
if isinstance(dst, Repository):
return self.from_folds(dst, is_existing_deleted, **kwargs)
else:
return self.from_folders(dst, is_existing_deleted, **kwargs)
<|end_body_0|>
<|body_start_1|>
dst = Path(dst)
if is_existing_deleted:
rmtr... | A device for collecting -- i.e. concatenating -- csv files across folders or folds. | Collect | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Collect:
"""A device for collecting -- i.e. concatenating -- csv files across folders or folds."""
def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any):
"""Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.ov... | stack_v2_sparse_classes_36k_train_016882 | 7,105 | permissive | [
{
"docstring": "Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.over_folds`` is called instead of ``self.over_folders``. Args: dst: The destination folder, to house ``self.csvs`` or ``self.folders``. is_existing_deleted: Whether to delete and recreate an existing ``dst``. **kw... | 4 | stack_v2_sparse_classes_30k_train_009024 | Implement the Python class `Collect` described below.
Class description:
A device for collecting -- i.e. concatenating -- csv files across folders or folds.
Method signatures and docstrings:
- def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any): Collect ``self.csvs`` into `... | Implement the Python class `Collect` described below.
Class description:
A device for collecting -- i.e. concatenating -- csv files across folders or folds.
Method signatures and docstrings:
- def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any): Collect ``self.csvs`` into `... | 7919befb620ed571dc71efe69f5312f82e1a9e6b | <|skeleton|>
class Collect:
"""A device for collecting -- i.e. concatenating -- csv files across folders or folds."""
def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any):
"""Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.ov... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Collect:
"""A device for collecting -- i.e. concatenating -- csv files across folders or folds."""
def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any):
"""Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.over_folds`` is... | the_stack_v2_python_sparse | romcomma/user/results.py | C-O-M-M-A/rom-comma | train | 2 |
a891668f485ed5a562d09fc6cc52b7f4da7ff9c2 | [
"self.customer_id = customer_id\nself.consumer_id = consumer_id\nself.mtype = mtype\nself.optional_consumer_info = optional_consumer_info\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\ncustomer_id = dictionary.get('customerId')\nconsumer_id = dictionary.get('consum... | <|body_start_0|>
self.customer_id = customer_id
self.consumer_id = consumer_id
self.mtype = mtype
self.optional_consumer_info = optional_consumer_info
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
re... | Implementation of the 'Borrowers' model. TODO: type model description here. Attributes: customer_id (string): Customer ID from the [Add Customer API]( https://api-reference.finicity.com/#/rest/api-endpoints/customer/ad d-customer) consumer_id (string): Consumer ID from the [Create Consumer API]( https://api-reference.f... | Borrowers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Borrowers:
"""Implementation of the 'Borrowers' model. TODO: type model description here. Attributes: customer_id (string): Customer ID from the [Add Customer API]( https://api-reference.finicity.com/#/rest/api-endpoints/customer/ad d-customer) consumer_id (string): Consumer ID from the [Create C... | stack_v2_sparse_classes_36k_train_016883 | 3,239 | permissive | [
{
"docstring": "Constructor for the Borrowers class",
"name": "__init__",
"signature": "def __init__(self, customer_id=None, consumer_id=None, mtype=None, optional_consumer_info=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictiona... | 2 | null | Implement the Python class `Borrowers` described below.
Class description:
Implementation of the 'Borrowers' model. TODO: type model description here. Attributes: customer_id (string): Customer ID from the [Add Customer API]( https://api-reference.finicity.com/#/rest/api-endpoints/customer/ad d-customer) consumer_id (... | Implement the Python class `Borrowers` described below.
Class description:
Implementation of the 'Borrowers' model. TODO: type model description here. Attributes: customer_id (string): Customer ID from the [Add Customer API]( https://api-reference.finicity.com/#/rest/api-endpoints/customer/ad d-customer) consumer_id (... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class Borrowers:
"""Implementation of the 'Borrowers' model. TODO: type model description here. Attributes: customer_id (string): Customer ID from the [Add Customer API]( https://api-reference.finicity.com/#/rest/api-endpoints/customer/ad d-customer) consumer_id (string): Consumer ID from the [Create C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Borrowers:
"""Implementation of the 'Borrowers' model. TODO: type model description here. Attributes: customer_id (string): Customer ID from the [Add Customer API]( https://api-reference.finicity.com/#/rest/api-endpoints/customer/ad d-customer) consumer_id (string): Consumer ID from the [Create Consumer API](... | the_stack_v2_python_sparse | finicityapi/models/borrowers.py | monarchmoney/finicity-python | train | 0 |
7c7a05f534b7d28b7aaa8b268900cdcddab365f1 | [
"t = m - 2\nfor nums in nums2:\n t = t + 1\n if nums <= nums1[0]:\n nums1[1:t + 2] = nums1[0:t + 1]\n nums1[0] = nums\n elif nums >= nums1[t]:\n nums1[t + 1] = nums\n else:\n for i in range(t):\n if nums == nums1[i]:\n nums1[i + 2:t + 2] = nums1[i + ... | <|body_start_0|>
t = m - 2
for nums in nums2:
t = t + 1
if nums <= nums1[0]:
nums1[1:t + 2] = nums1[0:t + 1]
nums1[0] = nums
elif nums >= nums1[t]:
nums1[t + 1] = nums
else:
for i in range(t):... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1, m, nums2, n):
""":type nums1: List[int]... | stack_v2_sparse_classes_36k_train_016884 | 2,009 | no_license | [
{
"docstring": ":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.",
"name": "merge",
"signature": "def merge(self, nums1, m, nums2, n)"
},
{
"docstring": ":type nums1: List[int] :type m: int :type nums2: Li... | 2 | stack_v2_sparse_classes_30k_train_003097 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.
-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.
-... | f1d780b7e8b91b4df704651514018143c6931f9d | <|skeleton|>
class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1, m, nums2, n):
""":type nums1: List[int]... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead."""
t = m - 2
for nums in nums2:
t = t + 1
if nums <= nums1[0]:
... | the_stack_v2_python_sparse | ProgramForLeetCode/LeetCode/88_merge.py | DQDH/Algorithm_Code | train | 0 | |
42960679793fb18f2bbbc8b81005d341399e73b9 | [
"self.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM')\nself.rnn_units = hyper_parameters['model'].get('rnn_units', 256)\nsuper().__init__(hyper_parameters)",
"super().create_model(hyper_parameters)\nembedding_output = self.word_embedding.output\nif self.rnn_units == 'LSTM':\n layer_cell = LSTM\nel... | <|body_start_0|>
self.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM')
self.rnn_units = hyper_parameters['model'].get('rnn_units', 256)
super().__init__(hyper_parameters)
<|end_body_0|>
<|body_start_1|>
super().create_model(hyper_parameters)
embedding_output = self.w... | RCNNGraph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RCNNGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
<|body_0|>
def create_model(self, hyper_parameters):
"""构建神经网络,行卷积加池化 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_016885 | 7,514 | permissive | [
{
"docstring": "初始化 :param hyper_parameters: json,超参",
"name": "__init__",
"signature": "def __init__(self, hyper_parameters)"
},
{
"docstring": "构建神经网络,行卷积加池化 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl",
"name": "create_model",
"signature": "def cre... | 3 | stack_v2_sparse_classes_30k_train_001409 | Implement the Python class `RCNNGraph` described below.
Class description:
Implement the RCNNGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参
- def create_model(self, hyper_parameters): 构建神经网络,行卷积加池化 :param hyper_parameters:json, hyper paramet... | Implement the Python class `RCNNGraph` described below.
Class description:
Implement the RCNNGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参
- def create_model(self, hyper_parameters): 构建神经网络,行卷积加池化 :param hyper_parameters:json, hyper paramet... | 640e3f44f90d9d8046546f7e1a93a29ebe5c8d30 | <|skeleton|>
class RCNNGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
<|body_0|>
def create_model(self, hyper_parameters):
"""构建神经网络,行卷积加池化 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RCNNGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
self.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM')
self.rnn_units = hyper_parameters['model'].get('rnn_units', 256)
super().__init__(hyper_parameters)
def create_mode... | the_stack_v2_python_sparse | keras_textclassification/m05_TextRCNN/graph.py | wzjames/Keras-TextClassification | train | 1 | |
3ed2d6c4d2b2cb5fd0ebf01b6409917d55bba0c4 | [
"if authorization_header is None or type(authorization_header) != str:\n return None\nif authorization_header[0:6] != 'Basic ':\n return None\nreturn authorization_header[6:]",
"if base64_authorization_header is None or type(base64_authorization_header) != str:\n return None\ntry:\n return b64decode(b... | <|body_start_0|>
if authorization_header is None or type(authorization_header) != str:
return None
if authorization_header[0:6] != 'Basic ':
return None
return authorization_header[6:]
<|end_body_0|>
<|body_start_1|>
if base64_authorization_header is None or type... | inherits from auth | BasicAuth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicAuth:
"""inherits from auth"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the base64 part for authorization"""
<|body_0|>
def decode_base64_authorization_header(self, base64_authorization_header: str) -> str:
... | stack_v2_sparse_classes_36k_train_016886 | 2,917 | no_license | [
{
"docstring": "returns the base64 part for authorization",
"name": "extract_base64_authorization_header",
"signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str"
},
{
"docstring": "decoded value of base64 str",
"name": "decode_base64_authorization_head... | 5 | stack_v2_sparse_classes_30k_train_016720 | Implement the Python class `BasicAuth` described below.
Class description:
inherits from auth
Method signatures and docstrings:
- def extract_base64_authorization_header(self, authorization_header: str) -> str: returns the base64 part for authorization
- def decode_base64_authorization_header(self, base64_authorizati... | Implement the Python class `BasicAuth` described below.
Class description:
inherits from auth
Method signatures and docstrings:
- def extract_base64_authorization_header(self, authorization_header: str) -> str: returns the base64 part for authorization
- def decode_base64_authorization_header(self, base64_authorizati... | c0182a227da7a47fd641b3d9e085243b36b626db | <|skeleton|>
class BasicAuth:
"""inherits from auth"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the base64 part for authorization"""
<|body_0|>
def decode_base64_authorization_header(self, base64_authorization_header: str) -> str:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicAuth:
"""inherits from auth"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the base64 part for authorization"""
if authorization_header is None or type(authorization_header) != str:
return None
if authorization_heade... | the_stack_v2_python_sparse | 0x07-Session_authentication/api/v1/auth/basic_auth.py | Jilroge7/holbertonschool-web_back_end | train | 0 |
8b85865f51c4507c93af0d7a154fd3a9d424c037 | [
"result = True\nfor k in kwargs:\n v = kwargs[k]\n dv = d.get(k)\n if not self.match_value(k, dv, v):\n result = False\n break\nreturn result",
"if type(v) != type(dv):\n result = False\nelif type(dv) is not str or k not in self._partial_matches:\n result = v == dv\nelse:\n result ... | <|body_start_0|>
result = True
for k in kwargs:
v = kwargs[k]
dv = d.get(k)
if not self.match_value(k, dv, v):
result = False
break
return result
<|end_body_0|>
<|body_start_1|>
if type(v) != type(dv):
resul... | This utility class matches a stored dictionary of :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method. | Matcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Matcher:
"""This utility class matches a stored dictionary of :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method."""
def matches(self, d, **kwargs):
"""Try to match a single dict with the supplied arguments. Key... | stack_v2_sparse_classes_36k_train_016887 | 5,208 | permissive | [
{
"docstring": "Try to match a single dict with the supplied arguments. Keys whose values are strings and which are in self._partial_matches will be checked for partial (i.e. substring) matches. You can extend this scheme to (for example) do regular expression matching, etc. Return `True` if found, else `False`... | 2 | stack_v2_sparse_classes_30k_train_009634 | Implement the Python class `Matcher` described below.
Class description:
This utility class matches a stored dictionary of :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method.
Method signatures and docstrings:
- def matches(self, d, **kwargs): Tr... | Implement the Python class `Matcher` described below.
Class description:
This utility class matches a stored dictionary of :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method.
Method signatures and docstrings:
- def matches(self, d, **kwargs): Tr... | 5daaeaeedc2682af878c2e925a2131033d631333 | <|skeleton|>
class Matcher:
"""This utility class matches a stored dictionary of :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method."""
def matches(self, d, **kwargs):
"""Try to match a single dict with the supplied arguments. Key... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Matcher:
"""This utility class matches a stored dictionary of :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method."""
def matches(self, d, **kwargs):
"""Try to match a single dict with the supplied arguments. Keys whose value... | the_stack_v2_python_sparse | virtual/lib/python3.6/site-packages/logutils/testing.py | LeoAmby/Galleria | train | 1 |
2e867d88868fdbb71d511ae489fceb01ea398593 | [
"self.width = width\nself.height = height\nself.offset_width = offset_width\nself.offset_height = offset_height\nself.temps = temps\nself.dt = dt\nself.count = count\nself.pendulum_1 = pendulum_1\nself.pendulum_2 = pendulum_2\nself.gap = gap\nself.temps_exec = temps_exec\nself.escala_moviment = 0.9 * (width - escal... | <|body_start_0|>
self.width = width
self.height = height
self.offset_width = offset_width
self.offset_height = offset_height
self.temps = temps
self.dt = dt
self.count = count
self.pendulum_1 = pendulum_1
self.pendulum_2 = pendulum_2
self.g... | App | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class App:
def __init__(self, pendulum_1: Pendulum, pendulum_2: Pendulum, gap: float, temps_exec: float, temps: np.ndarray, width: int=1200, height: int=600, offset_width: int=600, offset_height: int=300, dt: float=0.05, count: int=0):
"""Initialize the widget for the double pendulum animation... | stack_v2_sparse_classes_36k_train_016888 | 6,624 | no_license | [
{
"docstring": "Initialize the widget for the double pendulum animation. offset_width and offset_height represent the x and y offsets from the top left corner of the canvas to place the first pendulum.",
"name": "__init__",
"signature": "def __init__(self, pendulum_1: Pendulum, pendulum_2: Pendulum, gap... | 4 | stack_v2_sparse_classes_30k_train_012962 | Implement the Python class `App` described below.
Class description:
Implement the App class.
Method signatures and docstrings:
- def __init__(self, pendulum_1: Pendulum, pendulum_2: Pendulum, gap: float, temps_exec: float, temps: np.ndarray, width: int=1200, height: int=600, offset_width: int=600, offset_height: int... | Implement the Python class `App` described below.
Class description:
Implement the App class.
Method signatures and docstrings:
- def __init__(self, pendulum_1: Pendulum, pendulum_2: Pendulum, gap: float, temps_exec: float, temps: np.ndarray, width: int=1200, height: int=600, offset_width: int=600, offset_height: int... | 2551bb8d85d60268a1a80dd97d8dc66dbbe06888 | <|skeleton|>
class App:
def __init__(self, pendulum_1: Pendulum, pendulum_2: Pendulum, gap: float, temps_exec: float, temps: np.ndarray, width: int=1200, height: int=600, offset_width: int=600, offset_height: int=300, dt: float=0.05, count: int=0):
"""Initialize the widget for the double pendulum animation... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class App:
def __init__(self, pendulum_1: Pendulum, pendulum_2: Pendulum, gap: float, temps_exec: float, temps: np.ndarray, width: int=1200, height: int=600, offset_width: int=600, offset_height: int=300, dt: float=0.05, count: int=0):
"""Initialize the widget for the double pendulum animation. offset_width... | the_stack_v2_python_sparse | Source/Animacio.py | srmarcballestero/Newtons-Cradle | train | 1 | |
08a45f45525f08a9cccd1fcffd397942da4edf57 | [
"using_control_input = Bu is not None or u is not None or target_state is not None\npred_state = self._ssm_pred(st, target_state=target_state, Bu=Bu, u=u)\nC, Q = (self.C, self.Q)\nP = pred_state.cov\ntry:\n M = self.M\n pca_offset = self.pca_offset\nexcept:\n print(\"couldn't extract PCA parameters!\")\n ... | <|body_start_0|>
using_control_input = Bu is not None or u is not None or target_state is not None
pred_state = self._ssm_pred(st, target_state=target_state, Bu=Bu, u=u)
C, Q = (self.C, self.Q)
P = pred_state.cov
try:
M = self.M
pca_offset = self.pca_offse... | A modified KalmanFilter where the Kalman gain is confined to produce outputs in a lower-dimensional linear subspace, i.e. some principal component space | PCAKalmanFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PCAKalmanFilter:
"""A modified KalmanFilter where the Kalman gain is confined to produce outputs in a lower-dimensional linear subspace, i.e. some principal component space"""
def _forward_infer(self, st, obs_t, Bu=None, u=None, target_state=None, obs_is_control_independent=True, **kwargs):
... | stack_v2_sparse_classes_36k_train_016889 | 31,651 | permissive | [
{
"docstring": "See KalmanFilter._forward_infer for docs",
"name": "_forward_infer",
"signature": "def _forward_infer(self, st, obs_t, Bu=None, u=None, target_state=None, obs_is_control_independent=True, **kwargs)"
},
{
"docstring": "See KalmanFilter.__getstate__ for docs",
"name": "__getsta... | 3 | null | Implement the Python class `PCAKalmanFilter` described below.
Class description:
A modified KalmanFilter where the Kalman gain is confined to produce outputs in a lower-dimensional linear subspace, i.e. some principal component space
Method signatures and docstrings:
- def _forward_infer(self, st, obs_t, Bu=None, u=N... | Implement the Python class `PCAKalmanFilter` described below.
Class description:
A modified KalmanFilter where the Kalman gain is confined to produce outputs in a lower-dimensional linear subspace, i.e. some principal component space
Method signatures and docstrings:
- def _forward_infer(self, st, obs_t, Bu=None, u=N... | a0e296aa663b49e767c9ebb274defb54b301eb12 | <|skeleton|>
class PCAKalmanFilter:
"""A modified KalmanFilter where the Kalman gain is confined to produce outputs in a lower-dimensional linear subspace, i.e. some principal component space"""
def _forward_infer(self, st, obs_t, Bu=None, u=None, target_state=None, obs_is_control_independent=True, **kwargs):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PCAKalmanFilter:
"""A modified KalmanFilter where the Kalman gain is confined to produce outputs in a lower-dimensional linear subspace, i.e. some principal component space"""
def _forward_infer(self, st, obs_t, Bu=None, u=None, target_state=None, obs_is_control_independent=True, **kwargs):
"""Se... | the_stack_v2_python_sparse | riglib/bmi/kfdecoder.py | carmenalab/brain-python-interface | train | 9 |
0b87d515e5c127b6da2b79222f8828749bf8a029 | [
"strip_dc = lambda name: ''.join([el for el in name if el in string.ascii_lowercase])\nmsg_rvd = cls.parse_flask_req(r, session)\nmsg_rvd.update({'dc': {'name': strip_dc(msg_rvd['name'])}})\nreturn Line(**msg_rvd)",
"if row.get('dc_id'):\n row.setdefault('dc', {})\n row['dc']['id'] = row.get('dc_id')\n d... | <|body_start_0|>
strip_dc = lambda name: ''.join([el for el in name if el in string.ascii_lowercase])
msg_rvd = cls.parse_flask_req(r, session)
msg_rvd.update({'dc': {'name': strip_dc(msg_rvd['name'])}})
return Line(**msg_rvd)
<|end_body_0|>
<|body_start_1|>
if row.get('dc_id'):... | Line instance static fabric. | LineBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LineBuilder:
"""Line instance static fabric."""
def from_Flask_req(cls, r, session):
"""Creates class instance from Flask request object. Args: r: Flask request object. session: Flask session object. Returns: Ammo class instance."""
<|body_0|>
def from_row(cls, **row):
... | stack_v2_sparse_classes_36k_train_016890 | 1,844 | permissive | [
{
"docstring": "Creates class instance from Flask request object. Args: r: Flask request object. session: Flask session object. Returns: Ammo class instance.",
"name": "from_Flask_req",
"signature": "def from_Flask_req(cls, r, session)"
},
{
"docstring": "Creates class instance from RDBMS return... | 2 | null | Implement the Python class `LineBuilder` described below.
Class description:
Line instance static fabric.
Method signatures and docstrings:
- def from_Flask_req(cls, r, session): Creates class instance from Flask request object. Args: r: Flask request object. session: Flask session object. Returns: Ammo class instanc... | Implement the Python class `LineBuilder` described below.
Class description:
Line instance static fabric.
Method signatures and docstrings:
- def from_Flask_req(cls, r, session): Creates class instance from Flask request object. Args: r: Flask request object. session: Flask session object. Returns: Ammo class instanc... | e898fae67236cfb64b73c964d5b3ade73c976de6 | <|skeleton|>
class LineBuilder:
"""Line instance static fabric."""
def from_Flask_req(cls, r, session):
"""Creates class instance from Flask request object. Args: r: Flask request object. session: Flask session object. Returns: Ammo class instance."""
<|body_0|>
def from_row(cls, **row):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LineBuilder:
"""Line instance static fabric."""
def from_Flask_req(cls, r, session):
"""Creates class instance from Flask request object. Args: r: Flask request object. session: Flask session object. Returns: Ammo class instance."""
strip_dc = lambda name: ''.join([el for el in name if el... | the_stack_v2_python_sparse | lunaport_server/domain/line.py | maklaut/lunaport_server | train | 0 |
28405be99e22d87300930a0167d93f7945dc1e12 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConvertIdResult()",
"from .generic_error import GenericError\nfrom .generic_error import GenericError\nfields: Dict[str, Callable[[Any], None]] = {'errorDetails': lambda n: setattr(self, 'error_details', n.get_object_value(GenericError... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ConvertIdResult()
<|end_body_0|>
<|body_start_1|>
from .generic_error import GenericError
from .generic_error import GenericError
fields: Dict[str, Callable[[Any], None]] = {'err... | ConvertIdResult | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvertIdResult:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConvertIdResult:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | stack_v2_sparse_classes_36k_train_016891 | 3,281 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ConvertIdResult",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_val... | 3 | null | Implement the Python class `ConvertIdResult` described below.
Class description:
Implement the ConvertIdResult class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConvertIdResult: Creates a new instance of the appropriate class based on discriminator... | Implement the Python class `ConvertIdResult` described below.
Class description:
Implement the ConvertIdResult class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConvertIdResult: Creates a new instance of the appropriate class based on discriminator... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ConvertIdResult:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConvertIdResult:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvertIdResult:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConvertIdResult:
"""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: ConvertI... | the_stack_v2_python_sparse | msgraph/generated/models/convert_id_result.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
bc3979226861ea10d8043443b6f69eb754541dd6 | [
"_head = 0\nfor i in _x:\n if i == _b:\n _head += 1\n else:\n break\nreturn _head",
"_tail = 0\nfor i in range(len(_x)):\n if _x[len(_x) - i - 1] == _b:\n _tail += 1\n else:\n break\nreturn _tail"
] | <|body_start_0|>
_head = 0
for i in _x:
if i == _b:
_head += 1
else:
break
return _head
<|end_body_0|>
<|body_start_1|>
_tail = 0
for i in range(len(_x)):
if _x[len(_x) - i - 1] == _b:
_tail += 1... | _DiscretePeaksBase | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _DiscretePeaksBase:
def head(_b, _x):
"""Determine the number of leading b's in vector x. Parameters ---------- b: int Integer for counting at head of vector. x: array Vector of integers. Returns ------- head: int Number of leading b's in x."""
<|body_0|>
def tail(_b, _x):
... | stack_v2_sparse_classes_36k_train_016892 | 1,370 | permissive | [
{
"docstring": "Determine the number of leading b's in vector x. Parameters ---------- b: int Integer for counting at head of vector. x: array Vector of integers. Returns ------- head: int Number of leading b's in x.",
"name": "head",
"signature": "def head(_b, _x)"
},
{
"docstring": "Determine ... | 2 | stack_v2_sparse_classes_30k_train_005527 | Implement the Python class `_DiscretePeaksBase` described below.
Class description:
Implement the _DiscretePeaksBase class.
Method signatures and docstrings:
- def head(_b, _x): Determine the number of leading b's in vector x. Parameters ---------- b: int Integer for counting at head of vector. x: array Vector of int... | Implement the Python class `_DiscretePeaksBase` described below.
Class description:
Implement the _DiscretePeaksBase class.
Method signatures and docstrings:
- def head(_b, _x): Determine the number of leading b's in vector x. Parameters ---------- b: int Integer for counting at head of vector. x: array Vector of int... | d9e17c192ca210fdf8405f7bf57e933705814d26 | <|skeleton|>
class _DiscretePeaksBase:
def head(_b, _x):
"""Determine the number of leading b's in vector x. Parameters ---------- b: int Integer for counting at head of vector. x: array Vector of integers. Returns ------- head: int Number of leading b's in x."""
<|body_0|>
def tail(_b, _x):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _DiscretePeaksBase:
def head(_b, _x):
"""Determine the number of leading b's in vector x. Parameters ---------- b: int Integer for counting at head of vector. x: array Vector of integers. Returns ------- head: int Number of leading b's in x."""
_head = 0
for i in _x:
if i =... | the_stack_v2_python_sparse | mlrose_hiive/fitness/_discrete_peaks_base.py | hiive/mlrose | train | 79 | |
9d9a710003f6c1d85d64fb7af652826307c50ef9 | [
"if isinstance(value, collections.abc.Iterable):\n return numpy.ones_like(value, dtype=numpy.bool_)\nelse:\n return True",
"data = None if data is None else numpy.array(data, copy=False)\nif data is None or data.size == 0:\n return self.DEFAULT_RANGE\nif mode == 'minmax':\n vmin, vmax = self.autoscale... | <|body_start_0|>
if isinstance(value, collections.abc.Iterable):
return numpy.ones_like(value, dtype=numpy.bool_)
else:
return True
<|end_body_0|>
<|body_start_1|>
data = None if data is None else numpy.array(data, copy=False)
if data is None or data.size == 0:
... | Colormap normalization mix-in class | _NormalizationMixIn | [
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _NormalizationMixIn:
"""Colormap normalization mix-in class"""
def is_valid(self, value):
"""Check if a value is in the valid range for this normalization. Override in subclass. :param Union[float,numpy.ndarray] value: :rtype: Union[bool,numpy.ndarray]"""
<|body_0|>
def ... | stack_v2_sparse_classes_36k_train_016893 | 16,802 | permissive | [
{
"docstring": "Check if a value is in the valid range for this normalization. Override in subclass. :param Union[float,numpy.ndarray] value: :rtype: Union[bool,numpy.ndarray]",
"name": "is_valid",
"signature": "def is_valid(self, value)"
},
{
"docstring": "Returns range for given data and autos... | 4 | stack_v2_sparse_classes_30k_train_001611 | Implement the Python class `_NormalizationMixIn` described below.
Class description:
Colormap normalization mix-in class
Method signatures and docstrings:
- def is_valid(self, value): Check if a value is in the valid range for this normalization. Override in subclass. :param Union[float,numpy.ndarray] value: :rtype: ... | Implement the Python class `_NormalizationMixIn` described below.
Class description:
Colormap normalization mix-in class
Method signatures and docstrings:
- def is_valid(self, value): Check if a value is in the valid range for this normalization. Override in subclass. :param Union[float,numpy.ndarray] value: :rtype: ... | 5e33cb69afd2a8b1cfe3183282acdd8b34c1a74f | <|skeleton|>
class _NormalizationMixIn:
"""Colormap normalization mix-in class"""
def is_valid(self, value):
"""Check if a value is in the valid range for this normalization. Override in subclass. :param Union[float,numpy.ndarray] value: :rtype: Union[bool,numpy.ndarray]"""
<|body_0|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _NormalizationMixIn:
"""Colormap normalization mix-in class"""
def is_valid(self, value):
"""Check if a value is in the valid range for this normalization. Override in subclass. :param Union[float,numpy.ndarray] value: :rtype: Union[bool,numpy.ndarray]"""
if isinstance(value, collections.... | the_stack_v2_python_sparse | src/silx/math/colormap.py | silx-kit/silx | train | 120 |
202fdefc51bec7b3d58f249785e761d1850abed4 | [
"self.plaintext = plaintext\nself.key = '6440777308024991'\nself.info = {}",
"plaintext_bytes = self.plaintext.encode('utf-8')\nkey_bytes = self.key.encode('utf-8')\ncipher_encrypt = AES.new(key_bytes, AES.MODE_CFB)\niv_bytes = cipher_encrypt.iv\nself.init_vector = b64encode(iv_bytes).decode('utf-8')\ncipher_text... | <|body_start_0|>
self.plaintext = plaintext
self.key = '6440777308024991'
self.info = {}
<|end_body_0|>
<|body_start_1|>
plaintext_bytes = self.plaintext.encode('utf-8')
key_bytes = self.key.encode('utf-8')
cipher_encrypt = AES.new(key_bytes, AES.MODE_CFB)
iv_byt... | A class for encrypting plaintext passed in via user input | password_encrypt | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class password_encrypt:
"""A class for encrypting plaintext passed in via user input"""
def __init__(self, plaintext='', key=''):
"""init method for password encryption class"""
<|body_0|>
def encryptPassword(self):
"""encrypt user inputted plaintext"""
<|body_... | stack_v2_sparse_classes_36k_train_016894 | 2,888 | no_license | [
{
"docstring": "init method for password encryption class",
"name": "__init__",
"signature": "def __init__(self, plaintext='', key='')"
},
{
"docstring": "encrypt user inputted plaintext",
"name": "encryptPassword",
"signature": "def encryptPassword(self)"
},
{
"docstring": "Save... | 3 | stack_v2_sparse_classes_30k_train_008670 | Implement the Python class `password_encrypt` described below.
Class description:
A class for encrypting plaintext passed in via user input
Method signatures and docstrings:
- def __init__(self, plaintext='', key=''): init method for password encryption class
- def encryptPassword(self): encrypt user inputted plainte... | Implement the Python class `password_encrypt` described below.
Class description:
A class for encrypting plaintext passed in via user input
Method signatures and docstrings:
- def __init__(self, plaintext='', key=''): init method for password encryption class
- def encryptPassword(self): encrypt user inputted plainte... | 7a331478914c6cafd79d8b3c6b18afb95429d52f | <|skeleton|>
class password_encrypt:
"""A class for encrypting plaintext passed in via user input"""
def __init__(self, plaintext='', key=''):
"""init method for password encryption class"""
<|body_0|>
def encryptPassword(self):
"""encrypt user inputted plaintext"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class password_encrypt:
"""A class for encrypting plaintext passed in via user input"""
def __init__(self, plaintext='', key=''):
"""init method for password encryption class"""
self.plaintext = plaintext
self.key = '6440777308024991'
self.info = {}
def encryptPassword(self... | the_stack_v2_python_sparse | pycryptodome_assignment/password_encrypt.py | sbrohl3/projects | train | 0 |
df6f751988b8704fcd4c3eab5d4c82cfc2f0f6a3 | [
"self.app_domain = kwargs.get('app_domain')\nself.session_key = kwargs.get('session_key')\nself.user = kwargs.get('user')\nself.data_source_type_id = kwargs.get('data_source_type_id')\nself.workspace_id = kwargs.get('workspace_id')",
"success, user_or_err = get_authenticated_user(request)\nif not success:\n re... | <|body_start_0|>
self.app_domain = kwargs.get('app_domain')
self.session_key = kwargs.get('session_key')
self.user = kwargs.get('user')
self.data_source_type_id = kwargs.get('data_source_type_id')
self.workspace_id = kwargs.get('workspace_id')
<|end_body_0|>
<|body_start_1|>
... | Convenience class for retrieving SavedWorkspace objects | WorkspaceRetriever | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkspaceRetriever:
"""Convenience class for retrieving SavedWorkspace objects"""
def __init__(self, **kwargs):
"""Various keyword options: app_domain - as specified in configurations.models.DOMAIN_LIST session_key - django session key, stored in SavedWorkspace.session_key user - rav... | stack_v2_sparse_classes_36k_train_016895 | 4,984 | permissive | [
{
"docstring": "Various keyword options: app_domain - as specified in configurations.models.DOMAIN_LIST session_key - django session key, stored in SavedWorkspace.session_key user - raven_auth.models.User data_source_type_id - workspaces.models.DataSourceType.id workspace_id - SavedWorkspace.id",
"name": "_... | 5 | stack_v2_sparse_classes_30k_train_010062 | Implement the Python class `WorkspaceRetriever` described below.
Class description:
Convenience class for retrieving SavedWorkspace objects
Method signatures and docstrings:
- def __init__(self, **kwargs): Various keyword options: app_domain - as specified in configurations.models.DOMAIN_LIST session_key - django ses... | Implement the Python class `WorkspaceRetriever` described below.
Class description:
Convenience class for retrieving SavedWorkspace objects
Method signatures and docstrings:
- def __init__(self, **kwargs): Various keyword options: app_domain - as specified in configurations.models.DOMAIN_LIST session_key - django ses... | f84751b33fde26cd379d8120b3c6a6b5ed2c315d | <|skeleton|>
class WorkspaceRetriever:
"""Convenience class for retrieving SavedWorkspace objects"""
def __init__(self, **kwargs):
"""Various keyword options: app_domain - as specified in configurations.models.DOMAIN_LIST session_key - django session key, stored in SavedWorkspace.session_key user - rav... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkspaceRetriever:
"""Convenience class for retrieving SavedWorkspace objects"""
def __init__(self, **kwargs):
"""Various keyword options: app_domain - as specified in configurations.models.DOMAIN_LIST session_key - django session key, stored in SavedWorkspace.session_key user - raven_auth.model... | the_stack_v2_python_sparse | tworaven_apps/workspaces/workspace_retriever.py | Mital188/TwoRavens | train | 0 |
4c8a10ece7f2349ce117d535e4e7090da2150d20 | [
"fields = OrderedDict()\nvalidator_functions = {}\noptions_members = {}\nfor base in reversed(bases):\n if hasattr(base, '_schema'):\n fields.update(deepcopy(base._schema.fields))\n options_members.update(dict(base._schema.options))\n validator_functions.update(base._schema.validators)\nfor ... | <|body_start_0|>
fields = OrderedDict()
validator_functions = {}
options_members = {}
for base in reversed(bases):
if hasattr(base, '_schema'):
fields.update(deepcopy(base._schema.fields))
options_members.update(dict(base._schema.options))
... | Metaclass for Models. | ModelMeta | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelMeta:
"""Metaclass for Models."""
def __new__(mcs, name, bases, attrs):
"""This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class."""
<|body_0|>
def _read_options(mcs, name, bases, attrs, ... | stack_v2_sparse_classes_36k_train_016896 | 15,133 | permissive | [
{
"docstring": "This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.",
"name": "__new__",
"signature": "def __new__(mcs, name, bases, attrs)"
},
{
"docstring": "Parses model `Options` class into a `SchemaOptions` in... | 2 | stack_v2_sparse_classes_30k_val_000556 | Implement the Python class `ModelMeta` described below.
Class description:
Metaclass for Models.
Method signatures and docstrings:
- def __new__(mcs, name, bases, attrs): This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.
- def _read_o... | Implement the Python class `ModelMeta` described below.
Class description:
Metaclass for Models.
Method signatures and docstrings:
- def __new__(mcs, name, bases, attrs): This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class.
- def _read_o... | 5c0edaac0bc8b040fda638845f24e39b6c324888 | <|skeleton|>
class ModelMeta:
"""Metaclass for Models."""
def __new__(mcs, name, bases, attrs):
"""This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class."""
<|body_0|>
def _read_options(mcs, name, bases, attrs, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelMeta:
"""Metaclass for Models."""
def __new__(mcs, name, bases, attrs):
"""This metaclass parses the declarative Model into a corresponding Schema, then adding it as the `_schema` attribute to the host class."""
fields = OrderedDict()
validator_functions = {}
options_... | the_stack_v2_python_sparse | bin/jamf_pro_addon_for_splunk/aob_py3/solnlib/packages/schematics/models.py | jamf/SplunkBase | train | 5 |
bf1d9d057c085ad6297f2f0e7aa68370c76ff682 | [
"rows = set()\ncolumns = set()\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if matrix[i][j] == 0:\n rows.add(i)\n columns.add(j)\nfor row in rows:\n matrix[row] = [0] * len(matrix[0])\nfor column in columns:\n for row in range(len(matrix)):\n matrix[... | <|body_start_0|>
rows = set()
columns = set()
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if matrix[i][j] == 0:
rows.add(i)
columns.add(j)
for row in rows:
matrix[row] = [0] * len(matrix[0])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def setZeroes(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def setZeroes_O1(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify mat... | stack_v2_sparse_classes_36k_train_016897 | 1,570 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instea... | 2 | stack_v2_sparse_classes_30k_train_002435 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def setZeroes_O1(self, matrix): :type matrix: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def setZeroes_O1(self, matrix): :type matrix: Li... | 16e8a7935811fa71ce71998da8549e29ba68f847 | <|skeleton|>
class Solution:
def setZeroes(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def setZeroes_O1(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify mat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def setZeroes(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
rows = set()
columns = set()
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if matrix[i][j] ... | the_stack_v2_python_sparse | leetcode4/setZeroes.py | lizyang95/leetcode | train | 0 | |
2247c5634cc0326fb4248a60299bdc7bda02e07a | [
"self.full_auto_kill_timeout_secs = full_auto_kill_timeout_secs\nself.incr_auto_kill_timeout_secs = incr_auto_kill_timeout_secs\nself.log_auto_kill_timeout_secs = log_auto_kill_timeout_secs\nself.persist_mountpoints = persist_mountpoints\nself.vlan_params = vlan_params",
"if dictionary is None:\n return None\n... | <|body_start_0|>
self.full_auto_kill_timeout_secs = full_auto_kill_timeout_secs
self.incr_auto_kill_timeout_secs = incr_auto_kill_timeout_secs
self.log_auto_kill_timeout_secs = log_auto_kill_timeout_secs
self.persist_mountpoints = persist_mountpoints
self.vlan_params = vlan_param... | Implementation of the 'OracleBackupJobParams' model. Message to capture any additional backup params specific to Oracle. Attributes: full_auto_kill_timeout_secs (long|int): Time in seconds after which the full backup of the database in given backup job should be auto-killed. If set to -1, then the backup will run until... | OracleBackupJobParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OracleBackupJobParams:
"""Implementation of the 'OracleBackupJobParams' model. Message to capture any additional backup params specific to Oracle. Attributes: full_auto_kill_timeout_secs (long|int): Time in seconds after which the full backup of the database in given backup job should be auto-kil... | stack_v2_sparse_classes_36k_train_016898 | 3,948 | permissive | [
{
"docstring": "Constructor for the OracleBackupJobParams class",
"name": "__init__",
"signature": "def __init__(self, full_auto_kill_timeout_secs=None, incr_auto_kill_timeout_secs=None, log_auto_kill_timeout_secs=None, persist_mountpoints=None, vlan_params=None)"
},
{
"docstring": "Creates an i... | 2 | null | Implement the Python class `OracleBackupJobParams` described below.
Class description:
Implementation of the 'OracleBackupJobParams' model. Message to capture any additional backup params specific to Oracle. Attributes: full_auto_kill_timeout_secs (long|int): Time in seconds after which the full backup of the database... | Implement the Python class `OracleBackupJobParams` described below.
Class description:
Implementation of the 'OracleBackupJobParams' model. Message to capture any additional backup params specific to Oracle. Attributes: full_auto_kill_timeout_secs (long|int): Time in seconds after which the full backup of the database... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class OracleBackupJobParams:
"""Implementation of the 'OracleBackupJobParams' model. Message to capture any additional backup params specific to Oracle. Attributes: full_auto_kill_timeout_secs (long|int): Time in seconds after which the full backup of the database in given backup job should be auto-kil... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OracleBackupJobParams:
"""Implementation of the 'OracleBackupJobParams' model. Message to capture any additional backup params specific to Oracle. Attributes: full_auto_kill_timeout_secs (long|int): Time in seconds after which the full backup of the database in given backup job should be auto-killed. If set t... | the_stack_v2_python_sparse | cohesity_management_sdk/models/oracle_backup_job_params.py | cohesity/management-sdk-python | train | 24 |
ad1eb218fbcc53177f2804fdd0dcd615b10debc5 | [
"for child in sorted(self.OpenChildren(), key=lambda x: x.PRIORITY):\n if not allow_external and child.EXTERNAL:\n continue\n if child.Get(child.Schema.ACTIVE):\n yield child",
"hashes = set(hashes)\nfor child in self.GetChildrenByPriority(allow_external=external):\n for urn, digest in chil... | <|body_start_0|>
for child in sorted(self.OpenChildren(), key=lambda x: x.PRIORITY):
if not allow_external and child.EXTERNAL:
continue
if child.Get(child.Schema.ACTIVE):
yield child
<|end_body_0|>
<|body_start_1|>
hashes = set(hashes)
for... | Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on according to their PRIORITY value, lowest ... | FileStore | [
"Apache-2.0",
"DOC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileStore:
"""Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on accor... | stack_v2_sparse_classes_36k_train_016899 | 24,878 | permissive | [
{
"docstring": "Generator that yields active filestore children in priority order.",
"name": "GetChildrenByPriority",
"signature": "def GetChildrenByPriority(self, allow_external=True)"
},
{
"docstring": "Checks a list of hashes for presence in the store. Sub stores need to pass back the origina... | 4 | stack_v2_sparse_classes_30k_train_019596 | Implement the Python class `FileStore` described below.
Class description:
Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_manage... | Implement the Python class `FileStore` described below.
Class description:
Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_manage... | ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e | <|skeleton|>
class FileStore:
"""Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on accor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileStore:
"""Filestore for files downloaded from clients. Modules can register for file content by creating paths under "aff4:/files". By default files created in this namespace can be read by users that have the URN (hash). See lib/aff4_objects/user_managers.py. Filestores are operated on according to their... | the_stack_v2_python_sparse | lib/aff4_objects/filestore.py | defaultnamehere/grr | train | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.