blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
84541aebcf1d5ac8c11d2b0a1d3303c8f3e8a6a9 | [
"self.options = options\nmatSize = None\nfor mm in range(numPlot ** 3):\n if 2 * numPlot - mm <= mm ** 2:\n matSize = mm\n break\nif matSize is None:\n raise RuntimeError('Could not find matrix size.')\nself.options.numRow = matSize\nself.options.numCol = matSize\nself.numPlotPosition = self.opt... | <|body_start_0|>
self.options = options
matSize = None
for mm in range(numPlot ** 3):
if 2 * numPlot - mm <= mm ** 2:
matSize = mm
break
if matSize is None:
raise RuntimeError('Could not find matrix size.')
self.options.numR... | LayoutManager for a figure that is an upper triangular plot. | LayoutManagerLowerTriangular | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LayoutManagerLowerTriangular:
"""LayoutManager for a figure that is an upper triangular plot."""
def __init__(self, options, numPlot):
"""Manages allocation of space in subplot and sets up options accordingly. Parameters --------- options: PlotOptions"""
<|body_0|>
def _... | stack_v2_sparse_classes_75kplus_train_006200 | 6,460 | permissive | [
{
"docstring": "Manages allocation of space in subplot and sets up options accordingly. Parameters --------- options: PlotOptions",
"name": "__init__",
"signature": "def __init__(self, options, numPlot)"
},
{
"docstring": "Linearizes the lower triangular matrix counting down successive columns s... | 2 | stack_v2_sparse_classes_30k_train_029558 | Implement the Python class `LayoutManagerLowerTriangular` described below.
Class description:
LayoutManager for a figure that is an upper triangular plot.
Method signatures and docstrings:
- def __init__(self, options, numPlot): Manages allocation of space in subplot and sets up options accordingly. Parameters ------... | Implement the Python class `LayoutManagerLowerTriangular` described below.
Class description:
LayoutManager for a figure that is an upper triangular plot.
Method signatures and docstrings:
- def __init__(self, options, numPlot): Manages allocation of space in subplot and sets up options accordingly. Parameters ------... | 31b184176a7f19074c905db76e6e6ac8e4fc36a8 | <|skeleton|>
class LayoutManagerLowerTriangular:
"""LayoutManager for a figure that is an upper triangular plot."""
def __init__(self, options, numPlot):
"""Manages allocation of space in subplot and sets up options accordingly. Parameters --------- options: PlotOptions"""
<|body_0|>
def _... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LayoutManagerLowerTriangular:
"""LayoutManager for a figure that is an upper triangular plot."""
def __init__(self, options, numPlot):
"""Manages allocation of space in subplot and sets up options accordingly. Parameters --------- options: PlotOptions"""
self.options = options
mat... | the_stack_v2_python_sparse | SBstoat/_layoutManager.py | YunjeongLee/SBstoat | train | 0 |
4ab7f15d5cce58c48ce54158750da6107aba0ad0 | [
"result = []\nlevel = [root]\nwhile root and level:\n current_nodes, next_level = ([], [])\n for node in level:\n current_nodes.append(node.val)\n if node.left:\n next_level.append(node.left)\n if node.right:\n next_level.append(node.right)\n result.append(current... | <|body_start_0|>
result = []
level = [root]
while root and level:
current_nodes, next_level = ([], [])
for node in level:
current_nodes.append(node.val)
if node.left:
next_level.append(node.left)
if node.... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def levelOrderBottom(self, root):
"""FUNNY"""
<|body_0|>
def levelOrderBottom(self, root):
"""NOT SO FUNNY"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
level = [root]
while root and level:
current... | stack_v2_sparse_classes_75kplus_train_006201 | 1,702 | no_license | [
{
"docstring": "FUNNY",
"name": "levelOrderBottom",
"signature": "def levelOrderBottom(self, root)"
},
{
"docstring": "NOT SO FUNNY",
"name": "levelOrderBottom",
"signature": "def levelOrderBottom(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041122 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrderBottom(self, root): FUNNY
- def levelOrderBottom(self, root): NOT SO FUNNY | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrderBottom(self, root): FUNNY
- def levelOrderBottom(self, root): NOT SO FUNNY
<|skeleton|>
class Solution:
def levelOrderBottom(self, root):
"""FUNNY"""
... | 4ec4f9fbb0ef07ea13207654a619cfdb709cc78c | <|skeleton|>
class Solution:
def levelOrderBottom(self, root):
"""FUNNY"""
<|body_0|>
def levelOrderBottom(self, root):
"""NOT SO FUNNY"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def levelOrderBottom(self, root):
"""FUNNY"""
result = []
level = [root]
while root and level:
current_nodes, next_level = ([], [])
for node in level:
current_nodes.append(node.val)
if node.left:
... | the_stack_v2_python_sparse | 91_bt_level_order_traversal_bottom_up.py | gautamgitspace/leetcode_30-day_challenge | train | 0 | |
42e883059c6d94e3551586d77a7d84ba1eda2178 | [
"l, r = (0, len(numbers) - 1)\nwhile l < r:\n s = numbers[l] + numbers[r]\n if s == target:\n return [l + 1, r + 1]\n if s < target:\n l += 1\n if s > target:\n r -= 1",
"dic = {}\nfor i, num in enumerate(numbers):\n if target - num in dic:\n return [dic[target - num] + ... | <|body_start_0|>
l, r = (0, len(numbers) - 1)
while l < r:
s = numbers[l] + numbers[r]
if s == target:
return [l + 1, r + 1]
if s < target:
l += 1
if s > target:
r -= 1
<|end_body_0|>
<|body_start_1|>
... | 167. Two Sum II - Input array is sorted | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""167. Two Sum II - Input array is sorted"""
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[... | stack_v2_sparse_classes_75kplus_train_006202 | 1,307 | no_license | [
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, numbers, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, numbers, ta... | 2 | null | Implement the Python class `Solution` described below.
Class description:
167. Two Sum II - Input array is sorted
Method signatures and docstrings:
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum(self, numbers, target): :type numbers: List[int] :type targ... | Implement the Python class `Solution` described below.
Class description:
167. Two Sum II - Input array is sorted
Method signatures and docstrings:
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum(self, numbers, target): :type numbers: List[int] :type targ... | d356db9146f6608a0540fdf92a127c28a1411746 | <|skeleton|>
class Solution:
"""167. Two Sum II - Input array is sorted"""
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""167. Two Sum II - Input array is sorted"""
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
l, r = (0, len(numbers) - 1)
while l < r:
s = numbers[l] + numbers[r]
if s == target:
... | the_stack_v2_python_sparse | easy/twoSumII.py | magicyu90/LeetCode | train | 0 |
c75f973a3205155925e4538aa1611d10b3548397 | [
"self.client = Client()\nself.form_url = reverse('index')\nself.form_url_II = reverse('create')",
"response = self.client.get(self.form_url)\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'index.html')"
] | <|body_start_0|>
self.client = Client()
self.form_url = reverse('index')
self.form_url_II = reverse('create')
<|end_body_0|>
<|body_start_1|>
response = self.client.get(self.form_url)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'index.ht... | Class with unittests for views. | TestViews | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestViews:
"""Class with unittests for views."""
def setUp(self):
"""Set up for tests."""
<|body_0|>
def test_GET_index(self):
"""GET method for index, tests."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.client = Client()
self.fo... | stack_v2_sparse_classes_75kplus_train_006203 | 709 | no_license | [
{
"docstring": "Set up for tests.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "GET method for index, tests.",
"name": "test_GET_index",
"signature": "def test_GET_index(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004760 | Implement the Python class `TestViews` described below.
Class description:
Class with unittests for views.
Method signatures and docstrings:
- def setUp(self): Set up for tests.
- def test_GET_index(self): GET method for index, tests. | Implement the Python class `TestViews` described below.
Class description:
Class with unittests for views.
Method signatures and docstrings:
- def setUp(self): Set up for tests.
- def test_GET_index(self): GET method for index, tests.
<|skeleton|>
class TestViews:
"""Class with unittests for views."""
def s... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class TestViews:
"""Class with unittests for views."""
def setUp(self):
"""Set up for tests."""
<|body_0|>
def test_GET_index(self):
"""GET method for index, tests."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestViews:
"""Class with unittests for views."""
def setUp(self):
"""Set up for tests."""
self.client = Client()
self.form_url = reverse('index')
self.form_url_II = reverse('create')
def test_GET_index(self):
"""GET method for index, tests."""
response... | the_stack_v2_python_sparse | Django/Django_three_projects/urlshortner/shortner/test_views.py | JakubKazimierski/PythonPortfolio | train | 9 |
194f9717327f224434b0c297b6588c0bdea5d924 | [
"try:\n return Ratings.objects.get(pk=pk)\nexcept Ratings.DoesNotExist:\n raise RatingNotFound",
"rating = self.get_object(pk)\nserializer = RatingsSerializer(rating)\nreturn Response(serializer.data, status=status.HTTP_200_OK)",
"rating = self.get_object(pk)\nself.check_object_permissions(request, rating... | <|body_start_0|>
try:
return Ratings.objects.get(pk=pk)
except Ratings.DoesNotExist:
raise RatingNotFound
<|end_body_0|>
<|body_start_1|>
rating = self.get_object(pk)
serializer = RatingsSerializer(rating)
return Response(serializer.data, status=status.HT... | Allow only authenticated users to hit these endpoints. List edit or delete a rating only a rating owner can edit or delete his/her article | RetrieveUpdateDeleteRatingAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RetrieveUpdateDeleteRatingAPIView:
"""Allow only authenticated users to hit these endpoints. List edit or delete a rating only a rating owner can edit or delete his/her article"""
def get_object(self, pk):
"""Method to return a rating Params ------- pk: reference to rating to be retu... | stack_v2_sparse_classes_75kplus_train_006204 | 24,284 | permissive | [
{
"docstring": "Method to return a rating Params ------- pk: reference to rating to be returned Returns -------- a rating object if found raises an exception if not found",
"name": "get_object",
"signature": "def get_object(self, pk)"
},
{
"docstring": "Method to return a specific rating Params ... | 4 | stack_v2_sparse_classes_30k_train_019188 | Implement the Python class `RetrieveUpdateDeleteRatingAPIView` described below.
Class description:
Allow only authenticated users to hit these endpoints. List edit or delete a rating only a rating owner can edit or delete his/her article
Method signatures and docstrings:
- def get_object(self, pk): Method to return a... | Implement the Python class `RetrieveUpdateDeleteRatingAPIView` described below.
Class description:
Allow only authenticated users to hit these endpoints. List edit or delete a rating only a rating owner can edit or delete his/her article
Method signatures and docstrings:
- def get_object(self, pk): Method to return a... | 5a31840856de4b361fe2594dfa7a33d7774d3fe2 | <|skeleton|>
class RetrieveUpdateDeleteRatingAPIView:
"""Allow only authenticated users to hit these endpoints. List edit or delete a rating only a rating owner can edit or delete his/her article"""
def get_object(self, pk):
"""Method to return a rating Params ------- pk: reference to rating to be retu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RetrieveUpdateDeleteRatingAPIView:
"""Allow only authenticated users to hit these endpoints. List edit or delete a rating only a rating owner can edit or delete his/her article"""
def get_object(self, pk):
"""Method to return a rating Params ------- pk: reference to rating to be returned Returns ... | the_stack_v2_python_sparse | authors/apps/articles/views.py | bl4ck4ndbr0wn/ah-centauri-backend | train | 0 |
bb966401697e04ce2e2d0a74ddeaeffc85535bc5 | [
"self.view = PlaygroundSizeView(selected_size=self.playground.size)\nself.view.bind(selected_size=self._update_playground)\nself.view.bind(selected_size_name=self.setter('text'))\nself.text = self.view.selected_size_name",
"if self.playground:\n self.playground.size = size\n if self.playground.root:\n ... | <|body_start_0|>
self.view = PlaygroundSizeView(selected_size=self.playground.size)
self.view.bind(selected_size=self._update_playground)
self.view.bind(selected_size_name=self.setter('text'))
self.text = self.view.selected_size_name
<|end_body_0|>
<|body_start_1|>
if self.playg... | Button to open playground size selection view | PlaygroundSizeSelector | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlaygroundSizeSelector:
"""Button to open playground size selection view"""
def on_playground(self, *_):
"""Create a :class:`~designer.uix.playground_size_selector.PlaygroundSizeView` for the current playground."""
<|body_0|>
def _update_playground(self, _, size):
... | stack_v2_sparse_classes_75kplus_train_006205 | 8,430 | permissive | [
{
"docstring": "Create a :class:`~designer.uix.playground_size_selector.PlaygroundSizeView` for the current playground.",
"name": "on_playground",
"signature": "def on_playground(self, *_)"
},
{
"docstring": "Callback to update the playground size on :data:`selected_size` changes",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_001175 | Implement the Python class `PlaygroundSizeSelector` described below.
Class description:
Button to open playground size selection view
Method signatures and docstrings:
- def on_playground(self, *_): Create a :class:`~designer.uix.playground_size_selector.PlaygroundSizeView` for the current playground.
- def _update_p... | Implement the Python class `PlaygroundSizeSelector` described below.
Class description:
Button to open playground size selection view
Method signatures and docstrings:
- def on_playground(self, *_): Create a :class:`~designer.uix.playground_size_selector.PlaygroundSizeView` for the current playground.
- def _update_p... | 2b584a13335fe3b522e858a036093d63f6e82a9c | <|skeleton|>
class PlaygroundSizeSelector:
"""Button to open playground size selection view"""
def on_playground(self, *_):
"""Create a :class:`~designer.uix.playground_size_selector.PlaygroundSizeView` for the current playground."""
<|body_0|>
def _update_playground(self, _, size):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlaygroundSizeSelector:
"""Button to open playground size selection view"""
def on_playground(self, *_):
"""Create a :class:`~designer.uix.playground_size_selector.PlaygroundSizeView` for the current playground."""
self.view = PlaygroundSizeView(selected_size=self.playground.size)
... | the_stack_v2_python_sparse | designer/uix/playground_size_selector.py | kived/kivy-designer | train | 3 |
89b841d68766ebfbd3bb77f775f63736cfd37dde | [
"logger.info('Processing BWA Aligner')\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)",
"output_files_generated = {}\noutput_metadata = {}\nlogger.info('PROCESS ALIGNMENT - DEFINED OUTPUT:', output_files['bam'])\nif 'genome_public' in input_files:\n input_files['ge... | <|body_start_0|>
logger.info('Processing BWA Aligner')
if configuration is None:
configuration = {}
self.configuration.update(configuration)
<|end_body_0|>
<|body_start_1|>
output_files_generated = {}
output_metadata = {}
logger.info('PROCESS ALIGNMENT - DEFI... | Functions for aligning FastQ files with BWA ALN | process_bwa | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class process_bwa:
"""Functions for aligning FastQ files with BWA ALN"""
def __init__(self, configuration=None):
"""Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to ... | stack_v2_sparse_classes_75kplus_train_006206 | 6,076 | permissive | [
{
"docstring": "Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.",
"name": "__init__",
"signature": "def __init__(self, configuration=None)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_035281 | Implement the Python class `process_bwa` described below.
Class description:
Functions for aligning FastQ files with BWA ALN
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how th... | Implement the Python class `process_bwa` described below.
Class description:
Functions for aligning FastQ files with BWA ALN
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how th... | 50c7115c0c1a6af48dc34f275e469d1b9eb02999 | <|skeleton|>
class process_bwa:
"""Functions for aligning FastQ files with BWA ALN"""
def __init__(self, configuration=None):
"""Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class process_bwa:
"""Functions for aligning FastQ files with BWA ALN"""
def __init__(self, configuration=None):
"""Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool."""... | the_stack_v2_python_sparse | process_align_bwa.py | Multiscale-Genomics/mg-process-fastq | train | 2 |
eca26e552fe5cd73a34aa3ad037f72c1031f0ae4 | [
"self.mimics = 'StdGaussian'\nself.rng = Generator(PCG64(rng_seed))\nsuper().__init__()",
"r = int(replications)\nn = int(n_samples)\nd = int(dimensions)\nreturn self.rng.standard_normal((r, n, d))"
] | <|body_start_0|>
self.mimics = 'StdGaussian'
self.rng = Generator(PCG64(rng_seed))
super().__init__()
<|end_body_0|>
<|body_start_1|>
r = int(replications)
n = int(n_samples)
d = int(dimensions)
return self.rng.standard_normal((r, n, d))
<|end_body_1|>
| Standard Gaussian | IIDStdGaussian | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IIDStdGaussian:
"""Standard Gaussian"""
def __init__(self, rng_seed=None):
"""Args: rng_seed (int): seed the random number generator for reproducibility"""
<|body_0|>
def gen_dd_samples(self, replications, n_samples, dimensions):
"""Generate r nxd IID Standard Ga... | stack_v2_sparse_classes_75kplus_train_006207 | 2,094 | no_license | [
{
"docstring": "Args: rng_seed (int): seed the random number generator for reproducibility",
"name": "__init__",
"signature": "def __init__(self, rng_seed=None)"
},
{
"docstring": "Generate r nxd IID Standard Gaussian samples Args: replications (int): Number of nxd matrices to generate (sample.s... | 2 | stack_v2_sparse_classes_30k_train_019167 | Implement the Python class `IIDStdGaussian` described below.
Class description:
Standard Gaussian
Method signatures and docstrings:
- def __init__(self, rng_seed=None): Args: rng_seed (int): seed the random number generator for reproducibility
- def gen_dd_samples(self, replications, n_samples, dimensions): Generate ... | Implement the Python class `IIDStdGaussian` described below.
Class description:
Standard Gaussian
Method signatures and docstrings:
- def __init__(self, rng_seed=None): Args: rng_seed (int): seed the random number generator for reproducibility
- def gen_dd_samples(self, replications, n_samples, dimensions): Generate ... | 9f37eb67f74c4b1a4ccfb5547a2b284cb5897d37 | <|skeleton|>
class IIDStdGaussian:
"""Standard Gaussian"""
def __init__(self, rng_seed=None):
"""Args: rng_seed (int): seed the random number generator for reproducibility"""
<|body_0|>
def gen_dd_samples(self, replications, n_samples, dimensions):
"""Generate r nxd IID Standard Ga... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IIDStdGaussian:
"""Standard Gaussian"""
def __init__(self, rng_seed=None):
"""Args: rng_seed (int): seed the random number generator for reproducibility"""
self.mimics = 'StdGaussian'
self.rng = Generator(PCG64(rng_seed))
super().__init__()
def gen_dd_samples(self, re... | the_stack_v2_python_sparse | python_prototype/qmcpy/discrete_distribution/iid_generators.py | jagadeesr/QMCSoftware | train | 0 |
d89c81ab826f5cc7e6bad3d06318c0fc63b2f5ea | [
"import logging\nlogging.getLogger('transformers').setLevel(logging.ERROR)\nimport os\nos.environ['TOKENIZERS_PARALLELISM'] = 'false'\nimport transformers\nself.tokenizer = transformers.BertTokenizer.from_pretrained('mymusise/EasternFantasyNoval')\nself.lm = transformers.TFGPT2LMHeadModel.from_pretrained('mymusise/... | <|body_start_0|>
import logging
logging.getLogger('transformers').setLevel(logging.ERROR)
import os
os.environ['TOKENIZERS_PARALLELISM'] = 'false'
import transformers
self.tokenizer = transformers.BertTokenizer.from_pretrained('mymusise/EasternFantasyNoval')
self.... | GPT2LMCH | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GPT2LMCH:
def __init__(self):
""":Package Requirements: * **torch** (if use_tf = False) * **tensorflow** >= 2.0.0 (if use_tf = True) * **transformers**"""
<|body_0|>
def __call__(self, sent):
""":param str sent: A sentence. :return: Fluency (ppl). :rtype: float"""
... | stack_v2_sparse_classes_75kplus_train_006208 | 1,330 | permissive | [
{
"docstring": ":Package Requirements: * **torch** (if use_tf = False) * **tensorflow** >= 2.0.0 (if use_tf = True) * **transformers**",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":param str sent: A sentence. :return: Fluency (ppl). :rtype: float",
"name": "__ca... | 2 | stack_v2_sparse_classes_30k_train_024951 | Implement the Python class `GPT2LMCH` described below.
Class description:
Implement the GPT2LMCH class.
Method signatures and docstrings:
- def __init__(self): :Package Requirements: * **torch** (if use_tf = False) * **tensorflow** >= 2.0.0 (if use_tf = True) * **transformers**
- def __call__(self, sent): :param str ... | Implement the Python class `GPT2LMCH` described below.
Class description:
Implement the GPT2LMCH class.
Method signatures and docstrings:
- def __init__(self): :Package Requirements: * **torch** (if use_tf = False) * **tensorflow** >= 2.0.0 (if use_tf = True) * **transformers**
- def __call__(self, sent): :param str ... | 412d1b2777dea5009fe97ac264044bfda65dfa5d | <|skeleton|>
class GPT2LMCH:
def __init__(self):
""":Package Requirements: * **torch** (if use_tf = False) * **tensorflow** >= 2.0.0 (if use_tf = True) * **transformers**"""
<|body_0|>
def __call__(self, sent):
""":param str sent: A sentence. :return: Fluency (ppl). :rtype: float"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GPT2LMCH:
def __init__(self):
""":Package Requirements: * **torch** (if use_tf = False) * **tensorflow** >= 2.0.0 (if use_tf = True) * **transformers**"""
import logging
logging.getLogger('transformers').setLevel(logging.ERROR)
import os
os.environ['TOKENIZERS_PARALLELI... | the_stack_v2_python_sparse | OpenAttack/metric/gptlmch.py | sigma-random/OpenAttack | train | 0 | |
ee8cdaf7c34941776a754f96e5c6059ffe52ad1c | [
"class S(SymbolDef):\n a\n b\n c\nself.assertIs(S.a, Symbol('a'))\nself.assertIs(S.b, Symbol('b'))\nself.assertIs(S.c, Symbol('c'))",
"class S(SymbolDef):\n a = Symbol('the-a-symbol')\nself.assertIs(S.a, Symbol('the-a-symbol'))",
"class S(SymbolDef):\n a = 'the-a-symbol'\nself.assertIs(S.a, Symbo... | <|body_start_0|>
class S(SymbolDef):
a
b
c
self.assertIs(S.a, Symbol('a'))
self.assertIs(S.b, Symbol('b'))
self.assertIs(S.c, Symbol('c'))
<|end_body_0|>
<|body_start_1|>
class S(SymbolDef):
a = Symbol('the-a-symbol')
self.... | Tests for SymbolDef class | SymbolDefTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SymbolDefTests:
"""Tests for SymbolDef class"""
def test_implicit_symbols(self):
"""verify that referencing names inside SymbolDef creates symbols"""
<|body_0|>
def test_custom_symbols(self):
"""verify that assigning symbols to variables works"""
<|body_1... | stack_v2_sparse_classes_75kplus_train_006209 | 5,099 | no_license | [
{
"docstring": "verify that referencing names inside SymbolDef creates symbols",
"name": "test_implicit_symbols",
"signature": "def test_implicit_symbols(self)"
},
{
"docstring": "verify that assigning symbols to variables works",
"name": "test_custom_symbols",
"signature": "def test_cus... | 6 | stack_v2_sparse_classes_30k_train_005826 | Implement the Python class `SymbolDefTests` described below.
Class description:
Tests for SymbolDef class
Method signatures and docstrings:
- def test_implicit_symbols(self): verify that referencing names inside SymbolDef creates symbols
- def test_custom_symbols(self): verify that assigning symbols to variables work... | Implement the Python class `SymbolDefTests` described below.
Class description:
Tests for SymbolDef class
Method signatures and docstrings:
- def test_implicit_symbols(self): verify that referencing names inside SymbolDef creates symbols
- def test_custom_symbols(self): verify that assigning symbols to variables work... | 78aa82cdb35808988214329b3b1aabcc2d1a5e01 | <|skeleton|>
class SymbolDefTests:
"""Tests for SymbolDef class"""
def test_implicit_symbols(self):
"""verify that referencing names inside SymbolDef creates symbols"""
<|body_0|>
def test_custom_symbols(self):
"""verify that assigning symbols to variables works"""
<|body_1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SymbolDefTests:
"""Tests for SymbolDef class"""
def test_implicit_symbols(self):
"""verify that referencing names inside SymbolDef creates symbols"""
class S(SymbolDef):
a
b
c
self.assertIs(S.a, Symbol('a'))
self.assertIs(S.b, Symbol('b'... | the_stack_v2_python_sparse | venv/lib/python3.6/site-packages/plainbox/impl/test_symbol.py | utkarshyadavin/CloudMarks | train | 0 |
d4ec8f8729eecd0b281f940eee5246c88529ae16 | [
"def dfs(root, ret):\n if root is None:\n ret.append('#')\n return\n ret.append(str(root.val) + ',' + str(len(root.children)))\n for each in root.children:\n dfs(each, ret)\nret = []\ndfs(root, ret)\nreturn ' '.join(ret)",
"def dfs(vals):\n val = next(vals).split(',')\n if val[... | <|body_start_0|>
def dfs(root, ret):
if root is None:
ret.append('#')
return
ret.append(str(root.val) + ',' + str(len(root.children)))
for each in root.children:
dfs(each, ret)
ret = []
dfs(root, ret)
ret... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_006210 | 4,629 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | stack_v2_sparse_classes_30k_train_005423 | 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: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 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: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 9190d3d178f1733aa226973757ee7e045b7bab00 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
def dfs(root, ret):
if root is None:
ret.append('#')
return
ret.append(str(root.val) + ',' + str(len(root.children)))
for ... | the_stack_v2_python_sparse | SerializeAndDeserializeN-aryTree.py | ellinx/LC-python | train | 1 | |
04c9be4607647c2a7ec7ae3c8426569dbdb60376 | [
"self.label = label\nself.interval = interval\nself.sub_process = None\nself.max_step = max_step",
"def progress_interval(interval, label):\n count = 1\n while True:\n p_str = '*^{}s'.format(int(count * 3))\n end = format('*', p_str)\n progress_str = '{}{}'.format(label, end)\n d... | <|body_start_0|>
self.label = label
self.interval = interval
self.sub_process = None
self.max_step = max_step
<|end_body_0|>
<|body_start_1|>
def progress_interval(interval, label):
count = 1
while True:
p_str = '*^{}s'.format(int(count * ... | 主进程阻塞任务,启动子单进程任务进度显示控制类 | AbuBlockProgress | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbuBlockProgress:
"""主进程阻塞任务,启动子单进程任务进度显示控制类"""
def __init__(self, label, interval=1, max_step=20):
""":param label: 阻塞进度条显示的文字信息 :param interval: 阻塞进度条显示的时间间隔 :param max_step: 进度最大显示粒度"""
<|body_0|>
def __enter__(self):
"""创建子进程做进度显示"""
<|body_1|>
d... | stack_v2_sparse_classes_75kplus_train_006211 | 17,350 | permissive | [
{
"docstring": ":param label: 阻塞进度条显示的文字信息 :param interval: 阻塞进度条显示的时间间隔 :param max_step: 进度最大显示粒度",
"name": "__init__",
"signature": "def __init__(self, label, interval=1, max_step=20)"
},
{
"docstring": "创建子进程做进度显示",
"name": "__enter__",
"signature": "def __enter__(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_010454 | Implement the Python class `AbuBlockProgress` described below.
Class description:
主进程阻塞任务,启动子单进程任务进度显示控制类
Method signatures and docstrings:
- def __init__(self, label, interval=1, max_step=20): :param label: 阻塞进度条显示的文字信息 :param interval: 阻塞进度条显示的时间间隔 :param max_step: 进度最大显示粒度
- def __enter__(self): 创建子进程做进度显示
- def _... | Implement the Python class `AbuBlockProgress` described below.
Class description:
主进程阻塞任务,启动子单进程任务进度显示控制类
Method signatures and docstrings:
- def __init__(self, label, interval=1, max_step=20): :param label: 阻塞进度条显示的文字信息 :param interval: 阻塞进度条显示的时间间隔 :param max_step: 进度最大显示粒度
- def __enter__(self): 创建子进程做进度显示
- def _... | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | <|skeleton|>
class AbuBlockProgress:
"""主进程阻塞任务,启动子单进程任务进度显示控制类"""
def __init__(self, label, interval=1, max_step=20):
""":param label: 阻塞进度条显示的文字信息 :param interval: 阻塞进度条显示的时间间隔 :param max_step: 进度最大显示粒度"""
<|body_0|>
def __enter__(self):
"""创建子进程做进度显示"""
<|body_1|>
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AbuBlockProgress:
"""主进程阻塞任务,启动子单进程任务进度显示控制类"""
def __init__(self, label, interval=1, max_step=20):
""":param label: 阻塞进度条显示的文字信息 :param interval: 阻塞进度条显示的时间间隔 :param max_step: 进度最大显示粒度"""
self.label = label
self.interval = interval
self.sub_process = None
self.max... | the_stack_v2_python_sparse | abupy/UtilBu/ABuProgress.py | luqin/firefly | train | 1 |
e62c4f231ccee54fd9cf0f74248830e4c9151ef8 | [
"super(ODEGCN, self).__init__()\nself.sp_blocks = nn.ModuleList([nn.Sequential(STGCNBlock(in_channels=num_features, out_channels=[64, 32, 64], num_nodes=num_nodes, A_hat=A_sp_hat), STGCNBlock(in_channels=64, out_channels=[64, 32, 64], num_nodes=num_nodes, A_hat=A_sp_hat)) for _ in range(3)])\nself.se_blocks = nn.Mo... | <|body_start_0|>
super(ODEGCN, self).__init__()
self.sp_blocks = nn.ModuleList([nn.Sequential(STGCNBlock(in_channels=num_features, out_channels=[64, 32, 64], num_nodes=num_nodes, A_hat=A_sp_hat), STGCNBlock(in_channels=64, out_channels=[64, 32, 64], num_nodes=num_nodes, A_hat=A_sp_hat)) for _ in range(3... | the overall network framework | ODEGCN | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ODEGCN:
"""the overall network framework"""
def __init__(self, num_nodes, num_features, num_timesteps_input, num_timesteps_output, A_sp_hat, A_se_hat):
"""Args: num_nodes : number of nodes in the graph num_features : number of features at each node in each time step num_timesteps_inp... | stack_v2_sparse_classes_75kplus_train_006212 | 6,444 | permissive | [
{
"docstring": "Args: num_nodes : number of nodes in the graph num_features : number of features at each node in each time step num_timesteps_input : number of past time steps fed into the network num_timesteps_output : desired number of future time steps output by the network A_sp_hat : nomarlized adjacency sp... | 2 | stack_v2_sparse_classes_30k_train_032721 | Implement the Python class `ODEGCN` described below.
Class description:
the overall network framework
Method signatures and docstrings:
- def __init__(self, num_nodes, num_features, num_timesteps_input, num_timesteps_output, A_sp_hat, A_se_hat): Args: num_nodes : number of nodes in the graph num_features : number of ... | Implement the Python class `ODEGCN` described below.
Class description:
the overall network framework
Method signatures and docstrings:
- def __init__(self, num_nodes, num_features, num_timesteps_input, num_timesteps_output, A_sp_hat, A_se_hat): Args: num_nodes : number of nodes in the graph num_features : number of ... | 38cc696315eef0790dc03324314aa30732b34a65 | <|skeleton|>
class ODEGCN:
"""the overall network framework"""
def __init__(self, num_nodes, num_features, num_timesteps_input, num_timesteps_output, A_sp_hat, A_se_hat):
"""Args: num_nodes : number of nodes in the graph num_features : number of features at each node in each time step num_timesteps_inp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ODEGCN:
"""the overall network framework"""
def __init__(self, num_nodes, num_features, num_timesteps_input, num_timesteps_output, A_sp_hat, A_se_hat):
"""Args: num_nodes : number of nodes in the graph num_features : number of features at each node in each time step num_timesteps_input : number o... | the_stack_v2_python_sparse | model.py | BOBO-artist/STGODE | train | 0 |
e12791dbe28ed46541615678f51bd06cb032b84e | [
"super().__init__()\nself.device = device\nself.feature_dim = feature_dim\nself.embedding_dim = embedding_dim\nself.linear_classifier = nn.Sequential(nn.Linear(self.embedding_dim * feature_dim, hidden_dim1), nn.Sigmoid(), nn.Linear(hidden_dim1, hidden_dim2), nn.Sigmoid(), nn.Linear(hidden_dim2, output_dim), nn.Sigm... | <|body_start_0|>
super().__init__()
self.device = device
self.feature_dim = feature_dim
self.embedding_dim = embedding_dim
self.linear_classifier = nn.Sequential(nn.Linear(self.embedding_dim * feature_dim, hidden_dim1), nn.Sigmoid(), nn.Linear(hidden_dim1, hidden_dim2), nn.Sigmoi... | Scorer | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Scorer:
def __init__(self, feature_dim, embedding_dim, hidden_dim1, hidden_dim2, output_dim, device):
"""Contructor Parameters ---------- feature_dim : int Number of features. For base model, 1 and for extended model, 3. embedding_dim : int Embedding dimension. hidden_dim1 : int Hidden d... | stack_v2_sparse_classes_75kplus_train_006213 | 14,357 | permissive | [
{
"docstring": "Contructor Parameters ---------- feature_dim : int Number of features. For base model, 1 and for extended model, 3. embedding_dim : int Embedding dimension. hidden_dim1 : int Hidden dimension for MLP layer 1 in scorer. hidden_dim2 : int Hidden dimension for MLP layer 2 in scorer. output_dim : in... | 2 | stack_v2_sparse_classes_30k_train_013815 | Implement the Python class `Scorer` described below.
Class description:
Implement the Scorer class.
Method signatures and docstrings:
- def __init__(self, feature_dim, embedding_dim, hidden_dim1, hidden_dim2, output_dim, device): Contructor Parameters ---------- feature_dim : int Number of features. For base model, 1... | Implement the Python class `Scorer` described below.
Class description:
Implement the Scorer class.
Method signatures and docstrings:
- def __init__(self, feature_dim, embedding_dim, hidden_dim1, hidden_dim2, output_dim, device): Contructor Parameters ---------- feature_dim : int Number of features. For base model, 1... | eb1bbf2f124db8dea143965e419e17cfb93b17f3 | <|skeleton|>
class Scorer:
def __init__(self, feature_dim, embedding_dim, hidden_dim1, hidden_dim2, output_dim, device):
"""Contructor Parameters ---------- feature_dim : int Number of features. For base model, 1 and for extended model, 3. embedding_dim : int Embedding dimension. hidden_dim1 : int Hidden d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Scorer:
def __init__(self, feature_dim, embedding_dim, hidden_dim1, hidden_dim2, output_dim, device):
"""Contructor Parameters ---------- feature_dim : int Number of features. For base model, 1 and for extended model, 3. embedding_dim : int Embedding dimension. hidden_dim1 : int Hidden dimension for M... | the_stack_v2_python_sparse | Alignment_Model/model.py | TheresaSchmidt/ara | train | 0 | |
483140f5d0b3338d66a8d055fbab662f812b53d1 | [
"self.confirmed = confirmed\nself.synchronous = synchronous\nself.actions = actions",
"if dictionary is None:\n return None\nactions = None\nif dictionary.get('actions') != None:\n actions = list()\n for structure in dictionary.get('actions'):\n actions.append(meraki_sdk.models.action_model.Action... | <|body_start_0|>
self.confirmed = confirmed
self.synchronous = synchronous
self.actions = actions
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
actions = None
if dictionary.get('actions') != None:
actions = list()
... | Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset once it is true. Defaults to false. synchronous (bool): Set to... | CreateOrganizationActionBatchModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateOrganizationActionBatchModel:
"""Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset ... | stack_v2_sparse_classes_75kplus_train_006214 | 2,674 | permissive | [
{
"docstring": "Constructor for the CreateOrganizationActionBatchModel class",
"name": "__init__",
"signature": "def __init__(self, actions=None, confirmed=None, synchronous=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary ... | 2 | stack_v2_sparse_classes_30k_train_010364 | Implement the Python class `CreateOrganizationActionBatchModel` described below.
Class description:
Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before ex... | Implement the Python class `CreateOrganizationActionBatchModel` described below.
Class description:
Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before ex... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class CreateOrganizationActionBatchModel:
"""Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateOrganizationActionBatchModel:
"""Implementation of the 'createOrganizationActionBatch' model. TODO: type model description here. Attributes: confirmed (bool): Set to true for immediate execution. Set to false if the action should be previewed before executing. This property cannot be unset once it is tr... | the_stack_v2_python_sparse | meraki_sdk/models/create_organization_action_batch_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
df1ef78c6479f5da68addb41e3f82c2f3815efa1 | [
"if not v:\n raise ValueError('courier_id is required')\nif type(v) != int:\n raise ValueError('courier_id must be integer')\nif v < 0 or v > 9223372036854775807:\n raise ValueError('courier_id out of allowed range')\nreturn v",
"excess_fields = set(values.keys()).difference({'courier_id'})\nif excess_fi... | <|body_start_0|>
if not v:
raise ValueError('courier_id is required')
if type(v) != int:
raise ValueError('courier_id must be integer')
if v < 0 or v > 9223372036854775807:
raise ValueError('courier_id out of allowed range')
return v
<|end_body_0|>
<|... | Описывает стрктуру данных для назначения заказов | AssignDataModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssignDataModel:
"""Описывает стрктуру данных для назначения заказов"""
def validate_courier_id(cls, v: int) -> int:
"""Валидирует courier_id"""
<|body_0|>
def validate_excess_fields(cls, values: Dict) -> Dict:
"""Валидирует отсутствие лишних полей"""
<|b... | stack_v2_sparse_classes_75kplus_train_006215 | 8,762 | no_license | [
{
"docstring": "Валидирует courier_id",
"name": "validate_courier_id",
"signature": "def validate_courier_id(cls, v: int) -> int"
},
{
"docstring": "Валидирует отсутствие лишних полей",
"name": "validate_excess_fields",
"signature": "def validate_excess_fields(cls, values: Dict) -> Dict"... | 2 | stack_v2_sparse_classes_30k_train_006340 | Implement the Python class `AssignDataModel` described below.
Class description:
Описывает стрктуру данных для назначения заказов
Method signatures and docstrings:
- def validate_courier_id(cls, v: int) -> int: Валидирует courier_id
- def validate_excess_fields(cls, values: Dict) -> Dict: Валидирует отсутствие лишних... | Implement the Python class `AssignDataModel` described below.
Class description:
Описывает стрктуру данных для назначения заказов
Method signatures and docstrings:
- def validate_courier_id(cls, v: int) -> int: Валидирует courier_id
- def validate_excess_fields(cls, values: Dict) -> Dict: Валидирует отсутствие лишних... | f1a908e5d6b30b826c38d24c52a721764f056fde | <|skeleton|>
class AssignDataModel:
"""Описывает стрктуру данных для назначения заказов"""
def validate_courier_id(cls, v: int) -> int:
"""Валидирует courier_id"""
<|body_0|>
def validate_excess_fields(cls, values: Dict) -> Dict:
"""Валидирует отсутствие лишних полей"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AssignDataModel:
"""Описывает стрктуру данных для назначения заказов"""
def validate_courier_id(cls, v: int) -> int:
"""Валидирует courier_id"""
if not v:
raise ValueError('courier_id is required')
if type(v) != int:
raise ValueError('courier_id must be int... | the_stack_v2_python_sparse | candyapi/orders/validators.py | IntAlgambra/candyapi | train | 0 |
bd1733748dd9b82f4766d6ca9c63593826e991b7 | [
"threading.Thread.__init__(self)\nself.hass = hass\nself.stopped = threading.Event()\nself.on_receive_vto_event = on_receive_vto_event\nself.client = client\nself.started = False\nself._host = host\nself._port = port\nself._username = username\nself._password = password\nself._is_ssl = False\nself.vto_client = None... | <|body_start_0|>
threading.Thread.__init__(self)
self.hass = hass
self.stopped = threading.Event()
self.on_receive_vto_event = on_receive_vto_event
self.client = client
self.started = False
self._host = host
self._port = port
self._username = usern... | Connects to device and subscribes to events. Mainly to capture motion detection events. | DahuaVtoEventThread | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DahuaVtoEventThread:
"""Connects to device and subscribes to events. Mainly to capture motion detection events."""
def __init__(self, hass: HomeAssistant, client: DahuaClient, on_receive_vto_event, host: str, port: int, username: str, password: str):
"""Construct a thread listening f... | stack_v2_sparse_classes_75kplus_train_006216 | 5,648 | permissive | [
{
"docstring": "Construct a thread listening for events.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, client: DahuaClient, on_receive_vto_event, host: str, port: int, username: str, password: str)"
},
{
"docstring": "Fetch VTO events",
"name": "run",
"signa... | 3 | stack_v2_sparse_classes_30k_train_040103 | Implement the Python class `DahuaVtoEventThread` described below.
Class description:
Connects to device and subscribes to events. Mainly to capture motion detection events.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, client: DahuaClient, on_receive_vto_event, host: str, port: int, user... | Implement the Python class `DahuaVtoEventThread` described below.
Class description:
Connects to device and subscribes to events. Mainly to capture motion detection events.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, client: DahuaClient, on_receive_vto_event, host: str, port: int, user... | 1048a33ab025208228ca2b99375f052577514e42 | <|skeleton|>
class DahuaVtoEventThread:
"""Connects to device and subscribes to events. Mainly to capture motion detection events."""
def __init__(self, hass: HomeAssistant, client: DahuaClient, on_receive_vto_event, host: str, port: int, username: str, password: str):
"""Construct a thread listening f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DahuaVtoEventThread:
"""Connects to device and subscribes to events. Mainly to capture motion detection events."""
def __init__(self, hass: HomeAssistant, client: DahuaClient, on_receive_vto_event, host: str, port: int, username: str, password: str):
"""Construct a thread listening for events."""... | the_stack_v2_python_sparse | custom_components/dahua/thread.py | rohankapoorcom/homeassistant-config | train | 1 |
1d92a43c0216e38bd48d3950a7b1576075539b25 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | SCPSecretServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SCPSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getSCPSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createSCPSecret(self, request, context):
"""Missing as... | stack_v2_sparse_classes_75kplus_train_006217 | 7,947 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "getSCPSecret",
"signature": "def getSCPSecret(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "createSCPSecret",
"signature": "def createSCPS... | 4 | stack_v2_sparse_classes_30k_val_001526 | Implement the Python class `SCPSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getSCPSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createSCPSecret(self, request,... | Implement the Python class `SCPSecretServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def getSCPSecret(self, request, context): Missing associated documentation comment in .proto file.
- def createSCPSecret(self, request,... | c69e14b409add099d151434b9add711e41f41b20 | <|skeleton|>
class SCPSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getSCPSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def createSCPSecret(self, request, context):
"""Missing as... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SCPSecretServiceServicer:
"""Missing associated documentation comment in .proto file."""
def getSCPSecret(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not impleme... | the_stack_v2_python_sparse | python-sdk/src/airavata_mft_sdk/scp/SCPSecretService_pb2_grpc.py | apache/airavata-mft | train | 23 |
ff3fca948cf5e82e00dd85cc1c6b96e8278eb91c | [
"partial = kwargs.pop('partial', False)\ninstance = self.get_object()\nserializer = self.get_serializer(instance, data=request.data, partial=partial)\nserializer.is_valid(raise_exception=True)\nif Credential.objects.filter(owner=request.user, name=serializer.validated_data['name'], linux_user=serializer.validated_d... | <|body_start_0|>
partial = kwargs.pop('partial', False)
instance = self.get_object()
serializer = self.get_serializer(instance, data=request.data, partial=partial)
serializer.is_valid(raise_exception=True)
if Credential.objects.filter(owner=request.user, name=serializer.validated... | UpdateCredentialView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateCredentialView:
def update(self, request, *args, **kwargs):
"""Overwritten the default `update` method in order to catch unique constraint violation."""
<|body_0|>
def perform_update(self, serializer):
"""Overwrite the default 'perform_update' method in order t... | stack_v2_sparse_classes_75kplus_train_006218 | 43,758 | permissive | [
{
"docstring": "Overwritten the default `update` method in order to catch unique constraint violation.",
"name": "update",
"signature": "def update(self, request, *args, **kwargs)"
},
{
"docstring": "Overwrite the default 'perform_update' method in order to properly handle tags received as value... | 2 | stack_v2_sparse_classes_30k_train_013993 | Implement the Python class `UpdateCredentialView` described below.
Class description:
Implement the UpdateCredentialView class.
Method signatures and docstrings:
- def update(self, request, *args, **kwargs): Overwritten the default `update` method in order to catch unique constraint violation.
- def perform_update(se... | Implement the Python class `UpdateCredentialView` described below.
Class description:
Implement the UpdateCredentialView class.
Method signatures and docstrings:
- def update(self, request, *args, **kwargs): Overwritten the default `update` method in order to catch unique constraint violation.
- def perform_update(se... | 702254c48677cf5a6f2fe298bced854299868eef | <|skeleton|>
class UpdateCredentialView:
def update(self, request, *args, **kwargs):
"""Overwritten the default `update` method in order to catch unique constraint violation."""
<|body_0|>
def perform_update(self, serializer):
"""Overwrite the default 'perform_update' method in order t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdateCredentialView:
def update(self, request, *args, **kwargs):
"""Overwritten the default `update` method in order to catch unique constraint violation."""
partial = kwargs.pop('partial', False)
instance = self.get_object()
serializer = self.get_serializer(instance, data=req... | the_stack_v2_python_sparse | backend/device_registry/api_views.py | a-martynovich/api | train | 0 | |
e5e714d52355da1926bd8437293916c743bf3eee | [
"self.sumw = hist[0]\nself.edges = hist[1]\nself.varname = hist[2]\nself.centers = self.edges[:-1] + np.diff(self.edges) / 2\nself.norm = self.sumw.sum()\nself.mean = (self.sumw * self.centers).sum() / self.norm\nself.cdf = interp1d(x=self.edges, y=np.r_[0, np.cumsum(self.sumw / self.norm)], kind='linear', assume_s... | <|body_start_0|>
self.sumw = hist[0]
self.edges = hist[1]
self.varname = hist[2]
self.centers = self.edges[:-1] + np.diff(self.edges) / 2
self.norm = self.sumw.sum()
self.mean = (self.sumw * self.centers).sum() / self.norm
self.cdf = interp1d(x=self.edges, y=np.r_... | AffineMorphTemplate | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AffineMorphTemplate:
def __init__(self, hist):
"""hist: a numpy-histogram-like tuple of (sumw, edges)"""
<|body_0|>
def get(self, shift=0.0, smear=1.0):
"""Return a shifted and smeard histogram i.e. new edges = edges * smear + shift"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_75kplus_train_006219 | 2,182 | permissive | [
{
"docstring": "hist: a numpy-histogram-like tuple of (sumw, edges)",
"name": "__init__",
"signature": "def __init__(self, hist)"
},
{
"docstring": "Return a shifted and smeard histogram i.e. new edges = edges * smear + shift",
"name": "get",
"signature": "def get(self, shift=0.0, smear=... | 2 | stack_v2_sparse_classes_30k_train_028617 | Implement the Python class `AffineMorphTemplate` described below.
Class description:
Implement the AffineMorphTemplate class.
Method signatures and docstrings:
- def __init__(self, hist): hist: a numpy-histogram-like tuple of (sumw, edges)
- def get(self, shift=0.0, smear=1.0): Return a shifted and smeard histogram i... | Implement the Python class `AffineMorphTemplate` described below.
Class description:
Implement the AffineMorphTemplate class.
Method signatures and docstrings:
- def __init__(self, hist): hist: a numpy-histogram-like tuple of (sumw, edges)
- def get(self, shift=0.0, smear=1.0): Return a shifted and smeard histogram i... | 79aa39ada2560c5c705200489ae8e8b9faf64d46 | <|skeleton|>
class AffineMorphTemplate:
def __init__(self, hist):
"""hist: a numpy-histogram-like tuple of (sumw, edges)"""
<|body_0|>
def get(self, shift=0.0, smear=1.0):
"""Return a shifted and smeard histogram i.e. new edges = edges * smear + shift"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AffineMorphTemplate:
def __init__(self, hist):
"""hist: a numpy-histogram-like tuple of (sumw, edges)"""
self.sumw = hist[0]
self.edges = hist[1]
self.varname = hist[2]
self.centers = self.edges[:-1] + np.diff(self.edges) / 2
self.norm = self.sumw.sum()
... | the_stack_v2_python_sparse | rhalphalib/template_morph.py | nsmith-/rhalphalib | train | 3 | |
61d961f54b90fa54a30ac1574a0b875fd5b3a6b9 | [
"split = None\nfirst_sep_match_index = min([n for n, i in enumerate(seps) if i in stem], default=None)\nfirst_sep_match = seps[first_sep_match_index] if first_sep_match_index != None else None\nsplit = stem.split(first_sep_match)\n_lensplit = len(split)\nif _lensplit == 0:\n sID, position = (split[0], 0)\nelif l... | <|body_start_0|>
split = None
first_sep_match_index = min([n for n, i in enumerate(seps) if i in stem], default=None)
first_sep_match = seps[first_sep_match_index] if first_sep_match_index != None else None
split = stem.split(first_sep_match)
_lensplit = len(split)
if _le... | Collection of method for parsing a filename | ParserMethods | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParserMethods:
"""Collection of method for parsing a filename"""
def parse_filestem_to_sid_and_pos(stem: str, seps=('_', ' ', '-')):
"""Parser for the filenames -> finds SampleID and sample position Parameters ---------- # ramanfile_stem : str # The filepath which the is parsed seps ... | stack_v2_sparse_classes_75kplus_train_006220 | 7,682 | permissive | [
{
"docstring": "Parser for the filenames -> finds SampleID and sample position Parameters ---------- # ramanfile_stem : str # The filepath which the is parsed seps : tuple of str default ordered collection of seperators tried for split default : ('_', ' ', '-') Returns ------- tuple of strings Collection of str... | 3 | stack_v2_sparse_classes_30k_train_032905 | Implement the Python class `ParserMethods` described below.
Class description:
Collection of method for parsing a filename
Method signatures and docstrings:
- def parse_filestem_to_sid_and_pos(stem: str, seps=('_', ' ', '-')): Parser for the filenames -> finds SampleID and sample position Parameters ---------- # rama... | Implement the Python class `ParserMethods` described below.
Class description:
Collection of method for parsing a filename
Method signatures and docstrings:
- def parse_filestem_to_sid_and_pos(stem: str, seps=('_', ' ', '-')): Parser for the filenames -> finds SampleID and sample position Parameters ---------- # rama... | 1a9d8107bf44f2ce568d7c9a93613823a1863d51 | <|skeleton|>
class ParserMethods:
"""Collection of method for parsing a filename"""
def parse_filestem_to_sid_and_pos(stem: str, seps=('_', ' ', '-')):
"""Parser for the filenames -> finds SampleID and sample position Parameters ---------- # ramanfile_stem : str # The filepath which the is parsed seps ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParserMethods:
"""Collection of method for parsing a filename"""
def parse_filestem_to_sid_and_pos(stem: str, seps=('_', ' ', '-')):
"""Parser for the filenames -> finds SampleID and sample position Parameters ---------- # ramanfile_stem : str # The filepath which the is parsed seps : tuple of st... | the_stack_v2_python_sparse | src/raman_fitting/indexer/filename_parser.py | RassoulTOP/raman-fitting | train | 0 |
71e3d0c8d8f005f7e20bd56419bd3cedd0ea05e0 | [
"self.pool_name = pool_name\nself.subnet = subnet\nself.use_smart_connect = use_smart_connect",
"if dictionary is None:\n return None\npool_name = dictionary.get('poolName')\nsubnet = dictionary.get('subnet')\nuse_smart_connect = dictionary.get('useSmartConnect')\nreturn cls(pool_name, subnet, use_smart_connec... | <|body_start_0|>
self.pool_name = pool_name
self.subnet = subnet
self.use_smart_connect = use_smart_connect
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
pool_name = dictionary.get('poolName')
subnet = dictionary.get('subnet')
use... | Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name of the subnet the network pool belongs to. us... | NetworkPoolConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetworkPoolConfig:
"""Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name ... | stack_v2_sparse_classes_75kplus_train_006221 | 2,126 | permissive | [
{
"docstring": "Constructor for the NetworkPoolConfig class",
"name": "__init__",
"signature": "def __init__(self, pool_name=None, subnet=None, use_smart_connect=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representati... | 2 | stack_v2_sparse_classes_30k_train_006012 | Implement the Python class `NetworkPoolConfig` described below.
Class description:
Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network poo... | Implement the Python class `NetworkPoolConfig` described below.
Class description:
Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network poo... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NetworkPoolConfig:
"""Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NetworkPoolConfig:
"""Implementation of the 'NetworkPoolConfig' model. While caonfiguring the isilon protection source, this is the selected network pool config for the isilon access zone. Attributes: pool_name (string): Specifies the name of the Network pool. subnet (string): Specifies the name of the subnet... | the_stack_v2_python_sparse | cohesity_management_sdk/models/network_pool_config.py | cohesity/management-sdk-python | train | 24 |
d7b106f05df134d2fa2d3bfd997385fdd56236ec | [
"requestor = Requestor(local_api_key=api_key)\nurl = cls.class_url()\nwrapped_params = {cls.snakecase_name(): params}\nresponse, api_key = requestor.request(method=RequestMethod.POST, url=url, params=wrapped_params)\nreturn convert_to_easypost_object(response=response, api_key=api_key)",
"if not easypost_id:\n ... | <|body_start_0|>
requestor = Requestor(local_api_key=api_key)
url = cls.class_url()
wrapped_params = {cls.snakecase_name(): params}
response, api_key = requestor.request(method=RequestMethod.POST, url=url, params=wrapped_params)
return convert_to_easypost_object(response=response... | User | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User:
def create(cls, api_key: Optional[str]=None, **params) -> 'User':
"""Create a child user."""
<|body_0|>
def retrieve(cls, easypost_id: Optional[str]=None, api_key: Optional[str]=None, **params) -> 'User':
"""Retrieve a user."""
<|body_1|>
def retri... | stack_v2_sparse_classes_75kplus_train_006222 | 3,246 | permissive | [
{
"docstring": "Create a child user.",
"name": "create",
"signature": "def create(cls, api_key: Optional[str]=None, **params) -> 'User'"
},
{
"docstring": "Retrieve a user.",
"name": "retrieve",
"signature": "def retrieve(cls, easypost_id: Optional[str]=None, api_key: Optional[str]=None,... | 6 | stack_v2_sparse_classes_30k_train_013700 | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def create(cls, api_key: Optional[str]=None, **params) -> 'User': Create a child user.
- def retrieve(cls, easypost_id: Optional[str]=None, api_key: Optional[str]=None, **params) -> 'Use... | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def create(cls, api_key: Optional[str]=None, **params) -> 'User': Create a child user.
- def retrieve(cls, easypost_id: Optional[str]=None, api_key: Optional[str]=None, **params) -> 'Use... | c8f7a3f2472ae5fea13a5b596b4618bd55f3be0c | <|skeleton|>
class User:
def create(cls, api_key: Optional[str]=None, **params) -> 'User':
"""Create a child user."""
<|body_0|>
def retrieve(cls, easypost_id: Optional[str]=None, api_key: Optional[str]=None, **params) -> 'User':
"""Retrieve a user."""
<|body_1|>
def retri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class User:
def create(cls, api_key: Optional[str]=None, **params) -> 'User':
"""Create a child user."""
requestor = Requestor(local_api_key=api_key)
url = cls.class_url()
wrapped_params = {cls.snakecase_name(): params}
response, api_key = requestor.request(method=RequestMeth... | the_stack_v2_python_sparse | easypost/user.py | dsanders11/easypost-python | train | 0 | |
e2b3ed379ef71f108e0b2bf7dce7731603c6238a | [
"records.update(state=Record.AVAILABLE)\nfor record in records:\n admin.models.LogEntry.objects.log_action(user_id=request.user.pk, content_type_id=ContentType.objects.get(model='record').id, object_id=record.pk, object_repr=force_text(record), action_flag=admin.models.CHANGE, change_message='Record was unlocked... | <|body_start_0|>
records.update(state=Record.AVAILABLE)
for record in records:
admin.models.LogEntry.objects.log_action(user_id=request.user.pk, content_type_id=ContentType.objects.get(model='record').id, object_id=record.pk, object_repr=force_text(record), action_flag=admin.models.CHANGE, c... | RecordAdmin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecordAdmin:
def unlock(self, request, records):
"""Unlock selected students which must be lock state."""
<|body_0|>
def apply_blacklist(self, request, records):
"""Apply some student to black list."""
<|body_1|>
def get_actions(self, request):
"... | stack_v2_sparse_classes_75kplus_train_006223 | 2,609 | permissive | [
{
"docstring": "Unlock selected students which must be lock state.",
"name": "unlock",
"signature": "def unlock(self, request, records)"
},
{
"docstring": "Apply some student to black list.",
"name": "apply_blacklist",
"signature": "def apply_blacklist(self, request, records)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_035363 | Implement the Python class `RecordAdmin` described below.
Class description:
Implement the RecordAdmin class.
Method signatures and docstrings:
- def unlock(self, request, records): Unlock selected students which must be lock state.
- def apply_blacklist(self, request, records): Apply some student to black list.
- de... | Implement the Python class `RecordAdmin` described below.
Class description:
Implement the RecordAdmin class.
Method signatures and docstrings:
- def unlock(self, request, records): Unlock selected students which must be lock state.
- def apply_blacklist(self, request, records): Apply some student to black list.
- de... | a3453a8993db673eeec5bec09caf3e908ebfad85 | <|skeleton|>
class RecordAdmin:
def unlock(self, request, records):
"""Unlock selected students which must be lock state."""
<|body_0|>
def apply_blacklist(self, request, records):
"""Apply some student to black list."""
<|body_1|>
def get_actions(self, request):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RecordAdmin:
def unlock(self, request, records):
"""Unlock selected students which must be lock state."""
records.update(state=Record.AVAILABLE)
for record in records:
admin.models.LogEntry.objects.log_action(user_id=request.user.pk, content_type_id=ContentType.objects.get(... | the_stack_v2_python_sparse | core/admin.py | NTUOSC/ntu-vote-auth-server | train | 7 | |
888fe82b483a24c97ff26a521d7bd8dca6e887ab | [
"width = car.w\nratio = Classyfication.get_ratio()\nreturn width * ratio",
"height = car.h\nratio = Classyfication.get_ratio()\nreturn height * ratio",
"contours = ContourDetector.find(mask)\ncnt = SizeMeasurment.__find_biggest_contour(contours)\narea = ContourDetector.area(cnt)\nratio = Classyfication.get_rati... | <|body_start_0|>
width = car.w
ratio = Classyfication.get_ratio()
return width * ratio
<|end_body_0|>
<|body_start_1|>
height = car.h
ratio = Classyfication.get_ratio()
return height * ratio
<|end_body_1|>
<|body_start_2|>
contours = ContourDetector.find(mask)
... | SizeMeasurment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SizeMeasurment:
def calculate_width(car: Vehicle):
"""Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float"""
<|body_0|>
def calculate_height(car: Vehicle):
"""Wylicza... | stack_v2_sparse_classes_75kplus_train_006224 | 14,920 | no_license | [
{
"docstring": "Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float",
"name": "calculate_width",
"signature": "def calculate_width(car: Vehicle)"
},
{
"docstring": "Wylicza wysokośc samochodu w m... | 6 | stack_v2_sparse_classes_30k_train_021084 | Implement the Python class `SizeMeasurment` described below.
Class description:
Implement the SizeMeasurment class.
Method signatures and docstrings:
- def calculate_width(car: Vehicle): Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w m... | Implement the Python class `SizeMeasurment` described below.
Class description:
Implement the SizeMeasurment class.
Method signatures and docstrings:
- def calculate_width(car: Vehicle): Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w m... | c8d6be403f12e01d3a2c0ea671363f20eeb08ce4 | <|skeleton|>
class SizeMeasurment:
def calculate_width(car: Vehicle):
"""Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float"""
<|body_0|>
def calculate_height(car: Vehicle):
"""Wylicza... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SizeMeasurment:
def calculate_width(car: Vehicle):
"""Wylicza szerokość(długość) samochodu w metrach. :param Vehicle car: Obiekt reprezenetujący samochód. :return: Szerkość wyrażona w metrach. :rtype: float"""
width = car.w
ratio = Classyfication.get_ratio()
return width * rati... | the_stack_v2_python_sparse | src/classify.py | djgrasss/videodetection | train | 0 | |
e65fae160ea63fb8b362ccd5704e5203c4465e1f | [
"req_parser = RequestParser()\nreq_parser.add_argument('collect', type=inputs.boolean, required=True, location='json')\nargs = req_parser.parse_args()\ncollect = args['collect']\nquery = Material.query.filter_by(id=target, user_id=g.user_id, status=Material.STATUS.APPROVED)\nif collect:\n query.update({'is_colle... | <|body_start_0|>
req_parser = RequestParser()
req_parser.add_argument('collect', type=inputs.boolean, required=True, location='json')
args = req_parser.parse_args()
collect = args['collect']
query = Material.query.filter_by(id=target, user_id=g.user_id, status=Material.STATUS.APP... | 图片资源 | ImageResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageResource:
"""图片资源"""
def put(self, target):
"""修改收藏状态"""
<|body_0|>
def delete(self, target):
"""删除图片"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
req_parser = RequestParser()
req_parser.add_argument('collect', type=inputs.boolea... | stack_v2_sparse_classes_75kplus_train_006225 | 4,926 | no_license | [
{
"docstring": "修改收藏状态",
"name": "put",
"signature": "def put(self, target)"
},
{
"docstring": "删除图片",
"name": "delete",
"signature": "def delete(self, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013698 | Implement the Python class `ImageResource` described below.
Class description:
图片资源
Method signatures and docstrings:
- def put(self, target): 修改收藏状态
- def delete(self, target): 删除图片 | Implement the Python class `ImageResource` described below.
Class description:
图片资源
Method signatures and docstrings:
- def put(self, target): 修改收藏状态
- def delete(self, target): 删除图片
<|skeleton|>
class ImageResource:
"""图片资源"""
def put(self, target):
"""修改收藏状态"""
<|body_0|>
def delete(s... | c9703a9c57a98babf8d1e41b227aada9ef4bfe15 | <|skeleton|>
class ImageResource:
"""图片资源"""
def put(self, target):
"""修改收藏状态"""
<|body_0|>
def delete(self, target):
"""删除图片"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageResource:
"""图片资源"""
def put(self, target):
"""修改收藏状态"""
req_parser = RequestParser()
req_parser.add_argument('collect', type=inputs.boolean, required=True, location='json')
args = req_parser.parse_args()
collect = args['collect']
query = Material.quer... | the_stack_v2_python_sparse | mp/resources/news/material.py | Yaooooooooooooo/toutiao-backend | train | 0 |
32c28af78853539cb1a6a8ebdbd6e51cf7310fba | [
"self.ai_settings = ai_settings\nself.reset_stats()\nself.game_active = False\nself.hs_file = open('high_score.txt', 'r')\nself.high_score = self.hs_file.read()",
"self.ships_left = self.ai_settings.ship_limit\nself.score = 0\nself.level = 1"
] | <|body_start_0|>
self.ai_settings = ai_settings
self.reset_stats()
self.game_active = False
self.hs_file = open('high_score.txt', 'r')
self.high_score = self.hs_file.read()
<|end_body_0|>
<|body_start_1|>
self.ships_left = self.ai_settings.ship_limit
self.score =... | Track statistics for Alien Invasion | GameStats | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameStats:
"""Track statistics for Alien Invasion"""
def __init__(self, ai_settings):
"""Initialise statistics."""
<|body_0|>
def reset_stats(self):
"""Initialise statistics that can change during the game."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_006226 | 763 | no_license | [
{
"docstring": "Initialise statistics.",
"name": "__init__",
"signature": "def __init__(self, ai_settings)"
},
{
"docstring": "Initialise statistics that can change during the game.",
"name": "reset_stats",
"signature": "def reset_stats(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_042173 | Implement the Python class `GameStats` described below.
Class description:
Track statistics for Alien Invasion
Method signatures and docstrings:
- def __init__(self, ai_settings): Initialise statistics.
- def reset_stats(self): Initialise statistics that can change during the game. | Implement the Python class `GameStats` described below.
Class description:
Track statistics for Alien Invasion
Method signatures and docstrings:
- def __init__(self, ai_settings): Initialise statistics.
- def reset_stats(self): Initialise statistics that can change during the game.
<|skeleton|>
class GameStats:
... | 1f943c7c5424fa7c4d6d1e89c1a0e72183744983 | <|skeleton|>
class GameStats:
"""Track statistics for Alien Invasion"""
def __init__(self, ai_settings):
"""Initialise statistics."""
<|body_0|>
def reset_stats(self):
"""Initialise statistics that can change during the game."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameStats:
"""Track statistics for Alien Invasion"""
def __init__(self, ai_settings):
"""Initialise statistics."""
self.ai_settings = ai_settings
self.reset_stats()
self.game_active = False
self.hs_file = open('high_score.txt', 'r')
self.high_score = self.h... | the_stack_v2_python_sparse | alien_invasion/game_stats.py | Elisabeth-A/Alien-Invasion-Game | train | 0 |
90884b41eaf5730f0e863cc4192d527fb2a08603 | [
"if re.search('([^a-zA-Z/._\\\\d+])', username) is None:\n return username\nraise serializers.ValidationError('Username can only contain alphanumeric characters and . or _.')",
"if re.search('(^(?=.*[a-z])(?=.*[A-Z])(?=.*\\\\d)(?=.*[@$!%*?&])[A-Za-z\\\\d@$_!%*?&]{8,}$)', password) is not None:\n return pass... | <|body_start_0|>
if re.search('([^a-zA-Z/._\\d+])', username) is None:
return username
raise serializers.ValidationError('Username can only contain alphanumeric characters and . or _.')
<|end_body_0|>
<|body_start_1|>
if re.search('(^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-... | serializes and validates user's data | UserSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSerializer:
"""serializes and validates user's data"""
def validate_username(self, username):
"""Validate username"""
<|body_0|>
def validate_password(self, password):
"""Validate password"""
<|body_1|>
def create(self, validated_data):
"... | stack_v2_sparse_classes_75kplus_train_006227 | 3,565 | permissive | [
{
"docstring": "Validate username",
"name": "validate_username",
"signature": "def validate_username(self, username)"
},
{
"docstring": "Validate password",
"name": "validate_password",
"signature": "def validate_password(self, password)"
},
{
"docstring": "creates a user",
"... | 3 | stack_v2_sparse_classes_30k_train_002563 | Implement the Python class `UserSerializer` described below.
Class description:
serializes and validates user's data
Method signatures and docstrings:
- def validate_username(self, username): Validate username
- def validate_password(self, password): Validate password
- def create(self, validated_data): creates a use... | Implement the Python class `UserSerializer` described below.
Class description:
serializes and validates user's data
Method signatures and docstrings:
- def validate_username(self, username): Validate username
- def validate_password(self, password): Validate password
- def create(self, validated_data): creates a use... | 009def5bbaf3066df19ce3f48eacd6c8c055acdf | <|skeleton|>
class UserSerializer:
"""serializes and validates user's data"""
def validate_username(self, username):
"""Validate username"""
<|body_0|>
def validate_password(self, password):
"""Validate password"""
<|body_1|>
def create(self, validated_data):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserSerializer:
"""serializes and validates user's data"""
def validate_username(self, username):
"""Validate username"""
if re.search('([^a-zA-Z/._\\d+])', username) is None:
return username
raise serializers.ValidationError('Username can only contain alphanumeric cha... | the_stack_v2_python_sparse | apps/account/serializers.py | sasili-adetunji/flightify | train | 0 |
ebca861fe181c2e8074734923c1a73988444313f | [
"if config is None:\n config = KubernetesDagRunnerConfig()\nsuper().__init__(config)",
"if not pipeline.pipeline_info.run_id:\n pipeline.pipeline_info.run_id = datetime.datetime.now().isoformat()\nif not kube_utils.is_inside_cluster():\n kubernetes_remote_runner.run_as_kubernetes_job(pipeline=pipeline, t... | <|body_start_0|>
if config is None:
config = KubernetesDagRunnerConfig()
super().__init__(config)
<|end_body_0|>
<|body_start_1|>
if not pipeline.pipeline_info.run_id:
pipeline.pipeline_info.run_id = datetime.datetime.now().isoformat()
if not kube_utils.is_inside... | TFX runner on Kubernetes. | KubernetesDagRunner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KubernetesDagRunner:
"""TFX runner on Kubernetes."""
def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None):
"""Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pip... | stack_v2_sparse_classes_75kplus_train_006228 | 10,406 | permissive | [
{
"docstring": "Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config that supports InProcessComponentLauncher and KubernetesComponentLauncher.",
"name": "__init__",
"signature": "def __i... | 3 | stack_v2_sparse_classes_30k_train_023272 | Implement the Python class `KubernetesDagRunner` described below.
Class description:
TFX runner on Kubernetes.
Method signatures and docstrings:
- def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for cus... | Implement the Python class `KubernetesDagRunner` described below.
Class description:
TFX runner on Kubernetes.
Method signatures and docstrings:
- def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None): Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for cus... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class KubernetesDagRunner:
"""TFX runner on Kubernetes."""
def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None):
"""Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pip... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KubernetesDagRunner:
"""TFX runner on Kubernetes."""
def __init__(self, config: Optional[KubernetesDagRunnerConfig]=None):
"""Initializes KubernetesDagRunner as a TFX orchestrator. Args: config: Optional pipeline config for customizing the launching of each component. Defaults to pipeline config ... | the_stack_v2_python_sparse | tfx/orchestration/experimental/kubernetes/kubernetes_dag_runner.py | tensorflow/tfx | train | 2,116 |
46fcb5c5156b2433593989fc33937da25f1da1a3 | [
"self.task_name = task_name\nself.task_params = task_params\nself.world_params = world_params\nself.initial_full_state = initial_full_state\nself.robot_actions = []\nself.observations = []\nself.rewards = []\nself.infos = []\nself.dones = []\nself.timestamps = []",
"self.robot_actions.append(robot_action)\nself.o... | <|body_start_0|>
self.task_name = task_name
self.task_params = task_params
self.world_params = world_params
self.initial_full_state = initial_full_state
self.robot_actions = []
self.observations = []
self.rewards = []
self.infos = []
self.dones = [... | Episode | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Episode:
def __init__(self, task_name, initial_full_state, task_params=None, world_params=None):
"""The structure in which the data from each episode will be logged. :param task_name: :param initial_full_state: :param task_params: :param world_params:"""
<|body_0|>
def appen... | stack_v2_sparse_classes_75kplus_train_006229 | 1,242 | permissive | [
{
"docstring": "The structure in which the data from each episode will be logged. :param task_name: :param initial_full_state: :param task_params: :param world_params:",
"name": "__init__",
"signature": "def __init__(self, task_name, initial_full_state, task_params=None, world_params=None)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_023440 | Implement the Python class `Episode` described below.
Class description:
Implement the Episode class.
Method signatures and docstrings:
- def __init__(self, task_name, initial_full_state, task_params=None, world_params=None): The structure in which the data from each episode will be logged. :param task_name: :param i... | Implement the Python class `Episode` described below.
Class description:
Implement the Episode class.
Method signatures and docstrings:
- def __init__(self, task_name, initial_full_state, task_params=None, world_params=None): The structure in which the data from each episode will be logged. :param task_name: :param i... | 4c0ac37e559daa0dd89668e5bff5eec82a4158c5 | <|skeleton|>
class Episode:
def __init__(self, task_name, initial_full_state, task_params=None, world_params=None):
"""The structure in which the data from each episode will be logged. :param task_name: :param initial_full_state: :param task_params: :param world_params:"""
<|body_0|>
def appen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Episode:
def __init__(self, task_name, initial_full_state, task_params=None, world_params=None):
"""The structure in which the data from each episode will be logged. :param task_name: :param initial_full_state: :param task_params: :param world_params:"""
self.task_name = task_name
self... | the_stack_v2_python_sparse | Trifinger/causal_world/loggers/episode.py | emigmo/BenTDM | train | 0 | |
ab52207902ac62cb372c9c550e8a29caa4abae0c | [
"independent_pc = param_domain.ParamChange('a', 'Copier', {'value': 'firstValue', 'parse_with_jinja': False})\ndependent_pc = param_domain.ParamChange('b', 'Copier', {'value': '{{a}}', 'parse_with_jinja': True})\nexp_param_specs = {'a': param_domain.ParamSpec('UnicodeString'), 'b': param_domain.ParamSpec('UnicodeSt... | <|body_start_0|>
independent_pc = param_domain.ParamChange('a', 'Copier', {'value': 'firstValue', 'parse_with_jinja': False})
dependent_pc = param_domain.ParamChange('b', 'Copier', {'value': '{{a}}', 'parse_with_jinja': True})
exp_param_specs = {'a': param_domain.ParamSpec('UnicodeString'), 'b':... | Test methods relating to exploration parameters. | ExplorationParametersUnitTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExplorationParametersUnitTests:
"""Test methods relating to exploration parameters."""
def test_get_init_params(self):
"""Test the get_init_params() method."""
<|body_0|>
def test_update_learner_params(self):
"""Test the update_learner_params() method."""
... | stack_v2_sparse_classes_75kplus_train_006230 | 15,833 | permissive | [
{
"docstring": "Test the get_init_params() method.",
"name": "test_get_init_params",
"signature": "def test_get_init_params(self)"
},
{
"docstring": "Test the update_learner_params() method.",
"name": "test_update_learner_params",
"signature": "def test_update_learner_params(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026574 | Implement the Python class `ExplorationParametersUnitTests` described below.
Class description:
Test methods relating to exploration parameters.
Method signatures and docstrings:
- def test_get_init_params(self): Test the get_init_params() method.
- def test_update_learner_params(self): Test the update_learner_params... | Implement the Python class `ExplorationParametersUnitTests` described below.
Class description:
Test methods relating to exploration parameters.
Method signatures and docstrings:
- def test_get_init_params(self): Test the get_init_params() method.
- def test_update_learner_params(self): Test the update_learner_params... | 50994926e9e4fab925a0cf1f366cad3de2ed4d7b | <|skeleton|>
class ExplorationParametersUnitTests:
"""Test methods relating to exploration parameters."""
def test_get_init_params(self):
"""Test the get_init_params() method."""
<|body_0|>
def test_update_learner_params(self):
"""Test the update_learner_params() method."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExplorationParametersUnitTests:
"""Test methods relating to exploration parameters."""
def test_get_init_params(self):
"""Test the get_init_params() method."""
independent_pc = param_domain.ParamChange('a', 'Copier', {'value': 'firstValue', 'parse_with_jinja': False})
dependent_pc... | the_stack_v2_python_sparse | core/controllers/reader_test.py | CMDann/oppia | train | 2 |
155665f8532c8f7847d80a155fe60434536cd609 | [
"user_dict = bfly.users.models.get_user(id)\nif user_dict:\n return (user_dict, 200)\nelse:\n ns_conf.abort(404)",
"try:\n return (bfly.users.models.update_user(id, request.json), 200)\nexcept ValueError:\n ns_conf.abort(404)"
] | <|body_start_0|>
user_dict = bfly.users.models.get_user(id)
if user_dict:
return (user_dict, 200)
else:
ns_conf.abort(404)
<|end_body_0|>
<|body_start_1|>
try:
return (bfly.users.models.update_user(id, request.json), 200)
except ValueError:
... | User | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User:
def get(self, id):
"""Return a specific user :param id: :return:"""
<|body_0|>
def put(self, id):
"""Update a user :param id: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user_dict = bfly.users.models.get_user(id)
if user_d... | stack_v2_sparse_classes_75kplus_train_006231 | 7,021 | no_license | [
{
"docstring": "Return a specific user :param id: :return:",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Update a user :param id: :return:",
"name": "put",
"signature": "def put(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_038971 | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def get(self, id): Return a specific user :param id: :return:
- def put(self, id): Update a user :param id: :return: | Implement the Python class `User` described below.
Class description:
Implement the User class.
Method signatures and docstrings:
- def get(self, id): Return a specific user :param id: :return:
- def put(self, id): Update a user :param id: :return:
<|skeleton|>
class User:
def get(self, id):
"""Return a... | 77d43e588d0d56f5b30b1e9b989b891167c7f771 | <|skeleton|>
class User:
def get(self, id):
"""Return a specific user :param id: :return:"""
<|body_0|>
def put(self, id):
"""Update a user :param id: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class User:
def get(self, id):
"""Return a specific user :param id: :return:"""
user_dict = bfly.users.models.get_user(id)
if user_dict:
return (user_dict, 200)
else:
ns_conf.abort(404)
def put(self, id):
"""Update a user :param id: :return:"""
... | the_stack_v2_python_sparse | webapp/bfly/users/api.py | cnetedu/butterflyone | train | 0 | |
87440f9ebfab1ddf695e8acb3c8262b257c8ed8a | [
"request.session.clear()\nrequest.session.flush()\ncontext = super().get_context_data(Form(request.GET or None), **kwargs)\ncontext['methodName'] = 'get'\nreturn render(request, self.template_name, context)",
"context = super().get_context_data(Form(request.POST), **kwargs)\ncontext['methodName'] = 'post'\nform =... | <|body_start_0|>
request.session.clear()
request.session.flush()
context = super().get_context_data(Form(request.GET or None), **kwargs)
context['methodName'] = 'get'
return render(request, self.template_name, context)
<|end_body_0|>
<|body_start_1|>
context = super().ge... | View | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class View:
def get(self, request, *args, **kwargs):
"""GETメソッドで呼び出される。"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""POSTメソッドで呼び出される。"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
request.session.clear()
request.session.flush()
... | stack_v2_sparse_classes_75kplus_train_006232 | 2,586 | no_license | [
{
"docstring": "GETメソッドで呼び出される。",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "POSTメソッドで呼び出される。",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014574 | Implement the Python class `View` described below.
Class description:
Implement the View class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): GETメソッドで呼び出される。
- def post(self, request, *args, **kwargs): POSTメソッドで呼び出される。 | Implement the Python class `View` described below.
Class description:
Implement the View class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): GETメソッドで呼び出される。
- def post(self, request, *args, **kwargs): POSTメソッドで呼び出される。
<|skeleton|>
class View:
def get(self, request, *args, **kwarg... | e6c56bbd614b6a7df651b5a99dc5a8be92c342b9 | <|skeleton|>
class View:
def get(self, request, *args, **kwargs):
"""GETメソッドで呼び出される。"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""POSTメソッドで呼び出される。"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class View:
def get(self, request, *args, **kwargs):
"""GETメソッドで呼び出される。"""
request.session.clear()
request.session.flush()
context = super().get_context_data(Form(request.GET or None), **kwargs)
context['methodName'] = 'get'
return render(request, self.template_name, ... | the_stack_v2_python_sparse | site01/views/s01_comn/v01_entrance.py | uekiwg/hello_django | train | 0 | |
f8dccbb2c374a7c8ef6feb34511b8abdf7b7e6f9 | [
"n = len(matrix)\nfor r in range(n):\n for c in range(r + 1, n, 1):\n matrix[r][c], matrix[c][r] = (matrix[c][r], matrix[r][c])\nfor r in range(n):\n matrix[r].reverse()",
"n = len(matrix)\nfor r in range(n):\n for c in range(r + 1, n, 1):\n matrix[r][c], matrix[c][r] = (matrix[c][r], matri... | <|body_start_0|>
n = len(matrix)
for r in range(n):
for c in range(r + 1, n, 1):
matrix[r][c], matrix[c][r] = (matrix[c][r], matrix[r][c])
for r in range(n):
matrix[r].reverse()
<|end_body_0|>
<|body_start_1|>
n = len(matrix)
for r in rang... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotateClockwise(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotateCounterClockwise(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anyt... | stack_v2_sparse_classes_75kplus_train_006233 | 2,063 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.",
"name": "rotateClockwise",
"signature": "def rotateClockwise(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-... | 2 | stack_v2_sparse_classes_30k_train_004662 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateClockwise(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotateCounterClockwise(self, matrix): ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateClockwise(self, matrix): :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.
- def rotateCounterClockwise(self, matrix): ... | 9ac54720f571a4bea09d0cceb0039381a78df9e8 | <|skeleton|>
class Solution:
def rotateClockwise(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
<|body_0|>
def rotateCounterClockwise(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anyt... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotateClockwise(self, matrix):
""":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead."""
n = len(matrix)
for r in range(n):
for c in range(r + 1, n, 1):
matrix[r][c], matrix[c][r] = (matrix[c][r], ... | the_stack_v2_python_sparse | code/048_rotate-image.py | linhdvu14/leetcode-solutions | train | 2 | |
712de42c25ff0d7ebb2ff9ddce64a14ba03d7f08 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MessageRuleActions()",
"from .importance import Importance\nfrom .recipient import Recipient\nfrom .importance import Importance\nfrom .recipient import Recipient\nfields: Dict[str, Callable[[Any], None]] = {'assignCategories': lambda ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return MessageRuleActions()
<|end_body_0|>
<|body_start_1|>
from .importance import Importance
from .recipient import Recipient
from .importance import Importance
from .recipien... | MessageRuleActions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessageRuleActions:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MessageRuleActions:
"""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 obje... | stack_v2_sparse_classes_75kplus_train_006234 | 5,820 | 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: MessageRuleActions",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | stack_v2_sparse_classes_30k_train_030769 | Implement the Python class `MessageRuleActions` described below.
Class description:
Implement the MessageRuleActions class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MessageRuleActions: Creates a new instance of the appropriate class based on disc... | Implement the Python class `MessageRuleActions` described below.
Class description:
Implement the MessageRuleActions class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MessageRuleActions: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class MessageRuleActions:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MessageRuleActions:
"""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 obje... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MessageRuleActions:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MessageRuleActions:
"""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: Me... | the_stack_v2_python_sparse | msgraph/generated/models/message_rule_actions.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
368b4caa18a8e9323e195fc6d75ba7d42abd44ee | [
"from dials.algorithms.background.simple import Constant2dModeller, Constant3dModeller, Creator, Linear2dModeller, Linear3dModeller, MosflmOutlierRejector, NormalOutlierRejector, NSigmaOutlierRejector, TruncatedOutlierRejector, TukeyOutlierRejector\n\ndef select_modeller():\n if model == 'constant2d':\n r... | <|body_start_0|>
from dials.algorithms.background.simple import Constant2dModeller, Constant3dModeller, Creator, Linear2dModeller, Linear3dModeller, MosflmOutlierRejector, NormalOutlierRejector, NSigmaOutlierRejector, TruncatedOutlierRejector, TukeyOutlierRejector
def select_modeller():
if ... | Class to do background subtraction. | BackgroundAlgorithm | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BackgroundAlgorithm:
"""Class to do background subtraction."""
def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs):
"""Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The b... | stack_v2_sparse_classes_75kplus_train_006235 | 5,905 | permissive | [
{
"docstring": "Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The background model algorithm",
"name": "__init__",
"signature": "def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_015962 | Implement the Python class `BackgroundAlgorithm` described below.
Class description:
Class to do background subtraction.
Method signatures and docstrings:
- def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs): Initialise the algorithm. :param experiments: The list of experiments :param out... | Implement the Python class `BackgroundAlgorithm` described below.
Class description:
Class to do background subtraction.
Method signatures and docstrings:
- def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs): Initialise the algorithm. :param experiments: The list of experiments :param out... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class BackgroundAlgorithm:
"""Class to do background subtraction."""
def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs):
"""Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BackgroundAlgorithm:
"""Class to do background subtraction."""
def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs):
"""Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The background mod... | the_stack_v2_python_sparse | src/dials/algorithms/background/simple/algorithm.py | dials/dials | train | 71 |
7c152fe9eadd0621b19d794e990159d8195b25f9 | [
"datastore_hooks.SetPrivilegedRequest()\nrevision = int(self.request.get('revision'))\nnum_around = int(self.request.get('num_around'), 10)\ntest_key = ndb.Key(urlsafe=self.request.get('test_key'))\ncontainer_key = ndb.Key(urlsafe=self.request.get('parent_key'))\nbefore_revs = graph_data.Row.query(graph_data.Row.pa... | <|body_start_0|>
datastore_hooks.SetPrivilegedRequest()
revision = int(self.request.get('revision'))
num_around = int(self.request.get('num_around'), 10)
test_key = ndb.Key(urlsafe=self.request.get('test_key'))
container_key = ndb.Key(urlsafe=self.request.get('parent_key'))
... | URL endpoint for tasks which generate stats before/after a revision. | StatsAroundRevisionHandler | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatsAroundRevisionHandler:
"""URL endpoint for tasks which generate stats before/after a revision."""
def post(self):
"""Task queue task to get stats before/after a revision of a single Test. Request parameters: revision: A central revision to look around. num_around: The number of ... | stack_v2_sparse_classes_75kplus_train_006236 | 17,003 | permissive | [
{
"docstring": "Task queue task to get stats before/after a revision of a single Test. Request parameters: revision: A central revision to look around. num_around: The number of points before and after the given revision. test_key: The urlsafe string of a Test key. parent_key: The urlsafe string of a StatContai... | 3 | stack_v2_sparse_classes_30k_train_042657 | Implement the Python class `StatsAroundRevisionHandler` described below.
Class description:
URL endpoint for tasks which generate stats before/after a revision.
Method signatures and docstrings:
- def post(self): Task queue task to get stats before/after a revision of a single Test. Request parameters: revision: A ce... | Implement the Python class `StatsAroundRevisionHandler` described below.
Class description:
URL endpoint for tasks which generate stats before/after a revision.
Method signatures and docstrings:
- def post(self): Task queue task to get stats before/after a revision of a single Test. Request parameters: revision: A ce... | e71f21b9b4b9b839f5093301974a45545dad2691 | <|skeleton|>
class StatsAroundRevisionHandler:
"""URL endpoint for tasks which generate stats before/after a revision."""
def post(self):
"""Task queue task to get stats before/after a revision of a single Test. Request parameters: revision: A central revision to look around. num_around: The number of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StatsAroundRevisionHandler:
"""URL endpoint for tasks which generate stats before/after a revision."""
def post(self):
"""Task queue task to get stats before/after a revision of a single Test. Request parameters: revision: A central revision to look around. num_around: The number of points before... | the_stack_v2_python_sparse | third_party/catapult/dashboard/dashboard/stats.py | zenoalbisser/chromium | train | 0 |
ebe5b7eb82597f91c4675fb4007310e5e0637edd | [
"self.T_myClass = 0\nself.T_otherClass = 0\nself.F_myClass = 0\nself.F_otherClass = 0",
"if thisIsMe and accurateClass:\n self.T_myClass += 1\nelif accurateClass:\n self.T_otherClass += 1\nelif thisIsMe:\n self.F_myClass += 1\nelse:\n self.F_otherClass += 1",
"print('--------------------------------... | <|body_start_0|>
self.T_myClass = 0
self.T_otherClass = 0
self.F_myClass = 0
self.F_otherClass = 0
<|end_body_0|>
<|body_start_1|>
if thisIsMe and accurateClass:
self.T_myClass += 1
elif accurateClass:
self.T_otherClass += 1
elif thisIsMe:... | ClassAccuracy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassAccuracy:
def __init__(self):
"""Initialize the accuracy calculation for a single class"""
<|body_0|>
def updateAccuracy(self, thisIsMe, accurateClass):
"""Increment the appropriate cell of the confusion matrix"""
<|body_1|>
def reportClassAccuracy(... | stack_v2_sparse_classes_75kplus_train_006237 | 3,493 | permissive | [
{
"docstring": "Initialize the accuracy calculation for a single class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Increment the appropriate cell of the confusion matrix",
"name": "updateAccuracy",
"signature": "def updateAccuracy(self, thisIsMe, accurateCl... | 3 | stack_v2_sparse_classes_30k_train_019052 | Implement the Python class `ClassAccuracy` described below.
Class description:
Implement the ClassAccuracy class.
Method signatures and docstrings:
- def __init__(self): Initialize the accuracy calculation for a single class
- def updateAccuracy(self, thisIsMe, accurateClass): Increment the appropriate cell of the co... | Implement the Python class `ClassAccuracy` described below.
Class description:
Implement the ClassAccuracy class.
Method signatures and docstrings:
- def __init__(self): Initialize the accuracy calculation for a single class
- def updateAccuracy(self, thisIsMe, accurateClass): Increment the appropriate cell of the co... | df6ad93d1059f69956efd6d67c38a01bd16dc5f0 | <|skeleton|>
class ClassAccuracy:
def __init__(self):
"""Initialize the accuracy calculation for a single class"""
<|body_0|>
def updateAccuracy(self, thisIsMe, accurateClass):
"""Increment the appropriate cell of the confusion matrix"""
<|body_1|>
def reportClassAccuracy(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClassAccuracy:
def __init__(self):
"""Initialize the accuracy calculation for a single class"""
self.T_myClass = 0
self.T_otherClass = 0
self.F_myClass = 0
self.F_otherClass = 0
def updateAccuracy(self, thisIsMe, accurateClass):
"""Increment the appropriate... | the_stack_v2_python_sparse | exstracs_classaccuracy.py | ryanurbs/ExSTraCS_GP_Hybrid | train | 2 | |
2111660474bba4c65e0a71626725a0886f9cbc0d | [
"if not s or not t:\n return True\nif len(s) != len(t):\n return False\ns_dict = {}\nt_dict = {}\nfor i in range(len(s)):\n if s[i] in s_dict.keys() and s_dict[s[i]] != t[i]:\n return False\n if t[i] in t_dict.keys() and t_dict[t[i]] != s[i]:\n return False\n s_dict[s[i]] = t[i]\n t_... | <|body_start_0|>
if not s or not t:
return True
if len(s) != len(t):
return False
s_dict = {}
t_dict = {}
for i in range(len(s)):
if s[i] in s_dict.keys() and s_dict[s[i]] != t[i]:
return False
if t[i] in t_dict.keys... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic_2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not s or not t:
... | stack_v2_sparse_classes_75kplus_train_006238 | 1,561 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic",
"signature": "def isIsomorphic(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic_2",
"signature": "def isIsomorphic_2(self, s, t)"
}
] | 2 | stack_v2_sparse_classes_30k_train_033891 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic_2(self, s, t): :type s: str :type t: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic_2(self, s, t): :type s: str :type t: str :rtype: bool
<|skeleton|>
class Solution:
d... | a2cd0dc5e098080df87c4fb57d16877d21ca47a3 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic_2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
if not s or not t:
return True
if len(s) != len(t):
return False
s_dict = {}
t_dict = {}
for i in range(len(s)):
if s[i] in s_dict.keys() and... | the_stack_v2_python_sparse | 0205_Isomorphic_Strings/solution.py | benjaminhuanghuang/ben-leetcode | train | 1 | |
bf8c8026a80f755f549350005b704ec8508cd8d5 | [
"self.n = int(n)\nself.p = float(p)\nif data is None:\n if self.n <= 0:\n raise ValueError('n must be a positive value')\n if self.p <= 0 or self.p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\nelif type(data) is not list:\n raise TypeError('data must be a list')\nelif... | <|body_start_0|>
self.n = int(n)
self.p = float(p)
if data is None:
if self.n <= 0:
raise ValueError('n must be a positive value')
if self.p <= 0 or self.p >= 1:
raise ValueError('p must be greater than 0 and less than 1')
elif type... | Class Binomial | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""Class Binomial"""
def __init__(self, data=None, n=1, p=0.5):
"""Class constructor"""
<|body_0|>
def pmf(self, k):
"""Calculates the value of the PMF for a given number of “successes”"""
<|body_1|>
def cdf(self, k):
"""Calculates ... | stack_v2_sparse_classes_75kplus_train_006239 | 1,872 | no_license | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "Calculates the value of the PMF for a given number of “successes”",
"name": "pmf",
"signature": "def pmf(self, k)"
},
{
"docstring": "Calculates the... | 4 | null | Implement the Python class `Binomial` described below.
Class description:
Class Binomial
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Class constructor
- def pmf(self, k): Calculates the value of the PMF for a given number of “successes”
- def cdf(self, k): Calculates the value of th... | Implement the Python class `Binomial` described below.
Class description:
Class Binomial
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Class constructor
- def pmf(self, k): Calculates the value of the PMF for a given number of “successes”
- def cdf(self, k): Calculates the value of th... | b1d0995023630f2a2b7ed953983c405077c0d5a8 | <|skeleton|>
class Binomial:
"""Class Binomial"""
def __init__(self, data=None, n=1, p=0.5):
"""Class constructor"""
<|body_0|>
def pmf(self, k):
"""Calculates the value of the PMF for a given number of “successes”"""
<|body_1|>
def cdf(self, k):
"""Calculates ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Binomial:
"""Class Binomial"""
def __init__(self, data=None, n=1, p=0.5):
"""Class constructor"""
self.n = int(n)
self.p = float(p)
if data is None:
if self.n <= 0:
raise ValueError('n must be a positive value')
if self.p <= 0 or sel... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | oscarmrt/holbertonschool-machine_learning | train | 1 |
f7829bf4c540f1c02bc6e0d73f3bd8422b888847 | [
"super().__init__(force_update=force_update, sleeping_time=sleeping_time)\nassert self.entity_provider is not None\nassert self.entity_schema is not None\nself.exchanges = exchanges\nif codes is None and code is not None:\n self.codes = [code]\nelse:\n self.codes = codes\nself.day_data = day_data\nself.entity... | <|body_start_0|>
super().__init__(force_update=force_update, sleeping_time=sleeping_time)
assert self.entity_provider is not None
assert self.entity_schema is not None
self.exchanges = exchanges
if codes is None and code is not None:
self.codes = [code]
else:
... | EntityEventRecorder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntityEventRecorder:
def __init__(self, force_update=False, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filters=None, ignore_failed=True) -> None:
""":param code: :param ignore_failed: :param entity_filters: :param exch... | stack_v2_sparse_classes_75kplus_train_006240 | 24,497 | permissive | [
{
"docstring": ":param code: :param ignore_failed: :param entity_filters: :param exchanges: :param entity_id: for record single entity :param entity_ids: set entity_ids or (entity_type,exchanges,codes) :param codes: :param day_data: one record per day,set to True if you want skip recording it when data of today... | 2 | stack_v2_sparse_classes_30k_test_000583 | Implement the Python class `EntityEventRecorder` described below.
Class description:
Implement the EntityEventRecorder class.
Method signatures and docstrings:
- def __init__(self, force_update=False, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filt... | Implement the Python class `EntityEventRecorder` described below.
Class description:
Implement the EntityEventRecorder class.
Method signatures and docstrings:
- def __init__(self, force_update=False, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filt... | 03aee869fd432bb933d59ba419401cfc11501392 | <|skeleton|>
class EntityEventRecorder:
def __init__(self, force_update=False, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filters=None, ignore_failed=True) -> None:
""":param code: :param ignore_failed: :param entity_filters: :param exch... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EntityEventRecorder:
def __init__(self, force_update=False, sleeping_time=10, exchanges=None, entity_id=None, entity_ids=None, code=None, codes=None, day_data=False, entity_filters=None, ignore_failed=True) -> None:
""":param code: :param ignore_failed: :param entity_filters: :param exchanges: :param ... | the_stack_v2_python_sparse | src/zvt/contract/recorder.py | zvtvz/zvt | train | 2,782 | |
68cc1f9b71262520f022be5f6590957fb196284f | [
"if default is None:\n default = DEFAULT.copy()\n default.update(SPECTRAL_DEFAULT)\n default.update(WAVECAL_DEFAULT)\nsuper().__init__(default=default, config=config, pipecal_config=pipecal_config)",
"config = super().to_config()\nconfig['wavecal'] = True\nconfig['spatcal'] = False\nconfig['slitcorr'] = ... | <|body_start_0|>
if default is None:
default = DEFAULT.copy()
default.update(SPECTRAL_DEFAULT)
default.update(WAVECAL_DEFAULT)
super().__init__(default=default, config=config, pipecal_config=pipecal_config)
<|end_body_0|>
<|body_start_1|>
config = super().to_... | Reduction parameters for the FLITECAM grism wavecal pipeline. | FLITECAMWavecalParameters | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FLITECAMWavecalParameters:
"""Reduction parameters for the FLITECAM grism wavecal pipeline."""
def __init__(self, default=None, config=None, pipecal_config=None):
"""Initialize parameters with default values. The various config files are used to override certain parameter defaults fo... | stack_v2_sparse_classes_75kplus_train_006241 | 15,967 | permissive | [
{
"docstring": "Initialize parameters with default values. The various config files are used to override certain parameter defaults for particular observation modes, or dates, etc. Parameters ---------- config : dict-like, optional Reduction mode and auxiliary file configuration mapping, as returned from the so... | 5 | stack_v2_sparse_classes_30k_train_018288 | Implement the Python class `FLITECAMWavecalParameters` described below.
Class description:
Reduction parameters for the FLITECAM grism wavecal pipeline.
Method signatures and docstrings:
- def __init__(self, default=None, config=None, pipecal_config=None): Initialize parameters with default values. The various config... | Implement the Python class `FLITECAMWavecalParameters` described below.
Class description:
Reduction parameters for the FLITECAM grism wavecal pipeline.
Method signatures and docstrings:
- def __init__(self, default=None, config=None, pipecal_config=None): Initialize parameters with default values. The various config... | 493700340cd34d5f319af6f3a562a82135bb30dd | <|skeleton|>
class FLITECAMWavecalParameters:
"""Reduction parameters for the FLITECAM grism wavecal pipeline."""
def __init__(self, default=None, config=None, pipecal_config=None):
"""Initialize parameters with default values. The various config files are used to override certain parameter defaults fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FLITECAMWavecalParameters:
"""Reduction parameters for the FLITECAM grism wavecal pipeline."""
def __init__(self, default=None, config=None, pipecal_config=None):
"""Initialize parameters with default values. The various config files are used to override certain parameter defaults for particular ... | the_stack_v2_python_sparse | sofia_redux/pipeline/sofia/parameters/flitecam_wavecal_parameters.py | SOFIA-USRA/sofia_redux | train | 12 |
3fc027822bc4b20546b08fb940bf5de65ad5b0bd | [
"if self.error_message:\n return '%s: %s' % (self.__class__.__name__, self.messageFormat(self.error_message))\nelse:\n return '%s: %s' % (self.__class__.__name__, self.messageFormat())",
"if template is None:\n template = self.DEFAULTTEMPLATE\nline, lineChar = self.getLineCoordinate()\nvariables = {'prod... | <|body_start_0|>
if self.error_message:
return '%s: %s' % (self.__class__.__name__, self.messageFormat(self.error_message))
else:
return '%s: %s' % (self.__class__.__name__, self.messageFormat())
<|end_body_0|>
<|body_start_1|>
if template is None:
template =... | Sub-class of SyntaxError for use by SimpleParse parsers Every instance will have the following attributes: buffer -- pointer to the source buffer position -- integer position in buffer where error occured or -1 production -- the production which failed expected -- string (currently taken from grammar) describing what p... | ParserSyntaxError | [
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParserSyntaxError:
"""Sub-class of SyntaxError for use by SimpleParse parsers Every instance will have the following attributes: buffer -- pointer to the source buffer position -- integer position in buffer where error occured or -1 production -- the production which failed expected -- string (cu... | stack_v2_sparse_classes_75kplus_train_006242 | 2,101 | permissive | [
{
"docstring": "Create a string representation of the error",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Create a default message for this syntax error",
"name": "messageFormat",
"signature": "def messageFormat(self, template=None)"
},
{
"docstring": "... | 3 | stack_v2_sparse_classes_30k_train_029759 | Implement the Python class `ParserSyntaxError` described below.
Class description:
Sub-class of SyntaxError for use by SimpleParse parsers Every instance will have the following attributes: buffer -- pointer to the source buffer position -- integer position in buffer where error occured or -1 production -- the product... | Implement the Python class `ParserSyntaxError` described below.
Class description:
Sub-class of SyntaxError for use by SimpleParse parsers Every instance will have the following attributes: buffer -- pointer to the source buffer position -- integer position in buffer where error occured or -1 production -- the product... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class ParserSyntaxError:
"""Sub-class of SyntaxError for use by SimpleParse parsers Every instance will have the following attributes: buffer -- pointer to the source buffer position -- integer position in buffer where error occured or -1 production -- the production which failed expected -- string (cu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParserSyntaxError:
"""Sub-class of SyntaxError for use by SimpleParse parsers Every instance will have the following attributes: buffer -- pointer to the source buffer position -- integer position in buffer where error occured or -1 production -- the production which failed expected -- string (currently taken... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/simpleparse/error.py | alexus37/AugmentedRealityChess | train | 1 |
51c6e2082128fc69365c5a1b73acbcd1629bfcca | [
"sign = 1 if x >= 0 else -1\nx *= sign\noutput = 0\nwhile x:\n output = output * 10 + x % 10\n x = x // 10\nif output > 2 ** 31 - 1:\n return 0\nelse:\n return output * sign",
"if not x:\n return x\nsign = 1 if x >= 0 else -1\ndigits = str(x * sign)[::-1]\nindex_zeros = -1\nfor i, d in enumerate(di... | <|body_start_0|>
sign = 1 if x >= 0 else -1
x *= sign
output = 0
while x:
output = output * 10 + x % 10
x = x // 10
if output > 2 ** 31 - 1:
return 0
else:
return output * sign
<|end_body_0|>
<|body_start_1|>
if not... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverse(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def reverse_naive(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sign = 1 if x >= 0 else -1
x *= sign
output = 0
... | stack_v2_sparse_classes_75kplus_train_006243 | 1,783 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "reverse",
"signature": "def reverse(self, x)"
},
{
"docstring": ":type x: int :rtype: int",
"name": "reverse_naive",
"signature": "def reverse_naive(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_test_002306 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse(self, x): :type x: int :rtype: int
- def reverse_naive(self, x): :type x: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse(self, x): :type x: int :rtype: int
- def reverse_naive(self, x): :type x: int :rtype: int
<|skeleton|>
class Solution:
def reverse(self, x):
""":type x:... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def reverse(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def reverse_naive(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverse(self, x):
""":type x: int :rtype: int"""
sign = 1 if x >= 0 else -1
x *= sign
output = 0
while x:
output = output * 10 + x % 10
x = x // 10
if output > 2 ** 31 - 1:
return 0
else:
retu... | the_stack_v2_python_sparse | src/lt_7.py | oxhead/CodingYourWay | train | 0 | |
0073f62373d1c96fd35aec91b4d9a85f0b238274 | [
"try:\n article = self.get_article(pk)\n if article is None or article.status == ArticleStatus.WAIT:\n return FAIL\n with transaction.atomic():\n article.frequency = article.frequency + 1\n article.save()\n serializer = ArticleSerializer(article)\n return Response(ArticleWrapper(... | <|body_start_0|>
try:
article = self.get_article(pk)
if article is None or article.status == ArticleStatus.WAIT:
return FAIL
with transaction.atomic():
article.frequency = article.frequency + 1
article.save()
seriali... | Basic Article View | ArticleView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArticleView:
"""Basic Article View"""
def get(self, request, pk):
"""Request article By id"""
<|body_0|>
def delete(self, request, pk):
"""Delete article by id"""
<|body_1|>
def put(self, request, pk):
"""Update article by id"""
<|bod... | stack_v2_sparse_classes_75kplus_train_006244 | 9,189 | permissive | [
{
"docstring": "Request article By id",
"name": "get",
"signature": "def get(self, request, pk)"
},
{
"docstring": "Delete article by id",
"name": "delete",
"signature": "def delete(self, request, pk)"
},
{
"docstring": "Update article by id",
"name": "put",
"signature": ... | 3 | stack_v2_sparse_classes_30k_train_042701 | Implement the Python class `ArticleView` described below.
Class description:
Basic Article View
Method signatures and docstrings:
- def get(self, request, pk): Request article By id
- def delete(self, request, pk): Delete article by id
- def put(self, request, pk): Update article by id | Implement the Python class `ArticleView` described below.
Class description:
Basic Article View
Method signatures and docstrings:
- def get(self, request, pk): Request article By id
- def delete(self, request, pk): Delete article by id
- def put(self, request, pk): Update article by id
<|skeleton|>
class ArticleView... | 3c2454ebad7764906c5ff30cbdfe296cb7c64eb4 | <|skeleton|>
class ArticleView:
"""Basic Article View"""
def get(self, request, pk):
"""Request article By id"""
<|body_0|>
def delete(self, request, pk):
"""Delete article by id"""
<|body_1|>
def put(self, request, pk):
"""Update article by id"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArticleView:
"""Basic Article View"""
def get(self, request, pk):
"""Request article By id"""
try:
article = self.get_article(pk)
if article is None or article.status == ArticleStatus.WAIT:
return FAIL
with transaction.atomic():
... | the_stack_v2_python_sparse | travel/views/articleview.py | sausage-team/travel-notes | train | 0 |
b17fa2c403592705efc5ea4e2973a26c5b43f796 | [
"self.prp = PreprocessingStep3(dt_col='date', keep_last_train_days=366)\nself.lgb_params = {'boosting_type': 'gbdt', 'metric': 'custom', 'objective': 'tweedie', 'tweedie_variance_power': 1.1, 'n_jobs': -1, 'seed': 20, 'learning_rate': 0.03, 'subsample': 0.66, 'bagging_freq': 1, 'colsample_bytree': 0.77, 'max_depth'... | <|body_start_0|>
self.prp = PreprocessingStep3(dt_col='date', keep_last_train_days=366)
self.lgb_params = {'boosting_type': 'gbdt', 'metric': 'custom', 'objective': 'tweedie', 'tweedie_variance_power': 1.1, 'n_jobs': -1, 'seed': 20, 'learning_rate': 0.03, 'subsample': 0.66, 'bagging_freq': 1, 'colsample... | This class contains everything needed to train a model and make predictions for one day in the future. | LGBMDayModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LGBMDayModel:
"""This class contains everything needed to train a model and make predictions for one day in the future."""
def __init__(self, train_test_date_split, eval_start_date, dept_id):
"""This is the class' constructor. Parameters ---------- train_test_date_split : string A da... | stack_v2_sparse_classes_75kplus_train_006245 | 5,846 | no_license | [
{
"docstring": "This is the class' constructor. Parameters ---------- train_test_date_split : string A date where the data will be splitted into training and testing sets. eval_start_date : string Date to use to split train data into training and validation sets for LightGBM. Returns ------- None",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_032121 | Implement the Python class `LGBMDayModel` described below.
Class description:
This class contains everything needed to train a model and make predictions for one day in the future.
Method signatures and docstrings:
- def __init__(self, train_test_date_split, eval_start_date, dept_id): This is the class' constructor. ... | Implement the Python class `LGBMDayModel` described below.
Class description:
This class contains everything needed to train a model and make predictions for one day in the future.
Method signatures and docstrings:
- def __init__(self, train_test_date_split, eval_start_date, dept_id): This is the class' constructor. ... | ba9a7a15a3ae8b65cb09044489ee1d907a702909 | <|skeleton|>
class LGBMDayModel:
"""This class contains everything needed to train a model and make predictions for one day in the future."""
def __init__(self, train_test_date_split, eval_start_date, dept_id):
"""This is the class' constructor. Parameters ---------- train_test_date_split : string A da... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LGBMDayModel:
"""This class contains everything needed to train a model and make predictions for one day in the future."""
def __init__(self, train_test_date_split, eval_start_date, dept_id):
"""This is the class' constructor. Parameters ---------- train_test_date_split : string A date where the ... | the_stack_v2_python_sparse | python_code/M5_Forecasting_Accuracy/m5_forecasting_accuracy/models/lgbm_day_model.py | ThomasSELECK/src | train | 0 |
37894ebd2417402c047a0f492707e5acb428afff | [
"from collections import Counter\nsize = len(p)\nans = []\nfor i in range(len(s) - size + 1):\n c = Counter(s[i:size + i]) - Counter(p)\n if len(list(c.elements())) == 0:\n ans.append(i)\nreturn ans",
"ans = []\nsize = len(p)\npd = {}\nfor c in p:\n if c in pd:\n pd[c] += 1\n else:\n ... | <|body_start_0|>
from collections import Counter
size = len(p)
ans = []
for i in range(len(s) - size + 1):
c = Counter(s[i:size + i]) - Counter(p)
if len(list(c.elements())) == 0:
ans.append(i)
return ans
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findAnagrams2(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_0|>
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections impor... | stack_v2_sparse_classes_75kplus_train_006246 | 3,017 | no_license | [
{
"docstring": ":type s: str :type p: str :rtype: List[int]",
"name": "findAnagrams2",
"signature": "def findAnagrams2(self, s, p)"
},
{
"docstring": ":type s: str :type p: str :rtype: List[int]",
"name": "findAnagrams",
"signature": "def findAnagrams(self, s, p)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026491 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAnagrams2(self, s, p): :type s: str :type p: str :rtype: List[int]
- def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAnagrams2(self, s, p): :type s: str :type p: str :rtype: List[int]
- def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
<|skeleton|>
class Solutio... | a57282895fb213b68e5d81db301903721a92d80f | <|skeleton|>
class Solution:
def findAnagrams2(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_0|>
def findAnagrams(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findAnagrams2(self, s, p):
""":type s: str :type p: str :rtype: List[int]"""
from collections import Counter
size = len(p)
ans = []
for i in range(len(s) - size + 1):
c = Counter(s[i:size + i]) - Counter(p)
if len(list(c.elements())... | the_stack_v2_python_sparse | Python/438_find-all-anagrams-in-a-string.py | antonylu/leetcode2 | train | 0 | |
06d6bffe2f90495eabda0f709bfa13d1ab5b3098 | [
"if not prices:\n return 0\nn = len(prices)\nif maxK > n // 2:\n return self.maxProfit_inf_k(prices)\ndp = [[[0] * 2 for _ in range(maxK + 1)] for _ in range(n)]\nfor i in range(n):\n for k in range(maxK, 0, -1):\n if i == 0:\n dp[i][k][0], dp[i][k][1] = (0, -prices[i])\n else:\n ... | <|body_start_0|>
if not prices:
return 0
n = len(prices)
if maxK > n // 2:
return self.maxProfit_inf_k(prices)
dp = [[[0] * 2 for _ in range(maxK + 1)] for _ in range(n)]
for i in range(n):
for k in range(maxK, 0, -1):
if i == 0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, maxK: int, prices: list) -> int:
"""动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])"""
<|body_0|>
def maxProfit_inf_k(... | stack_v2_sparse_classes_75kplus_train_006247 | 2,396 | no_license | [
{
"docstring": "动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])",
"name": "maxProfit",
"signature": "def maxProfit(self, maxK: int, prices: list) -> int"
},
{
"docstring... | 2 | stack_v2_sparse_classes_30k_train_049864 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, maxK: int, prices: list) -> int: 动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, maxK: int, prices: list) -> int: 动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] ... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def maxProfit(self, maxK: int, prices: list) -> int:
"""动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])"""
<|body_0|>
def maxProfit_inf_k(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProfit(self, maxK: int, prices: list) -> int:
"""动态规划 跟之前分析的一致,不同的是此题k的大小会是任意的数字,要对k这个状态进行穷举 状态方程依旧是: dp[i][k][0] = max(dp[i-1][k][0], dp[i-1][k][1] + prices[i]) dp[i][k][1] = max(dp[i-1][k][1], dp[i-1][k-1][0] - prices[i])"""
if not prices:
return 0
n = le... | the_stack_v2_python_sparse | algorithm/leetcode/dp/11-买卖股票的最佳时机Ⅳ.py | lxconfig/UbuntuCode_bak | train | 0 | |
9c9bc50f2e744722f9ed0d0e6dfcadef2fcb0703 | [
"len_nums = len(nums)\nfor i in range(len_nums - 1, -1, -1):\n if nums[i] != 0:\n continue\n for j in range(i, len_nums - 1):\n if nums[j] == 0:\n nums[j], nums[j + 1] = (nums[j + 1], nums[j])\nprint(nums)",
"zero_pos = 0\nfor not_zero_pos in range(len(nums)):\n if nums[not_zero_... | <|body_start_0|>
len_nums = len(nums)
for i in range(len_nums - 1, -1, -1):
if nums[i] != 0:
continue
for j in range(i, len_nums - 1):
if nums[j] == 0:
nums[j], nums[j + 1] = (nums[j + 1], nums[j])
print(nums)
<|end_body... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes2(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后"""
<|body_0|>
def moveZeroes(self, nums: List[int]) -> None:
"""20191002 执行用时 :60 ms, 在所有 Python3 提交中击败了95.87% 的... | stack_v2_sparse_classes_75kplus_train_006248 | 1,619 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后",
"name": "moveZeroes2",
"signature": "def moveZeroes2(self, nums: List[int]) -> None"
},
{
"docstring": "20191002 执行用时 :60 ms, 在所有 Python3 提交中击败了95.87% 的用户 内存消耗 :15 MB, 在所有 Python3 提交中击... | 2 | stack_v2_sparse_classes_30k_train_001927 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后
- def moveZeroes(self, nums: List[in... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后
- def moveZeroes(self, nums: List[in... | 99a3abf1774933af73a8405f9b59e5e64906bca4 | <|skeleton|>
class Solution:
def moveZeroes2(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后"""
<|body_0|>
def moveZeroes(self, nums: List[int]) -> None:
"""20191002 执行用时 :60 ms, 在所有 Python3 提交中击败了95.87% 的... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def moveZeroes2(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead. 20191001 常规思路 O(n^2), 从后往前找 0, 找到之后移到最后"""
len_nums = len(nums)
for i in range(len_nums - 1, -1, -1):
if nums[i] != 0:
continue
for... | the_stack_v2_python_sparse | 2018年力扣高频算法面试题汇总/移动零.py | iamkissg/leetcode | train | 0 | |
5d039168875bc65c5d2494fd6f7605a64c7f2966 | [
"res = {}\nfor _obj in self.browse(cr, uid, ids, context=context):\n res[_obj.id] = {}\n res[_obj.id].update({'is_lot_based': _obj.track_production or _obj.cost_method in LOT_BASED_METHODS or False})\n res[_obj.id].update({'is_auto_assign': _obj.cost_method in AUTO_ASSIGN_METHODS or False})\nreturn res",
... | <|body_start_0|>
res = {}
for _obj in self.browse(cr, uid, ids, context=context):
res[_obj.id] = {}
res[_obj.id].update({'is_lot_based': _obj.track_production or _obj.cost_method in LOT_BASED_METHODS or False})
res[_obj.id].update({'is_auto_assign': _obj.cost_method i... | product_product | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class product_product:
def _is_lot_based(self, cr, uid, ids, name, args, context=None):
"""This determines whether the Product's Cost Method is considered lot based ------------------------------------------------------------------- @param self: Object Pointer @param cr: Database Cursor @param... | stack_v2_sparse_classes_75kplus_train_006249 | 6,637 | no_license | [
{
"docstring": "This determines whether the Product's Cost Method is considered lot based ------------------------------------------------------------------- @param self: Object Pointer @param cr: Database Cursor @param uid: Current Logged in User @param ids: Current Records @param name: Functional field's name... | 2 | stack_v2_sparse_classes_30k_train_043355 | Implement the Python class `product_product` described below.
Class description:
Implement the product_product class.
Method signatures and docstrings:
- def _is_lot_based(self, cr, uid, ids, name, args, context=None): This determines whether the Product's Cost Method is considered lot based -------------------------... | Implement the Python class `product_product` described below.
Class description:
Implement the product_product class.
Method signatures and docstrings:
- def _is_lot_based(self, cr, uid, ids, name, args, context=None): This determines whether the Product's Cost Method is considered lot based -------------------------... | f2b44a8af0e7bee87d52d258fca012bf44ca876f | <|skeleton|>
class product_product:
def _is_lot_based(self, cr, uid, ids, name, args, context=None):
"""This determines whether the Product's Cost Method is considered lot based ------------------------------------------------------------------- @param self: Object Pointer @param cr: Database Cursor @param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class product_product:
def _is_lot_based(self, cr, uid, ids, name, args, context=None):
"""This determines whether the Product's Cost Method is considered lot based ------------------------------------------------------------------- @param self: Object Pointer @param cr: Database Cursor @param uid: Current ... | the_stack_v2_python_sparse | via_lot_valuation/product.py | eksotama/prln-via-custom-addons | train | 0 | |
a329418bcc5071376c1ab4bf5ca9c06d52426530 | [
"y = CArray(y)\ns = CArray(s)\nreturn 1.0 / (1.0 + (-y * s).exp())",
"y = y.ravel()\ny = convert_binary_labels(y)\ny = CArray(y).astype(float).T\nC = self.C\nx = x.atleast_2d()\nn = x.shape[0]\ns = self.decision_function(x, y=1).T\nsigm = self._sigm(y, s)\nz = sigm * (1 - sigm)\nx = x if self.preprocess is None e... | <|body_start_0|>
y = CArray(y)
s = CArray(s)
return 1.0 / (1.0 + (-y * s).exp())
<|end_body_0|>
<|body_start_1|>
y = y.ravel()
y = convert_binary_labels(y)
y = CArray(y).astype(float).T
C = self.C
x = x.atleast_2d()
n = x.shape[0]
s = self... | Mixin class for CClassifierLogistic gradients. | CClassifierGradientLogisticMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CClassifierGradientLogisticMixin:
"""Mixin class for CClassifierLogistic gradients."""
def _sigm(self, y, s):
"""Sigmoid function."""
<|body_0|>
def hessian_tr_params(self, x, y):
"""Hessian of the training objective w.r.t. the classifier parameters. Parameters -... | stack_v2_sparse_classes_75kplus_train_006250 | 1,986 | permissive | [
{
"docstring": "Sigmoid function.",
"name": "_sigm",
"signature": "def _sigm(self, y, s)"
},
{
"docstring": "Hessian of the training objective w.r.t. the classifier parameters. Parameters ---------- x : CArray Features of the dataset on which the training objective is computed. y : CArray Datase... | 2 | null | Implement the Python class `CClassifierGradientLogisticMixin` described below.
Class description:
Mixin class for CClassifierLogistic gradients.
Method signatures and docstrings:
- def _sigm(self, y, s): Sigmoid function.
- def hessian_tr_params(self, x, y): Hessian of the training objective w.r.t. the classifier par... | Implement the Python class `CClassifierGradientLogisticMixin` described below.
Class description:
Mixin class for CClassifierLogistic gradients.
Method signatures and docstrings:
- def _sigm(self, y, s): Sigmoid function.
- def hessian_tr_params(self, x, y): Hessian of the training objective w.r.t. the classifier par... | 431373e65d8cfe2cb7cf042ce1a6c9519ea5a14a | <|skeleton|>
class CClassifierGradientLogisticMixin:
"""Mixin class for CClassifierLogistic gradients."""
def _sigm(self, y, s):
"""Sigmoid function."""
<|body_0|>
def hessian_tr_params(self, x, y):
"""Hessian of the training objective w.r.t. the classifier parameters. Parameters -... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CClassifierGradientLogisticMixin:
"""Mixin class for CClassifierLogistic gradients."""
def _sigm(self, y, s):
"""Sigmoid function."""
y = CArray(y)
s = CArray(s)
return 1.0 / (1.0 + (-y * s).exp())
def hessian_tr_params(self, x, y):
"""Hessian of the training ... | the_stack_v2_python_sparse | src/secml/ml/classifiers/gradients/mixin_classifier_gradient_logistic.py | Cinofix/secml | train | 0 |
e66aa8fbfca505c7c7c6bf7ab459eb326ce76504 | [
"self.app_marker_detection = app_marker_detection\nself.cloud_spill_vault_id = cloud_spill_vault_id\nself.compression_policy = compression_policy\nself.deduplicate_compress_delay_secs = deduplicate_compress_delay_secs\nself.deduplication_enabled = deduplication_enabled\nself.encryption_policy = encryption_policy\ns... | <|body_start_0|>
self.app_marker_detection = app_marker_detection
self.cloud_spill_vault_id = cloud_spill_vault_id
self.compression_policy = compression_policy
self.deduplicate_compress_delay_secs = deduplicate_compress_delay_secs
self.deduplication_enabled = deduplication_enable... | Implementation of the 'StoragePolicy' model. Specifies the storage options applied to a Storage Domain (View Box). Attributes: app_marker_detection (bool): Specifies Whether to support app marker detection. When this is set to true, app markers (like commvault markers) will be removed from data and put in separate chun... | StoragePolicy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StoragePolicy:
"""Implementation of the 'StoragePolicy' model. Specifies the storage options applied to a Storage Domain (View Box). Attributes: app_marker_detection (bool): Specifies Whether to support app marker detection. When this is set to true, app markers (like commvault markers) will be r... | stack_v2_sparse_classes_75kplus_train_006251 | 7,562 | permissive | [
{
"docstring": "Constructor for the StoragePolicy class",
"name": "__init__",
"signature": "def __init__(self, app_marker_detection=None, cloud_spill_vault_id=None, compression_policy=None, deduplicate_compress_delay_secs=None, deduplication_enabled=None, encryption_policy=None, erasure_coding_info=None... | 2 | stack_v2_sparse_classes_30k_train_044090 | Implement the Python class `StoragePolicy` described below.
Class description:
Implementation of the 'StoragePolicy' model. Specifies the storage options applied to a Storage Domain (View Box). Attributes: app_marker_detection (bool): Specifies Whether to support app marker detection. When this is set to true, app mar... | Implement the Python class `StoragePolicy` described below.
Class description:
Implementation of the 'StoragePolicy' model. Specifies the storage options applied to a Storage Domain (View Box). Attributes: app_marker_detection (bool): Specifies Whether to support app marker detection. When this is set to true, app mar... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class StoragePolicy:
"""Implementation of the 'StoragePolicy' model. Specifies the storage options applied to a Storage Domain (View Box). Attributes: app_marker_detection (bool): Specifies Whether to support app marker detection. When this is set to true, app markers (like commvault markers) will be r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StoragePolicy:
"""Implementation of the 'StoragePolicy' model. Specifies the storage options applied to a Storage Domain (View Box). Attributes: app_marker_detection (bool): Specifies Whether to support app marker detection. When this is set to true, app markers (like commvault markers) will be removed from d... | the_stack_v2_python_sparse | cohesity_management_sdk/models/storage_policy.py | cohesity/management-sdk-python | train | 24 |
e65fc951467c377f178022827486d95abb8b29d0 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | DriverServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DriverServicer:
"""Missing associated documentation comment in .proto file."""
def GetNodes(self, request, context):
"""Return a set of nodes"""
<|body_0|>
def PushTaskIns(self, request, context):
"""Create one or more tasks"""
<|body_1|>
def PullTas... | stack_v2_sparse_classes_75kplus_train_006252 | 5,727 | permissive | [
{
"docstring": "Return a set of nodes",
"name": "GetNodes",
"signature": "def GetNodes(self, request, context)"
},
{
"docstring": "Create one or more tasks",
"name": "PushTaskIns",
"signature": "def PushTaskIns(self, request, context)"
},
{
"docstring": "Get task results",
"n... | 3 | stack_v2_sparse_classes_30k_train_031398 | Implement the Python class `DriverServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetNodes(self, request, context): Return a set of nodes
- def PushTaskIns(self, request, context): Create one or more tasks
- def PullTaskRes... | Implement the Python class `DriverServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def GetNodes(self, request, context): Return a set of nodes
- def PushTaskIns(self, request, context): Create one or more tasks
- def PullTaskRes... | 55be690535e5f3feb33c888c3e4a586b7bdbf489 | <|skeleton|>
class DriverServicer:
"""Missing associated documentation comment in .proto file."""
def GetNodes(self, request, context):
"""Return a set of nodes"""
<|body_0|>
def PushTaskIns(self, request, context):
"""Create one or more tasks"""
<|body_1|>
def PullTas... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DriverServicer:
"""Missing associated documentation comment in .proto file."""
def GetNodes(self, request, context):
"""Return a set of nodes"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method... | the_stack_v2_python_sparse | src/py/flwr/proto/driver_pb2_grpc.py | adap/flower | train | 2,999 |
f081faa062dde9bd33d6f2b360a71e713dc07952 | [
"response = RESPONSE.SUCCESS\ntry:\n params = request.GET\n page = params.get('page', '1')\n page = int(page)\n if page < 1:\n raise ValueError()\n all_pages = Paginator(UserModel.objects.filter(user_type=UserType.ADMIN).order_by('id', 'username'), 25)\n curr_page = all_pages.page(page)\n ... | <|body_start_0|>
response = RESPONSE.SUCCESS
try:
params = request.GET
page = params.get('page', '1')
page = int(page)
if page < 1:
raise ValueError()
all_pages = Paginator(UserModel.objects.filter(user_type=UserType.ADMIN).orde... | SuperUserListHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuperUserListHandler:
def get(self, request, **_):
"""@api {get} /user/admin/ Get admin user list @apiName GetAdminList @apiGroup AdminMgmt @apiVersion 0.1.0 @apiPermission super_admin @apiParam {Number} [page] Specifies the page number (starting from 1, per page 25 elements) @apiSuccess... | stack_v2_sparse_classes_75kplus_train_006253 | 42,340 | no_license | [
{
"docstring": "@api {get} /user/admin/ Get admin user list @apiName GetAdminList @apiGroup AdminMgmt @apiVersion 0.1.0 @apiPermission super_admin @apiParam {Number} [page] Specifies the page number (starting from 1, per page 25 elements) @apiSuccess {Object} payload Response object @apiSuccess {Number} payload... | 2 | stack_v2_sparse_classes_30k_train_011479 | Implement the Python class `SuperUserListHandler` described below.
Class description:
Implement the SuperUserListHandler class.
Method signatures and docstrings:
- def get(self, request, **_): @api {get} /user/admin/ Get admin user list @apiName GetAdminList @apiGroup AdminMgmt @apiVersion 0.1.0 @apiPermission super_... | Implement the Python class `SuperUserListHandler` described below.
Class description:
Implement the SuperUserListHandler class.
Method signatures and docstrings:
- def get(self, request, **_): @api {get} /user/admin/ Get admin user list @apiName GetAdminList @apiGroup AdminMgmt @apiVersion 0.1.0 @apiPermission super_... | 251c7dd0d8ae4756a684ec90c38392866b67d0bb | <|skeleton|>
class SuperUserListHandler:
def get(self, request, **_):
"""@api {get} /user/admin/ Get admin user list @apiName GetAdminList @apiGroup AdminMgmt @apiVersion 0.1.0 @apiPermission super_admin @apiParam {Number} [page] Specifies the page number (starting from 1, per page 25 elements) @apiSuccess... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SuperUserListHandler:
def get(self, request, **_):
"""@api {get} /user/admin/ Get admin user list @apiName GetAdminList @apiGroup AdminMgmt @apiVersion 0.1.0 @apiPermission super_admin @apiParam {Number} [page] Specifies the page number (starting from 1, per page 25 elements) @apiSuccess {Object} payl... | the_stack_v2_python_sparse | backend/user_model/views.py | zx1239856/Cloud-Scheduler-OJ | train | 0 | |
594854f27ff16128754ad06dea4af7d9869bab45 | [
"boxes = super().get_boxes(method)\ncategories = np.unique(np.array(self.sample_types))\nenough_categories = min(Counter(self.sample_types).values()) > 1 and len(categories) == self.n_categories\npvalues = self.get_p_values(enough_categories)\nfor i, box in enumerate(boxes):\n box.pvalue = pvalues[i]\nreturn box... | <|body_start_0|>
boxes = super().get_boxes(method)
categories = np.unique(np.array(self.sample_types))
enough_categories = min(Counter(self.sample_types).values()) > 1 and len(categories) == self.n_categories
pvalues = self.get_p_values(enough_categories)
for i, box in enumerate(... | TODO: add docstring comment This class does ... | FrequentistRoiAligner | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrequentistRoiAligner:
"""TODO: add docstring comment This class does ..."""
def get_boxes(self, method='mean'):
"""Converts peaksets to generic boxes in a different way Args: method: Returns: ???"""
<|body_0|>
def get_p_values(self, enough_catergories):
"""Args:... | stack_v2_sparse_classes_75kplus_train_006254 | 46,677 | permissive | [
{
"docstring": "Converts peaksets to generic boxes in a different way Args: method: Returns: ???",
"name": "get_boxes",
"signature": "def get_boxes(self, method='mean')"
},
{
"docstring": "Args: enough_catergories: Returns: ???",
"name": "get_p_values",
"signature": "def get_p_values(sel... | 2 | null | Implement the Python class `FrequentistRoiAligner` described below.
Class description:
TODO: add docstring comment This class does ...
Method signatures and docstrings:
- def get_boxes(self, method='mean'): Converts peaksets to generic boxes in a different way Args: method: Returns: ???
- def get_p_values(self, enoug... | Implement the Python class `FrequentistRoiAligner` described below.
Class description:
TODO: add docstring comment This class does ...
Method signatures and docstrings:
- def get_boxes(self, method='mean'): Converts peaksets to generic boxes in a different way Args: method: Returns: ???
- def get_p_values(self, enoug... | e5d97ae4ff42d613fc55db51443e1e733999b908 | <|skeleton|>
class FrequentistRoiAligner:
"""TODO: add docstring comment This class does ..."""
def get_boxes(self, method='mean'):
"""Converts peaksets to generic boxes in a different way Args: method: Returns: ???"""
<|body_0|>
def get_p_values(self, enough_catergories):
"""Args:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FrequentistRoiAligner:
"""TODO: add docstring comment This class does ..."""
def get_boxes(self, method='mean'):
"""Converts peaksets to generic boxes in a different way Args: method: Returns: ???"""
boxes = super().get_boxes(method)
categories = np.unique(np.array(self.sample_typ... | the_stack_v2_python_sparse | vimms/Roi.py | glasgowcompbio/vimms | train | 22 |
4d357a6d639c258732f05dbbc940e6210574e8d2 | [
"super().__init__(name, strength=strength, elevation=elevation, azimuth=azimuth)\nself.__colour = colour\nself.set_scale_factor(conf.light_multiplier)",
"super().add_to_world(ax)\nworld_vector = self.get_world_position().get_cartesian_as_list()\nworld_position = [[x] for x in world_vector]\nmarker_size = str(supe... | <|body_start_0|>
super().__init__(name, strength=strength, elevation=elevation, azimuth=azimuth)
self.__colour = colour
self.set_scale_factor(conf.light_multiplier)
<|end_body_0|>
<|body_start_1|>
super().add_to_world(ax)
world_vector = self.get_world_position().get_cartesian_as... | Light | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Light:
def __init__(self, name, strength=1, elevation=np.pi / 4, azimuth=np.pi / 2, colour='green'):
"""Create a light-based cue with a given position and strength. Default is a light of strength 1 at 90 degrees azimuth and 45 degrees elevation. :param strength: How powerful the light is... | stack_v2_sparse_classes_75kplus_train_006255 | 1,669 | permissive | [
{
"docstring": "Create a light-based cue with a given position and strength. Default is a light of strength 1 at 90 degrees azimuth and 45 degrees elevation. :param strength: How powerful the light is :param elevation: The elevation at which the light sits on the dome. Radians. :param azimuth: The azimuth at wh... | 2 | stack_v2_sparse_classes_30k_train_034225 | Implement the Python class `Light` described below.
Class description:
Implement the Light class.
Method signatures and docstrings:
- def __init__(self, name, strength=1, elevation=np.pi / 4, azimuth=np.pi / 2, colour='green'): Create a light-based cue with a given position and strength. Default is a light of strengt... | Implement the Python class `Light` described below.
Class description:
Implement the Light class.
Method signatures and docstrings:
- def __init__(self, name, strength=1, elevation=np.pi / 4, azimuth=np.pi / 2, colour='green'): Create a light-based cue with a given position and strength. Default is a light of strengt... | 34fbf71985a662693fafd6c13b9724bc45cddca7 | <|skeleton|>
class Light:
def __init__(self, name, strength=1, elevation=np.pi / 4, azimuth=np.pi / 2, colour='green'):
"""Create a light-based cue with a given position and strength. Default is a light of strength 1 at 90 degrees azimuth and 45 degrees elevation. :param strength: How powerful the light is... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Light:
def __init__(self, name, strength=1, elevation=np.pi / 4, azimuth=np.pi / 2, colour='green'):
"""Create a light-based cue with a given position and strength. Default is a light of strength 1 at 90 degrees azimuth and 45 degrees elevation. :param strength: How powerful the light is :param elevat... | the_stack_v2_python_sparse | pathfinder/world/light.py | refmitchell/pathfinder | train | 1 | |
bebc859117356a1d4787864d3752dac4a7acd98c | [
"init_a[1].login_form(success_a_data['username'], success_a_data['password'], success_a_data['code'])\nsleep(1)\nassert HomePage(init_a[0]).button_is_exist() is True",
"init_a[1].login_form(datas['username'], datas['password'], datas['code'])\nsleep(1)\nassert init_a[1].login_fail_msg() == datas['check']",
"ini... | <|body_start_0|>
init_a[1].login_form(success_a_data['username'], success_a_data['password'], success_a_data['code'])
sleep(1)
assert HomePage(init_a[0]).button_is_exist() is True
<|end_body_0|>
<|body_start_1|>
init_a[1].login_form(datas['username'], datas['password'], datas['code'])
... | TestALogin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestALogin:
def test_login_a_success(self, init_a):
"""A端登录页面,登录成功操作"""
<|body_0|>
def test_login_a_fail(self, init_a, datas):
"""A端登录,登录失败弹框提示"""
<|body_1|>
def test_login_a_fail_code_None(self, init_a):
"""A端登录,验证码错误提示"""
<|body_2|>
<|... | stack_v2_sparse_classes_75kplus_train_006256 | 1,648 | no_license | [
{
"docstring": "A端登录页面,登录成功操作",
"name": "test_login_a_success",
"signature": "def test_login_a_success(self, init_a)"
},
{
"docstring": "A端登录,登录失败弹框提示",
"name": "test_login_a_fail",
"signature": "def test_login_a_fail(self, init_a, datas)"
},
{
"docstring": "A端登录,验证码错误提示",
"n... | 3 | stack_v2_sparse_classes_30k_train_047605 | Implement the Python class `TestALogin` described below.
Class description:
Implement the TestALogin class.
Method signatures and docstrings:
- def test_login_a_success(self, init_a): A端登录页面,登录成功操作
- def test_login_a_fail(self, init_a, datas): A端登录,登录失败弹框提示
- def test_login_a_fail_code_None(self, init_a): A端登录,验证码错误提... | Implement the Python class `TestALogin` described below.
Class description:
Implement the TestALogin class.
Method signatures and docstrings:
- def test_login_a_success(self, init_a): A端登录页面,登录成功操作
- def test_login_a_fail(self, init_a, datas): A端登录,登录失败弹框提示
- def test_login_a_fail_code_None(self, init_a): A端登录,验证码错误提... | 69e48844077d389f6afc37e12adc24683cd5cc2c | <|skeleton|>
class TestALogin:
def test_login_a_success(self, init_a):
"""A端登录页面,登录成功操作"""
<|body_0|>
def test_login_a_fail(self, init_a, datas):
"""A端登录,登录失败弹框提示"""
<|body_1|>
def test_login_a_fail_code_None(self, init_a):
"""A端登录,验证码错误提示"""
<|body_2|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestALogin:
def test_login_a_success(self, init_a):
"""A端登录页面,登录成功操作"""
init_a[1].login_form(success_a_data['username'], success_a_data['password'], success_a_data['code'])
sleep(1)
assert HomePage(init_a[0]).button_is_exist() is True
def test_login_a_fail(self, init_a, da... | the_stack_v2_python_sparse | TestCases/TestModuleA/test_a_login.py | Sissixi/web_sissi | train | 0 | |
b3edefffbce89ae4f1f51745fb39196d73c58dea | [
"self.data = post_data or {}\nself.img_url = self.data.get('image_url')\nself.color = (255, 255, 255)",
"load_image = load_url_image(self.img_url, True)\nimg_w, img_h = load_image.size\nmain_image_data = format_image_data(post_data=self.data, url=self.img_url, path=None, image_type=ImageType.Background, width=img... | <|body_start_0|>
self.data = post_data or {}
self.img_url = self.data.get('image_url')
self.color = (255, 255, 255)
<|end_body_0|>
<|body_start_1|>
load_image = load_url_image(self.img_url, True)
img_w, img_h = load_image.size
main_image_data = format_image_data(post_dat... | 图片添加水印的样式 | WatermarkPictureStyle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WatermarkPictureStyle:
"""图片添加水印的样式"""
def __init__(self, post_data):
"""初始化海报样式 :param post_data: 内容数据"""
<|body_0|>
def get_default_style(self):
"""默认样式"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.data = post_data or {}
self.i... | stack_v2_sparse_classes_75kplus_train_006257 | 35,262 | no_license | [
{
"docstring": "初始化海报样式 :param post_data: 内容数据",
"name": "__init__",
"signature": "def __init__(self, post_data)"
},
{
"docstring": "默认样式",
"name": "get_default_style",
"signature": "def get_default_style(self)"
}
] | 2 | null | Implement the Python class `WatermarkPictureStyle` described below.
Class description:
图片添加水印的样式
Method signatures and docstrings:
- def __init__(self, post_data): 初始化海报样式 :param post_data: 内容数据
- def get_default_style(self): 默认样式 | Implement the Python class `WatermarkPictureStyle` described below.
Class description:
图片添加水印的样式
Method signatures and docstrings:
- def __init__(self, post_data): 初始化海报样式 :param post_data: 内容数据
- def get_default_style(self): 默认样式
<|skeleton|>
class WatermarkPictureStyle:
"""图片添加水印的样式"""
def __init__(self, ... | dc6cc40b79d63baac5b9e2a682e0893222b082d5 | <|skeleton|>
class WatermarkPictureStyle:
"""图片添加水印的样式"""
def __init__(self, post_data):
"""初始化海报样式 :param post_data: 内容数据"""
<|body_0|>
def get_default_style(self):
"""默认样式"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WatermarkPictureStyle:
"""图片添加水印的样式"""
def __init__(self, post_data):
"""初始化海报样式 :param post_data: 内容数据"""
self.data = post_data or {}
self.img_url = self.data.get('image_url')
self.color = (255, 255, 255)
def get_default_style(self):
"""默认样式"""
load_i... | the_stack_v2_python_sparse | vimage/poster_style/poster_style.py | purpen/vimage | train | 0 |
4ea8b66af2c824e4249db51600b4f7513b72a77c | [
"username = bleach.clean(username)\nrtn = [g.name for g in ActuatorGroup.objects.filter(users__in=[get_user_model().objects.get(username=username)])]\nreturn Response(rtn)",
"username = bleach.clean(username)\nuser = get_user_model().objects.get(username=username)\nif user is None:\n return ParseError(detail='... | <|body_start_0|>
username = bleach.clean(username)
rtn = [g.name for g in ActuatorGroup.objects.filter(users__in=[get_user_model().objects.get(username=username)])]
return Response(rtn)
<|end_body_0|>
<|body_start_1|>
username = bleach.clean(username)
user = get_user_model().obj... | API endpoint that allows users actuator access to be viewed or edited. | ActuatorAccess | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActuatorAccess:
"""API endpoint that allows users actuator access to be viewed or edited."""
def get(self, request, username, *args, **kwargs):
"""API endpoint that lists the actuators a users can access"""
<|body_0|>
def put(self, request, username, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus_train_006258 | 1,619 | permissive | [
{
"docstring": "API endpoint that lists the actuators a users can access",
"name": "get",
"signature": "def get(self, request, username, *args, **kwargs)"
},
{
"docstring": "API endpoint that adds actuators to a users access",
"name": "put",
"signature": "def put(self, request, username,... | 2 | stack_v2_sparse_classes_30k_train_008362 | Implement the Python class `ActuatorAccess` described below.
Class description:
API endpoint that allows users actuator access to be viewed or edited.
Method signatures and docstrings:
- def get(self, request, username, *args, **kwargs): API endpoint that lists the actuators a users can access
- def put(self, request... | Implement the Python class `ActuatorAccess` described below.
Class description:
API endpoint that allows users actuator access to be viewed or edited.
Method signatures and docstrings:
- def get(self, request, username, *args, **kwargs): API endpoint that lists the actuators a users can access
- def put(self, request... | 9227d38cb53204b45641ac55aefd6a13d2aad563 | <|skeleton|>
class ActuatorAccess:
"""API endpoint that allows users actuator access to be viewed or edited."""
def get(self, request, username, *args, **kwargs):
"""API endpoint that lists the actuators a users can access"""
<|body_0|>
def put(self, request, username, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActuatorAccess:
"""API endpoint that allows users actuator access to be viewed or edited."""
def get(self, request, username, *args, **kwargs):
"""API endpoint that lists the actuators a users can access"""
username = bleach.clean(username)
rtn = [g.name for g in ActuatorGroup.obj... | the_stack_v2_python_sparse | orchestrator/core/orc_server/account/views/apiviews.py | sumodgeorge/openc2-oif-orchestrator | train | 0 |
6f035c2bee10b0b69fc8e050b635e343bbda7b52 | [
"main_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))\nlog_path = os.path.join(main_dir, 'results', 'robot_results')\nreturn os.path.join(log_path, session_name)",
"os.path.join(args[0], args[1])\nlog_directory = os.path.join(self.get_session(args[0]), args[1], args[2])\nreturn lo... | <|body_start_0|>
main_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
log_path = os.path.join(main_dir, 'results', 'robot_results')
return os.path.join(log_path, session_name)
<|end_body_0|>
<|body_start_1|>
os.path.join(args[0], args[1])
log_dir... | :class name : FrameworkLogger :description: Contains function api related to creation of robot_result tree structure | FrameworkLogger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrameworkLogger:
""":class name : FrameworkLogger :description: Contains function api related to creation of robot_result tree structure"""
def get_session(session_name):
""":param session_name: :return: :author: s.subhodeep@globaledgesoft.com"""
<|body_0|>
def make_robo... | stack_v2_sparse_classes_75kplus_train_006259 | 1,123 | no_license | [
{
"docstring": ":param session_name: :return: :author: s.subhodeep@globaledgesoft.com",
"name": "get_session",
"signature": "def get_session(session_name)"
},
{
"docstring": ":param args: :return: :author: s.subhodeep@globaledgesoft.com",
"name": "make_robot_log_dir",
"signature": "def m... | 2 | stack_v2_sparse_classes_30k_train_022754 | Implement the Python class `FrameworkLogger` described below.
Class description:
:class name : FrameworkLogger :description: Contains function api related to creation of robot_result tree structure
Method signatures and docstrings:
- def get_session(session_name): :param session_name: :return: :author: s.subhodeep@gl... | Implement the Python class `FrameworkLogger` described below.
Class description:
:class name : FrameworkLogger :description: Contains function api related to creation of robot_result tree structure
Method signatures and docstrings:
- def get_session(session_name): :param session_name: :return: :author: s.subhodeep@gl... | 476c0d3138944c8eb3e38de7b14306c5c5cc5a18 | <|skeleton|>
class FrameworkLogger:
""":class name : FrameworkLogger :description: Contains function api related to creation of robot_result tree structure"""
def get_session(session_name):
""":param session_name: :return: :author: s.subhodeep@globaledgesoft.com"""
<|body_0|>
def make_robo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FrameworkLogger:
""":class name : FrameworkLogger :description: Contains function api related to creation of robot_result tree structure"""
def get_session(session_name):
""":param session_name: :return: :author: s.subhodeep@globaledgesoft.com"""
main_dir = os.path.abspath(os.path.join(os... | the_stack_v2_python_sparse | gats/automation/scripts/libraries/framework_utils/framework_logger.py | Praveenkumar99/gitjenkinsintegration | train | 0 |
172dd68f4e564e13b1a49d7a172cca51e7c229a0 | [
"water = 0\nfor i in range(len(height)):\n leftmax = height[i]\n j = i - 1\n while j >= 0:\n if height[j] > leftmax and height[j] > height[i]:\n leftmax = height[j]\n j -= 1\n j = i + 1\n rightmax = height[i]\n while j < len(height):\n if height[j] > rightmax and he... | <|body_start_0|>
water = 0
for i in range(len(height)):
leftmax = height[i]
j = i - 1
while j >= 0:
if height[j] > leftmax and height[j] > height[i]:
leftmax = height[j]
j -= 1
j = i + 1
right... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def trap(self, height) -> int:
"""暴力法,某一位置的雨水等于两边最大高度的较小值,减去当前高度。类似找函数左右最小的极值 :param list[int] height: :return: int"""
<|body_0|>
def trap2(self, height) -> int:
"""改进暴力法,加入动态规划,找到坐标最大值,找到右边最大值 :param list[int] height: :return: int"""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus_train_006260 | 1,926 | no_license | [
{
"docstring": "暴力法,某一位置的雨水等于两边最大高度的较小值,减去当前高度。类似找函数左右最小的极值 :param list[int] height: :return: int",
"name": "trap",
"signature": "def trap(self, height) -> int"
},
{
"docstring": "改进暴力法,加入动态规划,找到坐标最大值,找到右边最大值 :param list[int] height: :return: int",
"name": "trap2",
"signature": "def trap... | 2 | stack_v2_sparse_classes_30k_test_000265 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def trap(self, height) -> int: 暴力法,某一位置的雨水等于两边最大高度的较小值,减去当前高度。类似找函数左右最小的极值 :param list[int] height: :return: int
- def trap2(self, height) -> int: 改进暴力法,加入动态规划,找到坐标最大值,找到右边最大值 :p... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def trap(self, height) -> int: 暴力法,某一位置的雨水等于两边最大高度的较小值,减去当前高度。类似找函数左右最小的极值 :param list[int] height: :return: int
- def trap2(self, height) -> int: 改进暴力法,加入动态规划,找到坐标最大值,找到右边最大值 :p... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def trap(self, height) -> int:
"""暴力法,某一位置的雨水等于两边最大高度的较小值,减去当前高度。类似找函数左右最小的极值 :param list[int] height: :return: int"""
<|body_0|>
def trap2(self, height) -> int:
"""改进暴力法,加入动态规划,找到坐标最大值,找到右边最大值 :param list[int] height: :return: int"""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def trap(self, height) -> int:
"""暴力法,某一位置的雨水等于两边最大高度的较小值,减去当前高度。类似找函数左右最小的极值 :param list[int] height: :return: int"""
water = 0
for i in range(len(height)):
leftmax = height[i]
j = i - 1
while j >= 0:
if height[j] > leftmax... | the_stack_v2_python_sparse | 华为题库/接雨水.py | 2226171237/Algorithmpractice | train | 0 | |
6efb806b9601b23d2f453ec8c499bc54667f950d | [
"super().__init__()\nstate_dim = descript.get('state_dim')\naction_dim = descript.get('action_dim')\nself.back_bone = ImpalaCnnBackBone(**descript)\nself.fc2 = Sequential(Linear(256, action_dim), Lambda(lambda x: softmax(x)))\nself.fc3 = Sequential(Linear(256, 1))",
"outputs = []\nback_bone_output = self.back_bon... | <|body_start_0|>
super().__init__()
state_dim = descript.get('state_dim')
action_dim = descript.get('action_dim')
self.back_bone = ImpalaCnnBackBone(**descript)
self.fc2 = Sequential(Linear(256, action_dim), Lambda(lambda x: softmax(x)))
self.fc3 = Sequential(Linear(256, ... | Create DQN net with FineGrainedSpace. | ImpalaCnnNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImpalaCnnNet:
"""Create DQN net with FineGrainedSpace."""
def __init__(self, **descript):
"""Create layers."""
<|body_0|>
def __call__(self, inputs):
"""Override compile function, conect models into a seq."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_006261 | 4,926 | permissive | [
{
"docstring": "Create layers.",
"name": "__init__",
"signature": "def __init__(self, **descript)"
},
{
"docstring": "Override compile function, conect models into a seq.",
"name": "__call__",
"signature": "def __call__(self, inputs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012825 | Implement the Python class `ImpalaCnnNet` described below.
Class description:
Create DQN net with FineGrainedSpace.
Method signatures and docstrings:
- def __init__(self, **descript): Create layers.
- def __call__(self, inputs): Override compile function, conect models into a seq. | Implement the Python class `ImpalaCnnNet` described below.
Class description:
Create DQN net with FineGrainedSpace.
Method signatures and docstrings:
- def __init__(self, **descript): Create layers.
- def __call__(self, inputs): Override compile function, conect models into a seq.
<|skeleton|>
class ImpalaCnnNet:
... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class ImpalaCnnNet:
"""Create DQN net with FineGrainedSpace."""
def __init__(self, **descript):
"""Create layers."""
<|body_0|>
def __call__(self, inputs):
"""Override compile function, conect models into a seq."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImpalaCnnNet:
"""Create DQN net with FineGrainedSpace."""
def __init__(self, **descript):
"""Create layers."""
super().__init__()
state_dim = descript.get('state_dim')
action_dim = descript.get('action_dim')
self.back_bone = ImpalaCnnBackBone(**descript)
se... | the_stack_v2_python_sparse | xt/model/impala/impala_cnn_zeus.py | huawei-noah/xingtian | train | 308 |
ec561c32cf1d97459c493dd73fe1e7ea5e2c7062 | [
"response = jsonify({'error': 'forbidden', 'message': message})\nresponse.status_code = 403\nreturn response",
"response = jsonify({'error': 'unauthorized', 'message': message})\nresponse.status_code = 401\nreturn response",
"response = jsonify({'error': 'not found', 'message': message})\nresponse.status_code =... | <|body_start_0|>
response = jsonify({'error': 'forbidden', 'message': message})
response.status_code = 403
return response
<|end_body_0|>
<|body_start_1|>
response = jsonify({'error': 'unauthorized', 'message': message})
response.status_code = 401
return response
<|end_b... | This class implements all the helper functions for API errors | RestApiErrors | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestApiErrors:
"""This class implements all the helper functions for API errors"""
def forbidden_403(message):
"""403 Forbidden - The authentication credentials sent with the request are insufficient for the request. :param message: Message to return to client"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_006262 | 1,887 | no_license | [
{
"docstring": "403 Forbidden - The authentication credentials sent with the request are insufficient for the request. :param message: Message to return to client",
"name": "forbidden_403",
"signature": "def forbidden_403(message)"
},
{
"docstring": "401 Unauthorized - The request does not inclu... | 5 | stack_v2_sparse_classes_30k_train_038711 | Implement the Python class `RestApiErrors` described below.
Class description:
This class implements all the helper functions for API errors
Method signatures and docstrings:
- def forbidden_403(message): 403 Forbidden - The authentication credentials sent with the request are insufficient for the request. :param mes... | Implement the Python class `RestApiErrors` described below.
Class description:
This class implements all the helper functions for API errors
Method signatures and docstrings:
- def forbidden_403(message): 403 Forbidden - The authentication credentials sent with the request are insufficient for the request. :param mes... | 4355219d1459930e66fbb64f5ac89bda5d62d2b4 | <|skeleton|>
class RestApiErrors:
"""This class implements all the helper functions for API errors"""
def forbidden_403(message):
"""403 Forbidden - The authentication credentials sent with the request are insufficient for the request. :param message: Message to return to client"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RestApiErrors:
"""This class implements all the helper functions for API errors"""
def forbidden_403(message):
"""403 Forbidden - The authentication credentials sent with the request are insufficient for the request. :param message: Message to return to client"""
response = jsonify({'erro... | the_stack_v2_python_sparse | app/api_errors.py | nikoren/crypto | train | 0 |
b67b9cdf635244fde63b4941e2483f4e17343034 | [
"if not root:\n return 0\nqueue, depth = ([], 1)\nqueue.append(root)\nwhile queue:\n size = len(queue)\n for _ in range(size):\n node = queue.pop(0)\n if not node.children and (not queue):\n return depth\n for child in node.children:\n queue.append(child)\n dep... | <|body_start_0|>
if not root:
return 0
queue, depth = ([], 1)
queue.append(root)
while queue:
size = len(queue)
for _ in range(size):
node = queue.pop(0)
if not node.children and (not queue):
return d... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root: 'Node') -> int:
"""BFS"""
<|body_0|>
def maxDepth_1(self, root: 'Node') -> int:
"""DFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return 0
queue, depth = ([], 1)
queue.... | stack_v2_sparse_classes_75kplus_train_006263 | 1,389 | no_license | [
{
"docstring": "BFS",
"name": "maxDepth",
"signature": "def maxDepth(self, root: 'Node') -> int"
},
{
"docstring": "DFS",
"name": "maxDepth_1",
"signature": "def maxDepth_1(self, root: 'Node') -> int"
}
] | 2 | stack_v2_sparse_classes_30k_val_000349 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root: 'Node') -> int: BFS
- def maxDepth_1(self, root: 'Node') -> int: DFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root: 'Node') -> int: BFS
- def maxDepth_1(self, root: 'Node') -> int: DFS
<|skeleton|>
class Solution:
def maxDepth(self, root: 'Node') -> int:
... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def maxDepth(self, root: 'Node') -> int:
"""BFS"""
<|body_0|>
def maxDepth_1(self, root: 'Node') -> int:
"""DFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxDepth(self, root: 'Node') -> int:
"""BFS"""
if not root:
return 0
queue, depth = ([], 1)
queue.append(root)
while queue:
size = len(queue)
for _ in range(size):
node = queue.pop(0)
if n... | the_stack_v2_python_sparse | algorithm/leetcode/bfs/03-N叉树的最大深度.py | lxconfig/UbuntuCode_bak | train | 0 | |
cffaf3e28c1eb069a6d6feba625891bf4363bc36 | [
"super().__init__(freq=freq, context_length=context_length, prediction_length=prediction_length, num_feat_dynamic_real=num_feat_dynamic_real, num_feat_static_real=num_feat_static_real, num_feat_static_cat=num_feat_static_cat, cardinality=cardinality, embedding_dimension=embedding_dimension, num_layers=num_layers, h... | <|body_start_0|>
super().__init__(freq=freq, context_length=context_length, prediction_length=prediction_length, num_feat_dynamic_real=num_feat_dynamic_real, num_feat_static_real=num_feat_static_real, num_feat_static_cat=num_feat_static_cat, cardinality=cardinality, embedding_dimension=embedding_dimension, num_... | MQF2MultiHorizonModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MQF2MultiHorizonModel:
def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[DistributionOutput]=None, embedding_dimension: Optional[List[int]]=Non... | stack_v2_sparse_classes_75kplus_train_006264 | 6,947 | permissive | [
{
"docstring": "Model class for the model MQF2 proposed in the paper ``Multivariate Quantile Function Forecaster`` by Kan, Aubet, Januschowski, Park, Benidis, Ruthotto, Gasthaus This is the multi-horizon (multivariate in time step) variant of MQF2 This class is based on gluonts.torch.model.deepar.module.DeepARM... | 3 | stack_v2_sparse_classes_30k_train_015372 | Implement the Python class `MQF2MultiHorizonModel` described below.
Class description:
Implement the MQF2MultiHorizonModel class.
Method signatures and docstrings:
- def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: i... | Implement the Python class `MQF2MultiHorizonModel` described below.
Class description:
Implement the MQF2MultiHorizonModel class.
Method signatures and docstrings:
- def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: i... | a818f69dc049c1c1d57e09d2ccb8b5f7a0cff656 | <|skeleton|>
class MQF2MultiHorizonModel:
def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[DistributionOutput]=None, embedding_dimension: Optional[List[int]]=Non... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MQF2MultiHorizonModel:
def __init__(self, freq: str, context_length: int, prediction_length: int, num_feat_dynamic_real: int, num_feat_static_real: int, num_feat_static_cat: int, cardinality: List[int], distr_output: Optional[DistributionOutput]=None, embedding_dimension: Optional[List[int]]=None, num_layers:... | the_stack_v2_python_sparse | src/gluonts/torch/model/mqf2/module.py | kashif/gluon-ts | train | 5 | |
2e3d9f74824477c5ead0059f9afeefd648d855c1 | [
"daemon_id = ''\nif conf_dict:\n for key in conf_dict:\n if 'api_daemon_' in key:\n if prefix in conf_dict[key]:\n daemon_id = key\n break\nreturn daemon_id",
"prefix = sys.prefix\nif conf_dict:\n if daemon_id in conf_dict:\n prefixes = conf_dict[daemon... | <|body_start_0|>
daemon_id = ''
if conf_dict:
for key in conf_dict:
if 'api_daemon_' in key:
if prefix in conf_dict[key]:
daemon_id = key
break
return daemon_id
<|end_body_0|>
<|body_start_1|>
... | This is an auto-generated class for the PySwitchLib device asset. Asset provides connection information for PySwitchLib APIs. | ConfigUtil | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigUtil:
"""This is an auto-generated class for the PySwitchLib device asset. Asset provides connection information for PySwitchLib APIs."""
def get_daemon_id_for_prefix(self, prefix='', conf_dict=None):
"""This is an auto-generated method for the PySwitchLib."""
<|body_0|... | stack_v2_sparse_classes_75kplus_train_006265 | 2,123 | permissive | [
{
"docstring": "This is an auto-generated method for the PySwitchLib.",
"name": "get_daemon_id_for_prefix",
"signature": "def get_daemon_id_for_prefix(self, prefix='', conf_dict=None)"
},
{
"docstring": "This is an auto-generated method for the PySwitchLib.",
"name": "get_prefix_for_daemon_i... | 4 | stack_v2_sparse_classes_30k_train_044321 | Implement the Python class `ConfigUtil` described below.
Class description:
This is an auto-generated class for the PySwitchLib device asset. Asset provides connection information for PySwitchLib APIs.
Method signatures and docstrings:
- def get_daemon_id_for_prefix(self, prefix='', conf_dict=None): This is an auto-g... | Implement the Python class `ConfigUtil` described below.
Class description:
This is an auto-generated class for the PySwitchLib device asset. Asset provides connection information for PySwitchLib APIs.
Method signatures and docstrings:
- def get_daemon_id_for_prefix(self, prefix='', conf_dict=None): This is an auto-g... | 54e872bcbe77f2ae840d845dadb7c5b9c12482ed | <|skeleton|>
class ConfigUtil:
"""This is an auto-generated class for the PySwitchLib device asset. Asset provides connection information for PySwitchLib APIs."""
def get_daemon_id_for_prefix(self, prefix='', conf_dict=None):
"""This is an auto-generated method for the PySwitchLib."""
<|body_0|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfigUtil:
"""This is an auto-generated class for the PySwitchLib device asset. Asset provides connection information for PySwitchLib APIs."""
def get_daemon_id_for_prefix(self, prefix='', conf_dict=None):
"""This is an auto-generated method for the PySwitchLib."""
daemon_id = ''
... | the_stack_v2_python_sparse | pyswitchlib/util/config.py | ScottJWalter/PySwitchLib | train | 0 |
85aa4979ba66357f7b9eaa1cfefa6a905340656a | [
"self.head: ListNode2 = None\nself.tail: ListNode2 = None\nself.size = 0",
"if index < 0 or index >= self.size:\n return -1\ncur = self.head\nfor i in range(index):\n cur = cur.next\nreturn cur.val",
"tmp = ListNode2(val)\nif self.head:\n self.head.prev = tmp\ntmp.next = self.head\ntmp.prev = None\nsel... | <|body_start_0|>
self.head: ListNode2 = None
self.tail: ListNode2 = None
self.size = 0
<|end_body_0|>
<|body_start_1|>
if index < 0 or index >= self.size:
return -1
cur = self.head
for i in range(index):
cur = cur.next
return cur.val
<|end... | DoublyLinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DoublyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
<|body_1|>
def addAtHead(self, ... | stack_v2_sparse_classes_75kplus_train_006266 | 6,234 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get the value of the index-th node in the linked list. If the index is invalid, return -1.",
"name": "get",
"signature": "def get(self, index: int) -> int"
},... | 6 | stack_v2_sparse_classes_30k_train_047429 | Implement the Python class `DoublyLinkedList` described below.
Class description:
Implement the DoublyLinkedList class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index i... | Implement the Python class `DoublyLinkedList` described below.
Class description:
Implement the DoublyLinkedList class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index i... | 73654b6567fdb282af84a868608929be234075c5 | <|skeleton|>
class DoublyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
<|body_1|>
def addAtHead(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DoublyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
self.head: ListNode2 = None
self.tail: ListNode2 = None
self.size = 0
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invali... | the_stack_v2_python_sparse | LeetCode/0707-Design Linked List/main.py | PRKKILLER/Algorithm_Practice | train | 0 | |
2f8d532beb5cc70f39190ce76123811416b0c7ad | [
"super(BasicSt, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass)\nK_sp = self.get_parameter_from_exponent('K_stochastic_sp', raise_error=False)\nK_ss = self.get_parameter_from_exponent('K_stochastic_ss', raise_error=False)\nlinear_diffusivity = self._length_factor **... | <|body_start_0|>
super(BasicSt, self).__init__(input_file=input_file, params=params, BaselevelHandlerClass=BaselevelHandlerClass)
K_sp = self.get_parameter_from_exponent('K_stochastic_sp', raise_error=False)
K_ss = self.get_parameter_from_exponent('K_stochastic_ss', raise_error=False)
li... | A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node. | BasicSt | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicSt:
"""A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node."""
def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None):
"""Initialize the StochasticDis... | stack_v2_sparse_classes_75kplus_train_006267 | 6,932 | permissive | [
{
"docstring": "Initialize the StochasticDischargeHortonianModel.",
"name": "__init__",
"signature": "def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None)"
},
{
"docstring": "Calculate runoff rate and discharge; return runoff.",
"name": "calc_runoff_and_discharge",
... | 3 | stack_v2_sparse_classes_30k_train_005580 | Implement the Python class `BasicSt` described below.
Class description:
A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node.
Method signatures and docstrings:
- def __init__(self, input_file=None, params=None, ... | Implement the Python class `BasicSt` described below.
Class description:
A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node.
Method signatures and docstrings:
- def __init__(self, input_file=None, params=None, ... | 1b756477b8a8ab6a8f1275b1b30ec84855c840ea | <|skeleton|>
class BasicSt:
"""A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node."""
def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None):
"""Initialize the StochasticDis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicSt:
"""A StochasticHortonianSPModel generates a random sequency of runoff events across a topographic surface, calculating the resulting water discharge at each node."""
def __init__(self, input_file=None, params=None, BaselevelHandlerClass=None):
"""Initialize the StochasticDischargeHortoni... | the_stack_v2_python_sparse | terrainbento/derived_models/model_100_basicSt/model_100_basicSt.py | mcflugen/terrainbento | train | 0 |
a307c239797c47bf2750c7bd72041b5eb5aa3db8 | [
"self.setup(block)\nself.find_head_body_sep()\nself.parse_table()\nstructure = self.structure_from_cells()\nreturn structure",
"for i in range(len(self.block)):\n line = self.block[i]\n if self.head_body_separator_pat.match(line):\n if self.head_body_sep:\n raise TableMarkupError('Multiple... | <|body_start_0|>
self.setup(block)
self.find_head_body_sep()
self.parse_table()
structure = self.structure_from_cells()
return structure
<|end_body_0|>
<|body_start_1|>
for i in range(len(self.block)):
line = self.block[i]
if self.head_body_separa... | Abstract superclass for the common parts of the syntax-specific parsers. | TableParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableParser:
"""Abstract superclass for the common parts of the syntax-specific parsers."""
def parse(self, block):
"""Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list of lines of text; no whitespace padding), parse the tabl... | stack_v2_sparse_classes_75kplus_train_006268 | 21,007 | permissive | [
{
"docstring": "Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list of lines of text; no whitespace padding), parse the table, construct and return the data necessary to construct a CALS table or equivalent. Raise `TableMarkupError` if there is any proble... | 2 | null | Implement the Python class `TableParser` described below.
Class description:
Abstract superclass for the common parts of the syntax-specific parsers.
Method signatures and docstrings:
- def parse(self, block): Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list... | Implement the Python class `TableParser` described below.
Class description:
Abstract superclass for the common parts of the syntax-specific parsers.
Method signatures and docstrings:
- def parse(self, block): Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list... | 05dbd4575d01a213f3f4d69aa4968473f2536142 | <|skeleton|>
class TableParser:
"""Abstract superclass for the common parts of the syntax-specific parsers."""
def parse(self, block):
"""Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list of lines of text; no whitespace padding), parse the tabl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TableParser:
"""Abstract superclass for the common parts of the syntax-specific parsers."""
def parse(self, block):
"""Analyze the text `block` and return a table data structure. Given a plaintext-graphic table in `block` (list of lines of text; no whitespace padding), parse the table, construct ... | the_stack_v2_python_sparse | python/helpers/py2only/docutils/parsers/rst/tableparser.py | JetBrains/intellij-community | train | 16,288 |
a02c32247a0d9f2da06aed8fccdb331651a47970 | [
"self.institution_id = i.canonical_name\nself.realms = pyessv.WCRP.cmip6.get_source_realms(s)\nself.source_id = s.canonical_name\nself.wb = None\nself.ws = None\nself.ws_row = 0\nself.CMIP6_MIP_ERA = _CMIP6_MIP_ERA\nself.VERSION = _VERSION",
"for func in (init_workbook, write_frontis, write_example, write_couplin... | <|body_start_0|>
self.institution_id = i.canonical_name
self.realms = pyessv.WCRP.cmip6.get_source_realms(s)
self.source_id = s.canonical_name
self.wb = None
self.ws = None
self.ws_row = 0
self.CMIP6_MIP_ERA = _CMIP6_MIP_ERA
self.VERSION = _VERSION
<|end_b... | Wraps XLS workbook being generated. | ProcessingContext | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessingContext:
"""Wraps XLS workbook being generated."""
def __init__(self, i, s):
"""Instance constructor."""
<|body_0|>
def write(self):
"""Write workbook."""
<|body_1|>
def create_format(self, font_size=12):
"""Returns a cell formatter... | stack_v2_sparse_classes_75kplus_train_006269 | 2,128 | no_license | [
{
"docstring": "Instance constructor.",
"name": "__init__",
"signature": "def __init__(self, i, s)"
},
{
"docstring": "Write workbook.",
"name": "write",
"signature": "def write(self)"
},
{
"docstring": "Returns a cell formatter.",
"name": "create_format",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_031065 | Implement the Python class `ProcessingContext` described below.
Class description:
Wraps XLS workbook being generated.
Method signatures and docstrings:
- def __init__(self, i, s): Instance constructor.
- def write(self): Write workbook.
- def create_format(self, font_size=12): Returns a cell formatter. | Implement the Python class `ProcessingContext` described below.
Class description:
Wraps XLS workbook being generated.
Method signatures and docstrings:
- def __init__(self, i, s): Instance constructor.
- def write(self): Write workbook.
- def create_format(self, font_size=12): Returns a cell formatter.
<|skeleton|>... | 6a1f09d7f723d1fd2bda5119413fc35e0a351649 | <|skeleton|>
class ProcessingContext:
"""Wraps XLS workbook being generated."""
def __init__(self, i, s):
"""Instance constructor."""
<|body_0|>
def write(self):
"""Write workbook."""
<|body_1|>
def create_format(self, font_size=12):
"""Returns a cell formatter... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProcessingContext:
"""Wraps XLS workbook being generated."""
def __init__(self, i, s):
"""Instance constructor."""
self.institution_id = i.canonical_name
self.realms = pyessv.WCRP.cmip6.get_source_realms(s)
self.source_id = s.canonical_name
self.wb = None
s... | the_stack_v2_python_sparse | lib/models/init_xls_coupling/__main__.py | ES-DOC/cmip6 | train | 0 |
0837d39e8aaf81cf74285a1bee7fa5d2cf536119 | [
"if not num_rows:\n return []\nret = [[1]]\nif num_rows == 1:\n return ret\nret.append([1, 1])\nif num_rows == 2:\n return ret\nfor i in range(3, num_rows + 1):\n row = [1]\n last_row = ret[len(ret) - 1]\n for j in range(1, len(last_row)):\n row.append(last_row[j - 1] + last_row[j])\n ro... | <|body_start_0|>
if not num_rows:
return []
ret = [[1]]
if num_rows == 1:
return ret
ret.append([1, 1])
if num_rows == 2:
return ret
for i in range(3, num_rows + 1):
row = [1]
last_row = ret[len(ret) - 1]
... | PascalsTriangle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PascalsTriangle:
def generate(num_rows):
""":type num_rows: int :rtype: List[List[int]]"""
<|body_0|>
def get_row(row_index):
""":type row_index: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not num_rows:
retu... | stack_v2_sparse_classes_75kplus_train_006270 | 1,130 | permissive | [
{
"docstring": ":type num_rows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(num_rows)"
},
{
"docstring": ":type row_index: int :rtype: List[int]",
"name": "get_row",
"signature": "def get_row(row_index)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030577 | Implement the Python class `PascalsTriangle` described below.
Class description:
Implement the PascalsTriangle class.
Method signatures and docstrings:
- def generate(num_rows): :type num_rows: int :rtype: List[List[int]]
- def get_row(row_index): :type row_index: int :rtype: List[int] | Implement the Python class `PascalsTriangle` described below.
Class description:
Implement the PascalsTriangle class.
Method signatures and docstrings:
- def generate(num_rows): :type num_rows: int :rtype: List[List[int]]
- def get_row(row_index): :type row_index: int :rtype: List[int]
<|skeleton|>
class PascalsTria... | 77838c37e3fdae0f2ec628aa7ddc59f4a5949bbe | <|skeleton|>
class PascalsTriangle:
def generate(num_rows):
""":type num_rows: int :rtype: List[List[int]]"""
<|body_0|>
def get_row(row_index):
""":type row_index: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PascalsTriangle:
def generate(num_rows):
""":type num_rows: int :rtype: List[List[int]]"""
if not num_rows:
return []
ret = [[1]]
if num_rows == 1:
return ret
ret.append([1, 1])
if num_rows == 2:
return ret
for i in ra... | the_stack_v2_python_sparse | Python/dev/arrays/pascals_triangle.py | faisaldialpad/hellouniverse | train | 0 | |
b31dbddd2fb70acb1c19b2dfb5bfb8219b8e90b8 | [
"super().__init__([place1, place2])\nself.place1: str = place1\nself.place2: str = place2",
"if self.place1 not in assignment or self.place2 not in assignment:\n return True\nreturn assignment[self.place1] != assignment[self.place2]"
] | <|body_start_0|>
super().__init__([place1, place2])
self.place1: str = place1
self.place2: str = place2
<|end_body_0|>
<|body_start_1|>
if self.place1 not in assignment or self.place2 not in assignment:
return True
return assignment[self.place1] != assignment[self.pl... | MapColoringConstraint is a subclass of Constraint class. | MapColoringConstraint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MapColoringConstraint:
"""MapColoringConstraint is a subclass of Constraint class."""
def __init__(self, place1: str, place2: str) -> None:
"""Constructor for MapColoringConstraint."""
<|body_0|>
def satisfied(self, assignment: Dict[str, str]) -> bool:
"""Abstrac... | stack_v2_sparse_classes_75kplus_train_006271 | 10,604 | no_license | [
{
"docstring": "Constructor for MapColoringConstraint.",
"name": "__init__",
"signature": "def __init__(self, place1: str, place2: str) -> None"
},
{
"docstring": "Abstract method satisfied in subclass.",
"name": "satisfied",
"signature": "def satisfied(self, assignment: Dict[str, str]) ... | 2 | stack_v2_sparse_classes_30k_train_030307 | Implement the Python class `MapColoringConstraint` described below.
Class description:
MapColoringConstraint is a subclass of Constraint class.
Method signatures and docstrings:
- def __init__(self, place1: str, place2: str) -> None: Constructor for MapColoringConstraint.
- def satisfied(self, assignment: Dict[str, s... | Implement the Python class `MapColoringConstraint` described below.
Class description:
MapColoringConstraint is a subclass of Constraint class.
Method signatures and docstrings:
- def __init__(self, place1: str, place2: str) -> None: Constructor for MapColoringConstraint.
- def satisfied(self, assignment: Dict[str, s... | 892d9c25b9712bf3bbfd7f29529eca8b47fb8039 | <|skeleton|>
class MapColoringConstraint:
"""MapColoringConstraint is a subclass of Constraint class."""
def __init__(self, place1: str, place2: str) -> None:
"""Constructor for MapColoringConstraint."""
<|body_0|>
def satisfied(self, assignment: Dict[str, str]) -> bool:
"""Abstrac... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MapColoringConstraint:
"""MapColoringConstraint is a subclass of Constraint class."""
def __init__(self, place1: str, place2: str) -> None:
"""Constructor for MapColoringConstraint."""
super().__init__([place1, place2])
self.place1: str = place1
self.place2: str = place2
... | the_stack_v2_python_sparse | sem-4/Lab7_15_2/Lab7_GraphColoringProblem_ConstraintSatisfactionAlgorithm.py | B-Tech-AI-Python/Class-assignments | train | 0 |
4e259ee6fffb0952ca1ad12be4caa021224c2e9a | [
"try:\n room = Room.objects.get(id=room_id)\n channel_room, created = ChannelRoom.objects.get_or_create(channel_name=room_channel_name, room=room)\n channel_room.add_participant(user_channel_name, user)\nexcept Exception as e:\n return\nreturn channel_room",
"try:\n channel_room = ChannelRoom.objec... | <|body_start_0|>
try:
room = Room.objects.get(id=room_id)
channel_room, created = ChannelRoom.objects.get_or_create(channel_name=room_channel_name, room=room)
channel_room.add_participant(user_channel_name, user)
except Exception as e:
return
retur... | ChannelRoomManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelRoomManager:
def add(self, room_id, room_channel_name, user_channel_name, user=None):
"""Creates a new room if it doesn't exist, then adds a new channel into the room."""
<|body_0|>
def remove(self, room_channel_name, user_channel_name):
"""Removes a channel (... | stack_v2_sparse_classes_75kplus_train_006272 | 4,527 | permissive | [
{
"docstring": "Creates a new room if it doesn't exist, then adds a new channel into the room.",
"name": "add",
"signature": "def add(self, room_id, room_channel_name, user_channel_name, user=None)"
},
{
"docstring": "Removes a channel (using its channel name) from the room.",
"name": "remov... | 2 | null | Implement the Python class `ChannelRoomManager` described below.
Class description:
Implement the ChannelRoomManager class.
Method signatures and docstrings:
- def add(self, room_id, room_channel_name, user_channel_name, user=None): Creates a new room if it doesn't exist, then adds a new channel into the room.
- def ... | Implement the Python class `ChannelRoomManager` described below.
Class description:
Implement the ChannelRoomManager class.
Method signatures and docstrings:
- def add(self, room_id, room_channel_name, user_channel_name, user=None): Creates a new room if it doesn't exist, then adds a new channel into the room.
- def ... | 6e026f1989b15310ad67c050beb69a168c3bdd5f | <|skeleton|>
class ChannelRoomManager:
def add(self, room_id, room_channel_name, user_channel_name, user=None):
"""Creates a new room if it doesn't exist, then adds a new channel into the room."""
<|body_0|>
def remove(self, room_channel_name, user_channel_name):
"""Removes a channel (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChannelRoomManager:
def add(self, room_id, room_channel_name, user_channel_name, user=None):
"""Creates a new room if it doesn't exist, then adds a new channel into the room."""
try:
room = Room.objects.get(id=room_id)
channel_room, created = ChannelRoom.objects.get_or_... | the_stack_v2_python_sparse | server/websockets/models/channel_room.py | nking1232/html5-msoy | train | 0 | |
896710a50b6a81bb782a3c9852cf7a51dd384abb | [
"self.name = name\nself.bord = []\nfor i in range(0, 4):\n self.bord.append(PuzzleGirafeBord(definition[i * 2:i * 2 + 2]))\nself.orientation = 0\nself.position = position\nself.numero = numero",
"image = pygame.image.load(self.name)\nself.image = pygame.transform.scale(image, (250, 250))\ns = self.image.get_si... | <|body_start_0|>
self.name = name
self.bord = []
for i in range(0, 4):
self.bord.append(PuzzleGirafeBord(definition[i * 2:i * 2 + 2]))
self.orientation = 0
self.position = position
self.numero = numero
<|end_body_0|>
<|body_start_1|>
image = pygame.im... | Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette information va donc bouger au fu... | PuzzleGirafePiece | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PuzzleGirafePiece:
"""Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le p... | stack_v2_sparse_classes_75kplus_train_006273 | 17,048 | permissive | [
{
"docstring": "on définit la pièce @param name nom de l'image représentant la pièce @param definition chaîne de 8 caractères, c'est une suite de 4 x 2 caractères définissant chaque bord, voir la classe bord pour leur signification @param position c'est la position initiale de la pièce, on suppose que l'orienta... | 5 | stack_v2_sparse_classes_30k_train_049895 | Implement the Python class `PuzzleGirafePiece` described below.
Class description:
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est l... | Implement the Python class `PuzzleGirafePiece` described below.
Class description:
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est l... | 2abbc7a20c7437f9ab91d1ec83a6aecdefceb028 | <|skeleton|>
class PuzzleGirafePiece:
"""Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PuzzleGirafePiece:
"""Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette ... | the_stack_v2_python_sparse | src/ensae_teaching_cs/special/puzzle_girafe.py | Pandinosaurus/ensae_teaching_cs | train | 1 |
4eb2547610c4c276c18ce6cfe18ca135b47fcbcb | [
"dxf = super(DXFGraphic, self).load_dxf_attribs(processor)\nif processor:\n processor.simple_dxfattribs_loader(dxf, merged_shape_group_codes)\n if processor.r12:\n elevation_to_z_axis(dxf, ('center',))\nreturn dxf",
"super().export_entity(tagwriter)\nif tagwriter.dxfversion > DXF12:\n tagwriter.wr... | <|body_start_0|>
dxf = super(DXFGraphic, self).load_dxf_attribs(processor)
if processor:
processor.simple_dxfattribs_loader(dxf, merged_shape_group_codes)
if processor.r12:
elevation_to_z_axis(dxf, ('center',))
return dxf
<|end_body_0|>
<|body_start_1|>
... | DXF SHAPE entity | Shape | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Shape:
"""DXF SHAPE entity"""
def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace:
"""Loading interface. (internal API)"""
<|body_0|>
def export_entity(self, tagwriter: AbstractTagWriter) -> None:
"""Export entity specific data... | stack_v2_sparse_classes_75kplus_train_006274 | 4,684 | permissive | [
{
"docstring": "Loading interface. (internal API)",
"name": "load_dxf_attribs",
"signature": "def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace"
},
{
"docstring": "Export entity specific data as DXF tags.",
"name": "export_entity",
"signature": "def ... | 3 | stack_v2_sparse_classes_30k_train_002825 | Implement the Python class `Shape` described below.
Class description:
DXF SHAPE entity
Method signatures and docstrings:
- def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: Loading interface. (internal API)
- def export_entity(self, tagwriter: AbstractTagWriter) -> None: Export... | Implement the Python class `Shape` described below.
Class description:
DXF SHAPE entity
Method signatures and docstrings:
- def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: Loading interface. (internal API)
- def export_entity(self, tagwriter: AbstractTagWriter) -> None: Export... | ba6ab0264dcb6833173042a37b1b5ae878d75113 | <|skeleton|>
class Shape:
"""DXF SHAPE entity"""
def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace:
"""Loading interface. (internal API)"""
<|body_0|>
def export_entity(self, tagwriter: AbstractTagWriter) -> None:
"""Export entity specific data... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Shape:
"""DXF SHAPE entity"""
def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace:
"""Loading interface. (internal API)"""
dxf = super(DXFGraphic, self).load_dxf_attribs(processor)
if processor:
processor.simple_dxfattribs_loader(dxf... | the_stack_v2_python_sparse | src/ezdxf/entities/shape.py | mozman/ezdxf | train | 750 |
a29cfdd56d4ec6a9da8434e8d8d2c447dd39e4f9 | [
"from ..models import FacilityTransaction, DBSession\npayload = convert_request_to_sedm(request, method_value='new')\ncontent = json.dumps(payload)\nr = requests.post(cfg['app.sedm_endpoint'], files={'jsonfile': ('jsonfile', content)})\nif r.status_code == 200:\n request.status = 'submitted'\nelse:\n request.... | <|body_start_0|>
from ..models import FacilityTransaction, DBSession
payload = convert_request_to_sedm(request, method_value='new')
content = json.dumps(payload)
r = requests.post(cfg['app.sedm_endpoint'], files={'jsonfile': ('jsonfile', content)})
if r.status_code == 200:
... | SkyPortal interface to the Spectral Energy Distribution machine (SEDM). | SEDMAPI | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SEDMAPI:
"""SkyPortal interface to the Spectral Energy Distribution machine (SEDM)."""
def submit(request):
"""Submit a follow-up request to SEDM. Parameters ---------- request: skyportal.models.FollowupRequest The request to submit."""
<|body_0|>
def delete(request):
... | stack_v2_sparse_classes_75kplus_train_006275 | 9,576 | permissive | [
{
"docstring": "Submit a follow-up request to SEDM. Parameters ---------- request: skyportal.models.FollowupRequest The request to submit.",
"name": "submit",
"signature": "def submit(request)"
},
{
"docstring": "Delete a follow-up request from SEDM queue. Parameters ---------- request: skyporta... | 3 | stack_v2_sparse_classes_30k_train_012716 | Implement the Python class `SEDMAPI` described below.
Class description:
SkyPortal interface to the Spectral Energy Distribution machine (SEDM).
Method signatures and docstrings:
- def submit(request): Submit a follow-up request to SEDM. Parameters ---------- request: skyportal.models.FollowupRequest The request to s... | Implement the Python class `SEDMAPI` described below.
Class description:
SkyPortal interface to the Spectral Energy Distribution machine (SEDM).
Method signatures and docstrings:
- def submit(request): Submit a follow-up request to SEDM. Parameters ---------- request: skyportal.models.FollowupRequest The request to s... | 2433d5ae0b2f41faac3c76ed4ae8d9a4da5522fb | <|skeleton|>
class SEDMAPI:
"""SkyPortal interface to the Spectral Energy Distribution machine (SEDM)."""
def submit(request):
"""Submit a follow-up request to SEDM. Parameters ---------- request: skyportal.models.FollowupRequest The request to submit."""
<|body_0|>
def delete(request):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SEDMAPI:
"""SkyPortal interface to the Spectral Energy Distribution machine (SEDM)."""
def submit(request):
"""Submit a follow-up request to SEDM. Parameters ---------- request: skyportal.models.FollowupRequest The request to submit."""
from ..models import FacilityTransaction, DBSession
... | the_stack_v2_python_sparse | skyportal/facility_apis/sedm.py | dmitryduev/skyportal | train | 1 |
4ee9b97a2e29075cfaa31b686d2a8023f7b47dbd | [
"if not head or not head.next:\n return head\ncur = head.next\nlast = head\nwhile cur:\n t = head\n last_t = None\n while t.val < cur.val:\n last_t = t\n t = t.next\n if cur == t:\n last = cur\n cur = cur.next\n else:\n last.next = cur.next\n if last_t:\n ... | <|body_start_0|>
if not head or not head.next:
return head
cur = head.next
last = head
while cur:
t = head
last_t = None
while t.val < cur.val:
last_t = t
t = t.next
if cur == t:
l... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insertionSortList(self, head: ListNode) -> ListNode:
"""链表插入排序"""
<|body_0|>
def insertionSortList2(self, head: ListNode) -> ListNode:
"""链表插入排序 优化后"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head or not head.next:
... | stack_v2_sparse_classes_75kplus_train_006276 | 2,451 | no_license | [
{
"docstring": "链表插入排序",
"name": "insertionSortList",
"signature": "def insertionSortList(self, head: ListNode) -> ListNode"
},
{
"docstring": "链表插入排序 优化后",
"name": "insertionSortList2",
"signature": "def insertionSortList2(self, head: ListNode) -> ListNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_033413 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insertionSortList(self, head: ListNode) -> ListNode: 链表插入排序
- def insertionSortList2(self, head: ListNode) -> ListNode: 链表插入排序 优化后 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insertionSortList(self, head: ListNode) -> ListNode: 链表插入排序
- def insertionSortList2(self, head: ListNode) -> ListNode: 链表插入排序 优化后
<|skeleton|>
class Solution:
def inse... | 7f8145f0c7ffdf18c557f01d221087b10443156e | <|skeleton|>
class Solution:
def insertionSortList(self, head: ListNode) -> ListNode:
"""链表插入排序"""
<|body_0|>
def insertionSortList2(self, head: ListNode) -> ListNode:
"""链表插入排序 优化后"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def insertionSortList(self, head: ListNode) -> ListNode:
"""链表插入排序"""
if not head or not head.next:
return head
cur = head.next
last = head
while cur:
t = head
last_t = None
while t.val < cur.val:
... | the_stack_v2_python_sparse | linked_list/147 Insertion Sort List.py | mofei952/leetcode_python | train | 0 | |
3976baac7609934ca36b3b5f54a369e4afa2c87e | [
"def register(cls: Type) -> Type:\n register_artifact(cls, artifact_name, save_attribute, restore_attribute)\n return cls\nreturn register",
"def deregister(cls: Type) -> Type:\n deregister_artifact(cls, artifact_name)\n return cls\nreturn deregister"
] | <|body_start_0|>
def register(cls: Type) -> Type:
register_artifact(cls, artifact_name, save_attribute, restore_attribute)
return cls
return register
<|end_body_0|>
<|body_start_1|>
def deregister(cls: Type) -> Type:
deregister_artifact(cls, artifact_name)
... | Decorators for artifact de/registration Expected to be applied at the class level to add class attributes indicating registered artifacts | ExternalArtifactDecorators | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternalArtifactDecorators:
"""Decorators for artifact de/registration Expected to be applied at the class level to add class attributes indicating registered artifacts"""
def register_artifact(artifact_name: str, save_attribute: str, restore_attribute: str) -> Callable:
"""Class lev... | stack_v2_sparse_classes_75kplus_train_006277 | 9,988 | permissive | [
{
"docstring": "Class level decorator to define artifacts produced. Expects each class to implement as many as needed to accomodate. Format: ``` @register_artifact(artifact_name='model', save_attribute='wrapper_attribute', restore_attribute='_internal_attribute') class NewPersistable(Persistable): @property def... | 2 | null | Implement the Python class `ExternalArtifactDecorators` described below.
Class description:
Decorators for artifact de/registration Expected to be applied at the class level to add class attributes indicating registered artifacts
Method signatures and docstrings:
- def register_artifact(artifact_name: str, save_attri... | Implement the Python class `ExternalArtifactDecorators` described below.
Class description:
Decorators for artifact de/registration Expected to be applied at the class level to add class attributes indicating registered artifacts
Method signatures and docstrings:
- def register_artifact(artifact_name: str, save_attri... | c7cdf1fa90b373025da48aa85bf9f0d3792ce494 | <|skeleton|>
class ExternalArtifactDecorators:
"""Decorators for artifact de/registration Expected to be applied at the class level to add class attributes indicating registered artifacts"""
def register_artifact(artifact_name: str, save_attribute: str, restore_attribute: str) -> Callable:
"""Class lev... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExternalArtifactDecorators:
"""Decorators for artifact de/registration Expected to be applied at the class level to add class attributes indicating registered artifacts"""
def register_artifact(artifact_name: str, save_attribute: str, restore_attribute: str) -> Callable:
"""Class level decorator ... | the_stack_v2_python_sparse | simpleml/save_patterns/decorators.py | eyadgaran/SimpleML | train | 15 |
363f7b59cac77687408c461ecec1b9e88527a121 | [
"self.zdim = total_latent_dim\nself.ddim = sum(num_classes)\nself.num_classes = num_classes\nself.dnum = len(num_classes)\nself.cdim = num_con_var\nself.cnum = num_con_var\nself.udim = self.zdim - self.ddim - self.cdim\nif self.udim <= 0:\n raise AttributeError('Total dimension of latent: {} is too small'.format... | <|body_start_0|>
self.zdim = total_latent_dim
self.ddim = sum(num_classes)
self.num_classes = num_classes
self.dnum = len(num_classes)
self.cdim = num_con_var
self.cnum = num_con_var
self.udim = self.zdim - self.ddim - self.cdim
if self.udim <= 0:
... | Noise Generator for the input of InfoGAN | NoiseGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NoiseGenerator:
"""Noise Generator for the input of InfoGAN"""
def __init__(self, total_latent_dim: int, num_classes: list, num_con_var: int, device=None):
""":params: total_latent_dim - total dim of all latent varibles. num_classes - number of class of each discrete variables. num_c... | stack_v2_sparse_classes_75kplus_train_006278 | 9,098 | no_license | [
{
"docstring": ":params: total_latent_dim - total dim of all latent varibles. num_classes - number of class of each discrete variables. num_con_var - number of continuous variables.",
"name": "__init__",
"signature": "def __init__(self, total_latent_dim: int, num_classes: list, num_con_var: int, device=... | 5 | stack_v2_sparse_classes_30k_train_045331 | Implement the Python class `NoiseGenerator` described below.
Class description:
Noise Generator for the input of InfoGAN
Method signatures and docstrings:
- def __init__(self, total_latent_dim: int, num_classes: list, num_con_var: int, device=None): :params: total_latent_dim - total dim of all latent varibles. num_cl... | Implement the Python class `NoiseGenerator` described below.
Class description:
Noise Generator for the input of InfoGAN
Method signatures and docstrings:
- def __init__(self, total_latent_dim: int, num_classes: list, num_con_var: int, device=None): :params: total_latent_dim - total dim of all latent varibles. num_cl... | a46c62779673e823225a5dfc37b0f855f72da79b | <|skeleton|>
class NoiseGenerator:
"""Noise Generator for the input of InfoGAN"""
def __init__(self, total_latent_dim: int, num_classes: list, num_con_var: int, device=None):
""":params: total_latent_dim - total dim of all latent varibles. num_classes - number of class of each discrete variables. num_c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NoiseGenerator:
"""Noise Generator for the input of InfoGAN"""
def __init__(self, total_latent_dim: int, num_classes: list, num_con_var: int, device=None):
""":params: total_latent_dim - total dim of all latent varibles. num_classes - number of class of each discrete variables. num_con_var - numb... | the_stack_v2_python_sparse | info_utils.py | MercuriXito/implement-infogan-pytorch | train | 1 |
e9d5f911db466574d83bbbdff41d017b178f8281 | [
"if not isinstance(zoom_range, (list, tuple)) or len(zoom_range) != 2:\n raise ValueError('zoom_range argument must be list/tuple with two values!')\nself.zoom_range = zoom_range\nself.reference = reference\nself.lazy = lazy",
"zoom_x = np.exp(random.gauss(np.log(self.zoom_range[0]), np.log(self.zoom_range[1])... | <|body_start_0|>
if not isinstance(zoom_range, (list, tuple)) or len(zoom_range) != 2:
raise ValueError('zoom_range argument must be list/tuple with two values!')
self.zoom_range = zoom_range
self.reference = reference
self.lazy = lazy
<|end_body_0|>
<|body_start_1|>
... | Apply a Zoom2D transform to an image, but with the zoom parameters randomly generated from a user-specified range. The range is determined by a mean (first parameter) and standard deviation (second parameter) via calls to random.gauss. | RandomZoom2D | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomZoom2D:
"""Apply a Zoom2D transform to an image, but with the zoom parameters randomly generated from a user-specified range. The range is determined by a mean (first parameter) and standard deviation (second parameter) via calls to random.gauss."""
def __init__(self, zoom_range, refer... | stack_v2_sparse_classes_75kplus_train_006279 | 21,674 | permissive | [
{
"docstring": "Initialize a RandomZoom2D object Arguments --------- zoom_range : list or tuple Lower and Upper bounds on zoom parameter. e.g. zoom_range = (0.7,0.9) will result in a random draw of the zoom parameters between 0.7 and 0.9 reference : ANTsImage (optional but recommended) image providing the refer... | 2 | stack_v2_sparse_classes_30k_train_000119 | Implement the Python class `RandomZoom2D` described below.
Class description:
Apply a Zoom2D transform to an image, but with the zoom parameters randomly generated from a user-specified range. The range is determined by a mean (first parameter) and standard deviation (second parameter) via calls to random.gauss.
Meth... | Implement the Python class `RandomZoom2D` described below.
Class description:
Apply a Zoom2D transform to an image, but with the zoom parameters randomly generated from a user-specified range. The range is determined by a mean (first parameter) and standard deviation (second parameter) via calls to random.gauss.
Meth... | 41f2dd3fcf72654f284dac1a9448033e963f0afb | <|skeleton|>
class RandomZoom2D:
"""Apply a Zoom2D transform to an image, but with the zoom parameters randomly generated from a user-specified range. The range is determined by a mean (first parameter) and standard deviation (second parameter) via calls to random.gauss."""
def __init__(self, zoom_range, refer... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomZoom2D:
"""Apply a Zoom2D transform to an image, but with the zoom parameters randomly generated from a user-specified range. The range is determined by a mean (first parameter) and standard deviation (second parameter) via calls to random.gauss."""
def __init__(self, zoom_range, reference=None, la... | the_stack_v2_python_sparse | ants/contrib/sampling/affine2d.py | ANTsX/ANTsPy | train | 483 |
a0f4cd9f4e432148002ac1deed7828a87d509312 | [
"self.dt = 1.0 / 365\nself.S_0_1 = 100.0\nself.S_0_2 = 110.0\nself.gamma_0 = 0.0\nself.sigma_1 = 0.2\nself.sigma_2 = 0.15\nself.sigma_gamma = 0.2\nself.theta = 0.15\nself.rho = 0.8\nself.drift_1 = -0.5 * self.sigma_1 * self.sigma_1 * self.dt\nself.drift_2 = -0.5 * self.sigma_2 * self.sigma_2 * self.dt\nself.drift_g... | <|body_start_0|>
self.dt = 1.0 / 365
self.S_0_1 = 100.0
self.S_0_2 = 110.0
self.gamma_0 = 0.0
self.sigma_1 = 0.2
self.sigma_2 = 0.15
self.sigma_gamma = 0.2
self.theta = 0.15
self.rho = 0.8
self.drift_1 = -0.5 * self.sigma_1 * self.sigma_1 *... | Class that simulates the paths for two risky assets with a mean-reverting spread process. | CointegratedSeriesGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CointegratedSeriesGenerator:
"""Class that simulates the paths for two risky assets with a mean-reverting spread process."""
def __init__(self):
"""Constructor."""
<|body_0|>
def run(self, n_steps):
"""Simulate the model. Parameters ---------- n_steps: int Number... | stack_v2_sparse_classes_75kplus_train_006280 | 4,905 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Simulate the model. Parameters ---------- n_steps: int Number of steps to simulate",
"name": "run",
"signature": "def run(self, n_steps)"
},
{
"docstring": "Dumps data in .csv ... | 3 | stack_v2_sparse_classes_30k_train_043217 | Implement the Python class `CointegratedSeriesGenerator` described below.
Class description:
Class that simulates the paths for two risky assets with a mean-reverting spread process.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def run(self, n_steps): Simulate the model. Parameters ---------... | Implement the Python class `CointegratedSeriesGenerator` described below.
Class description:
Class that simulates the paths for two risky assets with a mean-reverting spread process.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def run(self, n_steps): Simulate the model. Parameters ---------... | 1a3ae97023acff1ee5e2d197a446734117a6fb99 | <|skeleton|>
class CointegratedSeriesGenerator:
"""Class that simulates the paths for two risky assets with a mean-reverting spread process."""
def __init__(self):
"""Constructor."""
<|body_0|>
def run(self, n_steps):
"""Simulate the model. Parameters ---------- n_steps: int Number... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CointegratedSeriesGenerator:
"""Class that simulates the paths for two risky assets with a mean-reverting spread process."""
def __init__(self):
"""Constructor."""
self.dt = 1.0 / 365
self.S_0_1 = 100.0
self.S_0_2 = 110.0
self.gamma_0 = 0.0
self.sigma_1 = 0... | the_stack_v2_python_sparse | Code/Preprocessing/generate_cointegrated_series.py | fdoperezi/Thesis | train | 0 |
b5a33f6450019fff4535086ce66fb17a23707776 | [
"context = context or {}\nids = isinstance(ids, (int, long)) and [ids] or ids\ncr_date = time.strftime('%Y-%m-%d')\nsp_brw = self.browse(cur, uid, ids[0], context=context)\nif not sp_brw.date_contract_expiry or (sp_brw.date_contract_expiry and cr_date <= sp_brw.date_contract_expiry) or context.get('force_expiry_pic... | <|body_start_0|>
context = context or {}
ids = isinstance(ids, (int, long)) and [ids] or ids
cr_date = time.strftime('%Y-%m-%d')
sp_brw = self.browse(cur, uid, ids[0], context=context)
if not sp_brw.date_contract_expiry or (sp_brw.date_contract_expiry and cr_date <= sp_brw.date_c... | StockPickingIn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StockPickingIn:
def action_process(self, cur, uid, ids, context=None):
"""overwrite the method to add a verification of the contract due date before process the stock picking in."""
<|body_0|>
def copy(self, default=None):
"""Ovwerwrite the copy method to also copy t... | stack_v2_sparse_classes_75kplus_train_006281 | 5,912 | no_license | [
{
"docstring": "overwrite the method to add a verification of the contract due date before process the stock picking in.",
"name": "action_process",
"signature": "def action_process(self, cur, uid, ids, context=None)"
},
{
"docstring": "Ovwerwrite the copy method to also copy the date_contract_e... | 2 | stack_v2_sparse_classes_30k_train_046909 | Implement the Python class `StockPickingIn` described below.
Class description:
Implement the StockPickingIn class.
Method signatures and docstrings:
- def action_process(self, cur, uid, ids, context=None): overwrite the method to add a verification of the contract due date before process the stock picking in.
- def ... | Implement the Python class `StockPickingIn` described below.
Class description:
Implement the StockPickingIn class.
Method signatures and docstrings:
- def action_process(self, cur, uid, ids, context=None): overwrite the method to add a verification of the contract due date before process the stock picking in.
- def ... | 511dc410b4eba1f8ea939c6af02a5adea5122c92 | <|skeleton|>
class StockPickingIn:
def action_process(self, cur, uid, ids, context=None):
"""overwrite the method to add a verification of the contract due date before process the stock picking in."""
<|body_0|>
def copy(self, default=None):
"""Ovwerwrite the copy method to also copy t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StockPickingIn:
def action_process(self, cur, uid, ids, context=None):
"""overwrite the method to add a verification of the contract due date before process the stock picking in."""
context = context or {}
ids = isinstance(ids, (int, long)) and [ids] or ids
cr_date = time.strft... | the_stack_v2_python_sparse | stock_purchase_expiry/model/stock.py | yelizariev/addons-vauxoo | train | 3 | |
151a93b239d0bd93215459959940373cc00857e7 | [
"self.pool = threads\nfor thread in threads:\n thread.start()",
"for pool in self.pool:\n if pool.running:\n return False\nreturn True"
] | <|body_start_0|>
self.pool = threads
for thread in threads:
thread.start()
<|end_body_0|>
<|body_start_1|>
for pool in self.pool:
if pool.running:
return False
return True
<|end_body_1|>
| Kernel class | WSKernel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WSKernel:
"""Kernel class"""
def create_threads(self, threads):
"""Run threads from list, put it in pool"""
<|body_0|>
def finished(self):
"""Is all threads are finished?"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.pool = threads
... | stack_v2_sparse_classes_75kplus_train_006282 | 711 | permissive | [
{
"docstring": "Run threads from list, put it in pool",
"name": "create_threads",
"signature": "def create_threads(self, threads)"
},
{
"docstring": "Is all threads are finished?",
"name": "finished",
"signature": "def finished(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_042831 | Implement the Python class `WSKernel` described below.
Class description:
Kernel class
Method signatures and docstrings:
- def create_threads(self, threads): Run threads from list, put it in pool
- def finished(self): Is all threads are finished? | Implement the Python class `WSKernel` described below.
Class description:
Kernel class
Method signatures and docstrings:
- def create_threads(self, threads): Run threads from list, put it in pool
- def finished(self): Is all threads are finished?
<|skeleton|>
class WSKernel:
"""Kernel class"""
def create_th... | 846bca01dbf6cf5aa6fb6a7141b2ae3d9b4a4640 | <|skeleton|>
class WSKernel:
"""Kernel class"""
def create_threads(self, threads):
"""Run threads from list, put it in pool"""
<|body_0|>
def finished(self):
"""Is all threads are finished?"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WSKernel:
"""Kernel class"""
def create_threads(self, threads):
"""Run threads from list, put it in pool"""
self.pool = threads
for thread in threads:
thread.start()
def finished(self):
"""Is all threads are finished?"""
for pool in self.pool:
... | the_stack_v2_python_sparse | classes/kernel/WSKernel.py | hack4sec/ws-cli | train | 10 |
17a22380f1674677946d62d89f3e37008ccf5b01 | [
"if len(arg) > 0:\n try:\n raw = html.fromstring(arg)\n except ValueError:\n raw = html.fromstring(arg.encode('utf-8'))\n return raw.text_content().strip()\nreturn arg",
"arg = re.sub(re_newline_spc, '', arg)\narg = re.sub(re_starting_whitespc, '', arg)\narg = re.sub(re_multi_spc_tab, '', a... | <|body_start_0|>
if len(arg) > 0:
try:
raw = html.fromstring(arg)
except ValueError:
raw = html.fromstring(arg.encode('utf-8'))
return raw.text_content().strip()
return arg
<|end_body_0|>
<|body_start_1|>
arg = re.sub(re_newlin... | The Cleaner-Class tries to get the raw extracted text of the extractors in a comparable format. For this it deletes unnecessary whitespaces or in case of readability html-tags which are still in the extracted text. | Cleaner | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cleaner:
"""The Cleaner-Class tries to get the raw extracted text of the extractors in a comparable format. For this it deletes unnecessary whitespaces or in case of readability html-tags which are still in the extracted text."""
def delete_tags(self, arg):
"""Removes html-tags from ... | stack_v2_sparse_classes_75kplus_train_006283 | 3,909 | permissive | [
{
"docstring": "Removes html-tags from extracted data. :param arg: A string, the string which shall be cleaned :return: A string, the cleaned string",
"name": "delete_tags",
"signature": "def delete_tags(self, arg)"
},
{
"docstring": "Removes newlines, tabs and whitespaces at the beginning, the ... | 4 | stack_v2_sparse_classes_30k_train_038706 | Implement the Python class `Cleaner` described below.
Class description:
The Cleaner-Class tries to get the raw extracted text of the extractors in a comparable format. For this it deletes unnecessary whitespaces or in case of readability html-tags which are still in the extracted text.
Method signatures and docstrin... | Implement the Python class `Cleaner` described below.
Class description:
The Cleaner-Class tries to get the raw extracted text of the extractors in a comparable format. For this it deletes unnecessary whitespaces or in case of readability html-tags which are still in the extracted text.
Method signatures and docstrin... | aac84065a1eea3cccd8859b9ba0915615a196c54 | <|skeleton|>
class Cleaner:
"""The Cleaner-Class tries to get the raw extracted text of the extractors in a comparable format. For this it deletes unnecessary whitespaces or in case of readability html-tags which are still in the extracted text."""
def delete_tags(self, arg):
"""Removes html-tags from ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Cleaner:
"""The Cleaner-Class tries to get the raw extracted text of the extractors in a comparable format. For this it deletes unnecessary whitespaces or in case of readability html-tags which are still in the extracted text."""
def delete_tags(self, arg):
"""Removes html-tags from extracted dat... | the_stack_v2_python_sparse | newsplease/pipeline/extractor/cleaner.py | fhamborg/news-please | train | 1,785 |
1d848125e7afea63d8e297613be7da742c858e1f | [
"try:\n self.tickers.pop(ticker, None)\n self.tickers_data.pop(ticker, None)\nexcept KeyError:\n print('Could not unsubscribe ticker {0} as it was never subscribed'.format(ticker))",
"if ticker in self.tickers:\n timestamp = self.tickers[ticker]['timestamp']\n return timestamp\nelse:\n print('Ti... | <|body_start_0|>
try:
self.tickers.pop(ticker, None)
self.tickers_data.pop(ticker, None)
except KeyError:
print('Could not unsubscribe ticker {0} as it was never subscribed'.format(ticker))
<|end_body_0|>
<|body_start_1|>
if ticker in self.tickers:
... | PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event queue. This will replicate how a live strategy w... | AbstractPriceHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbstractPriceHandler:
"""PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event ... | stack_v2_sparse_classes_75kplus_train_006284 | 2,436 | no_license | [
{
"docstring": "Unsubscribes the price handler from a current ticker symbol :param ticker: The ticker to unsubscribe :return:",
"name": "unsubscribe_ticker",
"signature": "def unsubscribe_ticker(self, ticker)"
},
{
"docstring": "Returns the most recent actual timestamp for a given ticker :param ... | 2 | stack_v2_sparse_classes_30k_train_009333 | Implement the Python class `AbstractPriceHandler` described below.
Class description:
PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial i... | Implement the Python class `AbstractPriceHandler` described below.
Class description:
PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial i... | 1dffb983ba3374f5f3a018e2b7d909bf5546947d | <|skeleton|>
class AbstractPriceHandler:
"""PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AbstractPriceHandler:
"""PriceHandler is a base class providing an interface for all subsequent (inherited) data handlers (both live and historic). The goal of a (derived) PriceHandler object is to output a set of TickEvents or BarEvents for each financial instrument and place them into an event queue. This w... | the_stack_v2_python_sparse | price_handler_base.py | TheGiddy/Backtester | train | 0 |
d9cc48bb471dff3af59fef3a4f854ef0ea273374 | [
"self.assertRaises(IndexError, self.c.remove, 1)\n' Disallow removal of negative indices '\nself.assertRaises(IndexError, self.c.remove, -1)",
"self.assertRaises(ValueError, self.c.update_lines, {'a': 0, 'b': 0})\n' Must not allow replacement of lines with a larger set of lines '\nself.assertRaises(ValueError, se... | <|body_start_0|>
self.assertRaises(IndexError, self.c.remove, 1)
' Disallow removal of negative indices '
self.assertRaises(IndexError, self.c.remove, -1)
<|end_body_0|>
<|body_start_1|>
self.assertRaises(ValueError, self.c.update_lines, {'a': 0, 'b': 0})
' Must not allow replac... | CascadeSanity | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CascadeSanity:
def test_remove_sanity(self):
"""Cascades must not allow removal of gate indices that don't exist"""
<|body_0|>
def test_update_lines_sanity(self):
"""Must not allow replacement of lines with a set of lines that is smaller"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus_train_006285 | 7,951 | no_license | [
{
"docstring": "Cascades must not allow removal of gate indices that don't exist",
"name": "test_remove_sanity",
"signature": "def test_remove_sanity(self)"
},
{
"docstring": "Must not allow replacement of lines with a set of lines that is smaller",
"name": "test_update_lines_sanity",
"s... | 2 | stack_v2_sparse_classes_30k_train_028158 | Implement the Python class `CascadeSanity` described below.
Class description:
Implement the CascadeSanity class.
Method signatures and docstrings:
- def test_remove_sanity(self): Cascades must not allow removal of gate indices that don't exist
- def test_update_lines_sanity(self): Must not allow replacement of lines... | Implement the Python class `CascadeSanity` described below.
Class description:
Implement the CascadeSanity class.
Method signatures and docstrings:
- def test_remove_sanity(self): Cascades must not allow removal of gate indices that don't exist
- def test_update_lines_sanity(self): Must not allow replacement of lines... | 905eac3318f767575f89c336ccff549c8a091598 | <|skeleton|>
class CascadeSanity:
def test_remove_sanity(self):
"""Cascades must not allow removal of gate indices that don't exist"""
<|body_0|>
def test_update_lines_sanity(self):
"""Must not allow replacement of lines with a set of lines that is smaller"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CascadeSanity:
def test_remove_sanity(self):
"""Cascades must not allow removal of gate indices that don't exist"""
self.assertRaises(IndexError, self.c.remove, 1)
' Disallow removal of negative indices '
self.assertRaises(IndexError, self.c.remove, -1)
def test_update_lin... | the_stack_v2_python_sparse | revsim/unit.py | RevLogic/GA | train | 0 | |
7e77f1cbfb1639cba06a89f78ff23e53aa646b68 | [
"def square(x):\n return x * x\nmt = MemoTable(square)\nself.assertEqual(mt[2], 4)\nself.assertEqual(mt[2], 4)\nself.assertEqual(mt[4], 16)\nself.assertEqual(mt[4], 16)",
"def slow_square(x):\n answer = 0.0\n for _ in xrange(x):\n answer += x\n return answer\nmt = MemoTable(slow_square)\nNUM_CO... | <|body_start_0|>
def square(x):
return x * x
mt = MemoTable(square)
self.assertEqual(mt[2], 4)
self.assertEqual(mt[2], 4)
self.assertEqual(mt[4], 16)
self.assertEqual(mt[4], 16)
<|end_body_0|>
<|body_start_1|>
def slow_square(x):
answer = ... | MemoTableTest | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MemoTableTest:
def test_values_correct(self):
"""Create a function that computes the square of its argument. Then wrap a memo-table around that and make sure we get the correct values for things."""
<|body_0|>
def test_memo_faster(self):
"""Bascially the same test as... | stack_v2_sparse_classes_75kplus_train_006286 | 5,159 | permissive | [
{
"docstring": "Create a function that computes the square of its argument. Then wrap a memo-table around that and make sure we get the correct values for things.",
"name": "test_values_correct",
"signature": "def test_values_correct(self)"
},
{
"docstring": "Bascially the same test as above but... | 4 | stack_v2_sparse_classes_30k_test_001572 | Implement the Python class `MemoTableTest` described below.
Class description:
Implement the MemoTableTest class.
Method signatures and docstrings:
- def test_values_correct(self): Create a function that computes the square of its argument. Then wrap a memo-table around that and make sure we get the correct values fo... | Implement the Python class `MemoTableTest` described below.
Class description:
Implement the MemoTableTest class.
Method signatures and docstrings:
- def test_values_correct(self): Create a function that computes the square of its argument. Then wrap a memo-table around that and make sure we get the correct values fo... | 264459a8fa1480c7b65d946f88d94af1a038fbf1 | <|skeleton|>
class MemoTableTest:
def test_values_correct(self):
"""Create a function that computes the square of its argument. Then wrap a memo-table around that and make sure we get the correct values for things."""
<|body_0|>
def test_memo_faster(self):
"""Bascially the same test as... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MemoTableTest:
def test_values_correct(self):
"""Create a function that computes the square of its argument. Then wrap a memo-table around that and make sure we get the correct values for things."""
def square(x):
return x * x
mt = MemoTable(square)
self.assertEqual... | the_stack_v2_python_sparse | hetest/python/common/memo_table_test.py | y4n9squared/HEtest | train | 7 | |
f9faf8d9e35ba63d6993c46c1abaf4a0e42504a7 | [
"Parametre.__init__(self, 'lever', 'weigh')\nself.aide_courte = \"lève l'ancre présente\"\nself.aide_longue = \"Cette commande lève l'ancre présente dans la salle où vous vous trouvez. Pour certaines ancres plus lourdes, vous aurez besoin de faire cette manoeuvre à plusieurs. Les autres pourront peser sur le cabest... | <|body_start_0|>
Parametre.__init__(self, 'lever', 'weigh')
self.aide_courte = "lève l'ancre présente"
self.aide_longue = "Cette commande lève l'ancre présente dans la salle où vous vous trouvez. Pour certaines ancres plus lourdes, vous aurez besoin de faire cette manoeuvre à plusieurs. Les autr... | Commande 'ancre lever'. | PrmLever | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmLever:
"""Commande 'ancre lever'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametre.__ini... | stack_v2_sparse_classes_75kplus_train_006287 | 3,946 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053656 | Implement the Python class `PrmLever` described below.
Class description:
Commande 'ancre lever'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmLever` described below.
Class description:
Commande 'ancre lever'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmLever:
"""Commande 'ancre lever'.... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmLever:
"""Commande 'ancre lever'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrmLever:
"""Commande 'ancre lever'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'lever', 'weigh')
self.aide_courte = "lève l'ancre présente"
self.aide_longue = "Cette commande lève l'ancre présente dans la salle où vous vous trouvez. Po... | the_stack_v2_python_sparse | src/secondaires/navigation/commandes/ancre/lever.py | vincent-lg/tsunami | train | 5 |
266975eaa82ab25e3dab6674ae9c520456f8ae8f | [
"content_pk_copy = np.array(content_pk)\npk_copy = np.concatenate((np.array([-1]), pk))\nif isinstance(ignore_mask, np.ndarray):\n content_pk_copy[ignore_mask] = -1\ncontent_pk_copy[np.invert(np.isin(content_pk_copy, pk))] = -1\nsort_idx = np.argsort(pk_copy)\nself._indices = sort_idx[np.searchsorted(pk_copy, co... | <|body_start_0|>
content_pk_copy = np.array(content_pk)
pk_copy = np.concatenate((np.array([-1]), pk))
if isinstance(ignore_mask, np.ndarray):
content_pk_copy[ignore_mask] = -1
content_pk_copy[np.invert(np.isin(content_pk_copy, pk))] = -1
sort_idx = np.argsort(pk_copy... | Solves the following situation: content_pk[pk[i]] == to_map[i] Having two array's of the same length, with corresponding values: pk = [1, 2, 3, 4, 5, 6] to_map = [1.1, 2.1, 3.1, 4.1, 5.1, 6.1] And an array with with (unsorted) numbers that might match values in pk: content_pk = [0, 0, 15, 3, 4, 0, 0, 1, 1, 15] PKMapper... | PKMapper | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PKMapper:
"""Solves the following situation: content_pk[pk[i]] == to_map[i] Having two array's of the same length, with corresponding values: pk = [1, 2, 3, 4, 5, 6] to_map = [1.1, 2.1, 3.1, 4.1, 5.1, 6.1] And an array with with (unsorted) numbers that might match values in pk: content_pk = [0, 0... | stack_v2_sparse_classes_75kplus_train_006288 | 7,474 | permissive | [
{
"docstring": ":param pk: np.ndarray with pk values :param content_pk: np.ndarray with pk values to map to :param ignore_mask: boolean np.ndarray, when True the value of content_pk is ignored.",
"name": "__init__",
"signature": "def __init__(self, pk, content_pk, ignore_mask=None)"
},
{
"docstr... | 2 | stack_v2_sparse_classes_30k_train_004328 | Implement the Python class `PKMapper` described below.
Class description:
Solves the following situation: content_pk[pk[i]] == to_map[i] Having two array's of the same length, with corresponding values: pk = [1, 2, 3, 4, 5, 6] to_map = [1.1, 2.1, 3.1, 4.1, 5.1, 6.1] And an array with with (unsorted) numbers that might... | Implement the Python class `PKMapper` described below.
Class description:
Solves the following situation: content_pk[pk[i]] == to_map[i] Having two array's of the same length, with corresponding values: pk = [1, 2, 3, 4, 5, 6] to_map = [1.1, 2.1, 3.1, 4.1, 5.1, 6.1] And an array with with (unsorted) numbers that might... | 6a75d161162f81ac184cef361b3fb700cd2f05ae | <|skeleton|>
class PKMapper:
"""Solves the following situation: content_pk[pk[i]] == to_map[i] Having two array's of the same length, with corresponding values: pk = [1, 2, 3, 4, 5, 6] to_map = [1.1, 2.1, 3.1, 4.1, 5.1, 6.1] And an array with with (unsorted) numbers that might match values in pk: content_pk = [0, 0... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PKMapper:
"""Solves the following situation: content_pk[pk[i]] == to_map[i] Having two array's of the same length, with corresponding values: pk = [1, 2, 3, 4, 5, 6] to_map = [1.1, 2.1, 3.1, 4.1, 5.1, 6.1] And an array with with (unsorted) numbers that might match values in pk: content_pk = [0, 0, 15, 3, 4, 0... | the_stack_v2_python_sparse | threedigrid/admin/utils.py | nens/threedigrid | train | 6 |
f612d9de6520e811538ca6a8c3196fb44c807788 | [
"assert da.getDim() == 1\nself.da = da\nself.params = params\nself.factor = factor\nself.dx = dx\nself.localX = da.createLocalVec()\nself.xs, self.xe = self.da.getRanges()[0]\nself.mx = self.da.getSizes()[0]\nself.row = PETSc.Mat.Stencil()\nself.col = PETSc.Mat.Stencil()",
"self.da.globalToLocal(X, self.localX)\n... | <|body_start_0|>
assert da.getDim() == 1
self.da = da
self.params = params
self.factor = factor
self.dx = dx
self.localX = da.createLocalVec()
self.xs, self.xe = self.da.getRanges()[0]
self.mx = self.da.getSizes()[0]
self.row = PETSc.Mat.Stencil()
... | Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES | Fisher_full | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, params, factor, dx):
"""Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x dire... | stack_v2_sparse_classes_75kplus_train_006289 | 18,877 | permissive | [
{
"docstring": "Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x direction",
"name": "__init__",
"signature": "def __init__(self, da, params, factor, dx)"
},
{
"docstring": "Function to evaluate the residual for the New... | 3 | stack_v2_sparse_classes_30k_train_041580 | Implement the Python class `Fisher_full` described below.
Class description:
Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES
Method signatures and docstrings:
- def __init__(self, da, params, factor, dx): Initialization routine Args: da: DMDA object params: problem parameters f... | Implement the Python class `Fisher_full` described below.
Class description:
Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES
Method signatures and docstrings:
- def __init__(self, da, params, factor, dx): Initialization routine Args: da: DMDA object params: problem parameters f... | de2cd523411276083355389d7e7993106cedf93d | <|skeleton|>
class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, params, factor, dx):
"""Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x dire... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, params, factor, dx):
"""Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x direction"""
... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py | ruthschoebel/pySDC | train | 0 |
ed99c7fab7f9069131e1ea61c09519a7628cadd6 | [
"super(HelpDialog, self).__init__()\nself.version = version\nself.creator = creator\nself.setWindowTitle('Informações')\nself.createLabels()\nself.createButtonBox()\nself.setMainLayout()\nself.moveToCenter()",
"self.labelWidget = QtWidgets.QWidget()\nlayout = QtWidgets.QVBoxLayout()\nappName = QtWidgets.QLabel('T... | <|body_start_0|>
super(HelpDialog, self).__init__()
self.version = version
self.creator = creator
self.setWindowTitle('Informações')
self.createLabels()
self.createButtonBox()
self.setMainLayout()
self.moveToCenter()
<|end_body_0|>
<|body_start_1|>
... | HelpDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HelpDialog:
def __init__(self, version: str, creator: str):
"""Opens a dialog showing information about the app, app name, creator name and version."""
<|body_0|>
def createLabels(self):
"""Creates the widget labelWidget with the app information."""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_006290 | 2,850 | no_license | [
{
"docstring": "Opens a dialog showing information about the app, app name, creator name and version.",
"name": "__init__",
"signature": "def __init__(self, version: str, creator: str)"
},
{
"docstring": "Creates the widget labelWidget with the app information.",
"name": "createLabels",
... | 5 | stack_v2_sparse_classes_30k_train_009299 | Implement the Python class `HelpDialog` described below.
Class description:
Implement the HelpDialog class.
Method signatures and docstrings:
- def __init__(self, version: str, creator: str): Opens a dialog showing information about the app, app name, creator name and version.
- def createLabels(self): Creates the wi... | Implement the Python class `HelpDialog` described below.
Class description:
Implement the HelpDialog class.
Method signatures and docstrings:
- def __init__(self, version: str, creator: str): Opens a dialog showing information about the app, app name, creator name and version.
- def createLabels(self): Creates the wi... | 4c0cf67ad440f5cd1f0f1aa1b9fcc89a283deec2 | <|skeleton|>
class HelpDialog:
def __init__(self, version: str, creator: str):
"""Opens a dialog showing information about the app, app name, creator name and version."""
<|body_0|>
def createLabels(self):
"""Creates the widget labelWidget with the app information."""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HelpDialog:
def __init__(self, version: str, creator: str):
"""Opens a dialog showing information about the app, app name, creator name and version."""
super(HelpDialog, self).__init__()
self.version = version
self.creator = creator
self.setWindowTitle('Informações')
... | the_stack_v2_python_sparse | interface/menu/help.py | bmartins95/TagApp | train | 0 | |
819b26f2dc462daecd0ae2ccfe5139dc5252e4fb | [
"self.assertEqual(count_vowels('hello world'), 3)\nself.assertEqual(count_vowels('aeiouAEIOU'), 10)\nself.assertEqual(count_vowels('why'), 0)\nself.assertEqual(count_vowels('hEllO world'), 3)\nwith self.assertRaises(ValueError):\n count_vowels(66756)\nself.assertNotEqual(count_vowels('why'), count_vowels('hello'... | <|body_start_0|>
self.assertEqual(count_vowels('hello world'), 3)
self.assertEqual(count_vowels('aeiouAEIOU'), 10)
self.assertEqual(count_vowels('why'), 0)
self.assertEqual(count_vowels('hEllO world'), 3)
with self.assertRaises(ValueError):
count_vowels(66756)
... | test class | CountVowelsTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CountVowelsTest:
"""test class"""
def test_count_vowels(self) -> None:
"""testing how many vowels are in a string"""
<|body_0|>
def test_last_occurrence(self) -> None:
"""testing the last occurrence of a target value in a string"""
<|body_1|>
def tes... | stack_v2_sparse_classes_75kplus_train_006291 | 2,067 | no_license | [
{
"docstring": "testing how many vowels are in a string",
"name": "test_count_vowels",
"signature": "def test_count_vowels(self) -> None"
},
{
"docstring": "testing the last occurrence of a target value in a string",
"name": "test_last_occurrence",
"signature": "def test_last_occurrence(... | 3 | stack_v2_sparse_classes_30k_train_004684 | Implement the Python class `CountVowelsTest` described below.
Class description:
test class
Method signatures and docstrings:
- def test_count_vowels(self) -> None: testing how many vowels are in a string
- def test_last_occurrence(self) -> None: testing the last occurrence of a target value in a string
- def test_my... | Implement the Python class `CountVowelsTest` described below.
Class description:
test class
Method signatures and docstrings:
- def test_count_vowels(self) -> None: testing how many vowels are in a string
- def test_last_occurrence(self) -> None: testing the last occurrence of a target value in a string
- def test_my... | 495800b58a869c4057237e0ac5dc2857cd8aee93 | <|skeleton|>
class CountVowelsTest:
"""test class"""
def test_count_vowels(self) -> None:
"""testing how many vowels are in a string"""
<|body_0|>
def test_last_occurrence(self) -> None:
"""testing the last occurrence of a target value in a string"""
<|body_1|>
def tes... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CountVowelsTest:
"""test class"""
def test_count_vowels(self) -> None:
"""testing how many vowels are in a string"""
self.assertEqual(count_vowels('hello world'), 3)
self.assertEqual(count_vowels('aeiouAEIOU'), 10)
self.assertEqual(count_vowels('why'), 0)
self.asse... | the_stack_v2_python_sparse | HW04_Test_Himanshu.py | hbishnoi/SSW-810 | train | 0 |
c971cb1e0e7b9b07e6904e3d57f5607543dad4bc | [
"self.assertEqual(datetime.datetime(2013, 2, 14, 0, 0), inspector.extract_YYYYMMDD('rbspa_pre_ect-hope-L1_20130214_v1.0.0.cdf'))\nself.assertEqual(None, inspector.extract_YYYYMMDD('rbspa_pre_ect-hope-L1_20130231_v1.0.0.cdf'))\nself.assertEqual(None, inspector.extract_YYYYMMDD('rbspa_pre_ect-hope-L1_19520201_v1.0.0.... | <|body_start_0|>
self.assertEqual(datetime.datetime(2013, 2, 14, 0, 0), inspector.extract_YYYYMMDD('rbspa_pre_ect-hope-L1_20130214_v1.0.0.cdf'))
self.assertEqual(None, inspector.extract_YYYYMMDD('rbspa_pre_ect-hope-L1_20130231_v1.0.0.cdf'))
self.assertEqual(None, inspector.extract_YYYYMMDD('rbsp... | Tests of the inspector functions | InspectorFunctions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InspectorFunctions:
"""Tests of the inspector functions"""
def test_extract_YYYYMMDD(self):
"""extract_YYYYMMDD works"""
<|body_0|>
def test_extract_YYYYMM(self):
"""extract_YYYYMM works"""
<|body_1|>
def test_valid_YYYYMMDD(self):
"""valid_Y... | stack_v2_sparse_classes_75kplus_train_006292 | 7,654 | no_license | [
{
"docstring": "extract_YYYYMMDD works",
"name": "test_extract_YYYYMMDD",
"signature": "def test_extract_YYYYMMDD(self)"
},
{
"docstring": "extract_YYYYMM works",
"name": "test_extract_YYYYMM",
"signature": "def test_extract_YYYYMM(self)"
},
{
"docstring": "valid_YYYYMMDD works",... | 4 | stack_v2_sparse_classes_30k_train_015266 | Implement the Python class `InspectorFunctions` described below.
Class description:
Tests of the inspector functions
Method signatures and docstrings:
- def test_extract_YYYYMMDD(self): extract_YYYYMMDD works
- def test_extract_YYYYMM(self): extract_YYYYMM works
- def test_valid_YYYYMMDD(self): valid_YYYYMMDD works
-... | Implement the Python class `InspectorFunctions` described below.
Class description:
Tests of the inspector functions
Method signatures and docstrings:
- def test_extract_YYYYMMDD(self): extract_YYYYMMDD works
- def test_extract_YYYYMM(self): extract_YYYYMM works
- def test_valid_YYYYMMDD(self): valid_YYYYMMDD works
-... | a0bf5e682fb917bb707b4f66787b0ecb860efce1 | <|skeleton|>
class InspectorFunctions:
"""Tests of the inspector functions"""
def test_extract_YYYYMMDD(self):
"""extract_YYYYMMDD works"""
<|body_0|>
def test_extract_YYYYMM(self):
"""extract_YYYYMM works"""
<|body_1|>
def test_valid_YYYYMMDD(self):
"""valid_Y... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InspectorFunctions:
"""Tests of the inspector functions"""
def test_extract_YYYYMMDD(self):
"""extract_YYYYMMDD works"""
self.assertEqual(datetime.datetime(2013, 2, 14, 0, 0), inspector.extract_YYYYMMDD('rbspa_pre_ect-hope-L1_20130214_v1.0.0.cdf'))
self.assertEqual(None, inspector... | the_stack_v2_python_sparse | unit_tests/test_Inspector.py | spacepy/dbprocessing | train | 4 |
5196331d058e9fa4012cd4131eb68eefcab93434 | [
"clients = Client.objects.filter(channel=channel)\nrecipients = []\nfor client in clients:\n recipients.append(client.get_recipient())\nclient = OrbitedClient()\nif hasattr(settings, 'ORBITED_DISPATCH_PORT'):\n client.port = int(settings.ORBITED_DISPATCH_PORT)\nclient.connect()\nbody = {'channel': channel, 'b... | <|body_start_0|>
clients = Client.objects.filter(channel=channel)
recipients = []
for client in clients:
recipients.append(client.get_recipient())
client = OrbitedClient()
if hasattr(settings, 'ORBITED_DISPATCH_PORT'):
client.port = int(settings.ORBITED_DI... | Perform sengins operations over users set | ClientManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientManager:
"""Perform sengins operations over users set"""
def send(self, data, channel):
"""Send message to all users suscribed to a channel"""
<|body_0|>
def multicast(self, data):
"""Send message to all users suscribed to a channel"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_006293 | 2,838 | no_license | [
{
"docstring": "Send message to all users suscribed to a channel",
"name": "send",
"signature": "def send(self, data, channel)"
},
{
"docstring": "Send message to all users suscribed to a channel",
"name": "multicast",
"signature": "def multicast(self, data)"
}
] | 2 | null | Implement the Python class `ClientManager` described below.
Class description:
Perform sengins operations over users set
Method signatures and docstrings:
- def send(self, data, channel): Send message to all users suscribed to a channel
- def multicast(self, data): Send message to all users suscribed to a channel | Implement the Python class `ClientManager` described below.
Class description:
Perform sengins operations over users set
Method signatures and docstrings:
- def send(self, data, channel): Send message to all users suscribed to a channel
- def multicast(self, data): Send message to all users suscribed to a channel
<|... | 1447592c068ca52cb9ac82cabb36191b78b638e4 | <|skeleton|>
class ClientManager:
"""Perform sengins operations over users set"""
def send(self, data, channel):
"""Send message to all users suscribed to a channel"""
<|body_0|>
def multicast(self, data):
"""Send message to all users suscribed to a channel"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClientManager:
"""Perform sengins operations over users set"""
def send(self, data, channel):
"""Send message to all users suscribed to a channel"""
clients = Client.objects.filter(channel=channel)
recipients = []
for client in clients:
recipients.append(client... | the_stack_v2_python_sparse | myproject/django-orbited-read-only/.svn/pristine/51/5196331d058e9fa4012cd4131eb68eefcab93434.svn-base | michalstepniewski/TMProteins | train | 0 |
f6c57e30a470dbffce4d734f9d22a6ac9e7a5305 | [
"self.kids = [{}]\nself.root = 0\nself.vocabular = set([])",
"flag = key in self.vocabular\ncurr = self.root\nself.vocabular.add(key)\nif flag:\n for ch in key:\n index = self.kids[curr][ch][1]\n self.kids[curr][ch] = [val, index]\n curr = index\nelse:\n curr = self.root\n for ch in ... | <|body_start_0|>
self.kids = [{}]
self.root = 0
self.vocabular = set([])
<|end_body_0|>
<|body_start_1|>
flag = key in self.vocabular
curr = self.root
self.vocabular.add(key)
if flag:
for ch in key:
index = self.kids[curr][ch][1]
... | MapSum | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MapSum:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, key, val):
""":type key: str :type val: int :rtype: void"""
<|body_1|>
def sum(self, prefix):
""":type prefix: str :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_75kplus_train_006294 | 1,449 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type key: str :type val: int :rtype: void",
"name": "insert",
"signature": "def insert(self, key, val)"
},
{
"docstring": ":type prefix: str :rtype: in... | 3 | stack_v2_sparse_classes_30k_train_012858 | Implement the Python class `MapSum` described below.
Class description:
Implement the MapSum class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, key, val): :type key: str :type val: int :rtype: void
- def sum(self, prefix): :type prefix: str :rtype: i... | Implement the Python class `MapSum` described below.
Class description:
Implement the MapSum class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, key, val): :type key: str :type val: int :rtype: void
- def sum(self, prefix): :type prefix: str :rtype: i... | c1b083733543e05b9f1e86ddcea1b4c6d0330aaa | <|skeleton|>
class MapSum:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, key, val):
""":type key: str :type val: int :rtype: void"""
<|body_1|>
def sum(self, prefix):
""":type prefix: str :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MapSum:
def __init__(self):
"""Initialize your data structure here."""
self.kids = [{}]
self.root = 0
self.vocabular = set([])
def insert(self, key, val):
""":type key: str :type val: int :rtype: void"""
flag = key in self.vocabular
curr = self.root... | the_stack_v2_python_sparse | solved/P677.py | lgdxiaobobo/Leetcoce | train | 0 | |
d5eb8013eb7b5a43b27b68d47381da8349f0b733 | [
"with patch('sys.stdout', new=io.StringIO()) as fake_output:\n m.get_latest_price = MagicMock(return_value='500')\n m.main_menu()()\n assert m.FULL_INVENTORY == inventory_item\n m.get_latest_price = MagicMock(return_value='800')\n m.main_menu()()\n assert m.FULL_INVENTORY == add_appliance_item\n ... | <|body_start_0|>
with patch('sys.stdout', new=io.StringIO()) as fake_output:
m.get_latest_price = MagicMock(return_value='500')
m.main_menu()()
assert m.FULL_INVENTORY == inventory_item
m.get_latest_price = MagicMock(return_value='800')
m.main_menu()()... | IntegrationTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntegrationTests:
def test_main_menu_option_1(self, mock_input):
"""Test main menu option 1: add_new item"""
<|body_0|>
def test_main_menu_option_2(self, mock_input):
"""Test main menu option 2: item_info"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_006295 | 2,924 | no_license | [
{
"docstring": "Test main menu option 1: add_new item",
"name": "test_main_menu_option_1",
"signature": "def test_main_menu_option_1(self, mock_input)"
},
{
"docstring": "Test main menu option 2: item_info",
"name": "test_main_menu_option_2",
"signature": "def test_main_menu_option_2(sel... | 2 | null | Implement the Python class `IntegrationTests` described below.
Class description:
Implement the IntegrationTests class.
Method signatures and docstrings:
- def test_main_menu_option_1(self, mock_input): Test main menu option 1: add_new item
- def test_main_menu_option_2(self, mock_input): Test main menu option 2: ite... | Implement the Python class `IntegrationTests` described below.
Class description:
Implement the IntegrationTests class.
Method signatures and docstrings:
- def test_main_menu_option_1(self, mock_input): Test main menu option 1: add_new item
- def test_main_menu_option_2(self, mock_input): Test main menu option 2: ite... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class IntegrationTests:
def test_main_menu_option_1(self, mock_input):
"""Test main menu option 1: add_new item"""
<|body_0|>
def test_main_menu_option_2(self, mock_input):
"""Test main menu option 2: item_info"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IntegrationTests:
def test_main_menu_option_1(self, mock_input):
"""Test main menu option 1: add_new item"""
with patch('sys.stdout', new=io.StringIO()) as fake_output:
m.get_latest_price = MagicMock(return_value='500')
m.main_menu()()
assert m.FULL_INVENTOR... | the_stack_v2_python_sparse | students/tao_ye/lesson01/assignment/test_integration.py | JavaRod/SP_Python220B_2019 | train | 1 | |
505bdbc5051899409c5705d3b571bf3e7d806e50 | [
"for subclass in cls.__subclasses__():\n yield from subclass.get_all_subclasses()\n yield subclass",
"result = None\nfor subclass in cls.get_all_subclasses():\n if subclass.__name__.lower() == class_name.lower():\n if result is None:\n result = subclass\n else:\n raise... | <|body_start_0|>
for subclass in cls.__subclasses__():
yield from subclass.get_all_subclasses()
yield subclass
<|end_body_0|>
<|body_start_1|>
result = None
for subclass in cls.get_all_subclasses():
if subclass.__name__.lower() == class_name.lower():
... | 用于动态加载枚举类 | LoadEnumInterface | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadEnumInterface:
"""用于动态加载枚举类"""
def get_all_subclasses(cls) -> Iterable[Any]:
"""Return a generator of all subclasses"""
<|body_0|>
def load_class(cls, class_name) -> Any:
"""Return a subclass of ``class_name``, case insensitively :param cls_name (str): target... | stack_v2_sparse_classes_75kplus_train_006296 | 2,732 | no_license | [
{
"docstring": "Return a generator of all subclasses",
"name": "get_all_subclasses",
"signature": "def get_all_subclasses(cls) -> Iterable[Any]"
},
{
"docstring": "Return a subclass of ``class_name``, case insensitively :param cls_name (str): target class name :return:",
"name": "load_class"... | 2 | stack_v2_sparse_classes_30k_train_029990 | Implement the Python class `LoadEnumInterface` described below.
Class description:
用于动态加载枚举类
Method signatures and docstrings:
- def get_all_subclasses(cls) -> Iterable[Any]: Return a generator of all subclasses
- def load_class(cls, class_name) -> Any: Return a subclass of ``class_name``, case insensitively :param c... | Implement the Python class `LoadEnumInterface` described below.
Class description:
用于动态加载枚举类
Method signatures and docstrings:
- def get_all_subclasses(cls) -> Iterable[Any]: Return a generator of all subclasses
- def load_class(cls, class_name) -> Any: Return a subclass of ``class_name``, case insensitively :param c... | a07087a77d6e0c7eeb0a7b4da23baac9bbbfb3d6 | <|skeleton|>
class LoadEnumInterface:
"""用于动态加载枚举类"""
def get_all_subclasses(cls) -> Iterable[Any]:
"""Return a generator of all subclasses"""
<|body_0|>
def load_class(cls, class_name) -> Any:
"""Return a subclass of ``class_name``, case insensitively :param cls_name (str): target... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoadEnumInterface:
"""用于动态加载枚举类"""
def get_all_subclasses(cls) -> Iterable[Any]:
"""Return a generator of all subclasses"""
for subclass in cls.__subclasses__():
yield from subclass.get_all_subclasses()
yield subclass
def load_class(cls, class_name) -> Any:
... | the_stack_v2_python_sparse | novela/_utils/metaclass.py | Zessay/novel_analysis | train | 2 |
27cec197f57377f6998ac3dfa06cf52a6454d702 | [
"super(G3_SF, self).__init__()\nself.lambd = tf.cast(lambd, tf.keras.backend.floatx())\nself.zeta = tf.cast(zeta, tf.keras.backend.floatx())\nself.basis = GaussianBasis(center=np.zeros_like(eta), gamma=eta)\nself.cutoff = cutoff\nself.rc = rc\nself.i = i\nself.j = j\nself.k = k",
"i_rind, a_rind, ind_ij, ind_ik =... | <|body_start_0|>
super(G3_SF, self).__init__()
self.lambd = tf.cast(lambd, tf.keras.backend.floatx())
self.zeta = tf.cast(zeta, tf.keras.backend.floatx())
self.basis = GaussianBasis(center=np.zeros_like(eta), gamma=eta)
self.cutoff = cutoff
self.rc = rc
self.i = i... | BP-style G3 symmetry functions. | G3_SF | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class G3_SF:
"""BP-style G3 symmetry functions."""
def __init__(self, lambd, zeta, eta, cutoff, rc, i='ALL', j='ALL', k='ALL'):
"""Args: lambd (list of floats): lambda parameter of G3 SF zeta (list of floats): zeta parameter of G3 SF eta (list of floats): Gaussian widths i (str): species i... | stack_v2_sparse_classes_75kplus_train_006297 | 10,280 | permissive | [
{
"docstring": "Args: lambd (list of floats): lambda parameter of G3 SF zeta (list of floats): zeta parameter of G3 SF eta (list of floats): Gaussian widths i (str): species i j (str): species j k (str): species k",
"name": "__init__",
"signature": "def __init__(self, lambd, zeta, eta, cutoff, rc, i='AL... | 2 | stack_v2_sparse_classes_30k_train_002422 | Implement the Python class `G3_SF` described below.
Class description:
BP-style G3 symmetry functions.
Method signatures and docstrings:
- def __init__(self, lambd, zeta, eta, cutoff, rc, i='ALL', j='ALL', k='ALL'): Args: lambd (list of floats): lambda parameter of G3 SF zeta (list of floats): zeta parameter of G3 SF... | Implement the Python class `G3_SF` described below.
Class description:
BP-style G3 symmetry functions.
Method signatures and docstrings:
- def __init__(self, lambd, zeta, eta, cutoff, rc, i='ALL', j='ALL', k='ALL'): Args: lambd (list of floats): lambda parameter of G3 SF zeta (list of floats): zeta parameter of G3 SF... | 5717be6dab46c980d6c1e13949719e61b2ba335a | <|skeleton|>
class G3_SF:
"""BP-style G3 symmetry functions."""
def __init__(self, lambd, zeta, eta, cutoff, rc, i='ALL', j='ALL', k='ALL'):
"""Args: lambd (list of floats): lambda parameter of G3 SF zeta (list of floats): zeta parameter of G3 SF eta (list of floats): Gaussian widths i (str): species i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class G3_SF:
"""BP-style G3 symmetry functions."""
def __init__(self, lambd, zeta, eta, cutoff, rc, i='ALL', j='ALL', k='ALL'):
"""Args: lambd (list of floats): lambda parameter of G3 SF zeta (list of floats): zeta parameter of G3 SF eta (list of floats): Gaussian widths i (str): species i j (str): spe... | the_stack_v2_python_sparse | pinn/layers/bpsf.py | Teoroo-CMC/PiNN | train | 108 |
19397c86fc47d3b7898c6c19774b885bbc921971 | [
"self.surface = surface\nself.pos = pos\nself.direction = direction\nself.size = size\nself.color = color\nself.gravity = pygame.Vector2(0, 9.81 / FPS)\nself.drag = pygame.Vector2(1.0, 0.999)",
"right = self.surface.get_width() - self.size\nleft = self.size\ntop = self.size\nbottom = self.surface.get_height() - s... | <|body_start_0|>
self.surface = surface
self.pos = pos
self.direction = direction
self.size = size
self.color = color
self.gravity = pygame.Vector2(0, 9.81 / FPS)
self.drag = pygame.Vector2(1.0, 0.999)
<|end_body_0|>
<|body_start_1|>
right = self.surface.... | Paticle in 2D space | Particle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Particle:
"""Paticle in 2D space"""
def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple):
"""a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size:... | stack_v2_sparse_classes_75kplus_train_006298 | 5,061 | no_license | [
{
"docstring": "a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size: size of particle :param color: color of particle :param direction: initial direction of particle in m/s aka pixel/frame :param gravity: gravity vector 9.81 m/s aka 9.81... | 4 | stack_v2_sparse_classes_30k_train_047969 | Implement the Python class `Particle` described below.
Class description:
Paticle in 2D space
Method signatures and docstrings:
- def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): a particle in 2D space :param surface: surface to draw on :param pos: ... | Implement the Python class `Particle` described below.
Class description:
Paticle in 2D space
Method signatures and docstrings:
- def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): a particle in 2D space :param surface: surface to draw on :param pos: ... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class Particle:
"""Paticle in 2D space"""
def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple):
"""a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Particle:
"""Paticle in 2D space"""
def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple):
"""a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size: size of part... | the_stack_v2_python_sparse | effects/Particle.py | gunny26/pygame | train | 5 |
51c894d1a4c736e8046b8097e8fda978168833eb | [
"if label is None:\n label = title\nif info is None:\n info = title\nif c is None:\n c = current.request.controller\nif label is None:\n if t is None:\n t = '%s_%s' % (c, f)\n if m == 'create':\n label = get_crud_string(t, 'label_create')\n elif m == 'update':\n label = get_cr... | <|body_start_0|>
if label is None:
label = title
if info is None:
info = title
if c is None:
c = current.request.controller
if label is None:
if t is None:
t = '%s_%s' % (c, f)
if m == 'create':
l... | Links in form fields comments to show a form for adding a new foreign key record. | S3PopupLink | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S3PopupLink:
"""Links in form fields comments to show a form for adding a new foreign key record."""
def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None):
"""Constructor @param c: the target controller @param f:... | stack_v2_sparse_classes_75kplus_train_006299 | 26,788 | permissive | [
{
"docstring": "Constructor @param c: the target controller @param f: the target function @param t: the target table (defaults to c_f) @param m: the URL method (will be appended to args) @param args: the argument list @param vars: the request vars (format=\"popup\" will be added automatically) @param label: the... | 3 | stack_v2_sparse_classes_30k_train_029578 | Implement the Python class `S3PopupLink` described below.
Class description:
Links in form fields comments to show a form for adding a new foreign key record.
Method signatures and docstrings:
- def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=Non... | Implement the Python class `S3PopupLink` described below.
Class description:
Links in form fields comments to show a form for adding a new foreign key record.
Method signatures and docstrings:
- def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=Non... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class S3PopupLink:
"""Links in form fields comments to show a form for adding a new foreign key record."""
def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None):
"""Constructor @param c: the target controller @param f:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class S3PopupLink:
"""Links in form fields comments to show a form for adding a new foreign key record."""
def __init__(self, label=None, c=None, f=None, t=None, m='create', args=None, vars=None, info=None, title=None, tooltip=None):
"""Constructor @param c: the target controller @param f: the target f... | the_stack_v2_python_sparse | modules/s3layouts.py | nursix/drkcm | train | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.