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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b8398bf58bd93cd1a684f97de3d308f3e884b86e | [
"p = PizzaList()\np.create(Pizza('alegg1', 'alegg2'))\nself.assertEqual(1, len(p.pizza_list))",
"p = PizzaList()\np.create(Pizza('alegg1', 'alegg2', 'alegg3'))\np.create(Pizza('alegg1', 'alegg2', 'alegg3'))\np.create(Pizza('alegg1', 'alegg2', 'alegg3'))\np.serve(2)\nself.assertEqual(p.getPizza(2).servedStatus, 's... | <|body_start_0|>
p = PizzaList()
p.create(Pizza('alegg1', 'alegg2'))
self.assertEqual(1, len(p.pizza_list))
<|end_body_0|>
<|body_start_1|>
p = PizzaList()
p.create(Pizza('alegg1', 'alegg2', 'alegg3'))
p.create(Pizza('alegg1', 'alegg2', 'alegg3'))
p.create(Pizza(... | MyTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyTest:
def createTest(self):
"""Tests the create function"""
<|body_0|>
def serveTest(self):
"""Tests the serve function"""
<|body_1|>
def removeTest(self):
"""Tests the remove function"""
<|body_2|>
def testPrint(self):
"""... | stack_v2_sparse_classes_36k_train_009800 | 3,166 | no_license | [
{
"docstring": "Tests the create function",
"name": "createTest",
"signature": "def createTest(self)"
},
{
"docstring": "Tests the serve function",
"name": "serveTest",
"signature": "def serveTest(self)"
},
{
"docstring": "Tests the remove function",
"name": "removeTest",
... | 4 | stack_v2_sparse_classes_30k_train_019840 | Implement the Python class `MyTest` described below.
Class description:
Implement the MyTest class.
Method signatures and docstrings:
- def createTest(self): Tests the create function
- def serveTest(self): Tests the serve function
- def removeTest(self): Tests the remove function
- def testPrint(self): Tests the pri... | Implement the Python class `MyTest` described below.
Class description:
Implement the MyTest class.
Method signatures and docstrings:
- def createTest(self): Tests the create function
- def serveTest(self): Tests the serve function
- def removeTest(self): Tests the remove function
- def testPrint(self): Tests the pri... | 567b129db4ede8d45dec599fc844274bf0953301 | <|skeleton|>
class MyTest:
def createTest(self):
"""Tests the create function"""
<|body_0|>
def serveTest(self):
"""Tests the serve function"""
<|body_1|>
def removeTest(self):
"""Tests the remove function"""
<|body_2|>
def testPrint(self):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyTest:
def createTest(self):
"""Tests the create function"""
p = PizzaList()
p.create(Pizza('alegg1', 'alegg2'))
self.assertEqual(1, len(p.pizza_list))
def serveTest(self):
"""Tests the serve function"""
p = PizzaList()
p.create(Pizza('alegg1', 'al... | the_stack_v2_python_sparse | Tímadæmi/Tímadæmi 3/pizzaz.py | helenaj18/Gagnaskipan | train | 0 | |
3928b3b42fd12137b8f554622fa362969f349ba7 | [
"follower_data = pd.read_csv(c.FOLLOWER_FRIENDS_CSV)\ncolumns_names = pd.read_csv(c.TOP_FRIENDS_FOLLOWED_CSV)\nfollower_data['following'] = follower_data['following'].apply(lambda ids: literal_eval(ids))\nfriends = []\nfor follower_friends in follower_data['following']:\n friends += follower_friends\nfeatures = ... | <|body_start_0|>
follower_data = pd.read_csv(c.FOLLOWER_FRIENDS_CSV)
columns_names = pd.read_csv(c.TOP_FRIENDS_FOLLOWED_CSV)
follower_data['following'] = follower_data['following'].apply(lambda ids: literal_eval(ids))
friends = []
for follower_friends in follower_data['following'... | TweepyKMeans | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TweepyKMeans:
def __following_to_sparse(self, c):
"""Returns : sparse matrix of binary feature values; 0 = not following user | 1 = following user --------------------------------------------------"""
<|body_0|>
def find_optimal_k(self, c):
"""Returns : find optimal ... | stack_v2_sparse_classes_36k_train_009801 | 3,929 | no_license | [
{
"docstring": "Returns : sparse matrix of binary feature values; 0 = not following user | 1 = following user --------------------------------------------------",
"name": "__following_to_sparse",
"signature": "def __following_to_sparse(self, c)"
},
{
"docstring": "Returns : find optimal number o... | 2 | stack_v2_sparse_classes_30k_train_007234 | Implement the Python class `TweepyKMeans` described below.
Class description:
Implement the TweepyKMeans class.
Method signatures and docstrings:
- def __following_to_sparse(self, c): Returns : sparse matrix of binary feature values; 0 = not following user | 1 = following user ----------------------------------------... | Implement the Python class `TweepyKMeans` described below.
Class description:
Implement the TweepyKMeans class.
Method signatures and docstrings:
- def __following_to_sparse(self, c): Returns : sparse matrix of binary feature values; 0 = not following user | 1 = following user ----------------------------------------... | 064e67eac0c683d4bb507157dba168379ed15aee | <|skeleton|>
class TweepyKMeans:
def __following_to_sparse(self, c):
"""Returns : sparse matrix of binary feature values; 0 = not following user | 1 = following user --------------------------------------------------"""
<|body_0|>
def find_optimal_k(self, c):
"""Returns : find optimal ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TweepyKMeans:
def __following_to_sparse(self, c):
"""Returns : sparse matrix of binary feature values; 0 = not following user | 1 = following user --------------------------------------------------"""
follower_data = pd.read_csv(c.FOLLOWER_FRIENDS_CSV)
columns_names = pd.read_csv(c.TOP... | the_stack_v2_python_sparse | tweepy/explore_twitter_data/TweepyKMeans.py | ProgrammingBishop/machine_learning | train | 0 | |
201177a01575b8b5a2965aeaf1442bb65f4dc11d | [
"self.cluster = cluster\nself.fileset = fileset\nself.filesystem = filesystem\nself.name = name\nself.mtype = mtype",
"if dictionary is None:\n return None\ncluster = cohesity_management_sdk.models.gpfs_cluster.GpfsCluster.from_dictionary(dictionary.get('cluster')) if dictionary.get('cluster') else None\nfiles... | <|body_start_0|>
self.cluster = cluster
self.fileset = fileset
self.filesystem = filesystem
self.name = name
self.mtype = mtype
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
cluster = cohesity_management_sdk.models.gpfs_cluster.Gp... | Implementation of the 'GpfsProtectionSource' model. Specifies a Protection Source in GPFS environment. Attributes: cluster (GpfsCluster): Specifies information of an GPFS Cluster. This is set only when the entity type is 'kCluster'. fileset (GpfsFileset): Specifies information about a mount point in an GPFS file system... | GpfsProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GpfsProtectionSource:
"""Implementation of the 'GpfsProtectionSource' model. Specifies a Protection Source in GPFS environment. Attributes: cluster (GpfsCluster): Specifies information of an GPFS Cluster. This is set only when the entity type is 'kCluster'. fileset (GpfsFileset): Specifies inform... | stack_v2_sparse_classes_36k_train_009802 | 3,269 | permissive | [
{
"docstring": "Constructor for the GpfsProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, cluster=None, fileset=None, filesystem=None, name=None, mtype=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dicti... | 2 | null | Implement the Python class `GpfsProtectionSource` described below.
Class description:
Implementation of the 'GpfsProtectionSource' model. Specifies a Protection Source in GPFS environment. Attributes: cluster (GpfsCluster): Specifies information of an GPFS Cluster. This is set only when the entity type is 'kCluster'. ... | Implement the Python class `GpfsProtectionSource` described below.
Class description:
Implementation of the 'GpfsProtectionSource' model. Specifies a Protection Source in GPFS environment. Attributes: cluster (GpfsCluster): Specifies information of an GPFS Cluster. This is set only when the entity type is 'kCluster'. ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class GpfsProtectionSource:
"""Implementation of the 'GpfsProtectionSource' model. Specifies a Protection Source in GPFS environment. Attributes: cluster (GpfsCluster): Specifies information of an GPFS Cluster. This is set only when the entity type is 'kCluster'. fileset (GpfsFileset): Specifies inform... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GpfsProtectionSource:
"""Implementation of the 'GpfsProtectionSource' model. Specifies a Protection Source in GPFS environment. Attributes: cluster (GpfsCluster): Specifies information of an GPFS Cluster. This is set only when the entity type is 'kCluster'. fileset (GpfsFileset): Specifies information about a... | the_stack_v2_python_sparse | cohesity_management_sdk/models/gpfs_protection_source.py | cohesity/management-sdk-python | train | 24 |
cbda420147a92a0a5a22e19377485dba57afb32b | [
"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 GoogleAdsService. Service to fetch data and metrics across resources. | GoogleAdsServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleAdsServiceServicer:
"""Proto file describing the GoogleAdsService. Service to fetch data and metrics across resources."""
def Search(self, request, context):
"""Returns all rows that match the search query."""
<|body_0|>
def Mutate(self, request, context):
... | stack_v2_sparse_classes_36k_train_009803 | 5,425 | permissive | [
{
"docstring": "Returns all rows that match the search query.",
"name": "Search",
"signature": "def Search(self, request, context)"
},
{
"docstring": "Creates, updates, or removes resources. This method supports atomic transactions with multiple types of resources. For example, you can atomicall... | 2 | stack_v2_sparse_classes_30k_train_012645 | Implement the Python class `GoogleAdsServiceServicer` described below.
Class description:
Proto file describing the GoogleAdsService. Service to fetch data and metrics across resources.
Method signatures and docstrings:
- def Search(self, request, context): Returns all rows that match the search query.
- def Mutate(s... | Implement the Python class `GoogleAdsServiceServicer` described below.
Class description:
Proto file describing the GoogleAdsService. Service to fetch data and metrics across resources.
Method signatures and docstrings:
- def Search(self, request, context): Returns all rows that match the search query.
- def Mutate(s... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class GoogleAdsServiceServicer:
"""Proto file describing the GoogleAdsService. Service to fetch data and metrics across resources."""
def Search(self, request, context):
"""Returns all rows that match the search query."""
<|body_0|>
def Mutate(self, request, context):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GoogleAdsServiceServicer:
"""Proto file describing the GoogleAdsService. Service to fetch data and metrics across resources."""
def Search(self, request, context):
"""Returns all rows that match the search query."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_detai... | the_stack_v2_python_sparse | google/ads/google_ads/v1/proto/services/google_ads_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
bd4e9bd5fa99ae3f31eeb99e60615c067f8daf18 | [
"self._dt_fmt = dt_fmt\nself._data_header = data_header\nself._footer_header = footer_header\nself._columns = columns\nself._sep = sep\nself._nr_cols = 3\nself._current_line = None",
"self._current_line = 0\nwith open(file_name, 'r', encoding=encoding) as agt_file:\n self._parse_meta_data(agt_file)\n df = s... | <|body_start_0|>
self._dt_fmt = dt_fmt
self._data_header = data_header
self._footer_header = footer_header
self._columns = columns
self._sep = sep
self._nr_cols = 3
self._current_line = None
<|end_body_0|>
<|body_start_1|>
self._current_line = 0
w... | Parser for agt files that contain sensor data, i.e., timestamps, temerature, and pressure. These files also contain meta-inforamtion that is ignored. | AgtParser | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AgtParser:
"""Parser for agt files that contain sensor data, i.e., timestamps, temerature, and pressure. These files also contain meta-inforamtion that is ignored."""
def __init__(self, dt_fmt='%Y/%m/%d %H:%M:%S', sep=';', data_header='[Data]', footer_header='END OF DATA', columns=('pressure... | stack_v2_sparse_classes_36k_train_009804 | 6,235 | permissive | [
{
"docstring": "Constructor for a new parser, optionally specify a timestamp format.",
"name": "__init__",
"signature": "def __init__(self, dt_fmt='%Y/%m/%d %H:%M:%S', sep=';', data_header='[Data]', footer_header='END OF DATA', columns=('pressure', 'temperature'))"
},
{
"docstring": "parse the f... | 6 | stack_v2_sparse_classes_30k_train_013067 | Implement the Python class `AgtParser` described below.
Class description:
Parser for agt files that contain sensor data, i.e., timestamps, temerature, and pressure. These files also contain meta-inforamtion that is ignored.
Method signatures and docstrings:
- def __init__(self, dt_fmt='%Y/%m/%d %H:%M:%S', sep=';', d... | Implement the Python class `AgtParser` described below.
Class description:
Parser for agt files that contain sensor data, i.e., timestamps, temerature, and pressure. These files also contain meta-inforamtion that is ignored.
Method signatures and docstrings:
- def __init__(self, dt_fmt='%Y/%m/%d %H:%M:%S', sep=';', d... | e748466a2af9f3388a8b0ed091aa061dbfc752d6 | <|skeleton|>
class AgtParser:
"""Parser for agt files that contain sensor data, i.e., timestamps, temerature, and pressure. These files also contain meta-inforamtion that is ignored."""
def __init__(self, dt_fmt='%Y/%m/%d %H:%M:%S', sep=';', data_header='[Data]', footer_header='END OF DATA', columns=('pressure... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AgtParser:
"""Parser for agt files that contain sensor data, i.e., timestamps, temerature, and pressure. These files also contain meta-inforamtion that is ignored."""
def __init__(self, dt_fmt='%Y/%m/%d %H:%M:%S', sep=';', data_header='[Data]', footer_header='END OF DATA', columns=('pressure', 'temperatu... | the_stack_v2_python_sparse | Python/DataFormats/agt_parser.py | gjbex/training-material | train | 130 |
aea4cf7daaee5433a61bd6b29ba0726dba6e2905 | [
"required = [{'short_name': 'fgco2', 'mip': 'Omon'}, {'short_name': 'areacello', 'mip': 'fx'}]\nif project == 'CMIP6':\n required = [{'short_name': 'fgco2', 'mip': 'Omon'}, {'short_name': 'areacello', 'mip': 'Ofx'}]\nreturn required",
"fgco2_cube = cubes.extract_strict(iris.Constraint(name='surface_downward_ma... | <|body_start_0|>
required = [{'short_name': 'fgco2', 'mip': 'Omon'}, {'short_name': 'areacello', 'mip': 'fx'}]
if project == 'CMIP6':
required = [{'short_name': 'fgco2', 'mip': 'Omon'}, {'short_name': 'areacello', 'mip': 'Ofx'}]
return required
<|end_body_0|>
<|body_start_1|>
... | Derivation of variable `gtfgco2`. | DerivedVariable | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DerivedVariable:
"""Derivation of variable `gtfgco2`."""
def required(project):
"""Declare the variables needed for derivation."""
<|body_0|>
def calculate(cubes):
"""Compute longwave cloud radiative effect."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_009805 | 2,526 | permissive | [
{
"docstring": "Declare the variables needed for derivation.",
"name": "required",
"signature": "def required(project)"
},
{
"docstring": "Compute longwave cloud radiative effect.",
"name": "calculate",
"signature": "def calculate(cubes)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002315 | Implement the Python class `DerivedVariable` described below.
Class description:
Derivation of variable `gtfgco2`.
Method signatures and docstrings:
- def required(project): Declare the variables needed for derivation.
- def calculate(cubes): Compute longwave cloud radiative effect. | Implement the Python class `DerivedVariable` described below.
Class description:
Derivation of variable `gtfgco2`.
Method signatures and docstrings:
- def required(project): Declare the variables needed for derivation.
- def calculate(cubes): Compute longwave cloud radiative effect.
<|skeleton|>
class DerivedVariabl... | d5bf3f459ff3a43e780d75d57b63b88b6cc8c4f2 | <|skeleton|>
class DerivedVariable:
"""Derivation of variable `gtfgco2`."""
def required(project):
"""Declare the variables needed for derivation."""
<|body_0|>
def calculate(cubes):
"""Compute longwave cloud radiative effect."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DerivedVariable:
"""Derivation of variable `gtfgco2`."""
def required(project):
"""Declare the variables needed for derivation."""
required = [{'short_name': 'fgco2', 'mip': 'Omon'}, {'short_name': 'areacello', 'mip': 'fx'}]
if project == 'CMIP6':
required = [{'short_n... | the_stack_v2_python_sparse | esmvalcore/preprocessor/_derive/gtfgco2.py | aperezpredictia/ESMValCore | train | 1 |
fb2f8c3d67676e981d18d4e9a510382f81c1b022 | [
"for i in range(len(nums) - 1):\n subarray_sum = nums[i]\n for j in range(i + 1, len(nums)):\n subarray_sum += nums[j]\n if k == 0:\n if subarray_sum == 0:\n return True\n elif subarray_sum % k == 0:\n return True\nreturn False",
"sum = 0\nlookup = {... | <|body_start_0|>
for i in range(len(nums) - 1):
subarray_sum = nums[i]
for j in range(i + 1, len(nums)):
subarray_sum += nums[j]
if k == 0:
if subarray_sum == 0:
return True
elif subarray_sum % k ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def checkSubarraySum_1(self, nums: List[int], k: int) -> bool:
"""1. 暴力遍历"""
<|body_0|>
def checkSubarraySum(self, nums: List[int], k: int) -> bool:
"""2. 哈希表"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for i in range(len(nums) - 1):
... | stack_v2_sparse_classes_36k_train_009806 | 1,942 | no_license | [
{
"docstring": "1. 暴力遍历",
"name": "checkSubarraySum_1",
"signature": "def checkSubarraySum_1(self, nums: List[int], k: int) -> bool"
},
{
"docstring": "2. 哈希表",
"name": "checkSubarraySum",
"signature": "def checkSubarraySum(self, nums: List[int], k: int) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkSubarraySum_1(self, nums: List[int], k: int) -> bool: 1. 暴力遍历
- def checkSubarraySum(self, nums: List[int], k: int) -> bool: 2. 哈希表 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkSubarraySum_1(self, nums: List[int], k: int) -> bool: 1. 暴力遍历
- def checkSubarraySum(self, nums: List[int], k: int) -> bool: 2. 哈希表
<|skeleton|>
class Solution:
de... | 4732fb80710a08a715c3e7080c394f5298b8326d | <|skeleton|>
class Solution:
def checkSubarraySum_1(self, nums: List[int], k: int) -> bool:
"""1. 暴力遍历"""
<|body_0|>
def checkSubarraySum(self, nums: List[int], k: int) -> bool:
"""2. 哈希表"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def checkSubarraySum_1(self, nums: List[int], k: int) -> bool:
"""1. 暴力遍历"""
for i in range(len(nums) - 1):
subarray_sum = nums[i]
for j in range(i + 1, len(nums)):
subarray_sum += nums[j]
if k == 0:
if subar... | the_stack_v2_python_sparse | .leetcode/523.连续的子数组和.py | xiaoruijiang/algorithm | train | 0 | |
be20e26cc882f6ff73ed71c9d62e4c97431c76f7 | [
"super(RunUnitTestsTrampolineTest, self).setUp()\nrun_tests.trampoline.PLATFORM = 'MY_PLATFORM'\nrun_tests.trampoline.CONFIG = 'MY_CONFIG'",
"expected_output = 'python starboard/tools/testing/test_runner.py --target_name nplb --platform MY_PLATFORM --config MY_CONFIG'\ncmd_str = run_tests._ResolveTrampoline(argv=... | <|body_start_0|>
super(RunUnitTestsTrampolineTest, self).setUp()
run_tests.trampoline.PLATFORM = 'MY_PLATFORM'
run_tests.trampoline.CONFIG = 'MY_CONFIG'
<|end_body_0|>
<|body_start_1|>
expected_output = 'python starboard/tools/testing/test_runner.py --target_name nplb --platform MY_PLAT... | Tests trampoline substitutions for run_unit_tests.py. | RunUnitTestsTrampolineTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunUnitTestsTrampolineTest:
"""Tests trampoline substitutions for run_unit_tests.py."""
def setUp(self):
"""Change the trampoline internals for testing purposes."""
<|body_0|>
def testOne(self):
"""Tests that --target_name resolves to the expected value."""
... | stack_v2_sparse_classes_36k_train_009807 | 2,050 | permissive | [
{
"docstring": "Change the trampoline internals for testing purposes.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Tests that --target_name resolves to the expected value.",
"name": "testOne",
"signature": "def testOne(self)"
},
{
"docstring": "Tests that ... | 3 | stack_v2_sparse_classes_30k_train_018795 | Implement the Python class `RunUnitTestsTrampolineTest` described below.
Class description:
Tests trampoline substitutions for run_unit_tests.py.
Method signatures and docstrings:
- def setUp(self): Change the trampoline internals for testing purposes.
- def testOne(self): Tests that --target_name resolves to the exp... | Implement the Python class `RunUnitTestsTrampolineTest` described below.
Class description:
Tests trampoline substitutions for run_unit_tests.py.
Method signatures and docstrings:
- def setUp(self): Change the trampoline internals for testing purposes.
- def testOne(self): Tests that --target_name resolves to the exp... | 0b72f93b07285f3af3c8452ae2ceaf5860ca7c72 | <|skeleton|>
class RunUnitTestsTrampolineTest:
"""Tests trampoline substitutions for run_unit_tests.py."""
def setUp(self):
"""Change the trampoline internals for testing purposes."""
<|body_0|>
def testOne(self):
"""Tests that --target_name resolves to the expected value."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RunUnitTestsTrampolineTest:
"""Tests trampoline substitutions for run_unit_tests.py."""
def setUp(self):
"""Change the trampoline internals for testing purposes."""
super(RunUnitTestsTrampolineTest, self).setUp()
run_tests.trampoline.PLATFORM = 'MY_PLATFORM'
run_tests.tram... | the_stack_v2_python_sparse | src/cobalt/build/cobalt_archive_content/__cobalt_archive/run/impl/run_tests_test.py | blockspacer/cobalt-clone-cab7770533804d582eaa66c713a1582f361182d3 | train | 1 |
3a65cc0559c85ef4b814ca46d00dc56b8242156c | [
"n = 10\ncoefficient = tf.random.uniform(shape=[n])\nmin_value = -tf.math.reduce_sum(tf.abs(coefficient))\nfunc = lambda x: tf.math.reduce_sum(tf.sin(x) * coefficient)\nresult = rotosolve_minimizer.minimize(func, np.random.random(n))\nself.assertAlmostEqual(func(result.position), min_value)\nself.assertAlmostEqual(... | <|body_start_0|>
n = 10
coefficient = tf.random.uniform(shape=[n])
min_value = -tf.math.reduce_sum(tf.abs(coefficient))
func = lambda x: tf.math.reduce_sum(tf.sin(x) * coefficient)
result = rotosolve_minimizer.minimize(func, np.random.random(n))
self.assertAlmostEqual(fun... | Tests for the rotosolve optimization algorithm. | RotosolveMinimizerTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RotosolveMinimizerTest:
"""Tests for the rotosolve optimization algorithm."""
def test_function_optimization(self):
"""Optimize a simple sinusoid function."""
<|body_0|>
def test_nonlinear_function_optimization(self):
"""Test to optimize a non-linear function. A ... | stack_v2_sparse_classes_36k_train_009808 | 6,255 | permissive | [
{
"docstring": "Optimize a simple sinusoid function.",
"name": "test_function_optimization",
"signature": "def test_function_optimization(self)"
},
{
"docstring": "Test to optimize a non-linear function. A non-linear function cannot be optimized by rotosolve, therefore the optimization must neve... | 3 | stack_v2_sparse_classes_30k_train_006927 | Implement the Python class `RotosolveMinimizerTest` described below.
Class description:
Tests for the rotosolve optimization algorithm.
Method signatures and docstrings:
- def test_function_optimization(self): Optimize a simple sinusoid function.
- def test_nonlinear_function_optimization(self): Test to optimize a no... | Implement the Python class `RotosolveMinimizerTest` described below.
Class description:
Tests for the rotosolve optimization algorithm.
Method signatures and docstrings:
- def test_function_optimization(self): Optimize a simple sinusoid function.
- def test_nonlinear_function_optimization(self): Test to optimize a no... | f56257bceb988b743790e1e480eac76fd036d4ff | <|skeleton|>
class RotosolveMinimizerTest:
"""Tests for the rotosolve optimization algorithm."""
def test_function_optimization(self):
"""Optimize a simple sinusoid function."""
<|body_0|>
def test_nonlinear_function_optimization(self):
"""Test to optimize a non-linear function. A ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RotosolveMinimizerTest:
"""Tests for the rotosolve optimization algorithm."""
def test_function_optimization(self):
"""Optimize a simple sinusoid function."""
n = 10
coefficient = tf.random.uniform(shape=[n])
min_value = -tf.math.reduce_sum(tf.abs(coefficient))
fun... | the_stack_v2_python_sparse | tensorflow_quantum/python/optimizers/rotosolve_minimizer_test.py | tensorflow/quantum | train | 1,799 |
6d5188577d07d7c26f89e138628705f6c5bfac73 | [
"proc = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shellind)\nproc_out, proc_err = proc.communicate()\nout, err = ([], [])\nif proc_out is not None and len(proc_out) > 0:\n out = proc_out.decode(errors='ignore')\nif proc_err is not None and len(proc_err) > 0:\n err = pro... | <|body_start_0|>
proc = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shellind)
proc_out, proc_err = proc.communicate()
out, err = ([], [])
if proc_out is not None and len(proc_out) > 0:
out = proc_out.decode(errors='ignore')
if pro... | Utilities to work with shell and filesystem | OSUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OSUtils:
"""Utilities to work with shell and filesystem"""
def run_subprocess(cls, args_list, shellind=False):
"""Create subprocess and get stdout and stderr"""
<|body_0|>
def checkout_path(cls, path_to_file):
"""Returns ('/home/', 'file.ext', 'file') for input '... | stack_v2_sparse_classes_36k_train_009809 | 1,052 | no_license | [
{
"docstring": "Create subprocess and get stdout and stderr",
"name": "run_subprocess",
"signature": "def run_subprocess(cls, args_list, shellind=False)"
},
{
"docstring": "Returns ('/home/', 'file.ext', 'file') for input '/home/file.ext'",
"name": "checkout_path",
"signature": "def chec... | 2 | stack_v2_sparse_classes_30k_train_004590 | Implement the Python class `OSUtils` described below.
Class description:
Utilities to work with shell and filesystem
Method signatures and docstrings:
- def run_subprocess(cls, args_list, shellind=False): Create subprocess and get stdout and stderr
- def checkout_path(cls, path_to_file): Returns ('/home/', 'file.ext'... | Implement the Python class `OSUtils` described below.
Class description:
Utilities to work with shell and filesystem
Method signatures and docstrings:
- def run_subprocess(cls, args_list, shellind=False): Create subprocess and get stdout and stderr
- def checkout_path(cls, path_to_file): Returns ('/home/', 'file.ext'... | fe067bd01d8ed30abfc8f8a868fa8671e9f732a2 | <|skeleton|>
class OSUtils:
"""Utilities to work with shell and filesystem"""
def run_subprocess(cls, args_list, shellind=False):
"""Create subprocess and get stdout and stderr"""
<|body_0|>
def checkout_path(cls, path_to_file):
"""Returns ('/home/', 'file.ext', 'file') for input '... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OSUtils:
"""Utilities to work with shell and filesystem"""
def run_subprocess(cls, args_list, shellind=False):
"""Create subprocess and get stdout and stderr"""
proc = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shellind)
proc_out, proc_err = ... | the_stack_v2_python_sparse | helpers/os_helper.py | zab88/mm | train | 0 |
41ddec34103868769bcb7cc49ec7ee4f18c15945 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Windows10EnterpriseModernAppManagementConfiguration()",
"from .device_configuration import DeviceConfiguration\nfrom .device_configuration import DeviceConfiguration\nfields: Dict[str, Callable[[Any], None]] = {'uninstallBuiltInApps': ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Windows10EnterpriseModernAppManagementConfiguration()
<|end_body_0|>
<|body_start_1|>
from .device_configuration import DeviceConfiguration
from .device_configuration import DeviceConfig... | Windows10 Enterprise Modern App Management Configuration. | Windows10EnterpriseModernAppManagementConfiguration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Windows10EnterpriseModernAppManagementConfiguration:
"""Windows10 Enterprise Modern App Management Configuration."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Windows10EnterpriseModernAppManagementConfiguration:
"""Creates a new instance of the appr... | stack_v2_sparse_classes_36k_train_009810 | 2,483 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Windows10EnterpriseModernAppManagementConfiguration",
"name": "create_from_discriminator_value",
"signature"... | 3 | null | Implement the Python class `Windows10EnterpriseModernAppManagementConfiguration` described below.
Class description:
Windows10 Enterprise Modern App Management Configuration.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Windows10EnterpriseModernAppMa... | Implement the Python class `Windows10EnterpriseModernAppManagementConfiguration` described below.
Class description:
Windows10 Enterprise Modern App Management Configuration.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Windows10EnterpriseModernAppMa... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Windows10EnterpriseModernAppManagementConfiguration:
"""Windows10 Enterprise Modern App Management Configuration."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Windows10EnterpriseModernAppManagementConfiguration:
"""Creates a new instance of the appr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Windows10EnterpriseModernAppManagementConfiguration:
"""Windows10 Enterprise Modern App Management Configuration."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Windows10EnterpriseModernAppManagementConfiguration:
"""Creates a new instance of the appropriate class... | the_stack_v2_python_sparse | msgraph/generated/models/windows10_enterprise_modern_app_management_configuration.py | microsoftgraph/msgraph-sdk-python | train | 135 |
46c9af1862c1c4a2cdfaf72d705da1a8c289cc08 | [
"super(SampleEmbeddingHelper, self).__init__(embedding, start_tokens, end_token)\nself._softmax_temperature = softmax_temperature\nself._seed = seed",
"del time, state\nif not isinstance(outputs, ops.Tensor):\n raise TypeError('Expected outputs to be a single Tensor, got: %s' % type(outputs))\nif self._softmax... | <|body_start_0|>
super(SampleEmbeddingHelper, self).__init__(embedding, start_tokens, end_token)
self._softmax_temperature = softmax_temperature
self._seed = seed
<|end_body_0|>
<|body_start_1|>
del time, state
if not isinstance(outputs, ops.Tensor):
raise TypeError(... | A helper for use during inference. Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input. | SampleEmbeddingHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SampleEmbeddingHelper:
"""A helper for use during inference. Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input."""
def __init__(self, embedding, start_tokens, end_token, softmax_temperature=None, seed=None):
"... | stack_v2_sparse_classes_36k_train_009811 | 26,004 | permissive | [
{
"docstring": "Initializer. Args: embedding: A callable that takes a vector tensor of `ids` (argmax ids), or the `params` argument for `embedding_lookup`. The returned tensor will be passed to the decoder input. start_tokens: `int32` vector shaped `[batch_size]`, the start tokens. end_token: `int32` scalar, th... | 2 | null | Implement the Python class `SampleEmbeddingHelper` described below.
Class description:
A helper for use during inference. Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input.
Method signatures and docstrings:
- def __init__(self, embedding, star... | Implement the Python class `SampleEmbeddingHelper` described below.
Class description:
A helper for use during inference. Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input.
Method signatures and docstrings:
- def __init__(self, embedding, star... | cabf6e4f1970dc14302f87414f170de19944bac2 | <|skeleton|>
class SampleEmbeddingHelper:
"""A helper for use during inference. Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input."""
def __init__(self, embedding, start_tokens, end_token, softmax_temperature=None, seed=None):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SampleEmbeddingHelper:
"""A helper for use during inference. Uses sampling (from a distribution) instead of argmax and passes the result through an embedding layer to get the next input."""
def __init__(self, embedding, start_tokens, end_token, softmax_temperature=None, seed=None):
"""Initializer... | the_stack_v2_python_sparse | Tensorflow/source/tensorflow/contrib/seq2seq/python/ops/helper.py | ryfeus/lambda-packs | train | 1,283 |
6422e1d744274dcbffe7a774c8946296d5e77f74 | [
"super(NeuralNet, self).__init__()\nself.loss_fn = loss_fn\nself.features = nn.Sequential(nn.Conv2d(3, 6, 5), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), nn.Conv2d(6, 16, 5), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2))\nself.classifier = nn.Sequential(nn.Linear(16 * 5 * 5, 120), nn.ReLU(inplace=True), nn.Linear(120, ... | <|body_start_0|>
super(NeuralNet, self).__init__()
self.loss_fn = loss_fn
self.features = nn.Sequential(nn.Conv2d(3, 6, 5), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2), nn.Conv2d(6, 16, 5), nn.ReLU(inplace=True), nn.MaxPool2d(2, 2))
self.classifier = nn.Sequential(nn.Linear(16 * 5 * 5, 120... | NeuralNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeuralNet:
def __init__(self, lrate, loss_fn, in_size, out_size):
"""Initialize the layers of your neural network @param lrate: The learning rate for the model. @param loss_fn: A loss function defined in the following way: @param yhat - an (N,out_size) tensor @param y - an (N,) tensor @r... | stack_v2_sparse_classes_36k_train_009812 | 6,078 | no_license | [
{
"docstring": "Initialize the layers of your neural network @param lrate: The learning rate for the model. @param loss_fn: A loss function defined in the following way: @param yhat - an (N,out_size) tensor @param y - an (N,) tensor @return l(x,y) an () tensor that is the mean loss @param in_size: Dimension of ... | 3 | stack_v2_sparse_classes_30k_train_012266 | Implement the Python class `NeuralNet` described below.
Class description:
Implement the NeuralNet class.
Method signatures and docstrings:
- def __init__(self, lrate, loss_fn, in_size, out_size): Initialize the layers of your neural network @param lrate: The learning rate for the model. @param loss_fn: A loss functi... | Implement the Python class `NeuralNet` described below.
Class description:
Implement the NeuralNet class.
Method signatures and docstrings:
- def __init__(self, lrate, loss_fn, in_size, out_size): Initialize the layers of your neural network @param lrate: The learning rate for the model. @param loss_fn: A loss functi... | 493486813a00726b8356c60509f908aaad8032d4 | <|skeleton|>
class NeuralNet:
def __init__(self, lrate, loss_fn, in_size, out_size):
"""Initialize the layers of your neural network @param lrate: The learning rate for the model. @param loss_fn: A loss function defined in the following way: @param yhat - an (N,out_size) tensor @param y - an (N,) tensor @r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NeuralNet:
def __init__(self, lrate, loss_fn, in_size, out_size):
"""Initialize the layers of your neural network @param lrate: The learning rate for the model. @param loss_fn: A loss function defined in the following way: @param yhat - an (N,out_size) tensor @param y - an (N,) tensor @return l(x,y) a... | the_stack_v2_python_sparse | mp6-code/neuralnet_part2.py | atakanozyapici/ECE448 | train | 0 | |
ade4e2711c0e4be2ab7391c863047151edbca670 | [
"self.public_folders_parameters = public_folders_parameters\nself.acropolis_parameters = acropolis_parameters\nself.continue_on_error = continue_on_error\nself.deploy_vms_to_cloud = deploy_vms_to_cloud\nself.glacier_retrieval_type = glacier_retrieval_type\nself.hyperv_parameters = hyperv_parameters\nself.kubernetes... | <|body_start_0|>
self.public_folders_parameters = public_folders_parameters
self.acropolis_parameters = acropolis_parameters
self.continue_on_error = continue_on_error
self.deploy_vms_to_cloud = deploy_vms_to_cloud
self.glacier_retrieval_type = glacier_retrieval_type
self... | Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' restore objects. acropolis_parameters (Acropolis... | RecoverTaskRequest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecoverTaskRequest:
"""Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' re... | stack_v2_sparse_classes_36k_train_009813 | 13,406 | permissive | [
{
"docstring": "Constructor for the RecoverTaskRequest class",
"name": "__init__",
"signature": "def __init__(self, public_folders_parameters=None, acropolis_parameters=None, continue_on_error=None, deploy_vms_to_cloud=None, glacier_retrieval_type=None, hyperv_parameters=None, kubernetes_parameters=None... | 2 | null | Implement the Python class `RecoverTaskRequest` described below.
Class description:
Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parame... | Implement the Python class `RecoverTaskRequest` described below.
Class description:
Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parame... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RecoverTaskRequest:
"""Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RecoverTaskRequest:
"""Implementation of the 'RecoverTaskRequest' model. Create a Restore Task Request for recovering VMs or mounting volumes to mount points. Attributes: public_folders_parameters (PublicFoldersRestoreParameters): Specifies additional parameters for 'kRecoverO365PublicFolders' restore objects... | the_stack_v2_python_sparse | cohesity_management_sdk/models/recover_task_request.py | cohesity/management-sdk-python | train | 24 |
e016a92d441f4b2e04ef1f442ee7cc9411b01ba8 | [
"import re\nself.dataset_urls_file_path = dataset_urls_file_path\nself._category_regex = re.compile('[A-Za-z]+:')\nself._document_regex = re.compile('.*,http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')",
"import IOUtilities, os\nwith open(self.dataset_urls_file_path, 'r') as f:\n ... | <|body_start_0|>
import re
self.dataset_urls_file_path = dataset_urls_file_path
self._category_regex = re.compile('[A-Za-z]+:')
self._document_regex = re.compile('.*,http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
<|end_body_0|>
<|body_start_1|>
im... | Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category. | DataSetCreator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataSetCreator:
"""Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category."""
def __init__(self, dataset_urls_file_path: str):
... | stack_v2_sparse_classes_36k_train_009814 | 3,112 | no_license | [
{
"docstring": ":param dataset_urls_file_path: Filename for a .txt file which consists of category name,text names and urls.",
"name": "__init__",
"signature": "def __init__(self, dataset_urls_file_path: str)"
},
{
"docstring": "From the given dataset_utilities url file, reach document is retrie... | 2 | stack_v2_sparse_classes_30k_train_002515 | Implement the Python class `DataSetCreator` described below.
Class description:
Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category.
Method signatures and ... | Implement the Python class `DataSetCreator` described below.
Class description:
Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category.
Method signatures and ... | e79acd95d02f981aae13b4d6e55e8bdf65dc268c | <|skeleton|>
class DataSetCreator:
"""Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category."""
def __init__(self, dataset_urls_file_path: str):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataSetCreator:
"""Can be used to create a dataset_utilities for text device_classification. This is done by downloading texts in a specified file and placing them in folders corresponding to their text device_classification category."""
def __init__(self, dataset_urls_file_path: str):
""":param ... | the_stack_v2_python_sparse | dataset_utilities/data_set_creation.py | MDThomsen/DBAC-Device-Detection | train | 0 |
dd78c71fe1898b79a5ed4f6a4578ca1fda44c407 | [
"self.while_branch = while_branch\nself.else_branch = else_branch\nsuper().__init__(*args, **kwargs)",
"is_while_test_invalid = is_invalid_type(self.while_branch.test.check_type(environment))\nwhile_environment = environment.add_local_environment('while')\nis_while_suite_invalid = is_invalid_type(self.while_branc... | <|body_start_0|>
self.while_branch = while_branch
self.else_branch = else_branch
super().__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
is_while_test_invalid = is_invalid_type(self.while_branch.test.check_type(environment))
while_environment = environment.add_local_en... | While statement AST node. | WhileStmtNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WhileStmtNode:
"""While statement AST node."""
def __init__(self, while_branch: TestSuitePair, else_branch: SuiteNode, *args, **kwargs):
"""Set initial values."""
<|body_0|>
def check_type(self, environment: Environment) -> Type:
"""Perform type checking for whil... | stack_v2_sparse_classes_36k_train_009815 | 2,267 | no_license | [
{
"docstring": "Set initial values.",
"name": "__init__",
"signature": "def __init__(self, while_branch: TestSuitePair, else_branch: SuiteNode, *args, **kwargs)"
},
{
"docstring": "Perform type checking for while-stmt.",
"name": "check_type",
"signature": "def check_type(self, environmen... | 3 | stack_v2_sparse_classes_30k_train_000309 | Implement the Python class `WhileStmtNode` described below.
Class description:
While statement AST node.
Method signatures and docstrings:
- def __init__(self, while_branch: TestSuitePair, else_branch: SuiteNode, *args, **kwargs): Set initial values.
- def check_type(self, environment: Environment) -> Type: Perform t... | Implement the Python class `WhileStmtNode` described below.
Class description:
While statement AST node.
Method signatures and docstrings:
- def __init__(self, while_branch: TestSuitePair, else_branch: SuiteNode, *args, **kwargs): Set initial values.
- def check_type(self, environment: Environment) -> Type: Perform t... | 001ad94aad755c11df7cf6ef8f7f0f828a5ac90e | <|skeleton|>
class WhileStmtNode:
"""While statement AST node."""
def __init__(self, while_branch: TestSuitePair, else_branch: SuiteNode, *args, **kwargs):
"""Set initial values."""
<|body_0|>
def check_type(self, environment: Environment) -> Type:
"""Perform type checking for whil... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WhileStmtNode:
"""While statement AST node."""
def __init__(self, while_branch: TestSuitePair, else_branch: SuiteNode, *args, **kwargs):
"""Set initial values."""
self.while_branch = while_branch
self.else_branch = else_branch
super().__init__(*args, **kwargs)
def che... | the_stack_v2_python_sparse | typt/while_stmt_node.py | BPHarris/typt | train | 0 |
e5336e886b35016083020cacdfc62baca8759176 | [
"if not crvs:\n msg = 'Intrinsic mutual informations require a conditional variable.'\n raise ditException(msg)\nsuper().__init__(dist, rvs + [j], crvs, rv_mode=rv_mode)\ntheoretical_bound_u = prod((self._shape[rv] for rv in self._rvs))\nbound_u = min([bound_u, theoretical_bound_u]) if bound_u else theoretica... | <|body_start_0|>
if not crvs:
msg = 'Intrinsic mutual informations require a conditional variable.'
raise ditException(msg)
super().__init__(dist, rvs + [j], crvs, rv_mode=rv_mode)
theoretical_bound_u = prod((self._shape[rv] for rv in self._rvs))
bound_u = min([bo... | Compute the two-part intrinsic mutual informations, an upper bound on the secret key agreement rate: .. math:: I[X : Y \\downarrow\\downarrow\\downarrow\\downarrow Z] = inf_{J} min_{V - U - XY - ZJ} I[X:Y|J] + I[U:J|V] - I[U:Z|V] | InnerTwoPartIntrinsicMutualInformation | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InnerTwoPartIntrinsicMutualInformation:
"""Compute the two-part intrinsic mutual informations, an upper bound on the secret key agreement rate: .. math:: I[X : Y \\downarrow\\downarrow\\downarrow\\downarrow Z] = inf_{J} min_{V - U - XY - ZJ} I[X:Y|J] + I[U:J|V] - I[U:Z|V]"""
def __init__(sel... | stack_v2_sparse_classes_36k_train_009816 | 25,213 | permissive | [
{
"docstring": "Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to compute the intrinsic mutual information of. rvs : list, None A list of lists. Each inner list specifies the indexes of the random variables used to calculate the intrinsic mutual information. If None, then i... | 2 | null | Implement the Python class `InnerTwoPartIntrinsicMutualInformation` described below.
Class description:
Compute the two-part intrinsic mutual informations, an upper bound on the secret key agreement rate: .. math:: I[X : Y \\downarrow\\downarrow\\downarrow\\downarrow Z] = inf_{J} min_{V - U - XY - ZJ} I[X:Y|J] + I[U:J... | Implement the Python class `InnerTwoPartIntrinsicMutualInformation` described below.
Class description:
Compute the two-part intrinsic mutual informations, an upper bound on the secret key agreement rate: .. math:: I[X : Y \\downarrow\\downarrow\\downarrow\\downarrow Z] = inf_{J} min_{V - U - XY - ZJ} I[X:Y|J] + I[U:J... | b13c5020a2b8524527a4a0db5a81d8549142228c | <|skeleton|>
class InnerTwoPartIntrinsicMutualInformation:
"""Compute the two-part intrinsic mutual informations, an upper bound on the secret key agreement rate: .. math:: I[X : Y \\downarrow\\downarrow\\downarrow\\downarrow Z] = inf_{J} min_{V - U - XY - ZJ} I[X:Y|J] + I[U:J|V] - I[U:Z|V]"""
def __init__(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InnerTwoPartIntrinsicMutualInformation:
"""Compute the two-part intrinsic mutual informations, an upper bound on the secret key agreement rate: .. math:: I[X : Y \\downarrow\\downarrow\\downarrow\\downarrow Z] = inf_{J} min_{V - U - XY - ZJ} I[X:Y|J] + I[U:J|V] - I[U:Z|V]"""
def __init__(self, dist, rvs=... | the_stack_v2_python_sparse | dit/multivariate/secret_key_agreement/base_skar_optimizers.py | dit/dit | train | 468 |
cf1aac0b0e9c2670e0437ae6b6ba65c205d20e2f | [
"super().__init__()\nself._num_classes = num_classes\nself._is_training = is_training\nself._network_base, self._downsample_factor = get_inception_base_and_downsample_factor(inception_params.receptive_field_size)\nself._prelogit_dropout_keep_prob = inception_params.prelogit_dropout_keep_prob\nself._depth_multiplier... | <|body_start_0|>
super().__init__()
self._num_classes = num_classes
self._is_training = is_training
self._network_base, self._downsample_factor = get_inception_base_and_downsample_factor(inception_params.receptive_field_size)
self._prelogit_dropout_keep_prob = inception_params.pr... | A no pad, fully convolutional InceptionV3 model. | InceptionV3FCN | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InceptionV3FCN:
"""A no pad, fully convolutional InceptionV3 model."""
def __init__(self, inception_params, conv_scope_params, num_classes=2, is_training=True):
"""Creates a no pad, fully convolutional InceptionV3 model. Args: inception_params: parameters specific to the InceptionV3 ... | stack_v2_sparse_classes_36k_train_009817 | 5,630 | permissive | [
{
"docstring": "Creates a no pad, fully convolutional InceptionV3 model. Args: inception_params: parameters specific to the InceptionV3 conv_scope_params: parameters used to configure the general convolution parameters used in the slim argument scope. num_classes: number of output classes from the model is_trai... | 2 | null | Implement the Python class `InceptionV3FCN` described below.
Class description:
A no pad, fully convolutional InceptionV3 model.
Method signatures and docstrings:
- def __init__(self, inception_params, conv_scope_params, num_classes=2, is_training=True): Creates a no pad, fully convolutional InceptionV3 model. Args: ... | Implement the Python class `InceptionV3FCN` described below.
Class description:
A no pad, fully convolutional InceptionV3 model.
Method signatures and docstrings:
- def __init__(self, inception_params, conv_scope_params, num_classes=2, is_training=True): Creates a no pad, fully convolutional InceptionV3 model. Args: ... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class InceptionV3FCN:
"""A no pad, fully convolutional InceptionV3 model."""
def __init__(self, inception_params, conv_scope_params, num_classes=2, is_training=True):
"""Creates a no pad, fully convolutional InceptionV3 model. Args: inception_params: parameters specific to the InceptionV3 ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InceptionV3FCN:
"""A no pad, fully convolutional InceptionV3 model."""
def __init__(self, inception_params, conv_scope_params, num_classes=2, is_training=True):
"""Creates a no pad, fully convolutional InceptionV3 model. Args: inception_params: parameters specific to the InceptionV3 conv_scope_pa... | the_stack_v2_python_sparse | nopad_inception_v3_fcn/inception_v3_fcn.py | Jimmy-INL/google-research | train | 1 |
2738a587cdebd824e5a118e99e4aefeb834e1e21 | [
"super(DWSepConv, self).__init__()\nif norm_layer is None:\n norm_layer = nn.BatchNorm2d\nif kernel_size == 3:\n conv_dw = conv3x3\nelif kernel_size == 5:\n conv_dw = conv5x5\nelse:\n raise ValueError('DWSepConv class only supports kernel size 3x3, 5x5')\nself._outplanes = inplanes * stride\nself.convdw... | <|body_start_0|>
super(DWSepConv, self).__init__()
if norm_layer is None:
norm_layer = nn.BatchNorm2d
if kernel_size == 3:
conv_dw = conv3x3
elif kernel_size == 5:
conv_dw = conv5x5
else:
raise ValueError('DWSepConv class only suppo... | depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride | DWSepConv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DWSepConv:
"""depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride"""
def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_l... | stack_v2_sparse_classes_36k_train_009818 | 20,656 | no_license | [
{
"docstring": "Constructor Args: inplanes: (int) number of input channels to the block kernel_size: (int) kernel_size of conv-dw filter, either 3x3 or 5x5 is supported stride: (int) stride of conv-dw filter dropout: (float) p = dropout; default = 0 (no dropout effect) norm_layer: (nn.Module) normalization laye... | 2 | stack_v2_sparse_classes_30k_train_002634 | Implement the Python class `DWSepConv` described below.
Class description:
depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride
Method signatures and docstrings:
- d... | Implement the Python class `DWSepConv` described below.
Class description:
depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride
Method signatures and docstrings:
- d... | a0c51824b9c4c458918ef9a40a925cd576137d75 | <|skeleton|>
class DWSepConv:
"""depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride"""
def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DWSepConv:
"""depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride"""
def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_layer=None):
... | the_stack_v2_python_sparse | model/mnasnet.py | baihuaxie/ConvLab | train | 0 |
22c1012dd26d74ed7889945b61c9fe4ac4da6235 | [
"if lists == []:\n return None\nn = len(lists)\np = lists[0]\ni = 0\nres = []\nwhile i < n:\n p = lists[i]\n while p != None:\n res.append(p.val)\n p = p.next\n i += 1\nres.sort()\nhead = ListNode(-1)\np = head\nfor i in res:\n p.next = ListNode(i)\n p = p.next\nreturn head.next",
... | <|body_start_0|>
if lists == []:
return None
n = len(lists)
p = lists[0]
i = 0
res = []
while i < n:
p = lists[i]
while p != None:
res.append(p.val)
p = p.next
i += 1
res.sort()
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKLists2(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if lists == []:
... | stack_v2_sparse_classes_36k_train_009819 | 1,879 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists2",
"signature": "def mergeKLists2(self, lists)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKLists2(self, lists): :type lists: List[ListNode] :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKLists2(self, lists): :type lists: List[ListNode] :rtype: ListNode
<|skeleton|>
class Solut... | beabfd31379f44ffd767fc676912db5022495b53 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKLists2(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
if lists == []:
return None
n = len(lists)
p = lists[0]
i = 0
res = []
while i < n:
p = lists[i]
while p != None:
... | the_stack_v2_python_sparse | leetCode/top50/023mergeKLists.py | fatezy/Algorithm | train | 1 | |
99414251a2973dca978cc8fcf7746bab074b8e6a | [
"installed = dpkg.installed()\ncython3 = ('cython3',)\nmissing = [pkg for pkg in cython3 if pkg not in installed]\nif not missing:\n yield (Cython3.flavor, cython3)\ncython2 = ('cython',)\nmissing = [pkg for pkg in cython2 if pkg not in installed]\nif not missing:\n yield (Cython2.flavor, cython2)\nreturn",
... | <|body_start_0|>
installed = dpkg.installed()
cython3 = ('cython3',)
missing = [pkg for pkg in cython3 if pkg not in installed]
if not missing:
yield (Cython3.flavor, cython3)
cython2 = ('cython',)
missing = [pkg for pkg in cython2 if pkg not in installed]
... | The package manager for the cython interpreter | Cython | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cython:
"""The package manager for the cython interpreter"""
def dpkgAlternatives(cls, dpkg):
"""Go through the installed packages and identify those that are relevant for providing support for my installations"""
<|body_0|>
def dpkgPackages(cls, packager):
"""Id... | stack_v2_sparse_classes_36k_train_009820 | 6,451 | permissive | [
{
"docstring": "Go through the installed packages and identify those that are relevant for providing support for my installations",
"name": "dpkgAlternatives",
"signature": "def dpkgAlternatives(cls, dpkg)"
},
{
"docstring": "Identify the default implementation of BLAS on dpkg machines",
"na... | 3 | null | Implement the Python class `Cython` described below.
Class description:
The package manager for the cython interpreter
Method signatures and docstrings:
- def dpkgAlternatives(cls, dpkg): Go through the installed packages and identify those that are relevant for providing support for my installations
- def dpkgPackag... | Implement the Python class `Cython` described below.
Class description:
The package manager for the cython interpreter
Method signatures and docstrings:
- def dpkgAlternatives(cls, dpkg): Go through the installed packages and identify those that are relevant for providing support for my installations
- def dpkgPackag... | d741c44ffb3e9e1f726bf492202ac8738bb4aa1c | <|skeleton|>
class Cython:
"""The package manager for the cython interpreter"""
def dpkgAlternatives(cls, dpkg):
"""Go through the installed packages and identify those that are relevant for providing support for my installations"""
<|body_0|>
def dpkgPackages(cls, packager):
"""Id... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cython:
"""The package manager for the cython interpreter"""
def dpkgAlternatives(cls, dpkg):
"""Go through the installed packages and identify those that are relevant for providing support for my installations"""
installed = dpkg.installed()
cython3 = ('cython3',)
missing... | the_stack_v2_python_sparse | packages/pyre/externals/Cython.py | pyre/pyre | train | 27 |
6008284ce3f73614a1a2bc5ec2f0e692476b8616 | [
"if not self.key.id():\n logging.error('Key id does not exist.')\n return None\nif self.size < 1:\n return None\nstring_id = self.key.string_id()\nlog_part_keys = [ndb.Key('QuickLog', string_id, 'QuickLogPart', i + 1) for i in xrange(self.size)]\nlog_parts = ndb.get_multi(log_part_keys)\nserialized = ''.jo... | <|body_start_0|>
if not self.key.id():
logging.error('Key id does not exist.')
return None
if self.size < 1:
return None
string_id = self.key.string_id()
log_part_keys = [ndb.Key('QuickLog', string_id, 'QuickLogPart', i + 1) for i in xrange(self.size)]... | Represents a log entity. | QuickLog | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuickLog:
"""Represents a log entity."""
def GetRecords(self):
"""Gets records store in multiple entities. Combines and deserializes the data stored in QuickLogPart for this log. Returns: List of Record object."""
<|body_0|>
def SetRecords(self, records):
"""Sets... | stack_v2_sparse_classes_36k_train_009821 | 8,298 | permissive | [
{
"docstring": "Gets records store in multiple entities. Combines and deserializes the data stored in QuickLogPart for this log. Returns: List of Record object.",
"name": "GetRecords",
"signature": "def GetRecords(self)"
},
{
"docstring": "Sets records for this log and put into datastore. Serial... | 2 | stack_v2_sparse_classes_30k_train_013123 | Implement the Python class `QuickLog` described below.
Class description:
Represents a log entity.
Method signatures and docstrings:
- def GetRecords(self): Gets records store in multiple entities. Combines and deserializes the data stored in QuickLogPart for this log. Returns: List of Record object.
- def SetRecords... | Implement the Python class `QuickLog` described below.
Class description:
Represents a log entity.
Method signatures and docstrings:
- def GetRecords(self): Gets records store in multiple entities. Combines and deserializes the data stored in QuickLogPart for this log. Returns: List of Record object.
- def SetRecords... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class QuickLog:
"""Represents a log entity."""
def GetRecords(self):
"""Gets records store in multiple entities. Combines and deserializes the data stored in QuickLogPart for this log. Returns: List of Record object."""
<|body_0|>
def SetRecords(self, records):
"""Sets... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuickLog:
"""Represents a log entity."""
def GetRecords(self):
"""Gets records store in multiple entities. Combines and deserializes the data stored in QuickLogPart for this log. Returns: List of Record object."""
if not self.key.id():
logging.error('Key id does not exist.')
... | the_stack_v2_python_sparse | third_party/catapult/dashboard/dashboard/quick_logger.py | metux/chromium-suckless | train | 5 |
d427e69955aec828ab2d5af1b70d9199edcb1b64 | [
"if self.image_gravatar:\n return conference.gravatar.gravatar(self.profile.user.email)\nelif self.image_url:\n return self.image_url\nelif self.profile.image:\n return self.profile.image.url\nreturn settings.STATIC_URL + settings.P3_ANONYMOUS_AVATAR",
"if self.profile.visibility != 'x':\n url = self.... | <|body_start_0|>
if self.image_gravatar:
return conference.gravatar.gravatar(self.profile.user.email)
elif self.image_url:
return self.image_url
elif self.profile.image:
return self.profile.image.url
return settings.STATIC_URL + settings.P3_ANONYMOUS_A... | P3Profile | [
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class P3Profile:
def profile_image_url(self):
"""Return the url of the image that the user has associated with his profile."""
<|body_0|>
def public_profile_image_url(self):
"""Like `profile_image_url` but takes into account the visibility rules of the profile."""
... | stack_v2_sparse_classes_36k_train_009822 | 5,965 | permissive | [
{
"docstring": "Return the url of the image that the user has associated with his profile.",
"name": "profile_image_url",
"signature": "def profile_image_url(self)"
},
{
"docstring": "Like `profile_image_url` but takes into account the visibility rules of the profile.",
"name": "public_profi... | 2 | stack_v2_sparse_classes_30k_train_019412 | Implement the Python class `P3Profile` described below.
Class description:
Implement the P3Profile class.
Method signatures and docstrings:
- def profile_image_url(self): Return the url of the image that the user has associated with his profile.
- def public_profile_image_url(self): Like `profile_image_url` but takes... | Implement the Python class `P3Profile` described below.
Class description:
Implement the P3Profile class.
Method signatures and docstrings:
- def profile_image_url(self): Return the url of the image that the user has associated with his profile.
- def public_profile_image_url(self): Like `profile_image_url` but takes... | 341c22649ff4ec858fc710821303cf3b78aa59e6 | <|skeleton|>
class P3Profile:
def profile_image_url(self):
"""Return the url of the image that the user has associated with his profile."""
<|body_0|>
def public_profile_image_url(self):
"""Like `profile_image_url` but takes into account the visibility rules of the profile."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class P3Profile:
def profile_image_url(self):
"""Return the url of the image that the user has associated with his profile."""
if self.image_gravatar:
return conference.gravatar.gravatar(self.profile.user.email)
elif self.image_url:
return self.image_url
elif ... | the_stack_v2_python_sparse | p3/models.py | EuroPython/epcon | train | 40 | |
df9230addbd0097411274bc0e5d943f5f8ae730d | [
"n = len(prices)\ndp = [[[0, 0] for _ in range(k + 1)] for _ in range(n)]\nif k == 0 or n == 0:\n return 0\nfor i in range(0, n):\n for j in range(0, k + 1):\n if i == 0:\n dp[i][j][0] = 0\n dp[i][j][1] = -prices[0]\n continue\n elif j == 0:\n dp[i][j]... | <|body_start_0|>
n = len(prices)
dp = [[[0, 0] for _ in range(k + 1)] for _ in range(n)]
if k == 0 or n == 0:
return 0
for i in range(0, n):
for j in range(0, k + 1):
if i == 0:
dp[i][j][0] = 0
dp[i][j][1] = ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, k: int, prices: List[int]) -> int:
"""限制卖出.超时"""
<|body_0|>
def maxProfit(self, k: int, prices: List[int]) -> int:
"""限制买入"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(prices)
dp = [[[0, 0] for _ in r... | stack_v2_sparse_classes_36k_train_009823 | 2,546 | no_license | [
{
"docstring": "限制卖出.超时",
"name": "maxProfit",
"signature": "def maxProfit(self, k: int, prices: List[int]) -> int"
},
{
"docstring": "限制买入",
"name": "maxProfit",
"signature": "def maxProfit(self, k: int, prices: List[int]) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, k: int, prices: List[int]) -> int: 限制卖出.超时
- def maxProfit(self, k: int, prices: List[int]) -> int: 限制买入 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, k: int, prices: List[int]) -> int: 限制卖出.超时
- def maxProfit(self, k: int, prices: List[int]) -> int: 限制买入
<|skeleton|>
class Solution:
def maxProfit(self... | cb3587242195bb3f2626231af2da13b90945a4d5 | <|skeleton|>
class Solution:
def maxProfit(self, k: int, prices: List[int]) -> int:
"""限制卖出.超时"""
<|body_0|>
def maxProfit(self, k: int, prices: List[int]) -> int:
"""限制买入"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, k: int, prices: List[int]) -> int:
"""限制卖出.超时"""
n = len(prices)
dp = [[[0, 0] for _ in range(k + 1)] for _ in range(n)]
if k == 0 or n == 0:
return 0
for i in range(0, n):
for j in range(0, k + 1):
i... | the_stack_v2_python_sparse | leetcode/py36/买卖股票的最佳时机(k笔交易)N188.py | lionheartStark/sword_towards_offer | train | 0 | |
582a483d5267069a52fb11eb078e0a5ff18cddaa | [
"index = 0\napi_url = 'http://proxy.httpdaili.com/apinew.asp?sl=10&noinfo=true&ddbh=302094241791519942'\nprint('获取本次的 http 代理IP')\nwhile True:\n now = Date.now().format()\n print('第: {} 次更新代理, time: {}'.format(index, now))\n try:\n loop = asyncio.get_event_loop()\n ips = requests.get(api_url,... | <|body_start_0|>
index = 0
api_url = 'http://proxy.httpdaili.com/apinew.asp?sl=10&noinfo=true&ddbh=302094241791519942'
print('获取本次的 http 代理IP')
while True:
now = Date.now().format()
print('第: {} 次更新代理, time: {}'.format(index, now))
try:
... | Cron | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cron:
def update_proxy_ip(self):
"""更新代理 :return:"""
<|body_0|>
def check_all_ip(self):
"""轮询检查所有的代理IP,剔除失效的IP :return:"""
<|body_1|>
async def _get_ip_result(self, proxy_ip):
"""异步测试IP是否可用 :param proxy_ip: :return:"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_009824 | 3,268 | permissive | [
{
"docstring": "更新代理 :return:",
"name": "update_proxy_ip",
"signature": "def update_proxy_ip(self)"
},
{
"docstring": "轮询检查所有的代理IP,剔除失效的IP :return:",
"name": "check_all_ip",
"signature": "def check_all_ip(self)"
},
{
"docstring": "异步测试IP是否可用 :param proxy_ip: :return:",
"name"... | 3 | null | Implement the Python class `Cron` described below.
Class description:
Implement the Cron class.
Method signatures and docstrings:
- def update_proxy_ip(self): 更新代理 :return:
- def check_all_ip(self): 轮询检查所有的代理IP,剔除失效的IP :return:
- async def _get_ip_result(self, proxy_ip): 异步测试IP是否可用 :param proxy_ip: :return: | Implement the Python class `Cron` described below.
Class description:
Implement the Cron class.
Method signatures and docstrings:
- def update_proxy_ip(self): 更新代理 :return:
- def check_all_ip(self): 轮询检查所有的代理IP,剔除失效的IP :return:
- async def _get_ip_result(self, proxy_ip): 异步测试IP是否可用 :param proxy_ip: :return:
<|skelet... | 29ba13905c73081097df9ef646a5c8194eb024be | <|skeleton|>
class Cron:
def update_proxy_ip(self):
"""更新代理 :return:"""
<|body_0|>
def check_all_ip(self):
"""轮询检查所有的代理IP,剔除失效的IP :return:"""
<|body_1|>
async def _get_ip_result(self, proxy_ip):
"""异步测试IP是否可用 :param proxy_ip: :return:"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cron:
def update_proxy_ip(self):
"""更新代理 :return:"""
index = 0
api_url = 'http://proxy.httpdaili.com/apinew.asp?sl=10&noinfo=true&ddbh=302094241791519942'
print('获取本次的 http 代理IP')
while True:
now = Date.now().format()
print('第: {} 次更新代理, time: {}... | the_stack_v2_python_sparse | projects/ip_proxy/cron.py | UoToGK/crawler-pyspider | train | 0 | |
2118b8a15c3323094bff2c346d735801031ad7ef | [
"diff = [float('inf')]\n\ndef dfs(root):\n \"\"\"\n :ret: min, max\n \"\"\"\n if not root:\n return\n lsmall = llarge = rsmall = rlarge = None\n if root.left:\n lsmall, llarge = dfs(root.left)\n diff[0] = min(diff[0], root.val - llarge.val)\n if root.right:\... | <|body_start_0|>
diff = [float('inf')]
def dfs(root):
"""
:ret: min, max
"""
if not root:
return
lsmall = llarge = rsmall = rlarge = None
if root.left:
lsmall, llarge = dfs(root.left)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDiffInBST(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def rewrite(self, root):
""":type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d... | stack_v2_sparse_classes_36k_train_009825 | 2,714 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDiffInBST",
"signature": "def minDiffInBST(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop",
"name": "rewrite",
"signature": "def rewrite(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005935 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDiffInBST(self, root): :type root: TreeNode :rtype: int
- def rewrite(self, root): :type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDiffInBST(self, root): :type root: TreeNode :rtype: int
- def rewrite(self, root): :type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop
<|ske... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def minDiffInBST(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def rewrite(self, root):
""":type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minDiffInBST(self, root):
""":type root: TreeNode :rtype: int"""
diff = [float('inf')]
def dfs(root):
"""
:ret: min, max
"""
if not root:
return
lsmall = llarge = rsmall = rlarge ... | the_stack_v2_python_sparse | co_google/783_Minimum_Distance_Between_BST_Nodes.py | vsdrun/lc_public | train | 6 | |
b6bd26d3af31efc4a6c6f0b788f8141bb530cfad | [
"super(BuildingExtended, self).__init__(environment)\nself.build_year = build_year\nself.mod_year = mod_year\nself.build_type = build_type\nself.roof_usabl_pv_area = roof_usabl_pv_area\nself.net_floor_area = net_floor_area\nself.ground_area = ground_area\nself.height_of_floors = height_of_floors\nself.nb_of_floors ... | <|body_start_0|>
super(BuildingExtended, self).__init__(environment)
self.build_year = build_year
self.mod_year = mod_year
self.build_type = build_type
self.roof_usabl_pv_area = roof_usabl_pv_area
self.net_floor_area = net_floor_area
self.ground_area = ground_area... | BuildingExtended class (inheritance from building class of pycity) | BuildingExtended | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuildingExtended:
"""BuildingExtended class (inheritance from building class of pycity)"""
def __init__(self, environment, build_year=None, mod_year=None, build_type=None, roof_usabl_pv_area=None, net_floor_area=None, ground_area=None, height_of_floors=None, nb_of_floors=None, neighbour_buil... | stack_v2_sparse_classes_36k_train_009826 | 7,490 | permissive | [
{
"docstring": "Constructor of extended building. Inheritance from PyCity Building object. Parameters ---------- environment : Environment object Environment object of PyCity build_year : int, optional Year of construction of building (default: None) mod_year : int, optional Last year of modernization / retrofi... | 5 | stack_v2_sparse_classes_30k_train_005592 | Implement the Python class `BuildingExtended` described below.
Class description:
BuildingExtended class (inheritance from building class of pycity)
Method signatures and docstrings:
- def __init__(self, environment, build_year=None, mod_year=None, build_type=None, roof_usabl_pv_area=None, net_floor_area=None, ground... | Implement the Python class `BuildingExtended` described below.
Class description:
BuildingExtended class (inheritance from building class of pycity)
Method signatures and docstrings:
- def __init__(self, environment, build_year=None, mod_year=None, build_type=None, roof_usabl_pv_area=None, net_floor_area=None, ground... | 99fd0dab7f9a9030fd84ba4715753364662927ec | <|skeleton|>
class BuildingExtended:
"""BuildingExtended class (inheritance from building class of pycity)"""
def __init__(self, environment, build_year=None, mod_year=None, build_type=None, roof_usabl_pv_area=None, net_floor_area=None, ground_area=None, height_of_floors=None, nb_of_floors=None, neighbour_buil... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BuildingExtended:
"""BuildingExtended class (inheritance from building class of pycity)"""
def __init__(self, environment, build_year=None, mod_year=None, build_type=None, roof_usabl_pv_area=None, net_floor_area=None, ground_area=None, height_of_floors=None, nb_of_floors=None, neighbour_buildings=None, r... | the_stack_v2_python_sparse | pycity_calc/buildings/building.py | RWTH-EBC/pyCity_calc | train | 4 |
f4f3ada236e5eb73465400675331d25d07da3ef4 | [
"mocked_clue = Mock()\nexpected_data = self.SENSOR_DATA\ntype(mocked_clue).temperature = PropertyMock(side_effect=self.SENSOR_DATA)\nsource = TemperaturePlotSource(mocked_clue, mode='Celsius')\nfor expected_value in expected_data:\n self.assertAlmostEqual(source.data(), expected_value, msg='Checking converted te... | <|body_start_0|>
mocked_clue = Mock()
expected_data = self.SENSOR_DATA
type(mocked_clue).temperature = PropertyMock(side_effect=self.SENSOR_DATA)
source = TemperaturePlotSource(mocked_clue, mode='Celsius')
for expected_value in expected_data:
self.assertAlmostEqual(so... | Test_TemperaturePlotSource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_TemperaturePlotSource:
def test_celsius(self):
"""Create the source in Celsius mode and test with some values."""
<|body_0|>
def test_fahrenheit(self):
"""Create the source in Fahrenheit mode and test with some values."""
<|body_1|>
def test_kelvin(... | stack_v2_sparse_classes_36k_train_009827 | 4,778 | permissive | [
{
"docstring": "Create the source in Celsius mode and test with some values.",
"name": "test_celsius",
"signature": "def test_celsius(self)"
},
{
"docstring": "Create the source in Fahrenheit mode and test with some values.",
"name": "test_fahrenheit",
"signature": "def test_fahrenheit(s... | 3 | null | Implement the Python class `Test_TemperaturePlotSource` described below.
Class description:
Implement the Test_TemperaturePlotSource class.
Method signatures and docstrings:
- def test_celsius(self): Create the source in Celsius mode and test with some values.
- def test_fahrenheit(self): Create the source in Fahrenh... | Implement the Python class `Test_TemperaturePlotSource` described below.
Class description:
Implement the Test_TemperaturePlotSource class.
Method signatures and docstrings:
- def test_celsius(self): Create the source in Celsius mode and test with some values.
- def test_fahrenheit(self): Create the source in Fahrenh... | 5eaa7a15a437c533b89f359a25983e24bb6b5438 | <|skeleton|>
class Test_TemperaturePlotSource:
def test_celsius(self):
"""Create the source in Celsius mode and test with some values."""
<|body_0|>
def test_fahrenheit(self):
"""Create the source in Fahrenheit mode and test with some values."""
<|body_1|>
def test_kelvin(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_TemperaturePlotSource:
def test_celsius(self):
"""Create the source in Celsius mode and test with some values."""
mocked_clue = Mock()
expected_data = self.SENSOR_DATA
type(mocked_clue).temperature = PropertyMock(side_effect=self.SENSOR_DATA)
source = TemperaturePl... | the_stack_v2_python_sparse | CLUE_Sensor_Plotter/test_PlotSource.py | adafruit/Adafruit_Learning_System_Guides | train | 937 | |
8b5d0ca0a7477d4276a9e2a8f4437c1a3b48147a | [
"logger.debug('Collecting notification methods')\ncurrent_method = InvenTree.helpers.inheritors(NotificationMethod) - IGNORED_NOTIFICATION_CLS\nif selected_classes:\n current_method = [item for item in current_method if item is selected_classes]\nfiltered_list = {}\nfor item in current_method:\n plugin = item... | <|body_start_0|>
logger.debug('Collecting notification methods')
current_method = InvenTree.helpers.inheritors(NotificationMethod) - IGNORED_NOTIFICATION_CLS
if selected_classes:
current_method = [item for item in current_method if item is selected_classes]
filtered_list = {}... | Class that works as registry for all available notification methods in InvenTree. Is initialized on startup as one instance named `storage` in this file. | MethodStorageClass | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MethodStorageClass:
"""Class that works as registry for all available notification methods in InvenTree. Is initialized on startup as one instance named `storage` in this file."""
def collect(self, selected_classes=None):
"""Collect all classes in the environment that are notificatio... | stack_v2_sparse_classes_36k_train_009828 | 15,961 | permissive | [
{
"docstring": "Collect all classes in the environment that are notification methods. Can be filtered to only include provided classes for testing. Args: selected_classes (class, optional): References to the classes that should be registered. Defaults to None.",
"name": "collect",
"signature": "def coll... | 2 | null | Implement the Python class `MethodStorageClass` described below.
Class description:
Class that works as registry for all available notification methods in InvenTree. Is initialized on startup as one instance named `storage` in this file.
Method signatures and docstrings:
- def collect(self, selected_classes=None): Co... | Implement the Python class `MethodStorageClass` described below.
Class description:
Class that works as registry for all available notification methods in InvenTree. Is initialized on startup as one instance named `storage` in this file.
Method signatures and docstrings:
- def collect(self, selected_classes=None): Co... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class MethodStorageClass:
"""Class that works as registry for all available notification methods in InvenTree. Is initialized on startup as one instance named `storage` in this file."""
def collect(self, selected_classes=None):
"""Collect all classes in the environment that are notificatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MethodStorageClass:
"""Class that works as registry for all available notification methods in InvenTree. Is initialized on startup as one instance named `storage` in this file."""
def collect(self, selected_classes=None):
"""Collect all classes in the environment that are notification methods. Ca... | the_stack_v2_python_sparse | InvenTree/common/notifications.py | inventree/InvenTree | train | 3,077 |
b12c4fec724827096d917fc23ba79de3a120f881 | [
"driver = self.driver\ndriver.get(self.base_url)\nhomepage = HomePage(self.driver)\nhomepage.click_oa()\nhomepage.sleep(0.5)\nhomepage.click_yygl()\nhomepage.click_ycgl()\nhomepage.sleep(0.1)\nhomepage.click_yzyc()\nhomepage.switch_frame(driver.find_element_by_xpath(\"//iframe[@src='http://oa2.eascs.com/eaoa/discre... | <|body_start_0|>
driver = self.driver
driver.get(self.base_url)
homepage = HomePage(self.driver)
homepage.click_oa()
homepage.sleep(0.5)
homepage.click_yygl()
homepage.click_ycgl()
homepage.sleep(0.1)
homepage.click_yzyc()
homepage.switch_f... | 异常管理 | Start | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Start:
"""异常管理"""
def test1_yzyc(self):
"""运作异常"""
<|body_0|>
def test2_ycpcfy(self):
"""异常赔偿费用"""
<|body_1|>
def test3_yskkcyc(self):
"""应收款库存异常"""
<|body_2|>
def test4_hqzycx(self):
"""货权转移查询"""
<|body_3|>
<|en... | stack_v2_sparse_classes_36k_train_009829 | 3,704 | no_license | [
{
"docstring": "运作异常",
"name": "test1_yzyc",
"signature": "def test1_yzyc(self)"
},
{
"docstring": "异常赔偿费用",
"name": "test2_ycpcfy",
"signature": "def test2_ycpcfy(self)"
},
{
"docstring": "应收款库存异常",
"name": "test3_yskkcyc",
"signature": "def test3_yskkcyc(self)"
},
{... | 4 | stack_v2_sparse_classes_30k_train_010249 | Implement the Python class `Start` described below.
Class description:
异常管理
Method signatures and docstrings:
- def test1_yzyc(self): 运作异常
- def test2_ycpcfy(self): 异常赔偿费用
- def test3_yskkcyc(self): 应收款库存异常
- def test4_hqzycx(self): 货权转移查询 | Implement the Python class `Start` described below.
Class description:
异常管理
Method signatures and docstrings:
- def test1_yzyc(self): 运作异常
- def test2_ycpcfy(self): 异常赔偿费用
- def test3_yskkcyc(self): 应收款库存异常
- def test4_hqzycx(self): 货权转移查询
<|skeleton|>
class Start:
"""异常管理"""
def test1_yzyc(self):
"... | a90695147681163d45d4951f6a921eda816500bb | <|skeleton|>
class Start:
"""异常管理"""
def test1_yzyc(self):
"""运作异常"""
<|body_0|>
def test2_ycpcfy(self):
"""异常赔偿费用"""
<|body_1|>
def test3_yskkcyc(self):
"""应收款库存异常"""
<|body_2|>
def test4_hqzycx(self):
"""货权转移查询"""
<|body_3|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Start:
"""异常管理"""
def test1_yzyc(self):
"""运作异常"""
driver = self.driver
driver.get(self.base_url)
homepage = HomePage(self.driver)
homepage.click_oa()
homepage.sleep(0.5)
homepage.click_yygl()
homepage.click_ycgl()
homepage.sleep(0.1... | the_stack_v2_python_sparse | oa_test_case/oa_ycgl.py | shengli520/yyt | train | 0 |
7846e4d56b84612fab543dee7e37b53a6d93f668 | [
"super(CoarseFineFlownet, self).__init__()\nin_c = channel * 2\nconv1 = nn.Sequential(nn.Conv2d(in_c, 24, 5, 2, 2), nn.ReLU(True))\nconv2 = nn.Sequential(nn.Conv2d(24, 24, 3, 1, 1), nn.ReLU(True))\nconv3 = nn.Sequential(nn.Conv2d(24, 24, 5, 2, 2), nn.ReLU(True))\nconv4 = nn.Sequential(nn.Conv2d(24, 24, 3, 1, 1), nn... | <|body_start_0|>
super(CoarseFineFlownet, self).__init__()
in_c = channel * 2
conv1 = nn.Sequential(nn.Conv2d(in_c, 24, 5, 2, 2), nn.ReLU(True))
conv2 = nn.Sequential(nn.Conv2d(24, 24, 3, 1, 1), nn.ReLU(True))
conv3 = nn.Sequential(nn.Conv2d(24, 24, 5, 2, 2), nn.ReLU(True))
... | CoarseFineFlownet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoarseFineFlownet:
def __init__(self, channel):
"""Coarse to fine flow estimation network Originally from paper "Real-Time Video Super-Resolution with Spatio-Temporal Networks and Motion Compensation". See Vespcn.py"""
<|body_0|>
def forward(self, target, ref, gain=1):
... | stack_v2_sparse_classes_36k_train_009830 | 8,450 | permissive | [
{
"docstring": "Coarse to fine flow estimation network Originally from paper \"Real-Time Video Super-Resolution with Spatio-Temporal Networks and Motion Compensation\". See Vespcn.py",
"name": "__init__",
"signature": "def __init__(self, channel)"
},
{
"docstring": "Estimate optical flow from `r... | 2 | stack_v2_sparse_classes_30k_train_009220 | Implement the Python class `CoarseFineFlownet` described below.
Class description:
Implement the CoarseFineFlownet class.
Method signatures and docstrings:
- def __init__(self, channel): Coarse to fine flow estimation network Originally from paper "Real-Time Video Super-Resolution with Spatio-Temporal Networks and Mo... | Implement the Python class `CoarseFineFlownet` described below.
Class description:
Implement the CoarseFineFlownet class.
Method signatures and docstrings:
- def __init__(self, channel): Coarse to fine flow estimation network Originally from paper "Real-Time Video Super-Resolution with Spatio-Temporal Networks and Mo... | 3c0b478179f772d7fe7521655008a2d79a6b6185 | <|skeleton|>
class CoarseFineFlownet:
def __init__(self, channel):
"""Coarse to fine flow estimation network Originally from paper "Real-Time Video Super-Resolution with Spatio-Temporal Networks and Motion Compensation". See Vespcn.py"""
<|body_0|>
def forward(self, target, ref, gain=1):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoarseFineFlownet:
def __init__(self, channel):
"""Coarse to fine flow estimation network Originally from paper "Real-Time Video Super-Resolution with Spatio-Temporal Networks and Motion Compensation". See Vespcn.py"""
super(CoarseFineFlownet, self).__init__()
in_c = channel * 2
... | the_stack_v2_python_sparse | codes/utils/motion.py | riverlight/egvsr | train | 2 | |
83703b1bf31e98ee1002d519c2c3070eb320f0f5 | [
"params = dict()\nparams['applicationguid'] = applicationguid\nreturn q.workflowengine.actionmanager.startActorAction('smartclientbootservice', 'initialize', params, jobguid=jobguid, executionparams=executionparams)",
"params = dict()\nparams['smartclientguid'] = smartclientguid\nreturn q.workflowengine.actionman... | <|body_start_0|>
params = dict()
params['applicationguid'] = applicationguid
return q.workflowengine.actionmanager.startActorAction('smartclientbootservice', 'initialize', params, jobguid=jobguid, executionparams=executionparams)
<|end_body_0|>
<|body_start_1|>
params = dict()
p... | smartclientbootservice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class smartclientbootservice:
def initialize(self, applicationguid='', jobguid='', executionparams={}):
"""initialize the smartclientbootservice, can do this as many times as required FLOW #if applicationguid=="": in drp create cloudservice "smartclientbootservice" from template #check if ther... | stack_v2_sparse_classes_36k_train_009831 | 3,143 | no_license | [
{
"docstring": "initialize the smartclientbootservice, can do this as many times as required FLOW #if applicationguid==\"\": in drp create cloudservice \"smartclientbootservice\" from template #check if there is already DHCP server ##if no dhcpserver yet: create application rootobject dhcpserver in DRP (from te... | 2 | null | Implement the Python class `smartclientbootservice` described below.
Class description:
Implement the smartclientbootservice class.
Method signatures and docstrings:
- def initialize(self, applicationguid='', jobguid='', executionparams={}): initialize the smartclientbootservice, can do this as many times as required... | Implement the Python class `smartclientbootservice` described below.
Class description:
Implement the smartclientbootservice class.
Method signatures and docstrings:
- def initialize(self, applicationguid='', jobguid='', executionparams={}): initialize the smartclientbootservice, can do this as many times as required... | 53d349fa6bee0ccead29afd6676979b44c109a61 | <|skeleton|>
class smartclientbootservice:
def initialize(self, applicationguid='', jobguid='', executionparams={}):
"""initialize the smartclientbootservice, can do this as many times as required FLOW #if applicationguid=="": in drp create cloudservice "smartclientbootservice" from template #check if ther... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class smartclientbootservice:
def initialize(self, applicationguid='', jobguid='', executionparams={}):
"""initialize the smartclientbootservice, can do this as many times as required FLOW #if applicationguid=="": in drp create cloudservice "smartclientbootservice" from template #check if there is already D... | the_stack_v2_python_sparse | apps/cloud_api_generator/actor/smartclientbootservice.py | racktivity/ext-pylabs-core | train | 0 | |
81e7589147ca05d8555807ac4a30b63da25b4e54 | [
"super(HardTripletLoss, self).__init__()\nself.margin = margin\nself.hardest = hardest\nself.squared = squared",
"pairwise_dist = _pairwise_distance(embeddings, squared=self.squared)\nif self.hardest:\n mask_anchor_positive = _get_anchor_positive_triplet_mask(labels).float()\n valid_positive_dist = pairwise... | <|body_start_0|>
super(HardTripletLoss, self).__init__()
self.margin = margin
self.hardest = hardest
self.squared = squared
<|end_body_0|>
<|body_start_1|>
pairwise_dist = _pairwise_distance(embeddings, squared=self.squared)
if self.hardest:
mask_anchor_posit... | Hard/Hardest Triplet Loss (pytorch implementation of https://omoindrot.github.io/triplet-loss) For each anchor, we get the hardest positive and hardest negative to form a triplet. | HardTripletLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HardTripletLoss:
"""Hard/Hardest Triplet Loss (pytorch implementation of https://omoindrot.github.io/triplet-loss) For each anchor, we get the hardest positive and hardest negative to form a triplet."""
def __init__(self, margin=0.1, hardest=False, squared=False):
"""Args: margin: ma... | stack_v2_sparse_classes_36k_train_009832 | 10,959 | no_license | [
{
"docstring": "Args: margin: margin for triplet loss hardest: If true, loss is considered only hardest triplets. squared: If true, output is the pairwise squared euclidean distance matrix. If false, output is the pairwise euclidean distance matrix.",
"name": "__init__",
"signature": "def __init__(self,... | 2 | stack_v2_sparse_classes_30k_train_010059 | Implement the Python class `HardTripletLoss` described below.
Class description:
Hard/Hardest Triplet Loss (pytorch implementation of https://omoindrot.github.io/triplet-loss) For each anchor, we get the hardest positive and hardest negative to form a triplet.
Method signatures and docstrings:
- def __init__(self, ma... | Implement the Python class `HardTripletLoss` described below.
Class description:
Hard/Hardest Triplet Loss (pytorch implementation of https://omoindrot.github.io/triplet-loss) For each anchor, we get the hardest positive and hardest negative to form a triplet.
Method signatures and docstrings:
- def __init__(self, ma... | 75f25b4959e702c10efa7ed0b50f0f0f78f972e3 | <|skeleton|>
class HardTripletLoss:
"""Hard/Hardest Triplet Loss (pytorch implementation of https://omoindrot.github.io/triplet-loss) For each anchor, we get the hardest positive and hardest negative to form a triplet."""
def __init__(self, margin=0.1, hardest=False, squared=False):
"""Args: margin: ma... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HardTripletLoss:
"""Hard/Hardest Triplet Loss (pytorch implementation of https://omoindrot.github.io/triplet-loss) For each anchor, we get the hardest positive and hardest negative to form a triplet."""
def __init__(self, margin=0.1, hardest=False, squared=False):
"""Args: margin: margin for trip... | the_stack_v2_python_sparse | Courses/Deep Learning/3/hard_triplet_loss.py | ed18s007/MiRL | train | 0 |
86db4818ef9479e48d34659300a17cd3707f2705 | [
"super().__init__()\nself._pad = (kernel_size - 1) * dilation\nself.causal_conv1d = torch.nn.Conv1d(idim, odim, kernel_size=kernel_size, stride=stride, padding=self._pad, dilation=dilation, groups=groups, bias=bias)",
"x = x.permute(0, 2, 1)\nx = self.causal_conv1d(x)\nif self._pad != 0:\n x = x[:, :, :-self._... | <|body_start_0|>
super().__init__()
self._pad = (kernel_size - 1) * dilation
self.causal_conv1d = torch.nn.Conv1d(idim, odim, kernel_size=kernel_size, stride=stride, padding=self._pad, dilation=dilation, groups=groups, bias=bias)
<|end_body_0|>
<|body_start_1|>
x = x.permute(0, 2, 1)
... | CausalConv1d module for transformer decoder. Args: idim (int): dimension of inputs odim (int): dimension of outputs kernel_size (int): size of convolving kernel stride (int): stride of the convolution dilation (int): spacing between the kernel points groups (int): number of blocked connections from ichannels to ochanne... | CausalConv1d | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CausalConv1d:
"""CausalConv1d module for transformer decoder. Args: idim (int): dimension of inputs odim (int): dimension of outputs kernel_size (int): size of convolving kernel stride (int): stride of the convolution dilation (int): spacing between the kernel points groups (int): number of block... | stack_v2_sparse_classes_36k_train_009833 | 1,614 | permissive | [
{
"docstring": "Construct a CausalConv1d object.",
"name": "__init__",
"signature": "def __init__(self, idim, odim, kernel_size, stride=1, dilation=1, groups=1, bias=True)"
},
{
"docstring": "CausalConv1d forward for x. Args: x (torch.Tensor): input torch (B, U, idim) x_mask (torch.Tensor): (B, ... | 2 | stack_v2_sparse_classes_30k_train_003837 | Implement the Python class `CausalConv1d` described below.
Class description:
CausalConv1d module for transformer decoder. Args: idim (int): dimension of inputs odim (int): dimension of outputs kernel_size (int): size of convolving kernel stride (int): stride of the convolution dilation (int): spacing between the kern... | Implement the Python class `CausalConv1d` described below.
Class description:
CausalConv1d module for transformer decoder. Args: idim (int): dimension of inputs odim (int): dimension of outputs kernel_size (int): size of convolving kernel stride (int): stride of the convolution dilation (int): spacing between the kern... | 6ecde88045e1b706b2390f98eb1950ce4075a07d | <|skeleton|>
class CausalConv1d:
"""CausalConv1d module for transformer decoder. Args: idim (int): dimension of inputs odim (int): dimension of outputs kernel_size (int): size of convolving kernel stride (int): stride of the convolution dilation (int): spacing between the kernel points groups (int): number of block... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CausalConv1d:
"""CausalConv1d module for transformer decoder. Args: idim (int): dimension of inputs odim (int): dimension of outputs kernel_size (int): size of convolving kernel stride (int): stride of the convolution dilation (int): spacing between the kernel points groups (int): number of blocked connection... | the_stack_v2_python_sparse | espnet/nets/pytorch_backend/transducer/causal_conv1d.py | sw005320/espnet-1 | train | 4 |
7188f4eb39c5c7021e91919d10da159d2f547c47 | [
"kw = super(StoryTaskView, self).get_form_kwargs()\nkw.update({'organization': self.request.user.organization})\nreturn kw",
"context = super(StoryTaskView, self).get_context_data(**kwargs)\nstory = get_object_or_404(Story, id=self.kwargs['pk'])\ntasks = story.task_set.all()\ncount = tasks.count()\nidentified_ct ... | <|body_start_0|>
kw = super(StoryTaskView, self).get_form_kwargs()
kw.update({'organization': self.request.user.organization})
return kw
<|end_body_0|>
<|body_start_1|>
context = super(StoryTaskView, self).get_context_data(**kwargs)
story = get_object_or_404(Story, id=self.kwarg... | Create a story task. | StoryTaskView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StoryTaskView:
"""Create a story task."""
def get_form_kwargs(self):
"""Pass organization to form."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Return tasks belonging to the story."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
kw = s... | stack_v2_sparse_classes_36k_train_009834 | 11,257 | permissive | [
{
"docstring": "Pass organization to form.",
"name": "get_form_kwargs",
"signature": "def get_form_kwargs(self)"
},
{
"docstring": "Return tasks belonging to the story.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000137 | Implement the Python class `StoryTaskView` described below.
Class description:
Create a story task.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass organization to form.
- def get_context_data(self, **kwargs): Return tasks belonging to the story. | Implement the Python class `StoryTaskView` described below.
Class description:
Create a story task.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass organization to form.
- def get_context_data(self, **kwargs): Return tasks belonging to the story.
<|skeleton|>
class StoryTaskView:
"""Create a ... | dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9 | <|skeleton|>
class StoryTaskView:
"""Create a story task."""
def get_form_kwargs(self):
"""Pass organization to form."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Return tasks belonging to the story."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StoryTaskView:
"""Create a story task."""
def get_form_kwargs(self):
"""Pass organization to form."""
kw = super(StoryTaskView, self).get_form_kwargs()
kw.update({'organization': self.request.user.organization})
return kw
def get_context_data(self, **kwargs):
... | the_stack_v2_python_sparse | project/editorial/views/tasks.py | ProjectFacet/facet | train | 25 |
385d55e83946f3cb1b06c1927a9ba0cf26873749 | [
"self._registry_url = registry_url\nself.catalog = None\nself.tags = {}\nself.manifests = []\nself._load_info()",
"catalog_url = self._registry_url + '/_catalog'\ntags_info = '/tags/list'\nc = request_url(catalog_url)\nif c:\n self.catalog = json.load(c)['repositories']\nelse:\n raise Exception('Could not g... | <|body_start_0|>
self._registry_url = registry_url
self.catalog = None
self.tags = {}
self.manifests = []
self._load_info()
<|end_body_0|>
<|body_start_1|>
catalog_url = self._registry_url + '/_catalog'
tags_info = '/tags/list'
c = request_url(catalog_url... | Stores/Caches metadata from specified registry | RegistryInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistryInfo:
"""Stores/Caches metadata from specified registry"""
def __init__(self, registry_url):
"""Initialize the info object :param registry_url: The URL of registry"""
<|body_0|>
def _load_info(self):
"""Loads the information about the registry to refer la... | stack_v2_sparse_classes_36k_train_009835 | 3,045 | no_license | [
{
"docstring": "Initialize the info object :param registry_url: The URL of registry",
"name": "__init__",
"signature": "def __init__(self, registry_url)"
},
{
"docstring": "Loads the information about the registry to refer later.",
"name": "_load_info",
"signature": "def _load_info(self)... | 2 | stack_v2_sparse_classes_30k_train_001613 | Implement the Python class `RegistryInfo` described below.
Class description:
Stores/Caches metadata from specified registry
Method signatures and docstrings:
- def __init__(self, registry_url): Initialize the info object :param registry_url: The URL of registry
- def _load_info(self): Loads the information about the... | Implement the Python class `RegistryInfo` described below.
Class description:
Stores/Caches metadata from specified registry
Method signatures and docstrings:
- def __init__(self, registry_url): Initialize the info object :param registry_url: The URL of registry
- def _load_info(self): Loads the information about the... | 4b59184c3453ae706d5e352306fe9e551c90dc41 | <|skeleton|>
class RegistryInfo:
"""Stores/Caches metadata from specified registry"""
def __init__(self, registry_url):
"""Initialize the info object :param registry_url: The URL of registry"""
<|body_0|>
def _load_info(self):
"""Loads the information about the registry to refer la... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegistryInfo:
"""Stores/Caches metadata from specified registry"""
def __init__(self, registry_url):
"""Initialize the info object :param registry_url: The URL of registry"""
self._registry_url = registry_url
self.catalog = None
self.tags = {}
self.manifests = []
... | the_stack_v2_python_sparse | container_pipeline/cleanup_registry/lib.py | eupraxialabs/container-pipeline-service | train | 0 |
28c0519ee75d7c79e482660ab3375e05d32d7c21 | [
"relations = VipPermission.objects.filter(vip_id=self.id)\nperm_id_list = [r.perm_id for r in relations]\nreturn Permission.objects.filter(id__in=perm_id_list)",
"try:\n perm = Permission.get(name=perm_name)\nexcept Permission.DoesNotExist:\n return False\nelse:\n return VipPermission.objects.filter(vip_... | <|body_start_0|>
relations = VipPermission.objects.filter(vip_id=self.id)
perm_id_list = [r.perm_id for r in relations]
return Permission.objects.filter(id__in=perm_id_list)
<|end_body_0|>
<|body_start_1|>
try:
perm = Permission.get(name=perm_name)
except Permission.... | Vip | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vip:
def permission(self):
"""当前vip具有的所有权限"""
<|body_0|>
def has_perm(self, perm_name):
"""检查该等级vip是否具有某权限"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
relations = VipPermission.objects.filter(vip_id=self.id)
perm_id_list = [r.perm_id for... | stack_v2_sparse_classes_36k_train_009836 | 1,410 | no_license | [
{
"docstring": "当前vip具有的所有权限",
"name": "permission",
"signature": "def permission(self)"
},
{
"docstring": "检查该等级vip是否具有某权限",
"name": "has_perm",
"signature": "def has_perm(self, perm_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005398 | Implement the Python class `Vip` described below.
Class description:
Implement the Vip class.
Method signatures and docstrings:
- def permission(self): 当前vip具有的所有权限
- def has_perm(self, perm_name): 检查该等级vip是否具有某权限 | Implement the Python class `Vip` described below.
Class description:
Implement the Vip class.
Method signatures and docstrings:
- def permission(self): 当前vip具有的所有权限
- def has_perm(self, perm_name): 检查该等级vip是否具有某权限
<|skeleton|>
class Vip:
def permission(self):
"""当前vip具有的所有权限"""
<|body_0|>
d... | 8fc2f597fad912ef0bb10bed440a337e0b7b4625 | <|skeleton|>
class Vip:
def permission(self):
"""当前vip具有的所有权限"""
<|body_0|>
def has_perm(self, perm_name):
"""检查该等级vip是否具有某权限"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vip:
def permission(self):
"""当前vip具有的所有权限"""
relations = VipPermission.objects.filter(vip_id=self.id)
perm_id_list = [r.perm_id for r in relations]
return Permission.objects.filter(id__in=perm_id_list)
def has_perm(self, perm_name):
"""检查该等级vip是否具有某权限"""
t... | the_stack_v2_python_sparse | fuck/vip/models.py | Luciano0000/social | train | 3 | |
edd6b334aac85712c579950dafd6f34310957524 | [
"self.propList = ['conductivity', 'enthalpy', 'radiationLoss', 'viscosity']\nself.propKeys = dict(zip(self.propList, ['CND', 'HK', 'SSUBR', 'VIS']))\nself.conversionFactors = dict(zip(self.propList, [100000.0, 2.39e-07, 10000000.0, 10]))\nself.fileExtensions = dict(zip(self.propList, ['.K', '.H', '.R', '.V']))\nsel... | <|body_start_0|>
self.propList = ['conductivity', 'enthalpy', 'radiationLoss', 'viscosity']
self.propKeys = dict(zip(self.propList, ['CND', 'HK', 'SSUBR', 'VIS']))
self.conversionFactors = dict(zip(self.propList, [100000.0, 2.39e-07, 10000000.0, 10]))
self.fileExtensions = dict(zip(self.... | generate a text file containing a FORTRAN data statement suitable for use as properties with LAVA | lavaPropertyGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class lavaPropertyGenerator:
"""generate a text file containing a FORTRAN data statement suitable for use as properties with LAVA"""
def __init__(self):
"""define temperatures at which to evaluate props, plus some strings we'll need to write the files properly"""
<|body_0|>
de... | stack_v2_sparse_classes_36k_train_009837 | 6,576 | no_license | [
{
"docstring": "define temperatures at which to evaluate props, plus some strings we'll need to write the files properly",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "propArr - 2xN array, propArr[0] specifies temperatures, propArr[1] the value of the property prop - ... | 4 | null | Implement the Python class `lavaPropertyGenerator` described below.
Class description:
generate a text file containing a FORTRAN data statement suitable for use as properties with LAVA
Method signatures and docstrings:
- def __init__(self): define temperatures at which to evaluate props, plus some strings we'll need ... | Implement the Python class `lavaPropertyGenerator` described below.
Class description:
generate a text file containing a FORTRAN data statement suitable for use as properties with LAVA
Method signatures and docstrings:
- def __init__(self): define temperatures at which to evaluate props, plus some strings we'll need ... | 1886f25add30570eb3c3b3d40342de5e2d83d344 | <|skeleton|>
class lavaPropertyGenerator:
"""generate a text file containing a FORTRAN data statement suitable for use as properties with LAVA"""
def __init__(self):
"""define temperatures at which to evaluate props, plus some strings we'll need to write the files properly"""
<|body_0|>
de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class lavaPropertyGenerator:
"""generate a text file containing a FORTRAN data statement suitable for use as properties with LAVA"""
def __init__(self):
"""define temperatures at which to evaluate props, plus some strings we'll need to write the files properly"""
self.propList = ['conductivity'... | the_stack_v2_python_sparse | junk/LAVA/lavaHelpers.py | mcannamela/mike-cs-code | train | 0 |
95876cbb93bd6adb05e056aedbb3140bdd03aac5 | [
"self.radius = radius\nself.x = x_center\nself.y = y_center",
"while True:\n x = random.uniform(-1.0, 1.0)\n y = random.uniform(-1.0, 1.0)\n if x ** 2 + y ** 2 <= 1:\n break\nx = self.x + x * self.radius\ny = self.y + y * self.radius\nreturn [x, y]"
] | <|body_start_0|>
self.radius = radius
self.x = x_center
self.y = y_center
<|end_body_0|>
<|body_start_1|>
while True:
x = random.uniform(-1.0, 1.0)
y = random.uniform(-1.0, 1.0)
if x ** 2 + y ** 2 <= 1:
break
x = self.x + x * s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.radius = radi... | stack_v2_sparse_classes_36k_train_009838 | 2,121 | no_license | [
{
"docstring": ":type radius: float :type x_center: float :type y_center: float",
"name": "__init__",
"signature": "def __init__(self, radius, x_center, y_center)"
},
{
"docstring": ":rtype: List[float]",
"name": "randPoint",
"signature": "def randPoint(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000075 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float]
<|skeleton|>
class Sol... | a5cb862f0c5a3cfd21468141800568c2dedded0a | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
self.radius = radius
self.x = x_center
self.y = y_center
def randPoint(self):
""":rtype: List[float]"""
while True:
x... | the_stack_v2_python_sparse | python/leetcode/sampling/478_generate_point_circle.py | Levintsky/topcoder | train | 0 | |
11880cd44aa1d64196dce6fb7dd065e124fb4ef3 | [
"cols.add(j)\nleft_diags.add(j - i)\nright_diags.add(n - 1 - j - i)\nboard[i][j] = 'Q'",
"cols.remove(j)\nleft_diags.remove(j - i)\nright_diags.remove(n - 1 - j - i)\nboard[i][j] = '.'",
"if j not in cols and j - i not in left_diags and (n - 1 - j - i not in right_diags):\n return True\nreturn False",
"if ... | <|body_start_0|>
cols.add(j)
left_diags.add(j - i)
right_diags.add(n - 1 - j - i)
board[i][j] = 'Q'
<|end_body_0|>
<|body_start_1|>
cols.remove(j)
left_diags.remove(j - i)
right_diags.remove(n - 1 - j - i)
board[i][j] = '.'
<|end_body_1|>
<|body_start_2|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def place_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Places queen on the board at square(i, j). Modifies board in-place."""
<|body_0|>
def remove_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Removes queen from the squar... | stack_v2_sparse_classes_36k_train_009839 | 5,871 | no_license | [
{
"docstring": "Places queen on the board at square(i, j). Modifies board in-place.",
"name": "place_queen",
"signature": "def place_queen(self, board, n, i, j, cols, left_diags, right_diags)"
},
{
"docstring": "Removes queen from the square(i, j). Modifies board in-place.",
"name": "remove_... | 5 | stack_v2_sparse_classes_30k_train_019263 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def place_queen(self, board, n, i, j, cols, left_diags, right_diags): Places queen on the board at square(i, j). Modifies board in-place.
- def remove_queen(self, board, n, i, j,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def place_queen(self, board, n, i, j, cols, left_diags, right_diags): Places queen on the board at square(i, j). Modifies board in-place.
- def remove_queen(self, board, n, i, j,... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def place_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Places queen on the board at square(i, j). Modifies board in-place."""
<|body_0|>
def remove_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Removes queen from the squar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def place_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Places queen on the board at square(i, j). Modifies board in-place."""
cols.add(j)
left_diags.add(j - i)
right_diags.add(n - 1 - j - i)
board[i][j] = 'Q'
def remove_queen(self, board... | the_stack_v2_python_sparse | Backtracking/n_queens.py | vladn90/Algorithms | train | 0 | |
5ade448680a5844bf13a1889693214afefa8fdf9 | [
"self.name = name\nself.w_name = name + '_w'\nself.voc_dim = voc_dim\nself.vec_dim = vec_dim\nself.params = {}\nself.grads = {}\nself.params[self.w_name] = np.random.randn(voc_dim, vec_dim)\nself.grads[self.w_name] = None\nself.meta = None",
"out, self.meta = (None, None)\nout = self.params[self.w_name][x, :]\nse... | <|body_start_0|>
self.name = name
self.w_name = name + '_w'
self.voc_dim = voc_dim
self.vec_dim = vec_dim
self.params = {}
self.grads = {}
self.params[self.w_name] = np.random.randn(voc_dim, vec_dim)
self.grads[self.w_name] = None
self.meta = None
... | word_embedding | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class word_embedding:
def __init__(self, voc_dim, vec_dim, name='we'):
"""In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer voc_dim: words size vec_dim: embedding vector... | stack_v2_sparse_classes_36k_train_009840 | 28,090 | permissive | [
{
"docstring": "In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer voc_dim: words size vec_dim: embedding vector dimension self.meta: variables needed for the backward pass",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_008945 | Implement the Python class `word_embedding` described below.
Class description:
Implement the word_embedding class.
Method signatures and docstrings:
- def __init__(self, voc_dim, vec_dim, name='we'): In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the compute... | Implement the Python class `word_embedding` described below.
Class description:
Implement the word_embedding class.
Method signatures and docstrings:
- def __init__(self, voc_dim, vec_dim, name='we'): In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the compute... | c5cfa2410d47c7e43a476a8c8a9795182fe8f836 | <|skeleton|>
class word_embedding:
def __init__(self, voc_dim, vec_dim, name='we'):
"""In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer voc_dim: words size vec_dim: embedding vector... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class word_embedding:
def __init__(self, voc_dim, vec_dim, name='we'):
"""In forward pass, please use self.params for the weights and biases for this layer In backward pass, store the computed gradients to self.grads name: the name of current layer voc_dim: words size vec_dim: embedding vector dimension sel... | the_stack_v2_python_sparse | 2017_Fall/CSCI-599/Assignment02/lib/layer_utils.py | saketkc/hatex | train | 21 | |
da86f1464f8ebb39e2d076e0259ec3a609b5c09d | [
"self.site = page._link.site\nself.title = page._link.title\nself.loc_title = page._link.canonical_title()\nself.can_title = page._link.ns_title()\nself.outputlang = outputlang\nif outputlang is not None:\n if not hasattr(self, 'onsite'):\n self.onsite = pywikibot.Site(outputlang, self.site.family)\n t... | <|body_start_0|>
self.site = page._link.site
self.title = page._link.title
self.loc_title = page._link.canonical_title()
self.can_title = page._link.ns_title()
self.outputlang = outputlang
if outputlang is not None:
if not hasattr(self, 'onsite'):
... | Structure with Page attributes exposed for formatting from cmd line. | Formatter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Formatter:
"""Structure with Page attributes exposed for formatting from cmd line."""
def __init__(self, page, outputlang=None, default: str='******') -> None:
"""Initializer. :param page: the page to be formatted. :type page: Page object. :param outputlang: language code in which na... | stack_v2_sparse_classes_36k_train_009841 | 11,735 | permissive | [
{
"docstring": "Initializer. :param page: the page to be formatted. :type page: Page object. :param outputlang: language code in which namespace before title should be translated. Page ns will be searched in Site(outputlang, page.site.family) and, if found, its custom name will be used in page.title(). :type ou... | 2 | null | Implement the Python class `Formatter` described below.
Class description:
Structure with Page attributes exposed for formatting from cmd line.
Method signatures and docstrings:
- def __init__(self, page, outputlang=None, default: str='******') -> None: Initializer. :param page: the page to be formatted. :type page: ... | Implement the Python class `Formatter` described below.
Class description:
Structure with Page attributes exposed for formatting from cmd line.
Method signatures and docstrings:
- def __init__(self, page, outputlang=None, default: str='******') -> None: Initializer. :param page: the page to be formatted. :type page: ... | 5c01e6bfcd328bc6eae643e661f1a0ae57612808 | <|skeleton|>
class Formatter:
"""Structure with Page attributes exposed for formatting from cmd line."""
def __init__(self, page, outputlang=None, default: str='******') -> None:
"""Initializer. :param page: the page to be formatted. :type page: Page object. :param outputlang: language code in which na... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Formatter:
"""Structure with Page attributes exposed for formatting from cmd line."""
def __init__(self, page, outputlang=None, default: str='******') -> None:
"""Initializer. :param page: the page to be formatted. :type page: Page object. :param outputlang: language code in which namespace befor... | the_stack_v2_python_sparse | scripts/listpages.py | wikimedia/pywikibot | train | 432 |
ee5202d59445af5e7696727f872b471eb50e2eb9 | [
"self._mysql_conn = None\nself._hive_conn = None\nself._mysql_query = mysql_query\nself._hive_query = hive_query\nself._init()",
"if not self._mysql_conn:\n self._mysql_conn = pymysql.mysql(query=self._mysql_query)\n print(self._mysql_conn.read_table(sql='select 1 as mysql'))\n print('连接mysql成功')\nif not... | <|body_start_0|>
self._mysql_conn = None
self._hive_conn = None
self._mysql_query = mysql_query
self._hive_query = hive_query
self._init()
<|end_body_0|>
<|body_start_1|>
if not self._mysql_conn:
self._mysql_conn = pymysql.mysql(query=self._mysql_query)
... | hive2mysql | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class hive2mysql:
def __init__(self, mysql_conn=None, hive_conn=None, mysql_query='ai_mysql', hive_query='ai_hive'):
"""如果传入的参数是已经存在的连接,就用已经存在的连接,否则就使用快速连接的方式连接数据库 :param mysql_conn: 已经连接mysql的对象 :param hive_conn: 已经连接hive的对象 :param mysql_query: 需要快速连接哪个MySQL数据库 :param hive_query: 需要快速连接哪个hive... | stack_v2_sparse_classes_36k_train_009842 | 2,933 | no_license | [
{
"docstring": "如果传入的参数是已经存在的连接,就用已经存在的连接,否则就使用快速连接的方式连接数据库 :param mysql_conn: 已经连接mysql的对象 :param hive_conn: 已经连接hive的对象 :param mysql_query: 需要快速连接哪个MySQL数据库 :param hive_query: 需要快速连接哪个hive数据库",
"name": "__init__",
"signature": "def __init__(self, mysql_conn=None, hive_conn=None, mysql_query='ai_mysql'... | 3 | stack_v2_sparse_classes_30k_train_011156 | Implement the Python class `hive2mysql` described below.
Class description:
Implement the hive2mysql class.
Method signatures and docstrings:
- def __init__(self, mysql_conn=None, hive_conn=None, mysql_query='ai_mysql', hive_query='ai_hive'): 如果传入的参数是已经存在的连接,就用已经存在的连接,否则就使用快速连接的方式连接数据库 :param mysql_conn: 已经连接mysql的对象... | Implement the Python class `hive2mysql` described below.
Class description:
Implement the hive2mysql class.
Method signatures and docstrings:
- def __init__(self, mysql_conn=None, hive_conn=None, mysql_query='ai_mysql', hive_query='ai_hive'): 如果传入的参数是已经存在的连接,就用已经存在的连接,否则就使用快速连接的方式连接数据库 :param mysql_conn: 已经连接mysql的对象... | 5bc05445541ddece04aab5924daa49e9cd59dd3a | <|skeleton|>
class hive2mysql:
def __init__(self, mysql_conn=None, hive_conn=None, mysql_query='ai_mysql', hive_query='ai_hive'):
"""如果传入的参数是已经存在的连接,就用已经存在的连接,否则就使用快速连接的方式连接数据库 :param mysql_conn: 已经连接mysql的对象 :param hive_conn: 已经连接hive的对象 :param mysql_query: 需要快速连接哪个MySQL数据库 :param hive_query: 需要快速连接哪个hive... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class hive2mysql:
def __init__(self, mysql_conn=None, hive_conn=None, mysql_query='ai_mysql', hive_query='ai_hive'):
"""如果传入的参数是已经存在的连接,就用已经存在的连接,否则就使用快速连接的方式连接数据库 :param mysql_conn: 已经连接mysql的对象 :param hive_conn: 已经连接hive的对象 :param mysql_query: 需要快速连接哪个MySQL数据库 :param hive_query: 需要快速连接哪个hive数据库"""
... | the_stack_v2_python_sparse | common/database/hive2mysql.py | mistletoe720/salespredict | train | 2 | |
bb1f654558445ae74f5cea6642715c4a7cb3093b | [
"if not lst:\n return False\nnode = ListNode()\nnode.value = lst[0]\nif len(lst) == 1:\n node.next_node = None\nelse:\n node.next_node = self.list_generate(lst[1:])\nreturn node",
"if not head_node1:\n return head_node2\nelif not head_node2:\n return head_node1\nhead_node = None\nif head_node1.valu... | <|body_start_0|>
if not lst:
return False
node = ListNode()
node.value = lst[0]
if len(lst) == 1:
node.next_node = None
else:
node.next_node = self.list_generate(lst[1:])
return node
<|end_body_0|>
<|body_start_1|>
if not head_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def list_generate(self, lst):
"""传入一个列表将其生成链表"""
<|body_0|>
def merge_list(self, head_node1, head_node2):
"""递增合并两个链表 维持两个指针"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not lst:
return False
node = ListNode()
... | stack_v2_sparse_classes_36k_train_009843 | 2,597 | no_license | [
{
"docstring": "传入一个列表将其生成链表",
"name": "list_generate",
"signature": "def list_generate(self, lst)"
},
{
"docstring": "递增合并两个链表 维持两个指针",
"name": "merge_list",
"signature": "def merge_list(self, head_node1, head_node2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005258 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def list_generate(self, lst): 传入一个列表将其生成链表
- def merge_list(self, head_node1, head_node2): 递增合并两个链表 维持两个指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def list_generate(self, lst): 传入一个列表将其生成链表
- def merge_list(self, head_node1, head_node2): 递增合并两个链表 维持两个指针
<|skeleton|>
class Solution:
def list_generate(self, lst):
... | 7594e13e1f182006f0915e0d63b50cf2d20399c3 | <|skeleton|>
class Solution:
def list_generate(self, lst):
"""传入一个列表将其生成链表"""
<|body_0|>
def merge_list(self, head_node1, head_node2):
"""递增合并两个链表 维持两个指针"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def list_generate(self, lst):
"""传入一个列表将其生成链表"""
if not lst:
return False
node = ListNode()
node.value = lst[0]
if len(lst) == 1:
node.next_node = None
else:
node.next_node = self.list_generate(lst[1:])
retur... | the_stack_v2_python_sparse | merge2List17.py | wangzhaoyao/offer_codinginterview | train | 1 | |
ab2c0e1dc13e27ad74cd5f4c6d55a490f3960a96 | [
"self.logger = logging.getLogger(VisualAppearanceFeatureTransformer.__name__)\nself.device = get_device()\nself.use_masks = use_masks\nself.input_type = input_type\nself.reduced_size = reduced_size",
"if self.use_masks and all_masks is None:\n raise RuntimeError('No masks are provided but transformer has use_m... | <|body_start_0|>
self.logger = logging.getLogger(VisualAppearanceFeatureTransformer.__name__)
self.device = get_device()
self.use_masks = use_masks
self.input_type = input_type
self.reduced_size = reduced_size
<|end_body_0|>
<|body_start_1|>
if self.use_masks and all_mas... | VisualAppearanceFeatureTransformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VisualAppearanceFeatureTransformer:
def __init__(self, input_type='default', reduced_size=64, use_masks=False, **kwargs):
"""Parent class for visual appearance feature transformers. :param input_type: Input type for the auto encoder. If 'default', then an object region is cut out. If 'bl... | stack_v2_sparse_classes_36k_train_009844 | 6,881 | no_license | [
{
"docstring": "Parent class for visual appearance feature transformers. :param input_type: Input type for the auto encoder. If 'default', then an object region is cut out. If 'blacked', then the image is blacked except for the object region. Default: 'default' :param reduced_size: Size to which inputs are scal... | 5 | stack_v2_sparse_classes_30k_train_005520 | Implement the Python class `VisualAppearanceFeatureTransformer` described below.
Class description:
Implement the VisualAppearanceFeatureTransformer class.
Method signatures and docstrings:
- def __init__(self, input_type='default', reduced_size=64, use_masks=False, **kwargs): Parent class for visual appearance featu... | Implement the Python class `VisualAppearanceFeatureTransformer` described below.
Class description:
Implement the VisualAppearanceFeatureTransformer class.
Method signatures and docstrings:
- def __init__(self, input_type='default', reduced_size=64, use_masks=False, **kwargs): Parent class for visual appearance featu... | 259fff9b7576055ba1534375de859f8708f79337 | <|skeleton|>
class VisualAppearanceFeatureTransformer:
def __init__(self, input_type='default', reduced_size=64, use_masks=False, **kwargs):
"""Parent class for visual appearance feature transformers. :param input_type: Input type for the auto encoder. If 'default', then an object region is cut out. If 'bl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VisualAppearanceFeatureTransformer:
def __init__(self, input_type='default', reduced_size=64, use_masks=False, **kwargs):
"""Parent class for visual appearance feature transformers. :param input_type: Input type for the auto encoder. If 'default', then an object region is cut out. If 'blacked', then t... | the_stack_v2_python_sparse | iorank/featuretransformation/visual_appearance_feature_transformer.py | fweiland8/iorank | train | 3 | |
3571fe525cc229d60ac2beecc85b12280658eea6 | [
"site = models.SiteSettings.objects.get()\ndata = {'form': forms.RegistrationLimitedForm(instance=site)}\nreturn TemplateResponse(request, 'settings/registration_limited.html', data)",
"site = models.SiteSettings.objects.get()\nform = forms.RegistrationLimitedForm(request.POST, request.FILES, instance=site)\nif n... | <|body_start_0|>
site = models.SiteSettings.objects.get()
data = {'form': forms.RegistrationLimitedForm(instance=site)}
return TemplateResponse(request, 'settings/registration_limited.html', data)
<|end_body_0|>
<|body_start_1|>
site = models.SiteSettings.objects.get()
form = fo... | Things related to registering that non-admins owners can change | RegistrationLimited | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistrationLimited:
"""Things related to registering that non-admins owners can change"""
def get(self, request):
"""edit form"""
<|body_0|>
def post(self, request):
"""edit the site settings"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
site... | stack_v2_sparse_classes_36k_train_009845 | 3,435 | no_license | [
{
"docstring": "edit form",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "edit the site settings",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009040 | Implement the Python class `RegistrationLimited` described below.
Class description:
Things related to registering that non-admins owners can change
Method signatures and docstrings:
- def get(self, request): edit form
- def post(self, request): edit the site settings | Implement the Python class `RegistrationLimited` described below.
Class description:
Things related to registering that non-admins owners can change
Method signatures and docstrings:
- def get(self, request): edit form
- def post(self, request): edit the site settings
<|skeleton|>
class RegistrationLimited:
"""T... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class RegistrationLimited:
"""Things related to registering that non-admins owners can change"""
def get(self, request):
"""edit form"""
<|body_0|>
def post(self, request):
"""edit the site settings"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegistrationLimited:
"""Things related to registering that non-admins owners can change"""
def get(self, request):
"""edit form"""
site = models.SiteSettings.objects.get()
data = {'form': forms.RegistrationLimitedForm(instance=site)}
return TemplateResponse(request, 'setti... | the_stack_v2_python_sparse | bookwyrm/views/admin/site.py | bookwyrm-social/bookwyrm | train | 1,398 |
ec1a3ce98db4c305b40f1ad0a35aca1d3122daef | [
"self.__load_nobreaks(options.get('language'), options.get('nobreak_file'))\nself.__spaces = Regex('\\\\s+')\nself.__space_at_end = Regex('(^|\\\\n) ')\nself.__space_at_begin = Regex(' ($|\\\\n)')\nself.__non_period = Regex('([?!]|\\\\.{2,}) +' + self.SENT_STARTER)\nself.__in_punct = Regex('([?!\\\\.] *' + self.FIN... | <|body_start_0|>
self.__load_nobreaks(options.get('language'), options.get('nobreak_file'))
self.__spaces = Regex('\\s+')
self.__space_at_end = Regex('(^|\\n) ')
self.__space_at_begin = Regex(' ($|\\n)')
self.__non_period = Regex('([?!]|\\.{2,}) +' + self.SENT_STARTER)
se... | A simple sentence splitter class. | SentenceSplitter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SentenceSplitter:
"""A simple sentence splitter class."""
def __init__(self, options={}):
"""Constructor (pre-compile all needed regexes)."""
<|body_0|>
def split_sentences(self, text):
"""Split sentences in the given text using current settings."""
<|bod... | stack_v2_sparse_classes_36k_train_009846 | 7,087 | permissive | [
{
"docstring": "Constructor (pre-compile all needed regexes).",
"name": "__init__",
"signature": "def __init__(self, options={})"
},
{
"docstring": "Split sentences in the given text using current settings.",
"name": "split_sentences",
"signature": "def split_sentences(self, text)"
},
... | 3 | stack_v2_sparse_classes_30k_train_004043 | Implement the Python class `SentenceSplitter` described below.
Class description:
A simple sentence splitter class.
Method signatures and docstrings:
- def __init__(self, options={}): Constructor (pre-compile all needed regexes).
- def split_sentences(self, text): Split sentences in the given text using current setti... | Implement the Python class `SentenceSplitter` described below.
Class description:
A simple sentence splitter class.
Method signatures and docstrings:
- def __init__(self, options={}): Constructor (pre-compile all needed regexes).
- def split_sentences(self, text): Split sentences in the given text using current setti... | fcc78d62e1fa145b1c5c5782fbf0aa625bad761a | <|skeleton|>
class SentenceSplitter:
"""A simple sentence splitter class."""
def __init__(self, options={}):
"""Constructor (pre-compile all needed regexes)."""
<|body_0|>
def split_sentences(self, text):
"""Split sentences in the given text using current settings."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SentenceSplitter:
"""A simple sentence splitter class."""
def __init__(self, options={}):
"""Constructor (pre-compile all needed regexes)."""
self.__load_nobreaks(options.get('language'), options.get('nobreak_file'))
self.__spaces = Regex('\\s+')
self.__space_at_end = Rege... | the_stack_v2_python_sparse | worker/src/util/split_sentences.py | ufal/mtmonkey | train | 32 |
5de4df1f09379e414053f15a92be10b39ddbab42 | [
"self.created_time_msecs = created_time_msecs\nself.created_user_sid = created_user_sid\nself.created_username = created_username\nself.expiring_time_msecs = expiring_time_msecs\nself.id = id\nself.is_active = is_active\nself.is_expired = is_expired\nself.key = key\nself.name = name\nself.owner_user_sid = owner_use... | <|body_start_0|>
self.created_time_msecs = created_time_msecs
self.created_user_sid = created_user_sid
self.created_username = created_username
self.expiring_time_msecs = expiring_time_msecs
self.id = id
self.is_active = is_active
self.is_expired = is_expired
... | Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specifies the username who created this API key... | CreatedApiKey | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreatedApiKey:
"""Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specif... | stack_v2_sparse_classes_36k_train_009847 | 4,142 | permissive | [
{
"docstring": "Constructor for the CreatedApiKey class",
"name": "__init__",
"signature": "def __init__(self, created_time_msecs=None, created_user_sid=None, created_username=None, expiring_time_msecs=None, id=None, is_active=None, is_expired=None, key=None, name=None, owner_user_sid=None, owner_userna... | 2 | stack_v2_sparse_classes_30k_train_007740 | Implement the Python class `CreatedApiKey` described below.
Class description:
Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API... | Implement the Python class `CreatedApiKey` described below.
Class description:
Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class CreatedApiKey:
"""Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specif... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CreatedApiKey:
"""Implementation of the 'CreatedApiKey' model. Specifies a created API key. Attributes: created_time_msecs (long|int): Specifies the API key created time in milli seconds. created_user_sid (string): Specifies the user sid who created this API key. created_username (string): Specifies the usern... | the_stack_v2_python_sparse | cohesity_management_sdk/models/created_api_key.py | cohesity/management-sdk-python | train | 24 |
e2e6e38f39998e0d7fc52241331e332b71821d73 | [
"GPS.Action.__init__(self, 'open example ' + example_name)\nself.gpr_file = gpr_file\nself.readme = readme\nself.example_name = example_name\nself.directory = directory\nself.create(self.on_activate, filter='', category='Help', description='Load project for example ' + example_name)",
"new_proj_dir = str(GPS.MDI.... | <|body_start_0|>
GPS.Action.__init__(self, 'open example ' + example_name)
self.gpr_file = gpr_file
self.readme = readme
self.example_name = example_name
self.directory = directory
self.create(self.on_activate, filter='', category='Help', description='Load project for exa... | ExampleAction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExampleAction:
def __init__(self, example_name, directory, gpr_file, readme):
"""Create an action to load one example in GPS. example_name is the name to use for the example, directory is the directory containing the expample project, gpr_file is the project file to load, and readme (if ... | stack_v2_sparse_classes_36k_train_009848 | 4,728 | no_license | [
{
"docstring": "Create an action to load one example in GPS. example_name is the name to use for the example, directory is the directory containing the expample project, gpr_file is the project file to load, and readme (if any) the file to edit after project load.",
"name": "__init__",
"signature": "def... | 2 | null | Implement the Python class `ExampleAction` described below.
Class description:
Implement the ExampleAction class.
Method signatures and docstrings:
- def __init__(self, example_name, directory, gpr_file, readme): Create an action to load one example in GPS. example_name is the name to use for the example, directory i... | Implement the Python class `ExampleAction` described below.
Class description:
Implement the ExampleAction class.
Method signatures and docstrings:
- def __init__(self, example_name, directory, gpr_file, readme): Create an action to load one example in GPS. example_name is the name to use for the example, directory i... | 5b91c1816aadfa3a08bba730b8dfd3f6a0785463 | <|skeleton|>
class ExampleAction:
def __init__(self, example_name, directory, gpr_file, readme):
"""Create an action to load one example in GPS. example_name is the name to use for the example, directory is the directory containing the expample project, gpr_file is the project file to load, and readme (if ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExampleAction:
def __init__(self, example_name, directory, gpr_file, readme):
"""Create an action to load one example in GPS. example_name is the name to use for the example, directory is the directory containing the expample project, gpr_file is the project file to load, and readme (if any) the file ... | the_stack_v2_python_sparse | Code/share/gps/support/core/gnat_examples.py | AaronC98/PlaneSystem | train | 0 | |
ac6003a65a9750b446e7f5b40ea531c2f4831af0 | [
"self.root_nodes = root_nodes\nself.stats = stats\nself.stats_by_env = stats_by_env",
"if dictionary is None:\n return None\nroot_nodes = None\nif dictionary.get('rootNodes') != None:\n root_nodes = list()\n for structure in dictionary.get('rootNodes'):\n root_nodes.append(cohesity_management_sdk.... | <|body_start_0|>
self.root_nodes = root_nodes
self.stats = stats
self.stats_by_env = stats_by_env
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
root_nodes = None
if dictionary.get('rootNodes') != None:
root_nodes = list()
... | Implementation of the 'GetRegistrationInfoResponse' model. Specifies the registration, protection and permission information of all or a subset of the registered Protection Source Trees or Views on the Cohesity Cluster. Attributes: root_nodes (list of ProtectionSourceTreeInfo): Specifies the registration, protection an... | GetRegistrationInfoResponse | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetRegistrationInfoResponse:
"""Implementation of the 'GetRegistrationInfoResponse' model. Specifies the registration, protection and permission information of all or a subset of the registered Protection Source Trees or Views on the Cohesity Cluster. Attributes: root_nodes (list of ProtectionSou... | stack_v2_sparse_classes_36k_train_009849 | 3,189 | permissive | [
{
"docstring": "Constructor for the GetRegistrationInfoResponse class",
"name": "__init__",
"signature": "def __init__(self, root_nodes=None, stats=None, stats_by_env=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represe... | 2 | stack_v2_sparse_classes_30k_train_002003 | Implement the Python class `GetRegistrationInfoResponse` described below.
Class description:
Implementation of the 'GetRegistrationInfoResponse' model. Specifies the registration, protection and permission information of all or a subset of the registered Protection Source Trees or Views on the Cohesity Cluster. Attrib... | Implement the Python class `GetRegistrationInfoResponse` described below.
Class description:
Implementation of the 'GetRegistrationInfoResponse' model. Specifies the registration, protection and permission information of all or a subset of the registered Protection Source Trees or Views on the Cohesity Cluster. Attrib... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class GetRegistrationInfoResponse:
"""Implementation of the 'GetRegistrationInfoResponse' model. Specifies the registration, protection and permission information of all or a subset of the registered Protection Source Trees or Views on the Cohesity Cluster. Attributes: root_nodes (list of ProtectionSou... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetRegistrationInfoResponse:
"""Implementation of the 'GetRegistrationInfoResponse' model. Specifies the registration, protection and permission information of all or a subset of the registered Protection Source Trees or Views on the Cohesity Cluster. Attributes: root_nodes (list of ProtectionSourceTreeInfo):... | the_stack_v2_python_sparse | cohesity_management_sdk/models/get_registration_info_response.py | cohesity/management-sdk-python | train | 24 |
6729dc202743738c0a7e77cfabd18ed7dc3727c2 | [
"self.array = [None for _ in range(size)]\nself.i = 0\nself.total = 0",
"if self.array[self.i] is not None:\n self.total -= self.array[self.i]\nself.total += val\nself.array[self.i] = val\nself.i = (self.i + 1) % len(self.array)\ncount = len(self.array)\nif self.array[-1] is None:\n count = self.i\nreturn s... | <|body_start_0|>
self.array = [None for _ in range(size)]
self.i = 0
self.total = 0
<|end_body_0|>
<|body_start_1|>
if self.array[self.i] is not None:
self.total -= self.array[self.i]
self.total += val
self.array[self.i] = val
self.i = (self.i + 1) % ... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.array = [None for _ in range(siz... | stack_v2_sparse_classes_36k_train_009850 | 1,359 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006954 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 05e0beff0047f0ad399d0b46d625bb8d3459814e | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.array = [None for _ in range(size)]
self.i = 0
self.total = 0
def next(self, val):
""":type val: int :rtype: float"""
if self.array[self.i] is not None:... | the_stack_v2_python_sparse | python_1_to_1000/346_Moving_Average_from_Data_Stream.py | jakehoare/leetcode | train | 58 | |
47c349aa5e51069ba06897e9663fea9d4ec3283c | [
"self.G = G\nself.p = p\nself.q = q",
"G = self.G\np = self.p\nq = self.q\nunnormalized_probs = []\nfor x in G.neighbors(v):\n weight = G[v][x].get('weight', 1.0)\n if x == t:\n unnormalized_probs.append(weight / p)\n elif G.has_edge(x, t):\n unnormalized_probs.append(weight)\n else:\n ... | <|body_start_0|>
self.G = G
self.p = p
self.q = q
<|end_body_0|>
<|body_start_1|>
G = self.G
p = self.p
q = self.q
unnormalized_probs = []
for x in G.neighbors(v):
weight = G[v][x].get('weight', 1.0)
if x == t:
unno... | RandomWalker | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWalker:
def __init__(self, G, p=1, q=1):
""":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes"""
<|body_0|>
def g... | stack_v2_sparse_classes_36k_train_009851 | 3,281 | permissive | [
{
"docstring": ":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes",
"name": "__init__",
"signature": "def __init__(self, G, p=1, q=1)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_009588 | Implement the Python class `RandomWalker` described below.
Class description:
Implement the RandomWalker class.
Method signatures and docstrings:
- def __init__(self, G, p=1, q=1): :param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,all... | Implement the Python class `RandomWalker` described below.
Class description:
Implement the RandomWalker class.
Method signatures and docstrings:
- def __init__(self, G, p=1, q=1): :param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,all... | e41caeb32a07da95364f15b85cad527a67763255 | <|skeleton|>
class RandomWalker:
def __init__(self, G, p=1, q=1):
""":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes"""
<|body_0|>
def g... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomWalker:
def __init__(self, G, p=1, q=1):
""":param G: :param p: Return parameter,controls the likelihood of immediately revisiting a node in the walk. :param q: In-out parameter,allows the search to differentiate between “inward” and “outward” nodes"""
self.G = G
self.p = p
... | the_stack_v2_python_sparse | graphgallery/gallery/nodeclas/utils/walker.py | blindSpoter01/GraphGallery | train | 0 | |
da86dbe5eaadb3c7609d51c6d8365536a2a5f98a | [
"sk_idx = {v: i for i, v in enumerate(req_skills)}\ndp = {0: []}\nfor i, p in enumerate(people):\n sks = 0\n for sk in p:\n if sk in sk_idx:\n sks |= 1 << sk_idx[sk]\n for k, v in list(dp.items()):\n incld = k | sks\n if incld != k and (incld not in dp or len(dp[incld]) > le... | <|body_start_0|>
sk_idx = {v: i for i, v in enumerate(req_skills)}
dp = {0: []}
for i, p in enumerate(people):
sks = 0
for sk in p:
if sk in sk_idx:
sks |= 1 << sk_idx[sk]
for k, v in list(dp.items()):
incld ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def smallestSufficientTeam(self, req_skills, people):
""":type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]"""
<|body_0|>
def smallestSufficientTeam2(self, req_skills, people):
""":type req_skills: List[str] :type people: List[List[... | stack_v2_sparse_classes_36k_train_009852 | 1,971 | no_license | [
{
"docstring": ":type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]",
"name": "smallestSufficientTeam",
"signature": "def smallestSufficientTeam(self, req_skills, people)"
},
{
"docstring": ":type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]",
... | 2 | stack_v2_sparse_classes_30k_train_008283 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def smallestSufficientTeam(self, req_skills, people): :type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]
- def smallestSufficientTeam2(self, req_skills, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def smallestSufficientTeam(self, req_skills, people): :type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]
- def smallestSufficientTeam2(self, req_skills, ... | dbdb227e12f329e4ca064b338f1fbdca42f3a848 | <|skeleton|>
class Solution:
def smallestSufficientTeam(self, req_skills, people):
""":type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]"""
<|body_0|>
def smallestSufficientTeam2(self, req_skills, people):
""":type req_skills: List[str] :type people: List[List[... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def smallestSufficientTeam(self, req_skills, people):
""":type req_skills: List[str] :type people: List[List[str]] :rtype: List[int]"""
sk_idx = {v: i for i, v in enumerate(req_skills)}
dp = {0: []}
for i, p in enumerate(people):
sks = 0
for sk... | the_stack_v2_python_sparse | LC1125.py | Qiao-Liang/LeetCode | train | 0 | |
358ddafe482af9802daf37b8279ab9a75deb2d34 | [
"n = 0\ncur_node = head\nwhile cur_node:\n n += 1\n cur_node = cur_node.next\nans_node = head\nfor _ in range(n - k):\n ans_node = ans_node.next\nreturn ans_node",
"fast = head\nfor _ in range(k):\n fast = fast.next\nans_node = head\nwhile fast:\n ans_node = ans_node.next\n fast = fast.next\nret... | <|body_start_0|>
n = 0
cur_node = head
while cur_node:
n += 1
cur_node = cur_node.next
ans_node = head
for _ in range(n - k):
ans_node = ans_node.next
return ans_node
<|end_body_0|>
<|body_start_1|>
fast = head
for _ in... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getKthFromEnd(self, head: ListNode, k: int) -> ListNode:
"""顺序遍历2次,第一次获得链表长度,第二次遍历到 n - k位置返回 :param head: :param k: :return:"""
<|body_0|>
def getKthFromEnd1(self, head: ListNode, k: int) -> ListNode:
"""快慢指针,只需要遍历n :param head: :param k: :return:"""
... | stack_v2_sparse_classes_36k_train_009853 | 1,135 | no_license | [
{
"docstring": "顺序遍历2次,第一次获得链表长度,第二次遍历到 n - k位置返回 :param head: :param k: :return:",
"name": "getKthFromEnd",
"signature": "def getKthFromEnd(self, head: ListNode, k: int) -> ListNode"
},
{
"docstring": "快慢指针,只需要遍历n :param head: :param k: :return:",
"name": "getKthFromEnd1",
"signature": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getKthFromEnd(self, head: ListNode, k: int) -> ListNode: 顺序遍历2次,第一次获得链表长度,第二次遍历到 n - k位置返回 :param head: :param k: :return:
- def getKthFromEnd1(self, head: ListNode, k: int) ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getKthFromEnd(self, head: ListNode, k: int) -> ListNode: 顺序遍历2次,第一次获得链表长度,第二次遍历到 n - k位置返回 :param head: :param k: :return:
- def getKthFromEnd1(self, head: ListNode, k: int) ... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def getKthFromEnd(self, head: ListNode, k: int) -> ListNode:
"""顺序遍历2次,第一次获得链表长度,第二次遍历到 n - k位置返回 :param head: :param k: :return:"""
<|body_0|>
def getKthFromEnd1(self, head: ListNode, k: int) -> ListNode:
"""快慢指针,只需要遍历n :param head: :param k: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getKthFromEnd(self, head: ListNode, k: int) -> ListNode:
"""顺序遍历2次,第一次获得链表长度,第二次遍历到 n - k位置返回 :param head: :param k: :return:"""
n = 0
cur_node = head
while cur_node:
n += 1
cur_node = cur_node.next
ans_node = head
for _ in ... | the_stack_v2_python_sparse | datastructure/daily_topic/GetKthFromEnd.py | yinhuax/leet_code | train | 0 | |
11feda41ff47fb8a291ff8ba82f45a346d47ed86 | [
"if longUrl in long2short:\n return prefix + long2short[longUrl]\nelse:\n gen_letter = ''.join([letters[random.randint(0, 61)] for i in range(6)])\n long2short[longUrl] = gen_letter\n short2long[gen_letter] = longUrl\n return prefix + gen_letter",
"short = shortUrl.split('/')[-1]\nif short in short... | <|body_start_0|>
if longUrl in long2short:
return prefix + long2short[longUrl]
else:
gen_letter = ''.join([letters[random.randint(0, 61)] for i in range(6)])
long2short[longUrl] = gen_letter
short2long[gen_letter] = longUrl
return prefix + gen_... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL."""
<|body_0|>
def decode(self, shortUrl: str) -> str:
"""Decodes a shortened URL to its original URL."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if longUrl in lo... | stack_v2_sparse_classes_36k_train_009854 | 933 | no_license | [
{
"docstring": "Encodes a URL to a shortened URL.",
"name": "encode",
"signature": "def encode(self, longUrl: str) -> str"
},
{
"docstring": "Decodes a shortened URL to its original URL.",
"name": "decode",
"signature": "def decode(self, shortUrl: str) -> str"
}
] | 2 | stack_v2_sparse_classes_30k_train_013612 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, longUrl: str) -> str: Encodes a URL to a shortened URL.
- def decode(self, shortUrl: str) -> str: Decodes a shortened URL to its original URL. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, longUrl: str) -> str: Encodes a URL to a shortened URL.
- def decode(self, shortUrl: str) -> str: Decodes a shortened URL to its original URL.
<|skeleton|>
class Code... | 5ed070f22f4bc29777ee5cbb01bb9583726d8799 | <|skeleton|>
class Codec:
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL."""
<|body_0|>
def decode(self, shortUrl: str) -> str:
"""Decodes a shortened URL to its original URL."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL."""
if longUrl in long2short:
return prefix + long2short[longUrl]
else:
gen_letter = ''.join([letters[random.randint(0, 61)] for i in range(6)])
long2short[longUrl] = g... | the_stack_v2_python_sparse | 535_encode_and_decode_tinyurl.py | zdadadaz/coding_practice | train | 0 | |
612c168be1b6cd05916dbfe0ba78e61e9c440c48 | [
"try:\n reputation_object = user.reputation\nexcept ObjectDoesNotExist:\n reputation_object = Reputation(user=user)\n reputation_object.save()\nreturn reputation_object",
"start_time = datetime.datetime.today().replace(hour=0, minute=0, second=0)\nend_time = datetime.datetime.today().replace(hour=23, min... | <|body_start_0|>
try:
reputation_object = user.reputation
except ObjectDoesNotExist:
reputation_object = Reputation(user=user)
reputation_object.save()
return reputation_object
<|end_body_0|>
<|body_start_1|>
start_time = datetime.datetime.today().rep... | Custom manager for the "Reputation" model. Methods defined here provide shortcuts for modifying and tracking the reputation of users. | ReputationManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReputationManager:
"""Custom manager for the "Reputation" model. Methods defined here provide shortcuts for modifying and tracking the reputation of users."""
def reputation_for_user(self, user):
"""Returns the "Reputation" object associated with an "User". if no "Reputation" object ... | stack_v2_sparse_classes_36k_train_009855 | 7,439 | permissive | [
{
"docstring": "Returns the \"Reputation\" object associated with an \"User\". if no \"Reputation\" object currently exists for the user, then attempt to create a new \"Reputation\" object with default values.",
"name": "reputation_for_user",
"signature": "def reputation_for_user(self, user)"
},
{
... | 5 | null | Implement the Python class `ReputationManager` described below.
Class description:
Custom manager for the "Reputation" model. Methods defined here provide shortcuts for modifying and tracking the reputation of users.
Method signatures and docstrings:
- def reputation_for_user(self, user): Returns the "Reputation" obj... | Implement the Python class `ReputationManager` described below.
Class description:
Custom manager for the "Reputation" model. Methods defined here provide shortcuts for modifying and tracking the reputation of users.
Method signatures and docstrings:
- def reputation_for_user(self, user): Returns the "Reputation" obj... | 5f8f3b682ac28fd3f464e7a993c3988c1a49eb02 | <|skeleton|>
class ReputationManager:
"""Custom manager for the "Reputation" model. Methods defined here provide shortcuts for modifying and tracking the reputation of users."""
def reputation_for_user(self, user):
"""Returns the "Reputation" object associated with an "User". if no "Reputation" object ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReputationManager:
"""Custom manager for the "Reputation" model. Methods defined here provide shortcuts for modifying and tracking the reputation of users."""
def reputation_for_user(self, user):
"""Returns the "Reputation" object associated with an "User". if no "Reputation" object currently exi... | the_stack_v2_python_sparse | eruditio/shared_apps/django_reputation/models.py | genghisu/eruditio | train | 0 |
c92d6cf628ef35215dd7505940969881c1780e1a | [
"self.h_settings = h_settings\nself.reset_stats()\nself.game_active = False\nself.high_score = 0",
"self.heros_left = self.h_settings.hero_limit\nself.score = 0\nself.level = 1"
] | <|body_start_0|>
self.h_settings = h_settings
self.reset_stats()
self.game_active = False
self.high_score = 0
<|end_body_0|>
<|body_start_1|>
self.heros_left = self.h_settings.hero_limit
self.score = 0
self.level = 1
<|end_body_1|>
| Stores the game statistics data | GameStats | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameStats:
"""Stores the game statistics data"""
def __init__(self, h_settings):
"""Initializes the statistic data"""
<|body_0|>
def reset_stats(self):
"""Initializes the statistic data that can change during the game"""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_009856 | 773 | permissive | [
{
"docstring": "Initializes the statistic data",
"name": "__init__",
"signature": "def __init__(self, h_settings)"
},
{
"docstring": "Initializes the statistic data that can change during the game",
"name": "reset_stats",
"signature": "def reset_stats(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006891 | Implement the Python class `GameStats` described below.
Class description:
Stores the game statistics data
Method signatures and docstrings:
- def __init__(self, h_settings): Initializes the statistic data
- def reset_stats(self): Initializes the statistic data that can change during the game | Implement the Python class `GameStats` described below.
Class description:
Stores the game statistics data
Method signatures and docstrings:
- def __init__(self, h_settings): Initializes the statistic data
- def reset_stats(self): Initializes the statistic data that can change during the game
<|skeleton|>
class Game... | 4b336ebf0bc29aa4c644f0996431d13f853ac6e7 | <|skeleton|>
class GameStats:
"""Stores the game statistics data"""
def __init__(self, h_settings):
"""Initializes the statistic data"""
<|body_0|>
def reset_stats(self):
"""Initializes the statistic data that can change during the game"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GameStats:
"""Stores the game statistics data"""
def __init__(self, h_settings):
"""Initializes the statistic data"""
self.h_settings = h_settings
self.reset_stats()
self.game_active = False
self.high_score = 0
def reset_stats(self):
"""Initializes the... | the_stack_v2_python_sparse | pygame/hero_combat/hero_game_stats.py | carlinhoshk/python | train | 0 |
059104eff6a82effdc66cf94a58e9d94fc076ac1 | [
"if not email:\n raise ValueError('邮箱必须填写')\nuser = self.model(username=username, email=email)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(username, email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user"
] | <|body_start_0|>
if not email:
raise ValueError('邮箱必须填写')
user = self.model(username=username, email=email)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.create_user(username, email, password=pas... | G7UserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class G7UserManager:
def create_user(self, username, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, username, email, password):
"""Creates and saves a superuser with the given em... | stack_v2_sparse_classes_36k_train_009857 | 6,805 | no_license | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, username, email, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"name"... | 2 | null | Implement the Python class `G7UserManager` described below.
Class description:
Implement the G7UserManager class.
Method signatures and docstrings:
- def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, username,... | Implement the Python class `G7UserManager` described below.
Class description:
Implement the G7UserManager class.
Method signatures and docstrings:
- def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, username,... | 91f26df9b14a225d3226f010366cf94ea0436005 | <|skeleton|>
class G7UserManager:
def create_user(self, username, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, username, email, password):
"""Creates and saves a superuser with the given em... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class G7UserManager:
def create_user(self, username, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('邮箱必须填写')
user = self.model(username=username, email=email)
user.set_password(passwo... | the_stack_v2_python_sparse | Web/G7Platform/G7Platform/main/g7admin/Account/models.py | gao7ios/G7Platform | train | 4 | |
bcb66ccebc800b1f362b10fcb7f05111cf8f4de0 | [
"i, j = (0, 0)\nwhile i < len(word) and j < len(abbr):\n jj = j\n while jj < len(abbr) and abbr[jj].isdigit():\n jj += 1\n if jj > j and abbr[j] != '0':\n occur = int(abbr[j:jj])\n i, j = (i + occur, jj)\n elif word[i] != abbr[j]:\n return False\n else:\n i, j = (i ... | <|body_start_0|>
i, j = (0, 0)
while i < len(word) and j < len(abbr):
jj = j
while jj < len(abbr) and abbr[jj].isdigit():
jj += 1
if jj > j and abbr[j] != '0':
occur = int(abbr[j:jj])
i, j = (i + occur, jj)
e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def validWordAbbreviation(self, word, abbr):
""":type word: str :type abbr: str :rtype: bool"""
<|body_0|>
def minAbbreviation(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_009858 | 1,680 | no_license | [
{
"docstring": ":type word: str :type abbr: str :rtype: bool",
"name": "validWordAbbreviation",
"signature": "def validWordAbbreviation(self, word, abbr)"
},
{
"docstring": ":type target: str :type dictionary: List[str] :rtype: str",
"name": "minAbbreviation",
"signature": "def minAbbrev... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validWordAbbreviation(self, word, abbr): :type word: str :type abbr: str :rtype: bool
- def minAbbreviation(self, target, dictionary): :type target: str :type dictionary: Lis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validWordAbbreviation(self, word, abbr): :type word: str :type abbr: str :rtype: bool
- def minAbbreviation(self, target, dictionary): :type target: str :type dictionary: Lis... | 2722c0deafcd094ce64140a9a837b4027d29ed6f | <|skeleton|>
class Solution:
def validWordAbbreviation(self, word, abbr):
""":type word: str :type abbr: str :rtype: bool"""
<|body_0|>
def minAbbreviation(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def validWordAbbreviation(self, word, abbr):
""":type word: str :type abbr: str :rtype: bool"""
i, j = (0, 0)
while i < len(word) and j < len(abbr):
jj = j
while jj < len(abbr) and abbr[jj].isdigit():
jj += 1
if jj > j and a... | the_stack_v2_python_sparse | 411_min_abbr_h/enum_dfs.py | chao-shi/lclc | train | 0 | |
9e5a2e83c57f0fd7004f14c203d590b8201a93a7 | [
"_reader_interface = self.reader_factory(mode='json')\n_reader = _reader_interface(build_specification)\n_objects = []\nfor item in _reader.data:\n class_kwargs = _reader.data[item]\n module_name = class_kwargs.get('module', None)\n if module_name is not None:\n module_dict = dict(name=f'.{module_na... | <|body_start_0|>
_reader_interface = self.reader_factory(mode='json')
_reader = _reader_interface(build_specification)
_objects = []
for item in _reader.data:
class_kwargs = _reader.data[item]
module_name = class_kwargs.get('module', None)
if module_na... | Provides a constructor of various classes. | Factory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Factory:
"""Provides a constructor of various classes."""
def __init__(self, build_specification):
"""The init method of the Factory class."""
<|body_0|>
def reader_factory(mode: str='json') -> Callable:
"""Imports the correct reader class. Arguments: mode (str):... | stack_v2_sparse_classes_36k_train_009859 | 2,831 | no_license | [
{
"docstring": "The init method of the Factory class.",
"name": "__init__",
"signature": "def __init__(self, build_specification)"
},
{
"docstring": "Imports the correct reader class. Arguments: mode (str): The type of reader to import. Defaults to 'json'. Returns: class_constructor (pubsub.read... | 2 | stack_v2_sparse_classes_30k_train_013482 | Implement the Python class `Factory` described below.
Class description:
Provides a constructor of various classes.
Method signatures and docstrings:
- def __init__(self, build_specification): The init method of the Factory class.
- def reader_factory(mode: str='json') -> Callable: Imports the correct reader class. A... | Implement the Python class `Factory` described below.
Class description:
Provides a constructor of various classes.
Method signatures and docstrings:
- def __init__(self, build_specification): The init method of the Factory class.
- def reader_factory(mode: str='json') -> Callable: Imports the correct reader class. A... | d01493aaa9397e8fd7e34cc06f4712070aedbb6e | <|skeleton|>
class Factory:
"""Provides a constructor of various classes."""
def __init__(self, build_specification):
"""The init method of the Factory class."""
<|body_0|>
def reader_factory(mode: str='json') -> Callable:
"""Imports the correct reader class. Arguments: mode (str):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Factory:
"""Provides a constructor of various classes."""
def __init__(self, build_specification):
"""The init method of the Factory class."""
_reader_interface = self.reader_factory(mode='json')
_reader = _reader_interface(build_specification)
_objects = []
for it... | the_stack_v2_python_sparse | src/pyschool/pubsub/factory.py | hovey/pyschool | train | 1 |
68d14797317058f2429f2b20b9db60a89cf7cb5d | [
"super(BahdanauAttention, self).__init__()\nself.normalize = normalize\nself.batch_first = batch_first\nself.num_units = num_units\nself.linear_q = nn.Linear(query_size, num_units, bias=False)\nself.linear_k = nn.Linear(key_size, num_units, bias=False)\nnn.init.uniform_(self.linear_q.weight.data, -init_weight, init... | <|body_start_0|>
super(BahdanauAttention, self).__init__()
self.normalize = normalize
self.batch_first = batch_first
self.num_units = num_units
self.linear_q = nn.Linear(query_size, num_units, bias=False)
self.linear_k = nn.Linear(key_size, num_units, bias=False)
... | Bahdanau Attention (https://arxiv.org/abs/1409.0473) Implementation is very similar to tf.contrib.seq2seq.BahdanauAttention | BahdanauAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BahdanauAttention:
"""Bahdanau Attention (https://arxiv.org/abs/1409.0473) Implementation is very similar to tf.contrib.seq2seq.BahdanauAttention"""
def __init__(self, query_size, key_size, num_units, normalize=False, batch_first=False, init_weight=0.1):
"""Constructor for the Bahdan... | stack_v2_sparse_classes_36k_train_009860 | 6,755 | permissive | [
{
"docstring": "Constructor for the BahdanauAttention. :param query_size: feature dimension for query :param key_size: feature dimension for keys :param num_units: internal feature dimension :param normalize: whether to normalize energy term :param batch_first: if True batch size is the 1st dimension, if False ... | 5 | null | Implement the Python class `BahdanauAttention` described below.
Class description:
Bahdanau Attention (https://arxiv.org/abs/1409.0473) Implementation is very similar to tf.contrib.seq2seq.BahdanauAttention
Method signatures and docstrings:
- def __init__(self, query_size, key_size, num_units, normalize=False, batch_... | Implement the Python class `BahdanauAttention` described below.
Class description:
Bahdanau Attention (https://arxiv.org/abs/1409.0473) Implementation is very similar to tf.contrib.seq2seq.BahdanauAttention
Method signatures and docstrings:
- def __init__(self, query_size, key_size, num_units, normalize=False, batch_... | a5388a45f71a949639b35cc5b990bd130d2d8164 | <|skeleton|>
class BahdanauAttention:
"""Bahdanau Attention (https://arxiv.org/abs/1409.0473) Implementation is very similar to tf.contrib.seq2seq.BahdanauAttention"""
def __init__(self, query_size, key_size, num_units, normalize=False, batch_first=False, init_weight=0.1):
"""Constructor for the Bahdan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BahdanauAttention:
"""Bahdanau Attention (https://arxiv.org/abs/1409.0473) Implementation is very similar to tf.contrib.seq2seq.BahdanauAttention"""
def __init__(self, query_size, key_size, num_units, normalize=False, batch_first=False, init_weight=0.1):
"""Constructor for the BahdanauAttention. ... | the_stack_v2_python_sparse | PyTorch/Translation/GNMT/seq2seq/models/attention.py | NVIDIA/DeepLearningExamples | train | 11,838 |
5fb92714e61da7549a0b1b4992dd2e394ee6f920 | [
"if not cls.serializers:\n raise ValueError('Need to specify at least one serialization class')\nfor serializer in cls.serializers:\n LOGGER.debug(f'Serializing with {serializer}')\n params = serializer.serialize(**kwargs)\n LOGGER.debug(f'Serialization params: {params}')\n kwargs.update(params)\nret... | <|body_start_0|>
if not cls.serializers:
raise ValueError('Need to specify at least one serialization class')
for serializer in cls.serializers:
LOGGER.debug(f'Serializing with {serializer}')
params = serializer.serialize(**kwargs)
LOGGER.debug(f'Serializa... | Base class for save patterns (registered wrappers for the collection of serializers and deserializers) | BaseSavePattern | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseSavePattern:
"""Base class for save patterns (registered wrappers for the collection of serializers and deserializers)"""
def save(cls, **kwargs) -> Dict[str, str]:
"""Routine to iterate through serializers returning the final metadata"""
<|body_0|>
def load(cls, **k... | stack_v2_sparse_classes_36k_train_009861 | 1,807 | permissive | [
{
"docstring": "Routine to iterate through serializers returning the final metadata",
"name": "save",
"signature": "def save(cls, **kwargs) -> Dict[str, str]"
},
{
"docstring": "The load method invoked",
"name": "load",
"signature": "def load(cls, **kwargs) -> Any"
}
] | 2 | null | Implement the Python class `BaseSavePattern` described below.
Class description:
Base class for save patterns (registered wrappers for the collection of serializers and deserializers)
Method signatures and docstrings:
- def save(cls, **kwargs) -> Dict[str, str]: Routine to iterate through serializers returning the fi... | Implement the Python class `BaseSavePattern` described below.
Class description:
Base class for save patterns (registered wrappers for the collection of serializers and deserializers)
Method signatures and docstrings:
- def save(cls, **kwargs) -> Dict[str, str]: Routine to iterate through serializers returning the fi... | c7cdf1fa90b373025da48aa85bf9f0d3792ce494 | <|skeleton|>
class BaseSavePattern:
"""Base class for save patterns (registered wrappers for the collection of serializers and deserializers)"""
def save(cls, **kwargs) -> Dict[str, str]:
"""Routine to iterate through serializers returning the final metadata"""
<|body_0|>
def load(cls, **k... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseSavePattern:
"""Base class for save patterns (registered wrappers for the collection of serializers and deserializers)"""
def save(cls, **kwargs) -> Dict[str, str]:
"""Routine to iterate through serializers returning the final metadata"""
if not cls.serializers:
raise Valu... | the_stack_v2_python_sparse | simpleml/save_patterns/base.py | eyadgaran/SimpleML | train | 15 |
4b329e510d6098851dd3c76c8716ab4018867840 | [
"n = len(nums)\nM = [0] * (n + 1)\nif n == 0:\n return 0\nM[0] = 0\nM[1] = nums[0]\nfor i in range(2, n + 1):\n M[i] = max(nums[i - 1] + M[i - 2], M[i - 1])\nreturn M[-1]",
"prev = 0\ncurr = 0\nfor i in nums:\n prev, curr = (curr, max(curr, prev + i))\nreturn curr",
"n = len(nums)\ndp_i_1 = 0\ndp_i_2 =... | <|body_start_0|>
n = len(nums)
M = [0] * (n + 1)
if n == 0:
return 0
M[0] = 0
M[1] = nums[0]
for i in range(2, n + 1):
M[i] = max(nums[i - 1] + M[i - 2], M[i - 1])
return M[-1]
<|end_body_0|>
<|body_start_1|>
prev = 0
curr ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_36k_train_009862 | 1,312 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "rob",
"signature": "def rob(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "rob",
"signature": "def rob(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "rob",... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums): :type nums: List[int] :rtype: int
- def rob(self, nums): :type nums: List[int] :rtype: int
- def rob(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums): :type nums: List[int] :rtype: int
- def rob(self, nums): :type nums: List[int] :rtype: int
- def rob(self, nums): :type nums: List[int] :rtype: int
<|skelet... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
n = len(nums)
M = [0] * (n + 1)
if n == 0:
return 0
M[0] = 0
M[1] = nums[0]
for i in range(2, n + 1):
M[i] = max(nums[i - 1] + M[i - 2], M[i - 1])
retu... | the_stack_v2_python_sparse | 0198_House_Robber.py | bingli8802/leetcode | train | 0 | |
41b44cac92de3f1aa433899ea01e50de763d0fb6 | [
"if not head:\n return True\nstack = []\ncur_node = head\nwhile cur_node:\n stack.append(cur_node)\n cur_node = cur_node.next\nwhile head:\n last_node = stack.pop()\n if last_node.val != head.val:\n return False\n head = head.next\nreturn True",
"if not head or not head.next:\n return ... | <|body_start_0|>
if not head:
return True
stack = []
cur_node = head
while cur_node:
stack.append(cur_node)
cur_node = cur_node.next
while head:
last_node = stack.pop()
if last_node.val != head.val:
retur... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
"""使用辅助栈,时间复杂度O(N),空间复杂度O(N) :param head: :return:"""
<|body_0|>
def isPalindrome1(self, head: ListNode) -> bool:
"""使用快慢指针,边遍历,边翻转前面的链表,然后对比 :param head: :return:"""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_009863 | 1,789 | no_license | [
{
"docstring": "使用辅助栈,时间复杂度O(N),空间复杂度O(N) :param head: :return:",
"name": "isPalindrome",
"signature": "def isPalindrome(self, head: ListNode) -> bool"
},
{
"docstring": "使用快慢指针,边遍历,边翻转前面的链表,然后对比 :param head: :return:",
"name": "isPalindrome1",
"signature": "def isPalindrome1(self, head:... | 2 | stack_v2_sparse_classes_30k_train_001531 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head: ListNode) -> bool: 使用辅助栈,时间复杂度O(N),空间复杂度O(N) :param head: :return:
- def isPalindrome1(self, head: ListNode) -> bool: 使用快慢指针,边遍历,边翻转前面的链表,然后对比 :param... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head: ListNode) -> bool: 使用辅助栈,时间复杂度O(N),空间复杂度O(N) :param head: :return:
- def isPalindrome1(self, head: ListNode) -> bool: 使用快慢指针,边遍历,边翻转前面的链表,然后对比 :param... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
"""使用辅助栈,时间复杂度O(N),空间复杂度O(N) :param head: :return:"""
<|body_0|>
def isPalindrome1(self, head: ListNode) -> bool:
"""使用快慢指针,边遍历,边翻转前面的链表,然后对比 :param head: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isPalindrome(self, head: ListNode) -> bool:
"""使用辅助栈,时间复杂度O(N),空间复杂度O(N) :param head: :return:"""
if not head:
return True
stack = []
cur_node = head
while cur_node:
stack.append(cur_node)
cur_node = cur_node.next
... | the_stack_v2_python_sparse | datastructure/linked_list/IsPalindrome.py | yinhuax/leet_code | train | 0 | |
b8a426901a09079d426d5f95a4421443ff6b8370 | [
"self.host = host\nself.username = username\nself.password = password\nself.controller_unique_id = None\nself.director_bearer_token = None\nself.hass = hass",
"try:\n account_session = aiohttp_client.async_get_clientsession(self.hass)\n account = C4Account(self.username, self.password, account_session)\n ... | <|body_start_0|>
self.host = host
self.username = username
self.password = password
self.controller_unique_id = None
self.director_bearer_token = None
self.hass = hass
<|end_body_0|>
<|body_start_1|>
try:
account_session = aiohttp_client.async_get_cli... | Validates that config details can be used to authenticate and communicate with Control4. | Control4Validator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Control4Validator:
"""Validates that config details can be used to authenticate and communicate with Control4."""
def __init__(self, host, username, password, hass):
"""Initialize."""
<|body_0|>
async def authenticate(self) -> bool:
"""Test if we can authenticate... | stack_v2_sparse_classes_36k_train_009864 | 6,150 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, host, username, password, hass)"
},
{
"docstring": "Test if we can authenticate with the Control4 account API.",
"name": "authenticate",
"signature": "async def authenticate(self) -> bool"
},
{
"do... | 3 | null | Implement the Python class `Control4Validator` described below.
Class description:
Validates that config details can be used to authenticate and communicate with Control4.
Method signatures and docstrings:
- def __init__(self, host, username, password, hass): Initialize.
- async def authenticate(self) -> bool: Test i... | Implement the Python class `Control4Validator` described below.
Class description:
Validates that config details can be used to authenticate and communicate with Control4.
Method signatures and docstrings:
- def __init__(self, host, username, password, hass): Initialize.
- async def authenticate(self) -> bool: Test i... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class Control4Validator:
"""Validates that config details can be used to authenticate and communicate with Control4."""
def __init__(self, host, username, password, hass):
"""Initialize."""
<|body_0|>
async def authenticate(self) -> bool:
"""Test if we can authenticate... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Control4Validator:
"""Validates that config details can be used to authenticate and communicate with Control4."""
def __init__(self, host, username, password, hass):
"""Initialize."""
self.host = host
self.username = username
self.password = password
self.controlle... | the_stack_v2_python_sparse | homeassistant/components/control4/config_flow.py | home-assistant/core | train | 35,501 |
3e2ad75d472cc97b690e376f67c7b3f1f33a31ef | [
"super().__init__(coordinator, vehicle)\nself.entity_description = description\nself._attr_unique_id = f'{vehicle.vin}-{description.key}'\nif description.dynamic_options:\n self._attr_options = description.dynamic_options(vehicle)\nself._attr_current_option = description.current_option(vehicle)",
"_LOGGER.debu... | <|body_start_0|>
super().__init__(coordinator, vehicle)
self.entity_description = description
self._attr_unique_id = f'{vehicle.vin}-{description.key}'
if description.dynamic_options:
self._attr_options = description.dynamic_options(vehicle)
self._attr_current_option ... | Representation of BMW select entity. | BMWSelect | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BMWSelect:
"""Representation of BMW select entity."""
def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSelectEntityDescription) -> None:
"""Initialize an BMW select."""
<|body_0|>
def _handle_coordinator_update(self) -> Non... | stack_v2_sparse_classes_36k_train_009865 | 4,851 | permissive | [
{
"docstring": "Initialize an BMW select.",
"name": "__init__",
"signature": "def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSelectEntityDescription) -> None"
},
{
"docstring": "Handle updated data from the coordinator.",
"name": "_handle_coo... | 3 | null | Implement the Python class `BMWSelect` described below.
Class description:
Representation of BMW select entity.
Method signatures and docstrings:
- def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSelectEntityDescription) -> None: Initialize an BMW select.
- def _handle... | Implement the Python class `BMWSelect` described below.
Class description:
Representation of BMW select entity.
Method signatures and docstrings:
- def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSelectEntityDescription) -> None: Initialize an BMW select.
- def _handle... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class BMWSelect:
"""Representation of BMW select entity."""
def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSelectEntityDescription) -> None:
"""Initialize an BMW select."""
<|body_0|>
def _handle_coordinator_update(self) -> Non... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BMWSelect:
"""Representation of BMW select entity."""
def __init__(self, coordinator: BMWDataUpdateCoordinator, vehicle: MyBMWVehicle, description: BMWSelectEntityDescription) -> None:
"""Initialize an BMW select."""
super().__init__(coordinator, vehicle)
self.entity_description =... | the_stack_v2_python_sparse | homeassistant/components/bmw_connected_drive/select.py | home-assistant/core | train | 35,501 |
810b9cbc5966d79143e3cbc15350517a7940fa6a | [
"threading.Thread.__init__(self)\nself.f2run = f\nself.results = None\nself.list_of_params = list_of_params",
"self.results = []\nfor params in self.list_of_params:\n l, p = (params, {}) if len(params) else params\n self.results.append(self.f2run(*l, **p))",
"th = []\nsplit = [list_of_params[i::nbthread] ... | <|body_start_0|>
threading.Thread.__init__(self)
self.f2run = f
self.results = None
self.list_of_params = list_of_params
<|end_body_0|>
<|body_start_1|>
self.results = []
for params in self.list_of_params:
l, p = (params, {}) if len(params) else params
... | Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste. | ParallelThread | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParallelThread:
"""Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste."""
def __init__(self, f, list_of_params):
"""Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter"""
<|body_0|... | stack_v2_sparse_classes_36k_train_009866 | 2,408 | permissive | [
{
"docstring": "Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter",
"name": "__init__",
"signature": "def __init__(self, f, list_of_params)"
},
{
"docstring": "Appelle une fonction plusieurs sur tous les paramètres dans une liste.",
"name": "run"... | 3 | stack_v2_sparse_classes_30k_train_005076 | Implement the Python class `ParallelThread` described below.
Class description:
Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste.
Method signatures and docstrings:
- def __init__(self, f, list_of_params): Constructeur @param f fonction à exécuter @param list_of_pa... | Implement the Python class `ParallelThread` described below.
Class description:
Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste.
Method signatures and docstrings:
- def __init__(self, f, list_of_params): Constructeur @param f fonction à exécuter @param list_of_pa... | 2abbc7a20c7437f9ab91d1ec83a6aecdefceb028 | <|skeleton|>
class ParallelThread:
"""Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste."""
def __init__(self, f, list_of_params):
"""Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter"""
<|body_0|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParallelThread:
"""Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste."""
def __init__(self, f, list_of_params):
"""Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter"""
threading.Thread.__ini... | the_stack_v2_python_sparse | src/ensae_teaching_cs/td_2a/parallel_thread.py | Pandinosaurus/ensae_teaching_cs | train | 1 |
d3ea9f8f1fc820f5b52e7ac2a02a07b50977025c | [
"self.save_path = save_path\nself.val = None\nsuper().__init__(name, path, func)",
"state_exist = os.path.exists(self.state_file)\nif force_run or state_exist == 0:\n print('Start running {}'.format(self.name))\n with open(self.state_file, 'w') as f:\n f.write('Incomplete\\n')\n self.val = self.fu... | <|body_start_0|>
self.save_path = save_path
self.val = None
super().__init__(name, path, func)
<|end_body_0|>
<|body_start_1|>
state_exist = os.path.exists(self.state_file)
if force_run or state_exist == 0:
print('Start running {}'.format(self.name))
with... | Compute value for the given function, save value Return the value if already exists | ValueComputeProcess | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValueComputeProcess:
"""Compute value for the given function, save value Return the value if already exists"""
def __init__(self, name, path, save_path, func=None):
""":param name:name of the process, this will be used for the state file name :param path: path to where the state file... | stack_v2_sparse_classes_36k_train_009867 | 4,472 | permissive | [
{
"docstring": ":param name:name of the process, this will be used for the state file name :param path: path to where the state file will be stored :param save_path: path to save the computed value :param func: process function, if None then it will be child class's process() function",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_003812 | Implement the Python class `ValueComputeProcess` described below.
Class description:
Compute value for the given function, save value Return the value if already exists
Method signatures and docstrings:
- def __init__(self, name, path, save_path, func=None): :param name:name of the process, this will be used for the ... | Implement the Python class `ValueComputeProcess` described below.
Class description:
Compute value for the given function, save value Return the value if already exists
Method signatures and docstrings:
- def __init__(self, name, path, save_path, func=None): :param name:name of the process, this will be used for the ... | b784b9685fcc5137b5c6a928a820146f4b58037c | <|skeleton|>
class ValueComputeProcess:
"""Compute value for the given function, save value Return the value if already exists"""
def __init__(self, name, path, save_path, func=None):
""":param name:name of the process, this will be used for the state file name :param path: path to where the state file... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValueComputeProcess:
"""Compute value for the given function, save value Return the value if already exists"""
def __init__(self, name, path, save_path, func=None):
""":param name:name of the process, this will be used for the state file name :param path: path to where the state file will be stor... | the_stack_v2_python_sparse | mrs_utils/process_block.py | aneeshgupta42/mrs | train | 1 |
b25407a927ef3ff17c653f2d33de522a0d9eba85 | [
"if self.classification_head is None:\n init.initialize_decoder(self.decoder)\n init.initialize_head(self.segmentation_head)\nelse:\n init.initialize_head(self.classification_head)",
"features = self.encoder(x)\nif self.classification_head is None:\n decoder_output = self.decoder(*features)\n masks... | <|body_start_0|>
if self.classification_head is None:
init.initialize_decoder(self.decoder)
init.initialize_head(self.segmentation_head)
else:
init.initialize_head(self.classification_head)
<|end_body_0|>
<|body_start_1|>
features = self.encoder(x)
if... | This class defines a segmentation model. It takes an input tensor and sequentially passes it through the model's encoder, decoder and heads. Methods: initialize: Initializes the model's classification or segmentation head forward: Sequentially passes the input tensor through the model's encoder, decoder, and heads and ... | SegmentationModel | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegmentationModel:
"""This class defines a segmentation model. It takes an input tensor and sequentially passes it through the model's encoder, decoder and heads. Methods: initialize: Initializes the model's classification or segmentation head forward: Sequentially passes the input tensor through... | stack_v2_sparse_classes_36k_train_009868 | 11,765 | permissive | [
{
"docstring": "This function initializes the model's classification or segmentation head.",
"name": "initialize",
"signature": "def initialize(self)"
},
{
"docstring": "This function sequentially passes the input tensor through the model's encoder, decoder, and heads and returns either the segm... | 2 | null | Implement the Python class `SegmentationModel` described below.
Class description:
This class defines a segmentation model. It takes an input tensor and sequentially passes it through the model's encoder, decoder and heads. Methods: initialize: Initializes the model's classification or segmentation head forward: Seque... | Implement the Python class `SegmentationModel` described below.
Class description:
This class defines a segmentation model. It takes an input tensor and sequentially passes it through the model's encoder, decoder and heads. Methods: initialize: Initializes the model's classification or segmentation head forward: Seque... | 72eb99f68205afd5f8d49a3bb6cfc08cfd467582 | <|skeleton|>
class SegmentationModel:
"""This class defines a segmentation model. It takes an input tensor and sequentially passes it through the model's encoder, decoder and heads. Methods: initialize: Initializes the model's classification or segmentation head forward: Sequentially passes the input tensor through... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SegmentationModel:
"""This class defines a segmentation model. It takes an input tensor and sequentially passes it through the model's encoder, decoder and heads. Methods: initialize: Initializes the model's classification or segmentation head forward: Sequentially passes the input tensor through the model's ... | the_stack_v2_python_sparse | GANDLF/models/imagenet_unet.py | mlcommons/GaNDLF | train | 45 |
3551c829cbca26f95435793357a9b4b9348c7ce6 | [
"def rserialize(root, s):\n if root is None:\n s += 'None,'\n else:\n s += str(root.val) + ','\n s = rserialize(root.left, s)\n s = rserialize(root.right, s)\n return s\nreturn rserialize(root, '')",
"def rdeserialize(l):\n if l[0] == 'None':\n l.pop(0)\n retu... | <|body_start_0|>
def rserialize(root, s):
if root is None:
s += 'None,'
else:
s += str(root.val) + ','
s = rserialize(root.left, s)
s = rserialize(root.right, s)
return s
return rserialize(root, '')
<|end... | 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_009869 | 1,868 | 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_003786 | 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:... | 9b96135d9ddbff97dff31ddecd9994aa41cddcce | <|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"""
def rserialize(root, s):
if root is None:
s += 'None,'
else:
s += str(root.val) + ','
s = rserialize(root.left, s)... | the_stack_v2_python_sparse | Week 02/id_472/泛型递归/LeetCode_297_472.py | lvguichen1/algorithm004-02 | train | 0 | |
236ddb347c2166bcd486d6ccca97f3cdb6cee3a9 | [
"def _call_manage_main(self):\n self.setRoles(['Manager'])\n endInteraction()\n response = self.publish(f'/{Testing.ZopeTestCase.folder_name}/manage_main', basic=basic_auth)\n return str(response)\nreturn temporaryPlacelessSetUp(_call_manage_main, required_zcml=setupZCML)(self)",
"from .subscriber imp... | <|body_start_0|>
def _call_manage_main(self):
self.setRoles(['Manager'])
endInteraction()
response = self.publish(f'/{Testing.ZopeTestCase.folder_name}/manage_main', basic=basic_auth)
return str(response)
return temporaryPlacelessSetUp(_call_manage_main, r... | Testing .subscriber.* | SubscriberTests | [
"ZPL-2.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubscriberTests:
"""Testing .subscriber.*"""
def call_manage_main(self):
"""Call /folder/manage_main and return the HTML text."""
<|body_0|>
def test_subscriber__css_paths__1(self):
"""The paths it returns are rendered in the ZMI."""
<|body_1|>
def t... | stack_v2_sparse_classes_36k_train_009870 | 1,855 | permissive | [
{
"docstring": "Call /folder/manage_main and return the HTML text.",
"name": "call_manage_main",
"signature": "def call_manage_main(self)"
},
{
"docstring": "The paths it returns are rendered in the ZMI.",
"name": "test_subscriber__css_paths__1",
"signature": "def test_subscriber__css_pa... | 3 | stack_v2_sparse_classes_30k_train_004015 | Implement the Python class `SubscriberTests` described below.
Class description:
Testing .subscriber.*
Method signatures and docstrings:
- def call_manage_main(self): Call /folder/manage_main and return the HTML text.
- def test_subscriber__css_paths__1(self): The paths it returns are rendered in the ZMI.
- def test_... | Implement the Python class `SubscriberTests` described below.
Class description:
Testing .subscriber.*
Method signatures and docstrings:
- def call_manage_main(self): Call /folder/manage_main and return the HTML text.
- def test_subscriber__css_paths__1(self): The paths it returns are rendered in the ZMI.
- def test_... | c31b1c635e85a1766f2666cb0bd117337ae5fa67 | <|skeleton|>
class SubscriberTests:
"""Testing .subscriber.*"""
def call_manage_main(self):
"""Call /folder/manage_main and return the HTML text."""
<|body_0|>
def test_subscriber__css_paths__1(self):
"""The paths it returns are rendered in the ZMI."""
<|body_1|>
def t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubscriberTests:
"""Testing .subscriber.*"""
def call_manage_main(self):
"""Call /folder/manage_main and return the HTML text."""
def _call_manage_main(self):
self.setRoles(['Manager'])
endInteraction()
response = self.publish(f'/{Testing.ZopeTestCase.f... | the_stack_v2_python_sparse | src/zmi/styles/tests.py | zopefoundation/Zope | train | 335 |
55c8c9412db5ea14ece1d3ff34f511f6f50b6fc6 | [
"super(PartialWriter, self).__init__(cmd_tlm_data, deployment_name, cosmos_directory)\nself.overwrite_destinations = {cosmos_directory + '/config/targets/' + deployment_name.upper() + '/cmd_tlm/channels/_' + deployment_name.lower() + '_tlm_chn_hdr.txt': Partial_Channel.Partial_Channel(), cosmos_directory + '/config... | <|body_start_0|>
super(PartialWriter, self).__init__(cmd_tlm_data, deployment_name, cosmos_directory)
self.overwrite_destinations = {cosmos_directory + '/config/targets/' + deployment_name.upper() + '/cmd_tlm/channels/_' + deployment_name.lower() + '_tlm_chn_hdr.txt': Partial_Channel.Partial_Channel(), ... | This class generates each of the files that the user must input their own data into: _tlm_chn_hdr.txt: Channel header file that contains all shared channel definition fields _cmds_hdr.txt: Command header file that contains all shared command definition fields _tlm_evr_hdr.txt: Event header file that contains all shared... | PartialWriter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PartialWriter:
"""This class generates each of the files that the user must input their own data into: _tlm_chn_hdr.txt: Channel header file that contains all shared channel definition fields _cmds_hdr.txt: Command header file that contains all shared command definition fields _tlm_evr_hdr.txt: E... | stack_v2_sparse_classes_36k_train_009871 | 4,229 | permissive | [
{
"docstring": "@param cmd_tlm_data: Tuple containing lists channels [0], commands [1], and events [2] @param deployment_name: name of the COSMOS target @param cosmos_directory: Directory of COSMOS",
"name": "__init__",
"signature": "def __init__(self, cmd_tlm_data, deployment_name, cosmos_directory)"
... | 2 | stack_v2_sparse_classes_30k_train_020754 | Implement the Python class `PartialWriter` described below.
Class description:
This class generates each of the files that the user must input their own data into: _tlm_chn_hdr.txt: Channel header file that contains all shared channel definition fields _cmds_hdr.txt: Command header file that contains all shared comman... | Implement the Python class `PartialWriter` described below.
Class description:
This class generates each of the files that the user must input their own data into: _tlm_chn_hdr.txt: Channel header file that contains all shared channel definition fields _cmds_hdr.txt: Command header file that contains all shared comman... | d19cade2140231b4e0879b2f6ab4a62b25792dea | <|skeleton|>
class PartialWriter:
"""This class generates each of the files that the user must input their own data into: _tlm_chn_hdr.txt: Channel header file that contains all shared channel definition fields _cmds_hdr.txt: Command header file that contains all shared command definition fields _tlm_evr_hdr.txt: E... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PartialWriter:
"""This class generates each of the files that the user must input their own data into: _tlm_chn_hdr.txt: Channel header file that contains all shared channel definition fields _cmds_hdr.txt: Command header file that contains all shared command definition fields _tlm_evr_hdr.txt: Event header f... | the_stack_v2_python_sparse | Autocoders/Python/src/fprime_ac/utils/cosmos/writers/PartialWriter.py | nodcah/fprime | train | 0 |
6bb3a6af1918e758cbf658153216b44379908713 | [
"token = self.dumps({'id': str(obj_id), 'data': extra_data, 'random': secrets.token_hex(16)})\nif isinstance(token, bytes):\n token = token.decode('utf8')\nreturn token",
"try:\n data = self.load_token(token, force=force)\n expected_data = expected_data or {}\n for k, v in expected_data.items():\n ... | <|body_start_0|>
token = self.dumps({'id': str(obj_id), 'data': extra_data, 'random': secrets.token_hex(16)})
if isinstance(token, bytes):
token = token.decode('utf8')
return token
<|end_body_0|>
<|body_start_1|>
try:
data = self.load_token(token, force=force)
... | Mix-in class for token serializers. The tokens store a reference to some object (e.g. SecretLinks) via an ID, and they can hold additional data. Through the addition of a random value in the token, it is (almost) ensured that any two generated tokens are different, even when generated with otherwise identical data. | TokenSerializerMixin | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TokenSerializerMixin:
"""Mix-in class for token serializers. The tokens store a reference to some object (e.g. SecretLinks) via an ID, and they can hold additional data. Through the addition of a random value in the token, it is (almost) ensured that any two generated tokens are different, even w... | stack_v2_sparse_classes_36k_train_009872 | 3,886 | permissive | [
{
"docstring": "Create a token referencing the object id with extra data. Note: random data is added to ensure that no two tokens are identical.",
"name": "create_token",
"signature": "def create_token(self, obj_id, extra_data=dict())"
},
{
"docstring": "Load and validate secret link token. :par... | 3 | null | Implement the Python class `TokenSerializerMixin` described below.
Class description:
Mix-in class for token serializers. The tokens store a reference to some object (e.g. SecretLinks) via an ID, and they can hold additional data. Through the addition of a random value in the token, it is (almost) ensured that any two... | Implement the Python class `TokenSerializerMixin` described below.
Class description:
Mix-in class for token serializers. The tokens store a reference to some object (e.g. SecretLinks) via an ID, and they can hold additional data. Through the addition of a random value in the token, it is (almost) ensured that any two... | b4bcc2e16df6048149177a6e1ebd514bdb6b0626 | <|skeleton|>
class TokenSerializerMixin:
"""Mix-in class for token serializers. The tokens store a reference to some object (e.g. SecretLinks) via an ID, and they can hold additional data. Through the addition of a random value in the token, it is (almost) ensured that any two generated tokens are different, even w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TokenSerializerMixin:
"""Mix-in class for token serializers. The tokens store a reference to some object (e.g. SecretLinks) via an ID, and they can hold additional data. Through the addition of a random value in the token, it is (almost) ensured that any two generated tokens are different, even when generated... | the_stack_v2_python_sparse | invenio_rdm_records/secret_links/serializers.py | ppanero/invenio-rdm-records | train | 0 |
5681ba3edd8f47f054dea9bd80e9efe677df5b8c | [
"self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]",
"x_direction = choice([-1, 1])\nx_distance = choice([0, 1, 2, 3, 4])\nself.x_step = x_direction * x_distance\ny_direction = choice([-1, 1])\ny_distance = choice([0, 1, 2, 3, 4])\nself.y_step = y_direction * y_distance",
"while len(self.x_... | <|body_start_0|>
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
<|end_body_0|>
<|body_start_1|>
x_direction = choice([-1, 1])
x_distance = choice([0, 1, 2, 3, 4])
self.x_step = x_direction * x_distance
y_direction = choice([-1, 1])
y... | in the class we are trying to get x and y co-ordinates. | RandomWalk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWalk:
"""in the class we are trying to get x and y co-ordinates."""
def __init__(self, num_points=5000):
"""we define some useful attribute throught code."""
<|body_0|>
def get_step(self):
"""in this method we do some calculation for x and y co-ordinates.""... | stack_v2_sparse_classes_36k_train_009873 | 1,314 | no_license | [
{
"docstring": "we define some useful attribute throught code.",
"name": "__init__",
"signature": "def __init__(self, num_points=5000)"
},
{
"docstring": "in this method we do some calculation for x and y co-ordinates.",
"name": "get_step",
"signature": "def get_step(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_017128 | Implement the Python class `RandomWalk` described below.
Class description:
in the class we are trying to get x and y co-ordinates.
Method signatures and docstrings:
- def __init__(self, num_points=5000): we define some useful attribute throught code.
- def get_step(self): in this method we do some calculation for x ... | Implement the Python class `RandomWalk` described below.
Class description:
in the class we are trying to get x and y co-ordinates.
Method signatures and docstrings:
- def __init__(self, num_points=5000): we define some useful attribute throught code.
- def get_step(self): in this method we do some calculation for x ... | eb40f515564fe781eaaf5202165e06be6b22b34d | <|skeleton|>
class RandomWalk:
"""in the class we are trying to get x and y co-ordinates."""
def __init__(self, num_points=5000):
"""we define some useful attribute throught code."""
<|body_0|>
def get_step(self):
"""in this method we do some calculation for x and y co-ordinates.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomWalk:
"""in the class we are trying to get x and y co-ordinates."""
def __init__(self, num_points=5000):
"""we define some useful attribute throught code."""
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def get_step(self):
"""in t... | the_stack_v2_python_sparse | matplotlibpractice/randomwalk_plotly.py | noshah/Python_Practice | train | 0 |
ed567eeee35fa9260888599dd67d1019f28d03d4 | [
"self._grid = grid\nself.runoff_rate = runoff_rate / 3600000.0\nself.vel_coef = 1.0 / roughness\nself.changing_topo = changing_topo\nself.depth_exp = depth_exp\nself.weight = weight\ntry:\n self.elev = grid.at_node['topographic__elevation']\nexcept:\n raise\nif 'surface_water__depth' in grid.at_node:\n sel... | <|body_start_0|>
self._grid = grid
self.runoff_rate = runoff_rate / 3600000.0
self.vel_coef = 1.0 / roughness
self.changing_topo = changing_topo
self.depth_exp = depth_exp
self.weight = weight
try:
self.elev = grid.at_node['topographic__elevation']
... | Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, and works as follows. At each time step, we iterate from ... | KinwaveImplicitOverlandFlow | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KinwaveImplicitOverlandFlow:
"""Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, an... | stack_v2_sparse_classes_36k_train_009874 | 14,450 | permissive | [
{
"docstring": "Initialize the KinwaveOverlandFlowModel. Parameters ---------- grid : ModelGrid Landlab ModelGrid object runoff_rate : float, optional (defaults to 1 mm/hr) Precipitation rate, mm/hr roughnes : float, defaults to 0.01 Manning roughness coefficient, s/m^1/3 changing_topo : boolean, optional (defa... | 2 | stack_v2_sparse_classes_30k_train_009012 | Implement the Python class `KinwaveImplicitOverlandFlow` described below.
Class description:
Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The ... | Implement the Python class `KinwaveImplicitOverlandFlow` described below.
Class description:
Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The ... | 8c8613f8b8653906c1497f6557dd2a0bc555a79a | <|skeleton|>
class KinwaveImplicitOverlandFlow:
"""Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, an... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KinwaveImplicitOverlandFlow:
"""Calculate shallow water flow over topography. Landlab component that implements a two-dimensional kinematic wave model. This is a form of the 2D shallow-water equations in which energy slope is assumed to equal bed slope. The solution method is locally implicit, and works as fo... | the_stack_v2_python_sparse | landlab/components/overland_flow/generate_overland_flow_implicit_kinwave.py | RondaStrauch/landlab | train | 2 |
807adff37fd9c036da645c3db7a1ba8df2a2ea0d | [
"super(Lexer, self).__init__(TOKENS, TokenNamespace)\nif t_regexp is None:\n unique = {}\n for token in tokens:\n token.compile(alphabet)\n self._debug(format('Token: {0}', token))\n unique[token.id_] = token\n t_regexp = Compiler.multiple(alphabet, [(t.id_, t.regexp) for t in unique.v... | <|body_start_0|>
super(Lexer, self).__init__(TOKENS, TokenNamespace)
if t_regexp is None:
unique = {}
for token in tokens:
token.compile(alphabet)
self._debug(format('Token: {0}', token))
unique[token.id_] = token
t_rege... | This takes a set of regular expressions and provides a matcher that converts a stream into a stream of tokens, passing the new stream to the embedded matcher. It is added to the matcher graph by the lexer_rewriter; it is not specified explicitly by the user. | Lexer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lexer:
"""This takes a set of regular expressions and provides a matcher that converts a stream into a stream of tokens, passing the new stream to the embedded matcher. It is added to the matcher graph by the lexer_rewriter; it is not specified explicitly by the user."""
def __init__(self, m... | stack_v2_sparse_classes_36k_train_009875 | 15,248 | permissive | [
{
"docstring": "matcher is the head of the original matcher graph, which will be called with a tokenised stream. tokens is the set of `Token` instances that define the lexer. alphabet is the alphabet for which the regexps are defined. discard is the regular expression for spaces (which are silently dropped if n... | 3 | stack_v2_sparse_classes_30k_train_005975 | Implement the Python class `Lexer` described below.
Class description:
This takes a set of regular expressions and provides a matcher that converts a stream into a stream of tokens, passing the new stream to the embedded matcher. It is added to the matcher graph by the lexer_rewriter; it is not specified explicitly by... | Implement the Python class `Lexer` described below.
Class description:
This takes a set of regular expressions and provides a matcher that converts a stream into a stream of tokens, passing the new stream to the embedded matcher. It is added to the matcher graph by the lexer_rewriter; it is not specified explicitly by... | 84386a0a82c8d657f8bb57aa0399fc251fa581c3 | <|skeleton|>
class Lexer:
"""This takes a set of regular expressions and provides a matcher that converts a stream into a stream of tokens, passing the new stream to the embedded matcher. It is added to the matcher graph by the lexer_rewriter; it is not specified explicitly by the user."""
def __init__(self, m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Lexer:
"""This takes a set of regular expressions and provides a matcher that converts a stream into a stream of tokens, passing the new stream to the embedded matcher. It is added to the matcher graph by the lexer_rewriter; it is not specified explicitly by the user."""
def __init__(self, matcher, token... | the_stack_v2_python_sparse | lepl/lexer/matchers.py | alexmac/ifdef-refactor | train | 3 |
32b63916f8b136dc8434985b4526cc7738b85792 | [
"super(ProductLabelsQuery, self)._Initialize()\nself.tables = ['metadata_cube']\nself.fields = ['label', 'value', 'SUM(count) AS count']\nself.groups = ['label', 'value']\nself.orders = ['label', 'value']\nself.reply_processors += [self._ProcessReply]\nself.max_rows = 2000",
"if start_date:\n start_date_expr =... | <|body_start_0|>
super(ProductLabelsQuery, self)._Initialize()
self.tables = ['metadata_cube']
self.fields = ['label', 'value', 'SUM(count) AS count']
self.groups = ['label', 'value']
self.orders = ['label', 'value']
self.reply_processors += [self._ProcessReply]
s... | Returns per-product labels and values usage data. After execution, the 'rows' list will contain dictionaries of labels, values and counts. This raw data will be processed by a LabelManager into a queryable structure. | ProductLabelsQuery | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductLabelsQuery:
"""Returns per-product labels and values usage data. After execution, the 'rows' list will contain dictionaries of labels, values and counts. This raw data will be processed by a LabelManager into a queryable structure."""
def _Initialize(self):
"""Set up the quer... | stack_v2_sparse_classes_36k_train_009876 | 2,732 | permissive | [
{
"docstring": "Set up the query configuration (fields, tables, etc.).",
"name": "_Initialize",
"signature": "def _Initialize(self)"
},
{
"docstring": "Retrieves a list of labels and values for a specific product.",
"name": "Execute",
"signature": "def Execute(self, start_date=None, end_... | 3 | stack_v2_sparse_classes_30k_test_001152 | Implement the Python class `ProductLabelsQuery` described below.
Class description:
Returns per-product labels and values usage data. After execution, the 'rows' list will contain dictionaries of labels, values and counts. This raw data will be processed by a LabelManager into a queryable structure.
Method signatures... | Implement the Python class `ProductLabelsQuery` described below.
Class description:
Returns per-product labels and values usage data. After execution, the 'rows' list will contain dictionaries of labels, values and counts. This raw data will be processed by a LabelManager into a queryable structure.
Method signatures... | 9efa61015d50c25f6d753f0212ad3bf16876d496 | <|skeleton|>
class ProductLabelsQuery:
"""Returns per-product labels and values usage data. After execution, the 'rows' list will contain dictionaries of labels, values and counts. This raw data will be processed by a LabelManager into a queryable structure."""
def _Initialize(self):
"""Set up the quer... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProductLabelsQuery:
"""Returns per-product labels and values usage data. After execution, the 'rows' list will contain dictionaries of labels, values and counts. This raw data will be processed by a LabelManager into a queryable structure."""
def _Initialize(self):
"""Set up the query configurati... | the_stack_v2_python_sparse | server/perfkit/explorer/samples_mart/product_labels.py | GoogleCloudPlatform/PerfKitExplorer | train | 292 |
ea97491740fdb756629ae14602b1db028a3c93fa | [
"leoTkinterDialog.__init__(self, title, resizeable)\nself.text = text\nself.createTopFrame()\nself.top.bind('<Key>', self.onKey)\nif message:\n self.createMessageFrame(message)\nbuttons = ({'text': text, 'command': self.okButton, 'default': True},)\nself.createButtons(buttons)",
"ch = event.char.lower()\nif ch... | <|body_start_0|>
leoTkinterDialog.__init__(self, title, resizeable)
self.text = text
self.createTopFrame()
self.top.bind('<Key>', self.onKey)
if message:
self.createMessageFrame(message)
buttons = ({'text': text, 'command': self.okButton, 'default': True},)
... | A class that creates a Tkinter dialog with a single OK button. | tkinterAskOk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class tkinterAskOk:
"""A class that creates a Tkinter dialog with a single OK button."""
def __init__(self, title, message=None, text='Ok', resizeable=False):
"""Create a dialog with one button"""
<|body_0|>
def onKey(self, event):
"""Handle Key events in askOk dialogs... | stack_v2_sparse_classes_36k_train_009877 | 25,997 | no_license | [
{
"docstring": "Create a dialog with one button",
"name": "__init__",
"signature": "def __init__(self, title, message=None, text='Ok', resizeable=False)"
},
{
"docstring": "Handle Key events in askOk dialogs.",
"name": "onKey",
"signature": "def onKey(self, event)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015140 | Implement the Python class `tkinterAskOk` described below.
Class description:
A class that creates a Tkinter dialog with a single OK button.
Method signatures and docstrings:
- def __init__(self, title, message=None, text='Ok', resizeable=False): Create a dialog with one button
- def onKey(self, event): Handle Key ev... | Implement the Python class `tkinterAskOk` described below.
Class description:
A class that creates a Tkinter dialog with a single OK button.
Method signatures and docstrings:
- def __init__(self, title, message=None, text='Ok', resizeable=False): Create a dialog with one button
- def onKey(self, event): Handle Key ev... | 28c22721e1bc313c120a8a6c288893bc566a5c67 | <|skeleton|>
class tkinterAskOk:
"""A class that creates a Tkinter dialog with a single OK button."""
def __init__(self, title, message=None, text='Ok', resizeable=False):
"""Create a dialog with one button"""
<|body_0|>
def onKey(self, event):
"""Handle Key events in askOk dialogs... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class tkinterAskOk:
"""A class that creates a Tkinter dialog with a single OK button."""
def __init__(self, title, message=None, text='Ok', resizeable=False):
"""Create a dialog with one button"""
leoTkinterDialog.__init__(self, title, resizeable)
self.text = text
self.createTop... | the_stack_v2_python_sparse | Projects/jyleo/src/leoTkinterDialog.py | leo-editor/leo-editor-contrib | train | 6 |
a99a8e8c09b185f759efbb412535fbb286bbb67a | [
"with qdb.sql_connection.TRN:\n artifact = _get_artifact(artifact_id)\n study = artifact.study\n analysis = artifact.analysis\n response = {'name': artifact.name, 'timestamp': str(artifact.timestamp), 'visibility': artifact.visibility, 'type': artifact.artifact_type, 'data_type': artifact.data_type, 'ca... | <|body_start_0|>
with qdb.sql_connection.TRN:
artifact = _get_artifact(artifact_id)
study = artifact.study
analysis = artifact.analysis
response = {'name': artifact.name, 'timestamp': str(artifact.timestamp), 'visibility': artifact.visibility, 'type': artifact.art... | ArtifactHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArtifactHandler:
def get(self, artifact_id):
"""Retrieves the artifact information Parameters ---------- artifact_id : str The id of the artifact whose information is being retrieved Returns ------- dict The artifact information: 'name': artifact name 'timestamp': artifact creation times... | stack_v2_sparse_classes_36k_train_009878 | 8,483 | permissive | [
{
"docstring": "Retrieves the artifact information Parameters ---------- artifact_id : str The id of the artifact whose information is being retrieved Returns ------- dict The artifact information: 'name': artifact name 'timestamp': artifact creation timestamp 'visibility': artifact visibility 'type': artifact ... | 2 | null | Implement the Python class `ArtifactHandler` described below.
Class description:
Implement the ArtifactHandler class.
Method signatures and docstrings:
- def get(self, artifact_id): Retrieves the artifact information Parameters ---------- artifact_id : str The id of the artifact whose information is being retrieved R... | Implement the Python class `ArtifactHandler` described below.
Class description:
Implement the ArtifactHandler class.
Method signatures and docstrings:
- def get(self, artifact_id): Retrieves the artifact information Parameters ---------- artifact_id : str The id of the artifact whose information is being retrieved R... | 2c05960d712593368237c7c4efe9606a7919f892 | <|skeleton|>
class ArtifactHandler:
def get(self, artifact_id):
"""Retrieves the artifact information Parameters ---------- artifact_id : str The id of the artifact whose information is being retrieved Returns ------- dict The artifact information: 'name': artifact name 'timestamp': artifact creation times... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArtifactHandler:
def get(self, artifact_id):
"""Retrieves the artifact information Parameters ---------- artifact_id : str The id of the artifact whose information is being retrieved Returns ------- dict The artifact information: 'name': artifact name 'timestamp': artifact creation timestamp 'visibili... | the_stack_v2_python_sparse | qiita_db/handlers/artifact.py | yotohoshi/qiita | train | 2 | |
2d1f12bafaf2f46d5a0e394435f9da2eefa1eaa6 | [
"search = data.get('search', None)\noffset = int(data.get('offset', 0))\nlimit = int(data.get('limit', 0))\ntime_from = int(data.get('from', 0))\ntime_until = int(data.get('until', 0))\nstatus = data.get('status', None)\ntitle = data.get('title', None)\ndevice_id = data.get('device_id', None)\nalert_id = data.get('... | <|body_start_0|>
search = data.get('search', None)
offset = int(data.get('offset', 0))
limit = int(data.get('limit', 0))
time_from = int(data.get('from', 0))
time_until = int(data.get('until', 0))
status = data.get('status', None)
title = data.get('title', None)
... | AlertsHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlertsHandler:
def do_get(self, data):
"""获取告警"""
<|body_0|>
def do_put(self, data):
"""确认告警"""
<|body_1|>
def do_delete(self, data):
"""关闭告警"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
search = data.get('search', None)
... | stack_v2_sparse_classes_36k_train_009879 | 6,220 | no_license | [
{
"docstring": "获取告警",
"name": "do_get",
"signature": "def do_get(self, data)"
},
{
"docstring": "确认告警",
"name": "do_put",
"signature": "def do_put(self, data)"
},
{
"docstring": "关闭告警",
"name": "do_delete",
"signature": "def do_delete(self, data)"
}
] | 3 | stack_v2_sparse_classes_30k_train_012879 | Implement the Python class `AlertsHandler` described below.
Class description:
Implement the AlertsHandler class.
Method signatures and docstrings:
- def do_get(self, data): 获取告警
- def do_put(self, data): 确认告警
- def do_delete(self, data): 关闭告警 | Implement the Python class `AlertsHandler` described below.
Class description:
Implement the AlertsHandler class.
Method signatures and docstrings:
- def do_get(self, data): 获取告警
- def do_put(self, data): 确认告警
- def do_delete(self, data): 关闭告警
<|skeleton|>
class AlertsHandler:
def do_get(self, data):
""... | 94dc54ddbacc0282a6339b06e76ed6bf646bcd2b | <|skeleton|>
class AlertsHandler:
def do_get(self, data):
"""获取告警"""
<|body_0|>
def do_put(self, data):
"""确认告警"""
<|body_1|>
def do_delete(self, data):
"""关闭告警"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlertsHandler:
def do_get(self, data):
"""获取告警"""
search = data.get('search', None)
offset = int(data.get('offset', 0))
limit = int(data.get('limit', 0))
time_from = int(data.get('from', 0))
time_until = int(data.get('until', 0))
status = data.get('statu... | the_stack_v2_python_sparse | backend/handlers/alerts.py | alabizz/w2s | train | 0 | |
a382d535819289cbc09352fc4023e17f6cd869e8 | [
"if not nums:\n return\nmax_num = max(nums)\nmax_index = nums.index(max_num)\nroot = TreeNode(max_num)\nroot.left = self.constructMaximumBinaryTree(nums[:max_index])\nroot.right = self.constructMaximumBinaryTree(nums[max_index + 1:])\nreturn root",
"stack = []\nleft = None\nroot = None\nnums.append(float('inf'... | <|body_start_0|>
if not nums:
return
max_num = max(nums)
max_index = nums.index(max_num)
root = TreeNode(max_num)
root.left = self.constructMaximumBinaryTree(nums[:max_index])
root.right = self.constructMaximumBinaryTree(nums[max_index + 1:])
return ro... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _constructMaximumBinaryTree(self, nums):
""":type nums: List[int] :rtype: TreeNode"""
<|body_0|>
def __constructMaximumBinaryTree(self, nums):
""":type nums: List[int] :rtype: TreeNode"""
<|body_1|>
def ___constructMaximumBinaryTree(self, n... | stack_v2_sparse_classes_36k_train_009880 | 4,039 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: TreeNode",
"name": "_constructMaximumBinaryTree",
"signature": "def _constructMaximumBinaryTree(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: TreeNode",
"name": "__constructMaximumBinaryTree",
"signature": "def __constructMaxi... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode
- def __constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode
- def _... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode
- def __constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode
- def _... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _constructMaximumBinaryTree(self, nums):
""":type nums: List[int] :rtype: TreeNode"""
<|body_0|>
def __constructMaximumBinaryTree(self, nums):
""":type nums: List[int] :rtype: TreeNode"""
<|body_1|>
def ___constructMaximumBinaryTree(self, n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _constructMaximumBinaryTree(self, nums):
""":type nums: List[int] :rtype: TreeNode"""
if not nums:
return
max_num = max(nums)
max_index = nums.index(max_num)
root = TreeNode(max_num)
root.left = self.constructMaximumBinaryTree(nums[:max... | the_stack_v2_python_sparse | 654.maximum-binary-tree.py | windard/leeeeee | train | 0 | |
17b3668fb6ab4ac7fb17c82f5516402cbe4ba89b | [
"super(SeqPostProcessor, self).__init__()\nself.word_vocab = word_vocab\nself.tk = tokenizer\nself.dtk = detokenizer\nself.ss = sent_splitter\nself.tc = tcaser\nself.retain_end_token = retain_end_token",
"if self.word_vocab is not None:\n seq = format_seq(seq, start=self.word_vocab[START].id, end=self.word_voc... | <|body_start_0|>
super(SeqPostProcessor, self).__init__()
self.word_vocab = word_vocab
self.tk = tokenizer
self.dtk = detokenizer
self.ss = sent_splitter
self.tc = tcaser
self.retain_end_token = retain_end_token
<|end_body_0|>
<|body_start_1|>
if self.wor... | Post-processes sequences generated by the model to make them human readable. | SeqPostProcessor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SeqPostProcessor:
"""Post-processes sequences generated by the model to make them human readable."""
def __init__(self, word_vocab=None, tokenizer=None, detokenizer=None, sent_splitter=None, tcaser=None, retain_end_token=True):
"""Args: word_vocab: self-explanatory. tokenizer: if pro... | stack_v2_sparse_classes_36k_train_009881 | 2,428 | permissive | [
{
"docstring": "Args: word_vocab: self-explanatory. tokenizer: if provided will tokenize and concatenate input tokens. detokenizer: used to make the sequence look more like human written. sent_splitter: a function that splits a string to sentences. Used for capitalisation of first words if provided. tcaser: a t... | 2 | stack_v2_sparse_classes_30k_train_002414 | Implement the Python class `SeqPostProcessor` described below.
Class description:
Post-processes sequences generated by the model to make them human readable.
Method signatures and docstrings:
- def __init__(self, word_vocab=None, tokenizer=None, detokenizer=None, sent_splitter=None, tcaser=None, retain_end_token=Tru... | Implement the Python class `SeqPostProcessor` described below.
Class description:
Post-processes sequences generated by the model to make them human readable.
Method signatures and docstrings:
- def __init__(self, word_vocab=None, tokenizer=None, detokenizer=None, sent_splitter=None, tcaser=None, retain_end_token=Tru... | ca20e6eb8f93d21f9215a9cbf5a171b56600e3c1 | <|skeleton|>
class SeqPostProcessor:
"""Post-processes sequences generated by the model to make them human readable."""
def __init__(self, word_vocab=None, tokenizer=None, detokenizer=None, sent_splitter=None, tcaser=None, retain_end_token=True):
"""Args: word_vocab: self-explanatory. tokenizer: if pro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SeqPostProcessor:
"""Post-processes sequences generated by the model to make them human readable."""
def __init__(self, word_vocab=None, tokenizer=None, detokenizer=None, sent_splitter=None, tcaser=None, retain_end_token=True):
"""Args: word_vocab: self-explanatory. tokenizer: if provided will to... | the_stack_v2_python_sparse | fewsum/utils/tools/seq_post_processor.py | developerdrone/FewSum | train | 0 |
9d63061cbfe69df19666738569c7fc6629c867a5 | [
"if not l1:\n return l2\nelif not l2:\n return l1\ndummy = ListNode(None)\nnode = dummy\nwhile l1 or l2:\n n1 = l1.val if l1 else float('inf')\n n2 = l2.val if l2 else float('inf')\n node.next = l1 if n1 <= n2 else l2\n l1 = l1.next if n1 <= n2 else l1\n l2 = l2.next if n2 < n1 else l2\n nod... | <|body_start_0|>
if not l1:
return l2
elif not l2:
return l1
dummy = ListNode(None)
node = dummy
while l1 or l2:
n1 = l1.val if l1 else float('inf')
n2 = l2.val if l2 else float('inf')
node.next = l1 if n1 <= n2 else l2
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeTwoLists_v2(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_009882 | 2,317 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists_v2",
"signature": "def mergeTwoLists_v2(self... | 2 | stack_v2_sparse_classes_30k_train_015579 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeTwoLists_v2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeTwoLists_v2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNo... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeTwoLists_v2(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
if not l1:
return l2
elif not l2:
return l1
dummy = ListNode(None)
node = dummy
while l1 or l2:
n1 = l1.val if l1 else flo... | the_stack_v2_python_sparse | src/lt_21.py | oxhead/CodingYourWay | train | 0 | |
38b50ea62decdfa3a14bf6f0358ae08def1f5740 | [
"super(InceptionV3, self).__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\nself.output_blocks = sorted(output_blocks)\nself.last_needed_block = max(output_blocks)\nassert self.last_needed_block <= 3, 'Last possible output block index is 3'\nself.blocks = nn.ModuleList()\nincepti... | <|body_start_0|>
super(InceptionV3, self).__init__()
self.resize_input = resize_input
self.normalize_input = normalize_input
self.output_blocks = sorted(output_blocks)
self.last_needed_block = max(output_blocks)
assert self.last_needed_block <= 3, 'Last possible output bl... | Pretrained InceptionV3 network returning feature maps | InceptionV3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices o... | stack_v2_sparse_classes_36k_train_009883 | 8,851 | no_license | [
{
"docstring": "Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling - 2: corresponds to output which is fed to aux classifier ... | 2 | stack_v2_sparse_classes_30k_train_003745 | Implement the Python class `InceptionV3` described below.
Class description:
Pretrained InceptionV3 network returning feature maps
Method signatures and docstrings:
- def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False): Build pretrained InceptionV3 Pa... | Implement the Python class `InceptionV3` described below.
Class description:
Pretrained InceptionV3 network returning feature maps
Method signatures and docstrings:
- def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False): Build pretrained InceptionV3 Pa... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class InceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=False, normalize_input=True, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to r... | the_stack_v2_python_sparse | generated/test_tamarott_SinGAN.py | jansel/pytorch-jit-paritybench | train | 35 |
183370fde921c6500c31865d9ff4823138b107f8 | [
"args = dict(is_add=True, eid=LispEid.create_eid(eid, prefix_len), locator_set_name=locator_set_name, vni=int(vni))\ncmd = u'lisp_add_del_local_eid'\nerr_msg = f\"Failed to add local eid on host {node[u'host']}\"\nwith PapiSocketExecutor(node) as papi_exec:\n papi_exec.add(cmd, **args).get_reply(err_msg)",
"ar... | <|body_start_0|>
args = dict(is_add=True, eid=LispEid.create_eid(eid, prefix_len), locator_set_name=locator_set_name, vni=int(vni))
cmd = u'lisp_add_del_local_eid'
err_msg = f"Failed to add local eid on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_ex... | Class for Lisp local eid API. | LispLocalEid | [
"GPL-1.0-or-later",
"CC-BY-4.0",
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LispLocalEid:
"""Class for Lisp local eid API."""
def vpp_add_lisp_local_eid(node, locator_set_name, vni, eid, prefix_len=None):
"""Set lisp eid address on the VPP node in topology. :param node: VPP node. :param locator_set_name: Name of the locator_set. :param vni: Vni value. :param... | stack_v2_sparse_classes_36k_train_009884 | 14,690 | permissive | [
{
"docstring": "Set lisp eid address on the VPP node in topology. :param node: VPP node. :param locator_set_name: Name of the locator_set. :param vni: Vni value. :param eid: Eid value. :param prefix_len: Prefix len if the eid is IP address. :type node: dict :type locator_set_name: str :type vni: int :type eid: ... | 2 | stack_v2_sparse_classes_30k_train_018570 | Implement the Python class `LispLocalEid` described below.
Class description:
Class for Lisp local eid API.
Method signatures and docstrings:
- def vpp_add_lisp_local_eid(node, locator_set_name, vni, eid, prefix_len=None): Set lisp eid address on the VPP node in topology. :param node: VPP node. :param locator_set_nam... | Implement the Python class `LispLocalEid` described below.
Class description:
Class for Lisp local eid API.
Method signatures and docstrings:
- def vpp_add_lisp_local_eid(node, locator_set_name, vni, eid, prefix_len=None): Set lisp eid address on the VPP node in topology. :param node: VPP node. :param locator_set_nam... | 947057d7310cd1602119258c6b82fbb25fe1b79d | <|skeleton|>
class LispLocalEid:
"""Class for Lisp local eid API."""
def vpp_add_lisp_local_eid(node, locator_set_name, vni, eid, prefix_len=None):
"""Set lisp eid address on the VPP node in topology. :param node: VPP node. :param locator_set_name: Name of the locator_set. :param vni: Vni value. :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LispLocalEid:
"""Class for Lisp local eid API."""
def vpp_add_lisp_local_eid(node, locator_set_name, vni, eid, prefix_len=None):
"""Set lisp eid address on the VPP node in topology. :param node: VPP node. :param locator_set_name: Name of the locator_set. :param vni: Vni value. :param eid: Eid val... | the_stack_v2_python_sparse | resources/libraries/python/LispSetup.py | FDio/csit | train | 28 |
62bfded43c1efae09f8ffefd1155938d37e8e6d6 | [
"self.name = name\nself.short_rate = short_rate\nif short_rate < 0:\n raise ValueError('Short rate negative.')",
"if dtobjects is True:\n dlist = get_year_deltas(date_list)\nelse:\n dlist = np.array(date_list)\ndflist = np.exp(self.short_rate * np.sort(-dlist))\nreturn np.array((date_list, dflist)).T"
] | <|body_start_0|>
self.name = name
self.short_rate = short_rate
if short_rate < 0:
raise ValueError('Short rate negative.')
<|end_body_0|>
<|body_start_1|>
if dtobjects is True:
dlist = get_year_deltas(date_list)
else:
dlist = np.array(date_lis... | Class for constant short rate discounting | constant_short_rate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class constant_short_rate:
"""Class for constant short rate discounting"""
def __init__(self, name, short_rate):
""":param name:string name of the object :param short_rate:float(positive) constant rate for discounting"""
<|body_0|>
def get_discount_factors(self, date_list, dto... | stack_v2_sparse_classes_36k_train_009885 | 1,953 | no_license | [
{
"docstring": ":param name:string name of the object :param short_rate:float(positive) constant rate for discounting",
"name": "__init__",
"signature": "def __init__(self, name, short_rate)"
},
{
"docstring": "get discount factors given a list/array of datetime objects or year fractions",
"... | 2 | stack_v2_sparse_classes_30k_train_000253 | Implement the Python class `constant_short_rate` described below.
Class description:
Class for constant short rate discounting
Method signatures and docstrings:
- def __init__(self, name, short_rate): :param name:string name of the object :param short_rate:float(positive) constant rate for discounting
- def get_disco... | Implement the Python class `constant_short_rate` described below.
Class description:
Class for constant short rate discounting
Method signatures and docstrings:
- def __init__(self, name, short_rate): :param name:string name of the object :param short_rate:float(positive) constant rate for discounting
- def get_disco... | 4ba36c89003fca6797025319e81fd9863fbd05b1 | <|skeleton|>
class constant_short_rate:
"""Class for constant short rate discounting"""
def __init__(self, name, short_rate):
""":param name:string name of the object :param short_rate:float(positive) constant rate for discounting"""
<|body_0|>
def get_discount_factors(self, date_list, dto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class constant_short_rate:
"""Class for constant short rate discounting"""
def __init__(self, name, short_rate):
""":param name:string name of the object :param short_rate:float(positive) constant rate for discounting"""
self.name = name
self.short_rate = short_rate
if short_rat... | the_stack_v2_python_sparse | maths/估值建模.py | 631068264/learn-sktf | train | 0 |
84d71da7ecc685d32d0ac2004fedb3fe9333454b | [
"try:\n doc = Document.objects.get(id=doc_id)\nexcept Document.DoesNotExist:\n raise Http404('Document does not exists')\nif request.user.has_perm(Access.PERM_WRITE, doc):\n page_nums = request.GET.getlist('pages[]')\n page_nums = [int(number) for number in page_nums]\n doc.delete_pages(page_numbers=... | <|body_start_0|>
try:
doc = Document.objects.get(id=doc_id)
except Document.DoesNotExist:
raise Http404('Document does not exists')
if request.user.has_perm(Access.PERM_WRITE, doc):
page_nums = request.GET.getlist('pages[]')
page_nums = [int(number... | PagesView | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PagesView:
def delete(self, request, doc_id):
"""Deletes Pages from doc_id document"""
<|body_0|>
def post(self, request, doc_id):
"""Reorders pages from doc_id document request.data is expected to be a list of dictionaries: Example: [ {page_num: 2, page_order: 1}, {... | stack_v2_sparse_classes_36k_train_009886 | 7,101 | permissive | [
{
"docstring": "Deletes Pages from doc_id document",
"name": "delete",
"signature": "def delete(self, request, doc_id)"
},
{
"docstring": "Reorders pages from doc_id document request.data is expected to be a list of dictionaries: Example: [ {page_num: 2, page_order: 1}, {page_num: 1, page_order:... | 2 | stack_v2_sparse_classes_30k_val_000442 | Implement the Python class `PagesView` described below.
Class description:
Implement the PagesView class.
Method signatures and docstrings:
- def delete(self, request, doc_id): Deletes Pages from doc_id document
- def post(self, request, doc_id): Reorders pages from doc_id document request.data is expected to be a li... | Implement the Python class `PagesView` described below.
Class description:
Implement the PagesView class.
Method signatures and docstrings:
- def delete(self, request, doc_id): Deletes Pages from doc_id document
- def post(self, request, doc_id): Reorders pages from doc_id document request.data is expected to be a li... | 56c10c889e1db4760a3c47f2374a63ec12fcec3b | <|skeleton|>
class PagesView:
def delete(self, request, doc_id):
"""Deletes Pages from doc_id document"""
<|body_0|>
def post(self, request, doc_id):
"""Reorders pages from doc_id document request.data is expected to be a list of dictionaries: Example: [ {page_num: 2, page_order: 1}, {... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PagesView:
def delete(self, request, doc_id):
"""Deletes Pages from doc_id document"""
try:
doc = Document.objects.get(id=doc_id)
except Document.DoesNotExist:
raise Http404('Document does not exists')
if request.user.has_perm(Access.PERM_WRITE, doc):
... | the_stack_v2_python_sparse | papermerge/core/views/api.py | zhiliangpersonal/papermerge | train | 1 | |
939d270db10b8cd4098576973c0e2ee3b495ab29 | [
"super().__init__()\nself.encoder_a = encoder_cls(num_channels_a, n_filts, n_residual, n_sample, style_dim)\nself.encoder_b = encoder_cls(num_channels_b, n_filts, n_residual, n_sample, style_dim)\nself.decoder_a = decoder_cls(num_channels_a, n_filts, n_residual, n_sample, style_dim)\nself.decoder_b = decoder_cls(nu... | <|body_start_0|>
super().__init__()
self.encoder_a = encoder_cls(num_channels_a, n_filts, n_residual, n_sample, style_dim)
self.encoder_b = encoder_cls(num_channels_b, n_filts, n_residual, n_sample, style_dim)
self.decoder_a = decoder_cls(num_channels_a, n_filts, n_residual, n_sample, st... | Class implementing the Multimodal Unsupervised Image-to-Image Translation References ---------- `Paper <https://arxiv.org/abs/1804.04732>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this network into its parts (i. e. ... | MUNIT | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MUNIT:
"""Class implementing the Multimodal Unsupervised Image-to-Image Translation References ---------- `Paper <https://arxiv.org/abs/1804.04732>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split th... | stack_v2_sparse_classes_36k_train_009887 | 10,264 | permissive | [
{
"docstring": "Parameters ---------- num_channels_a : int number of image channels for domain A num_channels_b : int number of image channels for domain B n_filts : int number of convolutional filters per layer n_residual : int number of residual blocks in Encoders and Decoders n_sample : int number of up-/dow... | 2 | stack_v2_sparse_classes_30k_test_000686 | Implement the Python class `MUNIT` described below.
Class description:
Class implementing the Multimodal Unsupervised Image-to-Image Translation References ---------- `Paper <https://arxiv.org/abs/1804.04732>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained... | Implement the Python class `MUNIT` described below.
Class description:
Class implementing the Multimodal Unsupervised Image-to-Image Translation References ---------- `Paper <https://arxiv.org/abs/1804.04732>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class MUNIT:
"""Class implementing the Multimodal Unsupervised Image-to-Image Translation References ---------- `Paper <https://arxiv.org/abs/1804.04732>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MUNIT:
"""Class implementing the Multimodal Unsupervised Image-to-Image Translation References ---------- `Paper <https://arxiv.org/abs/1804.04732>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this network in... | the_stack_v2_python_sparse | dlutils/models/gans/munit/munit.py | justusschock/dl-utils | train | 15 |
f0e57f8bf8ec38de621670698ca3f8bbaf5a70e5 | [
"self.charcode = charcode\nself.shape = shape\nself.offset = offset\nself.advance = advance\nself.texcoords = texcoords\nself.kerning = {}",
"if charcode in self.kerning.keys():\n return self.kerning[charcode]\nelse:\n return 0"
] | <|body_start_0|>
self.charcode = charcode
self.shape = shape
self.offset = offset
self.advance = advance
self.texcoords = texcoords
self.kerning = {}
<|end_body_0|>
<|body_start_1|>
if charcode in self.kerning.keys():
return self.kerning[charcode]
... | A glyph gathers information relative to the size/offset/advance and texture coordinates of a single character. It is generally built automatically by a Font. | Glyph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Glyph:
"""A glyph gathers information relative to the size/offset/advance and texture coordinates of a single character. It is generally built automatically by a Font."""
def __init__(self, charcode, shape, offset, advance, texcoords):
"""Build a new texture glyph Parameter: --------... | stack_v2_sparse_classes_36k_train_009888 | 1,520 | permissive | [
{
"docstring": "Build a new texture glyph Parameter: ---------- charcode : char Represented character size: tuple of 2 ints Glyph size in pixels offset: tuple of 2 floats Glyph offset relatively to anchor point advance: tuple of 2 floats Glyph advance texcoords: tuple of 4 floats Texture coordinates of bottom-l... | 2 | null | Implement the Python class `Glyph` described below.
Class description:
A glyph gathers information relative to the size/offset/advance and texture coordinates of a single character. It is generally built automatically by a Font.
Method signatures and docstrings:
- def __init__(self, charcode, shape, offset, advance, ... | Implement the Python class `Glyph` described below.
Class description:
A glyph gathers information relative to the size/offset/advance and texture coordinates of a single character. It is generally built automatically by a Font.
Method signatures and docstrings:
- def __init__(self, charcode, shape, offset, advance, ... | 75408635bd46e48ff10939e308a71eafdaff35e8 | <|skeleton|>
class Glyph:
"""A glyph gathers information relative to the size/offset/advance and texture coordinates of a single character. It is generally built automatically by a Font."""
def __init__(self, charcode, shape, offset, advance, texcoords):
"""Build a new texture glyph Parameter: --------... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Glyph:
"""A glyph gathers information relative to the size/offset/advance and texture coordinates of a single character. It is generally built automatically by a Font."""
def __init__(self, charcode, shape, offset, advance, texcoords):
"""Build a new texture glyph Parameter: ---------- charcode :... | the_stack_v2_python_sparse | glumpy/graphics/text/font.py | glumpy/glumpy | train | 1,228 |
c971e8e50352a731549f84ade9cff29b11634640 | [
"clients = Client.objects.all()\ncontext = {'clients': clients.order_by('name')}\nreturn render(request, 'client/list-clients.html', context)",
"query = request.POST.get('search_query')\nclients = Client.objects.all()\nif query:\n clients = clients.filter(Q(name__icontains=query) | Q(phone_number__icontains=qu... | <|body_start_0|>
clients = Client.objects.all()
context = {'clients': clients.order_by('name')}
return render(request, 'client/list-clients.html', context)
<|end_body_0|>
<|body_start_1|>
query = request.POST.get('search_query')
clients = Client.objects.all()
if query:
... | Class based view for Client for listing all the clients. | ClientListView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientListView:
"""Class based view for Client for listing all the clients."""
def get(self, request):
"""Render client list tempalte.."""
<|body_0|>
def post(self, request):
"""Render client list tempalte.."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_009889 | 5,092 | no_license | [
{
"docstring": "Render client list tempalte..",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Render client list tempalte..",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | null | Implement the Python class `ClientListView` described below.
Class description:
Class based view for Client for listing all the clients.
Method signatures and docstrings:
- def get(self, request): Render client list tempalte..
- def post(self, request): Render client list tempalte.. | Implement the Python class `ClientListView` described below.
Class description:
Class based view for Client for listing all the clients.
Method signatures and docstrings:
- def get(self, request): Render client list tempalte..
- def post(self, request): Render client list tempalte..
<|skeleton|>
class ClientListView... | 93c3106ab90fb9aed85658f93f51686ba4734091 | <|skeleton|>
class ClientListView:
"""Class based view for Client for listing all the clients."""
def get(self, request):
"""Render client list tempalte.."""
<|body_0|>
def post(self, request):
"""Render client list tempalte.."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientListView:
"""Class based view for Client for listing all the clients."""
def get(self, request):
"""Render client list tempalte.."""
clients = Client.objects.all()
context = {'clients': clients.order_by('name')}
return render(request, 'client/list-clients.html', cont... | the_stack_v2_python_sparse | client/views/client_views.py | saadali5997/tms | train | 0 |
ccf48b6c5e0847abecd3abee1a6b04b366f7bbee | [
"super(InputObjectList, self).__init__(filename=filename)\nif self.nrows > 0:\n self.mand_cols, self.wav_cols = self._find_columns()",
"mand_cols = []\nmand_colnames = ['NUMBER', 'X_IMAGE', 'Y_IMAGE', 'A_IMAGE', 'B_IMAGE', 'THETA_IMAGE', 'X_WORLD', 'Y_WORLD', 'A_WORLD', 'B_WORLD', 'THETA_WORLD']\nopt_colnames ... | <|body_start_0|>
super(InputObjectList, self).__init__(filename=filename)
if self.nrows > 0:
self.mand_cols, self.wav_cols = self._find_columns()
<|end_body_0|>
<|body_start_1|>
mand_cols = []
mand_colnames = ['NUMBER', 'X_IMAGE', 'Y_IMAGE', 'A_IMAGE', 'B_IMAGE', 'THETA_IMAG... | Subclass of the AsciiData class for aXe | InputObjectList | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InputObjectList:
"""Subclass of the AsciiData class for aXe"""
def __init__(self, filename):
"""Initializes the class"""
<|body_0|>
def _find_columns(self):
"""Identify all important columns"""
<|body_1|>
def find_magcol(self, mag_cols, mag_wave):
... | stack_v2_sparse_classes_36k_train_009890 | 7,875 | permissive | [
{
"docstring": "Initializes the class",
"name": "__init__",
"signature": "def __init__(self, filename)"
},
{
"docstring": "Identify all important columns",
"name": "_find_columns",
"signature": "def _find_columns(self)"
},
{
"docstring": "Input: mag_cols - the list with infos on ... | 5 | null | Implement the Python class `InputObjectList` described below.
Class description:
Subclass of the AsciiData class for aXe
Method signatures and docstrings:
- def __init__(self, filename): Initializes the class
- def _find_columns(self): Identify all important columns
- def find_magcol(self, mag_cols, mag_wave): Input:... | Implement the Python class `InputObjectList` described below.
Class description:
Subclass of the AsciiData class for aXe
Method signatures and docstrings:
- def __init__(self, filename): Initializes the class
- def _find_columns(self): Identify all important columns
- def find_magcol(self, mag_cols, mag_wave): Input:... | 043c173fd5497c18c2b1bfe8bcff65180bca3996 | <|skeleton|>
class InputObjectList:
"""Subclass of the AsciiData class for aXe"""
def __init__(self, filename):
"""Initializes the class"""
<|body_0|>
def _find_columns(self):
"""Identify all important columns"""
<|body_1|>
def find_magcol(self, mag_cols, mag_wave):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InputObjectList:
"""Subclass of the AsciiData class for aXe"""
def __init__(self, filename):
"""Initializes the class"""
super(InputObjectList, self).__init__(filename=filename)
if self.nrows > 0:
self.mand_cols, self.wav_cols = self._find_columns()
def _find_colu... | the_stack_v2_python_sparse | stsdas/pkg/analysis/slitless/axe/axesrc/axeiol.py | spacetelescope/stsdas_stripped | train | 1 |
eaf79c960d4629bfbaf9aadb07a916afcea87763 | [
"class _sharedLocals(object):\n intstr = False\n strint = False\n\n@Overload(arg1=int, arg2=StrType)\ndef _simpleOverload(arg1, arg2):\n _sharedLocals.intstr = True\n\n@Overload(arg1=StrType, arg2=int)\ndef _simpleOverload(arg1, arg2):\n _sharedLocals.strint = True\n_simpleOverload(1, '2')\nself.assertT... | <|body_start_0|>
class _sharedLocals(object):
intstr = False
strint = False
@Overload(arg1=int, arg2=StrType)
def _simpleOverload(arg1, arg2):
_sharedLocals.intstr = True
@Overload(arg1=StrType, arg2=int)
def _simpleOverload(arg1, arg2):
... | Test for the Overload decorator | TestOverload | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestOverload:
"""Test for the Overload decorator"""
def testSimpleOverloads(self):
"""Test that overloads work in the general case and non-matching argument sets throw exceptions"""
<|body_0|>
def testValueOverloads(self):
"""Test that an overload on a value work... | stack_v2_sparse_classes_36k_train_009891 | 22,249 | no_license | [
{
"docstring": "Test that overloads work in the general case and non-matching argument sets throw exceptions",
"name": "testSimpleOverloads",
"signature": "def testSimpleOverloads(self)"
},
{
"docstring": "Test that an overload on a value works and has higher priority than an overload on a type"... | 4 | null | Implement the Python class `TestOverload` described below.
Class description:
Test for the Overload decorator
Method signatures and docstrings:
- def testSimpleOverloads(self): Test that overloads work in the general case and non-matching argument sets throw exceptions
- def testValueOverloads(self): Test that an ove... | Implement the Python class `TestOverload` described below.
Class description:
Test for the Overload decorator
Method signatures and docstrings:
- def testSimpleOverloads(self): Test that overloads work in the general case and non-matching argument sets throw exceptions
- def testValueOverloads(self): Test that an ove... | c7389961bee3d8e5088c8c3c8c4bb7e273e4ec50 | <|skeleton|>
class TestOverload:
"""Test for the Overload decorator"""
def testSimpleOverloads(self):
"""Test that overloads work in the general case and non-matching argument sets throw exceptions"""
<|body_0|>
def testValueOverloads(self):
"""Test that an overload on a value work... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestOverload:
"""Test for the Overload decorator"""
def testSimpleOverloads(self):
"""Test that overloads work in the general case and non-matching argument sets throw exceptions"""
class _sharedLocals(object):
intstr = False
strint = False
@Overload(arg1=... | the_stack_v2_python_sparse | csbuild/_utils/decorators.py | SleepingCatGames/csbuild2 | train | 1 |
cabbedc7f463dea320a8665e69fe16128856dd53 | [
"if root is None:\n return ['null']\nstack = []\noutput = []\nstack.append(root)\noutput.append(str(root.val))\nserializedPtr = 0\nwhile serializedPtr < len(stack):\n if stack[serializedPtr].left is not None:\n stack.append(stack[serializedPtr].left)\n output.append(str(stack[serializedPtr].left... | <|body_start_0|>
if root is None:
return ['null']
stack = []
output = []
stack.append(root)
output.append(str(root.val))
serializedPtr = 0
while serializedPtr < len(stack):
if stack[serializedPtr].left is not None:
stack.app... | 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_009892 | 3,120 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 7a1c3aba65f338f6e11afd2864dabd2b26142b6c | <|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 root is None:
return ['null']
stack = []
output = []
stack.append(root)
output.append(str(root.val))
serializedPtr = 0
whil... | the_stack_v2_python_sparse | exercise/leetcode/python_src/by2017_Sep/Leet297.py | SS4G/AlgorithmTraining | train | 2 | |
de1faee1b1d9c50da689bcf2ee8effdc79fcca02 | [
"self.polarity = polarity\nself.bits = bits\nself.d29 = bits[28]\nself.d30 = bits[29]\nself.dStarArray = np.array([d29, d30, d29, d30, d30, d29])\nself.bitstring = None\nself.paritypass = None\nself._check_parity()",
"assert self.polarity == self.dStarArray[1]\np = self.dStarArray[1] * PARITY_MAT * self.bits[0:24... | <|body_start_0|>
self.polarity = polarity
self.bits = bits
self.d29 = bits[28]
self.d30 = bits[29]
self.dStarArray = np.array([d29, d30, d29, d30, d30, d29])
self.bitstring = None
self.paritypass = None
self._check_parity()
<|end_body_0|>
<|body_start_1|>... | Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word. | Word | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Word:
"""Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word."""
def __init__(self, polarity, d29, d30, bits):
"""Constructs the libgnss.Word object. @type polarity : int @param polarity : This ... | stack_v2_sparse_classes_36k_train_009893 | 13,801 | permissive | [
{
"docstring": "Constructs the libgnss.Word object. @type polarity : int @param polarity : This is the polarity of the incoming navigation data bits. It can be either a 1 or a -1. Flip the bits if -1. Note: Polarity is determined by -d30 of the previous word. Note: Polarity of first word is determined by preamb... | 2 | stack_v2_sparse_classes_30k_test_000697 | Implement the Python class `Word` described below.
Class description:
Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word.
Method signatures and docstrings:
- def __init__(self, polarity, d29, d30, bits): Constructs the libgnss.... | Implement the Python class `Word` described below.
Class description:
Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word.
Method signatures and docstrings:
- def __init__(self, polarity, d29, d30, bits): Constructs the libgnss.... | 2420a859be9dfe68df62f6db3f7bbd6f151f2936 | <|skeleton|>
class Word:
"""Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word."""
def __init__(self, polarity, d29, d30, bits):
"""Constructs the libgnss.Word object. @type polarity : int @param polarity : This ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Word:
"""Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word."""
def __init__(self, polarity, d29, d30, bits):
"""Constructs the libgnss.Word object. @type polarity : int @param polarity : This is the polari... | the_stack_v2_python_sparse | pygnss/pythonreceiver/libgnss/ephemeris.py | GnssTao/NavLab-DPE-SDR | train | 0 |
6ee3ca887eed63b2f5a3967ebd17aee5602fbb5f | [
"super(Lz4CompressData, self).__init__(ds)\nif compression_mode is None:\n compression_mode = 'default'\nself._compression_mode = compression_mode",
"import lz4\nfor datapoint in self.ds.get_data():\n compressed_datapoint = lz4.block.compress(datapoint, self._compression_mode)\n yield compressed_datapoin... | <|body_start_0|>
super(Lz4CompressData, self).__init__(ds)
if compression_mode is None:
compression_mode = 'default'
self._compression_mode = compression_mode
<|end_body_0|>
<|body_start_1|>
import lz4
for datapoint in self.ds.get_data():
compressed_datap... | Compresses a datapoint using LZ4. | Lz4CompressData | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lz4CompressData:
"""Compresses a datapoint using LZ4."""
def __init__(self, ds, compression_mode='default'):
"""Args: ds (DataFlow): Input dataflow. compression_mode (str): LZ4 compression mode."""
<|body_0|>
def get_data(self):
"""Yields: Compressed datapoint.""... | stack_v2_sparse_classes_36k_train_009894 | 49,239 | permissive | [
{
"docstring": "Args: ds (DataFlow): Input dataflow. compression_mode (str): LZ4 compression mode.",
"name": "__init__",
"signature": "def __init__(self, ds, compression_mode='default')"
},
{
"docstring": "Yields: Compressed datapoint.",
"name": "get_data",
"signature": "def get_data(sel... | 2 | stack_v2_sparse_classes_30k_val_000133 | Implement the Python class `Lz4CompressData` described below.
Class description:
Compresses a datapoint using LZ4.
Method signatures and docstrings:
- def __init__(self, ds, compression_mode='default'): Args: ds (DataFlow): Input dataflow. compression_mode (str): LZ4 compression mode.
- def get_data(self): Yields: Co... | Implement the Python class `Lz4CompressData` described below.
Class description:
Compresses a datapoint using LZ4.
Method signatures and docstrings:
- def __init__(self, ds, compression_mode='default'): Args: ds (DataFlow): Input dataflow. compression_mode (str): LZ4 compression mode.
- def get_data(self): Yields: Co... | bbc684d9290a7685bf137a81e3a5d45b7ee24875 | <|skeleton|>
class Lz4CompressData:
"""Compresses a datapoint using LZ4."""
def __init__(self, ds, compression_mode='default'):
"""Args: ds (DataFlow): Input dataflow. compression_mode (str): LZ4 compression mode."""
<|body_0|>
def get_data(self):
"""Yields: Compressed datapoint.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Lz4CompressData:
"""Compresses a datapoint using LZ4."""
def __init__(self, ds, compression_mode='default'):
"""Args: ds (DataFlow): Input dataflow. compression_mode (str): LZ4 compression mode."""
super(Lz4CompressData, self).__init__(ds)
if compression_mode is None:
... | the_stack_v2_python_sparse | pybh/tensorpack_utils.py | bennihepp/pybh | train | 0 |
829f3763db197ec7a84adff17d5e853293cdf327 | [
"if frame.name == self.name:\n raise ValueError('Cannot connect to a frame with the same name.')\nself._connected_frames[frame.name] = transformation_to_frame.inverse\nframe._connected_frames[self.name] = transformation_to_frame",
"if not hasattr(geom_obj, '_frame'):\n raise ValueError('Cannot transform obj... | <|body_start_0|>
if frame.name == self.name:
raise ValueError('Cannot connect to a frame with the same name.')
self._connected_frames[frame.name] = transformation_to_frame.inverse
frame._connected_frames[self.name] = transformation_to_frame
<|end_body_0|>
<|body_start_1|>
if... | Frame | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Frame:
def connect_to(self, frame: 'Frame', *, transformation_to_frame: TransformType):
"""Connect this frame to another frame through a transformation. This also connects the other frame to this one."""
<|body_0|>
def __call__(self, geom_obj):
"""Calling an instance... | stack_v2_sparse_classes_36k_train_009895 | 2,578 | permissive | [
{
"docstring": "Connect this frame to another frame through a transformation. This also connects the other frame to this one.",
"name": "connect_to",
"signature": "def connect_to(self, frame: 'Frame', *, transformation_to_frame: TransformType)"
},
{
"docstring": "Calling an instance transforms t... | 2 | stack_v2_sparse_classes_30k_test_000221 | Implement the Python class `Frame` described below.
Class description:
Implement the Frame class.
Method signatures and docstrings:
- def connect_to(self, frame: 'Frame', *, transformation_to_frame: TransformType): Connect this frame to another frame through a transformation. This also connects the other frame to thi... | Implement the Python class `Frame` described below.
Class description:
Implement the Frame class.
Method signatures and docstrings:
- def connect_to(self, frame: 'Frame', *, transformation_to_frame: TransformType): Connect this frame to another frame through a transformation. This also connects the other frame to thi... | 8a9438b5a24c288721ae0302889fe55e26046310 | <|skeleton|>
class Frame:
def connect_to(self, frame: 'Frame', *, transformation_to_frame: TransformType):
"""Connect this frame to another frame through a transformation. This also connects the other frame to this one."""
<|body_0|>
def __call__(self, geom_obj):
"""Calling an instance... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Frame:
def connect_to(self, frame: 'Frame', *, transformation_to_frame: TransformType):
"""Connect this frame to another frame through a transformation. This also connects the other frame to this one."""
if frame.name == self.name:
raise ValueError('Cannot connect to a frame with t... | the_stack_v2_python_sparse | simulation/utils/geometry/frame.py | KITcar-Team/kitcar-gazebo-simulation | train | 19 | |
726a31663114c0a97ef15807387b2e47466a51ae | [
"zero_cnt = 0\nnone_zero_mul = 1\nfor num in nums:\n if num == 0:\n zero_cnt += 1\n else:\n none_zero_mul *= num\nres = []\nfor num in nums:\n if zero_cnt == 0:\n res.append(none_zero_mul / num)\n elif zero_cnt == 1 and num == 0:\n res.append(none_zero_mul)\n elif zero_cnt... | <|body_start_0|>
zero_cnt = 0
none_zero_mul = 1
for num in nums:
if num == 0:
zero_cnt += 1
else:
none_zero_mul *= num
res = []
for num in nums:
if zero_cnt == 0:
res.append(none_zero_mul / num)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf(self, nums):
"""原数组: [1 2 3 4] 左部分的乘积: 1 1 1*2 1*2*3 右部分的乘积: 2*3*4 3*4 4 1 结果: 1*2*3*4 1*3*4 1*2*4 1*2*3*1 :type nums: List[int] :rtype: List[i... | stack_v2_sparse_classes_36k_train_009896 | 2,457 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelf",
"signature": "def productExceptSelf(self, nums)"
},
{
"docstring": "原数组: [1 2 3 4] 左部分的乘积: 1 1 1*2 1*2*3 右部分的乘积: 2*3*4 3*4 4 1 结果: 1*2*3*4 1*3*4 1*2*4 1*2*3*1 :type nums: List[int] :rtype: List[int]",
"nam... | 2 | stack_v2_sparse_classes_30k_train_004797 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf(self, nums): 原数组: [1 2 3 4] 左部分的乘积: 1 1 1*2 1*2*3 右部分的乘积: 2*3*4 3*4 4 1 结果: 1*2... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf(self, nums): 原数组: [1 2 3 4] 左部分的乘积: 1 1 1*2 1*2*3 右部分的乘积: 2*3*4 3*4 4 1 结果: 1*2... | 860590239da0618c52967a55eda8d6bbe00bfa96 | <|skeleton|>
class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf(self, nums):
"""原数组: [1 2 3 4] 左部分的乘积: 1 1 1*2 1*2*3 右部分的乘积: 2*3*4 3*4 4 1 结果: 1*2*3*4 1*3*4 1*2*4 1*2*3*1 :type nums: List[int] :rtype: List[i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
zero_cnt = 0
none_zero_mul = 1
for num in nums:
if num == 0:
zero_cnt += 1
else:
none_zero_mul *= num
res = []
for ... | the_stack_v2_python_sparse | LeetCode/p0283/I/product-of-array-except-self.py | Ynjxsjmh/PracticeMakesPerfect | train | 0 | |
89dcbe0a1e14c94a93fab6bb500551d70b2fabfe | [
"if self.user:\n post = Post.get_by_id(int(post_id))\n if not post:\n self.error(404)\n if post.user.key().id() == int(self.user):\n self.render('edit_blog.html', post=post)\n else:\n error = 'You cannot edit this post.'\n self.render('edit_blog.html', access_error=error)\nel... | <|body_start_0|>
if self.user:
post = Post.get_by_id(int(post_id))
if not post:
self.error(404)
if post.user.key().id() == int(self.user):
self.render('edit_blog.html', post=post)
else:
error = 'You cannot edit this ... | To create a new blog post | EditBlog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EditBlog:
"""To create a new blog post"""
def get(self, post_id):
"""Renders the form for adding post"""
<|body_0|>
def post(self, post_id):
"""To process ans store blog post information into database"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_009897 | 4,859 | no_license | [
{
"docstring": "Renders the form for adding post",
"name": "get",
"signature": "def get(self, post_id)"
},
{
"docstring": "To process ans store blog post information into database",
"name": "post",
"signature": "def post(self, post_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014405 | Implement the Python class `EditBlog` described below.
Class description:
To create a new blog post
Method signatures and docstrings:
- def get(self, post_id): Renders the form for adding post
- def post(self, post_id): To process ans store blog post information into database | Implement the Python class `EditBlog` described below.
Class description:
To create a new blog post
Method signatures and docstrings:
- def get(self, post_id): Renders the form for adding post
- def post(self, post_id): To process ans store blog post information into database
<|skeleton|>
class EditBlog:
"""To c... | 74c6e821c2fdb4198de8be2e83c64164e23f9992 | <|skeleton|>
class EditBlog:
"""To create a new blog post"""
def get(self, post_id):
"""Renders the form for adding post"""
<|body_0|>
def post(self, post_id):
"""To process ans store blog post information into database"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EditBlog:
"""To create a new blog post"""
def get(self, post_id):
"""Renders the form for adding post"""
if self.user:
post = Post.get_by_id(int(post_id))
if not post:
self.error(404)
if post.user.key().id() == int(self.user):
... | the_stack_v2_python_sparse | Multi User Blog/Multi User Blog/handlers/blog.py | mascot6699/udacity-full-stack | train | 8 |
c8769bf24ccd0278e0beab4eb0307f42837407cc | [
"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 GoogleAdsFieldService Service to fetch Google Ads API fields. | GoogleAdsFieldServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleAdsFieldServiceServicer:
"""Proto file describing the GoogleAdsFieldService Service to fetch Google Ads API fields."""
def GetGoogleAdsField(self, request, context):
"""Returns just the requested field."""
<|body_0|>
def SearchGoogleAdsFields(self, request, context... | stack_v2_sparse_classes_36k_train_009898 | 5,654 | permissive | [
{
"docstring": "Returns just the requested field.",
"name": "GetGoogleAdsField",
"signature": "def GetGoogleAdsField(self, request, context)"
},
{
"docstring": "Returns all fields that match the search query.",
"name": "SearchGoogleAdsFields",
"signature": "def SearchGoogleAdsFields(self... | 2 | null | Implement the Python class `GoogleAdsFieldServiceServicer` described below.
Class description:
Proto file describing the GoogleAdsFieldService Service to fetch Google Ads API fields.
Method signatures and docstrings:
- def GetGoogleAdsField(self, request, context): Returns just the requested field.
- def SearchGoogle... | Implement the Python class `GoogleAdsFieldServiceServicer` described below.
Class description:
Proto file describing the GoogleAdsFieldService Service to fetch Google Ads API fields.
Method signatures and docstrings:
- def GetGoogleAdsField(self, request, context): Returns just the requested field.
- def SearchGoogle... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class GoogleAdsFieldServiceServicer:
"""Proto file describing the GoogleAdsFieldService Service to fetch Google Ads API fields."""
def GetGoogleAdsField(self, request, context):
"""Returns just the requested field."""
<|body_0|>
def SearchGoogleAdsFields(self, request, context... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GoogleAdsFieldServiceServicer:
"""Proto file describing the GoogleAdsFieldService Service to fetch Google Ads API fields."""
def GetGoogleAdsField(self, request, context):
"""Returns just the requested field."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/google_ads_field_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
5fd39655e10676e546f77d3e5d24d816374deee8 | [
"s = Selector({})\nassert isinstance(s, Selector), s\nassert s.mapping == {}, s.mapping",
"called = []\n\ndef s1func(node, env, path, called=called):\n called.append('s1func')\n called.append(node)\n return []\n\ndef s2func(node, env, path, called=called):\n called.append('s2func')\n called.append(... | <|body_start_0|>
s = Selector({})
assert isinstance(s, Selector), s
assert s.mapping == {}, s.mapping
<|end_body_0|>
<|body_start_1|>
called = []
def s1func(node, env, path, called=called):
called.append('s1func')
called.append(node)
return [... | SelectorTestCase | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelectorTestCase:
def test___init__(self) -> None:
"""Test creation of Scanner.Selector object"""
<|body_0|>
def test___call__(self) -> None:
"""Test calling Scanner.Selector objects"""
<|body_1|>
def test_select(self) -> None:
"""Test the Scanne... | stack_v2_sparse_classes_36k_train_009899 | 22,589 | permissive | [
{
"docstring": "Test creation of Scanner.Selector object",
"name": "test___init__",
"signature": "def test___init__(self) -> None"
},
{
"docstring": "Test calling Scanner.Selector objects",
"name": "test___call__",
"signature": "def test___call__(self) -> None"
},
{
"docstring": ... | 4 | null | Implement the Python class `SelectorTestCase` described below.
Class description:
Implement the SelectorTestCase class.
Method signatures and docstrings:
- def test___init__(self) -> None: Test creation of Scanner.Selector object
- def test___call__(self) -> None: Test calling Scanner.Selector objects
- def test_sele... | Implement the Python class `SelectorTestCase` described below.
Class description:
Implement the SelectorTestCase class.
Method signatures and docstrings:
- def test___init__(self) -> None: Test creation of Scanner.Selector object
- def test___call__(self) -> None: Test calling Scanner.Selector objects
- def test_sele... | b2a7d7066a2b854460a334a5fe737ea389655e6e | <|skeleton|>
class SelectorTestCase:
def test___init__(self) -> None:
"""Test creation of Scanner.Selector object"""
<|body_0|>
def test___call__(self) -> None:
"""Test calling Scanner.Selector objects"""
<|body_1|>
def test_select(self) -> None:
"""Test the Scanne... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelectorTestCase:
def test___init__(self) -> None:
"""Test creation of Scanner.Selector object"""
s = Selector({})
assert isinstance(s, Selector), s
assert s.mapping == {}, s.mapping
def test___call__(self) -> None:
"""Test calling Scanner.Selector objects"""
... | the_stack_v2_python_sparse | SCons/Scanner/ScannerTests.py | SCons/scons | train | 1,827 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.