text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> self.loop.add_signal_handler(signal.SIGQUIT, self.handle_quit,
signal.SIGQUIT, None)
self.loop.add_signal_handler(signal.SIGTERM, self.handle_exit,
signal.SIGTERM, None)
self.loop.add_signal_handler(signal.... | code_fim | hard | {
"lang": "python",
"repo": "jeamland/guvnor",
"path": "/guvnor/sanic_worker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: airshipit/drydock path: /python/drydock_provisioner/objects/hostprofile.py
ysical device address. If the device attribute does not match an
# alias, we assume it directly identifies a OS device name. When the
# apply_hardware_profile method is called on the parent Node of this
# devic... | code_fim | hard | {
"lang": "python",
"repo": "airshipit/drydock",
"path": "/python/drydock_provisioner/objects/hostprofile.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(**kwargs)
self.physical_devices = []
def get_name(self):
return self.name
def get_id(self):
return self.name
def add_partition(self, partition):
self.partitions.append(partition)
@staticmethod
def merge_lists(child_list, pare... | code_fim | hard | {
"lang": "python",
"repo": "airshipit/drydock",
"path": "/python/drydock_provisioner/objects/hostprofile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if parent_list is None:
return child_list
effective_list = []
if len(child_list) == 0 and len(parent_list) > 0:
for p in parent_list:
pp = deepcopy(p)
pp.source = hd_fields.ModelSource.Compiled
effective_list... | code_fim | hard | {
"lang": "python",
"repo": "airshipit/drydock",
"path": "/python/drydock_provisioner/objects/hostprofile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>iso = Isomap(n_neighbors=6,n_components=3)
iso.fit(df_merge.drop('col',axis=1))
T = iso.fit_transform(df_merge.drop('col',axis=1))
iso2 = Isomap(n_neighbors=6,n_components=3)
iso2.fit(df)
Ti = iso2.fit_transform(dfi)
#
# TODO: Create a 2D Scatter plot to graph your manifold. You
# can use either 'o'... | code_fim | hard | {
"lang": "python",
"repo": "luuduytung/programming-with-python-for-data-science-microsoft",
"path": "/Module4/assignment5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luuduytung/programming-with-python-for-data-science-microsoft path: /Module4/assignment5.py
import pandas as pd
from scipy import misc
import glob
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.pyplot as plt
# Look pretty...
# matplotlib.style.use('ggplot')
plt.style... | code_fim | hard | {
"lang": "python",
"repo": "luuduytung/programming-with-python-for-data-science-microsoft",
"path": "/Module4/assignment5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: amjadtaleb/PyTrinamic path: /PyTrinamic/modules/TMCM0010OPC/examples/TMCL/config_update.py
#!/usr/bin/env python3
'''
Created on 30.12.2018
@author: ED
'''
if __name__ == '__main__':
pass
import PyTrinamic
from PyTrinamic.connections.ConnectionManager import ConnectionManager
from PyTrinam... | code_fim | medium | {
"lang": "python",
"repo": "amjadtaleb/PyTrinamic",
"path": "/PyTrinamic/modules/TMCM0010OPC/examples/TMCL/config_update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>" set voltage limit to 50V and hysteresis to 1V"
myInterface.setAndStoreAxisParameter(brakeChopper.AP_VoltageLimit, 0, 500)
myInterface.setAndStoreAxisParameter(brakeChopper.AP_Hysteresis, 0, 10)
" show new config "
brakeChopper.showConfiguration()
myInterface.close()<|fim_prefix|># repo: amjadtaleb/PyT... | code_fim | hard | {
"lang": "python",
"repo": "amjadtaleb/PyTrinamic",
"path": "/PyTrinamic/modules/TMCM0010OPC/examples/TMCL/config_update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''
def random_node_suppression(g, k):
n_nodes = len(g)
l = [random.randint(0, n_nodes) for i in range(k)]
g.remove_nodes(l)
diff = n_nodes - len(g)
g.add_nodes(diff, {'h': torch.zeros(diff)})
return g
'''
def random_geometric_graph(size, p=0.058):
'''
size: sqrt of numb... | code_fim | hard | {
"lang": "python",
"repo": "Axeln78/SpectralDGL",
"path": "/lib/graphs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return transform(g)
def contracted(g, contraction_list):
'''https://networkx.github.io/documentation/networkx-1.10/reference/generated/networkx.algorithms.minors.contracted_nodes.html#networkx.algorithms.minors.contracted_nodes
Parameters:
-----------
G : graph of type DGLGraph
... | code_fim | hard | {
"lang": "python",
"repo": "Axeln78/SpectralDGL",
"path": "/lib/graphs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Axeln78/SpectralDGL path: /lib/graphs.py
'''
This file is a regroupment of functions that are supposed to create different lattices to test some hypothesis of laplacian proprieties
'''
# Libraries
import dgl
import networkx as nx
import random
import copy
import dgl
#from dgl import BatchedDGLG... | code_fim | hard | {
"lang": "python",
"repo": "Axeln78/SpectralDGL",
"path": "/lib/graphs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(step_num):
x_history.append(x.copy())
grad = numerical_gradient(f, x)
x -= lr * grad
return x, np.array(x_history)
def function_2(x):
return x[0]**2 + x[1]**2
init_x = np.array([-3.0, 4.0])
lr = 0.1
step_num = 20
x, x_history = gradient_descent(func... | code_fim | hard | {
"lang": "python",
"repo": "WzqProgrammer/DeepLearning",
"path": "/LearnProjects/ch04/gradient_descent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def function_2(x):
return x[0]**2 + x[1]**2
init_x = np.array([-3.0, 4.0])
lr = 0.1
step_num = 20
x, x_history = gradient_descent(function_2, init_x, lr, step_num)
plt.plot([-5, 5], [0, 0], '--b')
plt.plot([0, 0], [-5, 5], '--b')
plt.plot(x_history[:,0], x_history[:,1], 'o')
plt.xlim(-3.5, 3.5)
p... | code_fim | medium | {
"lang": "python",
"repo": "WzqProgrammer/DeepLearning",
"path": "/LearnProjects/ch04/gradient_descent.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WzqProgrammer/DeepLearning path: /LearnProjects/ch04/gradient_descent.py
#coding: utf-8
import numpy as np
import matplotlib.pylab as plt
from ch04.gradient_2d import numerical_gradient
def gradient_descent(f, init_x, lr=0.01, step_num=100):
<|fim_suffix|> return x[0]**2 + x[1]**2
init_x = n... | code_fim | hard | {
"lang": "python",
"repo": "WzqProgrammer/DeepLearning",
"path": "/LearnProjects/ch04/gradient_descent.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ctogle/daw_receiver path: /daw_receiver.py
import modular_core.fundamental as lfu
#import modular_dr.gui.libqtgui_daw_receiver as praqg
if __name__ == '__main__<|fim_suffix|>r.gui.libqtgui_daw_receiver')
lfu.gui_pack.initialize()<|fim_middle|>':
lfu.using_gui = True
lfu.set_gui_pack(... | code_fim | easy | {
"lang": "python",
"repo": "ctogle/daw_receiver",
"path": "/daw_receiver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>':
lfu.using_gui = True
lfu.set_gui_pack('modular_dr.gui.libqtgui_daw_receiver')
lfu.gui_pack.initialize()<|fim_prefix|># repo: ctogle/daw_receiver path: /daw_receiver.py
import modular_core.fundamental as lfu
#import modular_dr.g<|fim_middle|>ui.libqtgui_daw_receiver as praqg
if __name__ ==... | code_fim | easy | {
"lang": "python",
"repo": "ctogle/daw_receiver",
"path": "/daw_receiver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rahul263-stack/covid19-severity-prediction path: /data_new/county_level/processed/medicare_chronic/clean.py
#! /usr/bin/python3
import pandas as pd
from os.path import join as oj
import os
from ...raw.medicare_chronic.load import load_medicare_chronic
def clean_medicare_chronic(data_dir='../..... | code_fim | medium | {
"lang": "python",
"repo": "rahul263-stack/covid19-severity-prediction",
"path": "/data_new/county_level/processed/medicare_chronic/clean.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # load in data
df = load_medicare_chronic(data_dir = data_dir)
# county FIPS to string with padded zeros
df = df.dropna(subset = ['countyFIPS'])
df['countyFIPS'] = df['countyFIPS'].astype(int).astype(str).str.zfill(5)
# write out to csv
df.to_csv(oj(out_dir, "medicare... | code_fim | hard | {
"lang": "python",
"repo": "rahul263-stack/covid19-severity-prediction",
"path": "/data_new/county_level/processed/medicare_chronic/clean.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: silx-kit/silx path: /src/silx/io/test/test_dictdump.py
1.1,
("", "str"): "a",
("", "boollist"): [True, False, True],
("", "intlist"): [11, 22, 33],
("", "floatlist"): [1.1, 2.2, 3.3],
("", "strlist"): ["a", "bb", "ccc"],
}
... | code_fim | hard | {
"lang": "python",
"repo": "silx-kit/silx",
"path": "/src/silx/io/test/test_dictdump.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def testDereferenceLinks(self):
ddict = h5todict(self.h5_fname, path="links", dereference_links=True)
self.assertTrue(ddict["absolute_softlink"], 10)
self.assertTrue(ddict["relative_softlink"], 10)
self.assertTrue(ddict["external_link"], 10)
self.assertTrue(ddic... | code_fim | hard | {
"lang": "python",
"repo": "silx-kit/silx",
"path": "/src/silx/io/test/test_dictdump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.skipif(pint is None, reason="Require pint")
def test_dicttonx_pint(tmp_h5py_file):
ureg = pint.UnitRegistry()
treedict = {
"array_mm": pint.Quantity([1, 2, 3], ureg.mm),
"value_kg": 3 * ureg.kg,
}
dictdump.dicttonx(treedict, tmp_h5py_file)
result = dictd... | code_fim | hard | {
"lang": "python",
"repo": "silx-kit/silx",
"path": "/src/silx/io/test/test_dictdump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Resourceful way to parse sys.argv and then expand a ``*args``."""
_, *args = sys.argv[:]
if len(args) > 0:
print(pydoc.getdoc(*args))
return pydoc.getdoc(*args)
def were_in_ipython():
"""Call ipython to make sure we're really in it."""
shell = get_ipython()
if ... | code_fim | hard | {
"lang": "python",
"repo": "farisachugthai/dynamic_ipython",
"path": "/default_profile/util/pager2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: farisachugthai/dynamic_ipython path: /default_profile/util/pager2.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import contextlib
import io
import logging
import pydoc
import shlex
import sys
# seriously use pydocs
# from inspect import getdoc
from IPython.core.getipython import get_ipython
... | code_fim | hard | {
"lang": "python",
"repo": "farisachugthai/dynamic_ipython",
"path": "/default_profile/util/pager2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> oname = args and args or '_'
info = self.shell._ofind(oname)
if info['found']:
txt = (raw and str or pformat)(info['obj'])
if 'o' in opts:
logging.warning('Second')
self.blocking_pager(txt, cmd='bat --page never ')
... | code_fim | hard | {
"lang": "python",
"repo": "farisachugthai/dynamic_ipython",
"path": "/default_profile/util/pager2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: loco-3d/sot-talos-balance path: /src/dynamic_graph/sot_talos_balance/talos/base_estimator_conf.py
""" ********************* USER-PARAMETERS OF BASE ESTIMATOR *********************** """
# K = (4034, 23770, 239018, 707, 502, 936); #HRP2
# K = (1., 1., 1., 1., 1.... | code_fim | hard | {
"lang": "python",
"repo": "loco-3d/sot-talos-balance",
"path": "/src/dynamic_graph/sot_talos_balance/talos/base_estimator_conf.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>w_lf_in = 0.0
w_rf_in = 1.0
# mu = 0.3; # force friction coefficient<|fim_prefix|># repo: loco-3d/sot-talos-balance path: /src/dynamic_graph/sot_talos_balance/talos/base_estimator_conf.py
""" ********************* USER-PARAMETERS OF BASE ESTIMATOR *********************** """
# K... | code_fim | hard | {
"lang": "python",
"repo": "loco-3d/sot-talos-balance",
"path": "/src/dynamic_graph/sot_talos_balance/talos/base_estimator_conf.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zppppppx/2021_ruixinwei_soundrecognition path: /src/pl_solver_cnn_dfl.py
from model.models import CRNN
import torch
import pytorch_lightning as pl
from dataset.wav_data import WavDataset
from config import Config
from torch.utils.data import DataLoader
from einops import rearrange
from pytorch_li... | code_fim | hard | {
"lang": "python",
"repo": "zppppppx/2021_ruixinwei_soundrecognition",
"path": "/src/pl_solver_cnn_dfl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
cfg = Config()
# n_gpus = 2
n_gpus = 4
# model = LitModel(lr=5e-4)
# debug = True
debug = False
# test = True
test = False
description = "original"
cfg.train_cfg.debug = debug
model = LitModel(cfg)
# checkpoint = "./saved_models/... | code_fim | hard | {
"lang": "python",
"repo": "zppppppx/2021_ruixinwei_soundrecognition",
"path": "/src/pl_solver_cnn_dfl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karagioz/python_training path: /test/test_remove_contact_from_group.py
from model.group import Group
from model.contact import Contact
import random
import pytest
def test_remove_contact_from_group(app, db, orm):
with pytest.allure.step('Given a non-empty list of groups which include some c... | code_fim | hard | {
"lang": "python",
"repo": "karagioz/python_training",
"path": "/test/test_remove_contact_from_group.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>n orm.get_contacts_in_group(group))
with pytest.allure.step('When I remove the contact from the group'):
app.contact.remove_contact_from_group(contact, group)
with pytest.allure.step('Then the group does not contain this contact any more'):
assert (contact not in orm.get_contacts_i... | code_fim | hard | {
"lang": "python",
"repo": "karagioz/python_training",
"path": "/test/test_remove_contact_from_group.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #价格接口
price_url = 'https://p.3.cn/prices/mgets?skuIds=J_{id}'
#评论接口
conment_url = 'https://club.jd.com/comment/productPageComments.action?productId={id}&score=0&sortType=5&page={page}&pageSize=10'
#请求列表页
def start_requests(self):
Shoop_name(self.shoop)
for page in... | code_fim | hard | {
"lang": "python",
"repo": "jjk13593527343/smart_login",
"path": "/project/jdspider/jingdo/jingdo/spiders/jd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjk13593527343/smart_login path: /project/jdspider/jingdo/jingdo/spiders/jd.py
# -*- coding: utf-8 -*-
import scrapy
from scrapy.http import Request
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from jingdo.unity.page_cralw import get_page,Shoop_name
from scrapy_redis.s... | code_fim | hard | {
"lang": "python",
"repo": "jjk13593527343/smart_login",
"path": "/project/jdspider/jingdo/jingdo/spiders/jd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #解析商品信息
def parseSshoopInfo(self,response):
item = Shoop_Info()
shoop_title = response.meta.get('title_name')
shoop_id = response.meta.get('shoop_id')
print(shoop_id)
shoop_url = response.meta.get('url')
shoop_price = json.loads(response.text[1:-2])[... | code_fim | hard | {
"lang": "python",
"repo": "jjk13593527343/smart_login",
"path": "/project/jdspider/jingdo/jingdo/spiders/jd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subprocess.call(['i3-msg', 'workspace', str(avaliable_workspace)])
with open('/home/ben/i3msg', 'wb') as f:
f.write(
subprocess.Popen(['i3-msg','-t','get_tree'], stdout=subprocess.PIPE)
.stdout.read())
else:
subprocess.call(['i3-msg', 'workspace', 'back_and_fort... | code_fim | hard | {
"lang": "python",
"repo": "bennyyip/dotfiles",
"path": "/config/.config/i3/scripts/to_avaliable_workspace.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bennyyip/dotfiles path: /config/.config/i3/scripts/to_avaliable_workspace.py
import subprocess
import json
is_empty = len(
subprocess.Popen(['i3-save-tree'], stdout=subprocess.PIPE)
.stdout.read()) > 20
if (is_empty):
workspaces = json.loads(
subprocess.Popen(
['... | code_fim | medium | {
"lang": "python",
"repo": "bennyyip/dotfiles",
"path": "/config/.config/i3/scripts/to_avaliable_workspace.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: francisc112/EDHEC_PORT path: /.ipynb_checkpoints/edhec_management-checkpoint.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 6 19:20:53 2021
@author: francisco
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import requests
from scipy.optimiz... | code_fim | hard | {
"lang": "python",
"repo": "francisc112/EDHEC_PORT",
"path": "/.ipynb_checkpoints/edhec_management-checkpoint.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def plot_ef(self,er,cov,n_points):
"""
Plots the 2 asset efficient frontier
"""
weights = self.optimal_weights(n_points,er,cov)
rets = [self.portfolio_returns(w,er) for w in weights]
vols = [sel... | code_fim | hard | {
"lang": "python",
"repo": "francisc112/EDHEC_PORT",
"path": "/.ipynb_checkpoints/edhec_management-checkpoint.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shawnsarwar/aether-firebase-cloud-triggers path: /cloud/fb_move.py
# Copyright (C) 2020 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.... | code_fim | hard | {
"lang": "python",
"repo": "shawnsarwar/aether-firebase-cloud-triggers",
"path": "/cloud/fb_move.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _make_wildcard_writer(source: DBType, mode: Mode):
# requires `doc_type` etc be passed in as a wildcard
# then picked up from the context.params dict
# like:
# /some/path/{doc_type}/{maybe_an_id}
# format specified in CONF.path_template
LOG.debug('Creating writer (wildcard)')
... | code_fim | hard | {
"lang": "python",
"repo": "shawnsarwar/aether-firebase-cloud-triggers",
"path": "/cloud/fb_move.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def process_code(the_code):
line = 0
accumulator = 0
visited = set()
while line < len(the_code):
if line in visited:
return accumulator, False
visited.add(line)
op, num = the_code[line]
num = int(num)
if op == 'jmp':
line += num
continue
elif op == 'acc':
... | code_fim | medium | {
"lang": "python",
"repo": "mboos/advent-of-code",
"path": "/2020/day/8/loop.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main(argv):
if len(argv) > 2:
raise app.UsageError('Too many command-line arguments.')
with open(FLAGS.input) as fp:
the_code = [line.split() for line in fp]
accumulator, _ = process_code(the_code)
print(f'Accumulator value at beginning of loop: {accumulator}')
for line in range(len... | code_fim | hard | {
"lang": "python",
"repo": "mboos/advent-of-code",
"path": "/2020/day/8/loop.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mboos/advent-of-code path: /2020/day/8/loop.py
# Lint as: python3
"""Find value of accumulator at start of loop
Solution to https://adventofcode.com/2020/day/8
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
f... | code_fim | medium | {
"lang": "python",
"repo": "mboos/advent-of-code",
"path": "/2020/day/8/loop.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: REISOGLU53/OpenCV-Python path: /07_Haar_Cascade/04_Videodan_Goz_Algılama.py
import cv2
#cap = cv2.VideoCapture("eye.mp4")
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface.xml")
eye_cascade = cv2.CascadeClassifier("haarcascade_eye.xml")
... | code_fim | hard | {
"lang": "python",
"repo": "REISOGLU53/OpenCV-Python",
"path": "/07_Haar_Cascade/04_Videodan_Goz_Algılama.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> eyes = eye_cascade.detectMultiScale(frame)
for (x1, y1, w1, h1) in eyes:
if (x1>x and y1>y) and (w1<w and h1<h): cv2.rectangle(frame, (x1, y1),
(x1+w1, y1+h1),
... | code_fim | hard | {
"lang": "python",
"repo": "REISOGLU53/OpenCV-Python",
"path": "/07_Haar_Cascade/04_Videodan_Goz_Algılama.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sudosubin/bins path: /src/collection/lokalise2.py
import sys
from package import Package
from package.source import PackageSource
from utils import hardware
<|fim_suffix|> repo = 'lokalise/lokalise-cli-2-go'
source = PackageSource.GITHUB_RELEASE
if sys.platform == 'linux' and hardw... | code_fim | medium | {
"lang": "python",
"repo": "sudosubin/bins",
"path": "/src/collection/lokalise2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bin_pattern = ['./lokalise2']
link_pattern = {'./lokalise2': '$BIN_DIR/lokalise2'}<|fim_prefix|># repo: sudosubin/bins path: /src/collection/lokalise2.py
import sys
from package import Package
from package.source import PackageSource
from utils import hardware
<|fim_middle|>class Lokalise2(Pac... | code_fim | hard | {
"lang": "python",
"repo": "sudosubin/bins",
"path": "/src/collection/lokalise2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nnnlife/trader path: /agent/winvm/cybos_api/abroad_chart.py
import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..' + os.sep + '..' + os.sep + '..')))
import win32com.client
from utils import time_converter
from datetime import datetime, timedelta
from morn... | code_fim | hard | {
"lang": "python",
"repo": "nnnlife/trader",
"path": "/agent/winvm/cybos_api/abroad_chart.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_len = chart_obj.GetHeaderValue(3)
for i in range(data_len):
d = {}
for j in range(6):
d[str(j)] = chart_obj.GetDataValue(j, i)
data.append(d)
data = sorted(data, key=lambda x: x['0'])
return len(data), data<|fim_prefix|># repo: nnnlife/trader path... | code_fim | hard | {
"lang": "python",
"repo": "nnnlife/trader",
"path": "/agent/winvm/cybos_api/abroad_chart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = []
conn = connection.Connection()
while conn.request_left_count() <= 0:
print('Request Limit is reached')
time.sleep(1)
chart_obj= win32com.client.gencache.EnsureDispatch("Dscbo1.CpSvr8300")
chart_obj.SetInputValue(0, code)
chart_obj.SetInputValue(1, ord(per... | code_fim | hard | {
"lang": "python",
"repo": "nnnlife/trader",
"path": "/agent/winvm/cybos_api/abroad_chart.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns a Playlist object with the tracks attribute complete, or None
if there is an error.
"""
headers = {}
headers["Authorization"] = "Bearer {}".format(accesstoken)
limit = 100
payload = {}
payload["limit"] = limit
payload["offset"] = 0
r = requests.g... | code_fim | hard | {
"lang": "python",
"repo": "dherg/playlistflow",
"path": "/clplaylistflow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dherg/playlistflow path: /clplaylistflow.py
er"]) + 1)
# try again
return(getuserid(accesstoken))
else:
print(response["error"])
return(None)
else:
print('error: getuserid request failed')
... | code_fim | hard | {
"lang": "python",
"repo": "dherg/playlistflow",
"path": "/clplaylistflow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dherg/playlistflow path: /clplaylistflow.py
if response["error"]["status"] == 429:
# wait for the amount of time specified in response header
time.sleep(int(r.headers["Retry-After"]) + 1)
# try again
return(... | code_fim | hard | {
"lang": "python",
"repo": "dherg/playlistflow",
"path": "/clplaylistflow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ThilinaRajapakse/simpletransformers path: /simpletransformers/classification/transformer_models/camembert_model.py
from transformers.models.camembert.configuration_camembert import CamembertConfig
from transformers.models.camembert.modeling_camembert import (
CAMEMBERT_PRETRAINED_MODEL_ARCHIV... | code_fim | medium | {
"lang": "python",
"repo": "ThilinaRajapakse/simpletransformers",
"path": "/simpletransformers/classification/transformer_models/camembert_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> r"""
**labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size,)``:
Labels for computing the sequence classification/regression loss.
Indices should be in ``[0, ..., config.num_labels]``.
If ``config.num_labels == 1`` a regression loss is computed... | code_fim | medium | {
"lang": "python",
"repo": "ThilinaRajapakse/simpletransformers",
"path": "/simpletransformers/classification/transformer_models/camembert_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @testfixtures.log_capture()
def test_split_genotype_likelihood_with_missing_genotype_likelihood_haploid(self, log):
split_func = make_split_sample_alt_func("G", lambda x: x)
self.assertEqual(
[[None, None], [None, None]],
split_func([1.0, 2.0], 2, GenotypeCa... | code_fim | hard | {
"lang": "python",
"repo": "dylex/wecall",
"path": "/test/test_utils/vcfutils/test_fieldmetadata.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dylex/wecall path: /test/test_utils/vcfutils/test_fieldmetadata.py
# All content Copyright (C) 2018 Genomics plc
import unittest
import testfixtures
from wecall.vcfutils import fieldmetadata
from wecall.common.exceptions import weCallException
from wecall.vcfutils.fieldmetadata import make_spli... | code_fim | hard | {
"lang": "python",
"repo": "dylex/wecall",
"path": "/test/test_utils/vcfutils/test_fieldmetadata.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> split_func = make_split_sample_alt_func("G", lambda x: x)
self.assertEqual(
[[1.0, 2.0], [1.0, 3.0]],
split_func([1.0, 2.0, 3.0], 2, GenotypeCall("0"))
)
def test_split_genotype_likelihood_with_correct_number_of_genotypes_diploid_multi_allelic(self):
... | code_fim | hard | {
"lang": "python",
"repo": "dylex/wecall",
"path": "/test/test_utils/vcfutils/test_fieldmetadata.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: austinmilt/video-game-view path: /server/deployment/detection/replays.py
"""
Copyright 2018 Austin Walker Milt
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.apac... | code_fim | hard | {
"lang": "python",
"repo": "austinmilt/video-game-view",
"path": "/server/deployment/detection/replays.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, name='', data=[]):
"""
Heroes are objects for summarizing and doing operations on hero state
data in a dota 2 match replay.
Args:
name (str): (optional) name of hero. Default is empty.
data (list): (option... | code_fim | hard | {
"lang": "python",
"repo": "austinmilt/video-game-view",
"path": "/server/deployment/detection/replays.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jerryzh168/caffe2-benchmarking path: /benchmarking/get_connected_androids.py
#!/usr/bin/env python3
##############################################################################
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license fo... | code_fim | medium | {
"lang": "python",
"repo": "jerryzh168/caffe2-benchmarking",
"path": "/benchmarking/get_connected_androids.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self):
driver = AndroidDriver()
platforms = driver.getAndroidPlatforms("")
androids = {}
for p in platforms:
androids[p.platform] = p.platform_hash
json_str = json.dumps(androids)
print(json_str)
return json_str
if __name__ ... | code_fim | hard | {
"lang": "python",
"repo": "jerryzh168/caffe2-benchmarking",
"path": "/benchmarking/get_connected_androids.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esaye/pymtl path: /pclib/rtl/queues.py
BypassQueue( Model ):
def __init__( s, dtype ):
s.enq = InValRdyBundle ( dtype )
s.deq = OutValRdyBundle( dtype )
# set high if full
s.full = OutPort( 1 )
# Ctrl and Dpath unit instantiation
s.ctrl = SingleElementBypassQueueC... | code_fim | hard | {
"lang": "python",
"repo": "esaye/pymtl",
"path": "/pclib/rtl/queues.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: esaye/pymtl path: /pclib/rtl/queues.py
( 1 )
s.enq_rdy = OutPort ( 1 )
s.deq_val = OutPort ( 1 )
s.deq_rdy = InPort ( 1 )
# Control signal (ctrl -> dpath)
s.wen = OutPort ( 1 )
s.bypass_mux_sel = OutPort ( 1 )
# Full bit storage
... | code_fim | hard | {
"lang": "python",
"repo": "esaye/pymtl",
"path": "/pclib/rtl/queues.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # enq ptr incrementer
if s.enq_ptr == s.last_idx: s.enq_ptr_inc.value = 0
else: s.enq_ptr_inc.value = s.enq_ptr + 1
# deq ptr incrementer
if s.deq_ptr == s.last_idx: s.deq_ptr_inc.value = 0
else: s.deq_ptr_inc.value = s.deq... | code_fim | hard | {
"lang": "python",
"repo": "esaye/pymtl",
"path": "/pclib/rtl/queues.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rohan131293/net path: /net/utility/Formatter.py
from __future__ import print_function
from LogConfig import *
import binascii
import socket
import sys
import os
class Formatter:
python_version=sys.version.split(' ')[0] >'3'
#To-Do: Validation is to be added for IP and MAC
@staticmethod
def... | code_fim | hard | {
"lang": "python",
"repo": "Rohan131293/net",
"path": "/net/utility/Formatter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while(int(columns)<(spacePerBit*8)):
spacePerBit-=2
print()
#Printing Numbers
for i in range (8,0,-1):
space(spacePerBit/2)
print(i,end='')
space(spacePerBit/2)
index=0
first_line(spacePerBit)
for block in blockList:
if(type(block)!=dict):
logging.error('Received '+typ... | code_fim | hard | {
"lang": "python",
"repo": "Rohan131293/net",
"path": "/net/utility/Formatter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
"element",
"Element",
"event",
"Events",
"dialect",
"html",
"Layout",
"server",
"Var",
"vdom",
"Image",
"Eval",
"Import",
"hotswap",
"display",
"Input",
"html_to_vdom",
]<|fim_prefix|># repo: jorgerpo/idom path: /src/py/idom/... | code_fim | hard | {
"lang": "python",
"repo": "jorgerpo/idom",
"path": "/src/py/idom/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jorgerpo/idom path: /src/py/idom/__init__.py
__version__ = "0.6.0-a.4"
from . import server
from .core.element import element, Element
from .core.events import event, Events
from .core.layout import Layout
from .core.vdom import vdom
from .widgets.html import html
from .widgets.common import h... | code_fim | hard | {
"lang": "python",
"repo": "jorgerpo/idom",
"path": "/src/py/idom/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
__all__ = [
"element",
"Element",
"event",
"Events",
"dialect",
"html",
"Layout",
"server",
"Var",
"vdom",
"Image",
"Eval",
"Import",
"hotswap",
"display",
"Input",
"html_to_vdom",
]<|fim_prefix|># repo: jorgerpo/idom path: /src/py/idom... | code_fim | hard | {
"lang": "python",
"repo": "jorgerpo/idom",
"path": "/src/py/idom/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Python-Parallel-Programming-Cookbook-Second-Edition path: /Chapter06/Pyro4/Second Example/server_chain_1.py
import Pyro4
import chainTopology
current_server = "1"
next_server = "2"
<|fim_suffix|># enter the service loop.
print("server_%s started " % current_server)
daemon.reque... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Python-Parallel-Programming-Cookbook-Second-Edition",
"path": "/Chapter06/Pyro4/Second Example/server_chain_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("server_%s started " % current_server)
daemon.requestLoop()<|fim_prefix|># repo: PacktPublishing/Python-Parallel-Programming-Cookbook-Second-Edition path: /Chapter06/Pyro4/Second Example/server_chain_1.py
import Pyro4
import chainTopology
current_server = "1"
next_server = "2"
servername = "examp... | code_fim | medium | {
"lang": "python",
"repo": "PacktPublishing/Python-Parallel-Programming-Cookbook-Second-Edition",
"path": "/Chapter06/Pyro4/Second Example/server_chain_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShanmukhaSrinivas/python-75-hackathon path: /GUI.py
#Graphical User Interface
from tkinter import *
from urllib.request import urlopen
import urllib
from bs4 import BeautifulSoup
from tkinter import messagebox
import _tkinter
window = Tk()
window.geometry("600x500")
def fetch_url():
<|fim_suffix... | code_fim | hard | {
"lang": "python",
"repo": "ShanmukhaSrinivas/python-75-hackathon",
"path": "/GUI.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> e1.delete(0, 'end')
t1.delete(1.0,END)
l1 = Label(window, text='Enter the url to extract code', pady=10)
l1.grid(row=0, column=1)
url = StringVar()
e1=Entry(window, textvariable=url)
e1.grid(column=1, row=1)
btn1 = Button(window,text='GO',command=fetch_url)
btn1.grid(column=1,row=2)
btn2 = Button(... | code_fim | hard | {
"lang": "python",
"repo": "ShanmukhaSrinivas/python-75-hackathon",
"path": "/GUI.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elvisaronsp/heltour path: /heltour/tournament/lichessapi.py
import requests
import time
import json
from django.core.cache import cache
import logging
from heltour import settings
logger = logging.getLogger(__name__)
def _apicall(url, timeout=120, check_interval=0.1, post_data=None):
# Make... | code_fim | hard | {
"lang": "python",
"repo": "elvisaronsp/heltour",
"path": "/heltour/tournament/lichessapi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_game_meta(gameid, priority=0, max_retries=3, timeout=120):
url = '%s/lichessapi/game/export/%s?priority=%s&max_retries=%s&format=application/json' % (settings.API_WORKER_HOST, gameid, priority, max_retries)
result = _apicall(url, timeout)
if result == '':
raise ApiWorkerError('... | code_fim | hard | {
"lang": "python",
"repo": "elvisaronsp/heltour",
"path": "/heltour/tournament/lichessapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyflosic/pyeff path: /src/pyeff_ewald_energy_force_numba.py
rom pyeff_energy_force import system
from numba import jit
# notes
#--------------------------------------------------------------------
# erf ... takes complex arguments
# deriverative ... d/dz erf(z) = 2/ sqrt(Pi)... | code_fim | hard | {
"lang": "python",
"repo": "pyflosic/pyeff",
"path": "/src/pyeff_ewald_energy_force_numba.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # from sympy calculations
dE_up_downds2 = -1.0*0.9*rho*(-32.0*r**2*sj**2.0*(si*sj/(si**2.0 + sj**2.0))**3.0*(8.0*(si*sj/(si**2.0 + sj**2.0))**3.0 + 1.0*np.exp(2.0*r**2/(si**2 + sj**2)))*(si**2*sj**2*(4.0*r**2 - 6.0*si**2 - 6.0*sj**2) + 1.5*si**2*(si**2 + sj**2)**2 + 1.5*sj... | code_fim | hard | {
"lang": "python",
"repo": "pyflosic/pyeff",
"path": "/src/pyeff_ewald_energy_force_numba.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # this function is similar to the E_Pauli function
# but includes minima image coniditions for periodic boundary conditions (pbcs)
Pauli_rho = -0.2
Pauli_r = 1.125
Pauli_s = 0.9
def E_up_up(rho,r,si,sj):
# from sympy calculations
E_up_up = (8.0*(-rho + 1.0)*(1/(... | code_fim | hard | {
"lang": "python",
"repo": "pyflosic/pyeff",
"path": "/src/pyeff_ewald_energy_force_numba.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
wikipedia.set_lang(self.lenguage)
page_summary = wikipedia.summary(self.page_name)
return page_summary
except wikipedia.exceptions.PageError:
return 'Page not found :('
except:
return 'Something went w... | code_fim | medium | {
"lang": "python",
"repo": "regalk13/Telegram-bot",
"path": "/modules/wiki_browser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'Page not found :('
except:
return 'Something went wrong :('<|fim_prefix|># repo: regalk13/Telegram-bot path: /modules/wiki_browser.py
import wikipedia
class WikiBrowser:
'''WikiBrowser object to help us to browse something in wikipedia'''
def __... | code_fim | hard | {
"lang": "python",
"repo": "regalk13/Telegram-bot",
"path": "/modules/wiki_browser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: regalk13/Telegram-bot path: /modules/wiki_browser.py
import wikipedia
class WikiBrowser:
'''WikiBrowser object to help us to browse something in wikipedia'''
def __init__(self, page_name, lenguage = 'es'):
self.lenguage = lenguage
self.page_name = page_name
... | code_fim | medium | {
"lang": "python",
"repo": "regalk13/Telegram-bot",
"path": "/modules/wiki_browser.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = self.context['request'].user
validated_data['owner'] = user
return super().create(validated_data)
class UpdateSerializer(IrekuaModelSerializer):
class Meta:
model = PhysicalDevice
fields = (
'serial_number',
'metadata',
)... | code_fim | hard | {
"lang": "python",
"repo": "CONABIO-audio/irekua-rest-api",
"path": "/irekua_rest_api/serializers/devices/physical_devices.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class CreateSerializer(IrekuaModelSerializer):
class Meta:
model = PhysicalDevice
fields = (
'serial_number',
'device',
'metadata',
'bundle',
)
def create(self, validated_data):
user = self.context['request'].user
... | code_fim | hard | {
"lang": "python",
"repo": "CONABIO-audio/irekua-rest-api",
"path": "/irekua_rest_api/serializers/devices/physical_devices.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CONABIO-audio/irekua-rest-api path: /irekua_rest_api/serializers/devices/physical_devices.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework import serializers
from irekua_database.models import PhysicalDevice
from irekua_rest_api.serializers.base import Ire... | code_fim | hard | {
"lang": "python",
"repo": "CONABIO-audio/irekua-rest-api",
"path": "/irekua_rest_api/serializers/devices/physical_devices.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cccaaannn/keylogger path: /main.py
from keylogger import keylogger
log_file_name = "keypresses.log"
sender_mail = ""
sender_password = ""
receiver_mail = ""
mail_subject = "logs"
<|fim_suffix|>klogger = keylogger(log_file_name, sender_mail, sender_password, receiver_mail, mail_subject, wait_tim... | code_fim | medium | {
"lang": "python",
"repo": "cccaaannn/keylogger",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>klogger = keylogger(log_file_name, sender_mail, sender_password, receiver_mail, mail_subject, wait_time_to_send, file_size_to_send)
klogger.start()<|fim_prefix|># repo: cccaaannn/keylogger path: /main.py
from keylogger import keylogger
log_file_name = "keypresses.log"
sender_mail = ""
sender_password = ... | code_fim | medium | {
"lang": "python",
"repo": "cccaaannn/keylogger",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Index referenced records."""
indexer = ReferencedRecordsIndexer()
document_pid = document["pid"]
indexed = dict(pid_type=DOCUMENT_PID_TYPE, record=document)
# keep loans and items as first
# Note: this can be quite inefficient because it potentially retrieves
# a lot of re... | code_fim | hard | {
"lang": "python",
"repo": "inveniosoftware/invenio-app-ils",
"path": "/invenio_app_ils/documents/indexer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class DocumentIndexer(RecordIndexer):
"""Indexer class for Document record."""
def index(self, document, arguments=None, **kwargs):
"""Index a Document."""
super().index(document)
eta = datetime.utcnow() + current_app.config["ILS_INDEXER_TASK_DELAY"]
index_referenc... | code_fim | hard | {
"lang": "python",
"repo": "inveniosoftware/invenio-app-ils",
"path": "/invenio_app_ils/documents/indexer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: inveniosoftware/invenio-app-ils path: /invenio_app_ils/documents/indexer.py
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2020 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""ILS Doc... | code_fim | hard | {
"lang": "python",
"repo": "inveniosoftware/invenio-app-ils",
"path": "/invenio_app_ils/documents/indexer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ordering = ['postscript_name']
db_table = 'FontCenter_font'
app_label = 'Warrentech_FontCenter_Web'<|fim_prefix|># repo: Xiongpq/FontCenter path: /trunk/src/Web/Warrentech_FontCenter_Web/Warrentech_FontCenter_Web/models/FontModels.py
from django.db import models
# Create your... | code_fim | hard | {
"lang": "python",
"repo": "Xiongpq/FontCenter",
"path": "/trunk/src/Web/Warrentech_FontCenter_Web/Warrentech_FontCenter_Web/models/FontModels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xiongpq/FontCenter path: /trunk/src/Web/Warrentech_FontCenter_Web/Warrentech_FontCenter_Web/models/FontModels.py
from django.db import models
# Create your models here.
class Font(models.Model):
<|fim_suffix|> if self.sys_font:
return self.full_name or self.postscript_nam... | code_fim | hard | {
"lang": "python",
"repo": "Xiongpq/FontCenter",
"path": "/trunk/src/Web/Warrentech_FontCenter_Web/Warrentech_FontCenter_Web/models/FontModels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lucasfreire017/Desafios_Python path: /Exercício Python #040 - Aquele clássico da Média.py
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digite a segunda nota: '))
media = (n1 + n2) /2
if medi<|fim_suffix|>if media <=6.9:
print('Com a nota {} e {} a média é {} e o aluno está ... | code_fim | medium | {
"lang": "python",
"repo": "lucasfreire017/Desafios_Python",
"path": "/Exercício Python #040 - Aquele clássico da Média.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>edia))
else:
print('Com a nota {} e {} a média é {} e o aluno está \033[1;34mAPROVADO\033[m'.format(n1, n2, media))<|fim_prefix|># repo: lucasfreire017/Desafios_Python path: /Exercício Python #040 - Aquele clássico da Média.py
n1 = float(input('Digite a primeira nota: '))
n2 = float(input('Digite a s... | code_fim | medium | {
"lang": "python",
"repo": "lucasfreire017/Desafios_Python",
"path": "/Exercício Python #040 - Aquele clássico da Média.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ofa/connect path: /open_connect/accounts/tasks.py
"""Accounts tasks"""
from celery import shared_task
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.timezone import now
from open_connect.mailer.utils import send_email
@shared_task()
def r... | code_fim | hard | {
"lang": "python",
"repo": "ofa/connect",
"path": "/open_connect/accounts/tasks.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> send_email(
email=invite.email,
from_email=settings.DEFAULT_FROM_EMAIL,
subject=u"You're invited to Connect",
text=text,
html=html
)
invite.notified = now()
invite.save()<|fim_prefix|># repo: ofa/connect path: /open_connect/accounts/tasks.py
"""Acc... | code_fim | hard | {
"lang": "python",
"repo": "ofa/connect",
"path": "/open_connect/accounts/tasks.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/py-pyfftw/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.packa... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/py-pyfftw/package.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setup_build_environment(self, env):
env.append_flags("LDFLAGS", self.spec["fftw"].libs.search_flags)<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/py-pyfftw/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Pr... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/py-pyfftw/package.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .mandate_import import MandateImport
from .mandate_import_entry import MandateImportEntry
from .mandate_pdf import MandatePdf
from .payment import Payment
from .payout import Payout
from .payout_item import PayoutItem
from .redirect_flow import RedirectFlow
from .refund import Refund
from .su... | code_fim | hard | {
"lang": "python",
"repo": "ibrahmm22/library-management",
"path": "/frappe-bench/env/lib/python2.7/site-packages/gocardless_pro/resources/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ibrahmm22/library-management path: /frappe-bench/env/lib/python2.7/site-packages/gocardless_pro/resources/__init__.py
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
from .bank_details_lookup import BankDetailsLookup
from .creditor i... | code_fim | hard | {
"lang": "python",
"repo": "ibrahmm22/library-management",
"path": "/frappe-bench/env/lib/python2.7/site-packages/gocardless_pro/resources/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frankbryce/muzero path: /Testing/unit_tests.py
mpy as np
from Games.gym.GymGame import GymGame
from Games.gym.MuZeroModel.NNet import NNetWrapper as GymNet
from Games.hex.HexGame import HexGame
from Games.hex.MuZeroModel.NNet import NNetWrapper as HexNet
from MuZero.MuMCTS import MuZeroMCTS
fr... | code_fim | hard | {
"lang": "python",
"repo": "frankbryce/muzero",
"path": "/Testing/unit_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.