text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: ferchault/iago path: /tests/unit/test_analyser.py
# system modules
from unittest import TestCase
# custom modules
import iago
class TestAnalyser(TestCase):
def test_static_group_args(self):
a = iago.Analyser()
a.static_group('debug', 1, 3, 4, 5)
self.assertDictEqual(a.get_groups(), {'de... | code_fim | medium | {
"lang": "python",
"repo": "ferchault/iago",
"path": "/tests/unit/test_analyser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertRaises(NotImplementedError, a.setup)
try:
a.define_groups()
a.calculated_columns()
except:
self.fail('Mistakenly mandatory routines.')
def test_fail_missing_ndx(self):
a = iago.Analyser()
self.assertRaises(ValueError, a.static_load_groups, 'nonexisting.ndx')
a.path = '/'
... | code_fim | medium | {
"lang": "python",
"repo": "ferchault/iago",
"path": "/tests/unit/test_analyser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anirao26/Feature-based-Reinforcement-Learning-for-Solving-Rubik-s-Cube path: /Cube_State.py
]]
txt = "\n\n\t ["
txt += str(face5["q2"]) + " " + str(face5["q1"])
txt += "]\n"
txt += "\t [" + str(face5["q3"]) + " " + str(face5["q4"]) + "]"
txt += "\n\n"
txt += " [" ... | code_fim | hard | {
"lang": "python",
"repo": "anirao26/Feature-based-Reinforcement-Learning-for-Solving-Rubik-s-Cube",
"path": "/Cube_State.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, name, precond, state_transf):
self.name = name
self.precond = precond
self.state_transf = state_transf
def is_applicable(self, s):
return self.precond(s)
def apply(self, s):
return self.state_transf(s)
#</COMMON_CODE>
#Check how many faces are complete
def... | code_fim | hard | {
"lang": "python",
"repo": "anirao26/Feature-based-Reinforcement-Learning-for-Solving-Rubik-s-Cube",
"path": "/Cube_State.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anirao26/Feature-based-Reinforcement-Learning-for-Solving-Rubik-s-Cube path: /Cube_State.py
following is the problem formulation of the Rubik's Cube puzzle,
which comprises of the state definition and valid move generator.
'''
#</METADATA>
# Each face is represented by a number
FACE1 = "TOP"
FAC... | code_fim | hard | {
"lang": "python",
"repo": "anirao26/Feature-based-Reinforcement-Learning-for-Solving-Rubik-s-Cube",
"path": "/Cube_State.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raul1991/learn-python-the-hard-way path: /src/ex5.py
my_name = 'Rahul Bawa'
my_age = 35 #not a lie
my_height = 74
my_weight = 180
my_eyes = 'Blue'
my_teeth = 'White'
my_hair = 'Brown'
<|fim_suffix|>#Drills - testing some more formatting options.
print "Contains decimal %f" %(0.5)<|fim_middle|>pr... | code_fim | hard | {
"lang": "python",
"repo": "raul1991/learn-python-the-hard-way",
"path": "/src/ex5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Drills - testing some more formatting options.
print "Contains decimal %f" %(0.5)<|fim_prefix|># repo: raul1991/learn-python-the-hard-way path: /src/ex5.py
my_name = 'Rahul Bawa'
my_age = 35 #not a lie
my_height = 74
my_weight = 180
my_eyes = 'Blue'
my_teeth = 'White'
my_hair = 'Brown'
<|fim_middle|>pr... | code_fim | hard | {
"lang": "python",
"repo": "raul1991/learn-python-the-hard-way",
"path": "/src/ex5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> MAP_SIZE = (96, 520)
distance = np.zeros(MAP_SIZE)
START_DELAY = 6601;
TOTAL_CHN, TOTAL_ROUND, SIGNAL_LENGTH = signal_matrices.shape
for chn in range(TOTAL_CHN):
for rd in range(TOTAL_ROUND):
signal = signal_matrices[chn, rd, :]
norm_signal = signal/np.m... | code_fim | hard | {
"lang": "python",
"repo": "ChenSunMac/BlueNose_ToolKit",
"path": "/Algorithms/AlgorithmSet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for k in range(0, 8):
raw_signal = raw_data[start_byte + k * 4008 + 40 : start_byte + k * 4008 + 4040].view('uint16')
raw_signal = np.float32((raw_signal.astype("double")-32768)/32768)
raw_signal = np.asmatrix(raw_signal)
#raw_first_ref = raw_data[st... | code_fim | hard | {
"lang": "python",
"repo": "ChenSunMac/BlueNose_ToolKit",
"path": "/Algorithms/AlgorithmSet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChenSunMac/BlueNose_ToolKit path: /Algorithms/AlgorithmSet.py
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 28 11:45:40 2017
### Algorithm Set for Bluenose Data Processing
#FUNCTION: ProcessBinFile()
INPUT:
OUTPUT: m * n * 2000 signal matrices
#FUNCTION: calliperAlg()
INPUT: m * n... | code_fim | hard | {
"lang": "python",
"repo": "ChenSunMac/BlueNose_ToolKit",
"path": "/Algorithms/AlgorithmSet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mscaudill/openseize path: /tests/test_edf.py
"""A module for testing the reading and writing of edf files. The tests are
compared against the pyedf library results. This library can be found here:
https://github.com/bids-standard/pyedf/tree/py3k
Typical usage example:
!pytest edf_tests.py::... | code_fim | hard | {
"lang": "python",
"repo": "mscaudill/openseize",
"path": "/tests/test_edf.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Reads using the pyEDF reader between start and stop samples for each
channel in channels.
The pyEDF reader (unlike openseize) cannot read multiple channels
simultaneously so this function performs multiple reads to gather data
across channels.
Args:
eeg: pyEDF.EDFRead... | code_fim | hard | {
"lang": "python",
"repo": "mscaudill/openseize",
"path": "/tests/test_edf.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_written_data(demo_data, written_data):
"""The written data fixture (see conftest) wrote channels [0, 3] from
the demo_data edf to a new file 'write_test.edf'. This test asserts that
the correct data was written to that file."""
openeeg = openEDF(demo_data)
openeeg2 = openEDF... | code_fim | hard | {
"lang": "python",
"repo": "mscaudill/openseize",
"path": "/tests/test_edf.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sentohq/supertokens-fastapi path: /tests/test_supertokens.py
= ''
assert cookies_4['sRefreshToken']['value'] == ''
assert cookies_4['sIdRefreshToken']['value'] == ''
assert cookies_4['sAccessToken']['domain'] == TEST_DRIVER_CONFIG_COOKIE_DOMAIN
assert cookies_4['sRefreshToken']['d... | code_fim | hard | {
"lang": "python",
"repo": "sentohq/supertokens-fastapi",
"path": "/tests/test_supertokens.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sentohq/supertokens-fastapi path: /tests/test_supertokens.py
'sIdRefreshToken']['expires']), 0
)
assert response_4.headers['Id-Refresh-Token'] == 'remove'
@mark.asyncio
async def test_cookie_and_header_values_with_csrf_disabled(core_config_client: TestClient):
set_key_value_in_confi... | code_fim | hard | {
"lang": "python",
"repo": "sentohq/supertokens-fastapi",
"path": "/tests/test_supertokens.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> response_3 = driver_config_client.get(
url='/custom/info',
cookies={
'sAccessToken': cookies_2['sAccessToken']['value'],
'sIdRefreshToken': cookies_2['sIdRefreshToken']['value']
}
)
assert response_3.status_code == 200
cookies_3 = extract_all... | code_fim | hard | {
"lang": "python",
"repo": "sentohq/supertokens-fastapi",
"path": "/tests/test_supertokens.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#os.system(ffmpeg_path+' -i '+ path+'auroramaps/results/'+output_directory+'/prob_global.mp4 -vf fps=25 "scale=1000:-1:flags=lanczos" palettegen'+ path+'auroramaps/results/'+output_directory+'/palette.png ')
#os.system(ffmpeg_path+' -i '+ path+'auroramaps/results/'+output_directory+'/prob_global.mp4 -i ... | code_fim | hard | {
"lang": "python",
"repo": "helioforecast/helio4cast",
"path": "/distribute_tweet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: helioforecast/helio4cast path: /distribute_tweet.py
#distribute_tweet.py
#for putting the real time results on the @helio4cast twitter account
import sys
#add path for modules
sys.path.insert(0, r'/home/cmoestl/.ssh')
import os
import tweepy
from id_twitter_helio4cast import *
from web_data ... | code_fim | hard | {
"lang": "python",
"repo": "helioforecast/helio4cast",
"path": "/distribute_tweet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># upload images and get media_ids
#filenames = ['/nas/helio/AURORAMAPS/results/aurora_realtime/prob_europe_small.gif']#, '/nas/helio/AURORAMAPS/results/aurora_realtime/prob_canada_small.gif','/nas/helio/AURORAMAPS/results/aurora_realtime/prob_global_small.gif']
#media_ids = []
#for filename in filenames:
... | code_fim | hard | {
"lang": "python",
"repo": "helioforecast/helio4cast",
"path": "/distribute_tweet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def batched_index_select(
target: torch.Tensor,
indices: torch.LongTensor,
flattened_indices: Optional[torch.LongTensor] = None,
) -> torch.Tensor:
"""
The given `indices` of size `(batch_size, d_1, ..., d_n)` indexes into the sequence
dimension (dimension 2) of the target, which h... | code_fim | hard | {
"lang": "python",
"repo": "sourishbanerjee/EmailSum",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sourishbanerjee/EmailSum path: /utils.py
import math
import numpy as np
import torch
from torch.utils.data import Sampler
from torch.optim.lr_scheduler import LambdaLR
from typing import Optional
class SortishSampler(Sampler):
"Go through the text data by order of src length with a bit of r... | code_fim | hard | {
"lang": "python",
"repo": "sourishbanerjee/EmailSum",
"path": "/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> state['RMS'] = 0
else:
if use_first_moment:
state['exp_avg'] = state['exp_avg'].to(grad)
if factored:
state['exp_avg_sq_row'] = state['exp_avg_sq_row'].to(grad)
... | code_fim | hard | {
"lang": "python",
"repo": "sourishbanerjee/EmailSum",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sangh/ratelimit_multi_proc_py3 path: /MultiProcRateLimit.py
#!/usr/local/bin/python3
# A general description, information about what this file is, how it works,
# and usage examples can be found in `README.md` which is distributed with
# this script or can be found online at:
#
# https://git... | code_fim | hard | {
"lang": "python",
"repo": "sangh/ratelimit_multi_proc_py3",
"path": "/MultiProcRateLimit.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if cnt < allowed_times and time_called < t_since + per_secs:
conn.execute(
"UPDATE multi_proc_rate_limit SET count_int = "
"%r WHERE id = %r;" % (cnt + 1, rl_id)
).close()
else:
... | code_fim | hard | {
"lang": "python",
"repo": "sangh/ratelimit_multi_proc_py3",
"path": "/MultiProcRateLimit.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if Id == 50.:
Te_data = Te_data_50A[~np.isnan(Te_data_50A[:,idxTe+4])][:,[0,idxTe+4]]
phip_data = Te_data_50A[~np.isnan(Te_data_50A[:,idxTe+1])][:,[0,idxTe+1]]
master_Te_positional.append(np.copy(Te_data))
master_Te_average.append(np.nan)
master_phi.append(np.... | code_fim | hard | {
"lang": "python",
"repo": "eppdyl/cathode-database",
"path": "/jpl/lab6-cathodes/1.5cm-cathode/data_to_csv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eppdyl/cathode-database path: /jpl/lab6-cathodes/1.5cm-cathode/data_to_csv.py
# MIT License
#
# Copyright (c) 2019-2021 Pierre-Yves Taunay
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... | code_fim | hard | {
"lang": "python",
"repo": "eppdyl/cathode-database",
"path": "/jpl/lab6-cathodes/1.5cm-cathode/data_to_csv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not port:
port = int(config.PORT)
uvicorn.run(
app,
host="0.0.0.0",
port=port,
log_level="info"
)
def main():
fire.Fire({
'start': start_server,
})
if __name__ == '__main__':
main()<|fim_prefix|># repo: williamfzc/glockr path... | code_fim | hard | {
"lang": "python",
"repo": "williamfzc/glockr",
"path": "/glockr/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: williamfzc/glockr path: /glockr/server.py
from fastapi import FastAPI
import uvicorn
import fire
from glockr.manager import GResourceManager
from glockr import config
# --- API below ---
# TODO API for updating resource?
app = FastAPI()
@app.get(config.ROUTER['heartbeat'])
def heartbeat():
... | code_fim | medium | {
"lang": "python",
"repo": "williamfzc/glockr",
"path": "/glockr/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_class3_ex4():
base_path = "../class3/exercises/exercise4/"
cmd_list = ["python", "exercise4.py"]
os.environ["PYTHONWARNINGS"] = "ignore::Warning"
std_out, std_err, return_code = subprocess_runner(cmd_list, exercise_dir=base_path)
assert return_code == 0
assert "{'arista1'... | code_fim | hard | {
"lang": "python",
"repo": "twin-bridges/nornir_course",
"path": "/tests/test_class3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twin-bridges/nornir_course path: /tests/test_class3.py
import os
from pathlib import Path
import pytest
from utilities import subprocess_runner
from utilities import gen_inventory_dict
import nornir
from nornir import InitNornir
NORNIR_LOGGING = {"enabled": False}
TEST_CASES = [
("../clas... | code_fim | hard | {
"lang": "python",
"repo": "twin-bridges/nornir_course",
"path": "/tests/test_class3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> base_path = "../class3/exercises/exercise6/"
cmd_list = ["python", "exercise6b.py"]
os.environ["PYTHONWARNINGS"] = "ignore::Warning"
std_out, std_err, return_code = subprocess_runner(cmd_list, exercise_dir=base_path)
assert return_code == 0
assert std_out.count("nxos1") == 3
a... | code_fim | hard | {
"lang": "python",
"repo": "twin-bridges/nornir_course",
"path": "/tests/test_class3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: candido00/Python path: /EXERCICIOS DE PYTHON/list01Ex07_2.py
soma = 0
vnum = []
x=int(input("Digite um número diferente de 0: \n"))
<|fim_suffix|>maior = max(vnum)
menor = min(vnum)
print("o vetor é =", vnum)
print("o maior valor é =", maior)
print("o menor valor é =", menor)
print("o valor da ... | code_fim | medium | {
"lang": "python",
"repo": "candido00/Python",
"path": "/EXERCICIOS DE PYTHON/list01Ex07_2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>maior = max(vnum)
menor = min(vnum)
print("o vetor é =", vnum)
print("o maior valor é =", maior)
print("o menor valor é =", menor)
print("o valor da soma é =", soma)<|fim_prefix|># repo: candido00/Python path: /EXERCICIOS DE PYTHON/list01Ex07_2.py
soma = 0
vnum = []
x=int(input("Digite um número diferen... | code_fim | medium | {
"lang": "python",
"repo": "candido00/Python",
"path": "/EXERCICIOS DE PYTHON/list01Ex07_2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def send_mail(text, title="爬虫出现错误!"):
from app.config.secure import mail_sender, mail_host, mail_license, mail_receivers
mail_obj = AutoSendErrorMail(mail_host, mail_sender, mail_license, mail_receivers, text)
mail_obj.send_email(title)<|fim_prefix|># repo: michaelfyc/ASoulCnki path: /app/lib... | code_fim | hard | {
"lang": "python",
"repo": "michaelfyc/ASoulCnki",
"path": "/app/lib/mail.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mm = MIMEMultipart('related')
# 邮件主题
subject_content = title
# 设置发送者,注意严格遵守格式,里面邮箱为发件人邮箱
mm["From"] = "AsoulCnki<{}>".format(self.mail_sender)
# 设置接受者,注意严格遵守格式,里面邮箱为接受者邮箱
mm["To"] = "AsoulCnki_Receiver<{}>".format(self.mail_receivers[0])
# 设置... | code_fim | hard | {
"lang": "python",
"repo": "michaelfyc/ASoulCnki",
"path": "/app/lib/mail.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michaelfyc/ASoulCnki path: /app/lib/mail.py
import smtplib
from email.header import Header
# 负责构造图片
# 负责将多个对象集合起来
from email.mime.multipart import MIMEMultipart
# 负责构造文本
from email.mime.text import MIMEText
class AutoSendErrorMail:
<|fim_suffix|> mm = MIMEMultipart('related')
# 邮... | code_fim | hard | {
"lang": "python",
"repo": "michaelfyc/ASoulCnki",
"path": "/app/lib/mail.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoshuaJakowlew/vk-findme path: /app/base_dumper.py
class BaseDumper:
"""Interface for photo dumpers"""
def __init__(self, ctx):
self._ctx = ctx
def get_photos(self, user_id):
"""Recieves friend's photos
Recieves and parses friends photos
Select... | code_fim | hard | {
"lang": "python",
"repo": "JoshuaJakowlew/vk-findme",
"path": "/app/base_dumper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
sizes: "sizes" array from VK photo object
(see https://vk.com/dev/objects/photo)
Returns:
biggest photo's url
"""
max_size = 0
photo = ''
for size in sizes:
w = size['width']
h = size['he... | code_fim | hard | {
"lang": "python",
"repo": "JoshuaJakowlew/vk-findme",
"path": "/app/base_dumper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _method(self, output_layer):
raise NotImplementedError("Set in subclass.")
def _assert(self, method, network, x, explanation):
pass
def _apply_test(self, method, network):
# Get explainer.
computer = method(network["out"])
# Dryrun.
x = np.... | code_fim | hard | {
"lang": "python",
"repo": "Huiqi-Deng/nn-patterns",
"path": "/nn_patterns/utils/tests/dryrun.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _assert(self, method, network, x, explanation):
pass
def _apply_test(self, method, network):
# Get explainer.
computer = method(network["out"])
# Dryrun.
x = np.random.rand(10, *(network["input_shape"][1:]))
patterns = computer.compute_patterns(... | code_fim | hard | {
"lang": "python",
"repo": "Huiqi-Deng/nn-patterns",
"path": "/nn_patterns/utils/tests/dryrun.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Huiqi-Deng/nn-patterns path: /nn_patterns/utils/tests/dryrun.py
# Begin: Python 2/3 compatibility header small
# Get Python 3 functionality:
from __future__ import\
absolute_import, print_function, division, unicode_literals
from future.utils import raise_with_traceback, raise_from
# catch ex... | code_fim | hard | {
"lang": "python",
"repo": "Huiqi-Deng/nn-patterns",
"path": "/nn_patterns/utils/tests/dryrun.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ouranoshong/errbot-backend-lark path: /tests/_lark_tests/lark_server_test.py
from _lark.lark_server import LarkServer
from sanic import Sanic
from sanic_testing import TestManager
import unittest
class LarkServerTests(unittest.TestCase):
_app: Sanic
def setUp(self):
self._conf... | code_fim | hard | {
"lang": "python",
"repo": "ouranoshong/errbot-backend-lark",
"path": "/tests/_lark_tests/lark_server_test.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handler(data: dict):
return data.get("schema", "")
self._server.update_event_handlers({"im.message.receive_v1": handler})
_, response = self._app.test_client.post(
"/",
json={
"schema": "2.0",
"header": {
... | code_fim | hard | {
"lang": "python",
"repo": "ouranoshong/errbot-backend-lark",
"path": "/tests/_lark_tests/lark_server_test.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testUrlVerify(self):
request, response = self._app.test_client.post(
"/",
json={
"challenge": "ajls384kdjx98XX",
"token": self._config.get("verification_token"),
"type": "url_verification"
})
self.... | code_fim | hard | {
"lang": "python",
"repo": "ouranoshong/errbot-backend-lark",
"path": "/tests/_lark_tests/lark_server_test.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>## kb.tell(expr("Contract(NewNew)"))
## kb.tell(expr("Type(Tongwon)"))
## kb.tell(expr("Paytype(Drug)"))
## kb.tell(expr("Hospital(Small)"))
self.kb.tell(expr(query))
def ask(self,query):
x=self.kb.ask(expr(query))
return x
##
# wb=Insurance()
# wb... | code_fim | hard | {
"lang": "python",
"repo": "harp3133t/Graduationproject",
"path": "/uploads/core/Process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ask(self,query):
x=self.kb.ask(expr(query))
return x
##
# wb=Insurance()
# wb.tell(expr("Contract(Old)"))
# wb.tell(expr("Type(Tongwon)"))
# x=wb.ask(expr("Pay(small,big,day,count)"))
# print x<|fim_prefix|># repo: harp3133t/Graduationproject path: /uploads/core/Process.py
from p... | code_fim | hard | {
"lang": "python",
"repo": "harp3133t/Graduationproject",
"path": "/uploads/core/Process.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harp3133t/Graduationproject path: /uploads/core/Process.py
from process.logic import *
class Insurance:
def __init__(self):
self.kb=FolKB()
self.kb.tell(expr("(Contract(Old) & Type(Tongwon)) ==> Pay(0,3000000,180,Free)"))
self.kb.tell(expr("(Contract(Old) & Type(Ipwo... | code_fim | hard | {
"lang": "python",
"repo": "harp3133t/Graduationproject",
"path": "/uploads/core/Process.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.isGPU:
Xs_var = Xs_var.cpu()
output_var = output_var.cpu()
probs, predictions = torch.max(output_var, 1)
probs = probs.data.numpy()
predictions = predictions.data.numpy()
print("|===============... | code_fim | hard | {
"lang": "python",
"repo": "sjk0709/PaintCode_classification",
"path": "/PaintCode_classification/PaintCode_pyQt/paintCode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sjk0709/PaintCode_classification path: /PaintCode_classification/PaintCode_pyQt/paintCode.py
# -*- coding: utf-8 -*-
"""
"""
import sys, os
sys.path.append(os.pardir) # parent directory
# --------------------------------------------------
# PyQt5, exit code 1 (To catch the exceptions)... | code_fim | hard | {
"lang": "python",
"repo": "sjk0709/PaintCode_classification",
"path": "/PaintCode_classification/PaintCode_pyQt/paintCode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erikwii/sscode path: /new.py
import random
import os
import cv2
import numpy as np
from matplotlib import pyplot as plt
from group_beat import *
from group_pitch import *
# randi = [
# random.sample(range(0,49), 40), # whole
# random.sample(range(0,449), 40), # half
# random.... | code_fim | hard | {
"lang": "python",
"repo": "erikwii/sscode",
"path": "/new.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>randi = [
random.sample(range(0, 173), 20), # c1
random.sample(range(0, 255), 20), # d1
random.sample(range(0, 398), 20), # e1
random.sample(range(0, 366), 20), # f1
random.sample(range(0, 371), 20), # g1
random.sample(range(0, 427), 20), # a1
random.sample(range(0, 366),... | code_fim | hard | {
"lang": "python",
"repo": "erikwii/sscode",
"path": "/new.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sango09/senasoft path: /backend/apis/medic/views/exams.py
"""Vista de examenes medicos"""
# Django REST Framework
from rest_framework import generics
# Serializer
from apis.medic.serializers import ExamModelSerializer
# Modelos
from apis.medic.models import Exams
<|fim_suffix|> """View set... | code_fim | easy | {
"lang": "python",
"repo": "sango09/senasoft",
"path": "/backend/apis/medic/views/exams.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ExamsViewSet(generics.GenericAPIView):
"""View set de los examenes medicos"""
queryset = Exams.objects.all()
serializer_class = ExamModelSerializer<|fim_prefix|># repo: sango09/senasoft path: /backend/apis/medic/views/exams.py
"""Vista de examenes medicos"""
# Django REST Framework
fr... | code_fim | easy | {
"lang": "python",
"repo": "sango09/senasoft",
"path": "/backend/apis/medic/views/exams.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ricardo64/Over-100-Exercises-Python-and-Algorithms path: /src/examples_in_my_book/trees/traversals/BST_with_Nodes_traversal.py
#!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
from BST_with_Nodes import BSTwithNodes, Node
class BSTTraversal(BSTwithNodes):
def __init__(se... | code_fim | hard | {
"lang": "python",
"repo": "ricardo64/Over-100-Exercises-Python-and-Algorithms",
"path": "/src/examples_in_my_book/trees/traversals/BST_with_Nodes_traversal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def DFS_postorder(self, node):
if node is not None:
self.DFS_postorder(node.left)
self.DFS_postorder(node.right)
self.nodes_DFS_post.append(node.value)
return self.nodes_DFS_post
def main():
tree = BSTTraversal()
l1 = [10, 5,... | code_fim | hard | {
"lang": "python",
"repo": "ricardo64/Over-100-Exercises-Python-and-Algorithms",
"path": "/src/examples_in_my_book/trees/traversals/BST_with_Nodes_traversal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uSpike/ansible-discover path: /test/unit/entity/role/test_meta.py
import os
import pytest
from ansiblediscover.entity.role import Meta
@pytest.mark.parametrize('content, expected_dependencies', [
(None, []),
({}, []),
({'foobar': None}, []),
({'foobar': ['something']}, []),
... | code_fim | medium | {
"lang": "python",
"repo": "uSpike/ansible-discover",
"path": "/test/unit/entity/role/test_meta.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_path_main():
path = os.path.join('path', 'to', 'my', 'role')
assert os.path.join(path, 'meta', 'main.yml') == Meta.main_path(path)<|fim_prefix|># repo: uSpike/ansible-discover path: /test/unit/entity/role/test_meta.py
import os
import pytest
from ansiblediscover.entity.role import Met... | code_fim | medium | {
"lang": "python",
"repo": "uSpike/ansible-discover",
"path": "/test/unit/entity/role/test_meta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_path_main():
path = os.path.join('path', 'to', 'my', 'role')
assert os.path.join(path, 'meta', 'main.yml') == Meta.main_path(path)<|fim_prefix|># repo: uSpike/ansible-discover path: /test/unit/entity/role/test_meta.py
import os
import pytest
from ansiblediscover.entity.role import Meta... | code_fim | medium | {
"lang": "python",
"repo": "uSpike/ansible-discover",
"path": "/test/unit/entity/role/test_meta.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def verify_signature(m_public_key, signature, message):
public_key_bytes = base58.b58decode(m_public_key)
signature_bytes = base58.b58decode(signature)
message_bytes = signed_data(message)
verified = curve.verifySignature(public_key_bytes, message.encode(), signature_bytes) == 0
... | code_fim | medium | {
"lang": "python",
"repo": "amrbz/alexa",
"path": "/parser/api/v1/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def signed_data(data):
prefix = 'chainify'
return str_with_length(prefix) + str_with_length(data)
def verify_signature(m_public_key, signature, message):
public_key_bytes = base58.b58decode(m_public_key)
signature_bytes = base58.b58decode(signature)
message_bytes = signed_data(messag... | code_fim | medium | {
"lang": "python",
"repo": "amrbz/alexa",
"path": "/parser/api/v1/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amrbz/alexa path: /parser/api/v1/utils.py
import base58
import base64
import os
import pywaves.crypto as crypto
import axolotl_curve25519 as curve
def str_with_length(string_data):
string_length_bytes = len(string_data).to_bytes(2, byteorder='big')
string_bytes = string_data.encode('utf-... | code_fim | medium | {
"lang": "python",
"repo": "amrbz/alexa",
"path": "/parser/api/v1/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitchgu/TAMProxy-pyHost path: /tamproxy/devices/servo.py
from .device import Device
from .. import config as c
class Servo(Device):
DEVICE_CODE = c.devices.servo.code
WRITE_CODE = c.devices.servo.write_code
def __init__(self, tamproxy, pwm_pin, lower_uS=544, upper_uS=2400):
... | code_fim | hard | {
"lang": "python",
"repo": "mitchgu/TAMProxy-pyHost",
"path": "/tamproxy/devices/servo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def write_microseconds(self, uS):
self.tamp.send_request(self.id,
self.WRITE_CODE +
chr((int(uS) >> 8) & 0xFF) +
chr(int(uS) & 0xFF))<|fim_prefix|># repo: mitchgu/TAMProxy-pyHost path: /tamproxy/de... | code_fim | hard | {
"lang": "python",
"repo": "mitchgu/TAMProxy-pyHost",
"path": "/tamproxy/devices/servo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JonathonReinhart/scuba path: /tests/test_config.py
test_load_config_image_from_yaml_missing_file(self):
"""load_config raises ConfigError when !from_yaml references nonexistant file"""
with open(".scuba.yml", "w") as f:
f.write("image: !from_yaml .NONEXISTANT.yml image... | code_fim | hard | {
"lang": "python",
"repo": "JonathonReinhart/scuba",
"path": "/tests/test_config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """docker_args of incorrect type raises ConfigError"""
with open(".scuba.yml", "w") as f:
f.write(
r"""
image: na
docker_args: 666
"""
)
self._invalid_config("must be a string")
def test_d... | code_fim | hard | {
"lang": "python",
"repo": "JonathonReinhart/scuba",
"path": "/tests/test_config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JonathonReinhart/scuba path: /tests/test_config.py
oad_config(".scuba.yml")
assert config.hooks.get("root") == [
'echo "This runs before we switch users"',
"id",
]
assert config.hooks.get("user") == ["id"]
def test_hooks_invalid_list(self):
... | code_fim | hard | {
"lang": "python",
"repo": "JonathonReinhart/scuba",
"path": "/tests/test_config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>sol_mass = 1.98855e33
sol_lum = 3.828e33
sol_rschw = 2 * cgs_graw * sol_mass / cgs_c**2
sol_mdot_crit = 4 * cgs_pi * (cgs_graw * sol_mass) / (cgs_c * cgs_kapes)
sol_mdot_edd = 12 * sol_mdot_crit
sol_facc_edd = 3 * cgs_graw * sol_mass * sol_mdot_edd \
/ ( 8 * cgs_pi * sol_rschw**3 )
sol_omega = s... | code_fim | medium | {
"lang": "python",
"repo": "gronki/diskvert-old3",
"path": "/python/diskvert/cgs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gronki/diskvert-old3 path: /python/diskvert/cgs.py
from math import atan,sqrt
cgs_pi = 4*atan(1.0)
cgs_boltz = 1.3806581212e-16
cgs_c = 2.99792458e10
cgs_h = 6.62607554040e-27
cgs_graw = 6.67259858585e-8
cgs_mel = 9.10938975454e-28
cgs_hbar = cgs_h / (2*cgs_pi)
cgs_stef = 2 * cgs_pi**5 * cgs_bol... | code_fim | medium | {
"lang": "python",
"repo": "gronki/diskvert-old3",
"path": "/python/diskvert/cgs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Pony(app)
login_manager = LoginManager(app)
login_manager.login_view = 'login'
@login_manager.user_loader
def load_user(user_id):
return db.User.get(id=user_id)<|fim_prefix|># repo: ponyorm/pony path: /pony/flask/example/app.py
from flask import Flask
from flask_login import LoginManager
from pony.f... | code_fim | easy | {
"lang": "python",
"repo": "ponyorm/pony",
"path": "/pony/flask/example/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ponyorm/pony path: /pony/flask/example/app.py
from flask import Flask
from flask_login import LoginManager
from pony.flask import Pony
from .config import config
from .models import db
<|fim_suffix|>@login_manager.user_loader
def load_user(user_id):
return db.User.get(id=user_id)<|fim_middle... | code_fim | medium | {
"lang": "python",
"repo": "ponyorm/pony",
"path": "/pony/flask/example/app.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_manager.user_loader
def load_user(user_id):
return db.User.get(id=user_id)<|fim_prefix|># repo: ponyorm/pony path: /pony/flask/example/app.py
from flask import Flask
from flask_login import LoginManager
from pony.flask import Pony
from .config import config
from .models import db
app = Flask(... | code_fim | medium | {
"lang": "python",
"repo": "ponyorm/pony",
"path": "/pony/flask/example/app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onnx/models path: /vision/classification/extract_imagenet.py
# SPDX-License-Identifier: Apache-2.0
"""Prepare the ImageNet dataset"""
import os
import argparse
import tarfile
import pickle
import gzip
from tqdm import tqdm
from mxnet.gluon.utils import check_sha1
_TARGET_DIR = os.path.expanduse... | code_fim | hard | {
"lang": "python",
"repo": "onnx/models",
"path": "/vision/classification/extract_imagenet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> tar_dir = os.path.expanduser(args.download_dir)
train_tar_fname = os.path.join(tar_dir, _TRAIN_TAR)
check_file(train_tar_fname, args.checksum, _TRAIN_TAR_SHA1)
val_tar_fname = os.path.join(tar_dir, _VAL_TAR)
check_file(val_tar_fname, args.checksum, _VAL_TAR_SHA1)
extract_train(tra... | code_fim | hard | {
"lang": "python",
"repo": "onnx/models",
"path": "/vision/classification/extract_imagenet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def max(self, *args, **kwargs):
return self._dataframe.__constructor__(
query_compiler=self._query_compiler.expanding_max(
self.axis, self.expanding_args, *args, **kwargs
)
)
def mean(self, *args, **kwargs):
return self._dataframe.__... | code_fim | hard | {
"lang": "python",
"repo": "modin-project/modin",
"path": "/modin/pandas/window.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modin-project/modin path: /modin/pandas/window.py
om modin.pandas.utils import cast_function_modin2pandas
from modin.error_message import ErrorMessage
@_inherit_docstrings(pandas.core.window.rolling.Window)
class Window(ClassLogger):
def __init__(
self,
dataframe,
wi... | code_fim | hard | {
"lang": "python",
"repo": "modin-project/modin",
"path": "/modin/pandas/window.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def kurt(self, **kwargs):
return self._aggregate("kurt", **kwargs)
def apply(
self,
func,
raw=False,
engine="cython",
engine_kwargs=None,
args=None,
kwargs=None,
):
func = cast_function_modin2pandas(func)
return s... | code_fim | hard | {
"lang": "python",
"repo": "modin-project/modin",
"path": "/modin/pandas/window.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> callback_url = url_for('oauthorized', next=request.args.get('next'))
return twitter.authorize(callback=callback_url or request.referrer or None)
@app.route('/logout')
def logout():
session.pop('twitter_oauth', None)
return redirect(url_for('index'))
@app.route('/oauthorized')
def oauth... | code_fim | hard | {
"lang": "python",
"repo": "iAmMrinal0/Tweet_Search_and_Destroy",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if g.user is None:
return redirect(url_for('login', next=request.url))
ids = request.form.getlist('tweet_id')
if not ids:
return redirect(url_for('index'))
for tweet_id in ids:
resp = twitter.post('statuses/destroy/{0}.json'.format(tweet_id))
if resp.status ... | code_fim | hard | {
"lang": "python",
"repo": "iAmMrinal0/Tweet_Search_and_Destroy",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iAmMrinal0/Tweet_Search_and_Destroy path: /main.py
from flask import Flask
from flask import (flash, g, redirect, render_template,
request, session, url_for)
from twitter import twitter
app = Flask(__name__)
app.debug = True
app.secret_key = 'development'
@app.before_request... | code_fim | hard | {
"lang": "python",
"repo": "iAmMrinal0/Tweet_Search_and_Destroy",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wrapp/txwebretry path: /txwebretry.py
''' txwebretry - retry mechanisms for web requests.
Utilities for automatically retrying web requests made with twisted.web.client.
Usage:
>>> # GET localhost:8080 up to 3 times with exponential backoff
>>> d = retry3_exponential(treq.get, 'http://localhos... | code_fim | hard | {
"lang": "python",
"repo": "wrapp/txwebretry",
"path": "/txwebretry.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' Returns a Retry context that will retry calls immediately. '''
return Retry(repeat, 0, attempts)
def ExponentialBackoffRetry(attempts=3):
''' Returns a Retry context that will retry calls using exponential
backoff. '''
return Retry(simpleBackoffIterator, attempts)
# For conve... | code_fim | hard | {
"lang": "python",
"repo": "wrapp/txwebretry",
"path": "/txwebretry.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> all_len = min(len(arg)for arg in args.input)
aas = [set() for pos in range(all_len)]
for seq in args.input:
for pos in range(all_len):
aas[pos].add(seq[pos])
result = ""
for pos in range(all_len):
if len(aas[pos]) == 1:
result += "".join(list(aas... | code_fim | medium | {
"lang": "python",
"repo": "acorg/seqdb",
"path": "/bin/seq-aa-regex-gen.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acorg/seqdb path: /bin/seq-aa-regex-gen.py
#! /usr/bin/env python3
# -*- Python -*-
"""
Generates regex to match all the strings.
"""
import sys, os, traceback, pprint
if sys.version_info.major != 3: raise RuntimeError("Run script with python3")
from pathlib import Path
sys.path[:0] = [str(Path... | code_fim | hard | {
"lang": "python",
"repo": "acorg/seqdb",
"path": "/bin/seq-aa-regex-gen.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = argparse.ArgumentParser(description='Prerequisite prediction')
parser.add_argument('-dataset', type=str, required=True)
parser.add_argument('-alpha', type=float, default=0.3)
parser.add_argument('-seed', type=int, default=0)
args = parser.parse_args()
ass... | code_fim | hard | {
"lang": "python",
"repo": "luogan1234/prerequisite-prediction-co-training",
"path": "/build_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luogan1234/prerequisite-prediction-co-training path: /build_graph.py
import numpy as np
import argparse
import json
from collections import Counter
import math
import random
import tqdm
import os
def add_edge(graph, c1s, c2s, d):
if c1s and c2s:
d /= max(len(c1s), len(c2s)... | code_fim | hard | {
"lang": "python",
"repo": "luogan1234/prerequisite-prediction-co-training",
"path": "/build_graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_config(config=None):
"""
Return config class
:param config : Object - The configuration module containing the eviroment object
"""
if not config:
import config
return getattr(config, get_env())
# ---------------------------------------------------------------------... | code_fim | hard | {
"lang": "python",
"repo": "shtakai/pylot",
"path": "/pylot/app_templates/init.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shtakai/pylot path: /pylot/app_templates/init.py
# ------------------------------------------------------------------------------
# ENVIRONMENT FOR CONFIG
# Pylot uses configuration class by default, ie: Production(), Development(), (Staging()).
# To switch from one config to another based on th... | code_fim | hard | {
"lang": "python",
"repo": "shtakai/pylot",
"path": "/pylot/app_templates/init.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Footer links
INFO_LINK = "/r/TotesMessenger"
CONTACT_LINK = "/message/compose?to=/r/TotesMessenger"
TRANSLATION_ERROR_LINK = CONTACT_LINK + "&subject=translation error " \
"({language}\)"<|fim_prefix|># repo: justcool393/TotesMessenger path: /settings.py
from os ... | code_fim | hard | {
"lang": "python",
"repo": "justcool393/TotesMessenger",
"path": "/settings.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justcool393/TotesMessenger path: /settings.py
from os import environ
# Testing and debug settings
TEST = environ.get("TEST", "false") == "true"
DEBUG = environ.get("DEBUG", "false") == "true"
<|fim_suffix|># Database file
DB_FILE = environ.get("DATABASE", "totes.sqlite3")
# Posting settings
PO... | code_fim | medium | {
"lang": "python",
"repo": "justcool393/TotesMessenger",
"path": "/settings.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dinomitedude/utilities path: /math/units.py
#!/anaconda2/bin/python
class Units( object):
def __init__( self, unitstring, inverse=False, chars=3):
self.top = unitstring[:chars]
self.bot = unitstring[chars:]
self.inv = inverse
if self.inv: self.inverse()
... | code_fim | hard | {
"lang": "python",
"repo": "dinomitedude/utilities",
"path": "/math/units.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #create currency trading pairs
one,two,three='btcusd','btceur','eurusd'
#initialize units
oneInst = Units(one,True)
twoInst = Units(two)
threeInst = Units(three)
#convert units for one and two
conversion = Units.compute([oneInst,twoInst])
print 'one * two: {}'.format(co... | code_fim | medium | {
"lang": "python",
"repo": "dinomitedude/utilities",
"path": "/math/units.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cognition-gis/cognition-disaster-data path: /disaster_data/utils.py
import os
from multiprocessing.pool import ThreadPool
from osgeo import gdal
def gdal_info_stac(input_item):
"""
Return incomplete STAC item from call to gdal.Info
"""
file_url = os.path.join("/vsicurl/" + inpu... | code_fim | medium | {
"lang": "python",
"repo": "cognition-gis/cognition-disaster-data",
"path": "/disaster_data/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Merge the input STAC item (generated from Scrapy) with partial STAC item (from gdal.Info)
merged = {**partial_item, **input_item['item']}
merged['properties'].update(partial_item['properties'])
return {'parent': input_item['parent'], 'item': merged}
def gdal_info_stac_multi(filelist, n... | code_fim | hard | {
"lang": "python",
"repo": "cognition-gis/cognition-disaster-data",
"path": "/disaster_data/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mingxiaoh/chainercv path: /chainercv/datasets/sbd/sbd_instance_segmentation_dataset.py
import numpy as np
import os
import warnings
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.datasets.sbd import sbd_utils
from chainercv.datasets.voc import voc_uti... | code_fim | hard | {
"lang": "python",
"repo": "mingxiaoh/chainercv",
"path": "/chainercv/datasets/sbd/sbd_instance_segmentation_dataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_id = self.ids[i]
label_img, inst_img = self._load_label_inst(data_id)
mask, label = voc_utils.image_wise_to_instance_wise(
label_img, inst_img)
return mask, label
def _load_label_inst(self, data_id):
label_file = os.path.join(
self.... | code_fim | hard | {
"lang": "python",
"repo": "mingxiaoh/chainercv",
"path": "/chainercv/datasets/sbd/sbd_instance_segmentation_dataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_enthusiasms.py
from xai.brain.wordbase.nouns._enthusiasm import _ENTHUSIASM
<|fim_suffix|> _ENTHUSIASM.__init__(self)
self.name = "ENTHUSIASMS"
self.specie = 'nouns'
self.basic = "enthusiasm"
self.jsondata = {}<|fim_middle|>#calss header
c... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_enthusiasms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _ENTHUSIASM.__init__(self)
self.name = "ENTHUSIASMS"
self.specie = 'nouns'
self.basic = "enthusiasm"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_enthusiasms.py
from xai.brain.wordbase.nouns._enthusiasm import _ENTHUSIASM
<|fim_middle|>#calss header
c... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_enthusiasms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saadsaifse/flight-analysis path: /movement_analysis/movement_analysis_dialog_results.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'movement_analysis_dialog_results.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will... | code_fim | hard | {
"lang": "python",
"repo": "saadsaifse/flight-analysis",
"path": "/movement_analysis/movement_analysis_dialog_results.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def retranslateUi(self, AnimalMovementAnalysisDialogBase):
_translate = QtCore.QCoreApplication.translate
AnimalMovementAnalysisDialogBase.setWindowTitle(_translate("AnimalMovementAnalysisDialogBase", "Animal Movement Analysis"))
self.label.setText(_translate("AnimalMovementAna... | code_fim | hard | {
"lang": "python",
"repo": "saadsaifse/flight-analysis",
"path": "/movement_analysis/movement_analysis_dialog_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :raises CoreNotImplementedError: core not implemented error.
:rtype: bool
"""
raise CoreNotImplementedError()<|fim_prefix|># repo: mononobi/pyrin path: /src/pyrin/database/interface.py
# -*- coding: utf-8 -*-
"""
database interface module.
"""
from abc import abstractme... | code_fim | medium | {
"lang": "python",
"repo": "mononobi/pyrin",
"path": "/src/pyrin/database/interface.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.