text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> ", result[digit]['name'], result[digit]['market_cap']) digit += 1<|fim_prefix|># repo: nazmurat/assignment1--master path: /src/src.py from pycoingecko import CoinGeckoAPI cg = CoinGeckoAPI() result = cg.get_coins_markets(vs_currency='usd') print(result) num = int(input("<|fim_middle|>Enter number: ...
code_fim
medium
{ "lang": "python", "repo": "nazmurat/assignment1--master", "path": "/src/src.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nazmurat/assignment1--master path: /src/src.py from pycoingecko import CoinGeckoAPI cg = CoinGeckoAPI() result = cg.<|fim_suffix|>Enter number: ")) digit = 0 while digit < num: print(digit+1, " - ", result[digit]['name'], result[digit]['market_cap']) digit += 1<|fim_middle|>get_coins_mark...
code_fim
medium
{ "lang": "python", "repo": "nazmurat/assignment1--master", "path": "/src/src.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> json.dumps([str(self.block), str(self.move), str(self.parent), str(self.f), str(self.g), str(self.h)])<|fim_prefix|># repo: abhilshit/bloxorz path: /app/node.py # Copyright (c) 2020. Abhilshit Soni import json from app.block import Block from app.move import Move class Node: """ An A*...
code_fim
hard
{ "lang": "python", "repo": "abhilshit/bloxorz", "path": "/app/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # placeholders for A* costs only to be used in A* solver self.f = f self.g = g self.h = h self.block = block self.move = move self.parent = parent def __str__(self): json.dumps([str(self.block), str(self.move), str(self.parent), str(self...
code_fim
hard
{ "lang": "python", "repo": "abhilshit/bloxorz", "path": "/app/node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhilshit/bloxorz path: /app/node.py # Copyright (c) 2020. Abhilshit Soni import json from app.block import Block from app.move import Move class Node: """ An A* Node object. Wraps the Block object along with f, g, h values at the node. Maintains reference of parent node """ d...
code_fim
hard
{ "lang": "python", "repo": "abhilshit/bloxorz", "path": "/app/node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> file_read = open(file_list, "r") X_shapes = [] for line in file_read.readlines(): video_id = line.replace('\n', '') mfcc_path = "mfcc/" + video_id + ".mfcc.csv" # Check the availability of the mfcc file if os.path.exists(mfcc_path) is False: contin...
code_fim
medium
{ "lang": "python", "repo": "yongkyung-oh/CMU-Large_Scale_Multimedia_Analysis", "path": "/hw1_code/scripts/create_kmeans.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Save the feature of MFCC np.savetxt("kmeans/" + video_id + ".feature", y_norm.transpose()) file_read.close() X_shapes = np.array(X_shapes) print(sum(X_shapes[:,0])) print(X_shapes[0,1]) print "K-means features generated successfully!"<|fim_prefix|># repo: y...
code_fim
hard
{ "lang": "python", "repo": "yongkyung-oh/CMU-Large_Scale_Multimedia_Analysis", "path": "/hw1_code/scripts/create_kmeans.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yongkyung-oh/CMU-Large_Scale_Multimedia_Analysis path: /hw1_code/scripts/create_kmeans.py #!/bin/python import numpy as np import os from sklearn.cluster.k_means_ import KMeans from sklearn.cluster.k_means_ import MiniBatchKMeans import cPickle import sys # Generate k-means features for videos; ...
code_fim
hard
{ "lang": "python", "repo": "yongkyung-oh/CMU-Large_Scale_Multimedia_Analysis", "path": "/hw1_code/scripts/create_kmeans.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yumere/document-qa path: /docqa/scripts/ablate_hotpotqa.py import argparse from datetime import datetime from typing import Optional from tensorflow.keras.initializers import TruncatedNormal from tqdm import tqdm from docqa import model_dir from docqa import trainer from docqa.data_processing.d...
code_fim
hard
{ "lang": "python", "repo": "yumere/document-qa", "path": "/docqa/scripts/ablate_hotpotqa.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if mode == "paragraph-level": extract = ExtractSingleParagraph(MergeParagraphs(400), TopTfIdf(stop, 1), model.preprocessor, intern=True) elif mode == "shared-norm-600": extract = ExtractMultiParagraphs(MergeParagraphs(600), TopTfIdf(stop, 4), model.preprocessor, intern=True) el...
code_fim
hard
{ "lang": "python", "repo": "yumere/document-qa", "path": "/docqa/scripts/ablate_hotpotqa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>c(num) and num not in my_list: ssum += num my_list.append(num) print ssum<|fim_prefix|># repo: arvganesh/Project-Euler-Log path: /Python/125.py from Euler import is_palindromic import math limit = 10 ** 8 sqrtL = int(math.ceil(limit ** 0.5)<|fim_middle|>) num = 0 ssum = 0 my_list ...
code_fim
medium
{ "lang": "python", "repo": "arvganesh/Project-Euler-Log", "path": "/Python/125.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: arvganesh/Project-Euler-Log path: /Python/125.py from Euler import is_palindromic import math limit = 10 ** 8 sqrtL = int(math.ceil(limit ** 0.5)<|fim_suffix|>e(i + 1, sqrtL + 1): num += x * x if num > limit: break if is_palindromic(num) and num not in my_list: ...
code_fim
medium
{ "lang": "python", "repo": "arvganesh/Project-Euler-Log", "path": "/Python/125.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Paul-Haley/adventofcode_2017 path: /day23/primes.py def isPrime(i): for odd in range(3, i//2, 2): if i % odd == 0: return False return True primes = 0 for<|fim_suffix|>s += 1 #print("we got one!", i) print("primes = ", primes)<|fim_middle|> i in range(106700, ...
code_fim
medium
{ "lang": "python", "repo": "Paul-Haley/adventofcode_2017", "path": "/day23/primes.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> i in range(106700, 123700, 17): if isPrime(i): primes += 1 #print("we got one!", i) print("primes = ", primes)<|fim_prefix|># repo: Paul-Haley/adventofcode_2017 path: /day23/primes.py def isPrime(i): for odd in range(3, i//2, 2): if i % <|fim_middle|>odd == 0: ...
code_fim
medium
{ "lang": "python", "repo": "Paul-Haley/adventofcode_2017", "path": "/day23/primes.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>s += 1 #print("we got one!", i) print("primes = ", primes)<|fim_prefix|># repo: Paul-Haley/adventofcode_2017 path: /day23/primes.py def isPrime(i): for odd in range(3, i//2, 2): if i % <|fim_middle|>odd == 0: return False return True primes = 0 for i in range(106700, ...
code_fim
medium
{ "lang": "python", "repo": "Paul-Haley/adventofcode_2017", "path": "/day23/primes.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>rectoryPatch(join_ou="OU=FakeOU") res = client.patch_active_directory(names=["test-config"], active_directory=ad_config) print(res) if type(res) == pypureclient.responses.ValidResponse: print(list(res.items)) # Other valid fields: ids # See section "Common Fields" for examples<|fim_prefix|># repo: Pu...
code_fim
hard
{ "lang": "python", "repo": "PureStorage-OpenConnect/py-pure-client", "path": "/docs/source/examples/FB2.0/patch_active_directory.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: PureStorage-OpenConnect/py-pure-client path: /docs/source/examples/FB2.0/patch_active_directory.py from pypureclient.flashblade import ActiveDirectoryPatch # Change existing Active Directory account LDAP and kerberos servers, encryption types, and # service principal names. # Can alternatively s...
code_fim
hard
{ "lang": "python", "repo": "PureStorage-OpenConnect/py-pure-client", "path": "/docs/source/examples/FB2.0/patch_active_directory.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ''' Parametrize- Way to run a test with different parameters ''' @pytest.mark.parametrize('num1, num2, expected', [(1, 2, 3), (3, -1, 2)]) def test_sum(num1, num2, expected): # arrange arithmetic = Arithmetic() # act target = arithmetic.sum(num1, num2) #assert assert ta...
code_fim
easy
{ "lang": "python", "repo": "zoldello/pytest-unit-test-skillz-lab", "path": "/test_03-parameterize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zoldello/pytest-unit-test-skillz-lab path: /test_03-parameterize.py import pytest ''' System Under Test (SUT) ''' class Arithmetic: def sum(self, a, b): return a + b <|fim_suffix|> # arrange arithmetic = Arithmetic() # act target = arithmetic.sum(num1, num2)...
code_fim
medium
{ "lang": "python", "repo": "zoldello/pytest-unit-test-skillz-lab", "path": "/test_03-parameterize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # act target = arithmetic.sum(num1, num2) #assert assert target == expected<|fim_prefix|># repo: zoldello/pytest-unit-test-skillz-lab path: /test_03-parameterize.py import pytest ''' System Under Test (SUT) ''' class Arithmetic: def sum(self, a, b): <|fim_middle|> return...
code_fim
hard
{ "lang": "python", "repo": "zoldello/pytest-unit-test-skillz-lab", "path": "/test_03-parameterize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.get("/hello") async def hello(name: NameEnum = Query(NameEnum.empty, alias="first_name")): return "hello " + name.value animals_dict = {"ANT": "walk", "BEE": "flies", "CAT": "meows", "DOG": "barks"} Animal = Enum("Animal", {k: k for k in animals_dict}) @app.get("/animal") async def animal(an...
code_fim
medium
{ "lang": "python", "repo": "garry-jeromson/fastapi_experiments", "path": "/experiments/enumerate_params.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.get("/animal") async def animal(anim: Optional[Animal] = Query(None)): if anim is not None: return anim.name else: return "not found" if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=8000)<|fim_prefix|># repo: garry-jeromson/fastapi_experiments path: /e...
code_fim
medium
{ "lang": "python", "repo": "garry-jeromson/fastapi_experiments", "path": "/experiments/enumerate_params.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: garry-jeromson/fastapi_experiments path: /experiments/enumerate_params.py from enum import Enum from typing import Optional import uvicorn from fastapi import FastAPI, Query app = FastAPI() class NameEnum(str, Enum): empty = "" bob = "bob" doug = "doug" @app.get("/hello") async...
code_fim
hard
{ "lang": "python", "repo": "garry-jeromson/fastapi_experiments", "path": "/experiments/enumerate_params.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hiphoox/monitor path: /monitor/domain.py import os, time, logging from monitor.models import * from monitor.snmp.snmp import * import logging.handlers import subprocess LOG_FILENAME = 'log.out' # Set up a specific logger with our desired output level logger = logging.getLogger('MyLogger') logger...
code_fim
hard
{ "lang": "python", "repo": "hiphoox/monitor", "path": "/monitor/domain.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def check_switch_states(self): for switch in self.switchs: if switch.identifier in self.switchs_to_monitor: if (switch.enabled): current_statuses = port_status_for_community_in_switch(switch.protocol_version, switch.community, switch.ip_address, switch.user_name, switch.passw...
code_fim
hard
{ "lang": "python", "repo": "hiphoox/monitor", "path": "/monitor/domain.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: et4te/bitjws path: /example/flask_server_example.py # Install requirements: pip install flask flask-login import flask from flask.ext import login import bitjws # Server key used to sign responses. The client can optionally # check that the response was signed by a key it knows to belong # to th...
code_fim
hard
{ "lang": "python", "repo": "et4te/bitjws", "path": "/example/flask_server_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> msg = flask.g.payload.get('echo', '') address = login.current_user.id response = bitjws.sign_serialize(privkey, address=address, echo=msg) return response # Start a http server. app.run(port=8001)<|fim_prefix|># repo: et4te/bitjws path: /example/flask_server_example.py # Install requirem...
code_fim
hard
{ "lang": "python", "repo": "et4te/bitjws", "path": "/example/flask_server_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c_matrix = confusion_matrix(labels, predicted) plt.figure() plt.style.use('ggplot') plt.rc('xtick', labelsize=10) plt.rc('ytick', labelsize=10) plt.rc('axes', labelsize=10) plt.imshow(c_matrix) plt.colorbar() plt.xlabel('Predicted') plt.ylabel('True') plt.savefi...
code_fim
easy
{ "lang": "python", "repo": "eeishaan/ift6759-block1", "path": "/omsignal/utils/vis.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eeishaan/ift6759-block1 path: /omsignal/utils/vis.py #!/usr/bin/env python3 import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix <|fim_suffix|> c_matrix = confusion_matrix(labels, predicted) plt.figure() plt.style.use('ggplot') plt.rc('xtick', labelsize=10...
code_fim
easy
{ "lang": "python", "repo": "eeishaan/ift6759-block1", "path": "/omsignal/utils/vis.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> SPINNER.stop() result = click.confirm(msg) SPINNER.start() return result def echo(msg, *args, **kwargs): click.echo(msg, *args, **kwargs) def prompt(msg, *args, **kwargs): SPINNER.stop() result = click.prompt(msg, *args, **kwargs) SPINNER.start() return result<|fim_...
code_fim
easy
{ "lang": "python", "repo": "Matapii/wallabag-client", "path": "/src/wallabag/wclick.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Matapii/wallabag-client path: /src/wallabag/wclick.py # -*- coding: utf-8 -*- import click import click_spinner SPINNER = click_spinner.spinner() def spinner(): return SPINNER def stop_spinner(): SPINNER.stop() def confirm(msg): SPINNER.stop() result = click.confirm(msg) ...
code_fim
medium
{ "lang": "python", "repo": "Matapii/wallabag-client", "path": "/src/wallabag/wclick.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>folder = MIDDLE_DIR ext = '.jpg' standardLandmarks = getStandardFace(FRONT_FACE_STANDARD, detector, shapePredict) if (not os.path.exists(DEST_DIR)): os.mkdir(DEST_DIR) counter = 0 folderList = os.listdir(folder) for subFolder in folderList: if os.path.exists(os.path.join(DEST_DIR, subFolder)): ...
code_fim
hard
{ "lang": "python", "repo": "corganhejijun/frontal-face-trans", "path": "/prepare_train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: corganhejijun/frontal-face-trans path: /prepare_train.py # -*- coding: utf-8 -*- from src.file_oper import copy_celeba import dlib import os import numpy as np import cv2 from shutil import copyfile from src.face_landmark import getFaceDis, getStandardFace from src.util import getBound CELEBA...
code_fim
hard
{ "lang": "python", "repo": "corganhejijun/frontal-face-trans", "path": "/prepare_train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hor_sums = [sum(x) for x in self.board] vert_sums = [] for x in range(self.n): ss = 0 for y in range(self.n): ss += self.board[y][x] vert_sums.append(ss) winning = 0 for hor in hor_sums: for ver in vert...
code_fim
medium
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/157A/cdf_157A.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": Solution = CodeforcesTask157ASolution() Solution.read_input() Solution.process_task() print(Solution.get_result())<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/157A/cdf_157A.py class CodeforcesTask157ASolution: def __init__(self): ...
code_fim
hard
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/157A/cdf_157A.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kopok2/CodeforcesSolutionsPython path: /src/157A/cdf_157A.py class CodeforcesTask157ASolution: def __init__(self): self.result = '' self.n = 0 self.board = [] <|fim_suffix|> def process_task(self): hor_sums = [sum(x) for x in self.board] vert_sums =...
code_fim
medium
{ "lang": "python", "repo": "kopok2/CodeforcesSolutionsPython", "path": "/src/157A/cdf_157A.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setupUI2(self): self.setupUI1() tk.Button(self.root,text="生成凭证",command=GenNote,width=10).grid(row=1,column=1,sticky="e") if __name__=="__main__": root=tk.Tk() root.title('iAccountingTool.0.1.1') APP1=APP_class(root) root.mainloop()<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "JulianGong/littleAccountingTools", "path": "/ELN_GUI2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JulianGong/littleAccountingTools path: /ELN_GUI2.py # -*- coding: utf-8 -*- """ Created on Tue Nov 14 16:09:22 2017 @author: 028375 """ from __future__ import unicode_literals, division try: import tkinter as tk import tkinter.messagebox as msbox except ImportError: import Tkinter a...
code_fim
hard
{ "lang": "python", "repo": "JulianGong/littleAccountingTools", "path": "/ELN_GUI2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.dryrun: log("Would have run %s" % args) return # Set logging level to avoid rietveld's logging spew. old_level_name = logging.getLogger().getEffectiveLevel() logging.getLogger().setLevel(logging.ERROR) # Use RealMain instead of call...
code_fim
hard
{ "lang": "python", "repo": "FMSoftCN/mdolphin-core", "path": "/Tools/Tools/Scripts/webkitpy/common/net/rietveld.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: FMSoftCN/mdolphin-core path: /Tools/Tools/Scripts/webkitpy/common/net/rietveld.py # Copyright (c) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * ...
code_fim
hard
{ "lang": "python", "repo": "FMSoftCN/mdolphin-core", "path": "/Tools/Tools/Scripts/webkitpy/common/net/rietveld.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SmileyJoe/tic_tac_toe_terminal path: /main.py from board import Board import curses # initiate the curses lib so that we can work with the text on the screen properly screen = curses.initscr() curses.cbreak() # everything is wrapped in a try so that we can reset the state of the terminal # if t...
code_fim
hard
{ "lang": "python", "repo": "SmileyJoe/tic_tac_toe_terminal", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # add the board to the screen screen.addstr(board.get_board()) if player == Board.PLAYER_X: play_message = "Player X move: " else: play_message = "Player O move: " # add the instructions to the screen ...
code_fim
hard
{ "lang": "python", "repo": "SmileyJoe/tic_tac_toe_terminal", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ALPHA1 + BETA2 = K1 * W2 CA11 = amcl.mpc.mpc_mta_client1(rng, paillier_pk1, K1) CB12, BETA2 = amcl.mpc.mpc_mta_server(rng, paillier_pk1, W2, CA11) ALPHA1 = amcl.mpc.mpc_mta_client2(paillier_sk1, CB12) # ALPHA2 + BETA1 = K2 * W1 CA22 = amcl.mpc.mpc_mta_client1(rng, paillier_pk2, ...
code_fim
hard
{ "lang": "python", "repo": "isabella232/incubator-milagro-MPC", "path": "/python/examples/example_ecdsa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Calculate the inverse of kgamma INVKGAMMA = amcl.mpc.mpc_invkgamma(SUM1, SUM2) # Calculate the R signature component rc, SIG_R, _ = amcl.mpc.mpc_r(INVKGAMMA, GAMMAPT1, GAMMAPT2) # ALPHA1 + BETA2 = K1 * W2 CA11 = amcl.mpc.mpc_mta_client1(rng, paillier_pk1, K1) CB12, BETA2 = ...
code_fim
hard
{ "lang": "python", "repo": "isabella232/incubator-milagro-MPC", "path": "/python/examples/example_ecdsa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: isabella232/incubator-milagro-MPC path: /python/examples/example_ecdsa.py #!/usr/bin/env python3 """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright o...
code_fim
hard
{ "lang": "python", "repo": "isabella232/incubator-milagro-MPC", "path": "/python/examples/example_ecdsa.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name self.desired = treat_null(desired) self.current = treat_null(current) self.ready = treat_null(ready) self.age = treat_null(age) self.containers = treat_null(containers) self.images = treat_null(images) self.selector = treat_n...
code_fim
medium
{ "lang": "python", "repo": "marcosstefani/kubewatch", "path": "/kubewatch/model/replica_set.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcosstefani/kubewatch path: /kubewatch/model/replica_set.py from model.model import Model from service.util import treat_null <|fim_suffix|> def __init__(self, name, desired, current, ready, age, containers, images, selector): self.name = name self.desired = treat_null(desir...
code_fim
medium
{ "lang": "python", "repo": "marcosstefani/kubewatch", "path": "/kubewatch/model/replica_set.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if user == 1: elem = "O" elif user == 2: elem = "X" count = 0 #column win condition for i in range(1,4): if 0<index[0]+i<=5 and table[index[0]+i][index[1]] == elem: count += 1 if count == 3: ...
code_fim
hard
{ "lang": "python", "repo": "s1mpleTEK/Connect4.py", "path": "/src/lib/verification_function.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: s1mpleTEK/Connect4.py path: /src/lib/verification_function.py class Verification: @classmethod def verification_table(cls,input, table): for i in range(5, -1, -1): if table[i][input-1] == " ": index = [i, input-1] return(index) p...
code_fim
hard
{ "lang": "python", "repo": "s1mpleTEK/Connect4.py", "path": "/src/lib/verification_function.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #column win condition for i in range(1,4): if 0<index[0]+i<=5 and table[index[0]+i][index[1]] == elem: count += 1 if count == 3: return(1) else: count = 0 break #line win con...
code_fim
hard
{ "lang": "python", "repo": "s1mpleTEK/Connect4.py", "path": "/src/lib/verification_function.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _assign_datetimes(self): for datetime_attr in self.DATETIMES: raw_dt = self._data[datetime_attr]['dateTime'] setattr(self, datetime_attr, arrow.get(raw_dt)) @property def attendees(self): return self._attendees @attendees.setter def attende...
code_fim
hard
{ "lang": "python", "repo": "kevinlondon/meetingbot", "path": "/meetingbot/gcal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def starts_within(self, minutes): time_window = datetime.timedelta(minutes=5) time_until = self.start - arrow.utcnow() if time_until < datetime.timedelta(seconds=0): return False return time_until < time_window @property def should_notify(self): ...
code_fim
hard
{ "lang": "python", "repo": "kevinlondon/meetingbot", "path": "/meetingbot/gcal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinlondon/meetingbot path: /meetingbot/gcal.py import os import datetime from operator import attrgetter from collections import deque from pubsub import pub from hypchat import HypChat from . import settings, lights from .meetings import GoToMeeting from .utils import memoize import arrow ...
code_fim
hard
{ "lang": "python", "repo": "kevinlondon/meetingbot", "path": "/meetingbot/gcal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lightning-AI/torchmetrics path: /tests/unittests/classification/test_hamming_distance.py ignore_index == -1: target = inject_ignore_index(target, ignore_index) if multidim_average == "samplewise" and preds.ndim < 3: pytest.skip("samplewise and non-multidim arrays a...
code_fim
hard
{ "lang": "python", "repo": "Lightning-AI/torchmetrics", "path": "/tests/unittests/classification/test_hamming_distance.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.run_class_metric_test( ddp=ddp, preds=preds, target=target, metric_class=MulticlassHammingDistance, reference_metric=partial( _sklearn_hamming_distance_multiclass, ignore_index=ignore_index, ...
code_fim
hard
{ "lang": "python", "repo": "Lightning-AI/torchmetrics", "path": "/tests/unittests/classification/test_hamming_distance.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lightning-AI/torchmetrics path: /tests/unittests/classification/test_hamming_distance.py metric_module=BinaryHammingDistance, metric_functional=binary_hamming_distance, metric_args={"threshold": THRESHOLD}, ) @pytest.mark.parametrize("dtype", [torch....
code_fim
hard
{ "lang": "python", "repo": "Lightning-AI/torchmetrics", "path": "/tests/unittests/classification/test_hamming_distance.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jimmy-INL/google-research path: /dreamfields/experiments/diffusion_3d/glide.py # coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/dreamfields/experiments/diffusion_3d/glide.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> batch, channels = x.shape[:2] assert t.shape == (batch,) model_output = model(x, t, **model_kwargs) if isinstance(model_output, tuple): model_output, extra = model_output else: extra = None assert model_output.shape == (batch, channels * 2, *x.shape[2:]) model_output, model_var_valu...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/dreamfields/experiments/diffusion_3d/glide.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: django-oscar/django-oscar path: /tests/integration/offer/test_manager.py import datetime from django.test import TestCase from django.utils import timezone from oscar.apps.offer import models from oscar.test import factories class TestActiveOfferManager(TestCase): def test_includes_offers...
code_fim
hard
{ "lang": "python", "repo": "django-oscar/django-oscar", "path": "/tests/integration/offer/test_manager.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_includes_offers_with_null_start_date(self): now = timezone.now() end = now + datetime.timedelta(days=1) factories.create_offer(start=None, end=end) filtered_offers = models.ConditionalOffer.active.all() self.assertEqual(1, len(filtered_offers)) def...
code_fim
medium
{ "lang": "python", "repo": "django-oscar/django-oscar", "path": "/tests/integration/offer/test_manager.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_filters_out_suspended_offers(self): # Create offer that is available but with the wrong status factories.create_offer(status=models.ConditionalOffer.SUSPENDED) filtered_offers = models.ConditionalOffer.active.all() self.assertEqual(0, len(filtered_offers))<|fim...
code_fim
medium
{ "lang": "python", "repo": "django-oscar/django-oscar", "path": "/tests/integration/offer/test_manager.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TankerHQ/sdk-native path: /test_package/conanfile.py from conans import ConanFile, tools from conan.tools.cmake import CMake from conan.tools.layout import cmake_layout import os class TankerNativeTestPackage(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CM...
code_fim
hard
{ "lang": "python", "repo": "TankerHQ/sdk-native", "path": "/test_package/conanfile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.copy("*.dll", dst="bin", src="bin") self.copy("*.dylib", dst="bin", src="lib") self.copy("*.so.*", dst="bin", src="lib") self.copy("*.so", dst="bin", src="lib") def test(self): if not tools.cross_building(self): self.run(os.path.join(self.cpp.b...
code_fim
medium
{ "lang": "python", "repo": "TankerHQ/sdk-native", "path": "/test_package/conanfile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ManikHossain08/Metrics-Extraction-from-GitHub-MSR_Python path: /DevNetworkPython/configuration.py class Configuration: def __init__(self, repositoryUrl: str, repositoryPath: str, repositoryShortname: str, analysisOutputPath: str, aliasPath:str, aliasSimilarityMaxDistance: float): se...
code_fim
medium
{ "lang": "python", "repo": "ManikHossain08/Metrics-Extraction-from-GitHub-MSR_Python", "path": "/DevNetworkPython/configuration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>analysisOutputPath self.aliasPath = aliasPath self.aliasSimilarityMaxDistance = aliasSimilarityMaxDistance<|fim_prefix|># repo: ManikHossain08/Metrics-Extraction-from-GitHub-MSR_Python path: /DevNetworkPython/configuration.py class Configuration: def __init__(self, repositoryUrl: s...
code_fim
hard
{ "lang": "python", "repo": "ManikHossain08/Metrics-Extraction-from-GitHub-MSR_Python", "path": "/DevNetworkPython/configuration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pikotrek/django_easy_tags path: /books/filters.py from rest_framework.filters import BaseFilterBackend class TolkienBooksFilter(BaseFilterBackend): <|fim_suffix|> return queryset.filter(author__last_name='Tolkien')<|fim_middle|> def filter_queryset(self, request, queryset, view):
code_fim
easy
{ "lang": "python", "repo": "pikotrek/django_easy_tags", "path": "/books/filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def filter_queryset(self, request, queryset, view): return queryset.filter(author__last_name='Tolkien')<|fim_prefix|># repo: pikotrek/django_easy_tags path: /books/filters.py from rest_framework.filters import BaseFilterBackend <|fim_middle|>class TolkienBooksFilter(BaseFilterBackend):
code_fim
easy
{ "lang": "python", "repo": "pikotrek/django_easy_tags", "path": "/books/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return queryset.filter(author__last_name='Tolkien')<|fim_prefix|># repo: pikotrek/django_easy_tags path: /books/filters.py from rest_framework.filters import BaseFilterBackend <|fim_middle|>class TolkienBooksFilter(BaseFilterBackend): def filter_queryset(self, request, queryset, view):
code_fim
medium
{ "lang": "python", "repo": "pikotrek/django_easy_tags", "path": "/books/filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: affinitic/Products.BeakerSessionDataManager path: /Products/BeakerSessionDataManager/__init__.py def initialize(context): from Products.BeakerSessionDataManager.sessiondata import BeakerSessionDataManager from Produ<|fim_suffix|>Manager.sessiondata import ( addBeakerSessionDataMa...
code_fim
medium
{ "lang": "python", "repo": "affinitic/Products.BeakerSessionDataManager", "path": "/Products/BeakerSessionDataManager/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>aManager, constructors=(addBeakerSessionDataManagerForm, addBeakerSessionDataManager), icon="www/sdm.gif", )<|fim_prefix|># repo: affinitic/Products.BeakerSessionDataManager path: /Products/BeakerSessionDataManager/__init__.py def initialize(context): from Products.BeakerSessionD...
code_fim
medium
{ "lang": "python", "repo": "affinitic/Products.BeakerSessionDataManager", "path": "/Products/BeakerSessionDataManager/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws/serverless-application-model path: /tests/bin/test_public_interface.py from unittest import TestCase from bin.public_interface import _BreakingChanges, _detect_breaking_changes class TestDetectBreakingChanges(TestCase): def test_missing_variables(self): self.assertEqual( ...
code_fim
hard
{ "lang": "python", "repo": "aws/serverless-application-model", "path": "/tests/bin/test_public_interface.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_routines_still_compatible_when_converting_from_method_to_staticmethod(self): self.assertEqual( _detect_breaking_changes( { "samtranslator.model.do_something": [ {"kind": "POSITIONAL_OR_KEYWORD", "name": "self"}, ...
code_fim
hard
{ "lang": "python", "repo": "aws/serverless-application-model", "path": "/tests/bin/test_public_interface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.dbg: print display(self.w, self.h, self.repr()) def validp(self, pos): x, y = pos return x >= 0 and x < self.w and y >= 0 and y < self.h and not self.get(x, y) def validp2(self, pos): x, y = pos if y < 0: return True return x >=...
code_fim
hard
{ "lang": "python", "repo": "pbl64k/icfpc2015", "path": "/board.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #def merge(self, pc): # tp = self.tot_parts # self.merge_score = 0 # crds = set(pc.coords()) # ns = set() # for pos in pc.coords(): # x, y = pos # #assert not self.get(x, y) # for nspos in ns_hextris(pos): # if nspos no...
code_fim
hard
{ "lang": "python", "repo": "pbl64k/icfpc2015", "path": "/board.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pbl64k/icfpc2015 path: /board.py import utils from ui import * ns_all = utils.ns ns_hextris = utils.ns_hextris class Board(object): def __init__(self, w, h, f, dbg = True): self.w = w self.h = h #size = w * h ##self.medium = size > 128 #self.large = ...
code_fim
hard
{ "lang": "python", "repo": "pbl64k/icfpc2015", "path": "/board.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: enen92/script.tubecast path: /resources/lib/tubecast/youtube/templates.py # -*- coding: utf-8 -*- class YoutubeTemplates: @property def not_connected(self): return '''<service xmlns="urn:dial-multiscreen-org:schemas:dial"> <name>YouTube</name> ...
code_fim
hard
{ "lang": "python", "repo": "enen92/script.tubecast", "path": "/resources/lib/tubecast/youtube/templates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def announcement(screen_uid, default_screen_name, default_screen_app): return {"device": "LOUNGE_SCREEN", "id": screen_uid, "name": default_screen_name, "app": default_screen_app, "theme": "cl", "...
code_fim
hard
{ "lang": "python", "repo": "enen92/script.tubecast", "path": "/resources/lib/tubecast/youtube/templates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># 최근 한 주 요일별 총 doc 수 그래프 fig_oneweek = px.bar(weekday_df(select_OneWeek(df)), x='day_of_week', y= 'title', barmode='group') fig_oneweek.update_xaxes( title_text='요일') fig_oneweek.update_yaxes(title_text='전체 문서 개수') layout = html.Div([ html.Div([ html.Div([ html.H3('전체 문서 개수'), ...
code_fim
hard
{ "lang": "python", "repo": "yerachoi/prepo-flask-gentelella", "path": "/Dashboard/user_weekdaydoc_app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yerachoi/prepo-flask-gentelella path: /Dashboard/user_weekdaydoc_app.py import dash import dash_core_components as dcc from jupyter_dash import JupyterDash import dash_html_components as html from .Dash_fun import apply_layout_with_auth, load_object, save_object from dash.dependencies import Inpu...
code_fim
hard
{ "lang": "python", "repo": "yerachoi/prepo-flask-gentelella", "path": "/Dashboard/user_weekdaydoc_app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> week_prior = today - timedelta(weeks=1) last_week_df = data[week_prior <= data['clip_at']] return last_week_df # dataframe을 요일별화 시킴 def weekday_df(data): # 요일 칼럼 생성 weekday = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] data['day_of_week'] = data['clip_at'...
code_fim
hard
{ "lang": "python", "repo": "yerachoi/prepo-flask-gentelella", "path": "/Dashboard/user_weekdaydoc_app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ex = Exterior( phi=np.pi, omega=np.pi, kappa=np.pi, dm=[[-1, 0, 0], [0, -1, 0], [0, 0, 1]] ) # Rotate the matrix using the rotation_matrix function ex_rotated = rotation_matrix(ex) assert np.allclose(ex_rotated.dm, np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])) def test_manual_...
code_fim
hard
{ "lang": "python", "repo": "OpenPTV/openptv-python", "path": "/tests/test_rotation_matrix.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Test when all angles are pi/2 exterior.phi = np.pi / 2 exterior.omega = np.pi / 2 exterior.kappa = np.pi / 2 result = rotation_matrix(exterior) print(result.dm) assert np.allclose(result.dm, np.array([[0, 0, 1], [0, -1, 0], [1, 0, 0]])) def test_rotation_matrix_pi(exterior)...
code_fim
hard
{ "lang": "python", "repo": "OpenPTV/openptv-python", "path": "/tests/test_rotation_matrix.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenPTV/openptv-python path: /tests/test_rotation_matrix.py import numpy as np import pytest from openptv_python.calibration import Exterior, rotation_matrix # Define some test fixtures @pytest.fixture def exterior(): return Exterior( phi=0, omega=0, kappa=0, dm=np.array([[1, 0, 0]...
code_fim
hard
{ "lang": "python", "repo": "OpenPTV/openptv-python", "path": "/tests/test_rotation_matrix.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def backwards(self, orm): # Adding field 'ShiftRequest.fraction_green' db.add_column(u'watttime_shift_shiftrequest', 'fraction_green', self.gf('django.db.models.fields.FloatField')(default=0), keep_default=False) # Deleting field 'Sh...
code_fim
hard
{ "lang": "python", "repo": "Gavin-McCormick/watttime", "path": "/watttime_shift/migrations/0002_auto__del_field_shiftrequest_fraction_green__add_field_shiftrequest_re.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gavin-McCormick/watttime path: /watttime_shift/migrations/0002_auto__del_field_shiftrequest_fraction_green__add_field_shiftrequest_re.py # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigrat...
code_fim
hard
{ "lang": "python", "repo": "Gavin-McCormick/watttime", "path": "/watttime_shift/migrations/0002_auto__del_field_shiftrequest_fraction_green__add_field_shiftrequest_re.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Deleting field 'ShiftRequest.recommended_fraction_green' db.delete_column(u'watttime_shift_shiftrequest', 'recommended_fraction_green') models = { u'watttime_shift.shiftrequest': { 'Meta': {'object_name': 'ShiftRequest'}, 'ba': ('django.db.models.fie...
code_fim
hard
{ "lang": "python", "repo": "Gavin-McCormick/watttime", "path": "/watttime_shift/migrations/0002_auto__del_field_shiftrequest_fraction_green__add_field_shiftrequest_re.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> response = requests.post("http://localhost:8080/invocations", data=json.dumps(data), headers={'Content-type': 'application/json', 'Accept': 'application/json'}) serialized_ou...
code_fim
hard
{ "lang": "python", "repo": "just4jc/sagemaker-tensorflow-containers", "path": "/test/integ/container_tests/wide_deep_prediction.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: just4jc/sagemaker-tensorflow-containers path: /test/integ/container_tests/wide_deep_prediction.py # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance wit...
code_fim
medium
{ "lang": "python", "repo": "just4jc/sagemaker-tensorflow-containers", "path": "/test/integ/container_tests/wide_deep_prediction.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_json_request(): data = {'age': 42., 'workclass': 'Private', 'education': 'Doctorate', 'education_num': 16., 'marital_status': 'Married-civ-spouse', 'occupation': 'Prof-specialty', 'relationship': 'Husband', 'capital_gain': 0., 'capital_loss': 0., 'hou...
code_fim
medium
{ "lang": "python", "repo": "just4jc/sagemaker-tensorflow-containers", "path": "/test/integ/container_tests/wide_deep_prediction.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Taemin0707/minibot_control path: /shared_control/src/simple.py #!/usr/bin/env python #-*-coding: utf-8-*- import interface import rospy import pygame import copy import os import math from sys import stdout from std_msgs.msg import Int32, Header, Int32MultiArray, Float32, Time from visualizati...
code_fim
hard
{ "lang": "python", "repo": "Taemin0707/minibot_control", "path": "/shared_control/src/simple.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 발행 설정 rospy.wait_for_service('interf/nav2cmd') self.publisher_cmd_vel = rospy.Publisher('cmd_vel', Twist, queue_size=1) self.publisher_robot_motion = rospy.Publisher('interf/robot/motion', RobotMotion, queue_size=1) self.publisher_nav_cue = rospy.Publisher('interf...
code_fim
hard
{ "lang": "python", "repo": "Taemin0707/minibot_control", "path": "/shared_control/src/simple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('\r휴면') self.publisher_simple.publish(header=self.get_header(), motion=1) now = rospy.get_time() while self.time_cmd < now: rospy.sleep(rospy.Duration(0.2)) print('\r화살표') self.publisher_simple.publish( header=self.get_header(), motion=2) ...
code_fim
hard
{ "lang": "python", "repo": "Taemin0707/minibot_control", "path": "/shared_control/src/simple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> verbosity = options.get("verbosity", 0) if verbosity > 0: log_level = logging.DEBUG if verbosity > 1 else logging.INFO loggers = [logging.getLogger(), logging.getLogger("chronam")] for logger in loggers: logger.setLevel(log_level) ...
code_fim
hard
{ "lang": "python", "repo": "LibraryOfCongress/chronam", "path": "/core/management/commands/__init__.py", "mode": "spm", "license": "LicenseRef-scancode-public-domain-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: LibraryOfCongress/chronam path: /core/management/commands/__init__.py from __future__ import absolute_import import logging from django.core.management.base import BaseCommand <|fim_suffix|> verbosity = options.get("verbosity", 0) if verbosity > 0: log_level = logg...
code_fim
hard
{ "lang": "python", "repo": "LibraryOfCongress/chronam", "path": "/core/management/commands/__init__.py", "mode": "psm", "license": "LicenseRef-scancode-public-domain-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: LadyMiss88/recommendation-engine-using-social-graph path: /code/bot/utils/lookup_food.py import sqlite3 from nltk.corpus import wordnet as wn # Set the file paths db_path ='D:/Workspace-Github/saproject/data/foursquare.db' <|fim_suffix|>query_str = 'INSERT INTO venues_food VALUES ' + ', '.join(...
code_fim
hard
{ "lang": "python", "repo": "LadyMiss88/recommendation-engine-using-social-graph", "path": "/code/bot/utils/lookup_food.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>records = [] food_venue = open('D:/Workspace-Github/saproject/code/bot/jiakbot/corpus/knowledge/food_venue.txt', 'w', encoding = 'utf-8') for rid, tip in results: for food in food_list: if food in tip.lower(): food_venue.write('%s\t%s\n' % (food, rid)) records.append(st...
code_fim
hard
{ "lang": "python", "repo": "LadyMiss88/recommendation-engine-using-social-graph", "path": "/code/bot/utils/lookup_food.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adulting-dev/adulting.dev path: /app.py from flask import Flask, render_template from flaskext.markdown import Markdown import contentful from rich_text_renderer import RichTextRenderer from rich_text_renderer.base_node_renderer import BaseNodeRenderer from rich_text_renderer.null_renderer import...
code_fim
hard
{ "lang": "python", "repo": "adulting-dev/adulting.dev", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>BaseBlockEntryRenderer.__RENDERERS__ += [ locationBlockEntryRenderer, buttonEntryRenderer, ] renderer = RichTextRenderer( { "embedded-entry-block": BaseBlockEntryRenderer, "embedded-entry-inline": BaseInlineRenderer, } ) app = Flask(__name__) Markdown(app) @app.route("/...
code_fim
hard
{ "lang": "python", "repo": "adulting-dev/adulting.dev", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route("/") def home_page(): entry = client.entry("1l3EHYzPbgf9UUV0oEyTDs") return render_template( "home.html", renderer=renderer, title=entry.page_title, page_components=entry.page_component, client=client, MAP_KEY=MAP_KEY, ) if __name__...
code_fim
hard
{ "lang": "python", "repo": "adulting-dev/adulting.dev", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if table == None or title == None or start == None: raise TypeError self.table = table self.filter = filter self.title = title self.start = start # This is a helper function that is designed to get the string equvalent of a field # to be used ...
code_fim
hard
{ "lang": "python", "repo": "kheiss/ece517_Project2_SA22", "path": "/modules/timeline/event.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }