text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> while position[0] >= 0 and position[0] < self.num_rows and position[1] >= 0 and position[1] < self.num_cols:
# logging.debug(f'{direction} {position} {self.layout[position[0]][position[1]]}')
if self.layout[position[0]][position[1]] == '#':
... | code_fim | hard | {
"lang": "python",
"repo": "mlucas-NU/advent_of_code",
"path": "/2020/day_11/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: github/incubator-airflow path: /airflow/models/renderedtifields.py
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licens... | code_fim | hard | {
"lang": "python",
"repo": "github/incubator-airflow",
"path": "/airflow/models/renderedtifields.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if result:
rendered_fields = result.rendered_fields
return rendered_fields
else:
return None
@classmethod
@provide_session
def get_k8s_pod_yaml(cls, ti: TaskInstance, session: Session = None) -> Optional[dict]:
"""
Get render... | code_fim | hard | {
"lang": "python",
"repo": "github/incubator-airflow",
"path": "/airflow/models/renderedtifields.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dwtcourses/anuvaad path: /anuvaad-etl/anuvaad-extractor/content-handler/src/config.py
import logging
import os
import time
DEBUG = False
API_URL_PREFIX = "/api/v0"
HOST = '0.0.0.0'
PORT = 5001
ENABLE_CORS = False
#folders and file path
download_folder = 'upload'
<|fim_suffix|>#mongo
MONGO_IP... | code_fim | medium | {
"lang": "python",
"repo": "dwtcourses/anuvaad",
"path": "/anuvaad-etl/anuvaad-extractor/content-handler/src/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#folders and file path
download_folder = 'upload'
BLOCK_TYPES = [{'key':'lines'},{'key':'images'},{'key':'tables'},{'key':'text_blocks'}]
#mongo
MONGO_IP = 'MONGO_IP'
DEFAULT_VALUE = 'localhost'
MONGO_DB_IDENTIFIER = 'MONGO_DB'
DEFAULT_MONGO_DB_IDENTIFIER = 'preprocessing'
MONGO_SERVER_URL = os.environ... | code_fim | medium | {
"lang": "python",
"repo": "dwtcourses/anuvaad",
"path": "/anuvaad-etl/anuvaad-extractor/content-handler/src/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>BLOCK_TYPES = [{'key':'lines'},{'key':'images'},{'key':'tables'},{'key':'text_blocks'}]
#mongo
MONGO_IP = 'MONGO_IP'
DEFAULT_VALUE = 'localhost'
MONGO_DB_IDENTIFIER = 'MONGO_DB'
DEFAULT_MONGO_DB_IDENTIFIER = 'preprocessing'
MONGO_SERVER_URL = os.environ.get(MONGO_IP, DEFAULT_VALUE)
MONGO_DB = os.environ.... | code_fim | medium | {
"lang": "python",
"repo": "dwtcourses/anuvaad",
"path": "/anuvaad-etl/anuvaad-extractor/content-handler/src/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>cossing
from src.util.command import call, CommandBuilder
from src.util import log, ntlog<|fim_prefix|># repo: changleibox/flutter_build_script path: /src/util/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 CHANGLEI. All rights reserved.
# Created by changlei on 2020/6/2... | code_fim | medium | {
"lang": "python",
"repo": "changleibox/flutter_build_script",
"path": "/src/util/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: changleibox/flutter_build_script path: /src/util/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 CHANGLEI. All rights reserved.
# Created by changlei on 2020/6/28.
from src.util.utils import zip_dir, file_r<|fim_suffix|>cossing
from src.util.command import call, C... | code_fim | medium | {
"lang": "python",
"repo": "changleibox/flutter_build_script",
"path": "/src/util/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
with open('configs.json') as f:
data = json.loads(f.read())
raw_configs = data['Configs']
with table.batch_writer() as batch:
for config in raw_configs:
processed = process_config(config... | code_fim | hard | {
"lang": "python",
"repo": "dougjaso/amazon-connect-snippets",
"path": "/python/remote-control-center/HydrateConfigTableLambda/lambda_function.py",
"mode": "spm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dougjaso/amazon-connect-snippets path: /python/remote-control-center/HydrateConfigTableLambda/lambda_function.py
import boto3
import os
import time
import json
'''
SAMPLE EVENTS
####
Import Events from config.json file
####
{
"LanguageCodes": [
"en",
"fr",
"es"
... | code_fim | hard | {
"lang": "python",
"repo": "dougjaso/amazon-connect-snippets",
"path": "/python/remote-control-center/HydrateConfigTableLambda/lambda_function.py",
"mode": "psm",
"license": "MIT-0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@register.filter
def value1(x):
if x == 0:
return 'men'
else:
return 'women'<|fim_prefix|># repo: 1923488289/myfisttwo path: /test1/testbook/templatetags/myider.py
from django import template
<|fim_middle|>register = template.Library()
@register.filter
def myder(a):
if a =... | code_fim | medium | {
"lang": "python",
"repo": "1923488289/myfisttwo",
"path": "/test1/testbook/templatetags/myider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1923488289/myfisttwo path: /test1/testbook/templatetags/myider.py
from django import template
<|fim_suffix|> if x == 0:
return 'men'
else:
return 'women'<|fim_middle|>register = template.Library()
@register.filter
def myder(a):
if a == 0:
return '男'
else:... | code_fim | medium | {
"lang": "python",
"repo": "1923488289/myfisttwo",
"path": "/test1/testbook/templatetags/myider.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if x == 0:
return 'men'
else:
return 'women'<|fim_prefix|># repo: 1923488289/myfisttwo path: /test1/testbook/templatetags/myider.py
from django import template
register = template.Library()
<|fim_middle|>@register.filter
def myder(a):
if a == 0:
return '男'
else:... | code_fim | medium | {
"lang": "python",
"repo": "1923488289/myfisttwo",
"path": "/test1/testbook/templatetags/myider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
lexer = get_lexer_by_name(lang)
except ValueError:
try:
if self.options.get('guess_lang', True):
lexer = guess_lexer(text)
else:
lexer = get_lexer_by_name('text')
except ValueEr... | code_fim | hard | {
"lang": "python",
"repo": "dvl/mistune-hilite",
"path": "/mistune_hilite/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dvl/mistune-hilite path: /mistune_hilite/__init__.py
# -*- coding: utf-8 -*-
from mistune import Renderer as RendererBase
from pygments import highlight
from pygments.lexers import get_lexer_by_name, guess_lexer
from pygments.formatters import get_formatter_by_name
class HiliteRenderer(Render... | code_fim | hard | {
"lang": "python",
"repo": "dvl/mistune-hilite",
"path": "/mistune_hilite/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cookem4/3K04_DCM path: /main/views/EGMDataPage.py
import tkinter as tk
import matplotlib
matplotlib.use("Agg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from main.views import MainPage
from main.views.AppFrameBase import AppFrameBase
f... | code_fim | hard | {
"lang": "python",
"repo": "cookem4/3K04_DCM",
"path": "/main/views/EGMDataPage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def toggleGraphing(self):
if self.allowGraphing:
self.serial_service.end_egm_data()
self.allowGraphing = False
self.setToGraph = [[0], [0], [0]]
self.timeSum = 0
else:
self.allowGraphing = True
# Send request egm d... | code_fim | hard | {
"lang": "python",
"repo": "cookem4/3K04_DCM",
"path": "/main/views/EGMDataPage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>workflow = gbdx.Workflow([task])
workflow.savedata(task.outputs.data, location='seth_test_output')
workflow.execute()<|fim_prefix|># repo: nricklin/gdal-gbdx-task path: /example2.py
from gbdxtools import Interface
gbdx = Interface()
<|fim_middle|>task = gbdx.Task('ricklin-gdal-test')
task.inputs.data = ... | code_fim | hard | {
"lang": "python",
"repo": "nricklin/gdal-gbdx-task",
"path": "/example2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nricklin/gdal-gbdx-task path: /example2.py
from gbdxtools import Interface
gbdx = Interface()
task = gbdx.Task('ricklin-gdal-test')
task.inputs.data = 's3://gbd-customer-data/7b216bd9-6523-4ca9-aa3b-1d8a5994f054/sethtest/'
#task.inputs.filetype = 'tif'
task.inputs.execution_strategy = 'runonce'
... | code_fim | medium | {
"lang": "python",
"repo": "nricklin/gdal-gbdx-task",
"path": "/example2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangyeyu2016/wpxploit path: /wpxploit/xmlrpc/exploit.py
# XMLRPC Exploit
#
# Author : Relarizky
# Github : @relarizky (https://github.com/relarizky)
# File : interface.py
# Last Modified : 11/28/20, 00:34 AM
#
# Copyright (c) 2020 Relarizky
#
# Permission is hereby granted, free of charge, to a... | code_fim | hard | {
"lang": "python",
"repo": "wangyeyu2016/wpxploit",
"path": "/wpxploit/xmlrpc/exploit.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> progress_bar = tqdm(
desc=current_time(),
total=self.pass_word.__len__(),
dynamic_ncols=True
)
for pass_word in self.pass_word:
try:
payload = self._create_payload(self.user_name, pass_word)
request = s... | code_fim | hard | {
"lang": "python",
"repo": "wangyeyu2016/wpxploit",
"path": "/wpxploit/xmlrpc/exploit.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
m, k, d, names, owned, prices = read_data()
output = print_transactions(m, k, d, names, owned, prices)
print len(output)
for line in output:
print line
if __name__ == "__main__":
main()<|fim_prefix|># repo: jahnavigouru/hacker-rank path: /practice/ai/machine-lear... | code_fim | hard | {
"lang": "python",
"repo": "jahnavigouru/hacker-rank",
"path": "/practice/ai/machine-learning/stockprediction/stockprediction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jahnavigouru/hacker-rank path: /practice/ai/machine-learning/stockprediction/stockprediction.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-01-13 14:50:43
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-01-13 15:12:39
<|fim_suffix|> re... | code_fim | hard | {
"lang": "python",
"repo": "jahnavigouru/hacker-rank",
"path": "/practice/ai/machine-learning/stockprediction/stockprediction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if sa >= 80. and owned[i]:
output.append('{} {} {}'.format(names[i], 'SELL', owned[i]))
elif sa <= 20. and m:
to_buy.append((i, sa, prices[i][-1]))
for i, sa, price in to_buy:
num = int(m / int(math.ceil(price)))
if num:
output.appen... | code_fim | hard | {
"lang": "python",
"repo": "jahnavigouru/hacker-rank",
"path": "/practice/ai/machine-learning/stockprediction/stockprediction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>(f"yaml file: {path_to_yaml} loaded successfully")
return content<|fim_prefix|># repo: RajeshThakur1/DVN_LNP_SIMPLE_USECASE path: /src/utils/common.py
import yaml
import os
import json
import logging
import time
def rea<|fim_middle|>d_yaml(path_to_yaml: str) -> dict:
with open(path_to_yaml) as ya... | code_fim | medium | {
"lang": "python",
"repo": "RajeshThakur1/DVN_LNP_SIMPLE_USECASE",
"path": "/src/utils/common.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RajeshThakur1/DVN_LNP_SIMPLE_USECASE path: /src/utils/common.py
import yaml
import os
import json
import logging
import time
def rea<|fim_suffix|>l_file:
content = yaml.safe_load(yaml_file)
logging.info(f"yaml file: {path_to_yaml} loaded successfully")
return content<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "RajeshThakur1/DVN_LNP_SIMPLE_USECASE",
"path": "/src/utils/common.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>l_file:
content = yaml.safe_load(yaml_file)
logging.info(f"yaml file: {path_to_yaml} loaded successfully")
return content<|fim_prefix|># repo: RajeshThakur1/DVN_LNP_SIMPLE_USECASE path: /src/utils/common.py
import yaml
import os
import json
import logging
import time
def rea<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "RajeshThakur1/DVN_LNP_SIMPLE_USECASE",
"path": "/src/utils/common.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xctfmatch/CTF-misc-library path: /20200303_萌新赛-千字文_只有二维码/concat.py
# https://blog.csdn.net/Zhipeng_Hou/article/details/83381133
import os,random
from PIL import Image
base_dir = "qrcode/"
def walkfile():
qrcodes = []
for parent, dirnames, filenames in os.walk(base_dir, followlinks=True)... | code_fim | hard | {
"lang": "python",
"repo": "xctfmatch/CTF-misc-library",
"path": "/20200303_萌新赛-千字文_只有二维码/concat.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for w in range(2,box_width-2):
for h in range(2,box_height-2):
# print(w,h)
if w == flag_w and h == flag_h:# 添加flag.png
color = img.getpixel(((w*25+13), (h*25+13)))
print("flag color: ",color)
img_sm = convert_img("qrcode/flag.png",color > 127)
... | code_fim | medium | {
"lang": "python",
"repo": "xctfmatch/CTF-misc-library",
"path": "/20200303_萌新赛-千字文_只有二维码/concat.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> r = requests.get('http://arkapi:5001/blog/?page=' + str(page))
return r<|fim_prefix|># repo: allison-knauss/arkweb path: /web/clients/blog_client.py
import requests
def all():
<|fim_middle|> r = requests.get('http://arkapi:5001/blog')
return r
def paged(page=0):
| code_fim | medium | {
"lang": "python",
"repo": "allison-knauss/arkweb",
"path": "/web/clients/blog_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allison-knauss/arkweb path: /web/clients/blog_client.py
import requests
def all():
r = requests.get('http://arkapi:5001/blog')
return r
<|fim_suffix|> r = requests.get('http://arkapi:5001/blog/?page=' + str(page))
return r<|fim_middle|>def paged(page=0):
| code_fim | easy | {
"lang": "python",
"repo": "allison-knauss/arkweb",
"path": "/web/clients/blog_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.api_builtin.open(Folder.DIGIT_INDEX_FILE, "r") as fp:
index = self.api_json.load(fp)
self.api_random.shuffle(index)
minimum = self.get_limiting_digit(index)
return self.get_train_and_test_data(index, minimum)
def get_limiting_digit(self, index):
max_seen_of_each_dig... | code_fim | hard | {
"lang": "python",
"repo": "kamerons/dde-extract-gear",
"path": "/train/train_stat_value.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamerons/dde-extract-gear path: /train/train_stat_value.py
import os
import numpy as np
import sys
from extract_gear.create_index_task import CreateIndexTask
from extract_gear.index import Index
from extract_gear.image_splitter import ImageSplitter
from extract_gear.preprocess_stat import PrePro... | code_fim | hard | {
"lang": "python",
"repo": "kamerons/dde-extract-gear",
"path": "/train/train_stat_value.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qianrenjian/sigir2020-eComWorkshop-LTM-for-product-search path: /trainer/bert/rerank.py
import argparse
import task
import data
import sys
def main_cli():
parser = argparse.ArgumentParser('CEDR model re-ranking')
parser.add_argument('--model', choices=task.MODEL_MAP.keys(), default='v... | code_fim | medium | {
"lang": "python",
"repo": "qianrenjian/sigir2020-eComWorkshop-LTM-for-product-search",
"path": "/trainer/bert/rerank.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = task.MODEL_MAP[args.model]().cuda()
dataset = data.read_datafiles(args.datafiles)
run = data.read_run_dict(args.run)
if args.model_weights is not None:
model.load(args.weights_filename)
task.run_model(model, dataset, run, args.out_path, desc='rerank')
if __name__ == '... | code_fim | medium | {
"lang": "python",
"repo": "qianrenjian/sigir2020-eComWorkshop-LTM-for-product-search",
"path": "/trainer/bert/rerank.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dasmith2/djavError path: /djavError/models/fixable.py
from datetime import timedelta
from django.db import models
from djaveAllowed.models import Allowed
from djaveDT import now, end_of_day, beginning_of_day
USE_DEFAULT = 'use_default'
EITHER = 'either'
FIXED = 'fixed'
NOT_FIXED = 'not_fixed'
... | code_fim | hard | {
"lang": "python",
"repo": "dasmith2/djavError",
"path": "/djavError/models/fixable.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save(self, *args, **kwargs):
# This is important because a few things divide by count to get an average.
if not self.count:
raise Exception(
'How am I creating a {} with no count?'.format(self.__class__))
super().save(*args, **kwargs)
class Meta:
abstract = True
... | code_fim | hard | {
"lang": "python",
"repo": "dasmith2/djavError",
"path": "/djavError/models/fixable.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model, from_date=USE_DEFAULT, to_date=USE_DEFAULT, status=USE_DEFAULT,
nnow=None):
""" Assumes you have a created column and a fixed column. Easiest thing is to
inherit from djavError.models.fixable I'm leaving this here instead of in
djavError.models.fixable because this function knows abou... | code_fim | medium | {
"lang": "python",
"repo": "dasmith2/djavError",
"path": "/djavError/models/fixable.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chainso/HLRL path: /hlrl/torch/common/training.py
def polyak_average(source, target, polyak):
"""
Copies parameters from the source to the target using the formula:
t * (1 - polyak) + s * polyak.
"""
<|fim_suffix|>m.data.copy_(
t_param.data * (1 - polyak) + param.da... | code_fim | medium | {
"lang": "python",
"repo": "Chainso/HLRL",
"path": "/hlrl/torch/common/training.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for param, t_param in zip(source.parameters(), target.parameters()):
t_param.data.copy_(
t_param.data * (1 - polyak) + param.data * polyak
)<|fim_prefix|># repo: Chainso/HLRL path: /hlrl/torch/common/training.py
def polyak_average(source, target, polyak):
"""
Copies p... | code_fim | medium | {
"lang": "python",
"repo": "Chainso/HLRL",
"path": "/hlrl/torch/common/training.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mee321/HAPG_exp path: /garage/tf/algos/catrpo.py
self.opt_info = None
self.backup_policy = backup_policy
self.mix_policy = mix_policy
self.pos_eps_policy = pos_eps_policy
self.neg_eps_policy = neg_eps_policy
self.minibatch_size = minibatch_size
... | code_fim | hard | {
"lang": "python",
"repo": "Mee321/HAPG_exp",
"path": "/garage/tf/algos/catrpo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
observations = ext.extract(outer_sample, "observations")
actions = ext.extract(outer_sample, "actions")
advantages = ext.extract(outer_sample, "advantages")
outer_observations = observations[0].reshape(-1, self.env.spec.observation_space.shape[0])
outer_actions = ... | code_fim | hard | {
"lang": "python",
"repo": "Mee321/HAPG_exp",
"path": "/garage/tf/algos/catrpo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mee321/HAPG_exp path: /garage/tf/algos/catrpo.py
,
neg_eps_policy,
baseline,
minibatch_size=500,
n_sub_itr=10,
optimizer=None,
optimizer_args=None,
delta=0.01,
**kwargs):
Serializable.quick_ini... | code_fim | hard | {
"lang": "python",
"repo": "Mee321/HAPG_exp",
"path": "/garage/tf/algos/catrpo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ans = [nums[0]]
for i in nums[1:]:
ans.append(ans[-1]+i)
return ans<|fim_prefix|># repo: sudhirrd007/LeetCode-scraper path: /data_files/PROGRAMS/EASY/1480_Running_Sum_of_1d_Array.py
# ID : 1480
# Title : Running Sum of 1d Array
# Difficulty : EASY
# Acceptance_rate : 8... | code_fim | easy | {
"lang": "python",
"repo": "sudhirrd007/LeetCode-scraper",
"path": "/data_files/PROGRAMS/EASY/1480_Running_Sum_of_1d_Array.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sudhirrd007/LeetCode-scraper path: /data_files/PROGRAMS/EASY/1480_Running_Sum_of_1d_Array.py
# ID : 1480
# Title : Running Sum of 1d Array
# Difficulty : EASY
# Acceptance_rate : 88.9%
# Runtime : 32 ms
# Memory : 14.4 MB
# Tags : Array
# Language : python3
# Problem_link : https://leetcode.com/p... | code_fim | easy | {
"lang": "python",
"repo": "sudhirrd007/LeetCode-scraper",
"path": "/data_files/PROGRAMS/EASY/1480_Running_Sum_of_1d_Array.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Global-localhost/python-spanner-django path: /google/cloud/spanner_dbapi/__init__.py
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Connection-bas... | code_fim | hard | {
"lang": "python",
"repo": "Global-localhost/python-spanner-django",
"path": "/google/cloud/spanner_dbapi/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
__all__ = [
"Connection",
"DatabaseError",
"DataError",
"Error",
"IntegrityError",
"InterfaceError",
"InternalError",
"NotSupportedError",
"OperationalError",
"ProgrammingError",
"Warning",
"DEFAULT_USER_AGENT",
"apilevel",
"connect",
"paramstyl... | code_fim | hard | {
"lang": "python",
"repo": "Global-localhost/python-spanner-django",
"path": "/google/cloud/spanner_dbapi/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astropy/astropy path: /astropy/utils/xml/tests/test_iterparse.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# LOCAL
# SYSTEM
import io
import zlib
from astropy.utils.xml.iterparser import _fast_iterparse
# The C-based XML parser for VOTables previously used fixed-sized
# b... | code_fim | hard | {
"lang": "python",
"repo": "astropy/astropy",
"path": "/astropy/utils/xml/tests/test_iterparse.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Bytes vs. String .encode()/.decode() for compatibility with Python 3.5.
s = compo.compress(VOTABLE_XML.encode())
s = s + compo.flush()
fd = io.BytesIO(s)
fd.seek(0)
# Finally setup the test of the C-based '_fast_iterparse()' iterator
# and a situation in which it can be cal... | code_fim | hard | {
"lang": "python",
"repo": "astropy/astropy",
"path": "/astropy/utils/xml/tests/test_iterparse.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_iterparser_over_read_simple():
# Take the plaintext of 512 tags, and compression it with a
# Gzip-style header (+16), to most closely emulate the behavior
# of most HTTP servers.
zlib_GZIP_STYLE_HEADER = 16
compo = zlib.compressobj(
zlib.Z_BEST_COMPRESSION, zlib.DEFLAT... | code_fim | hard | {
"lang": "python",
"repo": "astropy/astropy",
"path": "/astropy/utils/xml/tests/test_iterparse.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/adjectives/_equines.py
from xai.brain.wordbase.adjectives._equine import _EQUINE
<|fim_suffix|> def __init__(self,):
_EQUINE.__init__(self)
self.name = "EQUINES"
self.specie = 'adjectives'
self.basic = "equine"
self.jsondata = {}<|fim_middle|>#... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/adjectives/_equines.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _EQUINE.__init__(self)
self.name = "EQUINES"
self.specie = 'adjectives'
self.basic = "equine"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/adjectives/_equines.py
from xai.brain.wordbase.adjectives._equine import _EQUINE
#calss header
class _EQUINES(_EQUINE, ... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/adjectives/_equines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lestherll/expr_calc path: /expr_calc/lexer.py
from decimal import Decimal
from expr_calc.token import Token, TokenType
from expr_calc.operators import OP_LIST, op_map, unary_op_map
from expr_calc.errors import NoProgramLoaded, ExcessiveDotError, TokenError
from typing import Optional, List
cl... | code_fim | hard | {
"lang": "python",
"repo": "lestherll/expr_calc",
"path": "/expr_calc/lexer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
# current token is not a digit anymore
if digit_flag:
if not dot_flag and char == ".": # possible decimal point
temp_digit.append(char)
dot_flag = True
elif dot_fl... | code_fim | hard | {
"lang": "python",
"repo": "lestherll/expr_calc",
"path": "/expr_calc/lexer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # current token is not a digit anymore
if digit_flag:
if not dot_flag and char == ".": # possible decimal point
temp_digit.append(char)
dot_flag = True
elif dot_flag and char == ".":... | code_fim | hard | {
"lang": "python",
"repo": "lestherll/expr_calc",
"path": "/expr_calc/lexer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AinsteinAI/ainstein_radar path: /ainstein_radar_filters/cfg/PointCloudDebug.cfg
#!/usr/bin/env python
PACKAGE = "ainstein_radar_filters"
from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator()
gen.add("print_debug", bool_t, 0, "Enable debug message printing", Fa... | code_fim | hard | {
"lang": "python",
"repo": "AinsteinAI/ainstein_radar",
"path": "/ainstein_radar_filters/cfg/PointCloudDebug.cfg",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ble_t, 0, "High elevation limit for point cloud debug messages (deb)", 60, -90, 90)
gen.add("low_power_limit", double_t, 0, "Low power limit for point cloud debug messages (deb)", 0, 0, 65535)
gen.add("high_power_limit", double_t, 0, "High elevation limit for point cloud debug messages (deb)", 65535, 0, 6... | code_fim | hard | {
"lang": "python",
"repo": "AinsteinAI/ainstein_radar",
"path": "/ainstein_radar_filters/cfg/PointCloudDebug.cfg",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ATrack+ Group Map',
'verbose_name_plural': 'Active Directory Group to QATrack+ Group Maps',
},
),
migrations.CreateModel(
name='DefaultGroup',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize... | code_fim | hard | {
"lang": "python",
"repo": "tguiot/qatrackplus",
"path": "/qatrack/accounts/migrations/0002_activedirectorygroupmap_defaultgroup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tguiot/qatrackplus path: /qatrack/accounts/migrations/0002_activedirectorygroupmap_defaultgroup.py
# Generated by Django 2.1.15 on 2020-09-22 18:36
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependen... | code_fim | hard | {
"lang": "python",
"repo": "tguiot/qatrackplus",
"path": "/qatrack/accounts/migrations/0002_activedirectorygroupmap_defaultgroup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>into QATrack+. (If there are no qualifying groups then all authenticated users may log into QATrack+.)', verbose_name='Account Qualifying Group')),
('groups', models.ManyToManyField(blank=True, help_text='Select the QATrack+ groups you want this user added to when they belong to the Active... | code_fim | hard | {
"lang": "python",
"repo": "tguiot/qatrackplus",
"path": "/qatrack/accounts/migrations/0002_activedirectorygroupmap_defaultgroup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t("%r :: "% playername)
print("gainian >> Oh, yes, "+ putin)<|fim_prefix|># repo: yuguoneo/bored-game-cool path: /in=out.py
print("-----------------------")
print("| ::::: |")
print("-----------------------")
print("Friday >> Tell me who <|fim_middle|>are you.")
playername = input("::")... | code_fim | medium | {
"lang": "python",
"repo": "yuguoneo/bored-game-cool",
"path": "/in=out.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>are you.")
playername = input("::")
while True:
putin = input("%r :: "% playername)
print("gainian >> Oh, yes, "+ putin)<|fim_prefix|># repo: yuguoneo/bored-game-cool path: /in=out.py
print("-----------------------")
print("| ::::: |"<|fim_middle|>)
print("-----------------------")
... | code_fim | medium | {
"lang": "python",
"repo": "yuguoneo/bored-game-cool",
"path": "/in=out.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuguoneo/bored-game-cool path: /in=out.py
print("-----------------------")
print("| ::::: |"<|fim_suffix|>are you.")
playername = input("::")
while True:
putin = input("%r :: "% playername)
print("gainian >> Oh, yes, "+ putin)<|fim_middle|>)
print("-----------------------")
... | code_fim | medium | {
"lang": "python",
"repo": "yuguoneo/bored-game-cool",
"path": "/in=out.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sjylawyer/shiyanlou path: /Louplus_Python_Code_week3_github (2)/shiyanlougithub/shiyanlougithub/spiders/shiyanlou.py
# -*- coding: utf-8 -*-
import scrapy
from shiyanlougithub.items import ShiyanlougithubItem
class ShiyanlouSpider(scrapy.Spider):
name = 'shiyanlou'
allowed_domains = ['gi... | code_fim | hard | {
"lang": "python",
"repo": "sjylawyer/shiyanlou",
"path": "/Louplus_Python_Code_week3_github (2)/shiyanlougithub/shiyanlougithub/spiders/shiyanlou.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse_commit(self,response):
item=response.meta['item']
item['commits']=response.xpath('//span[@class="num text-emphasized"]/text()').extract()[0].split()
item['branches']=response.xpath('//span[@class="num text-emphasized"]/text()').extract()[1].split()
item['relea... | code_fim | hard | {
"lang": "python",
"repo": "sjylawyer/shiyanlou",
"path": "/Louplus_Python_Code_week3_github (2)/shiyanlougithub/shiyanlougithub/spiders/shiyanlou.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> item=response.meta['item']
item['commits']=response.xpath('//span[@class="num text-emphasized"]/text()').extract()[0].split()
item['branches']=response.xpath('//span[@class="num text-emphasized"]/text()').extract()[1].split()
item['releases']=response.xpath('//span[@class="... | code_fim | hard | {
"lang": "python",
"repo": "sjylawyer/shiyanlou",
"path": "/Louplus_Python_Code_week3_github (2)/shiyanlougithub/shiyanlougithub/spiders/shiyanlou.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: priyansh19/struct2tensor path: /struct2tensor/expression_test.py
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.... | code_fim | hard | {
"lang": "python",
"repo": "priyansh19/struct2tensor",
"path": "/struct2tensor/expression_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_project(self):
expr = create_expression.create_expression_from_prensor(
prensor_test_util.create_nested_prensor())
projected = expr.project(
[path.Path(["user", "friends"]),
path.Path(["doc", "keep_me"])])
self.assertIsNotNone(
projected.get_descenda... | code_fim | hard | {
"lang": "python",
"repo": "priyansh19/struct2tensor",
"path": "/struct2tensor/expression_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Run unit tests
'''
import unittest
tests = unittest.TestLoader().discover('tests')
unittest.TextTestRunner(verbosity=2).run(tests)
@manager.shell
def make_shell_context():
return dict(app=app, db=db, Role=Role, User=User, Blogsection=Blogsection, Post=Post, Comment=Commen... | code_fim | medium | {
"lang": "python",
"repo": "VirginiaNdungu1/Gypsy",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VirginiaNdungu1/Gypsy path: /manage.py
from app import create_app, db
from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
from app.models import Role, User, Blogsection, Post, Comment
# app = create_app('development')
<|fim_suffix|>@manager.shell
def make_s... | code_fim | hard | {
"lang": "python",
"repo": "VirginiaNdungu1/Gypsy",
"path": "/manage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amejri/how-to-opensource path: /how_to_opensource/tests/test_core.py
import pytest
import numpy as np
from how_to_opensource import add_two_vectors
from typing import Union, Tuple
<|fim_suffix|> """Test it properly adds two vectors."""
a = 2 * np.ones(shape)
b = - np.ones(shape)
... | code_fim | medium | {
"lang": "python",
"repo": "amejri/how-to-opensource",
"path": "/how_to_opensource/tests/test_core.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test it properly adds two vectors."""
a = 2 * np.ones(shape)
b = - np.ones(shape)
results = add_two_vectors(a, b)
expected = np.ones(shape)
np.testing.assert_almost_equal(results, expected)<|fim_prefix|># repo: amejri/how-to-opensource path: /how_to_opensource/tests/test_core.... | code_fim | medium | {
"lang": "python",
"repo": "amejri/how-to-opensource",
"path": "/how_to_opensource/tests/test_core.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>dqmAk4PFCHSL1FastL2L3ResidualCorrector = ak4PFCHSL1FastL2L3ResidualCorrector.clone()
dqmAk4PFCHSL1FastL2L3ResidualCorrectorChain = cms.Sequence(
#ak4PFCHSL1FastjetCorrector*ak4PFCHSL2RelativeCorrector*ak4PFCHSL3AbsoluteCorrector*ak4PFCHSResidualCorrector
dqmAk4PFCHSL1FastL2L3ResidualCorrector
)
d... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cms-sw/cmssw path: /DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py
import FWCore.ParameterSet.Config as cms
from DQMOffline.JetMET.metDQMConfig_cff import *
from DQMOffline.JetMET.jetAnalyzer_cff import *
from DQMOffline.JetMET.pfCandidateDQMConfig_cfi import *
from DQMOffline.Je... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>dqmCorrPfMetType1=corrPfMetType1.clone(jetCorrLabel = cms.InputTag('dqmAk4PFCHSL1FastL2L3Corrector'),
jetCorrLabelRes = cms.InputTag('dqmAk4PFCHSL1FastL2L3ResidualCorrector')
)
pfMETT1=pfMetT1.clone(srcCorrections = (
'd... | code_fim | hard | {
"lang": "python",
"repo": "cms-sw/cmssw",
"path": "/DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SungBalance/krsh path: /krsh/cmd/group_create/templates/component/component.py
def {name}_op():
# If you read the following comment, you can remov<|fim_suffix|>his function name.
# 3. Do not change `__init__.py` file.
return<|fim_middle|>e this comment.
# 1. This function must ret... | code_fim | medium | {
"lang": "python",
"repo": "SungBalance/krsh",
"path": "/krsh/cmd/group_create/templates/component/component.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>his function name.
# 3. Do not change `__init__.py` file.
return<|fim_prefix|># repo: SungBalance/krsh path: /krsh/cmd/group_create/templates/component/component.py
def {name}_op():
# If you read the following comment, you can remov<|fim_middle|>e this comment.
# 1. This function must ret... | code_fim | medium | {
"lang": "python",
"repo": "SungBalance/krsh",
"path": "/krsh/cmd/group_create/templates/component/component.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LaplaceKorea/fast-noise-aware-topic-clustering path: /clustering_driver.py
# Copyright 2021 Bloomberg L.P.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://ww... | code_fim | hard | {
"lang": "python",
"repo": "LaplaceKorea/fast-noise-aware-topic-clustering",
"path": "/clustering_driver.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # load configuration and init cluster handler
configuration = build_algorithm_config(args)
cluster_handler = ClusterHandler(configuration)
logger.info(f"Init cluster handler with algorithm configuration: {configuration}")
# get data and labels
data, data_labels = get_data_and_labe... | code_fim | hard | {
"lang": "python",
"repo": "LaplaceKorea/fast-noise-aware-topic-clustering",
"path": "/clustering_driver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> use_sudo = True
make_executable = False
always_backup_existing_config = False
# TODO: maybe we should make this True by default,
# but don't backup when the 'diff' is empty.
def show_new_config(self):
"""
Show the new configuration fi... | code_fim | hard | {
"lang": "python",
"repo": "Duologic/python-deployer",
"path": "/deployer/contrib/nodes/config.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Duologic/python-deployer path: /deployer/contrib/nodes/config.py
from pygments import highlight
from pygments.lexers import TextLexer, DiffLexer
from pygments.formatters import TerminalFormatter as Formatter
from deployer.node import ParallelNode, required_property, suppress_action_result
from d... | code_fim | hard | {
"lang": "python",
"repo": "Duologic/python-deployer",
"path": "/deployer/contrib/nodes/config.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
True when this config exists.
"""
if self.host.exists(self.remote_path):
print 'Yes, config exists already.'
return True
else:
print 'Config doesn\'t exist yet'
return False
def changed(self):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Duologic/python-deployer",
"path": "/deployer/contrib/nodes/config.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ds in datasets:
ds_name, ds_root = ds
data = read_wsd_data(ds_root + '.data.xml', ds_root + '.gold.key.txt')
with JsonFile(os.path.join(outdir, ds_name + '.json'), 'w') as fout:
for line in data:
fout.write(line)
if __name__ == '__main__':
... | code_fim | hard | {
"lang": "python",
"repo": "shmuelamar/kb",
"path": "/bin/preprocess_wsd.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_dataset_metadata(wsd_framework_root):
return [
[
'semcor',
os.path.join(
wsd_framework_root, 'Training_Corpora', 'SemCor', 'semcor'
)
], [
'senseval2',
os.path.join(
... | code_fim | hard | {
"lang": "python",
"repo": "shmuelamar/kb",
"path": "/bin/preprocess_wsd.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shmuelamar/kb path: /bin/preprocess_wsd.py
'''
Original data from: http://lcl.uniroma1.it/wsdeval/
Data converted from XML to jsonl
'''
import os
import h5py
import json
import numpy as np
from kb.common import JsonFile
def read_gold_data(fname):
gold_data = {}
with open(fname, 'r') ... | code_fim | hard | {
"lang": "python",
"repo": "shmuelamar/kb",
"path": "/bin/preprocess_wsd.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Textualize/textual path: /tests/snapshot_tests/snapshot_apps/scroll_to_center.py
from textual.app import App, ComposeResult
from textual.containers import HorizontalScroll, VerticalScroll
from textual.widgets import Label
class MyApp(App[None]):
<|fim_suffix|> self.screen.scroll_to_cente... | code_fim | hard | {
"lang": "python",
"repo": "Textualize/textual",
"path": "/tests/snapshot_tests/snapshot_apps/scroll_to_center.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> yield Label(("SPAM\n" * 53)[:-1])
with VerticalScroll(id="vertical"):
yield Label(("SPAM\n" * 78)[:-1])
with HorizontalScroll():
yield Label(("v\n" * 17)[:-1])
yield Label("@" * 302)
yield Label("[red]>>bullseye<<[/red... | code_fim | hard | {
"lang": "python",
"repo": "Textualize/textual",
"path": "/tests/snapshot_tests/snapshot_apps/scroll_to_center.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ihmeuw/covid-model-seiir-pipeline path: /src/covid_model_seiir_pipeline/lib/io/api.py
"""Inteface methods for on disk I/O.
These methods use information from the provided key to select an appropriate
strategy for streaming data to and from disk.
"""
from typing import Any, Union
from covid_mod... | code_fim | medium | {
"lang": "python",
"repo": "ihmeuw/covid-model-seiir-pipeline",
"path": "/src/covid_model_seiir_pipeline/lib/io/api.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Loads the dataset associated with the provided key."""
if key.disk_format not in STRATEGIES:
raise
return STRATEGIES[key.disk_format].load(key, *args, **kwargs)
def dump(dataset: Any, key: Union[MetadataKey, DatasetKey]) -> None:
"""Writes the provided dataset to the location ... | code_fim | medium | {
"lang": "python",
"repo": "ihmeuw/covid-model-seiir-pipeline",
"path": "/src/covid_model_seiir_pipeline/lib/io/api.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if '__main__' == __name__:
import go
liver_dev_genes = set((
"ENSMUSG00000005836",
"ENSMUSG00000025907",
"ENSMUSG00000039910",
"ENSMUSG00000079844",
"ENSMUSG00000006818",
"ENSMUSG00000044147",
"ENSMUSG00000024927",
"ENSMUSG00000009... | code_fim | hard | {
"lang": "python",
"repo": "JohnReid/biopsy",
"path": "/Python/site_dpm/topgo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JohnReid/biopsy path: /Python/site_dpm/topgo.py
#
# Copyright John Reid 2009
#
"""
Code to interface to the topGO library.
"""
import rpy2.robjects, logging, os
from rpy2.robjects import r
from shared import *
r_str = r.str
r_print = r['print']
def set_r_width(width):
"Set the R width op... | code_fim | hard | {
"lang": "python",
"repo": "JohnReid/biopsy",
"path": "/Python/site_dpm/topgo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ethereum/web3.py path: /web3/utils/caching.py
from collections import (
OrderedDict,
)
from typing import (
Any,
Dict,
Optional,
Tuple,
)
class SimpleCache:
def __init__(self, size: int = 100):
self._size = size
self._data: OrderedDict[str, Any] = Ordered... | code_fim | hard | {
"lang": "python",
"repo": "ethereum/web3.py",
"path": "/web3/utils/caching.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cache(self, key: str, value: Any) -> Tuple[Any, Dict[str, Any]]:
evicted_items = None
# If the key is already in the OrderedDict just update it
# and don't evict any values. Ideally, we could still check to see
# if there are too many items in the OrderedDict but th... | code_fim | medium | {
"lang": "python",
"repo": "ethereum/web3.py",
"path": "/web3/utils/caching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_cache_entry(self, key: str) -> Optional[Any]:
return self._data[key] if key in self._data else None
def clear(self) -> None:
self._data.clear()
def items(self) -> Dict[str, Any]:
return self._data
def pop(self, key: str) -> Optional[Any]:
if key n... | code_fim | hard | {
"lang": "python",
"repo": "ethereum/web3.py",
"path": "/web3/utils/caching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
## Functions for solving for the proper level of sky subtraction ##
def get_std_sky(scale, name, num):
"""Attempt a sky subtraction at a given scaling, and return a metric of
how good that scaling is.
A proper sky subraction should result in a basically smooth continuum
left, ... | code_fim | hard | {
"lang": "python",
"repo": "tungol/mslit",
"path": "/mslit/sky.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tungol/mslit path: /mslit/sky.py
#!/usr/bin/env python
# encoding: utf-8
"""
Functions related to sky subtraction.
high level iraf wrappers: combine_sky_spectra, setairmass_galaxy, skies
sky_subtract_galaxy
low level FITS functions: find_line_peak, find_lines, get_cont... | code_fim | hard | {
"lang": "python",
"repo": "tungol/mslit",
"path": "/mslit/sky.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return the root means square of the continuum values around a
location."""
upcont_num = base(location, data, 1)
downcont_num = base(location, data, -1)
data = data.tolist()
values = data[upcont_num:(upcont_num + 3)]
values.extend(data[(downcont_num - 3):downcont_num])
... | code_fim | hard | {
"lang": "python",
"repo": "tungol/mslit",
"path": "/mslit/sky.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OkThought/cryptocmp path: /cryptocmp/api/price/single.py
from cryptocmp import decorators
@decorators.response_error_raise
@decorators.get('data/price')
def get(
coin,
in_coins,
try_conversion=None,
exchange=None,
extra_params=None,
sign=None,
):
... | code_fim | hard | {
"lang": "python",
"repo": "OkThought/cryptocmp",
"path": "/cryptocmp/api/price/single.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(in_coins, (tuple, list)):
in_coins = ','.join(in_coins)
return {
'tryConversion': try_conversion,
'fsym': coin,
'tsyms': in_coins,
'e': exchange,
'extraParams': extra_params,
'sign': sign,
}<|fim_prefix|># repo: OkThought/c... | code_fim | medium | {
"lang": "python",
"repo": "OkThought/cryptocmp",
"path": "/cryptocmp/api/price/single.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Example:
cryptocmp.price.single.get('BTC', ('USD','JPY','EUR'))
{
'USD': 6114.94,
'JPY': 679420.45,
'EUR': 5373.64,
}
"""
if isinstance(in_coins, (tuple, list)):
in_coins = ','.join(in_coins)
return {
't... | code_fim | hard | {
"lang": "python",
"repo": "OkThought/cryptocmp",
"path": "/cryptocmp/api/price/single.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.