text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: grtzsohalf/SpeechNet-codebase path: /bin/se/evaluation.py import numpy as np from pesq import pesq from pystoi import stoi def sisdr_eval(src, tar, sr=16000, eps=1e-10): alpha = (src * tar).sum() / ((tar * tar).sum() + eps) ay = alpha * tar norm = ((ay - src) * (ay - src)).sum() + ep...
code_fim
hard
{ "lang": "python", "repo": "grtzsohalf/SpeechNet-codebase", "path": "/bin/se/evaluation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def stoi_eval(src, tar, sr=16000): src, tar = src.numpy(), tar.numpy() assert src.ndim == 1 and tar.ndim == 1 return stoi(tar, src, sr, extended=False) def estoi_eval(src, tar, sr=16000): src, tar = src.numpy(), tar.numpy() assert src.ndim == 1 and tar.ndim == 1 return stoi(tar, s...
code_fim
hard
{ "lang": "python", "repo": "grtzsohalf/SpeechNet-codebase", "path": "/bin/se/evaluation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if family not in features: features[family] = list() l = features.get(family) l.append(feature_vec) best_accuracy = fitting_scoring(features) output[(p1, p2)] = best_accuracy output = dict...
code_fim
hard
{ "lang": "python", "repo": "skycckk/Malware-Image-Analysis", "path": "/src/param_tuning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skycckk/Malware-Image-Analysis path: /src/param_tuning.py from collections import OrderedDict from extract_features import * from load_images import * from malware_image_train import fitting_scoring __author__ = "Wei-Chung Huang" __copyright__ = "Copyright 2018, The SJSU MSCS Master project" __l...
code_fim
hard
{ "lang": "python", "repo": "skycckk/Malware-Image-Analysis", "path": "/src/param_tuning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MinniFlo/curpysnake path: /src/Color.py import curses import random class Color: def __init__(self, color_num): color_255 = 1000 color_0 = 392 color_224 = 878 color_191 = 749 color_128 = 502 curses.use_default_colors() curses.init_co...
code_fim
hard
{ "lang": "python", "repo": "MinniFlo/curpysnake", "path": "/src/Color.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def red_green_color(self): if self.color_cycle == 0: if not self.map_reverse: self.color_num += 1 if self.color_num == 8: self.map_reverse = True else: self.color_num -= 1 if self.color_...
code_fim
hard
{ "lang": "python", "repo": "MinniFlo/curpysnake", "path": "/src/Color.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Avocado-Network/avocado-blockchain path: /avocado/protocols/wallet_protocol.py from dataclasses import dataclass from typing import List, Optional, Tuple from avocado.types.blockchain_format.coin import Coin from avocado.types.blockchain_format.program import Program from avocado.types.blockchai...
code_fim
hard
{ "lang": "python", "repo": "Avocado-Network/avocado-blockchain", "path": "/avocado/protocols/wallet_protocol.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@dataclass(frozen=True) @streamable class RequestHeaderBlocks(Streamable): start_height: uint32 end_height: uint32 @dataclass(frozen=True) @streamable class RejectHeaderBlocks(Streamable): start_height: uint32 end_height: uint32 @dataclass(frozen=True) @streamable class RespondHeaderBl...
code_fim
hard
{ "lang": "python", "repo": "Avocado-Network/avocado-blockchain", "path": "/avocado/protocols/wallet_protocol.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def reparameterize(self, mean, logvar): eps = tf.random.normal(shape=mean.shape) return eps * tf.exp(logvar * .5) + mean def decode(self, z, apply_sigmoid=False): logits = self.generative_net(z) if apply_sigmoid: probs = tf.sigmoid(logits) r...
code_fim
hard
{ "lang": "python", "repo": "MalloryWittwer/super_tomo_py", "path": "/models/autoencoder/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MalloryWittwer/super_tomo_py path: /models/autoencoder/models.py import tensorflow as tf import os import time import numpy as np import glob class CVAE(tf.keras.Model): def __init__(self, latent_dim, input_data): ''' Initialise the convolutional autoencoder Paramete...
code_fim
hard
{ "lang": "python", "repo": "MalloryWittwer/super_tomo_py", "path": "/models/autoencoder/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logits = self.generative_net(z) if apply_sigmoid: probs = tf.sigmoid(logits) return probs return logits @tf.function def compute_loss(model, x, y, sigmoid=False): mean, logvar = model.encode(x) z = model.reparameterize(mean, logvar) x_logit = m...
code_fim
hard
{ "lang": "python", "repo": "MalloryWittwer/super_tomo_py", "path": "/models/autoencoder/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ctd_data = plot_data.ctd_data qaqc_mask = ctd_data.salinity.attrs["qaqcFlag"] == 1 ax.plot( ctd_data.temperature.sampleTime[qaqc_mask], ctd_data.temperature[qaqc_mask], linewidth=2, label="Observations", color=theme.COLOURS["time series"]["VENUS CTD temp...
code_fim
hard
{ "lang": "python", "repo": "SalishSeaCast/SalishSeaNowcast", "path": "/nowcast/figures/comparison/compare_venus_ctd.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _plot_temperature_time_series(ax, plot_data, timezone, theme): ctd_data = plot_data.ctd_data qaqc_mask = ctd_data.salinity.attrs["qaqcFlag"] == 1 ax.plot( ctd_data.temperature.sampleTime[qaqc_mask], ctd_data.temperature[qaqc_mask], linewidth=2, label="Obser...
code_fim
hard
{ "lang": "python", "repo": "SalishSeaCast/SalishSeaNowcast", "path": "/nowcast/figures/comparison/compare_venus_ctd.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SalishSeaCast/SalishSeaNowcast path: /nowcast/figures/comparison/compare_venus_ctd.py # Copyright 2013 – present by the SalishSeaCast Project contributors # and The University of British Columbia # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file e...
code_fim
hard
{ "lang": "python", "repo": "SalishSeaCast/SalishSeaNowcast", "path": "/nowcast/figures/comparison/compare_venus_ctd.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ggozad/petmail path: /petmail/node.py import json from twisted.application import service from . import database, web class Node(service.MultiService): def __init__(self, basedir, dbfile): service.MultiService.__init__(self) self.basedir = basedir self.dbfile = dbfile...
code_fim
medium
{ "lang": "python", "repo": "ggozad/petmail", "path": "/petmail/node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from .mailbox.server import HTTPMailboxServer # TODO: learn/be-told our IP addr/hostname c = self.db.execute("SELECT * FROM mailbox_server_config") row = c.fetchone() s = HTTPMailboxServer(self.web, bool(row["enable_retrieval"]), json.l...
code_fim
medium
{ "lang": "python", "repo": "ggozad/petmail", "path": "/petmail/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def init_webport(self): self.web = web.WebPort(self.basedir, self) self.web.setServiceParent(self) def init_mailbox_server(self): from .mailbox.server import HTTPMailboxServer # TODO: learn/be-told our IP addr/hostname c = self.db.execute("SELECT * FROM mai...
code_fim
hard
{ "lang": "python", "repo": "ggozad/petmail", "path": "/petmail/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arukakibay/ADM-HW1 path: /MapLambdaFunction.py cube = lambda x: pow(x,3) def fibonacci(n): #<|fim_suffix|>d(listt[i-2] + listt[i-1]) return(listt[0:n])<|fim_middle|> return a list of fibonacci numbers listt = [0,1] for i in range(2,n): listt.appen
code_fim
medium
{ "lang": "python", "repo": "arukakibay/ADM-HW1", "path": "/MapLambdaFunction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d(listt[i-2] + listt[i-1]) return(listt[0:n])<|fim_prefix|># repo: arukakibay/ADM-HW1 path: /MapLambdaFunction.py cube = lambda x: pow(x,3) def fibonacci(n): #<|fim_middle|> return a list of fibonacci numbers listt = [0,1] for i in range(2,n): listt.appen
code_fim
medium
{ "lang": "python", "repo": "arukakibay/ADM-HW1", "path": "/MapLambdaFunction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> integer") else: print(str(n) + "! =", fact(n))<|fim_prefix|># repo: saranshbht/bsc-codes path: /semester-6/Python Practice/fact.py def fact(n): if n == 0: return 1 <|fim_middle|>return n * fact(n - 1) n = int(input("Enter a number: ")) if n < 0: print("Enter a non-negative
code_fim
medium
{ "lang": "python", "repo": "saranshbht/bsc-codes", "path": "/semester-6/Python Practice/fact.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saranshbht/bsc-codes path: /semester-6/Python Practice/fact.py def fact(n): if n == 0: return 1 return n * fact(n - 1) n = int(input("Enter a num<|fim_suffix|> integer") else: print(str(n) + "! =", fact(n))<|fim_middle|>ber: ")) if n < 0: print("Enter a non-negative
code_fim
easy
{ "lang": "python", "repo": "saranshbht/bsc-codes", "path": "/semester-6/Python Practice/fact.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.train = train self.validation = validation self.test = test<|fim_prefix|># repo: KipperPipper/Library_test path: /toai/data/DataContainer.py from typing import Any class DataContainer: <|fim_middle|> def __init__(self, train: Any, validation: Any, test: Any):
code_fim
medium
{ "lang": "python", "repo": "KipperPipper/Library_test", "path": "/toai/data/DataContainer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KipperPipper/Library_test path: /toai/data/DataContainer.py from typing import Any <|fim_suffix|> def __init__(self, train: Any, validation: Any, test: Any): self.train = train self.validation = validation self.test = test<|fim_middle|> class DataContainer:
code_fim
easy
{ "lang": "python", "repo": "KipperPipper/Library_test", "path": "/toai/data/DataContainer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: noodlesz/fedclean_implementation path: /blockchainAPI/credentials.py import json with open("my_abi.json") as f: info_json = json.load(f) req_abi = info_json["abi"] <|fim_suffix|>state_abi = info_json["abi"] #driver if __name__ == "__main__": print(req_abi) print(state_abi)<|fim_middle|>wi...
code_fim
medium
{ "lang": "python", "repo": "noodlesz/fedclean_implementation", "path": "/blockchainAPI/credentials.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #driver if __name__ == "__main__": print(req_abi) print(state_abi)<|fim_prefix|># repo: noodlesz/fedclean_implementation path: /blockchainAPI/credentials.py import json with open("my_abi.json") as f: info_json = json.load(f) req_abi = info_json["abi"] <|fim_middle|>with open("state_abi.json") as g...
code_fim
medium
{ "lang": "python", "repo": "noodlesz/fedclean_implementation", "path": "/blockchainAPI/credentials.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ro9ueAdmin/django-orchestra path: /orchestra/contrib/orders/billing.py from django.utils.translation import ugettext_lazy as _ from orchestra.contrib.bills.models import Invoice, Fee, ProForma class BillsBackend(object): def create_bills(self, account, lines, **options): bill = Non...
code_fim
hard
{ "lang": "python", "repo": "Ro9ueAdmin/django-orchestra", "path": "/orchestra/contrib/orders/billing.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> metric = format(line.metric, '.2f').rstrip('0').rstrip('.') metric = metric.strip('0').strip('.') size = format(line.size, '.2f').rstrip('0').rstrip('.') size = size.strip('0').strip('.') if metric == '1': return size if size == '1': ...
code_fim
hard
{ "lang": "python", "repo": "Ro9ueAdmin/django-orchestra", "path": "/orchestra/contrib/orders/billing.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@require(lambda identifier: re.match(r'^[FB]{7}[LR]{3}\Z', identifier)) @ensure(lambda result: 0 <= result[0] <= 127) @ensure(lambda result: 0 <= result[1] <= 8) def determine_row_and_column(identifier: str) -> Tuple[int, int]: row_identifier = identifier[:7] column_identifier = identifier[7:] ...
code_fim
hard
{ "lang": "python", "repo": "LaurenDebruyn/aocdbc", "path": "/recorded_failures/aoc2020/day_5_binary_boarding/broken_step.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LaurenDebruyn/aocdbc path: /recorded_failures/aoc2020/day_5_binary_boarding/broken_step.py import re from typing import Tuple from icontract import require, ensure # crosshair: on @require(lambda first, last: (last - first + 1) % 2 == 0, "Range always divisible by 2") @require(lambda first, l...
code_fim
hard
{ "lang": "python", "repo": "LaurenDebruyn/aocdbc", "path": "/recorded_failures/aoc2020/day_5_binary_boarding/broken_step.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> in file(sys.argv[1], 'r')] acc = 0 for a, b in zip(pred, test): acc += abs(a - b) print "%.4f" % (acc / float(len(pred)))<|fim_prefix|># repo: rozim/KaggleFindingElo path: /xg-score.py import sys pred = [float(line) for line in file('<|fim_middle|>pred.txt').readlines()] test = [float...
code_fim
medium
{ "lang": "python", "repo": "rozim/KaggleFindingElo", "path": "/xg-score.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rozim/KaggleFindingElo path: /xg-score.py import sys pred = [float(line) for line in file('<|fim_suffix|>): acc += abs(a - b) print "%.4f" % (acc / float(len(pred)))<|fim_middle|>pred.txt').readlines()] test = [float(line.split()[0]) for line in file(sys.argv[1], 'r')] acc = 0 ...
code_fim
medium
{ "lang": "python", "repo": "rozim/KaggleFindingElo", "path": "/xg-score.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for p in processes: p.join() env_names = ['InvertedPendulum-v2', 'HalfCheetah-v2'] folder_names = [] for env_name in env_names: pattern = re.compile('ac_10_10_' + env_name + '.*') matching_folders = [os.path.join(data_folder,a) for a in os.listdir(base_folder) if pattern.search(a) is not Non...
code_fim
medium
{ "lang": "python", "repo": "hsilva664/CS-294-112-Fall-2018-HW-solutions", "path": "/hw3/ac_q2_run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hsilva664/CS-294-112-Fall-2018-HW-solutions path: /hw3/ac_q2_run.py import os from multiprocessing import Process, Lock import re base_folder = 'code/data' data_folder = 'data' system_code = [ 'cd code && python3 train_ac_f18.py InvertedPendulum-v2 -ep 1000 --discount 0.95 -n 100 -l 2 -s 64 -b ...
code_fim
hard
{ "lang": "python", "repo": "hsilva664/CS-294-112-Fall-2018-HW-solutions", "path": "/hw3/ac_q2_run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timvink/mkdocs-add-number-plugin path: /tests/test_markdown.py from mkdocs_add_number_plugin import markdown page1 = """ # Example page some content ## another heading <|fim_suffix|>def test_headings(): lines = page1.split('\n') assert markdown.headings(lines) == { 1: '# Examp...
code_fim
medium
{ "lang": "python", "repo": "timvink/mkdocs-add-number-plugin", "path": "/tests/test_markdown.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>bla ### another sub heading ## Another section """ def test_headings(): lines = page1.split('\n') assert markdown.headings(lines) == { 1: '# Example page', 5: '## another heading', 9: '## Some section', 14: '### sub heading', 18: '### another sub heading'...
code_fim
medium
{ "lang": "python", "repo": "timvink/mkdocs-add-number-plugin", "path": "/tests/test_markdown.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/1184. Distance Between Bus Stops/1184.py class Solution: def distanceBetweenBusStops(self, distance: List[int], start: int, destination: int) -> int: clockwise = 0 counterclockwise = 0 <|fim_suffix|> for i, d in enumerate(distance): if i >= st...
code_fim
medium
{ "lang": "python", "repo": "walkccc/LeetCode", "path": "/solutions/1184. Distance Between Bus Stops/1184.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if start > destination: start, destination = destination, start for i, d in enumerate(distance): if i >= start and i < destination: clockwise += d else: counterclockwise += d return min(clockwise, counterclockwise)<|fim_prefix|># repo: walkccc/LeetCode path...
code_fim
easy
{ "lang": "python", "repo": "walkccc/LeetCode", "path": "/solutions/1184. Distance Between Bus Stops/1184.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-google-native path: /sdk/python/pulumi_google_native/essentialcontacts/v1/get_folder_contact.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/essentialcontacts/v1/get_folder_contact.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_folder_contact(contact_id: Optional[str] = None, folder_id: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetFolderContactResult: """ Gets a single contact. """ __args__ = dict() __args__['contactId...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/essentialcontacts/v1/get_folder_contact.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> query = logic.Relation('member', (x, list)) print 'Query:', query print logic.prolog_prove([query], db)<|fim_prefix|># repo: skynetshrugged/paip-python path: /paip/examples/logic/find_elements.py import logging from paip import logic def main(): x = logic.Var('x') y = logic....
code_fim
hard
{ "lang": "python", "repo": "skynetshrugged/paip-python", "path": "/paip/examples/logic/find_elements.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> member_rest = logic.Clause( logic.Relation('member', (x, logic.Relation('pair', (y, more)))), [logic.Relation('member', (x, more))]) db = {} logic.store(db, member_first) logic.store(db, member_last) logic.store(db, member_rest) list = logic.Relation( 'pai...
code_fim
hard
{ "lang": "python", "repo": "skynetshrugged/paip-python", "path": "/paip/examples/logic/find_elements.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: skynetshrugged/paip-python path: /paip/examples/logic/find_elements.py import logging from paip import logic def main(): x = logic.Var('x') y = logic.Var('y') a = logic.Var('a') nil = logic.Atom('nil') more = logic.Var('more') <|fim_suffix|> list = logic.Relation( ...
code_fim
hard
{ "lang": "python", "repo": "skynetshrugged/paip-python", "path": "/paip/examples/logic/find_elements.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tedye/leetcode path: /tools/leetcode.110.Balanced Binary Tree/leetcode.110.Balanced Binary Tree.submission7.py # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "tedye/leetcode", "path": "/tools/leetcode.110.Balanced Binary Tree/leetcode.110.Balanced Binary Tree.submission7.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if abs(hl[0]-hr[0]) > 1: return False else: return (l and r)<|fim_prefix|># repo: tedye/leetcode path: /tools/leetcode.110.Balanced Binary Tree/leetcode.110.Balanced Binary Tree.submission7.py # Definition for a binary tree node # class TreeNode: # def __init__(self, x): ...
code_fim
hard
{ "lang": "python", "repo": "tedye/leetcode", "path": "/tools/leetcode.110.Balanced Binary Tree/leetcode.110.Balanced Binary Tree.submission7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_dataproc_job_api( dataproc_launcher: DataprocClusterLauncher, # noqa: F811 dataproc_retrieval_job_params: RetrievalJobParameters, # noqa: F811 ): job = dataproc_launcher.historical_feature_retrieval(dataproc_retrieval_job_params) job_id = job.get_id() retrieved_job = datapr...
code_fim
hard
{ "lang": "python", "repo": "MinjaMiladinovic/feast", "path": "/tests/integration/test_launchers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MinjaMiladinovic/feast path: /tests/integration/test_launchers.py import time from feast.pyspark.abc import RetrievalJobParameters, SparkJobStatus, SparkJob from feast.pyspark.launchers.gcloud import DataprocClusterLauncher from .fixtures.job_parameters import customer_entity # noqa: F401 from...
code_fim
medium
{ "lang": "python", "repo": "MinjaMiladinovic/feast", "path": "/tests/integration/test_launchers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cool-RR/python_toolbox path: /test_python_toolbox/test_temp_value_setting/test_temp_value_setter.py # Copyright 2009-2017 Ram Rachum. # This program is distributed under the MIT license. '''Testing module for `python_toolbox.temp_value_setting.TempValueSetter`.''' from python_toolbox import mis...
code_fim
hard
{ "lang": "python", "repo": "cool-RR/python_toolbox", "path": "/test_python_toolbox/test_temp_value_setting/test_temp_value_setter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Test `TempValueSetter` used as a decorator.''' @misc_tools.set_attributes(x=1) def a(): pass @TempValueSetter((a, 'x'), 2) def f(): assert a.x == 2 assert a.x == 1 f() assert a.x == 1 cute_testing.assert_polite_wrapper(f)<|fim_prefix|># repo: cool-RR/pytho...
code_fim
hard
{ "lang": "python", "repo": "cool-RR/python_toolbox", "path": "/test_python_toolbox/test_temp_value_setting/test_temp_value_setter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("shards_per_day", [1,2,3]) def test_as_pipeline(self, temp_dir, shards_per_day): file_path_base = temp_dir # file_path_base = 'gs://paul-scratch/TestDatePartitionedSink_temp' file_name_prefix = 'shard' file_path_prefix = pp.join(file_path_b...
code_fim
hard
{ "lang": "python", "repo": "GlobalFishingWatch/pipe-tools", "path": "/tests/test_datepartitionedsink.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GlobalFishingWatch/pipe-tools path: /tests/test_datepartitionedsink.py import posixpath as pp import six import pytest from apache_beam.testing.test_pipeline import TestPipeline as _TestPipeline from apache_beam.testing.util import assert_that from apache_beam.testing.util import equal_to from a...
code_fim
hard
{ "lang": "python", "repo": "GlobalFishingWatch/pipe-tools", "path": "/tests/test_datepartitionedsink.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return oprot.writeStructBegin('deleteStreamById_args') if self.session...
code_fim
hard
{ "lang": "python", "repo": "nishadi/product-private-paas", "path": "/components/org.wso2.ppaas.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/gen/ThriftEventTransmissionService/ThriftEventTransmissionService.py", "mode": "spm", "license": "Apache-2.0", "sou...
<|fim_suffix|> args = publish_args() args.read(iprot) iprot.readMessageEnd() result = publish_result() try: self._handler.publish(args.eventBundle) except Exception.ttypes.ThriftUndefinedEventTypeException, ue: result.ue = ue except Exception.ttypes.ThriftSessionExpiredException, ...
code_fim
hard
{ "lang": "python", "repo": "nishadi/product-private-paas", "path": "/components/org.wso2.ppaas.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/databridge/thrift/gen/ThriftEventTransmissionService/ThriftEventTransmissionService.py", "mode": "spm", "license": "Apache-2.0", "sou...
<|fim_prefix|># repo: johnrdowson/nornir_pyez path: /Tests/template_config.py from nornir_pyez.plugins.tasks import pyez_config, pyez_diff, pyez_commit import os from nornir import InitNornir from nornir.core.task import Task, Result from nornir_utils.plugins.functions import print_result from nornir_utils.plugins.tas...
code_fim
medium
{ "lang": "python", "repo": "johnrdowson/nornir_pyez", "path": "/Tests/template_config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def template_config(task): # retrieve data from groups.yml data = {} data['dns_server'] = task.host['dns_server'] data['ntp_server'] = task.host['ntp_server'] print(data) response = task.run( task=pyez_config, template_path='junos.j2', template_vars=data, data_format='set')...
code_fim
medium
{ "lang": "python", "repo": "johnrdowson/nornir_pyez", "path": "/Tests/template_config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, msg, response): self.msg = msg self.response = response super(Exception, self) class InvalidCredentialsError(Exception): """ Raised if none of the provided crendentials provide the correct authorization """ pass<|fim_prefix|># repo: sean-...
code_fim
hard
{ "lang": "python", "repo": "sean-abbott/artifactory_tool", "path": "/artifactory_tool/exceptions.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: sean-abbott/artifactory_tool path: /artifactory_tool/exceptions.py # -*- coding: utf-8 -*- class ConfigFetchError(Exception): """Raised when we were unable to fetch the config from the server """ def __init__(self, msg, response): self.msg = msg self.response = resp...
code_fim
hard
{ "lang": "python", "repo": "sean-abbott/artifactory_tool", "path": "/artifactory_tool/exceptions.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> self.msg = msg self.response = response super(Exception, self) class InvalidCredentialsError(Exception): """ Raised if none of the provided crendentials provide the correct authorization """ pass<|fim_prefix|># repo: sean-abbott/artifactory_tool path: /artifac...
code_fim
medium
{ "lang": "python", "repo": "sean-abbott/artifactory_tool", "path": "/artifactory_tool/exceptions.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>) display.set_caption("Пинг-понг") clock = time.clock() FPS = 60 class GameSprite(sprite.Sprite):<|fim_prefix|># repo: boryskrolivets/ping-pong path: /ping pong.py from pygame import* win_height = 700 win_width=5<|fim_middle|>00 window = display.set_mode(win_width,win_height
code_fim
easy
{ "lang": "python", "repo": "boryskrolivets/ping-pong", "path": "/ping pong.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: boryskrolivets/ping-pong path: /ping pong.py from pygame import* win_height = 700 win_width=5<|fim_suffix|>) display.set_caption("Пинг-понг") clock = time.clock() FPS = 60 class GameSprite(sprite.Sprite):<|fim_middle|>00 window = display.set_mode(win_width,win_height
code_fim
easy
{ "lang": "python", "repo": "boryskrolivets/ping-pong", "path": "/ping pong.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> sol = Solution() input = [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]] output = sol.reconstructQueue(input) print("Res: ", output)<|fim_prefix|># repo: partho-maple/coding-interview-gym path: /leetcode.com/python/406_Queue_Reconstruction_by_Height.py class Solution(object): def reconstructQueue(self, ...
code_fim
hard
{ "lang": "python", "repo": "partho-maple/coding-interview-gym", "path": "/leetcode.com/python/406_Queue_Reconstruction_by_Height.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: partho-maple/coding-interview-gym path: /leetcode.com/python/406_Queue_Reconstruction_by_Height.py class Solution(object): def reconstructQueue(self, people): <|fim_suffix|> sol = Solution() input = [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]] output = sol.reconstructQueue(input) print("Res: ...
code_fim
hard
{ "lang": "python", "repo": "partho-maple/coding-interview-gym", "path": "/leetcode.com/python/406_Queue_Reconstruction_by_Height.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sol = Solution() input = [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]] output = sol.reconstructQueue(input) print("Res: ", output)<|fim_prefix|># repo: partho-maple/coding-interview-gym path: /leetcode.com/python/406_Queue_Reconstruction_by_Height.py class Solution(object): def reconstructQueue(self, p...
code_fim
hard
{ "lang": "python", "repo": "partho-maple/coding-interview-gym", "path": "/leetcode.com/python/406_Queue_Reconstruction_by_Height.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def make_clipper(lims): """ Create a function that clips inputs into a closed box space. Parameters ---------- lims : array_like Array of lower and upper bounds to clip inputs to. Returns ------- function Clipping function. """ lims = np.array(lim...
code_fim
hard
{ "lang": "python", "repo": "rademacher-p/stats-learn", "path": "/src/stats_learn/preprocessing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def make_clipper(lims): """ Create a function that clips inputs into a closed box space. Parameters ---------- lims : array_like Array of lower and upper bounds to clip inputs to. Returns ------- function Clipping function. """ lims = np.array(li...
code_fim
hard
{ "lang": "python", "repo": "rademacher-p/stats-learn", "path": "/src/stats_learn/preprocessing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rademacher-p/stats-learn path: /src/stats_learn/preprocessing.py """Functions for preprocessing observations before training/prediction.""" import math import numpy as np from stats_learn.util import check_data_shape def make_discretizer(vals): # TODO: use sklearn.preprocessing.KBinsDiscret...
code_fim
hard
{ "lang": "python", "repo": "rademacher-p/stats-learn", "path": "/src/stats_learn/preprocessing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def block_until_playing(self, media=None, timeout=None, **kwargs): """Block until media is playing, typically useful in a script. Another way to do the same is to check if the controller is_active or by using self.status.player_state. Args: media (None, op...
code_fim
hard
{ "lang": "python", "repo": "home-assistant-libs/pychromecast", "path": "/pychromecast/controllers/plex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant-libs/pychromecast path: /pychromecast/controllers/plex.py one, username=None, autoplay=True, currentTime=0, playQueue=None, playQueueID=None, startItem=None, version="1.10.1.4602", **kwargs, ): # pylint: disable=invalid-name, too-many-locals, protec...
code_fim
hard
{ "lang": "python", "repo": "home-assistant-libs/pychromecast", "path": "/pychromecast/controllers/plex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant-libs/pychromecast path: /pychromecast/controllers/plex.py Audio=True, isVerifiedHostname=True, contentType="video", myPlexSubscription=True, contentId=None, streamType=STREAM_TYPE_BUFFERED, port=32400, protocol="http", address=None, username=None...
code_fim
hard
{ "lang": "python", "repo": "home-assistant-libs/pychromecast", "path": "/pychromecast/controllers/plex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fgs.AddGrowableCol(0) fgs.AddGrowableCol(1) fgs.AddGrowableCol(2) self.SetSizer(fgs) class MyPanel_23(wx.Panel): """- A FlexGridSizer of 9 cells (3x3) with 4 ColWins in cells and 5 empty cells - rows 1 and 3 have a fixed size""" def __init__(self, parent): ...
code_fim
hard
{ "lang": "python", "repo": "icefoxen/lang", "path": "/python/wx/sizertest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: icefoxen/lang path: /python/wx/sizertest.py el): """- Three items: a ColWin and two Buttons - the Buttons are either left/right aligned or centered""" def __init__(self, parent): wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) wred = ColWin(se...
code_fim
hard
{ "lang": "python", "repo": "icefoxen/lang", "path": "/python/wx/sizertest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: icefoxen/lang path: /python/wx/sizertest.py def __init__(self, parent): wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize) wred = ColWin(self, wx.NewId(), wx.RED) wblue = ColWin(self, wx.NewId(), wx.BLUE) wgreen = ColWin(self, wx.NewId(), wx.G...
code_fim
hard
{ "lang": "python", "repo": "icefoxen/lang", "path": "/python/wx/sizertest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: benjamesian/GoodNews path: /scraping/main.py #!/usr/bin/env python3 """ Get articles from the web """ import json import os import socket import sys import tempfile from scraping import API_CLIENTS, SOCKET_PATH def accept_status(status: bytes) -> bool: """ Check if the server status is ...
code_fim
hard
{ "lang": "python", "repo": "benjamesian/GoodNews", "path": "/scraping/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): """ Run the program """ with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock: sock.connect(SOCKET_PATH) for i, client in enumerate(cls() for cls in API_CLIENTS): if 200 <= client.request() < 300: filedesc, filename = tempfi...
code_fim
hard
{ "lang": "python", "repo": "benjamesian/GoodNews", "path": "/scraping/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> body = request.get_json() print(type(body)) print(body['exp_time']) return str(body) @app.route('/images', methods = ['DELETE']) def remove_images(): all_files = os.listdir('./pictures') image_files = [name for name in all_files if name.find('.png') != -1] for image_file ...
code_fim
medium
{ "lang": "python", "repo": "jrmalsan/photo-uploader", "path": "/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/', methods = ['POST']) def hello_world(): if have_camera: settings = request.get_json() ch.set_settings(camera, settings) cur_time = str(int(time.time())) print(cur_time) file_name = 'pi-capture-{}.png'.format(cur_time) full_path = './pictu...
code_fim
medium
{ "lang": "python", "repo": "jrmalsan/photo-uploader", "path": "/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrmalsan/photo-uploader path: /server.py import os import time import src.camera_helper as ch from dotenv import load_dotenv load_dotenv() from flask import Flask from flask import request from flask import jsonify app = Flask(__name__) from azure.storage.blob import BlockBlobService block_blo...
code_fim
medium
{ "lang": "python", "repo": "jrmalsan/photo-uploader", "path": "/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Zipcode(Thing, Base): pass t_state = State.__table__ t_city = City.__table__ t_zipcode = Zipcode.__table__ Base.metadata.create_all(engine)<|fim_prefix|># repo: xltechnology/crawlib-project path: /example/crawlib_doc-project/crawlib_doc/rds_model.py #!/usr/bin/env python # -*- coding: utf-8 ...
code_fim
hard
{ "lang": "python", "repo": "xltechnology/crawlib-project", "path": "/example/crawlib_doc-project/crawlib_doc/rds_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xltechnology/crawlib-project path: /example/crawlib_doc-project/crawlib_doc/rds_model.py #!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime from sqlalchemy.ext.declarative import declarative_base, declared_attr from sqlalchemy import Column, String, Integer, DateTime fro...
code_fim
medium
{ "lang": "python", "repo": "xltechnology/crawlib-project", "path": "/example/crawlib_doc-project/crawlib_doc/rds_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Zipcode(Thing, Base): pass t_state = State.__table__ t_city = City.__table__ t_zipcode = Zipcode.__table__ Base.metadata.create_all(engine)<|fim_prefix|># repo: xltechnology/crawlib-project path: /example/crawlib_doc-project/crawlib_doc/rds_model.py #!/usr/bin/env python # -*- coding: utf-8...
code_fim
hard
{ "lang": "python", "repo": "xltechnology/crawlib-project", "path": "/example/crawlib_doc-project/crawlib_doc/rds_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahinkhankishizade/bookclub_server path: /bookclub/bookclub/bookclub_server/migrations/0002_auto_20190430_2254.py # Generated by Django 2.1.7 on 2019-04-30 19:54 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies =...
code_fim
hard
{ "lang": "python", "repo": "mahinkhankishizade/bookclub_server", "path": "/bookclub/bookclub/bookclub_server/migrations/0002_auto_20190430_2254.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>SCADE, related_name='giving_book_suggestion', to='bookclub_server.Book'), ), migrations.AddField( model_name='suggestion', name='state', field=models.CharField(default='nothing', max_length=250), ), migrations.AddField( model_...
code_fim
hard
{ "lang": "python", "repo": "mahinkhankishizade/bookclub_server", "path": "/bookclub/bookclub/bookclub_server/migrations/0002_auto_20190430_2254.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_create_sqlite_db_setup(): with tempfile.NamedTemporaryFile(mode='w') as f: f.write("DB_DRIVER = 'sqlite'\n") f.write("DB_NAME = 'pantry.db'") f.flush() a = pantry.create_app(f.name) db_driver = a.config.get( 'SQLALCHEMY_DATABASE_URI', ...
code_fim
hard
{ "lang": "python", "repo": "abbec/pantry", "path": "/pantry/tests/test_create.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: abbec/pantry path: /pantry/tests/test_create.py import tempfile import logging import os import werkzeug.contrib.profiler as profiler import pantry def test_create_debug(): with tempfile.NamedTemporaryFile(mode='w') as f: f.write("DEBUG = True\nDB_DRIVER = 'sqlite'") f.flush...
code_fim
hard
{ "lang": "python", "repo": "abbec/pantry", "path": "/pantry/tests/test_create.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_create_profile(): with tempfile.NamedTemporaryFile(mode='w') as f: f.write("PROFILE = True\nDB_DRIVER = 'sqlite'") f.flush() a = pantry.create_app(f.name) assert not a.debug assert isinstance(a.wsgi_app, profiler.ProfilerMiddleware)<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "abbec/pantry", "path": "/pantry/tests/test_create.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def truncateto(self, commandnumber): """Truncates the history up to given commandnumber""" keytuples = self.pvalues.keys() allkeys = sorted(keytuples, key=lambda keytuple: keytuple[0]) # Sanity checking lastkey = allkeys[0][0] candelete = True fo...
code_fim
hard
{ "lang": "python", "repo": "liranz/concoord", "path": "/concoord/pvalue.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: liranz/concoord path: /concoord/pvalue.py ''' @author: Deniz Altinbuken, Emin Gun Sirer @note: PValue is used to keep Paxos state in Acceptor and Leader nodes. @copyright: See LICENSE ''' from concoord.pack import * import types class PValueSet(): """PValueSet encloses a set of pvalues with ...
code_fim
hard
{ "lang": "python", "repo": "liranz/concoord", "path": "/concoord/pvalue.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _objective_function_gradient_sparse(self, c): c = np.mat(c).T c_sum = np.sum(c) XTc = self._X_T * c - self._X_u_mean.T * c_sum a_labeled_tmp = self._gamma*(1.0 - np.multiply(self._y_T, (self._X_l * XTc - self._X...
code_fim
hard
{ "lang": "python", "repo": "hit-Chris/Quasi-Newton-S3VM", "path": "/Quasi_Newton_S3VM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hit-Chris/Quasi-Newton-S3VM path: /Quasi_Newton_S3VM.py import copy as cp import numpy as np from scipy import optimize from scipy import sparse import time class linear_k: def __init__(self, issparse): self._sparse = issparse def compute(self, data1, data2): if self._...
code_fim
hard
{ "lang": "python", "repo": "hit-Chris/Quasi-Newton-S3VM", "path": "/Quasi_Newton_S3VM.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user_input = raw_input('Enter numbers separated by a comma:\n').strip() print(quick_sort([int(item) for item in user_input.split(',')]))<|fim_prefix|># repo: HopperGithub/python_algorithms path: /sorts/quick.py #!/usr/bin/python #coding:utf-8 from __future__ import print_function def quick_sort(...
code_fim
medium
{ "lang": "python", "repo": "HopperGithub/python_algorithms", "path": "/sorts/quick.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HopperGithub/python_algorithms path: /sorts/quick.py #!/usr/bin/python #coding:utf-8 from __future__ import print_function def quick_sort(iterable): '''快速排序(英语:Quick Sort)是冒泡排序的改进,也是二叉查找树的一个空间最优版本。 使用分治法策略将一个序列分为2个子序列,递归排序。主要竞争对手有堆排序、归并排序 参数:可迭代序列 返回:升序排序后的可迭代序列 原理: 1. 对...
code_fim
medium
{ "lang": "python", "repo": "HopperGithub/python_algorithms", "path": "/sorts/quick.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return("<input type=\"number\" name=\""+Name+"\" value=\""+Value+"\" size=\""+Size+"\" maxlenght=\""+Maxlenght+"\" min=\""+Min+"\" max=\""+Max+"\" "+Required+" "+Readonly+">") def MyCheckboxForm(Name,Value): return("<input type=\"checkbox\" name=\""+Name+"\" value=\""+Value+"\">") def MyRadioBut...
code_fim
hard
{ "lang": "python", "repo": "raspibo/CentRed", "path": "/var/www/cgi-bin/mhl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return("<input type=\"email\" name=\""+Name+"\" value=\""+Value+"\" size=\""+Size+"\" "+Required+" "+Readonly+">") def MyTextAreaForm(Name,Value,Cols,Rows,Required,Readonly): return("<textarea name=\""+Name+"\" value=\""+Value+"\" cols=\""+Cols+"\" rows=\""+Rows+"\" "+Required+" "+Readonly+">") ...
code_fim
hard
{ "lang": "python", "repo": "raspibo/CentRed", "path": "/var/www/cgi-bin/mhl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: raspibo/CentRed path: /var/www/cgi-bin/mhl.py #!/usr/bin/env python3 ## My HTML Library # """ ATTENZIONE: Non tutte le funzioni sono state testate/usate alcune neanche fatte """ # Html page def MyHtml(): return "Content-type: text/html\n\n" def MyHtmlHead(): return (""" <html> <...
code_fim
hard
{ "lang": "python", "repo": "raspibo/CentRed", "path": "/var/www/cgi-bin/mhl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return os.path.join(self._checkpoint_dir, 'best', self.__str__()) @property def _attn_dir(self): return os.path.join(self._mp.attn_dir, self.__str__())<|fim_prefix|># repo: Tommy-Liu/A2A_MovieQA path: /model/basic_model.py import os import re from config import MovieQAPath from ...
code_fim
hard
{ "lang": "python", "repo": "Tommy-Liu/A2A_MovieQA", "path": "/model/basic_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tommy-Liu/A2A_MovieQA path: /model/basic_model.py import os import re from config import MovieQAPath from model.basic_hp import BasicHP class BasicModel(object): def __init__(self): self._hp = BasicHP() self._mp = MovieQAPath() def __str__(self): return '.'.joi...
code_fim
medium
{ "lang": "python", "repo": "Tommy-Liu/A2A_MovieQA", "path": "/model/basic_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kauppim/python-mazegame path: /src/pyramid_object.py ''' Pyramid Object ''' class PyramidObject(object): def __init__(self, size_x = 64, size_y = 48, height = 3, array = None): self.height = height self.size_x = size_x self.size_y = size_y if array == None: self.array = [None] * ...
code_fim
hard
{ "lang": "python", "repo": "kauppim/python-mazegame", "path": "/src/pyramid_object.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if ( 1 <= x_pos < self.size_x ) and ( 0 <= y_pos < self.size_y ) and ( 0 <= z_pos < self.height) and not self.is_wall(x_pos - 1, y_pos, z_pos): self.array[z_pos][y_pos][x_pos] = ' ' return True else: return False def set_ascent(self, x_pos, y_pos, z_pos): if ( 0 <= x_pos < self.size_x ) ...
code_fim
hard
{ "lang": "python", "repo": "kauppim/python-mazegame", "path": "/src/pyramid_object.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tests:../stack/tests') env.Program('tests', ['src/test_main.c', Glob('../libs/*.a')])<|fim_prefix|># repo: susanna-kaukinen/c_containers path: /tests/SConscript env = Environment(CPPPATH='../include:../<|fim_middle|>debug/include:../vector/include:../vector/
code_fim
easy
{ "lang": "python", "repo": "susanna-kaukinen/c_containers", "path": "/tests/SConscript", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>, ['src/test_main.c', Glob('../libs/*.a')])<|fim_prefix|># repo: susanna-kaukinen/c_containers path: /tests/SConscript env = Environment(CPPPATH='../include:../debug/include:../vector/include:../vector/<|fim_middle|>tests:../stack/tests') env.Program('tests'
code_fim
easy
{ "lang": "python", "repo": "susanna-kaukinen/c_containers", "path": "/tests/SConscript", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: susanna-kaukinen/c_containers path: /tests/SConscript env = Environment(CPPPATH='../include:../debug/include:../vector/include:../vector/<|fim_suffix|>, ['src/test_main.c', Glob('../libs/*.a')])<|fim_middle|>tests:../stack/tests') env.Program('tests'
code_fim
easy
{ "lang": "python", "repo": "susanna-kaukinen/c_containers", "path": "/tests/SConscript", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }