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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
132f631dad5ea957d18918cd31ec1e3deb5eac14 | [
"self.assertEqual(gcd_recursive(48, 18), 6)\nself.assertEqual(gcd_recursive(123, 369), 123)\nself.assertEqual(gcd_recursive(8, 12), 4)\nself.assertEqual(gcd_recursive(12, 8), 4)",
"self.assertEqual(gcd_iterative(48, 18), 6)\nself.assertEqual(gcd_iterative(123, 369), 123)\nself.assertEqual(gcd_iterative(8, 12), 4)... | <|body_start_0|>
self.assertEqual(gcd_recursive(48, 18), 6)
self.assertEqual(gcd_recursive(123, 369), 123)
self.assertEqual(gcd_recursive(8, 12), 4)
self.assertEqual(gcd_recursive(12, 8), 4)
<|end_body_0|>
<|body_start_1|>
self.assertEqual(gcd_iterative(48, 18), 6)
self.... | Gcd compute functions tests. | GcdTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GcdTest:
"""Gcd compute functions tests."""
def test_gcd_recursive_test(self):
"""Test some small hand picked example."""
<|body_0|>
def test_gcd_iterative_test(self):
"""Test some small hand picked example."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_069500 | 1,056 | no_license | [
{
"docstring": "Test some small hand picked example.",
"name": "test_gcd_recursive_test",
"signature": "def test_gcd_recursive_test(self)"
},
{
"docstring": "Test some small hand picked example.",
"name": "test_gcd_iterative_test",
"signature": "def test_gcd_iterative_test(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009266 | Implement the Python class `GcdTest` described below.
Class description:
Gcd compute functions tests.
Method signatures and docstrings:
- def test_gcd_recursive_test(self): Test some small hand picked example.
- def test_gcd_iterative_test(self): Test some small hand picked example. | Implement the Python class `GcdTest` described below.
Class description:
Gcd compute functions tests.
Method signatures and docstrings:
- def test_gcd_recursive_test(self): Test some small hand picked example.
- def test_gcd_iterative_test(self): Test some small hand picked example.
<|skeleton|>
class GcdTest:
"... | 662eed857389fa9bb4dea01458bc43a705768a3c | <|skeleton|>
class GcdTest:
"""Gcd compute functions tests."""
def test_gcd_recursive_test(self):
"""Test some small hand picked example."""
<|body_0|>
def test_gcd_iterative_test(self):
"""Test some small hand picked example."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GcdTest:
"""Gcd compute functions tests."""
def test_gcd_recursive_test(self):
"""Test some small hand picked example."""
self.assertEqual(gcd_recursive(48, 18), 6)
self.assertEqual(gcd_recursive(123, 369), 123)
self.assertEqual(gcd_recursive(8, 12), 4)
self.assert... | the_stack_v2_python_sparse | home/kolszak/gcd.py | anagorko/inf | train | 0 |
6806e0d3dcfae4849b8586447c1c77d7c28763f6 | [
"class Foo(Struct):\n network_name = 'foo'\n x: Array[Int32]\n y: Array[Double, String, Boolean]\nexp_x = [1, 2, 3]\nexp_y = [(1.2, 'a', True), (-3.4, 'b', False)]\nfoo = Foo()\nfoo.x = exp_x\nfoo.y = exp_y\nself.assertEqual(exp_x, foo.x)\nself.assertEqual(exp_y, foo.y)",
"exp_x = [1, 2, 3]\nexp_y = [(1.... | <|body_start_0|>
class Foo(Struct):
network_name = 'foo'
x: Array[Int32]
y: Array[Double, String, Boolean]
exp_x = [1, 2, 3]
exp_y = [(1.2, 'a', True), (-3.4, 'b', False)]
foo = Foo()
foo.x = exp_x
foo.y = exp_y
self.assertEqual... | ArrayStructTester | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArrayStructTester:
def test_struct_with_array(self):
"""Test creating an Icypaw Struct type that contains an array."""
<|body_0|>
def test_struct_with_array_defaults(self):
"""Test creating an Icypaw Struct type that contains an array with default values."""
... | stack_v2_sparse_classes_75kplus_train_069501 | 42,194 | permissive | [
{
"docstring": "Test creating an Icypaw Struct type that contains an array.",
"name": "test_struct_with_array",
"signature": "def test_struct_with_array(self)"
},
{
"docstring": "Test creating an Icypaw Struct type that contains an array with default values.",
"name": "test_struct_with_array... | 3 | stack_v2_sparse_classes_30k_train_000178 | Implement the Python class `ArrayStructTester` described below.
Class description:
Implement the ArrayStructTester class.
Method signatures and docstrings:
- def test_struct_with_array(self): Test creating an Icypaw Struct type that contains an array.
- def test_struct_with_array_defaults(self): Test creating an Icyp... | Implement the Python class `ArrayStructTester` described below.
Class description:
Implement the ArrayStructTester class.
Method signatures and docstrings:
- def test_struct_with_array(self): Test creating an Icypaw Struct type that contains an array.
- def test_struct_with_array_defaults(self): Test creating an Icyp... | a626f881d55c307bd857d0ff980cc526f2b18de2 | <|skeleton|>
class ArrayStructTester:
def test_struct_with_array(self):
"""Test creating an Icypaw Struct type that contains an array."""
<|body_0|>
def test_struct_with_array_defaults(self):
"""Test creating an Icypaw Struct type that contains an array with default values."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArrayStructTester:
def test_struct_with_array(self):
"""Test creating an Icypaw Struct type that contains an array."""
class Foo(Struct):
network_name = 'foo'
x: Array[Int32]
y: Array[Double, String, Boolean]
exp_x = [1, 2, 3]
exp_y = [(1.2, ... | the_stack_v2_python_sparse | icypaw/test_types.py | sandialabs/IcyPaw | train | 0 | |
19857dbd35e2cec283c3df7bdd8bb6dcade0aae9 | [
"self.method = method\nself.cooldown = cooldown\nself._bindings = {}",
"if obj is None:\n return self\nif id(obj) not in self._bindings:\n bound_method = self.method.__get__(obj)\n self._bindings[id(obj)] = _BoundCooldownMethod(bound_method, self.cooldown)\nreturn self._bindings[id(obj)]"
] | <|body_start_0|>
self.method = method
self.cooldown = cooldown
self._bindings = {}
<|end_body_0|>
<|body_start_1|>
if obj is None:
return self
if id(obj) not in self._bindings:
bound_method = self.method.__get__(obj)
self._bindings[id(obj)] = ... | A wrapper around an unbound method for adding a cooldown. This class is used to replace methods in classes with an object that stores the original method and a cooldown, then uses `__get__` to bind the objects accessing the method to their bound methods. | _UnboundCooldownMethod | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _UnboundCooldownMethod:
"""A wrapper around an unbound method for adding a cooldown. This class is used to replace methods in classes with an object that stores the original method and a cooldown, then uses `__get__` to bind the objects accessing the method to their bound methods."""
def __i... | stack_v2_sparse_classes_75kplus_train_069502 | 2,771 | permissive | [
{
"docstring": "Initialize a new unbound cooldown method. :param callable method: Method to wrap around :param float cooldown: The cooldown between two function calls",
"name": "__init__",
"signature": "def __init__(self, method, cooldown)"
},
{
"docstring": "Bind the accessing instance to a met... | 2 | null | Implement the Python class `_UnboundCooldownMethod` described below.
Class description:
A wrapper around an unbound method for adding a cooldown. This class is used to replace methods in classes with an object that stores the original method and a cooldown, then uses `__get__` to bind the objects accessing the method ... | Implement the Python class `_UnboundCooldownMethod` described below.
Class description:
A wrapper around an unbound method for adding a cooldown. This class is used to replace methods in classes with an object that stores the original method and a cooldown, then uses `__get__` to bind the objects accessing the method ... | 665d39a2bd82543d5196555f0801ef8fd4a3ee48 | <|skeleton|>
class _UnboundCooldownMethod:
"""A wrapper around an unbound method for adding a cooldown. This class is used to replace methods in classes with an object that stores the original method and a cooldown, then uses `__get__` to bind the objects accessing the method to their bound methods."""
def __i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _UnboundCooldownMethod:
"""A wrapper around an unbound method for adding a cooldown. This class is used to replace methods in classes with an object that stores the original method and a cooldown, then uses `__get__` to bind the objects accessing the method to their bound methods."""
def __init__(self, m... | the_stack_v2_python_sparse | all-gists/dcae2df60a20e1fcfd45dee57d67b260/snippet.py | gistable/gistable | train | 76 |
c94193bc12627234ed22ac1750e11ddc49b05da0 | [
"stats = self._generate_stats(host_state, filter_properties)\nLOG.debug(\"Driver Filter: Checking host '%s'\", stats['host_stats']['host'])\nresult = self._check_filter_function(stats)\nLOG.debug('Result: %s', result)\nLOG.debug(\"Done checking host '%s'\", stats['host_stats']['host'])\nreturn result",
"if stats[... | <|body_start_0|>
stats = self._generate_stats(host_state, filter_properties)
LOG.debug("Driver Filter: Checking host '%s'", stats['host_stats']['host'])
result = self._check_filter_function(stats)
LOG.debug('Result: %s', result)
LOG.debug("Done checking host '%s'", stats['host_st... | DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics. | DriverFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function... | stack_v2_sparse_classes_75kplus_train_069503 | 3,736 | permissive | [
{
"docstring": "Determines whether a host has a passing filter_function or not.",
"name": "host_passes",
"signature": "def host_passes(self, host_state, filter_properties)"
},
{
"docstring": "Checks if a share passes a host's filter function. Returns a tuple in the format (filter_passing, filter... | 4 | stack_v2_sparse_classes_30k_train_048551 | Implement the Python class `DriverFilter` described below.
Class description:
DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics.
Method signatures and docstrings:
- def host_passes(self, host_state, filter_properties)... | Implement the Python class `DriverFilter` described below.
Class description:
DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics.
Method signatures and docstrings:
- def host_passes(self, host_state, filter_properties)... | a93a844398a11a8a85f204782fb9456f7caccdbe | <|skeleton|>
class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function or not."""
... | the_stack_v2_python_sparse | manila/scheduler/filters/driver.py | openstack/manila | train | 178 |
cae4470d231530af30d4884258712f55612b2a17 | [
"self.temp = Temperature()\ntemp_label = Label(window, text='Temperature (in F):')\ntemp_label.grid(row=0, column=0, sticky=E)\nself._ftemp = IntVar()\ntemp_entry = Entry(window, textvariable=self._ftemp, width=5)\ntemp_entry.grid(row=0, column=1, sticky=W)\nconvert_button = Button(window, text='Convert to Celcius'... | <|body_start_0|>
self.temp = Temperature()
temp_label = Label(window, text='Temperature (in F):')
temp_label.grid(row=0, column=0, sticky=E)
self._ftemp = IntVar()
temp_entry = Entry(window, textvariable=self._ftemp, width=5)
temp_entry.grid(row=0, column=1, sticky=W)
... | This will create the GUI application class | Gui | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Gui:
"""This will create the GUI application class"""
def __init__(self, window):
"""This method will open up a window that converts a fahrenheit temperature to celcius"""
<|body_0|>
def convert_celcius(self):
"""This method is a command function for the conversi... | stack_v2_sparse_classes_75kplus_train_069504 | 2,217 | no_license | [
{
"docstring": "This method will open up a window that converts a fahrenheit temperature to celcius",
"name": "__init__",
"signature": "def __init__(self, window)"
},
{
"docstring": "This method is a command function for the conversion button to callback once the user presses the button",
"n... | 2 | stack_v2_sparse_classes_30k_train_024241 | Implement the Python class `Gui` described below.
Class description:
This will create the GUI application class
Method signatures and docstrings:
- def __init__(self, window): This method will open up a window that converts a fahrenheit temperature to celcius
- def convert_celcius(self): This method is a command func... | Implement the Python class `Gui` described below.
Class description:
This will create the GUI application class
Method signatures and docstrings:
- def __init__(self, window): This method will open up a window that converts a fahrenheit temperature to celcius
- def convert_celcius(self): This method is a command func... | 3ba64a4beebc44eba44847655a77ce12f8152fee | <|skeleton|>
class Gui:
"""This will create the GUI application class"""
def __init__(self, window):
"""This method will open up a window that converts a fahrenheit temperature to celcius"""
<|body_0|>
def convert_celcius(self):
"""This method is a command function for the conversi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Gui:
"""This will create the GUI application class"""
def __init__(self, window):
"""This method will open up a window that converts a fahrenheit temperature to celcius"""
self.temp = Temperature()
temp_label = Label(window, text='Temperature (in F):')
temp_label.grid(row=... | the_stack_v2_python_sparse | homework11/gui.py | sinai228/cs108 | train | 0 |
84faeb1def341eff7cba0f872c6088ebee2449b4 | [
"k = m + n - 1\ni = m - 1\nj = n - 1\nwhile k > -1:\n if i == -1:\n nums1[k] = nums2[j]\n j -= 1\n elif j == -1:\n nums1[k] = nums1[i]\n i -= 1\n elif nums1[i] > nums2[j]:\n nums1[k] = nums1[i]\n i -= 1\n else:\n nums1[k] = nums2[j]\n j -= 1\n k... | <|body_start_0|>
k = m + n - 1
i = m - 1
j = n - 1
while k > -1:
if i == -1:
nums1[k] = nums2[j]
j -= 1
elif j == -1:
nums1[k] = nums1[i]
i -= 1
elif nums1[i] > nums2[j]:
n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1: List[int], m: int, nums2: List[int], n: int) ->... | stack_v2_sparse_classes_75kplus_train_069505 | 1,008 | no_license | [
{
"docstring": ":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.",
"name": "merge",
"signature": "def merge(self, nums1, m, nums2, n)"
},
{
"docstring": "Do not return anything, modify nums1 in-place inste... | 2 | stack_v2_sparse_classes_30k_train_053131 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.
-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead.
-... | 46ab9dabcca845a13f55efcb3f9be3bf3f2908a9 | <|skeleton|>
class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1: List[int], m: int, nums2: List[int], n: int) ->... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: None Do not return anything, modify nums1 in-place instead."""
k = m + n - 1
i = m - 1
j = n - 1
while k > -1:
if i == -1:
... | the_stack_v2_python_sparse | easy/88_merge_sorted_arrays.py | zehrahayirci/LeetCode | train | 0 | |
987bc1cb980082f1ca49dc804f49f8ba8b2d533a | [
"chr_id = 1\nself.order_to_frag_name = {}\nself.order_to_frag_size = {}\nself.chr_dict = defaultdict(list)\nself.chr_size = defaultdict(int)\nwith open(assembly_file) as fh:\n for line in fh:\n this_chr, this_start, this_end, this_name, this_strand = ['.'] * 5\n if line.startswith('>'):\n ... | <|body_start_0|>
chr_id = 1
self.order_to_frag_name = {}
self.order_to_frag_size = {}
self.chr_dict = defaultdict(list)
self.chr_size = defaultdict(int)
with open(assembly_file) as fh:
for line in fh:
this_chr, this_start, this_end, this_name, ... | AssemblyIO | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssemblyIO:
def __init__(self, assembly_file):
"""Input assembly file #==> allhic.0.review.assembly <== #>Hic.fastq.gz.counts_GATC.20g1:::fragment_1 1 5423057 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_2:::debris 2 50000 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_3 3 7785000 #... #1 -3 1... | stack_v2_sparse_classes_75kplus_train_069506 | 12,367 | no_license | [
{
"docstring": "Input assembly file #==> allhic.0.review.assembly <== #>Hic.fastq.gz.counts_GATC.20g1:::fragment_1 1 5423057 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_2:::debris 2 50000 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_3 3 7785000 #... #1 -3 13 22 -5",
"name": "__init__",
"signature": "def __... | 4 | stack_v2_sparse_classes_30k_train_018169 | Implement the Python class `AssemblyIO` described below.
Class description:
Implement the AssemblyIO class.
Method signatures and docstrings:
- def __init__(self, assembly_file): Input assembly file #==> allhic.0.review.assembly <== #>Hic.fastq.gz.counts_GATC.20g1:::fragment_1 1 5423057 #>Hic.fastq.gz.counts_GATC.20g... | Implement the Python class `AssemblyIO` described below.
Class description:
Implement the AssemblyIO class.
Method signatures and docstrings:
- def __init__(self, assembly_file): Input assembly file #==> allhic.0.review.assembly <== #>Hic.fastq.gz.counts_GATC.20g1:::fragment_1 1 5423057 #>Hic.fastq.gz.counts_GATC.20g... | e31c8f2f65260ceff110d07b530b67e465e41800 | <|skeleton|>
class AssemblyIO:
def __init__(self, assembly_file):
"""Input assembly file #==> allhic.0.review.assembly <== #>Hic.fastq.gz.counts_GATC.20g1:::fragment_1 1 5423057 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_2:::debris 2 50000 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_3 3 7785000 #... #1 -3 1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AssemblyIO:
def __init__(self, assembly_file):
"""Input assembly file #==> allhic.0.review.assembly <== #>Hic.fastq.gz.counts_GATC.20g1:::fragment_1 1 5423057 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_2:::debris 2 50000 #>Hic.fastq.gz.counts_GATC.20g1:::fragment_3 3 7785000 #... #1 -3 13 22 -5"""
... | the_stack_v2_python_sparse | wrapper/iga/assembly/hic.py | lhui2010/bundle | train | 6 | |
de444a0979615d5a4d2e374e9f2d010492a8587e | [
"if data2 is None:\n self.type = 1\n self.n = data.shape[0]\n self.ind = np.triu_indices(n=self.n, k=1)\n self.sqdist = np.square(data[self.ind[0], :] - data[self.ind[1], :])\nelse:\n self.type = 2\n self.n = data.shape[0]\n self.m = data2.shape[0]\n self.ind = np.unravel_index(np.arange(sel... | <|body_start_0|>
if data2 is None:
self.type = 1
self.n = data.shape[0]
self.ind = np.triu_indices(n=self.n, k=1)
self.sqdist = np.square(data[self.ind[0], :] - data[self.ind[1], :])
else:
self.type = 2
self.n = data.shape[0]
... | Class for computing/storing distances and covariance matrix, typically not called directly by user but used in model. :var type: int -- 1: self-distance for single input data, 2: cross-distance for two input data :var n: int -- number of observations in data set 1 :var m: int -- number of observations in data set 2 :va... | SepiaDistCov | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SepiaDistCov:
"""Class for computing/storing distances and covariance matrix, typically not called directly by user but used in model. :var type: int -- 1: self-distance for single input data, 2: cross-distance for two input data :var n: int -- number of observations in data set 1 :var m: int -- ... | stack_v2_sparse_classes_75kplus_train_069507 | 2,760 | permissive | [
{
"docstring": "Instantiate SepiaDistCov. If only one data set is given, the auto-distance is computed, else computes distance between data and data2. :param data: nparray -- input data, shape (n_samples, _) :param data2: nparray -- optional, second data set to compute distances with data",
"name": "__init_... | 2 | null | Implement the Python class `SepiaDistCov` described below.
Class description:
Class for computing/storing distances and covariance matrix, typically not called directly by user but used in model. :var type: int -- 1: self-distance for single input data, 2: cross-distance for two input data :var n: int -- number of obs... | Implement the Python class `SepiaDistCov` described below.
Class description:
Class for computing/storing distances and covariance matrix, typically not called directly by user but used in model. :var type: int -- 1: self-distance for single input data, 2: cross-distance for two input data :var n: int -- number of obs... | 67624ecd9f9cacc3e5223321088974ba90730da7 | <|skeleton|>
class SepiaDistCov:
"""Class for computing/storing distances and covariance matrix, typically not called directly by user but used in model. :var type: int -- 1: self-distance for single input data, 2: cross-distance for two input data :var n: int -- number of observations in data set 1 :var m: int -- ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SepiaDistCov:
"""Class for computing/storing distances and covariance matrix, typically not called directly by user but used in model. :var type: int -- 1: self-distance for single input data, 2: cross-distance for two input data :var n: int -- number of observations in data set 1 :var m: int -- number of obs... | the_stack_v2_python_sparse | sepia/SepiaDistCov.py | natalieklein229/SEPIA | train | 0 |
90317124a189ace073fd8cc7f6203116fab58b53 | [
"x = driver.get_window_size()['width']\ny = driver.get_window_size()['height']\ndriver.swipe(x * 3 / 4, y / 4, x / 4, y / 4)",
"x = driver.get_window_size()['width']\ny = driver.get_window_size()['height']\ndriver.swipe(x / 4, y / 4, x * 3 / 4, y / 4)",
"x = self.driver.get_window_size()['width']\ny = self.driv... | <|body_start_0|>
x = driver.get_window_size()['width']
y = driver.get_window_size()['height']
driver.swipe(x * 3 / 4, y / 4, x / 4, y / 4)
<|end_body_0|>
<|body_start_1|>
x = driver.get_window_size()['width']
y = driver.get_window_size()['height']
driver.swipe(x / 4, y /... | gesture_mainpulation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class gesture_mainpulation:
def swipe_left(self, driver):
"""左滑"""
<|body_0|>
def swipe_right(self, driver):
"""右滑"""
<|body_1|>
def swipe_down(self, t=500, n=2):
"""下滑"""
<|body_2|>
def swipe_up(self, t=500, n=2):
"""上滑"""
... | stack_v2_sparse_classes_75kplus_train_069508 | 1,004 | no_license | [
{
"docstring": "左滑",
"name": "swipe_left",
"signature": "def swipe_left(self, driver)"
},
{
"docstring": "右滑",
"name": "swipe_right",
"signature": "def swipe_right(self, driver)"
},
{
"docstring": "下滑",
"name": "swipe_down",
"signature": "def swipe_down(self, t=500, n=2)"... | 4 | stack_v2_sparse_classes_30k_test_001810 | Implement the Python class `gesture_mainpulation` described below.
Class description:
Implement the gesture_mainpulation class.
Method signatures and docstrings:
- def swipe_left(self, driver): 左滑
- def swipe_right(self, driver): 右滑
- def swipe_down(self, t=500, n=2): 下滑
- def swipe_up(self, t=500, n=2): 上滑 | Implement the Python class `gesture_mainpulation` described below.
Class description:
Implement the gesture_mainpulation class.
Method signatures and docstrings:
- def swipe_left(self, driver): 左滑
- def swipe_right(self, driver): 右滑
- def swipe_down(self, t=500, n=2): 下滑
- def swipe_up(self, t=500, n=2): 上滑
<|skelet... | 0a2edf58311e76931aa72d2ccb611e06060b767f | <|skeleton|>
class gesture_mainpulation:
def swipe_left(self, driver):
"""左滑"""
<|body_0|>
def swipe_right(self, driver):
"""右滑"""
<|body_1|>
def swipe_down(self, t=500, n=2):
"""下滑"""
<|body_2|>
def swipe_up(self, t=500, n=2):
"""上滑"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class gesture_mainpulation:
def swipe_left(self, driver):
"""左滑"""
x = driver.get_window_size()['width']
y = driver.get_window_size()['height']
driver.swipe(x * 3 / 4, y / 4, x / 4, y / 4)
def swipe_right(self, driver):
"""右滑"""
x = driver.get_window_size()['widt... | the_stack_v2_python_sparse | src/common/gesture_mainpulation.py | lilinhuigomo/xiangjiUIautotest | train | 1 | |
981c220f44824f592829dcdaab32d5deca93a310 | [
"self.left = left\nself.right = right\nself.bottom = bottom\nself.top = top",
"mask_1 = (x > self.left) & (x <= self.right)\nmask_2 = (y > self.bottom) & (y <= self.top)\nmask = mask_1 & mask_2\nreturn mask"
] | <|body_start_0|>
self.left = left
self.right = right
self.bottom = bottom
self.top = top
<|end_body_0|>
<|body_start_1|>
mask_1 = (x > self.left) & (x <= self.right)
mask_2 = (y > self.bottom) & (y <= self.top)
mask = mask_1 & mask_2
return mask
<|end_bod... | a rectangular region | Region | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Region:
"""a rectangular region"""
def __init__(self, left, right, bottom, top):
"""Parameters ========== left : float minimum x-coordinate of region right : float maximum x-coordinate of region bottom : float minimum y-coordinate of region top : float maximum y-coordinate of region"... | stack_v2_sparse_classes_75kplus_train_069509 | 5,841 | no_license | [
{
"docstring": "Parameters ========== left : float minimum x-coordinate of region right : float maximum x-coordinate of region bottom : float minimum y-coordinate of region top : float maximum y-coordinate of region",
"name": "__init__",
"signature": "def __init__(self, left, right, bottom, top)"
},
... | 2 | stack_v2_sparse_classes_30k_train_003199 | Implement the Python class `Region` described below.
Class description:
a rectangular region
Method signatures and docstrings:
- def __init__(self, left, right, bottom, top): Parameters ========== left : float minimum x-coordinate of region right : float maximum x-coordinate of region bottom : float minimum y-coordin... | Implement the Python class `Region` described below.
Class description:
a rectangular region
Method signatures and docstrings:
- def __init__(self, left, right, bottom, top): Parameters ========== left : float minimum x-coordinate of region right : float maximum x-coordinate of region bottom : float minimum y-coordin... | 3ba6f056908597c9c7a5057760bffd6a5fcb4ab5 | <|skeleton|>
class Region:
"""a rectangular region"""
def __init__(self, left, right, bottom, top):
"""Parameters ========== left : float minimum x-coordinate of region right : float maximum x-coordinate of region bottom : float minimum y-coordinate of region top : float maximum y-coordinate of region"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Region:
"""a rectangular region"""
def __init__(self, left, right, bottom, top):
"""Parameters ========== left : float minimum x-coordinate of region right : float maximum x-coordinate of region bottom : float minimum y-coordinate of region top : float maximum y-coordinate of region"""
se... | the_stack_v2_python_sparse | sdss_measurements/grid.py | duncandc/galaxy_shapes | train | 0 |
6bed9e02e9f1444770bb7b56efb38e34543fd3a7 | [
"self.year = year\nself.month = month\nself.course_id = course_id\nself.user_type = user_type\nsuper(Calendar, self).__init__()",
"events_per_day = events.filter(eventDate__day=day)\nd = ''\nfor event in events_per_day:\n d += f'<li> {event.get_html_url} </li>'\nif day != 0:\n return f\"<td><span class='dat... | <|body_start_0|>
self.year = year
self.month = month
self.course_id = course_id
self.user_type = user_type
super(Calendar, self).__init__()
<|end_body_0|>
<|body_start_1|>
events_per_day = events.filter(eventDate__day=day)
d = ''
for event in events_per_d... | Calendar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Calendar:
def __init__(self, year=None, month=None, course_id=None, user_type=None):
"""calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html". Some part of the code is change in order to be able t... | stack_v2_sparse_classes_75kplus_train_069510 | 3,320 | no_license | [
{
"docstring": "calendar initialisation .. note::This code was made by following this tutorial \"https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html\". Some part of the code is change in order to be able to be integrated to the webapp :param self: object that contains metadata about the request. :p... | 4 | stack_v2_sparse_classes_30k_test_002393 | Implement the Python class `Calendar` described below.
Class description:
Implement the Calendar class.
Method signatures and docstrings:
- def __init__(self, year=None, month=None, course_id=None, user_type=None): calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.c... | Implement the Python class `Calendar` described below.
Class description:
Implement the Calendar class.
Method signatures and docstrings:
- def __init__(self, year=None, month=None, course_id=None, user_type=None): calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.c... | f003cc8721d78abe9eb6279818ecef287689bb72 | <|skeleton|>
class Calendar:
def __init__(self, year=None, month=None, course_id=None, user_type=None):
"""calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html". Some part of the code is change in order to be able t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Calendar:
def __init__(self, year=None, month=None, course_id=None, user_type=None):
"""calendar initialisation .. note::This code was made by following this tutorial "https://www.huiwenteo.com/normal/2018/07/24/django-calendar.html". Some part of the code is change in order to be able to be integrate... | the_stack_v2_python_sparse | IPC/utils.py | erikmudkip/finalProject | train | 0 | |
c7f0ab379dd4c0aa9429d8c0534a247424771f37 | [
"self.redirect_mode = redirect_mode\nself.domain = domain\nself.error = error\nself.cancel = cancel\nself.success = success\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nredirect_mode = dictionary.get('redirectMode')\ndomain = dictionary.get('domain')\nerror = dic... | <|body_start_0|>
self.redirect_mode = redirect_mode
self.domain = domain
self.error = error
self.cancel = cancel
self.success = success
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return No... | Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you specify iframe on any of the signers</span>) er... | RedirectSettings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RedirectSettings:
"""Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you spe... | stack_v2_sparse_classes_75kplus_train_069511 | 3,342 | permissive | [
{
"docstring": "Constructor for the RedirectSettings class",
"name": "__init__",
"signature": "def __init__(self, redirect_mode=None, domain=None, error=None, cancel=None, success=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictio... | 2 | stack_v2_sparse_classes_30k_train_021207 | Implement the Python class `RedirectSettings` described below.
Class description:
Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span ... | Implement the Python class `RedirectSettings` described below.
Class description:
Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span ... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class RedirectSettings:
"""Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you spe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RedirectSettings:
"""Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you specify iframe o... | the_stack_v2_python_sparse | idfy_rest_client/models/redirect_settings.py | dealflowteam/Idfy | train | 0 |
b55a17e037a0aee7bcd4cd4815730ea27f5a6132 | [
"self.abbr = {}\nself.dic = {}\nfor word in dictionary:\n l = len(word)\n self.dic[word] = 1\n if l <= 2:\n s = word\n else:\n s = word[0] + str(l - 2) + word[-1]\n if s not in self.abbr:\n self.abbr[s] = 1\n else:\n self.abbr[s] += 1",
"l = len(word)\nif l <= 2:\n ... | <|body_start_0|>
self.abbr = {}
self.dic = {}
for word in dictionary:
l = len(word)
self.dic[word] = 1
if l <= 2:
s = word
else:
s = word[0] + str(l - 2) + word[-1]
if s not in self.abbr:
... | ValidWordAbbr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
"""check if a word is unique. :type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_069512 | 1,164 | no_license | [
{
"docstring": "initialize your data structure here. :type dictionary: List[str]",
"name": "__init__",
"signature": "def __init__(self, dictionary)"
},
{
"docstring": "check if a word is unique. :type word: str :rtype: bool",
"name": "isUnique",
"signature": "def isUnique(self, word)"
... | 2 | stack_v2_sparse_classes_30k_train_039955 | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str]
- def isUnique(self, word): check if a word is unique. :type word: str ... | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str]
- def isUnique(self, word): check if a word is unique. :type word: str ... | 6ce22264a9c34d6addf4eff4c196105eec12b113 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
"""check if a word is unique. :type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
self.abbr = {}
self.dic = {}
for word in dictionary:
l = len(word)
self.dic[word] = 1
if l <= 2:
s = word
... | the_stack_v2_python_sparse | Unique_Word_Abbr.py | zhubw91/Leetcode | train | 0 | |
031b9350dd48ce66972107e24f9c14912d9e5340 | [
"l = [1, 0, 2, 1, 1, 2, 0, 0]\nsort_colors(l)\nself.assertEqual(l, [0, 0, 0, 1, 1, 1, 2, 2])",
"l = [0, 1, 2, 1, 0, 0, 2, 2, 1, 1, 0, 0, 1, 0]\nsort_colors(l)\nself.assertEqual(l, [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2])"
] | <|body_start_0|>
l = [1, 0, 2, 1, 1, 2, 0, 0]
sort_colors(l)
self.assertEqual(l, [0, 0, 0, 1, 1, 1, 2, 2])
<|end_body_0|>
<|body_start_1|>
l = [0, 1, 2, 1, 0, 0, 2, 2, 1, 1, 0, 0, 1, 0]
sort_colors(l)
self.assertEqual(l, [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2])
<|end_... | TestSortColors | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSortColors:
def test_sorts_small_list_in_place(self):
"""Takes in a small list and sorts it in place"""
<|body_0|>
def test_sorts_large_list_in_place(self):
"""Takes in a small list and sorts it in place"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_069513 | 614 | permissive | [
{
"docstring": "Takes in a small list and sorts it in place",
"name": "test_sorts_small_list_in_place",
"signature": "def test_sorts_small_list_in_place(self)"
},
{
"docstring": "Takes in a small list and sorts it in place",
"name": "test_sorts_large_list_in_place",
"signature": "def tes... | 2 | null | Implement the Python class `TestSortColors` described below.
Class description:
Implement the TestSortColors class.
Method signatures and docstrings:
- def test_sorts_small_list_in_place(self): Takes in a small list and sorts it in place
- def test_sorts_large_list_in_place(self): Takes in a small list and sorts it i... | Implement the Python class `TestSortColors` described below.
Class description:
Implement the TestSortColors class.
Method signatures and docstrings:
- def test_sorts_small_list_in_place(self): Takes in a small list and sorts it in place
- def test_sorts_large_list_in_place(self): Takes in a small list and sorts it i... | 27ffb6b32d6d18d279c51cfa45bf305a409be5c2 | <|skeleton|>
class TestSortColors:
def test_sorts_small_list_in_place(self):
"""Takes in a small list and sorts it in place"""
<|body_0|>
def test_sorts_large_list_in_place(self):
"""Takes in a small list and sorts it in place"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestSortColors:
def test_sorts_small_list_in_place(self):
"""Takes in a small list and sorts it in place"""
l = [1, 0, 2, 1, 1, 2, 0, 0]
sort_colors(l)
self.assertEqual(l, [0, 0, 0, 1, 1, 1, 2, 2])
def test_sorts_large_list_in_place(self):
"""Takes in a small list ... | the_stack_v2_python_sparse | src/leetcode/medium/sort-colors/test_sort_colors.py | nwthomas/code-challenges | train | 2 | |
a2f9fc983cdafe422cbf301b644333d9b3814ead | [
"self.items = []\nself.items_map = {}\nself.free_index = set()",
"if val not in self.items_map:\n if not self.free_index:\n self.items.append(val)\n self.items_map[val] = len(self.items) - 1\n return True\n else:\n reused_index = self.free_index.pop()\n self.items[reused_i... | <|body_start_0|>
self.items = []
self.items_map = {}
self.free_index = set()
<|end_body_0|>
<|body_start_1|>
if val not in self.items_map:
if not self.free_index:
self.items.append(val)
self.items_map[val] = len(self.items) - 1
... | RandomizedSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val: int) -> bool:
"""Inserts a value to the set. Returns true if the set did not already contain the specified element."""
<|body_1|>
def remove(se... | stack_v2_sparse_classes_75kplus_train_069514 | 6,990 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.",
"name": "insert",
"signature": "def insert(self, val: int) ... | 4 | stack_v2_sparse_classes_30k_train_002087 | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta... | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta... | 2cc179bdb33a97294a2bf99dbda278e935165943 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val: int) -> bool:
"""Inserts a value to the set. Returns true if the set did not already contain the specified element."""
<|body_1|>
def remove(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
self.items = []
self.items_map = {}
self.free_index = set()
def insert(self, val: int) -> bool:
"""Inserts a value to the set. Returns true if the set did not already contain the specifie... | the_stack_v2_python_sparse | leetcode/380.insert-delete-getrandom-o1.py | Zedmor/hackerrank-puzzles | train | 0 | |
f9ccf08687e27a0d8bbe626c4b55b5e847df8a1d | [
"parse_objectid(article_id)\nuid = g.uid\narticle = Article.with_id(article_id)\nif not article:\n raise ArticleError('文章没有找到!')\narticle.modify(inc__favorite=1)\nFavorite.create_favorite(article_id, article.node, article.title, uid)",
"parse_objectid(article_id)\nuid = g.uid\narticle = Article.with_id(article... | <|body_start_0|>
parse_objectid(article_id)
uid = g.uid
article = Article.with_id(article_id)
if not article:
raise ArticleError('文章没有找到!')
article.modify(inc__favorite=1)
Favorite.create_favorite(article_id, article.node, article.title, uid)
<|end_body_0|>
<... | ArticleFavoriteApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArticleFavoriteApi:
def post(self, article_id):
"""@apiVersion 1.0.0 @api {post} /api/favorite/article/:article_id 收藏文章 @apiName ArticleFavoriteApi @apiGroup plaza @apiSuccess {Integer} code 0 @apiUse ArgsError @apiUse ArticleError"""
<|body_0|>
def delete(self, article_id):... | stack_v2_sparse_classes_75kplus_train_069515 | 31,103 | no_license | [
{
"docstring": "@apiVersion 1.0.0 @api {post} /api/favorite/article/:article_id 收藏文章 @apiName ArticleFavoriteApi @apiGroup plaza @apiSuccess {Integer} code 0 @apiUse ArgsError @apiUse ArticleError",
"name": "post",
"signature": "def post(self, article_id)"
},
{
"docstring": "@apiVersion 1.0.0 @a... | 2 | stack_v2_sparse_classes_30k_train_011892 | Implement the Python class `ArticleFavoriteApi` described below.
Class description:
Implement the ArticleFavoriteApi class.
Method signatures and docstrings:
- def post(self, article_id): @apiVersion 1.0.0 @api {post} /api/favorite/article/:article_id 收藏文章 @apiName ArticleFavoriteApi @apiGroup plaza @apiSuccess {Inte... | Implement the Python class `ArticleFavoriteApi` described below.
Class description:
Implement the ArticleFavoriteApi class.
Method signatures and docstrings:
- def post(self, article_id): @apiVersion 1.0.0 @api {post} /api/favorite/article/:article_id 收藏文章 @apiName ArticleFavoriteApi @apiGroup plaza @apiSuccess {Inte... | 4b7fdfe3f2bcf3d3d0e0bc7c687b75991db1f2df | <|skeleton|>
class ArticleFavoriteApi:
def post(self, article_id):
"""@apiVersion 1.0.0 @api {post} /api/favorite/article/:article_id 收藏文章 @apiName ArticleFavoriteApi @apiGroup plaza @apiSuccess {Integer} code 0 @apiUse ArgsError @apiUse ArticleError"""
<|body_0|>
def delete(self, article_id):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArticleFavoriteApi:
def post(self, article_id):
"""@apiVersion 1.0.0 @api {post} /api/favorite/article/:article_id 收藏文章 @apiName ArticleFavoriteApi @apiGroup plaza @apiSuccess {Integer} code 0 @apiUse ArgsError @apiUse ArticleError"""
parse_objectid(article_id)
uid = g.uid
arti... | the_stack_v2_python_sparse | app/modules/plaza/apis.py | geasyheart/git-share | train | 0 | |
9bd6bc7f3c71a2922c13d14a8e955c4dec9c093f | [
"params = self.validated_data\ntask_name = params['task_name']\ntask_params = params.get('task_params')\ntask_handler_func = getattr(AsyncTaskHandler(), task_name)\ntask_id = task_handler_func(**task_params) if task_params else task_handler_func()\nreturn Response({'task_id': task_id})",
"task_id = self.validated... | <|body_start_0|>
params = self.validated_data
task_name = params['task_name']
task_params = params.get('task_params')
task_handler_func = getattr(AsyncTaskHandler(), task_name)
task_id = task_handler_func(**task_params) if task_params else task_handler_func()
return Respo... | SyncTaskViewSet | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyncTaskViewSet:
def create_sync_task(self, request):
"""@api {POST} /sync_task/create/ 创建同步任务 @apiName sync_task_create @apiGroup backend_sync_task"""
<|body_0|>
def status(self, request):
"""@api {GET} /sync_task/status/ 查询同步任务状态 @apiName sync_task_status @apiGroup... | stack_v2_sparse_classes_75kplus_train_069516 | 2,183 | permissive | [
{
"docstring": "@api {POST} /sync_task/create/ 创建同步任务 @apiName sync_task_create @apiGroup backend_sync_task",
"name": "create_sync_task",
"signature": "def create_sync_task(self, request)"
},
{
"docstring": "@api {GET} /sync_task/status/ 查询同步任务状态 @apiName sync_task_status @apiGroup backend_sync_... | 2 | stack_v2_sparse_classes_30k_train_031334 | Implement the Python class `SyncTaskViewSet` described below.
Class description:
Implement the SyncTaskViewSet class.
Method signatures and docstrings:
- def create_sync_task(self, request): @api {POST} /sync_task/create/ 创建同步任务 @apiName sync_task_create @apiGroup backend_sync_task
- def status(self, request): @api {... | Implement the Python class `SyncTaskViewSet` described below.
Class description:
Implement the SyncTaskViewSet class.
Method signatures and docstrings:
- def create_sync_task(self, request): @api {POST} /sync_task/create/ 创建同步任务 @apiName sync_task_create @apiGroup backend_sync_task
- def status(self, request): @api {... | 72d2104783443bff26c752c5bd934a013b302b6d | <|skeleton|>
class SyncTaskViewSet:
def create_sync_task(self, request):
"""@api {POST} /sync_task/create/ 创建同步任务 @apiName sync_task_create @apiGroup backend_sync_task"""
<|body_0|>
def status(self, request):
"""@api {GET} /sync_task/status/ 查询同步任务状态 @apiName sync_task_status @apiGroup... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SyncTaskViewSet:
def create_sync_task(self, request):
"""@api {POST} /sync_task/create/ 创建同步任务 @apiName sync_task_create @apiGroup backend_sync_task"""
params = self.validated_data
task_name = params['task_name']
task_params = params.get('task_params')
task_handler_func... | the_stack_v2_python_sparse | apps/backend/sync_task/views.py | TencentBlueKing/bk-nodeman | train | 54 | |
bf80c67801d65eb072bc9a9a283bc117404d692b | [
"super().__init__(index)\nself.serial = communicator\nself.hex_id = Util.int_to_hex_string(index * 7)\nself.next_color = None\nself.next_text = None",
"del flashing\ndel flash_mask\ncolors = text.get_colors()\nself.next_text = text\nif colors:\n self._set_color(colors)",
"if len(colors) == 1:\n self.next_... | <|body_start_0|>
super().__init__(index)
self.serial = communicator
self.hex_id = Util.int_to_hex_string(index * 7)
self.next_color = None
self.next_text = None
<|end_body_0|>
<|body_start_1|>
del flashing
del flash_mask
colors = text.get_colors()
... | FAST segment display. | FASTSegmentDisplay | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FASTSegmentDisplay:
"""FAST segment display."""
def __init__(self, index, communicator):
"""Initialise alpha numeric display."""
<|body_0|>
def set_text(self, text: ColoredSegmentDisplayText, flashing: FlashingType, flash_mask: str) -> None:
"""Set digits to disp... | stack_v2_sparse_classes_75kplus_train_069517 | 1,467 | permissive | [
{
"docstring": "Initialise alpha numeric display.",
"name": "__init__",
"signature": "def __init__(self, index, communicator)"
},
{
"docstring": "Set digits to display.",
"name": "set_text",
"signature": "def set_text(self, text: ColoredSegmentDisplayText, flashing: FlashingType, flash_m... | 3 | stack_v2_sparse_classes_30k_train_038769 | Implement the Python class `FASTSegmentDisplay` described below.
Class description:
FAST segment display.
Method signatures and docstrings:
- def __init__(self, index, communicator): Initialise alpha numeric display.
- def set_text(self, text: ColoredSegmentDisplayText, flashing: FlashingType, flash_mask: str) -> Non... | Implement the Python class `FASTSegmentDisplay` described below.
Class description:
FAST segment display.
Method signatures and docstrings:
- def __init__(self, index, communicator): Initialise alpha numeric display.
- def set_text(self, text: ColoredSegmentDisplayText, flashing: FlashingType, flash_mask: str) -> Non... | 9f90c8b1586363b65340017bfa3af5d56d32c6d9 | <|skeleton|>
class FASTSegmentDisplay:
"""FAST segment display."""
def __init__(self, index, communicator):
"""Initialise alpha numeric display."""
<|body_0|>
def set_text(self, text: ColoredSegmentDisplayText, flashing: FlashingType, flash_mask: str) -> None:
"""Set digits to disp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FASTSegmentDisplay:
"""FAST segment display."""
def __init__(self, index, communicator):
"""Initialise alpha numeric display."""
super().__init__(index)
self.serial = communicator
self.hex_id = Util.int_to_hex_string(index * 7)
self.next_color = None
self.n... | the_stack_v2_python_sparse | mpf/platforms/fast/fast_segment_display.py | missionpinball/mpf | train | 191 |
5a3bcfc43b5138b5ede90990e58936d3c0786c6c | [
"self.mean_list = []\nself.sd_list = []\nself.p_y_list = []",
"n = len(set(y))\nmean_list = []\nsd_list = []\nindexes = []\np_y_list = []\nfor i in range(n):\n indexes = np.where(y == i)[0]\n X_i = X[indexes]\n means = np.mean(X_i, axis=0)\n mean_list.append(means)\n sds = np.std(X_i, axis=0)\n ... | <|body_start_0|>
self.mean_list = []
self.sd_list = []
self.p_y_list = []
<|end_body_0|>
<|body_start_1|>
n = len(set(y))
mean_list = []
sd_list = []
indexes = []
p_y_list = []
for i in range(n):
indexes = np.where(y == i)[0]
... | Class which contains the implementation of Gaussian Naive Bayes classifier. | MyGNB | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyGNB:
"""Class which contains the implementation of Gaussian Naive Bayes classifier."""
def __init__(self):
"""contains instance variables which are created during model fitting"""
<|body_0|>
def fit(self, X, y):
"""Fits the model on the given input numpy arrays... | stack_v2_sparse_classes_75kplus_train_069518 | 4,282 | no_license | [
{
"docstring": "contains instance variables which are created during model fitting",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Fits the model on the given input numpy arrays Also creates the instance variables: mean_list, sd_list, indexes and p_y_list.",
"name"... | 4 | stack_v2_sparse_classes_30k_train_046976 | Implement the Python class `MyGNB` described below.
Class description:
Class which contains the implementation of Gaussian Naive Bayes classifier.
Method signatures and docstrings:
- def __init__(self): contains instance variables which are created during model fitting
- def fit(self, X, y): Fits the model on the giv... | Implement the Python class `MyGNB` described below.
Class description:
Class which contains the implementation of Gaussian Naive Bayes classifier.
Method signatures and docstrings:
- def __init__(self): contains instance variables which are created during model fitting
- def fit(self, X, y): Fits the model on the giv... | 80362a5896e161cd5ea01a34908b6b9f31bfa1e8 | <|skeleton|>
class MyGNB:
"""Class which contains the implementation of Gaussian Naive Bayes classifier."""
def __init__(self):
"""contains instance variables which are created during model fitting"""
<|body_0|>
def fit(self, X, y):
"""Fits the model on the given input numpy arrays... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyGNB:
"""Class which contains the implementation of Gaussian Naive Bayes classifier."""
def __init__(self):
"""contains instance variables which are created during model fitting"""
self.mean_list = []
self.sd_list = []
self.p_y_list = []
def fit(self, X, y):
... | the_stack_v2_python_sparse | 2018061_HW2/Q4.py | pankilkalra/Machine-Learning-Assignments | train | 0 |
b03ddfda17fb4d746a88ef6ae56c7d0cfce10850 | [
"if cls._consumer is not None:\n raise ClientRestartError()\nkafka_params = config.get('kafka')\nrequired_params = ['bootstrap_servers']\nif kafka_params is None:\n raise ConfigError(\"Missing required 'kafka' key\")\nif not isinstance(kafka_params, dict):\n raise ConfigError(\"Config value for 'kafka' is ... | <|body_start_0|>
if cls._consumer is not None:
raise ClientRestartError()
kafka_params = config.get('kafka')
required_params = ['bootstrap_servers']
if kafka_params is None:
raise ConfigError("Missing required 'kafka' key")
if not isinstance(kafka_params, ... | A client for consuming records from Kafka. | KafkaConsumer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KafkaConsumer:
"""A client for consuming records from Kafka."""
async def start(cls, config: Dict[str, Any]) -> None:
"""Initialize the Kafka consumer resource. Args: config: Params and values for configuring the client. Raises: ClientRestartError: The Kafka consumer resource has alr... | stack_v2_sparse_classes_75kplus_train_069519 | 3,055 | permissive | [
{
"docstring": "Initialize the Kafka consumer resource. Args: config: Params and values for configuring the client. Raises: ClientRestartError: The Kafka consumer resource has already been initialized. ClientRuntimeError: The Kafka consumer resource failed to connect to Kafka. ConfigError: The ``config`` argume... | 4 | stack_v2_sparse_classes_30k_train_017394 | Implement the Python class `KafkaConsumer` described below.
Class description:
A client for consuming records from Kafka.
Method signatures and docstrings:
- async def start(cls, config: Dict[str, Any]) -> None: Initialize the Kafka consumer resource. Args: config: Params and values for configuring the client. Raises... | Implement the Python class `KafkaConsumer` described below.
Class description:
A client for consuming records from Kafka.
Method signatures and docstrings:
- async def start(cls, config: Dict[str, Any]) -> None: Initialize the Kafka consumer resource. Args: config: Params and values for configuring the client. Raises... | 93c0c4bef28c1ed15dc61e9fd340a9faef4902e3 | <|skeleton|>
class KafkaConsumer:
"""A client for consuming records from Kafka."""
async def start(cls, config: Dict[str, Any]) -> None:
"""Initialize the Kafka consumer resource. Args: config: Params and values for configuring the client. Raises: ClientRestartError: The Kafka consumer resource has alr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KafkaConsumer:
"""A client for consuming records from Kafka."""
async def start(cls, config: Dict[str, Any]) -> None:
"""Initialize the Kafka consumer resource. Args: config: Params and values for configuring the client. Raises: ClientRestartError: The Kafka consumer resource has already been ini... | the_stack_v2_python_sparse | tglib/tglib/clients/kafka_consumer.py | terragraph/tgnms | train | 15 |
b448d6cc092c63bdd0ff72f8090c42772998722d | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), username=username)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password, username=username)\nuser.is_admin = True\nuser... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email), username=username)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user ... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, username, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, username, password=None):
"""Creates and saves a superuser with the giv... | stack_v2_sparse_classes_75kplus_train_069520 | 7,948 | no_license | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, username, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"name"... | 2 | stack_v2_sparse_classes_30k_train_028574 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, username, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, email, us... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, username, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, email, us... | 4ab5ca9362f1f57461a9ea1774f8f447e595c82a | <|skeleton|>
class MyUserManager:
def create_user(self, email, username, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, username, password=None):
"""Creates and saves a superuser with the giv... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, email, username, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email), use... | the_stack_v2_python_sparse | sisapp/models.py | T-Phage/SIS | train | 0 | |
00a5a3ffc0610537d707eb4b4b7e1020c796e921 | [
"from collections import defaultdict\ncourseDict = defaultdict(list)\nfor relation in prerequisites:\n nextCourse, prevCourse = (relation[0], relation[1])\n courseDict[prevCourse].append(nextCourse)\nvisited = [False] * numCourses\npath = [False] * numCourses\nfor currCourse in range(numCourses):\n if self... | <|body_start_0|>
from collections import defaultdict
courseDict = defaultdict(list)
for relation in prerequisites:
nextCourse, prevCourse = (relation[0], relation[1])
courseDict[prevCourse].append(nextCourse)
visited = [False] * numCourses
path = [False] *... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def isCyclic(self, currCourse, courseDict, path, visited):
"""backtracking method to check that no cycle would be formed... | stack_v2_sparse_classes_75kplus_train_069521 | 2,170 | no_license | [
{
"docstring": ":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool",
"name": "canFinish",
"signature": "def canFinish(self, numCourses, prerequisites)"
},
{
"docstring": "backtracking method to check that no cycle would be formed starting from currCourse",
"name": "isCyc... | 2 | stack_v2_sparse_classes_30k_train_053296 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool
- def isCyclic(self, currCourse, courseDict, path, visited... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canFinish(self, numCourses, prerequisites): :type numCourses: int :type prerequisites: List[List[int]] :rtype: bool
- def isCyclic(self, currCourse, courseDict, path, visited... | d953abe2c9680f636563e76287d2f907e90ced63 | <|skeleton|>
class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
<|body_0|>
def isCyclic(self, currCourse, courseDict, path, visited):
"""backtracking method to check that no cycle would be formed... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canFinish(self, numCourses, prerequisites):
""":type numCourses: int :type prerequisites: List[List[int]] :rtype: bool"""
from collections import defaultdict
courseDict = defaultdict(list)
for relation in prerequisites:
nextCourse, prevCourse = (relati... | the_stack_v2_python_sparse | python_leetcode_2020/Python_Leetcode_2020/207_course_schedule.py | xiangcao/Leetcode | train | 0 | |
695111f19edf2db79448165f2d966ddb52290b26 | [
"sortedList = []\ncount1 = 0\ncount2 = 0\nwhile count1 < m and count2 < n:\n if nums1[count1] < nums[count2]:\n sortedList.append(nums1[count1])\n count1 += 1\n else:\n sortedList.append(nums2[count1])\n count2 += 1\nwhile count1 < m:\n sortedList.append(nums1[count1])\n coun... | <|body_start_0|>
sortedList = []
count1 = 0
count2 = 0
while count1 < m and count2 < n:
if nums1[count1] < nums[count2]:
sortedList.append(nums1[count1])
count1 += 1
else:
sortedList.append(nums2[count1])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def mergeInPlace(self, nums1, m, nums2, n):
""":type nums1: Lis... | stack_v2_sparse_classes_75kplus_train_069522 | 1,937 | no_license | [
{
"docstring": ":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.",
"name": "merge",
"signature": "def merge(self, nums1, m, nums2, n)"
},
{
"docstring": ":type nums1: List[int] :type m: int :type nums2: Li... | 2 | stack_v2_sparse_classes_30k_train_001628 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.
-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.
-... | 94a35dc3e25ee55530920fd57d7484d24d4abbfb | <|skeleton|>
class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def mergeInPlace(self, nums1, m, nums2, n):
""":type nums1: Lis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def merge(self, nums1, m, nums2, n):
""":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead."""
sortedList = []
count1 = 0
count2 = 0
while count1 < m and count2 < n:
... | the_stack_v2_python_sparse | src/sorts/mergetwosortedarraysinplace.py | DanielHabib/practice_makes_perfect | train | 4 | |
62e57cf58f1117de292104a9251204bba6bc73a0 | [
"vim_suggestions = []\nfor item in data:\n item_base = {'word': item['id'], 'menu': make_title_ascii(item['title'])}\n if bool(int(vim.eval('g:pandoc#completion#bib#use_preview'))):\n item_base['info'] = dict_to_info(item)\n vim_suggestions.append(item_base)\nreturn vim_suggestions",
"query = quer... | <|body_start_0|>
vim_suggestions = []
for item in data:
item_base = {'word': item['id'], 'menu': make_title_ascii(item['title'])}
if bool(int(vim.eval('g:pandoc#completion#bib#use_preview'))):
item_base['info'] = dict_to_info(item)
vim_suggestions.appe... | VimCompleter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VimCompleter:
def parse_suggestions(self, data):
"""Turns the output of the collators get_suggestions() methods into a dict like what vim completion functions use."""
<|body_0|>
def get_suggestions(self, query):
"""Returns a dict with the suggestions available for th... | stack_v2_sparse_classes_75kplus_train_069523 | 2,245 | permissive | [
{
"docstring": "Turns the output of the collators get_suggestions() methods into a dict like what vim completion functions use.",
"name": "parse_suggestions",
"signature": "def parse_suggestions(self, data)"
},
{
"docstring": "Returns a dict with the suggestions available for the given query.",
... | 2 | stack_v2_sparse_classes_30k_train_010890 | Implement the Python class `VimCompleter` described below.
Class description:
Implement the VimCompleter class.
Method signatures and docstrings:
- def parse_suggestions(self, data): Turns the output of the collators get_suggestions() methods into a dict like what vim completion functions use.
- def get_suggestions(s... | Implement the Python class `VimCompleter` described below.
Class description:
Implement the VimCompleter class.
Method signatures and docstrings:
- def parse_suggestions(self, data): Turns the output of the collators get_suggestions() methods into a dict like what vim completion functions use.
- def get_suggestions(s... | d4fc6f8234c37eef16b6de8055c5fe53b7d7316a | <|skeleton|>
class VimCompleter:
def parse_suggestions(self, data):
"""Turns the output of the collators get_suggestions() methods into a dict like what vim completion functions use."""
<|body_0|>
def get_suggestions(self, query):
"""Returns a dict with the suggestions available for th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VimCompleter:
def parse_suggestions(self, data):
"""Turns the output of the collators get_suggestions() methods into a dict like what vim completion functions use."""
vim_suggestions = []
for item in data:
item_base = {'word': item['id'], 'menu': make_title_ascii(item['titl... | the_stack_v2_python_sparse | python3/vim_pandoc/bib/vim_completer.py | vim-pandoc/vim-pandoc | train | 966 | |
0fb98998ddaeef5c4bbfdb856d3133c142f8a643 | [
"pk = kwargs.get('pk')\nobject = self.model.objects.filter(id=pk).first()\nif check_can_edit(object.qapp_approval.qapp, request.user):\n return render(request, self.template_name, {'object': object, 'form': self.form_class(instance=object), 'qapp_id': object.qapp_approval.qapp.id})\nreason = 'You cannot edit thi... | <|body_start_0|>
pk = kwargs.get('pk')
object = self.model.objects.filter(id=pk).first()
if check_can_edit(object.qapp_approval.qapp, request.user):
return render(request, self.template_name, {'object': object, 'form': self.form_class(instance=object), 'qapp_id': object.qapp_approval... | Class view for editing approval signatures. | ProjectApprovalSignatureEdit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectApprovalSignatureEdit:
"""Class view for editing approval signatures."""
def get(self, request, *args, **kwargs):
"""Override default GET request. Verify the user has edit privileges, either through super status or team membership."""
<|body_0|>
def post(self, req... | stack_v2_sparse_classes_75kplus_train_069524 | 36,787 | no_license | [
{
"docstring": "Override default GET request. Verify the user has edit privileges, either through super status or team membership.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Process the post request with a modified Existing Data form.",
"name":... | 2 | stack_v2_sparse_classes_30k_train_031524 | Implement the Python class `ProjectApprovalSignatureEdit` described below.
Class description:
Class view for editing approval signatures.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override default GET request. Verify the user has edit privileges, either through super status or team ... | Implement the Python class `ProjectApprovalSignatureEdit` described below.
Class description:
Class view for editing approval signatures.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override default GET request. Verify the user has edit privileges, either through super status or team ... | ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4 | <|skeleton|>
class ProjectApprovalSignatureEdit:
"""Class view for editing approval signatures."""
def get(self, request, *args, **kwargs):
"""Override default GET request. Verify the user has edit privileges, either through super status or team membership."""
<|body_0|>
def post(self, req... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectApprovalSignatureEdit:
"""Class view for editing approval signatures."""
def get(self, request, *args, **kwargs):
"""Override default GET request. Verify the user has edit privileges, either through super status or team membership."""
pk = kwargs.get('pk')
object = self.mod... | the_stack_v2_python_sparse | DataSearch/qar5/views.py | USEPA/FoodWaste | train | 1 |
ca88143790f633f8a79d8832e1d100e312f192c4 | [
"if any([x.product_id.tracking != 'none' and (not x.lot_id) and (not float_is_zero(x.qty_done, precision_rounding=x.product_uom_id.rounding)) for x in self.produce_line_ids]):\n raise UserError(_('Some products are tracked by lots but no lot is set.'))\nif self.product_tracking != 'none' and (not self.lot_id):\n... | <|body_start_0|>
if any([x.product_id.tracking != 'none' and (not x.lot_id) and (not float_is_zero(x.qty_done, precision_rounding=x.product_uom_id.rounding)) for x in self.produce_line_ids]):
raise UserError(_('Some products are tracked by lots but no lot is set.'))
if self.product_tracking ... | MrpProductProduce | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MrpProductProduce:
def do_produce(self):
"""Override do_produce method on MRP to generate lot_id automatically"""
<|body_0|>
def _onchange_product_qty(self):
"""Override _onchange_product_qty method on MRP to remove duplicate rows caused by split procurement rules"""... | stack_v2_sparse_classes_75kplus_train_069525 | 2,032 | no_license | [
{
"docstring": "Override do_produce method on MRP to generate lot_id automatically",
"name": "do_produce",
"signature": "def do_produce(self)"
},
{
"docstring": "Override _onchange_product_qty method on MRP to remove duplicate rows caused by split procurement rules",
"name": "_onchange_produ... | 2 | null | Implement the Python class `MrpProductProduce` described below.
Class description:
Implement the MrpProductProduce class.
Method signatures and docstrings:
- def do_produce(self): Override do_produce method on MRP to generate lot_id automatically
- def _onchange_product_qty(self): Override _onchange_product_qty metho... | Implement the Python class `MrpProductProduce` described below.
Class description:
Implement the MrpProductProduce class.
Method signatures and docstrings:
- def do_produce(self): Override do_produce method on MRP to generate lot_id automatically
- def _onchange_product_qty(self): Override _onchange_product_qty metho... | c04e2b9730db07848c153d8245d2df65ec4e2c8f | <|skeleton|>
class MrpProductProduce:
def do_produce(self):
"""Override do_produce method on MRP to generate lot_id automatically"""
<|body_0|>
def _onchange_product_qty(self):
"""Override _onchange_product_qty method on MRP to remove duplicate rows caused by split procurement rules"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MrpProductProduce:
def do_produce(self):
"""Override do_produce method on MRP to generate lot_id automatically"""
if any([x.product_id.tracking != 'none' and (not x.lot_id) and (not float_is_zero(x.qty_done, precision_rounding=x.product_uom_id.rounding)) for x in self.produce_line_ids]):
... | the_stack_v2_python_sparse | altinkaya_stock_lot/wizards/mrp_product_produce.py | aaltinisik/customaddons | train | 15 | |
15bfd31d9dbcce5e0a699edcd4a11fa74d5e3791 | [
"str = 'SuperWoMan'\ncount = 0\nvowel = set(list('aeiou'))\nfor i in str:\n for j in vowel:\n if i == j:\n count += 1\nprint(count)",
"str = 'SuperWoMan'\nstr1 = 'IronMans'\nprint(list(set(str) & set(str1)))\nprint(set(str).intersection(set(str1)))",
"str = 'HulkHogan'\nstr1 = 'Hulk'\nprint... | <|body_start_0|>
str = 'SuperWoMan'
count = 0
vowel = set(list('aeiou'))
for i in str:
for j in vowel:
if i == j:
count += 1
print(count)
<|end_body_0|>
<|body_start_1|>
str = 'SuperWoMan'
str1 = 'IronMans'
... | setprogs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class setprogs:
def num_vowels(self):
"""Python Program to Count the Number of Vowels Present in a String using Sets"""
<|body_0|>
def common_letters(self):
"""Python Program to Check Common Letters in Two Input Strings"""
<|body_1|>
def lettrs_not_in_2string(... | stack_v2_sparse_classes_75kplus_train_069526 | 1,639 | no_license | [
{
"docstring": "Python Program to Count the Number of Vowels Present in a String using Sets",
"name": "num_vowels",
"signature": "def num_vowels(self)"
},
{
"docstring": "Python Program to Check Common Letters in Two Input Strings",
"name": "common_letters",
"signature": "def common_lett... | 5 | stack_v2_sparse_classes_30k_test_001496 | Implement the Python class `setprogs` described below.
Class description:
Implement the setprogs class.
Method signatures and docstrings:
- def num_vowels(self): Python Program to Count the Number of Vowels Present in a String using Sets
- def common_letters(self): Python Program to Check Common Letters in Two Input ... | Implement the Python class `setprogs` described below.
Class description:
Implement the setprogs class.
Method signatures and docstrings:
- def num_vowels(self): Python Program to Count the Number of Vowels Present in a String using Sets
- def common_letters(self): Python Program to Check Common Letters in Two Input ... | 8b6e1797811353ceb934f0cad77c654a603dba6e | <|skeleton|>
class setprogs:
def num_vowels(self):
"""Python Program to Count the Number of Vowels Present in a String using Sets"""
<|body_0|>
def common_letters(self):
"""Python Program to Check Common Letters in Two Input Strings"""
<|body_1|>
def lettrs_not_in_2string(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class setprogs:
def num_vowels(self):
"""Python Program to Count the Number of Vowels Present in a String using Sets"""
str = 'SuperWoMan'
count = 0
vowel = set(list('aeiou'))
for i in str:
for j in vowel:
if i == j:
count += 1
... | the_stack_v2_python_sparse | sanfoundry.com/sanFoundrySet.py | TanmayNakhate/headFirstPython | train | 0 | |
bf85f25e540c2ec927089e40f668f0f160bca552 | [
"super(AuxiliaryHead, self).__init__()\ns = input_size - 5\nself.features = nn.Sequential(nn.ReLU(inplace=True), nn.AvgPool2d(5, stride=s, padding=0, count_include_pad=False), nn.Conv2d(C, 128, 1, bias=False), nn.BatchNorm2d(128), nn.ReLU(inplace=True), nn.Conv2d(128, 768, 2, bias=False), nn.BatchNorm2d(768), nn.Re... | <|body_start_0|>
super(AuxiliaryHead, self).__init__()
s = input_size - 5
self.features = nn.Sequential(nn.ReLU(inplace=True), nn.AvgPool2d(5, stride=s, padding=0, count_include_pad=False), nn.Conv2d(C, 128, 1, bias=False), nn.BatchNorm2d(128), nn.ReLU(inplace=True), nn.Conv2d(128, 768, 2, bias=... | Auxiliary Head of Network. :param C: input channels :type C: int :param num_classes: numbers of classes :type num_classes: int :param input_size: input size :type input_size: int | AuxiliaryHead | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuxiliaryHead:
"""Auxiliary Head of Network. :param C: input channels :type C: int :param num_classes: numbers of classes :type num_classes: int :param input_size: input size :type input_size: int"""
def __init__(self, C, num_classes, input_size):
"""Init AuxiliaryHead."""
<|... | stack_v2_sparse_classes_75kplus_train_069527 | 6,558 | permissive | [
{
"docstring": "Init AuxiliaryHead.",
"name": "__init__",
"signature": "def __init__(self, C, num_classes, input_size)"
},
{
"docstring": "Forward function of Auxiliary Head.",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012844 | Implement the Python class `AuxiliaryHead` described below.
Class description:
Auxiliary Head of Network. :param C: input channels :type C: int :param num_classes: numbers of classes :type num_classes: int :param input_size: input size :type input_size: int
Method signatures and docstrings:
- def __init__(self, C, nu... | Implement the Python class `AuxiliaryHead` described below.
Class description:
Auxiliary Head of Network. :param C: input channels :type C: int :param num_classes: numbers of classes :type num_classes: int :param input_size: input size :type input_size: int
Method signatures and docstrings:
- def __init__(self, C, nu... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class AuxiliaryHead:
"""Auxiliary Head of Network. :param C: input channels :type C: int :param num_classes: numbers of classes :type num_classes: int :param input_size: input size :type input_size: int"""
def __init__(self, C, num_classes, input_size):
"""Init AuxiliaryHead."""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AuxiliaryHead:
"""Auxiliary Head of Network. :param C: input channels :type C: int :param num_classes: numbers of classes :type num_classes: int :param input_size: input size :type input_size: int"""
def __init__(self, C, num_classes, input_size):
"""Init AuxiliaryHead."""
super(Auxiliary... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/fine_grained_space/operators/darts.py | Huawei-Ascend/modelzoo | train | 1 |
7801b3aaae8697fbecefa67ff10b693f2ebd2c5f | [
"left = 0\nright = len(s) - 1\nwhile left < right:\n if not s[left].isalnum():\n left += 1\n continue\n if not s[right].isalnum():\n right -= 1\n continue\n if s[left].lower() != s[right].lower():\n return False\n left += 1\n right -= 1\nreturn True",
"if not s:\n... | <|body_start_0|>
left = 0
right = len(s) - 1
while left < right:
if not s[left].isalnum():
left += 1
continue
if not s[right].isalnum():
right -= 1
continue
if s[left].lower() != s[right].lower():... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isPalindrome_builtin(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
left = 0
right = len(s) - 1
while left < ... | stack_v2_sparse_classes_75kplus_train_069528 | 1,692 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "isPalindrome_builtin",
"signature": "def isPalindrome_builtin(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s: str :rtype: bool
- def isPalindrome_builtin(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s: str :rtype: bool
- def isPalindrome_builtin(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def isPalindrome(self, s):
... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isPalindrome_builtin(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, s):
""":type s: str :rtype: bool"""
left = 0
right = len(s) - 1
while left < right:
if not s[left].isalnum():
left += 1
continue
if not s[right].isalnum():
right -= 1
... | the_stack_v2_python_sparse | src/lt_125.py | oxhead/CodingYourWay | train | 0 | |
73ccc20018fe459a5e0fe7d877491ba1f98ced4f | [
"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... | Manages long-running operations with an API service. When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface to receive the real response asynchronously by polling the operation resource, or pass... | OperationsServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OperationsServicer:
"""Manages long-running operations with an API service. When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface to receive the real response asynchronou... | stack_v2_sparse_classes_75kplus_train_069529 | 14,464 | permissive | [
{
"docstring": "Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to override the binding to use different resource name schemes, such as `users/*/operations`. To override the bindi... | 5 | null | Implement the Python class `OperationsServicer` described below.
Class description:
Manages long-running operations with an API service. When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface t... | Implement the Python class `OperationsServicer` described below.
Class description:
Manages long-running operations with an API service. When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface t... | 78138cc66635cffd239820e1d33b6d364ab118c7 | <|skeleton|>
class OperationsServicer:
"""Manages long-running operations with an API service. When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface to receive the real response asynchronou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OperationsServicer:
"""Manages long-running operations with an API service. When an API method normally takes long time to complete, it can be designed to return [Operation][google.longrunning.Operation] to the client, and the client can use this interface to receive the real response asynchronously by pollin... | the_stack_v2_python_sparse | google/longrunning/operations_pb2_grpc.py | googleapis/python-api-common-protos | train | 14 |
7ec9040839213406891d9d64e37c8e5e71bc7110 | [
"gD = self.geoDraw = geoDraw\nself.image = self.image.copy()\nself.ulLat = self.ulLat\nself.ulLong = self.ulLong\nself.lrLat = self.lrLat\nself.lrLong = self.lrLong\nself.ulmx = self.ulmx\nself.ulmy = self.ulmy\nself.lrmx = self.lrmx\nself.lrmy = self.lrmy\nself.long_width = self.long_width\nself.lat_height = self.... | <|body_start_0|>
gD = self.geoDraw = geoDraw
self.image = self.image.copy()
self.ulLat = self.ulLat
self.ulLong = self.ulLong
self.lrLat = self.lrLat
self.lrLong = self.lrLong
self.ulmx = self.ulmx
self.ulmy = self.ulmy
self.lrmx = self.lrmx
... | GeoDrawMapState | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeoDrawMapState:
def __init__(self, geoDraw):
"""map state control :geoDraw: geoDraw instancemethod"""
<|body_0|>
def setState(self):
"""set / reset map State"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
gD = self.geoDraw = geoDraw
self.i... | stack_v2_sparse_classes_75kplus_train_069530 | 1,493 | no_license | [
{
"docstring": "map state control :geoDraw: geoDraw instancemethod",
"name": "__init__",
"signature": "def __init__(self, geoDraw)"
},
{
"docstring": "set / reset map State",
"name": "setState",
"signature": "def setState(self)"
}
] | 2 | null | Implement the Python class `GeoDrawMapState` described below.
Class description:
Implement the GeoDrawMapState class.
Method signatures and docstrings:
- def __init__(self, geoDraw): map state control :geoDraw: geoDraw instancemethod
- def setState(self): set / reset map State | Implement the Python class `GeoDrawMapState` described below.
Class description:
Implement the GeoDrawMapState class.
Method signatures and docstrings:
- def __init__(self, geoDraw): map state control :geoDraw: geoDraw instancemethod
- def setState(self): set / reset map State
<|skeleton|>
class GeoDrawMapState:
... | 53e5f1e9186d8cb24003f484d508abd72897bcf3 | <|skeleton|>
class GeoDrawMapState:
def __init__(self, geoDraw):
"""map state control :geoDraw: geoDraw instancemethod"""
<|body_0|>
def setState(self):
"""set / reset map State"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GeoDrawMapState:
def __init__(self, geoDraw):
"""map state control :geoDraw: geoDraw instancemethod"""
gD = self.geoDraw = geoDraw
self.image = self.image.copy()
self.ulLat = self.ulLat
self.ulLong = self.ulLong
self.lrLat = self.lrLat
self.lrLong = self... | the_stack_v2_python_sparse | src/GeoDrawMapState.py | raysmith619/PlantInvasion | train | 0 | |
8f9e7639125922045cbbae9860f77d12dd672bcb | [
"RESTFormatter.__init__(self, config)\nmimes = {'text/json+das': self.dasjson, 'application/xml+das': self.xml, 'application/plist': self.plist}\nself.supporttypes.update(mimes)",
"start_time = request.time\nresults = data\ncall_time = time.time() - start_time\nres_expire = make_timestamp(expires)\nkeyhash = hash... | <|body_start_0|>
RESTFormatter.__init__(self, config)
mimes = {'text/json+das': self.dasjson, 'application/xml+das': self.xml, 'application/plist': self.plist}
self.supporttypes.update(mimes)
<|end_body_0|>
<|body_start_1|>
start_time = request.time
results = data
call_t... | A REST formatter that appends the DAS headers to the result data | DASRESTFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DASRESTFormatter:
"""A REST formatter that appends the DAS headers to the result data"""
def __init__(self, config):
"""Initialise the formatter and set the mime types it supports"""
<|body_0|>
def runDas(self, data, expires):
"""Run a query and produce a diction... | stack_v2_sparse_classes_75kplus_train_069531 | 2,821 | no_license | [
{
"docstring": "Initialise the formatter and set the mime types it supports",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Run a query and produce a dictionary for DAS formatting",
"name": "runDas",
"signature": "def runDas(self, data, expires)"
},
... | 5 | stack_v2_sparse_classes_30k_train_004406 | Implement the Python class `DASRESTFormatter` described below.
Class description:
A REST formatter that appends the DAS headers to the result data
Method signatures and docstrings:
- def __init__(self, config): Initialise the formatter and set the mime types it supports
- def runDas(self, data, expires): Run a query ... | Implement the Python class `DASRESTFormatter` described below.
Class description:
A REST formatter that appends the DAS headers to the result data
Method signatures and docstrings:
- def __init__(self, config): Initialise the formatter and set the mime types it supports
- def runDas(self, data, expires): Run a query ... | f4cb398de940560e40491ba676b704e1489d4682 | <|skeleton|>
class DASRESTFormatter:
"""A REST formatter that appends the DAS headers to the result data"""
def __init__(self, config):
"""Initialise the formatter and set the mime types it supports"""
<|body_0|>
def runDas(self, data, expires):
"""Run a query and produce a diction... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DASRESTFormatter:
"""A REST formatter that appends the DAS headers to the result data"""
def __init__(self, config):
"""Initialise the formatter and set the mime types it supports"""
RESTFormatter.__init__(self, config)
mimes = {'text/json+das': self.dasjson, 'application/xml+das'... | the_stack_v2_python_sparse | src/python/WMCore/WebTools/DASRESTFormatter.py | PerilousApricot/WMCore | train | 1 |
3308ec4b5d3ea330b692d858dbf03ef8fbd3634c | [
"self.basis_ref_domain = basis_ref_domain\nself.n = self.basis_ref_domain.n\nself.mass_matrix_ref_domain = self.get_mass_matrix()\nself.mass_derivative_matrix_ref_domain = self.get_mass_derivative_matrix()",
"n = self.n\nM = numpy.zeros((n, n))\nfunction_space_Vh = self.basis_ref_domain.basis_functions\nquadratur... | <|body_start_0|>
self.basis_ref_domain = basis_ref_domain
self.n = self.basis_ref_domain.n
self.mass_matrix_ref_domain = self.get_mass_matrix()
self.mass_derivative_matrix_ref_domain = self.get_mass_derivative_matrix()
<|end_body_0|>
<|body_start_1|>
n = self.n
M = numpy... | Class for holding all there reference element information. This will hold data that is essentially common for every element that has this reference element | ReferenceElement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReferenceElement:
"""Class for holding all there reference element information. This will hold data that is essentially common for every element that has this reference element"""
def __init__(self, basis_ref_domain):
"""Constructor for the ReferenceElement class :param basis_ref_dom... | stack_v2_sparse_classes_75kplus_train_069532 | 5,064 | no_license | [
{
"docstring": "Constructor for the ReferenceElement class :param basis_ref_domain: The Basis class object. Should have member variables for the basis_functions and derivative_basis_functions. Should also have the basis defined on the reference domain.",
"name": "__init__",
"signature": "def __init__(se... | 5 | null | Implement the Python class `ReferenceElement` described below.
Class description:
Class for holding all there reference element information. This will hold data that is essentially common for every element that has this reference element
Method signatures and docstrings:
- def __init__(self, basis_ref_domain): Constr... | Implement the Python class `ReferenceElement` described below.
Class description:
Class for holding all there reference element information. This will hold data that is essentially common for every element that has this reference element
Method signatures and docstrings:
- def __init__(self, basis_ref_domain): Constr... | 192ab072add2f50a14612aead34594721d6dae4e | <|skeleton|>
class ReferenceElement:
"""Class for holding all there reference element information. This will hold data that is essentially common for every element that has this reference element"""
def __init__(self, basis_ref_domain):
"""Constructor for the ReferenceElement class :param basis_ref_dom... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReferenceElement:
"""Class for holding all there reference element information. This will hold data that is essentially common for every element that has this reference element"""
def __init__(self, basis_ref_domain):
"""Constructor for the ReferenceElement class :param basis_ref_domain: The Basi... | the_stack_v2_python_sparse | element.py | manmeetb/IGA-DG | train | 0 |
e3f19dee66af13dd63225ef92f509635aee5f89c | [
"self._on_off_channel = None\nself._state = None\nsuper().__init__(*args, **kwargs)",
"if self._state is None:\n return False\nreturn self._state",
"result = await self._on_off_channel.on()\nif not isinstance(result, list) or result[1] is not Status.SUCCESS:\n return\nself._state = True\nself.async_write_... | <|body_start_0|>
self._on_off_channel = None
self._state = None
super().__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
if self._state is None:
return False
return self._state
<|end_body_1|>
<|body_start_2|>
result = await self._on_off_channel.on()... | Common base class for zha switches. | BaseSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseSwitch:
"""Common base class for zha switches."""
def __init__(self, *args, **kwargs):
"""Initialize the ZHA switch."""
<|body_0|>
def is_on(self) -> bool:
"""Return if the switch is on based on the statemachine."""
<|body_1|>
async def async_tur... | stack_v2_sparse_classes_75kplus_train_069533 | 4,645 | permissive | [
{
"docstring": "Initialize the ZHA switch.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Return if the switch is on based on the statemachine.",
"name": "is_on",
"signature": "def is_on(self) -> bool"
},
{
"docstring": "Turn the entit... | 4 | null | Implement the Python class `BaseSwitch` described below.
Class description:
Common base class for zha switches.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize the ZHA switch.
- def is_on(self) -> bool: Return if the switch is on based on the statemachine.
- async def async_turn_on... | Implement the Python class `BaseSwitch` described below.
Class description:
Common base class for zha switches.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize the ZHA switch.
- def is_on(self) -> bool: Return if the switch is on based on the statemachine.
- async def async_turn_on... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class BaseSwitch:
"""Common base class for zha switches."""
def __init__(self, *args, **kwargs):
"""Initialize the ZHA switch."""
<|body_0|>
def is_on(self) -> bool:
"""Return if the switch is on based on the statemachine."""
<|body_1|>
async def async_tur... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseSwitch:
"""Common base class for zha switches."""
def __init__(self, *args, **kwargs):
"""Initialize the ZHA switch."""
self._on_off_channel = None
self._state = None
super().__init__(*args, **kwargs)
def is_on(self) -> bool:
"""Return if the switch is on ... | the_stack_v2_python_sparse | homeassistant/components/zha/switch.py | BenWoodford/home-assistant | train | 11 |
28658cda49c965f5add0ab92473812c45c28d8e7 | [
"self.label = label\nself.paths = paths\nif self.paths is None:\n self.paths = {}\nself.reset()",
"str_ = \"Vertex '{label}' - visited: {visited}, parent: {parent}, cost: {cost}\\n\"\nstr_ += ' paths: {paths}'\nreturn str_.format(**self.__dict__)",
"self.visited = False\nself.parent = None\nself.cost = No... | <|body_start_0|>
self.label = label
self.paths = paths
if self.paths is None:
self.paths = {}
self.reset()
<|end_body_0|>
<|body_start_1|>
str_ = "Vertex '{label}' - visited: {visited}, parent: {parent}, cost: {cost}\n"
str_ += ' paths: {paths}'
re... | A graph vertex with a set of paths to other vertices. A vertex is characterized by a label (or name) and a dictionary of paths from the vertex to other vertices. For application of Dijkstra's algorithm for calculating the shortest path from any vertex to all other vertices, each vertex also has the 'visited', 'parent' ... | Vertex | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vertex:
"""A graph vertex with a set of paths to other vertices. A vertex is characterized by a label (or name) and a dictionary of paths from the vertex to other vertices. For application of Dijkstra's algorithm for calculating the shortest path from any vertex to all other vertices, each vertex... | stack_v2_sparse_classes_75kplus_train_069534 | 15,275 | no_license | [
{
"docstring": "Create a new vertex.",
"name": "__init__",
"signature": "def __init__(self, label, paths=None)"
},
{
"docstring": "Format the vertex as a string.",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Reset the vertex to its default values. This ... | 3 | stack_v2_sparse_classes_30k_train_005250 | Implement the Python class `Vertex` described below.
Class description:
A graph vertex with a set of paths to other vertices. A vertex is characterized by a label (or name) and a dictionary of paths from the vertex to other vertices. For application of Dijkstra's algorithm for calculating the shortest path from any ve... | Implement the Python class `Vertex` described below.
Class description:
A graph vertex with a set of paths to other vertices. A vertex is characterized by a label (or name) and a dictionary of paths from the vertex to other vertices. For application of Dijkstra's algorithm for calculating the shortest path from any ve... | c80ea145c758f3b392f956e4311f11cfc099a149 | <|skeleton|>
class Vertex:
"""A graph vertex with a set of paths to other vertices. A vertex is characterized by a label (or name) and a dictionary of paths from the vertex to other vertices. For application of Dijkstra's algorithm for calculating the shortest path from any vertex to all other vertices, each vertex... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vertex:
"""A graph vertex with a set of paths to other vertices. A vertex is characterized by a label (or name) and a dictionary of paths from the vertex to other vertices. For application of Dijkstra's algorithm for calculating the shortest path from any vertex to all other vertices, each vertex also has the... | the_stack_v2_python_sparse | dailyprogrammer/challenges/038e.py | UltimateTimmeh/r-daily-programmer | train | 0 |
3f5f61093ff089e84bcf992944928bf871f43e26 | [
"count = [0]\nself.dfs(root, sum, 0, {}, count)\nreturn count[0]",
"if not root:\n return\ncur_sum += root.val\ndiff = cur_sum - sum\nif diff in prefix_sum:\n count[0] += prefix_sum[diff]\nif diff == 0:\n count[0] += 1\nprefix_sum[cur_sum] = prefix_sum.get(cur_sum, 0) + 1\nself.dfs(root.left, sum, cur_su... | <|body_start_0|>
count = [0]
self.dfs(root, sum, 0, {}, count)
return count[0]
<|end_body_0|>
<|body_start_1|>
if not root:
return
cur_sum += root.val
diff = cur_sum - sum
if diff in prefix_sum:
count[0] += prefix_sum[diff]
if diff... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root, sum):
"""Brute force: two dfs, O(n^2) Prefix sum in Tree, starting from root - O(n) :type root: TreeNode :type sum: int :rtype: int"""
<|body_0|>
def dfs(self, root, sum, cur_sum, prefix_sum, count):
"""Root to node sum prefix_sum: D... | stack_v2_sparse_classes_75kplus_train_069535 | 1,573 | permissive | [
{
"docstring": "Brute force: two dfs, O(n^2) Prefix sum in Tree, starting from root - O(n) :type root: TreeNode :type sum: int :rtype: int",
"name": "pathSum",
"signature": "def pathSum(self, root, sum)"
},
{
"docstring": "Root to node sum prefix_sum: Dict[int, int], sum -> count",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_005796 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, sum): Brute force: two dfs, O(n^2) Prefix sum in Tree, starting from root - O(n) :type root: TreeNode :type sum: int :rtype: int
- def dfs(self, root, sum... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, sum): Brute force: two dfs, O(n^2) Prefix sum in Tree, starting from root - O(n) :type root: TreeNode :type sum: int :rtype: int
- def dfs(self, root, sum... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Solution:
def pathSum(self, root, sum):
"""Brute force: two dfs, O(n^2) Prefix sum in Tree, starting from root - O(n) :type root: TreeNode :type sum: int :rtype: int"""
<|body_0|>
def dfs(self, root, sum, cur_sum, prefix_sum, count):
"""Root to node sum prefix_sum: D... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def pathSum(self, root, sum):
"""Brute force: two dfs, O(n^2) Prefix sum in Tree, starting from root - O(n) :type root: TreeNode :type sum: int :rtype: int"""
count = [0]
self.dfs(root, sum, 0, {}, count)
return count[0]
def dfs(self, root, sum, cur_sum, prefix_s... | the_stack_v2_python_sparse | 437 Path Sum III.py | Aminaba123/LeetCode | train | 1 | |
00f9e85aafb17690211fd1d756a8fb0bf0aeeec0 | [
"status = ErrorCode.SUCCESS\ntry:\n sms_options = QueryHelper.get_sms_option(self.current_user.uid, self.db)\n self.write_ret(status, dict_=dict(sms_options=sms_options))\nexcept Exception as e:\n logging.exception('[UWEB] uid:%s tid:%s get SMS Options failed. Exception: %s', e.args)\n status = ErrorCod... | <|body_start_0|>
status = ErrorCode.SUCCESS
try:
sms_options = QueryHelper.get_sms_option(self.current_user.uid, self.db)
self.write_ret(status, dict_=dict(sms_options=sms_options))
except Exception as e:
logging.exception('[UWEB] uid:%s tid:%s get SMS Options... | SMSOption: login/powerlow/poweroff/illegalmove/sos/heartbeat_lost 1: send 0: not send | SMSOptionHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SMSOptionHandler:
"""SMSOption: login/powerlow/poweroff/illegalmove/sos/heartbeat_lost 1: send 0: not send"""
def get(self):
"""Display smsoption of current user."""
<|body_0|>
def put(self):
"""Modify smsoptions for current user."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus_train_069536 | 6,583 | no_license | [
{
"docstring": "Display smsoption of current user.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Modify smsoptions for current user.",
"name": "put",
"signature": "def put(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054758 | Implement the Python class `SMSOptionHandler` described below.
Class description:
SMSOption: login/powerlow/poweroff/illegalmove/sos/heartbeat_lost 1: send 0: not send
Method signatures and docstrings:
- def get(self): Display smsoption of current user.
- def put(self): Modify smsoptions for current user. | Implement the Python class `SMSOptionHandler` described below.
Class description:
SMSOption: login/powerlow/poweroff/illegalmove/sos/heartbeat_lost 1: send 0: not send
Method signatures and docstrings:
- def get(self): Display smsoption of current user.
- def put(self): Modify smsoptions for current user.
<|skeleton... | 3b095a325581b1fc48497c234f0ad55e928586a1 | <|skeleton|>
class SMSOptionHandler:
"""SMSOption: login/powerlow/poweroff/illegalmove/sos/heartbeat_lost 1: send 0: not send"""
def get(self):
"""Display smsoption of current user."""
<|body_0|>
def put(self):
"""Modify smsoptions for current user."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SMSOptionHandler:
"""SMSOption: login/powerlow/poweroff/illegalmove/sos/heartbeat_lost 1: send 0: not send"""
def get(self):
"""Display smsoption of current user."""
status = ErrorCode.SUCCESS
try:
sms_options = QueryHelper.get_sms_option(self.current_user.uid, self.db... | the_stack_v2_python_sparse | apps/uweb/handlers/smsoption.py | jcsy521/ydws | train | 0 |
aeb3ab99d75b26bd66743ad4a6bee3666807a4ab | [
"from part.models import Part\nfrom stock.models import StockItem, StockLocation\nself.assertEqual(Part.barcode_model_type(), 'part')\nself.assertEqual(StockItem.barcode_model_type(), 'stockitem')\nself.assertEqual(StockLocation.barcode_model_type(), 'stocklocation')",
"hashing_tests = {'abcdefg': '7ac66c0f148de9... | <|body_start_0|>
from part.models import Part
from stock.models import StockItem, StockLocation
self.assertEqual(Part.barcode_model_type(), 'part')
self.assertEqual(StockItem.barcode_model_type(), 'stockitem')
self.assertEqual(StockLocation.barcode_model_type(), 'stocklocation')
... | Tests for the InvenTreeBarcodeMixin mixin class | BarcodeMixinTest | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BarcodeMixinTest:
"""Tests for the InvenTreeBarcodeMixin mixin class"""
def test_barcode_model_type(self):
"""Test that the barcode_model_type property works for each class"""
<|body_0|>
def test_bacode_hash(self):
"""Test that the barcode hashing function provid... | stack_v2_sparse_classes_75kplus_train_069537 | 41,191 | permissive | [
{
"docstring": "Test that the barcode_model_type property works for each class",
"name": "test_barcode_model_type",
"signature": "def test_barcode_model_type(self)"
},
{
"docstring": "Test that the barcode hashing function provides correct results",
"name": "test_bacode_hash",
"signature... | 2 | stack_v2_sparse_classes_30k_train_000665 | Implement the Python class `BarcodeMixinTest` described below.
Class description:
Tests for the InvenTreeBarcodeMixin mixin class
Method signatures and docstrings:
- def test_barcode_model_type(self): Test that the barcode_model_type property works for each class
- def test_bacode_hash(self): Test that the barcode ha... | Implement the Python class `BarcodeMixinTest` described below.
Class description:
Tests for the InvenTreeBarcodeMixin mixin class
Method signatures and docstrings:
- def test_barcode_model_type(self): Test that the barcode_model_type property works for each class
- def test_bacode_hash(self): Test that the barcode ha... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class BarcodeMixinTest:
"""Tests for the InvenTreeBarcodeMixin mixin class"""
def test_barcode_model_type(self):
"""Test that the barcode_model_type property works for each class"""
<|body_0|>
def test_bacode_hash(self):
"""Test that the barcode hashing function provid... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BarcodeMixinTest:
"""Tests for the InvenTreeBarcodeMixin mixin class"""
def test_barcode_model_type(self):
"""Test that the barcode_model_type property works for each class"""
from part.models import Part
from stock.models import StockItem, StockLocation
self.assertEqual(P... | the_stack_v2_python_sparse | InvenTree/InvenTree/tests.py | inventree/InvenTree | train | 3,077 |
66ccda5dd0103e2eeb30a221ab1c5913864098df | [
"backlog_name = ticket.values['backlog']\nif backlog_name != NO_BACKLOG:\n Backlog(self.env, name=backlog_name).add_ticket(ticket.id)",
"backlog_name = ticket.values.get('backlog', NO_BACKLOG)\nif 'backlog' in old_values.keys():\n if backlog_name == NO_BACKLOG:\n if old_values['backlog'] and old_valu... | <|body_start_0|>
backlog_name = ticket.values['backlog']
if backlog_name != NO_BACKLOG:
Backlog(self.env, name=backlog_name).add_ticket(ticket.id)
<|end_body_0|>
<|body_start_1|>
backlog_name = ticket.values.get('backlog', NO_BACKLOG)
if 'backlog' in old_values.keys():
... | Listens to the changes of tickets and updates backlogs if necessary | BacklogTicketChangeListener | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BacklogTicketChangeListener:
"""Listens to the changes of tickets and updates backlogs if necessary"""
def ticket_created(self, ticket):
"""Called when a ticket is created."""
<|body_0|>
def ticket_changed(self, ticket, comment, author, old_values):
"""Called whe... | stack_v2_sparse_classes_75kplus_train_069538 | 1,936 | permissive | [
{
"docstring": "Called when a ticket is created.",
"name": "ticket_created",
"signature": "def ticket_created(self, ticket)"
},
{
"docstring": "Called when a ticket is modified. Adds and removes tickets from backlogs.",
"name": "ticket_changed",
"signature": "def ticket_changed(self, tic... | 3 | stack_v2_sparse_classes_30k_train_019525 | Implement the Python class `BacklogTicketChangeListener` described below.
Class description:
Listens to the changes of tickets and updates backlogs if necessary
Method signatures and docstrings:
- def ticket_created(self, ticket): Called when a ticket is created.
- def ticket_changed(self, ticket, comment, author, ol... | Implement the Python class `BacklogTicketChangeListener` described below.
Class description:
Listens to the changes of tickets and updates backlogs if necessary
Method signatures and docstrings:
- def ticket_created(self, ticket): Called when a ticket is created.
- def ticket_changed(self, ticket, comment, author, ol... | 4fcd4aeba81d734654f5d9ec524218b91d54a0e1 | <|skeleton|>
class BacklogTicketChangeListener:
"""Listens to the changes of tickets and updates backlogs if necessary"""
def ticket_created(self, ticket):
"""Called when a ticket is created."""
<|body_0|>
def ticket_changed(self, ticket, comment, author, old_values):
"""Called whe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BacklogTicketChangeListener:
"""Listens to the changes of tickets and updates backlogs if necessary"""
def ticket_created(self, ticket):
"""Called when a ticket is created."""
backlog_name = ticket.values['backlog']
if backlog_name != NO_BACKLOG:
Backlog(self.env, name... | the_stack_v2_python_sparse | backlogplugin/trunk/backlog/ticketchangelistener.py | woochica/trachacks | train | 0 |
a315d85149c3858a86bc12947d6fd88ee8de912b | [
"if not is_real_number(success_threshold):\n raise TypeError('Expected real number for success_threshold, got %s' % type(success_threshold))\nif not isinstance(cost, CostFunctionGenerator):\n raise TypeError('Expected cost to be a CostFunctionGenerator, got %s' % type(cost))\nif not isinstance(instantiate_opt... | <|body_start_0|>
if not is_real_number(success_threshold):
raise TypeError('Expected real number for success_threshold, got %s' % type(success_threshold))
if not isinstance(cost, CostFunctionGenerator):
raise TypeError('Expected cost to be a CostFunctionGenerator, got %s' % type(... | The ScanningGateRemovalPass class. Starting from one side of the circuit, attempt to remove gates one-by-one. | ScanningGateRemovalPass | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScanningGateRemovalPass:
"""The ScanningGateRemovalPass class. Starting from one side of the circuit, attempt to remove gates one-by-one."""
def __init__(self, start_from_left: bool=True, success_threshold: float=1e-10, cost: CostFunctionGenerator=HilbertSchmidtResidualsGenerator(), instanti... | stack_v2_sparse_classes_75kplus_train_069539 | 5,282 | permissive | [
{
"docstring": "Construct a ScanningGateRemovalPass. Args: start_from_left (bool): Determines where the scan starts attempting to remove gates from. If True, scan goes left to right, otherwise right to left. (Default: True) success_threshold (float): The distance threshold that determines successful termintatio... | 2 | stack_v2_sparse_classes_30k_train_029151 | Implement the Python class `ScanningGateRemovalPass` described below.
Class description:
The ScanningGateRemovalPass class. Starting from one side of the circuit, attempt to remove gates one-by-one.
Method signatures and docstrings:
- def __init__(self, start_from_left: bool=True, success_threshold: float=1e-10, cost... | Implement the Python class `ScanningGateRemovalPass` described below.
Class description:
The ScanningGateRemovalPass class. Starting from one side of the circuit, attempt to remove gates one-by-one.
Method signatures and docstrings:
- def __init__(self, start_from_left: bool=True, success_threshold: float=1e-10, cost... | c89112d15072e8ffffb68cf1757b184e2aeb3dc8 | <|skeleton|>
class ScanningGateRemovalPass:
"""The ScanningGateRemovalPass class. Starting from one side of the circuit, attempt to remove gates one-by-one."""
def __init__(self, start_from_left: bool=True, success_threshold: float=1e-10, cost: CostFunctionGenerator=HilbertSchmidtResidualsGenerator(), instanti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScanningGateRemovalPass:
"""The ScanningGateRemovalPass class. Starting from one side of the circuit, attempt to remove gates one-by-one."""
def __init__(self, start_from_left: bool=True, success_threshold: float=1e-10, cost: CostFunctionGenerator=HilbertSchmidtResidualsGenerator(), instantiate_options: ... | the_stack_v2_python_sparse | bqskit/passes/processing/scan.py | BQSKit/bqskit | train | 54 |
740a08a2d13f21b2d2207e5ba94cabce294b0b7c | [
"super(KernelVar, self).__init__()\nself.embd_dim = embd_dim\nself.hidden_dim = hidden_dim\nself.kernel_dim = kernel_dim\nself.layer1 = nn.Linear(2 * embd_dim, hidden_dim)\nself.layer2 = nn.Linear(hidden_dim, hidden_dim)\nself.layer3 = nn.Linear(hidden_dim, kernel_dim)\nself.net = nn.Sequential(self.layer1, nn.ReLU... | <|body_start_0|>
super(KernelVar, self).__init__()
self.embd_dim = embd_dim
self.hidden_dim = hidden_dim
self.kernel_dim = kernel_dim
self.layer1 = nn.Linear(2 * embd_dim, hidden_dim)
self.layer2 = nn.Linear(hidden_dim, hidden_dim)
self.layer3 = nn.Linear(hidden_d... | KernelVar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KernelVar:
def __init__(self, embd_dim, hidden_dim, kernel_dim):
"""Currently, this creates a 2-hidden-layer network with ELU non-linearities."""
<|body_0|>
def forward(self, words):
"""Given words, returns batch_kernel of dimension [-1, kernel_dim]"""
<|body... | stack_v2_sparse_classes_75kplus_train_069540 | 30,546 | permissive | [
{
"docstring": "Currently, this creates a 2-hidden-layer network with ELU non-linearities.",
"name": "__init__",
"signature": "def __init__(self, embd_dim, hidden_dim, kernel_dim)"
},
{
"docstring": "Given words, returns batch_kernel of dimension [-1, kernel_dim]",
"name": "forward",
"si... | 2 | stack_v2_sparse_classes_30k_val_002153 | Implement the Python class `KernelVar` described below.
Class description:
Implement the KernelVar class.
Method signatures and docstrings:
- def __init__(self, embd_dim, hidden_dim, kernel_dim): Currently, this creates a 2-hidden-layer network with ELU non-linearities.
- def forward(self, words): Given words, return... | Implement the Python class `KernelVar` described below.
Class description:
Implement the KernelVar class.
Method signatures and docstrings:
- def __init__(self, embd_dim, hidden_dim, kernel_dim): Currently, this creates a 2-hidden-layer network with ELU non-linearities.
- def forward(self, words): Given words, return... | 86859b7612433cc6349b427b47c54986224e702a | <|skeleton|>
class KernelVar:
def __init__(self, embd_dim, hidden_dim, kernel_dim):
"""Currently, this creates a 2-hidden-layer network with ELU non-linearities."""
<|body_0|>
def forward(self, words):
"""Given words, returns batch_kernel of dimension [-1, kernel_dim]"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KernelVar:
def __init__(self, embd_dim, hidden_dim, kernel_dim):
"""Currently, this creates a 2-hidden-layer network with ELU non-linearities."""
super(KernelVar, self).__init__()
self.embd_dim = embd_dim
self.hidden_dim = hidden_dim
self.kernel_dim = kernel_dim
... | the_stack_v2_python_sparse | dpp_nets/layers/layers.py | mbp28/dpp_nets | train | 1 | |
34dc1b170643eaee18e3027d64b7bee5b49da672 | [
"epsilon = 1e-10\nx[x == 0] = epsilon\nout = -(np.log(x) * y).sum(axis=1)\nout = out.mean()\nreturn out",
"dx = -y / x\ndx = dx / x.shape[0]\nreturn dx"
] | <|body_start_0|>
epsilon = 1e-10
x[x == 0] = epsilon
out = -(np.log(x) * y).sum(axis=1)
out = out.mean()
return out
<|end_body_0|>
<|body_start_1|>
dx = -y / x
dx = dx / x.shape[0]
return dx
<|end_body_1|>
| Cross entropy loss module. | CrossEntropyModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrossEntropyModule:
"""Cross entropy loss module."""
def forward(self, x, y):
"""Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss"""
<|body_0|>
def backward(self, x, y):
"""Backward pass. Args: x: input to the mod... | stack_v2_sparse_classes_75kplus_train_069541 | 4,856 | no_license | [
{
"docstring": "Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss",
"name": "forward",
"signature": "def forward(self, x, y)"
},
{
"docstring": "Backward pass. Args: x: input to the module y: labels of the input Returns: dx: gradient of the loss w... | 2 | null | Implement the Python class `CrossEntropyModule` described below.
Class description:
Cross entropy loss module.
Method signatures and docstrings:
- def forward(self, x, y): Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss
- def backward(self, x, y): Backward pass. Args... | Implement the Python class `CrossEntropyModule` described below.
Class description:
Cross entropy loss module.
Method signatures and docstrings:
- def forward(self, x, y): Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss
- def backward(self, x, y): Backward pass. Args... | 2c5e3eb5b886bb881ac767a03c8303c5beff8242 | <|skeleton|>
class CrossEntropyModule:
"""Cross entropy loss module."""
def forward(self, x, y):
"""Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss"""
<|body_0|>
def backward(self, x, y):
"""Backward pass. Args: x: input to the mod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CrossEntropyModule:
"""Cross entropy loss module."""
def forward(self, x, y):
"""Forward pass. Args: x: input to the module y: labels of the input Returns: out: cross entropy loss"""
epsilon = 1e-10
x[x == 0] = epsilon
out = -(np.log(x) * y).sum(axis=1)
out = out.m... | the_stack_v2_python_sparse | assignment_1/code/modules.py | Kaleidophon/danish-dingo | train | 0 |
20fefe8cf543fee8525213e4cfc0a527aa7beb3c | [
"def dbfn(storeConnection):\n decodedJWTToken = verifyJWTTokenGivesUserWithAPIKeyPrivilagesAndReturnFormattedJWTToken(appObj=appObj, request=request, tenant=tenant)\n try:\n return appObj.ApiKeyManager.getAPIKeyDict(decodedJWTToken=decodedJWTToken, tenant=tenant, apiKeyID=apiKeyID, storeConnection=stor... | <|body_start_0|>
def dbfn(storeConnection):
decodedJWTToken = verifyJWTTokenGivesUserWithAPIKeyPrivilagesAndReturnFormattedJWTToken(appObj=appObj, request=request, tenant=tenant)
try:
return appObj.ApiKeyManager.getAPIKeyDict(decodedJWTToken=decodedJWTToken, tenant=tenant... | Get API key data from id | APIKeysInfo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APIKeysInfo:
"""Get API key data from id"""
def get(self, tenant, apiKeyID):
"""Get apikey for login api to use"""
<|body_0|>
def delete(self, tenant, apiKeyID):
"""Delete API Key"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def dbfn(storeCon... | stack_v2_sparse_classes_75kplus_train_069542 | 9,554 | permissive | [
{
"docstring": "Get apikey for login api to use",
"name": "get",
"signature": "def get(self, tenant, apiKeyID)"
},
{
"docstring": "Delete API Key",
"name": "delete",
"signature": "def delete(self, tenant, apiKeyID)"
}
] | 2 | stack_v2_sparse_classes_30k_train_032483 | Implement the Python class `APIKeysInfo` described below.
Class description:
Get API key data from id
Method signatures and docstrings:
- def get(self, tenant, apiKeyID): Get apikey for login api to use
- def delete(self, tenant, apiKeyID): Delete API Key | Implement the Python class `APIKeysInfo` described below.
Class description:
Get API key data from id
Method signatures and docstrings:
- def get(self, tenant, apiKeyID): Get apikey for login api to use
- def delete(self, tenant, apiKeyID): Delete API Key
<|skeleton|>
class APIKeysInfo:
"""Get API key data from ... | d3908c46614fb1b638553282cd72ba3634277495 | <|skeleton|>
class APIKeysInfo:
"""Get API key data from id"""
def get(self, tenant, apiKeyID):
"""Get apikey for login api to use"""
<|body_0|>
def delete(self, tenant, apiKeyID):
"""Delete API Key"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class APIKeysInfo:
"""Get API key data from id"""
def get(self, tenant, apiKeyID):
"""Get apikey for login api to use"""
def dbfn(storeConnection):
decodedJWTToken = verifyJWTTokenGivesUserWithAPIKeyPrivilagesAndReturnFormattedJWTToken(appObj=appObj, request=request, tenant=tenant)
... | the_stack_v2_python_sparse | services/src/APIlogin_APIKeys.py | rmetcalf9/saas_user_management_system | train | 1 |
43c0180cfe5ebab688bd953f111b2dd4d9e5dd0b | [
"assert len(input_shape) == 1\nself.with_action_shape = with_action_shape\ninput_shape = input_shape[0]\nif with_action_shape is not None:\n input_shape += with_action_shape\nactivation_layer = get_activation_layer(activation)\nlayers = [nn.Linear(input_shape, num_hidden)]\nfor i in range(num_layers):\n layer... | <|body_start_0|>
assert len(input_shape) == 1
self.with_action_shape = with_action_shape
input_shape = input_shape[0]
if with_action_shape is not None:
input_shape += with_action_shape
activation_layer = get_activation_layer(activation)
layers = [nn.Linear(inp... | DiscreteNetwork1D | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscreteNetwork1D:
def initialize(self, input_shape: Tuple, output_shape: int, num_layers: int=2, num_hidden: int=128, activation: str='relu', with_action_shape: int=0) -> None:
"""1D network for discrete outputs. Parameters ---------- input_shape: tuple shape of input to network output_... | stack_v2_sparse_classes_75kplus_train_069543 | 6,165 | permissive | [
{
"docstring": "1D network for discrete outputs. Parameters ---------- input_shape: tuple shape of input to network output_shape: int shape of output of network num_layers: int, default=2 number of linear layers to add to the network num_hidden: int, default=128 hidden dimension of inner layers (number of filte... | 3 | stack_v2_sparse_classes_30k_train_032329 | Implement the Python class `DiscreteNetwork1D` described below.
Class description:
Implement the DiscreteNetwork1D class.
Method signatures and docstrings:
- def initialize(self, input_shape: Tuple, output_shape: int, num_layers: int=2, num_hidden: int=128, activation: str='relu', with_action_shape: int=0) -> None: 1... | Implement the Python class `DiscreteNetwork1D` described below.
Class description:
Implement the DiscreteNetwork1D class.
Method signatures and docstrings:
- def initialize(self, input_shape: Tuple, output_shape: int, num_layers: int=2, num_hidden: int=128, activation: str='relu', with_action_shape: int=0) -> None: 1... | 6aecbe414f0032514ffb4206200596b8c3860b58 | <|skeleton|>
class DiscreteNetwork1D:
def initialize(self, input_shape: Tuple, output_shape: int, num_layers: int=2, num_hidden: int=128, activation: str='relu', with_action_shape: int=0) -> None:
"""1D network for discrete outputs. Parameters ---------- input_shape: tuple shape of input to network output_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiscreteNetwork1D:
def initialize(self, input_shape: Tuple, output_shape: int, num_layers: int=2, num_hidden: int=128, activation: str='relu', with_action_shape: int=0) -> None:
"""1D network for discrete outputs. Parameters ---------- input_shape: tuple shape of input to network output_shape: int sha... | the_stack_v2_python_sparse | ilpyt/nets/net1d.py | mitre/ilpyt | train | 11 | |
675732ae168ccb0e8c271c6a81fc8c6c36c9b43d | [
"params = {'method': 'brooklyn.integers.create'}\ndata = urlencode(params)\nrequest = urllib2.Request(BROOKLYNT_URL, data, HEADERS)\nresponse = simplejson.load(urllib2.urlopen(request))\nif option == 'raw':\n result = response['integer']\nelse:\n result = 'Your hand-crafted integer is %s - %s ' % (response['i... | <|body_start_0|>
params = {'method': 'brooklyn.integers.create'}
data = urlencode(params)
request = urllib2.Request(BROOKLYNT_URL, data, HEADERS)
response = simplejson.load(urllib2.urlopen(request))
if option == 'raw':
result = response['integer']
else:
... | ArtisanalIntegers | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArtisanalIntegers:
def brooklynt(self, irc, msg, args, option):
"""(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com"""
<|body_0|>
def missionint(self, irc, msg, args, option):
"""(missionint [raw]): Request a new hella ... | stack_v2_sparse_classes_75kplus_train_069544 | 3,585 | no_license | [
{
"docstring": "(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com",
"name": "brooklynt",
"signature": "def brooklynt(self, irc, msg, args, option)"
},
{
"docstring": "(missionint [raw]): Request a new hella artisanal integer from http://missioninteg... | 2 | stack_v2_sparse_classes_30k_val_001349 | Implement the Python class `ArtisanalIntegers` described below.
Class description:
Implement the ArtisanalIntegers class.
Method signatures and docstrings:
- def brooklynt(self, irc, msg, args, option): (brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com
- def missionint(s... | Implement the Python class `ArtisanalIntegers` described below.
Class description:
Implement the ArtisanalIntegers class.
Method signatures and docstrings:
- def brooklynt(self, irc, msg, args, option): (brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com
- def missionint(s... | 8c7f16c0584bdf393a56dccff6b35a83142e5ece | <|skeleton|>
class ArtisanalIntegers:
def brooklynt(self, irc, msg, args, option):
"""(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com"""
<|body_0|>
def missionint(self, irc, msg, args, option):
"""(missionint [raw]): Request a new hella ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArtisanalIntegers:
def brooklynt(self, irc, msg, args, option):
"""(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com"""
params = {'method': 'brooklyn.integers.create'}
data = urlencode(params)
request = urllib2.Request(BROOKLYNT_UR... | the_stack_v2_python_sparse | plugins/ArtisanalIntegers/plugin.py | frumiousbandersnatch/supybot-plugins | train | 0 | |
b4ac27259ad7af6874515427006e7451acb122d1 | [
"self.iterations = iterations\nself.graph = graph\nself.features = get_degrees(graph)\nself.nodes = self.graph.nodes()\nself.extracted_features = [str(v) for k, v in self.features.items()]\nself.per_stage = []",
"new_features = {}\nfor node in self.nodes:\n nebs = self.graph.neighbors(node)\n degs = [self.f... | <|body_start_0|>
self.iterations = iterations
self.graph = graph
self.features = get_degrees(graph)
self.nodes = self.graph.nodes()
self.extracted_features = [str(v) for k, v in self.features.items()]
self.per_stage = []
<|end_body_0|>
<|body_start_1|>
new_featur... | Weisfeiler Lehman feature extractor class. | WeisfeilerLehmanMachine | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeisfeilerLehmanMachine:
"""Weisfeiler Lehman feature extractor class."""
def __init__(self, graph, iterations):
"""Initialization method which also executes feature extraction. :param graph: The Nx graph object. :param iterations: Number of WL iterations."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_069545 | 6,915 | permissive | [
{
"docstring": "Initialization method which also executes feature extraction. :param graph: The Nx graph object. :param iterations: Number of WL iterations.",
"name": "__init__",
"signature": "def __init__(self, graph, iterations)"
},
{
"docstring": "The method does a single WL recursion. :retur... | 3 | stack_v2_sparse_classes_30k_train_001901 | Implement the Python class `WeisfeilerLehmanMachine` described below.
Class description:
Weisfeiler Lehman feature extractor class.
Method signatures and docstrings:
- def __init__(self, graph, iterations): Initialization method which also executes feature extraction. :param graph: The Nx graph object. :param iterati... | Implement the Python class `WeisfeilerLehmanMachine` described below.
Class description:
Weisfeiler Lehman feature extractor class.
Method signatures and docstrings:
- def __init__(self, graph, iterations): Initialization method which also executes feature extraction. :param graph: The Nx graph object. :param iterati... | e6e9db5a936e87a2adfdf81a1f00d952d800d1c8 | <|skeleton|>
class WeisfeilerLehmanMachine:
"""Weisfeiler Lehman feature extractor class."""
def __init__(self, graph, iterations):
"""Initialization method which also executes feature extraction. :param graph: The Nx graph object. :param iterations: Number of WL iterations."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeisfeilerLehmanMachine:
"""Weisfeiler Lehman feature extractor class."""
def __init__(self, graph, iterations):
"""Initialization method which also executes feature extraction. :param graph: The Nx graph object. :param iterations: Number of WL iterations."""
self.iterations = iterations
... | the_stack_v2_python_sparse | wl_sensibility.py | Yacnnn/GAT-Skip-Gram | train | 0 |
4ecb8a240e7df6395d900f382e37fdcf3f608dcb | [
"form = super(AddAlbumView, self).get_form()\nform.fields['cover_photo'].queryset = self.request.user.profile.photos.all()\nform.fields['photos'].queryset = self.request.user.profile.photos.all()\nreturn form",
"self.object = form.save()\nself.object.owner = self.request.user.profile\nself.object.save()\nreturn H... | <|body_start_0|>
form = super(AddAlbumView, self).get_form()
form.fields['cover_photo'].queryset = self.request.user.profile.photos.all()
form.fields['photos'].queryset = self.request.user.profile.photos.all()
return form
<|end_body_0|>
<|body_start_1|>
self.object = form.save()... | Add a new album. | AddAlbumView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddAlbumView:
"""Add a new album."""
def get_form(self):
"""Retrieve form and customize some fields."""
<|body_0|>
def form_valid(self, form):
"""If form post is successful, set the object's owner."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_069546 | 6,669 | permissive | [
{
"docstring": "Retrieve form and customize some fields.",
"name": "get_form",
"signature": "def get_form(self)"
},
{
"docstring": "If form post is successful, set the object's owner.",
"name": "form_valid",
"signature": "def form_valid(self, form)"
}
] | 2 | stack_v2_sparse_classes_30k_train_036591 | Implement the Python class `AddAlbumView` described below.
Class description:
Add a new album.
Method signatures and docstrings:
- def get_form(self): Retrieve form and customize some fields.
- def form_valid(self, form): If form post is successful, set the object's owner. | Implement the Python class `AddAlbumView` described below.
Class description:
Add a new album.
Method signatures and docstrings:
- def get_form(self): Retrieve form and customize some fields.
- def form_valid(self, form): If form post is successful, set the object's owner.
<|skeleton|>
class AddAlbumView:
"""Add... | ae0dd708fe29e9b2aec9125d649b06fc7b724e45 | <|skeleton|>
class AddAlbumView:
"""Add a new album."""
def get_form(self):
"""Retrieve form and customize some fields."""
<|body_0|>
def form_valid(self, form):
"""If form post is successful, set the object's owner."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddAlbumView:
"""Add a new album."""
def get_form(self):
"""Retrieve form and customize some fields."""
form = super(AddAlbumView, self).get_form()
form.fields['cover_photo'].queryset = self.request.user.profile.photos.all()
form.fields['photos'].queryset = self.request.us... | the_stack_v2_python_sparse | imagersite/imager_images/views.py | fordf/django-imager | train | 0 |
8d2d7c499358b08cea4fd4c350bead222a568644 | [
"if type(data) is not np.ndarray:\n raise TypeError('data must be a 2D numpy.ndarray')\nif len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nd, n = data.shape\nself.mean = np.mean(data, axis=1).res... | <|body_start_0|>
if type(data) is not np.ndarray:
raise TypeError('data must be a 2D numpy.ndarray')
if len(data.shape) != 2:
raise TypeError('data must be a 2D numpy.ndarray')
if data.shape[1] < 2:
raise ValueError('data must contain multiple data points')
... | Multinormal class that represents a Multivariate Normal distribution | MultiNormal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiNormal:
"""Multinormal class that represents a Multivariate Normal distribution"""
def __init__(self, data):
"""Init method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is... | stack_v2_sparse_classes_75kplus_train_069547 | 2,602 | no_license | [
{
"docstring": "Init method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D numpy.ndarray, raise a TypeError with the message data must be a 2D numpy.ndarray If n is less than 2, raise a ValueErr... | 2 | stack_v2_sparse_classes_30k_test_002849 | Implement the Python class `MultiNormal` described below.
Class description:
Multinormal class that represents a Multivariate Normal distribution
Method signatures and docstrings:
- def __init__(self, data): Init method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d ... | Implement the Python class `MultiNormal` described below.
Class description:
Multinormal class that represents a Multivariate Normal distribution
Method signatures and docstrings:
- def __init__(self, data): Init method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d ... | e8a98d85b3bfd5665cb04bec9ee8c3eb23d6bd58 | <|skeleton|>
class MultiNormal:
"""Multinormal class that represents a Multivariate Normal distribution"""
def __init__(self, data):
"""Init method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiNormal:
"""Multinormal class that represents a Multivariate Normal distribution"""
def __init__(self, data):
"""Init method data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point If data is not a 2D num... | the_stack_v2_python_sparse | math/0x06-multivariate_prob/multinormal.py | AndrewMiranda/holbertonschool-machine_learning-1 | train | 0 |
31720b3df7a6feba91938e992bdca829044f4291 | [
"d = defaultdict(list)\nfor i in range(len(points) - 1):\n p1 = points[i]\n for j in range(i + 1, len(points)):\n p2 = points[j]\n key = self.gen_key(p1, p2)\n d[key].append([p1, p2])\nres = float('inf')\nfor key, lines in d.items():\n if len(lines) < 2:\n continue\n for i in... | <|body_start_0|>
d = defaultdict(list)
for i in range(len(points) - 1):
p1 = points[i]
for j in range(i + 1, len(points)):
p2 = points[j]
key = self.gen_key(p1, p2)
d[key].append([p1, p2])
res = float('inf')
for key,... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minAreaFreeRect(self, points):
""":type points: List[List[int]] :rtype: float"""
<|body_0|>
def gen_key(self, p1, p2):
"""use the length and center point as the key"""
<|body_1|>
def cal_area(self, line1, line2):
"""line1 and line2 ... | stack_v2_sparse_classes_75kplus_train_069548 | 2,665 | no_license | [
{
"docstring": ":type points: List[List[int]] :rtype: float",
"name": "minAreaFreeRect",
"signature": "def minAreaFreeRect(self, points)"
},
{
"docstring": "use the length and center point as the key",
"name": "gen_key",
"signature": "def gen_key(self, p1, p2)"
},
{
"docstring": ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAreaFreeRect(self, points): :type points: List[List[int]] :rtype: float
- def gen_key(self, p1, p2): use the length and center point as the key
- def cal_area(self, line1,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAreaFreeRect(self, points): :type points: List[List[int]] :rtype: float
- def gen_key(self, p1, p2): use the length and center point as the key
- def cal_area(self, line1,... | 188befbfb7080ba1053ee1f7187b177b64cf42d2 | <|skeleton|>
class Solution:
def minAreaFreeRect(self, points):
""":type points: List[List[int]] :rtype: float"""
<|body_0|>
def gen_key(self, p1, p2):
"""use the length and center point as the key"""
<|body_1|>
def cal_area(self, line1, line2):
"""line1 and line2 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minAreaFreeRect(self, points):
""":type points: List[List[int]] :rtype: float"""
d = defaultdict(list)
for i in range(len(points) - 1):
p1 = points[i]
for j in range(i + 1, len(points)):
p2 = points[j]
key = self.gen... | the_stack_v2_python_sparse | 0963. Minimum Area Rectangle II.py | pwang867/LeetCode-Solutions-Python | train | 0 | |
222898f6594ac8fcf70139efda13cac75846ff47 | [
"super(QtWidgets.QDialog, self).__init__()\nself.setObjectName('LoadingAnimationDialog')\nself.resize(320 * globals.S_W_R, 250 * globals.S_H_R)\nself.setWindowTitle('Converting...')\nself.setWindowIcon(QtGui.QIcon('.\\\\images\\\\skore_icon.png'))\nself.setWindowFlag(QtCore.Qt.WindowCloseButtonHint, False)\nself.se... | <|body_start_0|>
super(QtWidgets.QDialog, self).__init__()
self.setObjectName('LoadingAnimationDialog')
self.resize(320 * globals.S_W_R, 250 * globals.S_H_R)
self.setWindowTitle('Converting...')
self.setWindowIcon(QtGui.QIcon('.\\images\\skore_icon.png'))
self.setWindowFl... | This class is a dialog to provide with a loading animation. The intent of this object is to inform the user of the initialization and completion of a file conversion. | LoadingAnimationDialog | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadingAnimationDialog:
"""This class is a dialog to provide with a loading animation. The intent of this object is to inform the user of the initialization and completion of a file conversion."""
def __init__(self):
"""This function initializes the dialog, settings its size and trai... | stack_v2_sparse_classes_75kplus_train_069549 | 3,624 | permissive | [
{
"docstring": "This function initializes the dialog, settings its size and trait.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This function sets the graphics view widget in the dialog class.",
"name": "setup_ui",
"signature": "def setup_ui(self)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_028369 | Implement the Python class `LoadingAnimationDialog` described below.
Class description:
This class is a dialog to provide with a loading animation. The intent of this object is to inform the user of the initialization and completion of a file conversion.
Method signatures and docstrings:
- def __init__(self): This fu... | Implement the Python class `LoadingAnimationDialog` described below.
Class description:
This class is a dialog to provide with a loading animation. The intent of this object is to inform the user of the initialization and completion of a file conversion.
Method signatures and docstrings:
- def __init__(self): This fu... | 72e742611ba96b0df542781ded0685f525bea82b | <|skeleton|>
class LoadingAnimationDialog:
"""This class is a dialog to provide with a loading animation. The intent of this object is to inform the user of the initialization and completion of a file conversion."""
def __init__(self):
"""This function initializes the dialog, settings its size and trai... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoadingAnimationDialog:
"""This class is a dialog to provide with a loading animation. The intent of this object is to inform the user of the initialization and completion of a file conversion."""
def __init__(self):
"""This function initializes the dialog, settings its size and trait."""
... | the_stack_v2_python_sparse | Software/python/loading_animation_dialog.py | edavalosanaya/SKORE | train | 2 |
31275f1985a19f68d41e17486953a32f2b0b2833 | [
"ObjectManager.__init__(self)\nself.getters.update({'user': 'get_foreign_key', 'training_unit_account': 'get_foreign_key', 'start': 'get_time', 'end': 'get_time', 'used_value': 'get_used_value_from_training_unit_authorization', 'max_value': 'get_general'})\nself.setters.update({'user': 'set_foreign_key', 'training_... | <|body_start_0|>
ObjectManager.__init__(self)
self.getters.update({'user': 'get_foreign_key', 'training_unit_account': 'get_foreign_key', 'start': 'get_time', 'end': 'get_time', 'used_value': 'get_used_value_from_training_unit_authorization', 'max_value': 'get_general'})
self.setters.update({'us... | Manage TrainingUnitAuthorizations in the Power Reg system | TrainingUnitAuthorizationManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainingUnitAuthorizationManager:
"""Manage TrainingUnitAuthorizations in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, training_unit_account, user, start, end, max_value):
"""Create a new TrainingUnitAuthor... | stack_v2_sparse_classes_75kplus_train_069550 | 2,336 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create a new TrainingUnitAuthorization @param training_unit_account Foreign Key for a training unit account @param user Foreign Key for a user @param start Start time as ISO8601 string @param e... | 2 | null | Implement the Python class `TrainingUnitAuthorizationManager` described below.
Class description:
Manage TrainingUnitAuthorizations in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, training_unit_account, user, start, end, max_value): Create a n... | Implement the Python class `TrainingUnitAuthorizationManager` described below.
Class description:
Manage TrainingUnitAuthorizations in the Power Reg system
Method signatures and docstrings:
- def __init__(self): constructor
- def create(self, auth_token, training_unit_account, user, start, end, max_value): Create a n... | a59457bc37f0501aea1f54d006a6de94ff80511c | <|skeleton|>
class TrainingUnitAuthorizationManager:
"""Manage TrainingUnitAuthorizations in the Power Reg system"""
def __init__(self):
"""constructor"""
<|body_0|>
def create(self, auth_token, training_unit_account, user, start, end, max_value):
"""Create a new TrainingUnitAuthor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TrainingUnitAuthorizationManager:
"""Manage TrainingUnitAuthorizations in the Power Reg system"""
def __init__(self):
"""constructor"""
ObjectManager.__init__(self)
self.getters.update({'user': 'get_foreign_key', 'training_unit_account': 'get_foreign_key', 'start': 'get_time', 'en... | the_stack_v2_python_sparse | pr_services/product_system/training_unit_authorization_manager.py | ninemoreminutes/openassign-server | train | 0 |
42687dc34467de39731092bd3172417085ac8a06 | [
"super(CustomSmapiClientBuilder, self).__init__()\nself.client_id = client_id\nself.client_secret = client_secret\nself.refresh_token = refresh_token\nself.serializer = serializer\nself.api_client = api_client",
"if self.serializer is None:\n self.serializer = DefaultSerializer()\nif self.api_client is None:\n... | <|body_start_0|>
super(CustomSmapiClientBuilder, self).__init__()
self.client_id = client_id
self.client_secret = client_secret
self.refresh_token = refresh_token
self.serializer = serializer
self.api_client = api_client
<|end_body_0|>
<|body_start_1|>
if self.se... | Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Serializers and ApiClient implementations. | CustomSmapiClientBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomSmapiClientBuilder:
"""Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Serializers and ApiClient implementations.... | stack_v2_sparse_classes_75kplus_train_069551 | 7,763 | permissive | [
{
"docstring": "Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Serializers and ApiClient implementations. :param client_id: The Clien... | 2 | null | Implement the Python class `CustomSmapiClientBuilder` described below.
Class description:
Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Ser... | Implement the Python class `CustomSmapiClientBuilder` described below.
Class description:
Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Ser... | 7e13ca69b240985584dff6ec633a27598a154ca1 | <|skeleton|>
class CustomSmapiClientBuilder:
"""Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Serializers and ApiClient implementations.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomSmapiClientBuilder:
"""Smapi Custom Builder with serializer, api_client and api_endpoint setter functions. This builder is used to create an instance of :py:class:`ask_smapi_model.services.skill_management.SkillManagementServiceClient` with default Serializers and ApiClient implementations."""
def ... | the_stack_v2_python_sparse | ask-smapi-sdk/ask_smapi_sdk/smapi_builder.py | alexa/alexa-skills-kit-sdk-for-python | train | 560 |
5cdad122a09bbee668c5cdb59b18113607caf063 | [
"exp = ' A -> B\\n A.radius < B.radius\\n '\ndm = dotmotif.Motif(exp)\nself.assertEqual(len(dm.list_dynamic_node_constraints()), 1)",
"exp = ' macro(A, B) {\\n A.radius > B.radius\\n }\\n macro(A, B)\\n A -> B\\n '\ndm = dotmotif.Motif(exp)\nself.... | <|body_start_0|>
exp = ' A -> B\n A.radius < B.radius\n '
dm = dotmotif.Motif(exp)
self.assertEqual(len(dm.list_dynamic_node_constraints()), 1)
<|end_body_0|>
<|body_start_1|>
exp = ' macro(A, B) {\n A.radius > B.radius\n }\n macro(A,... | TestDynamicNodeConstraints | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDynamicNodeConstraints:
def test_dynamic_constraints(self):
"""Test that comparisons may be made between variables, e.g.: A.type != B.type"""
<|body_0|>
def test_dynamic_constraints_in_macro(self):
"""Test that comparisons may be made between variables in a macro... | stack_v2_sparse_classes_75kplus_train_069552 | 11,613 | permissive | [
{
"docstring": "Test that comparisons may be made between variables, e.g.: A.type != B.type",
"name": "test_dynamic_constraints",
"signature": "def test_dynamic_constraints(self)"
},
{
"docstring": "Test that comparisons may be made between variables in a macro, e.g.: A.type != B.type",
"nam... | 2 | stack_v2_sparse_classes_30k_train_053961 | Implement the Python class `TestDynamicNodeConstraints` described below.
Class description:
Implement the TestDynamicNodeConstraints class.
Method signatures and docstrings:
- def test_dynamic_constraints(self): Test that comparisons may be made between variables, e.g.: A.type != B.type
- def test_dynamic_constraints... | Implement the Python class `TestDynamicNodeConstraints` described below.
Class description:
Implement the TestDynamicNodeConstraints class.
Method signatures and docstrings:
- def test_dynamic_constraints(self): Test that comparisons may be made between variables, e.g.: A.type != B.type
- def test_dynamic_constraints... | db093ddad7308756e9cf7ee01199f0dca1369872 | <|skeleton|>
class TestDynamicNodeConstraints:
def test_dynamic_constraints(self):
"""Test that comparisons may be made between variables, e.g.: A.type != B.type"""
<|body_0|>
def test_dynamic_constraints_in_macro(self):
"""Test that comparisons may be made between variables in a macro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestDynamicNodeConstraints:
def test_dynamic_constraints(self):
"""Test that comparisons may be made between variables, e.g.: A.type != B.type"""
exp = ' A -> B\n A.radius < B.radius\n '
dm = dotmotif.Motif(exp)
self.assertEqual(len(dm.list_dynamic_node_con... | the_stack_v2_python_sparse | dotmotif/parsers/v2/test_v2_parser.py | JuttaPig/dotmotif | train | 0 | |
2ea96482745dcc4cfd6c3417777055c6044370f7 | [
"self.host = host\nself.port = port\nself.verbose = verbose\nself.opts = opts\nself.flags = flags\nself.connect()",
"context = zmq.Context()\npuller = context.socket(zmq.PULL)\nfor opt in self.opts:\n puller.setsockopt(opt, 1)\npuller.connect('tcp://{0}:{1}'.format(self.host, self.port))\nself.puller = puller\... | <|body_start_0|>
self.host = host
self.port = port
self.verbose = verbose
self.opts = opts
self.flags = flags
self.connect()
<|end_body_0|>
<|body_start_1|>
context = zmq.Context()
puller = context.socket(zmq.PULL)
for opt in self.opts:
... | ZMQPull | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZMQPull:
def __init__(self, host, port, opts=[], flags=0, verbose=False):
"""create a Default ZMQ Pull socket"""
<|body_0|>
def connect(self):
"""open ZMQ pull socket return receiver object"""
<|body_1|>
def receive(self):
"""receive and return z... | stack_v2_sparse_classes_75kplus_train_069553 | 12,974 | no_license | [
{
"docstring": "create a Default ZMQ Pull socket",
"name": "__init__",
"signature": "def __init__(self, host, port, opts=[], flags=0, verbose=False)"
},
{
"docstring": "open ZMQ pull socket return receiver object",
"name": "connect",
"signature": "def connect(self)"
},
{
"docstri... | 4 | stack_v2_sparse_classes_30k_train_011334 | Implement the Python class `ZMQPull` described below.
Class description:
Implement the ZMQPull class.
Method signatures and docstrings:
- def __init__(self, host, port, opts=[], flags=0, verbose=False): create a Default ZMQ Pull socket
- def connect(self): open ZMQ pull socket return receiver object
- def receive(sel... | Implement the Python class `ZMQPull` described below.
Class description:
Implement the ZMQPull class.
Method signatures and docstrings:
- def __init__(self, host, port, opts=[], flags=0, verbose=False): create a Default ZMQ Pull socket
- def connect(self): open ZMQ pull socket return receiver object
- def receive(sel... | 55041e6947b888242ff01cb18bd5f1ee4c4c8f28 | <|skeleton|>
class ZMQPull:
def __init__(self, host, port, opts=[], flags=0, verbose=False):
"""create a Default ZMQ Pull socket"""
<|body_0|>
def connect(self):
"""open ZMQ pull socket return receiver object"""
<|body_1|>
def receive(self):
"""receive and return z... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZMQPull:
def __init__(self, host, port, opts=[], flags=0, verbose=False):
"""create a Default ZMQ Pull socket"""
self.host = host
self.port = port
self.verbose = verbose
self.opts = opts
self.flags = flags
self.connect()
def connect(self):
"... | the_stack_v2_python_sparse | NPC/gui/ZmqSockets.py | coquellen/NanoPeakCell | train | 6 | |
53b4a1cbbf1dd4744a57e15fb25741cbbf2c088d | [
"future_question = create_question('Question_1', 5)\nresponse = self.client.get(reverse('polls:detail', kwargs={'pk': future_question.id}))\nself.assertEqual(response.status_code, 404)",
"past_question = create_question('Question_1', -5)\nresponse = self.client.get(reverse('polls:detail', kwargs={'pk': past_quest... | <|body_start_0|>
future_question = create_question('Question_1', 5)
response = self.client.get(reverse('polls:detail', kwargs={'pk': future_question.id}))
self.assertEqual(response.status_code, 404)
<|end_body_0|>
<|body_start_1|>
past_question = create_question('Question_1', -5)
... | QuestionDetailViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionDetailViewTests:
def test_detail_view_with_future_questions(self):
"""A question in the future should not be visible on this view."""
<|body_0|>
def test_detail_view_with_past_questions(self):
"""A question in the future should not be visible on this view."""... | stack_v2_sparse_classes_75kplus_train_069554 | 4,246 | no_license | [
{
"docstring": "A question in the future should not be visible on this view.",
"name": "test_detail_view_with_future_questions",
"signature": "def test_detail_view_with_future_questions(self)"
},
{
"docstring": "A question in the future should not be visible on this view.",
"name": "test_det... | 2 | stack_v2_sparse_classes_30k_train_030107 | Implement the Python class `QuestionDetailViewTests` described below.
Class description:
Implement the QuestionDetailViewTests class.
Method signatures and docstrings:
- def test_detail_view_with_future_questions(self): A question in the future should not be visible on this view.
- def test_detail_view_with_past_ques... | Implement the Python class `QuestionDetailViewTests` described below.
Class description:
Implement the QuestionDetailViewTests class.
Method signatures and docstrings:
- def test_detail_view_with_future_questions(self): A question in the future should not be visible on this view.
- def test_detail_view_with_past_ques... | acbb6d21a8182feabcb3329e17c76ac3af375255 | <|skeleton|>
class QuestionDetailViewTests:
def test_detail_view_with_future_questions(self):
"""A question in the future should not be visible on this view."""
<|body_0|>
def test_detail_view_with_past_questions(self):
"""A question in the future should not be visible on this view."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuestionDetailViewTests:
def test_detail_view_with_future_questions(self):
"""A question in the future should not be visible on this view."""
future_question = create_question('Question_1', 5)
response = self.client.get(reverse('polls:detail', kwargs={'pk': future_question.id}))
... | the_stack_v2_python_sparse | pythonTutorial/django/mysite/polls/tests.py | rajatgirotra/study | train | 6 | |
fa3de8a9ccaae415fbcf60dc9553c8daa6d1c070 | [
"super(CreateVendorPartForm, self).__init__(*args, **kwargs)\nsettings = Settings.get_settings()\nif settings:\n self.owner.get_label = operator.attrgetter(settings.name_order)",
"initial_validation = super(CreateVendorPartForm, self).validate()\nerrors = False\nif not initial_validation:\n errors = True\nv... | <|body_start_0|>
super(CreateVendorPartForm, self).__init__(*args, **kwargs)
settings = Settings.get_settings()
if settings:
self.owner.get_label = operator.attrgetter(settings.name_order)
<|end_body_0|>
<|body_start_1|>
initial_validation = super(CreateVendorPartForm, self)... | CreateVendorPartForm | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateVendorPartForm:
def __init__(self, *args, **kwargs):
"""Create instance."""
<|body_0|>
def validate(self):
"""Validate the form."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(CreateVendorPartForm, self).__init__(*args, **kwargs)
... | stack_v2_sparse_classes_75kplus_train_069555 | 2,184 | permissive | [
{
"docstring": "Create instance.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Validate the form.",
"name": "validate",
"signature": "def validate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_022273 | Implement the Python class `CreateVendorPartForm` described below.
Class description:
Implement the CreateVendorPartForm class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create instance.
- def validate(self): Validate the form. | Implement the Python class `CreateVendorPartForm` described below.
Class description:
Implement the CreateVendorPartForm class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create instance.
- def validate(self): Validate the form.
<|skeleton|>
class CreateVendorPartForm:
def __init__... | ecb146cc26c6ade2863bcdc6d271ead3cbcbbe40 | <|skeleton|>
class CreateVendorPartForm:
def __init__(self, *args, **kwargs):
"""Create instance."""
<|body_0|>
def validate(self):
"""Validate the form."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateVendorPartForm:
def __init__(self, *args, **kwargs):
"""Create instance."""
super(CreateVendorPartForm, self).__init__(*args, **kwargs)
settings = Settings.get_settings()
if settings:
self.owner.get_label = operator.attrgetter(settings.name_order)
def val... | the_stack_v2_python_sparse | pid/vendorpart/forms.py | PlanetaryResources/pid | train | 3 | |
1eed389327923e79e16725c9ccc56787dfe0d9c4 | [
"self.se = set()\nself.di = {}\nfor i in dictionary:\n if i not in self.se:\n self.se.update([i])\n else:\n continue\n if len(i) <= 2:\n key = i\n elif len(i) == 3:\n key = i[0] + '1' + i[-1]\n else:\n key = i[0] + str(len(i) - 2) + i[-1]\n self.di[key] = self.di... | <|body_start_0|>
self.se = set()
self.di = {}
for i in dictionary:
if i not in self.se:
self.se.update([i])
else:
continue
if len(i) <= 2:
key = i
elif len(i) == 3:
key = i[0] + '1' + ... | https://leetcode.com/problems/unique-word-abbreviation/description/ | ValidWordAbbr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidWordAbbr:
"""https://leetcode.com/problems/unique-word-abbreviation/description/"""
def __init__(self, dictionary):
""":type dictionary: List[str]"""
<|body_0|>
def isUnique(self, i):
""":type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_75kplus_train_069556 | 1,576 | no_license | [
{
"docstring": ":type dictionary: List[str]",
"name": "__init__",
"signature": "def __init__(self, dictionary)"
},
{
"docstring": ":type word: str :rtype: bool",
"name": "isUnique",
"signature": "def isUnique(self, i)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020550 | Implement the Python class `ValidWordAbbr` described below.
Class description:
https://leetcode.com/problems/unique-word-abbreviation/description/
Method signatures and docstrings:
- def __init__(self, dictionary): :type dictionary: List[str]
- def isUnique(self, i): :type word: str :rtype: bool | Implement the Python class `ValidWordAbbr` described below.
Class description:
https://leetcode.com/problems/unique-word-abbreviation/description/
Method signatures and docstrings:
- def __init__(self, dictionary): :type dictionary: List[str]
- def isUnique(self, i): :type word: str :rtype: bool
<|skeleton|>
class V... | 30bfafb6a7727c9305b22933b63d9d645182c633 | <|skeleton|>
class ValidWordAbbr:
"""https://leetcode.com/problems/unique-word-abbreviation/description/"""
def __init__(self, dictionary):
""":type dictionary: List[str]"""
<|body_0|>
def isUnique(self, i):
""":type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ValidWordAbbr:
"""https://leetcode.com/problems/unique-word-abbreviation/description/"""
def __init__(self, dictionary):
""":type dictionary: List[str]"""
self.se = set()
self.di = {}
for i in dictionary:
if i not in self.se:
self.se.update([i])... | the_stack_v2_python_sparse | leetcode/Hash-Table/unique-word-abbreviation.py | iCodeIN/competitive-programming-5 | train | 0 |
e35ec7abf6e7728b5d089da0380f237f9adfcb69 | [
"message.CopyFrom(union_message)\nuser = data.user.get(True)\nunion = data.union.get(True)\nmessage.user.user.user_id = user.id\nmessage.user.user.name = user.get_readable_name()\nmessage.user.user.headicon_id = user.icon_id\nmessage.user.left_attack_count = union.battle_attack_count_left\nmessage.user.refresh_atta... | <|body_start_0|>
message.CopyFrom(union_message)
user = data.user.get(True)
union = data.union.get(True)
message.user.user.user_id = user.id
message.user.user.name = user.get_readable_name()
message.user.user.headicon_id = user.icon_id
message.user.left_attack_cou... | 填充联盟战争信息,可能包括敌对联盟信息 | UnionBattlePatcher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnionBattlePatcher:
"""填充联盟战争信息,可能包括敌对联盟信息"""
def patch(self, message, union_message, data, now):
"""填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳"""
<|body_0|>
def _patch_riv... | stack_v2_sparse_classes_75kplus_train_069557 | 8,396 | no_license | [
{
"docstring": "填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳",
"name": "patch",
"signature": "def patch(self, message, union_message, data, now)"
},
{
"docstring": "填充敌对联盟的战争信息",
"name": "_patch_... | 5 | stack_v2_sparse_classes_30k_train_038687 | Implement the Python class `UnionBattlePatcher` described below.
Class description:
填充联盟战争信息,可能包括敌对联盟信息
Method signatures and docstrings:
- def patch(self, message, union_message, data, now): 填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData... | Implement the Python class `UnionBattlePatcher` described below.
Class description:
填充联盟战争信息,可能包括敌对联盟信息
Method signatures and docstrings:
- def patch(self, message, union_message, data, now): 填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData... | a16c872ba781855a8c891eff41e8e651cd565ebf | <|skeleton|>
class UnionBattlePatcher:
"""填充联盟战争信息,可能包括敌对联盟信息"""
def patch(self, message, union_message, data, now):
"""填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳"""
<|body_0|>
def _patch_riv... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnionBattlePatcher:
"""填充联盟战争信息,可能包括敌对联盟信息"""
def patch(self, message, union_message, data, now):
"""填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳"""
message.CopyFrom(union_message)
use... | the_stack_v2_python_sparse | app/union_patcher.py | daxingyou/test-2 | train | 0 |
ee1c9b9b5a049f020d7ccfad25a751d51aed0a1b | [
"context = self.current_context = Context.by_name(self.current_context_name)\nself.current_context_name = name\nreturn context",
"context = self.set_context(self.current_context_name)\nfor event in eventreceiver.read_from_socket(sockname=self.sockname, connect_backoff=self.connect_backoff):\n if event.final:\n... | <|body_start_0|>
context = self.current_context = Context.by_name(self.current_context_name)
self.current_context_name = name
return context
<|end_body_0|>
<|body_start_1|>
context = self.set_context(self.current_context_name)
for event in eventreceiver.read_from_socket(sockname... | Interpreter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interpreter:
def set_context(self, name):
"""Reload our currently configured context"""
<|body_0|>
def run(self, result_queue):
"""Run the interpreter on an event stream"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
context = self.current_context ... | stack_v2_sparse_classes_75kplus_train_069558 | 3,132 | no_license | [
{
"docstring": "Reload our currently configured context",
"name": "set_context",
"signature": "def set_context(self, name)"
},
{
"docstring": "Run the interpreter on an event stream",
"name": "run",
"signature": "def run(self, result_queue)"
}
] | 2 | stack_v2_sparse_classes_30k_train_028816 | Implement the Python class `Interpreter` described below.
Class description:
Implement the Interpreter class.
Method signatures and docstrings:
- def set_context(self, name): Reload our currently configured context
- def run(self, result_queue): Run the interpreter on an event stream | Implement the Python class `Interpreter` described below.
Class description:
Implement the Interpreter class.
Method signatures and docstrings:
- def set_context(self, name): Reload our currently configured context
- def run(self, result_queue): Run the interpreter on an event stream
<|skeleton|>
class Interpreter:
... | 4467e6e32a5d9a5f45f256b4c3f96f798842fe80 | <|skeleton|>
class Interpreter:
def set_context(self, name):
"""Reload our currently configured context"""
<|body_0|>
def run(self, result_queue):
"""Run the interpreter on an event stream"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Interpreter:
def set_context(self, name):
"""Reload our currently configured context"""
context = self.current_context = Context.by_name(self.current_context_name)
self.current_context_name = name
return context
def run(self, result_queue):
"""Run the interpreter o... | the_stack_v2_python_sparse | listener/interpreter.py | mcfletch/listener2 | train | 1 | |
cc5937f78c4f2f3a2461ecd2850b1d3dc4c4f9b4 | [
"primitive = C_STORE()\nprimitive.MessageID = 7\nprimitive.AffectedSOPClassUID = '1.1.1'\nprimitive.AffectedSOPInstanceUID = '1.2.1'\nprimitive.Priority = 2\nprimitive.MoveOriginatorApplicationEntityTitle = b'UNITTEST'\nprimitive.MoveOriginatorMessageID = 3\nprimitive.DataSet = BytesIO(encode(DATASET, True, True))\... | <|body_start_0|>
primitive = C_STORE()
primitive.MessageID = 7
primitive.AffectedSOPClassUID = '1.1.1'
primitive.AffectedSOPInstanceUID = '1.2.1'
primitive.Priority = 2
primitive.MoveOriginatorApplicationEntityTitle = b'UNITTEST'
primitive.MoveOriginatorMessageID ... | TestDecodeMessage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDecodeMessage:
def setup_method(self):
"""Run prior to each test"""
<|body_0|>
def time_decode(self):
"""Benchmark for standard decode."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
primitive = C_STORE()
primitive.MessageID = 7
... | stack_v2_sparse_classes_75kplus_train_069559 | 1,948 | permissive | [
{
"docstring": "Run prior to each test",
"name": "setup_method",
"signature": "def setup_method(self)"
},
{
"docstring": "Benchmark for standard decode.",
"name": "time_decode",
"signature": "def time_decode(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_045033 | Implement the Python class `TestDecodeMessage` described below.
Class description:
Implement the TestDecodeMessage class.
Method signatures and docstrings:
- def setup_method(self): Run prior to each test
- def time_decode(self): Benchmark for standard decode. | Implement the Python class `TestDecodeMessage` described below.
Class description:
Implement the TestDecodeMessage class.
Method signatures and docstrings:
- def setup_method(self): Run prior to each test
- def time_decode(self): Benchmark for standard decode.
<|skeleton|>
class TestDecodeMessage:
def setup_met... | 2aa9ed7e3f7f03a0c9af48fe8b0049c82e74ee48 | <|skeleton|>
class TestDecodeMessage:
def setup_method(self):
"""Run prior to each test"""
<|body_0|>
def time_decode(self):
"""Benchmark for standard decode."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestDecodeMessage:
def setup_method(self):
"""Run prior to each test"""
primitive = C_STORE()
primitive.MessageID = 7
primitive.AffectedSOPClassUID = '1.1.1'
primitive.AffectedSOPInstanceUID = '1.2.1'
primitive.Priority = 2
primitive.MoveOriginatorApplic... | the_stack_v2_python_sparse | pynetdicom/benchmarks/bench_dimse_message.py | pydicom/pynetdicom | train | 342 | |
6bd84e7614928db67fc0334838f3bc708f78c612 | [
"user = User.objects.create_user(username='username', email='myemail@test.com', password='password')\nself.client.login(username='username', password='password')\nitem = Product(name='Product', available_stock='100', content='product content', price='30', image='img.jpg', num_of_ratings='10', average_rating='5')\ni... | <|body_start_0|>
user = User.objects.create_user(username='username', email='myemail@test.com', password='password')
self.client.login(username='username', password='password')
item = Product(name='Product', available_stock='100', content='product content', price='30', image='img.jpg', num_of_ra... | test delete view | TestDeleteReview | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDeleteReview:
"""test delete view"""
def test_to_delete_a_review(self):
"""test delete review when logged in as the user who wrote the review"""
<|body_0|>
def test_to_delete_a_review_with_no_one_logged_in(self):
"""test delete review when no-one is logged in... | stack_v2_sparse_classes_75kplus_train_069560 | 18,816 | no_license | [
{
"docstring": "test delete review when logged in as the user who wrote the review",
"name": "test_to_delete_a_review",
"signature": "def test_to_delete_a_review(self)"
},
{
"docstring": "test delete review when no-one is logged in",
"name": "test_to_delete_a_review_with_no_one_logged_in",
... | 4 | null | Implement the Python class `TestDeleteReview` described below.
Class description:
test delete view
Method signatures and docstrings:
- def test_to_delete_a_review(self): test delete review when logged in as the user who wrote the review
- def test_to_delete_a_review_with_no_one_logged_in(self): test delete review whe... | Implement the Python class `TestDeleteReview` described below.
Class description:
test delete view
Method signatures and docstrings:
- def test_to_delete_a_review(self): test delete review when logged in as the user who wrote the review
- def test_to_delete_a_review_with_no_one_logged_in(self): test delete review whe... | a80148cb642cb09dac57cff18483be14fed67dfd | <|skeleton|>
class TestDeleteReview:
"""test delete view"""
def test_to_delete_a_review(self):
"""test delete review when logged in as the user who wrote the review"""
<|body_0|>
def test_to_delete_a_review_with_no_one_logged_in(self):
"""test delete review when no-one is logged in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestDeleteReview:
"""test delete view"""
def test_to_delete_a_review(self):
"""test delete review when logged in as the user who wrote the review"""
user = User.objects.create_user(username='username', email='myemail@test.com', password='password')
self.client.login(username='user... | the_stack_v2_python_sparse | review/tests_views.py | sarahbarron/Stream-3-Project | train | 1 |
d7083df9b5a345c708016a426b9f81c9d985d56d | [
"cnt, N = (0, len(M))\nvset = set()\n\ndef bfs(n):\n q = [n]\n while q:\n n = q.pop(0)\n for x in range(N):\n if M[n][x] and x not in vset:\n vset.add(x)\n q.append(x)\nfor x in range(N):\n if x not in vset:\n cnt += 1\n bfs(x)\nreturn cn... | <|body_start_0|>
cnt, N = (0, len(M))
vset = set()
def bfs(n):
q = [n]
while q:
n = q.pop(0)
for x in range(N):
if M[n][x] and x not in vset:
vset.add(x)
q.append(x)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findCircleNum(self, M):
""":type M: List[List[int]] :rtype: int"""
<|body_0|>
def findCircleNum_DFS(self, M):
""":type M: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cnt, N = (0, len(M))
vset = s... | stack_v2_sparse_classes_75kplus_train_069561 | 1,112 | no_license | [
{
"docstring": ":type M: List[List[int]] :rtype: int",
"name": "findCircleNum",
"signature": "def findCircleNum(self, M)"
},
{
"docstring": ":type M: List[List[int]] :rtype: int",
"name": "findCircleNum_DFS",
"signature": "def findCircleNum_DFS(self, M)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000053 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCircleNum(self, M): :type M: List[List[int]] :rtype: int
- def findCircleNum_DFS(self, M): :type M: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCircleNum(self, M): :type M: List[List[int]] :rtype: int
- def findCircleNum_DFS(self, M): :type M: List[List[int]] :rtype: int
<|skeleton|>
class Solution:
def fin... | 16e8a7935811fa71ce71998da8549e29ba68f847 | <|skeleton|>
class Solution:
def findCircleNum(self, M):
""":type M: List[List[int]] :rtype: int"""
<|body_0|>
def findCircleNum_DFS(self, M):
""":type M: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findCircleNum(self, M):
""":type M: List[List[int]] :rtype: int"""
cnt, N = (0, len(M))
vset = set()
def bfs(n):
q = [n]
while q:
n = q.pop(0)
for x in range(N):
if M[n][x] and x not in v... | the_stack_v2_python_sparse | leetcode8/findCircleNum.py | lizyang95/leetcode | train | 0 | |
d33ad2604ab8f4a649b06dda8535cd384b337c71 | [
"res = super()._prepare_purchase_order_line(product_id, product_qty, product_uom, company_id, values, po)\ndate = None\nif po.date_order:\n date = po.date_order.date()\nseller = product_id._select_seller(partner_id=values['supplier'].name, quantity=product_qty, date=date, uom_id=product_uom)\nres.update(self._pr... | <|body_start_0|>
res = super()._prepare_purchase_order_line(product_id, product_qty, product_uom, company_id, values, po)
date = None
if po.date_order:
date = po.date_order.date()
seller = product_id._select_seller(partner_id=values['supplier'].name, quantity=product_qty, dat... | StockRule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StockRule:
def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, values, po):
"""Apply the discount to the created purchase order"""
<|body_0|>
def _prepare_purchase_order_line_from_seller(self, seller):
"""Overload this function to... | stack_v2_sparse_classes_75kplus_train_069562 | 1,069 | no_license | [
{
"docstring": "Apply the discount to the created purchase order",
"name": "_prepare_purchase_order_line",
"signature": "def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, values, po)"
},
{
"docstring": "Overload this function to prepare other data from sell... | 2 | stack_v2_sparse_classes_30k_test_002300 | Implement the Python class `StockRule` described below.
Class description:
Implement the StockRule class.
Method signatures and docstrings:
- def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, values, po): Apply the discount to the created purchase order
- def _prepare_purchase_o... | Implement the Python class `StockRule` described below.
Class description:
Implement the StockRule class.
Method signatures and docstrings:
- def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, values, po): Apply the discount to the created purchase order
- def _prepare_purchase_o... | 8dab55afc9277bd9d82479cb17222bba3034a7f0 | <|skeleton|>
class StockRule:
def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, values, po):
"""Apply the discount to the created purchase order"""
<|body_0|>
def _prepare_purchase_order_line_from_seller(self, seller):
"""Overload this function to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StockRule:
def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, values, po):
"""Apply the discount to the created purchase order"""
res = super()._prepare_purchase_order_line(product_id, product_qty, product_uom, company_id, values, po)
date = None
... | the_stack_v2_python_sparse | purchase_discount/models/stock_rule.py | sm2x/mas | train | 0 | |
b1661922161fbd84e84275fcdfc7aea812a2ab95 | [
"self._pat = list(pat)\nself._M = len(self._pat)\nself._miss = [0 for i in range(self._M)]\nself._dfa = cx.defaultdict(lambda: [0 for i in range(self._M)])\nself._dfa[self._pat[0]][0] = 1\nX = 0\nfor j, letter in enumerate(self._pat[1:], 1):\n for c in self._dfa.keys():\n self._dfa[c][j] = self._dfa[c][X]... | <|body_start_0|>
self._pat = list(pat)
self._M = len(self._pat)
self._miss = [0 for i in range(self._M)]
self._dfa = cx.defaultdict(lambda: [0 for i in range(self._M)])
self._dfa[self._pat[0]][0] = 1
X = 0
for j, letter in enumerate(self._pat[1:], 1):
... | finds the first occurrence of a pattern string in a text string. | KMP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KMP:
"""finds the first occurrence of a pattern string in a text string."""
def __init__(self, pat):
"""Preprocesses the pat string."""
<|body_0|>
def search(self, txt):
"""Returns the idx of the 1st occurrrence of the pattern string in the text string."""
... | stack_v2_sparse_classes_75kplus_train_069563 | 1,775 | no_license | [
{
"docstring": "Preprocesses the pat string.",
"name": "__init__",
"signature": "def __init__(self, pat)"
},
{
"docstring": "Returns the idx of the 1st occurrrence of the pattern string in the text string.",
"name": "search",
"signature": "def search(self, txt)"
},
{
"docstring":... | 3 | null | Implement the Python class `KMP` described below.
Class description:
finds the first occurrence of a pattern string in a text string.
Method signatures and docstrings:
- def __init__(self, pat): Preprocesses the pat string.
- def search(self, txt): Returns the idx of the 1st occurrrence of the pattern string in the t... | Implement the Python class `KMP` described below.
Class description:
finds the first occurrence of a pattern string in a text string.
Method signatures and docstrings:
- def __init__(self, pat): Preprocesses the pat string.
- def search(self, txt): Returns the idx of the 1st occurrrence of the pattern string in the t... | d494b3041069d377d6a7a9c296a14334f2fa5acc | <|skeleton|>
class KMP:
"""finds the first occurrence of a pattern string in a text string."""
def __init__(self, pat):
"""Preprocesses the pat string."""
<|body_0|>
def search(self, txt):
"""Returns the idx of the 1st occurrrence of the pattern string in the text string."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KMP:
"""finds the first occurrence of a pattern string in a text string."""
def __init__(self, pat):
"""Preprocesses the pat string."""
self._pat = list(pat)
self._M = len(self._pat)
self._miss = [0 for i in range(self._M)]
self._dfa = cx.defaultdict(lambda: [0 for... | the_stack_v2_python_sparse | python/dvklopfenstein_PrincetonAlgorithms/PrincetonAlgorithms-master/py/AlgsSedgewickWayne/KMP.py | LiuFang816/SALSTM_py_data | train | 10 |
fb1200c85ac9ab4177dbb59360d3939337dfb76d | [
"row_num = len(array)\nfor i in range(row_num):\n col_num = len(array[i])\n for j in range(col_num):\n if array[i][j] == target:\n return True\nreturn False",
"row_num = 0\ncol_num = len(array[0]) - 1\nrow_count = len(array)\nwhile row_num < row_count and col_num >= 0:\n val = array[row... | <|body_start_0|>
row_num = len(array)
for i in range(row_num):
col_num = len(array[i])
for j in range(col_num):
if array[i][j] == target:
return True
return False
<|end_body_0|>
<|body_start_1|>
row_num = 0
col_num = le... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def Find_1(self, target, array):
"""方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性"""
<|body_0|>
def Find_2(self, target, array):
"""方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。时间复杂度为O(n)"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_75kplus_train_069564 | 1,457 | no_license | [
{
"docstring": "方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性",
"name": "Find_1",
"signature": "def Find_1(self, target, array)"
},
{
"docstring": "方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。时间复杂度为O(n)",
"name": "Find_2",
"signature": "def Find_2(self, target, array)... | 2 | stack_v2_sparse_classes_30k_train_014563 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def Find_1(self, target, array): 方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性
- def Find_2(self, target, array): 方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def Find_1(self, target, array): 方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性
- def Find_2(self, target, array): 方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。... | 6ee455019ae2d9adeea9fc3876f5da4297320715 | <|skeleton|>
class Solution:
def Find_1(self, target, array):
"""方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性"""
<|body_0|>
def Find_2(self, target, array):
"""方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。时间复杂度为O(n)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def Find_1(self, target, array):
"""方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性"""
row_num = len(array)
for i in range(row_num):
col_num = len(array[i])
for j in range(col_num):
if array[i][j] == target:
... | the_stack_v2_python_sparse | p1_array/a1_Find.py | atm1992/nowcoder_offer_in_Python27 | train | 0 | |
adc62f0d938247a8ed867dc196b7b8ece20f0e01 | [
"if not root:\n return True\n\ndef dfs(left: TreeNode, right: TreeNode) -> bool:\n if not left and (not right):\n return True\n elif not left or not right:\n return False\n elif left.val != right.val:\n return False\n return dfs(left.left, right.right) and dfs(left.right, right.l... | <|body_start_0|>
if not root:
return True
def dfs(left: TreeNode, right: TreeNode) -> bool:
if not left and (not right):
return True
elif not left or not right:
return False
elif left.val != right.val:
retur... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
"""DFS"""
<|body_0|>
def isSymmetricBFS(self, root: TreeNode) -> bool:
"""BFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return True
def dfs(left: TreeNo... | stack_v2_sparse_classes_75kplus_train_069565 | 2,301 | no_license | [
{
"docstring": "DFS",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root: TreeNode) -> bool"
},
{
"docstring": "BFS",
"name": "isSymmetricBFS",
"signature": "def isSymmetricBFS(self, root: TreeNode) -> bool"
}
] | 2 | stack_v2_sparse_classes_30k_train_017891 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root: TreeNode) -> bool: DFS
- def isSymmetricBFS(self, root: TreeNode) -> bool: BFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root: TreeNode) -> bool: DFS
- def isSymmetricBFS(self, root: TreeNode) -> bool: BFS
<|skeleton|>
class Solution:
def isSymmetric(self, root: TreeNode... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
"""DFS"""
<|body_0|>
def isSymmetricBFS(self, root: TreeNode) -> bool:
"""BFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
"""DFS"""
if not root:
return True
def dfs(left: TreeNode, right: TreeNode) -> bool:
if not left and (not right):
return True
elif not left or not right:
return... | the_stack_v2_python_sparse | 101.对称二叉树/solution.py | QtTao/daily_leetcode | train | 0 | |
bc4a76be250a78a13ddcde2d44befe79ba0eae72 | [
"self.small = 1e-90\nself.a1 = 0.2137\nself.c0 = 0.031091\nself.c1 = 0.046644\nself.b1 = 1.0 / 2.0 / self.c0 * np.exp(-self.c1 / 2.0 / self.c0)\nself.b2 = 2 * self.c0 * self.b1 ** 2\nself.b3 = 1.6382\nself.b4 = 0.49294",
"if n < self.small:\n return 0.0\nelse:\n return self.e_x(n, der=der) + self.e_corr(n, ... | <|body_start_0|>
self.small = 1e-90
self.a1 = 0.2137
self.c0 = 0.031091
self.c1 = 0.046644
self.b1 = 1.0 / 2.0 / self.c0 * np.exp(-self.c1 / 2.0 / self.c0)
self.b2 = 2 * self.c0 * self.b1 ** 2
self.b3 = 1.6382
self.b4 = 0.49294
<|end_body_0|>
<|body_start... | XC_PW92 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XC_PW92:
def __init__(self):
"""The Perdew-Wang 1992 LDA exchange-correlation functional."""
<|body_0|>
def exc(self, n, der=0):
"""Exchange-correlation with electron density n."""
<|body_1|>
def e_x(self, n, der=0):
"""Exchange."""
<|bod... | stack_v2_sparse_classes_75kplus_train_069566 | 1,566 | no_license | [
{
"docstring": "The Perdew-Wang 1992 LDA exchange-correlation functional.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Exchange-correlation with electron density n.",
"name": "exc",
"signature": "def exc(self, n, der=0)"
},
{
"docstring": "Exchange."... | 5 | stack_v2_sparse_classes_30k_train_036779 | Implement the Python class `XC_PW92` described below.
Class description:
Implement the XC_PW92 class.
Method signatures and docstrings:
- def __init__(self): The Perdew-Wang 1992 LDA exchange-correlation functional.
- def exc(self, n, der=0): Exchange-correlation with electron density n.
- def e_x(self, n, der=0): Ex... | Implement the Python class `XC_PW92` described below.
Class description:
Implement the XC_PW92 class.
Method signatures and docstrings:
- def __init__(self): The Perdew-Wang 1992 LDA exchange-correlation functional.
- def exc(self, n, der=0): Exchange-correlation with electron density n.
- def e_x(self, n, der=0): Ex... | d249c4f2a01f58a96083bac2377309c05f652907 | <|skeleton|>
class XC_PW92:
def __init__(self):
"""The Perdew-Wang 1992 LDA exchange-correlation functional."""
<|body_0|>
def exc(self, n, der=0):
"""Exchange-correlation with electron density n."""
<|body_1|>
def e_x(self, n, der=0):
"""Exchange."""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XC_PW92:
def __init__(self):
"""The Perdew-Wang 1992 LDA exchange-correlation functional."""
self.small = 1e-90
self.a1 = 0.2137
self.c0 = 0.031091
self.c1 = 0.046644
self.b1 = 1.0 / 2.0 / self.c0 * np.exp(-self.c1 / 2.0 / self.c0)
self.b2 = 2 * self.c0 ... | the_stack_v2_python_sparse | HOTBIT/atom_only/XC_PW92.py | f-fathurrahman/ffr-python-stuffs | train | 0 | |
cb860dd0ae2eb70cac8d187185fa3b03cf2e9f05 | [
"if obj.is_expression:\n dims = {}\n for var in obj.variable_names:\n dim_data = dict(units=obj.variable_units[var])\n dim = obj._symbol_dims.get(var)\n if dim is not None and dim != var:\n dim_data['symbol'] = var\n else:\n dim = var\n dims[dim] = Gene... | <|body_start_0|>
if obj.is_expression:
dims = {}
for var in obj.variable_names:
dim_data = dict(units=obj.variable_units[var])
dim = obj._symbol_dims.get(var)
if dim is not None and dim != var:
dim_data['symbol'] = var
... | Serialization class for weldx.core.GenericSeries | GenericSeriesConverter | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenericSeriesConverter:
"""Serialization class for weldx.core.GenericSeries"""
def to_yaml_tree(self, obj: GenericSeries, tag: str, ctx) -> dict:
"""Convert to python dict."""
<|body_0|>
def from_yaml_tree(self, node: dict, tag: str, ctx):
"""Construct from tree.... | stack_v2_sparse_classes_75kplus_train_069567 | 2,696 | permissive | [
{
"docstring": "Convert to python dict.",
"name": "to_yaml_tree",
"signature": "def to_yaml_tree(self, obj: GenericSeries, tag: str, ctx) -> dict"
},
{
"docstring": "Construct from tree.",
"name": "from_yaml_tree",
"signature": "def from_yaml_tree(self, node: dict, tag: str, ctx)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007818 | Implement the Python class `GenericSeriesConverter` described below.
Class description:
Serialization class for weldx.core.GenericSeries
Method signatures and docstrings:
- def to_yaml_tree(self, obj: GenericSeries, tag: str, ctx) -> dict: Convert to python dict.
- def from_yaml_tree(self, node: dict, tag: str, ctx):... | Implement the Python class `GenericSeriesConverter` described below.
Class description:
Serialization class for weldx.core.GenericSeries
Method signatures and docstrings:
- def to_yaml_tree(self, obj: GenericSeries, tag: str, ctx) -> dict: Convert to python dict.
- def from_yaml_tree(self, node: dict, tag: str, ctx):... | 7bc16a196ee669822f3663f3c7a08f6bbd0c76d5 | <|skeleton|>
class GenericSeriesConverter:
"""Serialization class for weldx.core.GenericSeries"""
def to_yaml_tree(self, obj: GenericSeries, tag: str, ctx) -> dict:
"""Convert to python dict."""
<|body_0|>
def from_yaml_tree(self, node: dict, tag: str, ctx):
"""Construct from tree.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GenericSeriesConverter:
"""Serialization class for weldx.core.GenericSeries"""
def to_yaml_tree(self, obj: GenericSeries, tag: str, ctx) -> dict:
"""Convert to python dict."""
if obj.is_expression:
dims = {}
for var in obj.variable_names:
dim_data =... | the_stack_v2_python_sparse | weldx/tags/core/generic_series.py | BAMWelDX/weldx | train | 20 |
08a38ac1dbb0396fe91c1a91498ca87a9cd58a86 | [
"if isinstance(path, (str, Path)):\n path = str(path)\nelse:\n raise TypeError(f\"'path' must be a str or a Path object, but received {type(path)}.\")\nimages = scandir(path, suffix=IMG_EXTENSIONS, recursive=True)\nimages = [osp.join(path, v) for v in images]\nassert images, f'{path} has no valid image file.'... | <|body_start_0|>
if isinstance(path, (str, Path)):
path = str(path)
else:
raise TypeError(f"'path' must be a str or a Path object, but received {type(path)}.")
images = scandir(path, suffix=IMG_EXTENSIONS, recursive=True)
images = [osp.join(path, v) for v in image... | Base class for generation datasets. | BaseGenerationDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseGenerationDataset:
"""Base class for generation datasets."""
def scan_folder(path):
"""Obtain image path list (including sub-folders) from a given folder. Args: path (str | :obj:`Path`): Folder path. Returns: list[str]: Image list obtained from the given folder."""
<|body... | stack_v2_sparse_classes_75kplus_train_069568 | 1,948 | permissive | [
{
"docstring": "Obtain image path list (including sub-folders) from a given folder. Args: path (str | :obj:`Path`): Folder path. Returns: list[str]: Image list obtained from the given folder.",
"name": "scan_folder",
"signature": "def scan_folder(path)"
},
{
"docstring": "Evaluating with saving ... | 2 | stack_v2_sparse_classes_30k_train_004206 | Implement the Python class `BaseGenerationDataset` described below.
Class description:
Base class for generation datasets.
Method signatures and docstrings:
- def scan_folder(path): Obtain image path list (including sub-folders) from a given folder. Args: path (str | :obj:`Path`): Folder path. Returns: list[str]: Ima... | Implement the Python class `BaseGenerationDataset` described below.
Class description:
Base class for generation datasets.
Method signatures and docstrings:
- def scan_folder(path): Obtain image path list (including sub-folders) from a given folder. Args: path (str | :obj:`Path`): Folder path. Returns: list[str]: Ima... | 5678851339dff90becb09c3dec41e7214207ccbc | <|skeleton|>
class BaseGenerationDataset:
"""Base class for generation datasets."""
def scan_folder(path):
"""Obtain image path list (including sub-folders) from a given folder. Args: path (str | :obj:`Path`): Folder path. Returns: list[str]: Image list obtained from the given folder."""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseGenerationDataset:
"""Base class for generation datasets."""
def scan_folder(path):
"""Obtain image path list (including sub-folders) from a given folder. Args: path (str | :obj:`Path`): Folder path. Returns: list[str]: Image list obtained from the given folder."""
if isinstance(path,... | the_stack_v2_python_sparse | mmedit/datasets/base_generation_dataset.py | ImCharlesY/AdaInt | train | 141 |
6499f1f45fa7bcd8c4ef943da452061d62acf782 | [
"m = 1 + int(math.log2(n))\nself.dp = [[-1] * m for _ in range(n)]\nfor j in range(m):\n for i in range(n):\n if j == 0:\n self.dp[i][j] = parent[i]\n elif self.dp[i][j - 1] != -1:\n self.dp[i][j] = self.dp[self.dp[i][j - 1]][j - 1]",
"while k > 0 and node != -1:\n i = in... | <|body_start_0|>
m = 1 + int(math.log2(n))
self.dp = [[-1] * m for _ in range(n)]
for j in range(m):
for i in range(n):
if j == 0:
self.dp[i][j] = parent[i]
elif self.dp[i][j - 1] != -1:
self.dp[i][j] = self.dp[s... | TreeAncestor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TreeAncestor:
def __init__(self, n: int, parent: List[int]):
"""self.graph = collections.defaultdict(int) for cur,par in enumerate(parent): self.graph[cur] = par"""
<|body_0|>
def getKthAncestor(self, node: int, k: int) -> int:
"""visited = [] ans = -1 #dfs def dfs(n... | stack_v2_sparse_classes_75kplus_train_069569 | 1,525 | no_license | [
{
"docstring": "self.graph = collections.defaultdict(int) for cur,par in enumerate(parent): self.graph[cur] = par",
"name": "__init__",
"signature": "def __init__(self, n: int, parent: List[int])"
},
{
"docstring": "visited = [] ans = -1 #dfs def dfs(node, cnt): nonlocal ans if node == -1: retur... | 2 | stack_v2_sparse_classes_30k_train_016673 | Implement the Python class `TreeAncestor` described below.
Class description:
Implement the TreeAncestor class.
Method signatures and docstrings:
- def __init__(self, n: int, parent: List[int]): self.graph = collections.defaultdict(int) for cur,par in enumerate(parent): self.graph[cur] = par
- def getKthAncestor(self... | Implement the Python class `TreeAncestor` described below.
Class description:
Implement the TreeAncestor class.
Method signatures and docstrings:
- def __init__(self, n: int, parent: List[int]): self.graph = collections.defaultdict(int) for cur,par in enumerate(parent): self.graph[cur] = par
- def getKthAncestor(self... | a6eb22c3f84459c3c054c00aec59d0d87b685bfa | <|skeleton|>
class TreeAncestor:
def __init__(self, n: int, parent: List[int]):
"""self.graph = collections.defaultdict(int) for cur,par in enumerate(parent): self.graph[cur] = par"""
<|body_0|>
def getKthAncestor(self, node: int, k: int) -> int:
"""visited = [] ans = -1 #dfs def dfs(n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TreeAncestor:
def __init__(self, n: int, parent: List[int]):
"""self.graph = collections.defaultdict(int) for cur,par in enumerate(parent): self.graph[cur] = par"""
m = 1 + int(math.log2(n))
self.dp = [[-1] * m for _ in range(n)]
for j in range(m):
for i in range(n)... | the_stack_v2_python_sparse | 1483. Kth Ancestor of a Tree Node.py | chuzcjoe/Leetcode | train | 6 | |
4beca7751837a40cd931f643330ec89752f232dc | [
"Cases.__init__(self)\nmorpheme_index = word.morphemes.index(morpheme)\ngloss = get_glosses_concatenated(morpheme)\nword_index = phrase.words.index(word)\nself.add_case(config['case_type_gloss_morph'], morpheme.morpheme.lower(), gloss)\nself.add_case(config['case_type_gloss_word'], morpheme.morpheme.lower(), gloss)... | <|body_start_0|>
Cases.__init__(self)
morpheme_index = word.morphemes.index(morpheme)
gloss = get_glosses_concatenated(morpheme)
word_index = phrase.words.index(word)
self.add_case(config['case_type_gloss_morph'], morpheme.morpheme.lower(), gloss)
self.add_case(config['ca... | MorphemeCases | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MorphemeCases:
def __init__(self, morpheme, word, phrase):
"""Creates the MorphemeTargetCases object, registering all valid cases. :param morpheme: :param word: :param phrase:"""
<|body_0|>
def add_surrounding_morpheme_ngram_cases(self, morpheme_index, morphemes, gloss_to):
... | stack_v2_sparse_classes_75kplus_train_069570 | 23,184 | permissive | [
{
"docstring": "Creates the MorphemeTargetCases object, registering all valid cases. :param morpheme: :param word: :param phrase:",
"name": "__init__",
"signature": "def __init__(self, morpheme, word, phrase)"
},
{
"docstring": "Adds the surrounding morph and gloss n-grams of a given morpheme. :... | 3 | stack_v2_sparse_classes_30k_train_044025 | Implement the Python class `MorphemeCases` described below.
Class description:
Implement the MorphemeCases class.
Method signatures and docstrings:
- def __init__(self, morpheme, word, phrase): Creates the MorphemeTargetCases object, registering all valid cases. :param morpheme: :param word: :param phrase:
- def add_... | Implement the Python class `MorphemeCases` described below.
Class description:
Implement the MorphemeCases class.
Method signatures and docstrings:
- def __init__(self, morpheme, word, phrase): Creates the MorphemeTargetCases object, registering all valid cases. :param morpheme: :param word: :param phrase:
- def add_... | b311f33449c8796e656600e8c9f255b40c4c2dce | <|skeleton|>
class MorphemeCases:
def __init__(self, morpheme, word, phrase):
"""Creates the MorphemeTargetCases object, registering all valid cases. :param morpheme: :param word: :param phrase:"""
<|body_0|>
def add_surrounding_morpheme_ngram_cases(self, morpheme_index, morphemes, gloss_to):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MorphemeCases:
def __init__(self, morpheme, word, phrase):
"""Creates the MorphemeTargetCases object, registering all valid cases. :param morpheme: :param word: :param phrase:"""
Cases.__init__(self)
morpheme_index = word.morphemes.index(morpheme)
gloss = get_glosses_concatenat... | the_stack_v2_python_sparse | casetagger/models.py | Typecraft/casetagger | train | 1 | |
921dbdddf4b3add131887a38cc23c79b9e68c8d0 | [
"if not link_share_id:\n link_shares = []\n for link_share in Link_Share.objects.filter(user=request.user).exclude(valid_till__lt=timezone.now()).exclude(allowed_reads__lte=0):\n link_shares.append({'id': link_share.id, 'public_title': link_share.public_title, 'allowed_reads': link_share.allowed_reads,... | <|body_start_0|>
if not link_share_id:
link_shares = []
for link_share in Link_Share.objects.filter(user=request.user).exclude(valid_till__lt=timezone.now()).exclude(allowed_reads__lte=0):
link_shares.append({'id': link_share.id, 'public_title': link_share.public_title, '... | Check the REST Token and returns a list of all link_shares or the specified link_shares details | LinkShareView | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkShareView:
"""Check the REST Token and returns a list of all link_shares or the specified link_shares details"""
def get(self, request, link_share_id=None, *args, **kwargs):
"""Returns either a list of all link_shares with own access privileges or the members specified link_share... | stack_v2_sparse_classes_75kplus_train_069571 | 5,856 | permissive | [
{
"docstring": "Returns either a list of all link_shares with own access privileges or the members specified link_share :param request: :type request: :param link_share_id: :type link_share_id: :param args: :type args: :param kwargs: :type kwargs: :return: 200 / 403 :rtype:",
"name": "get",
"signature":... | 4 | stack_v2_sparse_classes_30k_train_026504 | Implement the Python class `LinkShareView` described below.
Class description:
Check the REST Token and returns a list of all link_shares or the specified link_shares details
Method signatures and docstrings:
- def get(self, request, link_share_id=None, *args, **kwargs): Returns either a list of all link_shares with ... | Implement the Python class `LinkShareView` described below.
Class description:
Check the REST Token and returns a list of all link_shares or the specified link_shares details
Method signatures and docstrings:
- def get(self, request, link_share_id=None, *args, **kwargs): Returns either a list of all link_shares with ... | 8936aa8ccdee8b9617ef7d894cb9a9a9f6f473cf | <|skeleton|>
class LinkShareView:
"""Check the REST Token and returns a list of all link_shares or the specified link_shares details"""
def get(self, request, link_share_id=None, *args, **kwargs):
"""Returns either a list of all link_shares with own access privileges or the members specified link_share... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinkShareView:
"""Check the REST Token and returns a list of all link_shares or the specified link_shares details"""
def get(self, request, link_share_id=None, *args, **kwargs):
"""Returns either a list of all link_shares with own access privileges or the members specified link_share :param reque... | the_stack_v2_python_sparse | psono/restapi/views/link_share.py | psono/psono-server | train | 76 |
6a89a2c3cd29802a922fa1e65159cd1939588438 | [
"traits = self.award_rule_form_class.get_possible_traits()\nif traits:\n return filter(lambda x: x[0] is not None, traits)\nelse:\n return []",
"if self.value():\n try:\n return queryset.filter(award__awardrule__trait=self.value())\n except FieldError:\n return queryset.filter(awardrule_... | <|body_start_0|>
traits = self.award_rule_form_class.get_possible_traits()
if traits:
return filter(lambda x: x[0] is not None, traits)
else:
return []
<|end_body_0|>
<|body_start_1|>
if self.value():
try:
return queryset.filter(award_... | TraitListFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TraitListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar."... | stack_v2_sparse_classes_75kplus_train_069572 | 5,432 | no_license | [
{
"docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.",
"name": "lookups",
"signature": "def lookups(self, request,... | 2 | stack_v2_sparse_classes_30k_train_035349 | Implement the Python class `TraitListFilter` described below.
Class description:
Implement the TraitListFilter class.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL que... | Implement the Python class `TraitListFilter` described below.
Class description:
Implement the TraitListFilter class.
Method signatures and docstrings:
- def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL que... | b3cf77ed92acbbe499619e3629d2f94a90db2010 | <|skeleton|>
class TraitListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TraitListFilter:
def lookups(self, request, model_admin):
"""Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar."""
tra... | the_stack_v2_python_sparse | apps/awards/admin.py | kbaskett248/fair_scoring_site | train | 0 | |
48495827d4f139c6463ed0a004e9465dab3f2da0 | [
"schema = EmployeeSchema()\nemployee = Employee.get_by_id(employee_id)\nif not employee:\n return (dict(status='fail', message=f'Employee with id {employee_id} not found'), 404)\nemployee_data, errors = schema.dumps(employee)\nif errors:\n return (dict(status='fail', message=errors), 500)\nreturn (dict(status... | <|body_start_0|>
schema = EmployeeSchema()
employee = Employee.get_by_id(employee_id)
if not employee:
return (dict(status='fail', message=f'Employee with id {employee_id} not found'), 404)
employee_data, errors = schema.dumps(employee)
if errors:
return (... | EmployeeDetailView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmployeeDetailView:
def get(self, employee_id):
"""Getting individual employee"""
<|body_0|>
def patch(self, employee_id):
"""Update a single employee"""
<|body_1|>
def delete(self, employee_id):
"""Delete a single employee"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus_train_069573 | 3,201 | no_license | [
{
"docstring": "Getting individual employee",
"name": "get",
"signature": "def get(self, employee_id)"
},
{
"docstring": "Update a single employee",
"name": "patch",
"signature": "def patch(self, employee_id)"
},
{
"docstring": "Delete a single employee",
"name": "delete",
... | 3 | stack_v2_sparse_classes_30k_train_047001 | Implement the Python class `EmployeeDetailView` described below.
Class description:
Implement the EmployeeDetailView class.
Method signatures and docstrings:
- def get(self, employee_id): Getting individual employee
- def patch(self, employee_id): Update a single employee
- def delete(self, employee_id): Delete a sin... | Implement the Python class `EmployeeDetailView` described below.
Class description:
Implement the EmployeeDetailView class.
Method signatures and docstrings:
- def get(self, employee_id): Getting individual employee
- def patch(self, employee_id): Update a single employee
- def delete(self, employee_id): Delete a sin... | 015d70b8f79df6c1a5629add35767cee52f424f5 | <|skeleton|>
class EmployeeDetailView:
def get(self, employee_id):
"""Getting individual employee"""
<|body_0|>
def patch(self, employee_id):
"""Update a single employee"""
<|body_1|>
def delete(self, employee_id):
"""Delete a single employee"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmployeeDetailView:
def get(self, employee_id):
"""Getting individual employee"""
schema = EmployeeSchema()
employee = Employee.get_by_id(employee_id)
if not employee:
return (dict(status='fail', message=f'Employee with id {employee_id} not found'), 404)
emp... | the_stack_v2_python_sparse | app/controllers/employee.py | MutegekiHenry/project-cohort-backend | train | 0 | |
7a89f8e136a05b851b8b5d64fc6a04148fb54a59 | [
"self.reset_stats()\nself.game_active = False\nwith open('record.txt') as rec:\n self.record = int(rec.read())",
"self.score_pizza = 0\nself.score_cola = 0\nself.score_cheetos = 0\nself.score_cake = 0"
] | <|body_start_0|>
self.reset_stats()
self.game_active = False
with open('record.txt') as rec:
self.record = int(rec.read())
<|end_body_0|>
<|body_start_1|>
self.score_pizza = 0
self.score_cola = 0
self.score_cheetos = 0
self.score_cake = 0
<|end_body_1... | Отслеживание статистики для игры Yummie catcher | GameStats | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameStats:
"""Отслеживание статистики для игры Yummie catcher"""
def __init__(self, ai_settings, screen):
"""Инициализирет статистику"""
<|body_0|>
def reset_stats(self):
"""Сброс статистики"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.r... | stack_v2_sparse_classes_75kplus_train_069574 | 517 | no_license | [
{
"docstring": "Инициализирет статистику",
"name": "__init__",
"signature": "def __init__(self, ai_settings, screen)"
},
{
"docstring": "Сброс статистики",
"name": "reset_stats",
"signature": "def reset_stats(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_025448 | Implement the Python class `GameStats` described below.
Class description:
Отслеживание статистики для игры Yummie catcher
Method signatures and docstrings:
- def __init__(self, ai_settings, screen): Инициализирет статистику
- def reset_stats(self): Сброс статистики | Implement the Python class `GameStats` described below.
Class description:
Отслеживание статистики для игры Yummie catcher
Method signatures and docstrings:
- def __init__(self, ai_settings, screen): Инициализирет статистику
- def reset_stats(self): Сброс статистики
<|skeleton|>
class GameStats:
"""Отслеживание ... | 1f1cbcac5c2f81a16967cadb2c55f6f2c7ce75be | <|skeleton|>
class GameStats:
"""Отслеживание статистики для игры Yummie catcher"""
def __init__(self, ai_settings, screen):
"""Инициализирет статистику"""
<|body_0|>
def reset_stats(self):
"""Сброс статистики"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameStats:
"""Отслеживание статистики для игры Yummie catcher"""
def __init__(self, ai_settings, screen):
"""Инициализирет статистику"""
self.reset_stats()
self.game_active = False
with open('record.txt') as rec:
self.record = int(rec.read())
def reset_sta... | the_stack_v2_python_sparse | game_stat.py | Iljanikolaev/Yummie-catcher | train | 0 |
e7f2400e7d765a9b168719127be8f4659eba42ff | [
"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... | Provides text analysis operations such as sentiment analysis and entity recognition. | LanguageServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LanguageServiceServicer:
"""Provides text analysis operations such as sentiment analysis and entity recognition."""
def AnalyzeSentiment(self, request, context):
"""Analyzes the sentiment of the provided text."""
<|body_0|>
def AnalyzeEntities(self, request, context):
... | stack_v2_sparse_classes_75kplus_train_069575 | 6,518 | no_license | [
{
"docstring": "Analyzes the sentiment of the provided text.",
"name": "AnalyzeSentiment",
"signature": "def AnalyzeSentiment(self, request, context)"
},
{
"docstring": "Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for eac... | 5 | stack_v2_sparse_classes_30k_test_002190 | Implement the Python class `LanguageServiceServicer` described below.
Class description:
Provides text analysis operations such as sentiment analysis and entity recognition.
Method signatures and docstrings:
- def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text.
- def AnalyzeEnti... | Implement the Python class `LanguageServiceServicer` described below.
Class description:
Provides text analysis operations such as sentiment analysis and entity recognition.
Method signatures and docstrings:
- def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text.
- def AnalyzeEnti... | d7424d21aa0dc121acc4d64b427ba365a3581a20 | <|skeleton|>
class LanguageServiceServicer:
"""Provides text analysis operations such as sentiment analysis and entity recognition."""
def AnalyzeSentiment(self, request, context):
"""Analyzes the sentiment of the provided text."""
<|body_0|>
def AnalyzeEntities(self, request, context):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LanguageServiceServicer:
"""Provides text analysis operations such as sentiment analysis and entity recognition."""
def AnalyzeSentiment(self, request, context):
"""Analyzes the sentiment of the provided text."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details(... | the_stack_v2_python_sparse | google/cloud/language/v1/language_service_pb2_grpc.py | msachtler/bazel-event-protocol-parser | train | 1 |
c69c633ed0d4cc30bc8b89190e2c5e9ed0f706b4 | [
"self.rtol = rtol\nself.atol = atol\nsuper(WeightedDiGraphMatcher, self).__init__(G1, G2)",
"G1_succ = self.G1.succ\nG1_pred = self.G1.pred\nG2_succ = self.G2.succ\nG2_pred = self.G2.pred\ncore_1 = self.core_1\nrtol, atol = (self.rtol, self.atol)\nfor successor in G1_succ[G1_node]:\n if successor is G1_node:\n... | <|body_start_0|>
self.rtol = rtol
self.atol = atol
super(WeightedDiGraphMatcher, self).__init__(G1, G2)
<|end_body_0|>
<|body_start_1|>
G1_succ = self.G1.succ
G1_pred = self.G1.pred
G2_succ = self.G2.succ
G2_pred = self.G2.pred
core_1 = self.core_1
... | Implementation of VF2 algorithm for directed, weighted graphs. | WeightedDiGraphMatcher | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeightedDiGraphMatcher:
"""Implementation of VF2 algorithm for directed, weighted graphs."""
def __init__(self, G1, G2, rtol=1e-06, atol=1e-09):
"""Initialize WeightedGraphMatcher. Parameters ---------- G1, G2 : nx.DiGraph instances G1 and G2 must be weighted graphs. rtol : float, op... | stack_v2_sparse_classes_75kplus_train_069576 | 9,804 | permissive | [
{
"docstring": "Initialize WeightedGraphMatcher. Parameters ---------- G1, G2 : nx.DiGraph instances G1 and G2 must be weighted graphs. rtol : float, optional The relative tolerance used to compare weights. atol : float, optional The absolute tolerance used to compare weights.",
"name": "__init__",
"sig... | 2 | stack_v2_sparse_classes_30k_train_017878 | Implement the Python class `WeightedDiGraphMatcher` described below.
Class description:
Implementation of VF2 algorithm for directed, weighted graphs.
Method signatures and docstrings:
- def __init__(self, G1, G2, rtol=1e-06, atol=1e-09): Initialize WeightedGraphMatcher. Parameters ---------- G1, G2 : nx.DiGraph inst... | Implement the Python class `WeightedDiGraphMatcher` described below.
Class description:
Implementation of VF2 algorithm for directed, weighted graphs.
Method signatures and docstrings:
- def __init__(self, G1, G2, rtol=1e-06, atol=1e-09): Initialize WeightedGraphMatcher. Parameters ---------- G1, G2 : nx.DiGraph inst... | de0cdb26248f6d0d8bea594124c1dd7a155d406d | <|skeleton|>
class WeightedDiGraphMatcher:
"""Implementation of VF2 algorithm for directed, weighted graphs."""
def __init__(self, G1, G2, rtol=1e-06, atol=1e-09):
"""Initialize WeightedGraphMatcher. Parameters ---------- G1, G2 : nx.DiGraph instances G1 and G2 must be weighted graphs. rtol : float, op... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeightedDiGraphMatcher:
"""Implementation of VF2 algorithm for directed, weighted graphs."""
def __init__(self, G1, G2, rtol=1e-06, atol=1e-09):
"""Initialize WeightedGraphMatcher. Parameters ---------- G1, G2 : nx.DiGraph instances G1 and G2 must be weighted graphs. rtol : float, optional The re... | the_stack_v2_python_sparse | Source/lib/CrossPlatform/networkx/algorithms/isomorphism/vf2weighted.py | JaneliaSciComp/Neuroptikon | train | 9 |
4d35d1d43c589a6bf871547ce9980aa14843cf68 | [
"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... | The service responsible for managing user information | UserManagementServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserManagementServiceServicer:
"""The service responsible for managing user information"""
def CreateUser(self, request, context):
"""Creates a new user"""
<|body_0|>
def VerifyCredentials(self, request, context):
"""Verify a user's username and password"""
... | stack_v2_sparse_classes_75kplus_train_069577 | 3,708 | permissive | [
{
"docstring": "Creates a new user",
"name": "CreateUser",
"signature": "def CreateUser(self, request, context)"
},
{
"docstring": "Verify a user's username and password",
"name": "VerifyCredentials",
"signature": "def VerifyCredentials(self, request, context)"
},
{
"docstring": ... | 3 | stack_v2_sparse_classes_30k_train_048953 | Implement the Python class `UserManagementServiceServicer` described below.
Class description:
The service responsible for managing user information
Method signatures and docstrings:
- def CreateUser(self, request, context): Creates a new user
- def VerifyCredentials(self, request, context): Verify a user's username ... | Implement the Python class `UserManagementServiceServicer` described below.
Class description:
The service responsible for managing user information
Method signatures and docstrings:
- def CreateUser(self, request, context): Creates a new user
- def VerifyCredentials(self, request, context): Verify a user's username ... | 55a610c97fd53c405edb2459c2722fc03857cb83 | <|skeleton|>
class UserManagementServiceServicer:
"""The service responsible for managing user information"""
def CreateUser(self, request, context):
"""Creates a new user"""
<|body_0|>
def VerifyCredentials(self, request, context):
"""Verify a user's username and password"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserManagementServiceServicer:
"""The service responsible for managing user information"""
def CreateUser(self, request, context):
"""Creates a new user"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedEr... | the_stack_v2_python_sparse | killrvideo/user_management/user_management_service_pb2_grpc.py | krzysztof-adamski/killrvideo-python | train | 0 |
e3fb608b09db47ed923c79a0ca6e3c378758d6d5 | [
"app = App.get_running_app()\nif app.active_trip._destinations is None:\n app.active_trip._destinations = []\nself.ids.listview.adapter.data = app.active_trip._destinations\nself.reload()",
"adapter = self.ids.listview.adapter\nprop = adapter.property('data')\nprop.dispatch(adapter)",
"def callback(*args):\n... | <|body_start_0|>
app = App.get_running_app()
if app.active_trip._destinations is None:
app.active_trip._destinations = []
self.ids.listview.adapter.data = app.active_trip._destinations
self.reload()
<|end_body_0|>
<|body_start_1|>
adapter = self.ids.listview.adapter
... | Represent the screen to manage trips created by the authenticated user | TripTracker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TripTracker:
"""Represent the screen to manage trips created by the authenticated user"""
def on_pre_enter(self, *args):
"""Update listview showing destinations of the active trip"""
<|body_0|>
def reload(self):
"""force updating list view"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_069578 | 7,386 | no_license | [
{
"docstring": "Update listview showing destinations of the active trip",
"name": "on_pre_enter",
"signature": "def on_pre_enter(self, *args)"
},
{
"docstring": "force updating list view",
"name": "reload",
"signature": "def reload(self)"
},
{
"docstring": "Finish the active trip... | 4 | stack_v2_sparse_classes_30k_train_050768 | Implement the Python class `TripTracker` described below.
Class description:
Represent the screen to manage trips created by the authenticated user
Method signatures and docstrings:
- def on_pre_enter(self, *args): Update listview showing destinations of the active trip
- def reload(self): force updating list view
- ... | Implement the Python class `TripTracker` described below.
Class description:
Represent the screen to manage trips created by the authenticated user
Method signatures and docstrings:
- def on_pre_enter(self, *args): Update listview showing destinations of the active trip
- def reload(self): force updating list view
- ... | d986e3b802b349f7c27c97fdebf7f084dc95fdde | <|skeleton|>
class TripTracker:
"""Represent the screen to manage trips created by the authenticated user"""
def on_pre_enter(self, *args):
"""Update listview showing destinations of the active trip"""
<|body_0|>
def reload(self):
"""force updating list view"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TripTracker:
"""Represent the screen to manage trips created by the authenticated user"""
def on_pre_enter(self, *args):
"""Update listview showing destinations of the active trip"""
app = App.get_running_app()
if app.active_trip._destinations is None:
app.active_trip.... | the_stack_v2_python_sparse | ui/trip_tracker.py | Salemalbarqi3090/online_travel_distribution | train | 0 |
8f71499291f0f9a084fddc33c479e83367e52ca0 | [
"if not PolicyCapabilitiesType._is_valid(type):\n raise OnepIllegalArgumentException('invalid policy type')\nself.policy_type = type\nself.network_element = element\nself.session_id = element.session_handle._id\nself.client = Client(element.api_protocol)\nself.table = {'type': None, 'actions': [], 'matches': []}... | <|body_start_0|>
if not PolicyCapabilitiesType._is_valid(type):
raise OnepIllegalArgumentException('invalid policy type')
self.policy_type = type
self.network_element = element
self.session_id = element.session_handle._id
self.client = Client(element.api_protocol)
... | Internal PolicyCapabilities class stores the capabilities of the Network Element. ***DEPRECATED*** classmethods get_capabilities and get_table_capabilities Please use caps.get_table_capabilities() **************** | PolicyCapabilities | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PolicyCapabilities:
"""Internal PolicyCapabilities class stores the capabilities of the Network Element. ***DEPRECATED*** classmethods get_capabilities and get_table_capabilities Please use caps.get_table_capabilities() ****************"""
def __init__(self, type, element):
"""Class ... | stack_v2_sparse_classes_75kplus_train_069579 | 15,793 | no_license | [
{
"docstring": "Class PolicyCapabilities. @param type: PolicyCapabilitiesType for type of policy @type type: {PolicyCapabilitiesType<onep.policyservice.caps.PolicyCapabilitiesType>} @param element: NetworkElement instance. @type element: {NetworkElement<onep.element.NetworkElement>} @raise OnepIllegalArgumentEx... | 3 | stack_v2_sparse_classes_30k_train_023338 | Implement the Python class `PolicyCapabilities` described below.
Class description:
Internal PolicyCapabilities class stores the capabilities of the Network Element. ***DEPRECATED*** classmethods get_capabilities and get_table_capabilities Please use caps.get_table_capabilities() ****************
Method signatures an... | Implement the Python class `PolicyCapabilities` described below.
Class description:
Internal PolicyCapabilities class stores the capabilities of the Network Element. ***DEPRECATED*** classmethods get_capabilities and get_table_capabilities Please use caps.get_table_capabilities() ****************
Method signatures an... | 54bc49eaed14f7832aca45c4f52311a00282d862 | <|skeleton|>
class PolicyCapabilities:
"""Internal PolicyCapabilities class stores the capabilities of the Network Element. ***DEPRECATED*** classmethods get_capabilities and get_table_capabilities Please use caps.get_table_capabilities() ****************"""
def __init__(self, type, element):
"""Class ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PolicyCapabilities:
"""Internal PolicyCapabilities class stores the capabilities of the Network Element. ***DEPRECATED*** classmethods get_capabilities and get_table_capabilities Please use caps.get_table_capabilities() ****************"""
def __init__(self, type, element):
"""Class PolicyCapabil... | the_stack_v2_python_sparse | onepk_without_pyc/onep/policyservice/caps.py | neoyogi/onepk | train | 0 |
e3ee6af91c194503033dcafd7f55ff9dfed4f143 | [
"self.n = n\nself.q = q\nself.log = (q - 1).bit_length()\nself.size = 1 << self.log\nself.seg = [[] for _ in range(2 * self.size)]\nself.edges = []\nself.edgeId = {}\nself.remain = set()\nself.uf = ATCRevocableUnionFindArray(self.n)",
"if u > v:\n u, v = (v, u)\nself.remain.add((u, v))\nself.edgeId[u, v] = t",... | <|body_start_0|>
self.n = n
self.q = q
self.log = (q - 1).bit_length()
self.size = 1 << self.log
self.seg = [[] for _ in range(2 * self.size)]
self.edges = []
self.edgeId = {}
self.remain = set()
self.uf = ATCRevocableUnionFindArray(self.n)
<|end_b... | OfflineDynamicConnectivity | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfflineDynamicConnectivity:
def __init__(self, n: int, q: int):
"""离线动态连通性查询 Args: n (int): 顶点数 q (int): 查询数"""
<|body_0|>
def addEdge(self, u: int, v: int, t: int):
"""時刻tに辺u-vを追加する。"""
<|body_1|>
def removeEdge(self, u: int, v: int, t: int):
""... | stack_v2_sparse_classes_75kplus_train_069580 | 5,383 | no_license | [
{
"docstring": "离线动态连通性查询 Args: n (int): 顶点数 q (int): 查询数",
"name": "__init__",
"signature": "def __init__(self, n: int, q: int)"
},
{
"docstring": "時刻tに辺u-vを追加する。",
"name": "addEdge",
"signature": "def addEdge(self, u: int, v: int, t: int)"
},
{
"docstring": "時刻tに辺u-vを削除する。",
... | 6 | stack_v2_sparse_classes_30k_test_001830 | Implement the Python class `OfflineDynamicConnectivity` described below.
Class description:
Implement the OfflineDynamicConnectivity class.
Method signatures and docstrings:
- def __init__(self, n: int, q: int): 离线动态连通性查询 Args: n (int): 顶点数 q (int): 查询数
- def addEdge(self, u: int, v: int, t: int): 時刻tに辺u-vを追加する。
- de... | Implement the Python class `OfflineDynamicConnectivity` described below.
Class description:
Implement the OfflineDynamicConnectivity class.
Method signatures and docstrings:
- def __init__(self, n: int, q: int): 离线动态连通性查询 Args: n (int): 顶点数 q (int): 查询数
- def addEdge(self, u: int, v: int, t: int): 時刻tに辺u-vを追加する。
- de... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class OfflineDynamicConnectivity:
def __init__(self, n: int, q: int):
"""离线动态连通性查询 Args: n (int): 顶点数 q (int): 查询数"""
<|body_0|>
def addEdge(self, u: int, v: int, t: int):
"""時刻tに辺u-vを追加する。"""
<|body_1|>
def removeEdge(self, u: int, v: int, t: int):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OfflineDynamicConnectivity:
def __init__(self, n: int, q: int):
"""离线动态连通性查询 Args: n (int): 顶点数 q (int): 查询数"""
self.n = n
self.q = q
self.log = (q - 1).bit_length()
self.size = 1 << self.log
self.seg = [[] for _ in range(2 * self.size)]
self.edges = []
... | the_stack_v2_python_sparse | 22_专题/离线查询/并查集/Dynamic Graph Vertex Add Component Sum-子树和.py | 981377660LMT/algorithm-study | train | 225 | |
4f74ba6d760a09d8258ca62ee4f2c724509d4a36 | [
"self.assertEqual('appyhay', piglatin.to_piglatin('happy'))\nself.assertEqual('uckday', piglatin.to_piglatin('duck'))\nself.assertEqual('oveglay', piglatin.to_piglatin('glove'))\nself.assertEqual('eggway', piglatin.to_piglatin('egg'))\nself.assertEqual('inboxway', piglatin.to_piglatin('inbox'))\nself.assertEqual('a... | <|body_start_0|>
self.assertEqual('appyhay', piglatin.to_piglatin('happy'))
self.assertEqual('uckday', piglatin.to_piglatin('duck'))
self.assertEqual('oveglay', piglatin.to_piglatin('glove'))
self.assertEqual('eggway', piglatin.to_piglatin('egg'))
self.assertEqual('inboxway', pig... | Test class for Piglatin | TestPiglatin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPiglatin:
"""Test class for Piglatin"""
def test_to_piglatin(self):
"""Tests the to_piglatin function"""
<|body_0|>
def test_from_piglatin(self):
"""Tests the from_piglatin function"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.assert... | stack_v2_sparse_classes_75kplus_train_069581 | 1,429 | no_license | [
{
"docstring": "Tests the to_piglatin function",
"name": "test_to_piglatin",
"signature": "def test_to_piglatin(self)"
},
{
"docstring": "Tests the from_piglatin function",
"name": "test_from_piglatin",
"signature": "def test_from_piglatin(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_028333 | Implement the Python class `TestPiglatin` described below.
Class description:
Test class for Piglatin
Method signatures and docstrings:
- def test_to_piglatin(self): Tests the to_piglatin function
- def test_from_piglatin(self): Tests the from_piglatin function | Implement the Python class `TestPiglatin` described below.
Class description:
Test class for Piglatin
Method signatures and docstrings:
- def test_to_piglatin(self): Tests the to_piglatin function
- def test_from_piglatin(self): Tests the from_piglatin function
<|skeleton|>
class TestPiglatin:
"""Test class for ... | a1dc9131e0ee089e905cbf15b3ef200e0c32d2be | <|skeleton|>
class TestPiglatin:
"""Test class for Piglatin"""
def test_to_piglatin(self):
"""Tests the to_piglatin function"""
<|body_0|>
def test_from_piglatin(self):
"""Tests the from_piglatin function"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestPiglatin:
"""Test class for Piglatin"""
def test_to_piglatin(self):
"""Tests the to_piglatin function"""
self.assertEqual('appyhay', piglatin.to_piglatin('happy'))
self.assertEqual('uckday', piglatin.to_piglatin('duck'))
self.assertEqual('oveglay', piglatin.to_piglatin... | the_stack_v2_python_sparse | python fundamentals/PythonFundamentals_exercises_solutions/strings/test_piglatin.py | jareyeshurtado/ISY_Training_Reyes | train | 0 |
ca809099a2db6f2598cc95337667951ef8095c00 | [
"now_time = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')\nmylogs.log_info('-----------------------test_7operate_monitor---------------------------')\nmylogs.log_info('Start to execute test set env and launch ota at {}'.format(now_time))",
"user.click_connect_btn()\nsp(2)\nuser.click_download_and_install_... | <|body_start_0|>
now_time = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
mylogs.log_info('-----------------------test_7operate_monitor---------------------------')
mylogs.log_info('Start to execute test set env and launch ota at {}'.format(now_time))
<|end_body_0|>
<|body_start_1|>
... | TestOtaSmokeClass | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestOtaSmokeClass:
def setup_class(self):
"""Execute one time before run all cases"""
<|body_0|>
def test_operate_monitor(self):
"""Todo://1.connet,download,install 2.take screen shot"""
<|body_1|>
def teardown_class(self):
"""Execute one time af... | stack_v2_sparse_classes_75kplus_train_069582 | 3,731 | permissive | [
{
"docstring": "Execute one time before run all cases",
"name": "setup_class",
"signature": "def setup_class(self)"
},
{
"docstring": "Todo://1.connet,download,install 2.take screen shot",
"name": "test_operate_monitor",
"signature": "def test_operate_monitor(self)"
},
{
"docstri... | 3 | stack_v2_sparse_classes_30k_train_018997 | Implement the Python class `TestOtaSmokeClass` described below.
Class description:
Implement the TestOtaSmokeClass class.
Method signatures and docstrings:
- def setup_class(self): Execute one time before run all cases
- def test_operate_monitor(self): Todo://1.connet,download,install 2.take screen shot
- def teardow... | Implement the Python class `TestOtaSmokeClass` described below.
Class description:
Implement the TestOtaSmokeClass class.
Method signatures and docstrings:
- def setup_class(self): Execute one time before run all cases
- def test_operate_monitor(self): Todo://1.connet,download,install 2.take screen shot
- def teardow... | e4afa8944785c1dc1dc80550073858d03a77d629 | <|skeleton|>
class TestOtaSmokeClass:
def setup_class(self):
"""Execute one time before run all cases"""
<|body_0|>
def test_operate_monitor(self):
"""Todo://1.connet,download,install 2.take screen shot"""
<|body_1|>
def teardown_class(self):
"""Execute one time af... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestOtaSmokeClass:
def setup_class(self):
"""Execute one time before run all cases"""
now_time = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
mylogs.log_info('-----------------------test_7operate_monitor---------------------------')
mylogs.log_info('Start to execute te... | the_stack_v2_python_sparse | testcases/smoke/dongfeng/test_dongfeng_smoke/test_7operate_monitor.py | uniquelover/ota_smoke_auto | train | 0 | |
d0e13a49069113ae8f72f714942ed7e3ff67da82 | [
"self.surf = surface\nself.color = color\nself.x = surface.get_width() // 2 - Rocket.width_rocket // 2\nself.y = surface.get_height()",
"pygame.draw.rect(self.surf, self.color, (self.x, self.y, Rocket.width_rocket, Rocket.height_rocket))\nself.y -= 3\nif self.y < -Rocket.height_rocket:\n self.y = WIN_HEIGHT"
] | <|body_start_0|>
self.surf = surface
self.color = color
self.x = surface.get_width() // 2 - Rocket.width_rocket // 2
self.y = surface.get_height()
<|end_body_0|>
<|body_start_1|>
pygame.draw.rect(self.surf, self.color, (self.x, self.y, Rocket.width_rocket, Rocket.height_rocket))... | Rocket | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rocket:
def __init__(self, surface, color):
"""Конструктору необходимо передать поверхность, по которой будет летать ракета и цвет самой ракеты"""
<|body_0|>
def fly(self):
"""Вызов метода fly() поднимает ракету на 3 пикселя. Если ракета скрывается вверху, она снова ... | stack_v2_sparse_classes_75kplus_train_069583 | 4,136 | no_license | [
{
"docstring": "Конструктору необходимо передать поверхность, по которой будет летать ракета и цвет самой ракеты",
"name": "__init__",
"signature": "def __init__(self, surface, color)"
},
{
"docstring": "Вызов метода fly() поднимает ракету на 3 пикселя. Если ракета скрывается вверху, она снова п... | 2 | stack_v2_sparse_classes_30k_val_002365 | Implement the Python class `Rocket` described below.
Class description:
Implement the Rocket class.
Method signatures and docstrings:
- def __init__(self, surface, color): Конструктору необходимо передать поверхность, по которой будет летать ракета и цвет самой ракеты
- def fly(self): Вызов метода fly() поднимает рак... | Implement the Python class `Rocket` described below.
Class description:
Implement the Rocket class.
Method signatures and docstrings:
- def __init__(self, surface, color): Конструктору необходимо передать поверхность, по которой будет летать ракета и цвет самой ракеты
- def fly(self): Вызов метода fly() поднимает рак... | 0ead3cf3f2fd7ec9a0234092a951328b98da899f | <|skeleton|>
class Rocket:
def __init__(self, surface, color):
"""Конструктору необходимо передать поверхность, по которой будет летать ракета и цвет самой ракеты"""
<|body_0|>
def fly(self):
"""Вызов метода fly() поднимает ракету на 3 пикселя. Если ракета скрывается вверху, она снова ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rocket:
def __init__(self, surface, color):
"""Конструктору необходимо передать поверхность, по которой будет летать ракета и цвет самой ракеты"""
self.surf = surface
self.color = color
self.x = surface.get_width() // 2 - Rocket.width_rocket // 2
self.y = surface.get_he... | the_stack_v2_python_sparse | course2/week5/my_pygame_test/pg_test3.py | shereshevskiy/coursera_python_specialization | train | 2 | |
fa3d86b057c416802ed490a7c7bf1603492b99f4 | [
"self.n = height\nself.m = width\nself.dirs = {'L': [0, -1], 'U': [-1, 0], 'R': [0, 1], 'D': [1, 0]}\nself.food = collections.deque(food)\nself.snake_set = {(0, 0)}\nself.snake = collections.deque([(0, 0)])",
"x, y = (self.snake[-1][0] + self.dirs[direction][0], self.snake[-1][1] + self.dirs[direction][1])\nif x ... | <|body_start_0|>
self.n = height
self.m = width
self.dirs = {'L': [0, -1], 'U': [-1, 0], 'R': [0, 1], 'D': [1, 0]}
self.food = collections.deque(food)
self.snake_set = {(0, 0)}
self.snake = collections.deque([(0, 0)])
<|end_body_0|>
<|body_start_1|>
x, y = (self.... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_75kplus_train_069584 | 1,784 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 2 | stack_v2_sparse_classes_30k_train_007122 | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | 59f70dc4466e15df591ba285317e4a1fe808ed60 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a... | the_stack_v2_python_sparse | leet/Design/353_Design_Snake_Game.py | arsamigullin/problem_solving_python | train | 0 | |
6aec07e8f780cc47474e4568e601cbb998ce2504 | [
"super(NeMoASR, self).__init__(load_path=load_path, nemo_params_path=nemo_params_path, **kwargs)\nself.labels = self.nemo_params['labels']\nself.data_preprocessor = AudioToMelSpectrogramPreprocessor(**self.nemo_params['AudioToMelSpectrogramPreprocessor'])\nself.jasper_encoder = JasperEncoder(**self.nemo_params['Jas... | <|body_start_0|>
super(NeMoASR, self).__init__(load_path=load_path, nemo_params_path=nemo_params_path, **kwargs)
self.labels = self.nemo_params['labels']
self.data_preprocessor = AudioToMelSpectrogramPreprocessor(**self.nemo_params['AudioToMelSpectrogramPreprocessor'])
self.jasper_encode... | ASR model on NeMo modules. | NeMoASR | [
"Python-2.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeMoASR:
"""ASR model on NeMo modules."""
def __init__(self, load_path: Union[str, Path], nemo_params_path: Union[str, Path], **kwargs) -> None:
"""Initializes NeuralModules for ASR. Args: load_path: Path to a directory with pretrained checkpoints for JasperEncoder and JasperDecoderF... | stack_v2_sparse_classes_75kplus_train_069585 | 7,898 | permissive | [
{
"docstring": "Initializes NeuralModules for ASR. Args: load_path: Path to a directory with pretrained checkpoints for JasperEncoder and JasperDecoderForCTC. nemo_params_path: Path to a file containig labels and params for AudioToMelSpectrogramPreprocessor, JasperEncoder, JasperDecoderForCTC and AudioInferData... | 2 | null | Implement the Python class `NeMoASR` described below.
Class description:
ASR model on NeMo modules.
Method signatures and docstrings:
- def __init__(self, load_path: Union[str, Path], nemo_params_path: Union[str, Path], **kwargs) -> None: Initializes NeuralModules for ASR. Args: load_path: Path to a directory with pr... | Implement the Python class `NeMoASR` described below.
Class description:
ASR model on NeMo modules.
Method signatures and docstrings:
- def __init__(self, load_path: Union[str, Path], nemo_params_path: Union[str, Path], **kwargs) -> None: Initializes NeuralModules for ASR. Args: load_path: Path to a directory with pr... | 65f69dfb898f5444cc2c98ae03ec7b3f44266df2 | <|skeleton|>
class NeMoASR:
"""ASR model on NeMo modules."""
def __init__(self, load_path: Union[str, Path], nemo_params_path: Union[str, Path], **kwargs) -> None:
"""Initializes NeuralModules for ASR. Args: load_path: Path to a directory with pretrained checkpoints for JasperEncoder and JasperDecoderF... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NeMoASR:
"""ASR model on NeMo modules."""
def __init__(self, load_path: Union[str, Path], nemo_params_path: Union[str, Path], **kwargs) -> None:
"""Initializes NeuralModules for ASR. Args: load_path: Path to a directory with pretrained checkpoints for JasperEncoder and JasperDecoderForCTC. nemo_p... | the_stack_v2_python_sparse | deeppavlov/models/nemo/asr.py | vintagexav/DeepPavlov | train | 2 |
a7e3e93faa33992c7b715e7e4e60c860378a49ac | [
"dp = [[1] * 3 for _ in range(4)]\ndp[3][0] = dp[3][2] = 0\nfor i in range(N - 1):\n dp = self.move(dp)\nreturn sum([sum(x) for x in dp]) % (10 ** 9 + 7)",
"row = len(grid)\ncol = len(grid[0])\nnum = 1000000007\nbuff_grid = [[0] * col for _ in range(row)]\nbuff_grid[0][0] = (grid[1][2] + grid[2][1]) % num\nbuf... | <|body_start_0|>
dp = [[1] * 3 for _ in range(4)]
dp[3][0] = dp[3][2] = 0
for i in range(N - 1):
dp = self.move(dp)
return sum([sum(x) for x in dp]) % (10 ** 9 + 7)
<|end_body_0|>
<|body_start_1|>
row = len(grid)
col = len(grid[0])
num = 1000000007
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def knightDialer(self, N):
""":type N: int :rtype: int"""
<|body_0|>
def move(self, grid):
""":type grid:list[list[int]] :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [[1] * 3 for _ in range(4)]
dp[3][0] = dp[3][2] ... | stack_v2_sparse_classes_75kplus_train_069586 | 1,376 | no_license | [
{
"docstring": ":type N: int :rtype: int",
"name": "knightDialer",
"signature": "def knightDialer(self, N)"
},
{
"docstring": ":type grid:list[list[int]] :return:",
"name": "move",
"signature": "def move(self, grid)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def knightDialer(self, N): :type N: int :rtype: int
- def move(self, grid): :type grid:list[list[int]] :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def knightDialer(self, N): :type N: int :rtype: int
- def move(self, grid): :type grid:list[list[int]] :return:
<|skeleton|>
class Solution:
def knightDialer(self, N):
... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def knightDialer(self, N):
""":type N: int :rtype: int"""
<|body_0|>
def move(self, grid):
""":type grid:list[list[int]] :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def knightDialer(self, N):
""":type N: int :rtype: int"""
dp = [[1] * 3 for _ in range(4)]
dp[3][0] = dp[3][2] = 0
for i in range(N - 1):
dp = self.move(dp)
return sum([sum(x) for x in dp]) % (10 ** 9 + 7)
def move(self, grid):
""":typ... | the_stack_v2_python_sparse | python/leetcode/935_Knight_Dialer.py | bobcaoge/my-code | train | 0 | |
8f8a7f6d57f905d02a3553bfb8fea4eae70f7458 | [
"np.random.seed(seed)\nself.base_learner = base_learner\nself.n_estimator = n_estimator\nself._estimators = [copy.deepcopy(self.base_learner) for _ in range(self.n_estimator)]\nself._alphas = [1 for _ in range(n_estimator)]",
"weights = np.ones(y.shape[0]) / y.shape[0]\nfor i in range(len(self._estimators)):\n ... | <|body_start_0|>
np.random.seed(seed)
self.base_learner = base_learner
self.n_estimator = n_estimator
self._estimators = [copy.deepcopy(self.base_learner) for _ in range(self.n_estimator)]
self._alphas = [1 for _ in range(n_estimator)]
<|end_body_0|>
<|body_start_1|>
wei... | Adaboost Classifier. Note that this class only support binary classification. | Adaboost | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Adaboost:
"""Adaboost Classifier. Note that this class only support binary classification."""
def __init__(self, base_learner, n_estimator, seed=2020):
"""Initialize the classifier. Args: base_learner: the base_learner should provide the .fit() and .predict() interface. n_estimator (... | stack_v2_sparse_classes_75kplus_train_069587 | 2,120 | no_license | [
{
"docstring": "Initialize the classifier. Args: base_learner: the base_learner should provide the .fit() and .predict() interface. n_estimator (int): The number of base learners in RandomForest. seed (int): random seed",
"name": "__init__",
"signature": "def __init__(self, base_learner, n_estimator, se... | 3 | null | Implement the Python class `Adaboost` described below.
Class description:
Adaboost Classifier. Note that this class only support binary classification.
Method signatures and docstrings:
- def __init__(self, base_learner, n_estimator, seed=2020): Initialize the classifier. Args: base_learner: the base_learner should p... | Implement the Python class `Adaboost` described below.
Class description:
Adaboost Classifier. Note that this class only support binary classification.
Method signatures and docstrings:
- def __init__(self, base_learner, n_estimator, seed=2020): Initialize the classifier. Args: base_learner: the base_learner should p... | 28e41c17b7f8653e26163a39ad5f741eaceae121 | <|skeleton|>
class Adaboost:
"""Adaboost Classifier. Note that this class only support binary classification."""
def __init__(self, base_learner, n_estimator, seed=2020):
"""Initialize the classifier. Args: base_learner: the base_learner should provide the .fit() and .predict() interface. n_estimator (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Adaboost:
"""Adaboost Classifier. Note that this class only support binary classification."""
def __init__(self, base_learner, n_estimator, seed=2020):
"""Initialize the classifier. Args: base_learner: the base_learner should provide the .fit() and .predict() interface. n_estimator (int): The num... | the_stack_v2_python_sparse | hw4/ensemble/adaboost.py | qiuruiyu/ZJU_Machine_Learning_fall20 | train | 0 |
b94c9c7d7c2f42509bd2d6aaa8a39c14b9b05835 | [
"stack = []\ncurstring = ''\ncurnum = 0\nfor c in s:\n if c == '[':\n stack.append(curstring)\n stack.append(curnum)\n curnum = 0\n curstring = ''\n elif c == ']':\n num = stack.pop()\n prevstring = stack.pop()\n curstring = prevstring + num * curstring\n el... | <|body_start_0|>
stack = []
curstring = ''
curnum = 0
for c in s:
if c == '[':
stack.append(curstring)
stack.append(curnum)
curnum = 0
curstring = ''
elif c == ']':
num = stack.pop()
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def decodeString(self, s):
"""Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记... | stack_v2_sparse_classes_75kplus_train_069588 | 3,130 | no_license | [
{
"docstring": "Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记录此 [ 前的倍数 multi 至栈,用于发现对应 ] 后,获取 multi × [...] 字... | 2 | stack_v2_sparse_classes_30k_train_028922 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def decodeString(self, s): Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def decodeString(self, s): Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def decodeString(self, s):
"""Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def decodeString(self, s):
"""Stack time O(S+|s|) space O(S) 本题难点在于括号内嵌套括号,需要从内向外生成与拼接字符串,这与栈的先入后出特性对应。 算法流程: 构建辅助栈 stack, 遍历字符串 s 中每个字符 c; 当 c 为数字时,将数字字符转化为数字 multi,用于后续倍数计算; 当 c 为字母时,在 res 尾部添加 c; 当 c 为 [ 时,将当前 multi 和 res 入栈,并分别置空置 000: 记录此 [ 前的临时结果 res 至栈,用于发现对应 ] 后的拼接操作; 记录此 [ 前的倍数 mult... | the_stack_v2_python_sparse | LeetCode/Stack/394_decode_string.py | XyK0907/for_work | train | 0 | |
42846d6de2508d57d3b9a6f6012d26915249167a | [
"self.scales = scales\nself.min_scale = min_scale\nself.max_scale = max_scale\nself.aspect_ratios = aspect_ratios\nself.interpolated_scale_aspect_ratio = interpolated_scale_aspect_ratio\nself.reduce_boxes_in_lowest_layer = reduce_boxes_in_lowest_layer",
"feature_map_shape_list = []\nnum_layers = len(image_feature... | <|body_start_0|>
self.scales = scales
self.min_scale = min_scale
self.max_scale = max_scale
self.aspect_ratios = aspect_ratios
self.interpolated_scale_aspect_ratio = interpolated_scale_aspect_ratio
self.reduce_boxes_in_lowest_layer = reduce_boxes_in_lowest_layer
<|end_bod... | AnchorGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnchorGenerator:
def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest_layer=True):
"""Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest... | stack_v2_sparse_classes_75kplus_train_069589 | 7,293 | permissive | [
{
"docstring": "Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest resolution to coarsest resolution. Arguments: scales: a list of float numbers or None, if scales is None then min_scale and max_scale are used. min_scale: a float number, scale of anchors corresponding to ... | 3 | stack_v2_sparse_classes_30k_train_049221 | Implement the Python class `AnchorGenerator` described below.
Class description:
Implement the AnchorGenerator class.
Method signatures and docstrings:
- def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest... | Implement the Python class `AnchorGenerator` described below.
Class description:
Implement the AnchorGenerator class.
Method signatures and docstrings:
- def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest... | 45f977d6622b083d5817167bc9da20420299b273 | <|skeleton|>
class AnchorGenerator:
def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest_layer=True):
"""Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnchorGenerator:
def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest_layer=True):
"""Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest resolution to... | the_stack_v2_python_sparse | src/anchor_generator.py | zsz00/single-shot-detector | train | 1 | |
61b8186209dbcb0c14734399d2c312c571c12a9e | [
"try:\n client.containers.get(name_or_id).remove(force=force)\nexcept docker.errors.NotFound as not_found:\n if not ignore_container_not_found:\n raise not_found",
"try:\n client.images.remove(name_or_id, force=force)\nexcept docker.errors.ImageNotFound as not_found:\n if not ignore_image_not_f... | <|body_start_0|>
try:
client.containers.get(name_or_id).remove(force=force)
except docker.errors.NotFound as not_found:
if not ignore_container_not_found:
raise not_found
<|end_body_0|>
<|body_start_1|>
try:
client.images.remove(name_or_id, fo... | docker extra tools that will be usefully also as stand alone commands | DockerTools | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DockerTools:
"""docker extra tools that will be usefully also as stand alone commands"""
def remove_container(name_or_id: str, ignore_container_not_found: bool=True, force: bool=False):
"""Examples docker rm MyTestContainer can be replaced with DockerTools.remove_container("MyTestCon... | stack_v2_sparse_classes_75kplus_train_069590 | 6,497 | permissive | [
{
"docstring": "Examples docker rm MyTestContainer can be replaced with DockerTools.remove_container(\"MyTestContainer\") in your code Args: name_or_id: the name or id of the container ignore_container_not_found: don't raise an exception in case the container already removed force: same as the -f option in the ... | 2 | stack_v2_sparse_classes_30k_train_026208 | Implement the Python class `DockerTools` described below.
Class description:
docker extra tools that will be usefully also as stand alone commands
Method signatures and docstrings:
- def remove_container(name_or_id: str, ignore_container_not_found: bool=True, force: bool=False): Examples docker rm MyTestContainer can... | Implement the Python class `DockerTools` described below.
Class description:
docker extra tools that will be usefully also as stand alone commands
Method signatures and docstrings:
- def remove_container(name_or_id: str, ignore_container_not_found: bool=True, force: bool=False): Examples docker rm MyTestContainer can... | 59d99cf4b5016be8a4a333c2541418e1612549e1 | <|skeleton|>
class DockerTools:
"""docker extra tools that will be usefully also as stand alone commands"""
def remove_container(name_or_id: str, ignore_container_not_found: bool=True, force: bool=False):
"""Examples docker rm MyTestContainer can be replaced with DockerTools.remove_container("MyTestCon... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DockerTools:
"""docker extra tools that will be usefully also as stand alone commands"""
def remove_container(name_or_id: str, ignore_container_not_found: bool=True, force: bool=False):
"""Examples docker rm MyTestContainer can be replaced with DockerTools.remove_container("MyTestContainer") in y... | the_stack_v2_python_sparse | demisto_sdk/commands/common/docker_util.py | kfirstri/demisto-sdk | train | 1 |
7bfe6156cb026efb8c5eb27c0aa576bf3d42a1c9 | [
"if not head:\n return head\nstack = list()\ncur = head\nwhile cur:\n stack.append(cur)\n cur = cur.next\nnewhead = stack.pop()\ncur = newhead\nwhile stack:\n cur.next = stack.pop()\n cur = cur.next\ncur.next = None\nreturn newhead",
"if not head:\n return head\nnewhead = None\nwhile head:\n ... | <|body_start_0|>
if not head:
return head
stack = list()
cur = head
while cur:
stack.append(cur)
cur = cur.next
newhead = stack.pop()
cur = newhead
while stack:
cur.next = stack.pop()
cur = cur.next
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode 栈 时间击败43.69%,内存击败71.38%"""
<|body_0|>
def reverseList2(self, head):
""":type head: ListNode :rtype: ListNode 双链表 双链表求解是把原链表的结点一个个摘掉,每次摘掉的链表都让他成为新的链表的头结点,然后更新新链表。 时间击败96.12%,内存击败63.76%"""
... | stack_v2_sparse_classes_75kplus_train_069591 | 1,263 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode 栈 时间击败43.69%,内存击败71.38%",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode 双链表 双链表求解是把原链表的结点一个个摘掉,每次摘掉的链表都让他成为新的链表的头结点,然后更新新链表。 时间击败96.12%,内存击败63.76%",
"name": "rev... | 2 | stack_v2_sparse_classes_30k_train_054079 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode 栈 时间击败43.69%,内存击败71.38%
- def reverseList2(self, head): :type head: ListNode :rtype: ListNode 双链表 双链表求解是把原链表的结点... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode 栈 时间击败43.69%,内存击败71.38%
- def reverseList2(self, head): :type head: ListNode :rtype: ListNode 双链表 双链表求解是把原链表的结点... | 2dc982e690b153c33bc7e27a63604f754a0df90c | <|skeleton|>
class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode 栈 时间击败43.69%,内存击败71.38%"""
<|body_0|>
def reverseList2(self, head):
""":type head: ListNode :rtype: ListNode 双链表 双链表求解是把原链表的结点一个个摘掉,每次摘掉的链表都让他成为新的链表的头结点,然后更新新链表。 时间击败96.12%,内存击败63.76%"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode 栈 时间击败43.69%,内存击败71.38%"""
if not head:
return head
stack = list()
cur = head
while cur:
stack.append(cur)
cur = cur.next
newhead = stack.pop()
... | the_stack_v2_python_sparse | 206_reverse-linked-list.py | 95275059/Algorithm | train | 0 | |
f3be8920ef40662d10f611768573385163ffc4c2 | [
"if not os.path.exists(ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME):\n logger.critical('缺失公交数据库,请检查!')\n pass\nself.data_path = ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME\nself._bus_data = self._busStop_Load_Data()\nself._busStop_Remove_Duplication()\nself._busStop_Structu... | <|body_start_0|>
if not os.path.exists(ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME):
logger.critical('缺失公交数据库,请检查!')
pass
self.data_path = ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME
self._bus_data = self._busStop_Load_Data()
se... | busStop | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class busStop:
def __init__(self):
"""读入数据"""
<|body_0|>
def _busStop_Load_Data(self):
"""从源文件中读取公交站原始数据 :return:"""
<|body_1|>
def _busStop_Remove_Duplication(self):
"""清洗数据,去掉重复项,去掉不符合要求的项目 :return:"""
<|body_2|>
def _busStop_Structure(s... | stack_v2_sparse_classes_75kplus_train_069592 | 5,440 | no_license | [
{
"docstring": "读入数据",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "从源文件中读取公交站原始数据 :return:",
"name": "_busStop_Load_Data",
"signature": "def _busStop_Load_Data(self)"
},
{
"docstring": "清洗数据,去掉重复项,去掉不符合要求的项目 :return:",
"name": "_busStop_Remove_Dup... | 5 | stack_v2_sparse_classes_30k_train_031079 | Implement the Python class `busStop` described below.
Class description:
Implement the busStop class.
Method signatures and docstrings:
- def __init__(self): 读入数据
- def _busStop_Load_Data(self): 从源文件中读取公交站原始数据 :return:
- def _busStop_Remove_Duplication(self): 清洗数据,去掉重复项,去掉不符合要求的项目 :return:
- def _busStop_Structure(se... | Implement the Python class `busStop` described below.
Class description:
Implement the busStop class.
Method signatures and docstrings:
- def __init__(self): 读入数据
- def _busStop_Load_Data(self): 从源文件中读取公交站原始数据 :return:
- def _busStop_Remove_Duplication(self): 清洗数据,去掉重复项,去掉不符合要求的项目 :return:
- def _busStop_Structure(se... | c24d149287697f8fcb26eddce479f37b664ef04c | <|skeleton|>
class busStop:
def __init__(self):
"""读入数据"""
<|body_0|>
def _busStop_Load_Data(self):
"""从源文件中读取公交站原始数据 :return:"""
<|body_1|>
def _busStop_Remove_Duplication(self):
"""清洗数据,去掉重复项,去掉不符合要求的项目 :return:"""
<|body_2|>
def _busStop_Structure(s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class busStop:
def __init__(self):
"""读入数据"""
if not os.path.exists(ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME):
logger.critical('缺失公交数据库,请检查!')
pass
self.data_path = ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME
self._bus_da... | the_stack_v2_python_sparse | Server/TransportationPredict_Tradition/BusStop.py | Kuailun/TransportTradition | train | 0 | |
15ebe61aba36f78ad74bd23b094b08074d2b9ea0 | [
"task = db.Task.get(id)\nif not task:\n return ({'msg': f'task id={id} is not found'}, HTTPStatus.NOT_FOUND)\nauth_org = self.obtain_auth_organization()\nschema = task_result_schema if request.args.get('include') == 'results' else task_schema\nif not self.r.v_glo.can():\n org_ids = [org.id for org in task.col... | <|body_start_0|>
task = db.Task.get(id)
if not task:
return ({'msg': f'task id={id} is not found'}, HTTPStatus.NOT_FOUND)
auth_org = self.obtain_auth_organization()
schema = task_result_schema if request.args.get('include') == 'results' else task_schema
if not self.r.... | Resource for /api/task | Task | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Task:
"""Resource for /api/task"""
def get(self, id):
"""Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |T... | stack_v2_sparse_classes_75kplus_train_069593 | 26,603 | permissive | [
{
"docstring": "Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |Task|Organization|View|✅|✅|View any task in your organization| Accessi... | 2 | stack_v2_sparse_classes_30k_train_012853 | Implement the Python class `Task` described below.
Class description:
Resource for /api/task
Method signatures and docstrings:
- def get(self, id): Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |-... | Implement the Python class `Task` described below.
Class description:
Resource for /api/task
Method signatures and docstrings:
- def get(self, id): Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |-... | b3ff6e91ac4caeaf31c12c20f73dfc61cfd9baca | <|skeleton|>
class Task:
"""Resource for /api/task"""
def get(self, id):
"""Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |T... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Task:
"""Resource for /api/task"""
def get(self, id):
"""Get task --- description: >- Returns the task specified by the id. ### Permission Table |Rule name|Scope|Operation|Assigned to node|Assigned to container| Description| |--|--|--|--|--|--| |Task|Global|View|❌|❌|View any task| |Task|Organizat... | the_stack_v2_python_sparse | vantage6-server/vantage6/server/resource/task.py | vantage6/vantage6 | train | 15 |
6f3fd8eb9860a76f1195f4394e208050710f33fa | [
"try:\n html = etree.HTML(content.lower())\n subject = html.xpath('//ul[@class=\"img\"]/li')\n subject_urls = list()\n for sub in subject:\n a_href = sub[0].get('href')\n subject_urls.append(a_href)\n return subject_urls\nexcept Exception as e:\n print(str(e))\n return list()",
... | <|body_start_0|>
try:
html = etree.HTML(content.lower())
subject = html.xpath('//ul[@class="img"]/li')
subject_urls = list()
for sub in subject:
a_href = sub[0].get('href')
subject_urls.append(a_href)
return subject_urls... | HtmlParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HtmlParser:
def parse_main_subjects(self, content):
"""解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']"""
<|body_0|>
def parse_subject_mj_info(self, content):
"""获取具体模特大图页面开头的模特信息 :param content: 一个类别的模特页面内容 :return: {'count': 该模特具备图总数, ... | stack_v2_sparse_classes_75kplus_train_069594 | 1,773 | permissive | [
{
"docstring": "解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']",
"name": "parse_main_subjects",
"signature": "def parse_main_subjects(self, content)"
},
{
"docstring": "获取具体模特大图页面开头的模特信息 :param content: 一个类别的模特页面内容 :return: {'count': 该模特具备图总数, 'mj_name': 模特名字}",
... | 3 | stack_v2_sparse_classes_30k_train_029855 | Implement the Python class `HtmlParser` described below.
Class description:
Implement the HtmlParser class.
Method signatures and docstrings:
- def parse_main_subjects(self, content): 解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']
- def parse_subject_mj_info(self, content): 获取具体模特大图页面开头... | Implement the Python class `HtmlParser` described below.
Class description:
Implement the HtmlParser class.
Method signatures and docstrings:
- def parse_main_subjects(self, content): 解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']
- def parse_subject_mj_info(self, content): 获取具体模特大图页面开头... | 6303c2df24ef3d15be205a8599ed58e7bc5ddb8a | <|skeleton|>
class HtmlParser:
def parse_main_subjects(self, content):
"""解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']"""
<|body_0|>
def parse_subject_mj_info(self, content):
"""获取具体模特大图页面开头的模特信息 :param content: 一个类别的模特页面内容 :return: {'count': 该模特具备图总数, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HtmlParser:
def parse_main_subjects(self, content):
"""解析美图录网站主页模特分类页面链接 :param content: 美图录主页内容 :return: ['一个模特的大图页面', '一个模特的大图页面']"""
try:
html = etree.HTML(content.lower())
subject = html.xpath('//ul[@class="img"]/li')
subject_urls = list()
fo... | the_stack_v2_python_sparse | MeiTuLuSpider/html_parser.py | motiondepp/SmallReptileTraining | train | 0 | |
403fc7c3e60b09c88e863c364b9e5d7ff28f549f | [
"super().__init__()\nself.output_size = output_size\nself.hidden_dim = hidden_dim\nself.n_layers = n_layers\nself.drop_prob = drop_prob\nself.train_on_gpu = train_on_gpu\nself.dvc = device\nself.lstm = nn.LSTM(input_size, self.hidden_dim, n_layers, dropout=drop_prob, batch_first=True)\nself.dropout = nn.Dropout(sel... | <|body_start_0|>
super().__init__()
self.output_size = output_size
self.hidden_dim = hidden_dim
self.n_layers = n_layers
self.drop_prob = drop_prob
self.train_on_gpu = train_on_gpu
self.dvc = device
self.lstm = nn.LSTM(input_size, self.hidden_dim, n_layers... | The baseline model. A simple LSTM model, without any preprocessing to the inputs. | EmbedRNN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmbedRNN:
"""The baseline model. A simple LSTM model, without any preprocessing to the inputs."""
def __init__(self, input_size, output_size, hidden_dim=256, n_layers=2, drop_prob=0.5, train_on_gpu=True, device='cuda:0'):
"""LSTM model initialization. Args: input_size: dimention of s... | stack_v2_sparse_classes_75kplus_train_069595 | 31,608 | permissive | [
{
"docstring": "LSTM model initialization. Args: input_size: dimention of state vector (flattened 3d tensor) output_size: the same shape of input_size, a 3d tensor with shape (69, 69, 3) to generate visual image hidden_dim: hidden size of lstm layers n_layers: number of lstm layers drop_prob: drop out rate lr: ... | 3 | null | Implement the Python class `EmbedRNN` described below.
Class description:
The baseline model. A simple LSTM model, without any preprocessing to the inputs.
Method signatures and docstrings:
- def __init__(self, input_size, output_size, hidden_dim=256, n_layers=2, drop_prob=0.5, train_on_gpu=True, device='cuda:0'): LS... | Implement the Python class `EmbedRNN` described below.
Class description:
The baseline model. A simple LSTM model, without any preprocessing to the inputs.
Method signatures and docstrings:
- def __init__(self, input_size, output_size, hidden_dim=256, n_layers=2, drop_prob=0.5, train_on_gpu=True, device='cuda:0'): LS... | ff165de95ec0f258ba444ff343d18d812a066b8f | <|skeleton|>
class EmbedRNN:
"""The baseline model. A simple LSTM model, without any preprocessing to the inputs."""
def __init__(self, input_size, output_size, hidden_dim=256, n_layers=2, drop_prob=0.5, train_on_gpu=True, device='cuda:0'):
"""LSTM model initialization. Args: input_size: dimention of s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmbedRNN:
"""The baseline model. A simple LSTM model, without any preprocessing to the inputs."""
def __init__(self, input_size, output_size, hidden_dim=256, n_layers=2, drop_prob=0.5, train_on_gpu=True, device='cuda:0'):
"""LSTM model initialization. Args: input_size: dimention of state vector (... | the_stack_v2_python_sparse | src/core/models.py | spencerzhang91/GSPNet | train | 0 |
d18d96414d5f2d71fa0be07189bbaff67fbeb970 | [
"from .traces import ScriptEndpointTrace\nif self.is_new():\n raise SyncanoValidationError('Method allowed only on existing model.')\nproperties = self.get_endpoint_data()\nhttp_method = 'POST'\nendpoint = self._meta.resolve_endpoint('run', properties, http_method)\nconnection = self._get_connection(**payload)\n... | <|body_start_0|>
from .traces import ScriptEndpointTrace
if self.is_new():
raise SyncanoValidationError('Method allowed only on existing model.')
properties = self.get_endpoint_data()
http_method = 'POST'
endpoint = self._meta.resolve_endpoint('run', properties, http_... | OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **ScriptEndpoint** has special method called... | ScriptEndpoint | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScriptEndpoint:
"""OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **... | stack_v2_sparse_classes_75kplus_train_069596 | 13,042 | no_license | [
{
"docstring": "Usage:: >>> se = ScriptEndpoint.please.get('instance-name', 'script-name') >>> se.run() >>> se.run(variable_one=1, variable_two=2)",
"name": "run",
"signature": "def run(self, cache_key=None, **payload)"
},
{
"docstring": "Usage:: >>> se = ScriptEndpoint.please.get('instance-name... | 2 | stack_v2_sparse_classes_30k_train_014435 | Implement the Python class `ScriptEndpoint` described below.
Class description:
OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.model... | Implement the Python class `ScriptEndpoint` described below.
Class description:
OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.model... | 3a1cff87a565a075ca6f54bfe55089bb152fdbf3 | <|skeleton|>
class ScriptEndpoint:
"""OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScriptEndpoint:
"""OO wrapper around script endpoints `link <http://docs.syncano.com/docs/codebox-sockets>`_. :ivar name: :class:`~syncano.models.fields.SlugField` :ivar script: :class:`~syncano.models.fields.IntegerField` :ivar links: :class:`~syncano.models.fields.HyperlinkedField` .. note:: **ScriptEndpoin... | the_stack_v2_python_sparse | syncano/models/incentives.py | Syncano/syncano-python | train | 4 |
e94e62d67a435948785c13c9f470239489a41088 | [
"self.from_user = '18201037154@163.com'\nself.from_password = 'HMCTBAUGRXFSEKDP'\nself.smtp_server = 'smtp.163.com'\nself.mail_port = 25\nself.receiver = receiver\nself.mime = MIMEMultipart()",
"text_info = '<h1>测试报告中含有错误或者失败的用例,点击连接查看详情:</h1><a href=%sapitest/query_report?task_id=%s /a>%sapitest/query_report?tas... | <|body_start_0|>
self.from_user = '18201037154@163.com'
self.from_password = 'HMCTBAUGRXFSEKDP'
self.smtp_server = 'smtp.163.com'
self.mail_port = 25
self.receiver = receiver
self.mime = MIMEMultipart()
<|end_body_0|>
<|body_start_1|>
text_info = '<h1>测试报告中含有错误或者... | sendEmail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class sendEmail:
def __init__(self, receiver):
"""初始化封装邮件对象"""
<|body_0|>
def sendEmailFun(self, env, task):
"""发送邮件"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.from_user = '18201037154@163.com'
self.from_password = 'HMCTBAUGRXFSEKDP'
... | stack_v2_sparse_classes_75kplus_train_069597 | 1,515 | no_license | [
{
"docstring": "初始化封装邮件对象",
"name": "__init__",
"signature": "def __init__(self, receiver)"
},
{
"docstring": "发送邮件",
"name": "sendEmailFun",
"signature": "def sendEmailFun(self, env, task)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030154 | Implement the Python class `sendEmail` described below.
Class description:
Implement the sendEmail class.
Method signatures and docstrings:
- def __init__(self, receiver): 初始化封装邮件对象
- def sendEmailFun(self, env, task): 发送邮件 | Implement the Python class `sendEmail` described below.
Class description:
Implement the sendEmail class.
Method signatures and docstrings:
- def __init__(self, receiver): 初始化封装邮件对象
- def sendEmailFun(self, env, task): 发送邮件
<|skeleton|>
class sendEmail:
def __init__(self, receiver):
"""初始化封装邮件对象"""
... | c26d8a49bdcc309cca377639a72c67d5ff06b67e | <|skeleton|>
class sendEmail:
def __init__(self, receiver):
"""初始化封装邮件对象"""
<|body_0|>
def sendEmailFun(self, env, task):
"""发送邮件"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class sendEmail:
def __init__(self, receiver):
"""初始化封装邮件对象"""
self.from_user = '18201037154@163.com'
self.from_password = 'HMCTBAUGRXFSEKDP'
self.smtp_server = 'smtp.163.com'
self.mail_port = 25
self.receiver = receiver
self.mime = MIMEMultipart()
def se... | the_stack_v2_python_sparse | lib/sendemail.py | wanyafei/AutoTestform | train | 1 | |
d7e37cb5307a1607270b6932022dd3645d77cdf7 | [
"if len(nums) < 2:\n return 0\nnums.sort()\nmax_diff = 0\nfor i in range(0, len(nums) - 1):\n if nums[i + 1] - nums[i] > max_diff:\n max_diff = nums[i + 1] - nums[i]\nreturn max_diff",
"if len(nums) < 2:\n return 0\nmin_val = min(nums)\nmax_val = max(nums)\nmax_diff = 0\nnums_set = set(nums)\ncurr... | <|body_start_0|>
if len(nums) < 2:
return 0
nums.sort()
max_diff = 0
for i in range(0, len(nums) - 1):
if nums[i + 1] - nums[i] > max_diff:
max_diff = nums[i + 1] - nums[i]
return max_diff
<|end_body_0|>
<|body_start_1|>
if len(num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(nums) < 2:
return 0
... | stack_v2_sparse_classes_75kplus_train_069598 | 1,091 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_042688 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maximumGap(se... | 6de551327f96ec4d4b63d0045281b65bbb4f5d0f | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
if len(nums) < 2:
return 0
nums.sort()
max_diff = 0
for i in range(0, len(nums) - 1):
if nums[i + 1] - nums[i] > max_diff:
max_diff = nums[i + 1] - nums... | the_stack_v2_python_sparse | maximumGap.py | JingweiTu/leetcode | train | 0 | |
7383f79ccccb08b1981ba4ea56c20fcedfc10f35 | [
"self.name = data['name']\noption_datas = data.get('options')\nif option_datas is None or not option_datas:\n options = None\nelse:\n options = [ApplicationCommandInteractionOption(option_data) for option_data in option_datas]\nself.options = options\nvalue = data.get('value')\nif value is not None:\n valu... | <|body_start_0|>
self.name = data['name']
option_datas = data.get('options')
if option_datas is None or not option_datas:
options = None
else:
options = [ApplicationCommandInteractionOption(option_data) for option_data in option_datas]
self.options = optio... | Represents an option of a ``ApplicationCommandInteraction``. Attributes ---------- name : `str` The option's name. options : `None` or `list` of ApplicationCommandInteractionOption The parameters and values from the user. Present if a sub-command was used. Defaults to `None` if non is received. Mutually exclusive with ... | ApplicationCommandInteractionOption | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApplicationCommandInteractionOption:
"""Represents an option of a ``ApplicationCommandInteraction``. Attributes ---------- name : `str` The option's name. options : `None` or `list` of ApplicationCommandInteractionOption The parameters and values from the user. Present if a sub-command was used. ... | stack_v2_sparse_classes_75kplus_train_069599 | 45,838 | permissive | [
{
"docstring": "Creates a new ``ApplicationCommandInteractionOption`` instance from the data received from Discord. Attributes ---------- data : `dict` of (`str`, `Any`) items The received application command interaction option data.",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_026050 | Implement the Python class `ApplicationCommandInteractionOption` described below.
Class description:
Represents an option of a ``ApplicationCommandInteraction``. Attributes ---------- name : `str` The option's name. options : `None` or `list` of ApplicationCommandInteractionOption The parameters and values from the us... | Implement the Python class `ApplicationCommandInteractionOption` described below.
Class description:
Represents an option of a ``ApplicationCommandInteraction``. Attributes ---------- name : `str` The option's name. options : `None` or `list` of ApplicationCommandInteractionOption The parameters and values from the us... | 74058ba2c878087e312120520bf4c56c312fbeca | <|skeleton|>
class ApplicationCommandInteractionOption:
"""Represents an option of a ``ApplicationCommandInteraction``. Attributes ---------- name : `str` The option's name. options : `None` or `list` of ApplicationCommandInteractionOption The parameters and values from the user. Present if a sub-command was used. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApplicationCommandInteractionOption:
"""Represents an option of a ``ApplicationCommandInteraction``. Attributes ---------- name : `str` The option's name. options : `None` or `list` of ApplicationCommandInteractionOption The parameters and values from the user. Present if a sub-command was used. Defaults to `... | the_stack_v2_python_sparse | hata/discord/interaction.py | 00-00-00-11/hata | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.