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
a42227a53e0dfb62b537e0755bb28a18c9a0cf09
[ "self.class_name = class_name\nself.klass = klass\nif not filter_models_classes(klass):\n raise NameError('Incompatible module for Models class: {0}'.format(klass.__module__))\nself.module_full_name = klass.__module__.replace('kubernetes.', 'kubernetes_typed.')\nself.module_name = klass.__module__.rpartition('.'...
<|body_start_0|> self.class_name = class_name self.klass = klass if not filter_models_classes(klass): raise NameError('Incompatible module for Models class: {0}'.format(klass.__module__)) self.module_full_name = klass.__module__.replace('kubernetes.', 'kubernetes_typed.') ...
Represents parsed state of kubernetes client model.
Model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """Represents parsed state of kubernetes client model.""" def __init__(self, class_name: str, klass: object) -> None: """Parse model parameters.""" <|body_0|> def uniq_imports(self, import_type: str) -> List[str]: """Get uniq import for the model.""" ...
stack_v2_sparse_classes_75kplus_train_070400
6,267
permissive
[ { "docstring": "Parse model parameters.", "name": "__init__", "signature": "def __init__(self, class_name: str, klass: object) -> None" }, { "docstring": "Get uniq import for the model.", "name": "uniq_imports", "signature": "def uniq_imports(self, import_type: str) -> List[str]" } ]
2
stack_v2_sparse_classes_30k_train_016193
Implement the Python class `Model` described below. Class description: Represents parsed state of kubernetes client model. Method signatures and docstrings: - def __init__(self, class_name: str, klass: object) -> None: Parse model parameters. - def uniq_imports(self, import_type: str) -> List[str]: Get uniq import fo...
Implement the Python class `Model` described below. Class description: Represents parsed state of kubernetes client model. Method signatures and docstrings: - def __init__(self, class_name: str, klass: object) -> None: Parse model parameters. - def uniq_imports(self, import_type: str) -> List[str]: Get uniq import fo...
82995b008daf551a4fe11660018d9c08c69f9e6e
<|skeleton|> class Model: """Represents parsed state of kubernetes client model.""" def __init__(self, class_name: str, klass: object) -> None: """Parse model parameters.""" <|body_0|> def uniq_imports(self, import_type: str) -> List[str]: """Get uniq import for the model.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Model: """Represents parsed state of kubernetes client model.""" def __init__(self, class_name: str, klass: object) -> None: """Parse model parameters.""" self.class_name = class_name self.klass = klass if not filter_models_classes(klass): raise NameError('Inco...
the_stack_v2_python_sparse
scripts/typeddictgen.py
gordonbondon/kubernetes-typed
train
24
183e355df6fd630d0c65ef9fac58ef286556ee20
[ "self.k_heap = []\nself.k = k\nfor i, x in enumerate(nums):\n if i < k:\n heapq.heappush(self.k_heap, x)\n elif self.k_heap[0] < x:\n heapq.heappop(self.k_heap)\n heapq.heappush(self.k_heap, x)", "if len(self.k_heap) < self.k:\n heapq.heappush(self.k_heap, val)\n return self.k_hea...
<|body_start_0|> self.k_heap = [] self.k = k for i, x in enumerate(nums): if i < k: heapq.heappush(self.k_heap, x) elif self.k_heap[0] < x: heapq.heappop(self.k_heap) heapq.heappush(self.k_heap, x) <|end_body_0|> <|body_sta...
KthLargest
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k_heap = [] self.k = k for i, x in en...
stack_v2_sparse_classes_75kplus_train_070401
932
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_021495
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
1c273eadfbf4bef9323a0f386717ac8e7ad2ba71
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k_heap = [] self.k = k for i, x in enumerate(nums): if i < k: heapq.heappush(self.k_heap, x) elif self.k_heap[0] < x: heapq.heappop(sel...
the_stack_v2_python_sparse
Algorithm/streamKlagest.py
jackwang816/python_practice
train
0
be8f9a119f4c07da8b6740acf01ef6da2b68d8ab
[ "super().__init__(*args, **kwargs)\nself.input_sample_rate = input_sample_rate\nself.n_mfcc = n_mfcc\nself.n_fft_length = n_fft_length\nself.hop_length = hop_length", "from librosa.feature import mfcc\nembeds = []\nfor chunk_data in data:\n mfccs = mfcc(y=chunk_data, sr=self.input_sample_rate, n_mfcc=self.n_mf...
<|body_start_0|> super().__init__(*args, **kwargs) self.input_sample_rate = input_sample_rate self.n_mfcc = n_mfcc self.n_fft_length = n_fft_length self.hop_length = hop_length <|end_body_0|> <|body_start_1|> from librosa.feature import mfcc embeds = [] f...
:class:`MFCCTimbreEncoder` is based on Mel-Frequency Cepstral Coefficients (MFCCs) which represent timbral features. :class:`MFCCTimbreEncoder` encodes an audio signal from a `Batch x Signal Length` ndarray into a `Batch x Concatenated Features` ndarray.
MFCCTimbreEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MFCCTimbreEncoder: """:class:`MFCCTimbreEncoder` is based on Mel-Frequency Cepstral Coefficients (MFCCs) which represent timbral features. :class:`MFCCTimbreEncoder` encodes an audio signal from a `Batch x Signal Length` ndarray into a `Batch x Concatenated Features` ndarray.""" def __init__...
stack_v2_sparse_classes_75kplus_train_070402
4,047
permissive
[ { "docstring": ":class:`MFCCTimbreEncoder` extracts from an audio signal a `n_mfcc`-dimensional feature vector for each MFCC frame. :param input_sample_rate: input sampling rate in Hz (22050 by default) :param n_mfcc: the number of coefficients (20 by default) :param n_fft: length of the FFT window (2048 by def...
2
stack_v2_sparse_classes_30k_train_042477
Implement the Python class `MFCCTimbreEncoder` described below. Class description: :class:`MFCCTimbreEncoder` is based on Mel-Frequency Cepstral Coefficients (MFCCs) which represent timbral features. :class:`MFCCTimbreEncoder` encodes an audio signal from a `Batch x Signal Length` ndarray into a `Batch x Concatenated ...
Implement the Python class `MFCCTimbreEncoder` described below. Class description: :class:`MFCCTimbreEncoder` is based on Mel-Frequency Cepstral Coefficients (MFCCs) which represent timbral features. :class:`MFCCTimbreEncoder` encodes an audio signal from a `Batch x Signal Length` ndarray into a `Batch x Concatenated ...
e30a8827d1b10b691ab7e18ea70c25b22166afc5
<|skeleton|> class MFCCTimbreEncoder: """:class:`MFCCTimbreEncoder` is based on Mel-Frequency Cepstral Coefficients (MFCCs) which represent timbral features. :class:`MFCCTimbreEncoder` encodes an audio signal from a `Batch x Signal Length` ndarray into a `Batch x Concatenated Features` ndarray.""" def __init__...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MFCCTimbreEncoder: """:class:`MFCCTimbreEncoder` is based on Mel-Frequency Cepstral Coefficients (MFCCs) which represent timbral features. :class:`MFCCTimbreEncoder` encodes an audio signal from a `Batch x Signal Length` ndarray into a `Batch x Concatenated Features` ndarray.""" def __init__(self, input_...
the_stack_v2_python_sparse
jina/executors/encoders/audio/spectral.py
alexcg1/jina
train
1
fe9888a500d0fa9e6015e4b0100295450d364f85
[ "self.debug = debug\nself._spi = spi\nself._ss = ss\nsuper().__init__(debug=debug, reset=reset)", "if self._reset_pin:\n self._reset_pin.value(1)\n time.sleep(0.01)\nself.low_power = False\nself._ss(0)\nself._spi.write(b'UU\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00')\nself._...
<|body_start_0|> self.debug = debug self._spi = spi self._ss = ss super().__init__(debug=debug, reset=reset) <|end_body_0|> <|body_start_1|> if self._reset_pin: self._reset_pin.value(1) time.sleep(0.01) self.low_power = False self._ss(0) ...
Driver for the PN532 connected over SPI
PN532_SPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PN532_SPI: """Driver for the PN532 connected over SPI""" def __init__(self, spi, ss, *, reset=None, debug=False): """Create an instance of the PN532 class using Serial connection. Optional reset pin and debugging output.""" <|body_0|> def _wakeup(self): """Send a...
stack_v2_sparse_classes_75kplus_train_070403
3,392
no_license
[ { "docstring": "Create an instance of the PN532 class using Serial connection. Optional reset pin and debugging output.", "name": "__init__", "signature": "def __init__(self, spi, ss, *, reset=None, debug=False)" }, { "docstring": "Send any special commands/data to wake up PN532", "name": "_...
5
null
Implement the Python class `PN532_SPI` described below. Class description: Driver for the PN532 connected over SPI Method signatures and docstrings: - def __init__(self, spi, ss, *, reset=None, debug=False): Create an instance of the PN532 class using Serial connection. Optional reset pin and debugging output. - def ...
Implement the Python class `PN532_SPI` described below. Class description: Driver for the PN532 connected over SPI Method signatures and docstrings: - def __init__(self, spi, ss, *, reset=None, debug=False): Create an instance of the PN532 class using Serial connection. Optional reset pin and debugging output. - def ...
6941424ade1e5c2563290fb32cf39034a55968f6
<|skeleton|> class PN532_SPI: """Driver for the PN532 connected over SPI""" def __init__(self, spi, ss, *, reset=None, debug=False): """Create an instance of the PN532 class using Serial connection. Optional reset pin and debugging output.""" <|body_0|> def _wakeup(self): """Send a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PN532_SPI: """Driver for the PN532 connected over SPI""" def __init__(self, spi, ss, *, reset=None, debug=False): """Create an instance of the PN532 class using Serial connection. Optional reset pin and debugging output.""" self.debug = debug self._spi = spi self._ss = ss ...
the_stack_v2_python_sparse
esp32-micropython/components/rfid/spi.py
octopusengine/octopuslab
train
32
082ce4e73277ac6949606ff297b343c648964a5f
[ "self.smp = smp\nself.nangles = nangles\nself.angles = np.linspace(0, np.pi, nangles, endpoint=False)", "smp = self.smp\nangles = self.angles\nsmp.compCov(y)\nspec = np.zeros(angles.shape)\nfor i in range(self.nangles):\n spec[i] = smp.compSpecSample(angles[i])\nangle = angles[np.argmax(spec)]\nif retspec:\n ...
<|body_start_0|> self.smp = smp self.nangles = nangles self.angles = np.linspace(0, np.pi, nangles, endpoint=False) <|end_body_0|> <|body_start_1|> smp = self.smp angles = self.angles smp.compCov(y) spec = np.zeros(angles.shape) for i in range(self.nangle...
DOA tracker without any filtering. It always computes the full spectrum. Attributes ---------- angles : (nangles,) ndarray Vector of angles to be sampled in a spatial spectrum. It is sampled in a linear space. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source...
NaiveTracker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NaiveTracker: """DOA tracker without any filtering. It always computes the full spectrum. Attributes ---------- angles : (nangles,) ndarray Vector of angles to be sampled in a spatial spectrum. It is sampled in a linear space. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S.,...
stack_v2_sparse_classes_75kplus_train_070404
2,209
no_license
[ { "docstring": "Parameters ---------- smp : SpectrumSampler Sampler of spatial spectrum. nangles : int Number of angle samples in a spatial spectrum. The angles will be sampled as a linear space in [0, pi).", "name": "__init__", "signature": "def __init__(self, smp, nangles)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_011820
Implement the Python class `NaiveTracker` described below. Class description: DOA tracker without any filtering. It always computes the full spectrum. Attributes ---------- angles : (nangles,) ndarray Vector of angles to be sampled in a spatial spectrum. It is sampled in a linear space. Reference --------- Zhong, X., ...
Implement the Python class `NaiveTracker` described below. Class description: DOA tracker without any filtering. It always computes the full spectrum. Attributes ---------- angles : (nangles,) ndarray Vector of angles to be sampled in a spatial spectrum. It is sampled in a linear space. Reference --------- Zhong, X., ...
4cbb2eba87c6ffd79e474014584ee31c893ade13
<|skeleton|> class NaiveTracker: """DOA tracker without any filtering. It always computes the full spectrum. Attributes ---------- angles : (nangles,) ndarray Vector of angles to be sampled in a spatial spectrum. It is sampled in a linear space. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S.,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NaiveTracker: """DOA tracker without any filtering. It always computes the full spectrum. Attributes ---------- angles : (nangles,) ndarray Vector of angles to be sampled in a spatial spectrum. It is sampled in a linear space. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle fi...
the_stack_v2_python_sparse
naivetracker.py
qrqiuren/particle
train
5
0c9a5d0bd1bbd05e0aa18eb21561ed92812b1db7
[ "sign = 1 if x >= 0 else -1\nx = abs(x)\nres = 0\nwhile x > 0:\n res = 10 * res + x % 10\n x /= 10\nreturn sign * res if -2 ** 31 <= sign * res <= 2 ** 31 - 1 else 0", "sign = 1 if x >= 0 else -1\nres = int(str(abs(x))[::-1])\nreturn sign * res if -2 ** 31 <= sign * res <= 2 ** 31 - 1 else 0" ]
<|body_start_0|> sign = 1 if x >= 0 else -1 x = abs(x) res = 0 while x > 0: res = 10 * res + x % 10 x /= 10 return sign * res if -2 ** 31 <= sign * res <= 2 ** 31 - 1 else 0 <|end_body_0|> <|body_start_1|> sign = 1 if x >= 0 else -1 res = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse2(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> sign = 1 if x >= 0 else -1 x = abs(x) res = 0 while ...
stack_v2_sparse_classes_75kplus_train_070405
669
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverse2", "signature": "def reverse2(self, x)" } ]
2
stack_v2_sparse_classes_30k_test_001790
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse2(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverse2(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def reverse(self, x): """:type x: int ...
31b2b4dc1e5c3b1c53b333fe30b98ed04b0bdacc
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverse2(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverse(self, x): """:type x: int :rtype: int""" sign = 1 if x >= 0 else -1 x = abs(x) res = 0 while x > 0: res = 10 * res + x % 10 x /= 10 return sign * res if -2 ** 31 <= sign * res <= 2 ** 31 - 1 else 0 def reverse2(...
the_stack_v2_python_sparse
prob007_reverseinteger.py
Hu-Wenchao/leetcode
train
0
7bf5c66ff540902d733abd5d076f8e5109085f44
[ "assert eta > 0, 'Efficiency of electrical heater should not be ' + 'equal to or below zero. Check your inputs.'\nassert eta <= 1, 'Efficiency of electrical heater should not' + ' exceed 1. Check your inputs.'\nsuper(ElectricalHeaterExtended, self).__init__(environment=environment, qNominal=q_nominal, tMax=t_max, l...
<|body_start_0|> assert eta > 0, 'Efficiency of electrical heater should not be ' + 'equal to or below zero. Check your inputs.' assert eta <= 1, 'Efficiency of electrical heater should not' + ' exceed 1. Check your inputs.' super(ElectricalHeaterExtended, self).__init__(environment=environment,...
electricalHeaterExtended class (inheritance from electricalHeater Boiler class) self.totalPConsumption self.totalQOutput
ElectricalHeaterExtended
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectricalHeaterExtended: """electricalHeaterExtended class (inheritance from electricalHeater Boiler class) self.totalPConsumption self.totalQOutput""" def __init__(self, environment, q_nominal, eta=1, t_max=85, lower_activation_limit=0): """Parameters ---------- environment : Exten...
stack_v2_sparse_classes_75kplus_train_070406
5,481
permissive
[ { "docstring": "Parameters ---------- environment : Extended environment object Common to all other objects. Includes time and weather instances q_nominal : float nominal heat production in W eta : float, optional nominal efficiency (without unit) (default: 1) t_max : float maximum provided temperature in °C (d...
4
stack_v2_sparse_classes_30k_train_026467
Implement the Python class `ElectricalHeaterExtended` described below. Class description: electricalHeaterExtended class (inheritance from electricalHeater Boiler class) self.totalPConsumption self.totalQOutput Method signatures and docstrings: - def __init__(self, environment, q_nominal, eta=1, t_max=85, lower_activ...
Implement the Python class `ElectricalHeaterExtended` described below. Class description: electricalHeaterExtended class (inheritance from electricalHeater Boiler class) self.totalPConsumption self.totalQOutput Method signatures and docstrings: - def __init__(self, environment, q_nominal, eta=1, t_max=85, lower_activ...
99fd0dab7f9a9030fd84ba4715753364662927ec
<|skeleton|> class ElectricalHeaterExtended: """electricalHeaterExtended class (inheritance from electricalHeater Boiler class) self.totalPConsumption self.totalQOutput""" def __init__(self, environment, q_nominal, eta=1, t_max=85, lower_activation_limit=0): """Parameters ---------- environment : Exten...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ElectricalHeaterExtended: """electricalHeaterExtended class (inheritance from electricalHeater Boiler class) self.totalPConsumption self.totalQOutput""" def __init__(self, environment, q_nominal, eta=1, t_max=85, lower_activation_limit=0): """Parameters ---------- environment : Extended environme...
the_stack_v2_python_sparse
pycity_calc/energysystems/electricalHeater.py
RWTH-EBC/pyCity_calc
train
4
89a228e893e87b20035e03a43537bcf5d1fcf929
[ "super(RNNEnc, self).__init__()\nself._input_dim = input_dim\nself._con_len = context_length\nself.gru_enc = GRU(input_size=self._input_dim, hidden_size=self._input_dim, num_layers=1, bias=True, batch_first=True, bidirectional=True)\nself.initialize_encoder()", "xavier_normal_(self.gru_enc.weight_ih_l0)\northogon...
<|body_start_0|> super(RNNEnc, self).__init__() self._input_dim = input_dim self._con_len = context_length self.gru_enc = GRU(input_size=self._input_dim, hidden_size=self._input_dim, num_layers=1, bias=True, batch_first=True, bidirectional=True) self.initialize_encoder() <|end_bo...
RNNEnc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNEnc: def __init__(self, input_dim, context_length): """The RNN encoder of the Masker. :param input_dim: The input dimensionality. :type input_dim: int :param context_length: The context length. :type context_length: int""" <|body_0|> def initialize_encoder(self): ...
stack_v2_sparse_classes_75kplus_train_070407
16,858
no_license
[ { "docstring": "The RNN encoder of the Masker. :param input_dim: The input dimensionality. :type input_dim: int :param context_length: The context length. :type context_length: int", "name": "__init__", "signature": "def __init__(self, input_dim, context_length)" }, { "docstring": "Manual weight...
3
stack_v2_sparse_classes_30k_test_001658
Implement the Python class `RNNEnc` described below. Class description: Implement the RNNEnc class. Method signatures and docstrings: - def __init__(self, input_dim, context_length): The RNN encoder of the Masker. :param input_dim: The input dimensionality. :type input_dim: int :param context_length: The context leng...
Implement the Python class `RNNEnc` described below. Class description: Implement the RNNEnc class. Method signatures and docstrings: - def __init__(self, input_dim, context_length): The RNN encoder of the Masker. :param input_dim: The input dimensionality. :type input_dim: int :param context_length: The context leng...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class RNNEnc: def __init__(self, input_dim, context_length): """The RNN encoder of the Masker. :param input_dim: The input dimensionality. :type input_dim: int :param context_length: The context length. :type context_length: int""" <|body_0|> def initialize_encoder(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RNNEnc: def __init__(self, input_dim, context_length): """The RNN encoder of the Masker. :param input_dim: The input dimensionality. :type input_dim: int :param context_length: The context length. :type context_length: int""" super(RNNEnc, self).__init__() self._input_dim = input_dim ...
the_stack_v2_python_sparse
generated/test_dr_costas_mad_twinnet.py
jansel/pytorch-jit-paritybench
train
35
884edb9980e306a8d6f68572fe9097146125fe89
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), name=name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password, name=name)\nuser.is_active = True\nuser.is_superuser =...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), name=name) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.c...
UserProfileManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileManager: def create_user(self, email, name, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, name, password): """Creates and saves a superuser with the given email...
stack_v2_sparse_classes_75kplus_train_070408
10,239
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, name, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name": "c...
2
stack_v2_sparse_classes_30k_train_023445
Implement the Python class `UserProfileManager` described below. Class description: Implement the UserProfileManager class. Method signatures and docstrings: - def create_user(self, email, name, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, ema...
Implement the Python class `UserProfileManager` described below. Class description: Implement the UserProfileManager class. Method signatures and docstrings: - def create_user(self, email, name, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, ema...
c7a03e6c39fa97881455a5b073c4d0e9a5b6075e
<|skeleton|> class UserProfileManager: def create_user(self, email, name, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, name, password): """Creates and saves a superuser with the given email...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProfileManager: def create_user(self, email, name, 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), na...
the_stack_v2_python_sparse
web/models.py
myAlike/SunEye
train
0
4184af7a9550194a650379a96a557656b4750b63
[ "if not email:\n raise ValueError('The Email must be set')\nemail = self.normalize_email(email)\nif not check_ncsu_email(email):\n raise ValueError('Please use NCSU Email Id!')\nuser = self.model(email=email, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user", "extra_fields.setdefault('...
<|body_start_0|> if not email: raise ValueError('The Email must be set') email = self.normalize_email(email) if not check_ncsu_email(email): raise ValueError('Please use NCSU Email Id!') user = self.model(email=email, **extra_fields) user.set_password(pass...
Custom user model manager where email is the unique identifiers for authentication instead of usernames.
CustomUserManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password, **extra_fields): """Create and save a User with the given email and password.""" <|body_0|> def create...
stack_v2_sparse_classes_75kplus_train_070409
2,595
permissive
[ { "docstring": "Create and save a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password, **extra_fields)" }, { "docstring": "Create and save a SuperUser with the given email and password.", "name": "create_superuser", "signat...
2
stack_v2_sparse_classes_30k_train_003265
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where email is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, email, password, **extra_fields): Create and save a User with the given ...
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where email is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, email, password, **extra_fields): Create and save a User with the given ...
c40b5f642577926e01dbc5d95d4abdf2a08bdbb5
<|skeleton|> class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password, **extra_fields): """Create and save a User with the given email and password.""" <|body_0|> def create...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomUserManager: """Custom user model manager where email is the unique identifiers for authentication instead of usernames.""" def create_user(self, email, password, **extra_fields): """Create and save a User with the given email and password.""" if not email: raise ValueEr...
the_stack_v2_python_sparse
src/base/managers.py
Nikhil1912/FindMyRoomie_2.0
train
1
c219375c1f52bcbbf41de7510397aaa2565f6a8f
[ "print('BASE CONVERTER')\nprint('Numbers entered must be below ten quintillion threshold.\\n')\nnum1 = input('Please enter number to convert: ')\nnum2 = int(input('Please enter the base of the number: '))\nif num2 == 1 or num2 == 0:\n print('A base of 0 or 1 will not work.')\nelif num2 == 10:\n print('The num...
<|body_start_0|> print('BASE CONVERTER') print('Numbers entered must be below ten quintillion threshold.\n') num1 = input('Please enter number to convert: ') num2 = int(input('Please enter the base of the number: ')) if num2 == 1 or num2 == 0: print('A base of 0 or 1 ...
Base
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: def convert_ten(self): """Description: This method converts any number from its base to base 10. Args: None. Returns: num1, total""" <|body_0|> def convert_base(self, num1, total): """Description: This method converts any number from base 10 to the users chosen...
stack_v2_sparse_classes_75kplus_train_070410
3,231
permissive
[ { "docstring": "Description: This method converts any number from its base to base 10. Args: None. Returns: num1, total", "name": "convert_ten", "signature": "def convert_ten(self)" }, { "docstring": "Description: This method converts any number from base 10 to the users chosen base. Args: num1,...
2
stack_v2_sparse_classes_30k_test_001292
Implement the Python class `Base` described below. Class description: Implement the Base class. Method signatures and docstrings: - def convert_ten(self): Description: This method converts any number from its base to base 10. Args: None. Returns: num1, total - def convert_base(self, num1, total): Description: This me...
Implement the Python class `Base` described below. Class description: Implement the Base class. Method signatures and docstrings: - def convert_ten(self): Description: This method converts any number from its base to base 10. Args: None. Returns: num1, total - def convert_base(self, num1, total): Description: This me...
df46c8bb8e4c8ba6d34898cd13cdb0348eb4e74d
<|skeleton|> class Base: def convert_ten(self): """Description: This method converts any number from its base to base 10. Args: None. Returns: num1, total""" <|body_0|> def convert_base(self, num1, total): """Description: This method converts any number from base 10 to the users chosen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Base: def convert_ten(self): """Description: This method converts any number from its base to base 10. Args: None. Returns: num1, total""" print('BASE CONVERTER') print('Numbers entered must be below ten quintillion threshold.\n') num1 = input('Please enter number to convert: '...
the_stack_v2_python_sparse
base_converter.py
tangowithfoxtrot/beginner_project_solutions
train
0
a43818e2155633354f9a3d4ae1b25104d32ffb58
[ "super().__init__(**kwargs)\nself.reader = profile_reader\nself.standardiser = profile_standardiser\nself.taxonomy = taxonomy_service", "if name is None:\n name = profile.stem\ntry:\n result = self.standardiser.transform(self.reader.read(profile))\nexcept SchemaErrors as errors:\n raise StandardisationEr...
<|body_start_0|> super().__init__(**kwargs) self.reader = profile_reader self.standardiser = profile_standardiser self.taxonomy = taxonomy_service <|end_body_0|> <|body_start_1|> if name is None: name = profile.stem try: result = self.standardiser...
Define the sample ETL application.
SampleETLApplication
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampleETLApplication: """Define the sample ETL application.""" def __init__(self, *, profile_reader: Type[ProfileReader], profile_standardiser: Type[ProfileStandardisationService], taxonomy_service: Optional[TaxonomyService]=None, **kwargs: dict): """Initialize the application for a ...
stack_v2_sparse_classes_75kplus_train_070411
3,774
permissive
[ { "docstring": "Initialize the application for a particular taxonomic profiler. Args: profile_reader: A profile reader for a specific taxonomic profile format. profile_standardiser: A profile standardisation service for a specific taxonomic profile format. taxonomy_service: A taxonomy service instance. It is as...
2
stack_v2_sparse_classes_30k_train_042396
Implement the Python class `SampleETLApplication` described below. Class description: Define the sample ETL application. Method signatures and docstrings: - def __init__(self, *, profile_reader: Type[ProfileReader], profile_standardiser: Type[ProfileStandardisationService], taxonomy_service: Optional[TaxonomyService]...
Implement the Python class `SampleETLApplication` described below. Class description: Define the sample ETL application. Method signatures and docstrings: - def __init__(self, *, profile_reader: Type[ProfileReader], profile_standardiser: Type[ProfileStandardisationService], taxonomy_service: Optional[TaxonomyService]...
98713deaeec2e92b2f020860d264bccc9a25dbd1
<|skeleton|> class SampleETLApplication: """Define the sample ETL application.""" def __init__(self, *, profile_reader: Type[ProfileReader], profile_standardiser: Type[ProfileStandardisationService], taxonomy_service: Optional[TaxonomyService]=None, **kwargs: dict): """Initialize the application for a ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SampleETLApplication: """Define the sample ETL application.""" def __init__(self, *, profile_reader: Type[ProfileReader], profile_standardiser: Type[ProfileStandardisationService], taxonomy_service: Optional[TaxonomyService]=None, **kwargs: dict): """Initialize the application for a particular ta...
the_stack_v2_python_sparse
src/taxpasta/infrastructure/application/sample_etl_application.py
taxprofiler/taxpasta
train
21
7c8eb00d7016fd0f84cca169f382c73cd6eab64c
[ "self._libros = []\narchivos = os.listdir(path='libros')\nfor n in archivos:\n if '.txt' in n:\n archivo = open('libros/' + n, 'r', encoding='utf-8')\n linea1 = archivo.readline()\n linea2 = archivo.readline()\n autor = (linea1 if linea1.find('autor') != -1 else linea2).replace('autor...
<|body_start_0|> self._libros = [] archivos = os.listdir(path='libros') for n in archivos: if '.txt' in n: archivo = open('libros/' + n, 'r', encoding='utf-8') linea1 = archivo.readline() linea2 = archivo.readline() auto...
Representa un lector de libros eléctronicos
EReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EReader: """Representa un lector de libros eléctronicos""" def __init__(self): """Se debe leer la lista de libros que están en el directorio 'libros'. Las dos primeras líneas de cada archivo contienen el autor y el título de cada libro, esta información no forma parte del contenido d...
stack_v2_sparse_classes_75kplus_train_070412
1,656
no_license
[ { "docstring": "Se debe leer la lista de libros que están en el directorio 'libros'. Las dos primeras líneas de cada archivo contienen el autor y el título de cada libro, esta información no forma parte del contenido del libro. Los nombres de los archivos terminan con la extensión .txt", "name": "__init__",...
2
null
Implement the Python class `EReader` described below. Class description: Representa un lector de libros eléctronicos Method signatures and docstrings: - def __init__(self): Se debe leer la lista de libros que están en el directorio 'libros'. Las dos primeras líneas de cada archivo contienen el autor y el título de ca...
Implement the Python class `EReader` described below. Class description: Representa un lector de libros eléctronicos Method signatures and docstrings: - def __init__(self): Se debe leer la lista de libros que están en el directorio 'libros'. Las dos primeras líneas de cada archivo contienen el autor y el título de ca...
ec6b69ccf995041a086ccf14e57cbc7886622ed5
<|skeleton|> class EReader: """Representa un lector de libros eléctronicos""" def __init__(self): """Se debe leer la lista de libros que están en el directorio 'libros'. Las dos primeras líneas de cada archivo contienen el autor y el título de cada libro, esta información no forma parte del contenido d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EReader: """Representa un lector de libros eléctronicos""" def __init__(self): """Se debe leer la lista de libros que están en el directorio 'libros'. Las dos primeras líneas de cada archivo contienen el autor y el título de cada libro, esta información no forma parte del contenido del libro. Los...
the_stack_v2_python_sparse
ejercicio1/angel/ereader.py
jazt9513/IA
train
0
774f871c6924b3adc5cee488b2beb7128509d8eb
[ "Thread.__init__(self)\nself.name = name\nself.url = url", "handle = urllib.request.urlopen(self.url)\nfname = os.path.basename(self.url)\nwith open(fname, 'wb') as f_handler:\n while True:\n chunk = handle.read(1024)\n if not chunk:\n break\n f_handler.write(chunk)\nmsg = '%s h...
<|body_start_0|> Thread.__init__(self) self.name = name self.url = url <|end_body_0|> <|body_start_1|> handle = urllib.request.urlopen(self.url) fname = os.path.basename(self.url) with open(fname, 'wb') as f_handler: while True: chunk = handle...
A threading example that can download a file
DownloadThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownloadThread: """A threading example that can download a file""" def __init__(self, url, name): """Initialize the thread""" <|body_0|> def run(self): """Run the thread""" <|body_1|> <|end_skeleton|> <|body_start_0|> Thread.__init__(self) ...
stack_v2_sparse_classes_75kplus_train_070413
3,234
no_license
[ { "docstring": "Initialize the thread", "name": "__init__", "signature": "def __init__(self, url, name)" }, { "docstring": "Run the thread", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_051520
Implement the Python class `DownloadThread` described below. Class description: A threading example that can download a file Method signatures and docstrings: - def __init__(self, url, name): Initialize the thread - def run(self): Run the thread
Implement the Python class `DownloadThread` described below. Class description: A threading example that can download a file Method signatures and docstrings: - def __init__(self, url, name): Initialize the thread - def run(self): Run the thread <|skeleton|> class DownloadThread: """A threading example that can ...
8ea0871c3d7ca86327424562e1b04daca6d54054
<|skeleton|> class DownloadThread: """A threading example that can download a file""" def __init__(self, url, name): """Initialize the thread""" <|body_0|> def run(self): """Run the thread""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DownloadThread: """A threading example that can download a file""" def __init__(self, url, name): """Initialize the thread""" Thread.__init__(self) self.name = name self.url = url def run(self): """Run the thread""" handle = urllib.request.urlopen(self...
the_stack_v2_python_sparse
metaverse/utils/scheduler_example.py
CyberChad/Metaverse
train
3
3610fa11406aab74feba6b034e76e404bb00c387
[ "self._params = Parameters()\nfor path, param in network.get_variables().items():\n self._params.add(path + '_velocity', numpy.zeros_like(param.get_value()))\nif 'momentum' not in optimization_options:\n raise ValueError('Momentum is not given in optimization options.')\nself._momentum = optimization_options[...
<|body_start_0|> self._params = Parameters() for path, param in network.get_variables().items(): self._params.add(path + '_velocity', numpy.zeros_like(param.get_value())) if 'momentum' not in optimization_options: raise ValueError('Momentum is not given in optimization op...
Nesterov Momentum Optimization Method Normally Nesterov momentum is implemented by first taking a step towards the previous update direction, calculating gradient at that position, using the gradient to obtain the new update direction, and finally updating the parameters. We use an alternative formulation that requires...
NesterovOptimizer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NesterovOptimizer: """Nesterov Momentum Optimization Method Normally Nesterov momentum is implemented by first taking a step towards the previous update direction, calculating gradient at that position, using the gradient to obtain the new update direction, and finally updating the parameters. We...
stack_v2_sparse_classes_75kplus_train_070414
2,905
permissive
[ { "docstring": "Creates a Nesterov momentum optimizer. Nesterov momentum optimizer does not use additional parameters. :type optimization_options: dict :param optimization_options: a dictionary of optimization options :type network: Network :param network: the neural network object", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_017734
Implement the Python class `NesterovOptimizer` described below. Class description: Nesterov Momentum Optimization Method Normally Nesterov momentum is implemented by first taking a step towards the previous update direction, calculating gradient at that position, using the gradient to obtain the new update direction, ...
Implement the Python class `NesterovOptimizer` described below. Class description: Nesterov Momentum Optimization Method Normally Nesterov momentum is implemented by first taking a step towards the previous update direction, calculating gradient at that position, using the gradient to obtain the new update direction, ...
9904faec19ad5718470f21927229aad2656e5686
<|skeleton|> class NesterovOptimizer: """Nesterov Momentum Optimization Method Normally Nesterov momentum is implemented by first taking a step towards the previous update direction, calculating gradient at that position, using the gradient to obtain the new update direction, and finally updating the parameters. We...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NesterovOptimizer: """Nesterov Momentum Optimization Method Normally Nesterov momentum is implemented by first taking a step towards the previous update direction, calculating gradient at that position, using the gradient to obtain the new update direction, and finally updating the parameters. We use an alter...
the_stack_v2_python_sparse
theanolm/training/nesterovoptimizer.py
senarvi/theanolm
train
95
4284535d2c74a3c15e86ff792b59ea2f5ce103c5
[ "losses = dict()\nif self.pixel_loss:\n losses['loss_pix'] = self.pixel_loss(batch_outputs, batch_gt_data)\nif self.perceptual_loss:\n loss_percep, loss_style = self.perceptual_loss(batch_outputs, batch_gt_data)\n if loss_percep is not None:\n losses['loss_perceptual'] = loss_percep\n if loss_sty...
<|body_start_0|> losses = dict() if self.pixel_loss: losses['loss_pix'] = self.pixel_loss(batch_outputs, batch_gt_data) if self.perceptual_loss: loss_percep, loss_style = self.perceptual_loss(batch_outputs, batch_gt_data) if loss_percep is not None: ...
Enhanced SRGAN model for single image super-resolution. Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN. Args: generator (dict): Config for the generator. discriminator (dict): Config for the d...
ESRGAN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESRGAN: """Enhanced SRGAN model for single image super-resolution. Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN. Args: generator (dict): Config for the generator. disc...
stack_v2_sparse_classes_75kplus_train_070415
4,262
permissive
[ { "docstring": "G step of GAN: Calculate losses of generator. Args: batch_outputs (Tensor): Batch output of generator. batch_gt_data (Tensor): Batch GT data. Returns: dict: Dict of losses.", "name": "g_step", "signature": "def g_step(self, batch_outputs: torch.Tensor, batch_gt_data: torch.Tensor)" }, ...
3
stack_v2_sparse_classes_30k_train_023562
Implement the Python class `ESRGAN` described below. Class description: Enhanced SRGAN model for single image super-resolution. Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN. Args: generator...
Implement the Python class `ESRGAN` described below. Class description: Enhanced SRGAN model for single image super-resolution. Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN. Args: generator...
a382f143c0fd20d227e1e5524831ba26a568190d
<|skeleton|> class ESRGAN: """Enhanced SRGAN model for single image super-resolution. Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN. Args: generator (dict): Config for the generator. disc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ESRGAN: """Enhanced SRGAN model for single image super-resolution. Ref: ESRGAN: Enhanced Super-Resolution Generative Adversarial Networks. It uses RaGAN for GAN updates: The relativistic discriminator: a key element missing from standard GAN. Args: generator (dict): Config for the generator. discriminator (di...
the_stack_v2_python_sparse
mmagic/models/editors/esrgan/esrgan.py
open-mmlab/mmagic
train
1,370
12880601eb056ffcd27fedc77b3964e1d4a6f5d2
[ "if m == 1 or n == 1:\n return 1\ndp = [[0] * n for _ in range(m)]\ndp[0] = [1] * n\nfor i in range(m):\n dp[i][0] = 1\nfor i in range(1, m):\n for j in range(1, n):\n dp[i][j] = dp[i][j - 1] + dp[i - 1][j]\nreturn dp[m - 1][n - 1]", "if m == 1 or n == 1:\n return 1\ndp = [1] * n\nfor _ in rang...
<|body_start_0|> if m == 1 or n == 1: return 1 dp = [[0] * n for _ in range(m)] dp[0] = [1] * n for i in range(m): dp[i][0] = 1 for i in range(1, m): for j in range(1, n): dp[i][j] = dp[i][j - 1] + dp[i - 1][j] return dp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def unique_path(self, m: int, n: int) -> int: """O(n*m) space""" <|body_0|> def unique_path_less_space(self, m: int, n: int) -> int: """Instead of using m rows in the dp matrix, we only need to maintain one row. O(n) sapce""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_070416
864
no_license
[ { "docstring": "O(n*m) space", "name": "unique_path", "signature": "def unique_path(self, m: int, n: int) -> int" }, { "docstring": "Instead of using m rows in the dp matrix, we only need to maintain one row. O(n) sapce", "name": "unique_path_less_space", "signature": "def unique_path_le...
2
stack_v2_sparse_classes_30k_train_014833
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def unique_path(self, m: int, n: int) -> int: O(n*m) space - def unique_path_less_space(self, m: int, n: int) -> int: Instead of using m rows in the dp matrix, we only need to ma...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def unique_path(self, m: int, n: int) -> int: O(n*m) space - def unique_path_less_space(self, m: int, n: int) -> int: Instead of using m rows in the dp matrix, we only need to ma...
5625e6396b746255f3343253c75447ead95879c7
<|skeleton|> class Solution: def unique_path(self, m: int, n: int) -> int: """O(n*m) space""" <|body_0|> def unique_path_less_space(self, m: int, n: int) -> int: """Instead of using m rows in the dp matrix, we only need to maintain one row. O(n) sapce""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def unique_path(self, m: int, n: int) -> int: """O(n*m) space""" if m == 1 or n == 1: return 1 dp = [[0] * n for _ in range(m)] dp[0] = [1] * n for i in range(m): dp[i][0] = 1 for i in range(1, m): for j in range(1, ...
the_stack_v2_python_sparse
62_unique_path/solution.py
FluffyFu/Leetcode
train
0
29eba9e0c27314ff329dcb653fff6c43de0edf03
[ "\"\"\"Logging server requires some default data for easy searching.\"\"\"\nusername = os.environ.get('BUILD_USER_ID', None)\nif username is None:\n username = os.environ.get('USER', '')\nself.default_data = {'type': 'qcatest', 'subtype': subtype, 'hostname': socket.gethostname(), 'user': username, 'build_url': ...
<|body_start_0|> """Logging server requires some default data for easy searching.""" username = os.environ.get('BUILD_USER_ID', None) if username is None: username = os.environ.get('USER', '') self.default_data = {'type': 'qcatest', 'subtype': subtype, 'hostname': socket.geth...
Write data to remote logging server.
RemoteLogger
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteLogger: """Write data to remote logging server.""" def __init__(self, server, subtype='demo'): """Constructor used to remote server logging :param server: remote server to log :type server: string :param subtype: subtype to be used, defaults to 'demo' :type subtype: string""" ...
stack_v2_sparse_classes_75kplus_train_070417
2,116
permissive
[ { "docstring": "Constructor used to remote server logging :param server: remote server to log :type server: string :param subtype: subtype to be used, defaults to 'demo' :type subtype: string", "name": "__init__", "signature": "def __init__(self, server, subtype='demo')" }, { "docstring": "Logs ...
2
null
Implement the Python class `RemoteLogger` described below. Class description: Write data to remote logging server. Method signatures and docstrings: - def __init__(self, server, subtype='demo'): Constructor used to remote server logging :param server: remote server to log :type server: string :param subtype: subtype ...
Implement the Python class `RemoteLogger` described below. Class description: Write data to remote logging server. Method signatures and docstrings: - def __init__(self, server, subtype='demo'): Constructor used to remote server logging :param server: remote server to log :type server: string :param subtype: subtype ...
100521fde1fb67536682cafecc2f91a6e2e8a6f8
<|skeleton|> class RemoteLogger: """Write data to remote logging server.""" def __init__(self, server, subtype='demo'): """Constructor used to remote server logging :param server: remote server to log :type server: string :param subtype: subtype to be used, defaults to 'demo' :type subtype: string""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoteLogger: """Write data to remote logging server.""" def __init__(self, server, subtype='demo'): """Constructor used to remote server logging :param server: remote server to log :type server: string :param subtype: subtype to be used, defaults to 'demo' :type subtype: string""" """Log...
the_stack_v2_python_sparse
boardfarm/dbclients/logstash.py
mattsm/boardfarm
train
45
7980cac317f328fd6387eab10ef8309b30a155e7
[ "self.pool = heapq.nlargest(k, nums)\nheapq.heapify(self.pool)\nself.k = k", "if len(self.pool) < self.k:\n heapq.heappush(self.pool, val)\nelse:\n heapq.heappushpop(self.pool, val)\nreturn self.pool[0]" ]
<|body_start_0|> self.pool = heapq.nlargest(k, nums) heapq.heapify(self.pool) self.k = k <|end_body_0|> <|body_start_1|> if len(self.pool) < self.k: heapq.heappush(self.pool, val) else: heapq.heappushpop(self.pool, val) return self.pool[0] <|end_b...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pool = heapq.nlargest(k, nums) heapq.heapify(...
stack_v2_sparse_classes_75kplus_train_070418
822
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_011854
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
bf900574ebec530f4af4494f81c84b31d36c9933
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.pool = heapq.nlargest(k, nums) heapq.heapify(self.pool) self.k = k def add(self, val): """:type val: int :rtype: int""" if len(self.pool) < self.k: heapq.heap...
the_stack_v2_python_sparse
easy/kth_largest_element_in_a_stream.py
luozhiping/leetcode
train
5
97121c708408294e0bb9804efec9e695d6907591
[ "location = self._parse_location(response)\nmeeting_map = {}\nfor item in response.css('.layoutArea li'):\n start = self._parse_start(item)\n if not start:\n continue\n meeting = Meeting(title='State Street Commission', description='', classification=COMMISSION, start=start, end=None, time_notes='',...
<|body_start_0|> location = self._parse_location(response) meeting_map = {} for item in response.css('.layoutArea li'): start = self._parse_start(item) if not start: continue meeting = Meeting(title='State Street Commission', description='', cl...
ChiSsa1Spider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChiSsa1Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start date and time.""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_070419
2,987
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse start date and time.", "name": "_parse_start", "signature":...
4
stack_v2_sparse_classes_30k_test_001398
Implement the Python class `ChiSsa1Spider` described below. Class description: Implement the ChiSsa1Spider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs. - def _parse_...
Implement the Python class `ChiSsa1Spider` described below. Class description: Implement the ChiSsa1Spider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs. - def _parse_...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class ChiSsa1Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start date and time.""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChiSsa1Spider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" location = self._parse_location(response) meeting_map = {} for item in response.css('.layoutArea li'):...
the_stack_v2_python_sparse
city_scrapers/spiders/chi_ssa_1.py
City-Bureau/city-scrapers
train
308
aeede243f60600e080ec9bee7e0cd54734f9cfb0
[ "if v is not None:\n if not v.get('eapType'):\n raise ValueError('eapType must be defined')\n try:\n wifi.eap_check_config(v)\n except wifi.ConfigureArgsError as e:\n raise ValueError(str(e))\nreturn v", "security_type = values.get('securityType')\npsk = values.get('psk')\neapconfig ...
<|body_start_0|> if v is not None: if not v.get('eapType'): raise ValueError('eapType must be defined') try: wifi.eap_check_config(v) except wifi.ConfigureArgsError as e: raise ValueError(str(e)) return v <|end_body_0|> ...
WifiConfiguration
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WifiConfiguration: def eap_config_validate(cls, v): """Custom validator for the eapConfig field""" <|body_0|> def validate_configuration(cls, values): """Validate the configuration""" <|body_1|> <|end_skeleton|> <|body_start_0|> if v is not None: ...
stack_v2_sparse_classes_75kplus_train_070420
13,352
permissive
[ { "docstring": "Custom validator for the eapConfig field", "name": "eap_config_validate", "signature": "def eap_config_validate(cls, v)" }, { "docstring": "Validate the configuration", "name": "validate_configuration", "signature": "def validate_configuration(cls, values)" } ]
2
stack_v2_sparse_classes_30k_test_002956
Implement the Python class `WifiConfiguration` described below. Class description: Implement the WifiConfiguration class. Method signatures and docstrings: - def eap_config_validate(cls, v): Custom validator for the eapConfig field - def validate_configuration(cls, values): Validate the configuration
Implement the Python class `WifiConfiguration` described below. Class description: Implement the WifiConfiguration class. Method signatures and docstrings: - def eap_config_validate(cls, v): Custom validator for the eapConfig field - def validate_configuration(cls, values): Validate the configuration <|skeleton|> cl...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class WifiConfiguration: def eap_config_validate(cls, v): """Custom validator for the eapConfig field""" <|body_0|> def validate_configuration(cls, values): """Validate the configuration""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WifiConfiguration: def eap_config_validate(cls, v): """Custom validator for the eapConfig field""" if v is not None: if not v.get('eapType'): raise ValueError('eapType must be defined') try: wifi.eap_check_config(v) except wif...
the_stack_v2_python_sparse
robot-server/robot_server/service/legacy/models/networking.py
Opentrons/opentrons
train
326
da793730ffbc2d0521a106fc0cc5d003484e5f8e
[ "super(ReinforceWithBaseline, self).__init__()\nself.num_actions = num_actions\nself.hidden_size = 64\nself.dense1 = tf.keras.layers.Dense(self.hidden_size, activation='relu')\nself.dense2 = tf.keras.layers.Dense(self.num_actions, activation='softmax')\nself.critic1 = tf.keras.layers.Dense(self.hidden_size, activat...
<|body_start_0|> super(ReinforceWithBaseline, self).__init__() self.num_actions = num_actions self.hidden_size = 64 self.dense1 = tf.keras.layers.Dense(self.hidden_size, activation='relu') self.dense2 = tf.keras.layers.Dense(self.num_actions, activation='softmax') self.cr...
ReinforceWithBaseline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReinforceWithBaseline: def __init__(self, state_size, num_actions): """The ReinforceWithBaseline class that inherits from tf.keras.Model. The forward pass calculates the policy for the agent given a batch of states. During training, ReinforceWithBaseLine estimates the value of each state...
stack_v2_sparse_classes_75kplus_train_070421
5,091
no_license
[ { "docstring": "The ReinforceWithBaseline class that inherits from tf.keras.Model. The forward pass calculates the policy for the agent given a batch of states. During training, ReinforceWithBaseLine estimates the value of each state to be used as a baseline to compare the policy's performance with. :param stat...
4
null
Implement the Python class `ReinforceWithBaseline` described below. Class description: Implement the ReinforceWithBaseline class. Method signatures and docstrings: - def __init__(self, state_size, num_actions): The ReinforceWithBaseline class that inherits from tf.keras.Model. The forward pass calculates the policy f...
Implement the Python class `ReinforceWithBaseline` described below. Class description: Implement the ReinforceWithBaseline class. Method signatures and docstrings: - def __init__(self, state_size, num_actions): The ReinforceWithBaseline class that inherits from tf.keras.Model. The forward pass calculates the policy f...
8f0ed6982ae6aba938cbf39af0e2a6259478db1c
<|skeleton|> class ReinforceWithBaseline: def __init__(self, state_size, num_actions): """The ReinforceWithBaseline class that inherits from tf.keras.Model. The forward pass calculates the policy for the agent given a batch of states. During training, ReinforceWithBaseLine estimates the value of each state...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReinforceWithBaseline: def __init__(self, state_size, num_actions): """The ReinforceWithBaseline class that inherits from tf.keras.Model. The forward pass calculates the policy for the agent given a batch of states. During training, ReinforceWithBaseLine estimates the value of each state to be used as...
the_stack_v2_python_sparse
hw6_REINFORCE/reinforce_with_baseline.py
YingSun0314/DeepLearningProjects
train
0
13a9eec5b9e72d3a869a196d6472043bc6b9036d
[ "problem = api.problem.get_problem(problem_id)\nif not problem:\n raise PicoException('Problem not found', status_code=404)\ncurr_user = api.user.get_user()\nproblem['solves'] = api.stats.get_problem_solves(problem['pid'])\nproblem['unlocked'] = problem['pid'] in api.problem.get_unlocked_pids(curr_user['tid'])\n...
<|body_start_0|> problem = api.problem.get_problem(problem_id) if not problem: raise PicoException('Problem not found', status_code=404) curr_user = api.user.get_user() problem['solves'] = api.stats.get_problem_solves(problem['pid']) problem['unlocked'] = problem['pid...
Get or update the availability of a specific problem.
Problem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Problem: """Get or update the availability of a specific problem.""" def get(self, problem_id): """Retrieve a specific problem.""" <|body_0|> def patch(self, problem_id): """Update a specific problem. The only valid field for this method is "disabled". Other fiel...
stack_v2_sparse_classes_75kplus_train_070422
11,388
permissive
[ { "docstring": "Retrieve a specific problem.", "name": "get", "signature": "def get(self, problem_id)" }, { "docstring": "Update a specific problem. The only valid field for this method is \"disabled\". Other fields are pulled from the shell server, and can be updated via the PATCH /problems end...
2
null
Implement the Python class `Problem` described below. Class description: Get or update the availability of a specific problem. Method signatures and docstrings: - def get(self, problem_id): Retrieve a specific problem. - def patch(self, problem_id): Update a specific problem. The only valid field for this method is "...
Implement the Python class `Problem` described below. Class description: Get or update the availability of a specific problem. Method signatures and docstrings: - def get(self, problem_id): Retrieve a specific problem. - def patch(self, problem_id): Update a specific problem. The only valid field for this method is "...
468035038afe00c6e7842b7e68ec45355ee1a224
<|skeleton|> class Problem: """Get or update the availability of a specific problem.""" def get(self, problem_id): """Retrieve a specific problem.""" <|body_0|> def patch(self, problem_id): """Update a specific problem. The only valid field for this method is "disabled". Other fiel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Problem: """Get or update the availability of a specific problem.""" def get(self, problem_id): """Retrieve a specific problem.""" problem = api.problem.get_problem(problem_id) if not problem: raise PicoException('Problem not found', status_code=404) curr_user ...
the_stack_v2_python_sparse
picoCTF-web/api/apps/v1/problems.py
zxc135781/picoCTF
train
1
32078d034f26582cec3511d5a3b8b0354d65863d
[ "super().__init__(input_name=input_name, output_names=[output_name])\nself.crop_proportion = crop_proportion\nself.crop_shape = crop_shape", "with tf.name_scope('CenterCropWithResize'):\n input = input[self.input_name]\n shape = tf.shape(input)\n image_height = shape[0]\n image_width = shape[1]\n h...
<|body_start_0|> super().__init__(input_name=input_name, output_names=[output_name]) self.crop_proportion = crop_proportion self.crop_shape = crop_shape <|end_body_0|> <|body_start_1|> with tf.name_scope('CenterCropWithResize'): input = input[self.input_name] sha...
The CenterCropWithResize crops (and resizes) the given (image) input at the center. :Attributes: crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. crop_shape: (Array) The shape to crop. [1, 32, 32, 3] by default.
CenterCropWithResize
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CenterCropWithResize: """The CenterCropWithResize crops (and resizes) the given (image) input at the center. :Attributes: crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. crop_shape: (Array) The shape to crop. [1, 32, 32, 3] by default.""" ...
stack_v2_sparse_classes_75kplus_train_070423
4,169
permissive
[ { "docstring": "Constructor, initialize member variables. :param crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. :param crop_shape: (Array) The shape to crop. [1, 32, 32, 3] by default. :param input_name: (String) The name of the input to apply this operatio...
3
stack_v2_sparse_classes_30k_train_007149
Implement the Python class `CenterCropWithResize` described below. Class description: The CenterCropWithResize crops (and resizes) the given (image) input at the center. :Attributes: crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. crop_shape: (Array) The shape to c...
Implement the Python class `CenterCropWithResize` described below. Class description: The CenterCropWithResize crops (and resizes) the given (image) input at the center. :Attributes: crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. crop_shape: (Array) The shape to c...
6907ae5781765f56a8492bfba594bfb3b9987f29
<|skeleton|> class CenterCropWithResize: """The CenterCropWithResize crops (and resizes) the given (image) input at the center. :Attributes: crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. crop_shape: (Array) The shape to crop. [1, 32, 32, 3] by default.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CenterCropWithResize: """The CenterCropWithResize crops (and resizes) the given (image) input at the center. :Attributes: crop_proportion: (Float) Proportion of image to retain along the less-cropped side. 0.875 by default. crop_shape: (Array) The shape to crop. [1, 32, 32, 3] by default.""" def __init__...
the_stack_v2_python_sparse
Preprocessing_Component/Preprocessing/CenterCropWithResize.py
BonifazStuhr/OFM
train
0
453df5d56509724e346bede1f95801d911a90861
[ "if not root:\n return\nl = self.invertTree(root.left)\nr = self.invertTree(root.right)\nroot.left = r\nroot.right = l\nreturn root", "if root:\n self.invertTree(root.left)\n self.invertTree(root.right)\n root.left, root.right = (root.right, root.left)\nreturn root" ]
<|body_start_0|> if not root: return l = self.invertTree(root.left) r = self.invertTree(root.right) root.left = r root.right = l return root <|end_body_0|> <|body_start_1|> if root: self.invertTree(root.left) self.invertTree(ro...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: """Nov 05, 2021 13:16""" <|body_0|> def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: """Mar 20, 2023 23:41""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_070424
1,710
no_license
[ { "docstring": "Nov 05, 2021 13:16", "name": "invertTree", "signature": "def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]" }, { "docstring": "Mar 20, 2023 23:41", "name": "invertTree", "signature": "def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]"...
2
stack_v2_sparse_classes_30k_train_038590
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: Nov 05, 2021 13:16 - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: Mar 20, 2023 23:4...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: Nov 05, 2021 13:16 - def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: Mar 20, 2023 23:4...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: """Nov 05, 2021 13:16""" <|body_0|> def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: """Mar 20, 2023 23:41""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: """Nov 05, 2021 13:16""" if not root: return l = self.invertTree(root.left) r = self.invertTree(root.right) root.left = r root.right = l return root def inve...
the_stack_v2_python_sparse
leetcode/solved/226_Invert_Binary_Tree/solution.py
sungminoh/algorithms
train
0
98db034bcef575d979fd1bcbf9d53896af0819c0
[ "super().__init__(channel)\nconfig = get_config()\nself.LOGGER = logging.getLogger('fm.device.service.messages')\nself.exchange_name = config.RABBITMQ_MESSAGES_EXCHANGE_NAME\nself.exchange_type = config.RABBITMQ_MESSAGES_EXCHANGE_TYPE\nself.routing_key = '_internal'\nself.setup_exchange(self.exchange_name)", "pay...
<|body_start_0|> super().__init__(channel) config = get_config() self.LOGGER = logging.getLogger('fm.device.service.messages') self.exchange_name = config.RABBITMQ_MESSAGES_EXCHANGE_NAME self.exchange_type = config.RABBITMQ_MESSAGES_EXCHANGE_TYPE self.routing_key = '_inte...
Receive and respond to internal message requests.
DeviceMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceMessage: """Receive and respond to internal message requests.""" def __init__(self, channel): """Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication""" ...
stack_v2_sparse_classes_75kplus_train_070425
9,633
permissive
[ { "docstring": "Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication", "name": "__init__", "signature": "def __init__(self, channel)" }, { "docstring": "Invoked by pika when a me...
2
stack_v2_sparse_classes_30k_val_000608
Implement the Python class `DeviceMessage` described below. Class description: Receive and respond to internal message requests. Method signatures and docstrings: - def __init__(self, channel): Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setu...
Implement the Python class `DeviceMessage` described below. Class description: Receive and respond to internal message requests. Method signatures and docstrings: - def __init__(self, channel): Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setu...
7d37690a8c42091a5892aa45518bfe6003728a18
<|skeleton|> class DeviceMessage: """Receive and respond to internal message requests.""" def __init__(self, channel): """Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeviceMessage: """Receive and respond to internal message requests.""" def __init__(self, channel): """Override the __init__ method from Message class. Create the logger instance, and set the required config info. Call the setup_exchange function to start the communication""" super().__in...
the_stack_v2_python_sparse
server/fm_server/device/service.py
nstoik/farm_monitor
train
0
e049b6f78f5ce65cb884b5fb1437243f559f512a
[ "super().__init__(coordinator)\nself.entity_description = description\nself._remote = remote\nself._attr_unique_id = f'{coordinator.mac_address}-{description.key}'\nself._attr_device_info = DeviceInfo(connections={(dr.CONNECTION_NETWORK_MAC, coordinator.mac_address)})", "response: SwitcherBaseResponse = None\nerr...
<|body_start_0|> super().__init__(coordinator) self.entity_description = description self._remote = remote self._attr_unique_id = f'{coordinator.mac_address}-{description.key}' self._attr_device_info = DeviceInfo(connections={(dr.CONNECTION_NETWORK_MAC, coordinator.mac_address)})...
Representation of a Switcher climate entity.
SwitcherThermostatButtonEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwitcherThermostatButtonEntity: """Representation of a Switcher climate entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None: """Initialize the entity.""" <|body...
stack_v2_sparse_classes_75kplus_train_070426
5,671
permissive
[ { "docstring": "Initialize the entity.", "name": "__init__", "signature": "def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None" }, { "docstring": "Press the button.", "name": "async_press...
2
stack_v2_sparse_classes_30k_train_021821
Implement the Python class `SwitcherThermostatButtonEntity` described below. Class description: Representation of a Switcher climate entity. Method signatures and docstrings: - def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreeze...
Implement the Python class `SwitcherThermostatButtonEntity` described below. Class description: Representation of a Switcher climate entity. Method signatures and docstrings: - def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreeze...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SwitcherThermostatButtonEntity: """Representation of a Switcher climate entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None: """Initialize the entity.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwitcherThermostatButtonEntity: """Representation of a Switcher climate entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator, description: SwitcherThermostatButtonEntityDescription, remote: SwitcherBreezeRemote) -> None: """Initialize the entity.""" super().__init__(co...
the_stack_v2_python_sparse
homeassistant/components/switcher_kis/button.py
home-assistant/core
train
35,501
c307b1a541a8541710c5cfa34e4a57b40733e25c
[ "self.params = {}\n'\\n 我们用标准差为weight_scale的高斯分布初始化参数W,\\n 偏置B的初始化都为0:\\n (其中randn函数是基于零均值和标准差的一个高斯分布)\\n '\nself.params['W1'] = weight_scale * np.random.randn(input_dims, hidden_dims)\nself.params['b1'] = np.zeros((hidden_dims,))\nself.params['W2'] = weight_scale * np.random.randn(hidde...
<|body_start_0|> self.params = {} '\n 我们用标准差为weight_scale的高斯分布初始化参数W,\n 偏置B的初始化都为0:\n (其中randn函数是基于零均值和标准差的一个高斯分布)\n ' self.params['W1'] = weight_scale * np.random.randn(input_dims, hidden_dims) self.params['b1'] = np.zeros((hidden_dims,)) self.params[...
首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。
TwoLayerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNet: """首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。""" def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001): """我们把需要学习的参数(W,B)都存在s...
stack_v2_sparse_classes_75kplus_train_070427
36,287
no_license
[ { "docstring": "我们把需要学习的参数(W,B)都存在self.params字典中, 其中每个元素都是numpy array:", "name": "__init__", "signature": "def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001)" }, { "docstring": "首先,输入的数据X是一个多维的array,shape为(样本图片的个数N * 32*32*3), y是与输入数据X对应的正确标签,shape为(N...
2
stack_v2_sparse_classes_30k_test_002663
Implement the Python class `TwoLayerNet` described below. Class description: 首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。 Method signatures and docstrings: - def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100,...
Implement the Python class `TwoLayerNet` described below. Class description: 首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。 Method signatures and docstrings: - def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100,...
e82d9577d8a7f4ce9950bc7e5a950592dff34bbd
<|skeleton|> class TwoLayerNet: """首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。""" def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001): """我们把需要学习的参数(W,B)都存在s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TwoLayerNet: """首先,先初始化我们的神经网络。 毕竟,数据从输入层第一次流入到神经网络里,参数(W,B)不能为空,(w,b)是 一层的参数;(W,B)是所有层参数的统一。参数初始化也不能太大或太小,因此 (W,B)的初始化时很重要的,对整个神经网络的训练影响巨大,但如何proper 的初始化参数还没定论。""" def __init__(self, input_dims=32 * 32 * 3, hidden_dims=100, num_classes=10, weight_scale=0.001): """我们把需要学习的参数(W,B)都存在self.params字典中...
the_stack_v2_python_sparse
assigment2/full_connect.py
hduyuanfu/SHUQI_SHIYAN
train
0
4543fe908c8f40c729c61d69fbff56f825d7bfc6
[ "host = get_live_server_host()\nport = get_live_server_port()\nasync with websockets.serve(self.handler, host, port):\n await self.bus.run()", "channel_id = path.split('/')[-2]\nchannel_name = make_channel_group_name(channel_id)\nawait self.bus.subscribe(channel_name, websocket)\ntry:\n await websocket.wait...
<|body_start_0|> host = get_live_server_host() port = get_live_server_port() async with websockets.serve(self.handler, host, port): await self.bus.run() <|end_body_0|> <|body_start_1|> channel_id = path.split('/')[-2] channel_name = make_channel_group_name(channel_id...
WebsocketsPublisherApp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebsocketsPublisherApp: async def __call__(self): """Called once per session.""" <|body_0|> async def handler(self, websocket, path): """Called once per new connection. Adds/removes the websocket connection to/from the channel group corresponding to the channel id fo...
stack_v2_sparse_classes_75kplus_train_070428
1,271
permissive
[ { "docstring": "Called once per session.", "name": "__call__", "signature": "async def __call__(self)" }, { "docstring": "Called once per new connection. Adds/removes the websocket connection to/from the channel group corresponding to the channel id found in the request's path.", "name": "ha...
2
stack_v2_sparse_classes_30k_train_037475
Implement the Python class `WebsocketsPublisherApp` described below. Class description: Implement the WebsocketsPublisherApp class. Method signatures and docstrings: - async def __call__(self): Called once per session. - async def handler(self, websocket, path): Called once per new connection. Adds/removes the websoc...
Implement the Python class `WebsocketsPublisherApp` described below. Class description: Implement the WebsocketsPublisherApp class. Method signatures and docstrings: - async def __call__(self): Called once per session. - async def handler(self, websocket, path): Called once per new connection. Adds/removes the websoc...
dd769be089d457cf36db2506520028bc5f506ac3
<|skeleton|> class WebsocketsPublisherApp: async def __call__(self): """Called once per session.""" <|body_0|> async def handler(self, websocket, path): """Called once per new connection. Adds/removes the websocket connection to/from the channel group corresponding to the channel id fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WebsocketsPublisherApp: async def __call__(self): """Called once per session.""" host = get_live_server_host() port = get_live_server_port() async with websockets.serve(self.handler, host, port): await self.bus.run() async def handler(self, websocket, path): ...
the_stack_v2_python_sparse
src/wagtail_live/publishers/websockets/app.py
7saikat7/wagtail-live
train
0
0c39f494f433581204a4332e0c75c1b0d76975f7
[ "if db_field.name == 'name':\n kwargs['widget'] = VerboseNameShowTextWidget()\nreturn super(ResourceReqAdminInline, self).formfield_for_dbfield(db_field, **kwargs)", "ro_fields = super(ResourceReqAdminInline, self).get_readonly_fields(request, obj=obj)\nif 'name' in ro_fields:\n ro_fields.remove('name')\nre...
<|body_start_0|> if db_field.name == 'name': kwargs['widget'] = VerboseNameShowTextWidget() return super(ResourceReqAdminInline, self).formfield_for_dbfield(db_field, **kwargs) <|end_body_0|> <|body_start_1|> ro_fields = super(ResourceReqAdminInline, self).get_readonly_fields(reques...
ResourceReqAdminInline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceReqAdminInline: def formfield_for_dbfield(self, db_field, **kwargs): """Readonly resource name but form input still hidden""" <|body_0|> def get_readonly_fields(self, request, obj=None): """Remove 'name' from readonly fields because its value is required to c...
stack_v2_sparse_classes_75kplus_train_070429
2,533
no_license
[ { "docstring": "Readonly resource name but form input still hidden", "name": "formfield_for_dbfield", "signature": "def formfield_for_dbfield(self, db_field, **kwargs)" }, { "docstring": "Remove 'name' from readonly fields because its value is required to call properly Resource.get ResourceReqFo...
2
stack_v2_sparse_classes_30k_train_039918
Implement the Python class `ResourceReqAdminInline` described below. Class description: Implement the ResourceReqAdminInline class. Method signatures and docstrings: - def formfield_for_dbfield(self, db_field, **kwargs): Readonly resource name but form input still hidden - def get_readonly_fields(self, request, obj=N...
Implement the Python class `ResourceReqAdminInline` described below. Class description: Implement the ResourceReqAdminInline class. Method signatures and docstrings: - def formfield_for_dbfield(self, db_field, **kwargs): Readonly resource name but form input still hidden - def get_readonly_fields(self, request, obj=N...
dd798dc9bd3321b17007ff131e7b1288a2cd3c36
<|skeleton|> class ResourceReqAdminInline: def formfield_for_dbfield(self, db_field, **kwargs): """Readonly resource name but form input still hidden""" <|body_0|> def get_readonly_fields(self, request, obj=None): """Remove 'name' from readonly fields because its value is required to c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceReqAdminInline: def formfield_for_dbfield(self, db_field, **kwargs): """Readonly resource name but form input still hidden""" if db_field.name == 'name': kwargs['widget'] = VerboseNameShowTextWidget() return super(ResourceReqAdminInline, self).formfield_for_dbfield(...
the_stack_v2_python_sparse
controller/apps/resources/admin.py
m00dy/vct-controller
train
2
fde840e940baa324acb334122c1d4602dbb0bb74
[ "try:\n if dataframe is not None:\n df = dataframe\n else:\n df = self.df\n if df is None:\n self.warning('Dataframe is empty: nothing to show')\n return\n num = len(df.columns.values)\nexcept Exception as e:\n self.err(e, self.show, 'Can not show dataframe')\n return\n...
<|body_start_0|> try: if dataframe is not None: df = dataframe else: df = self.df if df is None: self.warning('Dataframe is empty: nothing to show') return num = len(df.columns.values) except ...
Class to view the data
View
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class View: """Class to view the data""" def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: """Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :para...
stack_v2_sparse_classes_75kplus_train_070430
3,823
permissive
[ { "docstring": "Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :param dataframe: pd.DataFrame, optional :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.show()``", "name": "s...
6
null
Implement the Python class `View` described below. Class description: Class to view the data Method signatures and docstrings: - def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :pa...
Implement the Python class `View` described below. Class description: Class to view the data Method signatures and docstrings: - def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :pa...
ea33a114cea6af046d50839a88ea1b2f3b8f895b
<|skeleton|> class View: """Class to view the data""" def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: """Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :para...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class View: """Class to view the data""" def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: """Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :param dataframe: ...
the_stack_v2_python_sparse
dataswim/data/views.py
synw/dataswim
train
11
15297ba52e6b0e0daecf1743890059a7c2088174
[ "assert isinstance(name, str), 'Invalid name %s' % name\nassert isinstance(description, str), 'Invalid description %s' % description\nself.name = name.strip()\nself.description = description.strip()\nself._rights = {}\nself._defaults = []", "if isinstance(names, str):\n names = (names,)\nassert isinstance(name...
<|body_start_0|> assert isinstance(name, str), 'Invalid name %s' % name assert isinstance(description, str), 'Invalid description %s' % description self.name = name.strip() self.description = description.strip() self._rights = {} self._defaults = [] <|end_body_0|> <|body...
The ACL type model.
TypeAcl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeAcl: """The ACL type model.""" def __init__(self, name, description): """Construct the type model. @param name: string The type name. @param description: string The description for the type.""" <|body_0|> def rightsFor(self, names): """Provides the rights for...
stack_v2_sparse_classes_75kplus_train_070431
5,791
no_license
[ { "docstring": "Construct the type model. @param name: string The type name. @param description: string The description for the type.", "name": "__init__", "signature": "def __init__(self, name, description)" }, { "docstring": "Provides the rights for the provided name(s). @param names: string|I...
4
stack_v2_sparse_classes_30k_val_002849
Implement the Python class `TypeAcl` described below. Class description: The ACL type model. Method signatures and docstrings: - def __init__(self, name, description): Construct the type model. @param name: string The type name. @param description: string The description for the type. - def rightsFor(self, names): Pr...
Implement the Python class `TypeAcl` described below. Class description: The ACL type model. Method signatures and docstrings: - def __init__(self, name, description): Construct the type model. @param name: string The type name. @param description: string The description for the type. - def rightsFor(self, names): Pr...
a10cb774c8cbc5010950eed9342413846734fea7
<|skeleton|> class TypeAcl: """The ACL type model.""" def __init__(self, name, description): """Construct the type model. @param name: string The type name. @param description: string The description for the type.""" <|body_0|> def rightsFor(self, names): """Provides the rights for...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TypeAcl: """The ACL type model.""" def __init__(self, name, description): """Construct the type model. @param name: string The type name. @param description: string The description for the type.""" assert isinstance(name, str), 'Invalid name %s' % name assert isinstance(descriptio...
the_stack_v2_python_sparse
plugins/support-acl/acl/spec.py
bonomali/Ally-Py
train
0
ae94392bc08cf338d3b9447e38e958d49144632e
[ "cnt = 0\nfor i in range(len(A)):\n p, q = (0, i)\n while p < len(A) and q < len(B):\n while p < len(A) and q < len(B) and (A[p] != B[q]):\n p += 1\n q += 1\n t = 0\n while p < len(A) and q < len(B) and (A[p] == B[q]):\n p += 1\n q += 1\n ...
<|body_start_0|> cnt = 0 for i in range(len(A)): p, q = (0, i) while p < len(A) and q < len(B): while p < len(A) and q < len(B) and (A[p] != B[q]): p += 1 q += 1 t = 0 while p < len(A) and q <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLength(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_0|> def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt = 0 ...
stack_v2_sparse_classes_75kplus_train_070432
1,625
no_license
[ { "docstring": ":type A: List[int] :type B: List[int] :rtype: int", "name": "findLength", "signature": "def findLength(self, A, B)" }, { "docstring": ":type A: List[int] :type B: List[int] :rtype: int", "name": "findLength1", "signature": "def findLength1(self, A, B)" } ]
2
stack_v2_sparse_classes_30k_train_038165
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLength(self, A, B): :type A: List[int] :type B: List[int] :rtype: int - def findLength1(self, A, B): :type A: List[int] :type B: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLength(self, A, B): :type A: List[int] :type B: List[int] :rtype: int - def findLength1(self, A, B): :type A: List[int] :type B: List[int] :rtype: int <|skeleton|> class...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def findLength(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_0|> def findLength1(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findLength(self, A, B): """:type A: List[int] :type B: List[int] :rtype: int""" cnt = 0 for i in range(len(A)): p, q = (0, i) while p < len(A) and q < len(B): while p < len(A) and q < len(B) and (A[p] != B[q]): p...
the_stack_v2_python_sparse
py/leetcode/718.py
wfeng1991/learnpy
train
0
9e9f4b553b7151b0c0db0cdc26ceb86dd82f278a
[ "if not root:\n return 0\n\ndef recur(node: TreeNode, min_ancestor: int, max_ancestor: int) -> int:\n max_diff = max(abs(node.val - min_ancestor), abs(node.val - max_ancestor))\n min_ancestor = min(min_ancestor, node.val)\n max_ancestor = max(max_ancestor, node.val)\n if node.left:\n max_diff ...
<|body_start_0|> if not root: return 0 def recur(node: TreeNode, min_ancestor: int, max_ancestor: int) -> int: max_diff = max(abs(node.val - min_ancestor), abs(node.val - max_ancestor)) min_ancestor = min(min_ancestor, node.val) max_ancestor = max(max_anc...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxAncestorDiff(self, root: TreeNode) -> int: """When going down the descendants: - keep the minimum value of ancestor - keep the maximum value of ancestor => Allows to do the diff When going up (end of recursion): - look at the max difference on left and right - take the m...
stack_v2_sparse_classes_75kplus_train_070433
2,439
no_license
[ { "docstring": "When going down the descendants: - keep the minimum value of ancestor - keep the maximum value of ancestor => Allows to do the diff When going up (end of recursion): - look at the max difference on left and right - take the max with own difference with above Complexity is O(N)", "name": "max...
2
stack_v2_sparse_classes_30k_train_024884
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxAncestorDiff(self, root: TreeNode) -> int: When going down the descendants: - keep the minimum value of ancestor - keep the maximum value of ancestor => Allows to do the d...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxAncestorDiff(self, root: TreeNode) -> int: When going down the descendants: - keep the minimum value of ancestor - keep the maximum value of ancestor => Allows to do the d...
3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8
<|skeleton|> class Solution: def maxAncestorDiff(self, root: TreeNode) -> int: """When going down the descendants: - keep the minimum value of ancestor - keep the maximum value of ancestor => Allows to do the diff When going up (end of recursion): - look at the max difference on left and right - take the m...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxAncestorDiff(self, root: TreeNode) -> int: """When going down the descendants: - keep the minimum value of ancestor - keep the maximum value of ancestor => Allows to do the diff When going up (end of recursion): - look at the max difference on left and right - take the max with own di...
the_stack_v2_python_sparse
binary_tree/MaxDifferenceBetweenNodeAndAncestor.py
QuentinDuval/PythonExperiments
train
3
c94385fb8c043eaf9d6c19c652fe808cad1639d0
[ "app_id, handler_name, action = (int(app_id), handler_name, action)\nhandler = None\nprint(app_id, handler_name, action)\nself._app_id = app_id\nhandlers = platform_defines.get_platform_by_id(app_id)\nif handler_name in handlers:\n handler = handlers[handler_name]()\n print(handler)\nelse:\n print('handler...
<|body_start_0|> app_id, handler_name, action = (int(app_id), handler_name, action) handler = None print(app_id, handler_name, action) self._app_id = app_id handlers = platform_defines.get_platform_by_id(app_id) if handler_name in handlers: handler = handlers[...
HandlerMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandlerMixin: def handle_request_with_process(self, app_id, handler_name, action): """处理app_id, action,寻找相对于的模块""" <|body_0|> def collect_params(self, keys): """从请求中获取参数""" <|body_1|> def on_find_handler(self, handler): """分发到各自的类中执行各自的方法""" ...
stack_v2_sparse_classes_75kplus_train_070434
2,344
no_license
[ { "docstring": "处理app_id, action,寻找相对于的模块", "name": "handle_request_with_process", "signature": "def handle_request_with_process(self, app_id, handler_name, action)" }, { "docstring": "从请求中获取参数", "name": "collect_params", "signature": "def collect_params(self, keys)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_006461
Implement the Python class `HandlerMixin` described below. Class description: Implement the HandlerMixin class. Method signatures and docstrings: - def handle_request_with_process(self, app_id, handler_name, action): 处理app_id, action,寻找相对于的模块 - def collect_params(self, keys): 从请求中获取参数 - def on_find_handler(self, hand...
Implement the Python class `HandlerMixin` described below. Class description: Implement the HandlerMixin class. Method signatures and docstrings: - def handle_request_with_process(self, app_id, handler_name, action): 处理app_id, action,寻找相对于的模块 - def collect_params(self, keys): 从请求中获取参数 - def on_find_handler(self, hand...
8b78411413aae01e7ade0eec36f37746d0e54cd4
<|skeleton|> class HandlerMixin: def handle_request_with_process(self, app_id, handler_name, action): """处理app_id, action,寻找相对于的模块""" <|body_0|> def collect_params(self, keys): """从请求中获取参数""" <|body_1|> def on_find_handler(self, handler): """分发到各自的类中执行各自的方法""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HandlerMixin: def handle_request_with_process(self, app_id, handler_name, action): """处理app_id, action,寻找相对于的模块""" app_id, handler_name, action = (int(app_id), handler_name, action) handler = None print(app_id, handler_name, action) self._app_id = app_id handler...
the_stack_v2_python_sparse
tornado_SDK/utils/handler_mixn.py
du-debug/tornado_SDK
train
0
e8716122b3b4a7e66fe8292e3cda19c83803a370
[ "tmp, ans = (x, 0)\nif x < 0:\n return False\nwhile tmp > 0:\n ans = ans * 10 + tmp % 10\n tmp = tmp // 10\nreturn True if x == ans else False", "if x < 0:\n return False\nx = str(x)\nreturn True if x == x[::-1] else False" ]
<|body_start_0|> tmp, ans = (x, 0) if x < 0: return False while tmp > 0: ans = ans * 10 + tmp % 10 tmp = tmp // 10 return True if x == ans else False <|end_body_0|> <|body_start_1|> if x < 0: return False x = str(x) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome2(self, x: int) -> bool: """time complexity : O(log10(N)) space complexity : O(1)""" <|body_0|> def isPalindrome1(self, x: int) -> bool: """time complexity :O(N) space complexity : O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_070435
689
no_license
[ { "docstring": "time complexity : O(log10(N)) space complexity : O(1)", "name": "isPalindrome2", "signature": "def isPalindrome2(self, x: int) -> bool" }, { "docstring": "time complexity :O(N) space complexity : O(1)", "name": "isPalindrome1", "signature": "def isPalindrome1(self, x: int...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome2(self, x: int) -> bool: time complexity : O(log10(N)) space complexity : O(1) - def isPalindrome1(self, x: int) -> bool: time complexity :O(N) space complexity :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome2(self, x: int) -> bool: time complexity : O(log10(N)) space complexity : O(1) - def isPalindrome1(self, x: int) -> bool: time complexity :O(N) space complexity :...
29cb49a166a1dfd19c39613a0e9895c545a6bfe9
<|skeleton|> class Solution: def isPalindrome2(self, x: int) -> bool: """time complexity : O(log10(N)) space complexity : O(1)""" <|body_0|> def isPalindrome1(self, x: int) -> bool: """time complexity :O(N) space complexity : O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome2(self, x: int) -> bool: """time complexity : O(log10(N)) space complexity : O(1)""" tmp, ans = (x, 0) if x < 0: return False while tmp > 0: ans = ans * 10 + tmp % 10 tmp = tmp // 10 return True if x == ans e...
the_stack_v2_python_sparse
08.Math/PalindromeNum.py
mjmingd/study_algorithm
train
0
2b21ef1c80899255fdce4476aa5fdea9999f2482
[ "parityBitOdd = Parity.Field('odd')\nparityBitOdd.setData(0)\nself.assertEqual(parityBitOdd.pack(), 1 << 31, 'Parity Not Calculated Properly')\nparityBitEven = Parity.Field('even')\nparityBitEven.setData(0)\nself.assertEqual(parityBitEven.pack(), 0, 'Parity Not Calculated Properly')", "parityBitOdd = Parity.Field...
<|body_start_0|> parityBitOdd = Parity.Field('odd') parityBitOdd.setData(0) self.assertEqual(parityBitOdd.pack(), 1 << 31, 'Parity Not Calculated Properly') parityBitEven = Parity.Field('even') parityBitEven.setData(0) self.assertEqual(parityBitEven.pack(), 0, 'Parity Not...
Test Parity Pack/Unpack Algorithm
testParity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class testParity: """Test Parity Pack/Unpack Algorithm""" def testEmptyMessage(self): """Verify Case of no bit set in message""" <|body_0|> def testFullMessage(self): """Verify Case of all bits set in message""" <|body_1|> def testAFewCases(self): ...
stack_v2_sparse_classes_75kplus_train_070436
5,073
permissive
[ { "docstring": "Verify Case of no bit set in message", "name": "testEmptyMessage", "signature": "def testEmptyMessage(self)" }, { "docstring": "Verify Case of all bits set in message", "name": "testFullMessage", "signature": "def testFullMessage(self)" }, { "docstring": "Further ...
5
stack_v2_sparse_classes_30k_train_050777
Implement the Python class `testParity` described below. Class description: Test Parity Pack/Unpack Algorithm Method signatures and docstrings: - def testEmptyMessage(self): Verify Case of no bit set in message - def testFullMessage(self): Verify Case of all bits set in message - def testAFewCases(self): Further test...
Implement the Python class `testParity` described below. Class description: Test Parity Pack/Unpack Algorithm Method signatures and docstrings: - def testEmptyMessage(self): Verify Case of no bit set in message - def testFullMessage(self): Verify Case of all bits set in message - def testAFewCases(self): Further test...
077c979c7eb2aae206f6052c2a67e68ecc5b35a8
<|skeleton|> class testParity: """Test Parity Pack/Unpack Algorithm""" def testEmptyMessage(self): """Verify Case of no bit set in message""" <|body_0|> def testFullMessage(self): """Verify Case of all bits set in message""" <|body_1|> def testAFewCases(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class testParity: """Test Parity Pack/Unpack Algorithm""" def testEmptyMessage(self): """Verify Case of no bit set in message""" parityBitOdd = Parity.Field('odd') parityBitOdd.setData(0) self.assertEqual(parityBitOdd.pack(), 1 << 31, 'Parity Not Calculated Properly') pa...
the_stack_v2_python_sparse
ARINC429/UnitTests/ParityTest.py
superliujian/Py429
train
1
ca30922a8c09f3288b753e6eca7bd1dea1e0f174
[ "new_contact = Contact()\nnew_contact.first_name = request.data['first_name']\nnew_contact.last_name = request.data['last_name']\nnew_contact.address = request.data['address']\nnew_contact.email = request.data['email']\nnew_contact.phone_number = request.data['phone_number']\ncustom_user = CustomUser.objects.get(us...
<|body_start_0|> new_contact = Contact() new_contact.first_name = request.data['first_name'] new_contact.last_name = request.data['last_name'] new_contact.address = request.data['address'] new_contact.email = request.data['email'] new_contact.phone_number = request.data['...
Contacts for helloDanh
Contacts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Contacts: """Contacts for helloDanh""" def create(self, request): """Handle POST operations Returns: Response -- JSON serialized Contact instance""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for single contact Returns: Response -- JS...
stack_v2_sparse_classes_75kplus_train_070437
3,739
no_license
[ { "docstring": "Handle POST operations Returns: Response -- JSON serialized Contact instance", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Handle GET requests for single contact Returns: Response -- JSON serialized contact instance", "name": "retrieve", ...
5
stack_v2_sparse_classes_30k_train_005144
Implement the Python class `Contacts` described below. Class description: Contacts for helloDanh Method signatures and docstrings: - def create(self, request): Handle POST operations Returns: Response -- JSON serialized Contact instance - def retrieve(self, request, pk=None): Handle GET requests for single contact Re...
Implement the Python class `Contacts` described below. Class description: Contacts for helloDanh Method signatures and docstrings: - def create(self, request): Handle POST operations Returns: Response -- JSON serialized Contact instance - def retrieve(self, request, pk=None): Handle GET requests for single contact Re...
678cecfa51bac3211752ef0967b7668cde4c2ab4
<|skeleton|> class Contacts: """Contacts for helloDanh""" def create(self, request): """Handle POST operations Returns: Response -- JSON serialized Contact instance""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for single contact Returns: Response -- JS...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Contacts: """Contacts for helloDanh""" def create(self, request): """Handle POST operations Returns: Response -- JSON serialized Contact instance""" new_contact = Contact() new_contact.first_name = request.data['first_name'] new_contact.last_name = request.data['last_name'...
the_stack_v2_python_sparse
helloDanhApi/views/contact.py
KrystalGates/helloDanhApi
train
0
94e5b5b259903c80ac81bb5243c42457bc6fc59e
[ "record = self.shopware_record\nfor sw_category in record['categories']:\n self._import_dependency(sw_category['id'], 'shopware.product.category')", "record = self.shopware_record\nproduct_model = 'shopware.product.product'\nsw_main_detail_id = record['mainDetail']['id']\nimport_record(self.session, product_mo...
<|body_start_0|> record = self.shopware_record for sw_category in record['categories']: self._import_dependency(sw_category['id'], 'shopware.product.category') <|end_body_0|> <|body_start_1|> record = self.shopware_record product_model = 'shopware.product.product' sw...
ArticleImporter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleImporter: def _import_dependencies(self): """Import the dependencies for the record""" <|body_0|> def _after_import(self, binding): """Hook called at the end of the import""" <|body_1|> <|end_skeleton|> <|body_start_0|> record = self.shopware...
stack_v2_sparse_classes_75kplus_train_070438
23,991
no_license
[ { "docstring": "Import the dependencies for the record", "name": "_import_dependencies", "signature": "def _import_dependencies(self)" }, { "docstring": "Hook called at the end of the import", "name": "_after_import", "signature": "def _after_import(self, binding)" } ]
2
stack_v2_sparse_classes_30k_train_051853
Implement the Python class `ArticleImporter` described below. Class description: Implement the ArticleImporter class. Method signatures and docstrings: - def _import_dependencies(self): Import the dependencies for the record - def _after_import(self, binding): Hook called at the end of the import
Implement the Python class `ArticleImporter` described below. Class description: Implement the ArticleImporter class. Method signatures and docstrings: - def _import_dependencies(self): Import the dependencies for the record - def _after_import(self, binding): Hook called at the end of the import <|skeleton|> class ...
b7463b0e3b2069a7980d1b5bc38f658fe6637f67
<|skeleton|> class ArticleImporter: def _import_dependencies(self): """Import the dependencies for the record""" <|body_0|> def _after_import(self, binding): """Hook called at the end of the import""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArticleImporter: def _import_dependencies(self): """Import the dependencies for the record""" record = self.shopware_record for sw_category in record['categories']: self._import_dependency(sw_category['id'], 'shopware.product.category') def _after_import(self, binding)...
the_stack_v2_python_sparse
shopwareerpconnect/product.py
antorajjacob/Shopware-Odoo-Connector
train
0
5782fa1e86da2e3c2f79ac7665a462530197d269
[ "if isinstance(value, int) or isinstance(value, float):\n return Sync.sync_value(value=value, device=device, op=op)\nelif isinstance(value, Tensor):\n return Sync.sync_tensor(value=value, device=device, op=op)\nelif isinstance(value, Dict):\n return Sync.sync_tensor_dict(value=value, device=device, op=op)\...
<|body_start_0|> if isinstance(value, int) or isinstance(value, float): return Sync.sync_value(value=value, device=device, op=op) elif isinstance(value, Tensor): return Sync.sync_tensor(value=value, device=device, op=op) elif isinstance(value, Dict): return Sy...
同步数据
Sync
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sync: """同步数据""" def sync(value: Union[Tensor, int, float, Dict[str, Tensor]], device: torch.device, op: ReduceOp=ReduceOp.SUM) -> Union[Tensor, int, float, Dict[str, Tensor]]: """同步数据, in place 操作 :param value: 需要同步的数据 :param device: 当前 device :param op: op :return: 同步后的数据""" ...
stack_v2_sparse_classes_75kplus_train_070439
3,778
permissive
[ { "docstring": "同步数据, in place 操作 :param value: 需要同步的数据 :param device: 当前 device :param op: op :return: 同步后的数据", "name": "sync", "signature": "def sync(value: Union[Tensor, int, float, Dict[str, Tensor]], device: torch.device, op: ReduceOp=ReduceOp.SUM) -> Union[Tensor, int, float, Dict[str, Tensor]]" ...
4
null
Implement the Python class `Sync` described below. Class description: 同步数据 Method signatures and docstrings: - def sync(value: Union[Tensor, int, float, Dict[str, Tensor]], device: torch.device, op: ReduceOp=ReduceOp.SUM) -> Union[Tensor, int, float, Dict[str, Tensor]]: 同步数据, in place 操作 :param value: 需要同步的数据 :param ...
Implement the Python class `Sync` described below. Class description: 同步数据 Method signatures and docstrings: - def sync(value: Union[Tensor, int, float, Dict[str, Tensor]], device: torch.device, op: ReduceOp=ReduceOp.SUM) -> Union[Tensor, int, float, Dict[str, Tensor]]: 同步数据, in place 操作 :param value: 需要同步的数据 :param ...
ef83261a366bd8d7c259aa112da14f3fa7cdf918
<|skeleton|> class Sync: """同步数据""" def sync(value: Union[Tensor, int, float, Dict[str, Tensor]], device: torch.device, op: ReduceOp=ReduceOp.SUM) -> Union[Tensor, int, float, Dict[str, Tensor]]: """同步数据, in place 操作 :param value: 需要同步的数据 :param device: 当前 device :param op: op :return: 同步后的数据""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sync: """同步数据""" def sync(value: Union[Tensor, int, float, Dict[str, Tensor]], device: torch.device, op: ReduceOp=ReduceOp.SUM) -> Union[Tensor, int, float, Dict[str, Tensor]]: """同步数据, in place 操作 :param value: 需要同步的数据 :param device: 当前 device :param op: op :return: 同步后的数据""" if isinstan...
the_stack_v2_python_sparse
easytext/utils/distributed/sync_util.py
freedomkite/easytext
train
0
6371c480a582a25d00d420323b00f120d925f1bc
[ "try:\n if name is None or size is None:\n raise Exception('Cannot create logical volume without specified name and size')\n if uuid_str is None:\n uuid_str = str(uuid.uuid4())\n data = {'name': name, 'uuid': uuid_str, 'size': size}\n self.logger.debug('Creating logical volume %s in VG %s ...
<|body_start_0|> try: if name is None or size is None: raise Exception('Cannot create logical volume without specified name and size') if uuid_str is None: uuid_str = str(uuid.uuid4()) data = {'name': name, 'uuid': uuid_str, 'size': size} ...
VolumeGroup
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VolumeGroup: def create_lv(self, name=None, uuid_str=None, size=None): """Create a logical volume in this volume group. :param name: Name of the logical volume :param uuid_str: A UUID4-format string specifying the LV uuid. Will be generated if left as None :param size: The size of the lo...
stack_v2_sparse_classes_75kplus_train_070440
5,626
permissive
[ { "docstring": "Create a logical volume in this volume group. :param name: Name of the logical volume :param uuid_str: A UUID4-format string specifying the LV uuid. Will be generated if left as None :param size: The size of the logical volume", "name": "create_lv", "signature": "def create_lv(self, name...
4
stack_v2_sparse_classes_30k_train_032207
Implement the Python class `VolumeGroup` described below. Class description: Implement the VolumeGroup class. Method signatures and docstrings: - def create_lv(self, name=None, uuid_str=None, size=None): Create a logical volume in this volume group. :param name: Name of the logical volume :param uuid_str: A UUID4-for...
Implement the Python class `VolumeGroup` described below. Class description: Implement the VolumeGroup class. Method signatures and docstrings: - def create_lv(self, name=None, uuid_str=None, size=None): Create a logical volume in this volume group. :param name: Name of the logical volume :param uuid_str: A UUID4-for...
f99abfa4337f8cbb591513aac404b11208d4187c
<|skeleton|> class VolumeGroup: def create_lv(self, name=None, uuid_str=None, size=None): """Create a logical volume in this volume group. :param name: Name of the logical volume :param uuid_str: A UUID4-format string specifying the LV uuid. Will be generated if left as None :param size: The size of the lo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VolumeGroup: def create_lv(self, name=None, uuid_str=None, size=None): """Create a logical volume in this volume group. :param name: Name of the logical volume :param uuid_str: A UUID4-format string specifying the LV uuid. Will be generated if left as None :param size: The size of the logical volume""...
the_stack_v2_python_sparse
python/drydock_provisioner/drivers/node/maasdriver/models/volumegroup.py
airshipit/drydock
train
13
aa431b9798c5148574f25fee0ee21204fef0165f
[ "instructions = {}\nif flatten:\n obj, unflatten_kwargs = cls._flatten_dataframe(dataframe=obj)\n instructions['unflatten_kwargs'] = unflatten_kwargs\nobj.to_html(buf=file_path, **to_kwargs)\nreturn instructions", "obj = pd.read_html(io=file_path, **read_kwargs)[0]\nif unflatten_kwargs is not None:\n if ...
<|body_start_0|> instructions = {} if flatten: obj, unflatten_kwargs = cls._flatten_dataframe(dataframe=obj) instructions['unflatten_kwargs'] = unflatten_kwargs obj.to_html(buf=file_path, **to_kwargs) return instructions <|end_body_0|> <|body_start_1|> ob...
A static class for managing pandas html files.
_HTMLFormatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _HTMLFormatter: """A static class for managing pandas html files.""" def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: """Save the given dataframe to the html file path given. :param obj: The dataframe to save. :param file_path: The file to save...
stack_v2_sparse_classes_75kplus_train_070441
35,951
permissive
[ { "docstring": "Save the given dataframe to the html file path given. :param obj: The dataframe to save. :param file_path: The file to save to. :param flatten: Whether to flatten the dataframe before saving. For some formats it is mandatory to enable flattening, otherwise saving and loading the dataframe will c...
2
stack_v2_sparse_classes_30k_train_005559
Implement the Python class `_HTMLFormatter` described below. Class description: A static class for managing pandas html files. Method signatures and docstrings: - def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: Save the given dataframe to the html file path given. :param obj: ...
Implement the Python class `_HTMLFormatter` described below. Class description: A static class for managing pandas html files. Method signatures and docstrings: - def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: Save the given dataframe to the html file path given. :param obj: ...
b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77
<|skeleton|> class _HTMLFormatter: """A static class for managing pandas html files.""" def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: """Save the given dataframe to the html file path given. :param obj: The dataframe to save. :param file_path: The file to save...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _HTMLFormatter: """A static class for managing pandas html files.""" def to(cls, obj: pd.DataFrame, file_path: str, flatten: bool=True, **to_kwargs) -> dict: """Save the given dataframe to the html file path given. :param obj: The dataframe to save. :param file_path: The file to save to. :param f...
the_stack_v2_python_sparse
mlrun/package/packagers/pandas_packagers.py
mlrun/mlrun
train
1,093
00c7c8479f5033857464096bc1842f54a7c4694b
[ "if not self.logical_drives:\n msg = 'No logical drives found on the controller %(controller)s' % {'controller': str(self.controller_id)}\n LOG.debug(msg)\n raise exception.IloLogicalDriveNotFoundError(msg)\nlds = [{'Actions': [{'Action': 'LogicalDriveDelete'}], 'VolumeUniqueIdentifier': logical_drive.volu...
<|body_start_0|> if not self.logical_drives: msg = 'No logical drives found on the controller %(controller)s' % {'controller': str(self.controller_id)} LOG.debug(msg) raise exception.IloLogicalDriveNotFoundError(msg) lds = [{'Actions': [{'Action': 'LogicalDriveDelete'...
Class that defines the functionality for SmartSorageConfig Resources.
HPESmartStorageConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HPESmartStorageConfig: """Class that defines the functionality for SmartSorageConfig Resources.""" def delete_raid(self): """Clears the RAID configuration from the system.""" <|body_0|> def create_raid(self, raid_config): """Create the raid configuration on the h...
stack_v2_sparse_classes_75kplus_train_070442
4,150
permissive
[ { "docstring": "Clears the RAID configuration from the system.", "name": "delete_raid", "signature": "def delete_raid(self)" }, { "docstring": "Create the raid configuration on the hardware. :param raid_config: A dictionary containing target raid configuration data. This data stucture should be ...
2
stack_v2_sparse_classes_30k_test_002080
Implement the Python class `HPESmartStorageConfig` described below. Class description: Class that defines the functionality for SmartSorageConfig Resources. Method signatures and docstrings: - def delete_raid(self): Clears the RAID configuration from the system. - def create_raid(self, raid_config): Create the raid c...
Implement the Python class `HPESmartStorageConfig` described below. Class description: Class that defines the functionality for SmartSorageConfig Resources. Method signatures and docstrings: - def delete_raid(self): Clears the RAID configuration from the system. - def create_raid(self, raid_config): Create the raid c...
35c711e391b839bbb93c24880e08e4ac7554dae6
<|skeleton|> class HPESmartStorageConfig: """Class that defines the functionality for SmartSorageConfig Resources.""" def delete_raid(self): """Clears the RAID configuration from the system.""" <|body_0|> def create_raid(self, raid_config): """Create the raid configuration on the h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HPESmartStorageConfig: """Class that defines the functionality for SmartSorageConfig Resources.""" def delete_raid(self): """Clears the RAID configuration from the system.""" if not self.logical_drives: msg = 'No logical drives found on the controller %(controller)s' % {'contr...
the_stack_v2_python_sparse
proliantutils/redfish/resources/system/smart_storage_config.py
anta-nok/proliantutils
train
0
0debc914d1f3b8a5aeecca1493d036788133d8df
[ "res = []\nnums.sort()\nfor i in range(len(nums) - 2):\n if i > 0 and nums[i] == nums[i - 1]:\n continue\n l, r = (i + 1, len(nums) - 1)\n while l < r:\n s = nums[i] + nums[l] + nums[r]\n if s < 0:\n l += 1\n elif s > 0:\n r -= 1\n else:\n ...
<|body_start_0|> res = [] nums.sort() for i in range(len(nums) - 2): if i > 0 and nums[i] == nums[i - 1]: continue l, r = (i + 1, len(nums) - 1) while l < r: s = nums[i] + nums[l] + nums[r] if s < 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum_myfirst(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] nu...
stack_v2_sparse_classes_75kplus_train_070443
1,959
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum_myfirst", "signature": "def threeSum_myfirst(self, nums)" } ]
2
stack_v2_sparse_classes_30k_test_001387
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum_myfirst(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum_myfirst(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solu...
f0d9070fa292ca36971a465a805faddb12025482
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum_myfirst(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" res = [] nums.sort() for i in range(len(nums) - 2): if i > 0 and nums[i] == nums[i - 1]: continue l, r = (i + 1, len(nums) - 1) while l < ...
the_stack_v2_python_sparse
15.3Sum.py
JerryRoc/leetcode
train
0
1948aad05d7e89cd1b82015c8ab045a67269b214
[ "dict = Counter(nums)\nfor key, value in dict.items():\n if value > 1:\n return key", "tortoise = nums[0]\nhare = nums[0]\nwhile True:\n tortoise = nums[tortoise]\n hare = nums[nums[hare]]\n if tortoise == hare:\n break\nptr1 = nums[0]\nptr2 = tortoise\nwhile ptr1 != ptr2:\n ptr1 = nu...
<|body_start_0|> dict = Counter(nums) for key, value in dict.items(): if value > 1: return key <|end_body_0|> <|body_start_1|> tortoise = nums[0] hare = nums[0] while True: tortoise = nums[tortoise] hare = nums[nums[hare]] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dict = Counter(nums) for key, va...
stack_v2_sparse_classes_75kplus_train_070444
1,088
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate", "signature": "def findDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findDuplicate2", "signature": "def findDuplicate2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_014328
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): :type nums: List[int] :rtype: int - def findDuplicate2(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 findDuplicate(self, nums): :type nums: List[int] :rtype: int - def findDuplicate2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def findDu...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findDuplicate2(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 findDuplicate(self, nums): """:type nums: List[int] :rtype: int""" dict = Counter(nums) for key, value in dict.items(): if value > 1: return key def findDuplicate2(self, nums): """:type nums: List[int] :rtype: int""" tortoi...
the_stack_v2_python_sparse
287. Find the Duplicate Number/duplicate.py
Macielyoung/LeetCode
train
1
ba2b7612c34aae146eb61ca807ca15fb5e52c70b
[ "self.__status = False\nrospy.Subscriber(override_topic, std_msgs.msg.Bool, callback=self.__update)\nself.__status_lock = threading.Lock()", "self.__status_lock.acquire()\nstatus_equality = self.__status == other_status\nself.__status_lock.release()\nreturn status_equality", "self.__status_lock.acquire()\nself....
<|body_start_0|> self.__status = False rospy.Subscriber(override_topic, std_msgs.msg.Bool, callback=self.__update) self.__status_lock = threading.Lock() <|end_body_0|> <|body_start_1|> self.__status_lock.acquire() status_equality = self.__status == other_status self.__st...
Automatically maintain an override status.
OverrideStatus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OverrideStatus: """Automatically maintain an override status.""" def __init__(self, override_topic): """Initialize this override status with a subscriber. This class possibly doesn't need the lock, but I left it just in case.""" <|body_0|> def __eq__(self, other_status):...
stack_v2_sparse_classes_75kplus_train_070445
3,766
no_license
[ { "docstring": "Initialize this override status with a subscriber. This class possibly doesn't need the lock, but I left it just in case.", "name": "__init__", "signature": "def __init__(self, override_topic)" }, { "docstring": "Allow easy comparisons of this override status with a boolean.", ...
3
null
Implement the Python class `OverrideStatus` described below. Class description: Automatically maintain an override status. Method signatures and docstrings: - def __init__(self, override_topic): Initialize this override status with a subscriber. This class possibly doesn't need the lock, but I left it just in case. -...
Implement the Python class `OverrideStatus` described below. Class description: Automatically maintain an override status. Method signatures and docstrings: - def __init__(self, override_topic): Initialize this override status with a subscriber. This class possibly doesn't need the lock, but I left it just in case. -...
0c5911b59dda4fa4439f6a96a66dab435436204e
<|skeleton|> class OverrideStatus: """Automatically maintain an override status.""" def __init__(self, override_topic): """Initialize this override status with a subscriber. This class possibly doesn't need the lock, but I left it just in case.""" <|body_0|> def __eq__(self, other_status):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OverrideStatus: """Automatically maintain an override status.""" def __init__(self, override_topic): """Initialize this override status with a subscriber. This class possibly doesn't need the lock, but I left it just in case.""" self.__status = False rospy.Subscriber(override_topi...
the_stack_v2_python_sparse
packages/communication/ezrassor_topic_switch/source/ezrassor_topic_switch/topic_switch.py
FlaSpaceInst/EZ-RASSOR
train
49
1045cff0cce963fa728dd835717731fa7d764b9d
[ "new_list = []\nfor i in matrix:\n for j in i:\n new_list.append(j)\nprint(new_list)\nnew_list.sort()\nreturn new_list[k - 1]", "n = len(matrix)\n\ndef check(mid):\n i, j = (n - 1, 0)\n num = 0\n while j < n and i >= 0:\n if matrix[i][j] <= mid:\n num += i + 1\n j +...
<|body_start_0|> new_list = [] for i in matrix: for j in i: new_list.append(j) print(new_list) new_list.sort() return new_list[k - 1] <|end_body_0|> <|body_start_1|> n = len(matrix) def check(mid): i, j = (n - 1, 0) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """将二维矩阵变成一维矩阵之后,从小到大排序好 取第k-1即可。 :param matrix: :param k: :return:""" <|body_0|> def kthSmallest2(self, matrix: List[List[int]], k: int) -> int: """二分法 完全利用有序矩阵的两个特性 :param matrix: :param k: :r...
stack_v2_sparse_classes_75kplus_train_070446
2,021
no_license
[ { "docstring": "将二维矩阵变成一维矩阵之后,从小到大排序好 取第k-1即可。 :param matrix: :param k: :return:", "name": "kthSmallest", "signature": "def kthSmallest(self, matrix: List[List[int]], k: int) -> int" }, { "docstring": "二分法 完全利用有序矩阵的两个特性 :param matrix: :param k: :return:", "name": "kthSmallest2", "signatu...
2
stack_v2_sparse_classes_30k_train_005047
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix: List[List[int]], k: int) -> int: 将二维矩阵变成一维矩阵之后,从小到大排序好 取第k-1即可。 :param matrix: :param k: :return: - def kthSmallest2(self, matrix: List[List[int]], ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest(self, matrix: List[List[int]], k: int) -> int: 将二维矩阵变成一维矩阵之后,从小到大排序好 取第k-1即可。 :param matrix: :param k: :return: - def kthSmallest2(self, matrix: List[List[int]], ...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """将二维矩阵变成一维矩阵之后,从小到大排序好 取第k-1即可。 :param matrix: :param k: :return:""" <|body_0|> def kthSmallest2(self, matrix: List[List[int]], k: int) -> int: """二分法 完全利用有序矩阵的两个特性 :param matrix: :param k: :r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def kthSmallest(self, matrix: List[List[int]], k: int) -> int: """将二维矩阵变成一维矩阵之后,从小到大排序好 取第k-1即可。 :param matrix: :param k: :return:""" new_list = [] for i in matrix: for j in i: new_list.append(j) print(new_list) new_list.sort() ...
the_stack_v2_python_sparse
有序矩阵中第K小的元素.py
cjrzs/MyLeetCode
train
8
07f7a01edb1cbeaf1f87abf2cef5fd1eede01a72
[ "with codecs.open(Json_File, 'r', 'utf-8-sig') as f:\n predict_data = json.load(f)\nself.Four_officials_report = predict_data['four_officials_report']\nself.action_data = predict_data['data']\nself.action_index = 0\nself.len = len(self.action_data)\nself.stack_action_index = []\nself.Team_Roster = {'Home': None,...
<|body_start_0|> with codecs.open(Json_File, 'r', 'utf-8-sig') as f: predict_data = json.load(f) self.Four_officials_report = predict_data['four_officials_report'] self.action_data = predict_data['data'] self.action_index = 0 self.len = len(self.action_data) s...
这个纠正器,用来根据四官报告来对算饭检测出来的号码进行更正。
Number_Rectifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Number_Rectifier: """这个纠正器,用来根据四官报告来对算饭检测出来的号码进行更正。""" def __init__(self, Json_File): """载入基本信息 Json_File : 算法运行完成后的写入的Json file""" <|body_0|> def generate_number_list(self, players): """生成号码列表,和球员号码字典""" <|body_1|> def rectify(self): """开始根据...
stack_v2_sparse_classes_75kplus_train_070447
5,657
permissive
[ { "docstring": "载入基本信息 Json_File : 算法运行完成后的写入的Json file", "name": "__init__", "signature": "def __init__(self, Json_File)" }, { "docstring": "生成号码列表,和球员号码字典", "name": "generate_number_list", "signature": "def generate_number_list(self, players)" }, { "docstring": "开始根据四官来纠正号码", ...
6
null
Implement the Python class `Number_Rectifier` described below. Class description: 这个纠正器,用来根据四官报告来对算饭检测出来的号码进行更正。 Method signatures and docstrings: - def __init__(self, Json_File): 载入基本信息 Json_File : 算法运行完成后的写入的Json file - def generate_number_list(self, players): 生成号码列表,和球员号码字典 - def rectify(self): 开始根据四官来纠正号码 - def n...
Implement the Python class `Number_Rectifier` described below. Class description: 这个纠正器,用来根据四官报告来对算饭检测出来的号码进行更正。 Method signatures and docstrings: - def __init__(self, Json_File): 载入基本信息 Json_File : 算法运行完成后的写入的Json file - def generate_number_list(self, players): 生成号码列表,和球员号码字典 - def rectify(self): 开始根据四官来纠正号码 - def n...
c496e911a89870a9b6988d93f80e680d01ee8afc
<|skeleton|> class Number_Rectifier: """这个纠正器,用来根据四官报告来对算饭检测出来的号码进行更正。""" def __init__(self, Json_File): """载入基本信息 Json_File : 算法运行完成后的写入的Json file""" <|body_0|> def generate_number_list(self, players): """生成号码列表,和球员号码字典""" <|body_1|> def rectify(self): """开始根据...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Number_Rectifier: """这个纠正器,用来根据四官报告来对算饭检测出来的号码进行更正。""" def __init__(self, Json_File): """载入基本信息 Json_File : 算法运行完成后的写入的Json file""" with codecs.open(Json_File, 'r', 'utf-8-sig') as f: predict_data = json.load(f) self.Four_officials_report = predict_data['four_officials...
the_stack_v2_python_sparse
utils_BINGO/Number_Rectifier.py
IMBINGO95/FairMOT
train
0
399be71da9d7bff67258e5c72d0c686168a5ba73
[ "self.count = 0\nself.batch = batch\nself.atomistic = atomistic", "if not self.batch and (not self.atomistic):\n self._add_sample(sample_value)\nelif not self.batch and self.atomistic:\n n_atoms = sample_value.size(0)\n for i in range(n_atoms):\n self._add_sample(sample_value[i, :])\nelif self.bat...
<|body_start_0|> self.count = 0 self.batch = batch self.atomistic = atomistic <|end_body_0|> <|body_start_1|> if not self.batch and (not self.atomistic): self._add_sample(sample_value) elif not self.batch and self.atomistic: n_atoms = sample_value.size(0)...
StatisticsAccumulator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatisticsAccumulator: def __init__(self, batch=False, atomistic=False): """Use the incremental Welford algorithm described in [1]_ to accumulate the mean and standard deviation over a set of samples. Args: batch: If set to true, assumes sample is batch and uses leading dimension as batc...
stack_v2_sparse_classes_75kplus_train_070448
22,927
permissive
[ { "docstring": "Use the incremental Welford algorithm described in [1]_ to accumulate the mean and standard deviation over a set of samples. Args: batch: If set to true, assumes sample is batch and uses leading dimension as batch size atomistic: If set to true, average over atom dimension References: ----------...
4
null
Implement the Python class `StatisticsAccumulator` described below. Class description: Implement the StatisticsAccumulator class. Method signatures and docstrings: - def __init__(self, batch=False, atomistic=False): Use the incremental Welford algorithm described in [1]_ to accumulate the mean and standard deviation ...
Implement the Python class `StatisticsAccumulator` described below. Class description: Implement the StatisticsAccumulator class. Method signatures and docstrings: - def __init__(self, batch=False, atomistic=False): Use the incremental Welford algorithm described in [1]_ to accumulate the mean and standard deviation ...
9ca068d1f43ee4aff5bc2b6b0d5714c3ac484470
<|skeleton|> class StatisticsAccumulator: def __init__(self, batch=False, atomistic=False): """Use the incremental Welford algorithm described in [1]_ to accumulate the mean and standard deviation over a set of samples. Args: batch: If set to true, assumes sample is batch and uses leading dimension as batc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StatisticsAccumulator: def __init__(self, batch=False, atomistic=False): """Use the incremental Welford algorithm described in [1]_ to accumulate the mean and standard deviation over a set of samples. Args: batch: If set to true, assumes sample is batch and uses leading dimension as batch size atomist...
the_stack_v2_python_sparse
custom/datasqlite.py
MichaelSluydts/schnetpack
train
0
11b9c027c8420358bcd243fbcd4663e49156abdd
[ "super().__init__(dev_id)\nself._attr_device_class = device_class\nself.which = -1\nself.onoff = -1\nself._attr_unique_id = f'{combine_hex(dev_id)}-{device_class}'\nself._attr_name = dev_name", "pushed = None\nif packet.data[6] == 48:\n pushed = 1\nelif packet.data[6] == 32:\n pushed = 0\nself.schedule_upda...
<|body_start_0|> super().__init__(dev_id) self._attr_device_class = device_class self.which = -1 self.onoff = -1 self._attr_unique_id = f'{combine_hex(dev_id)}-{device_class}' self._attr_name = dev_name <|end_body_0|> <|body_start_1|> pushed = None if pac...
Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): - F6-02-01 (Light and Blind Control - Application Style 2) - F6-02-02 (Light and Blind Control - Application Style 1)
EnOceanBinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnOceanBinarySensor: """Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): - F6-02-01 (Light and Blind Control - Application Style 2) - F6-02-02 (Light and Blind Control - Application Style 1)""" def __init__(self, dev_id: list[int], ...
stack_v2_sparse_classes_75kplus_train_070449
3,643
permissive
[ { "docstring": "Initialize the EnOcean binary sensor.", "name": "__init__", "signature": "def __init__(self, dev_id: list[int], dev_name: str, device_class: BinarySensorDeviceClass | None) -> None" }, { "docstring": "Fire an event with the data that have changed. This method is called when there...
2
stack_v2_sparse_classes_30k_train_051662
Implement the Python class `EnOceanBinarySensor` described below. Class description: Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): - F6-02-01 (Light and Blind Control - Application Style 2) - F6-02-02 (Light and Blind Control - Application Style 1) Method...
Implement the Python class `EnOceanBinarySensor` described below. Class description: Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): - F6-02-01 (Light and Blind Control - Application Style 2) - F6-02-02 (Light and Blind Control - Application Style 1) Method...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EnOceanBinarySensor: """Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): - F6-02-01 (Light and Blind Control - Application Style 2) - F6-02-02 (Light and Blind Control - Application Style 1)""" def __init__(self, dev_id: list[int], ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnOceanBinarySensor: """Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): - F6-02-01 (Light and Blind Control - Application Style 2) - F6-02-02 (Light and Blind Control - Application Style 1)""" def __init__(self, dev_id: list[int], dev_name: str...
the_stack_v2_python_sparse
homeassistant/components/enocean/binary_sensor.py
home-assistant/core
train
35,501
695330fe4c0bdacde5878f17c044e709e0aa0276
[ "self._update_interval = update_interval\nself._fps = 0\nself._tick_count = 0\nself._last_time_updated = time.time()", "self._tick_count += 1\ncurrent_time = time.time()\nif current_time - self._last_time_updated > self._update_interval:\n self._fps = int(round(self._tick_count / (current_time - self._last_tim...
<|body_start_0|> self._update_interval = update_interval self._fps = 0 self._tick_count = 0 self._last_time_updated = time.time() <|end_body_0|> <|body_start_1|> self._tick_count += 1 current_time = time.time() if current_time - self._last_time_updated > self._up...
The counter for calculating the FPS Invoke `get_FPS()` at each frame. The counter will count how many calls within a specified updating interval. Within a updating interval, the returned FPS value won't be updated until the starting of next updating interval.
FPSCounter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FPSCounter: """The counter for calculating the FPS Invoke `get_FPS()` at each frame. The counter will count how many calls within a specified updating interval. Within a updating interval, the returned FPS value won't be updated until the starting of next updating interval.""" def __init__(s...
stack_v2_sparse_classes_75kplus_train_070450
2,603
no_license
[ { "docstring": "Constructor @param update_interval The time interval in seconds for updating the FPS value", "name": "__init__", "signature": "def __init__(self, update_interval=1.0)" }, { "docstring": "Update and get the calculated FPS", "name": "get_FPS", "signature": "def get_FPS(self...
2
stack_v2_sparse_classes_30k_train_041012
Implement the Python class `FPSCounter` described below. Class description: The counter for calculating the FPS Invoke `get_FPS()` at each frame. The counter will count how many calls within a specified updating interval. Within a updating interval, the returned FPS value won't be updated until the starting of next up...
Implement the Python class `FPSCounter` described below. Class description: The counter for calculating the FPS Invoke `get_FPS()` at each frame. The counter will count how many calls within a specified updating interval. Within a updating interval, the returned FPS value won't be updated until the starting of next up...
f82cd74cdb711dcb4710a4fdf25dfc52666f4898
<|skeleton|> class FPSCounter: """The counter for calculating the FPS Invoke `get_FPS()` at each frame. The counter will count how many calls within a specified updating interval. Within a updating interval, the returned FPS value won't be updated until the starting of next updating interval.""" def __init__(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FPSCounter: """The counter for calculating the FPS Invoke `get_FPS()` at each frame. The counter will count how many calls within a specified updating interval. Within a updating interval, the returned FPS value won't be updated until the starting of next updating interval.""" def __init__(self, update_i...
the_stack_v2_python_sparse
mlgame/gamedev/generic.py
leooel97895750/Python_Game_ML
train
1
58f1d956630e8d14dcec3fb01728b365981353dd
[ "if dialect.name == 'postgresql':\n return dialect.type_descriptor(UUID())\nelse:\n return dialect.type_descriptor(CHAR(32))", "if value is None:\n return value\nelif dialect.name == 'postgresql':\n return str(value)\nelif not isinstance(value, uuid.UUID):\n return '{0:.32x}'.format(uuid.UUID(value...
<|body_start_0|> if dialect.name == 'postgresql': return dialect.type_descriptor(UUID()) else: return dialect.type_descriptor(CHAR(32)) <|end_body_0|> <|body_start_1|> if value is None: return value elif dialect.name == 'postgresql': retur...
Platform-independent GUID type. Uses Postgresql's UUID type, otherwise uses CHAR(32), storing as stringified hex values. Taken from http://docs.sqlalchemy.org/en/latest/core/custom_types.html ?highlight=guid#backend-agnostic-guid-type Does not work if you simply do the following: id = Column(UUID(as_uuid=True), primary...
GUID
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUID: """Platform-independent GUID type. Uses Postgresql's UUID type, otherwise uses CHAR(32), storing as stringified hex values. Taken from http://docs.sqlalchemy.org/en/latest/core/custom_types.html ?highlight=guid#backend-agnostic-guid-type Does not work if you simply do the following: id = Co...
stack_v2_sparse_classes_75kplus_train_070451
8,387
permissive
[ { "docstring": "Load the native type for the database type being used :param dialect: database type being used :return: native type of the database", "name": "load_dialect_impl", "signature": "def load_dialect_impl(dialect)" }, { "docstring": "Format the value for insertion in to the database :p...
4
null
Implement the Python class `GUID` described below. Class description: Platform-independent GUID type. Uses Postgresql's UUID type, otherwise uses CHAR(32), storing as stringified hex values. Taken from http://docs.sqlalchemy.org/en/latest/core/custom_types.html ?highlight=guid#backend-agnostic-guid-type Does not work ...
Implement the Python class `GUID` described below. Class description: Platform-independent GUID type. Uses Postgresql's UUID type, otherwise uses CHAR(32), storing as stringified hex values. Taken from http://docs.sqlalchemy.org/en/latest/core/custom_types.html ?highlight=guid#backend-agnostic-guid-type Does not work ...
c49134e6e2edee39bebe4a08b6b0f9b83c309588
<|skeleton|> class GUID: """Platform-independent GUID type. Uses Postgresql's UUID type, otherwise uses CHAR(32), storing as stringified hex values. Taken from http://docs.sqlalchemy.org/en/latest/core/custom_types.html ?highlight=guid#backend-agnostic-guid-type Does not work if you simply do the following: id = Co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GUID: """Platform-independent GUID type. Uses Postgresql's UUID type, otherwise uses CHAR(32), storing as stringified hex values. Taken from http://docs.sqlalchemy.org/en/latest/core/custom_types.html ?highlight=guid#backend-agnostic-guid-type Does not work if you simply do the following: id = Column(UUID(as_...
the_stack_v2_python_sparse
biblib/models.py
adsabs/biblib-service
train
5
e41e961429193a8788cb53e87991122266fbaf9b
[ "super(HeaderUnit, self).__init__(**kwargs)\nself._unit_type = HeaderUnit.UNIT_TYPE\nself._unit_category = HeaderUnit.UNIT_CATEGORY\nself._name = 'header'\nself.head_data = {'name': HeadDataItem('', '', 0, 0, dtype=dt.STRING), 'revision': HeadDataItem('#REVISION#1', '{:>10}', 1, 0, dtype=dt.STRING), 'node_count': H...
<|body_start_0|> super(HeaderUnit, self).__init__(**kwargs) self._unit_type = HeaderUnit.UNIT_TYPE self._unit_category = HeaderUnit.UNIT_CATEGORY self._name = 'header' self.head_data = {'name': HeadDataItem('', '', 0, 0, dtype=dt.STRING), 'revision': HeadDataItem('#REVISION#1', '...
This class deals with the data file values at the top of the file. These contain the global variables for the model such as water temperature, key matrix coefficients and the total number of nodes. There is only ever one of these units in every dat file - at the very top - so it seems convenient to put it in this modul...
HeaderUnit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeaderUnit: """This class deals with the data file values at the top of the file. These contain the global variables for the model such as water temperature, key matrix coefficients and the total number of nodes. There is only ever one of these units in every dat file - at the very top - so it se...
stack_v2_sparse_classes_75kplus_train_070452
23,622
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Reads the given data into the object. Args: unit_data (list): The raw file data to be processed.", "name": "readUnitData", "signature": "def readUnitData(self, unit_data, fil...
3
null
Implement the Python class `HeaderUnit` described below. Class description: This class deals with the data file values at the top of the file. These contain the global variables for the model such as water temperature, key matrix coefficients and the total number of nodes. There is only ever one of these units in ever...
Implement the Python class `HeaderUnit` described below. Class description: This class deals with the data file values at the top of the file. These contain the global variables for the model such as water temperature, key matrix coefficients and the total number of nodes. There is only ever one of these units in ever...
e8e7249a511d52b29d34be0951d6a05f346b836c
<|skeleton|> class HeaderUnit: """This class deals with the data file values at the top of the file. These contain the global variables for the model such as water temperature, key matrix coefficients and the total number of nodes. There is only ever one of these units in every dat file - at the very top - so it se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HeaderUnit: """This class deals with the data file values at the top of the file. These contain the global variables for the model such as water temperature, key matrix coefficients and the total number of nodes. There is only ever one of these units in every dat file - at the very top - so it seems convenien...
the_stack_v2_python_sparse
ship/fmp/datunits/isisunit.py
duncan-r/SHIP
train
6
d723c19cae370055641529ebaeaa219f49371327
[ "if self.cluster_id is None:\n raise SkipTest('The cluster_id is not specified, can not run ostf')\nself.fuel_web.run_ostf(cluster_id=self.cluster_id, should_fail=getattr(self, 'ostf_tests_should_failed', 0), failed_test_name=getattr(self, 'failed_test_name', None))", "if self.cluster_id is None:\n raise Sk...
<|body_start_0|> if self.cluster_id is None: raise SkipTest('The cluster_id is not specified, can not run ostf') self.fuel_web.run_ostf(cluster_id=self.cluster_id, should_fail=getattr(self, 'ostf_tests_should_failed', 0), failed_test_name=getattr(self, 'failed_test_name', None)) <|end_body_0...
Basic actions for OSTF tests health_check - run sanity and smoke OSTF tests health_check_sanity_smoke_ha - run sanity, smoke and ha OSTF tests health_check_ha - run ha OSTF tests
HealthCheckActions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthCheckActions: """Basic actions for OSTF tests health_check - run sanity and smoke OSTF tests health_check_sanity_smoke_ha - run sanity, smoke and ha OSTF tests health_check_ha - run ha OSTF tests""" def health_check(self): """Run health checker Skip action if cluster doesn't ex...
stack_v2_sparse_classes_75kplus_train_070453
3,407
no_license
[ { "docstring": "Run health checker Skip action if cluster doesn't exist", "name": "health_check", "signature": "def health_check(self)" }, { "docstring": "Run health checker Sanity, Smoke and HA Skip action if cluster doesn't exist", "name": "health_check_sanity_smoke_ha", "signature": "...
4
stack_v2_sparse_classes_30k_train_053066
Implement the Python class `HealthCheckActions` described below. Class description: Basic actions for OSTF tests health_check - run sanity and smoke OSTF tests health_check_sanity_smoke_ha - run sanity, smoke and ha OSTF tests health_check_ha - run ha OSTF tests Method signatures and docstrings: - def health_check(se...
Implement the Python class `HealthCheckActions` described below. Class description: Basic actions for OSTF tests health_check - run sanity and smoke OSTF tests health_check_sanity_smoke_ha - run sanity, smoke and ha OSTF tests health_check_ha - run ha OSTF tests Method signatures and docstrings: - def health_check(se...
e825c2f0483ab2030ddc47c8a2bdc85a80e5da02
<|skeleton|> class HealthCheckActions: """Basic actions for OSTF tests health_check - run sanity and smoke OSTF tests health_check_sanity_smoke_ha - run sanity, smoke and ha OSTF tests health_check_ha - run ha OSTF tests""" def health_check(self): """Run health checker Skip action if cluster doesn't ex...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HealthCheckActions: """Basic actions for OSTF tests health_check - run sanity and smoke OSTF tests health_check_sanity_smoke_ha - run sanity, smoke and ha OSTF tests health_check_ha - run ha OSTF tests""" def health_check(self): """Run health checker Skip action if cluster doesn't exist""" ...
the_stack_v2_python_sparse
system_test/actions/ostf_actions.py
rkhozinov/fuel-qa
train
1
cf20cee78c5ead87ddbd400a598df5ff96dcde24
[ "sample_atom = atoms[-1]\nself.atoms = []\nself.name = sample_atom.res_name\nself.chain_id = sample_atom.chain_id\nself.res_seq = sample_atom.res_seq\nself.ins_code = sample_atom.ins_code\nself.fixed = 0\nself.ffname = 'WAT'\nself.map = {}\nself.reference = ref\nself.is_n_term = 0\nself.is_c_term = 0\nfor atom_ in ...
<|body_start_0|> sample_atom = atoms[-1] self.atoms = [] self.name = sample_atom.res_name self.chain_id = sample_atom.chain_id self.res_seq = sample_atom.res_seq self.ins_code = sample_atom.ins_code self.fixed = 0 self.ffname = 'WAT' self.map = {} ...
Generic ligand class.
LIG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LIG: """Generic ligand class.""" def __init__(self, atoms, ref): """Initialize this object. .. todo:: why is the force field name "WAT" for this? :param atoms: A list of :class:`Atom` objects to be stored in this object :type atoms: [Atom] :param ref: The reference object for the res...
stack_v2_sparse_classes_75kplus_train_070454
32,726
no_license
[ { "docstring": "Initialize this object. .. todo:: why is the force field name \"WAT\" for this? :param atoms: A list of :class:`Atom` objects to be stored in this object :type atoms: [Atom] :param ref: The reference object for the residue. Used to convert from the alternate naming scheme to the main naming sche...
3
stack_v2_sparse_classes_30k_val_001276
Implement the Python class `LIG` described below. Class description: Generic ligand class. Method signatures and docstrings: - def __init__(self, atoms, ref): Initialize this object. .. todo:: why is the force field name "WAT" for this? :param atoms: A list of :class:`Atom` objects to be stored in this object :type a...
Implement the Python class `LIG` described below. Class description: Generic ligand class. Method signatures and docstrings: - def __init__(self, atoms, ref): Initialize this object. .. todo:: why is the force field name "WAT" for this? :param atoms: A list of :class:`Atom` objects to be stored in this object :type a...
53cbe6d320048508710b3bad8581b69d3a358ab9
<|skeleton|> class LIG: """Generic ligand class.""" def __init__(self, atoms, ref): """Initialize this object. .. todo:: why is the force field name "WAT" for this? :param atoms: A list of :class:`Atom` objects to be stored in this object :type atoms: [Atom] :param ref: The reference object for the res...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LIG: """Generic ligand class.""" def __init__(self, atoms, ref): """Initialize this object. .. todo:: why is the force field name "WAT" for this? :param atoms: A list of :class:`Atom` objects to be stored in this object :type atoms: [Atom] :param ref: The reference object for the residue. Used to...
the_stack_v2_python_sparse
pdb2pqr/aa.py
rkretsch/pdb2pqr
train
0
a65f02194031714c7b4552ed9b80c6a8a925e451
[ "client_info = self.get_client_info()\ntheir_signature = self.request.headers.get('DCI-Auth-Signature')\nidentity = self.get_identity(client_info['type'], client_info['id'])\nif identity is None:\n raise dci_exc.DCIException('Client %(type)s/%(id)s does not exist' % client_info, status_code=401)\nself.identity =...
<|body_start_0|> client_info = self.get_client_info() their_signature = self.request.headers.get('DCI-Auth-Signature') identity = self.get_identity(client_info['type'], client_info['id']) if identity is None: raise dci_exc.DCIException('Client %(type)s/%(id)s does not exist' ...
SignatureAuthMechanism
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignatureAuthMechanism: def authenticate(self): """Tries to authenticate a request using a signature as authentication mechanism. Sets self.identity to the authenticated entity for later use.""" <|body_0|> def get_identity(self, client_type, client_id): """Get an ide...
stack_v2_sparse_classes_75kplus_train_070455
12,001
permissive
[ { "docstring": "Tries to authenticate a request using a signature as authentication mechanism. Sets self.identity to the authenticated entity for later use.", "name": "authenticate", "signature": "def authenticate(self)" }, { "docstring": "Get an identity including its API secret", "name": "...
4
stack_v2_sparse_classes_30k_train_032346
Implement the Python class `SignatureAuthMechanism` described below. Class description: Implement the SignatureAuthMechanism class. Method signatures and docstrings: - def authenticate(self): Tries to authenticate a request using a signature as authentication mechanism. Sets self.identity to the authenticated entity ...
Implement the Python class `SignatureAuthMechanism` described below. Class description: Implement the SignatureAuthMechanism class. Method signatures and docstrings: - def authenticate(self): Tries to authenticate a request using a signature as authentication mechanism. Sets self.identity to the authenticated entity ...
016592c133d12f6a980a335112eca13a07a0f273
<|skeleton|> class SignatureAuthMechanism: def authenticate(self): """Tries to authenticate a request using a signature as authentication mechanism. Sets self.identity to the authenticated entity for later use.""" <|body_0|> def get_identity(self, client_type, client_id): """Get an ide...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignatureAuthMechanism: def authenticate(self): """Tries to authenticate a request using a signature as authentication mechanism. Sets self.identity to the authenticated entity for later use.""" client_info = self.get_client_info() their_signature = self.request.headers.get('DCI-Auth-S...
the_stack_v2_python_sparse
dci/auth_mechanism.py
AlexxNica/dci-control-server
train
0
083cfb130feea19f4fc5372c8aa2a79f8b4507b1
[ "super(SecureResource, self).__init__()\nself.__session = session\nself.__auth = AWS4Auth(self.__session.credentials.key_id, self.__session.credentials.secret_key, ApiConfig.aws_region(), ApiConfig.aws_api_gw_service_name(), session_token=self.__session.credentials.session_token)", "url = self._build_url('secure'...
<|body_start_0|> super(SecureResource, self).__init__() self.__session = session self.__auth = AWS4Auth(self.__session.credentials.key_id, self.__session.credentials.secret_key, ApiConfig.aws_region(), ApiConfig.aws_api_gw_service_name(), session_token=self.__session.credentials.session_token) <...
SecureResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecureResource: def __init__(self, session): """:param session: chikyu_sdk.resource.session.Session""" <|body_0|> def invoke(self, path, data): """:param path: APIのパス :param data: APIに渡すデータ(リクエストのプロパティである「data」に入るもの) :rtype: dict :return:""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_070456
1,518
no_license
[ { "docstring": ":param session: chikyu_sdk.resource.session.Session", "name": "__init__", "signature": "def __init__(self, session)" }, { "docstring": ":param path: APIのパス :param data: APIに渡すデータ(リクエストのプロパティである「data」に入るもの) :rtype: dict :return:", "name": "invoke", "signature": "def invoke...
2
stack_v2_sparse_classes_30k_test_002165
Implement the Python class `SecureResource` described below. Class description: Implement the SecureResource class. Method signatures and docstrings: - def __init__(self, session): :param session: chikyu_sdk.resource.session.Session - def invoke(self, path, data): :param path: APIのパス :param data: APIに渡すデータ(リクエストのプロパテ...
Implement the Python class `SecureResource` described below. Class description: Implement the SecureResource class. Method signatures and docstrings: - def __init__(self, session): :param session: chikyu_sdk.resource.session.Session - def invoke(self, path, data): :param path: APIのパス :param data: APIに渡すデータ(リクエストのプロパテ...
03c0724d7dc31dae85a1d10472cafd83efbcc46b
<|skeleton|> class SecureResource: def __init__(self, session): """:param session: chikyu_sdk.resource.session.Session""" <|body_0|> def invoke(self, path, data): """:param path: APIのパス :param data: APIに渡すデータ(リクエストのプロパティである「data」に入るもの) :rtype: dict :return:""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SecureResource: def __init__(self, session): """:param session: chikyu_sdk.resource.session.Session""" super(SecureResource, self).__init__() self.__session = session self.__auth = AWS4Auth(self.__session.credentials.key_id, self.__session.credentials.secret_key, ApiConfig.aws_...
the_stack_v2_python_sparse
src/chikyu_sdk/secure_resource.py
chikyuinc/chikyu-sdk-python
train
0
57079aded9db70048585b9f3b509c2f89e3e9e11
[ "send_url = self.get_peizhi_(name='shiming', yaml_ming='yilou_fangdong.yaml')\nsend_url = send_url['bindIdentity']\nlogging.info('url is %s' % send_url)\nsend_dict = {'realName': realName, 'idCard': idCard}\nresponse = self.request_post(base_url=send_url, dict_data=send_dict)\nreturn response", "send_url = self.g...
<|body_start_0|> send_url = self.get_peizhi_(name='shiming', yaml_ming='yilou_fangdong.yaml') send_url = send_url['bindIdentity'] logging.info('url is %s' % send_url) send_dict = {'realName': realName, 'idCard': idCard} response = self.request_post(base_url=send_url, dict_data=se...
ShiMing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShiMing: def bindIdentity(self, realName, idCard): """提交实名认证 :return:""" <|body_0|> def getSupportBankList(self): """#86、获取支持银行列表 :return:""" <|body_1|> def getCardBin(self, bankCardNo): """#87、获取银行卡开户行 :return:""" <|body_2|> def rea...
stack_v2_sparse_classes_75kplus_train_070457
2,689
no_license
[ { "docstring": "提交实名认证 :return:", "name": "bindIdentity", "signature": "def bindIdentity(self, realName, idCard)" }, { "docstring": "#86、获取支持银行列表 :return:", "name": "getSupportBankList", "signature": "def getSupportBankList(self)" }, { "docstring": "#87、获取银行卡开户行 :return:", "n...
4
stack_v2_sparse_classes_30k_train_042584
Implement the Python class `ShiMing` described below. Class description: Implement the ShiMing class. Method signatures and docstrings: - def bindIdentity(self, realName, idCard): 提交实名认证 :return: - def getSupportBankList(self): #86、获取支持银行列表 :return: - def getCardBin(self, bankCardNo): #87、获取银行卡开户行 :return: - def real...
Implement the Python class `ShiMing` described below. Class description: Implement the ShiMing class. Method signatures and docstrings: - def bindIdentity(self, realName, idCard): 提交实名认证 :return: - def getSupportBankList(self): #86、获取支持银行列表 :return: - def getCardBin(self, bankCardNo): #87、获取银行卡开户行 :return: - def real...
e173d4e535ac22b72b67371b8a2524ee425cdcbf
<|skeleton|> class ShiMing: def bindIdentity(self, realName, idCard): """提交实名认证 :return:""" <|body_0|> def getSupportBankList(self): """#86、获取支持银行列表 :return:""" <|body_1|> def getCardBin(self, bankCardNo): """#87、获取银行卡开户行 :return:""" <|body_2|> def rea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShiMing: def bindIdentity(self, realName, idCard): """提交实名认证 :return:""" send_url = self.get_peizhi_(name='shiming', yaml_ming='yilou_fangdong.yaml') send_url = send_url['bindIdentity'] logging.info('url is %s' % send_url) send_dict = {'realName': realName, 'idCard': id...
the_stack_v2_python_sparse
public/aYiLou_fangdong/yilou_fangdong_business/yilou_fangdong_shiMing.py
GSIL-Monitor/mrbao_python
train
0
d9f9b43c28929b8edbeb869a00ce48acfd26d4be
[ "p = pHead\nwhile p:\n pClone = RandomListNode(p.label)\n pClone.next = p.next\n pClone.random = None\n p.next = pClone\n p = pClone.next\npHead = self.ConnectRandomNodes(pHead)\npHead = self.ReconnectNodes(pHead)\nreturn pHead", "p = pHead\nwhile p:\n pClone = p.next\n if p.random != None:\n...
<|body_start_0|> p = pHead while p: pClone = RandomListNode(p.label) pClone.next = p.next pClone.random = None p.next = pClone p = pClone.next pHead = self.ConnectRandomNodes(pHead) pHead = self.ReconnectNodes(pHead) ret...
复制复杂链表
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """复制复杂链表""" def Clone(self, pHead): """复制原始链表,(p1,p2,p3)->(p1,p11,p2,p22,p3,p33)""" <|body_0|> def ConnectRandomNodes(self, pHead): """连接含random的节点,如果原始链表中的N的random指向S,则对应的复制节点N'对应S'""" <|body_1|> def ReconnectNodes(self, pHead): "...
stack_v2_sparse_classes_75kplus_train_070458
3,242
no_license
[ { "docstring": "复制原始链表,(p1,p2,p3)->(p1,p11,p2,p22,p3,p33)", "name": "Clone", "signature": "def Clone(self, pHead)" }, { "docstring": "连接含random的节点,如果原始链表中的N的random指向S,则对应的复制节点N'对应S'", "name": "ConnectRandomNodes", "signature": "def ConnectRandomNodes(self, pHead)" }, { "docstring...
3
null
Implement the Python class `Solution` described below. Class description: 复制复杂链表 Method signatures and docstrings: - def Clone(self, pHead): 复制原始链表,(p1,p2,p3)->(p1,p11,p2,p22,p3,p33) - def ConnectRandomNodes(self, pHead): 连接含random的节点,如果原始链表中的N的random指向S,则对应的复制节点N'对应S' - def ReconnectNodes(self, pHead): 将链表拆分为两个链表,奇数...
Implement the Python class `Solution` described below. Class description: 复制复杂链表 Method signatures and docstrings: - def Clone(self, pHead): 复制原始链表,(p1,p2,p3)->(p1,p11,p2,p22,p3,p33) - def ConnectRandomNodes(self, pHead): 连接含random的节点,如果原始链表中的N的random指向S,则对应的复制节点N'对应S' - def ReconnectNodes(self, pHead): 将链表拆分为两个链表,奇数...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class Solution: """复制复杂链表""" def Clone(self, pHead): """复制原始链表,(p1,p2,p3)->(p1,p11,p2,p22,p3,p33)""" <|body_0|> def ConnectRandomNodes(self, pHead): """连接含random的节点,如果原始链表中的N的random指向S,则对应的复制节点N'对应S'""" <|body_1|> def ReconnectNodes(self, pHead): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """复制复杂链表""" def Clone(self, pHead): """复制原始链表,(p1,p2,p3)->(p1,p11,p2,p22,p3,p33)""" p = pHead while p: pClone = RandomListNode(p.label) pClone.next = p.next pClone.random = None p.next = pClone p = pClone.next ...
the_stack_v2_python_sparse
剑指offer/25.复杂链表的复制.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
df5be540ac69cca4a7b4617e13b9ae3d3c9a4950
[ "if show_columns is not None:\n self.all_extra_data_columns = show_columns['extra_data']\nelse:\n self.all_extra_data_columns = all_extra_data_columns\nsuper().__init__(instance=instance, data=data, **kwargs)\nif show_columns is not None:\n for field_name in set(self.fields) - set(show_columns['fields']):\...
<|body_start_0|> if show_columns is not None: self.all_extra_data_columns = show_columns['extra_data'] else: self.all_extra_data_columns = all_extra_data_columns super().__init__(instance=instance, data=data, **kwargs) if show_columns is not None: for ...
PropertyStateSerializer
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertyStateSerializer: def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): """If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of...
stack_v2_sparse_classes_75kplus_train_070459
26,431
permissive
[ { "docstring": "If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of all_extra_data_columns. :param instance: instance to serialize :param data: initial data :param all_extra_data_columns: :param show_columns:...
2
stack_v2_sparse_classes_30k_val_002813
Implement the Python class `PropertyStateSerializer` described below. Class description: Implement the PropertyStateSerializer class. Method signatures and docstrings: - def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): If show_columns is passed, then all_extra_d...
Implement the Python class `PropertyStateSerializer` described below. Class description: Implement the PropertyStateSerializer class. Method signatures and docstrings: - def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): If show_columns is passed, then all_extra_d...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class PropertyStateSerializer: def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): """If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PropertyStateSerializer: def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): """If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of all_extra_dat...
the_stack_v2_python_sparse
seed/serializers/properties.py
SEED-platform/seed
train
108
742da9a67f06192b7f0716ea788b6498591a8de7
[ "B = A[::-1]\nfor i in range(1, len(A)):\n A[i] *= A[i - 1] or 1\n B[i] *= B[i - 1] or 1\nreturn max(A + B)", "dp = [None] * len(nums)\ndp[0] = nums[0]\nfor i in range(1, len(nums)):\n dp[i] = max(dp[i - 1] + nums[i], nums[i])\nprint(dp)\nreturn max(dp)", "dp = nums.copy()\nfor i in range(2, len(nums))...
<|body_start_0|> B = A[::-1] for i in range(1, len(A)): A[i] *= A[i - 1] or 1 B[i] *= B[i - 1] or 1 return max(A + B) <|end_body_0|> <|body_start_1|> dp = [None] * len(nums) dp[0] = nums[0] for i in range(1, len(nums)): dp[i] = max(dp[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, A): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_070460
1,014
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct", "signature": "def maxProduct(self, A)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtyp...
3
stack_v2_sparse_classes_30k_train_023209
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, A): :type nums: List[int] :rtype: int - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def rob(self, nums): :type nums: List[int] :rtype: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, A): :type nums: List[int] :rtype: int - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def rob(self, nums): :type nums: List[int] :rtype: i...
7bcba42556475f56fad995b97a37b98f4981da8c
<|skeleton|> class Solution: def maxProduct(self, A): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProduct(self, A): """:type nums: List[int] :rtype: int""" B = A[::-1] for i in range(1, len(A)): A[i] *= A[i - 1] or 1 B[i] *= B[i - 1] or 1 return max(A + B) def maxSubArray(self, nums): """:type nums: List[int] :rtype: int...
the_stack_v2_python_sparse
Problems/152. Maximum Product Subarray.py
chendingyan/My-Leetcode
train
0
e12e303c35c0b77f3ad47300404d5b7acb48b5da
[ "time = timezone.now() + datetime.timedelta(days=30)\nfuture_question = Question(pub_date=time)\nself.assertEqual(future_question.was_published_recently(), False)", "time = timezone.now() - datetime.timedelta(days=30)\nold_question = Question(pub_date=time)\nself.assertEqual(old_question.was_published_recently(),...
<|body_start_0|> time = timezone.now() + datetime.timedelta(days=30) future_question = Question(pub_date=time) self.assertEqual(future_question.was_published_recently(), False) <|end_body_0|> <|body_start_1|> time = timezone.now() - datetime.timedelta(days=30) old_question = Que...
QuestionModelTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionModelTests: def test_was_published_recently_with_future_question(self): """Should return False for Questions published in the future.""" <|body_0|> def test_was_published_recently_with_old_question(self): """Should return False for questions whose published d...
stack_v2_sparse_classes_75kplus_train_070461
16,730
no_license
[ { "docstring": "Should return False for Questions published in the future.", "name": "test_was_published_recently_with_future_question", "signature": "def test_was_published_recently_with_future_question(self)" }, { "docstring": "Should return False for questions whose published date is older th...
3
stack_v2_sparse_classes_30k_train_008668
Implement the Python class `QuestionModelTests` described below. Class description: Implement the QuestionModelTests class. Method signatures and docstrings: - def test_was_published_recently_with_future_question(self): Should return False for Questions published in the future. - def test_was_published_recently_with_...
Implement the Python class `QuestionModelTests` described below. Class description: Implement the QuestionModelTests class. Method signatures and docstrings: - def test_was_published_recently_with_future_question(self): Should return False for Questions published in the future. - def test_was_published_recently_with_...
0adc16d8f291e7c670eb56c612597c30d0bdbd95
<|skeleton|> class QuestionModelTests: def test_was_published_recently_with_future_question(self): """Should return False for Questions published in the future.""" <|body_0|> def test_was_published_recently_with_old_question(self): """Should return False for questions whose published d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuestionModelTests: def test_was_published_recently_with_future_question(self): """Should return False for Questions published in the future.""" time = timezone.now() + datetime.timedelta(days=30) future_question = Question(pub_date=time) self.assertEqual(future_question.was_pu...
the_stack_v2_python_sparse
polls/tests.py
ajmejia/LearningDjango
train
0
50d04a0f29f71b60bdc83d787514d08152365234
[ "user = kwargs.get('user')\napp = kwargs.get('application')\nmessages = SentItem.get(user_id=user.id, application_id=app.id if app else None)\nreturn response(messages)", "user = kwargs.get('user')\napp = kwargs.get('application')\nSentItem.remove(uuid=sentitem, user_id=user.id, application_id=app.id if app else ...
<|body_start_0|> user = kwargs.get('user') app = kwargs.get('application') messages = SentItem.get(user_id=user.id, application_id=app.id if app else None) return response(messages) <|end_body_0|> <|body_start_1|> user = kwargs.get('user') app = kwargs.get('application')...
Sent endpoints
SentResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentResource: """Sent endpoints""" def index(self, **kwargs): """Returning list of sent items""" <|body_0|> def delete(self, sentitem, **kwargs): """Delete sent message""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = kwargs.get('user') ...
stack_v2_sparse_classes_75kplus_train_070462
1,591
permissive
[ { "docstring": "Returning list of sent items", "name": "index", "signature": "def index(self, **kwargs)" }, { "docstring": "Delete sent message", "name": "delete", "signature": "def delete(self, sentitem, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_026812
Implement the Python class `SentResource` described below. Class description: Sent endpoints Method signatures and docstrings: - def index(self, **kwargs): Returning list of sent items - def delete(self, sentitem, **kwargs): Delete sent message
Implement the Python class `SentResource` described below. Class description: Sent endpoints Method signatures and docstrings: - def index(self, **kwargs): Returning list of sent items - def delete(self, sentitem, **kwargs): Delete sent message <|skeleton|> class SentResource: """Sent endpoints""" def index...
37a3be814fc32ad87eb2a0ecfd93aa46ef46e68d
<|skeleton|> class SentResource: """Sent endpoints""" def index(self, **kwargs): """Returning list of sent items""" <|body_0|> def delete(self, sentitem, **kwargs): """Delete sent message""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentResource: """Sent endpoints""" def index(self, **kwargs): """Returning list of sent items""" user = kwargs.get('user') app = kwargs.get('application') messages = SentItem.get(user_id=user.id, application_id=app.id if app else None) return response(messages) ...
the_stack_v2_python_sparse
smsgw/resources/sent/api.py
jajonsraviation/smsgw
train
0
0ca44ce02b0706ccdc523abe6eb0cef31a720582
[ "first = second = third = float('-inf')\nfor n in nums:\n if n > first:\n first, second, third = (n, first, third)\n elif first > n > second:\n second, third = (n, second)\n elif second > n > third:\n third = n\n print(first, second, third)\nreturn third if third > float('-inf') els...
<|body_start_0|> first = second = third = float('-inf') for n in nums: if n > first: first, second, third = (n, first, third) elif first > n > second: second, third = (n, second) elif second > n > third: third = n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def thirdMax(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def thirdMax_refer(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> first = second = third = float('-inf') ...
stack_v2_sparse_classes_75kplus_train_070463
1,879
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "thirdMax", "signature": "def thirdMax(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "thirdMax_refer", "signature": "def thirdMax_refer(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_026585
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax(self, nums): :type nums: List[int] :rtype: int - def thirdMax_refer(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax(self, nums): :type nums: List[int] :rtype: int - def thirdMax_refer(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def thirdMax(se...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def thirdMax(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def thirdMax_refer(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 thirdMax(self, nums): """:type nums: List[int] :rtype: int""" first = second = third = float('-inf') for n in nums: if n > first: first, second, third = (n, first, third) elif first > n > second: second, third = (n, ...
the_stack_v2_python_sparse
414_thirdMax.py
jennyChing/leetCode
train
2
793dc852a1128d3a11be4b305f63a7e7d303057b
[ "self.summary_file = []\nself.path_params = []\nif release in ['DR17', 'MPL-11']:\n files = ['GZD_auto', 'gzUKIDSS', 'gz']\n version_DR17 = {'GZD_auto': 'v1_0_1', 'gzUKIDSS': 'v1_0_1', 'gz': 'v2_0_1'}\n for file in files:\n params = {'file': file, 'ver': version_DR17[file]}\n self.path_params...
<|body_start_0|> self.summary_file = [] self.path_params = [] if release in ['DR17', 'MPL-11']: files = ['GZD_auto', 'gzUKIDSS', 'gz'] version_DR17 = {'GZD_auto': 'v1_0_1', 'gzUKIDSS': 'v1_0_1', 'gz': 'v2_0_1'} for file in files: params = {'fil...
Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (GZ) data for SDSS galaxies has bee...
GZVAC
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GZVAC: """Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (G...
stack_v2_sparse_classes_75kplus_train_070464
5,257
permissive
[ { "docstring": "Sets the path to the GalaxyZoo summary file. Sets the paths to the GalaxyZoom summary file(s). For DR15 this is a single summary file, while for DR17, this has been split into three files, so ``self.summary_file`` and ``self.path_params`` return lists for DR17.", "name": "set_summary_file", ...
2
stack_v2_sparse_classes_30k_train_029170
Implement the Python class `GZVAC` described below. Class description: Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morpholog...
Implement the Python class `GZVAC` described below. Class description: Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morpholog...
db4c536a65fb2f16fee05a4f34996a7fd35f0527
<|skeleton|> class GZVAC: """Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (G...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GZVAC: """Provides access to the MaNGA Galaxy Zoo Morphology VAC. VAC name: MaNGA Morphologies from Galaxy Zoo URL: https://www.sdss.org/dr17/data_access/value-added-catalogs/?vac_id=manga-morphologies-from-galaxy-zoo Description Returns Galaxy Zoo morphology for MaNGA galaxies. The Galaxy Zoo (GZ) data for S...
the_stack_v2_python_sparse
python/marvin/contrib/vacs/galaxyzoo.py
sdss/marvin
train
56
c4398c7da68c924363f44d82aac41e541b90f522
[ "if 'xml' not in self.mimetype:\n raise AttributeError('Not a XML response (Content-Type: %s)' % self.mimetype)\nfor module in ['xml.etree.ElementTree', 'ElementTree', 'elementtree.ElementTree']:\n etree = import_string(module, silent=True)\n if etree is not None:\n return etree.XML(self.body)\nrais...
<|body_start_0|> if 'xml' not in self.mimetype: raise AttributeError('Not a XML response (Content-Type: %s)' % self.mimetype) for module in ['xml.etree.ElementTree', 'ElementTree', 'elementtree.ElementTree']: etree = import_string(module, silent=True) if etree is not ...
A mixin class for response objects that provides a couple of useful accessors for unittesting.
ContentAccessors
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentAccessors: """A mixin class for response objects that provides a couple of useful accessors for unittesting.""" def xml(self): """Get an etree if possible.""" <|body_0|> def lxml(self): """Get an lxml etree if possible.""" <|body_1|> def json(...
stack_v2_sparse_classes_75kplus_train_070465
2,453
permissive
[ { "docstring": "Get an etree if possible.", "name": "xml", "signature": "def xml(self)" }, { "docstring": "Get an lxml etree if possible.", "name": "lxml", "signature": "def lxml(self)" }, { "docstring": "Get the result of simplejson.loads if possible.", "name": "json", "...
3
stack_v2_sparse_classes_30k_train_054138
Implement the Python class `ContentAccessors` described below. Class description: A mixin class for response objects that provides a couple of useful accessors for unittesting. Method signatures and docstrings: - def xml(self): Get an etree if possible. - def lxml(self): Get an lxml etree if possible. - def json(self...
Implement the Python class `ContentAccessors` described below. Class description: A mixin class for response objects that provides a couple of useful accessors for unittesting. Method signatures and docstrings: - def xml(self): Get an etree if possible. - def lxml(self): Get an lxml etree if possible. - def json(self...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class ContentAccessors: """A mixin class for response objects that provides a couple of useful accessors for unittesting.""" def xml(self): """Get an etree if possible.""" <|body_0|> def lxml(self): """Get an lxml etree if possible.""" <|body_1|> def json(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContentAccessors: """A mixin class for response objects that provides a couple of useful accessors for unittesting.""" def xml(self): """Get an etree if possible.""" if 'xml' not in self.mimetype: raise AttributeError('Not a XML response (Content-Type: %s)' % self.mimetype) ...
the_stack_v2_python_sparse
Keras_tensorflow_nightly/source2.7/werkzeug/contrib/testtools.py
ryfeus/lambda-packs
train
1,283
62da06083352717cd06395d00985dd6dcf9b2836
[ "pg.ModellingBase.__init__(self, verbose)\nself.nlay_ = nlay\nself.FOP_ = pg.FDEM1dModelling(nlay + 1, frequencies, coilspacing, 0.0)\nself.mesh_ = pg.createMesh1D(nlay, 2)\nself.mesh_.cell(0).setMarker(2)\nself.setMesh(self.mesh_)", "thk = model(0, self.nlay)\nres = model(self.nlay - 1, self.nlay * 2)\nres[0] = ...
<|body_start_0|> pg.ModellingBase.__init__(self, verbose) self.nlay_ = nlay self.FOP_ = pg.FDEM1dModelling(nlay + 1, frequencies, coilspacing, 0.0) self.mesh_ = pg.createMesh1D(nlay, 2) self.mesh_.cell(0).setMarker(2) self.setMesh(self.mesh_) <|end_body_0|> <|body_start_...
Airborne FDEM modelling including variable bird height.
HEM1dWithElevation
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HEM1dWithElevation: """Airborne FDEM modelling including variable bird height.""" def __init__(self, frequencies, coilspacing, nlay=2, verbose=False): """Set up class by frequencies and geometries.""" <|body_0|> def response(self, model): """Return forward respon...
stack_v2_sparse_classes_75kplus_train_070466
27,181
permissive
[ { "docstring": "Set up class by frequencies and geometries.", "name": "__init__", "signature": "def __init__(self, frequencies, coilspacing, nlay=2, verbose=False)" }, { "docstring": "Return forward response for a given model.", "name": "response", "signature": "def response(self, model)...
2
stack_v2_sparse_classes_30k_train_035370
Implement the Python class `HEM1dWithElevation` described below. Class description: Airborne FDEM modelling including variable bird height. Method signatures and docstrings: - def __init__(self, frequencies, coilspacing, nlay=2, verbose=False): Set up class by frequencies and geometries. - def response(self, model): ...
Implement the Python class `HEM1dWithElevation` described below. Class description: Airborne FDEM modelling including variable bird height. Method signatures and docstrings: - def __init__(self, frequencies, coilspacing, nlay=2, verbose=False): Set up class by frequencies and geometries. - def response(self, model): ...
9962fe882fad284e52858ba3aa5e87b2395d791d
<|skeleton|> class HEM1dWithElevation: """Airborne FDEM modelling including variable bird height.""" def __init__(self, frequencies, coilspacing, nlay=2, verbose=False): """Set up class by frequencies and geometries.""" <|body_0|> def response(self, model): """Return forward respon...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HEM1dWithElevation: """Airborne FDEM modelling including variable bird height.""" def __init__(self, frequencies, coilspacing, nlay=2, verbose=False): """Set up class by frequencies and geometries.""" pg.ModellingBase.__init__(self, verbose) self.nlay_ = nlay self.FOP_ = p...
the_stack_v2_python_sparse
python/pygimli/physics/em/fdem.py
Geophysics-OpenSource/gimli
train
0
494a8e60f5b213a8ce84e74bafcc9fa45ac16fd8
[ "self.x = x\nself.y = y\nself.width = width\nself.height = height", "dx = x - self.x\ndy = y - self.y\nreturn 0 <= dx < self.width and 0 <= dy < self.height" ]
<|body_start_0|> self.x = x self.y = y self.width = width self.height = height <|end_body_0|> <|body_start_1|> dx = x - self.x dy = y - self.y return 0 <= dx < self.width and 0 <= dy < self.height <|end_body_1|>
Represents a single task as a rectangular region.
Task
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Task: """Represents a single task as a rectangular region.""" def __init__(self, x, y, width, height): """Initializes the task. :param x: the x coordinate of the top left corner of the goal region :param y: the y coordinate of the top left corner of the goal region :param width: the ...
stack_v2_sparse_classes_75kplus_train_070467
5,418
no_license
[ { "docstring": "Initializes the task. :param x: the x coordinate of the top left corner of the goal region :param y: the y coordinate of the top left corner of the goal region :param width: the width of the goal region :param height: the height of the goal region", "name": "__init__", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_001967
Implement the Python class `Task` described below. Class description: Represents a single task as a rectangular region. Method signatures and docstrings: - def __init__(self, x, y, width, height): Initializes the task. :param x: the x coordinate of the top left corner of the goal region :param y: the y coordinate of ...
Implement the Python class `Task` described below. Class description: Represents a single task as a rectangular region. Method signatures and docstrings: - def __init__(self, x, y, width, height): Initializes the task. :param x: the x coordinate of the top left corner of the goal region :param y: the y coordinate of ...
381c019a3c930d943672a65ae651e5a4f52686f8
<|skeleton|> class Task: """Represents a single task as a rectangular region.""" def __init__(self, x, y, width, height): """Initializes the task. :param x: the x coordinate of the top left corner of the goal region :param y: the y coordinate of the top left corner of the goal region :param width: the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Task: """Represents a single task as a rectangular region.""" def __init__(self, x, y, width, height): """Initializes the task. :param x: the x coordinate of the top left corner of the goal region :param y: the y coordinate of the top left corner of the goal region :param width: the width of the ...
the_stack_v2_python_sparse
domains/navigation/environment.py
rtloftin/HAL
train
0
9ba46b93a94feb252896217120877ff6eb7a2bd1
[ "try:\n book = BookInfo.objects.get(pk=pk)\nexcept BookInfo.DoesNotExist:\n return HttpResponse(status=404)\nreturn JsonResponse({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comment': book.comment, 'image': book.image.url if book.image else ''})", "try:\n book = Boo...
<|body_start_0|> try: book = BookInfo.objects.get(pk=pk) except BookInfo.DoesNotExist: return HttpResponse(status=404) return JsonResponse({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comment': book.comment, 'image': book.image.url i...
BookAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/""" <|body_0|> def put(self, request, pk): """修改图书信息 路由: PUT /books/<pk>""" <|body_1|> def delete(self, request, pk): """删除图书 路由: DELETE /books/<pk>/""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_070468
5,895
no_license
[ { "docstring": "获取单个图书信息 路由: GET /books/<pk>/", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "修改图书信息 路由: PUT /books/<pk>", "name": "put", "signature": "def put(self, request, pk)" }, { "docstring": "删除图书 路由: DELETE /books/<pk>/", "name": "delete"...
3
stack_v2_sparse_classes_30k_train_053554
Implement the Python class `BookAPIView` described below. Class description: Implement the BookAPIView class. Method signatures and docstrings: - def get(self, request, pk): 获取单个图书信息 路由: GET /books/<pk>/ - def put(self, request, pk): 修改图书信息 路由: PUT /books/<pk> - def delete(self, request, pk): 删除图书 路由: DELETE /books/<...
Implement the Python class `BookAPIView` described below. Class description: Implement the BookAPIView class. Method signatures and docstrings: - def get(self, request, pk): 获取单个图书信息 路由: GET /books/<pk>/ - def put(self, request, pk): 修改图书信息 路由: PUT /books/<pk> - def delete(self, request, pk): 删除图书 路由: DELETE /books/<...
0f123a99856238af5f1aab0b555f6501e635fc52
<|skeleton|> class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/""" <|body_0|> def put(self, request, pk): """修改图书信息 路由: PUT /books/<pk>""" <|body_1|> def delete(self, request, pk): """删除图书 路由: DELETE /books/<pk>/""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/""" try: book = BookInfo.objects.get(pk=pk) except BookInfo.DoesNotExist: return HttpResponse(status=404) return JsonResponse({'id': book.id, 'title': book.title, 'pub_date': book.p...
the_stack_v2_python_sparse
DRF_Tutorial/app/views.py
YDongY/PythonCode
train
1
e28391d7c4b82a0a3918dd79eef43426b5a34cf0
[ "layers = [state_dim + action_dim] + hidden_layers + [state_dim]\nsuper(EnvironmentModel, self).__init__(layers, activations)\nself.predicts_delta = predicts_delta\nself.probabilistic = False", "input = torch.cat((state, action), dim=-1)\noutput = self.forward(input)\nif self.predicts_delta:\n output = state +...
<|body_start_0|> layers = [state_dim + action_dim] + hidden_layers + [state_dim] super(EnvironmentModel, self).__init__(layers, activations) self.predicts_delta = predicts_delta self.probabilistic = False <|end_body_0|> <|body_start_1|> input = torch.cat((state, action), dim=-1)...
EnvironmentModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvironmentModel: def __init__(self, state_dim, action_dim, hidden_layers, activations, batch_norm=True, predicts_delta=True): """A neural network parameterized to model an OpenAI Gym environments state transition. :param state_dim: dimension of the environments state space :param action...
stack_v2_sparse_classes_75kplus_train_070469
21,063
no_license
[ { "docstring": "A neural network parameterized to model an OpenAI Gym environments state transition. :param state_dim: dimension of the environments state space :param action_dim: dimension of the environments action space :param hidden_layers: hidden_layers is a list defining the number of hidden nodes per lay...
2
null
Implement the Python class `EnvironmentModel` described below. Class description: Implement the EnvironmentModel class. Method signatures and docstrings: - def __init__(self, state_dim, action_dim, hidden_layers, activations, batch_norm=True, predicts_delta=True): A neural network parameterized to model an OpenAI Gym...
Implement the Python class `EnvironmentModel` described below. Class description: Implement the EnvironmentModel class. Method signatures and docstrings: - def __init__(self, state_dim, action_dim, hidden_layers, activations, batch_norm=True, predicts_delta=True): A neural network parameterized to model an OpenAI Gym...
ceeb196bde01592f9ec15f9e24d008a9395c65ea
<|skeleton|> class EnvironmentModel: def __init__(self, state_dim, action_dim, hidden_layers, activations, batch_norm=True, predicts_delta=True): """A neural network parameterized to model an OpenAI Gym environments state transition. :param state_dim: dimension of the environments state space :param action...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnvironmentModel: def __init__(self, state_dim, action_dim, hidden_layers, activations, batch_norm=True, predicts_delta=True): """A neural network parameterized to model an OpenAI Gym environments state transition. :param state_dim: dimension of the environments state space :param action_dim: dimensio...
the_stack_v2_python_sparse
src/algorithm/MPC/model.py
al91liwo/pytorch-rl-lab
train
3
2b1c7d624611b984a54b48cd73df8f6a47828819
[ "self.source_plate = source_plate\nself.s_cells = source_cells\nself.d_cells = dest_cells\nself.dilution_factor = dilution_factor\nself.mapping = {}\nself._populate_mapping()", "s_shape, s_width, s_height = self.s_cells.shape()\nd_shape, d_width, d_height = self.d_cells.shape()\nif s_shape == RowColIntersections....
<|body_start_0|> self.source_plate = source_plate self.s_cells = source_cells self.d_cells = dest_cells self.dilution_factor = dilution_factor self.mapping = {} self._populate_mapping() <|end_body_0|> <|body_start_1|> s_shape, s_width, s_height = self.s_cells.sha...
A transfer rule specifies rows and columns on an upstream *source* plate, and on a downstream *destination* plate. It refers to these rows and columns by holding a RowColIntersection object for the source and for the destination respectively. It also holds a dilution factor for the transfer. The shape made by the rows ...
TransferRule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransferRule: """A transfer rule specifies rows and columns on an upstream *source* plate, and on a downstream *destination* plate. It refers to these rows and columns by holding a RowColIntersection object for the source and for the destination respectively. It also holds a dilution factor for t...
stack_v2_sparse_classes_75kplus_train_070470
6,521
permissive
[ { "docstring": "Provide the source and destination cells using one RowColIntersections object respectively. The constructor will raise an IncompatibleTransferError when the combination is incompatible.", "name": "__init__", "signature": "def __init__(self, source_plate, source_cells, dest_cells, dilutio...
6
stack_v2_sparse_classes_30k_train_029658
Implement the Python class `TransferRule` described below. Class description: A transfer rule specifies rows and columns on an upstream *source* plate, and on a downstream *destination* plate. It refers to these rows and columns by holding a RowColIntersection object for the source and for the destination respectively...
Implement the Python class `TransferRule` described below. Class description: A transfer rule specifies rows and columns on an upstream *source* plate, and on a downstream *destination* plate. It refers to these rows and columns by holding a RowColIntersection object for the source and for the destination respectively...
b67f65694fe058dbdb7001f7b30f3cdbc08c686f
<|skeleton|> class TransferRule: """A transfer rule specifies rows and columns on an upstream *source* plate, and on a downstream *destination* plate. It refers to these rows and columns by holding a RowColIntersection object for the source and for the destination respectively. It also holds a dilution factor for t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransferRule: """A transfer rule specifies rows and columns on an upstream *source* plate, and on a downstream *destination* plate. It refers to these rows and columns by holding a RowColIntersection object for the source and for the destination respectively. It also holds a dilution factor for the transfer. ...
the_stack_v2_python_sparse
app/rules_engine/transfer_rule.py
pete-dnae/assay-screening-proj
train
1
865a4ed482eecfb7ccb3f284f7e6bd97bc2a6972
[ "super().__init__()\nself.requires_grad = False\nself._r = 2", "batch, in_channel, in_height, in_width = x.size()\nout_channel, out_height, out_width = (int(in_channel / self._r ** 2), self._r * in_height, self._r * in_width)\nx1 = x[:, 0:out_channel, :, :] / 2\nx2 = x[:, out_channel:out_channel * 2, :, :] / 2\nx...
<|body_start_0|> super().__init__() self.requires_grad = False self._r = 2 <|end_body_0|> <|body_start_1|> batch, in_channel, in_height, in_width = x.size() out_channel, out_height, out_width = (int(in_channel / self._r ** 2), self._r * in_height, self._r * in_width) x1 ...
2D Inverse Wavelet Transform as implemented in [1]_. References ---------- .. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.
IWT
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IWT: """2D Inverse Wavelet Transform as implemented in [1]_. References ---------- .. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.""" def __init__(self): """Inits :class:`IWT`."""...
stack_v2_sparse_classes_75kplus_train_070471
14,137
permissive
[ { "docstring": "Inits :class:`IWT`.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Computes IWT(`x`) given tensor `x`. Parameters ---------- x: torch.Tensor Input tensor. Returns ------- h: torch.Tensor IWT of `x`.", "name": "forward", "signature": "def forwar...
2
stack_v2_sparse_classes_30k_train_025330
Implement the Python class `IWT` described below. Class description: 2D Inverse Wavelet Transform as implemented in [1]_. References ---------- .. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071. Method signatures and...
Implement the Python class `IWT` described below. Class description: 2D Inverse Wavelet Transform as implemented in [1]_. References ---------- .. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071. Method signatures and...
2a4c29342bc52a404aae097bc2654fb4323e1ac8
<|skeleton|> class IWT: """2D Inverse Wavelet Transform as implemented in [1]_. References ---------- .. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.""" def __init__(self): """Inits :class:`IWT`."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IWT: """2D Inverse Wavelet Transform as implemented in [1]_. References ---------- .. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018. arXiv.org, http://arxiv.org/abs/1805.07071.""" def __init__(self): """Inits :class:`IWT`.""" supe...
the_stack_v2_python_sparse
direct/nn/mwcnn/mwcnn.py
NKI-AI/direct
train
151
e6dd2414161976f95ad77ee4c69f0414e8c0c3f1
[ "iterable = [1, 2, 3, 4, 5]\nfirst_matching = first_matching_item(iterable, lambda item: item == 1)\nsecond_matching = first_matching_item(iterable, lambda item: item == 5)\nthird_matching = first_matching_item(iterable, lambda item: item == 10)\nassert first_matching == 1\nassert second_matching == 5\nassert third...
<|body_start_0|> iterable = [1, 2, 3, 4, 5] first_matching = first_matching_item(iterable, lambda item: item == 1) second_matching = first_matching_item(iterable, lambda item: item == 5) third_matching = first_matching_item(iterable, lambda item: item == 10) assert first_matching...
Tests for assorted utility functions
UtilTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilTests: """Tests for assorted utility functions""" def test_first_matching_item(self): """Tests that first_matching_item returns a matching item in an iterable, or None""" <|body_0|> def test_is_subset_dict(self): """Tests that is_subset_dict properly determin...
stack_v2_sparse_classes_75kplus_train_070472
7,529
no_license
[ { "docstring": "Tests that first_matching_item returns a matching item in an iterable, or None", "name": "test_first_matching_item", "signature": "def test_first_matching_item(self)" }, { "docstring": "Tests that is_subset_dict properly determines whether or not a dict is a subset of another dic...
3
stack_v2_sparse_classes_30k_train_021467
Implement the Python class `UtilTests` described below. Class description: Tests for assorted utility functions Method signatures and docstrings: - def test_first_matching_item(self): Tests that first_matching_item returns a matching item in an iterable, or None - def test_is_subset_dict(self): Tests that is_subset_d...
Implement the Python class `UtilTests` described below. Class description: Tests for assorted utility functions Method signatures and docstrings: - def test_first_matching_item(self): Tests that first_matching_item returns a matching item in an iterable, or None - def test_is_subset_dict(self): Tests that is_subset_d...
3c166bc52dfe8d7aa04f922134f4f6deeff49eb6
<|skeleton|> class UtilTests: """Tests for assorted utility functions""" def test_first_matching_item(self): """Tests that first_matching_item returns a matching item in an iterable, or None""" <|body_0|> def test_is_subset_dict(self): """Tests that is_subset_dict properly determin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UtilTests: """Tests for assorted utility functions""" def test_first_matching_item(self): """Tests that first_matching_item returns a matching item in an iterable, or None""" iterable = [1, 2, 3, 4, 5] first_matching = first_matching_item(iterable, lambda item: item == 1) ...
the_stack_v2_python_sparse
micromasters/utils_test.py
avontd2868/micromasters
train
0
d1f3e56e7a29765d6b4e6079e9b5d7e2df4555de
[ "try:\n self.send(self.get_collection_endpoint(), http_method='POST', **client_params)\nexcept Exception as e:\n raise CartoException(e)", "if self.get_resource_endpoint() is None:\n raise CartoException('Async job needs to be run or retrieved first!')\nsuper(AsyncResourc...
<|body_start_0|> try: self.send(self.get_collection_endpoint(), http_method='POST', **client_params) except Exception as e: raise CartoException(e) <|end_body_0|> <|body_start_1|> if self.get_resource_endpoint() is None: raise CartoException('Async job needs ...
AsyncResource
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncResource: def run(self, **client_params): """Actually creates the async job on the CARTO server :param client_params: To be send to the CARTO API. See CARTO's documentation depending on the subclass you are using :type client_params: kwargs :return: :raise: CartoException""" ...
stack_v2_sparse_classes_75kplus_train_070473
3,366
permissive
[ { "docstring": "Actually creates the async job on the CARTO server :param client_params: To be send to the CARTO API. See CARTO's documentation depending on the subclass you are using :type client_params: kwargs :return: :raise: CartoException", "name": "run", "signature": "def run(self, **client_params...
2
stack_v2_sparse_classes_30k_train_018024
Implement the Python class `AsyncResource` described below. Class description: Implement the AsyncResource class. Method signatures and docstrings: - def run(self, **client_params): Actually creates the async job on the CARTO server :param client_params: To be send to the CARTO API. See CARTO's documentation dependin...
Implement the Python class `AsyncResource` described below. Class description: Implement the AsyncResource class. Method signatures and docstrings: - def run(self, **client_params): Actually creates the async job on the CARTO server :param client_params: To be send to the CARTO API. See CARTO's documentation dependin...
631b018f065960baa35473e2087ce598560b9e17
<|skeleton|> class AsyncResource: def run(self, **client_params): """Actually creates the async job on the CARTO server :param client_params: To be send to the CARTO API. See CARTO's documentation depending on the subclass you are using :type client_params: kwargs :return: :raise: CartoException""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AsyncResource: def run(self, **client_params): """Actually creates the async job on the CARTO server :param client_params: To be send to the CARTO API. See CARTO's documentation depending on the subclass you are using :type client_params: kwargs :return: :raise: CartoException""" try: ...
the_stack_v2_python_sparse
carto/resources.py
danicarrion/carto-python
train
0
c913584b014d9d0fbe036dd30c3411fb96501422
[ "anagrams_list = defaultdict(list)\nfor string in strings:\n count = [0] * 26\n for char in string:\n count[ord(char) - ord('a')] += 1\n anagrams_list[tuple(count)].append(string)\nreturn anagrams_list.values()", "anagrams_list = defaultdict(list)\nfor string in strings:\n anagrams_list[tuple(s...
<|body_start_0|> anagrams_list = defaultdict(list) for string in strings: count = [0] * 26 for char in string: count[ord(char) - ord('a')] += 1 anagrams_list[tuple(count)].append(string) return anagrams_list.values() <|end_body_0|> <|body_star...
Anagrams
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Anagrams: def group_(self, strings: List[str]) -> List[List[str]]: """Approach: Categorize by Count. N - length of strings. K - max length of strings. Time Complexity: O(NK) Space Complexity: :param strings: :return:""" <|body_0|> def group(self, strings: List[str]) -> List[...
stack_v2_sparse_classes_75kplus_train_070474
1,320
no_license
[ { "docstring": "Approach: Categorize by Count. N - length of strings. K - max length of strings. Time Complexity: O(NK) Space Complexity: :param strings: :return:", "name": "group_", "signature": "def group_(self, strings: List[str]) -> List[List[str]]" }, { "docstring": "Approach: Categorize by...
2
null
Implement the Python class `Anagrams` described below. Class description: Implement the Anagrams class. Method signatures and docstrings: - def group_(self, strings: List[str]) -> List[List[str]]: Approach: Categorize by Count. N - length of strings. K - max length of strings. Time Complexity: O(NK) Space Complexity:...
Implement the Python class `Anagrams` described below. Class description: Implement the Anagrams class. Method signatures and docstrings: - def group_(self, strings: List[str]) -> List[List[str]]: Approach: Categorize by Count. N - length of strings. K - max length of strings. Time Complexity: O(NK) Space Complexity:...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Anagrams: def group_(self, strings: List[str]) -> List[List[str]]: """Approach: Categorize by Count. N - length of strings. K - max length of strings. Time Complexity: O(NK) Space Complexity: :param strings: :return:""" <|body_0|> def group(self, strings: List[str]) -> List[...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Anagrams: def group_(self, strings: List[str]) -> List[List[str]]: """Approach: Categorize by Count. N - length of strings. K - max length of strings. Time Complexity: O(NK) Space Complexity: :param strings: :return:""" anagrams_list = defaultdict(list) for string in strings: ...
the_stack_v2_python_sparse
revisited/math_and_strings/strings/group_anagrams.py
Shiv2157k/leet_code
train
1
32279fdbf0b9acbaa409088b3296fb52baea4baa
[ "res = ''\nfor strr in strs:\n res += str(len(strr)) + '$' + strr\nprint(res)\nreturn res", "res = []\ni = 0\nwhile i < len(s):\n p = s.find('$', i)\n length = int(s[i:p])\n res.append(s[p + 1:p + 1 + length])\n i = p + 1 + length\nreturn res" ]
<|body_start_0|> res = '' for strr in strs: res += str(len(strr)) + '$' + strr print(res) return res <|end_body_0|> <|body_start_1|> res = [] i = 0 while i < len(s): p = s.find('$', i) length = int(s[i:p]) res.appen...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = '' ...
stack_v2_sparse_classes_75kplus_train_070475
561
permissive
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
95ca845e40c7c9f8ba589a45332791d5bbf49bbf
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" res = '' for strr in strs: res += str(len(strr)) + '$' + strr print(res) return res def decode(self, s: str) -> [str]: """Decodes a single string to...
the_stack_v2_python_sparse
String/Leetcode 271. Encode and Decode Strings.py
sriharsha004/LeetCode
train
0
55f19d3610a1f2d3da4f54aed0dd72169a6be3fa
[ "self.maxi = maxi\nself.p = self.__start_progress(maxi)()\nself.header_printed = False\nself.msg = msg\nself.size = size", "if reset:\n self.__init__(self.maxi, self.size, self.msg)\nif not self.header_printed:\n self.__print_header()\nnext(self.p)", "format_string = '\\n0%{: ^' + str(self.size - 6) + '}1...
<|body_start_0|> self.maxi = maxi self.p = self.__start_progress(maxi)() self.header_printed = False self.msg = msg self.size = size <|end_body_0|> <|body_start_1|> if reset: self.__init__(self.maxi, self.size, self.msg) if not self.header_printed: ...
Text mode progress bar. Usage: p = Progress(30) p.step() p.step() p.step(start=True) # to restart form 0% The progress bar displays a new header at each restart.
Progress
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Progress: """Text mode progress bar. Usage: p = Progress(30) p.step() p.step() p.step(start=True) # to restart form 0% The progress bar displays a new header at each restart.""" def __init__(self, maxi, size=100, msg=''): """Initialize class. Args: maxi: The number of steps required ...
stack_v2_sparse_classes_75kplus_train_070476
13,013
permissive
[ { "docstring": "Initialize class. Args: maxi: The number of steps required to reach 100%. size: The number of characters taken on the screen by the progress bar. msg: The message displayed in the header of the progress bar.", "name": "__init__", "signature": "def __init__(self, maxi, size=100, msg='')" ...
4
stack_v2_sparse_classes_30k_train_050785
Implement the Python class `Progress` described below. Class description: Text mode progress bar. Usage: p = Progress(30) p.step() p.step() p.step(start=True) # to restart form 0% The progress bar displays a new header at each restart. Method signatures and docstrings: - def __init__(self, maxi, size=100, msg=''): In...
Implement the Python class `Progress` described below. Class description: Text mode progress bar. Usage: p = Progress(30) p.step() p.step() p.step(start=True) # to restart form 0% The progress bar displays a new header at each restart. Method signatures and docstrings: - def __init__(self, maxi, size=100, msg=''): In...
ba5086c9852a1ad2425126fa7a95c02213ddbab4
<|skeleton|> class Progress: """Text mode progress bar. Usage: p = Progress(30) p.step() p.step() p.step(start=True) # to restart form 0% The progress bar displays a new header at each restart.""" def __init__(self, maxi, size=100, msg=''): """Initialize class. Args: maxi: The number of steps required ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Progress: """Text mode progress bar. Usage: p = Progress(30) p.step() p.step() p.step(start=True) # to restart form 0% The progress bar displays a new header at each restart.""" def __init__(self, maxi, size=100, msg=''): """Initialize class. Args: maxi: The number of steps required to reach 100%...
the_stack_v2_python_sparse
src/python/bot/fuzzers/ml/rnn/utils.py
Google-Autofuzz/clusterfuzz
train
4
e1bda30dca44604bc53daf7bd1fde62c7aa44321
[ "try:\n user_id = request.GET.get('id')\n user = User.objects.get(id=user_id)\n data = simplejson.dumps(user.userprofile.notifications.all())\n return HttpResponse(data, mimetype='application/json')\nexcept:\n return HttpResponse('', mimetype='application/json')", "id = request.POST.get('id')\nnoti...
<|body_start_0|> try: user_id = request.GET.get('id') user = User.objects.get(id=user_id) data = simplejson.dumps(user.userprofile.notifications.all()) return HttpResponse(data, mimetype='application/json') except: return HttpResponse('', mimet...
this class will generate a notification to the given user
NotificationsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationsView: """this class will generate a notification to the given user""" def get(self, request, *args, **kwargs): """This will get all the notifications for a given user""" <|body_0|> def post(self, request, *args, **kwargs): """this will delete the not...
stack_v2_sparse_classes_75kplus_train_070477
3,219
no_license
[ { "docstring": "This will get all the notifications for a given user", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "this will delete the notification of the given id.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }...
2
stack_v2_sparse_classes_30k_train_024114
Implement the Python class `NotificationsView` described below. Class description: this class will generate a notification to the given user Method signatures and docstrings: - def get(self, request, *args, **kwargs): This will get all the notifications for a given user - def post(self, request, *args, **kwargs): thi...
Implement the Python class `NotificationsView` described below. Class description: this class will generate a notification to the given user Method signatures and docstrings: - def get(self, request, *args, **kwargs): This will get all the notifications for a given user - def post(self, request, *args, **kwargs): thi...
b7c6acdc1624c5feda4e76d4dea864f20ca6f9aa
<|skeleton|> class NotificationsView: """this class will generate a notification to the given user""" def get(self, request, *args, **kwargs): """This will get all the notifications for a given user""" <|body_0|> def post(self, request, *args, **kwargs): """this will delete the not...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationsView: """this class will generate a notification to the given user""" def get(self, request, *args, **kwargs): """This will get all the notifications for a given user""" try: user_id = request.GET.get('id') user = User.objects.get(id=user_id) ...
the_stack_v2_python_sparse
qurious_backend/qurious/sessions/views.py
abhiInCalif/qurious-ios
train
0
fbca600a499299cbc19ccd7a6953bdd2faf0cf61
[ "super().__init__(out_dims)\nself.dim = dim\nself.c_dim = c_dim\nself.net = []\nself.net.append(SineLayer(dim + c_dim, hidden_size, is_first=True, omega_0=first_omega_0))\nfor i in range(n_layers):\n self.net.append(SineLayer(hidden_size, hidden_size, is_first=False, omega_0=hidden_omega_0))\nif outermost_linear...
<|body_start_0|> super().__init__(out_dims) self.dim = dim self.c_dim = c_dim self.net = [] self.net.append(SineLayer(dim + c_dim, hidden_size, is_first=True, omega_0=first_omega_0)) for i in range(n_layers): self.net.append(SineLayer(hidden_size, hidden_size,...
Siren
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Siren: def __init__(self, dim: int, hidden_size: int=256, n_layers: int=3, out_dims: dict=OrderedDict(sdf=1), outermost_linear: bool=True, c_dim: int=256, first_omega_0: float=30, hidden_omega_0: float=30.0, activation: Optional[str]=None, **kwargs): """Args: dim: first input dimension h...
stack_v2_sparse_classes_75kplus_train_070478
19,841
no_license
[ { "docstring": "Args: dim: first input dimension hidden_size: intermediate feature dimension n_layers: number of hidden layers (total number of layers = n_layers + 2) out_dim: last output dimension outermost_linear: use linear layer as the last layer instead of sine layer activation: for the sdf value", "na...
2
null
Implement the Python class `Siren` described below. Class description: Implement the Siren class. Method signatures and docstrings: - def __init__(self, dim: int, hidden_size: int=256, n_layers: int=3, out_dims: dict=OrderedDict(sdf=1), outermost_linear: bool=True, c_dim: int=256, first_omega_0: float=30, hidden_omeg...
Implement the Python class `Siren` described below. Class description: Implement the Siren class. Method signatures and docstrings: - def __init__(self, dim: int, hidden_size: int=256, n_layers: int=3, out_dims: dict=OrderedDict(sdf=1), outermost_linear: bool=True, c_dim: int=256, first_omega_0: float=30, hidden_omeg...
8fd8d86593272a56305b13ec7d9b4bdd9d241ef9
<|skeleton|> class Siren: def __init__(self, dim: int, hidden_size: int=256, n_layers: int=3, out_dims: dict=OrderedDict(sdf=1), outermost_linear: bool=True, c_dim: int=256, first_omega_0: float=30, hidden_omega_0: float=30.0, activation: Optional[str]=None, **kwargs): """Args: dim: first input dimension h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Siren: def __init__(self, dim: int, hidden_size: int=256, n_layers: int=3, out_dims: dict=OrderedDict(sdf=1), outermost_linear: bool=True, c_dim: int=256, first_omega_0: float=30, hidden_omega_0: float=30.0, activation: Optional[str]=None, **kwargs): """Args: dim: first input dimension hidden_size: in...
the_stack_v2_python_sparse
DSS/models/common.py
yifita/DSS
train
305
203ed0ec92045774e1d1905e0f4d64351c1f19e7
[ "self._command = command\nself._terms = results.AllTerms()\nself._results = results\nself._found_commands_map = {}\nfor c in found_commands:\n path = _GetPathWithoutPrefix(c)\n self._found_commands_map.setdefault(path, []).append(c)", "rating = 1.0\nrating *= self._RateForLocation()\nrating *= self._RateFor...
<|body_start_0|> self._command = command self._terms = results.AllTerms() self._results = results self._found_commands_map = {} for c in found_commands: path = _GetPathWithoutPrefix(c) self._found_commands_map.setdefault(path, []).append(c) <|end_body_0|> ...
A class to rate the results of searching a command.
CommandRater
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandRater: """A class to rate the results of searching a command.""" def __init__(self, results, command, found_commands): """Create a CommandRater. Args: results: googlecloudsdk.command_lib.search_help.search_util .CommandSearchResult, class that holds results. command: dict, a j...
stack_v2_sparse_classes_75kplus_train_070479
6,273
permissive
[ { "docstring": "Create a CommandRater. Args: results: googlecloudsdk.command_lib.search_help.search_util .CommandSearchResult, class that holds results. command: dict, a json representation of a command. found_commands: [dict], a list of all commands that were found.", "name": "__init__", "signature": "...
5
null
Implement the Python class `CommandRater` described below. Class description: A class to rate the results of searching a command. Method signatures and docstrings: - def __init__(self, results, command, found_commands): Create a CommandRater. Args: results: googlecloudsdk.command_lib.search_help.search_util .CommandS...
Implement the Python class `CommandRater` described below. Class description: A class to rate the results of searching a command. Method signatures and docstrings: - def __init__(self, results, command, found_commands): Create a CommandRater. Args: results: googlecloudsdk.command_lib.search_help.search_util .CommandS...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class CommandRater: """A class to rate the results of searching a command.""" def __init__(self, results, command, found_commands): """Create a CommandRater. Args: results: googlecloudsdk.command_lib.search_help.search_util .CommandSearchResult, class that holds results. command: dict, a j...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommandRater: """A class to rate the results of searching a command.""" def __init__(self, results, command, found_commands): """Create a CommandRater. Args: results: googlecloudsdk.command_lib.search_help.search_util .CommandSearchResult, class that holds results. command: dict, a json represent...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/command_lib/help_search/rater.py
bopopescu/socialliteapp
train
0
9ee0df2ba14cf002aeec7b9c2ae16c6c565f43b2
[ "auth_user = TokenAuthentication().authenticate(request)[0]\npayload = request.data\nowner_id = payload.get('owner', None)\noffer_amount = payload.get('amount', None)\nlisting_item = payload.get('listing_id', None)\nowner = account_models.User.objects.filter(id=owner_id)\nif owner.exists():\n offer = marketplace...
<|body_start_0|> auth_user = TokenAuthentication().authenticate(request)[0] payload = request.data owner_id = payload.get('owner', None) offer_amount = payload.get('amount', None) listing_item = payload.get('listing_id', None) owner = account_models.User.objects.filter(id...
API view set to handle Marketplace offers
MarketplaceOfferViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarketplaceOfferViewSet: """API view set to handle Marketplace offers""" def post(self, request, **kwargs): """POST method to create MarketplaceOffer object :param request: HTTP request object :param kwargs: Additional keyword arguments from the url :return: HTTP response object""" ...
stack_v2_sparse_classes_75kplus_train_070480
8,477
no_license
[ { "docstring": "POST method to create MarketplaceOffer object :param request: HTTP request object :param kwargs: Additional keyword arguments from the url :return: HTTP response object", "name": "post", "signature": "def post(self, request, **kwargs)" }, { "docstring": "API Endpoint to retrieve ...
2
null
Implement the Python class `MarketplaceOfferViewSet` described below. Class description: API view set to handle Marketplace offers Method signatures and docstrings: - def post(self, request, **kwargs): POST method to create MarketplaceOffer object :param request: HTTP request object :param kwargs: Additional keyword ...
Implement the Python class `MarketplaceOfferViewSet` described below. Class description: API view set to handle Marketplace offers Method signatures and docstrings: - def post(self, request, **kwargs): POST method to create MarketplaceOffer object :param request: HTTP request object :param kwargs: Additional keyword ...
38a09ce2fe68312338c8cb597a341853901eeaa3
<|skeleton|> class MarketplaceOfferViewSet: """API view set to handle Marketplace offers""" def post(self, request, **kwargs): """POST method to create MarketplaceOffer object :param request: HTTP request object :param kwargs: Additional keyword arguments from the url :return: HTTP response object""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MarketplaceOfferViewSet: """API view set to handle Marketplace offers""" def post(self, request, **kwargs): """POST method to create MarketplaceOffer object :param request: HTTP request object :param kwargs: Additional keyword arguments from the url :return: HTTP response object""" auth_u...
the_stack_v2_python_sparse
apps/marketplace/views.py
AOV-Team/aov-py-backend
train
0
11ca96c8a277e9cee7fea9f88a4d842010e1791a
[ "ref = db.child(table)\nkey = ref.generate_key()\nreturn ref.child(key).update(data)", "table_name = 'body_parts'\nfor body_part in ALL_BODY_PARTS:\n Fire.create_child(table_name, body_part['data'])\nreturn make_response({}, 200)", "table_name = 'workouts'\nfor workout in ALL_WORKOUTS:\n Fire.create_child...
<|body_start_0|> ref = db.child(table) key = ref.generate_key() return ref.child(key).update(data) <|end_body_0|> <|body_start_1|> table_name = 'body_parts' for body_part in ALL_BODY_PARTS: Fire.create_child(table_name, body_part['data']) return make_response...
This class acts as the fire model for our database. It contains all the methods related to initalizing the firebase database.
Fire
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fire: """This class acts as the fire model for our database. It contains all the methods related to initalizing the firebase database.""" def create_child(cls, table, data): """Creates a specified child in the table with that key and data. Arguments: table {str} -> The table name to ...
stack_v2_sparse_classes_75kplus_train_070481
3,823
no_license
[ { "docstring": "Creates a specified child in the table with that key and data. Arguments: table {str} -> The table name to update name {str} -> The name of the child object data {dict} -> The data for the child object Returns: response object -> If valid call, returns the the updated data and a 200 status code....
6
null
Implement the Python class `Fire` described below. Class description: This class acts as the fire model for our database. It contains all the methods related to initalizing the firebase database. Method signatures and docstrings: - def create_child(cls, table, data): Creates a specified child in the table with that k...
Implement the Python class `Fire` described below. Class description: This class acts as the fire model for our database. It contains all the methods related to initalizing the firebase database. Method signatures and docstrings: - def create_child(cls, table, data): Creates a specified child in the table with that k...
98f72eff6408801d770c74125b702364aab14835
<|skeleton|> class Fire: """This class acts as the fire model for our database. It contains all the methods related to initalizing the firebase database.""" def create_child(cls, table, data): """Creates a specified child in the table with that key and data. Arguments: table {str} -> The table name to ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Fire: """This class acts as the fire model for our database. It contains all the methods related to initalizing the firebase database.""" def create_child(cls, table, data): """Creates a specified child in the table with that key and data. Arguments: table {str} -> The table name to update name {...
the_stack_v2_python_sparse
backend/app/src/models/fire.py
imranmatin23/BitFit
train
0
94c6163d655cae48fd54687051333457a53dce42
[ "l = len(rods)\nmemory = {}\n\ndef dfs(i, left, right):\n if i == l:\n return left if left == right else 0\n if (i, left, right) in memory:\n return memory[i, left, right]\n first = dfs(i + 1, left + rods[i], right)\n second = dfs(i + 1, left, right + rods[i])\n third = dfs(i + 1, left,...
<|body_start_0|> l = len(rods) memory = {} def dfs(i, left, right): if i == l: return left if left == right else 0 if (i, left, right) in memory: return memory[i, left, right] first = dfs(i + 1, left + rods[i], right) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def tallestBillboard(self, rods): """:type rods: List[int] :rtype: int""" <|body_0|> def tallestBillboard_1(self, rods): """:type rods: List[int] :rtype: int 620 ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = len(rods) memo...
stack_v2_sparse_classes_75kplus_train_070482
3,463
no_license
[ { "docstring": ":type rods: List[int] :rtype: int", "name": "tallestBillboard", "signature": "def tallestBillboard(self, rods)" }, { "docstring": ":type rods: List[int] :rtype: int 620 ms", "name": "tallestBillboard_1", "signature": "def tallestBillboard_1(self, rods)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def tallestBillboard(self, rods): :type rods: List[int] :rtype: int - def tallestBillboard_1(self, rods): :type rods: List[int] :rtype: int 620 ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def tallestBillboard(self, rods): :type rods: List[int] :rtype: int - def tallestBillboard_1(self, rods): :type rods: List[int] :rtype: int 620 ms <|skeleton|> class Solution: ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def tallestBillboard(self, rods): """:type rods: List[int] :rtype: int""" <|body_0|> def tallestBillboard_1(self, rods): """:type rods: List[int] :rtype: int 620 ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def tallestBillboard(self, rods): """:type rods: List[int] :rtype: int""" l = len(rods) memory = {} def dfs(i, left, right): if i == l: return left if left == right else 0 if (i, left, right) in memory: return m...
the_stack_v2_python_sparse
TallestBillboard_HARD_956.py
953250587/leetcode-python
train
2
9820628612a6ee1acf247a6d1c483b78e0ac111a
[ "self.dq = collections.deque()\nfor i in range(1, n + 1):\n self.dq.append(i)\nself.t = collections.deque()", "if k == len(self.dq):\n return self.dq[-1]\nwhile k != 0:\n k -= 1\n self.t.append(self.dq.popleft())\nr = self.t[-1]\nself.dq.append(self.t.pop())\nwhile self.t:\n self.dq.appendleft(self...
<|body_start_0|> self.dq = collections.deque() for i in range(1, n + 1): self.dq.append(i) self.t = collections.deque() <|end_body_0|> <|body_start_1|> if k == len(self.dq): return self.dq[-1] while k != 0: k -= 1 self.t.append(sel...
MRUQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MRUQueue: def __init__(self, n): """:type n: int""" <|body_0|> def fetch(self, k): """:type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dq = collections.deque() for i in range(1, n + 1): self.dq.append...
stack_v2_sparse_classes_75kplus_train_070483
754
no_license
[ { "docstring": ":type n: int", "name": "__init__", "signature": "def __init__(self, n)" }, { "docstring": ":type k: int :rtype: int", "name": "fetch", "signature": "def fetch(self, k)" } ]
2
stack_v2_sparse_classes_30k_train_010417
Implement the Python class `MRUQueue` described below. Class description: Implement the MRUQueue class. Method signatures and docstrings: - def __init__(self, n): :type n: int - def fetch(self, k): :type k: int :rtype: int
Implement the Python class `MRUQueue` described below. Class description: Implement the MRUQueue class. Method signatures and docstrings: - def __init__(self, n): :type n: int - def fetch(self, k): :type k: int :rtype: int <|skeleton|> class MRUQueue: def __init__(self, n): """:type n: int""" <|...
20623defecf65cbc35b194d8b60d8b211816ee4f
<|skeleton|> class MRUQueue: def __init__(self, n): """:type n: int""" <|body_0|> def fetch(self, k): """:type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MRUQueue: def __init__(self, n): """:type n: int""" self.dq = collections.deque() for i in range(1, n + 1): self.dq.append(i) self.t = collections.deque() def fetch(self, k): """:type k: int :rtype: int""" if k == len(self.dq): retur...
the_stack_v2_python_sparse
in_Python/1756 Design Most Recently Used Queue.py
YangLiyli131/Leetcode2020
train
0
b62e676950067dc8c383022ea9fd0237b8438e61
[ "court_order = {'courtName': self.court_name, 'courtRegistry': self.court_registry, 'fileNumber': self.file_number, 'orderDate': format_ts(self.order_date)}\nif self.effect_of_order:\n court_order['effectOfOrder'] = self.effect_of_order\nreturn court_order", "expiry = None\nif court_order_id:\n expiry = cls...
<|body_start_0|> court_order = {'courtName': self.court_name, 'courtRegistry': self.court_registry, 'fileNumber': self.file_number, 'orderDate': format_ts(self.order_date)} if self.effect_of_order: court_order['effectOfOrder'] = self.effect_of_order return court_order <|end_body_0|> ...
This class manages all of the amendment, renewal statement court order information.
CourtOrder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourtOrder: """This class manages all of the amendment, renewal statement court order information.""" def json(self) -> dict: """Return the court_order as a json object.""" <|body_0|> def find_by_id(cls, court_order_id: int=None): """Return an expiry object by ex...
stack_v2_sparse_classes_75kplus_train_070484
3,545
permissive
[ { "docstring": "Return the court_order as a json object.", "name": "json", "signature": "def json(self) -> dict" }, { "docstring": "Return an expiry object by expiry ID.", "name": "find_by_id", "signature": "def find_by_id(cls, court_order_id: int=None)" }, { "docstring": "Return...
4
stack_v2_sparse_classes_30k_train_047089
Implement the Python class `CourtOrder` described below. Class description: This class manages all of the amendment, renewal statement court order information. Method signatures and docstrings: - def json(self) -> dict: Return the court_order as a json object. - def find_by_id(cls, court_order_id: int=None): Return a...
Implement the Python class `CourtOrder` described below. Class description: This class manages all of the amendment, renewal statement court order information. Method signatures and docstrings: - def json(self) -> dict: Return the court_order as a json object. - def find_by_id(cls, court_order_id: int=None): Return a...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class CourtOrder: """This class manages all of the amendment, renewal statement court order information.""" def json(self) -> dict: """Return the court_order as a json object.""" <|body_0|> def find_by_id(cls, court_order_id: int=None): """Return an expiry object by ex...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CourtOrder: """This class manages all of the amendment, renewal statement court order information.""" def json(self) -> dict: """Return the court_order as a json object.""" court_order = {'courtName': self.court_name, 'courtRegistry': self.court_registry, 'fileNumber': self.file_number, '...
the_stack_v2_python_sparse
ppr-api/src/ppr_api/models/court_order.py
bcgov/ppr
train
4
3f3050d43bb64aa123d7b79d4b59dd09f593bf16
[ "if __debug__:\n logger.debug('Creating Consumer...')\nif isinstance(topic, bytes):\n topic_fix = str(topic.decode('utf-8'))\nelse:\n topic_fix = str(topic)\nself.topic = topic_fix\nself.access_mode = access_mode\nfrom kafka import KafkaConsumer\nbootstrap_server_info = str(bootstrap_server).split(':')\nbo...
<|body_start_0|> if __debug__: logger.debug('Creating Consumer...') if isinstance(topic, bytes): topic_fix = str(topic.decode('utf-8')) else: topic_fix = str(topic) self.topic = topic_fix self.access_mode = access_mode from kafka import...
ODS Consumer connector implementation. Attributes: - topic: Registered topic name on the Kafka backend + type: string - access_mode: Consumer access mode + type: string - kafka_consumer: KafkaConsumer instance + type: KafkaConsumer
ODSConsumer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ODSConsumer: """ODS Consumer connector implementation. Attributes: - topic: Registered topic name on the Kafka backend + type: string - access_mode: Consumer access mode + type: string - kafka_consumer: KafkaConsumer instance + type: KafkaConsumer""" def __init__(self, bootstrap_server: str,...
stack_v2_sparse_classes_75kplus_train_070485
6,395
permissive
[ { "docstring": "Create a new ODSConsumer instance. :param bootstrap_server: Associated boostrap server. :param topic: Topic where to consume records. :param access_mode: Consumer access mode.", "name": "__init__", "signature": "def __init__(self, bootstrap_server: str, topic: str, access_mode: str) -> N...
2
stack_v2_sparse_classes_30k_train_003418
Implement the Python class `ODSConsumer` described below. Class description: ODS Consumer connector implementation. Attributes: - topic: Registered topic name on the Kafka backend + type: string - access_mode: Consumer access mode + type: string - kafka_consumer: KafkaConsumer instance + type: KafkaConsumer Method si...
Implement the Python class `ODSConsumer` described below. Class description: ODS Consumer connector implementation. Attributes: - topic: Registered topic name on the Kafka backend + type: string - access_mode: Consumer access mode + type: string - kafka_consumer: KafkaConsumer instance + type: KafkaConsumer Method si...
5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092
<|skeleton|> class ODSConsumer: """ODS Consumer connector implementation. Attributes: - topic: Registered topic name on the Kafka backend + type: string - access_mode: Consumer access mode + type: string - kafka_consumer: KafkaConsumer instance + type: KafkaConsumer""" def __init__(self, bootstrap_server: str,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ODSConsumer: """ODS Consumer connector implementation. Attributes: - topic: Registered topic name on the Kafka backend + type: string - access_mode: Consumer access mode + type: string - kafka_consumer: KafkaConsumer instance + type: KafkaConsumer""" def __init__(self, bootstrap_server: str, topic: str, ...
the_stack_v2_python_sparse
compss/programming_model/bindings/python/src/pycompss/streams/components/objects/kafka_connectors.py
bsc-wdc/compss
train
39
3521bc10d1058a01403545ad6d3a488e80d29253
[ "super().__init__()\nself._attention_type = attention\nself.conv_1 = nn.Sequential(nn.Conv2d(256, 1024, 1), nn.ReLU(), nn.Conv2d(1024, 256, 1), nn.ReLU())\nself.conv_1b = nn.Sequential(nn.Conv2d(256, 1024, 1), nn.ReLU(), nn.Conv2d(1024, 256, 1), nn.ReLU())\nself.attention_layer = AttentionLayer(use_language and att...
<|body_start_0|> super().__init__() self._attention_type = attention self.conv_1 = nn.Sequential(nn.Conv2d(256, 1024, 1), nn.ReLU(), nn.Conv2d(1024, 256, 1), nn.ReLU()) self.conv_1b = nn.Sequential(nn.Conv2d(256, 1024, 1), nn.ReLU(), nn.Conv2d(1024, 256, 1), nn.ReLU()) self.atten...
Predicate Branch. pred. features -> CONV -> RELU -> Att. Pool -> CONV1D -> RELU -> -> Att. Clsfr -> out attention: multihead, singlehead, None
PredicateBranch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredicateBranch: """Predicate Branch. pred. features -> CONV -> RELU -> Att. Pool -> CONV1D -> RELU -> -> Att. Clsfr -> out attention: multihead, singlehead, None""" def __init__(self, num_classes, attention='multi_head', use_language=True, use_spatial=True): """Initialize model.""" ...
stack_v2_sparse_classes_75kplus_train_070486
13,005
no_license
[ { "docstring": "Initialize model.", "name": "__init__", "signature": "def __init__(self, num_classes, attention='multi_head', use_language=True, use_spatial=True)" }, { "docstring": "Forward pass.", "name": "forward", "signature": "def forward(self, pred_feats, deltas, masks, subj_embs, ...
2
null
Implement the Python class `PredicateBranch` described below. Class description: Predicate Branch. pred. features -> CONV -> RELU -> Att. Pool -> CONV1D -> RELU -> -> Att. Clsfr -> out attention: multihead, singlehead, None Method signatures and docstrings: - def __init__(self, num_classes, attention='multi_head', us...
Implement the Python class `PredicateBranch` described below. Class description: Predicate Branch. pred. features -> CONV -> RELU -> Att. Pool -> CONV1D -> RELU -> -> Att. Clsfr -> out attention: multihead, singlehead, None Method signatures and docstrings: - def __init__(self, num_classes, attention='multi_head', us...
810c79541a8584de3fe37943d244af366d361689
<|skeleton|> class PredicateBranch: """Predicate Branch. pred. features -> CONV -> RELU -> Att. Pool -> CONV1D -> RELU -> -> Att. Clsfr -> out attention: multihead, singlehead, None""" def __init__(self, num_classes, attention='multi_head', use_language=True, use_spatial=True): """Initialize model.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PredicateBranch: """Predicate Branch. pred. features -> CONV -> RELU -> Att. Pool -> CONV1D -> RELU -> -> Att. Clsfr -> out attention: multihead, singlehead, None""" def __init__(self, num_classes, attention='multi_head', use_language=True, use_spatial=True): """Initialize model.""" super...
the_stack_v2_python_sparse
common/models/sg_generator/atr_net.py
bgzu/zs-vrd-bmvc20
train
0
b8425396ab2dc40e7d85bbbf1ab1ee7569e184c6
[ "self.bar = None\nself.onBar = onBar\nif bar_type == const.MARKET_TYPE_KLINE_5M:\n self.xmin = 5\nelif bar_type == const.MARKET_TYPE_KLINE_15M:\n self.xmin = 15\nself.bar_type = bar_type\nself.xminBar = None\nself.onXminBar = onXminBar", "newMinute = False\nif not self.bar:\n self.bar = Kline()\n newM...
<|body_start_0|> self.bar = None self.onBar = onBar if bar_type == const.MARKET_TYPE_KLINE_5M: self.xmin = 5 elif bar_type == const.MARKET_TYPE_KLINE_15M: self.xmin = 15 self.bar_type = bar_type self.xminBar = None self.onXminBar = onXminBa...
K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)
KlineGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KlineGenerator: """K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)""" def __init__(self, onBar, bar_type=None, onXminBar=None): """Constructor""" <|body_0|> async def update_trade(self, trade): """逐笔成交更新""" <|body_1|> async def update_bar(se...
stack_v2_sparse_classes_75kplus_train_070487
3,675
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, onBar, bar_type=None, onXminBar=None)" }, { "docstring": "逐笔成交更新", "name": "update_trade", "signature": "async def update_trade(self, trade)" }, { "docstring": "1分钟K线更新", "name": "update_bar", ...
3
stack_v2_sparse_classes_30k_train_030432
Implement the Python class `KlineGenerator` described below. Class description: K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15) Method signatures and docstrings: - def __init__(self, onBar, bar_type=None, onXminBar=None): Constructor - async def update_trade(self, trade): 逐笔成交更新 - async def update_bar(self, ...
Implement the Python class `KlineGenerator` described below. Class description: K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15) Method signatures and docstrings: - def __init__(self, onBar, bar_type=None, onXminBar=None): Constructor - async def update_trade(self, trade): 逐笔成交更新 - async def update_bar(self, ...
5f45dbd5f09354dd161606f7e740f8c8d8ae2772
<|skeleton|> class KlineGenerator: """K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)""" def __init__(self, onBar, bar_type=None, onXminBar=None): """Constructor""" <|body_0|> async def update_trade(self, trade): """逐笔成交更新""" <|body_1|> async def update_bar(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KlineGenerator: """K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)""" def __init__(self, onBar, bar_type=None, onXminBar=None): """Constructor""" self.bar = None self.onBar = onBar if bar_type == const.MARKET_TYPE_KLINE_5M: self.xmin = 5 elif b...
the_stack_v2_python_sparse
quant/interface/kline_generator.py
lucali2014/alphahunter
train
0
a9a861990602ac669150550c06c85c2bd602f217
[ "logging.getLogger('tensorflow').setLevel(logging.ERROR)\nlogging.getLogger('batchglm').setLevel(logging.WARNING)\nlogging.getLogger('diffxpy').setLevel(logging.WARNING)\nnp.random.seed(1)\nreturn self._test_t_test_de(n_cells=n_cells, n_genes=n_genes)", "logging.getLogger('tensorflow').setLevel(logging.ERROR)\nlo...
<|body_start_0|> logging.getLogger('tensorflow').setLevel(logging.ERROR) logging.getLogger('batchglm').setLevel(logging.WARNING) logging.getLogger('diffxpy').setLevel(logging.WARNING) np.random.seed(1) return self._test_t_test_de(n_cells=n_cells, n_genes=n_genes) <|end_body_0|> ...
Noise model-independent tests unit tests that tests false positive and false negative rates.
TestSingleDeStandard
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSingleDeStandard: """Noise model-independent tests unit tests that tests false positive and false negative rates.""" def test_ttest_de(self, n_cells: int=2000, n_genes: int=200): """:param n_cells: Number of cells to simulate (number of observations per test). :param n_genes: Num...
stack_v2_sparse_classes_75kplus_train_070488
10,613
permissive
[ { "docstring": ":param n_cells: Number of cells to simulate (number of observations per test). :param n_genes: Number of genes to simulate (number of tests).", "name": "test_ttest_de", "signature": "def test_ttest_de(self, n_cells: int=2000, n_genes: int=200)" }, { "docstring": ":param n_cells: ...
2
stack_v2_sparse_classes_30k_train_030266
Implement the Python class `TestSingleDeStandard` described below. Class description: Noise model-independent tests unit tests that tests false positive and false negative rates. Method signatures and docstrings: - def test_ttest_de(self, n_cells: int=2000, n_genes: int=200): :param n_cells: Number of cells to simula...
Implement the Python class `TestSingleDeStandard` described below. Class description: Noise model-independent tests unit tests that tests false positive and false negative rates. Method signatures and docstrings: - def test_ttest_de(self, n_cells: int=2000, n_genes: int=200): :param n_cells: Number of cells to simula...
7609ea935936e3739fc4c71b75c8ee8ca57f51ea
<|skeleton|> class TestSingleDeStandard: """Noise model-independent tests unit tests that tests false positive and false negative rates.""" def test_ttest_de(self, n_cells: int=2000, n_genes: int=200): """:param n_cells: Number of cells to simulate (number of observations per test). :param n_genes: Num...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSingleDeStandard: """Noise model-independent tests unit tests that tests false positive and false negative rates.""" def test_ttest_de(self, n_cells: int=2000, n_genes: int=200): """:param n_cells: Number of cells to simulate (number of observations per test). :param n_genes: Number of genes ...
the_stack_v2_python_sparse
diffxpy/unit_test/test_single_de.py
theislab/diffxpy
train
163
22e16b7044620e303415369fdf25b03a7db23921
[ "super().__init__(coordinator=coordinator)\nself._service_key = service_key\nself.entity_id = f'{SENSOR_DOMAIN}.{service}_{description.key}'\nself.entity_description = description\nself._attr_unique_id = f'{coordinator.config_entry.entry_id}_{service_key}_{description.key}'\nself._attr_device_info = DeviceInfo(entr...
<|body_start_0|> super().__init__(coordinator=coordinator) self._service_key = service_key self.entity_id = f'{SENSOR_DOMAIN}.{service}_{description.key}' self.entity_description = description self._attr_unique_id = f'{coordinator.config_entry.entry_id}_{service_key}_{description...
Defines an P1 Monitor sensor.
P1MonitorSensorEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class P1MonitorSensorEntity: """Defines an P1 Monitor sensor.""" def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None: """Initialize ...
stack_v2_sparse_classes_75kplus_train_070489
11,570
permissive
[ { "docstring": "Initialize P1 Monitor sensor.", "name": "__init__", "signature": "def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None" }, { ...
2
stack_v2_sparse_classes_30k_train_034978
Implement the Python class `P1MonitorSensorEntity` described below. Class description: Defines an P1 Monitor sensor. Method signatures and docstrings: - def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', '...
Implement the Python class `P1MonitorSensorEntity` described below. Class description: Defines an P1 Monitor sensor. Method signatures and docstrings: - def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', '...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class P1MonitorSensorEntity: """Defines an P1 Monitor sensor.""" def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None: """Initialize ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class P1MonitorSensorEntity: """Defines an P1 Monitor sensor.""" def __init__(self, *, coordinator: P1MonitorDataUpdateCoordinator, description: SensorEntityDescription, service_key: Literal['smartmeter', 'watermeter', 'phases', 'settings'], name: str, service: str) -> None: """Initialize P1 Monitor se...
the_stack_v2_python_sparse
homeassistant/components/p1_monitor/sensor.py
konnected-io/home-assistant
train
24
2a8420d3157a9d11ccc7dc1f6ce1768d8aa18e5d
[ "super().__init__()\nself.cost_is_referred = cost_is_referred\nself.cost_dice = cost_dice\nassert cost_is_referred != 0 or cost_dice != 0, 'all costs cant be 0'", "t, bs, num_queries = outputs['pred_masks'].shape[:3]\nout_masks = outputs['pred_masks'].flatten(1, 2)\ntgt_masks = [[m for v in t_step_batch for m in ...
<|body_start_0|> super().__init__() self.cost_is_referred = cost_is_referred self.cost_dice = cost_dice assert cost_is_referred != 0 or cost_dice != 0, 'all costs cant be 0' <|end_body_0|> <|body_start_1|> t, bs, num_queries = outputs['pred_masks'].shape[:3] out_masks = ...
This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, while the others are un-matched (...
HungarianMatcher
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best pr...
stack_v2_sparse_classes_75kplus_train_070490
7,299
permissive
[ { "docstring": "Creates the matcher Params: cost_is_referred: This is the relative weight of the reference cost in the total matching cost cost_dice: This is the relative weight of the dice cost in the total matching cost", "name": "__init__", "signature": "def __init__(self, cost_is_referred: float=1, ...
2
stack_v2_sparse_classes_30k_train_003433
Implement the Python class `HungarianMatcher` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case,...
Implement the Python class `HungarianMatcher` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case,...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best pr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, wh...
the_stack_v2_python_sparse
ai/modelscope/modelscope/models/cv/referring_video_object_segmentation/utils/matcher.py
alldatacenter/alldata
train
774
01b1959a87e5d0745caeceb32d6188b53395ae79
[ "print('Enter the values for filters you want to apply (Press enter to skip)')\nfor key in self.FILTERS:\n while True:\n value = SelectFiles.validate(input(self.FILTERS[key]['description']), key)\n if value == '':\n break\n elif not isinstance(value, bool):\n self.FILTE...
<|body_start_0|> print('Enter the values for filters you want to apply (Press enter to skip)') for key in self.FILTERS: while True: value = SelectFiles.validate(input(self.FILTERS[key]['description']), key) if value == '': break ...
Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered
SelectFiles
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectFiles: """Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered""" def __init__(self): """Takes in arguments from the user for filtering files""" <|body_0|> def list_all_files(path): ...
stack_v2_sparse_classes_75kplus_train_070491
8,019
permissive
[ { "docstring": "Takes in arguments from the user for filtering files", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Returns a Dict object of all the files present at the path argument.", "name": "list_all_files", "signature": "def list_all_files(path)" }, ...
5
stack_v2_sparse_classes_30k_train_024215
Implement the Python class `SelectFiles` described below. Class description: Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered Method signatures and docstrings: - def __init__(self): Takes in arguments from the user for filtering file...
Implement the Python class `SelectFiles` described below. Class description: Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered Method signatures and docstrings: - def __init__(self): Takes in arguments from the user for filtering file...
31fd3fb1233f39ea2252a7a44160ff8a2140f7bd
<|skeleton|> class SelectFiles: """Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered""" def __init__(self): """Takes in arguments from the user for filtering files""" <|body_0|> def list_all_files(path): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SelectFiles: """Class containing method to select and filter files at a path. It contains different filters based on which, the files can be filtered""" def __init__(self): """Takes in arguments from the user for filtering files""" print('Enter the values for filters you want to apply (Pr...
the_stack_v2_python_sparse
Python/Bulk_File_Renamer/utils.py
HarshCasper/Rotten-Scripts
train
1,474
714bdd93d9df62640ebdf71d48ce8765db732485
[ "self.table = table\nself.data = data or {}\nself.item_id = id", "if col in self.table.template:\n if col in self.data.keys():\n return self.data[col]\n else:\n return None\nelse:\n raise KeyError()", "if col in self.table.template:\n self.data[col] = val\nelse:\n raise KeyError()\n...
<|body_start_0|> self.table = table self.data = data or {} self.item_id = id <|end_body_0|> <|body_start_1|> if col in self.table.template: if col in self.data.keys(): return self.data[col] else: return None else: ...
Represents a database item.
db_item
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class db_item: """Represents a database item.""" def __init__(self, table, id, data): """Initialising a new item object.""" <|body_0|> def get(self, col: str): """Gets a column from the record row.""" <|body_1|> def set(self, col: str, val): """Set...
stack_v2_sparse_classes_75kplus_train_070492
4,747
no_license
[ { "docstring": "Initialising a new item object.", "name": "__init__", "signature": "def __init__(self, table, id, data)" }, { "docstring": "Gets a column from the record row.", "name": "get", "signature": "def get(self, col: str)" }, { "docstring": "Sets a column of the record ro...
3
stack_v2_sparse_classes_30k_train_017241
Implement the Python class `db_item` described below. Class description: Represents a database item. Method signatures and docstrings: - def __init__(self, table, id, data): Initialising a new item object. - def get(self, col: str): Gets a column from the record row. - def set(self, col: str, val): Sets a column of t...
Implement the Python class `db_item` described below. Class description: Represents a database item. Method signatures and docstrings: - def __init__(self, table, id, data): Initialising a new item object. - def get(self, col: str): Gets a column from the record row. - def set(self, col: str, val): Sets a column of t...
21261e3c9c4a7755b35dc9ae6e6fa4e453045f20
<|skeleton|> class db_item: """Represents a database item.""" def __init__(self, table, id, data): """Initialising a new item object.""" <|body_0|> def get(self, col: str): """Gets a column from the record row.""" <|body_1|> def set(self, col: str, val): """Set...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class db_item: """Represents a database item.""" def __init__(self, table, id, data): """Initialising a new item object.""" self.table = table self.data = data or {} self.item_id = id def get(self, col: str): """Gets a column from the record row.""" if col i...
the_stack_v2_python_sparse
software/module/database/database.py
shaiTheKimhi/lab_control_panel
train
0
3b79f1da407ce35df0781001c524bac20927a1d4
[ "best_side = 'index_left'\nindex_left = 0\nindex_right = len(subHeight) - 1\nfor i in range(1, int(len(subHeight) / 2 - 1)):\n index_left += 1\n index_right -= 1\n if subHeight[index_left] < subHeight[index_right]:\n best_side = 'index_left'\n elif subHeight[index_left] > subHeight[index_right]:\...
<|body_start_0|> best_side = 'index_left' index_left = 0 index_right = len(subHeight) - 1 for i in range(1, int(len(subHeight) / 2 - 1)): index_left += 1 index_right -= 1 if subHeight[index_left] < subHeight[index_right]: best_side = 'i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def best_side(self, subHeight): """两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> best_side = 'index_le...
stack_v2_sparse_classes_75kplus_train_070493
1,949
no_license
[ { "docstring": "两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:", "name": "best_side", "signature": "def best_side(self, subHeight)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_013994
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def best_side(self, subHeight): 两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return: - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def best_side(self, subHeight): 两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return: - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Soluti...
17b22a7201de65cf9ac8807efee225f475d72ef3
<|skeleton|> class Solution: def best_side(self, subHeight): """两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def best_side(self, subHeight): """两边相同时,往内搜索,如果单边随机选有可能选不到最好的 :param subHeight: :return:""" best_side = 'index_left' index_left = 0 index_right = len(subHeight) - 1 for i in range(1, int(len(subHeight) / 2 - 1)): index_left += 1 index_...
the_stack_v2_python_sparse
day5/code11.py
ohquai/LeetCode
train
0
d46907c83fb437396eddb57789990a73432e0a98
[ "self.fixed_size = fixed_size\nself.classifier_pkl = classifier_pkl\nself.feature_method = feature_method\nself.feature_options = feature_options\nself.image_processing_options = image_processing_options\nself.raw_image_path = raw_image_path\nself.kernel = kernel\nself.gamma = gamma\nself.C = C\nself.data = None\ns...
<|body_start_0|> self.fixed_size = fixed_size self.classifier_pkl = classifier_pkl self.feature_method = feature_method self.feature_options = feature_options self.image_processing_options = image_processing_options self.raw_image_path = raw_image_path self.kernel...
train_classifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class train_classifier: def __init__(self, df_path, image_col_name, category_col_name, fixed_size, classifier_pkl, feature_method, feature_options, image_processing_options, raw_image_path, kernel='rbf', gamma='auto', C=1): """The class constructor :param df_path: full path to the input roi Da...
stack_v2_sparse_classes_75kplus_train_070494
6,767
no_license
[ { "docstring": "The class constructor :param df_path: full path to the input roi DataFrame file (e.g. ../data/roi/roidf.h5) :param image_col_name: column name for the image data column :param category_col_name: column name for the image category (negative or positive) column :param fixed_size: 2x1 matrix contai...
3
stack_v2_sparse_classes_30k_train_024632
Implement the Python class `train_classifier` described below. Class description: Implement the train_classifier class. Method signatures and docstrings: - def __init__(self, df_path, image_col_name, category_col_name, fixed_size, classifier_pkl, feature_method, feature_options, image_processing_options, raw_image_pa...
Implement the Python class `train_classifier` described below. Class description: Implement the train_classifier class. Method signatures and docstrings: - def __init__(self, df_path, image_col_name, category_col_name, fixed_size, classifier_pkl, feature_method, feature_options, image_processing_options, raw_image_pa...
bbe858777fa043add1290adf56f213597bf7e44b
<|skeleton|> class train_classifier: def __init__(self, df_path, image_col_name, category_col_name, fixed_size, classifier_pkl, feature_method, feature_options, image_processing_options, raw_image_path, kernel='rbf', gamma='auto', C=1): """The class constructor :param df_path: full path to the input roi Da...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class train_classifier: def __init__(self, df_path, image_col_name, category_col_name, fixed_size, classifier_pkl, feature_method, feature_options, image_processing_options, raw_image_path, kernel='rbf', gamma='auto', C=1): """The class constructor :param df_path: full path to the input roi DataFrame file (...
the_stack_v2_python_sparse
2018_data_science_bowl/scripts/train_svm_classifier.py
laijasonk/kaggle
train
1
e316af4427639441ed2116da2deb81f2b19918eb
[ "data = self.get_json()\nname = data.get('galaxyName')\nif name is None:\n return self.error('galaxyName required to set object host')\nwith self.Session() as session:\n obj = session.scalars(Obj.select(session.user_or_token, mode='update').where(Obj.id == obj_id)).first()\n if obj is None:\n return...
<|body_start_0|> data = self.get_json() name = data.get('galaxyName') if name is None: return self.error('galaxyName required to set object host') with self.Session() as session: obj = session.scalars(Obj.select(session.user_or_token, mode='update').where(Obj.id =...
ObjHostHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string descrip...
stack_v2_sparse_classes_75kplus_train_070495
41,985
permissive
[ { "docstring": "--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string description: | Name of the galaxy to associate with the ob...
2
stack_v2_sparse_classes_30k_train_019917
Implement the Python class `ObjHostHandler` described below. Class description: Implement the ObjHostHandler class. Method signatures and docstrings: - def post(self, obj_id): --- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string re...
Implement the Python class `ObjHostHandler` described below. Class description: Implement the ObjHostHandler class. Method signatures and docstrings: - def post(self, obj_id): --- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string re...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string descrip...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjHostHandler: def post(self, obj_id): """--- description: Set an object's host galaxy tags: - objs - galaxys parameters: - in: path name: obj_id required: true schema: type: string requestBody: content: application/json: schema: type: object properties: galaxyName: type: string description: | Name o...
the_stack_v2_python_sparse
skyportal/handlers/api/galaxy.py
skyportal/skyportal
train
80
a164b4fa59a69e1154a25238695a2d4c0fc69a16
[ "self.__domain = domainName\nself.__kdcHost = serverIP\nself.__domainUsers = domainusers\nself.__sprayPassword = sprayPassword\nself.DomainUserRequest()", "domain = '@' + self.__domain\nfor user in self.__domainUsers:\n targetuser = user + domain\n self.AttackToTarget(targetuser)", "self.__sprayusers = []...
<|body_start_0|> self.__domain = domainName self.__kdcHost = serverIP self.__domainUsers = domainusers self.__sprayPassword = sprayPassword self.DomainUserRequest() <|end_body_0|> <|body_start_1|> domain = '@' + self.__domain for user in self.__domainUsers: ...
PasswordSPRAY
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PasswordSPRAY: def AttackArguments(self, serverIP, domainusers, sprayPassword, domainName): """Spray Attack Arguments""" <|body_0|> def DomainUserRequest(self): """Pars to Domain""" <|body_1|> def AttackToTarget(self, username): """Attack Part"""...
stack_v2_sparse_classes_75kplus_train_070496
1,067
permissive
[ { "docstring": "Spray Attack Arguments", "name": "AttackArguments", "signature": "def AttackArguments(self, serverIP, domainusers, sprayPassword, domainName)" }, { "docstring": "Pars to Domain", "name": "DomainUserRequest", "signature": "def DomainUserRequest(self)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_035887
Implement the Python class `PasswordSPRAY` described below. Class description: Implement the PasswordSPRAY class. Method signatures and docstrings: - def AttackArguments(self, serverIP, domainusers, sprayPassword, domainName): Spray Attack Arguments - def DomainUserRequest(self): Pars to Domain - def AttackToTarget(s...
Implement the Python class `PasswordSPRAY` described below. Class description: Implement the PasswordSPRAY class. Method signatures and docstrings: - def AttackArguments(self, serverIP, domainusers, sprayPassword, domainName): Spray Attack Arguments - def DomainUserRequest(self): Pars to Domain - def AttackToTarget(s...
92263ea73bd2eaa2081fb277c76aa229103a1d54
<|skeleton|> class PasswordSPRAY: def AttackArguments(self, serverIP, domainusers, sprayPassword, domainName): """Spray Attack Arguments""" <|body_0|> def DomainUserRequest(self): """Pars to Domain""" <|body_1|> def AttackToTarget(self, username): """Attack Part"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PasswordSPRAY: def AttackArguments(self, serverIP, domainusers, sprayPassword, domainName): """Spray Attack Arguments""" self.__domain = domainName self.__kdcHost = serverIP self.__domainUsers = domainusers self.__sprayPassword = sprayPassword self.DomainUserReq...
the_stack_v2_python_sparse
pentestui/pentest_api/enumeration/ldap/spray/sprayattack.py
mustgundogdu/PentestUI
train
31
a50be3966194211bd56a985baecdfdcfae6e9d99
[ "try:\n object_list = persistent_query_example_api.get_all_by_user(request.user)\n serializer = self.serializer(object_list, many=True)\n return Response(serializer.data, status=status.HTTP_200_OK)\nexcept AccessControlError as exception:\n content = {'message': str(exception)}\n return Response(cont...
<|body_start_0|> try: object_list = persistent_query_example_api.get_all_by_user(request.user) serializer = self.serializer(object_list, many=True) return Response(serializer.data, status=status.HTTP_200_OK) except AccessControlError as exception: content ...
List all persistent query example or create one
PersistentQueryExampleList
[ "NIST-Software", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersistentQueryExampleList: """List all persistent query example or create one""" def get(self, request): """Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - code: 500 con...
stack_v2_sparse_classes_75kplus_train_070497
13,206
permissive
[ { "docstring": "Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - code: 500 content: Internal server error", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Cre...
2
stack_v2_sparse_classes_30k_test_000259
Implement the Python class `PersistentQueryExampleList` described below. Class description: List all persistent query example or create one Method signatures and docstrings: - def get(self, request): Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent que...
Implement the Python class `PersistentQueryExampleList` described below. Class description: List all persistent query example or create one Method signatures and docstrings: - def get(self, request): Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent que...
2abebfd1c2319899d907ad0b650fedb955be7492
<|skeleton|> class PersistentQueryExampleList: """List all persistent query example or create one""" def get(self, request): """Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - code: 500 con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PersistentQueryExampleList: """List all persistent query example or create one""" def get(self, request): """Get all user persistent query example Args: request: HTTP request Returns: - code: 200 content: List of persistent query example - code: 403 content: Forbidden - code: 500 content: Interna...
the_stack_v2_python_sparse
core_explore_example_app/rest/persistent_query_example/views.py
usnistgov/core_explore_example_app
train
0
a1bf59e97e61330f0ba7c69e348c15ff7727b4be
[ "def backtrack(start, track):\n if sum(track) == n and len(track) == k:\n return res.append(track[:])\n if sum(track) > n or len(track) > k:\n return\n for i in range(start, 10):\n track.append(i)\n backtrack(i + 1, track)\n track.pop()\nres = []\nif n <= 0 or k <= 0:\n ...
<|body_start_0|> def backtrack(start, track): if sum(track) == n and len(track) == k: return res.append(track[:]) if sum(track) > n or len(track) > k: return for i in range(start, 10): track.append(i) backtrack(i...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: """k 限制了树的高度,n 限制了树的宽度。""" <|body_0|> def combinationSum3_1(self, k: int, n: int) -> List[List[int]]: """k 限制了树的高度,n 限制了树的宽度。""" <|body_1|> <|end_skeleton|> <|body_start_0|> def...
stack_v2_sparse_classes_75kplus_train_070498
2,352
permissive
[ { "docstring": "k 限制了树的高度,n 限制了树的宽度。", "name": "combinationSum3", "signature": "def combinationSum3(self, k: int, n: int) -> List[List[int]]" }, { "docstring": "k 限制了树的高度,n 限制了树的宽度。", "name": "combinationSum3_1", "signature": "def combinationSum3_1(self, k: int, n: int) -> List[List[int]...
2
stack_v2_sparse_classes_30k_train_039760
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum3(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。 - def combinationSum3_1(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum3(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。 - def combinationSum3_1(self, k: int, n: int) -> List[List[int]]: k 限制了树的高度,n 限制了树的宽度。 <|skele...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: """k 限制了树的高度,n 限制了树的宽度。""" <|body_0|> def combinationSum3_1(self, k: int, n: int) -> List[List[int]]: """k 限制了树的高度,n 限制了树的宽度。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def combinationSum3(self, k: int, n: int) -> List[List[int]]: """k 限制了树的高度,n 限制了树的宽度。""" def backtrack(start, track): if sum(track) == n and len(track) == k: return res.append(track[:]) if sum(track) > n or len(track) > k: retur...
the_stack_v2_python_sparse
216-combination-sum-iii.py
yuenliou/leetcode
train
0
e6c7f349891e6fefbb3f91a45dc7b4737e5fb989
[ "self.dataset = dataset[dataset['listingtype'] == 'sold']\nself.target_var = target_var\nself.cont_num_columns = cont_num_columns\nself.discrete_num_columns = discrete_num_columns\nself.nominal_cat_columns = nominal_cat_columns\nself.verbose_columns = verbose_columns\nself.verbose_threshold = verbose_threshold\nsel...
<|body_start_0|> self.dataset = dataset[dataset['listingtype'] == 'sold'] self.target_var = target_var self.cont_num_columns = cont_num_columns self.discrete_num_columns = discrete_num_columns self.nominal_cat_columns = nominal_cat_columns self.verbose_columns = verbose_c...
ModelInputETL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelInputETL: def __init__(self, dataset, target_var='', cont_num_columns=[], discrete_num_columns=[], nominal_cat_columns=[], verbose_columns=[], verbose_threshold=[], verbose_most_common=[], pca_columns=[], pca_expl_var=0.95, operation='model'): """Create Features from Raw Data.""" ...
stack_v2_sparse_classes_75kplus_train_070499
2,994
no_license
[ { "docstring": "Create Features from Raw Data.", "name": "__init__", "signature": "def __init__(self, dataset, target_var='', cont_num_columns=[], discrete_num_columns=[], nominal_cat_columns=[], verbose_columns=[], verbose_threshold=[], verbose_most_common=[], pca_columns=[], pca_expl_var=0.95, operati...
2
stack_v2_sparse_classes_30k_train_053903
Implement the Python class `ModelInputETL` described below. Class description: Implement the ModelInputETL class. Method signatures and docstrings: - def __init__(self, dataset, target_var='', cont_num_columns=[], discrete_num_columns=[], nominal_cat_columns=[], verbose_columns=[], verbose_threshold=[], verbose_most_...
Implement the Python class `ModelInputETL` described below. Class description: Implement the ModelInputETL class. Method signatures and docstrings: - def __init__(self, dataset, target_var='', cont_num_columns=[], discrete_num_columns=[], nominal_cat_columns=[], verbose_columns=[], verbose_threshold=[], verbose_most_...
721e1a2fca36c378206462a36cecc9f403d11c86
<|skeleton|> class ModelInputETL: def __init__(self, dataset, target_var='', cont_num_columns=[], discrete_num_columns=[], nominal_cat_columns=[], verbose_columns=[], verbose_threshold=[], verbose_most_common=[], pca_columns=[], pca_expl_var=0.95, operation='model'): """Create Features from Raw Data.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelInputETL: def __init__(self, dataset, target_var='', cont_num_columns=[], discrete_num_columns=[], nominal_cat_columns=[], verbose_columns=[], verbose_threshold=[], verbose_most_common=[], pca_columns=[], pca_expl_var=0.95, operation='model'): """Create Features from Raw Data.""" self.dat...
the_stack_v2_python_sparse
DeepREI/Model/src/preprocessing/ModelInputETL.py
dangoML/Project-Portfolio
train
5