text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
# 'period' type input parameter ================================================
class PeriodWidget(wx.Panel):
def __init__(self, *a, **k):
wx.Panel.__init__(self, *a, **k)
self.period_from = DateWidget(self, style=wx.DP_DROPDOWN|wx.DP_SHOWCENTURY)
self.period_to = DateWidget... | code_fim | hard | {
"lang": "python",
"repo": "ricpol/quickreport",
"path": "/quickreport/param_types.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ricpol/quickreport path: /quickreport/param_types.py
'date', 'period',
'month', 'bimester', 'trimester', 'quadrimester', 'semester']
# 'text' type input parameter =================================================
class TextWidget(wx.TextCtrl):
def __init__(self, *a, **k):
... | code_fim | hard | {
"lang": "python",
"repo": "ricpol/quickreport",
"path": "/quickreport/param_types.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> def SetValue(self, val):
if val is None:
wx.ComboBox.SetSelection(self, -1)
return
wx.ComboBox.SetSelection(self, self.ids.index(val))
def GetValue(self):
return self.ids[self.GetSelection()]
def droplist(parent, use_id=False):
if use... | code_fim | hard | {
"lang": "python",
"repo": "ricpol/quickreport",
"path": "/quickreport/param_types.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|>subset1_smaller=data [ numpy.where( data[:,0]<x ) ]
subset1_larger= data [ numpy.where( data[:,0]>=x ) ]
print (data [ numpy.where( data[:,0]>x ) ])
#print data[:,0]
x,y=numpy.median(subset1_smaller, 0)
print ("-----------------------")
print ( subset1_smaller[ numpy.where( subset1_sm... | code_fim | medium | {
"lang": "python",
"repo": "behnamasadi/OpenCVProjects",
"path": "/scripts/shape_analysis/kdtree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: behnamasadi/OpenCVProjects path: /scripts/shape_analysis/kdtree.py
import numpy as numpy
data=numpy.array([ [1,9] , [2,3] , [4,1] , [3,7] , [5,4] , [6,8] ,[7,2] , [8,8] , [7,9] , [9,6] ] )
#print data.shape
x,y=numpy.median(data, 0)
#print numpy.median(data, 0)
#print numpy.median(dat... | code_fim | hard | {
"lang": "python",
"repo": "behnamasadi/OpenCVProjects",
"path": "/scripts/shape_analysis/kdtree.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print ("-----------------------")
print ( subset1_smaller[ numpy.where( subset1_smaller[:,1]<y ) ])
print ("-----------------------")
print (subset1_smaller[ numpy.where( subset1_smaller[:,1]>=y ) ])
x,y=numpy.median(subset1_larger, 0)
print ("-----------------------")
print (subset1_larger[ nump... | code_fim | hard | {
"lang": "python",
"repo": "behnamasadi/OpenCVProjects",
"path": "/scripts/shape_analysis/kdtree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ishuca/hvass-lab path: /cache.py
########################################################################
#
# 함수나 클래스의 Cache-wrapper
#
# 하드 디스크에 객체 인스턴트를 만들거나 함수 호출 결과를 저장.
# 데이터를 지속적으로 쓴다면 매우 빠르고 쉽게 불러올 수 있다.
#
# Implemented in Python 3.5
#
#######################################################... | code_fim | hard | {
"lang": "python",
"repo": "ishuca/hvass-lab",
"path": "/cache.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
넘파이 파일을 피클로 바꿈
자료를 저장하기 위해 넘파이를 사용한 캐쉬 함수의 첫번째 버젼
모든 자료는 재계산되는 대신에, 이 함수를 사용해 캐쉬 파일로 바꿀 수 있다
:param in_path:
numpy.save()를 사용해 쓰여진 넘파일 포맷의 입력 파일
:param out_path:
피클 파일로 쓰여진 출력 파일
:return:
없음
"""
# 넘파이를 사용해 데이터를 불러온다
data = np.load(in... | code_fim | hard | {
"lang": "python",
"repo": "ishuca/hvass-lab",
"path": "/cache.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sha_page_html = render(template, {
'username': username,
'state': state,
'redirect': redirect,
'blob': blob,
'comments': comments
})
return {"html": sha_page_html, 'cookie': cookie}
def get_comments(sha):
try:
items = dynamo_client.query(
TableName='gitshame-posts',... | code_fim | medium | {
"lang": "python",
"repo": "dminnear/gitshame",
"path": "/lambdas/sha_page/sha_page.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dminnear/gitshame path: /lambdas/sha_page/sha_page.py
from common.common import *
import os
import re
template = 'common/templates/sha_page.template'
def handler(event, context):
sha = event['sha']
redirect = "https://gitshame.xyz/blob/%s" % sha
username, state, cookie = github_oauth(eve... | code_fim | medium | {
"lang": "python",
"repo": "dminnear/gitshame",
"path": "/lambdas/sha_page/sha_page.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {"html": sha_page_html, 'cookie': cookie}
def get_comments(sha):
try:
items = dynamo_client.query(
TableName='gitshame-posts',
IndexName='sha-timestamp-index',
Limit=20,
ScanIndexForward=False,
ProjectionExpression='post',
KeyConditionExpression='sha = :... | code_fim | medium | {
"lang": "python",
"repo": "dminnear/gitshame",
"path": "/lambdas/sha_page/sha_page.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/PLSC path: /plsc/scheduler/lr_scheduler.py
# Copyright (c) 2021 PaddlePaddle 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.
# You may obtain a copy of the License at
... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PLSC",
"path": "/plsc/scheduler/lr_scheduler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> step_each_epoch,
epochs,
learning_rate,
warmup_steps=0,
warmup_epochs=0,
decay_unit='epoch',
warmup_start_lr=0.0,
warmup_end_lr=0.0,
last_epoch=-1,
... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PLSC",
"path": "/plsc/scheduler/lr_scheduler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeonMarqs/Curso-Em-Video-Python3 path: /MUNDO 3/AULAS/Aula18 - Listas 2.py
pessoas = [['João', 15],['Maria', 22], ['Messias', 35]]
print(pessoas[0][1])
print(pessoas[1][0])
print(pessoas[2][1])
print(pessoas)
print(pessoas[1])
#############################################################
... | code_fim | hard | {
"lang": "python",
"repo": "LeonMarqs/Curso-Em-Video-Python3",
"path": "/MUNDO 3/AULAS/Aula18 - Listas 2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for p in galera:
print(f'{p[0]} tem {p[1]} anos de idade')
##########################################################
galera2 = []
dado = []
menor = mai = 0
for c in range (0,3):
dado.append(str(input('Nome: ')))
dado.append(int(input('Idade: ')))
galera2.append(dado[:])
d... | code_fim | hard | {
"lang": "python",
"repo": "LeonMarqs/Curso-Em-Video-Python3",
"path": "/MUNDO 3/AULAS/Aula18 - Listas 2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# noinspection PyPep8Naming
class latest(BaseUse):
"""Returns the latest glucose entry from a sequence of glucose data"""
def main(self, args, app):
args, _ = self.get_program(self.get_params(args))
cleaned = clean_glucose(*args)
return cleaned[0] if len(cleaned) > 0 els... | code_fim | hard | {
"lang": "python",
"repo": "DOCProjectCatalogue/openaps-glucosetools",
"path": "/openapscontrib/glucosetools/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DOCProjectCatalogue/openaps-glucosetools path: /openapscontrib/glucosetools/__init__.py
"""
glucosetools - tools for cleaning, condensing, and reformatting history data
"""
from .version import __version__
import argparse
import json
from openaps.uses.use import Use
from glucose import clean... | code_fim | hard | {
"lang": "python",
"repo": "DOCProjectCatalogue/openaps-glucosetools",
"path": "/openapscontrib/glucosetools/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Resolve inconsistencies and ordering from a sequence of glucose data
Tasks performed by this pass:
- Removes unknown and erroneous data entries
- Re-sorts all known values in reverse-chronological order
"""
def main(self, args, app):
args, _ = self.get_program(self.get_params(arg... | code_fim | hard | {
"lang": "python",
"repo": "DOCProjectCatalogue/openaps-glucosetools",
"path": "/openapscontrib/glucosetools/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IsmaeRLGV/pyCoBot path: /modules/ping/ping.py
# -*- coding: utf-8 -*-
import time
import locale
class ping:
def __init__(self, core, client):
core.addCommandHandler("ping", self, chelp="Responde con pong.")
core.addCommandHandler("pong", self)
core.addCommandHandler... | code_fim | hard | {
"lang": "python",
"repo": "IsmaeRLGV/pyCoBot",
"path": "/modules/ping/ping.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def pingrep(self, client, event):
if not event.arguments[0] == "PING":
return 0
current_milli_time = int(round(time.time() * 1000))
diff = current_milli_time - int(event.arguments[1])
secs = locale.str(diff / 1000) # milisegudos -> segundos
client.m... | code_fim | hard | {
"lang": "python",
"repo": "IsmaeRLGV/pyCoBot",
"path": "/modules/ping/ping.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ohhorob/pyMTS path: /dumper.py
from __future__ import print_function, division
import struct
import sys
import io
import MTS
from MTS.Header import Header
from MTS.word.HeaderWord import HeaderWord
__author__ = 'rob'
def scan_to_headerword(serial_input, maximum_bytes=9999, header_magic=Heade... | code_fim | hard | {
"lang": "python",
"repo": "ohhorob/pyMTS",
"path": "/dumper.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
import tempfile
outwrapper = tempfile.NamedTemporaryFile(suffix='.ISP2', delete=False)
outwrapper.close()
outfile = io.open(outwrapper.name, mode='w+b')
print('Logging raw data to temp file: {}'.format(outwrapper.name), file=sys.stderr)
try:
# sca... | code_fim | hard | {
"lang": "python",
"repo": "ohhorob/pyMTS",
"path": "/dumper.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: interimblue/idp path: /code/4chan-scraper-api/4chan_catalog_scraper_simple.py
"""
Created on 26/05/2020
4chan-scraper v0.2
@author: Andrew Ellul
"""
<|fim_suffix|>### Get the 4chan board catalog JSON file and open it
url = "https://a.4cdn.org/" + board + "/catalog.json"
threadCatalog = requests.... | code_fim | medium | {
"lang": "python",
"repo": "interimblue/idp",
"path": "/code/4chan-scraper-api/4chan_catalog_scraper_simple.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>### Append serialized submission object to the end of the JSON file
with open(filename, 'a+') as f:
json.dump(threadCatalog, f)<|fim_prefix|># repo: interimblue/idp path: /code/4chan-scraper-api/4chan_catalog_scraper_simple.py
"""
Created on 26/05/2020
4chan-scraper v0.2
@author: Andrew Ellul
"""
im... | code_fim | hard | {
"lang": "python",
"repo": "interimblue/idp",
"path": "/code/4chan-scraper-api/4chan_catalog_scraper_simple.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>### File save settings
board = 'pol'
filename = board + '.json'
### Get the 4chan board catalog JSON file and open it
url = "https://a.4cdn.org/" + board + "/catalog.json"
threadCatalog = requests.get(url).json()
### Append serialized submission object to the end of the JSON file
with open(filename, 'a+... | code_fim | easy | {
"lang": "python",
"repo": "interimblue/idp",
"path": "/code/4chan-scraper-api/4chan_catalog_scraper_simple.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> register_types_func, engine_cls, sys_mod):
sys_mod.argv = []
gui_app = mock.MagicMock()
gui_app_cls.return_value = gui_app
event_loop = mock.MagicMock()
event_loop_cls.return_value = event_loop
engine = engine_cls.return_value
root_... | code_fim | hard | {
"lang": "python",
"repo": "robertmrk/aiocometd-chat-demo",
"path": "/tests/test_main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robertmrk/aiocometd-chat-demo path: /tests/test_main.py
from unittest import TestCase, mock
import aiocometd_chat_demo.__main__ as main
from aiocometd_chat_demo.chat_service import ChatService
from aiocometd_chat_demo.channels import ChannelsModel
from aiocometd_chat_demo.conversation import Con... | code_fim | hard | {
"lang": "python",
"repo": "robertmrk/aiocometd-chat-demo",
"path": "/tests/test_main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> register_type.assert_has_calls([
mock.call(ConversationModel, "ChatDemo", 1, 0, "Conversation"),
mock.call(ChatService, "ChatService", 1, 0, "ChatService")
], any_order=True)
register_uncreatable_type.assert_has_calls([
mock.call(ChannelsModel, "... | code_fim | hard | {
"lang": "python",
"repo": "robertmrk/aiocometd-chat-demo",
"path": "/tests/test_main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shankun/Base64Transcode path: /base64Encode.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
将XX.7z加密成base64文本,内容附加到系统剪贴板
"""
import base64
import os
import win32clipboard as wclb
import win32con
from datetime import date
import traceback
<|fim_suffix|> os.remove(fPath)
sCmd = r'G... | code_fim | hard | {
"lang": "python",
"repo": "shankun/Base64Transcode",
"path": "/base64Encode.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
return s.decode('utf-8')
except UnicodeDecodeError:
return s.decode('gbk')
if __name__ == '__main__':
main()<|fim_prefix|># repo: shankun/Base64Transcode path: /base64Encode.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
将XX.7z加密成base64文本,内容附加到系统剪贴板
"""
import ... | code_fim | hard | {
"lang": "python",
"repo": "shankun/Base64Transcode",
"path": "/base64Encode.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oaxiom/episcan path: /7.trees/GO/GO_heatmap_big.py
import glob, sys, os, math
from glbase3 import *
import matplotlib.cm as cm
config.draw_mode = 'pdf'
format = {'force_tsv': True, 'pvalue': 1, 'name': 0}
def get_clus_number(s):
return int(os.path.split(filename)[1].replace('.tsv', '').spl... | code_fim | medium | {
"lang": "python",
"repo": "oaxiom/episcan",
"path": "/7.trees/GO/GO_heatmap_big.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for item in top5:
if item['pvalue'] < 0.01:
if item['name'] not in go_store:
go_store[item['name']] = [-1] * num_clusters
go_store[item['name']][clus_number] = -math.log10(item['pvalue'])
# fill in the holes:
for filename in... | code_fim | hard | {
"lang": "python",
"repo": "oaxiom/episcan",
"path": "/7.trees/GO/GO_heatmap_big.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = plot_parameters()
# data -> epoch * (i_x_t, i_y_t, i_t_t)
data = _pickle.load(open(args.input, 'rb'))
mi = list(zip(*map(lambda el: (el[0], *el[1]), data.items())))
epochs, i_x_t, i_y_t, i_t_t = mi
plot_main(i_x_t, i_y_t, epoch=max(epochs), filename=args.output, show=True)
... | code_fim | hard | {
"lang": "python",
"repo": "etherandrius/information-networks",
"path": "/main_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('--output', dest='output', default=None,
help='output image file')
args = parser.parse_args()
args.output = output(args)
return args
def main():
args = plot_parameters()
# data -> epoch * (i_x_t, i_y_t, i_t_t)
data = _pickle.load(o... | code_fim | medium | {
"lang": "python",
"repo": "etherandrius/information-networks",
"path": "/main_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: etherandrius/information-networks path: /main_plot.py
import argparse
import _pickle
from plot.plot import plot_main
def output(args):
if args.output is not None:
return args.output
out = args.input.split('/')[-1].split('.')[0]
out = out[:-7] if out.endswith('_pickle') else ... | code_fim | hard | {
"lang": "python",
"repo": "etherandrius/information-networks",
"path": "/main_plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@base_blueprint.route('/')
def get_info():
current_app.logger.info('get_info')
query = 'SELECT version_num FROM alembic_version'
full_name = db.session.execute(query).fetchone()[0]
return jsonify(
environment=current_app.config['ENVIRONMENT'],
info=full_name,
commi... | code_fim | medium | {
"lang": "python",
"repo": "newacropolis-uk-website/api",
"path": "/app/rest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: newacropolis-uk-website/api path: /app/rest.py
from flask import Blueprint, jsonify, current_app
from app import db
from app.errors import register_errors
base_blueprint = Blueprint('', __name__)
register_errors(base_blueprint)
<|fim_suffix|> current_app.logger.info('get_info')
query =... | code_fim | medium | {
"lang": "python",
"repo": "newacropolis-uk-website/api",
"path": "/app/rest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hep-gc/cloudscheduler path: /utilities/watch_csv2
type'] == 'SQL':
p = Popen([
'mysql',
'-u',
gvar['db_config'].db_config['db_user'],
'-p%s' % gvar['db_config'].db_config['db_password'],
'-h%s' % gvar['db_... | code_fim | hard | {
"lang": "python",
"repo": "hep-gc/cloudscheduler",
"path": "/utilities/watch_csv2",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> del log_files
return maps
def maps_remap(gvar):
# log files have been rotated, reload the maps and re-align mix/fix.
return
def search_bwd(gvar):
fix = gvar['fix']
mix = gvar['mix']
while frame_bwd(gvar):
if ''.join(fra... | code_fim | hard | {
"lang": "python",
"repo": "hep-gc/cloudscheduler",
"path": "/utilities/watch_csv2",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hep-gc/cloudscheduler path: /utilities/watch_csv2
e path of the watch_csv2' \
'\n configuration file. This file specifies the' \
'\n commands and SQL select statements that are to' \
... | code_fim | hard | {
"lang": "python",
"repo": "hep-gc/cloudscheduler",
"path": "/utilities/watch_csv2",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(PSEnv, self).__init__()
self.server = websockets.serve(initialization, "localhost", 8765)
self.num_moves = 5 #4 + 1 for struggle. #TODO: Generalize this in the future
self.num_observations = 6 #HP, HP, 4 PPs
self.action_space = spaces.Discrete(num_moves) #TODO: see htt... | code_fim | hard | {
"lang": "python",
"repo": "mit-gfx/pokemon-showdown",
"path": "/envs/ps_env.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mit-gfx/pokemon-showdown path: /envs/ps_env.py
import gym
from gym import spaces
import asyncio
import websockets
initialized = False #TODO: find a way to move this into the class
_websocket = None
np_precision = np.float64
async def initialization(websocket, path):
'''
initialization ... | code_fim | hard | {
"lang": "python",
"repo": "mit-gfx/pokemon-showdown",
"path": "/envs/ps_env.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def step(self, action):
global _websocket
await _websocket.send(str(action))
state _websocket.recv() #this should get us the new state of the world, an observation of some sort
#TODO: parse observation
#TODO: create a new observation
#TODO: create a new reward based off what... | code_fim | hard | {
"lang": "python",
"repo": "mit-gfx/pokemon-showdown",
"path": "/envs/ps_env.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return directory_file_upload
return _directory_creator
@pytest.fixture
async def populate_directory(
create_file_of_size: Callable[[ByteSize, str | None], Path],
storage_s3_client: StorageS3Client,
storage_s3_bucket: S3BucketName,
project_id: ProjectID,
node_id: NodeID,
... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/services/storage/tests/unit/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture
async def populate_directory(
create_file_of_size: Callable[[ByteSize, str | None], Path],
storage_s3_client: StorageS3Client,
storage_s3_bucket: S3BucketName,
project_id: ProjectID,
node_id: NodeID,
) -> Callable[..., Awaitable[None]]:
async def _create_content(
... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/services/storage/tests/unit/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ITISFoundation/osparc-simcore path: /services/storage/tests/unit/conftest.py
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
# pylint: disable=unused-variable
import asyncio
import urllib.parse
from collections import deque
from collections.abc import AsyncIterator, Awai... | code_fim | hard | {
"lang": "python",
"repo": "ITISFoundation/osparc-simcore",
"path": "/services/storage/tests/unit/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akihikoy/lfd_trick path: /src/base/base_traj.py
#! /usr/bin/env python
#Basic tools (trajectory).
import numpy as np
import numpy.linalg as la
import math
import random
import copy
from base_util import *
from base_const import *
from base_geom import *
#Get a sequence of times, from 0 to dt inc... | code_fim | hard | {
"lang": "python",
"repo": "akihikoy/lfd_trick",
"path": "/src/base/base_traj.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Return interpolated value at t (cyclic version).
#pi: Phase information.
def EvaluateC(self, t, pi=None):
if pi==None:
n, tp= self.PhaseInfo(t)
else:
n, tp= pi
return self.Evaluate(tp) + n*(self.KeyPts[-1].X - self.KeyPts[0].X)
#data= [[t0,x0],[t1,x1],[t2,x2],...]
FINIT... | code_fim | hard | {
"lang": "python",
"repo": "akihikoy/lfd_trick",
"path": "/src/base/base_traj.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> where_imask = _imask_where(model_data, "foo", [val])
assertion = where_imask == result
if isinstance(result, list):
assertion = assertion.all()
assert assertion
def test_imask_where_not(self, model_data):
where_imask = _imask_where(model_data, "foo"... | code_fim | hard | {
"lang": "python",
"repo": "FLomb/calliope",
"path": "/calliope/test/test_backend_subsets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FLomb/calliope path: /calliope/test/test_backend_subsets.py
from itertools import chain, combinations
import pytest
import xarray as xr
import numpy as np
import pandas as pd
import calliope
from calliope.backend.subsets import (
create_valid_subset,
_param_exists,
_inheritance,
... | code_fim | hard | {
"lang": "python",
"repo": "FLomb/calliope",
"path": "/calliope/test/test_backend_subsets.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def globals(self, user):
"""Return user usage objects and method."""
objects = {
"history": History.objects(user=user),
"user": User.objects(id=user)
}
methods = {
"isonce": functools.partial(self.isonce, *[user]),
"last_... | code_fim | hard | {
"lang": "python",
"repo": "katsugeneration/chatql",
"path": "/src/chatql/mongodb_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: katsugeneration/chatql path: /src/chatql/mongodb_client.py
# coding=utf-8
#
# Licensed under the MIT License
"""MongoDB client for ChatQL."""
import mongoengine
import datetime
import json
import functools
class Scenario(mongoengine.Document):
"""Scenario Collection Class."""
attribute... | code_fim | hard | {
"lang": "python",
"repo": "katsugeneration/chatql",
"path": "/src/chatql/mongodb_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Create new user.
Return:
ID (str): new user id
"""
u = User(**option)
u.save()
return u
def get_user_attributes(self, user_id):
"""Get user attributes.
Args:
user_id (str): target user id
Return:
... | code_fim | hard | {
"lang": "python",
"repo": "katsugeneration/chatql",
"path": "/src/chatql/mongodb_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
fig.canvas.draw()
def on_key(event):
if event.key == 'up':
if ax.current_row < spec['order'].size-1:
ax.current_row += 1
plot_order()
elif event.key == 'down':
if ax.current_row > 0:
ax.current_row -= 1
... | code_fim | hard | {
"lang": "python",
"repo": "wangleon/gamse",
"path": "/gamse/echelle/plot.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangleon/gamse path: /gamse/echelle/plot.py
import numpy as np
import astropy.io.fits as fits
import matplotlib.pyplot as plt
import matplotlib.ticker as tck
def plot(filename):
f = fits.open(filename)
spec = f[1].data
head = f[1].header
f.close()
fig = plt.figure(figsize=(1... | code_fim | hard | {
"lang": "python",
"repo": "wangleon/gamse",
"path": "/gamse/echelle/plot.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if suite:
test_suites = []
for file in os.listdir('.'):
if self.suite_path in file:
if os.path.isdir(file):
test_suites.append(file)
for test_suite in test_suites:
self._collect_cases(c... | code_fim | hard | {
"lang": "python",
"repo": "sdwfclcyk1/AutoTestCase",
"path": "/Public/CaseStrategy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for test_suite in test_suites:
self._collect_cases(cases, top_dir=test_suite)
else:
self._collect_cases(cases, top_dir=None)
return cases<|fim_prefix|># repo: sdwfclcyk1/AutoTestCase path: /Public/CaseStrategy.py
import os
import unittest
class Ca... | code_fim | hard | {
"lang": "python",
"repo": "sdwfclcyk1/AutoTestCase",
"path": "/Public/CaseStrategy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdwfclcyk1/AutoTestCase path: /Public/CaseStrategy.py
import os
import unittest
class CaseStrategy:
def __init__(self):
self.suite_path = 'TestSuite_'
self.case_path = 'TestCase'
self.case_pattern = 'test*.py'
<|fim_suffix|> for test_suite in test_suites:... | code_fim | hard | {
"lang": "python",
"repo": "sdwfclcyk1/AutoTestCase",
"path": "/Public/CaseStrategy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paulthebaker/NX01 path: /NX01_singlePsr.py
)
pmin = np.append(pmin,0.001*np.ones(len(systems)))
pmax = np.append(pmax,10.0*np.ones(len(systems)))
if args.fullN:
pmin = np.append(pmin,-10.0*np.ones(len(systems)))
pmax = np.append(pmax,-3.0*np.ones(len(systems)))
if 'pta' in t2ps... | code_fim | hard | {
"lang": "python",
"repo": "paulthebaker/NX01",
"path": "/NX01_singlePsr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.incGlitch:
glitch_epoch = xx[ct]
glitch_lamp = xx[ct+1]
loglike1 = 0.
####################################
####################################
scaled_err = (psr.toaerrs).copy()
for jj,sysname in enumerate(systems):
scaled_err[systems[sysname]] *= ... | code_fim | hard | {
"lang": "python",
"repo": "paulthebaker/NX01",
"path": "/NX01_singlePsr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except np.linalg.LinAlgError:
#print 'Cholesky Decomposition Failed second time!! Using SVD instead'
#u,s,v = sl.svd(Sigma)
#expval2 = np.dot(v.T, 1/s*np.dot(u.T, d))
#logdet_Sigma = np.sum(np.log(s))
print 'Cholesky Decomposition Failed second time!! Getting ou... | code_fim | hard | {
"lang": "python",
"repo": "paulthebaker/NX01",
"path": "/NX01_singlePsr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hd23408/nist-synthetic-data-2021 path: /test/test_discretize.py
"""Test methods for the discretize and undiscretize methods
from util.py.
Typical usage example:
python -m unittest
or
python -m unittest -k test_discretize
"""
import unittest
import pathlib
import numpy as np
import pan... | code_fim | hard | {
"lang": "python",
"repo": "hd23408/nist-synthetic-data-2021",
"path": "/test/test_discretize.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Run the discretize function to produce an mbi.dataset
mbi_dataset = discretize(dataframe, schema, 200)
# Run the undo_discretize function on the results
undiscretized_dataset = undo_discretize(mbi_dataset, schema)
# Visually compare the original with the discretized / undiscretized... | code_fim | hard | {
"lang": "python",
"repo": "hd23408/nist-synthetic-data-2021",
"path": "/test/test_discretize.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NamPNQ/freight path: /bin/run-task
#!/usr/bin/env python
from __future__ import absolute_import, unicode_literals
import logging
import os
import sys
from datetime import datetime
from flask import current_app
from freight import providers, vcs
from freight.config import create_app, db, redis... | code_fim | hard | {
"lang": "python",
"repo": "NamPNQ/freight",
"path": "/bin/run-task",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> app = App.query.filter(App.id == task.app_id).first()
repo = Repository.query.filter(Repository.id == app.repository_id).first()
task.date_started = datetime.utcnow()
task.status = TaskStatus.in_progress
db.session.add(task)
db.session.commit()
provider = providers.get(task.p... | code_fim | medium | {
"lang": "python",
"repo": "NamPNQ/freight",
"path": "/bin/run-task",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> lq = K.sqrt(K.sum(K.square(y_true[:,:] - y_pred[:,:]), axis=1, keepdims=True))
#return (50 * lq)
return (0.1 * lq)
def create_model():
#Create the convolutional stacks
input_img = Input(shape=(224,224,3))
x = Conv2D(16, kernel_size=3, activation='relu')(input_img)
x = MaxPo... | code_fim | hard | {
"lang": "python",
"repo": "lvhualong/mtrl-auto-uav",
"path": "/mtrl_network.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def create_model():
#Create the convolutional stacks
input_img = Input(shape=(224,224,3))
x = Conv2D(16, kernel_size=3, activation='relu')(input_img)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Conv2D(32, kernel_size=3, activation='relu')(x)
x = MaxPooling2D(pool_size=(2,2))(x)
... | code_fim | hard | {
"lang": "python",
"repo": "lvhualong/mtrl-auto-uav",
"path": "/mtrl_network.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lvhualong/mtrl-auto-uav path: /mtrl_network.py
import numpy as np
import time
import os
import glob
import cv2
import math
from math import *
from PIL import Image, ImageDraw
from scipy.misc import imsave
import matplotlib.pyplot as plt
plt.ion()
from keras.preprocessing.image import ImageDataGe... | code_fim | hard | {
"lang": "python",
"repo": "lvhualong/mtrl-auto-uav",
"path": "/mtrl_network.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: csira/wallace path: /tests/cases/attrs/inst_level.py
from tests.utils import should_throw
from tests.utils.registry import register
from wallace.db import DataType
from wallace.db import Model, String
from wallace.errors import ValidationError, WallaceError
@register
@should_throw(WallaceError... | code_fim | hard | {
"lang": "python",
"repo": "csira/wallace",
"path": "/tests/cases/attrs/inst_level.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> MyType(default=15, validators=(lambda val: val < 14,))
@register
@should_throw(ValidationError, 302)
def test_default_fails_3():
class MyType(DataType):
data_type = int
default = 10
MyType(validators=(lambda val: val < 10,))<|fim_prefix|># repo: csira/wallace path: /tests/c... | code_fim | hard | {
"lang": "python",
"repo": "csira/wallace",
"path": "/tests/cases/attrs/inst_level.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nguyenminhthai/choinho path: /scraper/storage_spiders/www88shopvn.py
# Auto generated by generator.py. Delete this line if you make modification.
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
XPATH = {
'name' : "//section[@id='primary']/div[@id='content']/he... | code_fim | hard | {
"lang": "python",
"repo": "nguyenminhthai/choinho",
"path": "/scraper/storage_spiders/www88shopvn.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>parse_item')]
sitemap_follow = []
rules = [
Rule(LinkExtractor(allow=['/san-pham/']), 'parse_item'),
Rule(LinkExtractor(allow=['/[a-zA-Z0-9-]+/($|page/\d+/$)']), 'parse'),
#Rule(LinkExtractor(), 'parse_item_and_links'),
]<|fim_prefix|># repo: nguyenminhthai/choinho path: /scraper/storage_spid... | code_fim | hard | {
"lang": "python",
"repo": "nguyenminhthai/choinho",
"path": "/scraper/storage_spiders/www88shopvn.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thanhchatvn/addons path: /date_range/tests/test_date_range_type.py
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from psycopg2 import IntegrityError
from odoo.exceptions import ValidationError
from odoo.tests.common import Tran... | code_fim | hard | {
"lang": "python",
"repo": "thanhchatvn/addons",
"path": "/date_range/tests/test_date_range_type.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_unlink(self):
date_range = self.env['date.range']
drt = self.env['date.range.type'].create(
{'name': 'Fiscal year',
'allow_overlap': False})
date_range.create({
'name': 'FS2016',
'date_start': '2015-01-01',
'... | code_fim | hard | {
"lang": "python",
"repo": "thanhchatvn/addons",
"path": "/date_range/tests/test_date_range_type.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Build a ``babel.Timezone`` based on tz factory
:return: ``babel.Timezone``
"""
return dates.get_timezone(_get_tz())<|fim_prefix|># repo: renzon/gaeforms path: /gaeforms/settings.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import babel
from ... | code_fim | hard | {
"lang": "python",
"repo": "renzon/gaeforms",
"path": "/gaeforms/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renzon/gaeforms path: /gaeforms/settings.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import babel
from babel import dates
def _get_locale():
return 'en_US'
<|fim_suffix|> """
Build a ``babel.Timezone`` based on tz factory
:return: ``babe... | code_fim | hard | {
"lang": "python",
"repo": "renzon/gaeforms",
"path": "/gaeforms/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jyotianeja/pythia path: /tools/eval_ensemble_on_val.py
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import glob
import sys
import yaml
from tr... | code_fim | hard | {
"lang": "python",
"repo": "jyotianeja/pythia",
"path": "/tools/eval_ensemble_on_val.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> accumulated_softmax = None
final_result = {}
n_model = 0
for c_file, model_file in zip(config_files, model_pths):
with open(c_file, 'r') as f:
config = yaml.load(f)
myModel = build_model(config, data_set_test)
myModel.load_state_dict(torch.load(model_fi... | code_fim | hard | {
"lang": "python",
"repo": "jyotianeja/pythia",
"path": "/tools/eval_ensemble_on_val.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_result = {}
# for key, value in result.items():
# new_result[value] = key
new_result = {value: key for key, value in result.items()}
print(new_result)<|fim_prefix|># repo: testcg/python path: /code_all/day06/exercise09.py
"""
练习1:
将两个列表,合并为一个字典
姓名列表["张无忌","赵敏","周芷若"]
... | code_fim | medium | {
"lang": "python",
"repo": "testcg/python",
"path": "/code_all/day06/exercise09.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: testcg/python path: /code_all/day06/exercise09.py
"""
练习1:
将两个列表,合并为一个字典
姓名列表["张无忌","赵敏","周芷若"]
房间列表[101,102,103]
{101: '张无忌', 102: '赵敏', 103: '周芷若'}
练习2:
颠倒练习1字典键值<|fim_suffix|> key = list_room[i]
# value = list_name[i]
# result[key] = value
re... | code_fim | medium | {
"lang": "python",
"repo": "testcg/python",
"path": "/code_all/day06/exercise09.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>chainedDg2 = ixNet.remapIds(chainedDg2)[0]
loopback2 = ixNet.add(chainedDg2, 'ipv4Loopback')
ixNet.setMultiAttribute(loopback2, '-stackedLayers', [], '-name', 'IPv4 Loopback 1')
ixNet.commit()
connector2 = ixNet.add(loopback2, 'connector')
ixNet.setMultiAttribute(connector2, '-connectedTo', network... | code_fim | hard | {
"lang": "python",
"repo": "OpenIxia/IxNetwork",
"path": "/LowLevelApi/NGPF/Python/MPLS/RSVP/RSVPTE_sample_sctipt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OpenIxia/IxNetwork path: /LowLevelApi/NGPF/Python/MPLS/RSVP/RSVPTE_sample_sctipt.py
logy: #
# Within topology both Label Switch Router(LSR) and Label Edge Router(LER)#
# are created. LSR is emulated in the front Device Group(DG... | code_fim | hard | {
"lang": "python",
"repo": "OpenIxia/IxNetwork",
"path": "/LowLevelApi/NGPF/Python/MPLS/RSVP/RSVPTE_sample_sctipt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bfssi-forest-dussault/infobasenutritiondb path: /infobasenutritiondb/api/views.py
from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from infobasenutritiondb.api.serializers import UserSerializer, GroupSerializer, \
IntakeDistributionCoordinatesSerializer, ... | code_fim | medium | {
"lang": "python",
"repo": "bfssi-forest-dussault/infobasenutritiondb",
"path": "/infobasenutritiondb/api/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class IntakeDistributionCoordinatesViewSet(viewsets.ModelViewSet):
serializer_class = IntakeDistributionCoordinatesSerializer
pagination_class = None
def get_queryset(self):
"""
Supports URL parameter filtering e.g. ?nutrient=Vitamin%20C&sex=male
"""
queryset =... | code_fim | hard | {
"lang": "python",
"repo": "bfssi-forest-dussault/infobasenutritiondb",
"path": "/infobasenutritiondb/api/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>N = int(input())
A = [int(x) for x in input().split()]
out_ = SimilarElementsPairs(A,N)
print (out_)<|fim_prefix|># repo: PaulSayantan/problem-solving path: /HACKEREARTH/Data Structures/Arrays/1-D/SimilarElementPairs.py
from typing import List
def SimilarElementsPairs(A: List[int],N: int) -> int:
A.... | code_fim | medium | {
"lang": "python",
"repo": "PaulSayantan/problem-solving",
"path": "/HACKEREARTH/Data Structures/Arrays/1-D/SimilarElementPairs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaulSayantan/problem-solving path: /HACKEREARTH/Data Structures/Arrays/1-D/SimilarElementPairs.py
from typing import List
def SimilarElementsPairs(A: List[int],N: int) -> int:
A.sort()
count = same = ans = 0
for i in range(1, N):
# print("At loop", i, ":")
# print("A[... | code_fim | medium | {
"lang": "python",
"repo": "PaulSayantan/problem-solving",
"path": "/HACKEREARTH/Data Structures/Arrays/1-D/SimilarElementPairs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not notify_caller:
print ('We are not notifying events to caller')
con = ESL.ESLconnection(esl_server, esl_port, esl_secret)
if con.connected():
subscribed_events = ['CHANNEL_CREATE', 'CHANNEL_ANSWER', 'CHANNEL_HANGUP_COMPLETE', 'CUSTOM', 'vm::maintenance']
con.ev... | code_fim | hard | {
"lang": "python",
"repo": "fedecastro/freeswitch-mattermost",
"path": "/freemat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def read_channel_answer(event, message_type=OUTGOING):
if message_type == OUTGOING:
message = ':white_check_mark: ***Call Answered***\n\t\t{} answered'.format(
event.get('Caller-Destination-Number'))
if message_type == INCOMING:
message = ':white_check_mark: ***Call An... | code_fim | hard | {
"lang": "python",
"repo": "fedecastro/freeswitch-mattermost",
"path": "/freemat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fedecastro/freeswitch-mattermost path: /freemat.py
#!/usr/bin/python2.7
'''
Freeswitch Mattermost notifications
Notify a Mattermost channel or user about new, answered, missed
and finished calls and new voicemails
'''
import ESL
import requests
import json
from ConfigParser import ConfigParser,... | code_fim | hard | {
"lang": "python",
"repo": "fedecastro/freeswitch-mattermost",
"path": "/freemat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def start(port, table_size, update_size, update_rate):
"""Start the webserver at the given port."""
app = make_app(table_size, update_size, update_rate)
app.listen(port)
logging.critical("Listening on http://localhost:{}".format(port))
loop = tornado.ioloop.IOLoop.current()
loop.s... | code_fim | hard | {
"lang": "python",
"repo": "RQuintin/perspective",
"path": "/python/perspective/bench/stresstest/server/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RQuintin/perspective path: /python/perspective/bench/stresstest/server/server.py
################################################################################
#
# Copyright (c) 2019, the Perspective Authors.
#
# This file is part of the Perspective library, distributed under the terms of
# the... | code_fim | hard | {
"lang": "python",
"repo": "RQuintin/perspective",
"path": "/python/perspective/bench/stresstest/server/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yusheng-wang/downscale path: /snap_scripts/downscaling_10min/move_raw_cmip5_common_dir.py
# # # # # # # # # # # # # # # # # # # # # # # # #
# # MOVE ALL _RAW_ DATA TO COMMON STRUCTURED DIR
# # # # # # # # # # # # # # # # # # # # # # # # #
def move_fn( fn, output_path ):
<|fim_suffix|>
# esg-dn... | code_fim | hard | {
"lang": "python",
"repo": "yusheng-wang/downscale",
"path": "/snap_scripts/downscaling_10min/move_raw_cmip5_common_dir.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# esg-dn1.nsc.liu.se,esg.pik-potsdam.de,esgdata.gfdl.noaa.gov,esgf-data.dkrz.de,esgf-index1.ceda.ac.uk,esgf-node.ipsl.upmc.fr,esgf-node.jpl.nasa.gov,esgf-node.llnl.gov,esgf.esrl.noaa.gov,esgf.nci.org.au<|fim_prefix|># repo: yusheng-wang/downscale path: /snap_scripts/downscaling_10min/move_raw_cmip5_comm... | code_fim | hard | {
"lang": "python",
"repo": "yusheng-wang/downscale",
"path": "/snap_scripts/downscaling_10min/move_raw_cmip5_common_dir.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: looio/jst path: /top/api/rest/FlashPictureDeleteRequest.py
'''
Created by auto_sdk on 2016.03.05
'''
from top.api.base import RestApi
class FlashPictureDeleteRequest(RestApi):
<|fim_suffix|> RestApi.__init__(self, domain, port)
self.nick = None
self.picture_ids = None
... | code_fim | medium | {
"lang": "python",
"repo": "looio/jst",
"path": "/top/api/rest/FlashPictureDeleteRequest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'taobao.flash.picture.delete'<|fim_prefix|># repo: looio/jst path: /top/api/rest/FlashPictureDeleteRequest.py
'''
Created by auto_sdk on 2016.03.05
'''
from top.api.base import RestApi
class FlashPictureDeleteRequest(RestApi):
def __init__(self, domain='gw.api.taobao.com', port=80):
... | code_fim | easy | {
"lang": "python",
"repo": "looio/jst",
"path": "/top/api/rest/FlashPictureDeleteRequest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> RestApi.__init__(self, domain, port)
self.nick = None
self.picture_ids = None
def getapiname(self):
return 'taobao.flash.picture.delete'<|fim_prefix|># repo: looio/jst path: /top/api/rest/FlashPictureDeleteRequest.py
'''
Created by auto_sdk on 2016.03.05
'''
from top.... | code_fim | medium | {
"lang": "python",
"repo": "looio/jst",
"path": "/top/api/rest/FlashPictureDeleteRequest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> edges.add((("from_node", newspaper1), ("to_node", df.Name[i]), ("relation_type", "LEFT FROM"), ("from_type", media_type[newspaper1]), ("to_type", "Journalist"), ("properties", ("leaving_date", leaving_date))))
edges.add((("from_node", df.Name[i]), ("to_node", newspaper2), ("relation_type"... | code_fim | hard | {
"lang": "python",
"repo": "osmanbaskaya/journalist-firing-in-turkey",
"path": "/dataread/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osmanbaskaya/journalist-firing-in-turkey path: /dataread/__init__.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
import codecs
import pandas as pd
import datetime
def get_data(input_file, sep='\t'):
media_df = pd.read_csv("media_types.tsv", sep='\t')
media_type = dict(zip(media_df.MediaE... | code_fim | medium | {
"lang": "python",
"repo": "osmanbaskaya/journalist-firing-in-turkey",
"path": "/dataread/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nanvel/bittrex-vpa path: /alembic/versions/af6b2aa1225b_minutes.py
"""minutes
Revision ID: af6b2aa1225b
Revises: b8ffad393b46
Create Date: 2018-03-23 21:00:46.837645
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'af6b2aa1225b'
down_revi... | code_fim | hard | {
"lang": "python",
"repo": "nanvel/bittrex-vpa",
"path": "/alembic/versions/af6b2aa1225b_minutes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('idx_timestamp', table_name='trades')
op.drop_table('minutes')
# ### end Alembic commands ###<|fim_prefix|># repo: nanvel/bittrex-vpa path: /alembic/versions/af6b2aa1225b_minutes.py
"""minutes
R... | code_fim | hard | {
"lang": "python",
"repo": "nanvel/bittrex-vpa",
"path": "/alembic/versions/af6b2aa1225b_minutes.py",
"mode": "spm",
"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.