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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
329fecd8303629eb111af78c313c430147276686 | [
"self.ipars = 0\nself.vtk_grid_data = []\nself.ti = -1\nself.tf = -1\nself.binary = True\nself.destination = 'work.vtk'",
"import numpy as np\nimport vtk\nfor pvar in pvar_list:\n points = np.vstack([pvar.xp, pvar.yp, pvar.zp])\n vtk_grid_data = vtk.vtkUnstructuredGrid()\n vtk_points = vtk.vtkPoints()\n ... | <|body_start_0|>
self.ipars = 0
self.vtk_grid_data = []
self.ti = -1
self.tf = -1
self.binary = True
self.destination = 'work.vtk'
<|end_body_0|>
<|body_start_1|>
import numpy as np
import vtk
for pvar in pvar_list:
points = np.vstack(... | ParticlesVtk -- holds the vtk particle data. | ParticlesVtk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParticlesVtk:
"""ParticlesVtk -- holds the vtk particle data."""
def __init__(self):
"""Fill members with default values."""
<|body_0|>
def convert_to_vtk(self, pvar_list):
"""Convert particle data into vtk format and return the vtk objects. call signature: conve... | stack_v2_sparse_classes_36k_train_000800 | 4,610 | no_license | [
{
"docstring": "Fill members with default values.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Convert particle data into vtk format and return the vtk objects. call signature: convert_to_vtk(self, pvar_list) Keyword arguments: *pvar_list*: List of particle objects.... | 3 | stack_v2_sparse_classes_30k_train_006949 | Implement the Python class `ParticlesVtk` described below.
Class description:
ParticlesVtk -- holds the vtk particle data.
Method signatures and docstrings:
- def __init__(self): Fill members with default values.
- def convert_to_vtk(self, pvar_list): Convert particle data into vtk format and return the vtk objects. ... | Implement the Python class `ParticlesVtk` described below.
Class description:
ParticlesVtk -- holds the vtk particle data.
Method signatures and docstrings:
- def __init__(self): Fill members with default values.
- def convert_to_vtk(self, pvar_list): Convert particle data into vtk format and return the vtk objects. ... | 624b742369c09d65bc20fdef25d2201cab7f758d | <|skeleton|>
class ParticlesVtk:
"""ParticlesVtk -- holds the vtk particle data."""
def __init__(self):
"""Fill members with default values."""
<|body_0|>
def convert_to_vtk(self, pvar_list):
"""Convert particle data into vtk format and return the vtk objects. call signature: conve... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParticlesVtk:
"""ParticlesVtk -- holds the vtk particle data."""
def __init__(self):
"""Fill members with default values."""
self.ipars = 0
self.vtk_grid_data = []
self.ti = -1
self.tf = -1
self.binary = True
self.destination = 'work.vtk'
def c... | the_stack_v2_python_sparse | python/pencilnew/export/particles_to_vtk.py | JosephMouallem/pencil_code | train | 1 |
4203e47b7b627b88fa8ae8fb8756724925e05ad2 | [
"self.d = {}\nfor i in range(0, len(words)):\n self.d[words[i]] = self.d.get(words[i], []) + [i]",
"l1 = self.d[word1]\nl2 = self.d[word2]\ni = j = 0\nans = float('inf')\nwhile i < len(l1) and j < len(l2):\n ans = min(ans, abs(l1[i] - l2[j]))\n if l1[i] > l2[j]:\n j += 1\n else:\n i += 1... | <|body_start_0|>
self.d = {}
for i in range(0, len(words)):
self.d[words[i]] = self.d.get(words[i], []) + [i]
<|end_body_0|>
<|body_start_1|>
l1 = self.d[word1]
l2 = self.d[word2]
i = j = 0
ans = float('inf')
while i < len(l1) and j < len(l2):
... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
"""Adds a word into the data structure. :type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_000801 | 848 | no_license | [
{
"docstring": "initialize your data structure here. :type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": "Adds a word into the data structure. :type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortes... | 2 | null | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): initialize your data structure here. :type words: List[str]
- def shortest(self, word1, word2): Adds a word into the data structure. :type word... | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): initialize your data structure here. :type words: List[str]
- def shortest(self, word1, word2): Adds a word into the data structure. :type word... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
"""Adds a word into the data structure. :type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
self.d = {}
for i in range(0, len(words)):
self.d[words[i]] = self.d.get(words[i], []) + [i]
def shortest(self, word1, word2):
"""Adds a word into the dat... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/lc-all-solutions/244.shortest-word-distance-ii/shortest-word-distance-ii.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
5dd857c493ab950c08145440394123990999f6cc | [
"response = []\nfor display_app in trans.app.datatypes_registry.display_applications.values():\n response.append({'id': display_app.id, 'name': display_app.name, 'version': display_app.version, 'filename_': display_app._filename, 'links': [{'name': l.name} for l in display_app.links.values()]})\nreturn response"... | <|body_start_0|>
response = []
for display_app in trans.app.datatypes_registry.display_applications.values():
response.append({'id': display_app.id, 'name': display_app.name, 'version': display_app.version, 'filename_': display_app._filename, 'links': [{'name': l.name} for l in display_app.l... | DisplayApplicationsController | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DisplayApplicationsController:
def index(self, trans, **kwd):
"""GET /api/display_applications/ Returns the list of display applications. :returns: list of available display applications :rtype: list"""
<|body_0|>
def reload(self, trans, payload={}, **kwd):
"""POST /... | stack_v2_sparse_classes_36k_train_000802 | 2,299 | permissive | [
{
"docstring": "GET /api/display_applications/ Returns the list of display applications. :returns: list of available display applications :rtype: list",
"name": "index",
"signature": "def index(self, trans, **kwd)"
},
{
"docstring": "POST /api/display_applications/reload Reloads the list of disp... | 2 | null | Implement the Python class `DisplayApplicationsController` described below.
Class description:
Implement the DisplayApplicationsController class.
Method signatures and docstrings:
- def index(self, trans, **kwd): GET /api/display_applications/ Returns the list of display applications. :returns: list of available disp... | Implement the Python class `DisplayApplicationsController` described below.
Class description:
Implement the DisplayApplicationsController class.
Method signatures and docstrings:
- def index(self, trans, **kwd): GET /api/display_applications/ Returns the list of display applications. :returns: list of available disp... | d194520fdfe08e48c0b3d0d2299cd2adcb8f5952 | <|skeleton|>
class DisplayApplicationsController:
def index(self, trans, **kwd):
"""GET /api/display_applications/ Returns the list of display applications. :returns: list of available display applications :rtype: list"""
<|body_0|>
def reload(self, trans, payload={}, **kwd):
"""POST /... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DisplayApplicationsController:
def index(self, trans, **kwd):
"""GET /api/display_applications/ Returns the list of display applications. :returns: list of available display applications :rtype: list"""
response = []
for display_app in trans.app.datatypes_registry.display_applications.... | the_stack_v2_python_sparse | lib/galaxy/webapps/galaxy/api/display_applications.py | bwlang/galaxy | train | 0 | |
40d1051acaaef2780b9bd124ceeba371c471d523 | [
"arr = [_ for _ in range(n)]\ncount = 0\nwhile True:\n for i in range(len(arr)):\n if arr[i] != -1:\n count = (count + 1) % m\n if count == 0:\n arr[i] = -1\n if arr.count(-1) == n - 1:\n for num in arr:\n if num... | <|body_start_0|>
arr = [_ for _ in range(n)]
count = 0
while True:
for i in range(len(arr)):
if arr[i] != -1:
count = (count + 1) % m
if count == 0:
arr[i] = -1
if arr.count(-1) ==... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lastRemaining(self, n: int, m: int) -> int:
"""超出时间限制 :param n: :param m: :return:"""
<|body_0|>
def lastRemaining2(self, n: int, m: int) -> int:
"""超时 :param n: :param m: :return:"""
<|body_1|>
def lastRemaining3(self, n: int, m: int) -> i... | stack_v2_sparse_classes_36k_train_000803 | 3,080 | no_license | [
{
"docstring": "超出时间限制 :param n: :param m: :return:",
"name": "lastRemaining",
"signature": "def lastRemaining(self, n: int, m: int) -> int"
},
{
"docstring": "超时 :param n: :param m: :return:",
"name": "lastRemaining2",
"signature": "def lastRemaining2(self, n: int, m: int) -> int"
},
... | 5 | stack_v2_sparse_classes_30k_train_006514 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastRemaining(self, n: int, m: int) -> int: 超出时间限制 :param n: :param m: :return:
- def lastRemaining2(self, n: int, m: int) -> int: 超时 :param n: :param m: :return:
- def lastR... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lastRemaining(self, n: int, m: int) -> int: 超出时间限制 :param n: :param m: :return:
- def lastRemaining2(self, n: int, m: int) -> int: 超时 :param n: :param m: :return:
- def lastR... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def lastRemaining(self, n: int, m: int) -> int:
"""超出时间限制 :param n: :param m: :return:"""
<|body_0|>
def lastRemaining2(self, n: int, m: int) -> int:
"""超时 :param n: :param m: :return:"""
<|body_1|>
def lastRemaining3(self, n: int, m: int) -> i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lastRemaining(self, n: int, m: int) -> int:
"""超出时间限制 :param n: :param m: :return:"""
arr = [_ for _ in range(n)]
count = 0
while True:
for i in range(len(arr)):
if arr[i] != -1:
count = (count + 1) % m
... | the_stack_v2_python_sparse | LeetCode/数学/1579. 圆圈中最后剩下的数字.py | yiming1012/MyLeetCode | train | 2 | |
51824e56f118de9aac609c013af6af59c98a3a62 | [
"parser.add_argument('config', metavar='INSTANCE_CONFIG', completer=flags.InstanceConfigCompleter, help=\"Cloud Spanner instance config. The 'custom-' prefix is required to avoid name conflicts with Google-managed configurations.\")\nparser.add_argument('--display-name', help='The name of this instance configuratio... | <|body_start_0|>
parser.add_argument('config', metavar='INSTANCE_CONFIG', completer=flags.InstanceConfigCompleter, help="Cloud Spanner instance config. The 'custom-' prefix is required to avoid name conflicts with Google-managed configurations.")
parser.add_argument('--display-name', help='The name of t... | Update a Cloud Spanner instance configuration. | Update | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Update:
"""Update a Cloud Spanner instance configuration."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments a... | stack_v2_sparse_classes_36k_train_000804 | 3,901 | permissive | [
{
"docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring"... | 2 | stack_v2_sparse_classes_30k_train_002530 | Implement the Python class `Update` described below.
Class description:
Update a Cloud Spanner instance configuration.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on th... | Implement the Python class `Update` described below.
Class description:
Update a Cloud Spanner instance configuration.
Method signatures and docstrings:
- def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on th... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class Update:
"""Update a Cloud Spanner instance configuration."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Update:
"""Update a Cloud Spanner instance configuration."""
def Args(parser):
"""Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""... | the_stack_v2_python_sparse | lib/surface/spanner/instance_configs/update.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
0e4c05029f3a1d4ec73822dec37a06099a5b998f | [
"parser = reqparse.RequestParser()\nparser.add_argument('file', type=str, location='args')\nargs = parser.parse_args()\nfile_to_read = args['file']\nif file_to_read is None:\n return ({'success': False, 'message': 'file (str) parameter is required'}, 400)\ntry:\n with open(file_to_read) as file:\n data... | <|body_start_0|>
parser = reqparse.RequestParser()
parser.add_argument('file', type=str, location='args')
args = parser.parse_args()
file_to_read = args['file']
if file_to_read is None:
return ({'success': False, 'message': 'file (str) parameter is required'}, 400)
... | Files | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"GPL-1.0-or-later",
"AGPL-3.0-only",
"AGPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Files:
def get(self):
"""Retrieve content of a file --- tags: - System responses: 200: description: Pair of user/token is valid 203: description: Invalid user/token pair 400: description: Malformed client input"""
<|body_0|>
def post(self):
"""Create a new file --- t... | stack_v2_sparse_classes_36k_train_000805 | 4,584 | permissive | [
{
"docstring": "Retrieve content of a file --- tags: - System responses: 200: description: Pair of user/token is valid 203: description: Invalid user/token pair 400: description: Malformed client input",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a new file --- tags: -... | 2 | stack_v2_sparse_classes_30k_val_000657 | Implement the Python class `Files` described below.
Class description:
Implement the Files class.
Method signatures and docstrings:
- def get(self): Retrieve content of a file --- tags: - System responses: 200: description: Pair of user/token is valid 203: description: Invalid user/token pair 400: description: Malfor... | Implement the Python class `Files` described below.
Class description:
Implement the Files class.
Method signatures and docstrings:
- def get(self): Retrieve content of a file --- tags: - System responses: 200: description: Pair of user/token is valid 203: description: Invalid user/token pair 400: description: Malfor... | e1617b14bb1b4a29a5bc6e02fa76c1312a333389 | <|skeleton|>
class Files:
def get(self):
"""Retrieve content of a file --- tags: - System responses: 200: description: Pair of user/token is valid 203: description: Invalid user/token pair 400: description: Malformed client input"""
<|body_0|>
def post(self):
"""Create a new file --- t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Files:
def get(self):
"""Retrieve content of a file --- tags: - System responses: 200: description: Pair of user/token is valid 203: description: Invalid user/token pair 400: description: Malformed client input"""
parser = reqparse.RequestParser()
parser.add_argument('file', type=str, ... | the_stack_v2_python_sparse | source/soca/cluster_web_ui/api/v1/system/files.py | awslabs/scale-out-computing-on-aws | train | 110 | |
923894e093acec0b949f90d4d0593357f880ea62 | [
"the_terms = dict()\nfor NounClass in NOUN_CLASSES:\n for item in NounClass.objects.all():\n for noun in item.get_nouns():\n assert noun not in the_terms\n the_terms[noun] = item\nfor command in COMMANDS:\n for verb in command.verbs:\n assert verb not in the_terms\n ... | <|body_start_0|>
the_terms = dict()
for NounClass in NOUN_CLASSES:
for item in NounClass.objects.all():
for noun in item.get_nouns():
assert noun not in the_terms
the_terms[noun] = item
for command in COMMANDS:
for v... | A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts. | Context | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Context:
"""A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts."""
def terms(self):
"""A cached dictionary of known nouns and verbs."""
<|body_0|>
def enrich_part(self, part):
"""Enriches a single part (... | stack_v2_sparse_classes_36k_train_000806 | 3,704 | permissive | [
{
"docstring": "A cached dictionary of known nouns and verbs.",
"name": "terms",
"signature": "def terms(self)"
},
{
"docstring": "Enriches a single part (which, well, might contain more than one actual word). :param part: A part(-of-speech) to enrich. :return: The part itself, or a model.",
... | 3 | stack_v2_sparse_classes_30k_train_020756 | Implement the Python class `Context` described below.
Class description:
A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts.
Method signatures and docstrings:
- def terms(self): A cached dictionary of known nouns and verbs.
- def enrich_part(self, part): Enr... | Implement the Python class `Context` described below.
Class description:
A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts.
Method signatures and docstrings:
- def terms(self): A cached dictionary of known nouns and verbs.
- def enrich_part(self, part): Enr... | ab9ce59ef6d7a8db30d38740aba44855fe5e87e7 | <|skeleton|>
class Context:
"""A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts."""
def terms(self):
"""A cached dictionary of known nouns and verbs."""
<|body_0|>
def enrich_part(self, part):
"""Enriches a single part (... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Context:
"""A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts."""
def terms(self):
"""A cached dictionary of known nouns and verbs."""
the_terms = dict()
for NounClass in NOUN_CLASSES:
for item in NounClass.o... | the_stack_v2_python_sparse | wurst/cli/context.py | jyrama/wurst | train | 0 |
d9a25824e614202f731d376b21005119f118da2a | [
"_ = self.get_or_raise(System, INSTANCE_READ, instances__id=instance_id)\nresponse = await self.client(Operation(operation_type='INSTANCE_READ', args=[instance_id]))\nself.set_header('Content-Type', 'application/json; charset=UTF-8')\nself.write(response)",
"_ = self.get_or_raise(System, INSTANCE_UPDATE, instance... | <|body_start_0|>
_ = self.get_or_raise(System, INSTANCE_READ, instances__id=instance_id)
response = await self.client(Operation(operation_type='INSTANCE_READ', args=[instance_id]))
self.set_header('Content-Type', 'application/json; charset=UTF-8')
self.write(response)
<|end_body_0|>
<|b... | InstanceAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstanceAPI:
async def get(self, instance_id):
"""--- summary: Retrieve a specific Instance parameters: - name: instance_id in: path required: true description: The ID of the Instance type: string responses: 200: description: Instance with the given ID schema: $ref: '#/definitions/Instan... | stack_v2_sparse_classes_36k_train_000807 | 9,957 | permissive | [
{
"docstring": "--- summary: Retrieve a specific Instance parameters: - name: instance_id in: path required: true description: The ID of the Instance type: string responses: 200: description: Instance with the given ID schema: $ref: '#/definitions/Instance' 404: $ref: '#/definitions/404Error' 50x: $ref: '#/defi... | 3 | stack_v2_sparse_classes_30k_train_006572 | Implement the Python class `InstanceAPI` described below.
Class description:
Implement the InstanceAPI class.
Method signatures and docstrings:
- async def get(self, instance_id): --- summary: Retrieve a specific Instance parameters: - name: instance_id in: path required: true description: The ID of the Instance type... | Implement the Python class `InstanceAPI` described below.
Class description:
Implement the InstanceAPI class.
Method signatures and docstrings:
- async def get(self, instance_id): --- summary: Retrieve a specific Instance parameters: - name: instance_id in: path required: true description: The ID of the Instance type... | a5fd2dcc2444409e243d3fdaa43d86695e5cb142 | <|skeleton|>
class InstanceAPI:
async def get(self, instance_id):
"""--- summary: Retrieve a specific Instance parameters: - name: instance_id in: path required: true description: The ID of the Instance type: string responses: 200: description: Instance with the given ID schema: $ref: '#/definitions/Instan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InstanceAPI:
async def get(self, instance_id):
"""--- summary: Retrieve a specific Instance parameters: - name: instance_id in: path required: true description: The ID of the Instance type: string responses: 200: description: Instance with the given ID schema: $ref: '#/definitions/Instance' 404: $ref:... | the_stack_v2_python_sparse | src/app/beer_garden/api/http/handlers/v1/instance.py | beer-garden/beer-garden | train | 254 | |
bddf66b06d0e65e8991080e2edc93954d5789cb8 | [
"NUM_COVARS = initial_guess.shape[1]\ncandidates_array = np.random.uniform(low=covar_bounds[0, :].numpy(), high=covar_bounds[1, :].numpy(), size=(n_samp, NUM_COVARS))\ncandidates = torch.from_numpy(candidates_array).double().to(device)\nreturn candidates",
"NUM_COVARS = initial_guess.shape[1]\nbins = np.zeros((n_... | <|body_start_0|>
NUM_COVARS = initial_guess.shape[1]
candidates_array = np.random.uniform(low=covar_bounds[0, :].numpy(), high=covar_bounds[1, :].numpy(), size=(n_samp, NUM_COVARS))
candidates = torch.from_numpy(candidates_array).double().to(device)
return candidates
<|end_body_0|>
<|bo... | class of sample methods (random and structured random) used for initialization and for interdispersed random sampling | DataSamplers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataSamplers:
"""class of sample methods (random and structured random) used for initialization and for interdispersed random sampling"""
def random(n_samp, initial_guess, covar_bounds, device):
"""randomly samples each covariate within bounds to provice new candidate datapoint :para... | stack_v2_sparse_classes_36k_train_000808 | 10,583 | permissive | [
{
"docstring": "randomly samples each covariate within bounds to provice new candidate datapoint :param n_samp (int): number of samples to be generated. Defines number of subsegments for each covariate, from which each new candidate datapoint are obtained :param initial_guess (tensor, 1 X <num covariates>): con... | 2 | stack_v2_sparse_classes_30k_val_000120 | Implement the Python class `DataSamplers` described below.
Class description:
class of sample methods (random and structured random) used for initialization and for interdispersed random sampling
Method signatures and docstrings:
- def random(n_samp, initial_guess, covar_bounds, device): randomly samples each covaria... | Implement the Python class `DataSamplers` described below.
Class description:
class of sample methods (random and structured random) used for initialization and for interdispersed random sampling
Method signatures and docstrings:
- def random(n_samp, initial_guess, covar_bounds, device): randomly samples each covaria... | e241d0f6a30479b600d85aafabf27058d3fd1072 | <|skeleton|>
class DataSamplers:
"""class of sample methods (random and structured random) used for initialization and for interdispersed random sampling"""
def random(n_samp, initial_guess, covar_bounds, device):
"""randomly samples each covariate within bounds to provice new candidate datapoint :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataSamplers:
"""class of sample methods (random and structured random) used for initialization and for interdispersed random sampling"""
def random(n_samp, initial_guess, covar_bounds, device):
"""randomly samples each covariate within bounds to provice new candidate datapoint :param n_samp (int... | the_stack_v2_python_sparse | greattunes/utils.py | minlattnwe/greattunes | train | 0 |
730cceb8463c917a34f8f3e22f5d4cf39a0666ea | [
"super(Snat, self).__init__(snat_s)\nself._meta_data['required_json_kind'] = 'tm:ltm:snat:snatstate'\nself._meta_data['required_creation_parameters'].update(('partition', 'origins'))",
"required_one_of = ['automap', 'snatpool', 'translation']\nhas_any = [x for x in iterkeys(kwargs) if x in required_one_of]\nif le... | <|body_start_0|>
super(Snat, self).__init__(snat_s)
self._meta_data['required_json_kind'] = 'tm:ltm:snat:snatstate'
self._meta_data['required_creation_parameters'].update(('partition', 'origins'))
<|end_body_0|>
<|body_start_1|>
required_one_of = ['automap', 'snatpool', 'translation']
... | BIG-IP® LTM Snat resource | Snat | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Snat:
"""BIG-IP® LTM Snat resource"""
def __init__(self, snat_s):
"""This represents a Snat. "origins" is our first example of a dict attribute, it appears to behave as expected."""
<|body_0|>
def create(self, **kwargs):
"""Call this to create a new snat on the B... | stack_v2_sparse_classes_36k_train_000809 | 3,520 | permissive | [
{
"docstring": "This represents a Snat. \"origins\" is our first example of a dict attribute, it appears to behave as expected.",
"name": "__init__",
"signature": "def __init__(self, snat_s)"
},
{
"docstring": "Call this to create a new snat on the BIG-IP®. Uses HTTP POST to 'containing' URI to ... | 2 | null | Implement the Python class `Snat` described below.
Class description:
BIG-IP® LTM Snat resource
Method signatures and docstrings:
- def __init__(self, snat_s): This represents a Snat. "origins" is our first example of a dict attribute, it appears to behave as expected.
- def create(self, **kwargs): Call this to creat... | Implement the Python class `Snat` described below.
Class description:
BIG-IP® LTM Snat resource
Method signatures and docstrings:
- def __init__(self, snat_s): This represents a Snat. "origins" is our first example of a dict attribute, it appears to behave as expected.
- def create(self, **kwargs): Call this to creat... | 3050df0079c2426af99b9a1b8f93d0b512468ff4 | <|skeleton|>
class Snat:
"""BIG-IP® LTM Snat resource"""
def __init__(self, snat_s):
"""This represents a Snat. "origins" is our first example of a dict attribute, it appears to behave as expected."""
<|body_0|>
def create(self, **kwargs):
"""Call this to create a new snat on the B... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Snat:
"""BIG-IP® LTM Snat resource"""
def __init__(self, snat_s):
"""This represents a Snat. "origins" is our first example of a dict attribute, it appears to behave as expected."""
super(Snat, self).__init__(snat_s)
self._meta_data['required_json_kind'] = 'tm:ltm:snat:snatstate'
... | the_stack_v2_python_sparse | f5/bigip/tm/ltm/snat.py | F5Networks/f5-common-python | train | 286 |
0e6fbb4ca2f2272d927322a63ec22b07f5a1f3d6 | [
"super().configure_defaults(conf)\nconf.set('port', 43000)\nconf.set('log_filename', 'clusterrunner_master.log')\nconf.set('eventlog_filename', 'eventlog_master.log')\nconf.set('shallow_clones', False)\nconf.set('unresponsive_slaves_cleanup_interval', 600)",
"super().configure_postload(conf)\nbase_directory = con... | <|body_start_0|>
super().configure_defaults(conf)
conf.set('port', 43000)
conf.set('log_filename', 'clusterrunner_master.log')
conf.set('eventlog_filename', 'eventlog_master.log')
conf.set('shallow_clones', False)
conf.set('unresponsive_slaves_cleanup_interval', 600)
<|en... | MasterConfigLoader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MasterConfigLoader:
def configure_defaults(self, conf):
"""This is the master configuration. These values should override values in base_conf.py. :type conf: Configuration"""
<|body_0|>
def configure_postload(self, conf):
"""After the clusterrunner.conf file has been... | stack_v2_sparse_classes_36k_train_000810 | 1,717 | permissive | [
{
"docstring": "This is the master configuration. These values should override values in base_conf.py. :type conf: Configuration",
"name": "configure_defaults",
"signature": "def configure_defaults(self, conf)"
},
{
"docstring": "After the clusterrunner.conf file has been loaded, generate the ma... | 2 | null | Implement the Python class `MasterConfigLoader` described below.
Class description:
Implement the MasterConfigLoader class.
Method signatures and docstrings:
- def configure_defaults(self, conf): This is the master configuration. These values should override values in base_conf.py. :type conf: Configuration
- def con... | Implement the Python class `MasterConfigLoader` described below.
Class description:
Implement the MasterConfigLoader class.
Method signatures and docstrings:
- def configure_defaults(self, conf): This is the master configuration. These values should override values in base_conf.py. :type conf: Configuration
- def con... | 55d18016f2c7d2dbb8aec5879459cae654edb045 | <|skeleton|>
class MasterConfigLoader:
def configure_defaults(self, conf):
"""This is the master configuration. These values should override values in base_conf.py. :type conf: Configuration"""
<|body_0|>
def configure_postload(self, conf):
"""After the clusterrunner.conf file has been... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MasterConfigLoader:
def configure_defaults(self, conf):
"""This is the master configuration. These values should override values in base_conf.py. :type conf: Configuration"""
super().configure_defaults(conf)
conf.set('port', 43000)
conf.set('log_filename', 'clusterrunner_master... | the_stack_v2_python_sparse | app/util/conf/master_config_loader.py | box/ClusterRunner | train | 168 | |
68f44addfb9163bb2696f511e6bb58378f22e780 | [
"try:\n if self.id is None:\n return self.query.all()\n if self.id is not None and type(self.id) is int and (self.id >= 0):\n return self.query.get(self.id)\nexcept Exception as e:\n return e.__cause__.args[1]",
"try:\n db.session.add(self)\n return db.session.commit()\nexcept Excepti... | <|body_start_0|>
try:
if self.id is None:
return self.query.all()
if self.id is not None and type(self.id) is int and (self.id >= 0):
return self.query.get(self.id)
except Exception as e:
return e.__cause__.args[1]
<|end_body_0|>
<|bod... | Using to create a session in database [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of session] user_id {[int]} -- [The user_id have this session] ip_address {[sring(17)]} -- [The ip address of person have user_id] user_agent {[text]} -- [The user agent... | Session | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Session:
"""Using to create a session in database [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of session] user_id {[int]} -- [The user_id have this session] ip_address {[sring(17)]} -- [The ip address of person have user_id] use... | stack_v2_sparse_classes_36k_train_000811 | 5,599 | no_license | [
{
"docstring": "[summary] [description] Arguments: id {[type]} -- [description] Returns: [None] -- [When successed] [Message] -- [When failed]",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "[summary] [description] Returns: [None] -- [When successed] [Message] -- [When failed]",... | 4 | stack_v2_sparse_classes_30k_train_009140 | Implement the Python class `Session` described below.
Class description:
Using to create a session in database [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of session] user_id {[int]} -- [The user_id have this session] ip_address {[sring(17)]} -- [The... | Implement the Python class `Session` described below.
Class description:
Using to create a session in database [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of session] user_id {[int]} -- [The user_id have this session] ip_address {[sring(17)]} -- [The... | 052956e5006f7d274d19a43b061c2fe4a6456cc0 | <|skeleton|>
class Session:
"""Using to create a session in database [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of session] user_id {[int]} -- [The user_id have this session] ip_address {[sring(17)]} -- [The ip address of person have user_id] use... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Session:
"""Using to create a session in database [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [The id of session] user_id {[int]} -- [The user_id have this session] ip_address {[sring(17)]} -- [The ip address of person have user_id] user_agent {[tex... | the_stack_v2_python_sparse | models/cache.py | BoTranVan/statuspage | train | 0 |
9f2ad0541d077cdc022c8560ee1189941ff9936c | [
"super(BasicBlock, self).__init__()\nif norm_layer is None:\n norm_layer = nn.BatchNorm1d\nif act_layer is None:\n act_layer = nn.ReLU\nif groups != 1 or base_width != 64:\n raise ValueError('BasicBlock class only supports groups=1 and base_width=64')\nif dilation > 1:\n raise ValueError('BasicBlock cla... | <|body_start_0|>
super(BasicBlock, self).__init__()
if norm_layer is None:
norm_layer = nn.BatchNorm1d
if act_layer is None:
act_layer = nn.ReLU
if groups != 1 or base_width != 64:
raise ValueError('BasicBlock class only supports groups=1 and base_widt... | Basic convolutional block - conv-3x3 -> bn -> relu | BasicBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicBlock:
"""Basic convolutional block - conv-3x3 -> bn -> relu"""
def __init__(self, inplanes, outplanes, kernel_size=3, stride=1, groups=1, dilation=1, base_width=64, downsample=None, norm_layer=None, act_layer=None):
"""Constructor Args: inplanes: (int) number of input channels ... | stack_v2_sparse_classes_36k_train_000812 | 8,913 | permissive | [
{
"docstring": "Constructor Args: inplanes: (int) number of input channels outplanes: (int) number of output channels stride: (int) stride kernel_size: (int) conv filter size groups: (int) number of groups for grouped conv filters dilation: (int) for dilated conv filters base_width: (int) BasicBlock only suppor... | 2 | stack_v2_sparse_classes_30k_train_001503 | Implement the Python class `BasicBlock` described below.
Class description:
Basic convolutional block - conv-3x3 -> bn -> relu
Method signatures and docstrings:
- def __init__(self, inplanes, outplanes, kernel_size=3, stride=1, groups=1, dilation=1, base_width=64, downsample=None, norm_layer=None, act_layer=None): Co... | Implement the Python class `BasicBlock` described below.
Class description:
Basic convolutional block - conv-3x3 -> bn -> relu
Method signatures and docstrings:
- def __init__(self, inplanes, outplanes, kernel_size=3, stride=1, groups=1, dilation=1, base_width=64, downsample=None, norm_layer=None, act_layer=None): Co... | 3ad344901c3bb59e0bc16bb70202d2cfd538fd77 | <|skeleton|>
class BasicBlock:
"""Basic convolutional block - conv-3x3 -> bn -> relu"""
def __init__(self, inplanes, outplanes, kernel_size=3, stride=1, groups=1, dilation=1, base_width=64, downsample=None, norm_layer=None, act_layer=None):
"""Constructor Args: inplanes: (int) number of input channels ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicBlock:
"""Basic convolutional block - conv-3x3 -> bn -> relu"""
def __init__(self, inplanes, outplanes, kernel_size=3, stride=1, groups=1, dilation=1, base_width=64, downsample=None, norm_layer=None, act_layer=None):
"""Constructor Args: inplanes: (int) number of input channels outplanes: (i... | the_stack_v2_python_sparse | baselines/common/networks/cnn.py | baihuaxie/drl-lib | train | 0 |
41b12966141c87aa2c88530b85f41e378eb7a2d1 | [
"if self.field:\n return 'Top filtered results for \"{0:s}\"'.format(self.field)\nreturn 'Top results for an unknown field after filtering'",
"if not (query_string or query_dsl):\n raise ValueError('Both query_string and query_dsl are missing')\nself.field = field\nformatted_field_name = self.format_field_b... | <|body_start_0|>
if self.field:
return 'Top filtered results for "{0:s}"'.format(self.field)
return 'Top results for an unknown field after filtering'
<|end_body_0|>
<|body_start_1|>
if not (query_string or query_dsl):
raise ValueError('Both query_string and query_dsl ar... | Query Filter Term Aggregation. | FilteredTermsAggregation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FilteredTermsAggregation:
"""Query Filter Term Aggregation."""
def chart_title(self):
"""Returns a title for the chart."""
<|body_0|>
def run(self, field, query_string='', query_dsl='', supported_charts='table', start_time='', end_time='', limit=10):
"""Run the a... | stack_v2_sparse_classes_36k_train_000813 | 7,686 | permissive | [
{
"docstring": "Returns a title for the chart.",
"name": "chart_title",
"signature": "def chart_title(self)"
},
{
"docstring": "Run the aggregation. Args: field (str): this denotes the event attribute that is used for aggregation. query_string (str): the query field to run on all documents prior... | 2 | null | Implement the Python class `FilteredTermsAggregation` described below.
Class description:
Query Filter Term Aggregation.
Method signatures and docstrings:
- def chart_title(self): Returns a title for the chart.
- def run(self, field, query_string='', query_dsl='', supported_charts='table', start_time='', end_time='',... | Implement the Python class `FilteredTermsAggregation` described below.
Class description:
Query Filter Term Aggregation.
Method signatures and docstrings:
- def chart_title(self): Returns a title for the chart.
- def run(self, field, query_string='', query_dsl='', supported_charts='table', start_time='', end_time='',... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class FilteredTermsAggregation:
"""Query Filter Term Aggregation."""
def chart_title(self):
"""Returns a title for the chart."""
<|body_0|>
def run(self, field, query_string='', query_dsl='', supported_charts='table', start_time='', end_time='', limit=10):
"""Run the a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FilteredTermsAggregation:
"""Query Filter Term Aggregation."""
def chart_title(self):
"""Returns a title for the chart."""
if self.field:
return 'Top filtered results for "{0:s}"'.format(self.field)
return 'Top results for an unknown field after filtering'
def run... | the_stack_v2_python_sparse | timesketch/lib/aggregators/term.py | google/timesketch | train | 2,263 |
571307be1e1d20222afe3cbe4527af5fcb38f445 | [
"try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404",
"if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\napplications = LoanApplication.get_members_loan_applications(member)\nserializer = Loa... | <|body_start_0|>
try:
return Member.objects.get(pk=pk)
except Member.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
if pk is not None:
member = self.get_member(int(pk))
else:
member = None
self.check_object_permissions... | LoanApplicationView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoanApplicationView:
def get_member(self, pk):
"""Get a member."""
<|body_0|>
def get(self, request, pk, format=None):
"""List Member's Loan Applications"""
<|body_1|>
def post(self, request, pk, format=None):
"""Add a new Loan Application --- se... | stack_v2_sparse_classes_36k_train_000814 | 13,511 | no_license | [
{
"docstring": "Get a member.",
"name": "get_member",
"signature": "def get_member(self, pk)"
},
{
"docstring": "List Member's Loan Applications",
"name": "get",
"signature": "def get(self, request, pk, format=None)"
},
{
"docstring": "Add a new Loan Application --- serializer: l... | 3 | stack_v2_sparse_classes_30k_train_012143 | Implement the Python class `LoanApplicationView` described below.
Class description:
Implement the LoanApplicationView class.
Method signatures and docstrings:
- def get_member(self, pk): Get a member.
- def get(self, request, pk, format=None): List Member's Loan Applications
- def post(self, request, pk, format=None... | Implement the Python class `LoanApplicationView` described below.
Class description:
Implement the LoanApplicationView class.
Method signatures and docstrings:
- def get_member(self, pk): Get a member.
- def get(self, request, pk, format=None): List Member's Loan Applications
- def post(self, request, pk, format=None... | c5ac11e40a628c93c3865363e97b4f255a104ca8 | <|skeleton|>
class LoanApplicationView:
def get_member(self, pk):
"""Get a member."""
<|body_0|>
def get(self, request, pk, format=None):
"""List Member's Loan Applications"""
<|body_1|>
def post(self, request, pk, format=None):
"""Add a new Loan Application --- se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoanApplicationView:
def get_member(self, pk):
"""Get a member."""
try:
return Member.objects.get(pk=pk)
except Member.DoesNotExist:
raise Http404
def get(self, request, pk, format=None):
"""List Member's Loan Applications"""
if pk is not No... | the_stack_v2_python_sparse | loans/views.py | lubegamark/gosacco | train | 2 | |
67f3c55d95928ad0b76e110373baaacfaab2a022 | [
"token = request.GET.get('token', None)\nself.error = None\nself.user = None\npayload = None\nif token:\n try:\n payload = jwt.decode(token, settings.SECRET_KEY, algorithms=['HS256'])\n except jwt.ExpiredSignatureError:\n self.error = 'Verification link has expired.'\n except jwt.PyJWTError:\... | <|body_start_0|>
token = request.GET.get('token', None)
self.error = None
self.user = None
payload = None
if token:
try:
payload = jwt.decode(token, settings.SECRET_KEY, algorithms=['HS256'])
except jwt.ExpiredSignatureError:
... | Change password. | ChangePasswordView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChangePasswordView:
"""Change password."""
def dispatch(self, request, *args, **kwargs):
"""Validate token."""
<|body_0|>
def get_form_kwargs(self):
"""Set user in form context."""
<|body_1|>
def get_context_data(self, **kwargs):
"""Pass poss... | stack_v2_sparse_classes_36k_train_000815 | 5,474 | permissive | [
{
"docstring": "Validate token.",
"name": "dispatch",
"signature": "def dispatch(self, request, *args, **kwargs)"
},
{
"docstring": "Set user in form context.",
"name": "get_form_kwargs",
"signature": "def get_form_kwargs(self)"
},
{
"docstring": "Pass possible error to template.... | 4 | stack_v2_sparse_classes_30k_train_018182 | Implement the Python class `ChangePasswordView` described below.
Class description:
Change password.
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): Validate token.
- def get_form_kwargs(self): Set user in form context.
- def get_context_data(self, **kwargs): Pass possible error to t... | Implement the Python class `ChangePasswordView` described below.
Class description:
Change password.
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): Validate token.
- def get_form_kwargs(self): Set user in form context.
- def get_context_data(self, **kwargs): Pass possible error to t... | 2c39ba45aa6aef37820b385c3060c83a73f8f910 | <|skeleton|>
class ChangePasswordView:
"""Change password."""
def dispatch(self, request, *args, **kwargs):
"""Validate token."""
<|body_0|>
def get_form_kwargs(self):
"""Set user in form context."""
<|body_1|>
def get_context_data(self, **kwargs):
"""Pass poss... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChangePasswordView:
"""Change password."""
def dispatch(self, request, *args, **kwargs):
"""Validate token."""
token = request.GET.get('token', None)
self.error = None
self.user = None
payload = None
if token:
try:
payload = jwt.... | the_stack_v2_python_sparse | weight/users/views/users.py | SeptumDevs/lose_weightapp | train | 1 |
7973bda82343e3673b00fe6243ba5c7ff4e43dfc | [
"found = model.get_repo_notification(uuid)\nif not found:\n raise NotFound()\nreturn found.to_dict()",
"deleted = model.delete_repo_notification(namespace_name, repository_name, uuid)\nif not deleted:\n raise InvalidRequest('No repository notification found for: %s, %s, %s' % (namespace_name, repository_nam... | <|body_start_0|>
found = model.get_repo_notification(uuid)
if not found:
raise NotFound()
return found.to_dict()
<|end_body_0|>
<|body_start_1|>
deleted = model.delete_repo_notification(namespace_name, repository_name, uuid)
if not deleted:
raise InvalidR... | Resource for dealing with specific notifications. | RepositoryNotification | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepositoryNotification:
"""Resource for dealing with specific notifications."""
def get(self, namespace_name, repository_name, uuid):
"""Get information for the specified notification."""
<|body_0|>
def delete(self, namespace_name, repository_name, uuid):
"""Dele... | stack_v2_sparse_classes_36k_train_000816 | 7,623 | permissive | [
{
"docstring": "Get information for the specified notification.",
"name": "get",
"signature": "def get(self, namespace_name, repository_name, uuid)"
},
{
"docstring": "Deletes the specified notification.",
"name": "delete",
"signature": "def delete(self, namespace_name, repository_name, ... | 3 | null | Implement the Python class `RepositoryNotification` described below.
Class description:
Resource for dealing with specific notifications.
Method signatures and docstrings:
- def get(self, namespace_name, repository_name, uuid): Get information for the specified notification.
- def delete(self, namespace_name, reposit... | Implement the Python class `RepositoryNotification` described below.
Class description:
Resource for dealing with specific notifications.
Method signatures and docstrings:
- def get(self, namespace_name, repository_name, uuid): Get information for the specified notification.
- def delete(self, namespace_name, reposit... | e400a0c22c5f89dd35d571654b13d262b1f6e3b3 | <|skeleton|>
class RepositoryNotification:
"""Resource for dealing with specific notifications."""
def get(self, namespace_name, repository_name, uuid):
"""Get information for the specified notification."""
<|body_0|>
def delete(self, namespace_name, repository_name, uuid):
"""Dele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RepositoryNotification:
"""Resource for dealing with specific notifications."""
def get(self, namespace_name, repository_name, uuid):
"""Get information for the specified notification."""
found = model.get_repo_notification(uuid)
if not found:
raise NotFound()
... | the_stack_v2_python_sparse | endpoints/api/repositorynotification.py | quay/quay | train | 2,363 |
1303a02da360a90eefefe6429429b3802c492211 | [
"if self.extra_state.get('matching'):\n return Group.objects.filter(local_site=self.extra_state['local_site'])\nelse:\n request = self.extra_state.get('request')\n assert request is not None\n if 'local_site' in self.extra_state:\n local_site = self.extra_state['local_site']\n else:\n l... | <|body_start_0|>
if self.extra_state.get('matching'):
return Group.objects.filter(local_site=self.extra_state['local_site'])
else:
request = self.extra_state.get('request')
assert request is not None
if 'local_site' in self.extra_state:
loc... | A condition choice for matching review groups. This is used to match a :py:class:`~reviewboard.reviews.models.group.Group` against a list of groups, against no group (empty list), or against a group's public/invite-only state. | ReviewGroupsChoice | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReviewGroupsChoice:
"""A condition choice for matching review groups. This is used to match a :py:class:`~reviewboard.reviews.models.group.Group` against a list of groups, against no group (empty list), or against a group's public/invite-only state."""
def get_queryset(self):
"""Retu... | stack_v2_sparse_classes_36k_train_000817 | 16,348 | permissive | [
{
"docstring": "Return the queryset used to look up review group choices. Returns: django.db.models.query.QuerySet: The queryset for review groups.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Return the review groups used for matching. Args: review_groups (... | 2 | stack_v2_sparse_classes_30k_train_009428 | Implement the Python class `ReviewGroupsChoice` described below.
Class description:
A condition choice for matching review groups. This is used to match a :py:class:`~reviewboard.reviews.models.group.Group` against a list of groups, against no group (empty list), or against a group's public/invite-only state.
Method ... | Implement the Python class `ReviewGroupsChoice` described below.
Class description:
A condition choice for matching review groups. This is used to match a :py:class:`~reviewboard.reviews.models.group.Group` against a list of groups, against no group (empty list), or against a group's public/invite-only state.
Method ... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class ReviewGroupsChoice:
"""A condition choice for matching review groups. This is used to match a :py:class:`~reviewboard.reviews.models.group.Group` against a list of groups, against no group (empty list), or against a group's public/invite-only state."""
def get_queryset(self):
"""Retu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReviewGroupsChoice:
"""A condition choice for matching review groups. This is used to match a :py:class:`~reviewboard.reviews.models.group.Group` against a list of groups, against no group (empty list), or against a group's public/invite-only state."""
def get_queryset(self):
"""Return the querys... | the_stack_v2_python_sparse | reviewboard/reviews/conditions.py | reviewboard/reviewboard | train | 1,141 |
793e9053b218a4c4ece4d609e02a50cd685bfa1b | [
"super(LabelSmoothingLoss, self).__init__()\nself.criterion = criterion\nself.padding_idx = padding_idx\nassert 0.0 < smoothing <= 1.0\nself.confidence = 1.0 - smoothing\nself.smoothing = smoothing\nself.size = size\nself.true_dist = None\nself.normalize_length = normalize_length",
"assert x.size(2) == self.size\... | <|body_start_0|>
super(LabelSmoothingLoss, self).__init__()
self.criterion = criterion
self.padding_idx = padding_idx
assert 0.0 < smoothing <= 1.0
self.confidence = 1.0 - smoothing
self.smoothing = smoothing
self.size = size
self.true_dist = None
... | Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number of class padding_idx: padding_idx: ignored cla... | LabelSmoothingLoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabelSmoothingLoss:
"""Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number ... | stack_v2_sparse_classes_36k_train_000818 | 33,189 | permissive | [
{
"docstring": "Construct an LabelSmoothingLoss object.",
"name": "__init__",
"signature": "def __init__(self, size: int, padding_idx: int=-1, smoothing: float=0.1, normalize_length: bool=False, criterion: nn.Module=nn.KLDivLoss(reduction='none')) -> None"
},
{
"docstring": "Compute loss between... | 2 | stack_v2_sparse_classes_30k_train_002171 | Implement the Python class `LabelSmoothingLoss` described below.
Class description:
Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_sm... | Implement the Python class `LabelSmoothingLoss` described below.
Class description:
Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_sm... | 2dda31e14039a79b77c89bcd3bb96d52cbf60c8a | <|skeleton|>
class LabelSmoothingLoss:
"""Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LabelSmoothingLoss:
"""Label-smoothing loss. KL-divergence between q_{smoothed ground truth prob.}(w) and p_{prob. computed by model}(w) is minimized. Modified from https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/label_smoothing_loss.py Args: size: the number of class padd... | the_stack_v2_python_sparse | snowfall/models/transformer.py | csukuangfj/snowfall | train | 0 |
3bb45ee354a4066ee80e1d8680f81a5e3086163d | [
"self.licensed = licensed\nself.insurance_group = insurance_group\nself.insurance_type = insurance_type\nself.summary_cards = summary_cards\nself.summary_notics = summary_notics\nself.image_albums = image_albums\nself.video_galleries = video_galleries\nself.insurance_centre = insurance_centre\nself.insurance_centre... | <|body_start_0|>
self.licensed = licensed
self.insurance_group = insurance_group
self.insurance_type = insurance_type
self.summary_cards = summary_cards
self.summary_notics = summary_notics
self.image_albums = image_albums
self.video_galleries = video_galleries
... | Implementation of the 'PortalLandingContactAbout' model. TODO: type model description here. Attributes: licensed (bool): TODO: type description here. insurance_group (list of string): TODO: type description here. insurance_type (list of string): TODO: type description here. summary_cards (list of string): TODO: type de... | PortalLandingContactAbout | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PortalLandingContactAbout:
"""Implementation of the 'PortalLandingContactAbout' model. TODO: type model description here. Attributes: licensed (bool): TODO: type description here. insurance_group (list of string): TODO: type description here. insurance_type (list of string): TODO: type descriptio... | stack_v2_sparse_classes_36k_train_000819 | 4,282 | permissive | [
{
"docstring": "Constructor for the PortalLandingContactAbout class",
"name": "__init__",
"signature": "def __init__(self, licensed=None, insurance_group=None, insurance_type=None, summary_cards=None, summary_notics=None, image_albums=None, video_galleries=None, insurance_centre=None, insurance_centre_p... | 2 | stack_v2_sparse_classes_30k_train_003977 | Implement the Python class `PortalLandingContactAbout` described below.
Class description:
Implementation of the 'PortalLandingContactAbout' model. TODO: type model description here. Attributes: licensed (bool): TODO: type description here. insurance_group (list of string): TODO: type description here. insurance_type ... | Implement the Python class `PortalLandingContactAbout` described below.
Class description:
Implementation of the 'PortalLandingContactAbout' model. TODO: type model description here. Attributes: licensed (bool): TODO: type description here. insurance_group (list of string): TODO: type description here. insurance_type ... | b574a76a8805b306a423229b572c36dae0159def | <|skeleton|>
class PortalLandingContactAbout:
"""Implementation of the 'PortalLandingContactAbout' model. TODO: type model description here. Attributes: licensed (bool): TODO: type description here. insurance_group (list of string): TODO: type description here. insurance_type (list of string): TODO: type descriptio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PortalLandingContactAbout:
"""Implementation of the 'PortalLandingContactAbout' model. TODO: type model description here. Attributes: licensed (bool): TODO: type description here. insurance_group (list of string): TODO: type description here. insurance_type (list of string): TODO: type description here. summa... | the_stack_v2_python_sparse | easybimehlanding/models/portal_landing_contact_about.py | kmelodi/EasyBimehLanding_Python | train | 0 |
5fd36c29bd0e7ddb1e6a854bf6cdb105fe87e735 | [
"if self.renewal_date is None:\n return None\nyear = self.renewal_date.year\nif self.renewal_date.month >= LICENSE_RENEWAL_MONTH:\n year = year + 1\nreturn date(year, LICENSE_EXPIRY_MONTH, 1)",
"if not self.exists:\n return False\nexpiry = self.expiry_date()\nreturn expiry is None or expiry > time.date()... | <|body_start_0|>
if self.renewal_date is None:
return None
year = self.renewal_date.year
if self.renewal_date.month >= LICENSE_RENEWAL_MONTH:
year = year + 1
return date(year, LICENSE_EXPIRY_MONTH, 1)
<|end_body_0|>
<|body_start_1|>
if not self.exists:
... | Licence information as retrieved from FFCAM servers. | LicenseInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LicenseInfo:
"""Licence information as retrieved from FFCAM servers."""
def expiry_date(self):
"""Get licence expiration date. Licence expire at the start of the month `LICENSE_EXPIRY_MONTH` which follow the renewal date. :return: License expiration date. `None` if renewal_date is `N... | stack_v2_sparse_classes_36k_train_000820 | 9,337 | no_license | [
{
"docstring": "Get licence expiration date. Licence expire at the start of the month `LICENSE_EXPIRY_MONTH` which follow the renewal date. :return: License expiration date. `None` if renewal_date is `None` :rtype: :py:class:`datetime.date`",
"name": "expiry_date",
"signature": "def expiry_date(self)"
... | 2 | stack_v2_sparse_classes_30k_train_005756 | Implement the Python class `LicenseInfo` described below.
Class description:
Licence information as retrieved from FFCAM servers.
Method signatures and docstrings:
- def expiry_date(self): Get licence expiration date. Licence expire at the start of the month `LICENSE_EXPIRY_MONTH` which follow the renewal date. :retu... | Implement the Python class `LicenseInfo` described below.
Class description:
Licence information as retrieved from FFCAM servers.
Method signatures and docstrings:
- def expiry_date(self): Get licence expiration date. Licence expire at the start of the month `LICENSE_EXPIRY_MONTH` which follow the renewal date. :retu... | 1ae05ae9029a28fd0656c06a2092f67a87a93dcd | <|skeleton|>
class LicenseInfo:
"""Licence information as retrieved from FFCAM servers."""
def expiry_date(self):
"""Get licence expiration date. Licence expire at the start of the month `LICENSE_EXPIRY_MONTH` which follow the renewal date. :return: License expiration date. `None` if renewal_date is `N... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LicenseInfo:
"""Licence information as retrieved from FFCAM servers."""
def expiry_date(self):
"""Get licence expiration date. Licence expire at the start of the month `LICENSE_EXPIRY_MONTH` which follow the renewal date. :return: License expiration date. `None` if renewal_date is `None` :rtype: ... | the_stack_v2_python_sparse | collectives/utils/extranet.py | Club-Alpin-Annecy/collectives | train | 12 |
9ebf934704aeea1f8dc1e4c39359380d1e810cce | [
"invitee = get_object_or_404(models.Invitee, pk=pk)\nif not invitee.invitation_sent_date:\n email = emails.InvitationEmail(invitee, request)\n custom_send_mail(subject=email.subject, html_message=email.message, from_email=email.from_email, recipient_list=email.to_list)\n invitee.invitation_sent_date = time... | <|body_start_0|>
invitee = get_object_or_404(models.Invitee, pk=pk)
if not invitee.invitation_sent_date:
email = emails.InvitationEmail(invitee, request)
custom_send_mail(subject=email.subject, html_message=email.message, from_email=email.from_email, recipient_list=email.to_list)... | InviteeSendInvitationAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InviteeSendInvitationAPIView:
def post(self, request, pk):
"""send the email"""
<|body_0|>
def get(self, request, pk):
"""get a preview of the email to be sent"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
invitee = get_object_or_404(models.Invite... | stack_v2_sparse_classes_36k_train_000821 | 7,363 | no_license | [
{
"docstring": "send the email",
"name": "post",
"signature": "def post(self, request, pk)"
},
{
"docstring": "get a preview of the email to be sent",
"name": "get",
"signature": "def get(self, request, pk)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011555 | Implement the Python class `InviteeSendInvitationAPIView` described below.
Class description:
Implement the InviteeSendInvitationAPIView class.
Method signatures and docstrings:
- def post(self, request, pk): send the email
- def get(self, request, pk): get a preview of the email to be sent | Implement the Python class `InviteeSendInvitationAPIView` described below.
Class description:
Implement the InviteeSendInvitationAPIView class.
Method signatures and docstrings:
- def post(self, request, pk): send the email
- def get(self, request, pk): get a preview of the email to be sent
<|skeleton|>
class Invite... | 483f855b19876fd60c0017a270df74e076aa0d8b | <|skeleton|>
class InviteeSendInvitationAPIView:
def post(self, request, pk):
"""send the email"""
<|body_0|>
def get(self, request, pk):
"""get a preview of the email to be sent"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InviteeSendInvitationAPIView:
def post(self, request, pk):
"""send the email"""
invitee = get_object_or_404(models.Invitee, pk=pk)
if not invitee.invitation_sent_date:
email = emails.InvitationEmail(invitee, request)
custom_send_mail(subject=email.subject, html_... | the_stack_v2_python_sparse | events/api/views.py | yc-hu/dm_apps | train | 0 | |
9090d2d5193b977778ac13e0f191544669e802ab | [
"super().__init__()\nself.output_feature_size = output_feature_size\nself.dropout = dropout\noutput_size, self.inject_input = inject_input(input_feature_size, action_feature_size + output_feature_size, output_feature_size, output_feature_size)\nself.lstm = nn.LSTMCell(output_size, output_feature_size)",
"h_n = hi... | <|body_start_0|>
super().__init__()
self.output_feature_size = output_feature_size
self.dropout = dropout
output_size, self.inject_input = inject_input(input_feature_size, action_feature_size + output_feature_size, output_feature_size, output_feature_size)
self.lstm = nn.LSTMCell... | LSTMTreeDecoder | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSTMTreeDecoder:
def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0):
"""Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each Ac... | stack_v2_sparse_classes_36k_train_000822 | 5,183 | permissive | [
{
"docstring": "Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each ActionSequence vector output_feature_size: int The number of features in the hidden state dropout: float The probability of dropout",
"name": "__init__",
"signature":... | 2 | null | Implement the Python class `LSTMTreeDecoder` described below.
Class description:
Implement the LSTMTreeDecoder class.
Method signatures and docstrings:
- def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): Constructor Paramete... | Implement the Python class `LSTMTreeDecoder` described below.
Class description:
Implement the LSTMTreeDecoder class.
Method signatures and docstrings:
- def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0): Constructor Paramete... | 573e94c567064705fa65267dd83946bf183197de | <|skeleton|>
class LSTMTreeDecoder:
def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0):
"""Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each Ac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LSTMTreeDecoder:
def __init__(self, inject_input: InjectInput, input_feature_size: int, action_feature_size: int, output_feature_size: int, dropout: float=0.0):
"""Constructor Parameters ---------- input_feature_size: int Size of each input vector action_feature_size: int Size of each ActionSequence v... | the_stack_v2_python_sparse | mlprogram/nn/action_sequence/lstm_tree_decoder.py | brando90/mlprogram | train | 0 | |
e71b41c8c13ba836918437e412749a802aea56b0 | [
"if len(nums) == 0:\n return []\ni, j = (0, 0)\nwhile j < len(nums):\n if nums[j] % 2 != 0:\n nums[i], nums[j] = (nums[j], nums[i])\n i += 1\n j += 1\nreturn nums",
"if len(nums) == 0:\n return []\ni, j = (0, len(nums) - 1)\nwhile i < j:\n while i < j and nums[i] % 2 != 0:\n i ... | <|body_start_0|>
if len(nums) == 0:
return []
i, j = (0, 0)
while j < len(nums):
if nums[j] % 2 != 0:
nums[i], nums[j] = (nums[j], nums[i])
i += 1
j += 1
return nums
<|end_body_0|>
<|body_start_1|>
if len(nums) ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def exchange(self, nums: List[int]) -> List[int]:
"""双指针, 动态规划 使i为奇偶边缘的第一个偶数下标 j向右走 :param nums: :return:"""
<|body_0|>
def exchange(self, nums: List[int]) -> List[int]:
"""双指针 i开头 j末尾 :param nums: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_000823 | 1,963 | no_license | [
{
"docstring": "双指针, 动态规划 使i为奇偶边缘的第一个偶数下标 j向右走 :param nums: :return:",
"name": "exchange",
"signature": "def exchange(self, nums: List[int]) -> List[int]"
},
{
"docstring": "双指针 i开头 j末尾 :param nums: :return:",
"name": "exchange",
"signature": "def exchange(self, nums: List[int]) -> List[... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exchange(self, nums: List[int]) -> List[int]: 双指针, 动态规划 使i为奇偶边缘的第一个偶数下标 j向右走 :param nums: :return:
- def exchange(self, nums: List[int]) -> List[int]: 双指针 i开头 j末尾 :param nums... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exchange(self, nums: List[int]) -> List[int]: 双指针, 动态规划 使i为奇偶边缘的第一个偶数下标 j向右走 :param nums: :return:
- def exchange(self, nums: List[int]) -> List[int]: 双指针 i开头 j末尾 :param nums... | b1680014ce3f55ba952a1e64241c0cbb783cc436 | <|skeleton|>
class Solution:
def exchange(self, nums: List[int]) -> List[int]:
"""双指针, 动态规划 使i为奇偶边缘的第一个偶数下标 j向右走 :param nums: :return:"""
<|body_0|>
def exchange(self, nums: List[int]) -> List[int]:
"""双指针 i开头 j末尾 :param nums: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def exchange(self, nums: List[int]) -> List[int]:
"""双指针, 动态规划 使i为奇偶边缘的第一个偶数下标 j向右走 :param nums: :return:"""
if len(nums) == 0:
return []
i, j = (0, 0)
while j < len(nums):
if nums[j] % 2 != 0:
nums[i], nums[j] = (nums[j], nums[... | the_stack_v2_python_sparse | 21.py | sun510001/leetcode_jianzhi_offer_2 | train | 0 | |
58fc98edb1e6fca22c80fabdb0744a0eab102f27 | [
"if isinstance(value, basestring):\n try:\n value = format.parse_decimal(value)\n except ValueError:\n pass\nreturn validators.Number.to_python(value, state)",
"dec_places = util.find_precision(value)\nif dec_places > 0:\n return format.format_decimal(value, dec_places)\nelse:\n return f... | <|body_start_0|>
if isinstance(value, basestring):
try:
value = format.parse_decimal(value)
except ValueError:
pass
return validators.Number.to_python(value, state)
<|end_body_0|>
<|body_start_1|>
dec_places = util.find_precision(value)
... | Number | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Number:
def _to_python(self, value, state):
"""parse a string and returns a float or integer"""
<|body_0|>
def _from_python(self, value, state):
"""returns a string using the correct grouping"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if isinst... | stack_v2_sparse_classes_36k_train_000824 | 8,823 | no_license | [
{
"docstring": "parse a string and returns a float or integer",
"name": "_to_python",
"signature": "def _to_python(self, value, state)"
},
{
"docstring": "returns a string using the correct grouping",
"name": "_from_python",
"signature": "def _from_python(self, value, state)"
}
] | 2 | null | Implement the Python class `Number` described below.
Class description:
Implement the Number class.
Method signatures and docstrings:
- def _to_python(self, value, state): parse a string and returns a float or integer
- def _from_python(self, value, state): returns a string using the correct grouping | Implement the Python class `Number` described below.
Class description:
Implement the Number class.
Method signatures and docstrings:
- def _to_python(self, value, state): parse a string and returns a float or integer
- def _from_python(self, value, state): returns a string using the correct grouping
<|skeleton|>
cl... | ca228848364edb204b15a7411fd6192379781c78 | <|skeleton|>
class Number:
def _to_python(self, value, state):
"""parse a string and returns a float or integer"""
<|body_0|>
def _from_python(self, value, state):
"""returns a string using the correct grouping"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Number:
def _to_python(self, value, state):
"""parse a string and returns a float or integer"""
if isinstance(value, basestring):
try:
value = format.parse_decimal(value)
except ValueError:
pass
return validators.Number.to_python(... | the_stack_v2_python_sparse | working-env/lib/python2.5/TurboGears-1.0.2.2-py2.5.egg/turbogears/validators.py | thraxil/gtreed | train | 1 | |
2f2f8556d5e21762a2af8fb475d0b1ca3097146b | [
"if head is None or head.next is None:\n return head\nslow, fast, pre = (head, head, head)\nwhile fast is not None and fast.next is not None:\n pre = slow\n slow = slow.next\n fast = fast.next.next\npre.next = None\nreturn self.merge(self.sortList(head), self.sortList(slow))",
"dummy = ListNode(-1)\nc... | <|body_start_0|>
if head is None or head.next is None:
return head
slow, fast, pre = (head, head, head)
while fast is not None and fast.next is not None:
pre = slow
slow = slow.next
fast = fast.next.next
pre.next = None
return self.... | SortList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SortList:
def sortList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def merge(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if head is None or head.... | stack_v2_sparse_classes_36k_train_000825 | 1,831 | permissive | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "sortList",
"signature": "def sortList(self, head)"
},
{
"docstring": ":param l1: ListNode :param l2: ListNode :return: ListNode",
"name": "merge",
"signature": "def merge(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017477 | Implement the Python class `SortList` described below.
Class description:
Implement the SortList class.
Method signatures and docstrings:
- def sortList(self, head): :type head: ListNode :rtype: ListNode
- def merge(self, l1, l2): :param l1: ListNode :param l2: ListNode :return: ListNode | Implement the Python class `SortList` described below.
Class description:
Implement the SortList class.
Method signatures and docstrings:
- def sortList(self, head): :type head: ListNode :rtype: ListNode
- def merge(self, l1, l2): :param l1: ListNode :param l2: ListNode :return: ListNode
<|skeleton|>
class SortList:... | 39f85cdedaaf5b85f7ce842ecef975301fc974cf | <|skeleton|>
class SortList:
def sortList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def merge(self, l1, l2):
""":param l1: ListNode :param l2: ListNode :return: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SortList:
def sortList(self, head):
""":type head: ListNode :rtype: ListNode"""
if head is None or head.next is None:
return head
slow, fast, pre = (head, head, head)
while fast is not None and fast.next is not None:
pre = slow
slow = slow.ne... | the_stack_v2_python_sparse | Python/SortList.py | santosh241/Windary | train | 2 | |
e90e6b59c375a549e966ac042c2d453f7a6fe462 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | USIServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class USIServiceServicer:
"""Missing associated documentation comment in .proto file."""
def GetPower(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetInterface(self, request, context):
"""Missing associated docu... | stack_v2_sparse_classes_36k_train_000826 | 6,848 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetPower",
"signature": "def GetPower(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetInterface",
"signature": "def GetInterface(self, re... | 4 | stack_v2_sparse_classes_30k_train_008171 | Implement the Python class `USIServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetPower(self, request, context): Missing associated documentation comment in .proto file.
- def GetInterface(self, request, context): Mi... | Implement the Python class `USIServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetPower(self, request, context): Missing associated documentation comment in .proto file.
- def GetInterface(self, request, context): Mi... | 8d279c468486e06f24715a66385e02efaddb7f01 | <|skeleton|>
class USIServiceServicer:
"""Missing associated documentation comment in .proto file."""
def GetPower(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetInterface(self, request, context):
"""Missing associated docu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class USIServiceServicer:
"""Missing associated documentation comment in .proto file."""
def GetPower(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | daq/proto/usi_pb2_grpc.py | faucetsdn/daq | train | 47 |
e591eff69ae2a6836363b9eff0d7df0042d08128 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Ad Parameter service. Service to manage ad parameters. | AdParameterServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdParameterServiceServicer:
"""Proto file describing the Ad Parameter service. Service to manage ad parameters."""
def GetAdParameter(self, request, context):
"""Returns the requested ad parameter in full detail."""
<|body_0|>
def MutateAdParameters(self, request, contex... | stack_v2_sparse_classes_36k_train_000827 | 3,370 | permissive | [
{
"docstring": "Returns the requested ad parameter in full detail.",
"name": "GetAdParameter",
"signature": "def GetAdParameter(self, request, context)"
},
{
"docstring": "Creates, updates, or removes ad parameters. Operation statuses are returned.",
"name": "MutateAdParameters",
"signat... | 2 | stack_v2_sparse_classes_30k_train_010756 | Implement the Python class `AdParameterServiceServicer` described below.
Class description:
Proto file describing the Ad Parameter service. Service to manage ad parameters.
Method signatures and docstrings:
- def GetAdParameter(self, request, context): Returns the requested ad parameter in full detail.
- def MutateAd... | Implement the Python class `AdParameterServiceServicer` described below.
Class description:
Proto file describing the Ad Parameter service. Service to manage ad parameters.
Method signatures and docstrings:
- def GetAdParameter(self, request, context): Returns the requested ad parameter in full detail.
- def MutateAd... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class AdParameterServiceServicer:
"""Proto file describing the Ad Parameter service. Service to manage ad parameters."""
def GetAdParameter(self, request, context):
"""Returns the requested ad parameter in full detail."""
<|body_0|>
def MutateAdParameters(self, request, contex... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdParameterServiceServicer:
"""Proto file describing the Ad Parameter service. Service to manage ad parameters."""
def GetAdParameter(self, request, context):
"""Returns the requested ad parameter in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_detai... | the_stack_v2_python_sparse | google/ads/google_ads/v2/proto/services/ad_parameter_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
e10f5f8ae5bbe0b43f677d18e3f4bea3009073f6 | [
"all_permutations = []\nself.permute_recursive(s, 0, '', all_permutations)\nreturn all_permutations",
"while pos != len(s):\n if s[pos].isalpha():\n self.permute_recursive(s, pos + 1, curr + s[pos].lower(), all_p)\n self.permute_recursive(s, pos + 1, curr + s[pos].upper(), all_p)\n return\... | <|body_start_0|>
all_permutations = []
self.permute_recursive(s, 0, '', all_permutations)
return all_permutations
<|end_body_0|>
<|body_start_1|>
while pos != len(s):
if s[pos].isalpha():
self.permute_recursive(s, pos + 1, curr + s[pos].lower(), all_p)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def letterCasePermutation(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def permute_recursive(self, s, pos, curr, all_p):
"""Recursively build the string while checking for letters one character at a time."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_000828 | 1,024 | no_license | [
{
"docstring": ":type s: str :rtype: List[str]",
"name": "letterCasePermutation",
"signature": "def letterCasePermutation(self, s)"
},
{
"docstring": "Recursively build the string while checking for letters one character at a time.",
"name": "permute_recursive",
"signature": "def permute... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def letterCasePermutation(self, s): :type s: str :rtype: List[str]
- def permute_recursive(self, s, pos, curr, all_p): Recursively build the string while checking for letters one... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def letterCasePermutation(self, s): :type s: str :rtype: List[str]
- def permute_recursive(self, s, pos, curr, all_p): Recursively build the string while checking for letters one... | c14d8829c95f61ff6691816e8c0de76b9319f389 | <|skeleton|>
class Solution:
def letterCasePermutation(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def permute_recursive(self, s, pos, curr, all_p):
"""Recursively build the string while checking for letters one character at a time."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def letterCasePermutation(self, s):
""":type s: str :rtype: List[str]"""
all_permutations = []
self.permute_recursive(s, 0, '', all_permutations)
return all_permutations
def permute_recursive(self, s, pos, curr, all_p):
"""Recursively build the string whi... | the_stack_v2_python_sparse | easy/letter-case-permutation/solution.py | hsuanhauliu/leetcode-solutions | train | 0 | |
d497ea1369ea6dc455359d411e0c3657a724e2d4 | [
"self.indices = indices\nself.possibilities = possibilities\nself.chosen = None",
"cards = [game.currentTurn.request.cards[cardIndex] for cardIndex in self.indices if cardIndex < len(self.possibilities)]\npassed = len(self.indices) == len(cards)\nif passed:\n self.chosen = cards\nreturn passed"
] | <|body_start_0|>
self.indices = indices
self.possibilities = possibilities
self.chosen = None
<|end_body_0|>
<|body_start_1|>
cards = [game.currentTurn.request.cards[cardIndex] for cardIndex in self.indices if cardIndex < len(self.possibilities)]
passed = len(self.indices) == le... | Represents a command requirement that can only be run if the indices exist in the list | IndicesInList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IndicesInList:
"""Represents a command requirement that can only be run if the indices exist in the list"""
def __init__(self, indices, possibilities):
"""Initialize the requirement with the indices and list to check"""
<|body_0|>
def passed(self, player, game):
... | stack_v2_sparse_classes_36k_train_000829 | 778 | no_license | [
{
"docstring": "Initialize the requirement with the indices and list to check",
"name": "__init__",
"signature": "def __init__(self, indices, possibilities)"
},
{
"docstring": "Return if the requirement passes",
"name": "passed",
"signature": "def passed(self, player, game)"
}
] | 2 | null | Implement the Python class `IndicesInList` described below.
Class description:
Represents a command requirement that can only be run if the indices exist in the list
Method signatures and docstrings:
- def __init__(self, indices, possibilities): Initialize the requirement with the indices and list to check
- def pass... | Implement the Python class `IndicesInList` described below.
Class description:
Represents a command requirement that can only be run if the indices exist in the list
Method signatures and docstrings:
- def __init__(self, indices, possibilities): Initialize the requirement with the indices and list to check
- def pass... | 0b5a7573a3cf33430fe61e4ff8a8a7a0ae20b258 | <|skeleton|>
class IndicesInList:
"""Represents a command requirement that can only be run if the indices exist in the list"""
def __init__(self, indices, possibilities):
"""Initialize the requirement with the indices and list to check"""
<|body_0|>
def passed(self, player, game):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IndicesInList:
"""Represents a command requirement that can only be run if the indices exist in the list"""
def __init__(self, indices, possibilities):
"""Initialize the requirement with the indices and list to check"""
self.indices = indices
self.possibilities = possibilities
... | the_stack_v2_python_sparse | src/Game/Commands/Requirements/indices_in_list.py | dfwarden/DeckBuilding | train | 0 |
b3cd84a88d29a7b409fba1d4c7d286ca7a649318 | [
"self.board = board\nself.word = word\nfor i in range(len(board)):\n for j in range(len(board[0])):\n if self.dfs(0, i, j):\n return True\nreturn False",
"if not 0 <= row < len(self.board) or not 0 <= col < len(self.board[0]) or self.board[row][col] != self.word[index]:\n return False\nif ... | <|body_start_0|>
self.board = board
self.word = word
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(0, i, j):
return True
return False
<|end_body_0|>
<|body_start_1|>
if not 0 <= row < len(self.board) or not... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def exist(self, board, word):
"""回溯 parameter: board: list[list[str]] word: str return: bool"""
<|body_0|>
def dfs(self, index, row, col):
"""parameter: index: int, 接下来要找的char row: int, 当前所在行 col: int, 当前所在行 return: bool"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_000830 | 1,484 | no_license | [
{
"docstring": "回溯 parameter: board: list[list[str]] word: str return: bool",
"name": "exist",
"signature": "def exist(self, board, word)"
},
{
"docstring": "parameter: index: int, 接下来要找的char row: int, 当前所在行 col: int, 当前所在行 return: bool",
"name": "dfs",
"signature": "def dfs(self, index,... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): 回溯 parameter: board: list[list[str]] word: str return: bool
- def dfs(self, index, row, col): parameter: index: int, 接下来要找的char row: int, 当前所在行 col:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def exist(self, board, word): 回溯 parameter: board: list[list[str]] word: str return: bool
- def dfs(self, index, row, col): parameter: index: int, 接下来要找的char row: int, 当前所在行 col:... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def exist(self, board, word):
"""回溯 parameter: board: list[list[str]] word: str return: bool"""
<|body_0|>
def dfs(self, index, row, col):
"""parameter: index: int, 接下来要找的char row: int, 当前所在行 col: int, 当前所在行 return: bool"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def exist(self, board, word):
"""回溯 parameter: board: list[list[str]] word: str return: bool"""
self.board = board
self.word = word
for i in range(len(board)):
for j in range(len(board[0])):
if self.dfs(0, i, j):
return ... | the_stack_v2_python_sparse | code/面试题12. 矩阵中的路径.py | AiZhanghan/Leetcode | train | 0 | |
add3fbc180cf94c630dfd1da44ec209f262dbb8d | [
"city_url = response.xpath('//div[@class = \"all\"]/div[2]/ul/div[2]/li/a/@href').extract()\ncity_name = response.xpath('//div[@class = \"all\"]/div[2]/ul/div[2]/li/a/text()').extract()\nprint('正在解析每个城市的URL链接')\nfor url, name in zip(city_url, city_name):\n yield scrapy.Request(url='{}{}'.format(self.base_urls, u... | <|body_start_0|>
city_url = response.xpath('//div[@class = "all"]/div[2]/ul/div[2]/li/a/@href').extract()
city_name = response.xpath('//div[@class = "all"]/div[2]/ul/div[2]/li/a/text()').extract()
print('正在解析每个城市的URL链接')
for url, name in zip(city_url, city_name):
yield scrapy... | AreaSpiderSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AreaSpiderSpider:
def parse(self, response):
"""匹配城市详情页 :param response: :return:"""
<|body_0|>
def parse_month(self, response):
"""匹配月份详情页 :param response: :return:"""
<|body_1|>
def parse_day(self, response):
"""匹配每一天的详细数据 :param response: :ret... | stack_v2_sparse_classes_36k_train_000831 | 2,431 | no_license | [
{
"docstring": "匹配城市详情页 :param response: :return:",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "匹配月份详情页 :param response: :return:",
"name": "parse_month",
"signature": "def parse_month(self, response)"
},
{
"docstring": "匹配每一天的详细数据 :param response... | 3 | stack_v2_sparse_classes_30k_val_000139 | Implement the Python class `AreaSpiderSpider` described below.
Class description:
Implement the AreaSpiderSpider class.
Method signatures and docstrings:
- def parse(self, response): 匹配城市详情页 :param response: :return:
- def parse_month(self, response): 匹配月份详情页 :param response: :return:
- def parse_day(self, response):... | Implement the Python class `AreaSpiderSpider` described below.
Class description:
Implement the AreaSpiderSpider class.
Method signatures and docstrings:
- def parse(self, response): 匹配城市详情页 :param response: :return:
- def parse_month(self, response): 匹配月份详情页 :param response: :return:
- def parse_day(self, response):... | 066876c61893cbf71df71ef5cdf2d00a4e4a1638 | <|skeleton|>
class AreaSpiderSpider:
def parse(self, response):
"""匹配城市详情页 :param response: :return:"""
<|body_0|>
def parse_month(self, response):
"""匹配月份详情页 :param response: :return:"""
<|body_1|>
def parse_day(self, response):
"""匹配每一天的详细数据 :param response: :ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AreaSpiderSpider:
def parse(self, response):
"""匹配城市详情页 :param response: :return:"""
city_url = response.xpath('//div[@class = "all"]/div[2]/ul/div[2]/li/a/@href').extract()
city_name = response.xpath('//div[@class = "all"]/div[2]/ul/div[2]/li/a/text()').extract()
print('正在解析每个... | the_stack_v2_python_sparse | Area/Area/spiders/area_spider.py | 960081508/pachong | train | 0 | |
281f2db8b868224f840b46a2971d7b1da9cd3ebd | [
"self.head = Block()\nself.tail = Block()\nself.head.next = self.tail\nself.tail.prev = self.head\nself.mapping = {}",
"if key not in self.mapping:\n cur_block = self.head\nelse:\n cur_block = self.mapping[key]\n cur_block.keys.remove(key)\nif cur_block.val + 1 != cur_block.next.val:\n new_block = Blo... | <|body_start_0|>
self.head = Block()
self.tail = Block()
self.head.next = self.tail
self.tail.prev = self.head
self.mapping = {}
<|end_body_0|>
<|body_start_1|>
if key not in self.mapping:
cur_block = self.head
else:
cur_block = self.mappi... | AllOne | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllOne:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def inc(self, key: str) -> None:
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1."""
<|body_1|>
def dec(self, key: str) -> None:
"""Decr... | stack_v2_sparse_classes_36k_train_000832 | 2,624 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a new key <Key> with value 1. Or increments an existing key by 1.",
"name": "inc",
"signature": "def inc(self, key: str) -> None"
},
{
"docstrin... | 5 | stack_v2_sparse_classes_30k_train_011355 | Implement the Python class `AllOne` described below.
Class description:
Implement the AllOne class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def inc(self, key: str) -> None: Inserts a new key <Key> with value 1. Or increments an existing key by 1.
- def dec(self, ... | Implement the Python class `AllOne` described below.
Class description:
Implement the AllOne class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def inc(self, key: str) -> None: Inserts a new key <Key> with value 1. Or increments an existing key by 1.
- def dec(self, ... | c71574acfc68174a091c1751f10985b8f5737a1f | <|skeleton|>
class AllOne:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def inc(self, key: str) -> None:
"""Inserts a new key <Key> with value 1. Or increments an existing key by 1."""
<|body_1|>
def dec(self, key: str) -> None:
"""Decr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AllOne:
def __init__(self):
"""Initialize your data structure here."""
self.head = Block()
self.tail = Block()
self.head.next = self.tail
self.tail.prev = self.head
self.mapping = {}
def inc(self, key: str) -> None:
"""Inserts a new key <Key> with v... | the_stack_v2_python_sparse | code/432-all-oone-data-structure.py | linhx13/leetcode-code | train | 0 | |
5079ccef8a72c023b2c4532e3dd82694b33fadd0 | [
"self.config = config_pb2.Config()\nself.config.error_code_matcher.output_column_name = 'ERROR_CODE'\nself.config.clusterer.output_column_name = 'CLUSTER_CODE'\nself.config.summarizer.n_messages = 5\nself.config.summarizer.n_class_lines_to_show = 5\nself.simple_dataframe = pd.read_json('testdata/summarizer/simple_d... | <|body_start_0|>
self.config = config_pb2.Config()
self.config.error_code_matcher.output_column_name = 'ERROR_CODE'
self.config.clusterer.output_column_name = 'CLUSTER_CODE'
self.config.summarizer.n_messages = 5
self.config.summarizer.n_class_lines_to_show = 5
self.simple... | Unit test case suite for our Summarizer class. | SummarizerTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SummarizerTest:
"""Unit test case suite for our Summarizer class."""
def setUp(self):
"""General setup for configuration files and pandas dataframes."""
<|body_0|>
def test_generate_summary(self):
"""Various test cases for summarizer.generate_summary."""
... | stack_v2_sparse_classes_36k_train_000833 | 2,584 | no_license | [
{
"docstring": "General setup for configuration files and pandas dataframes.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Various test cases for summarizer.generate_summary.",
"name": "test_generate_summary",
"signature": "def test_generate_summary(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000728 | Implement the Python class `SummarizerTest` described below.
Class description:
Unit test case suite for our Summarizer class.
Method signatures and docstrings:
- def setUp(self): General setup for configuration files and pandas dataframes.
- def test_generate_summary(self): Various test cases for summarizer.generate... | Implement the Python class `SummarizerTest` described below.
Class description:
Unit test case suite for our Summarizer class.
Method signatures and docstrings:
- def setUp(self): General setup for configuration files and pandas dataframes.
- def test_generate_summary(self): Various test cases for summarizer.generate... | 538bd1d109a8f53f2a756ebb65ba2f20703e5d32 | <|skeleton|>
class SummarizerTest:
"""Unit test case suite for our Summarizer class."""
def setUp(self):
"""General setup for configuration files and pandas dataframes."""
<|body_0|>
def test_generate_summary(self):
"""Various test cases for summarizer.generate_summary."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SummarizerTest:
"""Unit test case suite for our Summarizer class."""
def setUp(self):
"""General setup for configuration files and pandas dataframes."""
self.config = config_pb2.Config()
self.config.error_code_matcher.output_column_name = 'ERROR_CODE'
self.config.clusterer... | the_stack_v2_python_sparse | python/summarizer_test.py | googleinterns/stack-trace-classifier | train | 0 |
ef1008c216a3347395c0a47a991cb0e09208f576 | [
"super(BaseModule, self).__init__()\nself.cfg = cfg\nself.id = 0\nif self.cfg.VISUALIZATION.ENABLE and self.cfg.VISUALIZATION.FEATURE_MAPS.ENABLE:\n self.base_output_dir = self.cfg.VISUALIZATION.FEATURE_MAPS.BASE_OUTPUT_DIR\n self.register_forward_hook(self.visualize_features)",
"b, c, t, h, w = output_x.sh... | <|body_start_0|>
super(BaseModule, self).__init__()
self.cfg = cfg
self.id = 0
if self.cfg.VISUALIZATION.ENABLE and self.cfg.VISUALIZATION.FEATURE_MAPS.ENABLE:
self.base_output_dir = self.cfg.VISUALIZATION.FEATURE_MAPS.BASE_OUTPUT_DIR
self.register_forward_hook(se... | Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled. | BaseModule | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseModule:
"""Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled."""
def __init__(self, cfg):
"""Args: cfg (Config): global ... | stack_v2_sparse_classes_36k_train_000834 | 17,711 | permissive | [
{
"docstring": "Args: cfg (Config): global config object.",
"name": "__init__",
"signature": "def __init__(self, cfg)"
},
{
"docstring": "Visualizes and saves the normalized output features for the module.",
"name": "visualize_features",
"signature": "def visualize_features(self, module,... | 2 | stack_v2_sparse_classes_30k_train_018350 | Implement the Python class `BaseModule` described below.
Class description:
Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled.
Method signatures and docstring... | Implement the Python class `BaseModule` described below.
Class description:
Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled.
Method signatures and docstring... | cfb49fa51a13373e4afc74f8800ec8284c41b8d2 | <|skeleton|>
class BaseModule:
"""Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled."""
def __init__(self, cfg):
"""Args: cfg (Config): global ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseModule:
"""Constructs base module that contains basic visualization function and corresponding hooks. Note: The visualization function has only tested in the single GPU scenario. By default, the visualization is disabled."""
def __init__(self, cfg):
"""Args: cfg (Config): global config object... | the_stack_v2_python_sparse | papers/pytorch-video-understanding/models/base/base_blocks.py | hrb518/EssentialMC2 | train | 1 |
300884930c8f7a48387f7545d16949339280f686 | [
"super().__init__()\nself.dropout = Dropout(dropout)\nself.hidden_size = hidden_size\nself.activation = ELU()\nself.log_softmax = LogSoftmax(dim=2)\nif hidden_size is None:\n self.layers = ModuleList([GraphAttentionLayer(in_features=in_features, out_features=out_features, dropout=dropout, alpha=alpha) for _ in r... | <|body_start_0|>
super().__init__()
self.dropout = Dropout(dropout)
self.hidden_size = hidden_size
self.activation = ELU()
self.log_softmax = LogSoftmax(dim=2)
if hidden_size is None:
self.layers = ModuleList([GraphAttentionLayer(in_features=in_features, out_f... | 图注意力模型,当前模型,最多支持两层 | GAT | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GAT:
"""图注意力模型,当前模型,最多支持两层"""
def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None):
"""初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLa... | stack_v2_sparse_classes_36k_train_000835 | 6,041 | permissive | [
{
"docstring": "初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLayer 中 LeakyRelu 用到的 alpha :param num_heads: 头的数量 :param hidden_size: 隐层 size,如果是 None 表示没有隐层; 否则,只有一个隐层",
"name": "__init__",
"signature": "def __init__(self, in_f... | 2 | stack_v2_sparse_classes_30k_train_006470 | Implement the Python class `GAT` described below.
Class description:
图注意力模型,当前模型,最多支持两层
Method signatures and docstrings:
- def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): 初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度... | Implement the Python class `GAT` described below.
Class description:
图注意力模型,当前模型,最多支持两层
Method signatures and docstrings:
- def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None): 初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度... | ef83261a366bd8d7c259aa112da14f3fa7cdf918 | <|skeleton|>
class GAT:
"""图注意力模型,当前模型,最多支持两层"""
def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None):
"""初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GAT:
"""图注意力模型,当前模型,最多支持两层"""
def __init__(self, in_features: int, out_features: int, dropout: float, alpha: float, num_heads: int, hidden_size: int=None):
"""初始化 :param in_features: 输入的 node 维度 :param out_features: 输出的 node 维度 :param dropout: dropout :param alpha: 在 GraphAttentionLayer 中 LeakyRe... | the_stack_v2_python_sparse | easytext/modules/gat.py | freedomkite/easytext | train | 0 |
18bfc8b192f6ec564224c5a719f370957497d070 | [
"article = check_article.retrieve_article(slug)\nhighlight_data = request.data\narticle_field = highlight_data.get('field')\nindex_start = highlight_data.get('start_index')\nindex_end = highlight_data.get('end_index')\nvalidate_field(article_field)\nfield_data = check_field(article, article_field)\nvalidate_index(f... | <|body_start_0|>
article = check_article.retrieve_article(slug)
highlight_data = request.data
article_field = highlight_data.get('field')
index_start = highlight_data.get('start_index')
index_end = highlight_data.get('end_index')
validate_field(article_field)
fiel... | Highlight and comment on text views | HighlightAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HighlightAPIView:
"""Highlight and comment on text views"""
def post(self, request, slug):
"""Create a text Highlight"""
<|body_0|>
def get(self, request, slug):
"""Fetch all highlighted text for a single article for user"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_000836 | 4,382 | permissive | [
{
"docstring": "Create a text Highlight",
"name": "post",
"signature": "def post(self, request, slug)"
},
{
"docstring": "Fetch all highlighted text for a single article for user",
"name": "get",
"signature": "def get(self, request, slug)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010940 | Implement the Python class `HighlightAPIView` described below.
Class description:
Highlight and comment on text views
Method signatures and docstrings:
- def post(self, request, slug): Create a text Highlight
- def get(self, request, slug): Fetch all highlighted text for a single article for user | Implement the Python class `HighlightAPIView` described below.
Class description:
Highlight and comment on text views
Method signatures and docstrings:
- def post(self, request, slug): Create a text Highlight
- def get(self, request, slug): Fetch all highlighted text for a single article for user
<|skeleton|>
class ... | d0f73bf166ad41f243cff6d82caced2f9facf2f9 | <|skeleton|>
class HighlightAPIView:
"""Highlight and comment on text views"""
def post(self, request, slug):
"""Create a text Highlight"""
<|body_0|>
def get(self, request, slug):
"""Fetch all highlighted text for a single article for user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HighlightAPIView:
"""Highlight and comment on text views"""
def post(self, request, slug):
"""Create a text Highlight"""
article = check_article.retrieve_article(slug)
highlight_data = request.data
article_field = highlight_data.get('field')
index_start = highlight... | the_stack_v2_python_sparse | authors/apps/highlights/views.py | andela/ah-the-immortals-backend | train | 3 |
b6925741ffa695a891c2c1d7db9109d4a177179f | [
"i = j = max_num = 0\nused = set()\nwhile i < len(s) and j < len(s):\n if s[j] in used:\n used.remove(s[i])\n i += 1\n else:\n used.add(s[j])\n j += 1\n max_num = max(max_num, j - i)\nreturn max_num",
"used = dict()\nmax_num = start = 0\nfor i, c in enumerate(s):\n if c... | <|body_start_0|>
i = j = max_num = 0
used = set()
while i < len(s) and j < len(s):
if s[j] in used:
used.remove(s[i])
i += 1
else:
used.add(s[j])
j += 1
max_num = max(max_num, j - i)
r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s: str) -> int:
"""滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。"""
<|body_0|>
def lengthOfLongestSubstring(self, s: str) -> int:
"""滑动窗口优化:使用字典记录出现过的字符及其索引。 1. 如果字符出现过,则start从出现过的索引+1开始重新计算... | stack_v2_sparse_classes_36k_train_000837 | 2,108 | no_license | [
{
"docstring": "滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。",
"name": "lengthOfLongestSubstring1",
"signature": "def lengthOfLongestSubstring1(self, s: str) -> int"
},
{
"docstring": "滑动窗口优化:使用字典记录出现过的字符及其索引。 1. 如果字符出现过,则start从出现过的索引+1开始重新计算。 需要增加判断start是否比出现的索引要... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s: str) -> int: 滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。
- def lengthOfLongestSubstring(self, s: str) -> i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s: str) -> int: 滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。
- def lengthOfLongestSubstring(self, s: str) -> i... | 2bbb1640589aab34f2bc42489283033cc11fb885 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s: str) -> int:
"""滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。"""
<|body_0|>
def lengthOfLongestSubstring(self, s: str) -> int:
"""滑动窗口优化:使用字典记录出现过的字符及其索引。 1. 如果字符出现过,则start从出现过的索引+1开始重新计算... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring1(self, s: str) -> int:
"""滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。"""
i = j = max_num = 0
used = set()
while i < len(s) and j < len(s):
if s[j] in used:
used.remove(s[i])
... | the_stack_v2_python_sparse | 003_longest-substring-without-repeating-characters.py | helloocc/algorithm | train | 1 | |
1e425e3a30f23a4aa443aa94614478f9a1c0efb9 | [
"del request, wid, format\nserializer = self.serializer_class({'src_df': pandas.load_table(workflow.get_data_frame_table_name()), 'how': '', 'left_on': '', 'right_on': ''})\nreturn Response(serializer.data)",
"del wid, format\ndst_df = pandas.load_table(workflow.get_data_frame_table_name())\nif dst_df is None:\n ... | <|body_start_0|>
del request, wid, format
serializer = self.serializer_class({'src_df': pandas.load_table(workflow.get_data_frame_table_name()), 'how': '', 'left_on': '', 'right_on': ''})
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
del wid, format
dst_df = p... | Basic table merge methods. get: Retrieves the data frame attached to the workflow and returns it labeled as "data_frame" put: Request to merge a given data frame with the one attached to the workflow. | TableBasicMerge | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableBasicMerge:
"""Basic table merge methods. get: Retrieves the data frame attached to the workflow and returns it labeled as "data_frame" put: Request to merge a given data frame with the one attached to the workflow."""
def get(self, request: http.HttpRequest, wid: int, format=None, work... | stack_v2_sparse_classes_36k_train_000838 | 12,427 | permissive | [
{
"docstring": "Process the GET request.",
"name": "get",
"signature": "def get(self, request: http.HttpRequest, wid: int, format=None, workflow: Optional[models.Workflow]=None) -> http.HttpResponse"
},
{
"docstring": "Process the put request.",
"name": "put",
"signature": "def put(self,... | 2 | null | Implement the Python class `TableBasicMerge` described below.
Class description:
Basic table merge methods. get: Retrieves the data frame attached to the workflow and returns it labeled as "data_frame" put: Request to merge a given data frame with the one attached to the workflow.
Method signatures and docstrings:
- ... | Implement the Python class `TableBasicMerge` described below.
Class description:
Basic table merge methods. get: Retrieves the data frame attached to the workflow and returns it labeled as "data_frame" put: Request to merge a given data frame with the one attached to the workflow.
Method signatures and docstrings:
- ... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class TableBasicMerge:
"""Basic table merge methods. get: Retrieves the data frame attached to the workflow and returns it labeled as "data_frame" put: Request to merge a given data frame with the one attached to the workflow."""
def get(self, request: http.HttpRequest, wid: int, format=None, work... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TableBasicMerge:
"""Basic table merge methods. get: Retrieves the data frame attached to the workflow and returns it labeled as "data_frame" put: Request to merge a given data frame with the one attached to the workflow."""
def get(self, request: http.HttpRequest, wid: int, format=None, workflow: Optiona... | the_stack_v2_python_sparse | ontask/table/api.py | abelardopardo/ontask_b | train | 43 |
7a30f811ac260335b3514e501f4b1d398be05ece | [
"self.r_ratio = float(self.parameters['r_ratio'])\nself.tau = float(self.parameters['tau'])\nself.beta = float(self.parameters['beta'])\nself.gamma = float(self.parameters['gamma'])\nself.opening_angle = (180.0 - self.parameters['opening_angle']) / 2.0\nself.psy = float(self.parameters['psy'])\nself.fracAGN = float... | <|body_start_0|>
self.r_ratio = float(self.parameters['r_ratio'])
self.tau = float(self.parameters['tau'])
self.beta = float(self.parameters['beta'])
self.gamma = float(self.parameters['gamma'])
self.opening_angle = (180.0 - self.parameters['opening_angle']) / 2.0
self.ps... | Fritz et al. (2006) AGN dust torus emission The AGN emission is computed from the library of Fritz et al. (2006) from which all of the models are available. They take into account two emission components linked to the AGN. The first one is the isotropic emission of the central source, which is assumed to be point-like.... | Fritz2006 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fritz2006:
"""Fritz et al. (2006) AGN dust torus emission The AGN emission is computed from the library of Fritz et al. (2006) from which all of the models are available. They take into account two emission components linked to the AGN. The first one is the isotropic emission of the central sourc... | stack_v2_sparse_classes_36k_train_000839 | 6,229 | no_license | [
{
"docstring": "Get the template set out of the database",
"name": "_init_code",
"signature": "def _init_code(self)"
},
{
"docstring": "Add the IR re-emission contributions Parameters ---------- sed: pcigale.sed.SED object parameters: dictionary containing the parameters",
"name": "process",... | 2 | stack_v2_sparse_classes_30k_train_020157 | Implement the Python class `Fritz2006` described below.
Class description:
Fritz et al. (2006) AGN dust torus emission The AGN emission is computed from the library of Fritz et al. (2006) from which all of the models are available. They take into account two emission components linked to the AGN. The first one is the ... | Implement the Python class `Fritz2006` described below.
Class description:
Fritz et al. (2006) AGN dust torus emission The AGN emission is computed from the library of Fritz et al. (2006) from which all of the models are available. They take into account two emission components linked to the AGN. The first one is the ... | 9ef9b99425537350b8706fddfe90ed47301107a5 | <|skeleton|>
class Fritz2006:
"""Fritz et al. (2006) AGN dust torus emission The AGN emission is computed from the library of Fritz et al. (2006) from which all of the models are available. They take into account two emission components linked to the AGN. The first one is the isotropic emission of the central sourc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fritz2006:
"""Fritz et al. (2006) AGN dust torus emission The AGN emission is computed from the library of Fritz et al. (2006) from which all of the models are available. They take into account two emission components linked to the AGN. The first one is the isotropic emission of the central source, which is a... | the_stack_v2_python_sparse | pcigale/sed_modules/fritz2006.py | JohannesBuchner/cigale | train | 5 |
9f399a0496c98dedf3c67dc34847f1e855049473 | [
"urlModel = UrlModel(url=validated_data['url'], user_date=validated_data['user_date'], comments=validated_data['comments'], public=False, vetted=False)\nif 'person_id' in validated_data:\n try:\n authUser = User.objects.get(pk=validated_data['person_id'])\n urlModel.person = authUser\n except Us... | <|body_start_0|>
urlModel = UrlModel(url=validated_data['url'], user_date=validated_data['user_date'], comments=validated_data['comments'], public=False, vetted=False)
if 'person_id' in validated_data:
try:
authUser = User.objects.get(pk=validated_data['person_id'])
... | Override method of entering a url into the DB. The url can't be in the UrlModel when it is returned to neuroglancer as it crashes neuroglancer. | UrlSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UrlSerializer:
"""Override method of entering a url into the DB. The url can't be in the UrlModel when it is returned to neuroglancer as it crashes neuroglancer."""
def create(self, validated_data):
"""This gets called when a user clicks New in Neuroglancer"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_000840 | 5,279 | no_license | [
{
"docstring": "This gets called when a user clicks New in Neuroglancer",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "This gets called when a user clicks Save in Neuroglancer",
"name": "update",
"signature": "def update(self, instance, validated_d... | 2 | stack_v2_sparse_classes_30k_train_009341 | Implement the Python class `UrlSerializer` described below.
Class description:
Override method of entering a url into the DB. The url can't be in the UrlModel when it is returned to neuroglancer as it crashes neuroglancer.
Method signatures and docstrings:
- def create(self, validated_data): This gets called when a u... | Implement the Python class `UrlSerializer` described below.
Class description:
Override method of entering a url into the DB. The url can't be in the UrlModel when it is returned to neuroglancer as it crashes neuroglancer.
Method signatures and docstrings:
- def create(self, validated_data): This gets called when a u... | 45c4a15acf36db82ef341c1abf12212e22913fae | <|skeleton|>
class UrlSerializer:
"""Override method of entering a url into the DB. The url can't be in the UrlModel when it is returned to neuroglancer as it crashes neuroglancer."""
def create(self, validated_data):
"""This gets called when a user clicks New in Neuroglancer"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UrlSerializer:
"""Override method of entering a url into the DB. The url can't be in the UrlModel when it is returned to neuroglancer as it crashes neuroglancer."""
def create(self, validated_data):
"""This gets called when a user clicks New in Neuroglancer"""
urlModel = UrlModel(url=vali... | the_stack_v2_python_sparse | neuroglancer/serializers.py | madwilliam/activebrainatlasadmin-1 | train | 0 |
fcf1b81e849cac3de32b6eff7aedde68e73c0b04 | [
"left, right = (0, 0)\nchars = set()\nres = 0\nwhile left < len(s) and right < len(s):\n if s[right] in chars:\n if s[left] in chars:\n chars.remove(s[left])\n left += 1\n else:\n chars.add(s[right])\n right += 1\n res = max(res, len(chars))\nreturn res",
"left,... | <|body_start_0|>
left, right = (0, 0)
chars = set()
res = 0
while left < len(s) and right < len(s):
if s[right] in chars:
if s[left] in chars:
chars.remove(s[left])
left += 1
else:
chars.add(s[rig... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring3(self, s):
"""一次遍历时,使用字典保存每个字符第一次出现的位置。 当right向后遍历的过程中,如果这个字符在字典中,说明这个字符在前面出现过,即这个区间已经不是题目要求的不含重复字符的区间了,因此,需要移动left。 移动left到哪里呢?有个快速的方法,那就是移动到right字符在字典中出现的位置(即s[right]在前面的位置)的下一个位置。 :type s: str :rtype: int"""
<|body_0|>
def lengthOfLo... | stack_v2_sparse_classes_36k_train_000841 | 2,863 | no_license | [
{
"docstring": "一次遍历时,使用字典保存每个字符第一次出现的位置。 当right向后遍历的过程中,如果这个字符在字典中,说明这个字符在前面出现过,即这个区间已经不是题目要求的不含重复字符的区间了,因此,需要移动left。 移动left到哪里呢?有个快速的方法,那就是移动到right字符在字典中出现的位置(即s[right]在前面的位置)的下一个位置。 :type s: str :rtype: int",
"name": "lengthOfLongestSubstring3",
"signature": "def lengthOfLongestSubstring3(self, s)"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring3(self, s): 一次遍历时,使用字典保存每个字符第一次出现的位置。 当right向后遍历的过程中,如果这个字符在字典中,说明这个字符在前面出现过,即这个区间已经不是题目要求的不含重复字符的区间了,因此,需要移动left。 移动left到哪里呢?有个快速的方法,那就是移动到right字符在字典... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring3(self, s): 一次遍历时,使用字典保存每个字符第一次出现的位置。 当right向后遍历的过程中,如果这个字符在字典中,说明这个字符在前面出现过,即这个区间已经不是题目要求的不含重复字符的区间了,因此,需要移动left。 移动left到哪里呢?有个快速的方法,那就是移动到right字符在字典... | 3fe8c2298a52a15fadec0693e00445d875c4b6ea | <|skeleton|>
class Solution:
def lengthOfLongestSubstring3(self, s):
"""一次遍历时,使用字典保存每个字符第一次出现的位置。 当right向后遍历的过程中,如果这个字符在字典中,说明这个字符在前面出现过,即这个区间已经不是题目要求的不含重复字符的区间了,因此,需要移动left。 移动left到哪里呢?有个快速的方法,那就是移动到right字符在字典中出现的位置(即s[right]在前面的位置)的下一个位置。 :type s: str :rtype: int"""
<|body_0|>
def lengthOfLo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring3(self, s):
"""一次遍历时,使用字典保存每个字符第一次出现的位置。 当right向后遍历的过程中,如果这个字符在字典中,说明这个字符在前面出现过,即这个区间已经不是题目要求的不含重复字符的区间了,因此,需要移动left。 移动left到哪里呢?有个快速的方法,那就是移动到right字符在字典中出现的位置(即s[right]在前面的位置)的下一个位置。 :type s: str :rtype: int"""
left, right = (0, 0)
chars = set()
... | the_stack_v2_python_sparse | Longest Substring Without Repeating Characters.py | huiyi999/leetcode_python | train | 0 | |
dd253e68e7836394056d431e99115bdd9027b192 | [
"settings = {key: value for key, value in settings.items() if not value == ''}\nself.livy_settings = settings\nrequests_session = requests.Session()\nrequests_session.headers.update({'X-Requested-By': 'livy', 'Content-Type': 'application/json'})\nself.params = {'url': self.livy_settings.get('url'), 'auth': HTTPBasi... | <|body_start_0|>
settings = {key: value for key, value in settings.items() if not value == ''}
self.livy_settings = settings
requests_session = requests.Session()
requests_session.headers.update({'X-Requested-By': 'livy', 'Content-Type': 'application/json'})
self.params = {'url':... | LivyHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LivyHandler:
def __init__(self, settings):
"""Initializes the HiveHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name."""
<|body_0|>
def exec_query(self, query, params=None, **kwargs):
"""Execu... | stack_v2_sparse_classes_36k_train_000842 | 2,263 | permissive | [
{
"docstring": "Initializes the HiveHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.",
"name": "__init__",
"signature": "def __init__(self, settings)"
},
{
"docstring": "Executes Query in the database. :param query: st... | 2 | stack_v2_sparse_classes_30k_train_015809 | Implement the Python class `LivyHandler` described below.
Class description:
Implement the LivyHandler class.
Method signatures and docstrings:
- def __init__(self, settings): Initializes the HiveHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type n... | Implement the Python class `LivyHandler` described below.
Class description:
Implement the LivyHandler class.
Method signatures and docstrings:
- def __init__(self, settings): Initializes the HiveHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type n... | db34927e4c45df93438e2b7129f01388f1a34753 | <|skeleton|>
class LivyHandler:
def __init__(self, settings):
"""Initializes the HiveHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name."""
<|body_0|>
def exec_query(self, query, params=None, **kwargs):
"""Execu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LivyHandler:
def __init__(self, settings):
"""Initializes the HiveHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name."""
settings = {key: value for key, value in settings.items() if not value == ''}
self.livy_se... | the_stack_v2_python_sparse | mlapp/handlers/spark/livy_handler.py | ghas-results/mlapp | train | 0 | |
efe07249cb12578db74937b05e27f5beaada33a8 | [
"self._mutation_rate = mutation_rate\nself._mutation_rand = random.Random()\nself._switch_rand = random.Random()",
"mutated_org = organism.copy()\ngene_choices = mutated_org.genome.alphabet.letters\nfor gene_index in range(len(mutated_org.genome)):\n mutation_chance = self._mutation_rand.random()\n if mutat... | <|body_start_0|>
self._mutation_rate = mutation_rate
self._mutation_rand = random.Random()
self._switch_rand = random.Random()
<|end_body_0|>
<|body_start_1|>
mutated_org = organism.copy()
gene_choices = mutated_org.genome.alphabet.letters
for gene_index in range(len(mut... | Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to switch to any other letter in the alphabet. | ConversionMutation | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConversionMutation:
"""Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to swi... | stack_v2_sparse_classes_36k_train_000843 | 3,166 | permissive | [
{
"docstring": "Inititialize a mutator. Arguments: o mutation_rate -- The chance of a mutation happening at any position in the genome.",
"name": "__init__",
"signature": "def __init__(self, mutation_rate=0.001)"
},
{
"docstring": "Mutate the organisms genome.",
"name": "mutate",
"signat... | 2 | stack_v2_sparse_classes_30k_train_002032 | Implement the Python class `ConversionMutation` described below.
Class description:
Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the al... | Implement the Python class `ConversionMutation` described below.
Class description:
Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the al... | 1d9a8e84a8572809ee3260ede44290e14de3bdd1 | <|skeleton|>
class ConversionMutation:
"""Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to swi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConversionMutation:
"""Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to switch to any ot... | the_stack_v2_python_sparse | bin/last_wrapper/Bio/GA/Mutation/Simple.py | LyonsLab/coge | train | 41 |
d1146703ce4c03f6395746e5dece85902f1b24e4 | [
"res = ''\nfor s in strs:\n res += 's'\n for i in s:\n res += str(ord(i))\n res += 's'\n res += 'r'\nreturn res",
"l = s.split('s')\nres, cur = ([], '')\nfor i in range(1, len(l)):\n if l[i] == 'r':\n res.append(cur)\n cur = ''\n else:\n cur += chr(int(l[i]))\nret... | <|body_start_0|>
res = ''
for s in strs:
res += 's'
for i in s:
res += str(ord(i))
res += 's'
res += 'r'
return res
<|end_body_0|>
<|body_start_1|>
l = s.split('s')
res, cur = ([], '')
for i in range(1, ... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_000844 | 1,979 | no_license | [
{
"docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str",
"name": "encode",
"signature": "def encode(self, strs)"
},
{
"docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]",
"name": "decode",
"signature": "def ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | 2df1a58aa9474f2ecec2ee7c45ebf12466181391 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
res = ''
for s in strs:
res += 's'
for i in s:
res += str(ord(i))
res += 's'
res += 'r'
retur... | the_stack_v2_python_sparse | EncodeAndDecodeStrings.py | zjuzpz/Algorithms | train | 2 | |
547770d90a9977fc34cfe4108d6ddb35281932e3 | [
"super().__init__()\nself.tagset_size = tagset_size\nself.transitions = torch.nn.Parameter(torch.randn(tagset_size, tagset_size))\nif not init_from_state_dict:\n self.transitions.detach()[tag_dictionary.get_idx_for_item(START_TAG), :] = -10000\n self.transitions.detach()[:, tag_dictionary.get_idx_for_item(STO... | <|body_start_0|>
super().__init__()
self.tagset_size = tagset_size
self.transitions = torch.nn.Parameter(torch.randn(tagset_size, tagset_size))
if not init_from_state_dict:
self.transitions.detach()[tag_dictionary.get_idx_for_item(START_TAG), :] = -10000
self.tran... | Conditional Random Field. Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previous seen annotations. | CRF | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CRF:
"""Conditional Random Field. Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previous seen annotations."""
def __init__(self, tag_dict... | stack_v2_sparse_classes_36k_train_000845 | 2,171 | permissive | [
{
"docstring": "Initialize the Conditional Random Field. :param tag_dictionary: tag dictionary in order to find ID for start and stop tags :param tagset_size: number of tag from tag dictionary :param init_from_state_dict: whether we load pretrained model from state dict",
"name": "__init__",
"signature"... | 2 | null | Implement the Python class `CRF` described below.
Class description:
Conditional Random Field. Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previous seen annotatio... | Implement the Python class `CRF` described below.
Class description:
Conditional Random Field. Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previous seen annotatio... | 1795ac80da18efadcd56b46374a40190abca07e4 | <|skeleton|>
class CRF:
"""Conditional Random Field. Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previous seen annotations."""
def __init__(self, tag_dict... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CRF:
"""Conditional Random Field. Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previous seen annotations."""
def __init__(self, tag_dictionary, tagse... | the_stack_v2_python_sparse | flair/models/sequence_tagger_utils/crf.py | flairNLP/flair | train | 5,684 |
ea9cd540f29c4f1fce25ec14930feed1d8616c9d | [
"budget = 0.5\nfor d in [100, 200]:\n for number_candidates in [2 ** 4, 2 ** 5]:\n for epsilon in [2, 3]:\n x = np.random.normal(0, 1, (d, 1))\n x = np.divide(x, np.linalg.norm(x, axis=0).reshape(1, -1))\n c1, c2, _, gamma = get_parameters.get_parameters_unbiased_miracle(e... | <|body_start_0|>
budget = 0.5
for d in [100, 200]:
for number_candidates in [2 ** 4, 2 ** 5]:
for epsilon in [2, 3]:
x = np.random.normal(0, 1, (d, 1))
x = np.divide(x, np.linalg.norm(x, axis=0).reshape(1, -1))
c1, c... | ModifyPiTest | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModifyPiTest:
def test_tilde_pi_is_a_distribution(self):
"""Test whether every distribution generated by modify_all sums to 1."""
<|body_0|>
def test_tilde_pi_is_private(self):
"""Test whether tilde pi satisfies the DP constraint."""
<|body_1|>
def test_... | stack_v2_sparse_classes_36k_train_000846 | 3,519 | permissive | [
{
"docstring": "Test whether every distribution generated by modify_all sums to 1.",
"name": "test_tilde_pi_is_a_distribution",
"signature": "def test_tilde_pi_is_a_distribution(self)"
},
{
"docstring": "Test whether tilde pi satisfies the DP constraint.",
"name": "test_tilde_pi_is_private",... | 3 | stack_v2_sparse_classes_30k_test_001184 | Implement the Python class `ModifyPiTest` described below.
Class description:
Implement the ModifyPiTest class.
Method signatures and docstrings:
- def test_tilde_pi_is_a_distribution(self): Test whether every distribution generated by modify_all sums to 1.
- def test_tilde_pi_is_private(self): Test whether tilde pi ... | Implement the Python class `ModifyPiTest` described below.
Class description:
Implement the ModifyPiTest class.
Method signatures and docstrings:
- def test_tilde_pi_is_a_distribution(self): Test whether every distribution generated by modify_all sums to 1.
- def test_tilde_pi_is_private(self): Test whether tilde pi ... | 329e60fa56b87f691303638ceb9dfa1fc5083953 | <|skeleton|>
class ModifyPiTest:
def test_tilde_pi_is_a_distribution(self):
"""Test whether every distribution generated by modify_all sums to 1."""
<|body_0|>
def test_tilde_pi_is_private(self):
"""Test whether tilde pi satisfies the DP constraint."""
<|body_1|>
def test_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModifyPiTest:
def test_tilde_pi_is_a_distribution(self):
"""Test whether every distribution generated by modify_all sums to 1."""
budget = 0.5
for d in [100, 200]:
for number_candidates in [2 ** 4, 2 ** 5]:
for epsilon in [2, 3]:
x = np.r... | the_stack_v2_python_sparse | rcc_dp/modify_pi_test.py | google-research/federated | train | 595 | |
eeb63cd79be481d770dd81c851b08af8896b5f78 | [
"for i, c in enumerate(self.children):\n if c in ('elif', 'if'):\n yield self.children[i + 1]",
"start_pos = node.start_pos\nfor check_node in reversed(list(self.get_test_nodes())):\n if check_node.start_pos < start_pos:\n if start_pos < check_node.end_pos:\n return None\n el... | <|body_start_0|>
for i, c in enumerate(self.children):
if c in ('elif', 'if'):
yield self.children[i + 1]
<|end_body_0|>
<|body_start_1|>
start_pos = node.start_pos
for check_node in reversed(list(self.get_test_nodes())):
if check_node.start_pos < start_p... | IfStmt | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IfStmt:
def get_test_nodes(self):
"""E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass"""
<|body_0|>
def get_corresponding_test_node(self, node):
"""Searches for the branch in which the node is and returns the corresponding test no... | stack_v2_sparse_classes_36k_train_000847 | 38,111 | permissive | [
{
"docstring": "E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass",
"name": "get_test_nodes",
"signature": "def get_test_nodes(self)"
},
{
"docstring": "Searches for the branch in which the node is and returns the corresponding test node (see function above). ... | 3 | stack_v2_sparse_classes_30k_train_001016 | Implement the Python class `IfStmt` described below.
Class description:
Implement the IfStmt class.
Method signatures and docstrings:
- def get_test_nodes(self): E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass
- def get_corresponding_test_node(self, node): Searches for the branch... | Implement the Python class `IfStmt` described below.
Class description:
Implement the IfStmt class.
Method signatures and docstrings:
- def get_test_nodes(self): E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass
- def get_corresponding_test_node(self, node): Searches for the branch... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class IfStmt:
def get_test_nodes(self):
"""E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass"""
<|body_0|>
def get_corresponding_test_node(self, node):
"""Searches for the branch in which the node is and returns the corresponding test no... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IfStmt:
def get_test_nodes(self):
"""E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass"""
for i, c in enumerate(self.children):
if c in ('elif', 'if'):
yield self.children[i + 1]
def get_corresponding_test_node(self, node):
... | the_stack_v2_python_sparse | contrib/python/parso/py2/parso/python/tree.py | catboost/catboost | train | 8,012 | |
f92161140e47194f1c9e301c5b0166105f524f93 | [
"get_files_mock.return_value = ['file1', 'file2']\nzephyr_check_compliance._patch_get_files()\nout = zephyr_check_compliance._changed_files('ref')\nself.assertFalse(out)\nget_files_mock.return_value.append('zephyr/file3')\nzephyr_check_compliance._patch_get_files()\nout = zephyr_check_compliance._changed_files('ref... | <|body_start_0|>
get_files_mock.return_value = ['file1', 'file2']
zephyr_check_compliance._patch_get_files()
out = zephyr_check_compliance._changed_files('ref')
self.assertFalse(out)
get_files_mock.return_value.append('zephyr/file3')
zephyr_check_compliance._patch_get_fil... | Tests for zephyr_check_compliance. | TestZephyrCheckCompliance | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestZephyrCheckCompliance:
"""Tests for zephyr_check_compliance."""
def test_changed_files(self, get_files_mock):
"""Test _changed_files."""
<|body_0|>
def test_main(self, main_mock, changed_files_mock):
"""Tests the main function."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_000848 | 3,439 | permissive | [
{
"docstring": "Test _changed_files.",
"name": "test_changed_files",
"signature": "def test_changed_files(self, get_files_mock)"
},
{
"docstring": "Tests the main function.",
"name": "test_main",
"signature": "def test_main(self, main_mock, changed_files_mock)"
},
{
"docstring": ... | 4 | null | Implement the Python class `TestZephyrCheckCompliance` described below.
Class description:
Tests for zephyr_check_compliance.
Method signatures and docstrings:
- def test_changed_files(self, get_files_mock): Test _changed_files.
- def test_main(self, main_mock, changed_files_mock): Tests the main function.
- def test... | Implement the Python class `TestZephyrCheckCompliance` described below.
Class description:
Tests for zephyr_check_compliance.
Method signatures and docstrings:
- def test_changed_files(self, get_files_mock): Test _changed_files.
- def test_main(self, main_mock, changed_files_mock): Tests the main function.
- def test... | 0bbd46a5aa22eb824b21365f21f4811c9343ca1e | <|skeleton|>
class TestZephyrCheckCompliance:
"""Tests for zephyr_check_compliance."""
def test_changed_files(self, get_files_mock):
"""Test _changed_files."""
<|body_0|>
def test_main(self, main_mock, changed_files_mock):
"""Tests the main function."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestZephyrCheckCompliance:
"""Tests for zephyr_check_compliance."""
def test_changed_files(self, get_files_mock):
"""Test _changed_files."""
get_files_mock.return_value = ['file1', 'file2']
zephyr_check_compliance._patch_get_files()
out = zephyr_check_compliance._changed_f... | the_stack_v2_python_sparse | util/zephyr_check_compliance_unittest.py | coreboot/chrome-ec | train | 66 |
93772c895dcf119b32b010415ba24e4c4ac1a485 | [
"func_name = sys._getframe().f_code.co_name\nrow = self.get_case_row_index(func_name)\nhash = gl.get_value('hash')\nimage_info = self.get_request_data(func_name)\nimage_info['macActvImageSubInfoVos'][0]['imagePath'] += hash\nres = self.get_result(func_name, var_params=image_info)\nactual_result = res[0].json()['err... | <|body_start_0|>
func_name = sys._getframe().f_code.co_name
row = self.get_case_row_index(func_name)
hash = gl.get_value('hash')
image_info = self.get_request_data(func_name)
image_info['macActvImageSubInfoVos'][0]['imagePath'] += hash
res = self.get_result(func_name, var... | AdvertisingMapManagement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdvertisingMapManagement:
def test_urine_v2_MacActvImageMainInfo_save(self):
"""添加广告图组 :return:"""
<|body_0|>
def test_urine_v2_MacActvImageMainInfo_queryMacActvImageMainInfos(self):
"""广告图组列表 :return:"""
<|body_1|>
def test_urine_v2_MacActvImageMainInfo... | stack_v2_sparse_classes_36k_train_000849 | 3,688 | no_license | [
{
"docstring": "添加广告图组 :return:",
"name": "test_urine_v2_MacActvImageMainInfo_save",
"signature": "def test_urine_v2_MacActvImageMainInfo_save(self)"
},
{
"docstring": "广告图组列表 :return:",
"name": "test_urine_v2_MacActvImageMainInfo_queryMacActvImageMainInfos",
"signature": "def test_urine... | 4 | null | Implement the Python class `AdvertisingMapManagement` described below.
Class description:
Implement the AdvertisingMapManagement class.
Method signatures and docstrings:
- def test_urine_v2_MacActvImageMainInfo_save(self): 添加广告图组 :return:
- def test_urine_v2_MacActvImageMainInfo_queryMacActvImageMainInfos(self): 广告图组... | Implement the Python class `AdvertisingMapManagement` described below.
Class description:
Implement the AdvertisingMapManagement class.
Method signatures and docstrings:
- def test_urine_v2_MacActvImageMainInfo_save(self): 添加广告图组 :return:
- def test_urine_v2_MacActvImageMainInfo_queryMacActvImageMainInfos(self): 广告图组... | 6837a07ff200b610e7ba799a52543493848b6026 | <|skeleton|>
class AdvertisingMapManagement:
def test_urine_v2_MacActvImageMainInfo_save(self):
"""添加广告图组 :return:"""
<|body_0|>
def test_urine_v2_MacActvImageMainInfo_queryMacActvImageMainInfos(self):
"""广告图组列表 :return:"""
<|body_1|>
def test_urine_v2_MacActvImageMainInfo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdvertisingMapManagement:
def test_urine_v2_MacActvImageMainInfo_save(self):
"""添加广告图组 :return:"""
func_name = sys._getframe().f_code.co_name
row = self.get_case_row_index(func_name)
hash = gl.get_value('hash')
image_info = self.get_request_data(func_name)
image... | the_stack_v2_python_sparse | run/operation_management/test_advertising_map_management.py | liwei123a/APITestFrame | train | 0 | |
287f58d808d1fe87cc764e09e1b2fb91cd82c3b8 | [
"if which_challenge not in ('singlecoil', 'multicoil'):\n raise ValueError(f'Challenge should either be \"singlecoil\" or \"multicoil\"')\nself.mask_func = mask_func\nself.resolution = resolution\nself.which_challenge = which_challenge\nself.use_seed = use_seed",
"kspace = transforms.to_tensor(kspace)\nif self... | <|body_start_0|>
if which_challenge not in ('singlecoil', 'multicoil'):
raise ValueError(f'Challenge should either be "singlecoil" or "multicoil"')
self.mask_func = mask_func
self.resolution = resolution
self.which_challenge = which_challenge
self.use_seed = use_seed
... | Data Transformer for training U-Net models. | DataTransform | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the... | stack_v2_sparse_classes_36k_train_000850 | 9,464 | permissive | [
{
"docstring": "Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the image. which_challenge (str): Either \"singlecoil\" or \"multicoil\" denoting the dataset. use_seed (bool): If true, this class computes a pseudo random number... | 2 | stack_v2_sparse_classes_30k_train_011270 | Implement the Python class `DataTransform` described below.
Class description:
Data Transformer for training U-Net models.
Method signatures and docstrings:
- def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True): Args: mask_func (common.subsample.MaskFunc): A function that can create a mask ... | Implement the Python class `DataTransform` described below.
Class description:
Data Transformer for training U-Net models.
Method signatures and docstrings:
- def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True): Args: mask_func (common.subsample.MaskFunc): A function that can create a mask ... | 9e2aea9f8b0d794c617ca822980c6d85ab6557fc | <|skeleton|>
class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the image. which... | the_stack_v2_python_sparse | irim/external/fastMRI/models/unet/train_unet.py | fcaliva/FNAF-fastMRI | train | 1 |
c379d3ec9f8125988d7f190224ab8555a6ff6abf | [
"self.logger.info('Opening dashboard page')\nself.click(self.locators.NavPanel.DASHBOARD)\ndashboard_page = DashboardPage(driver=self.driver)\ndashboard_page.custom_wait(dashboard_page.check.is_page_opened)\nself.logger.info('Dashboard page opened')\nreturn dashboard_page",
"self.logger.info('Opening segments pag... | <|body_start_0|>
self.logger.info('Opening dashboard page')
self.click(self.locators.NavPanel.DASHBOARD)
dashboard_page = DashboardPage(driver=self.driver)
dashboard_page.custom_wait(dashboard_page.check.is_page_opened)
self.logger.info('Dashboard page opened')
return das... | The object of the navbar displayed after authorization, with methods for navigating to the pages | NavPanel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NavPanel:
"""The object of the navbar displayed after authorization, with methods for navigating to the pages"""
def go_to_dashboard(self):
"""Redirects to a dashboard page and returns an object for that page"""
<|body_0|>
def go_to_segments(self):
"""Redirects t... | stack_v2_sparse_classes_36k_train_000851 | 1,266 | no_license | [
{
"docstring": "Redirects to a dashboard page and returns an object for that page",
"name": "go_to_dashboard",
"signature": "def go_to_dashboard(self)"
},
{
"docstring": "Redirects to a segments page and returns an object for that page",
"name": "go_to_segments",
"signature": "def go_to_... | 2 | null | Implement the Python class `NavPanel` described below.
Class description:
The object of the navbar displayed after authorization, with methods for navigating to the pages
Method signatures and docstrings:
- def go_to_dashboard(self): Redirects to a dashboard page and returns an object for that page
- def go_to_segmen... | Implement the Python class `NavPanel` described below.
Class description:
The object of the navbar displayed after authorization, with methods for navigating to the pages
Method signatures and docstrings:
- def go_to_dashboard(self): Redirects to a dashboard page and returns an object for that page
- def go_to_segmen... | 725e2c878a0cea62275cb76289a1b73bcade28eb | <|skeleton|>
class NavPanel:
"""The object of the navbar displayed after authorization, with methods for navigating to the pages"""
def go_to_dashboard(self):
"""Redirects to a dashboard page and returns an object for that page"""
<|body_0|>
def go_to_segments(self):
"""Redirects t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NavPanel:
"""The object of the navbar displayed after authorization, with methods for navigating to the pages"""
def go_to_dashboard(self):
"""Redirects to a dashboard page and returns an object for that page"""
self.logger.info('Opening dashboard page')
self.click(self.locators.N... | the_stack_v2_python_sparse | Homework_2/ui/pages/nav_panel.py | Dan4ik2504/2021-1-MAILRU-SDET-Python-D-Mashkovtsev | train | 0 |
9de05161892ec57b03094ba097e4bc9621a53e1b | [
"super(Record, self).__init__(dtype=PARA_RECORD, name=name, index=index, label=label, help=help, default=default, required=required, group=group)\nself.fields = dict()\nfor para in fields:\n if para.name in self.fields:\n raise err.InvalidParameterError(\"duplicate field '{}'\".format(para.name))\n sel... | <|body_start_0|>
super(Record, self).__init__(dtype=PARA_RECORD, name=name, index=index, label=label, help=help, default=default, required=required, group=group)
self.fields = dict()
for para in fields:
if para.name in self.fields:
raise err.InvalidParameterError("dup... | Record parameter type that associates parameter declarations for record components with unique keys. | Record | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Record:
"""Record parameter type that associates parameter declarations for record components with unique keys."""
def __init__(self, name: str, fields: List[Parameter], index: Optional[int]=0, label: Optional[str]=None, help: Optional[str]=None, default: Optional[Dict]=None, required: Optio... | stack_v2_sparse_classes_36k_train_000852 | 6,520 | permissive | [
{
"docstring": "Initialize the base properties for a record parameter declaration. Parameters ---------- name: string Unique parameter identifier fields: list List of parameter declarations for record fields. The field name is the name of the respective parameter. index: int, default=0 Index position of the par... | 4 | stack_v2_sparse_classes_30k_train_018103 | Implement the Python class `Record` described below.
Class description:
Record parameter type that associates parameter declarations for record components with unique keys.
Method signatures and docstrings:
- def __init__(self, name: str, fields: List[Parameter], index: Optional[int]=0, label: Optional[str]=None, hel... | Implement the Python class `Record` described below.
Class description:
Record parameter type that associates parameter declarations for record components with unique keys.
Method signatures and docstrings:
- def __init__(self, name: str, fields: List[Parameter], index: Optional[int]=0, label: Optional[str]=None, hel... | 7116b7060aa68ab36bf08e6393be166dc5db955f | <|skeleton|>
class Record:
"""Record parameter type that associates parameter declarations for record components with unique keys."""
def __init__(self, name: str, fields: List[Parameter], index: Optional[int]=0, label: Optional[str]=None, help: Optional[str]=None, default: Optional[Dict]=None, required: Optio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Record:
"""Record parameter type that associates parameter declarations for record components with unique keys."""
def __init__(self, name: str, fields: List[Parameter], index: Optional[int]=0, label: Optional[str]=None, help: Optional[str]=None, default: Optional[Dict]=None, required: Optional[bool]=Fal... | the_stack_v2_python_sparse | flowserv/model/parameter/record.py | anrunw/flowserv-core-1 | train | 0 |
6472f693c9611b142c0b4131a0db71d318856100 | [
"parser.add_argument('dir', metavar='DIRECTORY', help='Directory of samples to verify.')\nparser.add_argument('--incomplete', action='store_true', help='Only print incomplete samples.')\nparser.add_argument('--split', action='store_true', help='Split sample tags.')",
"for sample_dir in glob.glob('{0}/*'.format(op... | <|body_start_0|>
parser.add_argument('dir', metavar='DIRECTORY', help='Directory of samples to verify.')
parser.add_argument('--incomplete', action='store_true', help='Only print incomplete samples.')
parser.add_argument('--split', action='store_true', help='Split sample tags.')
<|end_body_0|>
... | Verify an analysis completed. | Command | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Verify an analysis completed."""
def add_arguments(self, parser):
"""Command line arguements."""
<|body_0|>
def handle(self, *args, **opts):
"""Verify an analysis completed."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
parser.add_... | stack_v2_sparse_classes_36k_train_000853 | 1,420 | no_license | [
{
"docstring": "Command line arguements.",
"name": "add_arguments",
"signature": "def add_arguments(self, parser)"
},
{
"docstring": "Verify an analysis completed.",
"name": "handle",
"signature": "def handle(self, *args, **opts)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001104 | Implement the Python class `Command` described below.
Class description:
Verify an analysis completed.
Method signatures and docstrings:
- def add_arguments(self, parser): Command line arguements.
- def handle(self, *args, **opts): Verify an analysis completed. | Implement the Python class `Command` described below.
Class description:
Verify an analysis completed.
Method signatures and docstrings:
- def add_arguments(self, parser): Command line arguements.
- def handle(self, *args, **opts): Verify an analysis completed.
<|skeleton|>
class Command:
"""Verify an analysis c... | 2c35ee47e131a74642e60fae6f1cc23561d8b1a6 | <|skeleton|>
class Command:
"""Verify an analysis completed."""
def add_arguments(self, parser):
"""Command line arguements."""
<|body_0|>
def handle(self, *args, **opts):
"""Verify an analysis completed."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""Verify an analysis completed."""
def add_arguments(self, parser):
"""Command line arguements."""
parser.add_argument('dir', metavar='DIRECTORY', help='Directory of samples to verify.')
parser.add_argument('--incomplete', action='store_true', help='Only print incomplete... | the_stack_v2_python_sparse | sample/management/commands/verify_sample_in_db.py | staphopia/staphopia-web | train | 5 |
4c0312dc8f3ee2d4a6cb3382855135b44d47f9c6 | [
"head = 0\nlongest = 0\ndic = {}\nfor i in range(len(s)):\n if s[i] not in dic:\n dic[s[i]] = i\n else:\n if dic[s[i]] >= head:\n head = dic[s[i]] + 1\n dic[s[i]] = i\n longest = i - head + 1 if i - head + 1 > longest else longest\nreturn longest",
"head = 0\nlongest = 0\n... | <|body_start_0|>
head = 0
longest = 0
dic = {}
for i in range(len(s)):
if s[i] not in dic:
dic[s[i]] = i
else:
if dic[s[i]] >= head:
head = dic[s[i]] + 1
dic[s[i]] = i
longest = i - he... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head = 0
longest = 0
dic =... | stack_v2_sparse_classes_36k_train_000854 | 2,425 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring1",
"signature": "def lengthOfLongestSubstring1(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003255 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | 4012c16ccedeebc7852fda707a2399ecb0b5b60a | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
head = 0
longest = 0
dic = {}
for i in range(len(s)):
if s[i] not in dic:
dic[s[i]] = i
else:
if dic[s[i]] >= head:
... | the_stack_v2_python_sparse | py/3.py | XMK233/Leetcode-Journey | train | 0 | |
ab9da13790ae94747b3b580d0af7a8a6d7f6b3e1 | [
"self.build = build\nself.major_version = major_version\nself.minor_version = minor_version\nself.revision = revision\nself.version_string = version_string",
"if dictionary is None:\n return None\nbuild = dictionary.get('build')\nmajor_version = dictionary.get('majorVersion')\nminor_version = dictionary.get('m... | <|body_start_0|>
self.build = build
self.major_version = major_version
self.minor_version = minor_version
self.revision = revision
self.version_string = version_string
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
build = dictiona... | Implementation of the 'SQLServerInstanceVersion' model. Specifies the Server Instance Version. Attributes: build (int): Specifies the build. major_version (int): Specifies the major version. minor_version (int): Specifies the minor version. revision (int): Specifies the revision. version_string (string): Specifies the ... | SQLServerInstanceVersion | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SQLServerInstanceVersion:
"""Implementation of the 'SQLServerInstanceVersion' model. Specifies the Server Instance Version. Attributes: build (int): Specifies the build. major_version (int): Specifies the major version. minor_version (int): Specifies the minor version. revision (int): Specifies t... | stack_v2_sparse_classes_36k_train_000855 | 2,300 | permissive | [
{
"docstring": "Constructor for the SQLServerInstanceVersion class",
"name": "__init__",
"signature": "def __init__(self, build=None, major_version=None, minor_version=None, revision=None, version_string=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictiona... | 2 | null | Implement the Python class `SQLServerInstanceVersion` described below.
Class description:
Implementation of the 'SQLServerInstanceVersion' model. Specifies the Server Instance Version. Attributes: build (int): Specifies the build. major_version (int): Specifies the major version. minor_version (int): Specifies the min... | Implement the Python class `SQLServerInstanceVersion` described below.
Class description:
Implementation of the 'SQLServerInstanceVersion' model. Specifies the Server Instance Version. Attributes: build (int): Specifies the build. major_version (int): Specifies the major version. minor_version (int): Specifies the min... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SQLServerInstanceVersion:
"""Implementation of the 'SQLServerInstanceVersion' model. Specifies the Server Instance Version. Attributes: build (int): Specifies the build. major_version (int): Specifies the major version. minor_version (int): Specifies the minor version. revision (int): Specifies t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SQLServerInstanceVersion:
"""Implementation of the 'SQLServerInstanceVersion' model. Specifies the Server Instance Version. Attributes: build (int): Specifies the build. major_version (int): Specifies the major version. minor_version (int): Specifies the minor version. revision (int): Specifies the revision. ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/sql_server_instance_version.py | cohesity/management-sdk-python | train | 24 |
a5bec19a18ad7ebeda6e191272e9ba4e471ce6d9 | [
"if not root:\n return ''\nres = []\nq = collections.deque([root])\nwhile q:\n node = q.popleft()\n if node:\n res.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\n else:\n res.append(str(-1))\nreturn ','.join(res)",
"if not data:\n return None\ndata_q... | <|body_start_0|>
if not root:
return ''
res = []
q = collections.deque([root])
while q:
node = q.popleft()
if node:
res.append(str(node.val))
q.append(node.left)
q.append(node.right)
else:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_000856 | 1,442 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: Optional[TreeNode]) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> Optional[TreeNode... | 2 | stack_v2_sparse_classes_30k_train_016062 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree.
<... | c7a42753b2b16c7b9c66b8d7c2e67b683a15e27d | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
if not root:
return ''
res = []
q = collections.deque([root])
while q:
node = q.popleft()
if node:
res.append(str(no... | the_stack_v2_python_sparse | medium/449.py | brandoneng000/LeetCode | train | 0 | |
dad96cbd4d7e089285f9cd78b3f95b86601ca9fe | [
"self.name = name\nself.motion_based_retention_enabled = motion_based_retention_enabled\nself.restricted_bandwidth_mode_enabled = restricted_bandwidth_mode_enabled\nself.audio_recording_enabled = audio_recording_enabled\nself.cloud_archive_enabled = cloud_archive_enabled\nself.schedule_id = schedule_id\nself.max_re... | <|body_start_0|>
self.name = name
self.motion_based_retention_enabled = motion_based_retention_enabled
self.restricted_bandwidth_mode_enabled = restricted_bandwidth_mode_enabled
self.audio_recording_enabled = audio_recording_enabled
self.cloud_archive_enabled = cloud_archive_enab... | Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool): Deletes footage older than 3 days in which no motion was detected. Can b... | CreateNetworkCameraQualityRetentionProfileModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateNetworkCameraQualityRetentionProfileModel:
"""Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool... | stack_v2_sparse_classes_36k_train_000857 | 4,849 | permissive | [
{
"docstring": "Constructor for the CreateNetworkCameraQualityRetentionProfileModel class",
"name": "__init__",
"signature": "def __init__(self, name=None, motion_based_retention_enabled=None, restricted_bandwidth_mode_enabled=None, audio_recording_enabled=None, cloud_archive_enabled=None, schedule_id=N... | 2 | stack_v2_sparse_classes_30k_test_000714 | Implement the Python class `CreateNetworkCameraQualityRetentionProfileModel` described below.
Class description:
Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is require... | Implement the Python class `CreateNetworkCameraQualityRetentionProfileModel` described below.
Class description:
Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is require... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class CreateNetworkCameraQualityRetentionProfileModel:
"""Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CreateNetworkCameraQualityRetentionProfileModel:
"""Implementation of the 'createNetworkCameraQualityRetentionProfile' model. TODO: type model description here. Attributes: name (string): The name of the new profile. Must be unique. This parameter is required. motion_based_retention_enabled (bool): Deletes fo... | the_stack_v2_python_sparse | meraki_sdk/models/create_network_camera_quality_retention_profile_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
ce40f3ee670584700c9cf1aed54c41843ec51bfc | [
"self.__k = k\nself.__min_heap = []\nfor n in nums:\n self.add(n)",
"heapq.heappush(self.__min_heap, val)\nif len(self.__min_heap) > self.__k:\n heapq.heappop(self.__min_heap)\nreturn self.__min_heap[0]"
] | <|body_start_0|>
self.__k = k
self.__min_heap = []
for n in nums:
self.add(n)
<|end_body_0|>
<|body_start_1|>
heapq.heappush(self.__min_heap, val)
if len(self.__min_heap) > self.__k:
heapq.heappop(self.__min_heap)
return self.__min_heap[0]
<|end_b... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: init :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.__k = k
self.__min_heap = []
for n i... | stack_v2_sparse_classes_36k_train_000858 | 667 | no_license | [
{
"docstring": ":type k: init :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 | null | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: init :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: init :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, n... | 1804863ca931abedbbb8053bcc771115d0c23a2d | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: init :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: init :type nums: List[int]"""
self.__k = k
self.__min_heap = []
for n in nums:
self.add(n)
def add(self, val):
""":type val: int :rtype: int"""
heapq.heappush(self.__min_heap, val)
if ... | the_stack_v2_python_sparse | leetcodeDS/kth_largest_number_stream.py | PyRPy/algorithms_books | train | 1 | |
509d14ccce49086d167a85c7e2e2c37960668e60 | [
"if v and isinstance(v, dict):\n return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': ElasticContainerRegistry.parse_obj({'account_id': v.get('account_id'), 'alias': v.get('registry_alias'), 'aws_region': v.get('aws_region'), 'context': values.get('context')})})\nretu... | <|body_start_0|>
if v and isinstance(v, dict):
return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': ElasticContainerRegistry.parse_obj({'account_id': v.get('account_id'), 'alias': v.get('registry_alias'), 'aws_region': v.get('aws_region'), 'context': valu... | Args passed to image.push. | ImagePushArgs | [
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImagePushArgs:
"""Args passed to image.push."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
<|body_0|>
def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
"""Set the value of ``rep... | stack_v2_sparse_classes_36k_train_000859 | 3,744 | permissive | [
{
"docstring": "Set the value of ``ecr_repo``.",
"name": "_set_ecr_repo",
"signature": "def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any"
},
{
"docstring": "Set the value of ``repo``.",
"name": "_set_repo",
"signature": "def _set_repo(cls, v: Optional[str], values: Dict[str,... | 3 | stack_v2_sparse_classes_30k_train_012432 | Implement the Python class `ImagePushArgs` described below.
Class description:
Args passed to image.push.
Method signatures and docstrings:
- def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: Set the value of ``ecr_repo``.
- def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]: S... | Implement the Python class `ImagePushArgs` described below.
Class description:
Args passed to image.push.
Method signatures and docstrings:
- def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any: Set the value of ``ecr_repo``.
- def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]: S... | 0763b06aee07d2cf3f037a49ca0cb81a048c5deb | <|skeleton|>
class ImagePushArgs:
"""Args passed to image.push."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
<|body_0|>
def _set_repo(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
"""Set the value of ``rep... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImagePushArgs:
"""Args passed to image.push."""
def _set_ecr_repo(cls, v: Any, values: Dict[str, Any]) -> Any:
"""Set the value of ``ecr_repo``."""
if v and isinstance(v, dict):
return ElasticContainerRegistryRepository.parse_obj({'repo_name': v.get('repo_name'), 'registry': E... | the_stack_v2_python_sparse | runway/cfngin/hooks/docker/image/_push.py | onicagroup/runway | train | 156 |
69df4ca7139266a0bb9614f2a86c08b6eb25227c | [
"self.url = url\nself.port = port\nself.client = pymongo.MongoClient(self.url, self.port)\nself.db = self.client[database]",
"if self.db[table_name].insert_one(info):\n print('存入数据库成功')\nelse:\n print('存入数据库失败', info)"
] | <|body_start_0|>
self.url = url
self.port = port
self.client = pymongo.MongoClient(self.url, self.port)
self.db = self.client[database]
<|end_body_0|>
<|body_start_1|>
if self.db[table_name].insert_one(info):
print('存入数据库成功')
else:
print('存入数据库失败'... | 定义MongoDB操作类 | MongoDBHandle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MongoDBHandle:
"""定义MongoDB操作类"""
def __init__(self, url, port, database):
"""初始化数据库信息并创建数据库操作对象"""
<|body_0|>
def insert(self, info, table_name):
"""将数据插入数据库"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.url = url
self.port = por... | stack_v2_sparse_classes_36k_train_000860 | 579 | no_license | [
{
"docstring": "初始化数据库信息并创建数据库操作对象",
"name": "__init__",
"signature": "def __init__(self, url, port, database)"
},
{
"docstring": "将数据插入数据库",
"name": "insert",
"signature": "def insert(self, info, table_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000659 | Implement the Python class `MongoDBHandle` described below.
Class description:
定义MongoDB操作类
Method signatures and docstrings:
- def __init__(self, url, port, database): 初始化数据库信息并创建数据库操作对象
- def insert(self, info, table_name): 将数据插入数据库 | Implement the Python class `MongoDBHandle` described below.
Class description:
定义MongoDB操作类
Method signatures and docstrings:
- def __init__(self, url, port, database): 初始化数据库信息并创建数据库操作对象
- def insert(self, info, table_name): 将数据插入数据库
<|skeleton|>
class MongoDBHandle:
"""定义MongoDB操作类"""
def __init__(self, u... | 6f138a7a4eaaa0892986be07232d68defeafaeb6 | <|skeleton|>
class MongoDBHandle:
"""定义MongoDB操作类"""
def __init__(self, url, port, database):
"""初始化数据库信息并创建数据库操作对象"""
<|body_0|>
def insert(self, info, table_name):
"""将数据插入数据库"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MongoDBHandle:
"""定义MongoDB操作类"""
def __init__(self, url, port, database):
"""初始化数据库信息并创建数据库操作对象"""
self.url = url
self.port = port
self.client = pymongo.MongoClient(self.url, self.port)
self.db = self.client[database]
def insert(self, info, table_name):
... | the_stack_v2_python_sparse | DataBaseHandler/mongodb_handle.py | zeze-ya/12306Train_Info_Spider | train | 1 |
f3a6d3467cac101fe045f6a1c37c8795fbb1e426 | [
"while True:\n for read_file in file_list:\n try:\n print('Produced %s', read_file.strip())\n queue.put(read_file.strip())\n time.sleep(random.random())\n except ValueError:\n continue",
"while True:\n try:\n read_file = queue.get()\n p... | <|body_start_0|>
while True:
for read_file in file_list:
try:
print('Produced %s', read_file.strip())
queue.put(read_file.strip())
time.sleep(random.random())
except ValueError:
continue
<... | Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern | ProducerConsumerClassSummary | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProducerConsumerClassSummary:
"""Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern"""
def producer_run(self, file_list):
... | stack_v2_sparse_classes_36k_train_000861 | 1,578 | permissive | [
{
"docstring": "Running Producer Setting read word net file into the Queue",
"name": "producer_run",
"signature": "def producer_run(self, file_list)"
},
{
"docstring": "Running Consumer Taking the Calculate average vector",
"name": "consumer_run",
"signature": "def consumer_run(self, wik... | 2 | stack_v2_sparse_classes_30k_train_011169 | Implement the Python class `ProducerConsumerClassSummary` described below.
Class description:
Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern
Met... | Implement the Python class `ProducerConsumerClassSummary` described below.
Class description:
Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern
Met... | 2ea8bf0168ea53c804412b40fdb4d9b70b043073 | <|skeleton|>
class ProducerConsumerClassSummary:
"""Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern"""
def producer_run(self, file_list):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProducerConsumerClassSummary:
"""Producer Consumer Multi Thread Class Summary. Using the Consumer Producer pattern Reference Python Consumer Producer pattern http://agiliq.com/blog/2013/10/producer-consumer-problem-in-python/ Multi Thread Design pattern"""
def producer_run(self, file_list):
"""Ru... | the_stack_v2_python_sparse | summary/producer_consumer_class_summary.py | SnowMasaya/Chainer-Slack-Twitter-Dialogue | train | 56 |
f322190a686c78c26c86198f03971c7d83184e43 | [
"makefile = stage / 'merlin' / self.makefile\nmarker = f'compiler settings'\nyield from super().generate(makefile=makefile, marker=marker, **kwds)",
"yield from super()._generate(builder=builder, **kwds)\nrenderer = builder.renderer\ncompilers = plexus.compilers\nfor compiler in compilers:\n language = compile... | <|body_start_0|>
makefile = stage / 'merlin' / self.makefile
marker = f'compiler settings'
yield from super().generate(makefile=makefile, marker=marker, **kwds)
<|end_body_0|>
<|body_start_1|>
yield from super()._generate(builder=builder, **kwds)
renderer = builder.renderer
... | The generator of the makefile with the compiler support | Compilers | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Compilers:
"""The generator of the makefile with the compiler support"""
def generate(self, stage, **kwds):
"""Generate my makefile"""
<|body_0|>
def _generate(self, plexus, builder, **kwds):
"""Build my contents"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_000862 | 2,805 | permissive | [
{
"docstring": "Generate my makefile",
"name": "generate",
"signature": "def generate(self, stage, **kwds)"
},
{
"docstring": "Build my contents",
"name": "_generate",
"signature": "def _generate(self, plexus, builder, **kwds)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015917 | Implement the Python class `Compilers` described below.
Class description:
The generator of the makefile with the compiler support
Method signatures and docstrings:
- def generate(self, stage, **kwds): Generate my makefile
- def _generate(self, plexus, builder, **kwds): Build my contents | Implement the Python class `Compilers` described below.
Class description:
The generator of the makefile with the compiler support
Method signatures and docstrings:
- def generate(self, stage, **kwds): Generate my makefile
- def _generate(self, plexus, builder, **kwds): Build my contents
<|skeleton|>
class Compilers... | d741c44ffb3e9e1f726bf492202ac8738bb4aa1c | <|skeleton|>
class Compilers:
"""The generator of the makefile with the compiler support"""
def generate(self, stage, **kwds):
"""Generate my makefile"""
<|body_0|>
def _generate(self, plexus, builder, **kwds):
"""Build my contents"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Compilers:
"""The generator of the makefile with the compiler support"""
def generate(self, stage, **kwds):
"""Generate my makefile"""
makefile = stage / 'merlin' / self.makefile
marker = f'compiler settings'
yield from super().generate(makefile=makefile, marker=marker, **... | the_stack_v2_python_sparse | packages/merlin/builders/make/Compilers.py | pyre/pyre | train | 27 |
a3effefeafe74bbc6463bfcf6f8c68d79066cf29 | [
"super().__init__()\nself.thread_num = thread_num\nself.cities = cities\nself.queue = queue",
"current_time = str(datetime.datetime.now())[11:19]\nindex = 0\nfor city in self.cities:\n print(f'\\n{current_time}: Producer {self.thread_num} is adding to the queue')\n response = ISSDataRequest.get_overhead_pas... | <|body_start_0|>
super().__init__()
self.thread_num = thread_num
self.cities = cities
self.queue = queue
<|end_body_0|>
<|body_start_1|>
current_time = str(datetime.datetime.now())[11:19]
index = 0
for city in self.cities:
print(f'\n{current_time}: Pr... | ProducerThread class. | ProducerThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProducerThread:
"""ProducerThread class."""
def __init__(self, cities: list, queue: CityOverheadTimeQueue, thread_num: int):
"""Initialize ProducerThread class. :param cities: list of City objects :param queue: CityOverheadTimeQueue object :param thread_num: integer"""
<|body... | stack_v2_sparse_classes_36k_train_000863 | 4,814 | no_license | [
{
"docstring": "Initialize ProducerThread class. :param cities: list of City objects :param queue: CityOverheadTimeQueue object :param thread_num: integer",
"name": "__init__",
"signature": "def __init__(self, cities: list, queue: CityOverheadTimeQueue, thread_num: int)"
},
{
"docstring": "Run t... | 2 | stack_v2_sparse_classes_30k_train_005657 | Implement the Python class `ProducerThread` described below.
Class description:
ProducerThread class.
Method signatures and docstrings:
- def __init__(self, cities: list, queue: CityOverheadTimeQueue, thread_num: int): Initialize ProducerThread class. :param cities: list of City objects :param queue: CityOverheadTime... | Implement the Python class `ProducerThread` described below.
Class description:
ProducerThread class.
Method signatures and docstrings:
- def __init__(self, cities: list, queue: CityOverheadTimeQueue, thread_num: int): Initialize ProducerThread class. :param cities: list of City objects :param queue: CityOverheadTime... | c25009c0dd19de18706ff21fe5610c77c5cd89cf | <|skeleton|>
class ProducerThread:
"""ProducerThread class."""
def __init__(self, cities: list, queue: CityOverheadTimeQueue, thread_num: int):
"""Initialize ProducerThread class. :param cities: list of City objects :param queue: CityOverheadTimeQueue object :param thread_num: integer"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProducerThread:
"""ProducerThread class."""
def __init__(self, cities: list, queue: CityOverheadTimeQueue, thread_num: int):
"""Initialize ProducerThread class. :param cities: list of City objects :param queue: CityOverheadTimeQueue object :param thread_num: integer"""
super().__init__()
... | the_stack_v2_python_sparse | Labs/Lab10/producer_consumer.py | gonuxxiv/3522_A01200216 | train | 0 |
eb86da42e35090952e8c205885c9fd6b3f4df7c2 | [
"if self.request.method == 'GET':\n return (IsInActiveCommunity(), IsAbleToRetrieveAlbum())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method in ('PUT', 'PATCH', 'DELETE'):\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsStaffOfCommun... | <|body_start_0|>
if self.request.method == 'GET':
return (IsInActiveCommunity(), IsAbleToRetrieveAlbum())
elif self.request.method == 'POST':
return (permissions.IsAuthenticated(),)
elif self.request.method in ('PUT', 'PATCH', 'DELETE'):
return (permissions.Is... | Album view set | AlbumViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlbumViewSet:
"""Album view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def get_serializer_class(self):
"""Get serializer class"""
<|body_1|>
def list(self, request, *args, **kwargs):
"""List albums"""
<|body_2|... | stack_v2_sparse_classes_36k_train_000864 | 8,383 | permissive | [
{
"docstring": "Get permissions",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Get serializer class",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "List albums",
"name": "list",
"... | 3 | null | Implement the Python class `AlbumViewSet` described below.
Class description:
Album view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def get_serializer_class(self): Get serializer class
- def list(self, request, *args, **kwargs): List albums | Implement the Python class `AlbumViewSet` described below.
Class description:
Album view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def get_serializer_class(self): Get serializer class
- def list(self, request, *args, **kwargs): List albums
<|skeleton|>
class AlbumViewSet:
... | cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8 | <|skeleton|>
class AlbumViewSet:
"""Album view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def get_serializer_class(self):
"""Get serializer class"""
<|body_1|>
def list(self, request, *args, **kwargs):
"""List albums"""
<|body_2|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlbumViewSet:
"""Album view set"""
def get_permissions(self):
"""Get permissions"""
if self.request.method == 'GET':
return (IsInActiveCommunity(), IsAbleToRetrieveAlbum())
elif self.request.method == 'POST':
return (permissions.IsAuthenticated(),)
... | the_stack_v2_python_sparse | asset/views.py | 810Teams/clubs-and-events-backend | train | 3 |
92764cc506d89c81b82f3a303b70db97368ef6ab | [
"if not root:\n return []\n_queue = [root]\nresult = []\nwhile _queue:\n node = _queue.pop(0)\n if node:\n result.append(node.val)\n _queue.append(node.left)\n _queue.append(node.right)\n else:\n result.append('#')\nreturn result",
"if not data:\n return None\nroot = Tre... | <|body_start_0|>
if not root:
return []
_queue = [root]
result = []
while _queue:
node = _queue.pop(0)
if node:
result.append(node.val)
_queue.append(node.left)
_queue.append(node.right)
else:... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_000865 | 1,619 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_007928 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 9687f8e743a8b6396fff192f22b5256d1025f86b | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return []
_queue = [root]
result = []
while _queue:
node = _queue.pop(0)
if node:
result.append(n... | the_stack_v2_python_sparse | 2017/tree/CodecTree.py | buhuipao/LeetCode | train | 5 | |
be16b5eee522ced4ec82c18cc6d43d5fa16dd5b2 | [
"super().__init__(**kwds)\nself._slaveWidgets = []\nself._slaveStateWhenMasterIsEnabled = {}\nself._isInMutexGroup = isInMutexGroup",
"self._slaveWidgets.append(slaveWidget)\nself._slaveStateWhenMasterIsEnabled[slaveWidget] = isEnabledWhenMasterIsEnabled\nif self.isChecked():\n slaveWidget.setEnabled(self._sla... | <|body_start_0|>
super().__init__(**kwds)
self._slaveWidgets = []
self._slaveStateWhenMasterIsEnabled = {}
self._isInMutexGroup = isInMutexGroup
<|end_body_0|>
<|body_start_1|>
self._slaveWidgets.append(slaveWidget)
self._slaveStateWhenMasterIsEnabled[slaveWidget] = isEn... | This abstract class defines a checkbox widget that will disable slave widgets depending on the value of the master widget | NzQDisablingWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NzQDisablingWidget:
"""This abstract class defines a checkbox widget that will disable slave widgets depending on the value of the master widget"""
def __init__(self, isInMutexGroup=False, **kwds):
"""The class constructor @param[in] _isInMutexGroup bool: To define if the button is p... | stack_v2_sparse_classes_36k_train_000866 | 4,506 | no_license | [
{
"docstring": "The class constructor @param[in] _isInMutexGroup bool: To define if the button is part of a group of buttons that are mutually exclusive @param[in] kwds** Other parameters are sent to base class constructor",
"name": "__init__",
"signature": "def __init__(self, isInMutexGroup=False, **kw... | 4 | stack_v2_sparse_classes_30k_train_003120 | Implement the Python class `NzQDisablingWidget` described below.
Class description:
This abstract class defines a checkbox widget that will disable slave widgets depending on the value of the master widget
Method signatures and docstrings:
- def __init__(self, isInMutexGroup=False, **kwds): The class constructor @par... | Implement the Python class `NzQDisablingWidget` described below.
Class description:
This abstract class defines a checkbox widget that will disable slave widgets depending on the value of the master widget
Method signatures and docstrings:
- def __init__(self, isInMutexGroup=False, **kwds): The class constructor @par... | 08bbe9bdf98d9142c2a641ce46947b2e393f8cd6 | <|skeleton|>
class NzQDisablingWidget:
"""This abstract class defines a checkbox widget that will disable slave widgets depending on the value of the master widget"""
def __init__(self, isInMutexGroup=False, **kwds):
"""The class constructor @param[in] _isInMutexGroup bool: To define if the button is p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NzQDisablingWidget:
"""This abstract class defines a checkbox widget that will disable slave widgets depending on the value of the master widget"""
def __init__(self, isInMutexGroup=False, **kwds):
"""The class constructor @param[in] _isInMutexGroup bool: To define if the button is part of a grou... | the_stack_v2_python_sparse | vlc_transcoder/NzPyQtToolBox/NzQDisablingWidgets.py | Plouff/VlcTranscoderGui | train | 0 |
a6fa0b178353a082d8deb33cf56aacee6389eb23 | [
"self.num_envs = 1\nself.frame_count = 0\nself.render_every = render_every\nsuper().__init__(env)",
"self.frame_count += 1\nif self.frame_count % self.render_every == 0:\n if not kwargs:\n kwargs = {}\n if 'width' not in kwargs:\n kwargs['width'] = 1024\n if 'height' not in kwargs:\n ... | <|body_start_0|>
self.num_envs = 1
self.frame_count = 0
self.render_every = render_every
super().__init__(env)
<|end_body_0|>
<|body_start_1|>
self.frame_count += 1
if self.frame_count % self.render_every == 0:
if not kwargs:
kwargs = {}
... | A renderer with customized settings for the Jitterbug domain | JitterbugGymEnv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JitterbugGymEnv:
"""A renderer with customized settings for the Jitterbug domain"""
def __init__(self, env, *, render_every=1):
"""Constructor Args: env (dm_control Environment): The environment we are wrapping render_every (int): Draw a human-friendly visualisation of the Jitterbug ... | stack_v2_sparse_classes_36k_train_000867 | 1,765 | no_license | [
{
"docstring": "Constructor Args: env (dm_control Environment): The environment we are wrapping render_every (int): Draw a human-friendly visualisation of the Jitterbug every this many frames",
"name": "__init__",
"signature": "def __init__(self, env, *, render_every=1)"
},
{
"docstring": "Rende... | 2 | stack_v2_sparse_classes_30k_train_010632 | Implement the Python class `JitterbugGymEnv` described below.
Class description:
A renderer with customized settings for the Jitterbug domain
Method signatures and docstrings:
- def __init__(self, env, *, render_every=1): Constructor Args: env (dm_control Environment): The environment we are wrapping render_every (in... | Implement the Python class `JitterbugGymEnv` described below.
Class description:
A renderer with customized settings for the Jitterbug domain
Method signatures and docstrings:
- def __init__(self, env, *, render_every=1): Constructor Args: env (dm_control Environment): The environment we are wrapping render_every (in... | f9741d93994e40fbb96093e9aab1e0215fdb7491 | <|skeleton|>
class JitterbugGymEnv:
"""A renderer with customized settings for the Jitterbug domain"""
def __init__(self, env, *, render_every=1):
"""Constructor Args: env (dm_control Environment): The environment we are wrapping render_every (int): Draw a human-friendly visualisation of the Jitterbug ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JitterbugGymEnv:
"""A renderer with customized settings for the Jitterbug domain"""
def __init__(self, env, *, render_every=1):
"""Constructor Args: env (dm_control Environment): The environment we are wrapping render_every (int): Draw a human-friendly visualisation of the Jitterbug every this ma... | the_stack_v2_python_sparse | jitterbug_dmc/gym_wrapper.py | RoboticsDesignLab/jitterbug | train | 4 |
5582c1414aa410f5ce0aeab6682c5c124c7d76ca | [
"nums.sort()\nif len(nums) == 1 and nums[0] == 0:\n return 1\nfor i in range(len(nums)):\n if i != nums[i]:\n return i\nreturn nums[-1] + 1",
"nums.sort()\nleft = 0\nright = len(nums)\nwhile left < right:\n mid = left + (right - left) // 2\n if nums[mid] > mid:\n right = mid\n else:\n... | <|body_start_0|>
nums.sort()
if len(nums) == 1 and nums[0] == 0:
return 1
for i in range(len(nums)):
if i != nums[i]:
return i
return nums[-1] + 1
<|end_body_0|>
<|body_start_1|>
nums.sort()
left = 0
right = len(nums)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def missingNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def missingNumber1(self, nums):
""":type nums: List[int] :rtype: int [0, 2, 3]"""
<|body_1|>
def missingNumber2(self, nums):
""":type nums: List[int] :rty... | stack_v2_sparse_classes_36k_train_000868 | 1,266 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "missingNumber",
"signature": "def missingNumber(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int [0, 2, 3]",
"name": "missingNumber1",
"signature": "def missingNumber1(self, nums)"
},
{
"docstring": ":t... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def missingNumber(self, nums): :type nums: List[int] :rtype: int
- def missingNumber1(self, nums): :type nums: List[int] :rtype: int [0, 2, 3]
- def missingNumber2(self, nums): :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def missingNumber(self, nums): :type nums: List[int] :rtype: int
- def missingNumber1(self, nums): :type nums: List[int] :rtype: int [0, 2, 3]
- def missingNumber2(self, nums): :... | 3f4284330f9771037ca59e2e6a94122e51e58540 | <|skeleton|>
class Solution:
def missingNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def missingNumber1(self, nums):
""":type nums: List[int] :rtype: int [0, 2, 3]"""
<|body_1|>
def missingNumber2(self, nums):
""":type nums: List[int] :rty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def missingNumber(self, nums):
""":type nums: List[int] :rtype: int"""
nums.sort()
if len(nums) == 1 and nums[0] == 0:
return 1
for i in range(len(nums)):
if i != nums[i]:
return i
return nums[-1] + 1
def missingNum... | the_stack_v2_python_sparse | Leetcode/268.缺失数字.py | myf-algorithm/Leetcode | train | 1 | |
16bc8ecb17588632994166b86d86fe43af14e912 | [
"with mute_signals(post_save):\n profile = self.create_and_login_user()\n self.client.force_login(profile.user)\nwith override_settings(EMAIL_SUPPORT='support'):\n with patch('ui.templatetags.render_bundle._get_bundle') as get_bundle:\n response = self.client.get('/404/')\n assert response.co... | <|body_start_0|>
with mute_signals(post_save):
profile = self.create_and_login_user()
self.client.force_login(profile.user)
with override_settings(EMAIL_SUPPORT='support'):
with patch('ui.templatetags.render_bundle._get_bundle') as get_bundle:
response... | Tests for 404 and 500 handlers | HandlerTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HandlerTests:
"""Tests for 404 and 500 handlers"""
def test_404_error_context_logged_in(self):
"""Assert context values for 404 error page when logged in"""
<|body_0|>
def test_404_error_context_logged_out(self):
"""Assert context values for 404 error page when l... | stack_v2_sparse_classes_36k_train_000869 | 36,848 | permissive | [
{
"docstring": "Assert context values for 404 error page when logged in",
"name": "test_404_error_context_logged_in",
"signature": "def test_404_error_context_logged_in(self)"
},
{
"docstring": "Assert context values for 404 error page when logged out",
"name": "test_404_error_context_logged... | 4 | null | Implement the Python class `HandlerTests` described below.
Class description:
Tests for 404 and 500 handlers
Method signatures and docstrings:
- def test_404_error_context_logged_in(self): Assert context values for 404 error page when logged in
- def test_404_error_context_logged_out(self): Assert context values for ... | Implement the Python class `HandlerTests` described below.
Class description:
Tests for 404 and 500 handlers
Method signatures and docstrings:
- def test_404_error_context_logged_in(self): Assert context values for 404 error page when logged in
- def test_404_error_context_logged_out(self): Assert context values for ... | d6564caca0b7bbfd31e67a751564107fd17d6eb0 | <|skeleton|>
class HandlerTests:
"""Tests for 404 and 500 handlers"""
def test_404_error_context_logged_in(self):
"""Assert context values for 404 error page when logged in"""
<|body_0|>
def test_404_error_context_logged_out(self):
"""Assert context values for 404 error page when l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HandlerTests:
"""Tests for 404 and 500 handlers"""
def test_404_error_context_logged_in(self):
"""Assert context values for 404 error page when logged in"""
with mute_signals(post_save):
profile = self.create_and_login_user()
self.client.force_login(profile.user)
... | the_stack_v2_python_sparse | ui/views_test.py | mitodl/micromasters | train | 35 |
60abc9cbd5f2a3ab903e0e970f21f64a21e8ff37 | [
"headers = {'tenant-id': tenant_id, 'user-auth-token': token, 'user-login-type': AgentApp.agent_login_type, 'device-uuid': AgentApp.device_uuid, 'user-id': user_id, 'agent-app': AgentApp.agent_app, 'Api-version': AgentApp.Api_Version}\nparams = {}\nparams.update(kwargs)\nurl = AgentApp.fws + '/appapi/v4/bkges/bkges... | <|body_start_0|>
headers = {'tenant-id': tenant_id, 'user-auth-token': token, 'user-login-type': AgentApp.agent_login_type, 'device-uuid': AgentApp.device_uuid, 'user-id': user_id, 'agent-app': AgentApp.agent_app, 'Api-version': AgentApp.Api_Version}
params = {}
params.update(kwargs)
url... | Bkges | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bkges:
def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs):
"""佣金统计页面"""
<|body_0|>
def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs):
"""通道佣金列表创"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
headers = {'tenant-id': t... | stack_v2_sparse_classes_36k_train_000870 | 1,428 | no_license | [
{
"docstring": "佣金统计页面",
"name": "get_bkge_indexs",
"signature": "def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs)"
},
{
"docstring": "通道佣金列表创",
"name": "get_channel_bkge_list",
"signature": "def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007314 | Implement the Python class `Bkges` described below.
Class description:
Implement the Bkges class.
Method signatures and docstrings:
- def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): 佣金统计页面
- def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs): 通道佣金列表创 | Implement the Python class `Bkges` described below.
Class description:
Implement the Bkges class.
Method signatures and docstrings:
- def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs): 佣金统计页面
- def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs): 通道佣金列表创
<|skeleton|>
class Bkges:
d... | 2278222cf86887bf16f88cde0ebcce5b5ec98b8f | <|skeleton|>
class Bkges:
def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs):
"""佣金统计页面"""
<|body_0|>
def get_channel_bkge_list(self, token, user_id, tenant_id, **kwargs):
"""通道佣金列表创"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bkges:
def get_bkge_indexs(self, token, user_id, tenant_id, **kwargs):
"""佣金统计页面"""
headers = {'tenant-id': tenant_id, 'user-auth-token': token, 'user-login-type': AgentApp.agent_login_type, 'device-uuid': AgentApp.device_uuid, 'user-id': user_id, 'agent-app': AgentApp.agent_app, 'Api-version'... | the_stack_v2_python_sparse | api/bkges.py | Tiffanyfei/agent_app_api | train | 0 | |
9f2f7bdbe644fc84c68066666508221cd7e6e9bc | [
"super().__init__(**kwargs)\nself.fc1 = keras.layers.Dense(hidden_dim)\nself.fc2 = keras.layers.Dense(latent_dim)",
"x = tf.nn.relu(self.fc1(x))\nx = tf.nn.tanh(self.fc2(x))\nreturn x"
] | <|body_start_0|>
super().__init__(**kwargs)
self.fc1 = keras.layers.Dense(hidden_dim)
self.fc2 = keras.layers.Dense(latent_dim)
<|end_body_0|>
<|body_start_1|>
x = tf.nn.relu(self.fc1(x))
x = tf.nn.tanh(self.fc2(x))
return x
<|end_body_1|>
| ADULT encoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of two fully connected layers with ReLU and tanh nonlinearities. The tanh nonlinearity clips the embedding in [-1, 1] as required in the DDPG algorithm (e.g., [act_low, act_high]). The layers' dimensions used in the pap... | ADULTEncoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ADULTEncoder:
"""ADULT encoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of two fully connected layers with ReLU and tanh nonlinearities. The tanh nonlinearity clips the embedding in [-1, 1] as required in the DDPG algorithm (e.g., [act_low, act_high])... | stack_v2_sparse_classes_36k_train_000871 | 8,692 | permissive | [
{
"docstring": "Constructor. Parameters ---------- hidden_dim Hidden dimension. latent_dim Latent dimension.",
"name": "__init__",
"signature": "def __init__(self, hidden_dim: int, latent_dim: int, **kwargs)"
},
{
"docstring": "Forward pass. Parameters ---------- x Input tensor. **kwargs Other a... | 2 | null | Implement the Python class `ADULTEncoder` described below.
Class description:
ADULT encoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of two fully connected layers with ReLU and tanh nonlinearities. The tanh nonlinearity clips the embedding in [-1, 1] as required in the DDP... | Implement the Python class `ADULTEncoder` described below.
Class description:
ADULT encoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of two fully connected layers with ReLU and tanh nonlinearities. The tanh nonlinearity clips the embedding in [-1, 1] as required in the DDP... | 54d0c957fb01c7ebba4e2a0d28fcbde52d9c6718 | <|skeleton|>
class ADULTEncoder:
"""ADULT encoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of two fully connected layers with ReLU and tanh nonlinearities. The tanh nonlinearity clips the embedding in [-1, 1] as required in the DDPG algorithm (e.g., [act_low, act_high])... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ADULTEncoder:
"""ADULT encoder used in the Counterfactual with Reinforcement Learning experiments. The model consists of two fully connected layers with ReLU and tanh nonlinearities. The tanh nonlinearity clips the embedding in [-1, 1] as required in the DDPG algorithm (e.g., [act_low, act_high]). The layers'... | the_stack_v2_python_sparse | alibi/models/tensorflow/cfrl_models.py | SeldonIO/alibi | train | 2,143 |
3a737a6100ec1f3a5548817e3a067facb27cb3fd | [
"cccc.Stream.__init__(self, fileName, fileMode)\nself.label = 'FIXSRC '\nself.fileId = 1\nself.fixSrc = fixSrc\nni, nj, nz, ng = self.fixSrc.shape\nself.fc = collections.OrderedDict([('itype', 0), ('ndim', 3), ('ngroup', ng), ('ninti', ni), ('nintj', nj), ('nintk', nz), ('idists', 1), ('ndcomp', 1)... | <|body_start_0|>
cccc.Stream.__init__(self, fileName, fileMode)
self.label = 'FIXSRC '
self.fileId = 1
self.fixSrc = fixSrc
ni, nj, nz, ng = self.fixSrc.shape
self.fc = collections.OrderedDict([('itype', 0), ('ndim', 3), ('ngroup', ng), ('ninti', ni), ('n... | Read or write a binary FIXSRC file from DIF3D fixed source input. | FIXSRC | [
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FIXSRC:
"""Read or write a binary FIXSRC file from DIF3D fixed source input."""
def __init__(self, fileName, fileMode, fixSrc):
"""Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC ... | stack_v2_sparse_classes_36k_train_000872 | 4,615 | permissive | [
{
"docstring": "Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC file, the variable FIXSRC.fixSrc, which contains to-be-written core-wide multigroup gamma fixed source data, is constructed from an existing ne... | 5 | stack_v2_sparse_classes_30k_train_001918 | Implement the Python class `FIXSRC` described below.
Class description:
Read or write a binary FIXSRC file from DIF3D fixed source input.
Method signatures and docstrings:
- def __init__(self, fileName, fileMode, fixSrc): Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixe... | Implement the Python class `FIXSRC` described below.
Class description:
Read or write a binary FIXSRC file from DIF3D fixed source input.
Method signatures and docstrings:
- def __init__(self, fileName, fileMode, fixSrc): Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixe... | 360791847227df3f3a337a996ef561e00f846a09 | <|skeleton|>
class FIXSRC:
"""Read or write a binary FIXSRC file from DIF3D fixed source input."""
def __init__(self, fileName, fileMode, fixSrc):
"""Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FIXSRC:
"""Read or write a binary FIXSRC file from DIF3D fixed source input."""
def __init__(self, fileName, fileMode, fixSrc):
"""Initialize a gamma FIXSRC class for reading or writing a binary FIXSRC file for DIF3D gamma fixed source input. If the intent is to write a gamma FIXSRC file, the var... | the_stack_v2_python_sparse | armi/nuclearDataIO/cccc/fixsrc.py | terrapower/armi | train | 204 |
4750b8551d1ecc2f703d6842c0e0e3949bd8549b | [
"url = '/template_versions'\nif response_key:\n return self._get(url, 'template_versions', **kwargs)\nelse:\n return self._get(url, **kwargs)",
"url = '/template_versions/%s/functions' % template_version\nif response_key:\n return self._get(url, 'template_functions', **kwargs)\nelse:\n return self._ge... | <|body_start_0|>
url = '/template_versions'
if response_key:
return self._get(url, 'template_versions', **kwargs)
else:
return self._get(url, **kwargs)
<|end_body_0|>
<|body_start_1|>
url = '/template_versions/%s/functions' % template_version
if response_... | TemplateVersionManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TemplateVersionManager:
def list(self, response_key=True, **kwargs):
"""Get a list of template versions. :rtype: list of :class:`TemplateVersion`"""
<|body_0|>
def get(self, template_version, response_key=True, **kwargs):
"""Get a list of functions for a specific res... | stack_v2_sparse_classes_36k_train_000873 | 874 | no_license | [
{
"docstring": "Get a list of template versions. :rtype: list of :class:`TemplateVersion`",
"name": "list",
"signature": "def list(self, response_key=True, **kwargs)"
},
{
"docstring": "Get a list of functions for a specific resource_type. :param template_version: template version to get the fun... | 2 | stack_v2_sparse_classes_30k_train_010966 | Implement the Python class `TemplateVersionManager` described below.
Class description:
Implement the TemplateVersionManager class.
Method signatures and docstrings:
- def list(self, response_key=True, **kwargs): Get a list of template versions. :rtype: list of :class:`TemplateVersion`
- def get(self, template_versio... | Implement the Python class `TemplateVersionManager` described below.
Class description:
Implement the TemplateVersionManager class.
Method signatures and docstrings:
- def list(self, response_key=True, **kwargs): Get a list of template versions. :rtype: list of :class:`TemplateVersion`
- def get(self, template_versio... | 42f9197ba26ffb6b9dd336a524639ecbbf194365 | <|skeleton|>
class TemplateVersionManager:
def list(self, response_key=True, **kwargs):
"""Get a list of template versions. :rtype: list of :class:`TemplateVersion`"""
<|body_0|>
def get(self, template_version, response_key=True, **kwargs):
"""Get a list of functions for a specific res... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TemplateVersionManager:
def list(self, response_key=True, **kwargs):
"""Get a list of template versions. :rtype: list of :class:`TemplateVersion`"""
url = '/template_versions'
if response_key:
return self._get(url, 'template_versions', **kwargs)
else:
re... | the_stack_v2_python_sparse | ops_client/project/heat/template_versions.py | tokuzfunpi/ops_client | train | 0 | |
87f0725d49d3d06910e9e1060da4b6e4913f681b | [
"row = source[0]\ncolumn = source[1]\nown_destination = (row, column)\nown_path = (source, own_destination)\nleft_destination = (row, column - 1)\nleft_path = (source, left_destination)\ndown_destination = (row + 1, column)\ndown_path = (source, down_destination)\nright_destination = (row, column + 1)\nright_path =... | <|body_start_0|>
row = source[0]
column = source[1]
own_destination = (row, column)
own_path = (source, own_destination)
left_destination = (row, column - 1)
left_path = (source, left_destination)
down_destination = (row + 1, column)
down_path = (source, d... | RedSoldier (Piece) handles finding soldier move destinations from source filtering moves with board layout | RedSoldier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RedSoldier:
"""RedSoldier (Piece) handles finding soldier move destinations from source filtering moves with board layout"""
def all_destinations_from_source(self, source):
"""All red soldier destinations from source with paths :param source: [Tuple[int]] Board source coordinate :ret... | stack_v2_sparse_classes_36k_train_000874 | 6,795 | no_license | [
{
"docstring": "All red soldier destinations from source with paths :param source: [Tuple[int]] Board source coordinate :return: [Dict[Tuple[int], Tuple[Tuple[int]]]] Destination goes to source to destination path",
"name": "all_destinations_from_source",
"signature": "def all_destinations_from_source(s... | 2 | stack_v2_sparse_classes_30k_train_005240 | Implement the Python class `RedSoldier` described below.
Class description:
RedSoldier (Piece) handles finding soldier move destinations from source filtering moves with board layout
Method signatures and docstrings:
- def all_destinations_from_source(self, source): All red soldier destinations from source with paths... | Implement the Python class `RedSoldier` described below.
Class description:
RedSoldier (Piece) handles finding soldier move destinations from source filtering moves with board layout
Method signatures and docstrings:
- def all_destinations_from_source(self, source): All red soldier destinations from source with paths... | 59ea9a74928ca4c6d9978c3da1ebafeee6330871 | <|skeleton|>
class RedSoldier:
"""RedSoldier (Piece) handles finding soldier move destinations from source filtering moves with board layout"""
def all_destinations_from_source(self, source):
"""All red soldier destinations from source with paths :param source: [Tuple[int]] Board source coordinate :ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RedSoldier:
"""RedSoldier (Piece) handles finding soldier move destinations from source filtering moves with board layout"""
def all_destinations_from_source(self, source):
"""All red soldier destinations from source with paths :param source: [Tuple[int]] Board source coordinate :return: [Dict[Tu... | the_stack_v2_python_sparse | Soldier.py | davisethan/janggi | train | 0 |
fec2d1815ed1138828627d8eba7c3f39a213d3bc | [
"form = ParticipantDataEditForm(self.request.form, config=self.config)\nregistration_form = self.barcamp.registration_form\nif self.request.method == 'POST' and form.validate():\n f = form.data\n f['name'] = unicode(uuid.uuid4())\n new_choices = []\n for c in f['choices'].split('\\n'):\n choice =... | <|body_start_0|>
form = ParticipantDataEditForm(self.request.form, config=self.config)
registration_form = self.barcamp.registration_form
if self.request.method == 'POST' and form.validate():
f = form.data
f['name'] = unicode(uuid.uuid4())
new_choices = []
... | let the user define the participant data form fields | ParticipantsDataEditView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParticipantsDataEditView:
"""let the user define the participant data form fields"""
def get(self, slug=None):
"""render the view"""
<|body_0|>
def delete(self, slug=None):
"""delete a form entry"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
f... | stack_v2_sparse_classes_36k_train_000875 | 3,339 | permissive | [
{
"docstring": "render the view",
"name": "get",
"signature": "def get(self, slug=None)"
},
{
"docstring": "delete a form entry",
"name": "delete",
"signature": "def delete(self, slug=None)"
}
] | 2 | null | Implement the Python class `ParticipantsDataEditView` described below.
Class description:
let the user define the participant data form fields
Method signatures and docstrings:
- def get(self, slug=None): render the view
- def delete(self, slug=None): delete a form entry | Implement the Python class `ParticipantsDataEditView` described below.
Class description:
let the user define the participant data form fields
Method signatures and docstrings:
- def get(self, slug=None): render the view
- def delete(self, slug=None): delete a form entry
<|skeleton|>
class ParticipantsDataEditView:
... | 9b45664e46c451b2cbe00bb55583b043e769083d | <|skeleton|>
class ParticipantsDataEditView:
"""let the user define the participant data form fields"""
def get(self, slug=None):
"""render the view"""
<|body_0|>
def delete(self, slug=None):
"""delete a form entry"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParticipantsDataEditView:
"""let the user define the participant data form fields"""
def get(self, slug=None):
"""render the view"""
form = ParticipantDataEditForm(self.request.form, config=self.config)
registration_form = self.barcamp.registration_form
if self.request.met... | the_stack_v2_python_sparse | camper/barcamps/customfields.py | comlounge/camper | train | 14 |
a8ff7ac422d604742a518efaed78426eef5312c6 | [
"stu_1 = Student('Robin', 'Wills', 25000)\nstu_2 = Student('Mark', 'Smith', 28000)\nself.assertEqual(stu_1.mail, 'Robin.Wills@xyz.com')\nself.assertEqual(stu_2.mail, 'Mark.Smith@xyz.com')\nstu_1.first = 'Jennifer'\nstu_2.first = 'Graham'\nself.assertEqual(stu_1.mail, 'Jennifer.Wills@xyz.com')\nself.assertEqual(stu_... | <|body_start_0|>
stu_1 = Student('Robin', 'Wills', 25000)
stu_2 = Student('Mark', 'Smith', 28000)
self.assertEqual(stu_1.mail, 'Robin.Wills@xyz.com')
self.assertEqual(stu_2.mail, 'Mark.Smith@xyz.com')
stu_1.first = 'Jennifer'
stu_2.first = 'Graham'
self.assertEqua... | This class is used to test all the features of the student class | Testing | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Testing:
"""This class is used to test all the features of the student class"""
def test_mail(self):
"""This is used to test the mail property of the Student class :return: Nothing"""
<|body_0|>
def test_fullname(self):
"""This function tests the fullname propert... | stack_v2_sparse_classes_36k_train_000876 | 1,731 | no_license | [
{
"docstring": "This is used to test the mail property of the Student class :return: Nothing",
"name": "test_mail",
"signature": "def test_mail(self)"
},
{
"docstring": "This function tests the fullname property of the student :return: Nothing",
"name": "test_fullname",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_004634 | Implement the Python class `Testing` described below.
Class description:
This class is used to test all the features of the student class
Method signatures and docstrings:
- def test_mail(self): This is used to test the mail property of the Student class :return: Nothing
- def test_fullname(self): This function tests... | Implement the Python class `Testing` described below.
Class description:
This class is used to test all the features of the student class
Method signatures and docstrings:
- def test_mail(self): This is used to test the mail property of the Student class :return: Nothing
- def test_fullname(self): This function tests... | 2b7edfafc4e448bd558c034044570496ca68bf2d | <|skeleton|>
class Testing:
"""This class is used to test all the features of the student class"""
def test_mail(self):
"""This is used to test the mail property of the Student class :return: Nothing"""
<|body_0|>
def test_fullname(self):
"""This function tests the fullname propert... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Testing:
"""This class is used to test all the features of the student class"""
def test_mail(self):
"""This is used to test the mail property of the Student class :return: Nothing"""
stu_1 = Student('Robin', 'Wills', 25000)
stu_2 = Student('Mark', 'Smith', 28000)
self.ass... | the_stack_v2_python_sparse | AdvancedUnittest/test_student.py | gsudarshan1990/Training_Projects | train | 0 |
74bd61491d12823a730b128e0a288c08f8391646 | [
"self.weight_decay_lambda = weight_decay_lambda\nself.hidden_size_list = hidden_size_list\nhidden_layers_num = len(self.hidden_size_list)\nself.params = {}\nall_size_list = [input_size] + self.hidden_size_list + [output_size]\nfor index in range(1, len(all_size_list)):\n weight_init_he = np.sqrt(2 / all_size_lis... | <|body_start_0|>
self.weight_decay_lambda = weight_decay_lambda
self.hidden_size_list = hidden_size_list
hidden_layers_num = len(self.hidden_size_list)
self.params = {}
all_size_list = [input_size] + self.hidden_size_list + [output_size]
for index in range(1, len(all_size... | MultiLayerNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiLayerNet:
def __init__(self, input_size, hidden_size_list, output_size, weight_init_std=0.01, weight_decay_lambda=0.0, dropout_ratio=0.0):
"""Initialize n-layers network. Weight matrices are initialized randomly. Biases are zero vectors. input_size: the number of neurons in layer-0(... | stack_v2_sparse_classes_36k_train_000877 | 5,733 | permissive | [
{
"docstring": "Initialize n-layers network. Weight matrices are initialized randomly. Biases are zero vectors. input_size: the number of neurons in layer-0(input to this network) hidden_size_list: the numbers of neurons in layer-1, 2, ..., n-1(hidden layers) output_size: the number of neurons in layer-n(output... | 5 | stack_v2_sparse_classes_30k_train_019727 | Implement the Python class `MultiLayerNet` described below.
Class description:
Implement the MultiLayerNet class.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size_list, output_size, weight_init_std=0.01, weight_decay_lambda=0.0, dropout_ratio=0.0): Initialize n-layers network. Weight mat... | Implement the Python class `MultiLayerNet` described below.
Class description:
Implement the MultiLayerNet class.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size_list, output_size, weight_init_std=0.01, weight_decay_lambda=0.0, dropout_ratio=0.0): Initialize n-layers network. Weight mat... | 70ec531578f099136744d2c1ec11959b239c3854 | <|skeleton|>
class MultiLayerNet:
def __init__(self, input_size, hidden_size_list, output_size, weight_init_std=0.01, weight_decay_lambda=0.0, dropout_ratio=0.0):
"""Initialize n-layers network. Weight matrices are initialized randomly. Biases are zero vectors. input_size: the number of neurons in layer-0(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiLayerNet:
def __init__(self, input_size, hidden_size_list, output_size, weight_init_std=0.01, weight_decay_lambda=0.0, dropout_ratio=0.0):
"""Initialize n-layers network. Weight matrices are initialized randomly. Biases are zero vectors. input_size: the number of neurons in layer-0(input to this ... | the_stack_v2_python_sparse | ch06/multi_layer_net.py | sankaku/deep-learning-from-scratch-py | train | 0 | |
2a026acc6fbd42ee023f981b443ca8d0d53a2008 | [
"self.beam_set = beam_set\nself.joint_type = joint_type\nself.loc_para = loc_para\nself.left_or_right = left_or_right",
"if self.left_or_right:\n self.rel_locations = [(0 + self.loc_para) % 2, (1 + self.loc_para) % 2]\n self.type_loc_para = self.type_def.Triple.locations()\nelif not self.left_or_right:\n ... | <|body_start_0|>
self.beam_set = beam_set
self.joint_type = joint_type
self.loc_para = loc_para
self.left_or_right = left_or_right
<|end_body_0|>
<|body_start_1|>
if self.left_or_right:
self.rel_locations = [(0 + self.loc_para) % 2, (1 + self.loc_para) % 2]
... | Describing the relations and dowel placement between 2 beams, according to the Triple-Dowel-Beam logic. | DoubleJoint | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DoubleJoint:
"""Describing the relations and dowel placement between 2 beams, according to the Triple-Dowel-Beam logic."""
def __init__(self, beam_set, joint_type, loc_para=0, left_or_right=0):
"""Initialization of a double-joint isinstance :param beam_set: Which beams to consider :p... | stack_v2_sparse_classes_36k_train_000878 | 3,147 | permissive | [
{
"docstring": "Initialization of a double-joint isinstance :param beam_set: Which beams to consider :param joint_type: Type and functions that controle the hole locs. :param loc_para: Where to consider them to be connected (0 or 1) :param left_or_right: Left or right set (0 or 1)",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_017717 | Implement the Python class `DoubleJoint` described below.
Class description:
Describing the relations and dowel placement between 2 beams, according to the Triple-Dowel-Beam logic.
Method signatures and docstrings:
- def __init__(self, beam_set, joint_type, loc_para=0, left_or_right=0): Initialization of a double-joi... | Implement the Python class `DoubleJoint` described below.
Class description:
Describing the relations and dowel placement between 2 beams, according to the Triple-Dowel-Beam logic.
Method signatures and docstrings:
- def __init__(self, beam_set, joint_type, loc_para=0, left_or_right=0): Initialization of a double-joi... | 48579e7a2d73d51b95a685fc1b757024c96011d4 | <|skeleton|>
class DoubleJoint:
"""Describing the relations and dowel placement between 2 beams, according to the Triple-Dowel-Beam logic."""
def __init__(self, beam_set, joint_type, loc_para=0, left_or_right=0):
"""Initialization of a double-joint isinstance :param beam_set: Which beams to consider :p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DoubleJoint:
"""Describing the relations and dowel placement between 2 beams, according to the Triple-Dowel-Beam logic."""
def __init__(self, beam_set, joint_type, loc_para=0, left_or_right=0):
"""Initialization of a double-joint isinstance :param beam_set: Which beams to consider :param joint_ty... | the_stack_v2_python_sparse | Code & Design/Rewrite/joints.py | ytakzk/timber_assemblies | train | 0 |
8791a0c719c6bcd6e25c210b000185e458dad1e1 | [
"for selection in orm.Selection.objects.all():\n if selection.internal_crns == '[]':\n crns = []\n else:\n crns = deserialize_numbers(selection.internal_crns)\n sids = models.SectionProxy.objects.filter(crn__in=crns).values_list('id', flat=True)\n selection.internal_section_ids = serialize... | <|body_start_0|>
for selection in orm.Selection.objects.all():
if selection.internal_crns == '[]':
crns = []
else:
crns = deserialize_numbers(selection.internal_crns)
sids = models.SectionProxy.objects.filter(crn__in=crns).values_list('id', fla... | Migration | [
"MIT"
] | 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|>
for selection in orm.Selection.objects.all():
... | stack_v2_sparse_classes_36k_train_000879 | 9,318 | 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_010099 | 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,... | 6bdb2299905f6321be5de788f16a9464a70a4206 | <|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."""
for selection in orm.Selection.objects.all():
if selection.internal_crns == '[]':
crns = []
else:
crns = deserialize_numbers(selection.internal_crns)
... | the_stack_v2_python_sparse | scheduler/south_migrations/0006_convert_crns_to_section_ids_for_selections.py | a3r0d7n4m1k/YACS | train | 0 | |
4549b28bd76b451d26d9af6d5fb7ab6ebf431162 | [
"self.model = model\nself.dataloader = dataloader\nself.loss = loss_function()\nself.optimizer = optimizer\nself.epochs = epochs\nself.lr_scheduler = lr_scheduler\nself.device = device\nself.log_step = log_step\nself.checkpoints_dir_path = checkpoints_dir_path\nself.validator = BaseTester(val_dataloader, loss_funct... | <|body_start_0|>
self.model = model
self.dataloader = dataloader
self.loss = loss_function()
self.optimizer = optimizer
self.epochs = epochs
self.lr_scheduler = lr_scheduler
self.device = device
self.log_step = log_step
self.checkpoints_dir_path = ... | The class implements the base trainer pipeline. | BaseTrainer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseTrainer:
"""The class implements the base trainer pipeline."""
def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_path=None):
"""Constructor, the function initializes the trai... | stack_v2_sparse_classes_36k_train_000880 | 4,215 | permissive | [
{
"docstring": "Constructor, the function initializes the training related parameters. :param model: The model to train :param dataloader: The dataloader to get training samples from :param loss_function: The loss function :param optimizer: The optimizer to be used for training :param epochs: Number of epochs :... | 3 | stack_v2_sparse_classes_30k_train_016057 | Implement the Python class `BaseTrainer` described below.
Class description:
The class implements the base trainer pipeline.
Method signatures and docstrings:
- def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_p... | Implement the Python class `BaseTrainer` described below.
Class description:
The class implements the base trainer pipeline.
Method signatures and docstrings:
- def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_p... | 9a4bf0a112b818caca8794868a903dc736839a43 | <|skeleton|>
class BaseTrainer:
"""The class implements the base trainer pipeline."""
def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_path=None):
"""Constructor, the function initializes the trai... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseTrainer:
"""The class implements the base trainer pipeline."""
def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_path=None):
"""Constructor, the function initializes the training related ... | the_stack_v2_python_sparse | train/base_trainer.py | Niousha12/ssl_for_fgvc | train | 0 |
e6f517acbb6bd64f7c13cbc13ba6b6e320dc3174 | [
"startTime = datetime.datetime.now()\nopener = urllib.request.build_opener()\nopener.addheaders = [('User-agent', 'Mozilla/5.0')]\nurllib.request.install_opener(opener)\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('arshadr_rcallah_shaikh1', 'arshadr_rcallah_shaikh1')\nprint('Connected'... | <|body_start_0|>
startTime = datetime.datetime.now()
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(opener)
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('arshadr_r... | income_data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class income_data:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything h... | stack_v2_sparse_classes_36k_train_000881 | 4,837 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_012196 | Implement the Python class `income_data` described below.
Class description:
Implement the income_data class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTi... | Implement the Python class `income_data` described below.
Class description:
Implement the income_data class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTi... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class income_data:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything h... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class income_data:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.instal... | the_stack_v2_python_sparse | arshadr_rcallah_shaikh1/income_data.py | maximega/course-2019-spr-proj | train | 2 | |
86b1cb77514afd1a4a19b3b950e83ec3aa6fb292 | [
"self.site = site\nself.customer = customer\nself.__intiallize()",
"self.__items = list()\nself.__taxes = list()\nself.currency_rate = 1\nself.price_accuracy = 2\nself.currency_symbol = '€'\nself.currency_code = 'EUR'\nself.__shipping_charge = 0.0\nself.shipping_method = 'Flat Rate Per Order'\nself.tax_type = 'ex... | <|body_start_0|>
self.site = site
self.customer = customer
self.__intiallize()
<|end_body_0|>
<|body_start_1|>
self.__items = list()
self.__taxes = list()
self.currency_rate = 1
self.price_accuracy = 2
self.currency_symbol = '€'
self.currency_code... | Collection of :class:`CartItem` objects. | Cart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cart:
"""Collection of :class:`CartItem` objects."""
def __init__(self, site=None, customer=None):
""":param site: Unique id or name of :class:`Site` object or instance of :class:`Site`. :param customer: Unique id or name of :class:`Customer` object or instance of :class:`Customer`."... | stack_v2_sparse_classes_36k_train_000882 | 14,567 | no_license | [
{
"docstring": ":param site: Unique id or name of :class:`Site` object or instance of :class:`Site`. :param customer: Unique id or name of :class:`Customer` object or instance of :class:`Customer`.",
"name": "__init__",
"signature": "def __init__(self, site=None, customer=None)"
},
{
"docstring"... | 2 | null | Implement the Python class `Cart` described below.
Class description:
Collection of :class:`CartItem` objects.
Method signatures and docstrings:
- def __init__(self, site=None, customer=None): :param site: Unique id or name of :class:`Site` object or instance of :class:`Site`. :param customer: Unique id or name of :c... | Implement the Python class `Cart` described below.
Class description:
Collection of :class:`CartItem` objects.
Method signatures and docstrings:
- def __init__(self, site=None, customer=None): :param site: Unique id or name of :class:`Site` object or instance of :class:`Site`. :param customer: Unique id or name of :c... | 12c56200fcfd3e5229bfeec209fd03b5fc35b823 | <|skeleton|>
class Cart:
"""Collection of :class:`CartItem` objects."""
def __init__(self, site=None, customer=None):
""":param site: Unique id or name of :class:`Site` object or instance of :class:`Site`. :param customer: Unique id or name of :class:`Customer` object or instance of :class:`Customer`."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cart:
"""Collection of :class:`CartItem` objects."""
def __init__(self, site=None, customer=None):
""":param site: Unique id or name of :class:`Site` object or instance of :class:`Site`. :param customer: Unique id or name of :class:`Customer` object or instance of :class:`Customer`."""
se... | the_stack_v2_python_sparse | Front End/Kivy/project8/cart_page_py.py | SurendraKumarAratikatla/MyLenovolapCodes1 | train | 0 |
7816e6a38f17d8cb8bdd627dc9d513edea5a4ead | [
"if not party.__class__ == GenericParty:\n party = GenericParty.objects.get(party=party)\nall_owned_tasks = super(TaskManager, self).filter(ownership__party=party, completed=False).select_related('ownership')\ntask_list = []\nfor task in all_owned_tasks:\n ownership = task.ownership.filter(party=party).latest... | <|body_start_0|>
if not party.__class__ == GenericParty:
party = GenericParty.objects.get(party=party)
all_owned_tasks = super(TaskManager, self).filter(ownership__party=party, completed=False).select_related('ownership')
task_list = []
for task in all_owned_tasks:
... | Adding a method to get tasks currently owned by a user or group. | TaskManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskManager:
"""Adding a method to get tasks currently owned by a user or group."""
def filter_active_by_owner(self, party, *args, **kwargs):
"""Takes a User, Group, or GenericParty and returns a list of tasks that are currently owned by them."""
<|body_0|>
def can_be_se... | stack_v2_sparse_classes_36k_train_000883 | 37,716 | permissive | [
{
"docstring": "Takes a User, Group, or GenericParty and returns a list of tasks that are currently owned by them.",
"name": "filter_active_by_owner",
"signature": "def filter_active_by_owner(self, party, *args, **kwargs)"
},
{
"docstring": "Filters tasks that can be seen by a particular user. T... | 2 | stack_v2_sparse_classes_30k_train_016728 | Implement the Python class `TaskManager` described below.
Class description:
Adding a method to get tasks currently owned by a user or group.
Method signatures and docstrings:
- def filter_active_by_owner(self, party, *args, **kwargs): Takes a User, Group, or GenericParty and returns a list of tasks that are currentl... | Implement the Python class `TaskManager` described below.
Class description:
Adding a method to get tasks currently owned by a user or group.
Method signatures and docstrings:
- def filter_active_by_owner(self, party, *args, **kwargs): Takes a User, Group, or GenericParty and returns a list of tasks that are currentl... | 69e78d01065142446234e77ea7c8c31e3482af29 | <|skeleton|>
class TaskManager:
"""Adding a method to get tasks currently owned by a user or group."""
def filter_active_by_owner(self, party, *args, **kwargs):
"""Takes a User, Group, or GenericParty and returns a list of tasks that are currently owned by them."""
<|body_0|>
def can_be_se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskManager:
"""Adding a method to get tasks currently owned by a user or group."""
def filter_active_by_owner(self, party, *args, **kwargs):
"""Takes a User, Group, or GenericParty and returns a list of tasks that are currently owned by them."""
if not party.__class__ == GenericParty:
... | the_stack_v2_python_sparse | what_apps/do/models.py | jMyles/WHAT | train | 0 |
2f291941efe9b119387deafecb46828520bfeef5 | [
"reader = staticconf.NamespaceReaders(config_namespace)\ntry:\n signal_name = reader.read_string('autoscale_signal.name')\nexcept ConfigurationError as e:\n raise NoSignalConfiguredException from e\nsuper().__init__(signal_name, cluster, pool, scheduler, app, config_namespace)\nself.required_metrics: list = r... | <|body_start_0|>
reader = staticconf.NamespaceReaders(config_namespace)
try:
signal_name = reader.read_string('autoscale_signal.name')
except ConfigurationError as e:
raise NoSignalConfiguredException from e
super().__init__(signal_name, cluster, pool, scheduler, ... | ExternalSignal | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternalSignal:
def __init__(self, cluster: str, pool: str, scheduler: str, app: str, config_namespace: str, metrics_client: ClustermanMetricsBotoClient, signal_namespace: str) -> None:
"""Create an encapsulation of the Unix sockets via which we communicate with signals :param cluster: t... | stack_v2_sparse_classes_36k_train_000884 | 8,912 | permissive | [
{
"docstring": "Create an encapsulation of the Unix sockets via which we communicate with signals :param cluster: the name of the cluster this signal is for :param pool: the name of the pool this signal is for :param app: the name of the application this signal is for :param config_namespace: the staticconf nam... | 3 | null | Implement the Python class `ExternalSignal` described below.
Class description:
Implement the ExternalSignal class.
Method signatures and docstrings:
- def __init__(self, cluster: str, pool: str, scheduler: str, app: str, config_namespace: str, metrics_client: ClustermanMetricsBotoClient, signal_namespace: str) -> No... | Implement the Python class `ExternalSignal` described below.
Class description:
Implement the ExternalSignal class.
Method signatures and docstrings:
- def __init__(self, cluster: str, pool: str, scheduler: str, app: str, config_namespace: str, metrics_client: ClustermanMetricsBotoClient, signal_namespace: str) -> No... | 6c4b8bb424fd84f1087552fb19d992180cf17834 | <|skeleton|>
class ExternalSignal:
def __init__(self, cluster: str, pool: str, scheduler: str, app: str, config_namespace: str, metrics_client: ClustermanMetricsBotoClient, signal_namespace: str) -> None:
"""Create an encapsulation of the Unix sockets via which we communicate with signals :param cluster: t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExternalSignal:
def __init__(self, cluster: str, pool: str, scheduler: str, app: str, config_namespace: str, metrics_client: ClustermanMetricsBotoClient, signal_namespace: str) -> None:
"""Create an encapsulation of the Unix sockets via which we communicate with signals :param cluster: the name of the... | the_stack_v2_python_sparse | clusterman/signals/external_signal.py | Yelp/clusterman | train | 310 | |
b7808dd857fe540131ba3c2d83ae4fc73c5b4d5a | [
"if cls._instance is None:\n cls._instance = super(ParallelBFGSResources, cls).__new__(cls, *args, **kwargs)\nreturn cls._instance",
"self.lock.acquire()\npname = self.mp.current_process().name\nargs = self._objects_per_process.get(pname, None)\nif args is None:\n args = []\n for obj in self.args:\n ... | <|body_start_0|>
if cls._instance is None:
cls._instance = super(ParallelBFGSResources, cls).__new__(cls, *args, **kwargs)
return cls._instance
<|end_body_0|>
<|body_start_1|>
self.lock.acquire()
pname = self.mp.current_process().name
args = self._objects_per_process... | Auxiliary singleton class for sharing memory objects in a multiprocessing environment when performing a parallel_L-BFGS-B minimization procedure. This class takes care of duplicating resources for each process and calling the respective loss function. | ParallelBFGSResources | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParallelBFGSResources:
"""Auxiliary singleton class for sharing memory objects in a multiprocessing environment when performing a parallel_L-BFGS-B minimization procedure. This class takes care of duplicating resources for each process and calling the respective loss function."""
def __new__... | stack_v2_sparse_classes_36k_train_000885 | 13,815 | permissive | [
{
"docstring": "Creates singleton instance.",
"name": "__new__",
"signature": "def __new__(cls, *args, **kwargs)"
},
{
"docstring": "Computes loss (custom_loss) for a specific set of parameters. This class performs the lock mechanism to duplicate objects for each process.",
"name": "loss",
... | 2 | stack_v2_sparse_classes_30k_train_004316 | Implement the Python class `ParallelBFGSResources` described below.
Class description:
Auxiliary singleton class for sharing memory objects in a multiprocessing environment when performing a parallel_L-BFGS-B minimization procedure. This class takes care of duplicating resources for each process and calling the respec... | Implement the Python class `ParallelBFGSResources` described below.
Class description:
Auxiliary singleton class for sharing memory objects in a multiprocessing environment when performing a parallel_L-BFGS-B minimization procedure. This class takes care of duplicating resources for each process and calling the respec... | f1a34904fdf9c6e87521bcf2410f1f4dd2924b7f | <|skeleton|>
class ParallelBFGSResources:
"""Auxiliary singleton class for sharing memory objects in a multiprocessing environment when performing a parallel_L-BFGS-B minimization procedure. This class takes care of duplicating resources for each process and calling the respective loss function."""
def __new__... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParallelBFGSResources:
"""Auxiliary singleton class for sharing memory objects in a multiprocessing environment when performing a parallel_L-BFGS-B minimization procedure. This class takes care of duplicating resources for each process and calling the respective loss function."""
def __new__(cls, *args, ... | the_stack_v2_python_sparse | src/qibo/optimizers.py | tuliplan/qibo | train | 0 |
d467e4aad74e0b846830603633fb678cca505b25 | [
"super().__init__()\nself.conv = torch.nn.Conv1d(idim, odim, kernel_size, stride=stride, dilation=dilation, groups=groups, bias=bias)\nself.dropout = torch.nn.Dropout(p=dropout_rate)\nif relu:\n self.relu_func = torch.nn.ReLU()\nif batch_norm:\n self.bn = torch.nn.BatchNorm1d(odim)\nself.relu = relu\nself.bat... | <|body_start_0|>
super().__init__()
self.conv = torch.nn.Conv1d(idim, odim, kernel_size, stride=stride, dilation=dilation, groups=groups, bias=bias)
self.dropout = torch.nn.Dropout(p=dropout_rate)
if relu:
self.relu_func = torch.nn.ReLU()
if batch_norm:
se... | 1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output channels. bias: Whether to add a ... | Conv1d | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv1d:
"""1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output... | stack_v2_sparse_classes_36k_train_000886 | 7,246 | permissive | [
{
"docstring": "Construct a Conv1d module object.",
"name": "__init__",
"signature": "def __init__(self, idim: int, odim: int, kernel_size: Union[int, Tuple], stride: Union[int, Tuple]=1, dilation: Union[int, Tuple]=1, groups: Union[int, Tuple]=1, bias: bool=True, batch_norm: bool=False, relu: bool=True... | 4 | stack_v2_sparse_classes_30k_train_002710 | Implement the Python class `Conv1d` described below.
Class description:
1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked co... | Implement the Python class `Conv1d` described below.
Class description:
1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked co... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class Conv1d:
"""1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Conv1d:
"""1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output channels. bi... | the_stack_v2_python_sparse | espnet/nets/pytorch_backend/transducer/conv1d_nets.py | espnet/espnet | train | 7,242 |
efd79fd63cd6d1e086fdcac83b39d0d180274243 | [
"if current_app.external_auth and current_app.external_auth.configured():\n raise MethodNotAllowedError('Explicit group to user association is not permitted when using LDAP. Group association to users is done automatically according to the groups associated with the user in LDAP.')\nrequest_dict = rest_utils.get... | <|body_start_0|>
if current_app.external_auth and current_app.external_auth.configured():
raise MethodNotAllowedError('Explicit group to user association is not permitted when using LDAP. Group association to users is done automatically according to the groups associated with the user in LDAP.')
... | UserGroupsUsers | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserGroupsUsers:
def put(self, multi_tenancy):
"""Add a user to a group"""
<|body_0|>
def delete(self, multi_tenancy):
"""Remove a user from a group"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if current_app.external_auth and current_app.externa... | stack_v2_sparse_classes_36k_train_000887 | 5,513 | permissive | [
{
"docstring": "Add a user to a group",
"name": "put",
"signature": "def put(self, multi_tenancy)"
},
{
"docstring": "Remove a user from a group",
"name": "delete",
"signature": "def delete(self, multi_tenancy)"
}
] | 2 | null | Implement the Python class `UserGroupsUsers` described below.
Class description:
Implement the UserGroupsUsers class.
Method signatures and docstrings:
- def put(self, multi_tenancy): Add a user to a group
- def delete(self, multi_tenancy): Remove a user from a group | Implement the Python class `UserGroupsUsers` described below.
Class description:
Implement the UserGroupsUsers class.
Method signatures and docstrings:
- def put(self, multi_tenancy): Add a user to a group
- def delete(self, multi_tenancy): Remove a user from a group
<|skeleton|>
class UserGroupsUsers:
def put(... | c0de6442e1d7653fad824d75e571802a74eee605 | <|skeleton|>
class UserGroupsUsers:
def put(self, multi_tenancy):
"""Add a user to a group"""
<|body_0|>
def delete(self, multi_tenancy):
"""Remove a user from a group"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserGroupsUsers:
def put(self, multi_tenancy):
"""Add a user to a group"""
if current_app.external_auth and current_app.external_auth.configured():
raise MethodNotAllowedError('Explicit group to user association is not permitted when using LDAP. Group association to users is done a... | the_stack_v2_python_sparse | rest-service/manager_rest/rest/resources_v3/user_groups.py | cloudify-cosmo/cloudify-manager | train | 146 | |
0c447ba4e6ed9b18da4726161099ed2380bf0f25 | [
"super(TailLatestFile, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)\nself.directory = directory\nself.file_pattern = file_pattern\nself.ret_required = False\nself.time_for_failure = time_for_failure\nself._first_line_time = None\nself._check_failure_indication = T... | <|body_start_0|>
super(TailLatestFile, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)
self.directory = directory
self.file_pattern = file_pattern
self.ret_required = False
self.time_for_failure = time_for_failure
self._fir... | TailLatestFile | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TailLatestFile:
def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1):
"""Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param di... | stack_v2_sparse_classes_36k_train_000888 | 5,682 | permissive | [
{
"docstring": "Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param directory: path to directory to tail. :param file_pattern: pattern for files from directory. :param prompt: prompt (on system where command runs). :param newl... | 4 | stack_v2_sparse_classes_30k_train_014698 | Implement the Python class `TailLatestFile` described below.
Class description:
Implement the TailLatestFile class.
Method signatures and docstrings:
- def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): Command for tail latest file from the... | Implement the Python class `TailLatestFile` described below.
Class description:
Implement the TailLatestFile class.
Method signatures and docstrings:
- def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): Command for tail latest file from the... | 5a7bb06807b6e0124c77040367d0c20f42849a4c | <|skeleton|>
class TailLatestFile:
def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1):
"""Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param di... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TailLatestFile:
def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1):
"""Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param directory: path ... | the_stack_v2_python_sparse | moler/cmd/unix/tail_latest_file.py | nokia/moler | train | 60 | |
73418aad3190f1151b847d09a56011d724ec868b | [
"self.nctrsHost = UTIL.SYS.s_configuration.NCTRS_HOST\nself.nctrsTMconn = False\nself.nctrsTMport = UTIL.SYS.s_configuration.NCTRS_TM_SERVER_PORT\nself.nctrsTCconn = False\nself.nctrsTCport = UTIL.SYS.s_configuration.NCTRS_TC_SERVER_PORT\nself.nctrsAdminConn = False\nself.nctrsAdminPort = UTIL.SYS.s_configuration.N... | <|body_start_0|>
self.nctrsHost = UTIL.SYS.s_configuration.NCTRS_HOST
self.nctrsTMconn = False
self.nctrsTMport = UTIL.SYS.s_configuration.NCTRS_TM_SERVER_PORT
self.nctrsTCconn = False
self.nctrsTCport = UTIL.SYS.s_configuration.NCTRS_TC_SERVER_PORT
self.nctrsAdminConn = ... | NCTRS Client Configuration | ClientConfiguration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientConfiguration:
"""NCTRS Client Configuration"""
def __init__(self):
"""Initialise the connection relevant informations"""
<|body_0|>
def dump(self):
"""Dumps the status of the configuration attributes"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_000889 | 5,270 | permissive | [
{
"docstring": "Initialise the connection relevant informations",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Dumps the status of the configuration attributes",
"name": "dump",
"signature": "def dump(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018126 | Implement the Python class `ClientConfiguration` described below.
Class description:
NCTRS Client Configuration
Method signatures and docstrings:
- def __init__(self): Initialise the connection relevant informations
- def dump(self): Dumps the status of the configuration attributes | Implement the Python class `ClientConfiguration` described below.
Class description:
NCTRS Client Configuration
Method signatures and docstrings:
- def __init__(self): Initialise the connection relevant informations
- def dump(self): Dumps the status of the configuration attributes
<|skeleton|>
class ClientConfigura... | c94415e9d85519f345fc56938198ac2537c0c6d0 | <|skeleton|>
class ClientConfiguration:
"""NCTRS Client Configuration"""
def __init__(self):
"""Initialise the connection relevant informations"""
<|body_0|>
def dump(self):
"""Dumps the status of the configuration attributes"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientConfiguration:
"""NCTRS Client Configuration"""
def __init__(self):
"""Initialise the connection relevant informations"""
self.nctrsHost = UTIL.SYS.s_configuration.NCTRS_HOST
self.nctrsTMconn = False
self.nctrsTMport = UTIL.SYS.s_configuration.NCTRS_TM_SERVER_PORT
... | the_stack_v2_python_sparse | GRND/IF.py | khawatkom/SpacePyLibrary | train | 1 |
be1487fca74d04eb7b02fbe16b10309944d14a20 | [
"if not tf.executing_eagerly():\n raise ValueError('Only eager mode is currently supported.')\nself._handle = gen_grpc_ops.grpc_client_resource_handle_op(shared_name=context.shared_name(None))\nself._resource_deleter = resource_variable_ops.EagerResourceDeleter(handle=self._handle, handle_device=context.context(... | <|body_start_0|>
if not tf.executing_eagerly():
raise ValueError('Only eager mode is currently supported.')
self._handle = gen_grpc_ops.grpc_client_resource_handle_op(shared_name=context.shared_name(None))
self._resource_deleter = resource_variable_ops.EagerResourceDeleter(handle=sel... | A TensorFlow gRPC client. | Client | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Client:
"""A TensorFlow gRPC client."""
def __init__(self, server_address):
"""Creates and starts the gRPC client. Args: server_address: A string containing the server address."""
<|body_0|>
def _add_method(self, name, output_specs):
"""Adds a method to the clien... | stack_v2_sparse_classes_36k_train_000890 | 5,903 | permissive | [
{
"docstring": "Creates and starts the gRPC client. Args: server_address: A string containing the server address.",
"name": "__init__",
"signature": "def __init__(self, server_address)"
},
{
"docstring": "Adds a method to the client.",
"name": "_add_method",
"signature": "def _add_method... | 2 | stack_v2_sparse_classes_30k_train_006826 | Implement the Python class `Client` described below.
Class description:
A TensorFlow gRPC client.
Method signatures and docstrings:
- def __init__(self, server_address): Creates and starts the gRPC client. Args: server_address: A string containing the server address.
- def _add_method(self, name, output_specs): Adds ... | Implement the Python class `Client` described below.
Class description:
A TensorFlow gRPC client.
Method signatures and docstrings:
- def __init__(self, server_address): Creates and starts the gRPC client. Args: server_address: A string containing the server address.
- def _add_method(self, name, output_specs): Adds ... | 0e1e0ac9178a670ad1e1463baed92020e88905ec | <|skeleton|>
class Client:
"""A TensorFlow gRPC client."""
def __init__(self, server_address):
"""Creates and starts the gRPC client. Args: server_address: A string containing the server address."""
<|body_0|>
def _add_method(self, name, output_specs):
"""Adds a method to the clien... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Client:
"""A TensorFlow gRPC client."""
def __init__(self, server_address):
"""Creates and starts the gRPC client. Args: server_address: A string containing the server address."""
if not tf.executing_eagerly():
raise ValueError('Only eager mode is currently supported.')
... | the_stack_v2_python_sparse | grpc/python/ops.py | google-research/seed_rl | train | 818 |
65ebd55fb08637b995af30bf28739df4e56c5cb4 | [
"Base.__init__(self, server, key)\nself.spider = spider\nself.key = key % {'spider': spider.name}",
"org_dict = request_to_dict(request, self.spider)\nred_dict = RequestDeCompress.reduce_request_dict(org_dict)\nreturn pickle.dumps(red_dict, protocol=1)",
"red_dict = pickle.loads(encoded_request)\norg_dict = Req... | <|body_start_0|>
Base.__init__(self, server, key)
self.spider = spider
self.key = key % {'spider': spider.name}
<|end_body_0|>
<|body_start_1|>
org_dict = request_to_dict(request, self.spider)
red_dict = RequestDeCompress.reduce_request_dict(org_dict)
return pickle.dumps... | RequestQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequestQueue:
def __init__(self, server, spider, key):
"""Initialize per-spider redis queue. Parameters: server -- redis connection spider -- spider instance key -- key for this queue (e.g. "%(spider)s:queue")"""
<|body_0|>
def _encode_request(self, request):
"""Enco... | stack_v2_sparse_classes_36k_train_000891 | 8,663 | no_license | [
{
"docstring": "Initialize per-spider redis queue. Parameters: server -- redis connection spider -- spider instance key -- key for this queue (e.g. \"%(spider)s:queue\")",
"name": "__init__",
"signature": "def __init__(self, server, spider, key)"
},
{
"docstring": "Encode a request object",
... | 3 | null | Implement the Python class `RequestQueue` described below.
Class description:
Implement the RequestQueue class.
Method signatures and docstrings:
- def __init__(self, server, spider, key): Initialize per-spider redis queue. Parameters: server -- redis connection spider -- spider instance key -- key for this queue (e.... | Implement the Python class `RequestQueue` described below.
Class description:
Implement the RequestQueue class.
Method signatures and docstrings:
- def __init__(self, server, spider, key): Initialize per-spider redis queue. Parameters: server -- redis connection spider -- spider instance key -- key for this queue (e.... | 0dc40186a1d89da2b00f29d4f4edfdc5470eb4fc | <|skeleton|>
class RequestQueue:
def __init__(self, server, spider, key):
"""Initialize per-spider redis queue. Parameters: server -- redis connection spider -- spider instance key -- key for this queue (e.g. "%(spider)s:queue")"""
<|body_0|>
def _encode_request(self, request):
"""Enco... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RequestQueue:
def __init__(self, server, spider, key):
"""Initialize per-spider redis queue. Parameters: server -- redis connection spider -- spider instance key -- key for this queue (e.g. "%(spider)s:queue")"""
Base.__init__(self, server, key)
self.spider = spider
self.key = ... | the_stack_v2_python_sparse | deploy/vertical_crawler_realtime/le_crawler/core/queue.py | cash2one/crawl_youtube | train | 0 | |
c1d7d38003e02a7cf150ba2b21c76ef119a579f3 | [
"if not root:\n return 0\nlh, rh = (self.__getHeight(root.left), self.__getHeight(root.right))\nif lh == rh:\n return 2 ** lh - 1 + 1 + self.countNodes(root.right)\nelse:\n return self.countNodes(root.left) + 1 + (2 ** rh - 1)",
"if not root:\n return 0\nreturn 1 + self.__getHeight(root.left)"
] | <|body_start_0|>
if not root:
return 0
lh, rh = (self.__getHeight(root.left), self.__getHeight(root.right))
if lh == rh:
return 2 ** lh - 1 + 1 + self.countNodes(root.right)
else:
return self.countNodes(root.left) + 1 + (2 ** rh - 1)
<|end_body_0|>
<|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countNodes(self, root: TreeNode) -> int:
"""完全二叉树的节点总数 = 左子树的节点总数 + 1(根节点) + 右子树的节点总数 :param root: :return:"""
<|body_0|>
def __getHeight(self, root: TreeNode) -> int:
"""获得以root为根的完全二叉树的深度 :param root: :return: height:int"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_000892 | 1,441 | no_license | [
{
"docstring": "完全二叉树的节点总数 = 左子树的节点总数 + 1(根节点) + 右子树的节点总数 :param root: :return:",
"name": "countNodes",
"signature": "def countNodes(self, root: TreeNode) -> int"
},
{
"docstring": "获得以root为根的完全二叉树的深度 :param root: :return: height:int",
"name": "__getHeight",
"signature": "def __getHeight... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root: TreeNode) -> int: 完全二叉树的节点总数 = 左子树的节点总数 + 1(根节点) + 右子树的节点总数 :param root: :return:
- def __getHeight(self, root: TreeNode) -> int: 获得以root为根的完全二叉树的深度 :p... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root: TreeNode) -> int: 完全二叉树的节点总数 = 左子树的节点总数 + 1(根节点) + 右子树的节点总数 :param root: :return:
- def __getHeight(self, root: TreeNode) -> int: 获得以root为根的完全二叉树的深度 :p... | 70ca9c5ef5be291abbc6e48100ff638c4145eb58 | <|skeleton|>
class Solution:
def countNodes(self, root: TreeNode) -> int:
"""完全二叉树的节点总数 = 左子树的节点总数 + 1(根节点) + 右子树的节点总数 :param root: :return:"""
<|body_0|>
def __getHeight(self, root: TreeNode) -> int:
"""获得以root为根的完全二叉树的深度 :param root: :return: height:int"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def countNodes(self, root: TreeNode) -> int:
"""完全二叉树的节点总数 = 左子树的节点总数 + 1(根节点) + 右子树的节点总数 :param root: :return:"""
if not root:
return 0
lh, rh = (self.__getHeight(root.left), self.__getHeight(root.right))
if lh == rh:
return 2 ** lh - 1 + 1 + ... | the_stack_v2_python_sparse | 1_Binnary_Tree/222_countNodes.py | Step657/leetcode | train | 0 | |
6ce02c0a5f04d9d2b7081a2725edd4b711c2f9e8 | [
"super(SegnetConvLSTM, self).__init__()\nassert lstm_nlayers == len(lstm_hidden_dim)\nself.n_classes = decoder_out_channels\nself.v = verbose\nself.encoder = encoder.VGGencoder()\nself.decoder = decoder.VGGDecoder(decoder_out_channels, config=vgg_decoder_config)\nself.lstm = convlstm.ConvLSTM(input_size=(4, 8), inp... | <|body_start_0|>
super(SegnetConvLSTM, self).__init__()
assert lstm_nlayers == len(lstm_hidden_dim)
self.n_classes = decoder_out_channels
self.v = verbose
self.encoder = encoder.VGGencoder()
self.decoder = decoder.VGGDecoder(decoder_out_channels, config=vgg_decoder_config... | This class implements the whole end-to-end trainable model as described in the paper 'Robust Lane detection From Continuous Driving Scenes Using Deep Neural Networks'. The model comprises of a fully convolutional encoder-decoder (namely Segnet) and of a ConvLSTM, which 'fuses' information coming from multiple contiguou... | SegnetConvLSTM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegnetConvLSTM:
"""This class implements the whole end-to-end trainable model as described in the paper 'Robust Lane detection From Continuous Driving Scenes Using Deep Neural Networks'. The model comprises of a fully convolutional encoder-decoder (namely Segnet) and of a ConvLSTM, which 'fuses' ... | stack_v2_sparse_classes_36k_train_000893 | 4,953 | no_license | [
{
"docstring": ":param lstm_hidden_dim: list of hidden layers dimensions used to define the convlstm architecture (e.g [512, 512]). :param lstm_nlayers: number of hidden layers in lstm (== len(lstm_hidden_dim)) :param decoder_out_channels: number of channels the decoder output will have; it is generally the sam... | 2 | stack_v2_sparse_classes_30k_train_011598 | Implement the Python class `SegnetConvLSTM` described below.
Class description:
This class implements the whole end-to-end trainable model as described in the paper 'Robust Lane detection From Continuous Driving Scenes Using Deep Neural Networks'. The model comprises of a fully convolutional encoder-decoder (namely Se... | Implement the Python class `SegnetConvLSTM` described below.
Class description:
This class implements the whole end-to-end trainable model as described in the paper 'Robust Lane detection From Continuous Driving Scenes Using Deep Neural Networks'. The model comprises of a fully convolutional encoder-decoder (namely Se... | b7fb520080c48a418d4d009ee35f4f92e01f50bd | <|skeleton|>
class SegnetConvLSTM:
"""This class implements the whole end-to-end trainable model as described in the paper 'Robust Lane detection From Continuous Driving Scenes Using Deep Neural Networks'. The model comprises of a fully convolutional encoder-decoder (namely Segnet) and of a ConvLSTM, which 'fuses' ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SegnetConvLSTM:
"""This class implements the whole end-to-end trainable model as described in the paper 'Robust Lane detection From Continuous Driving Scenes Using Deep Neural Networks'. The model comprises of a fully convolutional encoder-decoder (namely Segnet) and of a ConvLSTM, which 'fuses' information c... | the_stack_v2_python_sparse | segnet_conv_lstm_model.py | arindam-modak/Robust-Lane-Detection-in-hazy-environment-using-Encoder-Decoder-CNN-LSTM-DCP | train | 4 |
9202d2e7929f8e5c3556ea256de476a3e1ab9cf5 | [
"self.category_slot = None\nkwargs['type'] = 'multiarray'\nif 'meta' not in kwargs:\n kwargs['meta'] = {}\nkwargs['meta']['type'] = kwargs['type']\nif 'category_slot' in kwargs:\n self.category_slot = kwargs['category_slot']\nif self.category_slot is not None and (not kwargs.get('keys')):\n slot = kwargs['... | <|body_start_0|>
self.category_slot = None
kwargs['type'] = 'multiarray'
if 'meta' not in kwargs:
kwargs['meta'] = {}
kwargs['meta']['type'] = kwargs['type']
if 'category_slot' in kwargs:
self.category_slot = kwargs['category_slot']
if self.categor... | Class for MultiArray field type. | MultiArray | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiArray:
"""Class for MultiArray field type."""
def __init__(self, field_id, **kwargs):
"""Init MultiArray class."""
<|body_0|>
def expand_values(self):
"""Return list of full values."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.categ... | stack_v2_sparse_classes_36k_train_000894 | 11,877 | permissive | [
{
"docstring": "Init MultiArray class.",
"name": "__init__",
"signature": "def __init__(self, field_id, **kwargs)"
},
{
"docstring": "Return list of full values.",
"name": "expand_values",
"signature": "def expand_values(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016780 | Implement the Python class `MultiArray` described below.
Class description:
Class for MultiArray field type.
Method signatures and docstrings:
- def __init__(self, field_id, **kwargs): Init MultiArray class.
- def expand_values(self): Return list of full values. | Implement the Python class `MultiArray` described below.
Class description:
Class for MultiArray field type.
Method signatures and docstrings:
- def __init__(self, field_id, **kwargs): Init MultiArray class.
- def expand_values(self): Return list of full values.
<|skeleton|>
class MultiArray:
"""Class for MultiA... | 052a26316d19a48981417bf340d9f57e2cdc653a | <|skeleton|>
class MultiArray:
"""Class for MultiArray field type."""
def __init__(self, field_id, **kwargs):
"""Init MultiArray class."""
<|body_0|>
def expand_values(self):
"""Return list of full values."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiArray:
"""Class for MultiArray field type."""
def __init__(self, field_id, **kwargs):
"""Init MultiArray class."""
self.category_slot = None
kwargs['type'] = 'multiarray'
if 'meta' not in kwargs:
kwargs['meta'] = {}
kwargs['meta']['type'] = kwargs[... | the_stack_v2_python_sparse | src/blobtools/lib/field.py | blobtoolkit/blobtoolkit | train | 32 |
ff1544a50011f4fa6920b71509e27f9a3a0b1062 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.AntCoordFrame = AntCoordFrame\nself.AntPhaseCenter = AntPhaseCenter\nself.AntPattern = AntPattern\nsuper(AntennaType, self).__init__(**kwargs)",
"if self.AntCoordFrame is... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.AntCoordFrame = AntCoordFrame
self.AntPhaseCenter = AntPhaseCenter
self.AntPattern = AntPattern
supe... | Parameters that describe the transmit and receive antennas used to collect the signal array(s). | AntennaType | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AntennaType:
"""Parameters that describe the transmit and receive antennas used to collect the signal array(s)."""
def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs):
"""Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter :... | stack_v2_sparse_classes_36k_train_000895 | 7,511 | permissive | [
{
"docstring": "Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter : List[AntPhaseCenterType] AntPattern : List[AntPatternType] kwargs",
"name": "__init__",
"signature": "def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs)"
},
{
"docst... | 4 | stack_v2_sparse_classes_30k_train_011941 | Implement the Python class `AntennaType` described below.
Class description:
Parameters that describe the transmit and receive antennas used to collect the signal array(s).
Method signatures and docstrings:
- def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): Parameters ----------... | Implement the Python class `AntennaType` described below.
Class description:
Parameters that describe the transmit and receive antennas used to collect the signal array(s).
Method signatures and docstrings:
- def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs): Parameters ----------... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class AntennaType:
"""Parameters that describe the transmit and receive antennas used to collect the signal array(s)."""
def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs):
"""Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AntennaType:
"""Parameters that describe the transmit and receive antennas used to collect the signal array(s)."""
def __init__(self, AntCoordFrame=None, AntPhaseCenter=None, AntPattern=None, **kwargs):
"""Parameters ---------- AntCoordFrame : List[AntCoordFrameType] AntPhaseCenter : List[AntPhas... | the_stack_v2_python_sparse | sarpy/io/received/crsd1_elements/Antenna.py | ngageoint/sarpy | train | 192 |
d67bc24e6c0aa772a829f8636e077c6afe9236a2 | [
"if method == 'BCR764':\n a = zeros(4)\n a[0] = 0.0\n a[1] = 1.5171479707207227\n a[2] = -2.0342959414414454\n a[3] = 1.5171479707207227\n b = zeros(4)\n b[0] = 0.5600879810924619\n b[1] = -0.06008798109246194\n b[2] = -0.06008798109246194\n b[3] = 0.5600879810924619\n z = zeros(6)\... | <|body_start_0|>
if method == 'BCR764':
a = zeros(4)
a[0] = 0.0
a[1] = 1.5171479707207227
a[2] = -2.0342959414414454
a[3] = 1.5171479707207227
b = zeros(4)
b[0] = 0.5600879810924619
b[1] = -0.06008798109246194
... | ProcessingSplittingParameters | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessingSplittingParameters:
def build(self, method):
""":param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ====... | stack_v2_sparse_classes_36k_train_000896 | 3,691 | permissive | [
{
"docstring": ":param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ================= ========= BCR764 (7,6,4) Blanes/Casas/Ros [1]_ table ... | 2 | stack_v2_sparse_classes_30k_train_017413 | Implement the Python class `ProcessingSplittingParameters` described below.
Class description:
Implement the ProcessingSplittingParameters class.
Method signatures and docstrings:
- def build(self, method): :param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` a... | Implement the Python class `ProcessingSplittingParameters` described below.
Class description:
Implement the ProcessingSplittingParameters class.
Method signatures and docstrings:
- def build(self, method): :param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` a... | 225b5dd9b1af1998bd40b5f6467ee959292b6a83 | <|skeleton|>
class ProcessingSplittingParameters:
def build(self, method):
""":param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ====... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProcessingSplittingParameters:
def build(self, method):
""":param method: A string specifying the method for time integration. :return: Four arrays :math:`a`, :math:`b` and :math:`y`, :math:`z`. ====== ======= ================= ========= Method Order Authors Reference ====== ======= ================= ... | the_stack_v2_python_sparse | WaveBlocksND/ProcessingSplittingParameters.py | WaveBlocks/WaveBlocksND | train | 4 | |
f50189600c2125c7eb8b00b45307d116be643287 | [
"curr_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))\nassert os.path.exists(curr_path), 'Path does not exist: {}'.format(curr_path)\nself.root_path = root_path\nself.data_path = os.path.join(curr_path, self.root_path, image_set)\nself.image_set = image_set\nself.class_names = class_names.stri... | <|body_start_0|>
curr_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
assert os.path.exists(curr_path), 'Path does not exist: {}'.format(curr_path)
self.root_path = root_path
self.data_path = os.path.join(curr_path, self.root_path, image_set)
self.image_set ... | FruitDataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FruitDataset:
def __init__(self, root_path, image_set, class_names='apple,banana,orange'):
""":param root_path: 数据集所在根目录 :param image_set: 数据属性 train or val :param class_names: 类别名称,默认全部导入"""
<|body_0|>
def _load_img_xml_path(self):
"""加载img和xml文件,生成分别包含image和xml文件的两... | stack_v2_sparse_classes_36k_train_000897 | 8,039 | no_license | [
{
"docstring": ":param root_path: 数据集所在根目录 :param image_set: 数据属性 train or val :param class_names: 类别名称,默认全部导入",
"name": "__init__",
"signature": "def __init__(self, root_path, image_set, class_names='apple,banana,orange')"
},
{
"docstring": "加载img和xml文件,生成分别包含image和xml文件的两个列表",
"name": "_lo... | 6 | stack_v2_sparse_classes_30k_train_008579 | Implement the Python class `FruitDataset` described below.
Class description:
Implement the FruitDataset class.
Method signatures and docstrings:
- def __init__(self, root_path, image_set, class_names='apple,banana,orange'): :param root_path: 数据集所在根目录 :param image_set: 数据属性 train or val :param class_names: 类别名称,默认全部导... | Implement the Python class `FruitDataset` described below.
Class description:
Implement the FruitDataset class.
Method signatures and docstrings:
- def __init__(self, root_path, image_set, class_names='apple,banana,orange'): :param root_path: 数据集所在根目录 :param image_set: 数据属性 train or val :param class_names: 类别名称,默认全部导... | 33302a42b6002e1007e2e407bf5bfcde3527e780 | <|skeleton|>
class FruitDataset:
def __init__(self, root_path, image_set, class_names='apple,banana,orange'):
""":param root_path: 数据集所在根目录 :param image_set: 数据属性 train or val :param class_names: 类别名称,默认全部导入"""
<|body_0|>
def _load_img_xml_path(self):
"""加载img和xml文件,生成分别包含image和xml文件的两... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FruitDataset:
def __init__(self, root_path, image_set, class_names='apple,banana,orange'):
""":param root_path: 数据集所在根目录 :param image_set: 数据属性 train or val :param class_names: 类别名称,默认全部导入"""
curr_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
assert os.path.exis... | the_stack_v2_python_sparse | tools/fruit_dataset.py | Sparks-zs/mxnet-object-detection | train | 4 | |
117e75740ee7c71cd1e74773aeb9b69bb94cdc61 | [
"opts = SCons.Variables.Variables()\nopts.Add(SCons.Variables.BoolVariable('test', 'test option help', False))\no = opts.options[0]\nassert o.key == 'test', o.key\nassert o.help == 'test option help (yes|no)', o.help\nassert o.default == 0, o.default\nassert o.validator is not None, o.validator\nassert o.converter ... | <|body_start_0|>
opts = SCons.Variables.Variables()
opts.Add(SCons.Variables.BoolVariable('test', 'test option help', False))
o = opts.options[0]
assert o.key == 'test', o.key
assert o.help == 'test option help (yes|no)', o.help
assert o.default == 0, o.default
as... | BoolVariableTestCase | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BoolVariableTestCase:
def test_BoolVariable(self) -> None:
"""Test BoolVariable creation"""
<|body_0|>
def test_converter(self) -> None:
"""Test the BoolVariable converter"""
<|body_1|>
def test_validator(self) -> None:
"""Test the BoolVariable v... | stack_v2_sparse_classes_36k_train_000898 | 3,899 | permissive | [
{
"docstring": "Test BoolVariable creation",
"name": "test_BoolVariable",
"signature": "def test_BoolVariable(self) -> None"
},
{
"docstring": "Test the BoolVariable converter",
"name": "test_converter",
"signature": "def test_converter(self) -> None"
},
{
"docstring": "Test the ... | 3 | stack_v2_sparse_classes_30k_train_009710 | Implement the Python class `BoolVariableTestCase` described below.
Class description:
Implement the BoolVariableTestCase class.
Method signatures and docstrings:
- def test_BoolVariable(self) -> None: Test BoolVariable creation
- def test_converter(self) -> None: Test the BoolVariable converter
- def test_validator(s... | Implement the Python class `BoolVariableTestCase` described below.
Class description:
Implement the BoolVariableTestCase class.
Method signatures and docstrings:
- def test_BoolVariable(self) -> None: Test BoolVariable creation
- def test_converter(self) -> None: Test the BoolVariable converter
- def test_validator(s... | b2a7d7066a2b854460a334a5fe737ea389655e6e | <|skeleton|>
class BoolVariableTestCase:
def test_BoolVariable(self) -> None:
"""Test BoolVariable creation"""
<|body_0|>
def test_converter(self) -> None:
"""Test the BoolVariable converter"""
<|body_1|>
def test_validator(self) -> None:
"""Test the BoolVariable v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BoolVariableTestCase:
def test_BoolVariable(self) -> None:
"""Test BoolVariable creation"""
opts = SCons.Variables.Variables()
opts.Add(SCons.Variables.BoolVariable('test', 'test option help', False))
o = opts.options[0]
assert o.key == 'test', o.key
assert o.he... | the_stack_v2_python_sparse | SCons/Variables/BoolVariableTests.py | SCons/scons | train | 1,827 | |
878b449a69805e34d28be822bc45eccfb2609c2f | [
"super().__init__(name=name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself.blackboard = self.attach_blackboard_client()\nself.blackboard.register_key(key='/foo/bar/wow', access=py_trees.common.Access.WRITE, remap_to=remap_to['/foo/bar/wow'])",
"self.logger.debug('%s.update()' % self.__class_... | <|body_start_0|>
super().__init__(name=name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self.blackboard = self.attach_blackboard_client()
self.blackboard.register_key(key='/foo/bar/wow', access=py_trees.common.Access.WRITE, remap_to=remap_to['/foo/bar/wow'])
<|end_body_... | Custom writer that submits a more complicated variable to the blackboard. | Remap | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Remap:
"""Custom writer that submits a more complicated variable to the blackboard."""
def __init__(self, name: str, remap_to: typing.Dict[str, str]):
"""Set up the blackboard and remap variables. Args: name: behaviour name remap_to: remappings (from variable name to variable name)""... | stack_v2_sparse_classes_36k_train_000899 | 4,268 | permissive | [
{
"docstring": "Set up the blackboard and remap variables. Args: name: behaviour name remap_to: remappings (from variable name to variable name)",
"name": "__init__",
"signature": "def __init__(self, name: str, remap_to: typing.Dict[str, str])"
},
{
"docstring": "Write a dictionary to the blackb... | 2 | stack_v2_sparse_classes_30k_train_016620 | Implement the Python class `Remap` described below.
Class description:
Custom writer that submits a more complicated variable to the blackboard.
Method signatures and docstrings:
- def __init__(self, name: str, remap_to: typing.Dict[str, str]): Set up the blackboard and remap variables. Args: name: behaviour name rem... | Implement the Python class `Remap` described below.
Class description:
Custom writer that submits a more complicated variable to the blackboard.
Method signatures and docstrings:
- def __init__(self, name: str, remap_to: typing.Dict[str, str]): Set up the blackboard and remap variables. Args: name: behaviour name rem... | 17fc0aeed83ec57b1494deac848324ff61e64232 | <|skeleton|>
class Remap:
"""Custom writer that submits a more complicated variable to the blackboard."""
def __init__(self, name: str, remap_to: typing.Dict[str, str]):
"""Set up the blackboard and remap variables. Args: name: behaviour name remap_to: remappings (from variable name to variable name)""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Remap:
"""Custom writer that submits a more complicated variable to the blackboard."""
def __init__(self, name: str, remap_to: typing.Dict[str, str]):
"""Set up the blackboard and remap variables. Args: name: behaviour name remap_to: remappings (from variable name to variable name)"""
sup... | the_stack_v2_python_sparse | py_trees/demos/blackboard_remappings.py | jstyrud/py_trees | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.