blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6da92c503b4eb8ed80069117eb78ee3670e79e01 | [
"n = len(s)\ndp = [[0] * (n + 1) for _ in range(n + 1)]\nfor i in range(n):\n dp[i][i] = 1\nfor l in range(1, n):\n for i in range(n - l):\n j = i + l\n dp[i][j] = dp[i][j - 1] + 1\n for k in range(i, j):\n t = dp[i][k] + dp[k + 1][j]\n if s[k] == s[j]:\n ... | <|body_start_0|>
n = len(s)
dp = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
dp[i][i] = 1
for l in range(1, n):
for i in range(n - l):
j = i + l
dp[i][j] = dp[i][j - 1] + 1
for k in range(i, j):
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def strangePrinter_(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def strangePrinter(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(s)
dp = [[0] * (n + 1) for _ in range(n + 1)]
... | stack_v2_sparse_classes_75kplus_train_074800 | 1,459 | permissive | [
{
"docstring": ":type s: str :rtype: int",
"name": "strangePrinter_",
"signature": "def strangePrinter_(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "strangePrinter",
"signature": "def strangePrinter(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049986 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def strangePrinter_(self, s): :type s: str :rtype: int
- def strangePrinter(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def strangePrinter_(self, s): :type s: str :rtype: int
- def strangePrinter(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def strangePrinter_(self, s):
... | 8168f6058648f2a330a7354daf3a73a4d8a4e730 | <|skeleton|>
class Solution:
def strangePrinter_(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def strangePrinter(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def strangePrinter_(self, s):
""":type s: str :rtype: int"""
n = len(s)
dp = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
dp[i][i] = 1
for l in range(1, n):
for i in range(n - l):
j = i + l
dp... | the_stack_v2_python_sparse | py/leetcode/StrangePrinter.py | danyfang/SourceCode | train | 0 | |
b7dd46dd39cedbfb6660924ca266d85705704fe3 | [
"configuration = g.user.get_api().get_configuration(configuration)\nnetwork_ip = network.split('/')[0]\nnetwork_range = configuration.get_ip_range_by_ip(configuration.IP4Network, network_ip)\nif '/' in network and network_range.get_property('CIDR') != network:\n return ('No matching IPv4 Network(s) found', 404)\... | <|body_start_0|>
configuration = g.user.get_api().get_configuration(configuration)
network_ip = network.split('/')[0]
network_range = configuration.get_ip_range_by_ip(configuration.IP4Network, network_ip)
if '/' in network and network_range.get_property('CIDR') != network:
re... | IPv4Network | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPv4Network:
def get(self, configuration, network):
"""Get IPv4 Network belonging to default or provided Configuration. Network can be of the format: 1. 10.1.1.0 2. 10.1.1.0/24"""
<|body_0|>
def delete(self, configuration, network):
"""Delete IPv4 Network belonging t... | stack_v2_sparse_classes_75kplus_train_074801 | 17,646 | permissive | [
{
"docstring": "Get IPv4 Network belonging to default or provided Configuration. Network can be of the format: 1. 10.1.1.0 2. 10.1.1.0/24",
"name": "get",
"signature": "def get(self, configuration, network)"
},
{
"docstring": "Delete IPv4 Network belonging to default or provided Configuration. N... | 3 | stack_v2_sparse_classes_30k_train_031091 | Implement the Python class `IPv4Network` described below.
Class description:
Implement the IPv4Network class.
Method signatures and docstrings:
- def get(self, configuration, network): Get IPv4 Network belonging to default or provided Configuration. Network can be of the format: 1. 10.1.1.0 2. 10.1.1.0/24
- def delet... | Implement the Python class `IPv4Network` described below.
Class description:
Implement the IPv4Network class.
Method signatures and docstrings:
- def get(self, configuration, network): Get IPv4 Network belonging to default or provided Configuration. Network can be of the format: 1. 10.1.1.0 2. 10.1.1.0/24
- def delet... | 60b36434e689c3ef852ab388ca2aae370e70c62d | <|skeleton|>
class IPv4Network:
def get(self, configuration, network):
"""Get IPv4 Network belonging to default or provided Configuration. Network can be of the format: 1. 10.1.1.0 2. 10.1.1.0/24"""
<|body_0|>
def delete(self, configuration, network):
"""Delete IPv4 Network belonging t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IPv4Network:
def get(self, configuration, network):
"""Get IPv4 Network belonging to default or provided Configuration. Network can be of the format: 1. 10.1.1.0 2. 10.1.1.0/24"""
configuration = g.user.get_api().get_configuration(configuration)
network_ip = network.split('/')[0]
... | the_stack_v2_python_sparse | Community/rest_api/ip_space_page.py | bluecatlabs/gateway-workflows | train | 45 | |
d87eea5349a5b1bf1dac68810d040a4f871c5378 | [
"properties = properties or ['composition', 'iep', 'polarity']\nresult = []\nfor aa in sequence:\n if aa in PROPERTY_DETAILS:\n aaProperties = sum((PROPERTY_DETAILS[aa][prop] for prop in properties))\n result.append(aaProperties)\nreturn result",
"properties = properties or ['composition', 'iep',... | <|body_start_0|>
properties = properties or ['composition', 'iep', 'polarity']
result = []
for aa in sequence:
if aa in PROPERTY_DETAILS:
aaProperties = sum((PROPERTY_DETAILS[aa][prop] for prop in properties))
result.append(aaProperties)
return... | A class for computing statistics based on amino acid property peaks. | Peaks | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Peaks:
"""A class for computing statistics based on amino acid property peaks."""
def convertAAToProperties(self, sequence, properties=None):
"""Takes an amino acid sequence, converts it to a sequence of properties. @param sequence: an amino acid sequence. @param properties: a list o... | stack_v2_sparse_classes_75kplus_train_074802 | 1,663 | no_license | [
{
"docstring": "Takes an amino acid sequence, converts it to a sequence of properties. @param sequence: an amino acid sequence. @param properties: a list of properties that should be included.",
"name": "convertAAToProperties",
"signature": "def convertAAToProperties(self, sequence, properties=None)"
... | 2 | stack_v2_sparse_classes_30k_train_013979 | Implement the Python class `Peaks` described below.
Class description:
A class for computing statistics based on amino acid property peaks.
Method signatures and docstrings:
- def convertAAToProperties(self, sequence, properties=None): Takes an amino acid sequence, converts it to a sequence of properties. @param sequ... | Implement the Python class `Peaks` described below.
Class description:
A class for computing statistics based on amino acid property peaks.
Method signatures and docstrings:
- def convertAAToProperties(self, sequence, properties=None): Takes an amino acid sequence, converts it to a sequence of properties. @param sequ... | 3e848dfa66f5fd07f1fb709abc935baff9f43d87 | <|skeleton|>
class Peaks:
"""A class for computing statistics based on amino acid property peaks."""
def convertAAToProperties(self, sequence, properties=None):
"""Takes an amino acid sequence, converts it to a sequence of properties. @param sequence: an amino acid sequence. @param properties: a list o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Peaks:
"""A class for computing statistics based on amino acid property peaks."""
def convertAAToProperties(self, sequence, properties=None):
"""Takes an amino acid sequence, converts it to a sequence of properties. @param sequence: an amino acid sequence. @param properties: a list of properties ... | the_stack_v2_python_sparse | light/trig/peaks.py | acorg/light-matter | train | 0 |
b7e02cc5cd5422cae8dfe816f5d54662adef16ec | [
"super(VisdomObserver, self).__init__(trainers=trainers)\nself.scene = VisdomScene(env=env)\nself.scene.insert_plot(name='proc', cls=TrainIterPiePlot)\nself.scene.insert_plot(name='loss', cls=LossPlot)\nself.scene.insert_plot(name='grad', cls=GradientFlowLinePlot)",
"self.scene.update_plot('proc', epoch, iteratio... | <|body_start_0|>
super(VisdomObserver, self).__init__(trainers=trainers)
self.scene = VisdomScene(env=env)
self.scene.insert_plot(name='proc', cls=TrainIterPiePlot)
self.scene.insert_plot(name='loss', cls=LossPlot)
self.scene.insert_plot(name='grad', cls=GradientFlowLinePlot)
<|e... | An observer created with a Visdom session Automatically plots dataset processing stats, loss and gradient flow Attributes ---------- scene : VisdomScene the visdom scene where to plot | VisdomObserver | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VisdomObserver:
"""An observer created with a Visdom session Automatically plots dataset processing stats, loss and gradient flow Attributes ---------- scene : VisdomScene the visdom scene where to plot"""
def __init__(self, trainers=None, env='main'):
"""Parameters ---------- traine... | stack_v2_sparse_classes_75kplus_train_074803 | 2,189 | permissive | [
{
"docstring": "Parameters ---------- trainers : Trainer or list (optional) the trainer to observe env : str (optional) visdom environment (default is 'main')",
"name": "__init__",
"signature": "def __init__(self, trainers=None, env='main')"
},
{
"docstring": "Receives the trainer state and exec... | 2 | null | Implement the Python class `VisdomObserver` described below.
Class description:
An observer created with a Visdom session Automatically plots dataset processing stats, loss and gradient flow Attributes ---------- scene : VisdomScene the visdom scene where to plot
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `VisdomObserver` described below.
Class description:
An observer created with a Visdom session Automatically plots dataset processing stats, loss and gradient flow Attributes ---------- scene : VisdomScene the visdom scene where to plot
Method signatures and docstrings:
- def __init__(self,... | 2615b66dd4addfd5c03d9d91a24c7da414294308 | <|skeleton|>
class VisdomObserver:
"""An observer created with a Visdom session Automatically plots dataset processing stats, loss and gradient flow Attributes ---------- scene : VisdomScene the visdom scene where to plot"""
def __init__(self, trainers=None, env='main'):
"""Parameters ---------- traine... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VisdomObserver:
"""An observer created with a Visdom session Automatically plots dataset processing stats, loss and gradient flow Attributes ---------- scene : VisdomScene the visdom scene where to plot"""
def __init__(self, trainers=None, env='main'):
"""Parameters ---------- trainers : Trainer ... | the_stack_v2_python_sparse | ACME/training/visdom_observer.py | mauriziokovacic/ACME | train | 3 |
e66c37d426971ab971dcdbcbec65174cd4321c7c | [
"self.name = name\nself.input_stream = input_stream\nself.output_stream = output_stream\nself.hyperparameters = kwargs",
"if key in self.hyperparameters.keys():\n self.hyperparameters[key] = value\nelse:\n raise ValueError('The key was not found')",
"if key in self.hyperparameters.keys():\n return self... | <|body_start_0|>
self.name = name
self.input_stream = input_stream
self.output_stream = output_stream
self.hyperparameters = kwargs
<|end_body_0|>
<|body_start_1|>
if key in self.hyperparameters.keys():
self.hyperparameters[key] = value
else:
rais... | WFMG_ModuleBase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WFMG_ModuleBase:
def __init__(self, name, input_stream, output_stream, **kwargs):
"""Initialize the name, input, output, and hyperparameters name: the name of the real model/class We can also accept any number of keyword arguments for the hyper-parameters"""
<|body_0|>
def s... | stack_v2_sparse_classes_75kplus_train_074804 | 1,325 | permissive | [
{
"docstring": "Initialize the name, input, output, and hyperparameters name: the name of the real model/class We can also accept any number of keyword arguments for the hyper-parameters",
"name": "__init__",
"signature": "def __init__(self, name, input_stream, output_stream, **kwargs)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_050422 | Implement the Python class `WFMG_ModuleBase` described below.
Class description:
Implement the WFMG_ModuleBase class.
Method signatures and docstrings:
- def __init__(self, name, input_stream, output_stream, **kwargs): Initialize the name, input, output, and hyperparameters name: the name of the real model/class We c... | Implement the Python class `WFMG_ModuleBase` described below.
Class description:
Implement the WFMG_ModuleBase class.
Method signatures and docstrings:
- def __init__(self, name, input_stream, output_stream, **kwargs): Initialize the name, input, output, and hyperparameters name: the name of the real model/class We c... | dd101b4fb6ab41d39256e98f7e290453e2c147e9 | <|skeleton|>
class WFMG_ModuleBase:
def __init__(self, name, input_stream, output_stream, **kwargs):
"""Initialize the name, input, output, and hyperparameters name: the name of the real model/class We can also accept any number of keyword arguments for the hyper-parameters"""
<|body_0|>
def s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WFMG_ModuleBase:
def __init__(self, name, input_stream, output_stream, **kwargs):
"""Initialize the name, input, output, and hyperparameters name: the name of the real model/class We can also accept any number of keyword arguments for the hyper-parameters"""
self.name = name
self.input... | the_stack_v2_python_sparse | Code/wfmg/workFlowManager/wfmg_module_base.py | fiu-airlab/Data-Science-Workflow-Manager | train | 1 | |
00d29ece7956092f851a618109135ab23461c543 | [
"if not self.named_regexp:\n self.log.warning('Regular expression not provided for plugin. Run with `--help-all` flag for more information.')\n return None\nmatch = re.match(self.named_regexp, filename)\nif not match or not match.groups():\n self.log.warning(\"Regular expression '{}' did not match anything... | <|body_start_0|>
if not self.named_regexp:
self.log.warning('Regular expression not provided for plugin. Run with `--help-all` flag for more information.')
return None
match = re.match(self.named_regexp, filename)
if not match or not match.groups():
self.log.w... | Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class. | FileNameCollectorPlugin | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileNameCollectorPlugin:
"""Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class."""
def _match(self, filename: str) -> Optional[dict]:
"""Match the named group regular expression to t... | stack_v2_sparse_classes_75kplus_train_074805 | 7,151 | permissive | [
{
"docstring": "Match the named group regular expression to the beginning of the filename and return the match groupdict or None if no match.",
"name": "_match",
"signature": "def _match(self, filename: str) -> Optional[dict]"
},
{
"docstring": "This is the main function called by the :class:`~n... | 2 | stack_v2_sparse_classes_30k_train_026111 | Implement the Python class `FileNameCollectorPlugin` described below.
Class description:
Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class.
Method signatures and docstrings:
- def _match(self, filename: str) -> Opti... | Implement the Python class `FileNameCollectorPlugin` described below.
Class description:
Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class.
Method signatures and docstrings:
- def _match(self, filename: str) -> Opti... | 6db380039dab377157620516ae49eafcf7537fc8 | <|skeleton|>
class FileNameCollectorPlugin:
"""Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class."""
def _match(self, filename: str) -> Optional[dict]:
"""Match the named group regular expression to t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileNameCollectorPlugin:
"""Submission filename collector plugin for the :class:`~nbgrader.apps.zipcollectapp.ZipCollectApp`. Collect plugin subclasses MUST inherit from this class."""
def _match(self, filename: str) -> Optional[dict]:
"""Match the named group regular expression to the beginning ... | the_stack_v2_python_sparse | nbgrader/plugins/zipcollect.py | jupyter/nbgrader | train | 1,274 |
c3cbd181b07eda7b552d58488bcd6951f7117aa1 | [
"if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host",
"headers = {'org': org, 'user': user}\nroute_name = ''\nserv... | <|body_start_0|>
if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):
raise Exception('server_ip和server_port必须同时指定')
self._server_ip = server_ip
self._server_port = server_port
self._service_name = service_name
self._host = host
<|end_bod... | KeyClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_n... | stack_v2_sparse_classes_75kplus_train_074806 | 6,564 | permissive | [
{
"docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com",
"name": "__ini... | 4 | stack_v2_sparse_classes_30k_train_039599 | Implement the Python class `KeyClient` described below.
Class description:
Implement the KeyClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与ser... | Implement the Python class `KeyClient` described below.
Class description:
Implement the KeyClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与ser... | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | <|skeleton|>
class KeyClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KeyClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server... | the_stack_v2_python_sparse | collector_service_sdk/api/key/key_client.py | easyopsapis/easyops-api-python | train | 5 | |
84c649736cc2e3ef5f212543448275b195548f4a | [
"new_user = get_user_model().objects.create_user(username=username, email=email, password=password, is_active=active, id=getRandomID())\nuserena_profile = self.create_userena_profile(new_user)\nif send_email:\n userena_profile.send_activation_email()\nreturn new_user",
"if isinstance(user.username, text_type):... | <|body_start_0|>
new_user = get_user_model().objects.create_user(username=username, email=email, password=password, is_active=active, id=getRandomID())
userena_profile = self.create_userena_profile(new_user)
if send_email:
userena_profile.send_activation_email()
return new_us... | Extra functionality for the Userena model. | SparrowManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparrowManager:
"""Extra functionality for the Userena model."""
def createuser(self, username, email, password, active=False, send_email=True):
"""A simple wrapper that creates a new :class:`User`. :param username: String containing the username of the new user. :param email: String... | stack_v2_sparse_classes_75kplus_train_074807 | 2,480 | no_license | [
{
"docstring": "A simple wrapper that creates a new :class:`User`. :param username: String containing the username of the new user. :param email: String containing the email address of the new user. :param password: String containing the password for the new user. :param active: Boolean that defines if the user... | 2 | stack_v2_sparse_classes_30k_test_002072 | Implement the Python class `SparrowManager` described below.
Class description:
Extra functionality for the Userena model.
Method signatures and docstrings:
- def createuser(self, username, email, password, active=False, send_email=True): A simple wrapper that creates a new :class:`User`. :param username: String cont... | Implement the Python class `SparrowManager` described below.
Class description:
Extra functionality for the Userena model.
Method signatures and docstrings:
- def createuser(self, username, email, password, active=False, send_email=True): A simple wrapper that creates a new :class:`User`. :param username: String cont... | a72714613fe8cb2d9a8553fe4da7f17ac63af0b0 | <|skeleton|>
class SparrowManager:
"""Extra functionality for the Userena model."""
def createuser(self, username, email, password, active=False, send_email=True):
"""A simple wrapper that creates a new :class:`User`. :param username: String containing the username of the new user. :param email: String... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SparrowManager:
"""Extra functionality for the Userena model."""
def createuser(self, username, email, password, active=False, send_email=True):
"""A simple wrapper that creates a new :class:`User`. :param username: String containing the username of the new user. :param email: String containing t... | the_stack_v2_python_sparse | account/managers.py | GeorgeWang1994/Sparrow | train | 1 |
88dcc442cbac7b19a70aa27995ca9021b06639fd | [
"self.__api_token = api_token\nself.__api_token_authorization_url = api_token_authorization_url\nself.__auth = Authentication()",
"self.__auth.update_api_token_authorization_url(self.__api_token_authorization_url)\nself.__auth.update_api_token(self.__api_token)\nself.__auth.update_auth_type(LoginTypes.API_TOKEN.v... | <|body_start_0|>
self.__api_token = api_token
self.__api_token_authorization_url = api_token_authorization_url
self.__auth = Authentication()
<|end_body_0|>
<|body_start_1|>
self.__auth.update_api_token_authorization_url(self.__api_token_authorization_url)
self.__auth.update_api... | Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well. | ApiKeyAuthentication | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiKeyAuthentication:
"""Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well."""
def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: O... | stack_v2_sparse_classes_75kplus_train_074808 | 1,496 | permissive | [
{
"docstring": ":param api_token_authorization_url: Authorization URL - Same as login --api-token-authorization-server-url. :param api_token: API Token - Same as login --api-token.",
"name": "__init__",
"signature": "def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: Optional... | 2 | stack_v2_sparse_classes_30k_train_032780 | Implement the Python class `ApiKeyAuthentication` described below.
Class description:
Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well.
Method signatures and docstrings:
- def __init__... | Implement the Python class `ApiKeyAuthentication` described below.
Class description:
Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well.
Method signatures and docstrings:
- def __init__... | 9ac18145c6a32e0c3ae035b99796e87184a53522 | <|skeleton|>
class ApiKeyAuthentication:
"""Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well."""
def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: O... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApiKeyAuthentication:
"""Class that execute authentication process using API token. It will use the API token to get temporary access token using api token authorization URL. See Authentication class as well."""
def __init__(self, api_token_authorization_url: Optional[str]=None, api_token: Optional[str]=... | the_stack_v2_python_sparse | projects/vdk-control-cli/src/vdk/internal/control/auth/apikey_auth.py | savadev/versatile-data-kit | train | 0 |
d58c2ceeae1a93b620158b02b44ec9ddfbee8ee1 | [
"self.bin_name = bin_name\nself.fastsimcoal_dir = fastsimcoal_dir\nif fastsimcoal_dir is None:\n for path in os.environ['PATH'].split(os.pathsep):\n if os.path.isfile(os.path.join(path, self.bin_name)):\n self.fastsimcoal_dir = path\n if self.fastsimcoal_dir is None:\n raise IOError('... | <|body_start_0|>
self.bin_name = bin_name
self.fastsimcoal_dir = fastsimcoal_dir
if fastsimcoal_dir is None:
for path in os.environ['PATH'].split(os.pathsep):
if os.path.isfile(os.path.join(path, self.bin_name)):
self.fastsimcoal_dir = path
... | FastSimCoalController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FastSimCoalController:
def __init__(self, fastsimcoal_dir=None, bin_name='fsc252'):
"""Initializes the controller. fastsimcoal_dir is the directory where fastsimcoal is. By default the binary should be called fsc252. bin_name specifies a different name for the binary. The initializer che... | stack_v2_sparse_classes_75kplus_train_074809 | 11,968 | permissive | [
{
"docstring": "Initializes the controller. fastsimcoal_dir is the directory where fastsimcoal is. By default the binary should be called fsc252. bin_name specifies a different name for the binary. The initializer checks for existence and executability of binaries and sets up the command line controller. Fastsi... | 2 | stack_v2_sparse_classes_30k_val_000851 | Implement the Python class `FastSimCoalController` described below.
Class description:
Implement the FastSimCoalController class.
Method signatures and docstrings:
- def __init__(self, fastsimcoal_dir=None, bin_name='fsc252'): Initializes the controller. fastsimcoal_dir is the directory where fastsimcoal is. By defau... | Implement the Python class `FastSimCoalController` described below.
Class description:
Implement the FastSimCoalController class.
Method signatures and docstrings:
- def __init__(self, fastsimcoal_dir=None, bin_name='fsc252'): Initializes the controller. fastsimcoal_dir is the directory where fastsimcoal is. By defau... | 2632aa3484ef64c9539c4885026b705b737f6d1e | <|skeleton|>
class FastSimCoalController:
def __init__(self, fastsimcoal_dir=None, bin_name='fsc252'):
"""Initializes the controller. fastsimcoal_dir is the directory where fastsimcoal is. By default the binary should be called fsc252. bin_name specifies a different name for the binary. The initializer che... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FastSimCoalController:
def __init__(self, fastsimcoal_dir=None, bin_name='fsc252'):
"""Initializes the controller. fastsimcoal_dir is the directory where fastsimcoal is. By default the binary should be called fsc252. bin_name specifies a different name for the binary. The initializer checks for existe... | the_stack_v2_python_sparse | resources/usr/local/lib/python2.7/dist-packages/Bio/PopGen/SimCoal/Controller.py | edawson/parliament2 | train | 0 | |
984d4a8105560eb8aef5cd6f922c3c2ac02e3dea | [
"self.funcs = funcs\nself.argmax = argmax\nself.maxval = maxval\nself.argmin = argmin\nself.minval = minval\nexperiment_caller = self._get_experiment_caller()\nsuper(MultiFunctionCaller, self).__init__(experiment_caller, domain, descr, *args, noise_type=noise_type, noise_scale=noise_scale, fidel_space=fidel_space, ... | <|body_start_0|>
self.funcs = funcs
self.argmax = argmax
self.maxval = maxval
self.argmin = argmin
self.minval = minval
experiment_caller = self._get_experiment_caller()
super(MultiFunctionCaller, self).__init__(experiment_caller, domain, descr, *args, noise_type=... | An Experiment Caller specifically for evaluating a collection of functions. | MultiFunctionCaller | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiFunctionCaller:
"""An Experiment Caller specifically for evaluating a collection of functions."""
def __init__(self, funcs, domain, descr='', argmax=None, maxval=None, argmin=None, minval=None, noise_type='no_noise', noise_scale=None, fidel_space=None, fidel_cost_func=None, fidel_to_opt... | stack_v2_sparse_classes_75kplus_train_074810 | 28,947 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, funcs, domain, descr='', argmax=None, maxval=None, argmin=None, minval=None, noise_type='no_noise', noise_scale=None, fidel_space=None, fidel_cost_func=None, fidel_to_opt=None, *args, **kwargs)"
},
{
"docstring":... | 4 | stack_v2_sparse_classes_30k_train_039210 | Implement the Python class `MultiFunctionCaller` described below.
Class description:
An Experiment Caller specifically for evaluating a collection of functions.
Method signatures and docstrings:
- def __init__(self, funcs, domain, descr='', argmax=None, maxval=None, argmin=None, minval=None, noise_type='no_noise', no... | Implement the Python class `MultiFunctionCaller` described below.
Class description:
An Experiment Caller specifically for evaluating a collection of functions.
Method signatures and docstrings:
- def __init__(self, funcs, domain, descr='', argmax=None, maxval=None, argmin=None, minval=None, noise_type='no_noise', no... | 3eef7d30bcc2e56f2221a624bd8ec7f933f81e40 | <|skeleton|>
class MultiFunctionCaller:
"""An Experiment Caller specifically for evaluating a collection of functions."""
def __init__(self, funcs, domain, descr='', argmax=None, maxval=None, argmin=None, minval=None, noise_type='no_noise', noise_scale=None, fidel_space=None, fidel_cost_func=None, fidel_to_opt... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiFunctionCaller:
"""An Experiment Caller specifically for evaluating a collection of functions."""
def __init__(self, funcs, domain, descr='', argmax=None, maxval=None, argmin=None, minval=None, noise_type='no_noise', noise_scale=None, fidel_space=None, fidel_cost_func=None, fidel_to_opt=None, *args,... | the_stack_v2_python_sparse | dragonfly/exd/experiment_caller.py | dragonfly/dragonfly | train | 868 |
1fcc1b5bacc7c1ae0e3ef4c9834ea32f0a6f6b20 | [
"visited_set = set()\nmax_area = 0\nm, n = (len(grid), len(grid[0]))\nfor i in range(m):\n for j in range(n):\n if grid[i][j] and (i, j) not in visited_set:\n queue = deque([(i, j)])\n visited_set.add((i, j))\n area = 0\n while queue:\n c_i, c_j =... | <|body_start_0|>
visited_set = set()
max_area = 0
m, n = (len(grid), len(grid[0]))
for i in range(m):
for j in range(n):
if grid[i][j] and (i, j) not in visited_set:
queue = deque([(i, j)])
visited_set.add((i, j))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""BFS"""
<|body_0|>
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
visited_set = set()
max_area = 0
... | stack_v2_sparse_classes_75kplus_train_074811 | 3,362 | no_license | [
{
"docstring": "BFS",
"name": "maxAreaOfIsland",
"signature": "def maxAreaOfIsland(self, grid: List[List[int]]) -> int"
},
{
"docstring": "DFS",
"name": "maxAreaOfIsland",
"signature": "def maxAreaOfIsland(self, grid: List[List[int]]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_045293 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: BFS
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: DFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: BFS
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: DFS
<|skeleton|>
class Solution:
def maxAreaOfIsland... | fce451090ecaf5471aab5a9413ac0675639ace5d | <|skeleton|>
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""BFS"""
<|body_0|>
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""BFS"""
visited_set = set()
max_area = 0
m, n = (len(grid), len(grid[0]))
for i in range(m):
for j in range(n):
if grid[i][j] and (i, j) not in visited_set:
... | the_stack_v2_python_sparse | search/695MaxAreaofIsland.py | kidexp/91leetcode | train | 0 | |
60f29405f39725e1835d6d3c98c65e40f682f986 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EdiscoverySearch()",
"from .data_source import DataSource\nfrom .data_source_scopes import DataSourceScopes\nfrom .ediscovery_add_to_review_set_operation import EdiscoveryAddToReviewSetOperation\nfrom .ediscovery_estimate_operation imp... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return EdiscoverySearch()
<|end_body_0|>
<|body_start_1|>
from .data_source import DataSource
from .data_source_scopes import DataSourceScopes
from .ediscovery_add_to_review_set_operati... | EdiscoverySearch | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EdiscoverySearch:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoverySearch:
"""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 R... | stack_v2_sparse_classes_75kplus_train_074812 | 5,246 | 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: EdiscoverySearch",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_va... | 3 | stack_v2_sparse_classes_30k_test_000092 | Implement the Python class `EdiscoverySearch` described below.
Class description:
Implement the EdiscoverySearch class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoverySearch: Creates a new instance of the appropriate class based on discrimina... | Implement the Python class `EdiscoverySearch` described below.
Class description:
Implement the EdiscoverySearch class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoverySearch: Creates a new instance of the appropriate class based on discrimina... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class EdiscoverySearch:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoverySearch:
"""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 R... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EdiscoverySearch:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EdiscoverySearch:
"""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: Edisco... | the_stack_v2_python_sparse | msgraph/generated/models/security/ediscovery_search.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
63b1f6cf9b63e49843f2aa9ca266d81da10d5e88 | [
"\"\"\"\n 子问题:以第i个数字结尾的最长子序列长度 F(i)\n 转移:F(i) = max{ F(j) + 1} j = 0, 1, 2, ..., i - 1, and 第j个数字小于第i个数字\n \"\"\"\nL = [1]\nfor i in range(1, len(nums)):\n max_length = 0\n for j in range(0, i):\n if nums[j] < nums[i]:\n if max_length < L[j] + 1:\n max_leng... | <|body_start_0|>
"""
子问题:以第i个数字结尾的最长子序列长度 F(i)
转移:F(i) = max{ F(j) + 1} j = 0, 1, 2, ..., i - 1, and 第j个数字小于第i个数字
"""
L = [1]
for i in range(1, len(nums)):
max_length = 0
for j in range(0, i):
if nums[j] < num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findLengthOfLIS(self, nums):
"""寻找最长递增子串的长度 :type nums: List[int] :rtype: int"""
<|body_0|>
def findNumberOfLIS(self, nums):
"""寻找最长递增子串的个数 :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
... | stack_v2_sparse_classes_75kplus_train_074813 | 2,169 | no_license | [
{
"docstring": "寻找最长递增子串的长度 :type nums: List[int] :rtype: int",
"name": "findLengthOfLIS",
"signature": "def findLengthOfLIS(self, nums)"
},
{
"docstring": "寻找最长递增子串的个数 :type nums: List[int] :rtype: int",
"name": "findNumberOfLIS",
"signature": "def findNumberOfLIS(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009681 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLengthOfLIS(self, nums): 寻找最长递增子串的长度 :type nums: List[int] :rtype: int
- def findNumberOfLIS(self, nums): 寻找最长递增子串的个数 :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLengthOfLIS(self, nums): 寻找最长递增子串的长度 :type nums: List[int] :rtype: int
- def findNumberOfLIS(self, nums): 寻找最长递增子串的个数 :type nums: List[int] :rtype: int
<|skeleton|>
clas... | 997b058df3c167dc6068321a93182aadb918e3f1 | <|skeleton|>
class Solution:
def findLengthOfLIS(self, nums):
"""寻找最长递增子串的长度 :type nums: List[int] :rtype: int"""
<|body_0|>
def findNumberOfLIS(self, nums):
"""寻找最长递增子串的个数 :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findLengthOfLIS(self, nums):
"""寻找最长递增子串的长度 :type nums: List[int] :rtype: int"""
"""
子问题:以第i个数字结尾的最长子序列长度 F(i)
转移:F(i) = max{ F(j) + 1} j = 0, 1, 2, ..., i - 1, and 第j个数字小于第i个数字
"""
L = [1]
for i in range(1, len(nums)... | the_stack_v2_python_sparse | algorithm/basic algs/DP/LeetCode/findNumberOfLIS.py | sunday1103/Notebook | train | 0 | |
44feb77608e233d1888ec65e7559e8311142c0c9 | [
"import da.commit_message\nexample_message = textwrap.dedent('\\n c000|p0000|j0000000|Development Automation Bootstrap\\n\\n ---\\n work_summary: Development Automation Bootstrap\\n\\n work_notes: We have a basic skeleton build-system in place and\\n avail... | <|body_start_0|>
import da.commit_message
example_message = textwrap.dedent('\n c000|p0000|j0000000|Development Automation Bootstrap\n\n ---\n work_summary: Development Automation Bootstrap\n\n work_notes: We have a basic skeleton build-system in place and\n ... | Specify the da.commit_message.parse() function. | SpecifyParse | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecifyParse:
"""Specify the da.commit_message.parse() function."""
def it_parses_well_formed_commit_messages(self):
"""The parse() function parses a well formed commit message."""
<|body_0|>
def it_fails_gracefully_with_a_malformed_commit_message(self):
"""It fa... | stack_v2_sparse_classes_75kplus_train_074814 | 5,816 | permissive | [
{
"docstring": "The parse() function parses a well formed commit message.",
"name": "it_parses_well_formed_commit_messages",
"signature": "def it_parses_well_formed_commit_messages(self)"
},
{
"docstring": "It fails gracefully when given malformed commit message.",
"name": "it_fails_graceful... | 2 | stack_v2_sparse_classes_30k_train_020706 | Implement the Python class `SpecifyParse` described below.
Class description:
Specify the da.commit_message.parse() function.
Method signatures and docstrings:
- def it_parses_well_formed_commit_messages(self): The parse() function parses a well formed commit message.
- def it_fails_gracefully_with_a_malformed_commit... | Implement the Python class `SpecifyParse` described below.
Class description:
Specify the da.commit_message.parse() function.
Method signatures and docstrings:
- def it_parses_well_formed_commit_messages(self): The parse() function parses a well formed commit message.
- def it_fails_gracefully_with_a_malformed_commit... | 04a13be2792323e3f9fdb83fd236a8e9cfe6aa2d | <|skeleton|>
class SpecifyParse:
"""Specify the da.commit_message.parse() function."""
def it_parses_well_formed_commit_messages(self):
"""The parse() function parses a well formed commit message."""
<|body_0|>
def it_fails_gracefully_with_a_malformed_commit_message(self):
"""It fa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpecifyParse:
"""Specify the da.commit_message.parse() function."""
def it_parses_well_formed_commit_messages(self):
"""The parse() function parses a well formed commit message."""
import da.commit_message
example_message = textwrap.dedent('\n c000|p0000|j0000000|Developmen... | the_stack_v2_python_sparse | a3_src/h70_internal/da/spec/spec_commit_message.py | wtpayne/hiai | train | 5 |
61ec0596e39f8345225dd7843e08ad9f5254c0c6 | [
"super().__init__()\nself.embedding_layer = nn.Embedding(len(symbol_to_id), cfg.tts_model['embedding_dim'], padding_idx=symbol_to_id['_PAD_'])\nstd = sqrt(2.0 / (len(symbol_to_id) + cfg.tts_model['embedding_dim']))\nval = sqrt(3.0) * std\nself.embedding_layer.weight.data.uniform_(-val, val)\nself.encoder = Encoder(... | <|body_start_0|>
super().__init__()
self.embedding_layer = nn.Embedding(len(symbol_to_id), cfg.tts_model['embedding_dim'], padding_idx=symbol_to_id['_PAD_'])
std = sqrt(2.0 / (len(symbol_to_id) + cfg.tts_model['embedding_dim']))
val = sqrt(3.0) * std
self.embedding_layer.weight.d... | Tacotron2 model | Tacotron2 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tacotron2:
"""Tacotron2 model"""
def __init__(self):
"""Instantiate the model"""
<|body_0|>
def forward(self, texts, mels):
"""Forward pass"""
<|body_1|>
def generate(self, texts):
"""Generate mels from text"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_75kplus_train_074815 | 3,500 | permissive | [
{
"docstring": "Instantiate the model",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Forward pass",
"name": "forward",
"signature": "def forward(self, texts, mels)"
},
{
"docstring": "Generate mels from text",
"name": "generate",
"signature": "... | 3 | null | Implement the Python class `Tacotron2` described below.
Class description:
Tacotron2 model
Method signatures and docstrings:
- def __init__(self): Instantiate the model
- def forward(self, texts, mels): Forward pass
- def generate(self, texts): Generate mels from text | Implement the Python class `Tacotron2` described below.
Class description:
Tacotron2 model
Method signatures and docstrings:
- def __init__(self): Instantiate the model
- def forward(self, texts, mels): Forward pass
- def generate(self, texts): Generate mels from text
<|skeleton|>
class Tacotron2:
"""Tacotron2 m... | cb0091241a9fb9b7e3fc88fbdbad8027a9d18928 | <|skeleton|>
class Tacotron2:
"""Tacotron2 model"""
def __init__(self):
"""Instantiate the model"""
<|body_0|>
def forward(self, texts, mels):
"""Forward pass"""
<|body_1|>
def generate(self, texts):
"""Generate mels from text"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tacotron2:
"""Tacotron2 model"""
def __init__(self):
"""Instantiate the model"""
super().__init__()
self.embedding_layer = nn.Embedding(len(symbol_to_id), cfg.tts_model['embedding_dim'], padding_idx=symbol_to_id['_PAD_'])
std = sqrt(2.0 / (len(symbol_to_id) + cfg.tts_model... | the_stack_v2_python_sparse | tacotron2/model.py | anandaswarup/TTS | train | 2 |
24f40b51cbe96d73fbb8db3e4db7f1037e5347fd | [
"self.root = root\nself.data = MNIST(root, train=False)\nif USE_NUMPY:\n state_dict = np.load(state_dict_path, allow_pickle=True).item()\nelif torch.cuda.is_available():\n state_dict = torch.load(state_dict_path)\nelse:\n state_dict = torch.load(state_dict_path, map_location=torch.device('cpu'))\nif not US... | <|body_start_0|>
self.root = root
self.data = MNIST(root, train=False)
if USE_NUMPY:
state_dict = np.load(state_dict_path, allow_pickle=True).item()
elif torch.cuda.is_available():
state_dict = torch.load(state_dict_path)
else:
state_dict = tor... | AI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AI:
def __init__(self, root, state_dict_path):
"""Initializes the AI. Args: root (str): Path to the MNIST data root. state_dict_path (str): Path to the weight .pth file"""
<|body_0|>
def infer_next(self, image=None) -> (np.ndarray, int, any, any):
"""Infer the next n... | stack_v2_sparse_classes_75kplus_train_074816 | 4,198 | permissive | [
{
"docstring": "Initializes the AI. Args: root (str): Path to the MNIST data root. state_dict_path (str): Path to the weight .pth file",
"name": "__init__",
"signature": "def __init__(self, root, state_dict_path)"
},
{
"docstring": "Infer the next number in the list or the given image. Args: ima... | 2 | stack_v2_sparse_classes_30k_train_037700 | Implement the Python class `AI` described below.
Class description:
Implement the AI class.
Method signatures and docstrings:
- def __init__(self, root, state_dict_path): Initializes the AI. Args: root (str): Path to the MNIST data root. state_dict_path (str): Path to the weight .pth file
- def infer_next(self, image... | Implement the Python class `AI` described below.
Class description:
Implement the AI class.
Method signatures and docstrings:
- def __init__(self, root, state_dict_path): Initializes the AI. Args: root (str): Path to the MNIST data root. state_dict_path (str): Path to the weight .pth file
- def infer_next(self, image... | 80a3852f4831b6e7737084656d1483a9a8940c33 | <|skeleton|>
class AI:
def __init__(self, root, state_dict_path):
"""Initializes the AI. Args: root (str): Path to the MNIST data root. state_dict_path (str): Path to the weight .pth file"""
<|body_0|>
def infer_next(self, image=None) -> (np.ndarray, int, any, any):
"""Infer the next n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AI:
def __init__(self, root, state_dict_path):
"""Initializes the AI. Args: root (str): Path to the MNIST data root. state_dict_path (str): Path to the weight .pth file"""
self.root = root
self.data = MNIST(root, train=False)
if USE_NUMPY:
state_dict = np.load(state... | the_stack_v2_python_sparse | src/inference.py | yvan674/minimal-mnist | train | 0 | |
0e36e0f0b67f5d04505f3d41021fff748aa5b858 | [
"super().__init__(config_entry, coordinator)\nself._attr_unique_id = f'{coordinator.device.device_id}_climate'\nself._attr_temperature_unit = UnitOfTemperature.CELSIUS\nself._attr_fan_modes = [FAN_ON, FAN_AUTO]\nself._attr_min_temp = -10\nself._attr_max_temp = 50\nself._attr_hvac_modes = [HVACMode.COOL, HVACMode.HE... | <|body_start_0|>
super().__init__(config_entry, coordinator)
self._attr_unique_id = f'{coordinator.device.device_id}_climate'
self._attr_temperature_unit = UnitOfTemperature.CELSIUS
self._attr_fan_modes = [FAN_ON, FAN_AUTO]
self._attr_min_temp = -10
self._attr_max_temp = ... | YoLink Climate Entity. | YoLinkClimateEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class YoLinkClimateEntity:
"""YoLink Climate Entity."""
def __init__(self, config_entry: ConfigEntry, coordinator: YoLinkCoordinator) -> None:
"""Init YoLink Thermostat."""
<|body_0|>
def update_entity_state(self, state: dict[str, Any]) -> None:
"""Update HA Entity Sta... | stack_v2_sparse_classes_75kplus_train_074817 | 5,603 | permissive | [
{
"docstring": "Init YoLink Thermostat.",
"name": "__init__",
"signature": "def __init__(self, config_entry: ConfigEntry, coordinator: YoLinkCoordinator) -> None"
},
{
"docstring": "Update HA Entity State.",
"name": "update_entity_state",
"signature": "def update_entity_state(self, state... | 6 | null | Implement the Python class `YoLinkClimateEntity` described below.
Class description:
YoLink Climate Entity.
Method signatures and docstrings:
- def __init__(self, config_entry: ConfigEntry, coordinator: YoLinkCoordinator) -> None: Init YoLink Thermostat.
- def update_entity_state(self, state: dict[str, Any]) -> None:... | Implement the Python class `YoLinkClimateEntity` described below.
Class description:
YoLink Climate Entity.
Method signatures and docstrings:
- def __init__(self, config_entry: ConfigEntry, coordinator: YoLinkCoordinator) -> None: Init YoLink Thermostat.
- def update_entity_state(self, state: dict[str, Any]) -> None:... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class YoLinkClimateEntity:
"""YoLink Climate Entity."""
def __init__(self, config_entry: ConfigEntry, coordinator: YoLinkCoordinator) -> None:
"""Init YoLink Thermostat."""
<|body_0|>
def update_entity_state(self, state: dict[str, Any]) -> None:
"""Update HA Entity Sta... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class YoLinkClimateEntity:
"""YoLink Climate Entity."""
def __init__(self, config_entry: ConfigEntry, coordinator: YoLinkCoordinator) -> None:
"""Init YoLink Thermostat."""
super().__init__(config_entry, coordinator)
self._attr_unique_id = f'{coordinator.device.device_id}_climate'
... | the_stack_v2_python_sparse | homeassistant/components/yolink/climate.py | home-assistant/core | train | 35,501 |
9a3a3ea9f6812b924baedce96de478e1e9bf9a68 | [
"self.message = message\nself.history_type = history_type\nself.kwargs = kwargs",
"print(self.message)\nfor key, val in self.kwargs.items():\n history = '{key: <20} | {val: <20}'.format(key=key, val=xstr(val))\n print(history)\nprint()"
] | <|body_start_0|>
self.message = message
self.history_type = history_type
self.kwargs = kwargs
<|end_body_0|>
<|body_start_1|>
print(self.message)
for key, val in self.kwargs.items():
history = '{key: <20} | {val: <20}'.format(key=key, val=xstr(val))
print... | HistoryInstance class for logging events in the portfolio | HistoryInstance | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistoryInstance:
"""HistoryInstance class for logging events in the portfolio"""
def __init__(self, history_type, message='', **kwargs):
""":param history_type: HistoryType enum :param message: String to print :param kwargs: Keyword args of order values or position values"""
... | stack_v2_sparse_classes_75kplus_train_074818 | 19,100 | permissive | [
{
"docstring": ":param history_type: HistoryType enum :param message: String to print :param kwargs: Keyword args of order values or position values",
"name": "__init__",
"signature": "def __init__(self, history_type, message='', **kwargs)"
},
{
"docstring": "Prints the message and values of ins... | 2 | stack_v2_sparse_classes_30k_train_001231 | Implement the Python class `HistoryInstance` described below.
Class description:
HistoryInstance class for logging events in the portfolio
Method signatures and docstrings:
- def __init__(self, history_type, message='', **kwargs): :param history_type: HistoryType enum :param message: String to print :param kwargs: Ke... | Implement the Python class `HistoryInstance` described below.
Class description:
HistoryInstance class for logging events in the portfolio
Method signatures and docstrings:
- def __init__(self, history_type, message='', **kwargs): :param history_type: HistoryType enum :param message: String to print :param kwargs: Ke... | b32a64601ea696a98990d694540df6b097778377 | <|skeleton|>
class HistoryInstance:
"""HistoryInstance class for logging events in the portfolio"""
def __init__(self, history_type, message='', **kwargs):
""":param history_type: HistoryType enum :param message: String to print :param kwargs: Keyword args of order values or position values"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HistoryInstance:
"""HistoryInstance class for logging events in the portfolio"""
def __init__(self, history_type, message='', **kwargs):
""":param history_type: HistoryType enum :param message: String to print :param kwargs: Keyword args of order values or position values"""
self.message ... | the_stack_v2_python_sparse | algotaf/backend/simulator/Portfolio.py | webclinic017/AlgoTradeFramework | train | 0 |
ae727d17f6969e080438935f8707d801bad804f3 | [
"if os.path.split(self.request.path)[1] == str(self.request.user.id):\n if ResumesModel.objects.filter(client_id=request.user.id):\n return super().get(request, *args, **kwargs)\n else:\n return redirect(reverse('create_resume'))\nelse:\n return redirect(reverse('update_resume'))",
"this_re... | <|body_start_0|>
if os.path.split(self.request.path)[1] == str(self.request.user.id):
if ResumesModel.objects.filter(client_id=request.user.id):
return super().get(request, *args, **kwargs)
else:
return redirect(reverse('create_resume'))
else:
... | ResumesUpdate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResumesUpdate:
def get(self, request, *args, **kwargs):
"""Если id запроса и id отправителя совпадают, то идёт проверка на то, есть ли у пользователя резюме: если есть, то вернётся страница с обновлением, иначе произойдёт редирект на создание резюме. В противном случае, будет попытка под... | stack_v2_sparse_classes_75kplus_train_074819 | 13,868 | no_license | [
{
"docstring": "Если id запроса и id отправителя совпадают, то идёт проверка на то, есть ли у пользователя резюме: если есть, то вернётся страница с обновлением, иначе произойдёт редирект на создание резюме. В противном случае, будет попытка подставить перейти на резюме пользователя (url update_resume)",
"n... | 2 | stack_v2_sparse_classes_30k_train_033466 | Implement the Python class `ResumesUpdate` described below.
Class description:
Implement the ResumesUpdate class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Если id запроса и id отправителя совпадают, то идёт проверка на то, есть ли у пользователя резюме: если есть, то вернётся стран... | Implement the Python class `ResumesUpdate` described below.
Class description:
Implement the ResumesUpdate class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Если id запроса и id отправителя совпадают, то идёт проверка на то, есть ли у пользователя резюме: если есть, то вернётся стран... | 4fb0b3c7244db29f87b21baac14fa034eaa418fe | <|skeleton|>
class ResumesUpdate:
def get(self, request, *args, **kwargs):
"""Если id запроса и id отправителя совпадают, то идёт проверка на то, есть ли у пользователя резюме: если есть, то вернётся страница с обновлением, иначе произойдёт редирект на создание резюме. В противном случае, будет попытка под... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResumesUpdate:
def get(self, request, *args, **kwargs):
"""Если id запроса и id отправителя совпадают, то идёт проверка на то, есть ли у пользователя резюме: если есть, то вернётся страница с обновлением, иначе произойдёт редирект на создание резюме. В противном случае, будет попытка подставить перейт... | the_stack_v2_python_sparse | work/views.py | ziminyuri/csdprt | train | 0 | |
dd5071dfaeef377a0a095b58e503bc7af420c903 | [
"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... | Proto file describing the AdGroupFeed service. Service to manage ad group feeds. | AdGroupFeedServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdGroupFeedServiceServicer:
"""Proto file describing the AdGroupFeed service. Service to manage ad group feeds."""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail."""
<|body_0|>
def MutateAdGroupFeeds(self, request, conte... | stack_v2_sparse_classes_75kplus_train_074820 | 5,536 | permissive | [
{
"docstring": "Returns the requested ad group feed in full detail.",
"name": "GetAdGroupFeed",
"signature": "def GetAdGroupFeed(self, request, context)"
},
{
"docstring": "Creates, updates, or removes ad group feeds. Operation statuses are returned.",
"name": "MutateAdGroupFeeds",
"sign... | 2 | stack_v2_sparse_classes_30k_test_002430 | Implement the Python class `AdGroupFeedServiceServicer` described below.
Class description:
Proto file describing the AdGroupFeed service. Service to manage ad group feeds.
Method signatures and docstrings:
- def GetAdGroupFeed(self, request, context): Returns the requested ad group feed in full detail.
- def MutateA... | Implement the Python class `AdGroupFeedServiceServicer` described below.
Class description:
Proto file describing the AdGroupFeed service. Service to manage ad group feeds.
Method signatures and docstrings:
- def GetAdGroupFeed(self, request, context): Returns the requested ad group feed in full detail.
- def MutateA... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class AdGroupFeedServiceServicer:
"""Proto file describing the AdGroupFeed service. Service to manage ad group feeds."""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail."""
<|body_0|>
def MutateAdGroupFeeds(self, request, conte... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdGroupFeedServiceServicer:
"""Proto file describing the AdGroupFeed service. Service to manage ad group feeds."""
def GetAdGroupFeed(self, request, context):
"""Returns the requested ad group feed in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_deta... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/ad_group_feed_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
f100eb5f173be68928c62b84042f03bbd48eabd1 | [
"self.reqparser_delete = reqparse.RequestParser()\nself.reqparser_delete.add_argument('userID', required=True, help='A userID is required', location=['form', 'json'])\nself.reqparser_delete.add_argument('widgetID', required=True, help='widgetID required', location=['form', 'json'])\nsuper().__init__()",
"args = s... | <|body_start_0|>
self.reqparser_delete = reqparse.RequestParser()
self.reqparser_delete.add_argument('userID', required=True, help='A userID is required', location=['form', 'json'])
self.reqparser_delete.add_argument('widgetID', required=True, help='widgetID required', location=['form', 'json'])... | Delete a widget from the database Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type userID: int :type widgetID: int :raises SQLAlchemyError: when a SQLAlchemyError is r... | DeleteWidgets | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteWidgets:
"""Delete a widget from the database Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type userID: int :type widgetID: int :raises SQL... | stack_v2_sparse_classes_75kplus_train_074821 | 3,599 | permissive | [
{
"docstring": "Initiates the delete widget endpoint Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type userID: int :type widgetID: int",
"name": "__init__",... | 2 | stack_v2_sparse_classes_30k_train_033289 | Implement the Python class `DeleteWidgets` described below.
Class description:
Delete a widget from the database Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type user... | Implement the Python class `DeleteWidgets` described below.
Class description:
Delete a widget from the database Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type user... | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | <|skeleton|>
class DeleteWidgets:
"""Delete a widget from the database Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type userID: int :type widgetID: int :raises SQL... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeleteWidgets:
"""Delete a widget from the database Parameters can be passed using a POST request that contains a JSON with the following fields: :param userID: Unique user identification number :param widgetID: Unique widget identification number :type userID: int :type widgetID: int :raises SQLAlchemyError:... | the_stack_v2_python_sparse | Analytics/resources/Widgets/delete_widget.py | thanosbnt/SharingCitiesDashboard | train | 0 |
57ac49ff2cbd10e51d5a864969d7dc8f7092bd18 | [
"features = features.contiguous()\nindices = indices.contiguous()\nif features_batch_cnt is not None and indices_batch_cnt is not None:\n assert features_batch_cnt.dtype == torch.int\n assert indices_batch_cnt.dtype == torch.int\n M, nsample = indices.size()\n N, C = features.size()\n B = indices_bat... | <|body_start_0|>
features = features.contiguous()
indices = indices.contiguous()
if features_batch_cnt is not None and indices_batch_cnt is not None:
assert features_batch_cnt.dtype == torch.int
assert indices_batch_cnt.dtype == torch.int
M, nsample = indices.... | Group feature with given index. | GroupingOperation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupingOperation:
"""Group feature with given index."""
def forward(ctx, features: torch.Tensor, indices: torch.Tensor, features_batch_cnt: Optional[torch.Tensor]=None, indices_batch_cnt: Optional[torch.Tensor]=None) -> torch.Tensor:
"""Args: features (Tensor): Tensor of features to... | stack_v2_sparse_classes_75kplus_train_074822 | 10,890 | permissive | [
{
"docstring": "Args: features (Tensor): Tensor of features to group, input shape is (B, C, N) or stacked inputs (N1 + N2 ..., C). indices (Tensor): The indices of features to group with, input shape is (B, npoint, nsample) or stacked inputs (M1 + M2 ..., nsample). features_batch_cnt (Tensor, optional): Input f... | 2 | stack_v2_sparse_classes_30k_test_002637 | Implement the Python class `GroupingOperation` described below.
Class description:
Group feature with given index.
Method signatures and docstrings:
- def forward(ctx, features: torch.Tensor, indices: torch.Tensor, features_batch_cnt: Optional[torch.Tensor]=None, indices_batch_cnt: Optional[torch.Tensor]=None) -> tor... | Implement the Python class `GroupingOperation` described below.
Class description:
Group feature with given index.
Method signatures and docstrings:
- def forward(ctx, features: torch.Tensor, indices: torch.Tensor, features_batch_cnt: Optional[torch.Tensor]=None, indices_batch_cnt: Optional[torch.Tensor]=None) -> tor... | 6e9ee26718b22961d5c34caca4108413b1b7b3af | <|skeleton|>
class GroupingOperation:
"""Group feature with given index."""
def forward(ctx, features: torch.Tensor, indices: torch.Tensor, features_batch_cnt: Optional[torch.Tensor]=None, indices_batch_cnt: Optional[torch.Tensor]=None) -> torch.Tensor:
"""Args: features (Tensor): Tensor of features to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupingOperation:
"""Group feature with given index."""
def forward(ctx, features: torch.Tensor, indices: torch.Tensor, features_batch_cnt: Optional[torch.Tensor]=None, indices_batch_cnt: Optional[torch.Tensor]=None) -> torch.Tensor:
"""Args: features (Tensor): Tensor of features to group, input... | the_stack_v2_python_sparse | mmcv/ops/group_points.py | open-mmlab/mmcv | train | 5,319 |
1140f76c2b095e5c0a953fabea8160566e617335 | [
"if queryset is None:\n queryset = self.get_queryset()\npk = self.kwargs.get('pk', None)\nslug = self.kwargs.get('slug', None)\ntry:\n if pk is not None:\n return queryset.get(pk=self.kwargs['pk'])\n elif slug is not None:\n slug_field = self.get_slug_field()\n return queryset.get(**{s... | <|body_start_0|>
if queryset is None:
queryset = self.get_queryset()
pk = self.kwargs.get('pk', None)
slug = self.kwargs.get('slug', None)
try:
if pk is not None:
return queryset.get(pk=self.kwargs['pk'])
elif slug is not None:
... | SingleObjectMixin | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleObjectMixin:
def get_object(self, queryset=None):
"""Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the URLconf, but subclasses can override this to return any object."""
<|body_0|>
def get_queryset(... | stack_v2_sparse_classes_75kplus_train_074823 | 2,256 | permissive | [
{
"docstring": "Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the URLconf, but subclasses can override this to return any object.",
"name": "get_object",
"signature": "def get_object(self, queryset=None)"
},
{
"docstring": "G... | 2 | stack_v2_sparse_classes_30k_train_030433 | Implement the Python class `SingleObjectMixin` described below.
Class description:
Implement the SingleObjectMixin class.
Method signatures and docstrings:
- def get_object(self, queryset=None): Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the UR... | Implement the Python class `SingleObjectMixin` described below.
Class description:
Implement the SingleObjectMixin class.
Method signatures and docstrings:
- def get_object(self, queryset=None): Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the UR... | 406734280ca6b55f66b73b3b4ec5e97ba58f045d | <|skeleton|>
class SingleObjectMixin:
def get_object(self, queryset=None):
"""Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the URLconf, but subclasses can override this to return any object."""
<|body_0|>
def get_queryset(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SingleObjectMixin:
def get_object(self, queryset=None):
"""Returns the object the view is displaying. By default this requires `self.queryset` and a `pk` or `slug` argument in the URLconf, but subclasses can override this to return any object."""
if queryset is None:
queryset = sel... | the_stack_v2_python_sparse | dockit/views/detail.py | cuker/django-dockit | train | 0 | |
dbe04fe4cd08096f584e45023f4205881874a100 | [
"self.encoder = networks.UNet_Encoder(input_channels=4, feature_dim=self.config['feature_dim'])\nself.decoder = networks.UNet_Decoder(num_encoders=1, feature_dim=self.config['feature_dim'])\nself.foreground_module = nn.Conv2d(self.config['feature_dim'], 1, kernel_size=1, stride=1, padding=0, bias=False)\nself.model... | <|body_start_0|>
self.encoder = networks.UNet_Encoder(input_channels=4, feature_dim=self.config['feature_dim'])
self.decoder = networks.UNet_Decoder(num_encoders=1, feature_dim=self.config['feature_dim'])
self.foreground_module = nn.Conv2d(self.config['feature_dim'], 1, kernel_size=1, stride=1, ... | RRNWrapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RRNWrapper:
def setup(self):
"""Setup model, losses, optimizers, misc"""
<|body_0|>
def run_on_batch(self, batch, threshold=0.5):
"""Run algorithm on batch of images in eval mode @param batch: a dictionary with the following keys: - rgb: a [N x 3 x H x W] torch.Float... | stack_v2_sparse_classes_75kplus_train_074824 | 25,135 | permissive | [
{
"docstring": "Setup model, losses, optimizers, misc",
"name": "setup",
"signature": "def setup(self)"
},
{
"docstring": "Run algorithm on batch of images in eval mode @param batch: a dictionary with the following keys: - rgb: a [N x 3 x H x W] torch.FloatTensor - initial_masks: a [N x H x W] t... | 2 | stack_v2_sparse_classes_30k_train_018758 | Implement the Python class `RRNWrapper` described below.
Class description:
Implement the RRNWrapper class.
Method signatures and docstrings:
- def setup(self): Setup model, losses, optimizers, misc
- def run_on_batch(self, batch, threshold=0.5): Run algorithm on batch of images in eval mode @param batch: a dictionar... | Implement the Python class `RRNWrapper` described below.
Class description:
Implement the RRNWrapper class.
Method signatures and docstrings:
- def setup(self): Setup model, losses, optimizers, misc
- def run_on_batch(self, batch, threshold=0.5): Run algorithm on batch of images in eval mode @param batch: a dictionar... | f30da6a553d66ebfec44efb31fecb6f310576c6f | <|skeleton|>
class RRNWrapper:
def setup(self):
"""Setup model, losses, optimizers, misc"""
<|body_0|>
def run_on_batch(self, batch, threshold=0.5):
"""Run algorithm on batch of images in eval mode @param batch: a dictionary with the following keys: - rgb: a [N x 3 x H x W] torch.Float... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RRNWrapper:
def setup(self):
"""Setup model, losses, optimizers, misc"""
self.encoder = networks.UNet_Encoder(input_channels=4, feature_dim=self.config['feature_dim'])
self.decoder = networks.UNet_Decoder(num_encoders=1, feature_dim=self.config['feature_dim'])
self.foreground_m... | the_stack_v2_python_sparse | uois/src/segmentation.py | columbia-university-robotics/moveit-experiments-spring-2021 | train | 1 | |
2418cfacbb0cc49754c6c5c27e301160f7c7b747 | [
"event_template = 'calling-command.ec2.%s'\nfor operation in self.TARGET_OPERATIONS:\n event = event_template % operation\n event_emitter.register_last(event, self.inject)",
"if not parsed_globals.paginate:\n return\npagination_config = call_parameters.get('PaginationConfig', {})\nif 'PageSize' in pagina... | <|body_start_0|>
event_template = 'calling-command.ec2.%s'
for operation in self.TARGET_OPERATIONS:
event = event_template % operation
event_emitter.register_last(event, self.inject)
<|end_body_0|>
<|body_start_1|>
if not parsed_globals.paginate:
return
... | EC2PageSizeInjector | [
"MIT",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EC2PageSizeInjector:
def register(self, event_emitter):
"""Register `inject` for each target operation."""
<|body_0|>
def inject(self, event_name, parsed_globals, call_parameters, **kwargs):
"""Conditionally inject PageSize."""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_75kplus_train_074825 | 2,304 | permissive | [
{
"docstring": "Register `inject` for each target operation.",
"name": "register",
"signature": "def register(self, event_emitter)"
},
{
"docstring": "Conditionally inject PageSize.",
"name": "inject",
"signature": "def inject(self, event_name, parsed_globals, call_parameters, **kwargs)"... | 2 | null | Implement the Python class `EC2PageSizeInjector` described below.
Class description:
Implement the EC2PageSizeInjector class.
Method signatures and docstrings:
- def register(self, event_emitter): Register `inject` for each target operation.
- def inject(self, event_name, parsed_globals, call_parameters, **kwargs): C... | Implement the Python class `EC2PageSizeInjector` described below.
Class description:
Implement the EC2PageSizeInjector class.
Method signatures and docstrings:
- def register(self, event_emitter): Register `inject` for each target operation.
- def inject(self, event_name, parsed_globals, call_parameters, **kwargs): C... | 59300441b52d32f3ecb5095085ef9d448aef63af | <|skeleton|>
class EC2PageSizeInjector:
def register(self, event_emitter):
"""Register `inject` for each target operation."""
<|body_0|>
def inject(self, event_name, parsed_globals, call_parameters, **kwargs):
"""Conditionally inject PageSize."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EC2PageSizeInjector:
def register(self, event_emitter):
"""Register `inject` for each target operation."""
event_template = 'calling-command.ec2.%s'
for operation in self.TARGET_OPERATIONS:
event = event_template % operation
event_emitter.register_last(event, se... | the_stack_v2_python_sparse | web/env/lib/python3.6/site-packages/awscli/customizations/ec2/paginate.py | rizwansoaib/face-attendence | train | 45 | |
e2cddc26c7a1e9a883f20aa92682eea3d4d8725f | [
"self.netbox = netbox\nself.min_records = min_records\nself.zones = {'direct': defaultdict(set), 'reverse': defaultdict(set)}",
"logger.info('Generating DNS records')\nrecords_count = 0\nfor name, device_data in self.netbox.devices.items():\n for address in device_data['addresses']:\n hostname, zone, zo... | <|body_start_0|>
self.netbox = netbox
self.min_records = min_records
self.zones = {'direct': defaultdict(set), 'reverse': defaultdict(set)}
<|end_body_0|>
<|body_start_1|>
logger.info('Generating DNS records')
records_count = 0
for name, device_data in self.netbox.device... | Class to represent all the DNS records. | Records | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Records:
"""Class to represent all the DNS records."""
def __init__(self, netbox: Netbox, min_records: int):
"""Initialize the instance. Arguments: netbox (Netbox): the Netbox instance. min_records (int): the minimum number of records that should be created, as a safety precaution.""... | stack_v2_sparse_classes_75kplus_train_074826 | 30,608 | permissive | [
{
"docstring": "Initialize the instance. Arguments: netbox (Netbox): the Netbox instance. min_records (int): the minimum number of records that should be created, as a safety precaution.",
"name": "__init__",
"signature": "def __init__(self, netbox: Netbox, min_records: int)"
},
{
"docstring": "... | 5 | stack_v2_sparse_classes_30k_train_031566 | Implement the Python class `Records` described below.
Class description:
Class to represent all the DNS records.
Method signatures and docstrings:
- def __init__(self, netbox: Netbox, min_records: int): Initialize the instance. Arguments: netbox (Netbox): the Netbox instance. min_records (int): the minimum number of ... | Implement the Python class `Records` described below.
Class description:
Class to represent all the DNS records.
Method signatures and docstrings:
- def __init__(self, netbox: Netbox, min_records: int): Initialize the instance. Arguments: netbox (Netbox): the Netbox instance. min_records (int): the minimum number of ... | 0e58c08f75bb6fb17c2ce32eba6b49947c811dae | <|skeleton|>
class Records:
"""Class to represent all the DNS records."""
def __init__(self, netbox: Netbox, min_records: int):
"""Initialize the instance. Arguments: netbox (Netbox): the Netbox instance. min_records (int): the minimum number of records that should be created, as a safety precaution.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Records:
"""Class to represent all the DNS records."""
def __init__(self, netbox: Netbox, min_records: int):
"""Initialize the instance. Arguments: netbox (Netbox): the Netbox instance. min_records (int): the minimum number of records that should be created, as a safety precaution."""
sel... | the_stack_v2_python_sparse | dns/generate_dns_snippets.py | wikimedia/operations-software-netbox-extras | train | 7 |
8accc383aaa6aaee6c02b33b413589ee235316db | [
"response = jsonify(get_students_list())\nresponse.headers.add('Access-Control-Allow-Origin', '*')\nreturn response",
"json_data = request.get_json(force=True)\nname = json_data['name']\nemail = json_data['email']\npassword = json_data['password']\naddress = json_data['address']\nbirth_date = datetime.strptime(js... | <|body_start_0|>
response = jsonify(get_students_list())
response.headers.add('Access-Control-Allow-Origin', '*')
return response
<|end_body_0|>
<|body_start_1|>
json_data = request.get_json(force=True)
name = json_data['name']
email = json_data['email']
password... | student | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class student:
def get(self):
"""Returns a list of all students"""
<|body_0|>
def post(self):
"""Create a new student"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
response = jsonify(get_students_list())
response.headers.add('Access-Control-Allo... | stack_v2_sparse_classes_75kplus_train_074827 | 2,530 | permissive | [
{
"docstring": "Returns a list of all students",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a new student",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `student` described below.
Class description:
Implement the student class.
Method signatures and docstrings:
- def get(self): Returns a list of all students
- def post(self): Create a new student | Implement the Python class `student` described below.
Class description:
Implement the student class.
Method signatures and docstrings:
- def get(self): Returns a list of all students
- def post(self): Create a new student
<|skeleton|>
class student:
def get(self):
"""Returns a list of all students"""
... | 09ab988f6570bd8fe64316afb5801f0ae837e3c6 | <|skeleton|>
class student:
def get(self):
"""Returns a list of all students"""
<|body_0|>
def post(self):
"""Create a new student"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class student:
def get(self):
"""Returns a list of all students"""
response = jsonify(get_students_list())
response.headers.add('Access-Control-Allow-Origin', '*')
return response
def post(self):
"""Create a new student"""
json_data = request.get_json(force=True)... | the_stack_v2_python_sparse | src/api/endpoints/students.py | douglasramos/pcs3443-escola-aviacao | train | 1 | |
91f4b515cc1511fa185ce42f9b25ff083bf27a35 | [
"masked_img = inputs\nmasks = data_samples.mask\nmasks = 1.0 - masks\nmasks = masks.repeat(1, 3, 1, 1)\nfake_reses, _ = self.generator(masked_img, masks)\nfake_imgs = fake_reses * (1.0 - masks) + masked_img * masks\nreturn (fake_reses, fake_imgs)",
"data = self.data_preprocessor(data, True)\nbatch_inputs, data_sa... | <|body_start_0|>
masked_img = inputs
masks = data_samples.mask
masks = 1.0 - masks
masks = masks.repeat(1, 3, 1, 1)
fake_reses, _ = self.generator(masked_img, masks)
fake_imgs = fake_reses * (1.0 - masks) + masked_img * masks
return (fake_reses, fake_imgs)
<|end_b... | Inpaintor for Partial Convolution method. This inpaintor is implemented according to the paper: Image inpainting for irregular holes using partial convolutions | PConvInpaintor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PConvInpaintor:
"""Inpaintor for Partial Convolution method. This inpaintor is implemented according to the paper: Image inpainting for irregular holes using partial convolutions"""
def forward_tensor(self, inputs, data_samples):
"""Forward function in tensor mode. Args: inputs (torc... | stack_v2_sparse_classes_75kplus_train_074828 | 2,825 | permissive | [
{
"docstring": "Forward function in tensor mode. Args: inputs (torch.Tensor): Input tensor. data_sample (dict): Dict contains data sample. Returns: dict: Dict contains output results.",
"name": "forward_tensor",
"signature": "def forward_tensor(self, inputs, data_samples)"
},
{
"docstring": "Tra... | 2 | stack_v2_sparse_classes_30k_train_010350 | Implement the Python class `PConvInpaintor` described below.
Class description:
Inpaintor for Partial Convolution method. This inpaintor is implemented according to the paper: Image inpainting for irregular holes using partial convolutions
Method signatures and docstrings:
- def forward_tensor(self, inputs, data_samp... | Implement the Python class `PConvInpaintor` described below.
Class description:
Inpaintor for Partial Convolution method. This inpaintor is implemented according to the paper: Image inpainting for irregular holes using partial convolutions
Method signatures and docstrings:
- def forward_tensor(self, inputs, data_samp... | a382f143c0fd20d227e1e5524831ba26a568190d | <|skeleton|>
class PConvInpaintor:
"""Inpaintor for Partial Convolution method. This inpaintor is implemented according to the paper: Image inpainting for irregular holes using partial convolutions"""
def forward_tensor(self, inputs, data_samples):
"""Forward function in tensor mode. Args: inputs (torc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PConvInpaintor:
"""Inpaintor for Partial Convolution method. This inpaintor is implemented according to the paper: Image inpainting for irregular holes using partial convolutions"""
def forward_tensor(self, inputs, data_samples):
"""Forward function in tensor mode. Args: inputs (torch.Tensor): In... | the_stack_v2_python_sparse | mmagic/models/editors/pconv/pconv_inpaintor.py | open-mmlab/mmagic | train | 1,370 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.