blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
543dadfc2ac4efbea7de63620013b771b4ad04ff
[ "super().__init__()\nself.embed_size = embed_size\nself.no_imgnorm = no_imgnorm\nself.cnn = self.get_cnn(cnn_type)\nfor param in self.cnn.parameters():\n param.requires_grad = finetune\nif cnn_type.startswith('vgg'):\n self.fc = nn.Linear(self.cnn.classifier._modules['6'].in_features, embed_size)\n self.cn...
<|body_start_0|> super().__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm self.cnn = self.get_cnn(cnn_type) for param in self.cnn.parameters(): param.requires_grad = finetune if cnn_type.startswith('vgg'): self.fc = nn.Linear(se...
EncoderImage
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderImage: def __init__(self, embed_size, finetune=False, cnn_type='resnet152', no_imgnorm=False): """Load pretrained CNN and replace top fc layer.""" <|body_0|> def get_cnn(self, arch): """Load a pretrained CNN and parallelize over GPUs""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_016600
6,876
permissive
[ { "docstring": "Load pretrained CNN and replace top fc layer.", "name": "__init__", "signature": "def __init__(self, embed_size, finetune=False, cnn_type='resnet152', no_imgnorm=False)" }, { "docstring": "Load a pretrained CNN and parallelize over GPUs", "name": "get_cnn", "signature": "...
4
null
Implement the Python class `EncoderImage` described below. Class description: Implement the EncoderImage class. Method signatures and docstrings: - def __init__(self, embed_size, finetune=False, cnn_type='resnet152', no_imgnorm=False): Load pretrained CNN and replace top fc layer. - def get_cnn(self, arch): Load a pr...
Implement the Python class `EncoderImage` described below. Class description: Implement the EncoderImage class. Method signatures and docstrings: - def __init__(self, embed_size, finetune=False, cnn_type='resnet152', no_imgnorm=False): Load pretrained CNN and replace top fc layer. - def get_cnn(self, arch): Load a pr...
ccf60824b28f0ce8ceda44a7ce52a0d117669115
<|skeleton|> class EncoderImage: def __init__(self, embed_size, finetune=False, cnn_type='resnet152', no_imgnorm=False): """Load pretrained CNN and replace top fc layer.""" <|body_0|> def get_cnn(self, arch): """Load a pretrained CNN and parallelize over GPUs""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderImage: def __init__(self, embed_size, finetune=False, cnn_type='resnet152', no_imgnorm=False): """Load pretrained CNN and replace top fc layer.""" super().__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm self.cnn = self.get_cnn(cnn_type) ...
the_stack_v2_python_sparse
ParlAI/parlai/agents/vsepp_caption/modules.py
ethanjperez/convince
train
27
6350c642e2d4f8229cc9fec6de3f481854a5fb18
[ "self.currow = row\nself.curcol = col\nself.m_dPreSoilW = gSoil_GridLayerPara.SP_Sw[row][col]\nself.m_dERR = dErr\nself.m_dK = gSoil_GridLayerPara.Horton_K[self.currow][self.curcol]\nself.m_dF0 = gSoil_GridLayerPara.SP_Init_F0[self.currow][self.curcol]\nself.m_dFc = gSoil_GridLayerPara.SP_Stable_Fc[self.currow][sel...
<|body_start_0|> self.currow = row self.curcol = col self.m_dPreSoilW = gSoil_GridLayerPara.SP_Sw[row][col] self.m_dERR = dErr self.m_dK = gSoil_GridLayerPara.Horton_K[self.currow][self.curcol] self.m_dF0 = gSoil_GridLayerPara.SP_Init_F0[self.currow][self.curcol] ...
CHortonInfil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CHortonInfil: def SetGridPara(self, row, col, dErr): """设置参数 :param dSoilW: :param dErr: :return:""" <|body_0|> def HortonExcessRunoff(self): """计算霍顿超渗产流 :return:""" <|body_1|> def DTempSoilW(self, dt): """求时段dt下的土壤含水量变化 :param dt: :return:""" ...
stack_v2_sparse_classes_36k_train_016601
2,737
no_license
[ { "docstring": "设置参数 :param dSoilW: :param dErr: :return:", "name": "SetGridPara", "signature": "def SetGridPara(self, row, col, dErr)" }, { "docstring": "计算霍顿超渗产流 :return:", "name": "HortonExcessRunoff", "signature": "def HortonExcessRunoff(self)" }, { "docstring": "求时段dt下的土壤含水量...
3
stack_v2_sparse_classes_30k_train_019337
Implement the Python class `CHortonInfil` described below. Class description: Implement the CHortonInfil class. Method signatures and docstrings: - def SetGridPara(self, row, col, dErr): 设置参数 :param dSoilW: :param dErr: :return: - def HortonExcessRunoff(self): 计算霍顿超渗产流 :return: - def DTempSoilW(self, dt): 求时段dt下的土壤含水...
Implement the Python class `CHortonInfil` described below. Class description: Implement the CHortonInfil class. Method signatures and docstrings: - def SetGridPara(self, row, col, dErr): 设置参数 :param dSoilW: :param dErr: :return: - def HortonExcessRunoff(self): 计算霍顿超渗产流 :return: - def DTempSoilW(self, dt): 求时段dt下的土壤含水...
d66012113af9b4ec2f1568373dabd94793b2ee20
<|skeleton|> class CHortonInfil: def SetGridPara(self, row, col, dErr): """设置参数 :param dSoilW: :param dErr: :return:""" <|body_0|> def HortonExcessRunoff(self): """计算霍顿超渗产流 :return:""" <|body_1|> def DTempSoilW(self, dt): """求时段dt下的土壤含水量变化 :param dt: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CHortonInfil: def SetGridPara(self, row, col, dErr): """设置参数 :param dSoilW: :param dErr: :return:""" self.currow = row self.curcol = col self.m_dPreSoilW = gSoil_GridLayerPara.SP_Sw[row][col] self.m_dERR = dErr self.m_dK = gSoil_GridLayerPara.Horton_K[self.curro...
the_stack_v2_python_sparse
modules/Hydro/HortonInfil.py
PyESSI/PyESSI
train
7
4bdeacfde74fcf6ff7248f6d76e0fbbe92650b71
[ "cidr_range_string = self.tcex.playbook.read(self.args.cidr_range)\nself.cidr = ipaddress.ip_network(cidr_range_string)\nself.exit_message = 'CIDR Range details gathered and delivered.'", "self.tcex.log.info('Writing Output')\nself.tcex.playbook.create_output('cidr.addressCount', self.cidr.num_addresses, 'String'...
<|body_start_0|> cidr_range_string = self.tcex.playbook.read(self.args.cidr_range) self.cidr = ipaddress.ip_network(cidr_range_string) self.exit_message = 'CIDR Range details gathered and delivered.' <|end_body_0|> <|body_start_1|> self.tcex.log.info('Writing Output') self.tcex....
Playbook App
App
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """Playbook App""" def run(self): """Run the App main logic. This method should contain the core logic of the App.""" <|body_0|> def write_output(self): """Write the Playbook output variables. This method should be overridden with the output variables define...
stack_v2_sparse_classes_36k_train_016602
1,364
permissive
[ { "docstring": "Run the App main logic. This method should contain the core logic of the App.", "name": "run", "signature": "def run(self)" }, { "docstring": "Write the Playbook output variables. This method should be overridden with the output variables defined in the install.json configuration...
2
null
Implement the Python class `App` described below. Class description: Playbook App Method signatures and docstrings: - def run(self): Run the App main logic. This method should contain the core logic of the App. - def write_output(self): Write the Playbook output variables. This method should be overridden with the ou...
Implement the Python class `App` described below. Class description: Playbook App Method signatures and docstrings: - def run(self): Run the App main logic. This method should contain the core logic of the App. - def write_output(self): Write the Playbook output variables. This method should be overridden with the ou...
0f2e6a2d1c71f104b1522fd68ec01b9f9f3b92f9
<|skeleton|> class App: """Playbook App""" def run(self): """Run the App main logic. This method should contain the core logic of the App.""" <|body_0|> def write_output(self): """Write the Playbook output variables. This method should be overridden with the output variables define...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class App: """Playbook App""" def run(self): """Run the App main logic. This method should contain the core logic of the App.""" cidr_range_string = self.tcex.playbook.read(self.args.cidr_range) self.cidr = ipaddress.ip_network(cidr_range_string) self.exit_message = 'CIDR Range ...
the_stack_v2_python_sparse
apps/TCPB_-_CIDR_Range_Utility/app.py
ThreatConnect-Inc/threatconnect-playbooks
train
76
44e8df121e660a6ff82b3470bc3f1e53cdd35dc4
[ "self.xhat = x_init\nself.xhatd = x_dinit\nself.alpha = alpha\nself.beta = beta\nself.prev_time = 0.0", "y = self.xhatd + self.alpha * (zk - self.xhat - self.xhatd)\nyd = self.beta * (y - self.xhatd)\nself.xhat = self.xhat + y\nself.xhatd = self.xhatd + yd\nreturn (self.xhat, self.xhatd)" ]
<|body_start_0|> self.xhat = x_init self.xhatd = x_dinit self.alpha = alpha self.beta = beta self.prev_time = 0.0 <|end_body_0|> <|body_start_1|> y = self.xhatd + self.alpha * (zk - self.xhat - self.xhatd) yd = self.beta * (y - self.xhatd) self.xhat = sel...
@brief Exponentially weighted moving average
Ewma
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ewma: """@brief Exponentially weighted moving average""" def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): """@brief initialise Ewma filter for single data point @param x_init initial guess""" <|body_0|> def filter(self, zk, t): """@brief filter f...
stack_v2_sparse_classes_36k_train_016603
1,929
no_license
[ { "docstring": "@brief initialise Ewma filter for single data point @param x_init initial guess", "name": "__init__", "signature": "def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1)" }, { "docstring": "@brief filter for one time step @param zk sensor value @param t time that measu...
2
stack_v2_sparse_classes_30k_val_000389
Implement the Python class `Ewma` described below. Class description: @brief Exponentially weighted moving average Method signatures and docstrings: - def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): @brief initialise Ewma filter for single data point @param x_init initial guess - def filter(self, zk...
Implement the Python class `Ewma` described below. Class description: @brief Exponentially weighted moving average Method signatures and docstrings: - def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): @brief initialise Ewma filter for single data point @param x_init initial guess - def filter(self, zk...
791692cc8a158446c0702f006890820c2019f668
<|skeleton|> class Ewma: """@brief Exponentially weighted moving average""" def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): """@brief initialise Ewma filter for single data point @param x_init initial guess""" <|body_0|> def filter(self, zk, t): """@brief filter f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ewma: """@brief Exponentially weighted moving average""" def __init__(self, x_init=0.0, x_dinit=0.0, alpha=0.1, beta=0.1): """@brief initialise Ewma filter for single data point @param x_init initial guess""" self.xhat = x_init self.xhatd = x_dinit self.alpha = alpha ...
the_stack_v2_python_sparse
tos/Node/Filters/DEWMA/python/dewma.py
jbrusey/cogent-house
train
4
681706c9b63dfeea3a60d738a3f91124a7691063
[ "super().__init__(**kwargs)\nself._model_directory = self._options['model_directory']\nself._half_precision_model = self._options.get('half_precision_model', False)\nself._model = BertModel.from_pretrained(self._model_directory)\nif self._half_precision_model:\n self._model = self._model.half()\nself._model = se...
<|body_start_0|> super().__init__(**kwargs) self._model_directory = self._options['model_directory'] self._half_precision_model = self._options.get('half_precision_model', False) self._model = BertModel.from_pretrained(self._model_directory) if self._half_precision_model: ...
ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225
ProtTransBertBFDEmbedder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtTransBertBFDEmbedder: """ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225"...
stack_v2_sparse_classes_36k_train_016604
1,793
permissive
[ { "docstring": "Initialize Bert embedder. :param model_directory: :param half_precision_model:", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Returns the CPU model", "name": "_get_fallback_model", "signature": "def _get_fallback_model(self) -> BertMo...
2
stack_v2_sparse_classes_30k_test_001162
Implement the Python class `ProtTransBertBFDEmbedder` described below. Class description: ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2...
Implement the Python class `ProtTransBertBFDEmbedder` described below. Class description: ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2...
efb9801f0de9b9d51d19b741088763a7d2d0c3a2
<|skeleton|> class ProtTransBertBFDEmbedder: """ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtTransBertBFDEmbedder: """ProtTrans-Bert-BFD Embedder (ProtBert-BFD) Elnaggar, Ahmed, et al. "ProtTrans: Towards Cracking the Language of Life's Code Through Self-Supervised Deep Learning and High Performance Computing." arXiv preprint arXiv:2007.06225 (2020). https://arxiv.org/abs/2007.06225""" def _...
the_stack_v2_python_sparse
bio_embeddings/embed/prottrans_bert_bfd_embedder.py
sacdallago/bio_embeddings
train
383
6b5f6d06cdcfac2a34d2d4fed26c2f172dbb803a
[ "consecutive = False\nstart = 0\nmaxnumber = 0\nfor i in range(len(nums)):\n if nums[i] == 1 and (not consecutive):\n start = i\n consecutive = True\n elif nums[i] == 1 and consecutive:\n continue\n elif nums[i] != 1 and consecutive:\n consecutive = False\n maxnumber = ma...
<|body_start_0|> consecutive = False start = 0 maxnumber = 0 for i in range(len(nums)): if nums[i] == 1 and (not consecutive): start = i consecutive = True elif nums[i] == 1 and consecutive: continue elif...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMaxConsecutiveOnes_eash(self, nums): """time O(n) space O(1) :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> consecuti...
stack_v2_sparse_classes_36k_train_016605
1,254
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findMaxConsecutiveOnes", "signature": "def findMaxConsecutiveOnes(self, nums)" }, { "docstring": "time O(n) space O(1) :param nums: :return:", "name": "findMaxConsecutiveOnes_eash", "signature": "def findMaxConsecutiveOnes_eash...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int - def findMaxConsecutiveOnes_eash(self, nums): time O(n) space O(1) :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int - def findMaxConsecutiveOnes_eash(self, nums): time O(n) space O(1) :param nums: :return: <|skeleton|> ...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMaxConsecutiveOnes_eash(self, nums): """time O(n) space O(1) :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxConsecutiveOnes(self, nums): """:type nums: List[int] :rtype: int""" consecutive = False start = 0 maxnumber = 0 for i in range(len(nums)): if nums[i] == 1 and (not consecutive): start = i consecutive = Tr...
the_stack_v2_python_sparse
LeetCode/Array/485_max_consecutive_ones.py
XyK0907/for_work
train
0
82fe6c87cf83102cdfd1210d66201176e4acd41b
[ "if n < 3:\n return n\none_step_before, two_steps_before = (2, 1)\nall_ways = 0\nfor _ in range(3, n + 1):\n all_ways = one_step_before + two_steps_before\n two_steps_before = one_step_before\n one_step_before = all_ways\nreturn all_ways", "dp = [0] * (n + 1)\ndp[0] = 1\nwhile True:\n dp2 = [0] * (...
<|body_start_0|> if n < 3: return n one_step_before, two_steps_before = (2, 1) all_ways = 0 for _ in range(3, n + 1): all_ways = one_step_before + two_steps_before two_steps_before = one_step_before one_step_before = all_ways return...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 3: return n one_step_before, two_steps_be...
stack_v2_sparse_classes_36k_train_016606
945
permissive
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs2", "signature": "def climbStairs2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_015663
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def climbStairs(self, n): """:...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" if n < 3: return n one_step_before, two_steps_before = (2, 1) all_ways = 0 for _ in range(3, n + 1): all_ways = one_step_before + two_steps_before two_steps_before = o...
the_stack_v2_python_sparse
1-100/61-70/70-climbingStairs/climbingStairs.py
xuychen/Leetcode
train
0
65025ea88ff837003cb63347231f4644b40a2846
[ "if isinstance(instances, Dict):\n payloads = self._generate_payloads(instances=instances)\nelif isinstance(instances, List):\n payloads = instances\nelse:\n instances_dict = instances.to_dict(orient='index')\n payloads = self._generate_payloads(instances=instances_dict)\n_LOGGER.log_action_start_agains...
<|body_start_0|> if isinstance(instances, Dict): payloads = self._generate_payloads(instances=instances) elif isinstance(instances, List): payloads = instances else: instances_dict = instances.to_dict(orient='index') payloads = self._generate_paylo...
Preview EntityType resource for Vertex AI.
EntityType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityType: """Preview EntityType resource for Vertex AI.""" def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float, bool, bytes, List[int], List[str], List[float], List[bool]]]], 'pd....
stack_v2_sparse_classes_36k_train_016607
10,796
permissive
[ { "docstring": "Streaming ingestion. Write feature values directly to Feature Store. ``` my_entity_type = aiplatform.EntityType( entity_type_name=\"my_entity_type_id\", featurestore_id=\"my_featurestore_id\", ) # writing feature values from a pandas DataFrame my_dataframe = pd.DataFrame( data = [ {\"entity_id\"...
3
null
Implement the Python class `EntityType` described below. Class description: Preview EntityType resource for Vertex AI. Method signatures and docstrings: - def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float,...
Implement the Python class `EntityType` described below. Class description: Preview EntityType resource for Vertex AI. Method signatures and docstrings: - def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float,...
76b95b92c1d3b87c72d754d8c02b1bca652b9a27
<|skeleton|> class EntityType: """Preview EntityType resource for Vertex AI.""" def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float, bool, bytes, List[int], List[str], List[float], List[bool]]]], 'pd....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntityType: """Preview EntityType resource for Vertex AI.""" def write_feature_values(self, instances: Union[List[gca_featurestore_online_service_v1beta1.WriteFeatureValuesPayload], Dict[str, Dict[str, Union[int, str, float, bool, bytes, List[int], List[str], List[float], List[bool]]]], 'pd.DataFrame']) ...
the_stack_v2_python_sparse
google/cloud/aiplatform/preview/featurestore/entity_type.py
googleapis/python-aiplatform
train
418
66fdc1d61084f0a1c603a0c8b9faf90c89879b49
[ "default = super(Widget, self).default or u''\nif six.PY2:\n if isinstance(default, six.text_type):\n default = default.encode('utf-8')\nreturn default", "query = {}\nindex = self.data.get('index', '')\nif six.PY2:\n index = index.encode('utf-8', 'replace')\nif not index:\n return query\nif self.h...
<|body_start_0|> default = super(Widget, self).default or u'' if six.PY2: if isinstance(default, six.text_type): default = default.encode('utf-8') return default <|end_body_0|> <|body_start_1|> query = {} index = self.data.get('index', '') if ...
Widget
Widget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Widget: """Widget""" def default(self): """Get default values""" <|body_0|> def query(self, form): """Get value from form and return a catalog dict query""" <|body_1|> <|end_skeleton|> <|body_start_0|> default = super(Widget, self).default or u'...
stack_v2_sparse_classes_36k_train_016608
1,594
no_license
[ { "docstring": "Get default values", "name": "default", "signature": "def default(self)" }, { "docstring": "Get value from form and return a catalog dict query", "name": "query", "signature": "def query(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_001970
Implement the Python class `Widget` described below. Class description: Widget Method signatures and docstrings: - def default(self): Get default values - def query(self, form): Get value from form and return a catalog dict query
Implement the Python class `Widget` described below. Class description: Widget Method signatures and docstrings: - def default(self): Get default values - def query(self, form): Get value from form and return a catalog dict query <|skeleton|> class Widget: """Widget""" def default(self): """Get defa...
a833b2e5257da35786f21916e279f8b1082b2faa
<|skeleton|> class Widget: """Widget""" def default(self): """Get default values""" <|body_0|> def query(self, form): """Get value from form and return a catalog dict query""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Widget: """Widget""" def default(self): """Get default values""" default = super(Widget, self).default or u'' if six.PY2: if isinstance(default, six.text_type): default = default.encode('utf-8') return default def query(self, form): ...
the_stack_v2_python_sparse
agsci/common/facetednavigation/widgets/select/widget.py
tsimkins/agsci.common
train
0
f41125a2ac34df5bb5615a2bb395825d7c2325ba
[ "super(Exhaust, self).__init__()\nself.enh_lib = enhancement\nself.enh = None\nself.T_ref = 300.0\nself.P = 101.0\nself.height = 0.015\nself.ducts = 1\nself.sides = 2\nself.mdot_omega = 0.2 / 60.0\nself.Nu_coeff = 0.023\nfunctions.bind_functions(self)", "self.set_thermal_props()\nself.c_p = self.c_p_air\nself.k =...
<|body_start_0|> super(Exhaust, self).__init__() self.enh_lib = enhancement self.enh = None self.T_ref = 300.0 self.P = 101.0 self.height = 0.015 self.ducts = 1 self.sides = 2 self.mdot_omega = 0.2 / 60.0 self.Nu_coeff = 0.023 funct...
Class for engine exhaust in heat exchanger. Methods: __init__ set_fluid_props
Exhaust
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exhaust: """Class for engine exhaust in heat exchanger. Methods: __init__ set_fluid_props""" def __init__(self): """Sets a bunch of constants, binds methods, inits parent class self.enh_lib = enhancement - Used in hx.py Also initializes super class, which is ideal_gas from the proper...
stack_v2_sparse_classes_36k_train_016609
1,302
no_license
[ { "docstring": "Sets a bunch of constants, binds methods, inits parent class self.enh_lib = enhancement - Used in hx.py Also initializes super class, which is ideal_gas from the properties script. I keep this script in ~/Documents/Python, which is part of my python path.", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_train_015495
Implement the Python class `Exhaust` described below. Class description: Class for engine exhaust in heat exchanger. Methods: __init__ set_fluid_props Method signatures and docstrings: - def __init__(self): Sets a bunch of constants, binds methods, inits parent class self.enh_lib = enhancement - Used in hx.py Also in...
Implement the Python class `Exhaust` described below. Class description: Class for engine exhaust in heat exchanger. Methods: __init__ set_fluid_props Method signatures and docstrings: - def __init__(self): Sets a bunch of constants, binds methods, inits parent class self.enh_lib = enhancement - Used in hx.py Also in...
d619b66b1f16557e06c94eee1c16d4ee2a9e896a
<|skeleton|> class Exhaust: """Class for engine exhaust in heat exchanger. Methods: __init__ set_fluid_props""" def __init__(self): """Sets a bunch of constants, binds methods, inits parent class self.enh_lib = enhancement - Used in hx.py Also initializes super class, which is ideal_gas from the proper...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Exhaust: """Class for engine exhaust in heat exchanger. Methods: __init__ set_fluid_props""" def __init__(self): """Sets a bunch of constants, binds methods, inits parent class self.enh_lib = enhancement - Used in hx.py Also initializes super class, which is ideal_gas from the properties script. ...
the_stack_v2_python_sparse
Modules/exhaust.py
hfateh/TE_Model-1
train
0
7ea6370b1742e6548730d695664e5dbbc1be4319
[ "self.nums = deque()\nself.size = size\nself.total = 0", "if not self.nums:\n self.nums.append(val)\n return val\nif len(self.nums) == self.size:\n self.total -= self.nums.popleft()\nself.total += val\nself.nums.append(val)\nreturn self.total / len(self.nums) * 1.0" ]
<|body_start_0|> self.nums = deque() self.size = size self.total = 0 <|end_body_0|> <|body_start_1|> if not self.nums: self.nums.append(val) return val if len(self.nums) == self.size: self.total -= self.nums.popleft() self.total += val...
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nums = deque() self.size...
stack_v2_sparse_classes_36k_train_016610
1,108
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
null
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
2df1a58aa9474f2ecec2ee7c45ebf12466181391
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.nums = deque() self.size = size self.total = 0 def next(self, val): """:type val: int :rtype: float""" if not self.nums: self.nums.append(va...
the_stack_v2_python_sparse
MovingAverageFromDataStream.py
zjuzpz/Algorithms
train
2
b46c3a2472f3607032461201875163ad77526868
[ "super().__init__(cost_multiplier=cost_multiplier)\nself.state_count = target_states.shape[0]\nself.step_count = step_count\nself.target_states_dagger = conjugate_transpose(anp.stack(target_states))", "fidelity = anp.sum(anp.square(anp.abs(anp.matmul(self.target_states_dagger, states)[:, 0, 0])), axis=0)\nfidelit...
<|body_start_0|> super().__init__(cost_multiplier=cost_multiplier) self.state_count = target_states.shape[0] self.step_count = step_count self.target_states_dagger = conjugate_transpose(anp.stack(target_states)) <|end_body_0|> <|body_start_1|> fidelity = anp.sum(anp.square(anp.a...
a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the gradient of the cost function with respect to the para...
TargetStateInfidelityTime
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TargetStateInfidelityTime: """a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the g...
stack_v2_sparse_classes_36k_train_016611
3,824
permissive
[ { "docstring": "See class definition for parameter specification. target_states :: numpy.ndarray - an array of states that correspond to the target state for each of the initial states used in optimization", "name": "__init__", "signature": "def __init__(self, step_count, target_states, cost_multiplier=...
2
stack_v2_sparse_classes_30k_train_012547
Implement the Python class `TargetStateInfidelityTime` described below. Class description: a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) ->...
Implement the Python class `TargetStateInfidelityTime` described below. Class description: a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) ->...
64c1eed34c9a4200a01a7152932482a29a1fd89e
<|skeleton|> class TargetStateInfidelityTime: """a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TargetStateInfidelityTime: """a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the gradient of th...
the_stack_v2_python_sparse
qoc/standard/costs/targetstateinfidelitytime.py
jmbaker94/qoc
train
0
c66eec7d32b605db63d129c9d5907f35ec1c1268
[ "self.is_up_metric = True\nself.metric = Gauge('mssql_up', 'MsSQL exporter UP status', labelnames=['server', 'port'], registry=registry)\nsuper().__init__()", "with app.app_context():\n if db_util.is_port_open():\n self.metric.labels(server=db_util.get_server(), port=db_util.get_port()).set(1)\n ...
<|body_start_0|> self.is_up_metric = True self.metric = Gauge('mssql_up', 'MsSQL exporter UP status', labelnames=['server', 'port'], registry=registry) super().__init__() <|end_body_0|> <|body_start_1|> with app.app_context(): if db_util.is_port_open(): self....
Up
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Up: def __init__(self, registry): """Initialize query and metrics""" <|body_0|> def collect(self, app): """Collect from the query result :param rows: query result :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.is_up_metric = True ...
stack_v2_sparse_classes_36k_train_016612
1,182
permissive
[ { "docstring": "Initialize query and metrics", "name": "__init__", "signature": "def __init__(self, registry)" }, { "docstring": "Collect from the query result :param rows: query result :return:", "name": "collect", "signature": "def collect(self, app)" } ]
2
stack_v2_sparse_classes_30k_train_020458
Implement the Python class `Up` described below. Class description: Implement the Up class. Method signatures and docstrings: - def __init__(self, registry): Initialize query and metrics - def collect(self, app): Collect from the query result :param rows: query result :return:
Implement the Python class `Up` described below. Class description: Implement the Up class. Method signatures and docstrings: - def __init__(self, registry): Initialize query and metrics - def collect(self, app): Collect from the query result :param rows: query result :return: <|skeleton|> class Up: def __init_...
18eec896827dddc631e5a936cf64bba9872e4d13
<|skeleton|> class Up: def __init__(self, registry): """Initialize query and metrics""" <|body_0|> def collect(self, app): """Collect from the query result :param rows: query result :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Up: def __init__(self, registry): """Initialize query and metrics""" self.is_up_metric = True self.metric = Gauge('mssql_up', 'MsSQL exporter UP status', labelnames=['server', 'port'], registry=registry) super().__init__() def collect(self, app): """Collect from th...
the_stack_v2_python_sparse
app/prom/metrics/general/up.py
IntershopCommunicationsAG/ish-monitoring-mssqldb-exporter
train
1
537223d234aa63eb5d556eecd039e90335f7a91f
[ "document = self.get_object(request, document_id)\nresponse_serializer = serializers.DocumentStatusSerializer(document)\nreturn JsonResponse(response_serializer.data, status=200)", "document = self.get_object(request, document_id)\nif document.status == 2:\n document = document.get_self_clone()\nrequest_serial...
<|body_start_0|> document = self.get_object(request, document_id) response_serializer = serializers.DocumentStatusSerializer(document) return JsonResponse(response_serializer.data, status=200) <|end_body_0|> <|body_start_1|> document = self.get_object(request, document_id) if do...
DocumentAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentAPIView: def get(self, request, document_id, format=None): """Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users""" <|body_0|> def put(self, request, document_id, format=None): """Launches u...
stack_v2_sparse_classes_36k_train_016613
8,316
no_license
[ { "docstring": "Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users", "name": "get", "signature": "def get(self, request, document_id, format=None)" }, { "docstring": "Launches uploading file to DBMS with selected_parameters. If...
3
stack_v2_sparse_classes_30k_train_005810
Implement the Python class `DocumentAPIView` described below. Class description: Implement the DocumentAPIView class. Method signatures and docstrings: - def get(self, request, document_id, format=None): Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: ...
Implement the Python class `DocumentAPIView` described below. Class description: Implement the DocumentAPIView class. Method signatures and docstrings: - def get(self, request, document_id, format=None): Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: ...
fcb2cad8ff4aa7c5dbddc109f6a001d0dd0e45c7
<|skeleton|> class DocumentAPIView: def get(self, request, document_id, format=None): """Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users""" <|body_0|> def put(self, request, document_id, format=None): """Launches u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DocumentAPIView: def get(self, request, document_id, format=None): """Uploads new document to server and returns detected info about it. - Authorization: Token <token> - Access scope: users""" document = self.get_object(request, document_id) response_serializer = serializers.DocumentSt...
the_stack_v2_python_sparse
fileupload/views.py
squizduos/File2UploadDB
train
0
707deee344b78f07ec4878d7a1352e3587b8e29b
[ "if not isinstance(target, (UnitaryMatrix, StateVector, StateSystem)):\n raise TypeError('Expected unitary or state, got %s.' % type(target))\nif not target.is_qubit_only():\n raise ValueError('Cannot generate layers for non-qubit circuits.')\ninit_circuit = Circuit(target.num_qudits, target.radixes)\nfor i i...
<|body_start_0|> if not isinstance(target, (UnitaryMatrix, StateVector, StateSystem)): raise TypeError('Expected unitary or state, got %s.' % type(target)) if not target.is_qubit_only(): raise ValueError('Cannot generate layers for non-qubit circuits.') init_circuit = Cir...
The FourParamGenerator class. This is an optimized layer generator that uses commutativity rules to reduce the number of parameters per block. This also fixes the gate set to use cnots, ry, rz, and u3 gates. This is based on the following equivalences: U--C--U U--C--Rz--Ry--Rz U--C--Ry--Rz | ~ | ~ | U--X--U U--X--Rx--R...
FourParamGenerator
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FourParamGenerator: """The FourParamGenerator class. This is an optimized layer generator that uses commutativity rules to reduce the number of parameters per block. This also fixes the gate set to use cnots, ry, rz, and u3 gates. This is based on the following equivalences: U--C--U U--C--Rz--Ry-...
stack_v2_sparse_classes_36k_train_016614
4,173
permissive
[ { "docstring": "Generate the initial layer, see LayerGenerator for more. Raises: ValueError: If `target` is not qubit only.", "name": "gen_initial_layer", "signature": "def gen_initial_layer(self, target: UnitaryMatrix | StateVector | StateSystem, data: PassData) -> Circuit" }, { "docstring": "G...
3
null
Implement the Python class `FourParamGenerator` described below. Class description: The FourParamGenerator class. This is an optimized layer generator that uses commutativity rules to reduce the number of parameters per block. This also fixes the gate set to use cnots, ry, rz, and u3 gates. This is based on the follow...
Implement the Python class `FourParamGenerator` described below. Class description: The FourParamGenerator class. This is an optimized layer generator that uses commutativity rules to reduce the number of parameters per block. This also fixes the gate set to use cnots, ry, rz, and u3 gates. This is based on the follow...
c89112d15072e8ffffb68cf1757b184e2aeb3dc8
<|skeleton|> class FourParamGenerator: """The FourParamGenerator class. This is an optimized layer generator that uses commutativity rules to reduce the number of parameters per block. This also fixes the gate set to use cnots, ry, rz, and u3 gates. This is based on the following equivalences: U--C--U U--C--Rz--Ry-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FourParamGenerator: """The FourParamGenerator class. This is an optimized layer generator that uses commutativity rules to reduce the number of parameters per block. This also fixes the gate set to use cnots, ry, rz, and u3 gates. This is based on the following equivalences: U--C--U U--C--Rz--Ry--Rz U--C--Ry-...
the_stack_v2_python_sparse
bqskit/passes/search/generators/fourparam.py
BQSKit/bqskit
train
54
fcecfbf37e5bb3555f6776e8a6050244ad52a4fd
[ "pathspec = rdf_paths.PathSpec(path='\\\\\\\\.\\\\PhysicalDrive0\\\\', pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Options.CASE_LITERAL)\nself.state.bytes_downloaded = 0\nself.state.buffers = []\nbuffer_size = constants.CLIENT_MAX_BUFFER_SIZE\nbuffers_we_need = self.args.length // buffe...
<|body_start_0|> pathspec = rdf_paths.PathSpec(path='\\\\.\\PhysicalDrive0\\', pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Options.CASE_LITERAL) self.state.bytes_downloaded = 0 self.state.buffers = [] buffer_size = constants.CLIENT_MAX_BUFFER_SIZE buf...
A flow to retrieve the MBR. Returns to parent flow: The retrieved MBR.
GetMBR
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetMBR: """A flow to retrieve the MBR. Returns to parent flow: The retrieved MBR.""" def Start(self): """Schedules the ReadBuffer client action.""" <|body_0|> def StoreMBR(self, responses): """This method stores the MBR.""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_016615
43,096
permissive
[ { "docstring": "Schedules the ReadBuffer client action.", "name": "Start", "signature": "def Start(self)" }, { "docstring": "This method stores the MBR.", "name": "StoreMBR", "signature": "def StoreMBR(self, responses)" } ]
2
null
Implement the Python class `GetMBR` described below. Class description: A flow to retrieve the MBR. Returns to parent flow: The retrieved MBR. Method signatures and docstrings: - def Start(self): Schedules the ReadBuffer client action. - def StoreMBR(self, responses): This method stores the MBR.
Implement the Python class `GetMBR` described below. Class description: A flow to retrieve the MBR. Returns to parent flow: The retrieved MBR. Method signatures and docstrings: - def Start(self): Schedules the ReadBuffer client action. - def StoreMBR(self, responses): This method stores the MBR. <|skeleton|> class G...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class GetMBR: """A flow to retrieve the MBR. Returns to parent flow: The retrieved MBR.""" def Start(self): """Schedules the ReadBuffer client action.""" <|body_0|> def StoreMBR(self, responses): """This method stores the MBR.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetMBR: """A flow to retrieve the MBR. Returns to parent flow: The retrieved MBR.""" def Start(self): """Schedules the ReadBuffer client action.""" pathspec = rdf_paths.PathSpec(path='\\\\.\\PhysicalDrive0\\', pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Option...
the_stack_v2_python_sparse
grr/server/grr_response_server/flows/general/transfer.py
google/grr
train
4,683
401905174d6908ff175b93dd35435d6dd19d1f6a
[ "self.fname = fname\nif not fname:\n self.fname = sys.stdin", "line = self.fname.readline()\nwhile not line.startswith('>'):\n line = self.fname.readline()\nheader = line[1:].rstrip()\nsequence = ''\nfor line in self.fname:\n if line.startswith('>'):\n yield [header, sequence]\n header = li...
<|body_start_0|> self.fname = fname if not fname: self.fname = sys.stdin <|end_body_0|> <|body_start_1|> line = self.fname.readline() while not line.startswith('>'): line = self.fname.readline() header = line[1:].rstrip() sequence = '' for...
This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013
FastAreader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastAreader: """This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013""" def __init__(self, fname=''...
stack_v2_sparse_classes_36k_train_016616
1,405
no_license
[ { "docstring": "contructor: saves attribute fname", "name": "__init__", "signature": "def __init__(self, fname='')" }, { "docstring": "returns each FastA record as 2 strings - header and sequence. whitespace is removed, no adjustment is made to sequence contents. The initial '>' is removed from ...
2
stack_v2_sparse_classes_30k_train_002855
Implement the Python class `FastAreader` described below. Class description: This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2...
Implement the Python class `FastAreader` described below. Class description: This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2...
7236f20f52810195af397a07a797003c5c45b1e9
<|skeleton|> class FastAreader: """This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013""" def __init__(self, fname=''...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastAreader: """This class taken from BME 160 Lab 4 starter code. Provides reading of a FastA file. object attribute fname: standard input methods readFasta(): returns header and sequence as strings. Author: David Bernick, Modifications: me Date: April 19, 2013""" def __init__(self, fname=''): ""...
the_stack_v2_python_sparse
generate_read_size_distribution.py
belgravia/stacker-scripts
train
0
effa2f0014c0ac1943417503aed5ecbafceb7b73
[ "pre_sum = 0\nself.sum_index = []\nfor i in range(len(w)):\n pre_sum += w[i]\n self.sum_index.append(pre_sum)", "num = random.randint(1, self.sum_index[-1])\nl, r = (0, len(self.sum_index))\nwhile l <= r:\n mid = l + (r - l) // 2\n if self.sum_index[mid] == num:\n return mid\n elif num < sel...
<|body_start_0|> pre_sum = 0 self.sum_index = [] for i in range(len(w)): pre_sum += w[i] self.sum_index.append(pre_sum) <|end_body_0|> <|body_start_1|> num = random.randint(1, self.sum_index[-1]) l, r = (0, len(self.sum_index)) while l <= r: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> pre_sum = 0 self.sum_index = [] for i in range(len(w)): pre_sum += w...
stack_v2_sparse_classes_36k_train_016617
684
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
d8f96b0ec1a85abeef1ce8c0cc409ed501ce088b
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" pre_sum = 0 self.sum_index = [] for i in range(len(w)): pre_sum += w[i] self.sum_index.append(pre_sum) def pickIndex(self): """:rtype: int""" num = random.randint(1, self.sum_...
the_stack_v2_python_sparse
Python/pickIndex.py
miaojiang1987/LeetCode
train
1
8c9788e6946e5340b52b375df56b34a9607e7bc8
[ "self.word_index = collections.defaultdict(list)\nfor i in range(len(words)):\n self.word_index[words[i]].append(i)", "l1 = self.word_index[word1]\nl2 = self.word_index[word2]\nret = float('inf')\ni1, i2 = (0, 0)\nwhile i1 < len(l1) and i2 < len(l2):\n if l1[i1] <= l2[i2]:\n ret = min(ret, l2[i2] - l...
<|body_start_0|> self.word_index = collections.defaultdict(list) for i in range(len(words)): self.word_index[words[i]].append(i) <|end_body_0|> <|body_start_1|> l1 = self.word_index[word1] l2 = self.word_index[word2] ret = float('inf') i1, i2 = (0, 0) ...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.word_index = collections.default...
stack_v2_sparse_classes_36k_train_016618
1,536
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
null
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
9190d3d178f1733aa226973757ee7e045b7bab00
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.word_index = collections.defaultdict(list) for i in range(len(words)): self.word_index[words[i]].append(i) def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: ...
the_stack_v2_python_sparse
ShortestWordDistanceII.py
ellinx/LC-python
train
1
b4fd9bffee583db8cc45237db4c0604fa3a2c574
[ "super(StopVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._control, self._type = get_actor_control(actor)\nif self._type == 'walker':\n self._control.speed = 0\nself._actor = actor\nself._brake_value = brake_value", "new_status = py_trees.common.Status.RUNNING...
<|body_start_0|> super(StopVehicle, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._control, self._type = get_actor_control(actor) if self._type == 'walker': self._control.speed = 0 self._actor = actor self._brake_value ...
This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates when the actor stopped moving
StopVehicle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StopVehicle: """This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates ...
stack_v2_sparse_classes_36k_train_016619
39,839
permissive
[ { "docstring": "Setup _actor and maximum braking value", "name": "__init__", "signature": "def __init__(self, actor, brake_value, name='Stopping')" }, { "docstring": "Set brake to brake_value until reaching full stop", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `StopVehicle` described below. Class description: This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in...
Implement the Python class `StopVehicle` described below. Class description: This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class StopVehicle: """This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StopVehicle: """This class contains an atomic stopping behavior. The controlled traffic participant will decelerate with _bake_value_ until reaching a full stop. Important parameters: - actor: CARLA actor to execute the behavior - brake_value: Brake value in [0,1] applied The behavior terminates when the acto...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_behaviors.py
TinaMenke/Deep-Reinforcement-Learning
train
9
f2390d315d374b3753ebfb38f0f291c764cd23b6
[ "super(MailChimpClient, self).__init__()\nself.auth = HTTPBasicAuth(mc_user, mc_secret)\ndatacenter = mc_secret.split('-').pop()\nself.base_url = 'https://%s.api.mailchimp.com/3.0/' % datacenter", "url = urljoin(self.base_url, url)\nr = requests.post(url, auth=self.auth, json=data)\nif r.status_code == requests.c...
<|body_start_0|> super(MailChimpClient, self).__init__() self.auth = HTTPBasicAuth(mc_user, mc_secret) datacenter = mc_secret.split('-').pop() self.base_url = 'https://%s.api.mailchimp.com/3.0/' % datacenter <|end_body_0|> <|body_start_1|> url = urljoin(self.base_url, url) ...
MailChimp class to communicate with the v3 API
MailChimpClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailChimpClient: """MailChimp class to communicate with the v3 API""" def __init__(self, mc_user, mc_secret): """Initialize the class with you user_id and secret_key""" <|body_0|> def _post(self, url, data=None): """Handle authenticated POST requests""" <...
stack_v2_sparse_classes_36k_train_016620
2,441
permissive
[ { "docstring": "Initialize the class with you user_id and secret_key", "name": "__init__", "signature": "def __init__(self, mc_user, mc_secret)" }, { "docstring": "Handle authenticated POST requests", "name": "_post", "signature": "def _post(self, url, data=None)" }, { "docstring...
6
stack_v2_sparse_classes_30k_train_020501
Implement the Python class `MailChimpClient` described below. Class description: MailChimp class to communicate with the v3 API Method signatures and docstrings: - def __init__(self, mc_user, mc_secret): Initialize the class with you user_id and secret_key - def _post(self, url, data=None): Handle authenticated POST ...
Implement the Python class `MailChimpClient` described below. Class description: MailChimp class to communicate with the v3 API Method signatures and docstrings: - def __init__(self, mc_user, mc_secret): Initialize the class with you user_id and secret_key - def _post(self, url, data=None): Handle authenticated POST ...
b1f5ac2d56567dc4f9619082c597c29229a0c28f
<|skeleton|> class MailChimpClient: """MailChimp class to communicate with the v3 API""" def __init__(self, mc_user, mc_secret): """Initialize the class with you user_id and secret_key""" <|body_0|> def _post(self, url, data=None): """Handle authenticated POST requests""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailChimpClient: """MailChimp class to communicate with the v3 API""" def __init__(self, mc_user, mc_secret): """Initialize the class with you user_id and secret_key""" super(MailChimpClient, self).__init__() self.auth = HTTPBasicAuth(mc_user, mc_secret) datacenter = mc_se...
the_stack_v2_python_sparse
mailchimp3/mailchimpclient.py
klaviyo/python-mailchimp
train
0
b0a5170e600d915e8edab2378afcb5f17b9fc8d9
[ "super().__init__()\nself.first_layer_norm = LNorm(normalized_shape=hid_dim)\nself.self_attention = MultiHeadAttentionLayer(hid_dim, n_heads, dropout, device)\nself.first_gate = Gate(hid_dim=hid_dim)\nself.second_layer_norm = LNorm(normalized_shape=hid_dim)\nself.encoder_attention = MultiHeadAttentionLayer(hid_dim,...
<|body_start_0|> super().__init__() self.first_layer_norm = LNorm(normalized_shape=hid_dim) self.self_attention = MultiHeadAttentionLayer(hid_dim, n_heads, dropout, device) self.first_gate = Gate(hid_dim=hid_dim) self.second_layer_norm = LNorm(normalized_shape=hid_dim) se...
GatedDecoderLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GatedDecoderLayer: def __init__(self, hid_dim: int, n_heads: int, pf_dim: int, dropout: float, device: str): """Gated Decoder Layer for the Decoder Self-attention layer use decoder's representation as Q,V,K similar as the EncoderLayer. Then it follow the Add&Norm which is dropout, residu...
stack_v2_sparse_classes_36k_train_016621
8,786
permissive
[ { "docstring": "Gated Decoder Layer for the Decoder Self-attention layer use decoder's representation as Q,V,K similar as the EncoderLayer. Then it follow the Add&Norm which is dropout, residual/adding connection then normalization This layer uses the target sequence mask \"trg_mask\" in order to prevent the de...
2
stack_v2_sparse_classes_30k_train_000526
Implement the Python class `GatedDecoderLayer` described below. Class description: Implement the GatedDecoderLayer class. Method signatures and docstrings: - def __init__(self, hid_dim: int, n_heads: int, pf_dim: int, dropout: float, device: str): Gated Decoder Layer for the Decoder Self-attention layer use decoder's...
Implement the Python class `GatedDecoderLayer` described below. Class description: Implement the GatedDecoderLayer class. Method signatures and docstrings: - def __init__(self, hid_dim: int, n_heads: int, pf_dim: int, dropout: float, device: str): Gated Decoder Layer for the Decoder Self-attention layer use decoder's...
a6c870d4ed0788f15cfdf58c85ed5201dff60ee9
<|skeleton|> class GatedDecoderLayer: def __init__(self, hid_dim: int, n_heads: int, pf_dim: int, dropout: float, device: str): """Gated Decoder Layer for the Decoder Self-attention layer use decoder's representation as Q,V,K similar as the EncoderLayer. Then it follow the Add&Norm which is dropout, residu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GatedDecoderLayer: def __init__(self, hid_dim: int, n_heads: int, pf_dim: int, dropout: float, device: str): """Gated Decoder Layer for the Decoder Self-attention layer use decoder's representation as Q,V,K similar as the EncoderLayer. Then it follow the Add&Norm which is dropout, residual/adding conn...
the_stack_v2_python_sparse
src/gated_transformers_nlp/utils/gated_transformers/decoder.py
mnguyen0226/gated_transformers_nlp
train
2
1342c87f11545bc2335cb40008d6d7d532c13698
[ "self.flavors_client.default_headers['Accept'] = 'application/xml'\nself.flavors_client.default_headers['Content-Type'] = 'application/json'\nresponse = self.flavors_client.list_flavors()\nself.assertEqual(response.status_code, 200, 'Unexpected status code returned. Expected: {0} Received: {1}'.format(200, response...
<|body_start_0|> self.flavors_client.default_headers['Accept'] = 'application/xml' self.flavors_client.default_headers['Content-Type'] = 'application/json' response = self.flavors_client.list_flavors() self.assertEqual(response.status_code, 200, 'Unexpected status code returned. Expected...
XMLDeprecationTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLDeprecationTest: def test_get_request_accept_xml_ignored(self): """A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The follow...
stack_v2_sparse_classes_36k_train_016622
7,393
permissive
[ { "docstring": "A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The following assertions occur: - The response code is 200 - The response content does n...
6
stack_v2_sparse_classes_30k_train_017666
Implement the Python class `XMLDeprecationTest` described below. Class description: Implement the XMLDeprecationTest class. Method signatures and docstrings: - def test_get_request_accept_xml_ignored(self): A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only...
Implement the Python class `XMLDeprecationTest` described below. Class description: Implement the XMLDeprecationTest class. Method signatures and docstrings: - def test_get_request_accept_xml_ignored(self): A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class XMLDeprecationTest: def test_get_request_accept_xml_ignored(self): """A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The follow...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLDeprecationTest: def test_get_request_accept_xml_ignored(self): """A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The following assertions...
the_stack_v2_python_sparse
cloudroast/compute/api/test_xml_deprecation.py
RULCSoft/cloudroast
train
1
09a2021dafc40470c5a853dc987d29047c04990e
[ "pg.sprite.Sprite.__init__(self)\nself.make_image()\nself.mask = pg.mask.from_surface(self.image)\nself.rect = pg.Rect(location, (50, 50))", "color = [random.randint(0, 255) for _ in range(3)]\nself.image = pg.Surface((50, 50)).convert_alpha()\nself.image.fill(color)\nself.image.blit(SHADE_IMG, (0, 0))" ]
<|body_start_0|> pg.sprite.Sprite.__init__(self) self.make_image() self.mask = pg.mask.from_surface(self.image) self.rect = pg.Rect(location, (50, 50)) <|end_body_0|> <|body_start_1|> color = [random.randint(0, 255) for _ in range(3)] self.image = pg.Surface((50, 50)).co...
A class representing solid obstacles.
Block
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Block: """A class representing solid obstacles.""" def __init__(self, location): """The location argument is an (x,y) coordinate pair.""" <|body_0|> def make_image(self): """Something pretty to look at.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_016623
8,368
no_license
[ { "docstring": "The location argument is an (x,y) coordinate pair.", "name": "__init__", "signature": "def __init__(self, location)" }, { "docstring": "Something pretty to look at.", "name": "make_image", "signature": "def make_image(self)" } ]
2
null
Implement the Python class `Block` described below. Class description: A class representing solid obstacles. Method signatures and docstrings: - def __init__(self, location): The location argument is an (x,y) coordinate pair. - def make_image(self): Something pretty to look at.
Implement the Python class `Block` described below. Class description: A class representing solid obstacles. Method signatures and docstrings: - def __init__(self, location): The location argument is an (x,y) coordinate pair. - def make_image(self): Something pretty to look at. <|skeleton|> class Block: """A cla...
7fc4e0d98d06b4e28b09844babb2452e229a603c
<|skeleton|> class Block: """A class representing solid obstacles.""" def __init__(self, location): """The location argument is an (x,y) coordinate pair.""" <|body_0|> def make_image(self): """Something pretty to look at.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Block: """A class representing solid obstacles.""" def __init__(self, location): """The location argument is an (x,y) coordinate pair.""" pg.sprite.Sprite.__init__(self) self.make_image() self.mask = pg.mask.from_surface(self.image) self.rect = pg.Rect(location, (5...
the_stack_v2_python_sparse
meks-pygame-samples/platforming/fall_rotate.py
pk00749/Example_Python
train
1
8088bc5b2311607af3c9946eb29481f6881a7730
[ "if instance is None:\n raise ValueError('Class instance binding must be non-empty')\nself._instance = instance", "inst = self._instance\nif isinstance(inst, ReferenceType):\n inst = inst()\n if inst is None:\n raise InjectionError('Weakref instance expired')\nreturn inst" ]
<|body_start_0|> if instance is None: raise ValueError('Class instance binding must be non-empty') self._instance = instance <|end_body_0|> <|body_start_1|> inst = self._instance if isinstance(inst, ReferenceType): inst = inst() if inst is None: ...
Provider for a previously-created instance.
InstanceProvider
[ "LicenseRef-scancode-dco-1.1", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceProvider: """Provider for a previously-created instance.""" def __init__(self, instance): """Initialize the instance provider.""" <|body_0|> def provide(self, config: BaseSettings, injector: BaseInjector): """Provide the object instance given a config and...
stack_v2_sparse_classes_36k_train_016624
4,857
permissive
[ { "docstring": "Initialize the instance provider.", "name": "__init__", "signature": "def __init__(self, instance)" }, { "docstring": "Provide the object instance given a config and injector.", "name": "provide", "signature": "def provide(self, config: BaseSettings, injector: BaseInjecto...
2
stack_v2_sparse_classes_30k_train_019751
Implement the Python class `InstanceProvider` described below. Class description: Provider for a previously-created instance. Method signatures and docstrings: - def __init__(self, instance): Initialize the instance provider. - def provide(self, config: BaseSettings, injector: BaseInjector): Provide the object instan...
Implement the Python class `InstanceProvider` described below. Class description: Provider for a previously-created instance. Method signatures and docstrings: - def __init__(self, instance): Initialize the instance provider. - def provide(self, config: BaseSettings, injector: BaseInjector): Provide the object instan...
39cac36d8937ce84a9307ce100aaefb8bc05ec04
<|skeleton|> class InstanceProvider: """Provider for a previously-created instance.""" def __init__(self, instance): """Initialize the instance provider.""" <|body_0|> def provide(self, config: BaseSettings, injector: BaseInjector): """Provide the object instance given a config and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstanceProvider: """Provider for a previously-created instance.""" def __init__(self, instance): """Initialize the instance provider.""" if instance is None: raise ValueError('Class instance binding must be non-empty') self._instance = instance def provide(self, ...
the_stack_v2_python_sparse
aries_cloudagent/config/provider.py
hyperledger/aries-cloudagent-python
train
370
1936e0614719596d2f4d7fa9041b3479beae3042
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('mriver_osagga', 'mriver_osagga')\ndata = repo['mriver_osagga.ny_uber_data'].find()\nif trial:\n data = itertools.islice(data, 0, 600000, 1000)\nr_p = list()\nfor val in data:\n time = val['Date/Tim...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('mriver_osagga', 'mriver_osagga') data = repo['mriver_osagga.ny_uber_data'].find() if trial: data = itertools.islice(data, 0, 600000, 1...
clean_ny_uber_data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class clean_ny_uber_data: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing every...
stack_v2_sparse_classes_36k_train_016625
4,075
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `clean_ny_uber_data` described below. Class description: Implement the clean_ny_uber_data class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTi...
Implement the Python class `clean_ny_uber_data` described below. Class description: Implement the clean_ny_uber_data class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTi...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class clean_ny_uber_data: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing every...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class clean_ny_uber_data: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('mriver_osagga', 'mriver_osagga')...
the_stack_v2_python_sparse
mriver_osagga/clean_ny_uber_data.py
maximega/course-2019-spr-proj
train
2
26f0181ddd24c329b10387914092156d0f5a234e
[ "if data is not None:\n if not isinstance(data, list):\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple values')\n self.lambtha = 1 / (sum(data) / len(data))\nelse:\n if lambtha <= 0:\n raise ValueError('lambtha must be a po...
<|body_start_0|> if data is not None: if not isinstance(data, list): raise TypeError('data must be a list') if len(data) < 2: raise ValueError('data must contain multiple values') self.lambtha = 1 / (sum(data) / len(data)) else: ...
Class that represents an exponential distribution
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: """Class that represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Class constructor""" <|body_0|> def pdf(self, x): """Calculates Probability Density Function (PDF) Args: x: time period Returns: PDF of x or 0 if x...
stack_v2_sparse_classes_36k_train_016626
1,304
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" }, { "docstring": "Calculates Probability Density Function (PDF) Args: x: time period Returns: PDF of x or 0 if x is out of range.", "name": "pdf", "signature": "def pdf(self...
3
stack_v2_sparse_classes_30k_train_007803
Implement the Python class `Exponential` described below. Class description: Class that represents an exponential distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Class constructor - def pdf(self, x): Calculates Probability Density Function (PDF) Args: x: time period Return...
Implement the Python class `Exponential` described below. Class description: Class that represents an exponential distribution Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Class constructor - def pdf(self, x): Calculates Probability Density Function (PDF) Args: x: time period Return...
a5e940f0cbce0c179aa9cd200fc04c940abfaa0b
<|skeleton|> class Exponential: """Class that represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Class constructor""" <|body_0|> def pdf(self, x): """Calculates Probability Density Function (PDF) Args: x: time period Returns: PDF of x or 0 if x...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Exponential: """Class that represents an exponential distribution""" def __init__(self, data=None, lambtha=1.0): """Class constructor""" if data is not None: if not isinstance(data, list): raise TypeError('data must be a list') if len(data) < 2: ...
the_stack_v2_python_sparse
math/0x03-probability/exponential.py
luischaparroc/holbertonschool-machine_learning
train
8
7b505342cb3b2e80c78e0d3fbf5e1f489a46ac6b
[ "self.entity = entity\nself.progress_monitor_root_task_path = progress_monitor_root_task_path\nself.root_entity = root_entity\nself.source_view_name = source_view_name\nself.task_id = task_id\nself.view_box_id = view_box_id\nself.view_name = view_name", "if dictionary is None:\n return None\nentity = cohesity_...
<|body_start_0|> self.entity = entity self.progress_monitor_root_task_path = progress_monitor_root_task_path self.root_entity = root_entity self.source_view_name = source_view_name self.task_id = task_id self.view_box_id = view_box_id self.view_name = view_name <|...
Implementation of the 'SetupRestoreDiskTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. SetupRestoreDiskTaskInfoProto extension, extension_number Location =======================================================...
SetupRestoreDiskTaskInfoProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetupRestoreDiskTaskInfoProto: """Implementation of the 'SetupRestoreDiskTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. SetupRestoreDiskTaskInfoProto extension, extension_number Locatio...
stack_v2_sparse_classes_36k_train_016627
4,291
permissive
[ { "docstring": "Constructor for the SetupRestoreDiskTaskInfoProto class", "name": "__init__", "signature": "def __init__(self, entity=None, progress_monitor_root_task_path=None, root_entity=None, source_view_name=None, task_id=None, view_box_id=None, view_name=None)" }, { "docstring": "Creates a...
2
null
Implement the Python class `SetupRestoreDiskTaskInfoProto` described below. Class description: Implementation of the 'SetupRestoreDiskTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. SetupRestoreDiskTaskInfoPr...
Implement the Python class `SetupRestoreDiskTaskInfoProto` described below. Class description: Implementation of the 'SetupRestoreDiskTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. SetupRestoreDiskTaskInfoPr...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SetupRestoreDiskTaskInfoProto: """Implementation of the 'SetupRestoreDiskTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. SetupRestoreDiskTaskInfoProto extension, extension_number Locatio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SetupRestoreDiskTaskInfoProto: """Implementation of the 'SetupRestoreDiskTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. SetupRestoreDiskTaskInfoProto extension, extension_number Location ===========...
the_stack_v2_python_sparse
cohesity_management_sdk/models/setup_restore_disk_task_info_proto.py
cohesity/management-sdk-python
train
24
c4b0729e06bc1d9bd4b6fd89076295833ce8e85a
[ "if not root:\n return 0\nreturn 1 + max(self.maxDepth(root.left), self.maxDepth(root.right))", "max = 0\nif not root or root.val is None:\n return max\nqueue = [root]\nwhile queue:\n max += 1\n que_len = len(queue)\n for _ in range(que_len):\n node = queue.pop(0)\n if node.left:\n ...
<|body_start_0|> if not root: return 0 return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) <|end_body_0|> <|body_start_1|> max = 0 if not root or root.val is None: return max queue = [root] while queue: max += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: """DFS 解法 Args: root: Returns:""" <|body_0|> def maxDepth(self, root: TreeNode) -> int: """BFS 解法 Args: root: Returns:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: retu...
stack_v2_sparse_classes_36k_train_016628
1,583
no_license
[ { "docstring": "DFS 解法 Args: root: Returns:", "name": "maxDepth", "signature": "def maxDepth(self, root: TreeNode) -> int" }, { "docstring": "BFS 解法 Args: root: Returns:", "name": "maxDepth", "signature": "def maxDepth(self, root: TreeNode) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root: TreeNode) -> int: DFS 解法 Args: root: Returns: - def maxDepth(self, root: TreeNode) -> int: BFS 解法 Args: root: Returns:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root: TreeNode) -> int: DFS 解法 Args: root: Returns: - def maxDepth(self, root: TreeNode) -> int: BFS 解法 Args: root: Returns: <|skeleton|> class Solution: ...
c0dd577481b46129d950354d567d332a4d091137
<|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: """DFS 解法 Args: root: Returns:""" <|body_0|> def maxDepth(self, root: TreeNode) -> int: """BFS 解法 Args: root: Returns:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepth(self, root: TreeNode) -> int: """DFS 解法 Args: root: Returns:""" if not root: return 0 return 1 + max(self.maxDepth(root.left), self.maxDepth(root.right)) def maxDepth(self, root: TreeNode) -> int: """BFS 解法 Args: root: Returns:""" ...
the_stack_v2_python_sparse
leetcode/104_二叉树的最大深度.py
tenqaz/crazy_arithmetic
train
0
5a8e8464d120b2fcb4a61b693c828f79db7b439c
[ "dim_ob = ob_space.shape[0]\nn_actions = ac_space.n\nexpected_shape = (dim_ob + 1) * n_actions\nif len(theta) != expected_shape:\n raise WrongShapeError('Expected a theta of length {} instead of {}'.format(expected_shape, len(theta)))\nself.W = theta[0:dim_ob * n_actions].reshape(dim_ob, n_actions)\nself.b = the...
<|body_start_0|> dim_ob = ob_space.shape[0] n_actions = ac_space.n expected_shape = (dim_ob + 1) * n_actions if len(theta) != expected_shape: raise WrongShapeError('Expected a theta of length {} instead of {}'.format(expected_shape, len(theta))) self.W = theta[0:dim_o...
Deterministicially select an action from a discrete action space using a linear function.
DeterministicMultiBinaryActionLinearPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeterministicMultiBinaryActionLinearPolicy: """Deterministicially select an action from a discrete action space using a linear function.""" def __init__(self, theta, ob_space, ac_space) -> None: """dim_ob: dimension of observations n_actions: number of actions theta: flat vector of p...
stack_v2_sparse_classes_36k_train_016629
7,807
permissive
[ { "docstring": "dim_ob: dimension of observations n_actions: number of actions theta: flat vector of parameters", "name": "__init__", "signature": "def __init__(self, theta, ob_space, ac_space) -> None" }, { "docstring": "Select the action that got the highest value from the linear function.", ...
2
stack_v2_sparse_classes_30k_train_013745
Implement the Python class `DeterministicMultiBinaryActionLinearPolicy` described below. Class description: Deterministicially select an action from a discrete action space using a linear function. Method signatures and docstrings: - def __init__(self, theta, ob_space, ac_space) -> None: dim_ob: dimension of observat...
Implement the Python class `DeterministicMultiBinaryActionLinearPolicy` described below. Class description: Deterministicially select an action from a discrete action space using a linear function. Method signatures and docstrings: - def __init__(self, theta, ob_space, ac_space) -> None: dim_ob: dimension of observat...
d63ea61f8379a7e0a9786e4bb717813ed53bb8f0
<|skeleton|> class DeterministicMultiBinaryActionLinearPolicy: """Deterministicially select an action from a discrete action space using a linear function.""" def __init__(self, theta, ob_space, ac_space) -> None: """dim_ob: dimension of observations n_actions: number of actions theta: flat vector of p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeterministicMultiBinaryActionLinearPolicy: """Deterministicially select an action from a discrete action space using a linear function.""" def __init__(self, theta, ob_space, ac_space) -> None: """dim_ob: dimension of observations n_actions: number of actions theta: flat vector of parameters""" ...
the_stack_v2_python_sparse
yarll/agents/basic/cem.py
arnomoonens/yarll
train
21
618608d8d3ce4767b99323bcb384bd676619e682
[ "so = cls()\ntry:\n res = func(*args, **kwargs)\nfinally:\n out, err = so.reset()\nreturn (res, out, err)", "if hasattr(self, '_reset'):\n raise ValueError('was already reset')\nself._reset = True\noutfile, errfile = self.done(save=False)\nout, err = ('', '')\nif outfile and (not outfile.closed):\n ou...
<|body_start_0|> so = cls() try: res = func(*args, **kwargs) finally: out, err = so.reset() return (res, out, err) <|end_body_0|> <|body_start_1|> if hasattr(self, '_reset'): raise ValueError('was already reset') self._reset = True ...
Capture
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Capture: def call(cls, func, *args, **kwargs): """return a (res, out, err) tuple where out and err represent the output/error output during function execution. call the given function with args/kwargs and capture output/error during its execution.""" <|body_0|> def reset(sel...
stack_v2_sparse_classes_36k_train_016630
11,652
permissive
[ { "docstring": "return a (res, out, err) tuple where out and err represent the output/error output during function execution. call the given function with args/kwargs and capture output/error during its execution.", "name": "call", "signature": "def call(cls, func, *args, **kwargs)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_007027
Implement the Python class `Capture` described below. Class description: Implement the Capture class. Method signatures and docstrings: - def call(cls, func, *args, **kwargs): return a (res, out, err) tuple where out and err represent the output/error output during function execution. call the given function with arg...
Implement the Python class `Capture` described below. Class description: Implement the Capture class. Method signatures and docstrings: - def call(cls, func, *args, **kwargs): return a (res, out, err) tuple where out and err represent the output/error output during function execution. call the given function with arg...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class Capture: def call(cls, func, *args, **kwargs): """return a (res, out, err) tuple where out and err represent the output/error output during function execution. call the given function with args/kwargs and capture output/error during its execution.""" <|body_0|> def reset(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Capture: def call(cls, func, *args, **kwargs): """return a (res, out, err) tuple where out and err represent the output/error output during function execution. call the given function with args/kwargs and capture output/error during its execution.""" so = cls() try: res = f...
the_stack_v2_python_sparse
contrib/python/py/py/_io/capture.py
catboost/catboost
train
8,012
000e3fca2156d72022b1a627de77ee053f26fc48
[ "state = {}\nfor attr, cls in self._stateobject_attributes.items():\n val = getattr(self, attr)\n state[attr] = get_state(cls, val)\nreturn state", "state = state.copy()\nfor attr, cls in self._stateobject_attributes.items():\n val = state.pop(attr)\n if val is None:\n setattr(self, attr, val)\...
<|body_start_0|> state = {} for attr, cls in self._stateobject_attributes.items(): val = getattr(self, attr) state[attr] = get_state(cls, val) return state <|end_body_0|> <|body_start_1|> state = state.copy() for attr, cls in self._stateobject_attributes....
An object with serializable state. State attributes can either be serializable types(str, tuple, bool, ...) or StateObject instances themselves.
StateObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateObject: """An object with serializable state. State attributes can either be serializable types(str, tuple, bool, ...) or StateObject instances themselves.""" def get_state(self): """Retrieve object state.""" <|body_0|> def set_state(self, state): """Load ob...
stack_v2_sparse_classes_36k_train_016631
3,465
permissive
[ { "docstring": "Retrieve object state.", "name": "get_state", "signature": "def get_state(self)" }, { "docstring": "Load object state from data returned by a get_state call.", "name": "set_state", "signature": "def set_state(self, state)" } ]
2
null
Implement the Python class `StateObject` described below. Class description: An object with serializable state. State attributes can either be serializable types(str, tuple, bool, ...) or StateObject instances themselves. Method signatures and docstrings: - def get_state(self): Retrieve object state. - def set_state(...
Implement the Python class `StateObject` described below. Class description: An object with serializable state. State attributes can either be serializable types(str, tuple, bool, ...) or StateObject instances themselves. Method signatures and docstrings: - def get_state(self): Retrieve object state. - def set_state(...
79fa2e81e690b9c32882d006a6799c3a316fe346
<|skeleton|> class StateObject: """An object with serializable state. State attributes can either be serializable types(str, tuple, bool, ...) or StateObject instances themselves.""" def get_state(self): """Retrieve object state.""" <|body_0|> def set_state(self, state): """Load ob...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateObject: """An object with serializable state. State attributes can either be serializable types(str, tuple, bool, ...) or StateObject instances themselves.""" def get_state(self): """Retrieve object state.""" state = {} for attr, cls in self._stateobject_attributes.items(): ...
the_stack_v2_python_sparse
seleniumwire/thirdparty/mitmproxy/stateobject.py
wkeeling/selenium-wire
train
1,625
6d2e9eb0ed8157e4efbad9ed3c8dc4da2da4356e
[ "self.server = server\nself.user = username\nself.password = password\nself.database = database\nself.port = port\nself.db = pymssql.connect(server=self.server, port=self.port, user=self.user, password=self.password, database=self.database, charset='utf8')", "self.db.autocommit(True)\nself.cursor = self.db.cursor...
<|body_start_0|> self.server = server self.user = username self.password = password self.database = database self.port = port self.db = pymssql.connect(server=self.server, port=self.port, user=self.user, password=self.password, database=self.database, charset='utf8') <|en...
Data_SQLserver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Data_SQLserver: def __init__(self, server, username, password, database, port): """初始化sqlserver信息""" <|body_0|> def select_SQL_Db(self, sql): """SQLserver数据库查询""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.server = server self.user = ...
stack_v2_sparse_classes_36k_train_016632
749
no_license
[ { "docstring": "初始化sqlserver信息", "name": "__init__", "signature": "def __init__(self, server, username, password, database, port)" }, { "docstring": "SQLserver数据库查询", "name": "select_SQL_Db", "signature": "def select_SQL_Db(self, sql)" } ]
2
stack_v2_sparse_classes_30k_train_005685
Implement the Python class `Data_SQLserver` described below. Class description: Implement the Data_SQLserver class. Method signatures and docstrings: - def __init__(self, server, username, password, database, port): 初始化sqlserver信息 - def select_SQL_Db(self, sql): SQLserver数据库查询
Implement the Python class `Data_SQLserver` described below. Class description: Implement the Data_SQLserver class. Method signatures and docstrings: - def __init__(self, server, username, password, database, port): 初始化sqlserver信息 - def select_SQL_Db(self, sql): SQLserver数据库查询 <|skeleton|> class Data_SQLserver: ...
afa165e677e1e87c4a591a36dddf8ded5a56bd3a
<|skeleton|> class Data_SQLserver: def __init__(self, server, username, password, database, port): """初始化sqlserver信息""" <|body_0|> def select_SQL_Db(self, sql): """SQLserver数据库查询""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Data_SQLserver: def __init__(self, server, username, password, database, port): """初始化sqlserver信息""" self.server = server self.user = username self.password = password self.database = database self.port = port self.db = pymssql.connect(server=self.server...
the_stack_v2_python_sparse
py/sqlmanager/App/Model/Mssql.py
teamhead/lan
train
0
c7f0ab379dd4c0aa9429d8c0534a247424771f37
[ "self.redirect_mode = redirect_mode\nself.domain = domain\nself.error = error\nself.cancel = cancel\nself.success = success\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nredirect_mode = dictionary.get('redirectMode')\ndomain = dictionary.get('domain')\nerror = dic...
<|body_start_0|> self.redirect_mode = redirect_mode self.domain = domain self.error = error self.cancel = cancel self.success = success self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return No...
Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you specify iframe on any of the signers</span>) er...
RedirectSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedirectSettings: """Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you spe...
stack_v2_sparse_classes_36k_train_016633
3,342
permissive
[ { "docstring": "Constructor for the RedirectSettings class", "name": "__init__", "signature": "def __init__(self, redirect_mode=None, domain=None, error=None, cancel=None, success=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictio...
2
stack_v2_sparse_classes_30k_train_007097
Implement the Python class `RedirectSettings` described below. Class description: Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span ...
Implement the Python class `RedirectSettings` described below. Class description: Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span ...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class RedirectSettings: """Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you spe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RedirectSettings: """Implementation of the 'RedirectSettings' model. TODO: type model description here. Attributes: redirect_mode (RedirectMode): Define if you want redirect or webmessaging or both domain (string): The domain your website is hosted on <span style="color: red;">Required if you specify iframe o...
the_stack_v2_python_sparse
idfy_rest_client/models/redirect_settings.py
dealflowteam/Idfy
train
0
044ca3e8251b4f5f69f2df248d1141f348c0050a
[ "count_dict = defaultdict(int)\nfor n in nums:\n count_dict[n] -= 1\nhq = Heap([[val, key] for key, val in count_dict.items()])\ntop_k = [0] * k\nfor i in range(k):\n top_k[i] = hq.pop()\nreturn top_k", "countMap = {}\nfor n in nums:\n countMap[n] = countMap.get(n, 0) + 1\ncountKey = [[-countMap[key], ke...
<|body_start_0|> count_dict = defaultdict(int) for n in nums: count_dict[n] -= 1 hq = Heap([[val, key] for key, val in count_dict.items()]) top_k = [0] * k for i in range(k): top_k[i] = hq.pop() return top_k <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def topKFrequentCustom(self, nums: List[int], k: int) -> List[int]: """Runtime: O(Nlogk) Space: O(n)""" <|body_0|> def topKFrequentHeapq(self, nums: List[int], k: int) -> List[int]: """:type nums: List[int] :type k: int :rtype: List[int] Solution using hash...
stack_v2_sparse_classes_36k_train_016634
2,352
permissive
[ { "docstring": "Runtime: O(Nlogk) Space: O(n)", "name": "topKFrequentCustom", "signature": "def topKFrequentCustom(self, nums: List[int], k: int) -> List[int]" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int] Solution using hashmap and a priority queue or heapq", "name...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequentCustom(self, nums: List[int], k: int) -> List[int]: Runtime: O(Nlogk) Space: O(n) - def topKFrequentHeapq(self, nums: List[int], k: int) -> List[int]: :type nums:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequentCustom(self, nums: List[int], k: int) -> List[int]: Runtime: O(Nlogk) Space: O(n) - def topKFrequentHeapq(self, nums: List[int], k: int) -> List[int]: :type nums:...
c07b555127ee89d6f461cea7cd87811c382086ff
<|skeleton|> class Solution: def topKFrequentCustom(self, nums: List[int], k: int) -> List[int]: """Runtime: O(Nlogk) Space: O(n)""" <|body_0|> def topKFrequentHeapq(self, nums: List[int], k: int) -> List[int]: """:type nums: List[int] :type k: int :rtype: List[int] Solution using hash...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def topKFrequentCustom(self, nums: List[int], k: int) -> List[int]: """Runtime: O(Nlogk) Space: O(n)""" count_dict = defaultdict(int) for n in nums: count_dict[n] -= 1 hq = Heap([[val, key] for key, val in count_dict.items()]) top_k = [0] * k ...
the_stack_v2_python_sparse
Leetcode/week_4/p0347_top_k_frequent_elements.py
scohen40/wallbreakers_projects
train
0
0fd476723aeb88e1a77336a1e5d17829b1b6a422
[ "self.request = request\nself.request_manager = PokedexRequestManager()\noutput_strategy = TextFileOutputStrategy(request.output) if request.output else ConsoleOutputStrategy()\nself.report_exporter = Report(output_strategy)", "if self.request.inputdata:\n return [self.request.inputdata]\nif self.request.input...
<|body_start_0|> self.request = request self.request_manager = PokedexRequestManager() output_strategy = TextFileOutputStrategy(request.output) if request.output else ConsoleOutputStrategy() self.report_exporter = Report(output_strategy) <|end_body_0|> <|body_start_1|> if self.r...
The driver class that accepts a request and executes it.
Pokedex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pokedex: """The driver class that accepts a request and executes it.""" def __init__(self, request: Request): """Initializes a Pokedex with a request. :param request: a Request""" <|body_0|> def get_request_dataset(self) -> list: """Returns a list of request name...
stack_v2_sparse_classes_36k_train_016635
2,848
no_license
[ { "docstring": "Initializes a Pokedex with a request. :param request: a Request", "name": "__init__", "signature": "def __init__(self, request: Request)" }, { "docstring": "Returns a list of request names or ids. :return: a list", "name": "get_request_dataset", "signature": "def get_requ...
4
null
Implement the Python class `Pokedex` described below. Class description: The driver class that accepts a request and executes it. Method signatures and docstrings: - def __init__(self, request: Request): Initializes a Pokedex with a request. :param request: a Request - def get_request_dataset(self) -> list: Returns a...
Implement the Python class `Pokedex` described below. Class description: The driver class that accepts a request and executes it. Method signatures and docstrings: - def __init__(self, request: Request): Initializes a Pokedex with a request. :param request: a Request - def get_request_dataset(self) -> list: Returns a...
e86956c69006f96221349fe9bd4925ad2255601e
<|skeleton|> class Pokedex: """The driver class that accepts a request and executes it.""" def __init__(self, request: Request): """Initializes a Pokedex with a request. :param request: a Request""" <|body_0|> def get_request_dataset(self) -> list: """Returns a list of request name...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pokedex: """The driver class that accepts a request and executes it.""" def __init__(self, request: Request): """Initializes a Pokedex with a request. :param request: a Request""" self.request = request self.request_manager = PokedexRequestManager() output_strategy = TextF...
the_stack_v2_python_sparse
assignment-3-an-object-oriented-pokedex-pikachu/pokedex.py
lizhiquan/learning-python
train
0
9f6f39051d4921b8da5ffd18516fb1662c7334ba
[ "parser = (Literal('abc') > 'name') ** make_error('msg')\nparser.config.no_full_first_match()\nnode = parser.parse('abc')[0]\nassert isinstance(node, Error)\nassert node[0] == 'msg', node[0]\nassert str(node).startswith('msg ('), str(node)\nassert isinstance(node, Exception), type(node)", "parser = (Literal('abc'...
<|body_start_0|> parser = (Literal('abc') > 'name') ** make_error('msg') parser.config.no_full_first_match() node = parser.parse('abc')[0] assert isinstance(node, Error) assert node[0] == 'msg', node[0] assert str(node).startswith('msg ('), str(node) assert isinst...
Check generation of Error nodes.
MessageTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageTest: """Check generation of Error nodes.""" def test_simple(self): """Test a message with no fmtting.""" <|body_0|> def test_fmtted(self): """Test a message with fmtting.""" <|body_1|> def test_bad_fmt(self): """Test a message with ba...
stack_v2_sparse_classes_36k_train_016636
3,681
no_license
[ { "docstring": "Test a message with no fmtting.", "name": "test_simple", "signature": "def test_simple(self)" }, { "docstring": "Test a message with fmtting.", "name": "test_fmtted", "signature": "def test_fmtted(self)" }, { "docstring": "Test a message with bad fmtting.", "n...
4
stack_v2_sparse_classes_30k_train_010740
Implement the Python class `MessageTest` described below. Class description: Check generation of Error nodes. Method signatures and docstrings: - def test_simple(self): Test a message with no fmtting. - def test_fmtted(self): Test a message with fmtting. - def test_bad_fmt(self): Test a message with bad fmtting. - de...
Implement the Python class `MessageTest` described below. Class description: Check generation of Error nodes. Method signatures and docstrings: - def test_simple(self): Test a message with no fmtting. - def test_fmtted(self): Test a message with fmtting. - def test_bad_fmt(self): Test a message with bad fmtting. - de...
0603505f187acc3c7da2e1a6083833a201f8b061
<|skeleton|> class MessageTest: """Check generation of Error nodes.""" def test_simple(self): """Test a message with no fmtting.""" <|body_0|> def test_fmtted(self): """Test a message with fmtting.""" <|body_1|> def test_bad_fmt(self): """Test a message with ba...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessageTest: """Check generation of Error nodes.""" def test_simple(self): """Test a message with no fmtting.""" parser = (Literal('abc') > 'name') ** make_error('msg') parser.config.no_full_first_match() node = parser.parse('abc')[0] assert isinstance(node, Error)...
the_stack_v2_python_sparse
src/lepl/matchers/_test/error.py
nyimbi/LEPL
train
2
fa6deecde967815892cac53b61d6d4438ea78f10
[ "if root == None:\n return ''\nres = []\nq = deque([root])\nwhile len(q) != 0:\n curr = q.popleft()\n res.append(str(curr.val))\n if curr.left != None:\n q.append(curr.left)\n if curr.right != None:\n q.append(curr.right)\nreturn ','.join(res)", "if data == '':\n return None\nlst =...
<|body_start_0|> if root == None: return '' res = [] q = deque([root]) while len(q) != 0: curr = q.popleft() res.append(str(curr.val)) if curr.left != None: q.append(curr.left) if curr.right != None: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_016637
4,399
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
00fd1397b65c68a303fcf963db3e28cd35c1c003
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return '' res = [] q = deque([root]) while len(q) != 0: curr = q.popleft() res.append(str(curr.val)) ...
the_stack_v2_python_sparse
leetcode/449. Serialize and Deserialize BST.py
cuiy0006/Algorithms
train
0
19568443677c3027c374d0c301402dbc65662e91
[ "session = db.session()\nrepos = session.query(db.Repository.name).all()\nif not repos:\n yield 'No available repositories'\n return\nyield '%(HI)s Available Repositories:'\nyield self.nextLine\nfor repo in repos:\n yield (' %s' % repo[0])\n yield self.nextLine", "session = db.session()\nif not self....
<|body_start_0|> session = db.session() repos = session.query(db.Repository.name).all() if not repos: yield 'No available repositories' return yield '%(HI)s Available Repositories:' yield self.nextLine for repo in repos: yield (' %s' %...
Repositories Commands
RepositoriesCommands
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepositoriesCommands: """Repositories Commands""" def do_list(self): """List available repositories""" <|body_0|> def do_add(self, reponame, repopath, size=0, quota=0): """Add repository.""" <|body_1|> def do_size(self, reponame): """Check th...
stack_v2_sparse_classes_36k_train_016638
6,649
no_license
[ { "docstring": "List available repositories", "name": "do_list", "signature": "def do_list(self)" }, { "docstring": "Add repository.", "name": "do_add", "signature": "def do_add(self, reponame, repopath, size=0, quota=0)" }, { "docstring": "Check the repository's current size", ...
4
stack_v2_sparse_classes_30k_train_018203
Implement the Python class `RepositoriesCommands` described below. Class description: Repositories Commands Method signatures and docstrings: - def do_list(self): List available repositories - def do_add(self, reponame, repopath, size=0, quota=0): Add repository. - def do_size(self, reponame): Check the repository's ...
Implement the Python class `RepositoriesCommands` described below. Class description: Repositories Commands Method signatures and docstrings: - def do_list(self): List available repositories - def do_add(self, reponame, repopath, size=0, quota=0): Add repository. - def do_size(self, reponame): Check the repository's ...
75f0c76f67ad4d98f83645a1ae05980dd5aa28e6
<|skeleton|> class RepositoriesCommands: """Repositories Commands""" def do_list(self): """List available repositories""" <|body_0|> def do_add(self, reponame, repopath, size=0, quota=0): """Add repository.""" <|body_1|> def do_size(self, reponame): """Check th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RepositoriesCommands: """Repositories Commands""" def do_list(self): """List available repositories""" session = db.session() repos = session.query(db.Repository.name).all() if not repos: yield 'No available repositories' return yield '%(HI)...
the_stack_v2_python_sparse
sshg/terminal/commands/repositories.py
UfSoft/SSHg
train
0
4a6576e3ddf6f75b92d943841d0fd642518d928d
[ "self.charge_id = None\nself.registration_date = None\nself.entry_number = None", "state = LastCreatedCharge()\nif 'charge_id' in state_json:\n state.charge_id = state_json['charge_id']\nif 'registration_date' in state_json:\n state.registration_date = state_json['registration_date']\nif 'entry_number' in s...
<|body_start_0|> self.charge_id = None self.registration_date = None self.entry_number = None <|end_body_0|> <|body_start_1|> state = LastCreatedCharge() if 'charge_id' in state_json: state.charge_id = state_json['charge_id'] if 'registration_date' in state_j...
Model to hold last created charge.
LastCreatedCharge
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LastCreatedCharge: """Model to hold last created charge.""" def __init__(self): """Initialize instance of the LastCreatedCharge.""" <|body_0|> def from_dict(state_json): """Build AddChargeState object from json dictionary. :param state_json: Json Dictionary repre...
stack_v2_sparse_classes_36k_train_016639
873
permissive
[ { "docstring": "Initialize instance of the LastCreatedCharge.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Build AddChargeState object from json dictionary. :param state_json: Json Dictionary representing the add charge state. :return: AddChargeState object.", "...
2
null
Implement the Python class `LastCreatedCharge` described below. Class description: Model to hold last created charge. Method signatures and docstrings: - def __init__(self): Initialize instance of the LastCreatedCharge. - def from_dict(state_json): Build AddChargeState object from json dictionary. :param state_json: ...
Implement the Python class `LastCreatedCharge` described below. Class description: Model to hold last created charge. Method signatures and docstrings: - def __init__(self): Initialize instance of the LastCreatedCharge. - def from_dict(state_json): Build AddChargeState object from json dictionary. :param state_json: ...
d92446a9972ebbcd9a43a7a7444a528aa2f30bf7
<|skeleton|> class LastCreatedCharge: """Model to hold last created charge.""" def __init__(self): """Initialize instance of the LastCreatedCharge.""" <|body_0|> def from_dict(state_json): """Build AddChargeState object from json dictionary. :param state_json: Json Dictionary repre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LastCreatedCharge: """Model to hold last created charge.""" def __init__(self): """Initialize instance of the LastCreatedCharge.""" self.charge_id = None self.registration_date = None self.entry_number = None def from_dict(state_json): """Build AddChargeState ...
the_stack_v2_python_sparse
maintain_frontend/dependencies/session_api/last_created_charge.py
uk-gov-mirror/LandRegistry.maintain-frontend
train
0
b24c4af73643e56fcb07c11f7ce0db6f79d5dc60
[ "payloads = ['\\r\\nSet-Cookie: {}={}', '\\nSet-Cookie: {}={}', '\\rSet-Cookie: {}={}', 'čĊSet-Cookie: {}={}']\nself._random = utility.generate_random(string.ascii_lowercase)\nself._payloads = [payload.format(self._random, self._random) for payload in payloads]", "if not response.cookies:\n return False\nif se...
<|body_start_0|> payloads = ['\r\nSet-Cookie: {}={}', '\nSet-Cookie: {}={}', '\rSet-Cookie: {}={}', 'čĊSet-Cookie: {}={}'] self._random = utility.generate_random(string.ascii_lowercase) self._payloads = [payload.format(self._random, self._random) for payload in payloads] <|end_body_0|> <|body_s...
Checks for Header Injection in the response's header. The payload sets a cookie of 'ava=avascan' using CRLF character variations, such as removing each CR/LF character and encoding as UTF-8.
HeaderInjectionCheck
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeaderInjectionCheck: """Checks for Header Injection in the response's header. The payload sets a cookie of 'ava=avascan' using CRLF character variations, such as removing each CR/LF character and encoding as UTF-8.""" def __init__(self): """Define static payloads""" <|body_0...
stack_v2_sparse_classes_36k_train_016640
1,534
permissive
[ { "docstring": "Define static payloads", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Checks for Header Injections by looking for the 'Set-Cookie' payload in the response's headers. :param response: response object from server :param payload: payload value :return: tr...
2
stack_v2_sparse_classes_30k_train_020002
Implement the Python class `HeaderInjectionCheck` described below. Class description: Checks for Header Injection in the response's header. The payload sets a cookie of 'ava=avascan' using CRLF character variations, such as removing each CR/LF character and encoding as UTF-8. Method signatures and docstrings: - def _...
Implement the Python class `HeaderInjectionCheck` described below. Class description: Checks for Header Injection in the response's header. The payload sets a cookie of 'ava=avascan' using CRLF character variations, such as removing each CR/LF character and encoding as UTF-8. Method signatures and docstrings: - def _...
962f551710c6369d04851cc09ea579ce16fcc4db
<|skeleton|> class HeaderInjectionCheck: """Checks for Header Injection in the response's header. The payload sets a cookie of 'ava=avascan' using CRLF character variations, such as removing each CR/LF character and encoding as UTF-8.""" def __init__(self): """Define static payloads""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeaderInjectionCheck: """Checks for Header Injection in the response's header. The payload sets a cookie of 'ava=avascan' using CRLF character variations, such as removing each CR/LF character and encoding as UTF-8.""" def __init__(self): """Define static payloads""" payloads = ['\r\nSet-...
the_stack_v2_python_sparse
ava/actives/header_injection.py
indeedsecurity/ava
train
10
07d26e6082d73417add3b0feaf68f9e190f3f778
[ "stack = []\ndummy = Node(0, None, None, None)\ndummy.next = head\ncur = head\nwhile cur:\n if cur.child:\n stack.append(cur.next)\n cur.next = cur.child\n cur.child.prev = cur\n cur.child = None\n if not cur.next and stack:\n connect = stack.pop()\n cur.next = connec...
<|body_start_0|> stack = [] dummy = Node(0, None, None, None) dummy.next = head cur = head while cur: if cur.child: stack.append(cur.next) cur.next = cur.child cur.child.prev = cur cur.child = None ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, head): """:type head: Node :rtype: Node 864MS""" <|body_0|> def flatten_1(self, head): """:type head: Node :rtype: Node 848MS""" <|body_1|> <|end_skeleton|> <|body_start_0|> stack = [] dummy = Node(0, None, None, ...
stack_v2_sparse_classes_36k_train_016641
2,365
no_license
[ { "docstring": ":type head: Node :rtype: Node 864MS", "name": "flatten", "signature": "def flatten(self, head)" }, { "docstring": ":type head: Node :rtype: Node 848MS", "name": "flatten_1", "signature": "def flatten_1(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, head): :type head: Node :rtype: Node 864MS - def flatten_1(self, head): :type head: Node :rtype: Node 848MS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, head): :type head: Node :rtype: Node 864MS - def flatten_1(self, head): :type head: Node :rtype: Node 848MS <|skeleton|> class Solution: def flatten(self,...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def flatten(self, head): """:type head: Node :rtype: Node 864MS""" <|body_0|> def flatten_1(self, head): """:type head: Node :rtype: Node 848MS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten(self, head): """:type head: Node :rtype: Node 864MS""" stack = [] dummy = Node(0, None, None, None) dummy.next = head cur = head while cur: if cur.child: stack.append(cur.next) cur.next = cur.chil...
the_stack_v2_python_sparse
FlattenAMultilevelDoublyLinkedList_MID_430.py
953250587/leetcode-python
train
2
3b2535750640970e72fae433871919098381024b
[ "name = name or 'interpolation_2d'\nwith tf.name_scope(name):\n self._xdata = tf.convert_to_tensor(x_data, dtype=dtype, name='x_data')\n self._dtype = dtype or self._xdata.dtype\n self._ydata = tf.convert_to_tensor(y_data, dtype=self._dtype, name='y_data')\n self._zdata = tf.convert_to_tensor(z_data, dt...
<|body_start_0|> name = name or 'interpolation_2d' with tf.name_scope(name): self._xdata = tf.convert_to_tensor(x_data, dtype=dtype, name='x_data') self._dtype = dtype or self._xdata.dtype self._ydata = tf.convert_to_tensor(y_data, dtype=self._dtype, name='y_data') ...
Performs interpolation in a 2-dimensional space. For input `x_data` in x-direction we assume that values in y-direction are given by `y_data` and the corresponding function values by `z_data`. For given `x` and `y` along x- and y- direction respectively, the interpolated function values are computed on grid `[x, y]`. T...
Interpolation2D
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interpolation2D: """Performs interpolation in a 2-dimensional space. For input `x_data` in x-direction we assume that values in y-direction are given by `y_data` and the corresponding function values by `z_data`. For given `x` and `y` along x- and y- direction respectively, the interpolated funct...
stack_v2_sparse_classes_36k_train_016642
6,894
permissive
[ { "docstring": "Initialize the 2d-interpolation object. Args: x_data: A `Tensor` of real `dtype` and shape `batch_shape + [num_x_data_points]`. Defines the x-coordinates of the input data. `num_x_data_points` should be >= 2. The elements of `x_data` should be in a non-decreasing order. y_data: A `Tensor` of the...
2
stack_v2_sparse_classes_30k_train_002890
Implement the Python class `Interpolation2D` described below. Class description: Performs interpolation in a 2-dimensional space. For input `x_data` in x-direction we assume that values in y-direction are given by `y_data` and the corresponding function values by `z_data`. For given `x` and `y` along x- and y- directi...
Implement the Python class `Interpolation2D` described below. Class description: Performs interpolation in a 2-dimensional space. For input `x_data` in x-direction we assume that values in y-direction are given by `y_data` and the corresponding function values by `z_data`. For given `x` and `y` along x- and y- directi...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class Interpolation2D: """Performs interpolation in a 2-dimensional space. For input `x_data` in x-direction we assume that values in y-direction are given by `y_data` and the corresponding function values by `z_data`. For given `x` and `y` along x- and y- direction respectively, the interpolated funct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Interpolation2D: """Performs interpolation in a 2-dimensional space. For input `x_data` in x-direction we assume that values in y-direction are given by `y_data` and the corresponding function values by `z_data`. For given `x` and `y` along x- and y- direction respectively, the interpolated function values ar...
the_stack_v2_python_sparse
tf_quant_finance/math/interpolation/interpolation_2d/interpolation_2d.py
google/tf-quant-finance
train
4,165
3b4598f100b891b1cdd0ff22c17814aa7c35246d
[ "nn.Module.__init__(self)\nself.input_dim = pinput['dim']\nself.output_dim = poutput['dim']\nself.modules_list = nn.ModuleList()\nself.nn_lin = poutput.get('nn_lin')\nif issubclass(type(self.input_dim), list):\n input_dim_mean = self.input_dim[0]\n input_dim_var = self.input_dim[1]\nelse:\n input_dim_mean ...
<|body_start_0|> nn.Module.__init__(self) self.input_dim = pinput['dim'] self.output_dim = poutput['dim'] self.modules_list = nn.ModuleList() self.nn_lin = poutput.get('nn_lin') if issubclass(type(self.input_dim), list): input_dim_mean = self.input_dim[0] ...
GaussianLayer1D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianLayer1D: def __init__(self, pinput, poutput, **kwargs): """Args pinput (dict): dimension of input poutput (dict): dimension of output""" <|body_0|> def forward(self, ins, *args, **kwargs): """Outputs parameters of a diagonal Gaussian distribution. :param ins ...
stack_v2_sparse_classes_36k_train_016643
6,457
no_license
[ { "docstring": "Args pinput (dict): dimension of input poutput (dict): dimension of output", "name": "__init__", "signature": "def __init__(self, pinput, poutput, **kwargs)" }, { "docstring": "Outputs parameters of a diagonal Gaussian distribution. :param ins : input vector. :returns: (torch.Ten...
2
stack_v2_sparse_classes_30k_train_019795
Implement the Python class `GaussianLayer1D` described below. Class description: Implement the GaussianLayer1D class. Method signatures and docstrings: - def __init__(self, pinput, poutput, **kwargs): Args pinput (dict): dimension of input poutput (dict): dimension of output - def forward(self, ins, *args, **kwargs):...
Implement the Python class `GaussianLayer1D` described below. Class description: Implement the GaussianLayer1D class. Method signatures and docstrings: - def __init__(self, pinput, poutput, **kwargs): Args pinput (dict): dimension of input poutput (dict): dimension of output - def forward(self, ins, *args, **kwargs):...
703c435dbfb612f61908822d789f1a4034ac48b0
<|skeleton|> class GaussianLayer1D: def __init__(self, pinput, poutput, **kwargs): """Args pinput (dict): dimension of input poutput (dict): dimension of output""" <|body_0|> def forward(self, ins, *args, **kwargs): """Outputs parameters of a diagonal Gaussian distribution. :param ins ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianLayer1D: def __init__(self, pinput, poutput, **kwargs): """Args pinput (dict): dimension of input poutput (dict): dimension of output""" nn.Module.__init__(self) self.input_dim = pinput['dim'] self.output_dim = poutput['dim'] self.modules_list = nn.ModuleList() ...
the_stack_v2_python_sparse
lt/modules/modules_distribution.py
domkirke/latent-transcription
train
2
c6a26e46690b1d3e2f8585b1ae17de4be56500b8
[ "logging.debug('start core updating after install process finished')\nCore.get_instance().set_expired(True)\nCore.get_instance().update()", "title = 'Installing products: {0}'.format(', '.join([product_name for product_name in requested_products]))\nstate = {'requested_products': requested_products, 'products': p...
<|body_start_0|> logging.debug('start core updating after install process finished') Core.get_instance().set_expired(True) Core.get_instance().update() <|end_body_0|> <|body_start_1|> title = 'Installing products: {0}'.format(', '.join([product_name for product_name in requested_product...
MasterProduct
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MasterProduct: def sync_core(): """После каждой установки выполнить sync чтобы current.yaml был в актуальном сосотоянии""" <|body_0|> def create_install_task(self, requested_products: list, products: ProductCollection, parameter_manager: ParametersManager): """фабрич...
stack_v2_sparse_classes_36k_train_016644
5,911
no_license
[ { "docstring": "После каждой установки выполнить sync чтобы current.yaml был в актуальном сосотоянии", "name": "sync_core", "signature": "def sync_core()" }, { "docstring": "фабричный метод: создать такс с переданными параметрами, с типом COMMAND_INSTALL сохранить в базе данных зхапустить воркер...
5
stack_v2_sparse_classes_30k_train_012927
Implement the Python class `MasterProduct` described below. Class description: Implement the MasterProduct class. Method signatures and docstrings: - def sync_core(): После каждой установки выполнить sync чтобы current.yaml был в актуальном сосотоянии - def create_install_task(self, requested_products: list, products...
Implement the Python class `MasterProduct` described below. Class description: Implement the MasterProduct class. Method signatures and docstrings: - def sync_core(): После каждой установки выполнить sync чтобы current.yaml был в актуальном сосотоянии - def create_install_task(self, requested_products: list, products...
c01ca095369524eb5ee8485dc9ab5079ee49fabf
<|skeleton|> class MasterProduct: def sync_core(): """После каждой установки выполнить sync чтобы current.yaml был в актуальном сосотоянии""" <|body_0|> def create_install_task(self, requested_products: list, products: ProductCollection, parameter_manager: ParametersManager): """фабрич...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MasterProduct: def sync_core(): """После каждой установки выполнить sync чтобы current.yaml был в актуальном сосотоянии""" logging.debug('start core updating after install process finished') Core.get_instance().set_expired(True) Core.get_instance().update() def create_inst...
the_stack_v2_python_sparse
web/zooapi/views/master_product.py
perldev/zoo
train
0
82bc337156bf60f4be72d723d4fd2749e8e818f7
[ "self.functions: List[Callable] = functions\nself.input_dict: Dict[str, any] = input_dict\nself.dispatch_table: Dict[Tuple[str], Callable] = self._generate_dispatch_table()", "parameters_not_none, parameter_values_not_none = self._parse_input_dict(self.input_dict)\nif parameters_not_none not in self.dispatch_tabl...
<|body_start_0|> self.functions: List[Callable] = functions self.input_dict: Dict[str, any] = input_dict self.dispatch_table: Dict[Tuple[str], Callable] = self._generate_dispatch_table() <|end_body_0|> <|body_start_1|> parameters_not_none, parameter_values_not_none = self._parse_input_d...
Dispatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dispatcher: def __init__(self, functions: List[Callable], input_dict: Dict[str, Any]): """Initialize the dispatcher with a list of functions and an input dict""" <|body_0|> def __call__(self): """Call the dispatcher with the input dict""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_016645
2,130
no_license
[ { "docstring": "Initialize the dispatcher with a list of functions and an input dict", "name": "__init__", "signature": "def __init__(self, functions: List[Callable], input_dict: Dict[str, Any])" }, { "docstring": "Call the dispatcher with the input dict", "name": "__call__", "signature"...
4
stack_v2_sparse_classes_30k_train_020097
Implement the Python class `Dispatcher` described below. Class description: Implement the Dispatcher class. Method signatures and docstrings: - def __init__(self, functions: List[Callable], input_dict: Dict[str, Any]): Initialize the dispatcher with a list of functions and an input dict - def __call__(self): Call the...
Implement the Python class `Dispatcher` described below. Class description: Implement the Dispatcher class. Method signatures and docstrings: - def __init__(self, functions: List[Callable], input_dict: Dict[str, Any]): Initialize the dispatcher with a list of functions and an input dict - def __call__(self): Call the...
d2ec6d25b577dd6938bbf92317aeff1d6b3c5b08
<|skeleton|> class Dispatcher: def __init__(self, functions: List[Callable], input_dict: Dict[str, Any]): """Initialize the dispatcher with a list of functions and an input dict""" <|body_0|> def __call__(self): """Call the dispatcher with the input dict""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dispatcher: def __init__(self, functions: List[Callable], input_dict: Dict[str, Any]): """Initialize the dispatcher with a list of functions and an input dict""" self.functions: List[Callable] = functions self.input_dict: Dict[str, any] = input_dict self.dispatch_table: Dict[Tu...
the_stack_v2_python_sparse
cg/utils/dispatcher.py
Clinical-Genomics/cg
train
19
7ba0a47cf51fc0b55be038ea136715870d3a13e3
[ "email = form.data.get('email')\nif User.objects.filter(email=email).first():\n messages.info(self.request, 'You already have an account on FireCARES. If you\\'ve forgotten your password or username, use the \"Forgot Password or Username\" links below.')\n return redirect('login')\nif RegistrationWhitelist.i...
<|body_start_0|> email = form.data.get('email') if User.objects.filter(email=email).first(): messages.info(self.request, 'You already have an account on FireCARES. If you\'ve forgotten your password or username, use the "Forgot Password or Username" links below.') return redirec...
Processes account requests.
AccountRequestView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountRequestView: """Processes account requests.""" def form_valid(self, form): """If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.""" <|body_0|> def form_invalid(self, form): """If the form is inval...
stack_v2_sparse_classes_36k_train_016646
23,296
permissive
[ { "docstring": "If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "If the form is invalid, re-render the context data with the data-filled form and err...
3
stack_v2_sparse_classes_30k_train_018144
Implement the Python class `AccountRequestView` described below. Class description: Processes account requests. Method signatures and docstrings: - def form_valid(self, form): If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address. - def form_invalid(self, form):...
Implement the Python class `AccountRequestView` described below. Class description: Processes account requests. Method signatures and docstrings: - def form_valid(self, form): If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address. - def form_invalid(self, form):...
aa708d441790263206dd3a0a480eb6ca9031439d
<|skeleton|> class AccountRequestView: """Processes account requests.""" def form_valid(self, form): """If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.""" <|body_0|> def form_invalid(self, form): """If the form is inval...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountRequestView: """Processes account requests.""" def form_valid(self, form): """If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.""" email = form.data.get('email') if User.objects.filter(email=email).first(): ...
the_stack_v2_python_sparse
firecares/firecares_core/views.py
FireCARES/firecares
train
12
dc9ec16578db695061ce791db760ee937d43a5ec
[ "super().__init__()\nself.height = height\nself.width = width\ncheck_pos_int(height, 'height')\ncheck_pos_int(width, 'width')\nself.coords = torch.stack(torch.meshgrid(torch.arange(height, dtype=torch.float32), torch.arange(width, dtype=torch.float32)), -1)\nself.coords = torch.reshape(self.coords, [-1, 2])", "sa...
<|body_start_0|> super().__init__() self.height = height self.width = width check_pos_int(height, 'height') check_pos_int(width, 'width') self.coords = torch.stack(torch.meshgrid(torch.arange(height, dtype=torch.float32), torch.arange(width, dtype=torch.float32)), -1) ...
The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampled_data = sampler(rays_directions=rays_d, r...
AllPixelSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllPixelSampler: """The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampl...
stack_v2_sparse_classes_36k_train_016647
2,482
permissive
[ { "docstring": "Args: height (int): The height of the 2D array to be sampled. Positive integer. width (int): The width of the 2D array to be sampled. Positive integer.", "name": "__init__", "signature": "def __init__(self, height, width)" }, { "docstring": "Args: image (torch.Tensor): (Optional)...
2
stack_v2_sparse_classes_30k_test_000338
Implement the Python class `AllPixelSampler` described below. Class description: The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelS...
Implement the Python class `AllPixelSampler` described below. Class description: The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelS...
da3680cce7e8fc4c194f13a1528cddbad9a18ab0
<|skeleton|> class AllPixelSampler: """The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllPixelSampler: """The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampled_data = sam...
the_stack_v2_python_sparse
pynif3d/sampling/pixel/all_pixel_sampler.py
pfnet/pynif3d
train
72
70bb710ec74e381e42c45a8c46d9e61787ef34b2
[ "self.session = session\nself.user_fetcher = user_fetcher\nself.publish = publish", "creator = self.user_fetcher(userid)\ngroup = Group(name=name, creator=creator, description=description)\nself.session.add(group)\nself.session.flush()\nif self.publish:\n self.publish('group-join', group.pubid, userid)\nreturn...
<|body_start_0|> self.session = session self.user_fetcher = user_fetcher self.publish = publish <|end_body_0|> <|body_start_1|> creator = self.user_fetcher(userid) group = Group(name=name, creator=creator, description=description) self.session.add(group) self.ses...
A service for manipulating groups and group membership.
GroupsService
[ "MIT", "BSD-2-Clause", "BSD-3-Clause", "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupsService: """A service for manipulating groups and group membership.""" def __init__(self, session, user_fetcher, publish=None): """Create a new groups service. :param session: the SQLAlchemy session object :param user_fetcher: a callable for fetching users by userid :param publ...
stack_v2_sparse_classes_36k_train_016648
2,421
permissive
[ { "docstring": "Create a new groups service. :param session: the SQLAlchemy session object :param user_fetcher: a callable for fetching users by userid :param publish: a callable for publishing events", "name": "__init__", "signature": "def __init__(self, session, user_fetcher, publish=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_001235
Implement the Python class `GroupsService` described below. Class description: A service for manipulating groups and group membership. Method signatures and docstrings: - def __init__(self, session, user_fetcher, publish=None): Create a new groups service. :param session: the SQLAlchemy session object :param user_fet...
Implement the Python class `GroupsService` described below. Class description: A service for manipulating groups and group membership. Method signatures and docstrings: - def __init__(self, session, user_fetcher, publish=None): Create a new groups service. :param session: the SQLAlchemy session object :param user_fet...
fd1decafdce981b681ef3bd59e001b1284498dae
<|skeleton|> class GroupsService: """A service for manipulating groups and group membership.""" def __init__(self, session, user_fetcher, publish=None): """Create a new groups service. :param session: the SQLAlchemy session object :param user_fetcher: a callable for fetching users by userid :param publ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupsService: """A service for manipulating groups and group membership.""" def __init__(self, session, user_fetcher, publish=None): """Create a new groups service. :param session: the SQLAlchemy session object :param user_fetcher: a callable for fetching users by userid :param publish: a callab...
the_stack_v2_python_sparse
h/groups/services.py
project-star/h
train
1
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return IngestSerializerV6\nelif self.request.version == 'v7':\n return IngestSerializerV6", "if request.version == 'v6':\n return self.list_impl(request)\nelif request.version == 'v7':\n return self.list_impl(request)\nraise Http404()", "started = rest_util.parse_...
<|body_start_0|> if self.request.version == 'v6': return IngestSerializerV6 elif self.request.version == 'v7': return IngestSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6': return self.list_impl(request) elif request.version ==...
This view is the endpoint for retrieving the list of all ingests.
IngestsView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IngestsView: """This view is the endpoint for retrieving the list of all ingests.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Determine api versi...
stack_v2_sparse_classes_36k_train_016649
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Determine api version and call specific method :param request: the HTTP POST request :type request:...
3
stack_v2_sparse_classes_30k_train_018563
Implement the Python class `IngestsView` described below. Class description: This view is the endpoint for retrieving the list of all ingests. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, request)...
Implement the Python class `IngestsView` described below. Class description: This view is the endpoint for retrieving the list of all ingests. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, request)...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class IngestsView: """This view is the endpoint for retrieving the list of all ingests.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Determine api versi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IngestsView: """This view is the endpoint for retrieving the list of all ingests.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" if self.request.version == 'v6': return IngestSerializerV6 elif ...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
8a86ad5425b0f50787cd0e7effd4891f2b04cea2
[ "ret_list = [start_node.value]\nstart_node.visited = True\nedges_out = [e for e in start_node.edges if e.node_to.value != start_node.value]\nfor edge in edges_out:\n if not edge.node_to.visited:\n ret_list.extend(self.dfs_helper(edge.node_to))\nreturn ret_list", "node = self.find_node(start_node_num)\ns...
<|body_start_0|> ret_list = [start_node.value] start_node.visited = True edges_out = [e for e in start_node.edges if e.node_to.value != start_node.value] for edge in edges_out: if not edge.node_to.visited: ret_list.extend(self.dfs_helper(edge.node_to)) ...
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: def dfs_helper(self, start_node): """The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQ...
stack_v2_sparse_classes_36k_train_016650
5,068
no_license
[ { "docstring": "The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQUIRES: self._clear_visited() to be called before MOD...
2
stack_v2_sparse_classes_30k_train_007733
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def dfs_helper(self, start_node): The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corr...
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def dfs_helper(self, start_node): The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corr...
8ae0db8508dc5e75a5bf45659debaedf22c72b1f
<|skeleton|> class Graph: def dfs_helper(self, start_node): """The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: def dfs_helper(self, start_node): """The helper function for a recursive implementation of Depth First Search iterating through a node's edges. The output should be a list of numbers corresponding to the values of the traversed nodes. ARGUMENTS: start_node is the starting Node REQUIRES: self._c...
the_stack_v2_python_sparse
review/graph/dijkstraDistance.py
khezam/algos_ds
train
0
ff276b931d6cc3d94f3a53ee29a4987899081d45
[ "default_args = {'imads': False, 'colnames': ('site_wk_score', 'site_str_score')}\nself.df = traindf\nself.set_attrs(params, default_args)\nif len(self.colnames) > 2 or len(self.colnames) == 0:\n raise Exception('there should be only 1 or 2 columns')\nif len(self.colnames) == 1:\n self.col1, self.col2 = (self...
<|body_start_0|> default_args = {'imads': False, 'colnames': ('site_wk_score', 'site_str_score')} self.df = traindf self.set_attrs(params, default_args) if len(self.colnames) > 2 or len(self.colnames) == 0: raise Exception('there should be only 1 or 2 columns') if len...
Affinity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Affinity: def __init__(self, traindf, params): """Affinity prediction feature class Args: traindf: dataframe containing the site_wk_score and site_str_score columns if imadsmodel is None params: - imads Returns: NA""" <|body_0|> def get_feature(self, seqcolname='Sequence'): ...
stack_v2_sparse_classes_36k_train_016651
2,526
permissive
[ { "docstring": "Affinity prediction feature class Args: traindf: dataframe containing the site_wk_score and site_str_score columns if imadsmodel is None params: - imads Returns: NA", "name": "__init__", "signature": "def __init__(self, traindf, params)" }, { "docstring": "Get a dictionary of bin...
2
null
Implement the Python class `Affinity` described below. Class description: Implement the Affinity class. Method signatures and docstrings: - def __init__(self, traindf, params): Affinity prediction feature class Args: traindf: dataframe containing the site_wk_score and site_str_score columns if imadsmodel is None para...
Implement the Python class `Affinity` described below. Class description: Implement the Affinity class. Method signatures and docstrings: - def __init__(self, traindf, params): Affinity prediction feature class Args: traindf: dataframe containing the site_wk_score and site_str_score columns if imadsmodel is None para...
6271b7ede0cacc8fea2b93798b46efb867971478
<|skeleton|> class Affinity: def __init__(self, traindf, params): """Affinity prediction feature class Args: traindf: dataframe containing the site_wk_score and site_str_score columns if imadsmodel is None params: - imads Returns: NA""" <|body_0|> def get_feature(self, seqcolname='Sequence'): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Affinity: def __init__(self, traindf, params): """Affinity prediction feature class Args: traindf: dataframe containing the site_wk_score and site_str_score columns if imadsmodel is None params: - imads Returns: NA""" default_args = {'imads': False, 'colnames': ('site_wk_score', 'site_str_scor...
the_stack_v2_python_sparse
chip2probe/modeler/features/affinity.py
vincentiusmartin/chip2probe
train
1
e0bc5929e95c2429360a00f4b8025981f41836cd
[ "if not a:\n return list()\nt = a[0]\nn = len(a)\nm = len(a[0])\ni = 0\nj = m - 1\nfor s, x in enumerate(self.gen_sect_len(n, m)):\n for y in range(0, x):\n i, j = self.eval_next_loc(s, i, j)\n t.append(a[i][j])\nreturn t", "if m >= n:\n l = 2 * (n - 1)\nelse:\n l = 2 * m - 1\nfor x in r...
<|body_start_0|> if not a: return list() t = a[0] n = len(a) m = len(a[0]) i = 0 j = m - 1 for s, x in enumerate(self.gen_sect_len(n, m)): for y in range(0, x): i, j = self.eval_next_loc(s, i, j) t.append(a[i...
Solution
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def get_spiral_order(self, a): """Traverses all elements of 2D array in spiral order. :param list[list[int]] a: 2D array of positive integers :return: array of elements from input 2D array in spiral order :rtype: list[int]""" <|body_0|> def gen_sect_len(self, n, m)...
stack_v2_sparse_classes_36k_train_016652
3,177
permissive
[ { "docstring": "Traverses all elements of 2D array in spiral order. :param list[list[int]] a: 2D array of positive integers :return: array of elements from input 2D array in spiral order :rtype: list[int]", "name": "get_spiral_order", "signature": "def get_spiral_order(self, a)" }, { "docstring"...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_spiral_order(self, a): Traverses all elements of 2D array in spiral order. :param list[list[int]] a: 2D array of positive integers :return: array of elements from input 2...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def get_spiral_order(self, a): Traverses all elements of 2D array in spiral order. :param list[list[int]] a: 2D array of positive integers :return: array of elements from input 2...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution: def get_spiral_order(self, a): """Traverses all elements of 2D array in spiral order. :param list[list[int]] a: 2D array of positive integers :return: array of elements from input 2D array in spiral order :rtype: list[int]""" <|body_0|> def gen_sect_len(self, n, m)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def get_spiral_order(self, a): """Traverses all elements of 2D array in spiral order. :param list[list[int]] a: 2D array of positive integers :return: array of elements from input 2D array in spiral order :rtype: list[int]""" if not a: return list() t = a[0] ...
the_stack_v2_python_sparse
0054_spiral_matrix/python_source.py
arthurdysart/LeetCode
train
0
6f4cb55a74da7b43fc3207dbc5a2f8ed41a29270
[ "super(KernelSteinTest, self).__init__(p, alpha)\nself.k = k\nself.bootstrapper = bootstrapper\nself.n_simulate = n_simulate\nself.seed = seed", "with util.ContextTimer() as t:\n alpha = self.alpha\n n_simulate = self.n_simulate\n X = dat.data()\n n = X.shape[0]\n _, H = self.compute_stat(dat, retu...
<|body_start_0|> super(KernelSteinTest, self).__init__(p, alpha) self.k = k self.bootstrapper = bootstrapper self.n_simulate = n_simulate self.seed = seed <|end_body_0|> <|body_start_1|> with util.ContextTimer() as t: alpha = self.alpha n_simulate...
Goodness-of-fit test using kernelized Stein discrepancy test of Chwialkowski et al., 2016 and Liu et al., 2016 in ICML 2016. Mainly follow the details in Chwialkowski et al., 2016. The test statistic is n*V_n where V_n is a V-statistic. - This test runs in O(n^2 d^2) time. H0: the sample follows p H1: the sample does n...
KernelSteinTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KernelSteinTest: """Goodness-of-fit test using kernelized Stein discrepancy test of Chwialkowski et al., 2016 and Liu et al., 2016 in ICML 2016. Mainly follow the details in Chwialkowski et al., 2016. The test statistic is n*V_n where V_n is a V-statistic. - This test runs in O(n^2 d^2) time. H0:...
stack_v2_sparse_classes_36k_train_016653
41,550
permissive
[ { "docstring": "p: an instance of UnnormalizedDensity k: a KSTKernel object bootstrapper: a function: (n) |-> numpy array of n weights to be multiplied in the double sum of the test statistic for generating bootstrap samples from the null distribution. alpha: significance level n_simulate: The number of times t...
3
stack_v2_sparse_classes_30k_train_001536
Implement the Python class `KernelSteinTest` described below. Class description: Goodness-of-fit test using kernelized Stein discrepancy test of Chwialkowski et al., 2016 and Liu et al., 2016 in ICML 2016. Mainly follow the details in Chwialkowski et al., 2016. The test statistic is n*V_n where V_n is a V-statistic. -...
Implement the Python class `KernelSteinTest` described below. Class description: Goodness-of-fit test using kernelized Stein discrepancy test of Chwialkowski et al., 2016 and Liu et al., 2016 in ICML 2016. Mainly follow the details in Chwialkowski et al., 2016. The test statistic is n*V_n where V_n is a V-statistic. -...
039a95ed9d8062e283da6bd051b7161a190b4876
<|skeleton|> class KernelSteinTest: """Goodness-of-fit test using kernelized Stein discrepancy test of Chwialkowski et al., 2016 and Liu et al., 2016 in ICML 2016. Mainly follow the details in Chwialkowski et al., 2016. The test statistic is n*V_n where V_n is a V-statistic. - This test runs in O(n^2 d^2) time. H0:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KernelSteinTest: """Goodness-of-fit test using kernelized Stein discrepancy test of Chwialkowski et al., 2016 and Liu et al., 2016 in ICML 2016. Mainly follow the details in Chwialkowski et al., 2016. The test statistic is n*V_n where V_n is a V-statistic. - This test runs in O(n^2 d^2) time. H0: the sample f...
the_stack_v2_python_sparse
kgof/goftest.py
wittawatj/kernel-gof
train
69
af04b9881c8b6e46a3a8cbedccbbbb0c23cea840
[ "super(Gtk.Notebook, self).__init__()\nself.workspace_sidebar = workspace_sidebar\nself.hosts_sidebar = hosts_sidebar\nself.set_tab_pos(Gtk.PositionType.BOTTOM)\nself.append_page(self.workspace_sidebar, Gtk.Label('Workspaces'))\nself.append_page(self.hosts_sidebar, Gtk.Label('Hosts'))", "box = Gtk.Box()\nbox.pack...
<|body_start_0|> super(Gtk.Notebook, self).__init__() self.workspace_sidebar = workspace_sidebar self.hosts_sidebar = hosts_sidebar self.set_tab_pos(Gtk.PositionType.BOTTOM) self.append_page(self.workspace_sidebar, Gtk.Label('Workspaces')) self.append_page(self.hosts_side...
Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)
Sidebar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sidebar: """Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)""" def __init__(self, workspace_sidebar, hosts_sideb...
stack_v2_sparse_classes_36k_train_016654
38,992
no_license
[ { "docstring": "Attach to the notebok the workspace sidebar and the host_sidebar", "name": "__init__", "signature": "def __init__(self, workspace_sidebar, hosts_sidebar)" }, { "docstring": "Wraps the notebook inside a little box.", "name": "box_it", "signature": "def box_it(self)" } ]
2
stack_v2_sparse_classes_30k_val_000450
Implement the Python class `Sidebar` described below. Class description: Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar) Method signatures...
Implement the Python class `Sidebar` described below. Class description: Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar) Method signatures...
8fa21ff67a2e2fd8b92376e5c677d5df474c646e
<|skeleton|> class Sidebar: """Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)""" def __init__(self, workspace_sidebar, hosts_sideb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sidebar: """Defines the bigger sidebar in a notebook. One of its tabs will contain the workspace view, listing all the workspaces (WorkspaceSidebar) and the other will contain the information about hosts, services, and vulns (HostsSidebar)""" def __init__(self, workspace_sidebar, hosts_sidebar): ...
the_stack_v2_python_sparse
gui/gtk/mainwidgets.py
ekiojp/faraday
train
1
a3d1f411e1f95b350666d1f935f0106b81a2ddf9
[ "self.temp = arr[0]\nfor values in range(len(arr) - 1):\n arr[values] = arr[values + 1]\narr[-1] = self.temp", "self.temp = arr[-1]\nfor values in range(len(arr) - 1, -1, -1):\n arr[values] = arr[values - 1]\narr[0] = self.temp", "self.aux = len(arr) * [0]\nfor i in range(len(arr)):\n self.aux[(i + k) ...
<|body_start_0|> self.temp = arr[0] for values in range(len(arr) - 1): arr[values] = arr[values + 1] arr[-1] = self.temp <|end_body_0|> <|body_start_1|> self.temp = arr[-1] for values in range(len(arr) - 1, -1, -1): arr[values] = arr[values - 1] a...
Rotation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rotation: def rotate_left_by_One(self, arr): """Rotate the array left by one""" <|body_0|> def rotate_right_by_One(self, arr): """Rotate the array right by one""" <|body_1|> def rotate_right(self, arr, k): """We use an extra array in which we pla...
stack_v2_sparse_classes_36k_train_016655
3,090
no_license
[ { "docstring": "Rotate the array left by one", "name": "rotate_left_by_One", "signature": "def rotate_left_by_One(self, arr)" }, { "docstring": "Rotate the array right by one", "name": "rotate_right_by_One", "signature": "def rotate_right_by_One(self, arr)" }, { "docstring": "We ...
5
stack_v2_sparse_classes_30k_val_000823
Implement the Python class `Rotation` described below. Class description: Implement the Rotation class. Method signatures and docstrings: - def rotate_left_by_One(self, arr): Rotate the array left by one - def rotate_right_by_One(self, arr): Rotate the array right by one - def rotate_right(self, arr, k): We use an ex...
Implement the Python class `Rotation` described below. Class description: Implement the Rotation class. Method signatures and docstrings: - def rotate_left_by_One(self, arr): Rotate the array left by one - def rotate_right_by_One(self, arr): Rotate the array right by one - def rotate_right(self, arr, k): We use an ex...
0892f41fe055de4361aae950fb60b0e3c2f96505
<|skeleton|> class Rotation: def rotate_left_by_One(self, arr): """Rotate the array left by one""" <|body_0|> def rotate_right_by_One(self, arr): """Rotate the array right by one""" <|body_1|> def rotate_right(self, arr, k): """We use an extra array in which we pla...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rotation: def rotate_left_by_One(self, arr): """Rotate the array left by one""" self.temp = arr[0] for values in range(len(arr) - 1): arr[values] = arr[values + 1] arr[-1] = self.temp def rotate_right_by_One(self, arr): """Rotate the array right by one"...
the_stack_v2_python_sparse
DataStructures/v1/code/Geeks/arrayRotation.py
acemodou/Working-Copy
train
0
382aa8b4adefc523e5185dd5e6e9e9e6b466b01f
[ "l, r = (0, 0)\nwindow_sum = 0\nres = float('inf')\nwhile r < len(s):\n windom_sum += nums[r]\n while window_sum >= s:\n res = min(res, r - l + 1)\n window_sum -= nums[l]\n l += 1\n r += 1\nreturn res if res != float('inf') else -1", "import bisect\nprefix = [0]\ncurr_sum = 0\nres = ...
<|body_start_0|> l, r = (0, 0) window_sum = 0 res = float('inf') while r < len(s): windom_sum += nums[r] while window_sum >= s: res = min(res, r - l + 1) window_sum -= nums[l] l += 1 r += 1 return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSubArrayLen1(self, s: int, nums: List[int]) -> int: """two pointer Time: O(N) Space: O(1)""" <|body_0|> def minSubArrayLen1(self, s: int, nums: List[iint]) -> int: """binary serach Time: O(NlogN) Space: O(N)""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_016656
1,520
no_license
[ { "docstring": "two pointer Time: O(N) Space: O(1)", "name": "minSubArrayLen1", "signature": "def minSubArrayLen1(self, s: int, nums: List[int]) -> int" }, { "docstring": "binary serach Time: O(NlogN) Space: O(N)", "name": "minSubArrayLen1", "signature": "def minSubArrayLen1(self, s: int...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen1(self, s: int, nums: List[int]) -> int: two pointer Time: O(N) Space: O(1) - def minSubArrayLen1(self, s: int, nums: List[iint]) -> int: binary serach Time: O(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen1(self, s: int, nums: List[int]) -> int: two pointer Time: O(N) Space: O(1) - def minSubArrayLen1(self, s: int, nums: List[iint]) -> int: binary serach Time: O(...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def minSubArrayLen1(self, s: int, nums: List[int]) -> int: """two pointer Time: O(N) Space: O(1)""" <|body_0|> def minSubArrayLen1(self, s: int, nums: List[iint]) -> int: """binary serach Time: O(NlogN) Space: O(N)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minSubArrayLen1(self, s: int, nums: List[int]) -> int: """two pointer Time: O(N) Space: O(1)""" l, r = (0, 0) window_sum = 0 res = float('inf') while r < len(s): windom_sum += nums[r] while window_sum >= s: res = min...
the_stack_v2_python_sparse
Leetcode 0209. Minimum Size Subarray Sum.py
Chaoran-sjsu/leetcode
train
0
9702d42418b855b14e020ad1874da9f9f89b65d9
[ "self.A = A\nself.B = B\nself.F = F", "current_state = np.mat(current_state).reshape(-1, 1)\ntarget_state = np.mat(target_state).reshape(-1, 1)\nns = self.A * current_state + self.B * self.F * (target_state - current_state)\nreturn ns", "current_state = np.mat(current_state).reshape(-1, 1)\ntarget_state = np.ma...
<|body_start_0|> self.A = A self.B = B self.F = F <|end_body_0|> <|body_start_1|> current_state = np.mat(current_state).reshape(-1, 1) target_state = np.mat(target_state).reshape(-1, 1) ns = self.A * current_state + self.B * self.F * (target_state - current_state) ...
Generic linear state-feedback controller. Can be time-varying in general and not be related to a specific cost function
LinearFeedbackController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearFeedbackController: """Generic linear state-feedback controller. Can be time-varying in general and not be related to a specific cost function""" def __init__(self, A, B, F): """Constructor for LinearFeedbackController FC for a linear system x_{t+1} = Ax_t + Bu_t where the cont...
stack_v2_sparse_classes_36k_train_016657
12,992
permissive
[ { "docstring": "Constructor for LinearFeedbackController FC for a linear system x_{t+1} = Ax_t + Bu_t where the control input u_t is calculated using linear feedback u_t = F(x_t - x^*) Parameters ---------- B : np.mat Input matrix for the system F : np.mat static feedback gain matrix Returns ------- LinearFeedb...
3
null
Implement the Python class `LinearFeedbackController` described below. Class description: Generic linear state-feedback controller. Can be time-varying in general and not be related to a specific cost function Method signatures and docstrings: - def __init__(self, A, B, F): Constructor for LinearFeedbackController FC...
Implement the Python class `LinearFeedbackController` described below. Class description: Generic linear state-feedback controller. Can be time-varying in general and not be related to a specific cost function Method signatures and docstrings: - def __init__(self, A, B, F): Constructor for LinearFeedbackController FC...
a0e296aa663b49e767c9ebb274defb54b301eb12
<|skeleton|> class LinearFeedbackController: """Generic linear state-feedback controller. Can be time-varying in general and not be related to a specific cost function""" def __init__(self, A, B, F): """Constructor for LinearFeedbackController FC for a linear system x_{t+1} = Ax_t + Bu_t where the cont...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearFeedbackController: """Generic linear state-feedback controller. Can be time-varying in general and not be related to a specific cost function""" def __init__(self, A, B, F): """Constructor for LinearFeedbackController FC for a linear system x_{t+1} = Ax_t + Bu_t where the control input u_t...
the_stack_v2_python_sparse
riglib/bmi/feedback_controllers.py
carmenalab/brain-python-interface
train
9
c4e1e3ea8175d10b531a815628f04de2d02710cf
[ "self.loggit = logging.getLogger('curator.actions.cold2frozen')\nverify_index_list(ilo)\nilo.empty_list_check()\nself.index_list = ilo\nself.client = ilo.client\nself.indices = ilo\nself.index_settings = None\nself.ignore_index_settings = None\nself.wait_for_completion = None\nself.assign_kwargs(**kwargs)", "for ...
<|body_start_0|> self.loggit = logging.getLogger('curator.actions.cold2frozen') verify_index_list(ilo) ilo.empty_list_check() self.index_list = ilo self.client = ilo.client self.indices = ilo self.index_settings = None self.ignore_index_settings = None ...
Cold to Frozen Tier Searchable Snapshot Action Class For manually migrating snapshots not associated with ILM from the cold tier to the frozen tier.
Cold2Frozen
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cold2Frozen: """Cold to Frozen Tier Searchable Snapshot Action Class For manually migrating snapshots not associated with ILM from the cold tier to the frozen tier.""" def __init__(self, ilo, **kwargs): """:param ilo: An IndexList Object :param index_settings: (Optional) Settings tha...
stack_v2_sparse_classes_36k_train_016658
8,770
permissive
[ { "docstring": ":param ilo: An IndexList Object :param index_settings: (Optional) Settings that should be added to the index when it is mounted. If not set, set the ``_tier_preference`` to the tiers available, coldest first. :param ignore_index_settings: (Optional, array of strings) Names of settings that shoul...
5
stack_v2_sparse_classes_30k_train_002441
Implement the Python class `Cold2Frozen` described below. Class description: Cold to Frozen Tier Searchable Snapshot Action Class For manually migrating snapshots not associated with ILM from the cold tier to the frozen tier. Method signatures and docstrings: - def __init__(self, ilo, **kwargs): :param ilo: An IndexL...
Implement the Python class `Cold2Frozen` described below. Class description: Cold to Frozen Tier Searchable Snapshot Action Class For manually migrating snapshots not associated with ILM from the cold tier to the frozen tier. Method signatures and docstrings: - def __init__(self, ilo, **kwargs): :param ilo: An IndexL...
b41743a061ad790820affe7acee5f71abe819357
<|skeleton|> class Cold2Frozen: """Cold to Frozen Tier Searchable Snapshot Action Class For manually migrating snapshots not associated with ILM from the cold tier to the frozen tier.""" def __init__(self, ilo, **kwargs): """:param ilo: An IndexList Object :param index_settings: (Optional) Settings tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cold2Frozen: """Cold to Frozen Tier Searchable Snapshot Action Class For manually migrating snapshots not associated with ILM from the cold tier to the frozen tier.""" def __init__(self, ilo, **kwargs): """:param ilo: An IndexList Object :param index_settings: (Optional) Settings that should be a...
the_stack_v2_python_sparse
curator/actions/cold2frozen.py
volatilemolotov/curator
train
0
509adb8d0a921cbcd885c4532fda894c28e7829e
[ "AWS_PSTORE_PROJECT = '/MarksWebsite/'\nAWS_PSTORE_ENV = 'test'\nAWS_PSTORE_REGION = 'eu-west-2'\nobjStore = AWSParameterStore(AWS_PSTORE_PROJECT, AWS_PSTORE_ENV, AWS_PSTORE_REGION)\nres = objStore.get_parameter('PARAMSTORE_TEST', False)\nself.assertEqual(res, 'SUCCESS')", "lstIn = []\nret = appendEC2IPToArray(ls...
<|body_start_0|> AWS_PSTORE_PROJECT = '/MarksWebsite/' AWS_PSTORE_ENV = 'test' AWS_PSTORE_REGION = 'eu-west-2' objStore = AWSParameterStore(AWS_PSTORE_PROJECT, AWS_PSTORE_ENV, AWS_PSTORE_REGION) res = objStore.get_parameter('PARAMSTORE_TEST', False) self.assertEqual(res, ...
EBDjangoTestSimple
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EBDjangoTestSimple: def test_parameter_store(self): """This creates an AWSParameterStore object and then uses it to extract a parameter. I have a test parameter setup specifically for the test.""" <|body_0|> def test_add_ec2ip(self): """I cannot do a huge amount with...
stack_v2_sparse_classes_36k_train_016659
1,759
permissive
[ { "docstring": "This creates an AWSParameterStore object and then uses it to extract a parameter. I have a test parameter setup specifically for the test.", "name": "test_parameter_store", "signature": "def test_parameter_store(self)" }, { "docstring": "I cannot do a huge amount with this becaus...
2
null
Implement the Python class `EBDjangoTestSimple` described below. Class description: Implement the EBDjangoTestSimple class. Method signatures and docstrings: - def test_parameter_store(self): This creates an AWSParameterStore object and then uses it to extract a parameter. I have a test parameter setup specifically f...
Implement the Python class `EBDjangoTestSimple` described below. Class description: Implement the EBDjangoTestSimple class. Method signatures and docstrings: - def test_parameter_store(self): This creates an AWSParameterStore object and then uses it to extract a parameter. I have a test parameter setup specifically f...
e6a6a76376d122b224d4744314e687f660aad770
<|skeleton|> class EBDjangoTestSimple: def test_parameter_store(self): """This creates an AWSParameterStore object and then uses it to extract a parameter. I have a test parameter setup specifically for the test.""" <|body_0|> def test_add_ec2ip(self): """I cannot do a huge amount with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EBDjangoTestSimple: def test_parameter_store(self): """This creates an AWSParameterStore object and then uses it to extract a parameter. I have a test parameter setup specifically for the test.""" AWS_PSTORE_PROJECT = '/MarksWebsite/' AWS_PSTORE_ENV = 'test' AWS_PSTORE_REGION =...
the_stack_v2_python_sparse
ebdjango/tests.py
MarkyMark1000/AWS---PYTHON---COPY---MYWEBSITE
train
1
3a7660e003988568899bd07222e53a87855df3d4
[ "super().__init__()\nself.input_conv = nn.Conv1D(in_channels, hidden_channels, 1)\nself.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, layers=layers, stacks=stacks, base_dilation=base_dilation, residual_channels=hidden_channels, aux_channels=-1, gate_channels=hidden_channels * 2, skip_c...
<|body_start_0|> super().__init__() self.input_conv = nn.Conv1D(in_channels, hidden_channels, 1) self.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, layers=layers, stacks=stacks, base_dilation=base_dilation, residual_channels=hidden_channels, aux_channels=-1, gate_ch...
Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`: https://arxiv.org/abs/2006.04558
PosteriorEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PosteriorEncoder: """Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speec...
stack_v2_sparse_classes_36k_train_016660
4,766
permissive
[ { "docstring": "Initilialize PosteriorEncoder module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. hidden_channels (int): Number of hidden channels. kernel_size (int): Kernel size in WaveNet. layers (int): Number of layers of WaveNet. stacks (int): Number of ...
2
stack_v2_sparse_classes_30k_train_019714
Implement the Python class `PosteriorEncoder` described below. Class description: Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversaria...
Implement the Python class `PosteriorEncoder` described below. Class description: Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversaria...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class PosteriorEncoder: """Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PosteriorEncoder: """Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`: https://a...
the_stack_v2_python_sparse
paddlespeech/t2s/models/vits/posterior_encoder.py
anniyanvr/DeepSpeech-1
train
0
f55a9e9b1450b6336add72e8bc38bb2163c22517
[ "data = np.zeros((2, 3, 3), dtype=np.float32)\npercentiles = np.array([50.0, 90.0], dtype=np.float32)\nself.cube_wg = set_up_percentile_cube(data, percentiles)", "perc_coord = find_percentile_coordinate(self.cube_wg)\nself.assertIsInstance(perc_coord, iris.coords.Coord)\nself.assertEqual(perc_coord.name(), 'perce...
<|body_start_0|> data = np.zeros((2, 3, 3), dtype=np.float32) percentiles = np.array([50.0, 90.0], dtype=np.float32) self.cube_wg = set_up_percentile_cube(data, percentiles) <|end_body_0|> <|body_start_1|> perc_coord = find_percentile_coordinate(self.cube_wg) self.assertIsInstan...
Test whether the cube has a percentile coordinate.
Test_find_percentile_coordinate
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_find_percentile_coordinate: """Test whether the cube has a percentile coordinate.""" def setUp(self): """Create a wind-speed and wind-gust cube with percentile coord.""" <|body_0|> def test_basic(self): """Test that the function returns a Coord.""" <...
stack_v2_sparse_classes_36k_train_016661
19,394
permissive
[ { "docstring": "Create a wind-speed and wind-gust cube with percentile coord.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the function returns a Coord.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test it raises...
5
stack_v2_sparse_classes_30k_train_017966
Implement the Python class `Test_find_percentile_coordinate` described below. Class description: Test whether the cube has a percentile coordinate. Method signatures and docstrings: - def setUp(self): Create a wind-speed and wind-gust cube with percentile coord. - def test_basic(self): Test that the function returns ...
Implement the Python class `Test_find_percentile_coordinate` described below. Class description: Test whether the cube has a percentile coordinate. Method signatures and docstrings: - def setUp(self): Create a wind-speed and wind-gust cube with percentile coord. - def test_basic(self): Test that the function returns ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_find_percentile_coordinate: """Test whether the cube has a percentile coordinate.""" def setUp(self): """Create a wind-speed and wind-gust cube with percentile coord.""" <|body_0|> def test_basic(self): """Test that the function returns a Coord.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_find_percentile_coordinate: """Test whether the cube has a percentile coordinate.""" def setUp(self): """Create a wind-speed and wind-gust cube with percentile coord.""" data = np.zeros((2, 3, 3), dtype=np.float32) percentiles = np.array([50.0, 90.0], dtype=np.float32) ...
the_stack_v2_python_sparse
improver_tests/metadata/test_probabilistic.py
metoppv/improver
train
101
83a57acc792f965c7caee99eaf48d33e35da4fe0
[ "allAnnotations = [annotation for annotator in annotations for annotation in annotator]\nclusteredPos = []\nclusteredIndex = set([])\nfor i, annotation in enumerate(allAnnotations):\n if i in clusteredIndex:\n continue\n clusterIdx = [j for j, value in enumerate(allAnnotations) if j not in clusteredInd...
<|body_start_0|> allAnnotations = [annotation for annotator in annotations for annotation in annotator] clusteredPos = [] clusteredIndex = set([]) for i, annotation in enumerate(allAnnotations): if i in clusteredIndex: continue clusterIdx = [j for ...
class handling jams serialization of track or mixes
JamsSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JamsSerializer: """class handling jams serialization of track or mixes""" def aggregateAnnotations(annotations, agreementThreshold=0, agreementThresholdLastPoint=0.5, distanceAgreement=0.5, minimalAnnotator=0): """Aggregate the points of the same track from different annotators. - Re...
stack_v2_sparse_classes_36k_train_016662
8,287
permissive
[ { "docstring": "Aggregate the points of the same track from different annotators. - Return only the points having a ratio of annotators annotating it above the threshold - The points aggregated are clustered based on the distanceAgrement - The tracks without the threshold number of annotator are completely disc...
3
null
Implement the Python class `JamsSerializer` described below. Class description: class handling jams serialization of track or mixes Method signatures and docstrings: - def aggregateAnnotations(annotations, agreementThreshold=0, agreementThresholdLastPoint=0.5, distanceAgreement=0.5, minimalAnnotator=0): Aggregate the...
Implement the Python class `JamsSerializer` described below. Class description: class handling jams serialization of track or mixes Method signatures and docstrings: - def aggregateAnnotations(annotations, agreementThreshold=0, agreementThresholdLastPoint=0.5, distanceAgreement=0.5, minimalAnnotator=0): Aggregate the...
dfaa00a9e7c5c0938c0a9d275c07f3a3e5f87e43
<|skeleton|> class JamsSerializer: """class handling jams serialization of track or mixes""" def aggregateAnnotations(annotations, agreementThreshold=0, agreementThresholdLastPoint=0.5, distanceAgreement=0.5, minimalAnnotator=0): """Aggregate the points of the same track from different annotators. - Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JamsSerializer: """class handling jams serialization of track or mixes""" def aggregateAnnotations(annotations, agreementThreshold=0, agreementThresholdLastPoint=0.5, distanceAgreement=0.5, minimalAnnotator=0): """Aggregate the points of the same track from different annotators. - Return only the...
the_stack_v2_python_sparse
automix/model/inputOutput/serializer/jamsSerializer.py
jarey/Automix
train
0
8670dcde71b55d3c77f3325ba68c4f1dff5e22a7
[ "offset = request.args.get('offset', 0)\nlimit = request.args.get('limit', 10)\norder_by = request.args.get('order_by', 'id')\norder = request.args.get('order', 'ASC')\nsearch_params = get_search_params(request.args, ['title', 'description'])\nreturn dal.provider.paged(offset, limit, order_by, order, search_params)...
<|body_start_0|> offset = request.args.get('offset', 0) limit = request.args.get('limit', 10) order_by = request.args.get('order_by', 'id') order = request.args.get('order', 'ASC') search_params = get_search_params(request.args, ['title', 'description']) return dal.provid...
ProviderCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProviderCollection: def get(self): """Returns list of providers.""" <|body_0|> def post(self): """Creates a new provider.""" <|body_1|> <|end_skeleton|> <|body_start_0|> offset = request.args.get('offset', 0) limit = request.args.get('limit'...
stack_v2_sparse_classes_36k_train_016663
2,885
no_license
[ { "docstring": "Returns list of providers.", "name": "get", "signature": "def get(self)" }, { "docstring": "Creates a new provider.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_021442
Implement the Python class `ProviderCollection` described below. Class description: Implement the ProviderCollection class. Method signatures and docstrings: - def get(self): Returns list of providers. - def post(self): Creates a new provider.
Implement the Python class `ProviderCollection` described below. Class description: Implement the ProviderCollection class. Method signatures and docstrings: - def get(self): Returns list of providers. - def post(self): Creates a new provider. <|skeleton|> class ProviderCollection: def get(self): """Ret...
527231a4a2747ffc87ed86299cc02b8361d49c9c
<|skeleton|> class ProviderCollection: def get(self): """Returns list of providers.""" <|body_0|> def post(self): """Creates a new provider.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProviderCollection: def get(self): """Returns list of providers.""" offset = request.args.get('offset', 0) limit = request.args.get('limit', 10) order_by = request.args.get('order_by', 'id') order = request.args.get('order', 'ASC') search_params = get_search_par...
the_stack_v2_python_sparse
obras/service/genl/endpoints/providers.py
pianodaemon/SJO
train
0
80b2c664bf95039f3f1c8abb460ba7dc04c81b88
[ "brightness_limit = _check_and_convert_limit_value(brightness_limit)\ncontrast_limit = _check_and_convert_limit_value(contrast_limit)\nself.brightness_uniform = ops.Uniform(range=brightness_limit)\nself.contrast_uniform = ops.Uniform(range=contrast_limit)\nself.random_brightness_contrast = ops.BrightnessContrast(de...
<|body_start_0|> brightness_limit = _check_and_convert_limit_value(brightness_limit) contrast_limit = _check_and_convert_limit_value(contrast_limit) self.brightness_uniform = ops.Uniform(range=brightness_limit) self.contrast_uniform = ops.Uniform(range=contrast_limit) self.random...
Randomly adjust the brightness and contrast of the image
RandomBrightnessContrast
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomBrightnessContrast: """Randomly adjust the brightness and contrast of the image""" def __init__(self, p: float=0.5, brightness_limit: Union[List, float]=0.5, contrast_limit: Union[List, float]=0.5): """Initialization Args: p (float, optional): Probability to apply this transfor...
stack_v2_sparse_classes_36k_train_016664
22,608
no_license
[ { "docstring": "Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to .5. brightness_limit (Union[List,float], optional): Factor multiplier range for changing brightness in [min,max] value format. If provided as a single float, the range will be 1 + (-limit, limit). Def...
2
stack_v2_sparse_classes_30k_train_008575
Implement the Python class `RandomBrightnessContrast` described below. Class description: Randomly adjust the brightness and contrast of the image Method signatures and docstrings: - def __init__(self, p: float=0.5, brightness_limit: Union[List, float]=0.5, contrast_limit: Union[List, float]=0.5): Initialization Args...
Implement the Python class `RandomBrightnessContrast` described below. Class description: Randomly adjust the brightness and contrast of the image Method signatures and docstrings: - def __init__(self, p: float=0.5, brightness_limit: Union[List, float]=0.5, contrast_limit: Union[List, float]=0.5): Initialization Args...
1532db8447d03e75d5ec26f93111270a4ccb7a7e
<|skeleton|> class RandomBrightnessContrast: """Randomly adjust the brightness and contrast of the image""" def __init__(self, p: float=0.5, brightness_limit: Union[List, float]=0.5, contrast_limit: Union[List, float]=0.5): """Initialization Args: p (float, optional): Probability to apply this transfor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomBrightnessContrast: """Randomly adjust the brightness and contrast of the image""" def __init__(self, p: float=0.5, brightness_limit: Union[List, float]=0.5, contrast_limit: Union[List, float]=0.5): """Initialization Args: p (float, optional): Probability to apply this transformation. Defau...
the_stack_v2_python_sparse
src/development/vortex/development/utils/data/augment/modules/nvidia_dali/modules.py
jesslynsepthiaa/vortex
train
0
941d6c1aaeadf5e8da8e2535cdf97cde77c0c2bb
[ "if not user_id:\n return ({'error': 'mandatory parameter user_id not supplied'}, 404)\nprint('making request to leave handler to post attendance')\nleave_handler = LeaveHandler()\nrecords = leave_handler.get_leave_record(user_id)\nreturn jsonify(records)", "if not user_id:\n return ({'error': 'employee id ...
<|body_start_0|> if not user_id: return ({'error': 'mandatory parameter user_id not supplied'}, 404) print('making request to leave handler to post attendance') leave_handler = LeaveHandler() records = leave_handler.get_leave_record(user_id) return jsonify(records) <|...
SubmitLeave
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmitLeave: def get(self, user_id): """gets all the leave records given the user id Param: leave_id: user id. Request: path: "api/v0/submitleave/<userid>" query_params: > user_id Response: return { date_of_applying: "2020-05-21", date_range: {start_date: "2020-05-21", end_date: "2020-05...
stack_v2_sparse_classes_36k_train_016665
6,574
no_license
[ { "docstring": "gets all the leave records given the user id Param: leave_id: user id. Request: path: \"api/v0/submitleave/<userid>\" query_params: > user_id Response: return { date_of_applying: \"2020-05-21\", date_range: {start_date: \"2020-05-21\", end_date: \"2020-05-22\"}, no of days: 1, type of leave: \"g...
2
stack_v2_sparse_classes_30k_train_009414
Implement the Python class `SubmitLeave` described below. Class description: Implement the SubmitLeave class. Method signatures and docstrings: - def get(self, user_id): gets all the leave records given the user id Param: leave_id: user id. Request: path: "api/v0/submitleave/<userid>" query_params: > user_id Response...
Implement the Python class `SubmitLeave` described below. Class description: Implement the SubmitLeave class. Method signatures and docstrings: - def get(self, user_id): gets all the leave records given the user id Param: leave_id: user id. Request: path: "api/v0/submitleave/<userid>" query_params: > user_id Response...
cb990525bb9da7fef1e82735ea5ca6f5ad67825a
<|skeleton|> class SubmitLeave: def get(self, user_id): """gets all the leave records given the user id Param: leave_id: user id. Request: path: "api/v0/submitleave/<userid>" query_params: > user_id Response: return { date_of_applying: "2020-05-21", date_range: {start_date: "2020-05-21", end_date: "2020-05...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubmitLeave: def get(self, user_id): """gets all the leave records given the user id Param: leave_id: user id. Request: path: "api/v0/submitleave/<userid>" query_params: > user_id Response: return { date_of_applying: "2020-05-21", date_range: {start_date: "2020-05-21", end_date: "2020-05-22"}, no of d...
the_stack_v2_python_sparse
server/services/leave_management/leave_controller.py
goel-aman/Erp-Backend-Code
train
0
1e12709f54a7ef504a524019d0c1f7dd86608e31
[ "if len(nums) == 1:\n return nums[0]\n\ndef my_rob(nums):\n if not nums:\n return 0\n if len(nums) == 1:\n return nums[0]\n memo = [0] * len(nums)\n memo[0] = nums[0]\n memo[1] = max(memo[0], nums[1])\n for i in range(2, len(nums)):\n memo[i] = max(memo[i - 2] + nums[i], me...
<|body_start_0|> if len(nums) == 1: return nums[0] def my_rob(nums): if not nums: return 0 if len(nums) == 1: return nums[0] memo = [0] * len(nums) memo[0] = nums[0] memo[1] = max(memo[0], nums[1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob_2variables(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 1: ...
stack_v2_sparse_classes_36k_train_016666
1,316
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: int", "name": "rob_2variables", "signature": "def rob_2variables(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_018779
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob_2variables(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def rob_2variables(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def rob_2variables(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 1: return nums[0] def my_rob(nums): if not nums: return 0 if len(nums) == 1: return nums[0] memo = [0] * len(nums) ...
the_stack_v2_python_sparse
LeetCode/DynamicProgramming/213_house_robber_ii.py
XyK0907/for_work
train
0
0c7af7bd9d42bbe557fc871a81bd7469c45733e6
[ "if pixelization_level <= 0:\n return image\nresize_width_ratio = image.width / 1000.0\nresize_height_ratio = image.height / 1000.0\nenlarged_image = image.resize((int(image.width / pixelization_level / resize_width_ratio), int(image.height / pixelization_level / resize_height_ratio)))\nresized_image = enlarged_...
<|body_start_0|> if pixelization_level <= 0: return image resize_width_ratio = image.width / 1000.0 resize_height_ratio = image.height / 1000.0 enlarged_image = image.resize((int(image.width / pixelization_level / resize_width_ratio), int(image.height / pixelization_level / r...
ImageResizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageResizer: def resize_image_conserved(image, pixelization_level): """Downscale an image and then upscale the image by the same amount, creating a pixelized effect. When inputting a level of pixelization, this specific method outputs the same amount of pixelization regardless of the si...
stack_v2_sparse_classes_36k_train_016667
2,151
permissive
[ { "docstring": "Downscale an image and then upscale the image by the same amount, creating a pixelized effect. When inputting a level of pixelization, this specific method outputs the same amount of pixelization regardless of the size of the image. In other words, the amount of resizing depends on the size of t...
2
stack_v2_sparse_classes_30k_test_000836
Implement the Python class `ImageResizer` described below. Class description: Implement the ImageResizer class. Method signatures and docstrings: - def resize_image_conserved(image, pixelization_level): Downscale an image and then upscale the image by the same amount, creating a pixelized effect. When inputting a lev...
Implement the Python class `ImageResizer` described below. Class description: Implement the ImageResizer class. Method signatures and docstrings: - def resize_image_conserved(image, pixelization_level): Downscale an image and then upscale the image by the same amount, creating a pixelized effect. When inputting a lev...
8931c8859878692134f5113d4c6c3e17561f0196
<|skeleton|> class ImageResizer: def resize_image_conserved(image, pixelization_level): """Downscale an image and then upscale the image by the same amount, creating a pixelized effect. When inputting a level of pixelization, this specific method outputs the same amount of pixelization regardless of the si...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageResizer: def resize_image_conserved(image, pixelization_level): """Downscale an image and then upscale the image by the same amount, creating a pixelized effect. When inputting a level of pixelization, this specific method outputs the same amount of pixelization regardless of the size of the imag...
the_stack_v2_python_sparse
UpdatedSyntheticDataset/SyntheticDataset2/ImageOperations/image_resizer.py
FlintHill/SUAS-Competition
train
5
866c93ef6acf0d89e81f08c07cf1e753536a6c98
[ "super().__init__()\nself.vgg2l = torch.nn.Sequential(torch.nn.Conv2d(1, 64, 3, stride=1, padding=1), torch.nn.ReLU(), torch.nn.Conv2d(64, 64, 3, stride=1, padding=1), torch.nn.ReLU(), torch.nn.MaxPool2d((3, 2)), torch.nn.Conv2d(64, 128, 3, stride=1, padding=1), torch.nn.ReLU(), torch.nn.Conv2d(128, 128, 3, stride=...
<|body_start_0|> super().__init__() self.vgg2l = torch.nn.Sequential(torch.nn.Conv2d(1, 64, 3, stride=1, padding=1), torch.nn.ReLU(), torch.nn.Conv2d(64, 64, 3, stride=1, padding=1), torch.nn.ReLU(), torch.nn.MaxPool2d((3, 2)), torch.nn.Conv2d(64, 128, 3, stride=1, padding=1), torch.nn.ReLU(), torch.nn....
VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class.
VGG2L
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VGG2L: """VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class.""" def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module=None): """Construct a VGG2L object.""" <|body_0|> def forward(self, fe...
stack_v2_sparse_classes_36k_train_016668
2,782
permissive
[ { "docstring": "Construct a VGG2L object.", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module=None)" }, { "docstring": "Forward VGG2L bottleneck. Args: feats: Feature sequences. (B, F, D_feats) feats_mask: Mask of feature sequences. (B, 1, F) Ret...
3
null
Implement the Python class `VGG2L` described below. Class description: VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class. Method signatures and docstrings: - def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module=None): Construct a VGG2...
Implement the Python class `VGG2L` described below. Class description: VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class. Method signatures and docstrings: - def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module=None): Construct a VGG2...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class VGG2L: """VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class.""" def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module=None): """Construct a VGG2L object.""" <|body_0|> def forward(self, fe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VGG2L: """VGG2L module for custom encoder. Args: idim: Input dimension. odim: Output dimension. pos_enc: Positional encoding class.""" def __init__(self, idim: int, odim: int, pos_enc: torch.nn.Module=None): """Construct a VGG2L object.""" super().__init__() self.vgg2l = torch.nn....
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/transducer/vgg2l.py
espnet/espnet
train
7,242
0b839aed9f6d5a504876879e753df63c85d3b9b9
[ "version = ''\nif config_file == '':\n version = 'params'\nelse:\n version = config_file\nwandb = False\ncfg = cfg_parser(osp.join('config', version + '.json'))\ncfg['experiment'].wandb = wandb\ncfg['experiment'].version = version\ncfg['experiment'].wandb_id = 'id'\ncfg['experiment'].wandb_name = 'MicroNet-Ts...
<|body_start_0|> version = '' if config_file == '': version = 'params' else: version = config_file wandb = False cfg = cfg_parser(osp.join('config', version + '.json')) cfg['experiment'].wandb = wandb cfg['experiment'].version = version ...
Training options for commandline
TrainOptions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainOptions: """Training options for commandline""" def initialize(self, config_file): """Parameter definitions Returns: ArgumentParser.parse_args: Params values for training Command line arguments: --version [str]: name of the config file to use --wandb [bool]: Log to wandb or not"...
stack_v2_sparse_classes_36k_train_016669
1,974
no_license
[ { "docstring": "Parameter definitions Returns: ArgumentParser.parse_args: Params values for training Command line arguments: --version [str]: name of the config file to use --wandb [bool]: Log to wandb or not", "name": "initialize", "signature": "def initialize(self, config_file)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_010629
Implement the Python class `TrainOptions` described below. Class description: Training options for commandline Method signatures and docstrings: - def initialize(self, config_file): Parameter definitions Returns: ArgumentParser.parse_args: Params values for training Command line arguments: --version [str]: name of th...
Implement the Python class `TrainOptions` described below. Class description: Training options for commandline Method signatures and docstrings: - def initialize(self, config_file): Parameter definitions Returns: ArgumentParser.parse_args: Params values for training Command line arguments: --version [str]: name of th...
dc35bc0d2896f7d76074c83fc633d2bf86cf2c0e
<|skeleton|> class TrainOptions: """Training options for commandline""" def initialize(self, config_file): """Parameter definitions Returns: ArgumentParser.parse_args: Params values for training Command line arguments: --version [str]: name of the config file to use --wandb [bool]: Log to wandb or not"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainOptions: """Training options for commandline""" def initialize(self, config_file): """Parameter definitions Returns: ArgumentParser.parse_args: Params values for training Command line arguments: --version [str]: name of the config file to use --wandb [bool]: Log to wandb or not""" ve...
the_stack_v2_python_sparse
data/traffic_sign_interiit/options/train_options.py
yash12khandelwal/traffic_sign_interiit
train
4
816b1945f37628be0ff9e92dc52a970ad6ce9c3f
[ "super().__init__(**kwargs)\nself.func = func\nself.args = args or {}", "response = self.func(**self.args)\nif response.status_code > 0 and self.skippable:\n response.warning = True\n response.status_code = 0\nreturn response" ]
<|body_start_0|> super().__init__(**kwargs) self.func = func self.args = args or {} <|end_body_0|> <|body_start_1|> response = self.func(**self.args) if response.status_code > 0 and self.skippable: response.warning = True response.status_code = 0 ...
A step which execution is a function call. Is composed of a function, arguments, and a message (feedback).
FunctionStep
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionStep: """A step which execution is a function call. Is composed of a function, arguments, and a message (feedback).""" def __init__(self, func, args=None, **kwargs): """Constructor.""" <|body_0|> def execute(self): """Execute the function with the given a...
stack_v2_sparse_classes_36k_train_016670
1,815
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, func, args=None, **kwargs)" }, { "docstring": "Execute the function with the given arguments.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_017159
Implement the Python class `FunctionStep` described below. Class description: A step which execution is a function call. Is composed of a function, arguments, and a message (feedback). Method signatures and docstrings: - def __init__(self, func, args=None, **kwargs): Constructor. - def execute(self): Execute the func...
Implement the Python class `FunctionStep` described below. Class description: A step which execution is a function call. Is composed of a function, arguments, and a message (feedback). Method signatures and docstrings: - def __init__(self, func, args=None, **kwargs): Constructor. - def execute(self): Execute the func...
40573024e8ad81430afdda8fc8ceb2acbd55d7d2
<|skeleton|> class FunctionStep: """A step which execution is a function call. Is composed of a function, arguments, and a message (feedback).""" def __init__(self, func, args=None, **kwargs): """Constructor.""" <|body_0|> def execute(self): """Execute the function with the given a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionStep: """A step which execution is a function call. Is composed of a function, arguments, and a message (feedback).""" def __init__(self, func, args=None, **kwargs): """Constructor.""" super().__init__(**kwargs) self.func = func self.args = args or {} def exec...
the_stack_v2_python_sparse
invenio_cli/commands/steps.py
inveniosoftware/invenio-cli
train
8
dc82ddf62b30c74dd03f2fccb985af9bae859d9c
[ "local_part, domain = email_utils.split_mailbox(value)\ndomain = admin_models.Domain.objects.filter(name=domain).first()\nuser = self.context['request'].user\nif domain and (not user.can_access(domain)):\n raise serializers.ValidationError(_(\"You don't have access to this domain.\"))\nreturn value", "user = s...
<|body_start_0|> local_part, domain = email_utils.split_mailbox(value) domain = admin_models.Domain.objects.filter(name=domain).first() user = self.context['request'].user if domain and (not user.can_access(domain)): raise serializers.ValidationError(_("You don't have access ...
Base Alias serializer.
SenderAddressSerializer
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SenderAddressSerializer: """Base Alias serializer.""" def validate_address(self, value): """Check domain.""" <|body_0|> def validate_mailbox(self, value): """Check permission.""" <|body_1|> <|end_skeleton|> <|body_start_0|> local_part, domain = ...
stack_v2_sparse_classes_36k_train_016671
18,871
permissive
[ { "docstring": "Check domain.", "name": "validate_address", "signature": "def validate_address(self, value)" }, { "docstring": "Check permission.", "name": "validate_mailbox", "signature": "def validate_mailbox(self, value)" } ]
2
null
Implement the Python class `SenderAddressSerializer` described below. Class description: Base Alias serializer. Method signatures and docstrings: - def validate_address(self, value): Check domain. - def validate_mailbox(self, value): Check permission.
Implement the Python class `SenderAddressSerializer` described below. Class description: Base Alias serializer. Method signatures and docstrings: - def validate_address(self, value): Check domain. - def validate_mailbox(self, value): Check permission. <|skeleton|> class SenderAddressSerializer: """Base Alias ser...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class SenderAddressSerializer: """Base Alias serializer.""" def validate_address(self, value): """Check domain.""" <|body_0|> def validate_mailbox(self, value): """Check permission.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SenderAddressSerializer: """Base Alias serializer.""" def validate_address(self, value): """Check domain.""" local_part, domain = email_utils.split_mailbox(value) domain = admin_models.Domain.objects.filter(name=domain).first() user = self.context['request'].user i...
the_stack_v2_python_sparse
modoboa/admin/api/v1/serializers.py
modoboa/modoboa
train
2,201
6e88a4a853c733aefbe3103e82aa2c3d6d2cc61a
[ "temperatures = {}\ntry:\n for sensor in self.data.Temperatures:\n temperatures[sensor.Name] = sensor.ReadingCelsius\n return temperatures\nexcept AttributeError:\n return 'Not available'", "fans = {}\ntry:\n for fan in self.data.Fans:\n fans[fan.Name] = str(fan.Reading) + ' ' + fan.Read...
<|body_start_0|> temperatures = {} try: for sensor in self.data.Temperatures: temperatures[sensor.Name] = sensor.ReadingCelsius return temperatures except AttributeError: return 'Not available' <|end_body_0|> <|body_start_1|> fans = {}...
Class to manage redfish Thermal data.
Thermal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Thermal: """Class to manage redfish Thermal data.""" def get_temperatures(self): """Get chassis sensors name and temperature :returns: chassis sensor and temperature :rtype: dict""" <|body_0|> def get_fans(self): """Get chassis fan name and rpm :returns: chassis ...
stack_v2_sparse_classes_36k_train_016672
11,877
permissive
[ { "docstring": "Get chassis sensors name and temperature :returns: chassis sensor and temperature :rtype: dict", "name": "get_temperatures", "signature": "def get_temperatures(self)" }, { "docstring": "Get chassis fan name and rpm :returns: chassis fan and rpm :rtype: dict", "name": "get_fan...
2
stack_v2_sparse_classes_30k_train_016044
Implement the Python class `Thermal` described below. Class description: Class to manage redfish Thermal data. Method signatures and docstrings: - def get_temperatures(self): Get chassis sensors name and temperature :returns: chassis sensor and temperature :rtype: dict - def get_fans(self): Get chassis fan name and r...
Implement the Python class `Thermal` described below. Class description: Class to manage redfish Thermal data. Method signatures and docstrings: - def get_temperatures(self): Get chassis sensors name and temperature :returns: chassis sensor and temperature :rtype: dict - def get_fans(self): Get chassis fan name and r...
41115bc5982a2f2d4e9eb7106880dc3bbdfebc54
<|skeleton|> class Thermal: """Class to manage redfish Thermal data.""" def get_temperatures(self): """Get chassis sensors name and temperature :returns: chassis sensor and temperature :rtype: dict""" <|body_0|> def get_fans(self): """Get chassis fan name and rpm :returns: chassis ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Thermal: """Class to manage redfish Thermal data.""" def get_temperatures(self): """Get chassis sensors name and temperature :returns: chassis sensor and temperature :rtype: dict""" temperatures = {} try: for sensor in self.data.Temperatures: temperatur...
the_stack_v2_python_sparse
redfish/types.py
bcornec/python-redfish
train
10
5790083497e46ef6365b2f805fcbdcfad01e7824
[ "self.name = name\nself.given_name = given_name\nself.middle_name = middle_name\nself.family_name = family_name\nself.address = address\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nname = dictionary.get('name')\ngiven_name = dictionary.get('givenName')\nmiddle_na...
<|body_start_0|> self.name = name self.given_name = given_name self.middle_name = middle_name self.family_name = family_name self.address = address self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'Payroll Employee Record' model. TODO: type model description here. Attributes: name (string): Full name of the employee: first, middle (if stated), and last name. given_name (string): First name of employee middle_name (string): Middle name of employee, if stated family_name (string): Last name o...
PayrollEmployeeRecord
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PayrollEmployeeRecord: """Implementation of the 'Payroll Employee Record' model. TODO: type model description here. Attributes: name (string): Full name of the employee: first, middle (if stated), and last name. given_name (string): First name of employee middle_name (string): Middle name of empl...
stack_v2_sparse_classes_36k_train_016673
2,958
permissive
[ { "docstring": "Constructor for the PayrollEmployeeRecord class", "name": "__init__", "signature": "def __init__(self, name=None, given_name=None, middle_name=None, family_name=None, address=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary A...
2
stack_v2_sparse_classes_30k_train_020468
Implement the Python class `PayrollEmployeeRecord` described below. Class description: Implementation of the 'Payroll Employee Record' model. TODO: type model description here. Attributes: name (string): Full name of the employee: first, middle (if stated), and last name. given_name (string): First name of employee mi...
Implement the Python class `PayrollEmployeeRecord` described below. Class description: Implementation of the 'Payroll Employee Record' model. TODO: type model description here. Attributes: name (string): Full name of the employee: first, middle (if stated), and last name. given_name (string): First name of employee mi...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class PayrollEmployeeRecord: """Implementation of the 'Payroll Employee Record' model. TODO: type model description here. Attributes: name (string): Full name of the employee: first, middle (if stated), and last name. given_name (string): First name of employee middle_name (string): Middle name of empl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PayrollEmployeeRecord: """Implementation of the 'Payroll Employee Record' model. TODO: type model description here. Attributes: name (string): Full name of the employee: first, middle (if stated), and last name. given_name (string): First name of employee middle_name (string): Middle name of employee, if stat...
the_stack_v2_python_sparse
finicityapi/models/payroll_employee_record.py
monarchmoney/finicity-python
train
0
9e1e4b699dcc7e6bf6d8969ff0a9565b9e28cebe
[ "super().__init__()\nif len(adv_input) == 0:\n raise ValueError('Adversary has no inputs!')\nnet_list: List[nn.Module] = []\nnum_inputs = 0\nif 'X' in adv_input:\n num_inputs += input_shape\nif 'Y' in adv_input:\n num_inputs += 1\nif 'S' in adv_input:\n assert num_groups is not None, 'num_groups must be...
<|body_start_0|> super().__init__() if len(adv_input) == 0: raise ValueError('Adversary has no inputs!') net_list: List[nn.Module] = [] num_inputs = 0 if 'X' in adv_input: num_inputs += input_shape if 'Y' in adv_input: num_inputs += 1 ...
Fully-connected feed forward neural network; adversary network of the ARL. Attributes: input_shape: Dimensionality of the data input. hidden_units: Number of hidden units in each layer of the network. adv_input: Set with strings describing the input the adversary has access to. May contain any combination of 'X' for fe...
Adversary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Adversary: """Fully-connected feed forward neural network; adversary network of the ARL. Attributes: input_shape: Dimensionality of the data input. hidden_units: Number of hidden units in each layer of the network. adv_input: Set with strings describing the input the adversary has access to. May ...
stack_v2_sparse_classes_36k_train_016674
19,354
no_license
[ { "docstring": "Inits an instance of the adversary network with the given attributes.", "name": "__init__", "signature": "def __init__(self, input_shape: int, hidden_units: List[int]=[], adv_input: Set[str]={'X', 'Y'}, num_groups: Optional[int]=None)" }, { "docstring": "Forward propagation of in...
2
stack_v2_sparse_classes_30k_train_011986
Implement the Python class `Adversary` described below. Class description: Fully-connected feed forward neural network; adversary network of the ARL. Attributes: input_shape: Dimensionality of the data input. hidden_units: Number of hidden units in each layer of the network. adv_input: Set with strings describing the ...
Implement the Python class `Adversary` described below. Class description: Fully-connected feed forward neural network; adversary network of the ARL. Attributes: input_shape: Dimensionality of the data input. hidden_units: Number of hidden units in each layer of the network. adv_input: Set with strings describing the ...
34e1889db83e70d5ddde590ae67836c97c99f904
<|skeleton|> class Adversary: """Fully-connected feed forward neural network; adversary network of the ARL. Attributes: input_shape: Dimensionality of the data input. hidden_units: Number of hidden units in each layer of the network. adv_input: Set with strings describing the input the adversary has access to. May ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Adversary: """Fully-connected feed forward neural network; adversary network of the ARL. Attributes: input_shape: Dimensionality of the data input. hidden_units: Number of hidden units in each layer of the network. adv_input: Set with strings describing the input the adversary has access to. May contain any c...
the_stack_v2_python_sparse
arl.py
TomFrederik/fact-ai
train
1
dbb308129f12167f1933911f7e752bf9fc3f273d
[ "X_scitype = self.get_tag('X_scitype')\ny_scitype = self.get_tag('y_scitype', None, raise_error=False)\nif _is_child_of(obj, OLD_PANEL_MIXINS) and X_scitype != 'Panel':\n return False\nhas_y = self.get_tag('has_y')\nif not has_y and get_tag(obj, 'requires_y'):\n return False\nX_inner_mtype = get_tag(obj, 'X_i...
<|body_start_0|> X_scitype = self.get_tag('X_scitype') y_scitype = self.get_tag('y_scitype', None, raise_error=False) if _is_child_of(obj, OLD_PANEL_MIXINS) and X_scitype != 'Panel': return False has_y = self.get_tag('has_y') if not has_y and get_tag(obj, 'requires_y'...
Generic test scenario for transformers.
TransformerTestScenario
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerTestScenario: """Generic test scenario for transformers.""" def is_applicable(self, obj): """Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to ob...
stack_v2_sparse_classes_36k_train_016675
14,371
permissive
[ { "docstring": "Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to obj, False if not", "name": "is_applicable", "signature": "def is_applicable(self, obj)" }, { "docstri...
2
null
Implement the Python class `TransformerTestScenario` described below. Class description: Generic test scenario for transformers. Method signatures and docstrings: - def is_applicable(self, obj): Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ...
Implement the Python class `TransformerTestScenario` described below. Class description: Generic test scenario for transformers. Method signatures and docstrings: - def is_applicable(self, obj): Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ...
70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f
<|skeleton|> class TransformerTestScenario: """Generic test scenario for transformers.""" def is_applicable(self, obj): """Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to ob...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerTestScenario: """Generic test scenario for transformers.""" def is_applicable(self, obj): """Check whether scenario is applicable to obj. Parameters ---------- obj : class or object to check against scenario Returns ------- applicable: bool True if self is applicable to obj, False if n...
the_stack_v2_python_sparse
sktime/utils/_testing/scenarios_transformers.py
sktime/sktime
train
1,117
a5048a5623ff03a9a7e278c717148999e69b8549
[ "lines = make_model()\nlog = get_logger(level='warning', encoding='utf-8')\nmodel = read_abaqus(lines, log=log, debug=False)\nmodel.write('spike.inp')\nos.remove('spike.inp')\nabaqus_filename = os.path.join(MODEL_PATH, 'abaqus.inp')\nwith open(abaqus_filename, 'w') as abaqus_file:\n abaqus_file.writelines('\\n'....
<|body_start_0|> lines = make_model() log = get_logger(level='warning', encoding='utf-8') model = read_abaqus(lines, log=log, debug=False) model.write('spike.inp') os.remove('spike.inp') abaqus_filename = os.path.join(MODEL_PATH, 'abaqus.inp') with open(abaqus_fil...
TestAbaqus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAbaqus: def test_abaqus_1(self): """simple test""" <|body_0|> def test_abaqus_2(self): """two hex blocks with duplicate node ids""" <|body_1|> <|end_skeleton|> <|body_start_0|> lines = make_model() log = get_logger(level='warning', encod...
stack_v2_sparse_classes_36k_train_016676
3,005
no_license
[ { "docstring": "simple test", "name": "test_abaqus_1", "signature": "def test_abaqus_1(self)" }, { "docstring": "two hex blocks with duplicate node ids", "name": "test_abaqus_2", "signature": "def test_abaqus_2(self)" } ]
2
stack_v2_sparse_classes_30k_train_012819
Implement the Python class `TestAbaqus` described below. Class description: Implement the TestAbaqus class. Method signatures and docstrings: - def test_abaqus_1(self): simple test - def test_abaqus_2(self): two hex blocks with duplicate node ids
Implement the Python class `TestAbaqus` described below. Class description: Implement the TestAbaqus class. Method signatures and docstrings: - def test_abaqus_1(self): simple test - def test_abaqus_2(self): two hex blocks with duplicate node ids <|skeleton|> class TestAbaqus: def test_abaqus_1(self): "...
d9ffdb4ac845b13bcf6aea96ff5d37cc026c5267
<|skeleton|> class TestAbaqus: def test_abaqus_1(self): """simple test""" <|body_0|> def test_abaqus_2(self): """two hex blocks with duplicate node ids""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAbaqus: def test_abaqus_1(self): """simple test""" lines = make_model() log = get_logger(level='warning', encoding='utf-8') model = read_abaqus(lines, log=log, debug=False) model.write('spike.inp') os.remove('spike.inp') abaqus_filename = os.path.joi...
the_stack_v2_python_sparse
pyNastran/converters/abaqus/test_unit_abaqus.py
ratalex/pyNastran
train
0
8a9a7d07d4c8382bc910b34bbfd119acde0f2c45
[ "super(NETWORK, self).__init__()\nself.layer1 = torch.nn.Sequential(torch.nn.Linear(input_dim, hidden_dim), torch.nn.ReLU())\nself.layer2 = torch.nn.Sequential(torch.nn.Linear(hidden_dim, hidden_dim), torch.nn.ReLU())\nself.final = torch.nn.Linear(hidden_dim, output_dim)", "x = self.layer1(x)\nx = self.layer2(x)\...
<|body_start_0|> super(NETWORK, self).__init__() self.layer1 = torch.nn.Sequential(torch.nn.Linear(input_dim, hidden_dim), torch.nn.ReLU()) self.layer2 = torch.nn.Sequential(torch.nn.Linear(hidden_dim, hidden_dim), torch.nn.ReLU()) self.final = torch.nn.Linear(hidden_dim, output_dim) <|e...
NETWORK
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NETWORK: def __init__(self, input_dim: int, output_dim: int, hidden_dim: int) -> None: """DQN Network example Args: input_dim (int): `state` dimension. `state` is 2-D tensor of shape (n, input_dim) output_dim (int): Number of actions. Q_value is 2-D tensor of shape (n, output_dim) hidden...
stack_v2_sparse_classes_36k_train_016677
11,264
no_license
[ { "docstring": "DQN Network example Args: input_dim (int): `state` dimension. `state` is 2-D tensor of shape (n, input_dim) output_dim (int): Number of actions. Q_value is 2-D tensor of shape (n, output_dim) hidden_dim (int): Hidden dimension in fc layer", "name": "__init__", "signature": "def __init__(...
2
stack_v2_sparse_classes_30k_test_000384
Implement the Python class `NETWORK` described below. Class description: Implement the NETWORK class. Method signatures and docstrings: - def __init__(self, input_dim: int, output_dim: int, hidden_dim: int) -> None: DQN Network example Args: input_dim (int): `state` dimension. `state` is 2-D tensor of shape (n, input...
Implement the Python class `NETWORK` described below. Class description: Implement the NETWORK class. Method signatures and docstrings: - def __init__(self, input_dim: int, output_dim: int, hidden_dim: int) -> None: DQN Network example Args: input_dim (int): `state` dimension. `state` is 2-D tensor of shape (n, input...
6c3d1a7ba9246181b89e67b1f4857df99c85fa01
<|skeleton|> class NETWORK: def __init__(self, input_dim: int, output_dim: int, hidden_dim: int) -> None: """DQN Network example Args: input_dim (int): `state` dimension. `state` is 2-D tensor of shape (n, input_dim) output_dim (int): Number of actions. Q_value is 2-D tensor of shape (n, output_dim) hidden...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NETWORK: def __init__(self, input_dim: int, output_dim: int, hidden_dim: int) -> None: """DQN Network example Args: input_dim (int): `state` dimension. `state` is 2-D tensor of shape (n, input_dim) output_dim (int): Number of actions. Q_value is 2-D tensor of shape (n, output_dim) hidden_dim (int): Hi...
the_stack_v2_python_sparse
JumpKing.py
senweim/JumpKingAtHome
train
14
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(MaskingModule, self).__init__()\nself.N = N\nself.in_N = N + N // 2 if partial_input else N\nself.norm_1 = GroupNormWrapper(generated, E_1, E_2, 8, self.in_N, eps=1e-08)\nself.prelu_1 = nn.PReLU()\nself.in_conv = Conv1dWrapper(generated, E_1, E_2, self.in_N, B, 1, bias=False)\nself.norm_2 = GroupNormWrapper(...
<|body_start_0|> super(MaskingModule, self).__init__() self.N = N self.in_N = N + N // 2 if partial_input else N self.norm_1 = GroupNormWrapper(generated, E_1, E_2, 8, self.in_N, eps=1e-08) self.prelu_1 = nn.PReLU() self.in_conv = Conv1dWrapper(generated, E_1, E_2, self.i...
Creates a [0,1] mask of the four instruments on the latent matrix
MaskingModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskingModule: """Creates a [0,1] mask of the four instruments on the latent matrix""" def __init__(self, generated, E_1, E_2, N, B, H, layer, stack, kernel=3, residual_bias=False, partial_input=False): """Arguments: generated {bool} -- True if you want to use the generated weights E...
stack_v2_sparse_classes_36k_train_016678
37,269
no_license
[ { "docstring": "Arguments: generated {bool} -- True if you want to use the generated weights E_1 {int} -- Dimension of the instrument embedding E_2 {int} -- Dimension of the instrument embedding bottleneck N {int} -- Dimension of the latent matrix B {int} -- Dimension of the bottleneck convolution H {int} -- Hi...
2
stack_v2_sparse_classes_30k_train_016530
Implement the Python class `MaskingModule` described below. Class description: Creates a [0,1] mask of the four instruments on the latent matrix Method signatures and docstrings: - def __init__(self, generated, E_1, E_2, N, B, H, layer, stack, kernel=3, residual_bias=False, partial_input=False): Arguments: generated ...
Implement the Python class `MaskingModule` described below. Class description: Creates a [0,1] mask of the four instruments on the latent matrix Method signatures and docstrings: - def __init__(self, generated, E_1, E_2, N, B, H, layer, stack, kernel=3, residual_bias=False, partial_input=False): Arguments: generated ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MaskingModule: """Creates a [0,1] mask of the four instruments on the latent matrix""" def __init__(self, generated, E_1, E_2, N, B, H, layer, stack, kernel=3, residual_bias=False, partial_input=False): """Arguments: generated {bool} -- True if you want to use the generated weights E...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaskingModule: """Creates a [0,1] mask of the four instruments on the latent matrix""" def __init__(self, generated, E_1, E_2, N, B, H, layer, stack, kernel=3, residual_bias=False, partial_input=False): """Arguments: generated {bool} -- True if you want to use the generated weights E_1 {int} -- D...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
f48c37ee9c3331789aebddd2ba40d25147aa27b7
[ "self.input = input\nself.output = output\nself.grid_mode = grid_mode\nself.filter = Filter(fltr)\nif self.filter.filename is None:\n raise ValueError('Could not find filter: ' + fltr)\nself.filter_resampled = False", "if self.grid_mode:\n grid = FilesGrid(self.input)\n self.process_grid(grid)\nelse:\n ...
<|body_start_0|> self.input = input self.output = output self.grid_mode = grid_mode self.filter = Filter(fltr) if self.filter.filename is None: raise ValueError('Could not find filter: ' + fltr) self.filter_resampled = False <|end_body_0|> <|body_start_1|> ...
ConvolveLimbDark
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvolveLimbDark: def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): """Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid""" <|body_0|> def __call__(self): ...
stack_v2_sparse_classes_36k_train_016679
4,186
permissive
[ { "docstring": "Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid", "name": "__init__", "signature": "def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False)" }, { "docstring": "Process...
4
stack_v2_sparse_classes_30k_test_000535
Implement the Python class `ConvolveLimbDark` described below. Class description: Implement the ConvolveLimbDark class. Method signatures and docstrings: - def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): Initialises object Args: input: Input filename/grid output: Output filename/directo...
Implement the Python class `ConvolveLimbDark` described below. Class description: Implement the ConvolveLimbDark class. Method signatures and docstrings: - def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): Initialises object Args: input: Input filename/grid output: Output filename/directo...
648eb1758e3744d9e3d6669edc4a0c4753559f17
<|skeleton|> class ConvolveLimbDark: def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): """Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid""" <|body_0|> def __call__(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvolveLimbDark: def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): """Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid""" self.input = input self.output = output ...
the_stack_v2_python_sparse
spexxy/tools/filters/limbdark.py
thusser/spexxy
train
4
fd3f81285b8254e5c43109217d1448edfae58489
[ "tmp = {}\nfor i in range(len(s)):\n if s[i] not in tmp:\n tmp[s[i]] = 1\n else:\n tmp[s[i]] += 1\narr = [0] * len(tmp)\nfor i in range(len(t)):\n if t[i] not in tmp:\n return False\n else:\n tmp[t[i]] -= 1\nreturn arr == tmp.values()", "s = sorted(s)\nt = sorted(t)\nreturn...
<|body_start_0|> tmp = {} for i in range(len(s)): if s[i] not in tmp: tmp[s[i]] = 1 else: tmp[s[i]] += 1 arr = [0] * len(tmp) for i in range(len(t)): if t[i] not in tmp: return False else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isAnagram(self, s: str, t: str) -> bool: """使用哈希表计算次数。 :param s: :param t: :return:""" <|body_0|> def isAnagram(self, s: str, t: str) -> bool: """排序看是否相等即可。 :param s: :param t: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> t...
stack_v2_sparse_classes_36k_train_016680
949
no_license
[ { "docstring": "使用哈希表计算次数。 :param s: :param t: :return:", "name": "isAnagram", "signature": "def isAnagram(self, s: str, t: str) -> bool" }, { "docstring": "排序看是否相等即可。 :param s: :param t: :return:", "name": "isAnagram", "signature": "def isAnagram(self, s: str, t: str) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_003349
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isAnagram(self, s: str, t: str) -> bool: 使用哈希表计算次数。 :param s: :param t: :return: - def isAnagram(self, s: str, t: str) -> bool: 排序看是否相等即可。 :param s: :param t: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isAnagram(self, s: str, t: str) -> bool: 使用哈希表计算次数。 :param s: :param t: :return: - def isAnagram(self, s: str, t: str) -> bool: 排序看是否相等即可。 :param s: :param t: :return: <|ske...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def isAnagram(self, s: str, t: str) -> bool: """使用哈希表计算次数。 :param s: :param t: :return:""" <|body_0|> def isAnagram(self, s: str, t: str) -> bool: """排序看是否相等即可。 :param s: :param t: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isAnagram(self, s: str, t: str) -> bool: """使用哈希表计算次数。 :param s: :param t: :return:""" tmp = {} for i in range(len(s)): if s[i] not in tmp: tmp[s[i]] = 1 else: tmp[s[i]] += 1 arr = [0] * len(tmp) for ...
the_stack_v2_python_sparse
有效的字母异位词.py
cjrzs/MyLeetCode
train
8
b6da4c94fedb43c62b8a36fcedf252a26dd18283
[ "super().__init__()\nself.z_dim = z_dim\nh_dim = 256\nh_channels = 32\nkernel_size = 4\nout_channels = 3\nself.conv_shape = (h_channels, kernel_size, kernel_size)\nself.fc_block = nn.Sequential(nn.Linear(z_dim, h_dim), nn.ReLU(), nn.Linear(h_dim, h_dim), nn.ReLU(), nn.Linear(h_dim, np.product(self.conv_shape)), nn....
<|body_start_0|> super().__init__() self.z_dim = z_dim h_dim = 256 h_channels = 32 kernel_size = 4 out_channels = 3 self.conv_shape = (h_channels, kernel_size, kernel_size) self.fc_block = nn.Sequential(nn.Linear(z_dim, h_dim), nn.ReLU(), nn.Linear(h_dim, ...
Convolutional Decoder Architecture ------------ FC: Latent Dimension FC: 256 neurons FC: 256 neurons Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 References ---------- [1] Burgess, Christopher P., et al. "Understanding disentangling ...
ConvDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvDecoder: """Convolutional Decoder Architecture ------------ FC: Latent Dimension FC: 256 neurons FC: 256 neurons Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 References ---------- [1] Burgess, Christopher P...
stack_v2_sparse_classes_36k_train_016681
1,912
permissive
[ { "docstring": "Instantiate Decoder for a VAE Parameters ---------- z_dim: int dimension of the latent distribution to be learnt", "name": "__init__", "signature": "def __init__(self, z_dim: int)" }, { "docstring": "Forward pass of a convolutional decoder", "name": "forward", "signature"...
2
stack_v2_sparse_classes_30k_train_012125
Implement the Python class `ConvDecoder` described below. Class description: Convolutional Decoder Architecture ------------ FC: Latent Dimension FC: 256 neurons FC: 256 neurons Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Reference...
Implement the Python class `ConvDecoder` described below. Class description: Convolutional Decoder Architecture ------------ FC: Latent Dimension FC: 256 neurons FC: 256 neurons Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Reference...
ca84a8d646ad8e5e3675ffd19165c20933b81ef7
<|skeleton|> class ConvDecoder: """Convolutional Decoder Architecture ------------ FC: Latent Dimension FC: 256 neurons FC: 256 neurons Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 References ---------- [1] Burgess, Christopher P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvDecoder: """Convolutional Decoder Architecture ------------ FC: Latent Dimension FC: 256 neurons FC: 256 neurons Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 Transpose Conv: 32 channels, 4x4 References ---------- [1] Burgess, Christopher P., et al. "Un...
the_stack_v2_python_sparse
disenn/models/decoders.py
AmanDaVinci/DiSENN
train
1
dff8c659a78b13b7c40142b0f425f25e09025211
[ "from sklearn.datasets import fetch_mldata\nmnist = fetch_mldata('MNIST original', data_home='.')\nself.X = mnist['data']\nself.y = mnist['target']\nprint('Loaded {} images which contain {} pixels'.format(self.X.shape[0], self.X.shape[1]))", "import random\nfor digit in digit_list:\n digit_idx = np.where(self....
<|body_start_0|> from sklearn.datasets import fetch_mldata mnist = fetch_mldata('MNIST original', data_home='.') self.X = mnist['data'] self.y = mnist['target'] print('Loaded {} images which contain {} pixels'.format(self.X.shape[0], self.X.shape[1])) <|end_body_0|> <|body_start...
MnistProcesser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MnistProcesser: def __init__(self): """Incarcati setul de date MNIST. Acesta este format din 70000 de imagini cu cifre scrise de mana. Dimensiunea imaginilor este 28x28. Datele pe care le veti gasi in mnist['data'] sunt efectiv pixelii imaginilor, iar target-ul fiecarei imagini este de f...
stack_v2_sparse_classes_36k_train_016682
4,018
no_license
[ { "docstring": "Incarcati setul de date MNIST. Acesta este format din 70000 de imagini cu cifre scrise de mana. Dimensiunea imaginilor este 28x28. Datele pe care le veti gasi in mnist['data'] sunt efectiv pixelii imaginilor, iar target-ul fiecarei imagini este de fapt cifra. Inainte de a incepe lucrul, va indem...
5
stack_v2_sparse_classes_30k_train_016689
Implement the Python class `MnistProcesser` described below. Class description: Implement the MnistProcesser class. Method signatures and docstrings: - def __init__(self): Incarcati setul de date MNIST. Acesta este format din 70000 de imagini cu cifre scrise de mana. Dimensiunea imaginilor este 28x28. Datele pe care ...
Implement the Python class `MnistProcesser` described below. Class description: Implement the MnistProcesser class. Method signatures and docstrings: - def __init__(self): Incarcati setul de date MNIST. Acesta este format din 70000 de imagini cu cifre scrise de mana. Dimensiunea imaginilor este 28x28. Datele pe care ...
e8ce18fad97b1207545e933ed0947347ed09c536
<|skeleton|> class MnistProcesser: def __init__(self): """Incarcati setul de date MNIST. Acesta este format din 70000 de imagini cu cifre scrise de mana. Dimensiunea imaginilor este 28x28. Datele pe care le veti gasi in mnist['data'] sunt efectiv pixelii imaginilor, iar target-ul fiecarei imagini este de f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MnistProcesser: def __init__(self): """Incarcati setul de date MNIST. Acesta este format din 70000 de imagini cu cifre scrise de mana. Dimensiunea imaginilor este 28x28. Datele pe care le veti gasi in mnist['data'] sunt efectiv pixelii imaginilor, iar target-ul fiecarei imagini este de fapt cifra. Ina...
the_stack_v2_python_sparse
01_tests/06_laurentiu_repository/python_tests_ioan&erik/2/2_mnist_rez.py
Cloudifier/CLOUDIFIER_WORK
train
0
927cfb4caa0cb5d264566bb912be25e92c0a168a
[ "parser.add_argument('metric_name', help='The name of the log-based metric to update.')\nconfig_group = parser.add_argument_group(help='Data about the metric to update.', required=True)\nconfig_group.add_argument('--description', help='A new description for the metric. If omitted, the description is not changed.')\...
<|body_start_0|> parser.add_argument('metric_name', help='The name of the log-based metric to update.') config_group = parser.add_argument_group(help='Data about the metric to update.', required=True) config_group.add_argument('--description', help='A new description for the metric. If omitted, ...
Updates the definition of a logs-based metric.
UpdateGA
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateGA: """Updates the definition of a logs-based metric.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the argumen...
stack_v2_sparse_classes_36k_train_016683
7,286
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: The updated...
2
stack_v2_sparse_classes_30k_train_007283
Implement the Python class `UpdateGA` described below. Class description: Updates the definition of a logs-based metric. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse names...
Implement the Python class `UpdateGA` described below. Class description: Updates the definition of a logs-based metric. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse names...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class UpdateGA: """Updates the definition of a logs-based metric.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the argumen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateGA: """Updates the definition of a logs-based metric.""" def Args(parser): """Register flags for this command.""" parser.add_argument('metric_name', help='The name of the log-based metric to update.') config_group = parser.add_argument_group(help='Data about the metric to up...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/logging/metrics/update.py
bopopescu/socialliteapp
train
0
5dcdbe51e83c488d678678a17376e89215e9630d
[ "binary_path = '/home/salomons/project/wsd/hyper.py'\ncmd = '%s --seed %d' % (binary_path, runargs['seed'])\nfor key, value in config.iteritems():\n cmd += ' -%s %s' % (key, value)\nreturn cmd", "lines = filepointer.read()\nresultMap = {}\nresultMap['status'] = 'SUCCESS'\nreturn resultMap" ]
<|body_start_0|> binary_path = '/home/salomons/project/wsd/hyper.py' cmd = '%s --seed %d' % (binary_path, runargs['seed']) for key, value in config.iteritems(): cmd += ' -%s %s' % (key, value) return cmd <|end_body_0|> <|body_start_1|> lines = filepointer.read() ...
EmptyWrapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmptyWrapper: def get_command_line_args(self, runargs, config): """Returns the command line call string to execute the target algorithm (here: Spear). Args: runargs: a map of several optional arguments for the execution of the target algorithm. { "instance": <instance>, "specifics" : <ex...
stack_v2_sparse_classes_36k_train_016684
2,779
permissive
[ { "docstring": "Returns the command line call string to execute the target algorithm (here: Spear). Args: runargs: a map of several optional arguments for the execution of the target algorithm. { \"instance\": <instance>, \"specifics\" : <extra data associated with the instance>, \"cutoff\" : <runtime cutoff>, ...
2
stack_v2_sparse_classes_30k_train_007263
Implement the Python class `EmptyWrapper` described below. Class description: Implement the EmptyWrapper class. Method signatures and docstrings: - def get_command_line_args(self, runargs, config): Returns the command line call string to execute the target algorithm (here: Spear). Args: runargs: a map of several opti...
Implement the Python class `EmptyWrapper` described below. Class description: Implement the EmptyWrapper class. Method signatures and docstrings: - def get_command_line_args(self, runargs, config): Returns the command line call string to execute the target algorithm (here: Spear). Args: runargs: a map of several opti...
6313f7d0708b960e75bcddb53eec645451499d0e
<|skeleton|> class EmptyWrapper: def get_command_line_args(self, runargs, config): """Returns the command line call string to execute the target algorithm (here: Spear). Args: runargs: a map of several optional arguments for the execution of the target algorithm. { "instance": <instance>, "specifics" : <ex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmptyWrapper: def get_command_line_args(self, runargs, config): """Returns the command line call string to execute the target algorithm (here: Spear). Args: runargs: a map of several optional arguments for the execution of the target algorithm. { "instance": <instance>, "specifics" : <extra data assoc...
the_stack_v2_python_sparse
smac_wrapper_old.py
jia1/lstm_wsd
train
0
a27b072d5191688c078d2212b471471eaceba064
[ "n = len(stones)\npre = [0] * (n + 1)\nfor i in range(n):\n pre[i + 1] = pre[i] + stones[i]\ndp = [[0] * (n + 1) for _ in range(n + 1)]\nfor length in range(1, n + 1):\n for i in range(1, n - length + 1):\n j = i + length\n dp[i][j] = max(pre[j] - pre[i] - dp[i + 1][j], pre[j - 1] - pre[i - 1] -...
<|body_start_0|> n = len(stones) pre = [0] * (n + 1) for i in range(n): pre[i + 1] = pre[i] + stones[i] dp = [[0] * (n + 1) for _ in range(n + 1)] for length in range(1, n + 1): for i in range(1, n - length + 1): j = i + length ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def stoneGameVII1(self, stones: List[int]) -> int: """思路:动态规划法 @param stones: @return:""" <|body_0|> def stoneGameVII2(self, stones: List[int]) -> int: """思路:记忆化递归 @param stones: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> n =...
stack_v2_sparse_classes_36k_train_016685
3,087
no_license
[ { "docstring": "思路:动态规划法 @param stones: @return:", "name": "stoneGameVII1", "signature": "def stoneGameVII1(self, stones: List[int]) -> int" }, { "docstring": "思路:记忆化递归 @param stones: @return:", "name": "stoneGameVII2", "signature": "def stoneGameVII2(self, stones: List[int]) -> int" }...
2
stack_v2_sparse_classes_30k_train_017867
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def stoneGameVII1(self, stones: List[int]) -> int: 思路:动态规划法 @param stones: @return: - def stoneGameVII2(self, stones: List[int]) -> int: 思路:记忆化递归 @param stones: @return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def stoneGameVII1(self, stones: List[int]) -> int: 思路:动态规划法 @param stones: @return: - def stoneGameVII2(self, stones: List[int]) -> int: 思路:记忆化递归 @param stones: @return: <|skele...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def stoneGameVII1(self, stones: List[int]) -> int: """思路:动态规划法 @param stones: @return:""" <|body_0|> def stoneGameVII2(self, stones: List[int]) -> int: """思路:记忆化递归 @param stones: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def stoneGameVII1(self, stones: List[int]) -> int: """思路:动态规划法 @param stones: @return:""" n = len(stones) pre = [0] * (n + 1) for i in range(n): pre[i + 1] = pre[i] + stones[i] dp = [[0] * (n + 1) for _ in range(n + 1)] for length in range(...
the_stack_v2_python_sparse
LeetCode/石子游戏/5627. 石子游戏 VII.py
yiming1012/MyLeetCode
train
2
73377b4dacb546d0f25c43b7b5e0d7f00d0e87a7
[ "previous_blessed_models = []\nfor a in self._metadata_handler.get_artifacts_by_type('ModelBlessing'):\n if 'pipeline_name' in a.properties:\n p = a.properties['pipeline_name'].string_value\n else:\n p = a.custom_properties['pipeline_name'].string_value\n if p == pipeline_name and a.custom_pr...
<|body_start_0|> previous_blessed_models = [] for a in self._metadata_handler.get_artifacts_by_type('ModelBlessing'): if 'pipeline_name' in a.properties: p = a.properties['pipeline_name'].string_value else: p = a.custom_properties['pipeline_name']....
Custom driver for model validator.
Driver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Driver: """Custom driver for model validator.""" def _fetch_last_blessed_model(self, pipeline_name: str, component_id: str) -> Tuple[Optional[str], Optional[int]]: """Fetch last blessed model in metadata based on span.""" <|body_0|> def resolve_exec_properties(self, exec...
stack_v2_sparse_classes_36k_train_016686
2,710
permissive
[ { "docstring": "Fetch last blessed model in metadata based on span.", "name": "_fetch_last_blessed_model", "signature": "def _fetch_last_blessed_model(self, pipeline_name: str, component_id: str) -> Tuple[Optional[str], Optional[int]]" }, { "docstring": "Overrides BaseDriver.resolve_exec_propert...
2
stack_v2_sparse_classes_30k_train_005631
Implement the Python class `Driver` described below. Class description: Custom driver for model validator. Method signatures and docstrings: - def _fetch_last_blessed_model(self, pipeline_name: str, component_id: str) -> Tuple[Optional[str], Optional[int]]: Fetch last blessed model in metadata based on span. - def re...
Implement the Python class `Driver` described below. Class description: Custom driver for model validator. Method signatures and docstrings: - def _fetch_last_blessed_model(self, pipeline_name: str, component_id: str) -> Tuple[Optional[str], Optional[int]]: Fetch last blessed model in metadata based on span. - def re...
1b328504fa08a70388691e4072df76f143631325
<|skeleton|> class Driver: """Custom driver for model validator.""" def _fetch_last_blessed_model(self, pipeline_name: str, component_id: str) -> Tuple[Optional[str], Optional[int]]: """Fetch last blessed model in metadata based on span.""" <|body_0|> def resolve_exec_properties(self, exec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Driver: """Custom driver for model validator.""" def _fetch_last_blessed_model(self, pipeline_name: str, component_id: str) -> Tuple[Optional[str], Optional[int]]: """Fetch last blessed model in metadata based on span.""" previous_blessed_models = [] for a in self._metadata_handle...
the_stack_v2_python_sparse
tfx/components/model_validator/driver.py
tensorflow/tfx
train
2,116
87a11776867bd210a1c7998248aea5dc08d9a577
[ "super(Cell, self).__init__()\nself.units = units\nself.state_size = units\nself.return_output = return_output\nself.with_prev_output = with_prev_output\nself.input_keep_prob = input_keep_prob\nself.state_keep_prob = state_keep_prob\nself.output_keep_prob = output_keep_prob\nself.n_output = n_output\nself.seed = se...
<|body_start_0|> super(Cell, self).__init__() self.units = units self.state_size = units self.return_output = return_output self.with_prev_output = with_prev_output self.input_keep_prob = input_keep_prob self.state_keep_prob = state_keep_prob self.output_k...
RNNCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNCell: def __init__(self, units, f_out, return_output=True, with_prev_output=True, input_keep_prob=1, state_keep_prob=1, output_keep_prob=1, n_output=1, seed=42): """Initialization of RNN Cell Args: units: integer representing the number of units f_out: the activation function used in ...
stack_v2_sparse_classes_36k_train_016687
4,337
no_license
[ { "docstring": "Initialization of RNN Cell Args: units: integer representing the number of units f_out: the activation function used in output of the network return_output: whether to compute output and return it with_prev_output: whether to use previous cell output input_keep_prob: the input keep probability f...
2
stack_v2_sparse_classes_30k_train_005494
Implement the Python class `RNNCell` described below. Class description: Implement the RNNCell class. Method signatures and docstrings: - def __init__(self, units, f_out, return_output=True, with_prev_output=True, input_keep_prob=1, state_keep_prob=1, output_keep_prob=1, n_output=1, seed=42): Initialization of RNN Ce...
Implement the Python class `RNNCell` described below. Class description: Implement the RNNCell class. Method signatures and docstrings: - def __init__(self, units, f_out, return_output=True, with_prev_output=True, input_keep_prob=1, state_keep_prob=1, output_keep_prob=1, n_output=1, seed=42): Initialization of RNN Ce...
6d4bf69dc8d7524f966a3e28affc5d9f845e50e6
<|skeleton|> class RNNCell: def __init__(self, units, f_out, return_output=True, with_prev_output=True, input_keep_prob=1, state_keep_prob=1, output_keep_prob=1, n_output=1, seed=42): """Initialization of RNN Cell Args: units: integer representing the number of units f_out: the activation function used in ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNCell: def __init__(self, units, f_out, return_output=True, with_prev_output=True, input_keep_prob=1, state_keep_prob=1, output_keep_prob=1, n_output=1, seed=42): """Initialization of RNN Cell Args: units: integer representing the number of units f_out: the activation function used in output of the ...
the_stack_v2_python_sparse
src/model/sequence_model/classRNNCell.py
dorianb/ML_toolkit
train
0
85484eb8a8dfa0671e8ade2f5a222618b7b939d2
[ "params = self.params.train.input\nimages = inputs[FeatureNames.VISION]\nlabels_onehot = inputs[FeatureNames.LABEL_INDEX]\nif params.linearize_vision:\n img_shape = [params.frame_size, params.frame_size, 3]\n if params.name in dataloaders.VID_CLS_DS:\n space_to_depth = params.space_to_depth\n im...
<|body_start_0|> params = self.params.train.input images = inputs[FeatureNames.VISION] labels_onehot = inputs[FeatureNames.LABEL_INDEX] if params.linearize_vision: img_shape = [params.frame_size, params.frame_size, 3] if params.name in dataloaders.VID_CLS_DS: ...
Constructs the necessary modules to perform vision fine-tuning.
VisionExecutor
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisionExecutor: """Constructs the necessary modules to perform vision fine-tuning.""" def prepare_train_inputs(self, inputs): """Prepares inputs on device to be fed to model in train mode.""" <|body_0|> def prepare_eval_inputs(self, inputs): """Prepares inputs on...
stack_v2_sparse_classes_36k_train_016688
12,796
permissive
[ { "docstring": "Prepares inputs on device to be fed to model in train mode.", "name": "prepare_train_inputs", "signature": "def prepare_train_inputs(self, inputs)" }, { "docstring": "Prepares inputs on device to be fed to model in eval mode.", "name": "prepare_eval_inputs", "signature": ...
2
null
Implement the Python class `VisionExecutor` described below. Class description: Constructs the necessary modules to perform vision fine-tuning. Method signatures and docstrings: - def prepare_train_inputs(self, inputs): Prepares inputs on device to be fed to model in train mode. - def prepare_eval_inputs(self, inputs...
Implement the Python class `VisionExecutor` described below. Class description: Constructs the necessary modules to perform vision fine-tuning. Method signatures and docstrings: - def prepare_train_inputs(self, inputs): Prepares inputs on device to be fed to model in train mode. - def prepare_eval_inputs(self, inputs...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class VisionExecutor: """Constructs the necessary modules to perform vision fine-tuning.""" def prepare_train_inputs(self, inputs): """Prepares inputs on device to be fed to model in train mode.""" <|body_0|> def prepare_eval_inputs(self, inputs): """Prepares inputs on...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VisionExecutor: """Constructs the necessary modules to perform vision fine-tuning.""" def prepare_train_inputs(self, inputs): """Prepares inputs on device to be fed to model in train mode.""" params = self.params.train.input images = inputs[FeatureNames.VISION] labels_oneh...
the_stack_v2_python_sparse
vatt/experiments/finetune.py
Jimmy-INL/google-research
train
1
c08494dc741be8154a6073e914159bd35540a70d
[ "super(TaskCacheDataParser, self).__init__()\nself._debug = debug\nself._output_writer = output_writer", "if filetime == 0:\n return dfdatetime_semantic_time.SemanticTime(string='Not set')\nif filetime == 9223372036854775807:\n return dfdatetime_semantic_time.SemanticTime(string='Never')\nreturn dfdatetime_...
<|body_start_0|> super(TaskCacheDataParser, self).__init__() self._debug = debug self._output_writer = output_writer <|end_body_0|> <|body_start_1|> if filetime == 0: return dfdatetime_semantic_time.SemanticTime(string='Not set') if filetime == 9223372036854775807: ...
Task Cache data parser.
TaskCacheDataParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskCacheDataParser: """Task Cache data parser.""" def __init__(self, debug=False, output_writer=None): """Initializes a Task Cache data parser. Args: debug (Optional[bool]): True if debug information should be printed. output_writer (Optional[OutputWriter]): output writer.""" ...
stack_v2_sparse_classes_36k_train_016689
7,293
permissive
[ { "docstring": "Initializes a Task Cache data parser. Args: debug (Optional[bool]): True if debug information should be printed. output_writer (Optional[OutputWriter]): output writer.", "name": "__init__", "signature": "def __init__(self, debug=False, output_writer=None)" }, { "docstring": "Pars...
3
stack_v2_sparse_classes_30k_train_011250
Implement the Python class `TaskCacheDataParser` described below. Class description: Task Cache data parser. Method signatures and docstrings: - def __init__(self, debug=False, output_writer=None): Initializes a Task Cache data parser. Args: debug (Optional[bool]): True if debug information should be printed. output_...
Implement the Python class `TaskCacheDataParser` described below. Class description: Task Cache data parser. Method signatures and docstrings: - def __init__(self, debug=False, output_writer=None): Initializes a Task Cache data parser. Args: debug (Optional[bool]): True if debug information should be printed. output_...
d149aff1b8ff97e1cc8d7416fc583b964bad4ccd
<|skeleton|> class TaskCacheDataParser: """Task Cache data parser.""" def __init__(self, debug=False, output_writer=None): """Initializes a Task Cache data parser. Args: debug (Optional[bool]): True if debug information should be printed. output_writer (Optional[OutputWriter]): output writer.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskCacheDataParser: """Task Cache data parser.""" def __init__(self, debug=False, output_writer=None): """Initializes a Task Cache data parser. Args: debug (Optional[bool]): True if debug information should be printed. output_writer (Optional[OutputWriter]): output writer.""" super(TaskC...
the_stack_v2_python_sparse
winregrc/task_cache.py
libyal/winreg-kb
train
129
60eecbc9886dc6e7e022d5c87830e49e1975c31f
[ "self.quark = quark\nself.nucleon = nucleon\nself.ip = input_dict", "if self.nucleon == 'p':\n if self.quark == 'u':\n return 2 * self.ip['ap'] + self.ip['an'] + self.ip['F2sp']\n if self.quark == 'd':\n return 2 * self.ip['an'] + self.ip['ap'] + self.ip['F2sp']\n if self.quark == 's':\n ...
<|body_start_0|> self.quark = quark self.nucleon = nucleon self.ip = input_dict <|end_body_0|> <|body_start_1|> if self.nucleon == 'p': if self.quark == 'u': return 2 * self.ip['ap'] + self.ip['an'] + self.ip['F2sp'] if self.quark == 'd': ...
F2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class F2: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor F2 Return the nuclear form factor F2 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionar...
stack_v2_sparse_classes_36k_train_016690
18,337
permissive
[ { "docstring": "The nuclear form factor F2 Return the nuclear form factor F2 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadronic input parameters (default is Num_input().input_pa...
2
stack_v2_sparse_classes_30k_train_020401
Implement the Python class `F2` described below. Class description: Implement the F2 class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor F2 Return the nuclear form factor F2 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange)...
Implement the Python class `F2` described below. Class description: Implement the F2 class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor F2 Return the nuclear form factor F2 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange)...
4a714e4701f817fdc96e10e461eef7c4756ef71d
<|skeleton|> class F2: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor F2 Return the nuclear form factor F2 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class F2: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor F2 Return the nuclear form factor F2 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadronic ...
the_stack_v2_python_sparse
directdm/num/single_nucleon_form_factors.py
DirectDM/directdm-py
train
6
cc81020ad20cba6f3ed0db99d34d0c2d62097587
[ "LayoutItem.__init__(self, dom, parent_element, map_object, mxd, arc_doc)\nself.dom = dom\nself.parent_element = parent_element\nself.map_object = map_object\nself.mxd = mxd\nself.arc_doc = arc_doc", "arcpy_item = LayoutItem.get_arcpy_layout_element(self, self.layout_item_object)\nLayoutItemFrame.set_size_and_pos...
<|body_start_0|> LayoutItem.__init__(self, dom, parent_element, map_object, mxd, arc_doc) self.dom = dom self.parent_element = parent_element self.map_object = map_object self.mxd = mxd self.arc_doc = arc_doc <|end_body_0|> <|body_start_1|> arcpy_item = LayoutIte...
LayoutItemFrame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayoutItemFrame: def __init__(self, dom, parent_element, map_object, mxd, arc_doc): """This function creates a frame(Map)-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param map_object: The Map item as ArcObject ...
stack_v2_sparse_classes_36k_train_016691
2,970
permissive
[ { "docstring": "This function creates a frame(Map)-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param map_object: The Map item as ArcObject :param mxd: the arcpy mxd-document :param arc_doc: the ArcObject IMxDocument", "name": "__i...
2
null
Implement the Python class `LayoutItemFrame` described below. Class description: Implement the LayoutItemFrame class. Method signatures and docstrings: - def __init__(self, dom, parent_element, map_object, mxd, arc_doc): This function creates a frame(Map)-item :param dom: the Document Object Model :param parent_eleme...
Implement the Python class `LayoutItemFrame` described below. Class description: Implement the LayoutItemFrame class. Method signatures and docstrings: - def __init__(self, dom, parent_element, map_object, mxd, arc_doc): This function creates a frame(Map)-item :param dom: the Document Object Model :param parent_eleme...
cd0aa5f533194c85cf6e098fadc079ea61b63fce
<|skeleton|> class LayoutItemFrame: def __init__(self, dom, parent_element, map_object, mxd, arc_doc): """This function creates a frame(Map)-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param map_object: The Map item as ArcObject ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayoutItemFrame: def __init__(self, dom, parent_element, map_object, mxd, arc_doc): """This function creates a frame(Map)-item :param dom: the Document Object Model :param parent_element: the main layout element, where to put the layout-items :param map_object: The Map item as ArcObject :param mxd: th...
the_stack_v2_python_sparse
layout/layoutItemFrame.py
avaldeon/mapqonverter
train
0
460b7d194c1924327e0a5f561a064d43189c23dc
[ "with conn.cursor() as cur:\n cur.execute(\"\\nselect count(*) as ct\\n from pg_class\\n where relnamespace = 'acct10001'::regnamespace\\n and relname = 'presto_delete_wrapper_log';\\n\")\n self.assertTrue(bool(cur.fetchone()[0]))\n cur.execute(\"\\nselect count(*) as ct\\n from pg_trigger\\n where tgn...
<|body_start_0|> with conn.cursor() as cur: cur.execute("\nselect count(*) as ct\n from pg_class\n where relnamespace = 'acct10001'::regnamespace\n and relname = 'presto_delete_wrapper_log';\n") self.assertTrue(bool(cur.fetchone()[0])) cur.execute("\nselect count(*) as ct\...
TestPrestoDeleteLogTrigger
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPrestoDeleteLogTrigger: def test_presto_delete_log_table_exists(self): """Ensure that the table and trigger exists""" <|body_0|> def test_presto_delete_log_func_exists(self): """Ensure that the presto delete wrapper trigger function exists""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_016692
2,799
permissive
[ { "docstring": "Ensure that the table and trigger exists", "name": "test_presto_delete_log_table_exists", "signature": "def test_presto_delete_log_table_exists(self)" }, { "docstring": "Ensure that the presto delete wrapper trigger function exists", "name": "test_presto_delete_log_func_exist...
3
stack_v2_sparse_classes_30k_val_000165
Implement the Python class `TestPrestoDeleteLogTrigger` described below. Class description: Implement the TestPrestoDeleteLogTrigger class. Method signatures and docstrings: - def test_presto_delete_log_table_exists(self): Ensure that the table and trigger exists - def test_presto_delete_log_func_exists(self): Ensure...
Implement the Python class `TestPrestoDeleteLogTrigger` described below. Class description: Implement the TestPrestoDeleteLogTrigger class. Method signatures and docstrings: - def test_presto_delete_log_table_exists(self): Ensure that the table and trigger exists - def test_presto_delete_log_func_exists(self): Ensure...
2979f03fbdd1c20c3abc365a963a1282b426f321
<|skeleton|> class TestPrestoDeleteLogTrigger: def test_presto_delete_log_table_exists(self): """Ensure that the table and trigger exists""" <|body_0|> def test_presto_delete_log_func_exists(self): """Ensure that the presto delete wrapper trigger function exists""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPrestoDeleteLogTrigger: def test_presto_delete_log_table_exists(self): """Ensure that the table and trigger exists""" with conn.cursor() as cur: cur.execute("\nselect count(*) as ct\n from pg_class\n where relnamespace = 'acct10001'::regnamespace\n and relname = 'presto_dele...
the_stack_v2_python_sparse
koku/koku/test_presto_delete_wrapper_trigger.py
luisfdez/koku
train
0
38a8b53b275e59ce2d07d724b2c66855aad43d81
[ "def rec(node):\n if node == root:\n return\n b, e, v = (pos - node.words, pos, node.end)\n while rst and b < rst[-1][1]:\n rst.pop(-1)\n rst.append((b, e, v))\nrec(node.first)", "fails = node.get_fails()\nfor fail in reversed(fails):\n if fail != root:\n rst.append((pos - fail...
<|body_start_0|> def rec(node): if node == root: return b, e, v = (pos - node.words, pos, node.end) while rst and b < rst[-1][1]: rst.pop(-1) rst.append((b, e, v)) rec(node.first) <|end_body_0|> <|body_start_1|> fai...
匹配结果的记录模式
mode_t
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mode_t: """匹配结果的记录模式""" def last(rst, pos, node, root): """后项最大匹配,记录最后出现的有效结果""" <|body_0|> def all(rst, pos, node, root): """记录原文字符pos处匹配的节点node的全部可能值""" <|body_1|> def cross(rst, pos, node, root): """交叉保留,丢弃重叠包含的匹配""" <|body_2|> <|...
stack_v2_sparse_classes_36k_train_016693
13,459
no_license
[ { "docstring": "后项最大匹配,记录最后出现的有效结果", "name": "last", "signature": "def last(rst, pos, node, root)" }, { "docstring": "记录原文字符pos处匹配的节点node的全部可能值", "name": "all", "signature": "def all(rst, pos, node, root)" }, { "docstring": "交叉保留,丢弃重叠包含的匹配", "name": "cross", "signature": ...
3
null
Implement the Python class `mode_t` described below. Class description: 匹配结果的记录模式 Method signatures and docstrings: - def last(rst, pos, node, root): 后项最大匹配,记录最后出现的有效结果 - def all(rst, pos, node, root): 记录原文字符pos处匹配的节点node的全部可能值 - def cross(rst, pos, node, root): 交叉保留,丢弃重叠包含的匹配
Implement the Python class `mode_t` described below. Class description: 匹配结果的记录模式 Method signatures and docstrings: - def last(rst, pos, node, root): 后项最大匹配,记录最后出现的有效结果 - def all(rst, pos, node, root): 记录原文字符pos处匹配的节点node的全部可能值 - def cross(rst, pos, node, root): 交叉保留,丢弃重叠包含的匹配 <|skeleton|> class mode_t: """匹配结果的...
ac8076428dbf4608fa0ec77eccbcd03751092e42
<|skeleton|> class mode_t: """匹配结果的记录模式""" def last(rst, pos, node, root): """后项最大匹配,记录最后出现的有效结果""" <|body_0|> def all(rst, pos, node, root): """记录原文字符pos处匹配的节点node的全部可能值""" <|body_1|> def cross(rst, pos, node, root): """交叉保留,丢弃重叠包含的匹配""" <|body_2|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mode_t: """匹配结果的记录模式""" def last(rst, pos, node, root): """后项最大匹配,记录最后出现的有效结果""" def rec(node): if node == root: return b, e, v = (pos - node.words, pos, node.end) while rst and b < rst[-1][1]: rst.pop(-1) rst...
the_stack_v2_python_sparse
py/match_ac.py
hxrain/scutil
train
3
ce6ef2140c421d6999a1252ff8604813dca2c620
[ "super().__init__(*args, **kwargs)\ninput_size = sum((x.output_size for x in self._input_layers))\noutput_size = self.output_size\nself._init_weight('input/W', (input_size, output_size), scale=0.01)\nif self._network.class_prior_probs is None:\n self._init_bias('input/b', output_size)\nelse:\n initial_bias = ...
<|body_start_0|> super().__init__(*args, **kwargs) input_size = sum((x.output_size for x in self._input_layers)) output_size = self.output_size self._init_weight('input/W', (input_size, output_size), scale=0.01) if self._network.class_prior_probs is None: self._init_b...
Softmax Output Layer The output layer is a simple softmax layer that outputs the word probabilities.
SoftmaxLayer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftmaxLayer: """Softmax Output Layer The output layer is a simple softmax layer that outputs the word probabilities.""" def __init__(self, *args, **kwargs): """Initializes the parameters used by this layer.""" <|body_0|> def create_structure(self): """Creates th...
stack_v2_sparse_classes_36k_train_016694
4,458
permissive
[ { "docstring": "Initializes the parameters used by this layer.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Creates the symbolic graph of this layer. The input is always 3-dimensional: the first dimension is the time step, the second dimension are t...
2
stack_v2_sparse_classes_30k_train_010743
Implement the Python class `SoftmaxLayer` described below. Class description: Softmax Output Layer The output layer is a simple softmax layer that outputs the word probabilities. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initializes the parameters used by this layer. - def create_struct...
Implement the Python class `SoftmaxLayer` described below. Class description: Softmax Output Layer The output layer is a simple softmax layer that outputs the word probabilities. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initializes the parameters used by this layer. - def create_struct...
9904faec19ad5718470f21927229aad2656e5686
<|skeleton|> class SoftmaxLayer: """Softmax Output Layer The output layer is a simple softmax layer that outputs the word probabilities.""" def __init__(self, *args, **kwargs): """Initializes the parameters used by this layer.""" <|body_0|> def create_structure(self): """Creates th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftmaxLayer: """Softmax Output Layer The output layer is a simple softmax layer that outputs the word probabilities.""" def __init__(self, *args, **kwargs): """Initializes the parameters used by this layer.""" super().__init__(*args, **kwargs) input_size = sum((x.output_size for ...
the_stack_v2_python_sparse
theanolm/network/softmaxlayer.py
senarvi/theanolm
train
95
80c6b8358432cf7154f8f49aee162932d6dd34a4
[ "super(_CommandSubmitterPQ, self).__init__(parent)\nself.__cmndlist = cmndlist\nself.__cmndpipe = cmndpipe\nself.__rspdpipe = rspdpipe\nself.__nextcmnd = 0\nself.__button = QPushButton('Submit next command', self)\nself.__button.pressed.connect(self.submitNextCommand)\nself.show()", "try:\n cmndstr = str(self....
<|body_start_0|> super(_CommandSubmitterPQ, self).__init__(parent) self.__cmndlist = cmndlist self.__cmndpipe = cmndpipe self.__rspdpipe = rspdpipe self.__nextcmnd = 0 self.__button = QPushButton('Submit next command', self) self.__button.pressed.connect(self.subm...
Testing dialog for controlling the addition of commands to a pipe. Used for testing PipedImagerPQ in the same process as the viewer.
_CommandSubmitterPQ
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _CommandSubmitterPQ: """Testing dialog for controlling the addition of commands to a pipe. Used for testing PipedImagerPQ in the same process as the viewer.""" def __init__(self, parent, cmndpipe, rspdpipe, cmndlist): """Create a QDialog with a single QPushButton for controlling the ...
stack_v2_sparse_classes_36k_train_016695
40,479
permissive
[ { "docstring": "Create a QDialog with a single QPushButton for controlling the submission of commands from cmndlist to cmndpipe.", "name": "__init__", "signature": "def __init__(self, parent, cmndpipe, rspdpipe, cmndlist)" }, { "docstring": "Submit the next command from the command list to the c...
2
stack_v2_sparse_classes_30k_train_002608
Implement the Python class `_CommandSubmitterPQ` described below. Class description: Testing dialog for controlling the addition of commands to a pipe. Used for testing PipedImagerPQ in the same process as the viewer. Method signatures and docstrings: - def __init__(self, parent, cmndpipe, rspdpipe, cmndlist): Create...
Implement the Python class `_CommandSubmitterPQ` described below. Class description: Testing dialog for controlling the addition of commands to a pipe. Used for testing PipedImagerPQ in the same process as the viewer. Method signatures and docstrings: - def __init__(self, parent, cmndpipe, rspdpipe, cmndlist): Create...
f21d878c776286ee333a44b99e0b31ad53d8917a
<|skeleton|> class _CommandSubmitterPQ: """Testing dialog for controlling the addition of commands to a pipe. Used for testing PipedImagerPQ in the same process as the viewer.""" def __init__(self, parent, cmndpipe, rspdpipe, cmndlist): """Create a QDialog with a single QPushButton for controlling the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _CommandSubmitterPQ: """Testing dialog for controlling the addition of commands to a pipe. Used for testing PipedImagerPQ in the same process as the viewer.""" def __init__(self, parent, cmndpipe, rspdpipe, cmndlist): """Create a QDialog with a single QPushButton for controlling the submission of...
the_stack_v2_python_sparse
pviewmod/pipedimagerpq.py
NOAA-PMEL/PyFerret
train
61
cc77b2745867036742c3e99c667be022806d35c3
[ "if not head or not head.next:\n return True\nslow, fast = (head, head)\nstack = [head.val]\nwhile fast and fast.next:\n slow, fast = (slow.next, fast.next.next)\n stack.append(slow.val)\nif not fast.next:\n stack.pop()\nwhile slow.next:\n slow = slow.next\n if stack.pop() != slow.val:\n re...
<|body_start_0|> if not head or not head.next: return True slow, fast = (head, head) stack = [head.val] while fast and fast.next: slow, fast = (slow.next, fast.next.next) stack.append(slow.val) if not fast.next: stack.pop() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def ispalindrome_stack(self, head): """快慢指针找到中点,前半部分入栈 Time: O(n) Space: O(n/2) :type head: ListNode :rtype: bool""" <|body_0|> def ispalindrome(self, head): """快慢指针找到中点,前半部分链表逆置 Time: O(n) Space: O(1) :type head: ListNode :rtype: bool""" <|body_1|>...
stack_v2_sparse_classes_36k_train_016696
2,535
no_license
[ { "docstring": "快慢指针找到中点,前半部分入栈 Time: O(n) Space: O(n/2) :type head: ListNode :rtype: bool", "name": "ispalindrome_stack", "signature": "def ispalindrome_stack(self, head)" }, { "docstring": "快慢指针找到中点,前半部分链表逆置 Time: O(n) Space: O(1) :type head: ListNode :rtype: bool", "name": "ispalindrome",...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ispalindrome_stack(self, head): 快慢指针找到中点,前半部分入栈 Time: O(n) Space: O(n/2) :type head: ListNode :rtype: bool - def ispalindrome(self, head): 快慢指针找到中点,前半部分链表逆置 Time: O(n) Space:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ispalindrome_stack(self, head): 快慢指针找到中点,前半部分入栈 Time: O(n) Space: O(n/2) :type head: ListNode :rtype: bool - def ispalindrome(self, head): 快慢指针找到中点,前半部分链表逆置 Time: O(n) Space:...
215d513b3564a7a76db3d2b29e4acc341a68e8ee
<|skeleton|> class Solution: def ispalindrome_stack(self, head): """快慢指针找到中点,前半部分入栈 Time: O(n) Space: O(n/2) :type head: ListNode :rtype: bool""" <|body_0|> def ispalindrome(self, head): """快慢指针找到中点,前半部分链表逆置 Time: O(n) Space: O(1) :type head: ListNode :rtype: bool""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def ispalindrome_stack(self, head): """快慢指针找到中点,前半部分入栈 Time: O(n) Space: O(n/2) :type head: ListNode :rtype: bool""" if not head or not head.next: return True slow, fast = (head, head) stack = [head.val] while fast and fast.next: slow, ...
the_stack_v2_python_sparse
python/two-pointer/palindrome-linked-list.py
euxuoh/leetcode
train
0
50d7b1ce219368bb0e8e622f1062c326f754ef1b
[ "if columns != []:\n for i, _ in enumerate(dicts):\n dicts[i] = {c: dicts[i][c] for c in columns}\n return dicts\nelse:\n return dicts", "sim_dict = {'А': 'A', 'Р': 'P', 'К': 'K', 'В': 'B', 'Т': 'T', 'С': 'C', 'Х': 'X', 'Е': 'E', 'О': 'O', 'Н': 'H', 'М': 'M'}\nfor sym in sim_dict.keys():\n text...
<|body_start_0|> if columns != []: for i, _ in enumerate(dicts): dicts[i] = {c: dicts[i][c] for c in columns} return dicts else: return dicts <|end_body_0|> <|body_start_1|> sim_dict = {'А': 'A', 'Р': 'P', 'К': 'K', 'В': 'B', 'Т': 'T', 'С': 'C...
Simple auxiliary filtering class
DataFiltering
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFiltering: """Simple auxiliary filtering class""" def dict_list_slice(dicts: list, columns: list) -> list: """Slices list of dicts by given columns(keys) Parameters ---------- dicts : list list of dicts columns : list column(keys) names Returns ------- list list of dicts sliced b...
stack_v2_sparse_classes_36k_train_016697
1,854
permissive
[ { "docstring": "Slices list of dicts by given columns(keys) Parameters ---------- dicts : list list of dicts columns : list column(keys) names Returns ------- list list of dicts sliced by given keys", "name": "dict_list_slice", "signature": "def dict_list_slice(dicts: list, columns: list) -> list" }, ...
3
stack_v2_sparse_classes_30k_train_005387
Implement the Python class `DataFiltering` described below. Class description: Simple auxiliary filtering class Method signatures and docstrings: - def dict_list_slice(dicts: list, columns: list) -> list: Slices list of dicts by given columns(keys) Parameters ---------- dicts : list list of dicts columns : list colum...
Implement the Python class `DataFiltering` described below. Class description: Simple auxiliary filtering class Method signatures and docstrings: - def dict_list_slice(dicts: list, columns: list) -> list: Slices list of dicts by given columns(keys) Parameters ---------- dicts : list list of dicts columns : list colum...
7bf107b448cdd0e5d7f1cf85726b06c677ed922d
<|skeleton|> class DataFiltering: """Simple auxiliary filtering class""" def dict_list_slice(dicts: list, columns: list) -> list: """Slices list of dicts by given columns(keys) Parameters ---------- dicts : list list of dicts columns : list column(keys) names Returns ------- list list of dicts sliced b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataFiltering: """Simple auxiliary filtering class""" def dict_list_slice(dicts: list, columns: list) -> list: """Slices list of dicts by given columns(keys) Parameters ---------- dicts : list list of dicts columns : list column(keys) names Returns ------- list list of dicts sliced by given keys"...
the_stack_v2_python_sparse
advancedbot/components/utils/datafiltering.py
sdallaboratory/advanced-telegram-bot
train
6
9ebc796f17095486673ae8da6119d33f0a4a9a66
[ "defined_cmd = 'a $VERY $OVERSIMPLIFIED line'\nt = SCons.Platform.TempFileMunge(defined_cmd)\nenv = SCons.Environment.SubstitutionEnvironment(tools=[])\nenv['MAXLINELENGTH'] = 1024\nenv['VERY'] = 'test'\nenv['OVERSIMPLIFIED'] = 'command'\nexpanded_cmd = env.subst(defined_cmd)\ncmd = t(None, None, env, 0)\nassert cm...
<|body_start_0|> defined_cmd = 'a $VERY $OVERSIMPLIFIED line' t = SCons.Platform.TempFileMunge(defined_cmd) env = SCons.Environment.SubstitutionEnvironment(tools=[]) env['MAXLINELENGTH'] = 1024 env['VERY'] = 'test' env['OVERSIMPLIFIED'] = 'command' expanded_cmd = ...
TempFileMungeTestCase
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempFileMungeTestCase: def test_MAXLINELENGTH(self) -> None: """Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher""" <|body_0|> def test_TEMPFILEARGJOINBYTE(self) -> No...
stack_v2_sparse_classes_36k_train_016698
12,425
permissive
[ { "docstring": "Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher", "name": "test_MAXLINELENGTH", "signature": "def test_MAXLINELENGTH(self) -> None" }, { "docstring": "Test argument join b...
4
stack_v2_sparse_classes_30k_train_013267
Implement the Python class `TempFileMungeTestCase` described below. Class description: Implement the TempFileMungeTestCase class. Method signatures and docstrings: - def test_MAXLINELENGTH(self) -> None: Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism k...
Implement the Python class `TempFileMungeTestCase` described below. Class description: Implement the TempFileMungeTestCase class. Method signatures and docstrings: - def test_MAXLINELENGTH(self) -> None: Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism k...
b2a7d7066a2b854460a334a5fe737ea389655e6e
<|skeleton|> class TempFileMungeTestCase: def test_MAXLINELENGTH(self) -> None: """Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher""" <|body_0|> def test_TEMPFILEARGJOINBYTE(self) -> No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TempFileMungeTestCase: def test_MAXLINELENGTH(self) -> None: """Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher""" defined_cmd = 'a $VERY $OVERSIMPLIFIED line' t = SCons.Platfor...
the_stack_v2_python_sparse
SCons/Platform/PlatformTests.py
SCons/scons
train
1,827
b2391cedad75a08834a418f03a8b4d90fbd9891c
[ "mapping_file = open(filepath, 'r')\nmatrix = []\nfor row in mapping_file:\n matrix.append([int(n) for n in list(row)[:-1]])\nself._mapping = matrix", "if score_from_current_incident > 1 or score_from_prev_incidents > 1:\n warnings.warn(f'Current or previous risk score > 1:\\n\\n Current:...
<|body_start_0|> mapping_file = open(filepath, 'r') matrix = [] for row in mapping_file: matrix.append([int(n) for n in list(row)[:-1]]) self._mapping = matrix <|end_body_0|> <|body_start_1|> if score_from_current_incident > 1 or score_from_prev_incidents > 1: ...
RiskScoreCombiner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RiskScoreCombiner: def __init__(self, filepath: str='server/risk_scores/mapping.txt'): """Reads a text file that contains the mappings for incoming risk scores. e.g., _mapping[20, 30] corresponds to the risk score for all scores where: 0.20 <= score_from_current_incident < 0.21 0.30 <= s...
stack_v2_sparse_classes_36k_train_016699
5,842
permissive
[ { "docstring": "Reads a text file that contains the mappings for incoming risk scores. e.g., _mapping[20, 30] corresponds to the risk score for all scores where: 0.20 <= score_from_current_incident < 0.21 0.30 <= score_from_prev_incidents < 0.31", "name": "__init__", "signature": "def __init__(self, fil...
2
stack_v2_sparse_classes_30k_train_017962
Implement the Python class `RiskScoreCombiner` described below. Class description: Implement the RiskScoreCombiner class. Method signatures and docstrings: - def __init__(self, filepath: str='server/risk_scores/mapping.txt'): Reads a text file that contains the mappings for incoming risk scores. e.g., _mapping[20, 30...
Implement the Python class `RiskScoreCombiner` described below. Class description: Implement the RiskScoreCombiner class. Method signatures and docstrings: - def __init__(self, filepath: str='server/risk_scores/mapping.txt'): Reads a text file that contains the mappings for incoming risk scores. e.g., _mapping[20, 30...
a2ff0c96f449e81998fca6fa083350cf22eac382
<|skeleton|> class RiskScoreCombiner: def __init__(self, filepath: str='server/risk_scores/mapping.txt'): """Reads a text file that contains the mappings for incoming risk scores. e.g., _mapping[20, 30] corresponds to the risk score for all scores where: 0.20 <= score_from_current_incident < 0.21 0.30 <= s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RiskScoreCombiner: def __init__(self, filepath: str='server/risk_scores/mapping.txt'): """Reads a text file that contains the mappings for incoming risk scores. e.g., _mapping[20, 30] corresponds to the risk score for all scores where: 0.20 <= score_from_current_incident < 0.21 0.30 <= score_from_prev...
the_stack_v2_python_sparse
server/risk_scores/risk_scores.py
Code-the-Change-YYC/YW-NLP-Report-Classifier
train
1