text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>def init_env_for_test():
global _environment # pylint: disable=global-statement
_environment = {
'hostName': 'test',
'userName': 'test'
}
def init_environment(denoise_result, ui):
u_name = os.uname()
result = {
'userName': getpass.getuser(),
'manualRu... | code_fim | hard | {
"lang": "python",
"repo": "smarr/ReBench",
"path": "/rebench/environment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smarr/ReBench path: /rebench/environment.py
import getpass
import os
import subprocess
from urllib.parse import urlparse
from cpuinfo.cpuinfo import _get_cpu_info_internal
from psutil import virtual_memory
from .subprocess_with_timeout import output_as_str
def _encode_str(out):
as_string ... | code_fim | hard | {
"lang": "python",
"repo": "smarr/ReBench",
"path": "/rebench/environment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_get_clients_succeeds_with_non_existent_client_id_in_params(
client, request_headers
):
"""
Tests that response is okay when client id exists.
Args:
client (FlaskClient): a test client created by a fixture.
request_headers (dict): a header created by a fixture.
... | code_fim | hard | {
"lang": "python",
"repo": "appcypher/requests",
"path": "/tests/views/test_client_endpoints.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: appcypher/requests path: /tests/views/test_client_endpoints.py
from urls import clients_url
def test_get_clients_succeeds_with_valid_client_id_in_params(
valid_client_model, client, request_headers
):
"""
Tests that response is okay when client id exists.
Args:
valid_cl... | code_fim | hard | {
"lang": "python",
"repo": "appcypher/requests",
"path": "/tests/views/test_client_endpoints.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create a list of the documents only, returned by the model. Remove the vector values
modelReturnedDocumentList = []
for i in range(0, len(word2vec_model_output)):
modelReturnedDocumentList.append(str(word2vec_model_output[i][0]))
# print vI, ",",
... | code_fim | hard | {
"lang": "python",
"repo": "TeamTitanz/ML_Paper_Implementation",
"path": "/neural_network_recall_calculate.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TeamTitanz/ML_Paper_Implementation path: /neural_network_recall_calculate.py
import numpy as np
import pandas as pd
import pickle as p
from matplotlib import pyplot as plt
from sklearn.neural_network import MLPClassifier
from sklearn.neural_network import MLPRegressor
from sklearn.model_selection... | code_fim | hard | {
"lang": "python",
"repo": "TeamTitanz/ML_Paper_Implementation",
"path": "/neural_network_recall_calculate.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.system("git clone --depth 1 https://github.com/lambci/yumda")
os.system("gm convert ./yumda/examples/sam_squirrel.jpg -negate -contrast -resize 100x100 thumbnail.jpg")
# Normally we'd perhaps upload to S3, etc... but here we just convert to ASCII:
os.system("jp2a --width=69 thumb... | code_fim | easy | {
"lang": "python",
"repo": "ErickWendel/yumda",
"path": "/examples/python3.7/hello_world/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ErickWendel/yumda path: /examples/python3.7/hello_world/app.py
import os
def lambda_handler(event, context):
os.chdir("/tmp")
<|fim_suffix|> os.system("gm convert ./yumda/examples/sam_squirrel.jpg -negate -contrast -resize 100x100 thumbnail.jpg")
# Normally we'd perhaps upload t... | code_fim | medium | {
"lang": "python",
"repo": "ErickWendel/yumda",
"path": "/examples/python3.7/hello_world/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class Input(Pin):
def __init__(self, node, name, action):
super().__init__(node, name)
self.action = action
def add_wire(self, wire):
super().add_wire(wire)
wire.output.observable.subscribe(self.action)
class Output(Pin):
def __init__(self, node,... | code_fim | medium | {
"lang": "python",
"repo": "KangWeon/arcade-imgui",
"path": "/imflo/imflo/pin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KangWeon/arcade-imgui path: /imflo/imflo/pin.py
class Pin:
def __init__(self, node, name):
self.node = node
self.name = name
self.wires = []
self.x = 0
self.y = 0
def add_wire(self, wire):
self.wires.append(wire)
<|fim_suffix|> def get_... | code_fim | medium | {
"lang": "python",
"repo": "KangWeon/arcade-imgui",
"path": "/imflo/imflo/pin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simrit1/fractals-1 path: /setup.py
import turtle
def setup(speed=0, start_position=(), color='', hideturtle=False):
if hideturtle:
turtle.hideturtle()
<|fim_suffix|> if color:
turtle.color(color)<|fim_middle|> if speed:
turtle.speed(speed)
if... | code_fim | hard | {
"lang": "python",
"repo": "simrit1/fractals-1",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if start_position:
turtle.penup()
turtle.goto(start_position[0] - 300, start_position[1] + 300) # not accurate
turtle.pendown()
if color:
turtle.color(color)<|fim_prefix|># repo: simrit1/fractals-1 path: /setup.py
import turtle
def setup(speed=0, start... | code_fim | medium | {
"lang": "python",
"repo": "simrit1/fractals-1",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: djpetti/rpinets path: /common/data_manager/data_augmentation.py
import numpy as np
def extract_patches(image, patch_shape, flip=True):
""" Extract patches from the image. It extracts ten such patches:
Top left, top right, bottom left, bottom right, and center, plus horizontal
reflections ... | code_fim | medium | {
"lang": "python",
"repo": "djpetti/rpinets",
"path": "/common/data_manager/data_augmentation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> distx_from_edge = (width - new_width) / 2
disty_from_edge = (height - new_height) / 2
center = image[distx_from_edge:width - distx_from_edge,
disty_from_edge:height - disty_from_edge]
ret = [top_left, top_right, bottom_left, bottom_right, center]
if flip:
# Flip everything... | code_fim | hard | {
"lang": "python",
"repo": "djpetti/rpinets",
"path": "/common/data_manager/data_augmentation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = [s.strip() for s in sys.stdin]
p = [int(x) for x in data[0].split(",")]
op = list(p)
for n in range(100):
for v in range(100):
p = list(op)
p[1] = n
p[2] = v
run(p)
if p[0] == 19690720:
print(100*n ... | code_fim | medium | {
"lang": "python",
"repo": "msullivan/advent-of-code",
"path": "/2019/2b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for n in range(100):
for v in range(100):
p = list(op)
p[1] = n
p[2] = v
run(p)
if p[0] == 19690720:
print(100*n + v)
return
if __name__ == '__main__':
sys.exit(main(sys.argv))<|fim_prefix|># repo:... | code_fim | medium | {
"lang": "python",
"repo": "msullivan/advent-of-code",
"path": "/2019/2b.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msullivan/advent-of-code path: /2019/2b.py
#!/usr/bin/env python3
import sys
def run(p):
ip = 0
while True:
instr = p[ip]
if instr == 1:
p[p[ip+3]] = p[p[ip+1]] + p[p[ip+2]]
ip += 4
elif instr == 2:
p[p[ip+3]] = p[p[ip+1]] * p[... | code_fim | medium | {
"lang": "python",
"repo": "msullivan/advent-of-code",
"path": "/2019/2b.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acobley/TF-recomm path: /dataio.py
from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
def read_movies(filname, sep="::"):
col_names = ["movie", "title", "tags"]
df = pd.read_csv(filname, sep=sep, header=None, names=col_names, engine='python'... | code_fim | medium | {
"lang": "python",
"repo": "acobley/TF-recomm",
"path": "/dataio.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.group_id >= len(self.idx_group):
self.group_id = 0
raise StopIteration
out = self.inputs[self.idx_group[self.group_id], :]
self.group_id += 1
return [out[:, i] for i in range(self.num_cols)]<|fim_prefix|># repo: acobley/TF-recomm path: /dataio.py
from __future__ import absolute_impo... | code_fim | hard | {
"lang": "python",
"repo": "acobley/TF-recomm",
"path": "/dataio.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>ebnuke, filepathinfo['newpath'])
#print(filepathinfo)<|fim_prefix|># repo: bugbound/jsfs path: /libs/commands/LSrunner.py
class LSrunner:
@staticmethod
def run(fakeFileSystem<|fim_middle|>, webnuke, line):
#print(line)
filepathinfo = fakeFileSystem.CD_merge_filepath(line)
fakeFileSystem.LS(w | code_fim | medium | {
"lang": "python",
"repo": "bugbound/jsfs",
"path": "/libs/commands/LSrunner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bugbound/jsfs path: /libs/commands/LSrunner.py
class LSrunner:
@staticmethod
def run(fakeFileSystem<|fim_suffix|>ileSystem.CD_merge_filepath(line)
fakeFileSystem.LS(webnuke, filepathinfo['newpath'])
#print(filepathinfo)<|fim_middle|>, webnuke, line):
#print(line)
filepathinfo = fakeF | code_fim | easy | {
"lang": "python",
"repo": "bugbound/jsfs",
"path": "/libs/commands/LSrunner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class NCToNA(nappy.nc_interface.xarray_to_na.XarrayToNA):
"""
Converts a NetCDF file to one or more NASA Ames files.
"""
def __init__(self, nc_file, var_ids=None, na_items_to_override=None,
only_return_file_names=False, exclude_vars=None,
requested_ffi=None... | code_fim | hard | {
"lang": "python",
"repo": "cedadev/nappy",
"path": "/nappy/nc_interface/nc_to_na.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cedadev/nappy path: /nappy/nc_interface/nc_to_na.py
# Copyright (C) 2004 CCLRC & NERC( Natural Environment Research Council ).
# This software may be distributed under the terms of the
# Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
"""
... | code_fim | hard | {
"lang": "python",
"repo": "cedadev/nappy",
"path": "/nappy/nc_interface/nc_to_na.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def calc_social_features(self):
G = self.network
follower_count_list = []
friend_count_list = []
listed_count_list = []
favourites_count_list = []
statuses_count_list = []
is_verified_list = []
for node in G.nodes():
try:
... | code_fim | hard | {
"lang": "python",
"repo": "anshiquanshu66/rumor-diffusion-network-analysis",
"path": "/scripts/feature-extraction/social_feature_extraction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anshiquanshu66/rumor-diffusion-network-analysis path: /scripts/feature-extraction/social_feature_extraction.py
import sys
sys.path.append('..')
from utils import *
class Cascade:
# --------------------------
# Initiate Cascade
# --------------------------
total_user_not_fo... | code_fim | hard | {
"lang": "python",
"repo": "anshiquanshu66/rumor-diffusion-network-analysis",
"path": "/scripts/feature-extraction/social_feature_extraction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raghurama123/normal-mode-jupyter path: /helpers.py
import py3Dmol
from ipywidgets import widgets, interact,fixed
from IPython.display import display
def section(fle, begin, end):
"""
yields a section of a textfile.
Used to identify [COORDS] section etc
"""
with open(fle) as ... | code_fim | hard | {
"lang": "python",
"repo": "raghurama123/normal-mode-jupyter",
"path": "/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
draws a specified normal mode using the animate mode from py3Dmol.
Coming from psi4 units need to be converted from a.u to A.
"""
fac=0.52917721067121 # bohr to A
xyz =f"{len(coords)}\n\n"
for i in range(len(coords)):
atom_coords = [float(m) for m in coords[i][8... | code_fim | hard | {
"lang": "python",
"repo": "raghurama123/normal-mode-jupyter",
"path": "/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(TermsTest, self).tearDown()
self._index.delete()
def test_terms_aggregation(self):
agg = Terms("terms").set_field("color")
query = Query()
query.add_aggregation(agg)
results = self._index.search(query).aggregations['terms']
self.assertEq... | code_fim | hard | {
"lang": "python",
"repo": "jlinn/pylastica",
"path": "/tests/aggregation/test_terms.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jlinn/pylastica path: /tests/aggregation/test_terms.py
from pylastica.query import Query
from pylastica import Document
from pylastica.aggregation.terms import Terms
from tests.base import Base
__author__ = 'Joe Linn'
import unittest
<|fim_suffix|> results = self._index.search(query).ag... | code_fim | hard | {
"lang": "python",
"repo": "jlinn/pylastica",
"path": "/tests/aggregation/test_terms.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Ma = Ha.array([4, 5])
self.assertEqual(Ma[0], 4)
self.assertEqual(Ma[1], 5)
self.assertRaises(HilbertIndexError, lambda: Ma[2])
Mx = Hx.array([4, 5, 6])
self.assertEqual(Mx['x'], 4)
self.assertEqual(Mx['y'], 5)
self.assertEqual(Mx['z'], 6)
... | code_fim | hard | {
"lang": "python",
"repo": "stjordanis/qitensor",
"path": "/qitensor/tests/hilbert.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stjordanis/qitensor path: /qitensor/tests/hilbert.py
#!/usr/bin/python
import unittest
import qitensor
from qitensor import qubit, qudit, indexed_space
from qitensor import DuplicatedSpaceError, HilbertError
from qitensor import HilbertIndexError, HilbertShapeError
from qitensor.factory import G... | code_fim | hard | {
"lang": "python",
"repo": "stjordanis/qitensor",
"path": "/qitensor/tests/hilbert.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tianhm/pythalesians path: /finmarketpy_examples/returns_examples.py
__author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016-2020 Cuemacro - https://www.cuemacro.com / @cuemacro
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance wi... | code_fim | medium | {
"lang": "python",
"repo": "tianhm/pythalesians",
"path": "/finmarketpy_examples/returns_examples.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>chart = Chart(engine='matplotlib')
market = Market(market_data_generator=MarketDataGenerator())
# Choose run_example = 0 for everything
# run_example = 1 - use PyFolio to analyse gold's return properties
run_example = 0
###### Use PyFolio to analyse gold's return properties
if run_example == 1 or run_... | code_fim | hard | {
"lang": "python",
"repo": "tianhm/pythalesians",
"path": "/finmarketpy_examples/returns_examples.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>nt(data)
apk = APK(data)
apk.parse_androidxml()
print(apk.getpackage()+" "+apk.getversion())
zipFile.close()<|fim_prefix|># repo: ShaoboFeng/PyAXML path: /list_cur_dir.py
import os
import os.path
from PyAXML.AndroidXML import *
import zipfile
rootdi... | code_fim | hard | {
"lang": "python",
"repo": "ShaoboFeng/PyAXML",
"path": "/list_cur_dir.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShaoboFeng/PyAXML path: /list_cur_dir.py
import os
import os.path
from PyAXML.AndroidXML import *
import zipfile
rootdir = "."
for parent,dirnames,filenames in os.walk(rootdir):
#for dirname in dirnames:
# print(parent)
# print(dirname)
if parent != rootdir:
... | code_fim | medium | {
"lang": "python",
"repo": "ShaoboFeng/PyAXML",
"path": "/list_cur_dir.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PatrickRWells/specim path: /specim/make_cutout.py
"""
Script to make a cutout of a fits image. The user requests a center
(RA, Dec) and an output image size in arcseconds. The input fits
file must have valid WCS information.
Usage: python make_cutout.py [infile] [ra_cent] [dec_cent] [imsize] [... | code_fim | hard | {
"lang": "python",
"repo": "PatrickRWells/specim",
"path": "/specim/make_cutout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>""" Check command line syntax """
if len(sys.argv) < 6:
help_message()
exit()
""" Assign variables based on command-line input """
infile = sys.argv[1]
try:
racent = float(sys.argv[2])
except ValueError:
print('')
print('ERROR: ra_cent must be a number')
help_message()
exit()
... | code_fim | hard | {
"lang": "python",
"repo": "PatrickRWells/specim",
"path": "/specim/make_cutout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> expected_tree = tree_id3(training_data, target, attributes)
snapshot.assert_match(str(expected_tree))<|fim_prefix|># repo: joctaTorres/treeasy path: /test/test_trees.py
import pandas as pd
from treeasy.trees import tree_id3
<|fim_middle|>def test_tree_id3(snapshot):
training_data = pd.read... | code_fim | hard | {
"lang": "python",
"repo": "joctaTorres/treeasy",
"path": "/test/test_trees.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joctaTorres/treeasy path: /test/test_trees.py
import pandas as pd
from treeasy.trees import tree_id3
<|fim_suffix|> training_data = pd.read_csv("./datasets/tennis.csv")
training_data.drop(["day"], axis=1, inplace=True)
attributes = list(training_data.columns)
target = "play"
... | code_fim | easy | {
"lang": "python",
"repo": "joctaTorres/treeasy",
"path": "/test/test_trees.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> training_data = pd.read_csv("./datasets/tennis.csv")
training_data.drop(["day"], axis=1, inplace=True)
attributes = list(training_data.columns)
target = "play"
expected_tree = tree_id3(training_data, target, attributes)
snapshot.assert_match(str(expected_tree))<|fim_prefix|># rep... | code_fim | easy | {
"lang": "python",
"repo": "joctaTorres/treeasy",
"path": "/test/test_trees.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liuguoyou/PosterChild path: /src/posterization/posterization_old_version.py
]:
#print ("start_point =", curve.start_point)
# draw parent curve
if curve not in painted:
cr.move_to( curve.start_point[0] / height, curve.start_point[... | code_fim | hard | {
"lang": "python",
"repo": "liuguoyou/PosterChild",
"path": "/src/posterization/posterization_old_version.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liuguoyou/PosterChild path: /src/posterization/posterization_old_version.py
oundaries, final_colors )
self.surface.write_to_png( filename + '.png' )
cr.show_page()
self.surface.finish()
def draw_dest( self, cr, height, width, boundaries, final_colors ):
... | code_fim | hard | {
"lang": "python",
"repo": "liuguoyou/PosterChild",
"path": "/src/posterization/posterization_old_version.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # option 1 means list
visited = []
for label in colors:
if label not in visited:
visited.append(label)
return visited
def frobenius_inner_product(matrix1, matrix2):
assert matrix1.shape == matrix2.shape
return np.trace(matrix1.T @ matrix2)
def optimize_weigh... | code_fim | hard | {
"lang": "python",
"repo": "liuguoyou/PosterChild",
"path": "/src/posterization/posterization_old_version.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> file = open(asset_list_file)
data = file.read()
file.close()
data = data.split('\n')
for asset in data:
AssetManager.__assets.update({asset.split('=', 1)[0].strip(): asset.split('=', 1)[1].strip()})
@staticmethod
def get_asset(_asset_name):
... | code_fim | medium | {
"lang": "python",
"repo": "Vikas99Kr/Zombie",
"path": "/zombie/asset.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vikas99Kr/Zombie path: /zombie/asset.py
import zombie
class AssetManager:
__assets = {}
<|fim_suffix|> file = open(asset_list_file)
data = file.read()
file.close()
data = data.split('\n')
for asset in data:
AssetManager.__assets.update({as... | code_fim | medium | {
"lang": "python",
"repo": "Vikas99Kr/Zombie",
"path": "/zombie/asset.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vikas99Kr/Zombie path: /zombie/asset.py
import zombie
class AssetManager:
__assets = {}
@staticmethod
def load_asset(asset_list_file="asset.z"):
file = open(asset_list_file)
data = file.read()
file.close()
data = data.split('\n')
for asset in... | code_fim | easy | {
"lang": "python",
"repo": "Vikas99Kr/Zombie",
"path": "/zombie/asset.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Doist/python-timezones path: /timezones/_defs.py
Timezone = tuple[
str, # offset
str, # timezone name
str, # formatted name
]
_US_TIMEZONES = [
("US/Hawaii", "Hawaii"),
("US/Alaska", "Alaska"),
("US/Pacific", "Pacific Time (US & Canada)"),
("US/Arizona", "Arizona")... | code_fim | hard | {
"lang": "python",
"repo": "Doist/python-timezones",
"path": "/timezones/_defs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_FIXED_OFFSETS: list[Timezone] = [
("-1200", "GMT -12:00", "GMT -12:00"),
("-1100", "GMT -11:00", "GMT -11:00"),
("-1000", "GMT -10:00", "GMT -10:00"),
("-0900", "GMT -9:00", "GMT -9:00"),
("-0800", "GMT -8:00", "GMT -8:00"),
("-0700", "GMT -7:00", "GMT -7:00"),
("-0600", "GMT ... | code_fim | hard | {
"lang": "python",
"repo": "Doist/python-timezones",
"path": "/timezones/_defs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: X-DataInitiative/SCALPEL-Analysis path: /scalpel/stats/flattening_confidence_degree.py
# License: BSD 3 clause
import logging
from functools import reduce
from typing import Callable, FrozenSet
import seaborn as sns
from matplotlib.figure import Figure
from pandas import DataFrame as PDDataFram... | code_fim | hard | {
"lang": "python",
"repo": "X-DataInitiative/SCALPEL-Analysis",
"path": "/scalpel/stats/flattening_confidence_degree.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> figure: Figure,
cohort: FlatTable,
show=False,
show_func=print,
save_path=None,
group_by_cols=None,
) -> Figure:
"""
This method is used to calculate the confidence degree of a flat table
and show the result in seaborn context.
Parameters
----------
figure:... | code_fim | hard | {
"lang": "python",
"repo": "X-DataInitiative/SCALPEL-Analysis",
"path": "/scalpel/stats/flattening_confidence_degree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wfc1102/deepsky path: /scripts/storm_ua_gan.py
import numpy as np
import pandas as pd
import xarray as xr
from glob import glob
from keras.models import Sequential, Model
from keras.layers import Conv2D, Conv2DTranspose, Flatten, Dense, Input, Conv1D, Merge, concatenate
from keras.layers import A... | code_fim | hard | {
"lang": "python",
"repo": "wfc1102/deepsky",
"path": "/scripts/storm_ua_gan.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
ua_vars = ['geopotential_height_500_mb_prev',
'geopotential_height_700_mb_prev',
'geopotential_height_850_mb_prev',
'temperature_500_mb_prev',
'temperature_700_mb_prev',
'temperature_850_mb_prev',
'dew_point_temperatur... | code_fim | hard | {
"lang": "python",
"repo": "wfc1102/deepsky",
"path": "/scripts/storm_ua_gan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
input_size (int): Number of nodes in the input layer.
filter_width (int): Width of each convolutional filter
min_data_width (int): Width of the first convolved layer after the input layer
min_conv_filters (int): Number of convolutional filters in the last convolut... | code_fim | hard | {
"lang": "python",
"repo": "wfc1102/deepsky",
"path": "/scripts/storm_ua_gan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dliberat/django-ghost path: /game/GhostGame.py
import random
from .Trie import TRIE_BRANCH
from .GhostStrategies import RandomWinBestEffortLossStrat
class GhostMove(object):
"""Describes a move being made by a CPU player.
In the case where the CPU player has not made
a move because ... | code_fim | hard | {
"lang": "python",
"repo": "dliberat/django-ghost",
"path": "/game/GhostGame.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _create_move_obj(self, prefix, suffix, winners, losers):
word = prefix + suffix
chosen_node = None
if suffix in winners:
chosen_node = winners[suffix]
is_game_over = chosen_node.height == 0
return GhostMove(is_game_over, wo... | code_fim | hard | {
"lang": "python",
"repo": "dliberat/django-ghost",
"path": "/game/GhostGame.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dgomes/pyipma path: /tests/test_location.py
import json
import aiohttp
import pytest
from aioresponses import aioresponses
from mock import patch
from freezegun import freeze_time
from datetime import datetime
from pyipma.api import IPMA_API
from pyipma.location import Location
from pyipma.rcm ... | code_fim | hard | {
"lang": "python",
"repo": "dgomes/pyipma",
"path": "/tests/test_location.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> location = await Location.get(api, 40.6517, -8.6573)
print("Forecast for {}".format(location.name))
print("Nearest station is {}".format(location.station))
assert location.name == "Aveiro"
assert location.station == "Aveiro (Universidade)"
# 1210702 is the ... | code_fim | hard | {
"lang": "python",
"repo": "dgomes/pyipma",
"path": "/tests/test_location.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # define the list with the values of (sensitivity and 1 - specificity)
recalls = []
fall_outs = []
# compute the metrics for every threshold
for threshold in thresholds:
# get the roc metrics
recall, fall_out = roc_metrics(y_pred, y, threshold=threshold)
... | code_fim | hard | {
"lang": "python",
"repo": "AndrewSpano/AI-2-Projects",
"path": "/Project3/Notebooks/plots.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndrewSpano/AI-2-Projects path: /Project3/Notebooks/plots.py
import torch
import numpy as np
from matplotlib import gridspec
import matplotlib.pyplot as plt
from metrics import *
def plot_metrics(train_metric, val_metric, train_metric_name, val_metric_name, yax, title):
"""
:... | code_fim | hard | {
"lang": "python",
"repo": "AndrewSpano/AI-2-Projects",
"path": "/Project3/Notebooks/plots.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>CONFIG_PATH = click.option("--config-path", "-cp", default=None,
help="Path to a yaml file containing config for neuralqa. "
"If none is provided, the default config.yaml is copied to the current directory.")<|fim_prefix|># repo: vishalbelsare/neuralqa... | code_fim | hard | {
"lang": "python",
"repo": "vishalbelsare/neuralqa",
"path": "/neuralqa/utils/cli_args.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vishalbelsare/neuralqa path: /neuralqa/utils/cli_args.py
"""
Definitions of click options shared by several CLI commands.
"""
import click
HOST = click.option("--host", "-h", default="127.0.0.1",
help="The network address to listen on (default: 127.0.0.1). "
... | code_fim | hard | {
"lang": "python",
"repo": "vishalbelsare/neuralqa",
"path": "/neuralqa/utils/cli_args.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> treba = 0
vyhra = 0
for i in range(najmensich):
treba += vyska - X[i]
vyhra += vyska - X[i]
for i in range(najmensich,37):
if X[i] <= vyska:
treba += vyska+1-... | code_fim | hard | {
"lang": "python",
"repo": "Abigiris/SLACC",
"path": "/projects/src/main/python/CodeJam/Y13R5P1/misof/A4.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abigiris/SLACC path: /projects/src/main/python/CodeJam/Y13R5P1/misof/A4.py
from random import randint
def try_random(B,X):
x = randint(1,max(X))
treba = 0
pocet = 0
for y in X:
if y <= x:
treba += x-y
pocet += 1
if treba > B: return (x,0)... | code_fim | hard | {
"lang": "python",
"repo": "Abigiris/SLACC",
"path": "/projects/src/main/python/CodeJam/Y13R5P1/misof/A4.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not hasattr(cfg.model, 'test_ds'):
raise ValueError(f'model.test_ds was not found in the config, skipping evaluation')
else:
gpu = 1 if cfg.trainer.gpus != 0 else 0
trainer = pl.Trainer(
gpus=gpu,
precision=cfg.trainer.precision,
amp_level=cfg.traine... | code_fim | hard | {
"lang": "python",
"repo": "blisc/NeMo",
"path": "/examples/nlp/token_classification/punctuation_capitalization_evaluate.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blisc/NeMo path: /examples/nlp/token_classification/punctuation_capitalization_evaluate.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | code_fim | hard | {
"lang": "python",
"repo": "blisc/NeMo",
"path": "/examples/nlp/token_classification/punctuation_capitalization_evaluate.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.retranslateUi(Form)
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.textEdit.set... | code_fim | hard | {
"lang": "python",
"repo": "muntakim1/semantic-",
"path": "/allgui.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muntakim1/semantic- path: /allgui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'allinone.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtW... | code_fim | hard | {
"lang": "python",
"repo": "muntakim1/semantic-",
"path": "/allgui.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
return (200 in get_status_codes())
if __name__=="__main__":
main()<|fim_prefix|># repo: tcarrio/cse-notsosocialnetwork path: /test.py
import requests
from config.env_config import ProductionConfig as conf
def get_status_codes():
base_url = '{}:{}/'.format('127.0.0.1','8080')
... | code_fim | hard | {
"lang": "python",
"repo": "tcarrio/cse-notsosocialnetwork",
"path": "/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tcarrio/cse-notsosocialnetwork path: /test.py
import requests
from config.env_config import ProductionConfig as conf
def get_status_codes():
<|fim_suffix|> for uri in test_urls:
try:
r = requests.get('{}{}'.format(base_url,uri))
status_codes.append(r.status_cod... | code_fim | hard | {
"lang": "python",
"repo": "tcarrio/cse-notsosocialnetwork",
"path": "/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lothesven/Help-MacGyver-to-escape path: /data/settings.py
"""Contains all settings constants such as:\n
colors, fonts, sounds, images, positions, structures and sizes"""
import os.path
from pygame import font
<|fim_suffix|>FOOTSTEPS = os.path.join(DIRECTORY, "sounds", "footsteps.ogg")
ERROR = ... | code_fim | hard | {
"lang": "python",
"repo": "lothesven/Help-MacGyver-to-escape",
"path": "/data/settings.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>FOOTSTEPS = os.path.join(DIRECTORY, "sounds", "footsteps.ogg")
ERROR = os.path.join(DIRECTORY, "sounds", "error.ogg")
AMBIANT = os.path.join(DIRECTORY, "sounds", "ambiant.ogg")
WINNING = os.path.join(DIRECTORY, "sounds", "winning.ogg")
VICTORY = os.path.join(DIRECTORY, "sounds", "victory.ogg")
FAILURE = o... | code_fim | hard | {
"lang": "python",
"repo": "lothesven/Help-MacGyver-to-escape",
"path": "/data/settings.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aryamanz29/Book-Recommendation-Analysis path: /env/lib/python3.6/site-packages/flask_user/tests/test_misc.py
from .utils import utils_prepare_user
<|fim_suffix|> # Generate token with data-item other than int or string
um.token_manager.generate_token(1.1)
# Hash password with old API... | code_fim | medium | {
"lang": "python",
"repo": "Aryamanz29/Book-Recommendation-Analysis",
"path": "/env/lib/python3.6/site-packages/flask_user/tests/test_misc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Hash password with old API
um.password_manager.verify_password('password', user)<|fim_prefix|># repo: Aryamanz29/Book-Recommendation-Analysis path: /env/lib/python3.6/site-packages/flask_user/tests/test_misc.py
from .utils import utils_prepare_user
# Make sure that uncovered lines are covered
... | code_fim | medium | {
"lang": "python",
"repo": "Aryamanz29/Book-Recommendation-Analysis",
"path": "/env/lib/python3.6/site-packages/flask_user/tests/test_misc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|><p><strong>后续挑战</strong> <strong>:</strong></p>
<p>如果有大量输入的 S,称作S1, S2, ... , Sk 其中 k >= 10亿,你需要依次检查它们是否为 T 的子序列。在这种情况下,你会怎样改变代码?</p>
<p><strong>致谢:</strong></p>
<p>特别感谢<strong> </strong><a href="https://leetcode.com/pbrother/">@pbrother </a>添加此问题并且创建所有测试用例。</p>
"""
class Solution:
def is... | code_fim | hard | {
"lang": "python",
"repo": "lishulongVI/leetcode",
"path": "/python3/392.Is Subsequence(判断子序列).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lishulongVI/leetcode path: /python3/392.Is Subsequence(判断子序列).py
"""
<p>
Given a string <b>s</b> and a string <b>t</b>, check if <b>s</b> is subsequence of <b>t</b>.
</p>
<p>
You may assume that there is only lower case English letters in both <b>s</b> and <b>t</b>. <b>t</b> is potentially a ver... | code_fim | hard | {
"lang": "python",
"repo": "lishulongVI/leetcode",
"path": "/python3/392.Is Subsequence(判断子序列).py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|><p>返回 <code>true</code>.</p>
<p><strong>示例 2:</strong><br />
<strong>s</strong> = <code>"axc"</code>, <strong>t</strong> = <code>"ahbgdc"</code></p>
<p>返回 <code>false</code>.</p>
<p><strong>后续挑战</strong> <strong>:</strong></p>
<p>如果有大量输入的 S,称作S1, S2, ... , Sk 其中 k &g... | code_fim | hard | {
"lang": "python",
"repo": "lishulongVI/leetcode",
"path": "/python3/392.Is Subsequence(判断子序列).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yotohoshi/qiita path: /qiita_db/support_files/patches/python_patches/43.py
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in th... | code_fim | hard | {
"lang": "python",
"repo": "yotohoshi/qiita",
"path": "/qiita_db/support_files/patches/python_patches/43.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> cmd_out_id = qdb.util.convert_to_id(
cmd_out, "command_output", "name")
# the owner of the study will create the job
job = PJ.create(c.study.owner, c.processing_parameters, True)
with qdb.sql_connection.TRN:
sql = """... | code_fim | hard | {
"lang": "python",
"repo": "yotohoshi/qiita",
"path": "/qiita_db/support_files/patches/python_patches/43.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Somnus1990/gridcell path: /gridcell/imaps.py
erit_binary_operation(other, '__floordiv__')
def __rfloordiv__(self, other):
return self._inherit_binary_operation(other, '__rfloordiv__')
def __pow__(self, other):
return self._inherit_binary_operation(other, '__pow__')
... | code_fim | hard | {
"lang": "python",
"repo": "Somnus1990/gridcell",
"path": "/gridcell/imaps.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __le__(self, other):
return self._inherit_binary_operation(other, '__le__')
def __gt__(self, other):
return self._inherit_binary_operation(other, '__gt__')
def __ge__(self, other):
return self._inherit_binary_operation(other, '__ge__')
def __add__(self, other... | code_fim | hard | {
"lang": "python",
"repo": "Somnus1990/gridcell",
"path": "/gridcell/imaps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
try:
l = len(vector)
except TypeError:
vector = (vector,)
l = 1
if not l == self.ndim:
raise ValueError("'vector' must be a sequence containing a number "
"for each dimension in the {} instanc... | code_fim | hard | {
"lang": "python",
"repo": "Somnus1990/gridcell",
"path": "/gridcell/imaps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: npgeorge/NHL_Project path: /pages/predictions.py
# Imports from 3rd party libraries
import dash
import pandas as pd
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_daq as ... | code_fim | hard | {
"lang": "python",
"repo": "npgeorge/NHL_Project",
"path": "/pages/predictions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'Number of Shots: {}'.format(input_value)
@app.callback(
Output(component_id='out3', component_property='children'),
[Input(component_id='hits', component_property='value')]
)
def update_output_div(input_value):
return 'Number of Hits: {}'.format(input_value)
@app.callbac... | code_fim | hard | {
"lang": "python",
"repo": "npgeorge/NHL_Project",
"path": "/pages/predictions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
print("等待活动连接...")
readable, writeable, exceptional = select.select(inputs, outputs, inputs, time_out)
if not (readable or writeable or exceptional):
print("select超时无活动连接,重新连接select...")
continue
for s in readable:
# 如果是server监听的socket
if s is se... | code_fim | hard | {
"lang": "python",
"repo": "fadeawaylove/test_projects",
"path": "/select_server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fadeawaylove/test_projects path: /select_server.py
import socket
import select
import queue
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # ipv4 tcp
server.setblocking(False) # 设置非阻塞
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_address = ("127.0.0.1", 8989)
... | code_fim | hard | {
"lang": "python",
"repo": "fadeawaylove/test_projects",
"path": "/select_server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShGKme/py-grpc-chat-example path: /client/chat_client.py
import threading
import grpc
import client.grpc_out.chat_pb2 as chat_proto
import client.grpc_out.chat_pb2_grpc as chat_grpc
class ChatClient:
"""
Класс - клиент чата.
В gRPC довольно легко работать с сервером, но мы сделаем ... | code_fim | hard | {
"lang": "python",
"repo": "ShGKme/py-grpc-chat-example",
"path": "/client/chat_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Функция, которую будем вызывать, когда придёт сообщение
self._on_message_receive = message_received
# Создаём отдельный поток, в котором читаем приходящий стим сообщений от сервера
threading.Thread(target=self._listen_for_messages, daemon=True).start()
def _listen_fo... | code_fim | medium | {
"lang": "python",
"repo": "ShGKme/py-grpc-chat-example",
"path": "/client/chat_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brennash/Feature_Dashboard path: /App.py
#####################################################################
# The Feature Dashboard Python flask application. This application #
# is used to display the potential gains accrued by a predictive #
# model of top-flight European football leagues... | code_fim | hard | {
"lang": "python",
"repo": "brennash/Feature_Dashboard",
"path": "/App.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def getSingleSQL(utilType, minProb, maxProb, minUtil, maxUtil):
if utilType == 'BEST':
utilText = 'BestOdds'
elif utilType == 'WORST':
utilText = 'WorstOdds'
else:
utilText = 'AvgOdds'
sql = 'SELECT BatchNum, SeasonCode, Result, DATE(FixtureDate), WorstOdds, 1 FROM Features WHERE '
sql += 'P... | code_fim | hard | {
"lang": "python",
"repo": "brennash/Feature_Dashboard",
"path": "/App.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> app.config["ASSETS_URL"] = "http://localhost:5001/static/"
webpack_server = sp.Popen(["/usr/bin/node",
"node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"--content-base", "Application/static",
"... | code_fim | medium | {
"lang": "python",
"repo": "paynejacob/Flask-Bootstrap",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paynejacob/Flask-Bootstrap path: /manage.py
#!/usr/bin/env python3
"""
manage.py
Scripts for running the applications
"""
import subprocess as sp
from flask_script import Manager, Shell, Server as OldServer
from flask_migrate import MigrateCommand, Migrate
<|fim_suffix|>app = create_app(get_co... | code_fim | medium | {
"lang": "python",
"repo": "paynejacob/Flask-Bootstrap",
"path": "/manage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sp.run(["/usr/bin/npm", "update"], cwd="Application/app_src", check=True)
manager.add_command('runserver', Server(threaded=True))
manager.add_command('shell', Shell(make_context=_make_context))
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()<|fim_prefix|># repo: pa... | code_fim | hard | {
"lang": "python",
"repo": "paynejacob/Flask-Bootstrap",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate_accumulator_serialize_and_deserialize(self, combiner, data,
expected):
"""Validate that the serialize<->deserialize loop loses no data."""
acc = combiner.compute(data)
extracted_data = combiner.serialize(acc)
restored_acc ... | code_fim | hard | {
"lang": "python",
"repo": "fansNvidia/tensorflow",
"path": "/tensorflow/python/keras/layers/preprocessing/preprocessing_test_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> unordered_all_merge = combiner.merge([
combiner.compute(data_1),
combiner.compute(data_2),
combiner.compute(data_0)
])
self.assert_accumulator_equal(
combiner,
all_merge,
unordered_all_merge,
message="The order of merge arguments should n... | code_fim | hard | {
"lang": "python",
"repo": "fansNvidia/tensorflow",
"path": "/tensorflow/python/keras/layers/preprocessing/preprocessing_test_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fansNvidia/tensorflow path: /tensorflow/python/keras/layers/preprocessing/preprocessing_test_utils.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | code_fim | hard | {
"lang": "python",
"repo": "fansNvidia/tensorflow",
"path": "/tensorflow/python/keras/layers/preprocessing/preprocessing_test_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rid-dim/pySafe path: /safenet/mutabledata.py
import safenet.base_classes as base
import safenet.safe_utils as safeUtils
import queue
class MutableData(base.StandardMutableData):
def __init__(self, app_pointer=None, fromBytes=None):
self.queue = queue.Queue()
self.bind_ffi_met... | code_fim | hard | {
"lang": "python",
"repo": "rid-dim/pySafe",
"path": "/safenet/mutabledata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return random_info
def insertEntries(self, info_data, content_as_dict):
self.mdata_entry_actions_new(self.app_pointer, None)
entry_handle = self.queue.get()
for item in content_as_dict:
self.mdata_entry_actions_insert(self.app_pointer, entry_handle, item,... | code_fim | hard | {
"lang": "python",
"repo": "rid-dim/pySafe",
"path": "/safenet/mutabledata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jordeu/gendas path: /examples/oncodrive.py
#
# Copyright 2018 Jordi Deu-Pons
#
# 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 copy of the License at
#
# http://www.apache.org/licenses/LI... | code_fim | hard | {
"lang": "python",
"repo": "jordeu/gendas",
"path": "/examples/oncodrive.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def oncodrive_fml(gd, sampling=100):
cadds_gene = list(gd['cadd']['PHRED'])
cadds_observed = list(gd['variants'].merge(gd['cadd'], on=['REF', 'ALT'])['cadd']['PHRED'])
if len(cadds_observed) == 0:
return None
background = np.array([np.mean(np.random.choice(cadds_gene, size=len(c... | code_fim | medium | {
"lang": "python",
"repo": "jordeu/gendas",
"path": "/examples/oncodrive.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Goobley/radynpy path: /radynpy/cdf/RadynKeyFile.py
import os
import cdflib
import pickle
from radynpy.cdf.auxtypes import Val, Array
import numpy as np
cdfFile = '/data/crisp/RadynGrid/radyn_out.val3c_d3_1.0e11_t20s_10kev_fp'
res = {}
cdf = cdflib.CDF(cdfFile)
for k in cdf.cdf_info()['zVariable... | code_fim | hard | {
"lang": "python",
"repo": "Goobley/radynpy",
"path": "/radynpy/cdf/RadynKeyFile.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.