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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4863afcd00aa308863d26185007ecf1160c24724 | [
"lista_usuarios = []\nnro_elementos = usuarios_per_line\nnro_filas = -1\nfor usuario in user_list:\n if nro_elementos == usuarios_per_line:\n lista_usuarios.append([])\n nro_filas = nro_filas + 1\n if nro_elementos > 0:\n lista_usuarios[nro_filas].append(usuario)\n nro_elementos = ... | <|body_start_0|>
lista_usuarios = []
nro_elementos = usuarios_per_line
nro_filas = -1
for usuario in user_list:
if nro_elementos == usuarios_per_line:
lista_usuarios.append([])
nro_filas = nro_filas + 1
if nro_elementos > 0:
... | SearchFilterForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchFilterForm:
def get_ordered_list(self, user_list, usuarios_per_line=4):
"""Ordena la lista 'user_list' en una lista de N listas con un numero de elementos igual o menor al valor de la variable 'usuarios_per_line'"""
<|body_0|>
def apply_filters(self, user_list):
... | stack_v2_sparse_classes_36k_train_013300 | 20,666 | no_license | [
{
"docstring": "Ordena la lista 'user_list' en una lista de N listas con un numero de elementos igual o menor al valor de la variable 'usuarios_per_line'",
"name": "get_ordered_list",
"signature": "def get_ordered_list(self, user_list, usuarios_per_line=4)"
},
{
"docstring": "Aplica a user_list(... | 3 | null | Implement the Python class `SearchFilterForm` described below.
Class description:
Implement the SearchFilterForm class.
Method signatures and docstrings:
- def get_ordered_list(self, user_list, usuarios_per_line=4): Ordena la lista 'user_list' en una lista de N listas con un numero de elementos igual o menor al valor... | Implement the Python class `SearchFilterForm` described below.
Class description:
Implement the SearchFilterForm class.
Method signatures and docstrings:
- def get_ordered_list(self, user_list, usuarios_per_line=4): Ordena la lista 'user_list' en una lista de N listas con un numero de elementos igual o menor al valor... | a68d39a3e3b93c0b81f2893d61773b5a6453d108 | <|skeleton|>
class SearchFilterForm:
def get_ordered_list(self, user_list, usuarios_per_line=4):
"""Ordena la lista 'user_list' en una lista de N listas con un numero de elementos igual o menor al valor de la variable 'usuarios_per_line'"""
<|body_0|>
def apply_filters(self, user_list):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SearchFilterForm:
def get_ordered_list(self, user_list, usuarios_per_line=4):
"""Ordena la lista 'user_list' en una lista de N listas con un numero de elementos igual o menor al valor de la variable 'usuarios_per_line'"""
lista_usuarios = []
nro_elementos = usuarios_per_line
nr... | the_stack_v2_python_sparse | portal/forms.py | ljarufe/mp100 | train | 0 | |
aef90210446f5d5555bbb602ece60b6be9c8ca91 | [
"_ = request\nfor obj in queryset:\n leader = obj.leader()\n if leader and obj.award_to in ('individual_overall', 'individual_team') and (not self.notice_sent(obj)):\n template = NoticeTemplate.objects.get(notice_type='prize-winner')\n message = template.render({'PRIZE': obj})\n UserNotif... | <|body_start_0|>
_ = request
for obj in queryset:
leader = obj.leader()
if leader and obj.award_to in ('individual_overall', 'individual_team') and (not self.notice_sent(obj)):
template = NoticeTemplate.objects.get(notice_type='prize-winner')
messa... | raffle admin | PrizeAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrizeAdmin:
"""raffle admin"""
def notify_winner(self, request, queryset):
"""pick winner."""
<|body_0|>
def winner(self, obj):
"""return the winner and link to pickup form."""
<|body_1|>
def notice_sent(self, obj):
"""return True if the noti... | stack_v2_sparse_classes_36k_train_013301 | 2,640 | no_license | [
{
"docstring": "pick winner.",
"name": "notify_winner",
"signature": "def notify_winner(self, request, queryset)"
},
{
"docstring": "return the winner and link to pickup form.",
"name": "winner",
"signature": "def winner(self, obj)"
},
{
"docstring": "return True if the notificat... | 3 | stack_v2_sparse_classes_30k_train_018882 | Implement the Python class `PrizeAdmin` described below.
Class description:
raffle admin
Method signatures and docstrings:
- def notify_winner(self, request, queryset): pick winner.
- def winner(self, obj): return the winner and link to pickup form.
- def notice_sent(self, obj): return True if the notification had be... | Implement the Python class `PrizeAdmin` described below.
Class description:
raffle admin
Method signatures and docstrings:
- def notify_winner(self, request, queryset): pick winner.
- def winner(self, obj): return the winner and link to pickup form.
- def notice_sent(self, obj): return True if the notification had be... | dc27c9125e068eaf19cb1f179f8eb0ee6e914021 | <|skeleton|>
class PrizeAdmin:
"""raffle admin"""
def notify_winner(self, request, queryset):
"""pick winner."""
<|body_0|>
def winner(self, obj):
"""return the winner and link to pickup form."""
<|body_1|>
def notice_sent(self, obj):
"""return True if the noti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrizeAdmin:
"""raffle admin"""
def notify_winner(self, request, queryset):
"""pick winner."""
_ = request
for obj in queryset:
leader = obj.leader()
if leader and obj.award_to in ('individual_overall', 'individual_team') and (not self.notice_sent(obj)):
... | the_stack_v2_python_sparse | makahiki/apps/widgets/prizes/admin.py | gregorylburgess/makahiki | train | 0 |
9690519da1abf4091c73c0bbf74f58e6bf7f60af | [
"self._playbook_path = Path(__file__).parent / 'playbooks'\nself._config = {'private_data_dir': None, 'inventory': None, 'host_pattern': 'localhost', 'cmdline': '--forks 128'}\nif config:\n inventory_file = getattr(config, 'host_file', None)\n inventory_list = getattr(config, 'host_list', None)\n if invent... | <|body_start_0|>
self._playbook_path = Path(__file__).parent / 'playbooks'
self._config = {'private_data_dir': None, 'inventory': None, 'host_pattern': 'localhost', 'cmdline': '--forks 128'}
if config:
inventory_file = getattr(config, 'host_file', None)
inventory_list = g... | Ansible Client class. | AnsibleClient | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnsibleClient:
"""Ansible Client class."""
def __init__(self, config):
"""Initilize. Args: config (DictConfig): Ansible config object."""
<|body_0|>
def run(self, ansible_config, sudo=False):
"""Run Ansible runner. Args: ansible_config (dict): Ansible config dict... | stack_v2_sparse_classes_36k_train_013302 | 3,985 | permissive | [
{
"docstring": "Initilize. Args: config (DictConfig): Ansible config object.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Run Ansible runner. Args: ansible_config (dict): Ansible config dict. sudo (bool): Run as sudo or not. Defaults to False. Returns: int: ... | 4 | stack_v2_sparse_classes_30k_test_000538 | Implement the Python class `AnsibleClient` described below.
Class description:
Ansible Client class.
Method signatures and docstrings:
- def __init__(self, config): Initilize. Args: config (DictConfig): Ansible config object.
- def run(self, ansible_config, sudo=False): Run Ansible runner. Args: ansible_config (dict)... | Implement the Python class `AnsibleClient` described below.
Class description:
Ansible Client class.
Method signatures and docstrings:
- def __init__(self, config): Initilize. Args: config (DictConfig): Ansible config object.
- def run(self, ansible_config, sudo=False): Run Ansible runner. Args: ansible_config (dict)... | 43620c3f46701d11514901e5c238d7a571ab3ea9 | <|skeleton|>
class AnsibleClient:
"""Ansible Client class."""
def __init__(self, config):
"""Initilize. Args: config (DictConfig): Ansible config object."""
<|body_0|>
def run(self, ansible_config, sudo=False):
"""Run Ansible runner. Args: ansible_config (dict): Ansible config dict... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnsibleClient:
"""Ansible Client class."""
def __init__(self, config):
"""Initilize. Args: config (DictConfig): Ansible config object."""
self._playbook_path = Path(__file__).parent / 'playbooks'
self._config = {'private_data_dir': None, 'inventory': None, 'host_pattern': 'localho... | the_stack_v2_python_sparse | superbench/runner/ansible.py | QPC-database/superbenchmark | train | 1 |
4832f95011c9b80569787aab0d0f771fad0c6e59 | [
"self.trie = Trie()\nself.time = Trie()\nself.degree = 4",
"print('Give the degree of the markov chain (range 3-6)')\ndegree = int(input())\nself.degree = degree\nprint('Reading files and training')\nself.train()\nwhile input('Create a file? (y/n)\\n') == 'y':\n name = input('Give a name for the created file (... | <|body_start_0|>
self.trie = Trie()
self.time = Trie()
self.degree = 4
<|end_body_0|>
<|body_start_1|>
print('Give the degree of the markov chain (range 3-6)')
degree = int(input())
self.degree = degree
print('Reading files and training')
self.train()
... | A crude commandline interface for operating the music creation | CommandlineUI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandlineUI:
"""A crude commandline interface for operating the music creation"""
def __init__(self):
"""Sets both tries ready for training and sets the base degree of the markov chain"""
<|body_0|>
def execute(self):
"""Takes input trought the command line and... | stack_v2_sparse_classes_36k_train_013303 | 1,898 | no_license | [
{
"docstring": "Sets both tries ready for training and sets the base degree of the markov chain",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Takes input trought the command line and executes methods accordingly",
"name": "execute",
"signature": "def execute(... | 4 | stack_v2_sparse_classes_30k_train_014197 | Implement the Python class `CommandlineUI` described below.
Class description:
A crude commandline interface for operating the music creation
Method signatures and docstrings:
- def __init__(self): Sets both tries ready for training and sets the base degree of the markov chain
- def execute(self): Takes input trought... | Implement the Python class `CommandlineUI` described below.
Class description:
A crude commandline interface for operating the music creation
Method signatures and docstrings:
- def __init__(self): Sets both tries ready for training and sets the base degree of the markov chain
- def execute(self): Takes input trought... | 7f4eba6e0a2ea12bed8eaff48207b02f4c3df32c | <|skeleton|>
class CommandlineUI:
"""A crude commandline interface for operating the music creation"""
def __init__(self):
"""Sets both tries ready for training and sets the base degree of the markov chain"""
<|body_0|>
def execute(self):
"""Takes input trought the command line and... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommandlineUI:
"""A crude commandline interface for operating the music creation"""
def __init__(self):
"""Sets both tries ready for training and sets the base degree of the markov chain"""
self.trie = Trie()
self.time = Trie()
self.degree = 4
def execute(self):
... | the_stack_v2_python_sparse | src/ui/commandlineui.py | ReimKuos/tiralab | train | 0 |
405a13e4ad05b1b056f040b468fc2c955e395d52 | [
"super(OidcAuthorizationCode, self).__init__(auth_url=auth_url, identity_provider=identity_provider, protocol=protocol, client_id=client_id, client_secret=client_secret, access_token_endpoint=access_token_endpoint, grant_type=grant_type, access_token_type=access_token_type)\nself.redirect_uri = redirect_uri\nself.c... | <|body_start_0|>
super(OidcAuthorizationCode, self).__init__(auth_url=auth_url, identity_provider=identity_provider, protocol=protocol, client_id=client_id, client_secret=client_secret, access_token_endpoint=access_token_endpoint, grant_type=grant_type, access_token_type=access_token_type)
self.redirect... | Implementation for OpenID Connect Authorization Code. | OidcAuthorizationCode | [
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OidcAuthorizationCode:
"""Implementation for OpenID Connect Authorization Code."""
def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='authorization_code', access_token_type='access_token', redirect_uri=None, code=None):
... | stack_v2_sparse_classes_36k_train_013304 | 11,519 | permissive | [
{
"docstring": "The OpenID Authorization Code plugin expects the following. :param redirect_uri: OpenID Connect Client Redirect URL :type redirect_uri: string :param code: OAuth 2.0 Authorization Code :type code: string",
"name": "__init__",
"signature": "def __init__(self, auth_url, identity_provider, ... | 2 | stack_v2_sparse_classes_30k_train_009245 | Implement the Python class `OidcAuthorizationCode` described below.
Class description:
Implementation for OpenID Connect Authorization Code.
Method signatures and docstrings:
- def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='authorization_code', a... | Implement the Python class `OidcAuthorizationCode` described below.
Class description:
Implementation for OpenID Connect Authorization Code.
Method signatures and docstrings:
- def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='authorization_code', a... | 37b99242ac9810a01ab969d3d3874fa07b8fcee3 | <|skeleton|>
class OidcAuthorizationCode:
"""Implementation for OpenID Connect Authorization Code."""
def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='authorization_code', access_token_type='access_token', redirect_uri=None, code=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OidcAuthorizationCode:
"""Implementation for OpenID Connect Authorization Code."""
def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='authorization_code', access_token_type='access_token', redirect_uri=None, code=None):
"""The Op... | the_stack_v2_python_sparse | python_scripts/lib/keystoneauth1-2.7.0/build/lib/keystoneauth1/identity/v3/oidc.py | rkaggrawal/PythonScripts | train | 0 |
2a5d9ab8b81474b26ddf5d86e0407a644c3a480f | [
"self.n = model.n\nself.probs = probs = dict()\nself.sorted_probs = dict()\npre = [elem for elem in model.counts.keys() if not len(elem) == self.n]\nsuf = [elem for elem in model.counts.keys() if len(elem) == self.n]\nfor elem in suf:\n prfx = elem[:-1]\n sfx = elem[-1]\n if prfx in probs:\n aux = p... | <|body_start_0|>
self.n = model.n
self.probs = probs = dict()
self.sorted_probs = dict()
pre = [elem for elem in model.counts.keys() if not len(elem) == self.n]
suf = [elem for elem in model.counts.keys() if len(elem) == self.n]
for elem in suf:
prfx = elem[:-... | n-gram generator. | NGramGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NGramGenerator:
"""n-gram generator."""
def __init__(self, model):
"""model -- n-gram model."""
<|body_0|>
def generate_sent(self):
"""Randomly generate a sentence."""
<|body_1|>
def generate_token(self, prev_tokens=None):
"""Randomly generat... | stack_v2_sparse_classes_36k_train_013305 | 2,740 | permissive | [
{
"docstring": "model -- n-gram model.",
"name": "__init__",
"signature": "def __init__(self, model)"
},
{
"docstring": "Randomly generate a sentence.",
"name": "generate_sent",
"signature": "def generate_sent(self)"
},
{
"docstring": "Randomly generate a token, given prev_tokens... | 3 | stack_v2_sparse_classes_30k_train_006073 | Implement the Python class `NGramGenerator` described below.
Class description:
n-gram generator.
Method signatures and docstrings:
- def __init__(self, model): model -- n-gram model.
- def generate_sent(self): Randomly generate a sentence.
- def generate_token(self, prev_tokens=None): Randomly generate a token, give... | Implement the Python class `NGramGenerator` described below.
Class description:
n-gram generator.
Method signatures and docstrings:
- def __init__(self, model): model -- n-gram model.
- def generate_sent(self): Randomly generate a sentence.
- def generate_token(self, prev_tokens=None): Randomly generate a token, give... | cb163f203ae3ce21d210d7751c457b18443e43d0 | <|skeleton|>
class NGramGenerator:
"""n-gram generator."""
def __init__(self, model):
"""model -- n-gram model."""
<|body_0|>
def generate_sent(self):
"""Randomly generate a sentence."""
<|body_1|>
def generate_token(self, prev_tokens=None):
"""Randomly generat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NGramGenerator:
"""n-gram generator."""
def __init__(self, model):
"""model -- n-gram model."""
self.n = model.n
self.probs = probs = dict()
self.sorted_probs = dict()
pre = [elem for elem in model.counts.keys() if not len(elem) == self.n]
suf = [elem for e... | the_stack_v2_python_sparse | pagi/utils/ngram/ngram_generator.py | yoelm/pagi | train | 0 |
1e63c91d278413eb12cadaca3ef4d4dba82b82d9 | [
"self._logger = logging.getLogger(__name__)\n'A logger for this object.'\nself._job_store = job_store\n'The job store to act on.'\nself._steps_requirements = dict()\n'Requirements per step, keyed by step name and requirement\\n name.\\n '\nself._get_steps_resource_requirements(local_api_dir)",... | <|body_start_0|>
self._logger = logging.getLogger(__name__)
'A logger for this object.'
self._job_store = job_store
'The job store to act on.'
self._steps_requirements = dict()
'Requirements per step, keyed by step name and requirement\n name.\n '
... | Handles workflow execution requirements. This class keeps track of which hardware is needed for each available step, then analyses a workflow and decides which resources it needs based on this. | JobPlanner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobPlanner:
"""Handles workflow execution requirements. This class keeps track of which hardware is needed for each available step, then analyses a workflow and decides which resources it needs based on this."""
def __init__(self, job_store: SQLiteJobStore, local_api_dir: cerulean.Path):
... | stack_v2_sparse_classes_36k_train_013306 | 4,211 | permissive | [
{
"docstring": "Create a JobPlanner. Args: job_store: The job store to act on. local_api_dir: Path of local api directory.",
"name": "__init__",
"signature": "def __init__(self, job_store: SQLiteJobStore, local_api_dir: cerulean.Path)"
},
{
"docstring": "Figures out which resources a job needs. ... | 3 | stack_v2_sparse_classes_30k_train_021494 | Implement the Python class `JobPlanner` described below.
Class description:
Handles workflow execution requirements. This class keeps track of which hardware is needed for each available step, then analyses a workflow and decides which resources it needs based on this.
Method signatures and docstrings:
- def __init__... | Implement the Python class `JobPlanner` described below.
Class description:
Handles workflow execution requirements. This class keeps track of which hardware is needed for each available step, then analyses a workflow and decides which resources it needs based on this.
Method signatures and docstrings:
- def __init__... | f8ff51629d1198200bd84d59e78ca456321af940 | <|skeleton|>
class JobPlanner:
"""Handles workflow execution requirements. This class keeps track of which hardware is needed for each available step, then analyses a workflow and decides which resources it needs based on this."""
def __init__(self, job_store: SQLiteJobStore, local_api_dir: cerulean.Path):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobPlanner:
"""Handles workflow execution requirements. This class keeps track of which hardware is needed for each available step, then analyses a workflow and decides which resources it needs based on this."""
def __init__(self, job_store: SQLiteJobStore, local_api_dir: cerulean.Path):
"""Creat... | the_stack_v2_python_sparse | cerise/back_end/job_planner.py | MD-Studio/cerise | train | 10 |
2993c58fb7b33bf4320ed9f245d41597339e7e9b | [
"super().__init__()\nif not isinstance(credentials, google.oauth2.credentials.Credentials):\n raise TypeError('Cannot get ID tokens from credentials type %s' % type(credentials))\nself._credentials = credentials\nself._request = request",
"headers = {}\nself._credentials.before_request(self._request, context.m... | <|body_start_0|>
super().__init__()
if not isinstance(credentials, google.oauth2.credentials.Credentials):
raise TypeError('Cannot get ID tokens from credentials type %s' % type(credentials))
self._credentials = credentials
self._request = request
<|end_body_0|>
<|body_start... | A `gRPC AuthMetadataPlugin` that uses ID tokens. This works like the existing `google.auth.transport.grpc.AuthMetadataPlugin` except that instead of always using access tokens, it preferentially uses the `Credentials.id_token` property if available (and logs an error otherwise). See http://www.grpc.io/grpc/python/grpc.... | IdTokenAuthMetadataPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdTokenAuthMetadataPlugin:
"""A `gRPC AuthMetadataPlugin` that uses ID tokens. This works like the existing `google.auth.transport.grpc.AuthMetadataPlugin` except that instead of always using access tokens, it preferentially uses the `Credentials.id_token` property if available (and logs an error... | stack_v2_sparse_classes_36k_train_013307 | 16,711 | permissive | [
{
"docstring": "Constructs an IdTokenAuthMetadataPlugin. Args: credentials (google.auth.credentials.Credentials): The credentials to add to requests. request (google.auth.transport.Request): A HTTP transport request object used to refresh credentials as needed.",
"name": "__init__",
"signature": "def __... | 2 | stack_v2_sparse_classes_30k_val_000900 | Implement the Python class `IdTokenAuthMetadataPlugin` described below.
Class description:
A `gRPC AuthMetadataPlugin` that uses ID tokens. This works like the existing `google.auth.transport.grpc.AuthMetadataPlugin` except that instead of always using access tokens, it preferentially uses the `Credentials.id_token` p... | Implement the Python class `IdTokenAuthMetadataPlugin` described below.
Class description:
A `gRPC AuthMetadataPlugin` that uses ID tokens. This works like the existing `google.auth.transport.grpc.AuthMetadataPlugin` except that instead of always using access tokens, it preferentially uses the `Credentials.id_token` p... | 5961c76dca0fb9bb40d146f5ce13834ac29d8ddb | <|skeleton|>
class IdTokenAuthMetadataPlugin:
"""A `gRPC AuthMetadataPlugin` that uses ID tokens. This works like the existing `google.auth.transport.grpc.AuthMetadataPlugin` except that instead of always using access tokens, it preferentially uses the `Credentials.id_token` property if available (and logs an error... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdTokenAuthMetadataPlugin:
"""A `gRPC AuthMetadataPlugin` that uses ID tokens. This works like the existing `google.auth.transport.grpc.AuthMetadataPlugin` except that instead of always using access tokens, it preferentially uses the `Credentials.id_token` property if available (and logs an error otherwise). ... | the_stack_v2_python_sparse | tensorboard/uploader/auth.py | tensorflow/tensorboard | train | 6,766 |
ba1fc9a326857070c0fa2dd2e05d1bd99ab55f75 | [
"todos = model.get_todos()\nform = self.form()\nreturn render.index(todos, form)",
"form = self.form()\nif not form.validates():\n todos = model.get_todos()\n return render.index(todos, form)\nmodel.new_todo(form.d.title)\nraise web.seeother('/')"
] | <|body_start_0|>
todos = model.get_todos()
form = self.form()
return render.index(todos, form)
<|end_body_0|>
<|body_start_1|>
form = self.form()
if not form.validates():
todos = model.get_todos()
return render.index(todos, form)
model.new_todo(fo... | Index | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Index:
def GET(self):
"""Show page"""
<|body_0|>
def POST(self):
"""Add new entry"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
todos = model.get_todos()
form = self.form()
return render.index(todos, form)
<|end_body_0|>
<|body_st... | stack_v2_sparse_classes_36k_train_013308 | 2,141 | no_license | [
{
"docstring": "Show page",
"name": "GET",
"signature": "def GET(self)"
},
{
"docstring": "Add new entry",
"name": "POST",
"signature": "def POST(self)"
}
] | 2 | null | Implement the Python class `Index` described below.
Class description:
Implement the Index class.
Method signatures and docstrings:
- def GET(self): Show page
- def POST(self): Add new entry | Implement the Python class `Index` described below.
Class description:
Implement the Index class.
Method signatures and docstrings:
- def GET(self): Show page
- def POST(self): Add new entry
<|skeleton|>
class Index:
def GET(self):
"""Show page"""
<|body_0|>
def POST(self):
"""Add n... | 6880591bdd8ef4f4c1e4e760504eda8b9db4f9af | <|skeleton|>
class Index:
def GET(self):
"""Show page"""
<|body_0|>
def POST(self):
"""Add new entry"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Index:
def GET(self):
"""Show page"""
todos = model.get_todos()
form = self.form()
return render.index(todos, form)
def POST(self):
"""Add new entry"""
form = self.form()
if not form.validates():
todos = model.get_todos()
ret... | the_stack_v2_python_sparse | todowebv1/todo.py | kennyfrc/pybasics | train | 0 | |
9bfd3a05b03a827944ce79d18678fcf10fba36c2 | [
"if page_url is None or html_cont is None:\n return\nsoup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')\nnew_urls = self._get_new_urls(page_url, soup)\nnew_data = self._get_new_data(page_url, soup)\nreturn (new_urls, new_data)",
"new_urls = set()\nlinks = soup.find_all('a', href=re.compile('... | <|body_start_0|>
if page_url is None or html_cont is None:
return
soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')
new_urls = self._get_new_urls(page_url, soup)
new_data = self._get_new_data(page_url, soup)
return (new_urls, new_data)
<|end_body_0... | HtmlParse | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HtmlParse:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取url和数据 :param page_url: 下载页面的url :param html_cont: 下载网页的内容 :return:"""
<|body_0|>
def _get_new_urls(self, page_url, soup):
"""抽取新的url集合 :param page_url:下载页面的url :param soup: soup :return: 返回新的url集合"""
... | stack_v2_sparse_classes_36k_train_013309 | 2,001 | no_license | [
{
"docstring": "用于解析网页内容,抽取url和数据 :param page_url: 下载页面的url :param html_cont: 下载网页的内容 :return:",
"name": "parser",
"signature": "def parser(self, page_url, html_cont)"
},
{
"docstring": "抽取新的url集合 :param page_url:下载页面的url :param soup: soup :return: 返回新的url集合",
"name": "_get_new_urls",
"s... | 3 | stack_v2_sparse_classes_30k_val_000666 | Implement the Python class `HtmlParse` described below.
Class description:
Implement the HtmlParse class.
Method signatures and docstrings:
- def parser(self, page_url, html_cont): 用于解析网页内容,抽取url和数据 :param page_url: 下载页面的url :param html_cont: 下载网页的内容 :return:
- def _get_new_urls(self, page_url, soup): 抽取新的url集合 :para... | Implement the Python class `HtmlParse` described below.
Class description:
Implement the HtmlParse class.
Method signatures and docstrings:
- def parser(self, page_url, html_cont): 用于解析网页内容,抽取url和数据 :param page_url: 下载页面的url :param html_cont: 下载网页的内容 :return:
- def _get_new_urls(self, page_url, soup): 抽取新的url集合 :para... | 82cd7e39c2accb5f123769c16e66d7234e9a4121 | <|skeleton|>
class HtmlParse:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取url和数据 :param page_url: 下载页面的url :param html_cont: 下载网页的内容 :return:"""
<|body_0|>
def _get_new_urls(self, page_url, soup):
"""抽取新的url集合 :param page_url:下载页面的url :param soup: soup :return: 返回新的url集合"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HtmlParse:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取url和数据 :param page_url: 下载页面的url :param html_cont: 下载网页的内容 :return:"""
if page_url is None or html_cont is None:
return
soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')
new_urls = s... | the_stack_v2_python_sparse | Internet worm/five_models/HtmlParse.py | Katherinelove/python | train | 0 | |
9ceeaecd6eb28b8e2a803aeca3251367da63b365 | [
"StaticPanel.__init__(self, container, *args, **kwargs)\nself.attributes.append(wx.TextCtrl(self, wx.ID_ANY))\nself.attributes.append(wx.TextCtrl(self, wx.ID_ANY))\nself.attributes.append(wx.lib.masked.TimeCtrl(self, wx.ID_ANY, format='24HHMM'))\nself.attributes.append(wx.lib.masked.TimeCtrl(self, wx.ID_ANY, format... | <|body_start_0|>
StaticPanel.__init__(self, container, *args, **kwargs)
self.attributes.append(wx.TextCtrl(self, wx.ID_ANY))
self.attributes.append(wx.TextCtrl(self, wx.ID_ANY))
self.attributes.append(wx.lib.masked.TimeCtrl(self, wx.ID_ANY, format='24HHMM'))
self.attributes.appen... | StaticTurnusPanel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StaticTurnusPanel:
def __init__(self, container, *args, **kwargs):
"""The default constructor container: a data container object"""
<|body_0|>
def get_attributes(self):
"""Return a list of all attributes. return: a list, that contains this panel's attribute values.""... | stack_v2_sparse_classes_36k_train_013310 | 11,497 | no_license | [
{
"docstring": "The default constructor container: a data container object",
"name": "__init__",
"signature": "def __init__(self, container, *args, **kwargs)"
},
{
"docstring": "Return a list of all attributes. return: a list, that contains this panel's attribute values.",
"name": "get_attri... | 3 | null | Implement the Python class `StaticTurnusPanel` described below.
Class description:
Implement the StaticTurnusPanel class.
Method signatures and docstrings:
- def __init__(self, container, *args, **kwargs): The default constructor container: a data container object
- def get_attributes(self): Return a list of all attr... | Implement the Python class `StaticTurnusPanel` described below.
Class description:
Implement the StaticTurnusPanel class.
Method signatures and docstrings:
- def __init__(self, container, *args, **kwargs): The default constructor container: a data container object
- def get_attributes(self): Return a list of all attr... | 781ce419b51b5bd99bbd1b155c03843cb434cb8c | <|skeleton|>
class StaticTurnusPanel:
def __init__(self, container, *args, **kwargs):
"""The default constructor container: a data container object"""
<|body_0|>
def get_attributes(self):
"""Return a list of all attributes. return: a list, that contains this panel's attribute values.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StaticTurnusPanel:
def __init__(self, container, *args, **kwargs):
"""The default constructor container: a data container object"""
StaticPanel.__init__(self, container, *args, **kwargs)
self.attributes.append(wx.TextCtrl(self, wx.ID_ANY))
self.attributes.append(wx.TextCtrl(sel... | the_stack_v2_python_sparse | gui/static_data.py | mcepar1/Scheduler | train | 0 | |
69d35e753673be2e50d55b0463b4200e3ce1cdc0 | [
"self.struc1 = struc1\nself.charge = charge\nself.center_index = center_index\nself.neighboring_index = neighboring_index\nself.vacuum = vacuum\nself.max_distance = max_distance\nself.struc2 = self.generate_structure()",
"sites = self.struc1.sites\nlattice_matrix = self.struc1.lattice.matrix\ncart_coords = []\nsp... | <|body_start_0|>
self.struc1 = struc1
self.charge = charge
self.center_index = center_index
self.neighboring_index = neighboring_index
self.vacuum = vacuum
self.max_distance = max_distance
self.struc2 = self.generate_structure()
<|end_body_0|>
<|body_start_1|>
... | write vasp files ready for running using MPRelaxSet | IonVacuumFileWriter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IonVacuumFileWriter:
"""write vasp files ready for running using MPRelaxSet"""
def __init__(self, struc1, center_index, neighboring_index=None, vacuum=20, max_distance=4, charge=0):
"""Args: struc1: the original crystal structure center_index: the index of the center atom in original... | stack_v2_sparse_classes_36k_train_013311 | 5,319 | permissive | [
{
"docstring": "Args: struc1: the original crystal structure center_index: the index of the center atom in original structure (starting from 1, as used by vesta) neighboring_index: a list of index for neighboring atoms (starting from 1, as used by vesta) vacuum: dimension of the vacuum(cubic) max_distance: the ... | 4 | stack_v2_sparse_classes_30k_train_010415 | Implement the Python class `IonVacuumFileWriter` described below.
Class description:
write vasp files ready for running using MPRelaxSet
Method signatures and docstrings:
- def __init__(self, struc1, center_index, neighboring_index=None, vacuum=20, max_distance=4, charge=0): Args: struc1: the original crystal structu... | Implement the Python class `IonVacuumFileWriter` described below.
Class description:
write vasp files ready for running using MPRelaxSet
Method signatures and docstrings:
- def __init__(self, struc1, center_index, neighboring_index=None, vacuum=20, max_distance=4, charge=0): Args: struc1: the original crystal structu... | 04330ea1ce9f04913eb14233c7aaf161601f8b6f | <|skeleton|>
class IonVacuumFileWriter:
"""write vasp files ready for running using MPRelaxSet"""
def __init__(self, struc1, center_index, neighboring_index=None, vacuum=20, max_distance=4, charge=0):
"""Args: struc1: the original crystal structure center_index: the index of the center atom in original... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IonVacuumFileWriter:
"""write vasp files ready for running using MPRelaxSet"""
def __init__(self, struc1, center_index, neighboring_index=None, vacuum=20, max_distance=4, charge=0):
"""Args: struc1: the original crystal structure center_index: the index of the center atom in original structure (s... | the_stack_v2_python_sparse | structure/ion_vacuum.py | amyncarol/mmtools | train | 0 |
02487ae040fbe9a689f5ace0bfb461e9690e605b | [
"super(Organization, self).__init__(resource_id=organization_id, resource_type=resource.ResourceType.ORGANIZATION, name=name, display_name=display_name, lifecycle_state=lifecycle_state)\nself.full_name = full_name\nself.data = data",
"del parent\norg_dict = json.loads(json_string)\norg_name = org_dict['name']\nor... | <|body_start_0|>
super(Organization, self).__init__(resource_id=organization_id, resource_type=resource.ResourceType.ORGANIZATION, name=name, display_name=display_name, lifecycle_state=lifecycle_state)
self.full_name = full_name
self.data = data
<|end_body_0|>
<|body_start_1|>
del paren... | Organization resource. | Organization | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Organization:
"""Organization resource."""
def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED):
"""Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource ... | stack_v2_sparse_classes_36k_train_013312 | 3,000 | permissive | [
{
"docstring": "Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource name and ancestory. data (str): Resource representation of the organization. name (str): The organization's unique GCP name, with the format \"organizations/{id}\". display_name (str): The organizati... | 2 | stack_v2_sparse_classes_30k_train_012649 | Implement the Python class `Organization` described below.
Class description:
Organization resource.
Method signatures and docstrings:
- def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): Initialize. Args: organization_id (int):... | Implement the Python class `Organization` described below.
Class description:
Organization resource.
Method signatures and docstrings:
- def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): Initialize. Args: organization_id (int):... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class Organization:
"""Organization resource."""
def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED):
"""Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Organization:
"""Organization resource."""
def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED):
"""Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource name and ance... | the_stack_v2_python_sparse | google/cloud/forseti/common/gcp_type/organization.py | kevensen/forseti-security | train | 1 |
f7b5876a13b8c3f8070c3d0b377e62ad5bb28098 | [
"self.total_offers = total_offers\nself.total_offer_pages = total_offer_pages\nself.more_offers_url = more_offers_url\nself.offer = offer",
"if dictionary is None:\n return None\ntotal_offers = dictionary.get('TotalOffers')\ntotal_offer_pages = dictionary.get('TotalOfferPages')\nmore_offers_url = dictionary.ge... | <|body_start_0|>
self.total_offers = total_offers
self.total_offer_pages = total_offer_pages
self.more_offers_url = more_offers_url
self.offer = offer
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
total_offers = dictionary.get('TotalOffer... | Implementation of the 'Offers' model. TODO: type model description here. Attributes: total_offers (int): TODO: type description here. total_offer_pages (int): TODO: type description here. more_offers_url (string): TODO: type description here. offer (list of Offer): TODO: type description here. | Offers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Offers:
"""Implementation of the 'Offers' model. TODO: type model description here. Attributes: total_offers (int): TODO: type description here. total_offer_pages (int): TODO: type description here. more_offers_url (string): TODO: type description here. offer (list of Offer): TODO: type descripti... | stack_v2_sparse_classes_36k_train_013313 | 2,403 | permissive | [
{
"docstring": "Constructor for the Offers class",
"name": "__init__",
"signature": "def __init__(self, total_offers=None, total_offer_pages=None, more_offers_url=None, offer=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary... | 2 | stack_v2_sparse_classes_30k_train_011825 | Implement the Python class `Offers` described below.
Class description:
Implementation of the 'Offers' model. TODO: type model description here. Attributes: total_offers (int): TODO: type description here. total_offer_pages (int): TODO: type description here. more_offers_url (string): TODO: type description here. offe... | Implement the Python class `Offers` described below.
Class description:
Implementation of the 'Offers' model. TODO: type model description here. Attributes: total_offers (int): TODO: type description here. total_offer_pages (int): TODO: type description here. more_offers_url (string): TODO: type description here. offe... | 26ea1019115a1de3b1b37a4b830525e164ac55ce | <|skeleton|>
class Offers:
"""Implementation of the 'Offers' model. TODO: type model description here. Attributes: total_offers (int): TODO: type description here. total_offer_pages (int): TODO: type description here. more_offers_url (string): TODO: type description here. offer (list of Offer): TODO: type descripti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Offers:
"""Implementation of the 'Offers' model. TODO: type model description here. Attributes: total_offers (int): TODO: type description here. total_offer_pages (int): TODO: type description here. more_offers_url (string): TODO: type description here. offer (list of Offer): TODO: type description here."""
... | the_stack_v2_python_sparse | awsecommerceservice/models/offers.py | nidaizamir/Test-PY | train | 0 |
8c95cc508bb0943266b64ece7f74f865e20c2a42 | [
"self.p.m['r'], self.p.m['s'] = (1.0, 1.0)\nself.p.m['k'][1][2] = 0.124\nself.p.m['k'][2][1] = self.p.m['k'][1][2]\nself.s.update_state(self.s, self.p, P=2400000.0, T=263.1, X=[[0.25], [0.25]])\nself.assertTrue(type(self.s.c) is list)\nself.assertTrue(type(self.s.c[1]) is dict)\nself.assertTrue(type(self.p.c) is li... | <|body_start_0|>
self.p.m['r'], self.p.m['s'] = (1.0, 1.0)
self.p.m['k'][1][2] = 0.124
self.p.m['k'][2][1] = self.p.m['k'][1][2]
self.s.update_state(self.s, self.p, P=2400000.0, T=263.1, X=[[0.25], [0.25]])
self.assertTrue(type(self.s.c) is list)
self.assertTrue(type(self... | Test ncomp functions | TestNcompFuncsBin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestNcompFuncsBin:
"""Test ncomp functions"""
def test_b1(self):
"""State and data class defs and funcs"""
<|body_0|>
def test_b2(self):
"""Equil. CO2-Ethane Equilibrium"""
<|body_1|>
def test_b3(self):
"""Phase sep. CO2-Ethane Equilibrium"""... | stack_v2_sparse_classes_36k_train_013314 | 14,154 | no_license | [
{
"docstring": "State and data class defs and funcs",
"name": "test_b1",
"signature": "def test_b1(self)"
},
{
"docstring": "Equil. CO2-Ethane Equilibrium",
"name": "test_b2",
"signature": "def test_b2(self)"
},
{
"docstring": "Phase sep. CO2-Ethane Equilibrium",
"name": "tes... | 6 | stack_v2_sparse_classes_30k_train_004395 | Implement the Python class `TestNcompFuncsBin` described below.
Class description:
Test ncomp functions
Method signatures and docstrings:
- def test_b1(self): State and data class defs and funcs
- def test_b2(self): Equil. CO2-Ethane Equilibrium
- def test_b3(self): Phase sep. CO2-Ethane Equilibrium
- def test_b4(sel... | Implement the Python class `TestNcompFuncsBin` described below.
Class description:
Test ncomp functions
Method signatures and docstrings:
- def test_b1(self): State and data class defs and funcs
- def test_b2(self): Equil. CO2-Ethane Equilibrium
- def test_b3(self): Phase sep. CO2-Ethane Equilibrium
- def test_b4(sel... | 91ae76ae50cb46530545b69beaf0fbb4e20450fc | <|skeleton|>
class TestNcompFuncsBin:
"""Test ncomp functions"""
def test_b1(self):
"""State and data class defs and funcs"""
<|body_0|>
def test_b2(self):
"""Equil. CO2-Ethane Equilibrium"""
<|body_1|>
def test_b3(self):
"""Phase sep. CO2-Ethane Equilibrium"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestNcompFuncsBin:
"""Test ncomp functions"""
def test_b1(self):
"""State and data class defs and funcs"""
self.p.m['r'], self.p.m['s'] = (1.0, 1.0)
self.p.m['k'][1][2] = 0.124
self.p.m['k'][2][1] = self.p.m['k'][1][2]
self.s.update_state(self.s, self.p, P=2400000.... | the_stack_v2_python_sparse | ncomp_tests.py | Stefan-Endres/DWPM-Mixture-Model | train | 5 |
53ad3e903a693e5ddd68b3d4c0f1bcf2b8610c87 | [
"if self.get_text('latex') is not None:\n return True\nreturn False",
"if self.has_raw_latex():\n return self.get_text('latex')\nraise IllegalState()"
] | <|body_start_0|>
if self.get_text('latex') is not None:
return True
return False
<|end_body_0|>
<|body_start_1|>
if self.has_raw_latex():
return self.get_text('latex')
raise IllegalState()
<|end_body_1|>
| mecqbank answers | MecQBankAnswerRecord | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MecQBankAnswerRecord:
"""mecqbank answers"""
def has_raw_latex(self):
"""stub"""
<|body_0|>
def get_raw_latex(self):
"""stub"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.get_text('latex') is not None:
return True
r... | stack_v2_sparse_classes_36k_train_013315 | 7,652 | permissive | [
{
"docstring": "stub",
"name": "has_raw_latex",
"signature": "def has_raw_latex(self)"
},
{
"docstring": "stub",
"name": "get_raw_latex",
"signature": "def get_raw_latex(self)"
}
] | 2 | null | Implement the Python class `MecQBankAnswerRecord` described below.
Class description:
mecqbank answers
Method signatures and docstrings:
- def has_raw_latex(self): stub
- def get_raw_latex(self): stub | Implement the Python class `MecQBankAnswerRecord` described below.
Class description:
mecqbank answers
Method signatures and docstrings:
- def has_raw_latex(self): stub
- def get_raw_latex(self): stub
<|skeleton|>
class MecQBankAnswerRecord:
"""mecqbank answers"""
def has_raw_latex(self):
"""stub"""... | 445f968a175d61c8d92c0f617a3c17dc1dc7c584 | <|skeleton|>
class MecQBankAnswerRecord:
"""mecqbank answers"""
def has_raw_latex(self):
"""stub"""
<|body_0|>
def get_raw_latex(self):
"""stub"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MecQBankAnswerRecord:
"""mecqbank answers"""
def has_raw_latex(self):
"""stub"""
if self.get_text('latex') is not None:
return True
return False
def get_raw_latex(self):
"""stub"""
if self.has_raw_latex():
return self.get_text('latex')
... | the_stack_v2_python_sparse | dlkit/records/assessment/mecqbank/item_records.py | mitsei/dlkit | train | 2 |
af69ff0b967a81476912aa28b969e08be9c547f0 | [
"mat = [[-1] * n for _ in range(n)]\nfor s, d, p in flights:\n mat[s][d] = p\ndist = [{} for _ in range(K + 1)]\nfor city, price in enumerate(mat[src]):\n if price < 0:\n continue\n dist[0][city] = price\nfor i in range(1, K + 1):\n for depart, spend in dist[i - 1].items():\n for arrival, ... | <|body_start_0|>
mat = [[-1] * n for _ in range(n)]
for s, d, p in flights:
mat[s][d] = p
dist = [{} for _ in range(K + 1)]
for city, price in enumerate(mat[src]):
if price < 0:
continue
dist[0][city] = price
for i in range(1, K... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
"""May 02, 2020 02:07"""
<|body_0|>
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
"""May 02, 2020 02:12"""
... | stack_v2_sparse_classes_36k_train_013316 | 4,732 | no_license | [
{
"docstring": "May 02, 2020 02:07",
"name": "findCheapestPrice",
"signature": "def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int"
},
{
"docstring": "May 02, 2020 02:12",
"name": "findCheapestPrice",
"signature": "def findCheapestPrice(self,... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int: May 02, 2020 02:07
- def findCheapestPrice(self, n: int, flights: List[List[int]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int: May 02, 2020 02:07
- def findCheapestPrice(self, n: int, flights: List[List[int]... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
"""May 02, 2020 02:07"""
<|body_0|>
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
"""May 02, 2020 02:12"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
"""May 02, 2020 02:07"""
mat = [[-1] * n for _ in range(n)]
for s, d, p in flights:
mat[s][d] = p
dist = [{} for _ in range(K + 1)]
for city, price in... | the_stack_v2_python_sparse | leetcode/solved/803_Cheapest_Flights_Within_K_Stops/solution.py | sungminoh/algorithms | train | 0 | |
b6ab896e25cb3d513dd3fe00ec17883f41a3be60 | [
"_url_path = '/tokens'\n_url_path = APIHelper.append_url_with_template_parameters(_url_path, {'public_key': public_key})\n_query_builder = Configuration.base_uri\n_query_builder += _url_path\n_query_parameters = {'appId': app_id}\n_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_pa... | <|body_start_0|>
_url_path = '/tokens'
_url_path = APIHelper.append_url_with_template_parameters(_url_path, {'public_key': public_key})
_query_builder = Configuration.base_uri
_query_builder += _url_path
_query_parameters = {'appId': app_id}
_query_builder = APIHelper.app... | A Controller to access Endpoints in the mundiapi API. | TokensController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TokensController:
"""A Controller to access Endpoints in the mundiapi API."""
def create_token(self, public_key, body, idempotency_key=None, app_id=None):
"""Does a POST request to /tokens. CreateToken Args: public_key (string): Public key body (TokensRequest): Request for creating a... | stack_v2_sparse_classes_36k_train_013317 | 6,137 | permissive | [
{
"docstring": "Does a POST request to /tokens. CreateToken Args: public_key (string): Public key body (TokensRequest): Request for creating a token idempotency_key (string, optional): TODO: type description here. Example: app_id (string, optional): TODO: type description here. Example: Returns: TokensResponse:... | 2 | stack_v2_sparse_classes_30k_train_011667 | Implement the Python class `TokensController` described below.
Class description:
A Controller to access Endpoints in the mundiapi API.
Method signatures and docstrings:
- def create_token(self, public_key, body, idempotency_key=None, app_id=None): Does a POST request to /tokens. CreateToken Args: public_key (string)... | Implement the Python class `TokensController` described below.
Class description:
A Controller to access Endpoints in the mundiapi API.
Method signatures and docstrings:
- def create_token(self, public_key, body, idempotency_key=None, app_id=None): Does a POST request to /tokens. CreateToken Args: public_key (string)... | 95c80c35dd57bb2a238faeaf30d1e3b4544d2298 | <|skeleton|>
class TokensController:
"""A Controller to access Endpoints in the mundiapi API."""
def create_token(self, public_key, body, idempotency_key=None, app_id=None):
"""Does a POST request to /tokens. CreateToken Args: public_key (string): Public key body (TokensRequest): Request for creating a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TokensController:
"""A Controller to access Endpoints in the mundiapi API."""
def create_token(self, public_key, body, idempotency_key=None, app_id=None):
"""Does a POST request to /tokens. CreateToken Args: public_key (string): Public key body (TokensRequest): Request for creating a token idempo... | the_stack_v2_python_sparse | mundiapi/controllers/tokens_controller.py | mundipagg/MundiAPI-PYTHON | train | 10 |
6307b14c4c35c5e6ad7648cfe95d8ad9a0bad599 | [
"for r in range(len(matrix)):\n for c in range(len(matrix[r])):\n if matrix[r][c] == 0:\n for rr in range(len(matrix)):\n if rr != r and matrix[rr][c] != 0:\n matrix[rr][c] = -100000\n for cc in range(len(matrix[r])):\n if cc != c and ... | <|body_start_0|>
for r in range(len(matrix)):
for c in range(len(matrix[r])):
if matrix[r][c] == 0:
for rr in range(len(matrix)):
if rr != r and matrix[rr][c] != 0:
matrix[rr][c] = -100000
for... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def setZeroes(self, matrix):
"""把后设置的0和本来就是的0区分开就可以了 :param matrix: :return:"""
<|body_0|>
def setZeroes2(self, matrix):
"""或者使用第一行,第一列记录哪些行和列需要置0 :param matrix: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for r in range(len(m... | stack_v2_sparse_classes_36k_train_013318 | 2,770 | permissive | [
{
"docstring": "把后设置的0和本来就是的0区分开就可以了 :param matrix: :return:",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix)"
},
{
"docstring": "或者使用第一行,第一列记录哪些行和列需要置0 :param matrix: :return:",
"name": "setZeroes2",
"signature": "def setZeroes2(self, matrix)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix): 把后设置的0和本来就是的0区分开就可以了 :param matrix: :return:
- def setZeroes2(self, matrix): 或者使用第一行,第一列记录哪些行和列需要置0 :param matrix: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix): 把后设置的0和本来就是的0区分开就可以了 :param matrix: :return:
- def setZeroes2(self, matrix): 或者使用第一行,第一列记录哪些行和列需要置0 :param matrix: :return:
<|skeleton|>
class Solut... | 2830c7e2ada8dfd3dcdda7c06846116d4f944a27 | <|skeleton|>
class Solution:
def setZeroes(self, matrix):
"""把后设置的0和本来就是的0区分开就可以了 :param matrix: :return:"""
<|body_0|>
def setZeroes2(self, matrix):
"""或者使用第一行,第一列记录哪些行和列需要置0 :param matrix: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def setZeroes(self, matrix):
"""把后设置的0和本来就是的0区分开就可以了 :param matrix: :return:"""
for r in range(len(matrix)):
for c in range(len(matrix[r])):
if matrix[r][c] == 0:
for rr in range(len(matrix)):
if rr != r and matr... | the_stack_v2_python_sparse | leetcode/medium/Set_Matrix_Zeroes.py | shhuan/algorithms | train | 0 | |
85138878fcd8ccc448292f60908aa82b3d40b3fd | [
"VapiInterface.__init__(self, config, _SoftwareStub)\nself._VAPI_OPERATION_IDS = {}\nself._VAPI_OPERATION_IDS.update({'scan_task': 'scan$task'})",
"task_id = self._invoke('scan$task', {'host': host})\ntask_svc = Tasks(self._config)\ntask_instance = Task(task_id, task_svc, type.ReferenceType('com.vmware.esx.settin... | <|body_start_0|>
VapiInterface.__init__(self, config, _SoftwareStub)
self._VAPI_OPERATION_IDS = {}
self._VAPI_OPERATION_IDS.update({'scan_task': 'scan$task'})
<|end_body_0|>
<|body_start_1|>
task_id = self._invoke('scan$task', {'host': host})
task_svc = Tasks(self._config)
... | The ``Software`` class provides methods to manage desired software specification of a standalone ESX host. | Software | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Software:
"""The ``Software`` class provides methods to manage desired software specification of a standalone ESX host."""
def __init__(self, config):
""":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub."... | stack_v2_sparse_classes_36k_train_013319 | 6,024 | permissive | [
{
"docstring": ":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Scans the host against the host's desired state.. The result of thi... | 2 | null | Implement the Python class `Software` described below.
Class description:
The ``Software`` class provides methods to manage desired software specification of a standalone ESX host.
Method signatures and docstrings:
- def __init__(self, config): :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param... | Implement the Python class `Software` described below.
Class description:
The ``Software`` class provides methods to manage desired software specification of a standalone ESX host.
Method signatures and docstrings:
- def __init__(self, config): :type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param... | c07e1be98615201139b26c28db3aa584c4254b66 | <|skeleton|>
class Software:
"""The ``Software`` class provides methods to manage desired software specification of a standalone ESX host."""
def __init__(self, config):
""":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Software:
"""The ``Software`` class provides methods to manage desired software specification of a standalone ESX host."""
def __init__(self, config):
""":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub."""
Va... | the_stack_v2_python_sparse | com/vmware/esx/settings/hosts_client.py | adammillerio/vsphere-automation-sdk-python | train | 0 |
9c9b465ab1ff35fff59f09b577b56a5355fbb789 | [
"res = []\nn, m = (len(s), len(p))\nif n < m:\n return res\np_char_count, s_char_count = ([0] * 128, [0] * 128)\nfor x in p:\n p_char_count[ord(x)] += 1\nfor x in s[:m - 1]:\n s_char_count[ord(x)] += 1\nfor i in range(m - 1, n):\n s_char_count[ord(s[i])] += 1\n if i - m >= 0:\n s_char_count[or... | <|body_start_0|>
res = []
n, m = (len(s), len(p))
if n < m:
return res
p_char_count, s_char_count = ([0] * 128, [0] * 128)
for x in p:
p_char_count[ord(x)] += 1
for x in s[:m - 1]:
s_char_count[ord(x)] += 1
for i in range(m - 1,... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_0|>
def findAnagrams_old(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = []
n,... | stack_v2_sparse_classes_36k_train_013320 | 3,116 | no_license | [
{
"docstring": ":type s: str :type p: str :rtype: List[int]",
"name": "findAnagrams",
"signature": "def findAnagrams(self, s, p)"
},
{
"docstring": ":type s: str :type p: str :rtype: List[int]",
"name": "findAnagrams_old",
"signature": "def findAnagrams_old(self, s, p)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
- def findAnagrams_old(self, s, p): :type s: str :type p: str :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
- def findAnagrams_old(self, s, p): :type s: str :type p: str :rtype: List[int]
<|skeleton|>
class Solu... | 3f0ffd519404165fd1a735441b212c801fd1ad1e | <|skeleton|>
class Solution:
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_0|>
def findAnagrams_old(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
res = []
n, m = (len(s), len(p))
if n < m:
return res
p_char_count, s_char_count = ([0] * 128, [0] * 128)
for x in p:
p_char_count[ord(x)] += 1
... | the_stack_v2_python_sparse | Problems/0400_0499/0438_Find_All_Anagrams_in_a_String/Project_Python3/Find_All_Anagrams_in_a_String.py | NobuyukiInoue/LeetCode | train | 0 | |
b5343630cc6fab3f7710a3209f3f9736ea9892e0 | [
"super(XLSWriter, self).__init__(filename)\nif not xlwt:\n print('**********************************************************')\n print('You need to install \"xlwt\" first to export xls files!')\n print('You can use \"pip install xlwt\" to install it! ')\n print('*****************************... | <|body_start_0|>
super(XLSWriter, self).__init__(filename)
if not xlwt:
print('**********************************************************')
print('You need to install "xlwt" first to export xls files!')
print('You can use "pip install xlwt" to install it! ... | XLS/XLSX file's writer. IT HAS PROBLEMS ON WINDOWS! | XLSWriter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XLSWriter:
"""XLS/XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!"""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: b... | stack_v2_sparse_classes_36k_train_013321 | 6,679 | permissive | [
{
"docstring": "Args: filename: (String) data file's name. Returns: None",
"name": "__init__",
"signature": "def __init__(self, filename=None)"
},
{
"docstring": "Write data line. Args: line: (List) Line data. Returns: boolean: Write success.",
"name": "writeln",
"signature": "def writel... | 3 | null | Implement the Python class `XLSWriter` described below.
Class description:
XLS/XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) ... | Implement the Python class `XLSWriter` described below.
Class description:
XLS/XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) ... | 5fa06b29bf800646dc4da5851fdf7a1f299f15a7 | <|skeleton|>
class XLSWriter:
"""XLS/XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!"""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XLSWriter:
"""XLS/XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!"""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
super(XLSWriter, self).__init__(filename)
if not xlwt:
print('****************************************... | the_stack_v2_python_sparse | muddery/common/utils/writers.py | muddery/muddery | train | 139 |
eb44c1ec7ec3ec3ce12ada33067c0aa4f7c85b94 | [
"if not end_date:\n end_date = arrow.now().format('YYYYMMDD')\nif not start_date:\n start_date = arrow.now().shift(days=-7).format('YYYYMMDD')\nprint(exchange, symbol, freq, start_date, end_date)\ndf = tushare_pro.coinbar(exchange=exchange, symbol=symbol, freq=freq, start_date=start_date, end_date=end_date)\n... | <|body_start_0|>
if not end_date:
end_date = arrow.now().format('YYYYMMDD')
if not start_date:
start_date = arrow.now().shift(days=-7).format('YYYYMMDD')
print(exchange, symbol, freq, start_date, end_date)
df = tushare_pro.coinbar(exchange=exchange, symbol=symbol,... | TushareClient | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TushareClient:
def kline(self, exchange, symbol, freq, start_date=None, end_date=None):
"""获取数字货币行情数据,目前支持币币交易和期货合约交易。如果是币币交易,exchange参数请输入huobi,okex,binance,bitfinex等。如果是期货,exchange参数请输入future_xxx,比如future_okex,future_bitmex。 :param exchange: :param symbol: :param freq: :param start_dat... | stack_v2_sparse_classes_36k_train_013322 | 4,022 | permissive | [
{
"docstring": "获取数字货币行情数据,目前支持币币交易和期货合约交易。如果是币币交易,exchange参数请输入huobi,okex,binance,bitfinex等。如果是期货,exchange参数请输入future_xxx,比如future_okex,future_bitmex。 :param exchange: :param symbol: :param freq: :param start_date: :param end_date: :return:",
"name": "kline",
"signature": "def kline(self, exchange, sym... | 2 | stack_v2_sparse_classes_30k_train_014106 | Implement the Python class `TushareClient` described below.
Class description:
Implement the TushareClient class.
Method signatures and docstrings:
- def kline(self, exchange, symbol, freq, start_date=None, end_date=None): 获取数字货币行情数据,目前支持币币交易和期货合约交易。如果是币币交易,exchange参数请输入huobi,okex,binance,bitfinex等。如果是期货,exchange参数请输... | Implement the Python class `TushareClient` described below.
Class description:
Implement the TushareClient class.
Method signatures and docstrings:
- def kline(self, exchange, symbol, freq, start_date=None, end_date=None): 获取数字货币行情数据,目前支持币币交易和期货合约交易。如果是币币交易,exchange参数请输入huobi,okex,binance,bitfinex等。如果是期货,exchange参数请输... | fa540a99468dc92daaa7671436b693f10209c00e | <|skeleton|>
class TushareClient:
def kline(self, exchange, symbol, freq, start_date=None, end_date=None):
"""获取数字货币行情数据,目前支持币币交易和期货合约交易。如果是币币交易,exchange参数请输入huobi,okex,binance,bitfinex等。如果是期货,exchange参数请输入future_xxx,比如future_okex,future_bitmex。 :param exchange: :param symbol: :param freq: :param start_dat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TushareClient:
def kline(self, exchange, symbol, freq, start_date=None, end_date=None):
"""获取数字货币行情数据,目前支持币币交易和期货合约交易。如果是币币交易,exchange参数请输入huobi,okex,binance,bitfinex等。如果是期货,exchange参数请输入future_xxx,比如future_okex,future_bitmex。 :param exchange: :param symbol: :param freq: :param start_date: :param end_... | the_stack_v2_python_sparse | app/tasks/spider/tushare_spider.py | longniao/pointer_worker | train | 0 | |
e4aa3d1de6915eb0da0a862721dd9f56db2f65d1 | [
"self.timeout = timeout\ntry:\n self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, lts=self.parent.parameters.get('lts', {}), timeout=timeout)\nexcept Exception as e:\n self.errored(\"Section failed due to: '{e}'\".format(e=e))\nfor stp in steps.details:\n if stp.result.name... | <|body_start_0|>
self.timeout = timeout
try:
self.pre_snap = self.mapping.learn_ops(device=uut, abstract=abstract, steps=steps, lts=self.parent.parameters.get('lts', {}), timeout=timeout)
except Exception as e:
self.errored("Section failed due to: '{e}'".format(e=e))
... | Trigger class for UnconfigConfig action | TriggerUnconfigConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriggerUnconfigConfig:
"""Trigger class for UnconfigConfig action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object.... | stack_v2_sparse_classes_36k_train_013323 | 5,764 | permissive | [
{
"docstring": "Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`obj`): Abstract object. steps (`step obj`): aetest step object timeout (`timeout obj`): Timeout Object Returns: None Raises: pyATS Res... | 6 | stack_v2_sparse_classes_30k_train_008181 | Implement the Python class `TriggerUnconfigConfig` described below.
Class description:
Trigger class for UnconfigConfig action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then ski... | Implement the Python class `TriggerUnconfigConfig` described below.
Class description:
Trigger class for UnconfigConfig action
Method signatures and docstrings:
- def verify_prerequisite(self, uut, abstract, steps, timeout): Learn Ops object and verify the requirements. If the requirements are not satisfied, then ski... | e42e51475cddcb10f5c7814d0fe892ac865742ba | <|skeleton|>
class TriggerUnconfigConfig:
"""Trigger class for UnconfigConfig action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TriggerUnconfigConfig:
"""Trigger class for UnconfigConfig action"""
def verify_prerequisite(self, uut, abstract, steps, timeout):
"""Learn Ops object and verify the requirements. If the requirements are not satisfied, then skip to the next testcase. Args: uut (`obj`): Device object. abstract (`o... | the_stack_v2_python_sparse | pkgs/sdk-pkg/src/genie/libs/sdk/triggers/unconfigconfig/unconfigconfig.py | CiscoTestAutomation/genielibs | train | 109 |
55c5973e55454d5964633acfd8b357c427964929 | [
"self.code = code\nself.language = language\nself.tokennames = tokennames\nself.lexer = None\nif language in ('', 'text') or tokennames == 'none':\n return\nif not with_pygments:\n raise LexerError('Cannot analyze code. Pygments package not found.')\ntry:\n self.lexer = get_lexer_by_name(self.language)\nex... | <|body_start_0|>
self.code = code
self.language = language
self.tokennames = tokennames
self.lexer = None
if language in ('', 'text') or tokennames == 'none':
return
if not with_pygments:
raise LexerError('Cannot analyze code. Pygments package not ... | Parse `code` lines and yield "classified" tokens. Arguments code -- string of source code to parse, language -- formal language the code is written in, tokennames -- either 'long', 'short', or '' (see below). Merge subsequent tokens of the same token-type. Iterating over an instance yields the tokens as ``(tokentype, v... | Lexer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lexer:
"""Parse `code` lines and yield "classified" tokens. Arguments code -- string of source code to parse, language -- formal language the code is written in, tokennames -- either 'long', 'short', or '' (see below). Merge subsequent tokens of the same token-type. Iterating over an instance yie... | stack_v2_sparse_classes_36k_train_013324 | 4,872 | permissive | [
{
"docstring": "Set up a lexical analyzer for `code` in `language`.",
"name": "__init__",
"signature": "def __init__(self, code, language, tokennames='short')"
},
{
"docstring": "Merge subsequent tokens of same token-type. Also strip the final newline (added by pygments).",
"name": "merge",
... | 3 | stack_v2_sparse_classes_30k_train_021024 | Implement the Python class `Lexer` described below.
Class description:
Parse `code` lines and yield "classified" tokens. Arguments code -- string of source code to parse, language -- formal language the code is written in, tokennames -- either 'long', 'short', or '' (see below). Merge subsequent tokens of the same tok... | Implement the Python class `Lexer` described below.
Class description:
Parse `code` lines and yield "classified" tokens. Arguments code -- string of source code to parse, language -- formal language the code is written in, tokennames -- either 'long', 'short', or '' (see below). Merge subsequent tokens of the same tok... | 05dbd4575d01a213f3f4d69aa4968473f2536142 | <|skeleton|>
class Lexer:
"""Parse `code` lines and yield "classified" tokens. Arguments code -- string of source code to parse, language -- formal language the code is written in, tokennames -- either 'long', 'short', or '' (see below). Merge subsequent tokens of the same token-type. Iterating over an instance yie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Lexer:
"""Parse `code` lines and yield "classified" tokens. Arguments code -- string of source code to parse, language -- formal language the code is written in, tokennames -- either 'long', 'short', or '' (see below). Merge subsequent tokens of the same token-type. Iterating over an instance yields the token... | the_stack_v2_python_sparse | python/helpers/py2only/docutils/utils/code_analyzer.py | JetBrains/intellij-community | train | 16,288 |
4946060df9f7e5dc7b361b123be906f849bc574c | [
"if isinstance(value, str) and value.replace(' ', '') == '':\n raise InvalidEmptyValue(field_name=field.name)\nreturn value",
"if value.lower() not in [i.lower() for i in cls.case_management_types]:\n raise InvalidEntityType(field_name=field.name, entity_type=str(cls.case_management_types), value=value)\nre... | <|body_start_0|>
if isinstance(value, str) and value.replace(' ', '') == '':
raise InvalidEmptyValue(field_name=field.name)
return value
<|end_body_0|>
<|body_start_1|>
if value.lower() not in [i.lower() for i in cls.case_management_types]:
raise InvalidEntityType(field_... | Case Management Entity Field (Model) Type | CaseManagementEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseManagementEntity:
"""Case Management Entity Field (Model) Type"""
def is_empty(cls, value: str, field: ModelField) -> str:
"""Validate that the value is a non-empty string."""
<|body_0|>
def is_type(cls, value: str, field: ModelField) -> str:
"""Validate that... | stack_v2_sparse_classes_36k_train_013325 | 2,334 | permissive | [
{
"docstring": "Validate that the value is a non-empty string.",
"name": "is_empty",
"signature": "def is_empty(cls, value: str, field: ModelField) -> str"
},
{
"docstring": "Validate that the entity is of Indicator type.",
"name": "is_type",
"signature": "def is_type(cls, value: str, fi... | 2 | stack_v2_sparse_classes_30k_train_011061 | Implement the Python class `CaseManagementEntity` described below.
Class description:
Case Management Entity Field (Model) Type
Method signatures and docstrings:
- def is_empty(cls, value: str, field: ModelField) -> str: Validate that the value is a non-empty string.
- def is_type(cls, value: str, field: ModelField) ... | Implement the Python class `CaseManagementEntity` described below.
Class description:
Case Management Entity Field (Model) Type
Method signatures and docstrings:
- def is_empty(cls, value: str, field: ModelField) -> str: Validate that the value is a non-empty string.
- def is_type(cls, value: str, field: ModelField) ... | 30dc147e40d63d1082ec2a5e6c62005b60c29c37 | <|skeleton|>
class CaseManagementEntity:
"""Case Management Entity Field (Model) Type"""
def is_empty(cls, value: str, field: ModelField) -> str:
"""Validate that the value is a non-empty string."""
<|body_0|>
def is_type(cls, value: str, field: ModelField) -> str:
"""Validate that... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaseManagementEntity:
"""Case Management Entity Field (Model) Type"""
def is_empty(cls, value: str, field: ModelField) -> str:
"""Validate that the value is a non-empty string."""
if isinstance(value, str) and value.replace(' ', '') == '':
raise InvalidEmptyValue(field_name=fi... | the_stack_v2_python_sparse | tcex/input/field_type/case_management_entity.py | ThreatConnect-Inc/tcex | train | 24 |
d7ae70453d3685cda8851dfbce5caa27481f95b4 | [
"self.is_vapp = is_vapp\nself.is_vapp_template = is_vapp_template\nself.restored_vapp_info = restored_vapp_info\nself.restored_vapp_object = restored_vapp_object\nself.restored_vapp_template_info = restored_vapp_template_info\nself.restored_vapp_template_object = restored_vapp_template_object\nself.vapp_entity = va... | <|body_start_0|>
self.is_vapp = is_vapp
self.is_vapp_template = is_vapp_template
self.restored_vapp_info = restored_vapp_info
self.restored_vapp_object = restored_vapp_object
self.restored_vapp_template_info = restored_vapp_template_info
self.restored_vapp_template_object... | Implementation of the 'RestoredObjectVCDConfigProto' model. TODO: type description here. Attributes: is_vapp (bool): Whether the restored object is a VApp. is_vapp_template (bool): Whether the restored object is a VApp template. restored_vapp_info (EntityProto): Entity info enabled only when is_vapp is true. This proto... | RestoredObjectVCDConfigProto | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoredObjectVCDConfigProto:
"""Implementation of the 'RestoredObjectVCDConfigProto' model. TODO: type description here. Attributes: is_vapp (bool): Whether the restored object is a VApp. is_vapp_template (bool): Whether the restored object is a VApp template. restored_vapp_info (EntityProto): E... | stack_v2_sparse_classes_36k_train_013326 | 5,645 | permissive | [
{
"docstring": "Constructor for the RestoredObjectVCDConfigProto class",
"name": "__init__",
"signature": "def __init__(self, is_vapp=None, is_vapp_template=None, restored_vapp_info=None, restored_vapp_object=None, restored_vapp_template_info=None, restored_vapp_template_object=None, vapp_entity=None, v... | 2 | null | Implement the Python class `RestoredObjectVCDConfigProto` described below.
Class description:
Implementation of the 'RestoredObjectVCDConfigProto' model. TODO: type description here. Attributes: is_vapp (bool): Whether the restored object is a VApp. is_vapp_template (bool): Whether the restored object is a VApp templa... | Implement the Python class `RestoredObjectVCDConfigProto` described below.
Class description:
Implementation of the 'RestoredObjectVCDConfigProto' model. TODO: type description here. Attributes: is_vapp (bool): Whether the restored object is a VApp. is_vapp_template (bool): Whether the restored object is a VApp templa... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoredObjectVCDConfigProto:
"""Implementation of the 'RestoredObjectVCDConfigProto' model. TODO: type description here. Attributes: is_vapp (bool): Whether the restored object is a VApp. is_vapp_template (bool): Whether the restored object is a VApp template. restored_vapp_info (EntityProto): E... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestoredObjectVCDConfigProto:
"""Implementation of the 'RestoredObjectVCDConfigProto' model. TODO: type description here. Attributes: is_vapp (bool): Whether the restored object is a VApp. is_vapp_template (bool): Whether the restored object is a VApp template. restored_vapp_info (EntityProto): Entity info en... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restored_object_vcd_config_proto.py | cohesity/management-sdk-python | train | 24 |
07c40ebdfa980644c00d58e3702a0c330d417d7e | [
"params = dict(name='foo', kind=['english'])\nform = TeaSearchForm(params)\nself.assertEqual(form.is_valid(), True, form.errors.as_text())",
"params = dict()\nform = TeaSearchForm(params)\nself.assertEqual(form.is_valid(), False, form.errors.as_text())",
"params = dict(name='foo')\nform = TeaSearchForm(params)\... | <|body_start_0|>
params = dict(name='foo', kind=['english'])
form = TeaSearchForm(params)
self.assertEqual(form.is_valid(), True, form.errors.as_text())
<|end_body_0|>
<|body_start_1|>
params = dict()
form = TeaSearchForm(params)
self.assertEqual(form.is_valid(), False, ... | TeaSearchFormTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeaSearchFormTest:
def test_valid(self):
"""检查输入正常时是否会报错"""
<|body_0|>
def test_either1(self):
"""检查名称和种类都无输入时是否会报错"""
<|body_1|>
def test_either2(self):
"""检查输入名称后是否会报错"""
<|body_2|>
def test_either3(self):
"""检查输入种类后是否会报错""... | stack_v2_sparse_classes_36k_train_013327 | 1,779 | no_license | [
{
"docstring": "检查输入正常时是否会报错",
"name": "test_valid",
"signature": "def test_valid(self)"
},
{
"docstring": "检查名称和种类都无输入时是否会报错",
"name": "test_either1",
"signature": "def test_either1(self)"
},
{
"docstring": "检查输入名称后是否会报错",
"name": "test_either2",
"signature": "def test_e... | 4 | null | Implement the Python class `TeaSearchFormTest` described below.
Class description:
Implement the TeaSearchFormTest class.
Method signatures and docstrings:
- def test_valid(self): 检查输入正常时是否会报错
- def test_either1(self): 检查名称和种类都无输入时是否会报错
- def test_either2(self): 检查输入名称后是否会报错
- def test_either3(self): 检查输入种类后是否会报错 | Implement the Python class `TeaSearchFormTest` described below.
Class description:
Implement the TeaSearchFormTest class.
Method signatures and docstrings:
- def test_valid(self): 检查输入正常时是否会报错
- def test_either1(self): 检查名称和种类都无输入时是否会报错
- def test_either2(self): 检查输入名称后是否会报错
- def test_either3(self): 检查输入种类后是否会报错
<|... | 7bf061c0de4521601b91a85a3691dd47bd466d5c | <|skeleton|>
class TeaSearchFormTest:
def test_valid(self):
"""检查输入正常时是否会报错"""
<|body_0|>
def test_either1(self):
"""检查名称和种类都无输入时是否会报错"""
<|body_1|>
def test_either2(self):
"""检查输入名称后是否会报错"""
<|body_2|>
def test_either3(self):
"""检查输入种类后是否会报错""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeaSearchFormTest:
def test_valid(self):
"""检查输入正常时是否会报错"""
params = dict(name='foo', kind=['english'])
form = TeaSearchForm(params)
self.assertEqual(form.is_valid(), True, form.errors.as_text())
def test_either1(self):
"""检查名称和种类都无输入时是否会报错"""
params = dict... | the_stack_v2_python_sparse | src_code/10.用Jenkins持续集成/LIST10.08_cafe_apps_menu_tests.py | caiyunze/web | train | 0 | |
60f15938ee746e3bf51bd0b0396f88c673e81d9e | [
"if not nums:\n return 0\nnums.sort(reverse=True)\nprint(nums)\ncnt = 1\nfor i in range(len(nums) - 1):\n print('ssss')\n print(nums[i])\n if nums[i] > nums[i + 1]:\n cnt += 1\n print('aaaa')\n print(nums[i])\n if cnt == 3:\n print('bbbbb')\n print(nums[i + 1])\n ... | <|body_start_0|>
if not nums:
return 0
nums.sort(reverse=True)
print(nums)
cnt = 1
for i in range(len(nums) - 1):
print('ssss')
print(nums[i])
if nums[i] > nums[i + 1]:
cnt += 1
print('aaaa')
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return 0
nums.sor... | stack_v2_sparse_classes_36k_train_013328 | 1,804 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax",
"signature": "def thirdMax(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax2",
"signature": "def thirdMax2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def thirdMax(self, nums): :type nums: List[int] :rtype: int
- def thirdMax2(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 thirdMax(self, nums): :type nums: List[int] :rtype: int
- def thirdMax2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def thirdMax(self, n... | f022677c042db3598003df1a320a70f0edc4f870 | <|skeleton|>
class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return 0
nums.sort(reverse=True)
print(nums)
cnt = 1
for i in range(len(nums) - 1):
print('ssss')
print(nums[i])
if nums[i] >... | the_stack_v2_python_sparse | ArrayDeal/disandadeshu.py | daisyzl/program-exercise-python | train | 0 | |
ab138fde2857cb53d0dd8b9c5e3d0dc61b3681da | [
"super().__init__(parent, QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinMaxButtonsHint | QtCore.Qt.WindowCloseButtonHint)\nself.horzLayout = QHBoxLayout()\nself.vertLayout = QVBoxLayout()\nself.spacer = QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Fixed)\nself.btnPrint = QPushButton(self)\nself.btnPrint.se... | <|body_start_0|>
super().__init__(parent, QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinMaxButtonsHint | QtCore.Qt.WindowCloseButtonHint)
self.horzLayout = QHBoxLayout()
self.vertLayout = QVBoxLayout()
self.spacer = QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Fixed)
sel... | Generate a more complex HTML Viewer dialog window, with Prin/Close Buttons | HtmlDialog | [
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HtmlDialog:
"""Generate a more complex HTML Viewer dialog window, with Prin/Close Buttons"""
def __init__(self, parent=None):
"""Constructor of HtmlDialog :param parent: dialog parent :return:"""
<|body_0|>
def showHtml(self, html):
"""Show rendered value of ``ht... | stack_v2_sparse_classes_36k_train_013329 | 29,282 | permissive | [
{
"docstring": "Constructor of HtmlDialog :param parent: dialog parent :return:",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "Show rendered value of ``html`` :param html: raw html data",
"name": "showHtml",
"signature": "def showHtml(self, html)"... | 2 | stack_v2_sparse_classes_30k_train_011923 | Implement the Python class `HtmlDialog` described below.
Class description:
Generate a more complex HTML Viewer dialog window, with Prin/Close Buttons
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor of HtmlDialog :param parent: dialog parent :return:
- def showHtml(self, html): Show r... | Implement the Python class `HtmlDialog` described below.
Class description:
Generate a more complex HTML Viewer dialog window, with Prin/Close Buttons
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor of HtmlDialog :param parent: dialog parent :return:
- def showHtml(self, html): Show r... | f6c86cc95218216cbd0f548b508d0c5fde11520e | <|skeleton|>
class HtmlDialog:
"""Generate a more complex HTML Viewer dialog window, with Prin/Close Buttons"""
def __init__(self, parent=None):
"""Constructor of HtmlDialog :param parent: dialog parent :return:"""
<|body_0|>
def showHtml(self, html):
"""Show rendered value of ``ht... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HtmlDialog:
"""Generate a more complex HTML Viewer dialog window, with Prin/Close Buttons"""
def __init__(self, parent=None):
"""Constructor of HtmlDialog :param parent: dialog parent :return:"""
super().__init__(parent, QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinMaxButtonsHint | QtCo... | the_stack_v2_python_sparse | oPB/gui/utilities.py | pandel/opsiPackageBuilder | train | 10 |
092ec24d96a916b92a96ee0b82d40d4d169574e4 | [
"super(AdaIN, self).__init__()\nself.net_type = net_type\nself.norm_type = norm_type\nself.resize_type = resize_type\nif self.norm_type == 'batch':\n self.norm_layer = nn.BatchNorm2d(n_hin_channles, affine=False)\nelif self.norm_type == 'instance':\n self.norm_layer = nn.InstanceNorm2d(n_hin_channles, affine=... | <|body_start_0|>
super(AdaIN, self).__init__()
self.net_type = net_type
self.norm_type = norm_type
self.resize_type = resize_type
if self.norm_type == 'batch':
self.norm_layer = nn.BatchNorm2d(n_hin_channles, affine=False)
elif self.norm_type == 'instance':
... | AdaIN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaIN:
def __init__(self, n_hin_channles, n_in_channles, net_type='conv', norm_type='batch', resize_type='nearest'):
"""[args] resize_type : ネットワーク外部から入力するデータ(セグメンテーション画像など)のサイズを、前段のネットワークからの活性化入力のサイズにリサイズして合わせるときのリサイズ手法 'nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area... | stack_v2_sparse_classes_36k_train_013330 | 5,381 | no_license | [
{
"docstring": "[args] resize_type : ネットワーク外部から入力するデータ(セグメンテーション画像など)のサイズを、前段のネットワークからの活性化入力のサイズにリサイズして合わせるときのリサイズ手法 'nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area'",
"name": "__init__",
"signature": "def __init__(self, n_hin_channles, n_in_channles, net_type='conv', norm_type='batc... | 2 | stack_v2_sparse_classes_30k_train_020034 | Implement the Python class `AdaIN` described below.
Class description:
Implement the AdaIN class.
Method signatures and docstrings:
- def __init__(self, n_hin_channles, n_in_channles, net_type='conv', norm_type='batch', resize_type='nearest'): [args] resize_type : ネットワーク外部から入力するデータ(セグメンテーション画像など)のサイズを、前段のネットワークからの活性化... | Implement the Python class `AdaIN` described below.
Class description:
Implement the AdaIN class.
Method signatures and docstrings:
- def __init__(self, n_hin_channles, n_in_channles, net_type='conv', norm_type='batch', resize_type='nearest'): [args] resize_type : ネットワーク外部から入力するデータ(セグメンテーション画像など)のサイズを、前段のネットワークからの活性化... | 97e1bd1eebc528d8c682a41031c750fa2066a713 | <|skeleton|>
class AdaIN:
def __init__(self, n_hin_channles, n_in_channles, net_type='conv', norm_type='batch', resize_type='nearest'):
"""[args] resize_type : ネットワーク外部から入力するデータ(セグメンテーション画像など)のサイズを、前段のネットワークからの活性化入力のサイズにリサイズして合わせるときのリサイズ手法 'nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdaIN:
def __init__(self, n_hin_channles, n_in_channles, net_type='conv', norm_type='batch', resize_type='nearest'):
"""[args] resize_type : ネットワーク外部から入力するデータ(セグメンテーション画像など)のサイズを、前段のネットワークからの活性化入力のサイズにリサイズして合わせるときのリサイズ手法 'nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area'"""
s... | the_stack_v2_python_sparse | _in_progress/GAN_Pix2PixStyleGAN/models/adain.py | Yagami360/MachineLearning_Exercises_Python_PyTorch | train | 18 | |
ecc3be5a2b181f74b4e1fe0bdcb3588478a0684f | [
"if isinstance(waitkeyval, tuple):\n waitkeyval = waitkeyval[0]\nif is_raw:\n i = waitkeyval & 255\nreturn KeyBoardInput._key_dic[i]",
"if isinstance(waitkeyval, (tuple, dict, set)):\n for x in waitkeyval:\n if isinstance(waitkeyval, int):\n waitkeyval = x\n break\nspecial = ... | <|body_start_0|>
if isinstance(waitkeyval, tuple):
waitkeyval = waitkeyval[0]
if is_raw:
i = waitkeyval & 255
return KeyBoardInput._key_dic[i]
<|end_body_0|>
<|body_start_1|>
if isinstance(waitkeyval, (tuple, dict, set)):
for x in waitkeyval:
... | user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none' | KeyBoardInput | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyBoardInput:
"""user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'"""
def get_pressed_key(waitkeyval, is_raw=True):
"""(int, bool) -> s... | stack_v2_sparse_classes_36k_train_013331 | 2,605 | no_license | [
{
"docstring": "(int, bool) -> str Pass in waitkey result, returning the string representation of the key. i: return value of waitkey is_raw: if true, is the raw return value otherwise assumes already converted to the character ord value, e.g. from view.show() Returns: string representation of keypress, also: '... | 2 | stack_v2_sparse_classes_30k_train_019466 | Implement the Python class `KeyBoardInput` described below.
Class description:
user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'
Method signatures and docstrings:
- def g... | Implement the Python class `KeyBoardInput` described below.
Class description:
user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'
Method signatures and docstrings:
- def g... | 9123aa6baf538b662143b9098d963d55165e8409 | <|skeleton|>
class KeyBoardInput:
"""user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'"""
def get_pressed_key(waitkeyval, is_raw=True):
"""(int, bool) -> s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KeyBoardInput:
"""user keyboard input key_dic is a dictionary containing numbers as keys with the ASCII character Also includes the special keys: 'return', 'backspace', 'escape', 'tab', 'space', 'unknowable', 'none'"""
def get_pressed_key(waitkeyval, is_raw=True):
"""(int, bool) -> str Pass in wa... | the_stack_v2_python_sparse | opencvlib/display_utils.py | gmonkman/python | train | 0 |
a839a48fd583e71d450db943eaa81e5fd4a8d85a | [
"l = len(nums)\nfor i in range(1, l + 1):\n dp = [0] * (l + 1)\n dp[i] = nums[i - 1]\n for j in range(i + 1, l + 1):\n dp[j] = dp[j - 1] + nums[j - 1]\n if k != 0 and dp[j] % k == 0 or (k == 0 and dp[j] == 0):\n return True\nreturn False",
"pos = {0: -1}\nrunningSum = 0\nfor i, n... | <|body_start_0|>
l = len(nums)
for i in range(1, l + 1):
dp = [0] * (l + 1)
dp[i] = nums[i - 1]
for j in range(i + 1, l + 1):
dp[j] = dp[j - 1] + nums[j - 1]
if k != 0 and dp[j] % k == 0 or (k == 0 and dp[j] == 0):
r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def checkSubarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool 1345ms"""
<|body_0|>
def checkSubarraySum_2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool 55ms"""
<|body_1|>
def checkSubarraySum_1(sel... | stack_v2_sparse_classes_36k_train_013332 | 2,369 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool 1345ms",
"name": "checkSubarraySum",
"signature": "def checkSubarraySum(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool 55ms",
"name": "checkSubarraySum_2",
"signature": "def checkSubarrayS... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool 1345ms
- def checkSubarraySum_2(self, nums, k): :type nums: List[int] :type k: int :rtype: bo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool 1345ms
- def checkSubarraySum_2(self, nums, k): :type nums: List[int] :type k: int :rtype: bo... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def checkSubarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool 1345ms"""
<|body_0|>
def checkSubarraySum_2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool 55ms"""
<|body_1|>
def checkSubarraySum_1(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def checkSubarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool 1345ms"""
l = len(nums)
for i in range(1, l + 1):
dp = [0] * (l + 1)
dp[i] = nums[i - 1]
for j in range(i + 1, l + 1):
dp[j] = dp[j - 1]... | the_stack_v2_python_sparse | ContinuousSubarraySum_MID_523.py | 953250587/leetcode-python | train | 2 | |
d53a6e409ed327a075f7b840408db29f7f00826f | [
"data = EnvYAML(config)\nself.table_data = [data['table_header']]\nself.max_string_width = data.get('table_column_max_width', 0)\ndefault_args = data.get('default_args', {})\njobs = data['tests'] if runner_index is None or total_runners is None else np.array_split(data['tests'], int(total_runners))[int(runner_index... | <|body_start_0|>
data = EnvYAML(config)
self.table_data = [data['table_header']]
self.max_string_width = data.get('table_column_max_width', 0)
default_args = data.get('default_args', {})
jobs = data['tests'] if runner_index is None or total_runners is None else np.array_split(dat... | Automated Drive Testing. | AutomatedDriveTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutomatedDriveTest:
"""Automated Drive Testing."""
def __init__(self, config: str, runner_index: Optional[int], total_runners: Optional[int]):
"""Load config. Args: config: Path to config."""
<|body_0|>
def execute(self):
"""Execute tests inside self.pipeline."""... | stack_v2_sparse_classes_36k_train_013333 | 5,700 | permissive | [
{
"docstring": "Load config. Args: config: Path to config.",
"name": "__init__",
"signature": "def __init__(self, config: str, runner_index: Optional[int], total_runners: Optional[int])"
},
{
"docstring": "Execute tests inside self.pipeline.",
"name": "execute",
"signature": "def execute... | 4 | null | Implement the Python class `AutomatedDriveTest` described below.
Class description:
Automated Drive Testing.
Method signatures and docstrings:
- def __init__(self, config: str, runner_index: Optional[int], total_runners: Optional[int]): Load config. Args: config: Path to config.
- def execute(self): Execute tests ins... | Implement the Python class `AutomatedDriveTest` described below.
Class description:
Automated Drive Testing.
Method signatures and docstrings:
- def __init__(self, config: str, runner_index: Optional[int], total_runners: Optional[int]): Load config. Args: config: Path to config.
- def execute(self): Execute tests ins... | 8a9438b5a24c288721ae0302889fe55e26046310 | <|skeleton|>
class AutomatedDriveTest:
"""Automated Drive Testing."""
def __init__(self, config: str, runner_index: Optional[int], total_runners: Optional[int]):
"""Load config. Args: config: Path to config."""
<|body_0|>
def execute(self):
"""Execute tests inside self.pipeline."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutomatedDriveTest:
"""Automated Drive Testing."""
def __init__(self, config: str, runner_index: Optional[int], total_runners: Optional[int]):
"""Load config. Args: config: Path to config."""
data = EnvYAML(config)
self.table_data = [data['table_header']]
self.max_string_w... | the_stack_v2_python_sparse | simulation/utils/drive_test/run.py | KITcar-Team/kitcar-gazebo-simulation | train | 19 |
73e8babfd5e0e672e15a5b6968724ece0cf6a44c | [
"answer = get_object_or_404(Answer, pk=pk)\nuser = request.user\nanswer.Answervoters.remove(user)\nanswer.save()\nserializer_context = {'request': request}\nserializer = self.serializer_class(answer, context=serializer_context)\nreturn Response(serializer.data, status=status.HTTP_200_OK)",
"answer = get_object_or... | <|body_start_0|>
answer = get_object_or_404(Answer, pk=pk)
user = request.user
answer.Answervoters.remove(user)
answer.save()
serializer_context = {'request': request}
serializer = self.serializer_class(answer, context=serializer_context)
return Response(serialize... | Allow users to add/remove a like to/from an answer instance. | AnswerLikeAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnswerLikeAPIView:
"""Allow users to add/remove a like to/from an answer instance."""
def delete(self, request, pk):
"""Remove request.user from the voters queryset of an answer instance."""
<|body_0|>
def post(self, request, pk):
"""Add request.user to the voter... | stack_v2_sparse_classes_36k_train_013334 | 10,756 | no_license | [
{
"docstring": "Remove request.user from the voters queryset of an answer instance.",
"name": "delete",
"signature": "def delete(self, request, pk)"
},
{
"docstring": "Add request.user to the voters queryset of an answer instance.",
"name": "post",
"signature": "def post(self, request, p... | 2 | stack_v2_sparse_classes_30k_train_011776 | Implement the Python class `AnswerLikeAPIView` described below.
Class description:
Allow users to add/remove a like to/from an answer instance.
Method signatures and docstrings:
- def delete(self, request, pk): Remove request.user from the voters queryset of an answer instance.
- def post(self, request, pk): Add requ... | Implement the Python class `AnswerLikeAPIView` described below.
Class description:
Allow users to add/remove a like to/from an answer instance.
Method signatures and docstrings:
- def delete(self, request, pk): Remove request.user from the voters queryset of an answer instance.
- def post(self, request, pk): Add requ... | e74237fd26226afa108d981c95e962c72ab4b11a | <|skeleton|>
class AnswerLikeAPIView:
"""Allow users to add/remove a like to/from an answer instance."""
def delete(self, request, pk):
"""Remove request.user from the voters queryset of an answer instance."""
<|body_0|>
def post(self, request, pk):
"""Add request.user to the voter... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnswerLikeAPIView:
"""Allow users to add/remove a like to/from an answer instance."""
def delete(self, request, pk):
"""Remove request.user from the voters queryset of an answer instance."""
answer = get_object_or_404(Answer, pk=pk)
user = request.user
answer.Answervoters.... | the_stack_v2_python_sparse | battlesoccer/app/api/views.py | battlesocce/tournament | train | 0 |
dc0f09381a6c4fb413c2319abfc1603a3d187cbd | [
"try:\n raise RuntimeError('Hello World!')\nexcept Exception:\n self.exc_info = sys.exc_info()",
"exc_class, exc, tb = self.exc_info\ncurrent_msg = str(exc) if exc else str(exc_class)\nnew_exc = exc_class('Re-raised exception: ' + current_msg)\nraise exc_class(new_exc).with_traceback(tb)"
] | <|body_start_0|>
try:
raise RuntimeError('Hello World!')
except Exception:
self.exc_info = sys.exc_info()
<|end_body_0|>
<|body_start_1|>
exc_class, exc, tb = self.exc_info
current_msg = str(exc) if exc else str(exc_class)
new_exc = exc_class('Re-raised e... | Raise an exception, hold it and then re-raise it with original stack trace and a modified modify the message. Kudos: http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html http://blog.ianbicking.org/2007/09/12/re-raising-exceptions/ | ExceptionHolder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExceptionHolder:
"""Raise an exception, hold it and then re-raise it with original stack trace and a modified modify the message. Kudos: http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html http://blog.ianbicking.org/2007/09/12/re-raising-exceptions/"""
def part_one(self... | stack_v2_sparse_classes_36k_train_013335 | 1,071 | no_license | [
{
"docstring": "Create exception but hold it.",
"name": "part_one",
"signature": "def part_one(self)"
},
{
"docstring": "Throw exeception generated in part_one with modified message. This exception will seem to come from part_one().",
"name": "part_two",
"signature": "def part_two(self)"... | 2 | stack_v2_sparse_classes_30k_train_006125 | Implement the Python class `ExceptionHolder` described below.
Class description:
Raise an exception, hold it and then re-raise it with original stack trace and a modified modify the message. Kudos: http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html http://blog.ianbicking.org/2007/09/12/re-raisin... | Implement the Python class `ExceptionHolder` described below.
Class description:
Raise an exception, hold it and then re-raise it with original stack trace and a modified modify the message. Kudos: http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html http://blog.ianbicking.org/2007/09/12/re-raisin... | 5e47e93c32bc85f986f39b1d4df8a384c7ff0019 | <|skeleton|>
class ExceptionHolder:
"""Raise an exception, hold it and then re-raise it with original stack trace and a modified modify the message. Kudos: http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html http://blog.ianbicking.org/2007/09/12/re-raising-exceptions/"""
def part_one(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExceptionHolder:
"""Raise an exception, hold it and then re-raise it with original stack trace and a modified modify the message. Kudos: http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html http://blog.ianbicking.org/2007/09/12/re-raising-exceptions/"""
def part_one(self):
""... | the_stack_v2_python_sparse | python/exception-reraise.py | von/sandbox | train | 4 |
685281629eb6673ee0b8ba06465013da2ad2cf39 | [
"serial = []\n\ndef preorder(node):\n if not node:\n return\n serial.append(str(node.val))\n for child in node.children:\n preorder(child)\n serial.append('#')\npreorder(root)\nreturn ' '.join(serial)",
"def dfs(node):\n if not tokens:\n return\n while tokens[0] != '#':\n ... | <|body_start_0|>
serial = []
def preorder(node):
if not node:
return
serial.append(str(node.val))
for child in node.children:
preorder(child)
serial.append('#')
preorder(root)
return ' '.join(serial)
<|end_b... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_013336 | 3,581 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: 'Node') -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def des... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | 3dc5af2bc870fcc8f2142130fcd2b7cab8733151 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
serial = []
def preorder(node):
if not node:
return
serial.append(str(node.val))
for child in node.children:
... | the_stack_v2_python_sparse | 428.serialize-and-deserialize-n-ary-tree.py | chenxu0602/LeetCode | train | 2 | |
2a42408a9f0c620dae21f734afb18473c9649188 | [
"from yepes.model_mixins import Displayable\nif user is not None and user.is_staff:\n return self.all()\nif not date:\n date = timezone.now()\nreturn self.filter(Q(publish_status=Displayable.PUBLISHED), Q(publish_from=None) | Q(publish_from__lte=date), Q(publish_to=None) | Q(publish_to__gte=date))",
"from y... | <|body_start_0|>
from yepes.model_mixins import Displayable
if user is not None and user.is_staff:
return self.all()
if not date:
date = timezone.now()
return self.filter(Q(publish_status=Displayable.PUBLISHED), Q(publish_from=None) | Q(publish_from__lte=date), Q(... | QuerySet providing main search functionality for ``PublishableManager``. | PublishableQuerySet | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublishableQuerySet:
"""QuerySet providing main search functionality for ``PublishableManager``."""
def published(self, user=None, date=None):
"""Returns items with a published status and whose publication dates fall before and after the current date when specified."""
<|body... | stack_v2_sparse_classes_36k_train_013337 | 2,108 | permissive | [
{
"docstring": "Returns items with a published status and whose publication dates fall before and after the current date when specified.",
"name": "published",
"signature": "def published(self, user=None, date=None)"
},
{
"docstring": "Returns items with published status but whose publication da... | 2 | null | Implement the Python class `PublishableQuerySet` described below.
Class description:
QuerySet providing main search functionality for ``PublishableManager``.
Method signatures and docstrings:
- def published(self, user=None, date=None): Returns items with a published status and whose publication dates fall before and... | Implement the Python class `PublishableQuerySet` described below.
Class description:
QuerySet providing main search functionality for ``PublishableManager``.
Method signatures and docstrings:
- def published(self, user=None, date=None): Returns items with a published status and whose publication dates fall before and... | 1ef9a42d4eaa70d9b3e6e7fa519396c1e1174fcb | <|skeleton|>
class PublishableQuerySet:
"""QuerySet providing main search functionality for ``PublishableManager``."""
def published(self, user=None, date=None):
"""Returns items with a published status and whose publication dates fall before and after the current date when specified."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PublishableQuerySet:
"""QuerySet providing main search functionality for ``PublishableManager``."""
def published(self, user=None, date=None):
"""Returns items with a published status and whose publication dates fall before and after the current date when specified."""
from yepes.model_mi... | the_stack_v2_python_sparse | yepes/managers/publishable.py | samuelmaudo/yepes | train | 0 |
446f93db141f6f425732417fb84e211bbd69465d | [
"super().__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",
"seq_len =... | <|body_start_0|>
super().__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(input_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, self.dm)
self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]
se... | Encoder class | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Encoder class"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""* N - the number of blocks in the encoder * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer... | stack_v2_sparse_classes_36k_train_013338 | 18,002 | no_license | [
{
"docstring": "* N - the number of blocks in the encoder * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * input_vocab - the size of the input vocabulary * max_seq_len - the maximum sequence length possible * drop_rate - the dr... | 2 | stack_v2_sparse_classes_30k_train_008183 | Implement the Python class `Encoder` described below.
Class description:
Encoder class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): * N - the number of blocks in the encoder * dm - the dimensionality of the model * h - the number of heads * hidden ... | Implement the Python class `Encoder` described below.
Class description:
Encoder class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): * N - the number of blocks in the encoder * dm - the dimensionality of the model * h - the number of heads * hidden ... | 8ad4c2594ff78b345dbd92e9d54d2a143ac4071a | <|skeleton|>
class Encoder:
"""Encoder class"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""* N - the number of blocks in the encoder * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Encoder:
"""Encoder class"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""* N - the number of blocks in the encoder * dm - the dimensionality of the model * h - the number of heads * hidden - the number of hidden units in the fully connected layer * input_voca... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/5-transformer.py | jorgezafra94/holbertonschool-machine_learning | train | 1 |
903dc3be6baff25d78f1b672056b53fee8a1859c | [
"self.controller_expand_secret_ref = controller_expand_secret_ref\nself.controller_publish_secret_ref = controller_publish_secret_ref\nself.driver = driver\nself.fs_type = fs_type\nself.node_publish_secret_ref = node_publish_secret_ref\nself.node_stage_secret_ref = node_stage_secret_ref\nself.read_only = read_only\... | <|body_start_0|>
self.controller_expand_secret_ref = controller_expand_secret_ref
self.controller_publish_secret_ref = controller_publish_secret_ref
self.driver = driver
self.fs_type = fs_type
self.node_publish_secret_ref = node_publish_secret_ref
self.node_stage_secret_r... | Implementation of the 'PodInfo_PodSpec_VolumeInfo_CSI' model. TODO: type description here. Attributes: controller_expand_secret_ref (ObjectReference): TODO: Type description here. controller_publish_secret_ref (ObjectReference): TODO: Type description here. driver (string): TODO: Type description here. fs_type (string)... | PodInfo_PodSpec_VolumeInfo_CSI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PodInfo_PodSpec_VolumeInfo_CSI:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_CSI' model. TODO: type description here. Attributes: controller_expand_secret_ref (ObjectReference): TODO: Type description here. controller_publish_secret_ref (ObjectReference): TODO: Type description here. driv... | stack_v2_sparse_classes_36k_train_013339 | 4,968 | permissive | [
{
"docstring": "Constructor for the PodInfo_PodSpec_VolumeInfo_CSI class",
"name": "__init__",
"signature": "def __init__(self, controller_expand_secret_ref=None, controller_publish_secret_ref=None, driver=None, fs_type=None, node_publish_secret_ref=None, node_stage_secret_ref=None, read_only=None, volu... | 2 | null | Implement the Python class `PodInfo_PodSpec_VolumeInfo_CSI` described below.
Class description:
Implementation of the 'PodInfo_PodSpec_VolumeInfo_CSI' model. TODO: type description here. Attributes: controller_expand_secret_ref (ObjectReference): TODO: Type description here. controller_publish_secret_ref (ObjectRefere... | Implement the Python class `PodInfo_PodSpec_VolumeInfo_CSI` described below.
Class description:
Implementation of the 'PodInfo_PodSpec_VolumeInfo_CSI' model. TODO: type description here. Attributes: controller_expand_secret_ref (ObjectReference): TODO: Type description here. controller_publish_secret_ref (ObjectRefere... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PodInfo_PodSpec_VolumeInfo_CSI:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_CSI' model. TODO: type description here. Attributes: controller_expand_secret_ref (ObjectReference): TODO: Type description here. controller_publish_secret_ref (ObjectReference): TODO: Type description here. driv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PodInfo_PodSpec_VolumeInfo_CSI:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_CSI' model. TODO: type description here. Attributes: controller_expand_secret_ref (ObjectReference): TODO: Type description here. controller_publish_secret_ref (ObjectReference): TODO: Type description here. driver (string): ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/pod_info_pod_spec_volume_info_csi.py | cohesity/management-sdk-python | train | 24 |
721f5103c1655047d540ba300cc84c872ff6b6eb | [
"ret = 0\nfor ch in s:\n ret = ret ^ ord(ch)\nfor ch in t:\n ret = ret ^ ord(ch)\nreturn chr(ret)",
"small_letters = map(chr, range(ord('a'), ord('z') + 1))\ns_dict = {}\nt_dict = {}\nfor ch in small_letters:\n s_dict[ch] = 0\n t_dict[ch] = 0\nfor ch in s:\n s_dict[ch] += 1\nfor ch in t:\n t_dic... | <|body_start_0|>
ret = 0
for ch in s:
ret = ret ^ ord(ch)
for ch in t:
ret = ret ^ ord(ch)
return chr(ret)
<|end_body_0|>
<|body_start_1|>
small_letters = map(chr, range(ord('a'), ord('z') + 1))
s_dict = {}
t_dict = {}
for ch in sm... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def findTheDifference1(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ret = 0
for ch i... | stack_v2_sparse_classes_36k_train_013340 | 2,401 | permissive | [
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "findTheDifference",
"signature": "def findTheDifference(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "findTheDifference1",
"signature": "def findTheDifference1(self, s, t)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010952 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference1(self, s, t): :type s: str :type t: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTheDifference(self, s, t): :type s: str :type t: str :rtype: str
- def findTheDifference1(self, s, t): :type s: str :type t: str :rtype: str
<|skeleton|>
class Solution:... | 05420b73d28220681cd7be8253bebcaa83966954 | <|skeleton|>
class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def findTheDifference1(self, s, t):
""":type s: str :type t: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findTheDifference(self, s, t):
""":type s: str :type t: str :rtype: str"""
ret = 0
for ch in s:
ret = ret ^ ord(ch)
for ch in t:
ret = ret ^ ord(ch)
return chr(ret)
def findTheDifference1(self, s, t):
""":type s: str :t... | the_stack_v2_python_sparse | add-digits/test.py | optionalg/challenges-leetcode-interesting | train | 0 | |
69a7db37f552a29e804b6bdf8cd3878c590c8602 | [
"_LOGGER.debug('Enable charging: %s', self.name)\nawait self.tesla_device.start_charge()\nself.async_write_ha_state()",
"_LOGGER.debug('Disable charging for: %s', self.name)\nawait self.tesla_device.stop_charge()\nself.async_write_ha_state()",
"if self.tesla_device.is_charging() is None:\n return None\nretur... | <|body_start_0|>
_LOGGER.debug('Enable charging: %s', self.name)
await self.tesla_device.start_charge()
self.async_write_ha_state()
<|end_body_0|>
<|body_start_1|>
_LOGGER.debug('Disable charging for: %s', self.name)
await self.tesla_device.stop_charge()
self.async_write... | Representation of a Tesla charger switch. | ChargerSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChargerSwitch:
"""Representation of a Tesla charger switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
""... | stack_v2_sparse_classes_36k_train_013341 | 4,636 | permissive | [
{
"docstring": "Send the on command.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self, **kwargs)"
},
{
"docstring": "Send the off command.",
"name": "async_turn_off",
"signature": "async def async_turn_off(self, **kwargs)"
},
{
"docstring": "Get whether the s... | 3 | stack_v2_sparse_classes_30k_train_005993 | Implement the Python class `ChargerSwitch` described below.
Class description:
Representation of a Tesla charger switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get whether th... | Implement the Python class `ChargerSwitch` described below.
Class description:
Representation of a Tesla charger switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get whether th... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class ChargerSwitch:
"""Representation of a Tesla charger switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChargerSwitch:
"""Representation of a Tesla charger switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
_LOGGER.debug('Enable charging: %s', self.name)
await self.tesla_device.start_charge()
self.async_write_ha_state()
async def async_turn_o... | the_stack_v2_python_sparse | homeassistant/components/tesla/switch.py | BenWoodford/home-assistant | train | 11 |
5ea2047789668d67d72b87721a5e378e96a104db | [
"self.min = np.array([0.0, 0.0])\nself.value = 0.0\nself.domain = np.array([[-65.536, 65.536], [-65.536, 65.536]])\nself.n = 2\nself.smooth = True\nself.info = [True, False, False]\nself.latex_name = 'Rotated Hyper-Ellipsoid Function'\nself.latex_type = 'Bowl-Shaped'\nself.latex_cost = '\\\\[ f(\\\\mathbf{x}) = \\\... | <|body_start_0|>
self.min = np.array([0.0, 0.0])
self.value = 0.0
self.domain = np.array([[-65.536, 65.536], [-65.536, 65.536]])
self.n = 2
self.smooth = True
self.info = [True, False, False]
self.latex_name = 'Rotated Hyper-Ellipsoid Function'
self.latex_... | Rotated Hyper-Ellipsoid Function. | RotatedHyperEllipsoid | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RotatedHyperEllipsoid:
"""Rotated Hyper-Ellipsoid Function."""
def __init__(self):
"""Constructor."""
<|body_0|>
def cost(self, x):
"""Cost function."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.min = np.array([0.0, 0.0])
self.va... | stack_v2_sparse_classes_36k_train_013342 | 1,274 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Cost function.",
"name": "cost",
"signature": "def cost(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011573 | Implement the Python class `RotatedHyperEllipsoid` described below.
Class description:
Rotated Hyper-Ellipsoid Function.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def cost(self, x): Cost function. | Implement the Python class `RotatedHyperEllipsoid` described below.
Class description:
Rotated Hyper-Ellipsoid Function.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def cost(self, x): Cost function.
<|skeleton|>
class RotatedHyperEllipsoid:
"""Rotated Hyper-Ellipsoid Function."""
... | f2a74df3ab01ac35ea8d80569da909ffa1e86af3 | <|skeleton|>
class RotatedHyperEllipsoid:
"""Rotated Hyper-Ellipsoid Function."""
def __init__(self):
"""Constructor."""
<|body_0|>
def cost(self, x):
"""Cost function."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RotatedHyperEllipsoid:
"""Rotated Hyper-Ellipsoid Function."""
def __init__(self):
"""Constructor."""
self.min = np.array([0.0, 0.0])
self.value = 0.0
self.domain = np.array([[-65.536, 65.536], [-65.536, 65.536]])
self.n = 2
self.smooth = True
self.... | the_stack_v2_python_sparse | ctf/functions2d/rotated_hyper_ellipsoid.py | cntaylor/ctf | train | 1 |
7f2726b81b4c4355600e32f91da0b9680e0e9b67 | [
"if not root:\n return False\n\ndef dfs(node, target):\n if not node:\n return False\n target -= node.val\n if not node.left and (not node.right) and (target == 0):\n return True\n return dfs(node.left, target) or dfs(node.right, target)\nreturn dfs(root, target)",
"res, path = ([], [... | <|body_start_0|>
if not root:
return False
def dfs(node, target):
if not node:
return False
target -= node.val
if not node.left and (not node.right) and (target == 0):
return True
return dfs(node.left, target) o... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasPathSum(self, root: TreeNode, target: int) -> bool:
"""路径总和"""
<|body_0|>
def pathSum_1(self, root: TreeNode, target: int) -> List[List[int]]:
"""路径总和Ⅱ"""
<|body_1|>
def pathSum_3(self, root: TreeNode, target: int) -> int:
"""路径总... | stack_v2_sparse_classes_36k_train_013343 | 2,678 | no_license | [
{
"docstring": "路径总和",
"name": "hasPathSum",
"signature": "def hasPathSum(self, root: TreeNode, target: int) -> bool"
},
{
"docstring": "路径总和Ⅱ",
"name": "pathSum_1",
"signature": "def pathSum_1(self, root: TreeNode, target: int) -> List[List[int]]"
},
{
"docstring": "路径总和Ⅲ 在遍历过程中... | 3 | stack_v2_sparse_classes_30k_train_001289 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root: TreeNode, target: int) -> bool: 路径总和
- def pathSum_1(self, root: TreeNode, target: int) -> List[List[int]]: 路径总和Ⅱ
- def pathSum_3(self, root: TreeNode,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root: TreeNode, target: int) -> bool: 路径总和
- def pathSum_1(self, root: TreeNode, target: int) -> List[List[int]]: 路径总和Ⅱ
- def pathSum_3(self, root: TreeNode,... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def hasPathSum(self, root: TreeNode, target: int) -> bool:
"""路径总和"""
<|body_0|>
def pathSum_1(self, root: TreeNode, target: int) -> List[List[int]]:
"""路径总和Ⅱ"""
<|body_1|>
def pathSum_3(self, root: TreeNode, target: int) -> int:
"""路径总... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasPathSum(self, root: TreeNode, target: int) -> bool:
"""路径总和"""
if not root:
return False
def dfs(node, target):
if not node:
return False
target -= node.val
if not node.left and (not node.right) and (targ... | the_stack_v2_python_sparse | algorithm/leetcode/backtracking/18-路径总和.py | lxconfig/UbuntuCode_bak | train | 0 | |
1c119060bd5753267f40d30b62999f42625645af | [
"self.nodes = {}\nfor l_value, energies in self.linear_energies.items():\n assert type(energies) == list\n self.nodes[l_value] = len(set(energies)) - 1\nreturn self.nodes",
"self.linear_energies = linear_energies\nself.nodes = nodes if nodes is not None else self.get_max_nodes()\nself.energy_tol = energy_to... | <|body_start_0|>
self.nodes = {}
for l_value, energies in self.linear_energies.items():
assert type(energies) == list
self.nodes[l_value] = len(set(energies)) - 1
return self.nodes
<|end_body_0|>
<|body_start_1|>
self.linear_energies = linear_energies
sel... | DefaultLOs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultLOs:
def get_max_nodes(self) -> dict:
"""TODO MAYBE ONLY MAKES SENSE COUNTING NODES FOR ENERGIES ABOVE ZERO? Would also be useful to distinguish between valence and conduction states. Get the number of nodes associated with the lo function with max nodes, per l-channel. Nodes appe... | stack_v2_sparse_classes_36k_train_013344 | 22,974 | no_license | [
{
"docstring": "TODO MAYBE ONLY MAKES SENSE COUNTING NODES FOR ENERGIES ABOVE ZERO? Would also be useful to distinguish between valence and conduction states. Get the number of nodes associated with the lo function with max nodes, per l-channel. Nodes appear to be interchangeable with the energy parameters, as ... | 2 | null | Implement the Python class `DefaultLOs` described below.
Class description:
Implement the DefaultLOs class.
Method signatures and docstrings:
- def get_max_nodes(self) -> dict: TODO MAYBE ONLY MAKES SENSE COUNTING NODES FOR ENERGIES ABOVE ZERO? Would also be useful to distinguish between valence and conduction states... | Implement the Python class `DefaultLOs` described below.
Class description:
Implement the DefaultLOs class.
Method signatures and docstrings:
- def get_max_nodes(self) -> dict: TODO MAYBE ONLY MAKES SENSE COUNTING NODES FOR ENERGIES ABOVE ZERO? Would also be useful to distinguish between valence and conduction states... | 40a3c90b9e551b26de2a5f9d57ce83053912cd76 | <|skeleton|>
class DefaultLOs:
def get_max_nodes(self) -> dict:
"""TODO MAYBE ONLY MAKES SENSE COUNTING NODES FOR ENERGIES ABOVE ZERO? Would also be useful to distinguish between valence and conduction states. Get the number of nodes associated with the lo function with max nodes, per l-channel. Nodes appe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefaultLOs:
def get_max_nodes(self) -> dict:
"""TODO MAYBE ONLY MAKES SENSE COUNTING NODES FOR ENERGIES ABOVE ZERO? Would also be useful to distinguish between valence and conduction states. Get the number of nodes associated with the lo function with max nodes, per l-channel. Nodes appear to be inter... | the_stack_v2_python_sparse | exciting/process/optimised_basis.py | AlexBuccheri/python | train | 0 | |
6910c6d218fcb79d896fa7c111c82895a03ebd13 | [
"self.comid = comid\nself.hydroseq = hydroseq\nself.down = down\nself.up = up\nself.drain = drain\nself.area = area\nself.divarea = div\nself.reach = reachcode",
"self.maxelev = maxelev\nself.minelev = minelev\nself.length = length",
"self.flow = flow\nself.velocity = velocity\nself.gageid = gageid",
"ft_per_... | <|body_start_0|>
self.comid = comid
self.hydroseq = hydroseq
self.down = down
self.up = up
self.drain = drain
self.area = area
self.divarea = div
self.reach = reachcode
<|end_body_0|>
<|body_start_1|>
self.maxelev = maxelev
self.minelev = ... | A class to store the attributes of a flowline from the NHDPlus database. | Flowline | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Flowline:
"""A class to store the attributes of a flowline from the NHDPlus database."""
def __init__(self, comid, hydroseq, down, up, drain, area, div, reachcode):
"""Attributes from NHDPlus PlusFlowVAA."""
<|body_0|>
def add_slope(self, maxelev, minelev, length):
... | stack_v2_sparse_classes_36k_train_013345 | 1,290 | permissive | [
{
"docstring": "Attributes from NHDPlus PlusFlowVAA.",
"name": "__init__",
"signature": "def __init__(self, comid, hydroseq, down, up, drain, area, div, reachcode)"
},
{
"docstring": "Attributes from NHDPlus ElevSlope.",
"name": "add_slope",
"signature": "def add_slope(self, maxelev, min... | 4 | stack_v2_sparse_classes_30k_train_003946 | Implement the Python class `Flowline` described below.
Class description:
A class to store the attributes of a flowline from the NHDPlus database.
Method signatures and docstrings:
- def __init__(self, comid, hydroseq, down, up, drain, area, div, reachcode): Attributes from NHDPlus PlusFlowVAA.
- def add_slope(self, ... | Implement the Python class `Flowline` described below.
Class description:
A class to store the attributes of a flowline from the NHDPlus database.
Method signatures and docstrings:
- def __init__(self, comid, hydroseq, down, up, drain, area, div, reachcode): Attributes from NHDPlus PlusFlowVAA.
- def add_slope(self, ... | 248f0193391b5019df28987ef93f35eebb575ee1 | <|skeleton|>
class Flowline:
"""A class to store the attributes of a flowline from the NHDPlus database."""
def __init__(self, comid, hydroseq, down, up, drain, area, div, reachcode):
"""Attributes from NHDPlus PlusFlowVAA."""
<|body_0|>
def add_slope(self, maxelev, minelev, length):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Flowline:
"""A class to store the attributes of a flowline from the NHDPlus database."""
def __init__(self, comid, hydroseq, down, up, drain, area, div, reachcode):
"""Attributes from NHDPlus PlusFlowVAA."""
self.comid = comid
self.hydroseq = hydroseq
self.down = down
... | the_stack_v2_python_sparse | src/pyhspf/preprocessing/flowline.py | xuexianwu/PyHSPF | train | 0 |
a9c397df79e7bb4099eaf8e16e37f19846379faf | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AccessPackageAssignment()",
"from .access_package import AccessPackage\nfrom .access_package_assignment_policy import AccessPackageAssignmentPolicy\nfrom .access_package_assignment_state import AccessPackageAssignmentState\nfrom .acces... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return AccessPackageAssignment()
<|end_body_0|>
<|body_start_1|>
from .access_package import AccessPackage
from .access_package_assignment_policy import AccessPackageAssignmentPolicy
fr... | AccessPackageAssignment | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccessPackageAssignment:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignment:
"""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 creat... | stack_v2_sparse_classes_36k_train_013346 | 6,146 | 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: AccessPackageAssignment",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimin... | 3 | null | Implement the Python class `AccessPackageAssignment` described below.
Class description:
Implement the AccessPackageAssignment class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignment: Creates a new instance of the appropriate clas... | Implement the Python class `AccessPackageAssignment` described below.
Class description:
Implement the AccessPackageAssignment class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignment: Creates a new instance of the appropriate clas... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AccessPackageAssignment:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignment:
"""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 creat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccessPackageAssignment:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AccessPackageAssignment:
"""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... | the_stack_v2_python_sparse | msgraph/generated/models/access_package_assignment.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
58048b9e6835721f5c462c2ee00e00790515184c | [
"app_dir = os.environ['APP_DIR']\napp_module = os.environ['APP_MODULE']\nscript_dir = os.environ['SCRIPT_DIR']\npublic_dir = os.environ['PUBLIC_DIR']\nos.chdir(app_dir)\napp = load_definition_from_string('{0}.app.application'.format(app_module))\nkwargs = {'app': app, 'script_dir': script_dir, 'public_dir': public_... | <|body_start_0|>
app_dir = os.environ['APP_DIR']
app_module = os.environ['APP_MODULE']
script_dir = os.environ['SCRIPT_DIR']
public_dir = os.environ['PUBLIC_DIR']
os.chdir(app_dir)
app = load_definition_from_string('{0}.app.application'.format(app_module))
kwargs ... | Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver | Dev | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dev:
"""Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver"""
def runserver(self, host, port, noreload):
"""Runs the development server for the current application. Args: host: The h... | stack_v2_sparse_classes_36k_train_013347 | 1,834 | permissive | [
{
"docstring": "Runs the development server for the current application. Args: host: The host to bind to port: The port to run on",
"name": "runserver",
"signature": "def runserver(self, host, port, noreload)"
},
{
"docstring": "Run an interactive shell based on the current application. The curr... | 2 | stack_v2_sparse_classes_30k_val_000036 | Implement the Python class `Dev` described below.
Class description:
Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver
Method signatures and docstrings:
- def runserver(self, host, port, noreload): Runs the developm... | Implement the Python class `Dev` described below.
Class description:
Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver
Method signatures and docstrings:
- def runserver(self, host, port, noreload): Runs the developm... | ffe157cb3fe24366ee55869d4260cce778012b4a | <|skeleton|>
class Dev:
"""Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver"""
def runserver(self, host, port, noreload):
"""Runs the development server for the current application. Args: host: The h... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dev:
"""Development related tasks. Example: .. code-block:: ./console.py dev runserver Provides access to the following commands during development: - runserver"""
def runserver(self, host, port, noreload):
"""Runs the development server for the current application. Args: host: The host to bind t... | the_stack_v2_python_sparse | watson/framework/support/console/commands/development.py | watsonpy/watson-framework | train | 69 |
8ea10be7e90279738150fef38abf4d1c15cc0947 | [
"self.bring_disks_online = bring_disks_online\nself.password = password\nself.target_source_id = target_source_id\nself.use_existing_agent = use_existing_agent\nself.username = username\nself.volume_names = volume_names",
"if dictionary is None:\n return None\nbring_disks_online = dictionary.get('bringDisksOnl... | <|body_start_0|>
self.bring_disks_online = bring_disks_online
self.password = password
self.target_source_id = target_source_id
self.use_existing_agent = use_existing_agent
self.username = username
self.volume_names = volume_names
<|end_body_0|>
<|body_start_1|>
... | Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSourceId is specified, all disks are attached but ma... | MountVolumesParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MountVolumesParameters:
"""Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSo... | stack_v2_sparse_classes_36k_train_013348 | 4,644 | permissive | [
{
"docstring": "Constructor for the MountVolumesParameters class",
"name": "__init__",
"signature": "def __init__(self, bring_disks_online=None, password=None, target_source_id=None, use_existing_agent=None, username=None, volume_names=None)"
},
{
"docstring": "Creates an instance of this model ... | 2 | stack_v2_sparse_classes_30k_test_000783 | Implement the Python class `MountVolumesParameters` described below.
Class description:
Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountV... | Implement the Python class `MountVolumesParameters` described below.
Class description:
Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountV... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class MountVolumesParameters:
"""Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MountVolumesParameters:
"""Implementation of the 'MountVolumesParameters' model. Specifies the information required for mounting volumes. Only required for Restore Tasks of type 'kMountVolumes'. At a minimum, the targetSourceId must be specified for 'kMountVolumes' Restore Tasks. If only targetSourceId is spe... | the_stack_v2_python_sparse | cohesity_management_sdk/models/mount_volumes_parameters.py | cohesity/management-sdk-python | train | 24 |
948465607d5d900b53e50bf6d6c5af150c9f8456 | [
"super(ConvDiscriminator, self).__init__()\nassert method in ['wasserstein', 'least_squares', 'binary_cross_entropy']\nself.method = method\nself.embed_0 = tfkl.Dense(hidden)\nself.embed_0.build((None, 1))\nself.dense_0 = tfkl.Conv1D(hidden, 3, strides=2, padding='same')\nself.dense_0.build((None, None, design_shap... | <|body_start_0|>
super(ConvDiscriminator, self).__init__()
assert method in ['wasserstein', 'least_squares', 'binary_cross_entropy']
self.method = method
self.embed_0 = tfkl.Dense(hidden)
self.embed_0.build((None, 1))
self.dense_0 = tfkl.Conv1D(hidden, 3, strides=2, paddi... | A Fully Connected Network conditioned on a score | ConvDiscriminator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvDiscriminator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, hidden=50, method='wasserstein'):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[i... | stack_v2_sparse_classes_36k_train_013349 | 30,757 | permissive | [
{
"docstring": "Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple of integers that represents the shape of a single design for a particular task hidden: int the number of hidden units in every layer of ... | 4 | stack_v2_sparse_classes_30k_train_014513 | Implement the Python class `ConvDiscriminator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, hidden=50, method='wasserstein'): Create a fully connected architecture using keras that can process several parallel... | Implement the Python class `ConvDiscriminator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, hidden=50, method='wasserstein'): Create a fully connected architecture using keras that can process several parallel... | d46ff40d8b665953afb64a3332ddf1953b8a0766 | <|skeleton|>
class ConvDiscriminator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, hidden=50, method='wasserstein'):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvDiscriminator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, hidden=50, method='wasserstein'):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of... | the_stack_v2_python_sparse | design_baselines/mins/nets.py | stjordanis/design-baselines | train | 0 |
871588234e4d58e41d5d98645ab393c3edfb693c | [
"doc = FakeDocument([edu1, edu2, edu3], [rel1, rel2], [cdu1])\nk = FakeKey('cdu_head_test')\ndoc.fleshout(k)\ngra = stac_gr.Graph.from_doc({k: doc}, k)\nids = graph_ids(gra)\nself.assertEqual(gra.cdu_head(ids['c1']), ids['e1'])",
"doc = FakeDocument([edu1, edu2, edu3, edu4], [rel1, rel2, rel3], [cdu1, cdu2])\nk =... | <|body_start_0|>
doc = FakeDocument([edu1, edu2, edu3], [rel1, rel2], [cdu1])
k = FakeKey('cdu_head_test')
doc.fleshout(k)
gra = stac_gr.Graph.from_doc({k: doc}, k)
ids = graph_ids(gra)
self.assertEqual(gra.cdu_head(ids['c1']), ids['e1'])
<|end_body_0|>
<|body_start_1|>
... | CduHeadTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CduHeadTest:
def test_cdu_head(self):
"""cdu[e1 -> e2 -> e2]"""
<|body_0|>
def test_embedded_cdu_head(self):
"""cdu[cdu[e1 -> e2 -> e3] -> e4]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
doc = FakeDocument([edu1, edu2, edu3], [rel1, rel2], [cdu1... | stack_v2_sparse_classes_36k_train_013350 | 14,502 | no_license | [
{
"docstring": "cdu[e1 -> e2 -> e2]",
"name": "test_cdu_head",
"signature": "def test_cdu_head(self)"
},
{
"docstring": "cdu[cdu[e1 -> e2 -> e3] -> e4]",
"name": "test_embedded_cdu_head",
"signature": "def test_embedded_cdu_head(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004271 | Implement the Python class `CduHeadTest` described below.
Class description:
Implement the CduHeadTest class.
Method signatures and docstrings:
- def test_cdu_head(self): cdu[e1 -> e2 -> e2]
- def test_embedded_cdu_head(self): cdu[cdu[e1 -> e2 -> e3] -> e4] | Implement the Python class `CduHeadTest` described below.
Class description:
Implement the CduHeadTest class.
Method signatures and docstrings:
- def test_cdu_head(self): cdu[e1 -> e2 -> e2]
- def test_embedded_cdu_head(self): cdu[cdu[e1 -> e2 -> e3] -> e4]
<|skeleton|>
class CduHeadTest:
def test_cdu_head(self... | c550f4383016e05fe20ad7180a027979e3540d1f | <|skeleton|>
class CduHeadTest:
def test_cdu_head(self):
"""cdu[e1 -> e2 -> e2]"""
<|body_0|>
def test_embedded_cdu_head(self):
"""cdu[cdu[e1 -> e2 -> e3] -> e4]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CduHeadTest:
def test_cdu_head(self):
"""cdu[e1 -> e2 -> e2]"""
doc = FakeDocument([edu1, edu2, edu3], [rel1, rel2], [cdu1])
k = FakeKey('cdu_head_test')
doc.fleshout(k)
gra = stac_gr.Graph.from_doc({k: doc}, k)
ids = graph_ids(gra)
self.assertEqual(gra.... | the_stack_v2_python_sparse | educe/stac/tests.py | kowey/educe | train | 1 | |
ac716d818e9110d426ab5cf390859452f3eee713 | [
"col_update_params = {}\nfiscal_year = self.object.fiscal_year\nfor form in LIST_INTERNAL_AFFAIRS_STATE:\n if ROUTE_LINK[form]['form_field'] in ['action_plan_implementation']:\n form_obj = ROUTE_LINK[form]['model'].objects.create(body=self.object.body, create_user=self.request.user)\n elif ROUTE_LINK[f... | <|body_start_0|>
col_update_params = {}
fiscal_year = self.object.fiscal_year
for form in LIST_INTERNAL_AFFAIRS_STATE:
if ROUTE_LINK[form]['form_field'] in ['action_plan_implementation']:
form_obj = ROUTE_LINK[form]['model'].objects.create(body=self.object.body, creat... | Creates form collection and initializes all forms in the collection | InternalAffairFormCollectionCreateView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InternalAffairFormCollectionCreateView:
"""Creates form collection and initializes all forms in the collection"""
def init_forms(self):
"""Initializes(creates) forms of the collection and links them to it."""
<|body_0|>
def get(self, request, *args, **kwargs):
""... | stack_v2_sparse_classes_36k_train_013351 | 15,180 | no_license | [
{
"docstring": "Initializes(creates) forms of the collection and links them to it.",
"name": "init_forms",
"signature": "def init_forms(self)"
},
{
"docstring": "renders forms initial page to fill initial data like province, fiscal year",
"name": "get",
"signature": "def get(self, reques... | 3 | null | Implement the Python class `InternalAffairFormCollectionCreateView` described below.
Class description:
Creates form collection and initializes all forms in the collection
Method signatures and docstrings:
- def init_forms(self): Initializes(creates) forms of the collection and links them to it.
- def get(self, reque... | Implement the Python class `InternalAffairFormCollectionCreateView` described below.
Class description:
Creates form collection and initializes all forms in the collection
Method signatures and docstrings:
- def init_forms(self): Initializes(creates) forms of the collection and links them to it.
- def get(self, reque... | 38c0bf763ae0a15c301c020d76ff0596c561da14 | <|skeleton|>
class InternalAffairFormCollectionCreateView:
"""Creates form collection and initializes all forms in the collection"""
def init_forms(self):
"""Initializes(creates) forms of the collection and links them to it."""
<|body_0|>
def get(self, request, *args, **kwargs):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InternalAffairFormCollectionCreateView:
"""Creates form collection and initializes all forms in the collection"""
def init_forms(self):
"""Initializes(creates) forms of the collection and links them to it."""
col_update_params = {}
fiscal_year = self.object.fiscal_year
for... | the_stack_v2_python_sparse | collection/views/internal_affairs_form_collection_views.py | Rabin5/formcollection | train | 0 |
5672a433858beb1d00ae7120d445c84f9a949de8 | [
"self.maze = maze\nself.x1 = x1\nself.x2 = x2\nself.y1 = y1\nself.y2 = y2\nself.stack = []\nself.stack.append((x1, y1))\nself.position = [lambda x, y: (x + 1, y), lambda x, y: (x - 1, y), lambda x, y: (x, y + 1), lambda x, y: (x, y - 1)]",
"while len(self.stack) > 0:\n cur_node = self.stack[-1]\n if cur_nod... | <|body_start_0|>
self.maze = maze
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 = y2
self.stack = []
self.stack.append((x1, y1))
self.position = [lambda x, y: (x + 1, y), lambda x, y: (x - 1, y), lambda x, y: (x, y + 1), lambda x, y: (x, y - 1)]
<|end_bod... | 路径搜索 栈实现 栈空表示没有路 | StackMazePath | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StackMazePath:
"""路径搜索 栈实现 栈空表示没有路"""
def __init__(self, maze, x1, y1, x2, y2):
"""初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y"""
<|body_0|>
def maze_alt(self):
"""搜索算法 :return:"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k_train_013352 | 4,700 | no_license | [
{
"docstring": "初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y",
"name": "__init__",
"signature": "def __init__(self, maze, x1, y1, x2, y2)"
},
{
"docstring": "搜索算法 :return:",
"name": "maze_alt",
"signature": "def maze_alt(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003684 | Implement the Python class `StackMazePath` described below.
Class description:
路径搜索 栈实现 栈空表示没有路
Method signatures and docstrings:
- def __init__(self, maze, x1, y1, x2, y2): 初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y
- def maze_alt(self): 搜索算法 :return: | Implement the Python class `StackMazePath` described below.
Class description:
路径搜索 栈实现 栈空表示没有路
Method signatures and docstrings:
- def __init__(self, maze, x1, y1, x2, y2): 初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y
- def maze_alt(self): 搜索算法 :return:
<|skeleton|>
cl... | 894137bacf0305b8afdd74302f416b2715e216fd | <|skeleton|>
class StackMazePath:
"""路径搜索 栈实现 栈空表示没有路"""
def __init__(self, maze, x1, y1, x2, y2):
"""初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y"""
<|body_0|>
def maze_alt(self):
"""搜索算法 :return:"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StackMazePath:
"""路径搜索 栈实现 栈空表示没有路"""
def __init__(self, maze, x1, y1, x2, y2):
"""初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y"""
self.maze = maze
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 = y2
se... | the_stack_v2_python_sparse | data_struct/stack_queue_demo.py | dxc13762525628/concurrent | train | 0 |
e1d712db8bdc8619ba3de8b15c107fd1ec058cc1 | [
"super().__init__()\nself.W = tf.keras.layers.Dense(units=units)\nself.U = tf.keras.layers.Dense(units=units)\nself.V = tf.keras.layers.Dense(units=1)",
"s_expanded = tf.expand_dims(input=s_prev, axis=1)\nfirst = self.W(s_expanded)\nsecond = self.U(hidden_states)\nscore = self.V(tf.nn.tanh(first + second))\natten... | <|body_start_0|>
super().__init__()
self.W = tf.keras.layers.Dense(units=units)
self.U = tf.keras.layers.Dense(units=units)
self.V = tf.keras.layers.Dense(units=1)
<|end_body_0|>
<|body_start_1|>
s_expanded = tf.expand_dims(input=s_prev, axis=1)
first = self.W(s_expanded... | class SelfAttention | SelfAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
"""class SelfAttention"""
def __init__(self, units):
"""* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hid... | stack_v2_sparse_classes_36k_train_013353 | 1,978 | no_license | [
{
"docstring": "* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hidden state * U - a Dense layer with units units, to be applied to the encoder hidden... | 2 | stack_v2_sparse_classes_30k_test_000295 | Implement the Python class `SelfAttention` described below.
Class description:
class SelfAttention
Method signatures and docstrings:
- def __init__(self, units): * units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer wi... | Implement the Python class `SelfAttention` described below.
Class description:
class SelfAttention
Method signatures and docstrings:
- def __init__(self, units): * units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer wi... | 8ad4c2594ff78b345dbd92e9d54d2a143ac4071a | <|skeleton|>
class SelfAttention:
"""class SelfAttention"""
def __init__(self, units):
"""* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hid... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelfAttention:
"""class SelfAttention"""
def __init__(self, units):
"""* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hidden state * U... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/1-self_attention.py | jorgezafra94/holbertonschool-machine_learning | train | 1 |
c273307560cddad80cd6009b73e0e2ac49685e4d | [
"super().__init__()\nself.dropout_rate = dropout_rate\nout_features = out_features or in_features\nhidden_features = hidden_features or in_features\nself.fc1 = Linear(in_features, hidden_features, bias=bias_on)\nself.act = act_layer()\nself.fc2 = Linear(hidden_features, out_features, bias=bias_on)\nif self.dropout_... | <|body_start_0|>
super().__init__()
self.dropout_rate = dropout_rate
out_features = out_features or in_features
hidden_features = hidden_features or in_features
self.fc1 = Linear(in_features, hidden_features, bias=bias_on)
self.act = act_layer()
self.fc2 = Linear(... | A MLP block that contains two linear layers with a normalization layer. The MLP block is used in a transformer model after the attention block. :: Linear (in_features, hidden_features) ↓ Normalization (act_layer) ↓ Dropout (p=dropout_rate) ↓ Linear (hidden_features, out_features) ↓ Dropout (p=dropout_rate) | Mlp | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mlp:
"""A MLP block that contains two linear layers with a normalization layer. The MLP block is used in a transformer model after the attention block. :: Linear (in_features, hidden_features) ↓ Normalization (act_layer) ↓ Dropout (p=dropout_rate) ↓ Linear (hidden_features, out_features) ↓ Dropou... | stack_v2_sparse_classes_36k_train_013354 | 28,184 | permissive | [
{
"docstring": "Args: in_features (int): Input feature dimension. hidden_features (Optional[int]): Hidden feature dimension. By default, hidden feature is set to input feature dimension. out_features (Optional[int]): Output feature dimension. By default, output features dimension is set to input feature dimensi... | 2 | null | Implement the Python class `Mlp` described below.
Class description:
A MLP block that contains two linear layers with a normalization layer. The MLP block is used in a transformer model after the attention block. :: Linear (in_features, hidden_features) ↓ Normalization (act_layer) ↓ Dropout (p=dropout_rate) ↓ Linear (... | Implement the Python class `Mlp` described below.
Class description:
A MLP block that contains two linear layers with a normalization layer. The MLP block is used in a transformer model after the attention block. :: Linear (in_features, hidden_features) ↓ Normalization (act_layer) ↓ Dropout (p=dropout_rate) ↓ Linear (... | c60dc19788217556ba12ea378c02b9fd0aea9ffe | <|skeleton|>
class Mlp:
"""A MLP block that contains two linear layers with a normalization layer. The MLP block is used in a transformer model after the attention block. :: Linear (in_features, hidden_features) ↓ Normalization (act_layer) ↓ Dropout (p=dropout_rate) ↓ Linear (hidden_features, out_features) ↓ Dropou... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mlp:
"""A MLP block that contains two linear layers with a normalization layer. The MLP block is used in a transformer model after the attention block. :: Linear (in_features, hidden_features) ↓ Normalization (act_layer) ↓ Dropout (p=dropout_rate) ↓ Linear (hidden_features, out_features) ↓ Dropout (p=dropout_... | the_stack_v2_python_sparse | python/aitemplate/frontend/nn/multiscale_attention.py | facebookincubator/AITemplate | train | 4,065 |
7c8bf28f7bf5edba90f3777d48c68aacfc897553 | [
"d = devicemanage(self.driver)\nd.open_devicemanage()\nself.assertEqual(d.verify(), True)\nd.modify_obj()\nself.assertEqual(d.sub_tagname(), '设备管理-修改')\nd.name_clear()\nd.serial_clear()\nd.version_clear()\nd.add_save()\nself.assertEqual(d.error_name(), '不能为空哦')\nself.assertEqual(d.error_serial(), '不能为空哦')\nself.ass... | <|body_start_0|>
d = devicemanage(self.driver)
d.open_devicemanage()
self.assertEqual(d.verify(), True)
d.modify_obj()
self.assertEqual(d.sub_tagname(), '设备管理-修改')
d.name_clear()
d.serial_clear()
d.version_clear()
d.add_save()
self.assertEq... | Test039_Device_Modify_Error | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test039_Device_Modify_Error:
def test_device_modify_error1(self):
"""输入为空"""
<|body_0|>
def test_device_modify_error2(self):
"""版本号输入无效"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = devicemanage(self.driver)
d.open_devicemanage()
... | stack_v2_sparse_classes_36k_train_013355 | 1,376 | no_license | [
{
"docstring": "输入为空",
"name": "test_device_modify_error1",
"signature": "def test_device_modify_error1(self)"
},
{
"docstring": "版本号输入无效",
"name": "test_device_modify_error2",
"signature": "def test_device_modify_error2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005974 | Implement the Python class `Test039_Device_Modify_Error` described below.
Class description:
Implement the Test039_Device_Modify_Error class.
Method signatures and docstrings:
- def test_device_modify_error1(self): 输入为空
- def test_device_modify_error2(self): 版本号输入无效 | Implement the Python class `Test039_Device_Modify_Error` described below.
Class description:
Implement the Test039_Device_Modify_Error class.
Method signatures and docstrings:
- def test_device_modify_error1(self): 输入为空
- def test_device_modify_error2(self): 版本号输入无效
<|skeleton|>
class Test039_Device_Modify_Error:
... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test039_Device_Modify_Error:
def test_device_modify_error1(self):
"""输入为空"""
<|body_0|>
def test_device_modify_error2(self):
"""版本号输入无效"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test039_Device_Modify_Error:
def test_device_modify_error1(self):
"""输入为空"""
d = devicemanage(self.driver)
d.open_devicemanage()
self.assertEqual(d.verify(), True)
d.modify_obj()
self.assertEqual(d.sub_tagname(), '设备管理-修改')
d.name_clear()
d.seria... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/Manage_Device/Test039_device_modify_error.py | rrmiracle/GlxssLive | train | 0 | |
8b120877a3050e08cf6deb0625957f57636c895c | [
"self.method = method\nself.algo_config = algo_config\nself.protect_wrap = protect_wrap",
"if not isinstance(img_obj, ImageEntity) or not isinstance(pattern_obj, ImageEntity):\n raise ValueError('img_obj and pattern_obj must both be ImageEntity objects to use InsertAtRandomLocation!')\npattern = pattern_obj.ge... | <|body_start_0|>
self.method = method
self.algo_config = algo_config
self.protect_wrap = protect_wrap
<|end_body_0|>
<|body_start_1|>
if not isinstance(img_obj, ImageEntity) or not isinstance(pattern_obj, ImageEntity):
raise ValueError('img_obj and pattern_obj must both be I... | Inserts a provided pattern at a random location, where valid locations are determined according to a provided algorithm specification | InsertAtRandomLocation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InsertAtRandomLocation:
"""Inserts a provided pattern at a random location, where valid locations are determined according to a provided algorithm specification"""
def __init__(self, method: str, algo_config: ValidInsertLocationsConfig, protect_wrap: bool=True) -> None:
"""Initialize... | stack_v2_sparse_classes_36k_train_013356 | 9,665 | permissive | [
{
"docstring": "Initialize the random inserter object. :param method: the insertion method, currently, only uniform_random_available is a valid input :param algo_config: The provided configuration object specifying the algorithm to use and necessary parameters :param protect_wrap: if True, ensures that pattern ... | 2 | stack_v2_sparse_classes_30k_train_015832 | Implement the Python class `InsertAtRandomLocation` described below.
Class description:
Inserts a provided pattern at a random location, where valid locations are determined according to a provided algorithm specification
Method signatures and docstrings:
- def __init__(self, method: str, algo_config: ValidInsertLoca... | Implement the Python class `InsertAtRandomLocation` described below.
Class description:
Inserts a provided pattern at a random location, where valid locations are determined according to a provided algorithm specification
Method signatures and docstrings:
- def __init__(self, method: str, algo_config: ValidInsertLoca... | 6ee5912f1fa57f49a4dd4feeeaf7862153bb6a9f | <|skeleton|>
class InsertAtRandomLocation:
"""Inserts a provided pattern at a random location, where valid locations are determined according to a provided algorithm specification"""
def __init__(self, method: str, algo_config: ValidInsertLocationsConfig, protect_wrap: bool=True) -> None:
"""Initialize... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InsertAtRandomLocation:
"""Inserts a provided pattern at a random location, where valid locations are determined according to a provided algorithm specification"""
def __init__(self, method: str, algo_config: ValidInsertLocationsConfig, protect_wrap: bool=True) -> None:
"""Initialize the random i... | the_stack_v2_python_sparse | trojai/trojai/datagen/insert_merges.py | ionutmodo/TrojAI-UMD | train | 1 |
d99ddfb523c953ca2120581deaf92b88e031d646 | [
"self.pager = pager\nself.text = text\nself.page = page\nself.state = None\nif active:\n self.state = 'active'\nif disabled:\n self.state = 'disabled'",
"if self.state is not None:\n return None\nreturn self.pager._href_pattern % self.page"
] | <|body_start_0|>
self.pager = pager
self.text = text
self.page = page
self.state = None
if active:
self.state = 'active'
if disabled:
self.state = 'disabled'
<|end_body_0|>
<|body_start_1|>
if self.state is not None:
return Non... | An object representing a single link in the pagination control. | _PageLink | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _PageLink:
"""An object representing a single link in the pagination control."""
def __init__(self, pager, text, page, active=False, disabled=False):
"""Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link ... | stack_v2_sparse_classes_36k_train_013357 | 5,248 | permissive | [
{
"docstring": "Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link points to. active: Whether the link represents the current page. disabled: Whether the link is invalid.",
"name": "__init__",
"signature": "def __init__(self... | 2 | stack_v2_sparse_classes_30k_train_010923 | Implement the Python class `_PageLink` described below.
Class description:
An object representing a single link in the pagination control.
Method signatures and docstrings:
- def __init__(self, pager, text, page, active=False, disabled=False): Create a new page link. Arguments: pager: The parent Pager object. text: T... | Implement the Python class `_PageLink` described below.
Class description:
An object representing a single link in the pagination control.
Method signatures and docstrings:
- def __init__(self, pager, text, page, active=False, disabled=False): Create a new page link. Arguments: pager: The parent Pager object. text: T... | 5701b2a6ef4c94a3026f03e1bbea09cd999e9d88 | <|skeleton|>
class _PageLink:
"""An object representing a single link in the pagination control."""
def __init__(self, pager, text, page, active=False, disabled=False):
"""Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _PageLink:
"""An object representing a single link in the pagination control."""
def __init__(self, pager, text, page, active=False, disabled=False):
"""Create a new page link. Arguments: pager: The parent Pager object. text: The text of the link. page: The page number that the link points to. ac... | the_stack_v2_python_sparse | app/handlers/pager.py | tapted/pub-dartlang | train | 0 |
221f7b858df21eaa923dee13d66b876d3ebc5f98 | [
"min_context_list = []\nfor i in itertools.product([0, 1], repeat=self.n_features):\n min_context_list.append(i)\npartitions = []\nfor partition in generate_partition(min_context_list):\n partitions.append(partition)\npartition_values = []\nmax_best_rewards_p_list = []\nfor partition in partitions:\n parti... | <|body_start_0|>
min_context_list = []
for i in itertools.product([0, 1], repeat=self.n_features):
min_context_list.append(i)
partitions = []
for partition in generate_partition(min_context_list):
partitions.append(partition)
partition_values = []
... | A simple context generator that compares all possible partitions and select the one with the highest value | BruteforceContextGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BruteforceContextGenerator:
"""A simple context generator that compares all possible partitions and select the one with the highest value"""
def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[Tuple]]):
"""Update the context structure tree by looking at ... | stack_v2_sparse_classes_36k_train_013358 | 6,509 | permissive | [
{
"docstring": "Update the context structure tree by looking at every possible combinations of feature without looking at the old context structure :param old_cst_root: old context structure tree :return: new context structure tree based on greedy algorithm on leaf nodes",
"name": "get_context_structure",
... | 4 | stack_v2_sparse_classes_30k_train_005990 | Implement the Python class `BruteforceContextGenerator` described below.
Class description:
A simple context generator that compares all possible partitions and select the one with the highest value
Method signatures and docstrings:
- def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[T... | Implement the Python class `BruteforceContextGenerator` described below.
Class description:
A simple context generator that compares all possible partitions and select the one with the highest value
Method signatures and docstrings:
- def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[T... | 0ba1e0ee67a570bb53ad02e9481e0c58ffc69249 | <|skeleton|>
class BruteforceContextGenerator:
"""A simple context generator that compares all possible partitions and select the one with the highest value"""
def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[Tuple]]):
"""Update the context structure tree by looking at ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BruteforceContextGenerator:
"""A simple context generator that compares all possible partitions and select the one with the highest value"""
def get_context_structure(self, old_cst_root: Node) -> (Optional[Node], List[List[Tuple]]):
"""Update the context structure tree by looking at every possibl... | the_stack_v2_python_sparse | bandit/context/BruteforceContextGenerator.py | riccardopoiani/pricing-and-advertising-machine-learning | train | 3 |
e2e06bd241469da798402383bb39efc37e311e32 | [
"time = timezone.now() + timedelta(days=10)\nfuture_event = Event(start=time, end=time + timedelta(hours=1), label='test event', category='tests')\nself.assertIs(future_event.is_upcoming(), False)",
"time = timezone.now() + timedelta(hours=2)\nfuture_event = Event(start=time, end=time + timedelta(hours=1), label=... | <|body_start_0|>
time = timezone.now() + timedelta(days=10)
future_event = Event(start=time, end=time + timedelta(hours=1), label='test event', category='tests')
self.assertIs(future_event.is_upcoming(), False)
<|end_body_0|>
<|body_start_1|>
time = timezone.now() + timedelta(hours=2)
... | DateModelTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DateModelTests:
def test_is_upcoming_for_not_upcoming_event(self):
"""Checks is_upcoming function with events that are not upcoming"""
<|body_0|>
def test_is_upcoming_for_upcoming_event(self):
"""Checks is_upcoming with events that are upcoming"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_013359 | 1,853 | no_license | [
{
"docstring": "Checks is_upcoming function with events that are not upcoming",
"name": "test_is_upcoming_for_not_upcoming_event",
"signature": "def test_is_upcoming_for_not_upcoming_event(self)"
},
{
"docstring": "Checks is_upcoming with events that are upcoming",
"name": "test_is_upcoming_... | 2 | stack_v2_sparse_classes_30k_train_003058 | Implement the Python class `DateModelTests` described below.
Class description:
Implement the DateModelTests class.
Method signatures and docstrings:
- def test_is_upcoming_for_not_upcoming_event(self): Checks is_upcoming function with events that are not upcoming
- def test_is_upcoming_for_upcoming_event(self): Chec... | Implement the Python class `DateModelTests` described below.
Class description:
Implement the DateModelTests class.
Method signatures and docstrings:
- def test_is_upcoming_for_not_upcoming_event(self): Checks is_upcoming function with events that are not upcoming
- def test_is_upcoming_for_upcoming_event(self): Chec... | 62b4d64e9fe98c8e8221526ee47668160f0bc246 | <|skeleton|>
class DateModelTests:
def test_is_upcoming_for_not_upcoming_event(self):
"""Checks is_upcoming function with events that are not upcoming"""
<|body_0|>
def test_is_upcoming_for_upcoming_event(self):
"""Checks is_upcoming with events that are upcoming"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DateModelTests:
def test_is_upcoming_for_not_upcoming_event(self):
"""Checks is_upcoming function with events that are not upcoming"""
time = timezone.now() + timedelta(days=10)
future_event = Event(start=time, end=time + timedelta(hours=1), label='test event', category='tests')
... | the_stack_v2_python_sparse | events/tests.py | eddumpy/EventPlanner | train | 0 | |
5e4198dcc9da98e7c4922d426edff324a07f9969 | [
"@self.router.get('/info', response_model=Info, response_model_exclude={'minzoom', 'maxzoom', 'center'}, response_model_exclude_none=True, responses={200: {'description': \"Return dataset's basic info or the list of available bands.\"}})\ndef info(src_path=Depends(self.path_dependency), bands_params=Depends(BandsPa... | <|body_start_0|>
@self.router.get('/info', response_model=Info, response_model_exclude={'minzoom', 'maxzoom', 'center'}, response_model_exclude_none=True, responses={200: {'description': "Return dataset's basic info or the list of available bands."}})
def info(src_path=Depends(self.path_dependency), ban... | Custom Tiler Factory for MultiBandReader classes. Note: To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a `bands` argument to most of its methods. By using the `BandsExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() and the .part() methods will receive bands or expr... | MultiBandTilerFactory | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiBandTilerFactory:
"""Custom Tiler Factory for MultiBandReader classes. Note: To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a `bands` argument to most of its methods. By using the `BandsExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() a... | stack_v2_sparse_classes_36k_train_013360 | 48,399 | permissive | [
{
"docstring": "Register /info endpoint.",
"name": "info",
"signature": "def info(self)"
},
{
"docstring": "Register /metadata endpoint.",
"name": "metadata",
"signature": "def metadata(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007551 | Implement the Python class `MultiBandTilerFactory` described below.
Class description:
Custom Tiler Factory for MultiBandReader classes. Note: To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a `bands` argument to most of its methods. By using the `BandsExprParams` for the `layer_dependenc... | Implement the Python class `MultiBandTilerFactory` described below.
Class description:
Custom Tiler Factory for MultiBandReader classes. Note: To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a `bands` argument to most of its methods. By using the `BandsExprParams` for the `layer_dependenc... | 2168c9284b39a46c4d1a095542c77addc690a738 | <|skeleton|>
class MultiBandTilerFactory:
"""Custom Tiler Factory for MultiBandReader classes. Note: To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a `bands` argument to most of its methods. By using the `BandsExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiBandTilerFactory:
"""Custom Tiler Factory for MultiBandReader classes. Note: To be able to use the rio_tiler.io.MultiBandReader we need to be able to pass a `bands` argument to most of its methods. By using the `BandsExprParams` for the `layer_dependency`, the .tile(), .point(), .preview() and the .part(... | the_stack_v2_python_sparse | src/titiler/core/titiler/core/factory.py | kylebarron/titiler | train | 0 |
c762bfff5189176d65c3fbff3ce653647fc98a63 | [
"self._data_context = data_context\nself._squeeze_time_dim = squeeze_time_dim\nself._prepend_t0_to_next_time_step = prepend_t0_to_next_time_step",
"if _is_transition_like(value):\n value = _as_tfa_transition(value)\nelif _is_trajectory_like(value):\n required_sequence_length = 2 if self._squeeze_time_dim el... | <|body_start_0|>
self._data_context = data_context
self._squeeze_time_dim = squeeze_time_dim
self._prepend_t0_to_next_time_step = prepend_t0_to_next_time_step
<|end_body_0|>
<|body_start_1|>
if _is_transition_like(value):
value = _as_tfa_transition(value)
elif _is_tr... | Class that validates and converts other data types to Transition. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the specs in the data context. These additional entries / observations are ignored and dropped during conversion. This non-strict checking allows use... | AsTransition | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsTransition:
"""Class that validates and converts other data types to Transition. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the specs in the data context. These additional entries / observations are ignored and dropped during convers... | stack_v2_sparse_classes_36k_train_013361 | 24,336 | permissive | [
{
"docstring": "Creates the AsTransition converter. Args: data_context: An instance of `DataContext`, typically accessed from the `TFAgent.data_context` property. squeeze_time_dim: Whether to emit a transition without time dimensions. If `True`, incoming trajectories are expected to have a time dimension of exa... | 2 | null | Implement the Python class `AsTransition` described below.
Class description:
Class that validates and converts other data types to Transition. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the specs in the data context. These additional entries / observations... | Implement the Python class `AsTransition` described below.
Class description:
Class that validates and converts other data types to Transition. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the specs in the data context. These additional entries / observations... | eca1093d3a047e538f17f6ab92ab4d8144284f23 | <|skeleton|>
class AsTransition:
"""Class that validates and converts other data types to Transition. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the specs in the data context. These additional entries / observations are ignored and dropped during convers... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AsTransition:
"""Class that validates and converts other data types to Transition. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the specs in the data context. These additional entries / observations are ignored and dropped during conversion. This non... | the_stack_v2_python_sparse | tf_agents/agents/data_converter.py | tensorflow/agents | train | 2,755 |
0d51a587d0e721efa6423b6fc817f8675729a145 | [
"self.objectid = ObjectId()\nself.assertIsNone(self.objectid.Key)\nself.assertEqual(self.objectid.Name, '')\nsetattr(self.objectid, 'Key', 12)\nself.assertEqual(self.objectid.Key, 12)\nsetattr(self.objectid, 'Name', 'what is up')\nself.assertEqual(self.objectid.Name, 'what is up')",
"self.objectid = ObjectId('kic... | <|body_start_0|>
self.objectid = ObjectId()
self.assertIsNone(self.objectid.Key)
self.assertEqual(self.objectid.Name, '')
setattr(self.objectid, 'Key', 12)
self.assertEqual(self.objectid.Key, 12)
setattr(self.objectid, 'Name', 'what is up')
self.assertEqual(self.o... | ObectIdTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObectIdTests:
def test_epmty_constructor(self):
"""Автор: Краснов Д.В."""
<|body_0|>
def test_filled_constructor_1(self):
"""Автор: Краснов Д.В."""
<|body_1|>
def test_filled_constructor_2(self):
"""Автор: Краснов Д.В."""
<|body_2|>
<|en... | stack_v2_sparse_classes_36k_train_013362 | 20,083 | no_license | [
{
"docstring": "Автор: Краснов Д.В.",
"name": "test_epmty_constructor",
"signature": "def test_epmty_constructor(self)"
},
{
"docstring": "Автор: Краснов Д.В.",
"name": "test_filled_constructor_1",
"signature": "def test_filled_constructor_1(self)"
},
{
"docstring": "Автор: Красн... | 3 | stack_v2_sparse_classes_30k_train_011799 | Implement the Python class `ObectIdTests` described below.
Class description:
Implement the ObectIdTests class.
Method signatures and docstrings:
- def test_epmty_constructor(self): Автор: Краснов Д.В.
- def test_filled_constructor_1(self): Автор: Краснов Д.В.
- def test_filled_constructor_2(self): Автор: Краснов Д.В... | Implement the Python class `ObectIdTests` described below.
Class description:
Implement the ObectIdTests class.
Method signatures and docstrings:
- def test_epmty_constructor(self): Автор: Краснов Д.В.
- def test_filled_constructor_1(self): Автор: Краснов Д.В.
- def test_filled_constructor_2(self): Автор: Краснов Д.В... | 5559275accbfda0cb75c8c90d79090c10524e815 | <|skeleton|>
class ObectIdTests:
def test_epmty_constructor(self):
"""Автор: Краснов Д.В."""
<|body_0|>
def test_filled_constructor_1(self):
"""Автор: Краснов Д.В."""
<|body_1|>
def test_filled_constructor_2(self):
"""Автор: Краснов Д.В."""
<|body_2|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ObectIdTests:
def test_epmty_constructor(self):
"""Автор: Краснов Д.В."""
self.objectid = ObjectId()
self.assertIsNone(self.objectid.Key)
self.assertEqual(self.objectid.Name, '')
setattr(self.objectid, 'Key', 12)
self.assertEqual(self.objectid.Key, 12)
s... | the_stack_v2_python_sparse | test_api/other_classes.py | 4l1fe/miscellaneous | train | 0 | |
8a1d9466fdbcfeb362b0e3764966654e91f8dbb7 | [
"self.config_entry = config_entry\nself.pin = config_entry.data[CONF_PIN]\nself.ignored_sources = config_entry.options.get(CONF_IGNORED_SOURCES)\nself.source_list: dict[str, str] = {}",
"coordinator = self.hass.data[DOMAIN][self.config_entry.entry_id]\nbraviarc = coordinator.braviarc\nconnected = await self.hass.... | <|body_start_0|>
self.config_entry = config_entry
self.pin = config_entry.data[CONF_PIN]
self.ignored_sources = config_entry.options.get(CONF_IGNORED_SOURCES)
self.source_list: dict[str, str] = {}
<|end_body_0|>
<|body_start_1|>
coordinator = self.hass.data[DOMAIN][self.config_e... | Config flow options for Bravia TV. | BraviaTVOptionsFlowHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BraviaTVOptionsFlowHandler:
"""Config flow options for Bravia TV."""
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize Bravia TV options flow."""
<|body_0|>
async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult:
... | stack_v2_sparse_classes_36k_train_013363 | 6,267 | permissive | [
{
"docstring": "Initialize Bravia TV options flow.",
"name": "__init__",
"signature": "def __init__(self, config_entry: ConfigEntry) -> None"
},
{
"docstring": "Manage the options.",
"name": "async_step_init",
"signature": "async def async_step_init(self, user_input: dict[str, Any] | Non... | 3 | null | Implement the Python class `BraviaTVOptionsFlowHandler` described below.
Class description:
Config flow options for Bravia TV.
Method signatures and docstrings:
- def __init__(self, config_entry: ConfigEntry) -> None: Initialize Bravia TV options flow.
- async def async_step_init(self, user_input: dict[str, Any] | No... | Implement the Python class `BraviaTVOptionsFlowHandler` described below.
Class description:
Config flow options for Bravia TV.
Method signatures and docstrings:
- def __init__(self, config_entry: ConfigEntry) -> None: Initialize Bravia TV options flow.
- async def async_step_init(self, user_input: dict[str, Any] | No... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class BraviaTVOptionsFlowHandler:
"""Config flow options for Bravia TV."""
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize Bravia TV options flow."""
<|body_0|>
async def async_step_init(self, user_input: dict[str, Any] | None=None) -> FlowResult:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BraviaTVOptionsFlowHandler:
"""Config flow options for Bravia TV."""
def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize Bravia TV options flow."""
self.config_entry = config_entry
self.pin = config_entry.data[CONF_PIN]
self.ignored_sources = config_entry.... | the_stack_v2_python_sparse | homeassistant/components/braviatv/config_flow.py | BenWoodford/home-assistant | train | 11 |
8ef0687353f245ca22a64e14da88cbe2e784c167 | [
"map = {}\nret = []\nfor m in strs:\n tmp = ''.join(sorted(m))\n if tmp not in map:\n map[tmp] = [m]\n else:\n map[tmp].append(m)\nfor k, v in map.items():\n ret.append(v)\nreturn ret",
"from collections import defaultdict\ndic = defaultdict(list)\nfor s in strs:\n dic[''.join(sorted(... | <|body_start_0|>
map = {}
ret = []
for m in strs:
tmp = ''.join(sorted(m))
if tmp not in map:
map[tmp] = [m]
else:
map[tmp].append(m)
for k, v in map.items():
ret.append(v)
return ret
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def groupAnagrams(self, strs):
""":type strs: List[str] :rtype: List[List[str]] 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ]"""
<|body_0|>
def groupAnagrams1(self, strs):
"""模块 :param strs: :return:... | stack_v2_sparse_classes_36k_train_013364 | 1,086 | no_license | [
{
"docstring": ":type strs: List[str] :rtype: List[List[str]] 示例: 输入: [\"eat\", \"tea\", \"tan\", \"ate\", \"nat\", \"bat\"], 输出: [ [\"ate\",\"eat\",\"tea\"], [\"nat\",\"tan\"], [\"bat\"] ]",
"name": "groupAnagrams",
"signature": "def groupAnagrams(self, strs)"
},
{
"docstring": "模块 :param strs:... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"]... | 069bb0b751ef7f469036b9897436eb5d138ffa24 | <|skeleton|>
class Solution:
def groupAnagrams(self, strs):
""":type strs: List[str] :rtype: List[List[str]] 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ]"""
<|body_0|>
def groupAnagrams1(self, strs):
"""模块 :param strs: :return:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def groupAnagrams(self, strs):
""":type strs: List[str] :rtype: List[List[str]] 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ]"""
map = {}
ret = []
for m in strs:
tmp = ''.join(sorted(m))
... | the_stack_v2_python_sparse | 算法/字母异位词分组.py | RichieSong/algorithm | train | 0 | |
286c1d1ca2ceee3f818564b1e7012d36cb15677a | [
"dummy = ListNode(-1)\ndummy.next = head\ncurrent = dummy\nwhile current.next and current.next.next:\n next_1, next_2, next_3 = (current.next, current.next.next, current.next.next.next)\n current.next = next_2\n next_2.next = next_1\n next_1.next = next_3\n current = next_1\nreturn dummy.next",
"du... | <|body_start_0|>
dummy = ListNode(-1)
dummy.next = head
current = dummy
while current.next and current.next.next:
next_1, next_2, next_3 = (current.next, current.next.next, current.next.next.next)
current.next = next_2
next_2.next = next_1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def swapPairs(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def swapPairs_v2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
def swapPairs_illegal(self, head):
""":type head: ListNode :rtype: Li... | stack_v2_sparse_classes_36k_train_013365 | 2,388 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "swapPairs",
"signature": "def swapPairs(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "swapPairs_v2",
"signature": "def swapPairs_v2(self, head)"
},
{
"docstring": ":type head: List... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def swapPairs(self, head): :type head: ListNode :rtype: ListNode
- def swapPairs_v2(self, head): :type head: ListNode :rtype: ListNode
- def swapPairs_illegal(self, head): :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def swapPairs(self, head): :type head: ListNode :rtype: ListNode
- def swapPairs_v2(self, head): :type head: ListNode :rtype: ListNode
- def swapPairs_illegal(self, head): :type ... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def swapPairs(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def swapPairs_v2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
def swapPairs_illegal(self, head):
""":type head: ListNode :rtype: Li... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def swapPairs(self, head):
""":type head: ListNode :rtype: ListNode"""
dummy = ListNode(-1)
dummy.next = head
current = dummy
while current.next and current.next.next:
next_1, next_2, next_3 = (current.next, current.next.next, current.next.next.nex... | the_stack_v2_python_sparse | src/lt_24.py | oxhead/CodingYourWay | train | 0 | |
ed41bfc5515008d62eee2b4e11ec55f39c8710c4 | [
"query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nform = AsignacionForm()\nlist_assign = None\nif query:\n list_assign = Asignacion.objects.filter(Q(server__name__icontains=query) | Q(interface__name_interface__icontains=query) | Q(client__name__icontains=query))\nelse:\n list_assign = As... | <|body_start_0|>
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
form = AsignacionForm()
list_assign = None
if query:
list_assign = Asignacion.objects.filter(Q(server__name__icontains=query) | Q(interface__name_interface__icontains=query) | Q(clien... | Clase para crear una asignacion | NewAssignView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewAssignView:
"""Clase para crear una asignacion"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query = request.GE... | stack_v2_sparse_classes_36k_train_013366 | 22,221 | no_license | [
{
"docstring": "Método get",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Método post",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005551 | Implement the Python class `NewAssignView` described below.
Class description:
Clase para crear una asignacion
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post | Implement the Python class `NewAssignView` described below.
Class description:
Clase para crear una asignacion
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Método get
- def post(self, request, *args, **kwargs): Método post
<|skeleton|>
class NewAssignView:
"""Clase para crear una ... | e28e2d968372609ad396c42fb572a00c2410a117 | <|skeleton|>
class NewAssignView:
"""Clase para crear una asignacion"""
def get(self, request, *args, **kwargs):
"""Método get"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Método post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewAssignView:
"""Clase para crear una asignacion"""
def get(self, request, *args, **kwargs):
"""Método get"""
query = request.GET.get('q')
sort = request.GET.get('sort', 'name')
form = AsignacionForm()
list_assign = None
if query:
list_assign =... | the_stack_v2_python_sparse | list/views.py | damaos/server_list2 | train | 0 |
187b3b682caf0497131f5fc1d82fe4dfea6621fd | [
"self._check()\nself.calc_derivatives(first=True)\nself.ffd_order = 1\nself.differentiator.calc_gradient()\nself.ffd_order = 0\ninputs = self.get_parameters().keys()\nobjs = self.get_objectives().keys()\nconstraints = list(self.get_eq_constraints().keys() + self.get_ineq_constraints().keys())\nself.dF = zeros((len(... | <|body_start_0|>
self._check()
self.calc_derivatives(first=True)
self.ffd_order = 1
self.differentiator.calc_gradient()
self.ffd_order = 0
inputs = self.get_parameters().keys()
objs = self.get_objectives().keys()
constraints = list(self.get_eq_constraints(... | Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plugged. Fake finite difference is supported. | SensitivityDriver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SensitivityDriver:
"""Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plu... | stack_v2_sparse_classes_36k_train_013367 | 5,240 | no_license | [
{
"docstring": "Calculate the gradient of the workflow.",
"name": "execute",
"signature": "def execute(self)"
},
{
"docstring": "Make sure we aren't missing inputs or outputs",
"name": "_check",
"signature": "def _check(self)"
}
] | 2 | null | Implement the Python class `SensitivityDriver` described below.
Class description:
Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot wher... | Implement the Python class `SensitivityDriver` described below.
Class description:
Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot wher... | 7b4d9c2804bfd84773bad6cbac37a7175f47104f | <|skeleton|>
class SensitivityDriver:
"""Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SensitivityDriver:
"""Driver to calculate the gradient of a workflow, and return it as a driver output. The gradient is calculated from all inputs (Parameters) to all outputs (Objectives and Constraints). SensitivityDriver includes a differentiator slot where the differentiation method can be plugged. Fake fi... | the_stack_v2_python_sparse | openmdao.lib/src/openmdao/lib/drivers/sensitivity.py | hschilling/OpenMDAO-Framework | train | 0 |
55411e7880092d9bf3cd6fabee5fcf03da3530a7 | [
"self._args = args\nself._kwargs = kwargs\nself._template = template\nif not self._template:\n self._template = '{asctime} {message}'",
"self._kwargs['message'] = record.message\nif '{asctime}' in self._template:\n lt = time.localtime(record.index)\n self._kwargs['asctime'] = time.strftime(self._datefmt,... | <|body_start_0|>
self._args = args
self._kwargs = kwargs
self._template = template
if not self._template:
self._template = '{asctime} {message}'
<|end_body_0|>
<|body_start_1|>
self._kwargs['message'] = record.message
if '{asctime}' in self._template:
... | Class specifying how to format a Record. | Formatter | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Formatter:
"""Class specifying how to format a Record."""
def __init__(self, template=None, *args, **kwargs):
"""Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for p... | stack_v2_sparse_classes_36k_train_013368 | 7,866 | permissive | [
{
"docstring": "Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for positional argument. **kwargs: Replacement field for keyword argument.",
"name": "__init__",
"signature": "def __init_... | 2 | null | Implement the Python class `Formatter` described below.
Class description:
Class specifying how to format a Record.
Method signatures and docstrings:
- def __init__(self, template=None, *args, **kwargs): Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwarg... | Implement the Python class `Formatter` described below.
Class description:
Class specifying how to format a Record.
Method signatures and docstrings:
- def __init__(self, template=None, *args, **kwargs): Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwarg... | e71f21b9b4b9b839f5093301974a45545dad2691 | <|skeleton|>
class Formatter:
"""Class specifying how to format a Record."""
def __init__(self, template=None, *args, **kwargs):
"""Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Formatter:
"""Class specifying how to format a Record."""
def __init__(self, template=None, *args, **kwargs):
"""Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for positional arg... | the_stack_v2_python_sparse | third_party/catapult/dashboard/dashboard/quick_logger.py | zenoalbisser/chromium | train | 0 |
6dd59181c388b9fb0a4062a04a2b39edeb4fb4e0 | [
"n_cells = len(fragile_linear_neuron_IDXs)\nif provided_cell_colors is not None:\n assert isinstance(provided_cell_colors, np.ndarray)\n assert provided_cell_colors.shape[0] == 4, f'provided_cell_colors should be a (4, n_cells) {(4, {n_cells})} array of colors but provided_cell_colors.shape: {provided_cell_co... | <|body_start_0|>
n_cells = len(fragile_linear_neuron_IDXs)
if provided_cell_colors is not None:
assert isinstance(provided_cell_colors, np.ndarray)
assert provided_cell_colors.shape[0] == 4, f'provided_cell_colors should be a (4, n_cells) {(4, {n_cells})} array of colors but prov... | An attempt to factor out the common color-related functionality from SpikeRenderingBaseMixin since this functionality is not specific to spike visualizations, for example it's needed to properly color placefields or indicate neuron identities in general. OBJECTIVE: Implement only @classmethod functions on this class. | DataSeriesColorHelpers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataSeriesColorHelpers:
"""An attempt to factor out the common color-related functionality from SpikeRenderingBaseMixin since this functionality is not specific to spike visualizations, for example it's needed to properly color placefields or indicate neuron identities in general. OBJECTIVE: Impl... | stack_v2_sparse_classes_36k_train_013369 | 6,278 | permissive | [
{
"docstring": "builds a list of pg.mkColors from the cell index id: mode: 'preserve_fragile_linear_neuron_IDXs': color is assigned based off of fragile_linear_neuron_IDX value, meaning after re-sorting the fragile_linear_neuron_IDXs the colors will appear visually different along y but will correspond to the s... | 2 | null | Implement the Python class `DataSeriesColorHelpers` described below.
Class description:
An attempt to factor out the common color-related functionality from SpikeRenderingBaseMixin since this functionality is not specific to spike visualizations, for example it's needed to properly color placefields or indicate neuron... | Implement the Python class `DataSeriesColorHelpers` described below.
Class description:
An attempt to factor out the common color-related functionality from SpikeRenderingBaseMixin since this functionality is not specific to spike visualizations, for example it's needed to properly color placefields or indicate neuron... | 212399d826284b394fce8894ff1a93133aef783f | <|skeleton|>
class DataSeriesColorHelpers:
"""An attempt to factor out the common color-related functionality from SpikeRenderingBaseMixin since this functionality is not specific to spike visualizations, for example it's needed to properly color placefields or indicate neuron identities in general. OBJECTIVE: Impl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataSeriesColorHelpers:
"""An attempt to factor out the common color-related functionality from SpikeRenderingBaseMixin since this functionality is not specific to spike visualizations, for example it's needed to properly color placefields or indicate neuron identities in general. OBJECTIVE: Implement only @c... | the_stack_v2_python_sparse | src/pyphoplacecellanalysis/General/Mixins/DataSeriesColorHelpers.py | CommanderPho/pyPhoPlaceCellAnalysis | train | 1 |
0a6288b606c944ac81a5bfbe86f16af96ece6757 | [
"cookie = set()\nhref = ''\nneed_redirect = False\nfor line in response.text.splitlines():\n line = line.strip()\n if line.startswith('Redirecting'):\n logging.debug('Redirecting with document.cookie')\n need_redirect = True\n search_result = re.search('document\\\\.cookie=\\\\\"(.*)\\\\\";',... | <|body_start_0|>
cookie = set()
href = ''
need_redirect = False
for line in response.text.splitlines():
line = line.strip()
if line.startswith('Redirecting'):
logging.debug('Redirecting with document.cookie')
need_redirect = True
... | 通过web请求形式获取release tags | HttpReleaseTagsMixin | [
"LicenseRef-scancode-mulanpsl-2.0-en",
"MulanPSL-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HttpReleaseTagsMixin:
"""通过web请求形式获取release tags"""
def get_redirect_resp(self, url, response):
"""获取重定向的url和cookie return: bool, str, list"""
<|body_0|>
def get_request_response(self, url, timeout=30, headers=None):
"""获取url请求获取response return: reponse"""
... | stack_v2_sparse_classes_36k_train_013370 | 16,868 | permissive | [
{
"docstring": "获取重定向的url和cookie return: bool, str, list",
"name": "get_redirect_resp",
"signature": "def get_redirect_resp(self, url, response)"
},
{
"docstring": "获取url请求获取response return: reponse",
"name": "get_request_response",
"signature": "def get_request_response(self, url, timeo... | 2 | stack_v2_sparse_classes_30k_train_019887 | Implement the Python class `HttpReleaseTagsMixin` described below.
Class description:
通过web请求形式获取release tags
Method signatures and docstrings:
- def get_redirect_resp(self, url, response): 获取重定向的url和cookie return: bool, str, list
- def get_request_response(self, url, timeout=30, headers=None): 获取url请求获取response retu... | Implement the Python class `HttpReleaseTagsMixin` described below.
Class description:
通过web请求形式获取release tags
Method signatures and docstrings:
- def get_redirect_resp(self, url, response): 获取重定向的url和cookie return: bool, str, list
- def get_request_response(self, url, timeout=30, headers=None): 获取url请求获取response retu... | 6b088eb29a53510eb441338804da79ad6d0623ab | <|skeleton|>
class HttpReleaseTagsMixin:
"""通过web请求形式获取release tags"""
def get_redirect_resp(self, url, response):
"""获取重定向的url和cookie return: bool, str, list"""
<|body_0|>
def get_request_response(self, url, timeout=30, headers=None):
"""获取url请求获取response return: reponse"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HttpReleaseTagsMixin:
"""通过web请求形式获取release tags"""
def get_redirect_resp(self, url, response):
"""获取重定向的url和cookie return: bool, str, list"""
cookie = set()
href = ''
need_redirect = False
for line in response.text.splitlines():
line = line.strip()
... | the_stack_v2_python_sparse | src/ac/acl/package_yaml/check_repo.py | openeuler-mirror/openeuler-jenkins | train | 2 |
395e03109bb59a39bd4e98f194fa67a8d9b68f9b | [
"super().__init__(**kwargs)\nself._model_directory = self._options['model_directory']\nself._half_precision_model = self._options.get('half_precision_model', False)\nself._model = AlbertModel.from_pretrained(self._model_directory)\nif self._half_precision_model:\n self._model = self._model.half()\nself._model = ... | <|body_start_0|>
super().__init__(**kwargs)
self._model_directory = self._options['model_directory']
self._half_precision_model = self._options.get('half_precision_model', False)
self._model = AlbertModel.from_pretrained(self._model_directory)
if self._half_precision_model:
... | ProtTrans-Albert-BFD Embedder (ProtAlbert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225 | ProtTransAlbertBFDEmbedder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtTransAlbertBFDEmbedder:
"""ProtTrans-Albert-BFD Embedder (ProtAlbert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.... | stack_v2_sparse_classes_36k_train_013371 | 1,792 | permissive | [
{
"docstring": "Initialize Albert embedder. :param model_directory: :param half_precision_model:",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Returns the CPU model",
"name": "_get_fallback_model",
"signature": "def _get_fallback_model(self) -> Albe... | 2 | stack_v2_sparse_classes_30k_train_019789 | Implement the Python class `ProtTransAlbertBFDEmbedder` described below.
Class description:
ProtTrans-Albert-BFD Embedder (ProtAlbert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06... | Implement the Python class `ProtTransAlbertBFDEmbedder` described below.
Class description:
ProtTrans-Albert-BFD Embedder (ProtAlbert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06... | efb9801f0de9b9d51d19b741088763a7d2d0c3a2 | <|skeleton|>
class ProtTransAlbertBFDEmbedder:
"""ProtTrans-Albert-BFD Embedder (ProtAlbert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProtTransAlbertBFDEmbedder:
"""ProtTrans-Albert-BFD Embedder (ProtAlbert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225"""
... | the_stack_v2_python_sparse | bio_embeddings/embed/prottrans_albert_bfd_embedder.py | sacdallago/bio_embeddings | train | 383 |
605363fec6f05317d023c7680a9dd2642346ce63 | [
"try:\n cluster_info = settings.GANETI_CLUSTER_INFO\nexcept (AttributeError, ImportError):\n return\nip, port, username, password = cluster_info\nbackend = orm.Backend.objects.create(clustername=ip, port=port, username=username, password=password)\nfor vm in orm.VirtualMachine.objects.all():\n vm.backend =... | <|body_start_0|>
try:
cluster_info = settings.GANETI_CLUSTER_INFO
except (AttributeError, ImportError):
return
ip, port, username, password = cluster_info
backend = orm.Backend.objects.create(clustername=ip, port=port, username=username, password=password)
... | Migration | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
<|body_0|>
def backwards(self, orm):
"""Write your backwards methods here."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
cluster_info = settings.GANETI_CL... | stack_v2_sparse_classes_36k_train_013372 | 9,034 | permissive | [
{
"docstring": "Write your forwards methods here.",
"name": "forwards",
"signature": "def forwards(self, orm)"
},
{
"docstring": "Write your backwards methods here.",
"name": "backwards",
"signature": "def backwards(self, orm)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017042 | Implement the Python class `Migration` described below.
Class description:
Implement the Migration class.
Method signatures and docstrings:
- def forwards(self, orm): Write your forwards methods here.
- def backwards(self, orm): Write your backwards methods here. | Implement the Python class `Migration` described below.
Class description:
Implement the Migration class.
Method signatures and docstrings:
- def forwards(self, orm): Write your forwards methods here.
- def backwards(self, orm): Write your backwards methods here.
<|skeleton|>
class Migration:
def forwards(self,... | 11e79c1c2add88c1e3dbe51e2915fb1bddd1bbf1 | <|skeleton|>
class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
<|body_0|>
def backwards(self, orm):
"""Write your backwards methods here."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Migration:
def forwards(self, orm):
"""Write your forwards methods here."""
try:
cluster_info = settings.GANETI_CLUSTER_INFO
except (AttributeError, ImportError):
return
ip, port, username, password = cluster_info
backend = orm.Backend.objects.cr... | the_stack_v2_python_sparse | snf-cyclades-app/synnefo/db/migrations/0035_default_backend.py | dimara/synnefo | train | 0 | |
7e211fd2c0414dcfea889002ba45d2d8c6c78b07 | [
"ret_data = []\nproject_query = Project.extend()\nname = self.get_argument('name', None)\nif name is not None:\n project_query = project_query.filter(Project.name == name)\nenv = self.get_argument('env', None)\nif env is not None:\n project_query = project_query.filter(TestEnvironment.name == env)\nhost = sel... | <|body_start_0|>
ret_data = []
project_query = Project.extend()
name = self.get_argument('name', None)
if name is not None:
project_query = project_query.filter(Project.name == name)
env = self.get_argument('env', None)
if env is not None:
project_... | ProjectHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectHandler:
async def get(self, *args, **kwargs):
"""项目数据查询"""
<|body_0|>
async def post(self, *args, **kwargs):
"""新增项目数据"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ret_data = []
project_query = Project.extend()
name = self... | stack_v2_sparse_classes_36k_train_013373 | 17,374 | permissive | [
{
"docstring": "项目数据查询",
"name": "get",
"signature": "async def get(self, *args, **kwargs)"
},
{
"docstring": "新增项目数据",
"name": "post",
"signature": "async def post(self, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009353 | Implement the Python class `ProjectHandler` described below.
Class description:
Implement the ProjectHandler class.
Method signatures and docstrings:
- async def get(self, *args, **kwargs): 项目数据查询
- async def post(self, *args, **kwargs): 新增项目数据 | Implement the Python class `ProjectHandler` described below.
Class description:
Implement the ProjectHandler class.
Method signatures and docstrings:
- async def get(self, *args, **kwargs): 项目数据查询
- async def post(self, *args, **kwargs): 新增项目数据
<|skeleton|>
class ProjectHandler:
async def get(self, *args, **kwa... | dc9b4c55f0b3ace180c30b7f080eb5d88bb38fdb | <|skeleton|>
class ProjectHandler:
async def get(self, *args, **kwargs):
"""项目数据查询"""
<|body_0|>
async def post(self, *args, **kwargs):
"""新增项目数据"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectHandler:
async def get(self, *args, **kwargs):
"""项目数据查询"""
ret_data = []
project_query = Project.extend()
name = self.get_argument('name', None)
if name is not None:
project_query = project_query.filter(Project.name == name)
env = self.get_ar... | the_stack_v2_python_sparse | apps/project/handlers.py | xiaoxiaolulu/MagicTestPlatform | train | 5 | |
43fe3211ab8df19c10531980f8434b516fec1a4e | [
"super().__init__()\nself.n_heads = n_heads\nself.down_kv = down_kv\nw_norm = w_norm_dispatch(w_norm)\nself.q_proj = w_norm(nn.Conv1d(C_in_q, C_qk, 1))\nself.k_proj = w_norm(nn.Conv1d(C_in_kv, C_qk, 1))\nself.v_proj = w_norm(nn.Conv1d(C_in_kv, C_v, 1))\nself.out = w_norm(nn.Conv2d(C_v, C_v, 1))\nif scale:\n self... | <|body_start_0|>
super().__init__()
self.n_heads = n_heads
self.down_kv = down_kv
w_norm = w_norm_dispatch(w_norm)
self.q_proj = w_norm(nn.Conv1d(C_in_q, C_qk, 1))
self.k_proj = w_norm(nn.Conv1d(C_in_kv, C_qk, 1))
self.v_proj = w_norm(nn.Conv1d(C_in_kv, C_v, 1))
... | Attention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attention:
def __init__(self, C_in_q, C_in_kv, C_qk, C_v, w_norm='none', scale=False, n_heads=1, down_kv=False, rel_pos_size=None):
"""Args: C_in_q: query source (encoder feature x) C_in_kv: key/value source (decoder feature y) C_qk: inner query/key dim, which should be same C_v: inner v... | stack_v2_sparse_classes_36k_train_013374 | 37,491 | no_license | [
{
"docstring": "Args: C_in_q: query source (encoder feature x) C_in_kv: key/value source (decoder feature y) C_qk: inner query/key dim, which should be same C_v: inner value dim, which same as output dim down_kv: Area attention for lightweight self-attention w/ mean pooling. rel_pos_size: height & width for rel... | 2 | stack_v2_sparse_classes_30k_test_000099 | Implement the Python class `Attention` described below.
Class description:
Implement the Attention class.
Method signatures and docstrings:
- def __init__(self, C_in_q, C_in_kv, C_qk, C_v, w_norm='none', scale=False, n_heads=1, down_kv=False, rel_pos_size=None): Args: C_in_q: query source (encoder feature x) C_in_kv:... | Implement the Python class `Attention` described below.
Class description:
Implement the Attention class.
Method signatures and docstrings:
- def __init__(self, C_in_q, C_in_kv, C_qk, C_v, w_norm='none', scale=False, n_heads=1, down_kv=False, rel_pos_size=None): Args: C_in_q: query source (encoder feature x) C_in_kv:... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class Attention:
def __init__(self, C_in_q, C_in_kv, C_qk, C_v, w_norm='none', scale=False, n_heads=1, down_kv=False, rel_pos_size=None):
"""Args: C_in_q: query source (encoder feature x) C_in_kv: key/value source (decoder feature y) C_qk: inner query/key dim, which should be same C_v: inner v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Attention:
def __init__(self, C_in_q, C_in_kv, C_qk, C_v, w_norm='none', scale=False, n_heads=1, down_kv=False, rel_pos_size=None):
"""Args: C_in_q: query source (encoder feature x) C_in_kv: key/value source (decoder feature y) C_qk: inner query/key dim, which should be same C_v: inner value dim, whic... | the_stack_v2_python_sparse | generated/test_clovaai_dmfont.py | jansel/pytorch-jit-paritybench | train | 35 | |
9361a03824c0138cb41ec7f82cabc2fc4137cdd2 | [
"dummy_head = ListNode(0)\ncurrent_node = dummy_head\nfor i in list:\n current_node.next = ListNode(i)\n current_node = current_node.next\nreturn dummy_head.next",
"curr = list\nans = []\nwhile curr:\n ans.append(curr.val)\n curr = curr.next\nreturn ans"
] | <|body_start_0|>
dummy_head = ListNode(0)
current_node = dummy_head
for i in list:
current_node.next = ListNode(i)
current_node = current_node.next
return dummy_head.next
<|end_body_0|>
<|body_start_1|>
curr = list
ans = []
while curr:
... | LinkListHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkListHelper:
def listToLinkList(self, list):
""":type list: List[int] :rtype: ListNode"""
<|body_0|>
def linkListToList(self, list):
""":type list: ListNode :rtype: List"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dummy_head = ListNode(0)
... | stack_v2_sparse_classes_36k_train_013375 | 3,744 | no_license | [
{
"docstring": ":type list: List[int] :rtype: ListNode",
"name": "listToLinkList",
"signature": "def listToLinkList(self, list)"
},
{
"docstring": ":type list: ListNode :rtype: List",
"name": "linkListToList",
"signature": "def linkListToList(self, list)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010780 | Implement the Python class `LinkListHelper` described below.
Class description:
Implement the LinkListHelper class.
Method signatures and docstrings:
- def listToLinkList(self, list): :type list: List[int] :rtype: ListNode
- def linkListToList(self, list): :type list: ListNode :rtype: List | Implement the Python class `LinkListHelper` described below.
Class description:
Implement the LinkListHelper class.
Method signatures and docstrings:
- def listToLinkList(self, list): :type list: List[int] :rtype: ListNode
- def linkListToList(self, list): :type list: ListNode :rtype: List
<|skeleton|>
class LinkLis... | a57282895fb213b68e5d81db301903721a92d80f | <|skeleton|>
class LinkListHelper:
def listToLinkList(self, list):
""":type list: List[int] :rtype: ListNode"""
<|body_0|>
def linkListToList(self, list):
""":type list: ListNode :rtype: List"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinkListHelper:
def listToLinkList(self, list):
""":type list: List[int] :rtype: ListNode"""
dummy_head = ListNode(0)
current_node = dummy_head
for i in list:
current_node.next = ListNode(i)
current_node = current_node.next
return dummy_head.next... | the_stack_v2_python_sparse | Python/helper.py | antonylu/leetcode2 | train | 0 | |
3d36bdb873ad1f95ad1d742f11b18fa1027e862f | [
"item = StockItem.objects.get(pk=1)\nself.assertEqual(StockItem.barcode_model_type(), 'stockitem')\nbarcode = item.format_barcode(brief=False)\nfor key in ['tool', 'version', 'instance', 'stockitem']:\n self.assertIn(key, barcode)\nbarcode = item.barcode\nself.assertEqual(barcode, '{\"stockitem\": 1}')",
"self... | <|body_start_0|>
item = StockItem.objects.get(pk=1)
self.assertEqual(StockItem.barcode_model_type(), 'stockitem')
barcode = item.format_barcode(brief=False)
for key in ['tool', 'version', 'instance', 'stockitem']:
self.assertIn(key, barcode)
barcode = item.barcode
... | Run barcode tests for the stock app | StockBarcodeTest | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StockBarcodeTest:
"""Run barcode tests for the stock app"""
def test_stock_item_barcode_basics(self):
"""Simple tests for the StockItem barcode integration"""
<|body_0|>
def test_location_barcode_basics(self):
"""Simple tests for the StockLocation barcode integra... | stack_v2_sparse_classes_36k_train_013376 | 40,181 | permissive | [
{
"docstring": "Simple tests for the StockItem barcode integration",
"name": "test_stock_item_barcode_basics",
"signature": "def test_stock_item_barcode_basics(self)"
},
{
"docstring": "Simple tests for the StockLocation barcode integration",
"name": "test_location_barcode_basics",
"sign... | 2 | null | Implement the Python class `StockBarcodeTest` described below.
Class description:
Run barcode tests for the stock app
Method signatures and docstrings:
- def test_stock_item_barcode_basics(self): Simple tests for the StockItem barcode integration
- def test_location_barcode_basics(self): Simple tests for the StockLoc... | Implement the Python class `StockBarcodeTest` described below.
Class description:
Run barcode tests for the stock app
Method signatures and docstrings:
- def test_stock_item_barcode_basics(self): Simple tests for the StockItem barcode integration
- def test_location_barcode_basics(self): Simple tests for the StockLoc... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class StockBarcodeTest:
"""Run barcode tests for the stock app"""
def test_stock_item_barcode_basics(self):
"""Simple tests for the StockItem barcode integration"""
<|body_0|>
def test_location_barcode_basics(self):
"""Simple tests for the StockLocation barcode integra... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StockBarcodeTest:
"""Run barcode tests for the stock app"""
def test_stock_item_barcode_basics(self):
"""Simple tests for the StockItem barcode integration"""
item = StockItem.objects.get(pk=1)
self.assertEqual(StockItem.barcode_model_type(), 'stockitem')
barcode = item.fo... | the_stack_v2_python_sparse | InvenTree/stock/tests.py | inventree/InvenTree | train | 3,077 |
c94385fb8c043eaf9d6c19c652fe808cad1639d0 | [
"app_id, handler_name, action = (int(app_id), handler_name, action)\nhandler = None\nprint(app_id, handler_name, action)\nself._app_id = app_id\nhandlers = platform_defines.get_platform_by_id(app_id)\nif handler_name in handlers:\n handler = handlers[handler_name]()\n print(handler)\nelse:\n print('handler... | <|body_start_0|>
app_id, handler_name, action = (int(app_id), handler_name, action)
handler = None
print(app_id, handler_name, action)
self._app_id = app_id
handlers = platform_defines.get_platform_by_id(app_id)
if handler_name in handlers:
handler = handlers[... | HandlerMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HandlerMixin:
def handle_request_with_process(self, app_id, handler_name, action):
"""处理app_id, action,寻找相对于的模块"""
<|body_0|>
def collect_params(self, keys):
"""从请求中获取参数"""
<|body_1|>
def on_find_handler(self, handler):
"""分发到各自的类中执行各自的方法"""
... | stack_v2_sparse_classes_36k_train_013377 | 2,344 | no_license | [
{
"docstring": "处理app_id, action,寻找相对于的模块",
"name": "handle_request_with_process",
"signature": "def handle_request_with_process(self, app_id, handler_name, action)"
},
{
"docstring": "从请求中获取参数",
"name": "collect_params",
"signature": "def collect_params(self, keys)"
},
{
"docstr... | 3 | stack_v2_sparse_classes_30k_train_011652 | Implement the Python class `HandlerMixin` described below.
Class description:
Implement the HandlerMixin class.
Method signatures and docstrings:
- def handle_request_with_process(self, app_id, handler_name, action): 处理app_id, action,寻找相对于的模块
- def collect_params(self, keys): 从请求中获取参数
- def on_find_handler(self, hand... | Implement the Python class `HandlerMixin` described below.
Class description:
Implement the HandlerMixin class.
Method signatures and docstrings:
- def handle_request_with_process(self, app_id, handler_name, action): 处理app_id, action,寻找相对于的模块
- def collect_params(self, keys): 从请求中获取参数
- def on_find_handler(self, hand... | 8b78411413aae01e7ade0eec36f37746d0e54cd4 | <|skeleton|>
class HandlerMixin:
def handle_request_with_process(self, app_id, handler_name, action):
"""处理app_id, action,寻找相对于的模块"""
<|body_0|>
def collect_params(self, keys):
"""从请求中获取参数"""
<|body_1|>
def on_find_handler(self, handler):
"""分发到各自的类中执行各自的方法"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HandlerMixin:
def handle_request_with_process(self, app_id, handler_name, action):
"""处理app_id, action,寻找相对于的模块"""
app_id, handler_name, action = (int(app_id), handler_name, action)
handler = None
print(app_id, handler_name, action)
self._app_id = app_id
handler... | the_stack_v2_python_sparse | tornado_SDK/utils/handler_mixn.py | du-debug/tornado_SDK | train | 0 | |
a6f6687be6d2707bbffe96e5d79aa2aa7cb254ad | [
"if root is None:\n return 0\nif root.left is None and root.right is None:\n return 1\nindex = 0\ncurrent = root\nwhile current.left:\n right_depth = self.find_depth(current.right)\n left_depth = self.find_depth(current.left)\n if right_depth == left_depth:\n current = current.right\n i... | <|body_start_0|>
if root is None:
return 0
if root.left is None and root.right is None:
return 1
index = 0
current = root
while current.left:
right_depth = self.find_depth(current.right)
left_depth = self.find_depth(current.left)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countNodes(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def find_depth(self, node):
""":type node: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
return 0
if ... | stack_v2_sparse_classes_36k_train_013378 | 2,821 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "countNodes",
"signature": "def countNodes(self, root)"
},
{
"docstring": ":type node: TreeNode :rtype: int",
"name": "find_depth",
"signature": "def find_depth(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018002 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root): :type root: TreeNode :rtype: int
- def find_depth(self, node): :type node: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root): :type root: TreeNode :rtype: int
- def find_depth(self, node): :type node: TreeNode :rtype: int
<|skeleton|>
class Solution:
def countNodes(self... | f832227c4d0e0b1c0cc326561187004ef24e2a68 | <|skeleton|>
class Solution:
def countNodes(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def find_depth(self, node):
""":type node: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def countNodes(self, root):
""":type root: TreeNode :rtype: int"""
if root is None:
return 0
if root.left is None and root.right is None:
return 1
index = 0
current = root
while current.left:
right_depth = self.find_... | the_stack_v2_python_sparse | 222.py | Gackle/leetcode_practice | train | 0 | |
d9308740213e815b4e7a8b68d07333844a9dbc01 | [
"self.API_KEY = api_key\nself.API_CURRENT = api_current\nself.API_FORECAST = api_forecast",
"payloadCurrent = {'lat': str(lat), 'lon': str(lon), 'key': self.API_KEY}\ntry:\n r = requests.get(self.API_CURRENT, payloadCurrent)\n if r.status_code != 200:\n print('not successfull status code: ', r.status... | <|body_start_0|>
self.API_KEY = api_key
self.API_CURRENT = api_current
self.API_FORECAST = api_forecast
<|end_body_0|>
<|body_start_1|>
payloadCurrent = {'lat': str(lat), 'lon': str(lon), 'key': self.API_KEY}
try:
r = requests.get(self.API_CURRENT, payloadCurrent)
... | WeatherAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeatherAPI:
def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?'):
"""inits weather request class"""
<|body_0|>
def getCurrent(self, lat, lon):
... | stack_v2_sparse_classes_36k_train_013379 | 4,531 | permissive | [
{
"docstring": "inits weather request class",
"name": "__init__",
"signature": "def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?')"
},
{
"docstring": "queries the api... | 3 | stack_v2_sparse_classes_30k_train_011867 | Implement the Python class `WeatherAPI` described below.
Class description:
Implement the WeatherAPI class.
Method signatures and docstrings:
- def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hou... | Implement the Python class `WeatherAPI` described below.
Class description:
Implement the WeatherAPI class.
Method signatures and docstrings:
- def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hou... | 7e80b4f3af17959e75a61ac5a5f9c31805ce46dd | <|skeleton|>
class WeatherAPI:
def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?'):
"""inits weather request class"""
<|body_0|>
def getCurrent(self, lat, lon):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WeatherAPI:
def __init__(self, api_key='3d34a9a9b0e544269a3ddbb97ec89ba7', api_current='https://api.weatherbit.io/v2.0/current', api_forecast='https://api.weatherbit.io/v2.0/forecast/hourly?'):
"""inits weather request class"""
self.API_KEY = api_key
self.API_CURRENT = api_current
... | the_stack_v2_python_sparse | backend/weather/weather_api.py | DinoSubbu/SmartEnergyManagementSystem | train | 0 | |
d11acb2ab8e44adc620e24038b42e5e5e736ba2b | [
"super().__init__()\nself.setFixedSize(340, 250)\nself.setWindowIcon(QIcon('src/devcuentasclaras/recursos/smallLogo.png'))\nself.setWindowTitle('Añadir viajeros a actividad')\nself.resultado = ''\nself.widget_dialogo = QListWidget()\nself.distribuidor_dialogo = QGridLayout()\nself.setLayout(self.distribuidor_dialog... | <|body_start_0|>
super().__init__()
self.setFixedSize(340, 250)
self.setWindowIcon(QIcon('src/devcuentasclaras/recursos/smallLogo.png'))
self.setWindowTitle('Añadir viajeros a actividad')
self.resultado = ''
self.widget_dialogo = QListWidget()
self.distribuidor_di... | Dialogo_agregar_viajeros | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dialogo_agregar_viajeros:
def __init__(self):
"""Constructor del diálogo"""
<|body_0|>
def mostrar_viajeros(self, viajeros):
"""Esta función muestra los viajeros en la tabla"""
<|body_1|>
def guardar(self):
"""Esta función envía la información de... | stack_v2_sparse_classes_36k_train_013380 | 3,377 | permissive | [
{
"docstring": "Constructor del diálogo",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Esta función muestra los viajeros en la tabla",
"name": "mostrar_viajeros",
"signature": "def mostrar_viajeros(self, viajeros)"
},
{
"docstring": "Esta función envía... | 4 | stack_v2_sparse_classes_30k_train_003933 | Implement the Python class `Dialogo_agregar_viajeros` described below.
Class description:
Implement the Dialogo_agregar_viajeros class.
Method signatures and docstrings:
- def __init__(self): Constructor del diálogo
- def mostrar_viajeros(self, viajeros): Esta función muestra los viajeros en la tabla
- def guardar(se... | Implement the Python class `Dialogo_agregar_viajeros` described below.
Class description:
Implement the Dialogo_agregar_viajeros class.
Method signatures and docstrings:
- def __init__(self): Constructor del diálogo
- def mostrar_viajeros(self, viajeros): Esta función muestra los viajeros en la tabla
- def guardar(se... | 27dcd9b17315b8a90f1adb94a107abfb14525025 | <|skeleton|>
class Dialogo_agregar_viajeros:
def __init__(self):
"""Constructor del diálogo"""
<|body_0|>
def mostrar_viajeros(self, viajeros):
"""Esta función muestra los viajeros en la tabla"""
<|body_1|>
def guardar(self):
"""Esta función envía la información de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dialogo_agregar_viajeros:
def __init__(self):
"""Constructor del diálogo"""
super().__init__()
self.setFixedSize(340, 250)
self.setWindowIcon(QIcon('src/devcuentasclaras/recursos/smallLogo.png'))
self.setWindowTitle('Añadir viajeros a actividad')
self.resultado ... | the_stack_v2_python_sparse | src/vista/Vista_agregar_viajero.py | ManuelMasferrer/MISW4101-202111-Grupo57-sandbox | train | 0 | |
97c8f9bf93a7fb14a83ce34d692cfce38d97cca4 | [
"self.entry_id = entry_id\nself.entry_markers = entry_markers\nself._idgen = IDGenerator('LX')\nself._idset = set()\nself.entries = sfm.SFM()",
"new_entry, rest = split_by_pred(lambda pair: pair[0] in self.entry_markers, entry, constructor=sfm.Entry)\nif not new_entry:\n return False\noriginal_id = entry.get(s... | <|body_start_0|>
self.entry_id = entry_id
self.entry_markers = entry_markers
self._idgen = IDGenerator('LX')
self._idset = set()
self.entries = sfm.SFM()
<|end_body_0|>
<|body_start_1|>
new_entry, rest = split_by_pred(lambda pair: pair[0] in self.entry_markers, entry, co... | Visitor for extracting Entry information from an SFM entry. | EntryExtractor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntryExtractor:
"""Visitor for extracting Entry information from an SFM entry."""
def __init__(self, entry_id, entry_markers):
"""Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry... | stack_v2_sparse_classes_36k_train_013381 | 44,273 | permissive | [
{
"docstring": "Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry (as opposed to a sense or an example)",
"name": "__init__",
"signature": "def __init__(self, entry_id, entry_markers)"
},
{
"... | 2 | stack_v2_sparse_classes_30k_train_010477 | Implement the Python class `EntryExtractor` described below.
Class description:
Visitor for extracting Entry information from an SFM entry.
Method signatures and docstrings:
- def __init__(self, entry_id, entry_markers): Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg ent... | Implement the Python class `EntryExtractor` described below.
Class description:
Visitor for extracting Entry information from an SFM entry.
Method signatures and docstrings:
- def __init__(self, entry_id, entry_markers): Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg ent... | 9fcb35608ab7ce0df3f02a88aba893ce3920e48a | <|skeleton|>
class EntryExtractor:
"""Visitor for extracting Entry information from an SFM entry."""
def __init__(self, entry_id, entry_markers):
"""Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EntryExtractor:
"""Visitor for extracting Entry information from an SFM entry."""
def __init__(self, entry_id, entry_markers):
"""Create an entry extractor. :arg entry_id: marker, which contains the entry's original ID :arg entry_markers: collection of markers, which make up an entry (as opposed ... | the_stack_v2_python_sparse | src/pydictionaria/sfm2cldf.py | dictionaria/pydictionaria | train | 1 |
366ee082bf2e77b2a20dd99b7e2885ca3111e68a | [
"self.is_system_defined = is_system_defined\nself.name = name\nself.pattern = pattern\nself.pattern_type = pattern_type",
"if dictionary is None:\n return None\nis_system_defined = dictionary.get('isSystemDefined')\nname = dictionary.get('name')\npattern = dictionary.get('pattern')\npattern_type = dictionary.g... | <|body_start_0|>
self.is_system_defined = is_system_defined
self.name = name
self.pattern = pattern
self.pattern_type = pattern_type
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
is_system_defined = dictionary.get('isSystemDefined')
... | Implementation of the 'SupportedPattern' model. Specifies details of the pattern available for search available in an application such as Pattern Finder within Analytics Work Bench. Attributes: is_system_defined (bool): Specifies whether the pattern has been defined by the system or the user. name (string): Specifies t... | SupportedPattern | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SupportedPattern:
"""Implementation of the 'SupportedPattern' model. Specifies details of the pattern available for search available in an application such as Pattern Finder within Analytics Work Bench. Attributes: is_system_defined (bool): Specifies whether the pattern has been defined by the sy... | stack_v2_sparse_classes_36k_train_013382 | 2,430 | permissive | [
{
"docstring": "Constructor for the SupportedPattern class",
"name": "__init__",
"signature": "def __init__(self, is_system_defined=None, name=None, pattern=None, pattern_type=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionar... | 2 | stack_v2_sparse_classes_30k_val_000999 | Implement the Python class `SupportedPattern` described below.
Class description:
Implementation of the 'SupportedPattern' model. Specifies details of the pattern available for search available in an application such as Pattern Finder within Analytics Work Bench. Attributes: is_system_defined (bool): Specifies whether... | Implement the Python class `SupportedPattern` described below.
Class description:
Implementation of the 'SupportedPattern' model. Specifies details of the pattern available for search available in an application such as Pattern Finder within Analytics Work Bench. Attributes: is_system_defined (bool): Specifies whether... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SupportedPattern:
"""Implementation of the 'SupportedPattern' model. Specifies details of the pattern available for search available in an application such as Pattern Finder within Analytics Work Bench. Attributes: is_system_defined (bool): Specifies whether the pattern has been defined by the sy... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SupportedPattern:
"""Implementation of the 'SupportedPattern' model. Specifies details of the pattern available for search available in an application such as Pattern Finder within Analytics Work Bench. Attributes: is_system_defined (bool): Specifies whether the pattern has been defined by the system or the u... | the_stack_v2_python_sparse | cohesity_management_sdk/models/supported_pattern.py | cohesity/management-sdk-python | train | 24 |
a48acbc7352754a229a735cdc0859ee820ee5af6 | [
"code = request.GET.get('code')\nweapp = WeApp()\ndata = weapp.get_session_key(code)\nopenid = data.get('openid', None)\nif not openid:\n return Response(data)\nitem = WeixinUnionID.objects.filter(app_key=settings.WEAPP_APPID, openid=openid).first()\nunionid = item.unionid if item else ''\nif unionid:\n custo... | <|body_start_0|>
code = request.GET.get('code')
weapp = WeApp()
data = weapp.get_session_key(code)
openid = data.get('openid', None)
if not openid:
return Response(data)
item = WeixinUnionID.objects.filter(app_key=settings.WEAPP_APPID, openid=openid).first()
... | WeAppViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeAppViewSet:
def login(self, request, *args, **kwargs):
"""GET /rest/v2/weapp/login params: - code return: { 'session': 'xxxxx' } code 换取 session_key"""
<|body_0|>
def post_user_info(self, request, *args, **kwargs):
"""POST /rest/v2/weapp/user_info params: - encrypt... | stack_v2_sparse_classes_36k_train_013383 | 4,739 | no_license | [
{
"docstring": "GET /rest/v2/weapp/login params: - code return: { 'session': 'xxxxx' } code 换取 session_key",
"name": "login",
"signature": "def login(self, request, *args, **kwargs)"
},
{
"docstring": "POST /rest/v2/weapp/user_info params: - encryptedData - rawData - iv - token return: { 'code':... | 2 | null | Implement the Python class `WeAppViewSet` described below.
Class description:
Implement the WeAppViewSet class.
Method signatures and docstrings:
- def login(self, request, *args, **kwargs): GET /rest/v2/weapp/login params: - code return: { 'session': 'xxxxx' } code 换取 session_key
- def post_user_info(self, request, ... | Implement the Python class `WeAppViewSet` described below.
Class description:
Implement the WeAppViewSet class.
Method signatures and docstrings:
- def login(self, request, *args, **kwargs): GET /rest/v2/weapp/login params: - code return: { 'session': 'xxxxx' } code 换取 session_key
- def post_user_info(self, request, ... | be58dc8f1f0630d3a04e551911f66d9091bedc45 | <|skeleton|>
class WeAppViewSet:
def login(self, request, *args, **kwargs):
"""GET /rest/v2/weapp/login params: - code return: { 'session': 'xxxxx' } code 换取 session_key"""
<|body_0|>
def post_user_info(self, request, *args, **kwargs):
"""POST /rest/v2/weapp/user_info params: - encrypt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WeAppViewSet:
def login(self, request, *args, **kwargs):
"""GET /rest/v2/weapp/login params: - code return: { 'session': 'xxxxx' } code 换取 session_key"""
code = request.GET.get('code')
weapp = WeApp()
data = weapp.get_session_key(code)
openid = data.get('openid', None)
... | the_stack_v2_python_sparse | flashsale/restpro/v2/views/weapp.py | nidepuzi/ndpuzsys | train | 1 | |
1092262d6650b07022991495585ded93e2681234 | [
"visited = set()\nnodeA, nodeB = (headA, headB)\nwhile nodeA:\n visited.add(nodeA)\n nodeA = nodeA.next\nwhile nodeB:\n if nodeB in visited:\n return nodeB\n nodeB = nodeB.next\nreturn None",
"node_a, node_b = (headA, headB)\nwhile node_a != node_b:\n node_a = node_a.next if node_a else head... | <|body_start_0|>
visited = set()
nodeA, nodeB = (headA, headB)
while nodeA:
visited.add(nodeA)
nodeA = nodeA.next
while nodeB:
if nodeB in visited:
return nodeB
nodeB = nodeB.next
return None
<|end_body_0|>
<|body_s... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode2(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_013384 | 923 | permissive | [
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA, headB)"
},
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode2",
"signature": "def getIntersectionNo... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li... | c8bf33af30569177c5276ffcd72a8d93ba4c402a | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode2(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
visited = set()
nodeA, nodeB = (headA, headB)
while nodeA:
visited.add(nodeA)
nodeA = nodeA.next
while nodeB:
if nodeB in visit... | the_stack_v2_python_sparse | 101-200/151-160/160-intersectionOfLinkedList/intersectionOfLinkedList.py | xuychen/Leetcode | train | 0 | |
95f84fd12c584fdd90fb54d9f5b193c0c61bb680 | [
"try:\n return World.objects.get(id=id)\nexcept World.DoesNotExist:\n raise NotFound('World with specified ID does not exist')",
"world = self.get_object(id)\nserializer = WorldSerializer(world)\nreturn Response(serializer.data)"
] | <|body_start_0|>
try:
return World.objects.get(id=id)
except World.DoesNotExist:
raise NotFound('World with specified ID does not exist')
<|end_body_0|>
<|body_start_1|>
world = self.get_object(id)
serializer = WorldSerializer(world)
return Response(seria... | API endpoint to get details of specific World. Requests handled: GET | WorldDetails | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorldDetails:
"""API endpoint to get details of specific World. Requests handled: GET"""
def get_object(self, id):
"""Method to retrieve a World object. :param id: Id of World object to retrieve :return: World if Id exists :raises: NotFound if Id does not exist"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_013385 | 30,034 | no_license | [
{
"docstring": "Method to retrieve a World object. :param id: Id of World object to retrieve :return: World if Id exists :raises: NotFound if Id does not exist",
"name": "get_object",
"signature": "def get_object(self, id)"
},
{
"docstring": "GET request handler. :param id: Id of World object to... | 2 | stack_v2_sparse_classes_30k_train_012122 | Implement the Python class `WorldDetails` described below.
Class description:
API endpoint to get details of specific World. Requests handled: GET
Method signatures and docstrings:
- def get_object(self, id): Method to retrieve a World object. :param id: Id of World object to retrieve :return: World if Id exists :rai... | Implement the Python class `WorldDetails` described below.
Class description:
API endpoint to get details of specific World. Requests handled: GET
Method signatures and docstrings:
- def get_object(self, id): Method to retrieve a World object. :param id: Id of World object to retrieve :return: World if Id exists :rai... | ea0e59de38505beba3b490a3b107f884b35986fd | <|skeleton|>
class WorldDetails:
"""API endpoint to get details of specific World. Requests handled: GET"""
def get_object(self, id):
"""Method to retrieve a World object. :param id: Id of World object to retrieve :return: World if Id exists :raises: NotFound if Id does not exist"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorldDetails:
"""API endpoint to get details of specific World. Requests handled: GET"""
def get_object(self, id):
"""Method to retrieve a World object. :param id: Id of World object to retrieve :return: World if Id exists :raises: NotFound if Id does not exist"""
try:
return ... | the_stack_v2_python_sparse | main/views.py | weixingp/slay-the-software-backend | train | 0 |
3eed21aec893d147fa163ab90677c1d13ca81647 | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), name=name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password, name=name)\nuser.is_admin = True\nuser.save(using=self... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email), name=name)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.c... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, name, password=None):
"""Creates and saves a User with the given email, name and password."""
<|body_0|>
def create_superuser(self, email, name, password):
"""Creates and saves a superuser with the given email, date of birt... | stack_v2_sparse_classes_36k_train_013386 | 2,456 | no_license | [
{
"docstring": "Creates and saves a User with the given email, name and password.",
"name": "create_user",
"signature": "def create_user(self, email, name, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"name": "create_sup... | 2 | stack_v2_sparse_classes_30k_train_001607 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, name, password=None): Creates and saves a User with the given email, name and password.
- def create_superuser(self, email, name, password)... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, name, password=None): Creates and saves a User with the given email, name and password.
- def create_superuser(self, email, name, password)... | 3c02098163611eaa4a21994cded89912794b9338 | <|skeleton|>
class MyUserManager:
def create_user(self, email, name, password=None):
"""Creates and saves a User with the given email, name and password."""
<|body_0|>
def create_superuser(self, email, name, password):
"""Creates and saves a superuser with the given email, date of birt... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyUserManager:
def create_user(self, email, name, password=None):
"""Creates and saves a User with the given email, name and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email), name=name)
... | the_stack_v2_python_sparse | stark/Wolf/models.py | sunjiebin/s12 | train | 0 | |
04555868e0c65265ee21e940efd545695718a2a5 | [
"self.LibAppCipher = LibAppCipher()\nself.LibVar = LibVar()\nself.PROTOCOL = self.LibVar.get_var(protocol)\nself.HOST = self.LibVar.get_var(host)\nself.PORT = self.LibVar.get_var(port)\nself.BASEPATH = self.LibVar.get_var(basepath)\nself.GO_CLIENT_HEADER = self.LibVar.get_var(clientHeader)\nself.TIMEOUT = self.LibV... | <|body_start_0|>
self.LibAppCipher = LibAppCipher()
self.LibVar = LibVar()
self.PROTOCOL = self.LibVar.get_var(protocol)
self.HOST = self.LibVar.get_var(host)
self.PORT = self.LibVar.get_var(port)
self.BASEPATH = self.LibVar.get_var(basepath)
self.GO_CLIENT_HEADER... | _init_ | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _init_:
def __init__(self, protocol='PROTOCOL', host='DATAPLATFORM_STG_HOST', port='DATAPLATFORM_STG_PORT', basepath='DATAPLATFORM_BASEPATH', clientHeader='GO_CLIENT_HEADER', timeout='API_TIMEOUT'):
"""usage: __dirname = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.... | stack_v2_sparse_classes_36k_train_013387 | 5,058 | no_license | [
{
"docstring": "usage: __dirname = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(__dirname, '../../lib')) from _init_ import _init_ self.init = _init_() Note: -default host is `DATAPLATFORM_STG_HOST` and basepath is `/go-platform/v1` if need to use other host, please follow below examp... | 3 | null | Implement the Python class `_init_` described below.
Class description:
Implement the _init_ class.
Method signatures and docstrings:
- def __init__(self, protocol='PROTOCOL', host='DATAPLATFORM_STG_HOST', port='DATAPLATFORM_STG_PORT', basepath='DATAPLATFORM_BASEPATH', clientHeader='GO_CLIENT_HEADER', timeout='API_TI... | Implement the Python class `_init_` described below.
Class description:
Implement the _init_ class.
Method signatures and docstrings:
- def __init__(self, protocol='PROTOCOL', host='DATAPLATFORM_STG_HOST', port='DATAPLATFORM_STG_PORT', basepath='DATAPLATFORM_BASEPATH', clientHeader='GO_CLIENT_HEADER', timeout='API_TI... | 31c29cc9a9b3f5a4b2c2b721a33df04c52b9d80a | <|skeleton|>
class _init_:
def __init__(self, protocol='PROTOCOL', host='DATAPLATFORM_STG_HOST', port='DATAPLATFORM_STG_PORT', basepath='DATAPLATFORM_BASEPATH', clientHeader='GO_CLIENT_HEADER', timeout='API_TIMEOUT'):
"""usage: __dirname = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _init_:
def __init__(self, protocol='PROTOCOL', host='DATAPLATFORM_STG_HOST', port='DATAPLATFORM_STG_PORT', basepath='DATAPLATFORM_BASEPATH', clientHeader='GO_CLIENT_HEADER', timeout='API_TIMEOUT'):
"""usage: __dirname = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(__dirname... | the_stack_v2_python_sparse | dataPlatform/go_platform/api/_init_.py | petercheng168/My-account-automation | train | 0 | |
9668b28e0c7fe3e60959dab2a17ca53bc4762273 | [
"n = len(seats)\nL = [float('inf') for _ in range(n)]\nR = [float('inf') for _ in range(n)]\nfor i in range(n):\n if seats[i] == 1:\n L[i] = 0\n elif i - 1 >= 0:\n L[i] = L[i - 1] + 1\nfor i in range(n - 1, -1, -1):\n if seats[i] == 1:\n R[i] = 0\n elif i + 1 < n:\n R[i] = R[... | <|body_start_0|>
n = len(seats)
L = [float('inf') for _ in range(n)]
R = [float('inf') for _ in range(n)]
for i in range(n):
if seats[i] == 1:
L[i] = 0
elif i - 1 >= 0:
L[i] = L[i - 1] + 1
for i in range(n - 1, -1, -1):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDistToClosest(self, seats: List[int]) -> int:
"""DP from left and right - next array Let L[i] be the distant to the left 1 at A[i] Let R[i] ..."""
<|body_0|>
def maxDistToClosest2(self, seats: List[int]) -> int:
"""maintain a sorrted index array"""
... | stack_v2_sparse_classes_36k_train_013388 | 2,432 | no_license | [
{
"docstring": "DP from left and right - next array Let L[i] be the distant to the left 1 at A[i] Let R[i] ...",
"name": "maxDistToClosest",
"signature": "def maxDistToClosest(self, seats: List[int]) -> int"
},
{
"docstring": "maintain a sorrted index array",
"name": "maxDistToClosest2",
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistToClosest(self, seats: List[int]) -> int: DP from left and right - next array Let L[i] be the distant to the left 1 at A[i] Let R[i] ...
- def maxDistToClosest2(self, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDistToClosest(self, seats: List[int]) -> int: DP from left and right - next array Let L[i] be the distant to the left 1 at A[i] Let R[i] ...
- def maxDistToClosest2(self, ... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def maxDistToClosest(self, seats: List[int]) -> int:
"""DP from left and right - next array Let L[i] be the distant to the left 1 at A[i] Let R[i] ..."""
<|body_0|>
def maxDistToClosest2(self, seats: List[int]) -> int:
"""maintain a sorrted index array"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDistToClosest(self, seats: List[int]) -> int:
"""DP from left and right - next array Let L[i] be the distant to the left 1 at A[i] Let R[i] ..."""
n = len(seats)
L = [float('inf') for _ in range(n)]
R = [float('inf') for _ in range(n)]
for i in range(n)... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/849 Maximize Distance to Closest Person.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
f8a3f206df0fba86bc32cd786895e0eeddaf0459 | [
"hosts = list(self._client.list())\nif check:\n assert_that(hosts, is_not(empty()))\nreturn hosts",
"hosts = self.get_hosts()\nif name:\n hosts = [host for host in hosts if host.host_name == name]\nif fqdn:\n hosts = [host for host in hosts if fqdn.startswith(host.host_name)]\nif check:\n assert_that(... | <|body_start_0|>
hosts = list(self._client.list())
if check:
assert_that(hosts, is_not(empty()))
return hosts
<|end_body_0|>
<|body_start_1|>
hosts = self.get_hosts()
if name:
hosts = [host for host in hosts if host.host_name == name]
if fqdn:
... | Host steps. | HostSteps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostSteps:
"""Host steps."""
def get_hosts(self, check=True):
"""Step to get hosts. Args: check (bool, optional): flag whether to check step or not Returns: list: list of hosts objects Raises: AssertionError: if hosts list is empty"""
<|body_0|>
def get_host(self, name=N... | stack_v2_sparse_classes_36k_train_013389 | 5,344 | no_license | [
{
"docstring": "Step to get hosts. Args: check (bool, optional): flag whether to check step or not Returns: list: list of hosts objects Raises: AssertionError: if hosts list is empty",
"name": "get_hosts",
"signature": "def get_hosts(self, check=True)"
},
{
"docstring": "Step to get host by name... | 4 | null | Implement the Python class `HostSteps` described below.
Class description:
Host steps.
Method signatures and docstrings:
- def get_hosts(self, check=True): Step to get hosts. Args: check (bool, optional): flag whether to check step or not Returns: list: list of hosts objects Raises: AssertionError: if hosts list is e... | Implement the Python class `HostSteps` described below.
Class description:
Host steps.
Method signatures and docstrings:
- def get_hosts(self, check=True): Step to get hosts. Args: check (bool, optional): flag whether to check step or not Returns: list: list of hosts objects Raises: AssertionError: if hosts list is e... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class HostSteps:
"""Host steps."""
def get_hosts(self, check=True):
"""Step to get hosts. Args: check (bool, optional): flag whether to check step or not Returns: list: list of hosts objects Raises: AssertionError: if hosts list is empty"""
<|body_0|>
def get_host(self, name=N... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HostSteps:
"""Host steps."""
def get_hosts(self, check=True):
"""Step to get hosts. Args: check (bool, optional): flag whether to check step or not Returns: list: list of hosts objects Raises: AssertionError: if hosts list is empty"""
hosts = list(self._client.list())
if check:
... | the_stack_v2_python_sparse | stepler/nova/steps/hosts.py | Mirantis/stepler | train | 16 |
3e153621eedfdd7f06ba7d76dd462f228386aa12 | [
"self.apt = aperture\nself.width = aperture.get_max_width()\nself.length = length\nself.lmbda = wavelength\nself.scr = numpy.zeros((5, self.width))\nself.field = numpy.zeros((self.length, self.width))",
"for i in range(self.width):\n for j in range(self.length):\n for u in range(self.width):\n ... | <|body_start_0|>
self.apt = aperture
self.width = aperture.get_max_width()
self.length = length
self.lmbda = wavelength
self.scr = numpy.zeros((5, self.width))
self.field = numpy.zeros((self.length, self.width))
<|end_body_0|>
<|body_start_1|>
for i in range(self... | Fraunhofer1D | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fraunhofer1D:
def __init__(self, aperture, length, wavelength):
"""Initialize the Fraunhofer algorithm with an aperture, total length, and wavelength of monochromatic plane waves."""
<|body_0|>
def run(self):
"""Run the manual integration over the aperture and every ... | stack_v2_sparse_classes_36k_train_013390 | 3,483 | no_license | [
{
"docstring": "Initialize the Fraunhofer algorithm with an aperture, total length, and wavelength of monochromatic plane waves.",
"name": "__init__",
"signature": "def __init__(self, aperture, length, wavelength)"
},
{
"docstring": "Run the manual integration over the aperture and every point o... | 3 | stack_v2_sparse_classes_30k_train_008077 | Implement the Python class `Fraunhofer1D` described below.
Class description:
Implement the Fraunhofer1D class.
Method signatures and docstrings:
- def __init__(self, aperture, length, wavelength): Initialize the Fraunhofer algorithm with an aperture, total length, and wavelength of monochromatic plane waves.
- def r... | Implement the Python class `Fraunhofer1D` described below.
Class description:
Implement the Fraunhofer1D class.
Method signatures and docstrings:
- def __init__(self, aperture, length, wavelength): Initialize the Fraunhofer algorithm with an aperture, total length, and wavelength of monochromatic plane waves.
- def r... | 3f73502c0d81c99de5f195ca7ddb6c071081c30c | <|skeleton|>
class Fraunhofer1D:
def __init__(self, aperture, length, wavelength):
"""Initialize the Fraunhofer algorithm with an aperture, total length, and wavelength of monochromatic plane waves."""
<|body_0|>
def run(self):
"""Run the manual integration over the aperture and every ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fraunhofer1D:
def __init__(self, aperture, length, wavelength):
"""Initialize the Fraunhofer algorithm with an aperture, total length, and wavelength of monochromatic plane waves."""
self.apt = aperture
self.width = aperture.get_max_width()
self.length = length
self.lmb... | the_stack_v2_python_sparse | camera/diffraction.py | wesleybowman/honours | train | 0 | |
05752f2fc762a53683dc6d7562d98c4f57b2193f | [
"self.pool = nums\nself.size = len(self.pool)\nself.k = k\nheapq.heapify(self.pool)\nwhile self.size > k:\n heapq.heappop(self.pool)\n self.size -= 1",
"if self.size < self.k:\n heapq.heappush(self.pool, val)\n self.size += 1\nelif val > self.pool[0]:\n heapq.heapreplace(self.pool, val)\nreturn sel... | <|body_start_0|>
self.pool = nums
self.size = len(self.pool)
self.k = k
heapq.heapify(self.pool)
while self.size > k:
heapq.heappop(self.pool)
self.size -= 1
<|end_body_0|>
<|body_start_1|>
if self.size < self.k:
heapq.heappush(self.po... | KthLargest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.pool = nums
self.size = len(self.pool)
... | stack_v2_sparse_classes_36k_train_013391 | 949 | permissive | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012041 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 92156e4b48ba19e3f02e4286b9f733e9769a1dee | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.pool = nums
self.size = len(self.pool)
self.k = k
heapq.heapify(self.pool)
while self.size > k:
heapq.heappop(self.pool)
self.size -= 1
def add(se... | the_stack_v2_python_sparse | src/Python/701-800/703.KthLargest.py | AveryHuo/PeefyLeetCode | train | 0 | |
6ff7792f69a1898b65fd697cd4ab6587985b835c | [
"reports = IngressReports.objects.filter()\nserializer = IngressReportsSerializer(reports, many=True)\npaginator = ListPaginator(serializer.data, request)\nreturn paginator.get_paginated_response(serializer.data)",
"source_uuid = request.data.get('source')\nsource_id = request.data.get('source')\ntry:\n source... | <|body_start_0|>
reports = IngressReports.objects.filter()
serializer = IngressReportsSerializer(reports, many=True)
paginator = ListPaginator(serializer.data, request)
return paginator.get_paginated_response(serializer.data)
<|end_body_0|>
<|body_start_1|>
source_uuid = request... | View to interact with settings for a customer. | IngressReportsView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IngressReportsView:
"""View to interact with settings for a customer."""
def get(self, request, *args, **kwargs):
"""Return list of sources."""
<|body_0|>
def post(self, request):
"""Handle posted reports."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_013392 | 3,418 | permissive | [
{
"docstring": "Return list of sources.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Handle posted reports.",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008745 | Implement the Python class `IngressReportsView` described below.
Class description:
View to interact with settings for a customer.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Return list of sources.
- def post(self, request): Handle posted reports. | Implement the Python class `IngressReportsView` described below.
Class description:
View to interact with settings for a customer.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Return list of sources.
- def post(self, request): Handle posted reports.
<|skeleton|>
class IngressReportsVi... | 0416e5216eb1ec4b41c8dd4999adde218b1ab2e1 | <|skeleton|>
class IngressReportsView:
"""View to interact with settings for a customer."""
def get(self, request, *args, **kwargs):
"""Return list of sources."""
<|body_0|>
def post(self, request):
"""Handle posted reports."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IngressReportsView:
"""View to interact with settings for a customer."""
def get(self, request, *args, **kwargs):
"""Return list of sources."""
reports = IngressReports.objects.filter()
serializer = IngressReportsSerializer(reports, many=True)
paginator = ListPaginator(ser... | the_stack_v2_python_sparse | koku/api/ingress/reports/view.py | project-koku/koku | train | 225 |
c5025d43ca88ee904ea5472ae1746d2f0a2e9134 | [
"super().__init__()\nassert use_masking != use_weighted_masking or not use_masking\nself.use_masking = use_masking\nself.use_weighted_masking = use_weighted_masking\nreduction = 'none' if self.use_weighted_masking else 'mean'\nself.l1_criterion = nn.L1Loss(reduction=reduction)\nself.mse_criterion = nn.MSELoss(reduc... | <|body_start_0|>
super().__init__()
assert use_masking != use_weighted_masking or not use_masking
self.use_masking = use_masking
self.use_weighted_masking = use_weighted_masking
reduction = 'none' if self.use_weighted_masking else 'mean'
self.l1_criterion = nn.L1Loss(redu... | Loss function module for Tacotron2. | TransformerTTSLoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerTTSLoss:
"""Loss function module for Tacotron2."""
def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=5.0):
"""Initialize Tactoron2 loss module. Parameters ---------- use_masking : bool Whether to apply masking for padded part in loss calculati... | stack_v2_sparse_classes_36k_train_013393 | 40,721 | permissive | [
{
"docstring": "Initialize Tactoron2 loss module. Parameters ---------- use_masking : bool Whether to apply masking for padded part in loss calculation. use_weighted_masking : bool Whether to apply weighted masking in loss calculation. bce_pos_weight : float Weight of positive sample of stop token.",
"name"... | 2 | null | Implement the Python class `TransformerTTSLoss` described below.
Class description:
Loss function module for Tacotron2.
Method signatures and docstrings:
- def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=5.0): Initialize Tactoron2 loss module. Parameters ---------- use_masking : bool W... | Implement the Python class `TransformerTTSLoss` described below.
Class description:
Loss function module for Tacotron2.
Method signatures and docstrings:
- def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=5.0): Initialize Tactoron2 loss module. Parameters ---------- use_masking : bool W... | 8705a2a8405e3c63f2174d69880d2b5525a6c9fd | <|skeleton|>
class TransformerTTSLoss:
"""Loss function module for Tacotron2."""
def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=5.0):
"""Initialize Tactoron2 loss module. Parameters ---------- use_masking : bool Whether to apply masking for padded part in loss calculati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransformerTTSLoss:
"""Loss function module for Tacotron2."""
def __init__(self, use_masking=True, use_weighted_masking=False, bce_pos_weight=5.0):
"""Initialize Tactoron2 loss module. Parameters ---------- use_masking : bool Whether to apply masking for padded part in loss calculation. use_weigh... | the_stack_v2_python_sparse | parakeet/models/transformer_tts/transformer_tts.py | PaddlePaddle/Parakeet | train | 609 |
a3a5f0604910e7d616ef4ea2742e8ec172a385bc | [
"if self._zone.is_type_fire():\n return BinarySensorDeviceClass.SMOKE\nif self._zone.is_type_carbon_monoxide():\n return BinarySensorDeviceClass.GAS\nif self._zone.is_type_motion():\n return BinarySensorDeviceClass.MOTION\nif self._zone.is_type_medical():\n return BinarySensorDeviceClass.SAFETY\nif self... | <|body_start_0|>
if self._zone.is_type_fire():
return BinarySensorDeviceClass.SMOKE
if self._zone.is_type_carbon_monoxide():
return BinarySensorDeviceClass.GAS
if self._zone.is_type_motion():
return BinarySensorDeviceClass.MOTION
if self._zone.is_type_... | Represent an TotalConnect security zone. | TotalConnectZoneSecurityBinarySensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TotalConnectZoneSecurityBinarySensor:
"""Represent an TotalConnect security zone."""
def device_class(self):
"""Return the class of this zone."""
<|body_0|>
def update(self):
"""Return the state of the device."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_36k_train_013394 | 6,360 | permissive | [
{
"docstring": "Return the class of this zone.",
"name": "device_class",
"signature": "def device_class(self)"
},
{
"docstring": "Return the state of the device.",
"name": "update",
"signature": "def update(self)"
}
] | 2 | null | Implement the Python class `TotalConnectZoneSecurityBinarySensor` described below.
Class description:
Represent an TotalConnect security zone.
Method signatures and docstrings:
- def device_class(self): Return the class of this zone.
- def update(self): Return the state of the device. | Implement the Python class `TotalConnectZoneSecurityBinarySensor` described below.
Class description:
Represent an TotalConnect security zone.
Method signatures and docstrings:
- def device_class(self): Return the class of this zone.
- def update(self): Return the state of the device.
<|skeleton|>
class TotalConnect... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class TotalConnectZoneSecurityBinarySensor:
"""Represent an TotalConnect security zone."""
def device_class(self):
"""Return the class of this zone."""
<|body_0|>
def update(self):
"""Return the state of the device."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TotalConnectZoneSecurityBinarySensor:
"""Represent an TotalConnect security zone."""
def device_class(self):
"""Return the class of this zone."""
if self._zone.is_type_fire():
return BinarySensorDeviceClass.SMOKE
if self._zone.is_type_carbon_monoxide():
ret... | the_stack_v2_python_sparse | homeassistant/components/totalconnect/binary_sensor.py | home-assistant/core | train | 35,501 |
79247dd7413ee040229a9fce448ac34d541706e2 | [
"super(CueMessageBox, self).__init__(parent)\nself.setIcon(QtWidgets.QMessageBox.Information)\nself.setText(message)\nself.setWindowTitle(title)\nself.setStandardButtons(QtWidgets.QMessageBox.Ok)",
"size = self.size()\ndesktopSize = QtWidgets.QDesktopWidget().screenGeometry()\ntop = desktopSize.height() / 2 - siz... | <|body_start_0|>
super(CueMessageBox, self).__init__(parent)
self.setIcon(QtWidgets.QMessageBox.Information)
self.setText(message)
self.setWindowTitle(title)
self.setStandardButtons(QtWidgets.QMessageBox.Ok)
<|end_body_0|>
<|body_start_1|>
size = self.size()
desk... | A QMessageBox with message and OK button. | CueMessageBox | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CueMessageBox:
"""A QMessageBox with message and OK button."""
def __init__(self, message, title=None, parent=None):
"""@type message: str @param message: error message @type title: str @param title: box title @type parent: QWidget @param parent: parent object"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_013395 | 17,658 | permissive | [
{
"docstring": "@type message: str @param message: error message @type title: str @param title: box title @type parent: QWidget @param parent: parent object",
"name": "__init__",
"signature": "def __init__(self, message, title=None, parent=None)"
},
{
"docstring": "Centers the message box on scr... | 2 | stack_v2_sparse_classes_30k_train_008408 | Implement the Python class `CueMessageBox` described below.
Class description:
A QMessageBox with message and OK button.
Method signatures and docstrings:
- def __init__(self, message, title=None, parent=None): @type message: str @param message: error message @type title: str @param title: box title @type parent: QWi... | Implement the Python class `CueMessageBox` described below.
Class description:
A QMessageBox with message and OK button.
Method signatures and docstrings:
- def __init__(self, message, title=None, parent=None): @type message: str @param message: error message @type title: str @param title: box title @type parent: QWi... | c1f335d22e59cdf75859aa14ecdfe43d9cb43e95 | <|skeleton|>
class CueMessageBox:
"""A QMessageBox with message and OK button."""
def __init__(self, message, title=None, parent=None):
"""@type message: str @param message: error message @type title: str @param title: box title @type parent: QWidget @param parent: parent object"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CueMessageBox:
"""A QMessageBox with message and OK button."""
def __init__(self, message, title=None, parent=None):
"""@type message: str @param message: error message @type title: str @param title: box title @type parent: QWidget @param parent: parent object"""
super(CueMessageBox, self... | the_stack_v2_python_sparse | cuesubmit/cuesubmit/ui/Widgets.py | AcademySoftwareFoundation/OpenCue | train | 439 |
831992343fba9a311200361aedc2942f56dab2fd | [
"p = self.params\nif len(inputs.shape) != 4:\n raise ValueError('Input is assumed to be a rank 4 tensor of shape[batch, sequence, heads, dims].')\nif p.embedding_dims % 2:\n raise ValueError('Embedding dim for rotary position embedding must be amultiple of 2.')\nif p.embedding_dims != inputs.shape[3]:\n ra... | <|body_start_0|>
p = self.params
if len(inputs.shape) != 4:
raise ValueError('Input is assumed to be a rank 4 tensor of shape[batch, sequence, heads, dims].')
if p.embedding_dims % 2:
raise ValueError('Embedding dim for rotary position embedding must be amultiple of 2.')
... | Applies rotary position embedding for a given 1-d sequence. The Rotary position embedding is described in https://arxiv.org/abs/2104.09864 | RotaryPositionalEmbedding | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RotaryPositionalEmbedding:
"""Applies rotary position embedding for a given 1-d sequence. The Rotary position embedding is described in https://arxiv.org/abs/2104.09864"""
def fprop(self, inputs: JTensor, position: Optional[JTensor]=None) -> JTensor:
"""Generates a JTensor of sinusoi... | stack_v2_sparse_classes_36k_train_013396 | 24,667 | permissive | [
{
"docstring": "Generates a JTensor of sinusoids with different frequencies. Args: inputs: The input sequence on which to apply the Rotary position embedding. Since rotary position embeddings are applied to query and keys after projection, it is assumed of shape [B, S, N, H]. position: Optional position JTensor... | 2 | stack_v2_sparse_classes_30k_train_021672 | Implement the Python class `RotaryPositionalEmbedding` described below.
Class description:
Applies rotary position embedding for a given 1-d sequence. The Rotary position embedding is described in https://arxiv.org/abs/2104.09864
Method signatures and docstrings:
- def fprop(self, inputs: JTensor, position: Optional[... | Implement the Python class `RotaryPositionalEmbedding` described below.
Class description:
Applies rotary position embedding for a given 1-d sequence. The Rotary position embedding is described in https://arxiv.org/abs/2104.09864
Method signatures and docstrings:
- def fprop(self, inputs: JTensor, position: Optional[... | c00a74b260fcf6ba11199cc4a340c127d6616479 | <|skeleton|>
class RotaryPositionalEmbedding:
"""Applies rotary position embedding for a given 1-d sequence. The Rotary position embedding is described in https://arxiv.org/abs/2104.09864"""
def fprop(self, inputs: JTensor, position: Optional[JTensor]=None) -> JTensor:
"""Generates a JTensor of sinusoi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RotaryPositionalEmbedding:
"""Applies rotary position embedding for a given 1-d sequence. The Rotary position embedding is described in https://arxiv.org/abs/2104.09864"""
def fprop(self, inputs: JTensor, position: Optional[JTensor]=None) -> JTensor:
"""Generates a JTensor of sinusoids with diffe... | the_stack_v2_python_sparse | lingvo/jax/layers/embedding_softmax.py | tensorflow/lingvo | train | 2,963 |
941d6c1aaeadf5e8da8e2535cdf97cde77c0c2bb | [
"if not request.args.get('roll_no') and (not request.args.get('student_id')) and (not request.args.get('admission_id')):\n return ({'error': \"Kindly send either admission no or student's rollno.\"}, 400)\nleave_handler = LeaveHandler()\nreturn jsonify(leave_handler.GetStudentLeaves(**request.args))",
"if not ... | <|body_start_0|>
if not request.args.get('roll_no') and (not request.args.get('student_id')) and (not request.args.get('admission_id')):
return ({'error': "Kindly send either admission no or student's rollno."}, 400)
leave_handler = LeaveHandler()
return jsonify(leave_handler.GetStud... | Manages the leave for students. | StudentLeaves | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StudentLeaves:
"""Manages the leave for students."""
def get(self):
"""Gets student leaves. Param: student_id: Student id. Request: path: api/v0/attendance/student query_params: > roll_no: 46, class_id: 7 > student_id > student_admission_no accept: application/json Response: return {... | stack_v2_sparse_classes_36k_train_013397 | 6,574 | no_license | [
{
"docstring": "Gets student leaves. Param: student_id: Student id. Request: path: api/v0/attendance/student query_params: > roll_no: 46, class_id: 7 > student_id > student_admission_no accept: application/json Response: return { attendance: [{\"name\": \"Shivam Kapoor\", \"date\": \"2020-06-25\", \"status\": \... | 2 | stack_v2_sparse_classes_30k_val_000059 | Implement the Python class `StudentLeaves` described below.
Class description:
Manages the leave for students.
Method signatures and docstrings:
- def get(self): Gets student leaves. Param: student_id: Student id. Request: path: api/v0/attendance/student query_params: > roll_no: 46, class_id: 7 > student_id > student... | Implement the Python class `StudentLeaves` described below.
Class description:
Manages the leave for students.
Method signatures and docstrings:
- def get(self): Gets student leaves. Param: student_id: Student id. Request: path: api/v0/attendance/student query_params: > roll_no: 46, class_id: 7 > student_id > student... | cb990525bb9da7fef1e82735ea5ca6f5ad67825a | <|skeleton|>
class StudentLeaves:
"""Manages the leave for students."""
def get(self):
"""Gets student leaves. Param: student_id: Student id. Request: path: api/v0/attendance/student query_params: > roll_no: 46, class_id: 7 > student_id > student_admission_no accept: application/json Response: return {... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StudentLeaves:
"""Manages the leave for students."""
def get(self):
"""Gets student leaves. Param: student_id: Student id. Request: path: api/v0/attendance/student query_params: > roll_no: 46, class_id: 7 > student_id > student_admission_no accept: application/json Response: return { attendance: ... | the_stack_v2_python_sparse | server/services/leave_management/leave_controller.py | goel-aman/Erp-Backend-Code | train | 0 |
650684a8f27da05721aa830d84e3adbd3e2b8d0c | [
"weight_scale_factor, n = (None, None)\nlogger.debug(f'input: {input}')\nwith torch.no_grad():\n if mode == quantization.QType.DETER:\n binarized_weight = deterministic_quantize(weight)\n s = torch.sum(torch.abs(weight))\n n = prod(weight.shape)\n weight_scale_factor = s / n\n elif... | <|body_start_0|>
weight_scale_factor, n = (None, None)
logger.debug(f'input: {input}')
with torch.no_grad():
if mode == quantization.QType.DETER:
binarized_weight = deterministic_quantize(weight)
s = torch.sum(torch.abs(weight))
n = pro... | binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 forward에서 binarized wegiths를 사용하고, gradient ... | BinarizedLinear | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinarizedLinear:
"""binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 f... | stack_v2_sparse_classes_36k_train_013398 | 5,021 | permissive | [
{
"docstring": "Real-value weights를 binarized weight와 scale factor로 변환한다. binarized tensor이를입력으로 받으면 이를 다음과 같이 계산한다. .. math:: output=I_{b} \\\\odot W_{b} \\\\times \\\\alpha_{W_{b}} Args: ctx (object): forward/backward간 정보를 공유하기위한 데이터 컨테이너 input (torch.Tensor): binairzed tensor weight (torch.Tensor): :math:`(o... | 2 | stack_v2_sparse_classes_30k_train_001661 | Implement the Python class `BinarizedLinear` described below.
Class description:
binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사... | Implement the Python class `BinarizedLinear` described below.
Class description:
binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사... | 2c02429d6ee052fe70a17ced4755d5814a4ef60a | <|skeleton|>
class BinarizedLinear:
"""binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BinarizedLinear:
"""binarized tensor를 입력으로 하여, scale factor와 binarized weights로 linear 연산을 수행하는 operation function Binarize operation method는 BinaryConnect의 `Deterministic`과 `Stochastic` method를 사용하며, scale factor와 weights를 binarize하는 방법은 XNOR-Net의 method를 사용함. .. note: Weights binarize method는 forward에서 bina... | the_stack_v2_python_sparse | src/ops/binarized_linear.py | ssaru/pytorch-XNOR-YOLO | train | 1 |
da8c71797206cc1128bcb36bc2774839fe75b3d3 | [
"roles = self.all()\nif role:\n roles = roles.filter(code=getattr(role, 'code', role))\nelse:\n if not (group or context):\n raise ValueError(u'This method expects at least one argument')\n if group:\n roles = roles.filter(group__name=getattr(group, 'name', group))\n if context:\n c... | <|body_start_0|>
roles = self.all()
if role:
roles = roles.filter(code=getattr(role, 'code', role))
else:
if not (group or context):
raise ValueError(u'This method expects at least one argument')
if group:
roles = roles.filter(g... | RoleManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleManager:
def match(self, role=None, group=None, context=None):
"""Filter according to role/role code or group/group name or context."""
<|body_0|>
def get_role(self, role=None, group=None, context=None, create=False):
"""Returns the role matching role/role code o... | stack_v2_sparse_classes_36k_train_013399 | 7,376 | no_license | [
{
"docstring": "Filter according to role/role code or group/group name or context.",
"name": "match",
"signature": "def match(self, role=None, group=None, context=None)"
},
{
"docstring": "Returns the role matching role/role code or group/group name AND context",
"name": "get_role",
"sig... | 2 | stack_v2_sparse_classes_30k_train_002478 | Implement the Python class `RoleManager` described below.
Class description:
Implement the RoleManager class.
Method signatures and docstrings:
- def match(self, role=None, group=None, context=None): Filter according to role/role code or group/group name or context.
- def get_role(self, role=None, group=None, context... | Implement the Python class `RoleManager` described below.
Class description:
Implement the RoleManager class.
Method signatures and docstrings:
- def match(self, role=None, group=None, context=None): Filter according to role/role code or group/group name or context.
- def get_role(self, role=None, group=None, context... | 3dfe6fc03844789b1c60d4027633072e77848186 | <|skeleton|>
class RoleManager:
def match(self, role=None, group=None, context=None):
"""Filter according to role/role code or group/group name or context."""
<|body_0|>
def get_role(self, role=None, group=None, context=None, create=False):
"""Returns the role matching role/role code o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RoleManager:
def match(self, role=None, group=None, context=None):
"""Filter according to role/role code or group/group name or context."""
roles = self.all()
if role:
roles = roles.filter(code=getattr(role, 'code', role))
else:
if not (group or context)... | the_stack_v2_python_sparse | models.py | yeleman/auth | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.