text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>)>> trailer <</Root 1 0 R>>
'''
import sys
#Enforces 2 hex char byte notation. "0" becomes "0x00"
def format_byte(b):
if (len(b) > 2) and (b[0:2] == '0x'):
b = b[2:]
if len(b) == 1:
b = '0' + b
return '0x' + b
def char2hex(c):
return format_byte(hex(ord(c)))
#Convert... | code_fim | hard | {
"lang": "python",
"repo": "nightohl/phoneypdf",
"path": "/pdf/filters/test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Copy path into 4 character (32 bit) words (max 11)
word_array = []
for i in range(11):
word = ''
if len(path):
word += path[0:4] if len(path) >= 4 else path
path = path[len(word):]
if len(word) < 4:
word += chr(0) ... | code_fim | hard | {
"lang": "python",
"repo": "nightohl/phoneypdf",
"path": "/pdf/filters/test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sripathisridhar/sridhar2020ismir path: /utilities/circle_projection.py
import numpy as np
def circle_projection(xy_center, radius, xy_coords):
'''
This function returns coordinates of points projected onto given circle
<|fim_suffix|> Returns
-----
xy_prime : (m,2) array o... | code_fim | medium | {
"lang": "python",
"repo": "sripathisridhar/sridhar2020ismir",
"path": "/utilities/circle_projection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Inputs
-----
xy_center : (x,y) coordinates of center of the circle;
radius : radius of circle;
xy_coords : (m,2) array of m points to be projected;
Returns
-----
xy_prime : (m,2) array of m projected coordinates
'''
vectors = xy_coords - np.transpose(xy_center)
... | code_fim | medium | {
"lang": "python",
"repo": "sripathisridhar/sridhar2020ismir",
"path": "/utilities/circle_projection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloud322/helloScrap path: /selenium_event.py
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
from selenium import webdriver
URL = 'https://kr.investing.com/currencies/'
driver = webdriver.Firefox(executable_path = r'C:\Program Files\Mozilla Firefox\geckodriver.exe')
driver.get(URL)
# 페이지... | code_fim | medium | {
"lang": "python",
"repo": "cloud322/helloScrap",
"path": "/selenium_event.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>## currid=("data-gae=-btc-usd","data-gae=-btc-krw", "data-gae=-eth-usd","data-gae=-bch-krw", "data-gae=-iot-usd")
#종류 data-gae="-btc-usd"
#가격 id="sb_last_945629"
for i in range (0, len(crypcurr)):
findkey = 'a["data-gae=-'+ crypcurr[i] +'"]'
for title in soup.select(findkey):
print(title.... | code_fim | hard | {
"lang": "python",
"repo": "cloud322/helloScrap",
"path": "/selenium_event.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duncanmcelfresh/ActiveRobustPreferenceElicitation path: /preference_classes.py
# This module contains classes for implementing preference elicitation with linear utility, and both static and active
# preference learning.
#
# Also implements function for the approach of Bertsimas & O'Hair (Learnin... | code_fim | hard | {
"lang": "python",
"repo": "duncanmcelfresh/ActiveRobustPreferenceElicitation",
"path": "/preference_classes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def random(cls, num_features, id=None, sphere_size=1.0, seed=None, positive=False):
# generate a random agent, with utility vector uniformly drawn from num_features-dimensional sphere
# seed (optional) : provide a random seed
rs = np.random.RandomState(seed)
... | code_fim | hard | {
"lang": "python",
"repo": "duncanmcelfresh/ActiveRobustPreferenceElicitation",
"path": "/preference_classes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = self.conv1(data)
data = self.conv2(data)
return data
class RandLANetRes(torch.nn.Module):
def __init__(self, *args, **kwargs):
print('Init randlanetres with kwargs: ', kwargs)
super(RandLANetRes, self).__init__()
self._conv = DilatedResidualBl... | code_fim | hard | {
"lang": "python",
"repo": "Yuwenger/deeppointcloud-benchmarks",
"path": "/models/RandLANet/modules.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yuwenger/deeppointcloud-benchmarks path: /models/RandLANet/modules.py
import torch
import torch.nn.functional as F
from torch_geometric.nn import MessagePassing, knn
from models.core_modules import *
from models.core_sampling_and_search import *
import math
class RandlaKernel(MessagePassing):
... | code_fim | hard | {
"lang": "python",
"repo": "Yuwenger/deeppointcloud-benchmarks",
"path": "/models/RandLANet/modules.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>application = tornado.web.Application([
(r"/slack", SlackHandler),
(r"/buddybuild", BuddybuildHandler)
], **settings)
app = tornado.wsgi.WSGIAdapter(application)
def main():
application.listen(8888)
tornado.ioloop.IOLoop.current().start()
if __name__ == '__main__':
main()<|fim_pref... | code_fim | hard | {
"lang": "python",
"repo": "wujianguo/bsphelper",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wujianguo/bsphelper path: /app.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os.path
import tornado.ioloop
import tornado.web
import tornado.wsgi
import requests
import logging
class BuddybuildHandler(tornado.web.RequestHandler):
def post(self):
logging.error... | code_fim | hard | {
"lang": "python",
"repo": "wujianguo/bsphelper",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>settings = {
"static_path": os.path.join(os.path.dirname(__file__), "public"),
"template_path": os.path.join(os.path.dirname(__file__), "views"),
"gzip": True,
"debug": True
}
application = tornado.web.Application([
(r"/slack", SlackHandler),
(r"/buddybuild", BuddybuildHandler)
],... | code_fim | hard | {
"lang": "python",
"repo": "wujianguo/bsphelper",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def maybe_colon(self):
return bool(set(StandardTerminology.filter_colon(self.locations)))
def is_distal(self):
"""
Distal if location includes a distal_location keyword and no other locations
Cite for locations:
- https://www.cancer.gov/publications/dic... | code_fim | hard | {
"lang": "python",
"repo": "kpwhri/precise_nlp",
"path": "/src/precise_nlp/extract/path/jar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kpwhri/precise_nlp path: /src/precise_nlp/extract/path/jar.py
from precise_nlp.const.enums import AssertionStatus
from precise_nlp.extract.path.polyp_size import PolypSize
from precise_nlp.extract.maybe_counter import MaybeCounter
from precise_nlp.extract.polarity_counter import PolarityCounter
f... | code_fim | hard | {
"lang": "python",
"repo": "kpwhri/precise_nlp",
"path": "/src/precise_nlp/extract/path/jar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_carcinoma(self, term=None, status=AssertionStatus.UNKNOWN, in_situ=False):
if status in {AssertionStatus.UNKNOWN, AssertionStatus.DEFINITE}:
if in_situ:
self.carcinomas_in_situ += 1
else:
self.carcinomas += 1
elif status i... | code_fim | hard | {
"lang": "python",
"repo": "kpwhri/precise_nlp",
"path": "/src/precise_nlp/extract/path/jar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: barry-scott/scm-workbench path: /Source/Common/wb_annotate_node.py
class AnnotateNode:
def __init__( self,
<|fim_suffix|> log_id ):
self.line_num = line_num
self.line_text = line_text
self.log_id = log_id<|fim_middle|> line_num,
... | code_fim | easy | {
"lang": "python",
"repo": "barry-scott/scm-workbench",
"path": "/Source/Common/wb_annotate_node.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.line_text = line_text
self.log_id = log_id<|fim_prefix|># repo: barry-scott/scm-workbench path: /Source/Common/wb_annotate_node.py
class AnnotateNode:
def __init__( self,
<|fim_middle|> line_num,
line_text,
log_id ):
self.lin... | code_fim | hard | {
"lang": "python",
"repo": "barry-scott/scm-workbench",
"path": "/Source/Common/wb_annotate_node.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Move the bullet up 5 pixels
self.rect.y -= self.yVel
self.rect.x -= self.xVel
def spawnCircle(spawnCount,playerX,playerY,playerW,playerH,color):
for i in range(spawnCount):
enemyCircle = Circle(color, circleWidth, circleHeight, circleMaxSpeed)
list = getSpaw... | code_fim | hard | {
"lang": "python",
"repo": "nckackerman/Tank-d",
"path": "/circle.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nckackerman/Tank-d path: /circle.py
import pygame
import colors
import math
import player
import getSpawnCoordinates
import Lists
import constants
circleWidth = 15
circleHeight = 15
circleMaxSpeed = 1
class Circle(pygame.sprite.Sprite):
def __init__(self,color,width,height,maxSpeed):
... | code_fim | hard | {
"lang": "python",
"repo": "nckackerman/Tank-d",
"path": "/circle.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if player.rect.y > thisCircle.rect.y:
thisCircle.yVel = -thisCircle.maxSpeed*(math.cos(deltaTheta))
if ((thisCircle.yVel - modError) < -thisCircle.maxSpeed):
thisCircle.yVel = -thisCircle.maxSpeed
else:
... | code_fim | hard | {
"lang": "python",
"repo": "nckackerman/Tank-d",
"path": "/circle.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: appium/python-client path: /appium/options/ios/xcuitest/simulator/simulator_window_center_option.py
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding cop... | code_fim | medium | {
"lang": "python",
"repo": "appium/python-client",
"path": "/appium/options/ios/xcuitest/simulator/simulator_window_center_option.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def simulator_window_center(self) -> Optional[str]:
"""
Simulator window center coordinates.
"""
return self.get_capability(SIMULATOR_WINDOW_CENTER)
@simulator_window_center.setter
def simulator_window_center(self, value: str) -> None:
"""... | code_fim | hard | {
"lang": "python",
"repo": "appium/python-client",
"path": "/appium/options/ios/xcuitest/simulator/simulator_window_center_option.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Simulator window center coordinates.
"""
return self.get_capability(SIMULATOR_WINDOW_CENTER)
@simulator_window_center.setter
def simulator_window_center(self, value: str) -> None:
"""
Allows to explicitly set the coordinates of Simulator window ... | code_fim | hard | {
"lang": "python",
"repo": "appium/python-client",
"path": "/appium/options/ios/xcuitest/simulator/simulator_window_center_option.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _DISCOTHEQUE.__init__(self)
self.name = "DISCOTHEQUES"
self.specie = 'nouns'
self.basic = "discotheque"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_discotheques.py
from xai.brain.wordbase.nouns._discotheque import _DISCOTHEQUE
<|fim_middle|>#calss he... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_discotheques.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_discotheques.py
from xai.brain.wordbase.nouns._discotheque import _DISCOTHEQUE
<|fim_suffix|> def __init__(self,):
_DISCOTHEQUE.__init__(self)
self.name = "DISCOTHEQUES"
self.specie = 'nouns'
self.basic = "discotheque"
self.jsondata = {}... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_discotheques.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> log.debug('Getting data from IMDB using %s' % (searchString,))
if not isMovie:
url = 'https://api.themoviedb.org/3/search/tv?query=%s&api_key=%s' % (searchString, API_KEY)
else:
url = 'https://api.themoviedb.org/3/search/movie?query=%s&api_key=%s' % (searchString, API_KEY)
... | code_fim | hard | {
"lang": "python",
"repo": "kyokley/MediaViewer",
"path": "/mediaviewer/models/tvdbconfiguration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kyokley/MediaViewer path: /mediaviewer/models/tvdbconfiguration.py
import time
import os
from mediaviewer.log import log
from mysite.settings import (API_KEY,
OMDBAPI_KEY,
IMAGE_PATH,
REQUEST_TIMEOUT,
... | code_fim | hard | {
"lang": "python",
"repo": "kyokley/MediaViewer",
"path": "/mediaviewer/models/tvdbconfiguration.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not isMovie:
url = 'https://api.themoviedb.org/3/search/tv?query=%s&api_key=%s' % (searchString, API_KEY)
else:
url = 'https://api.themoviedb.org/3/search/movie?query=%s&api_key=%s' % (searchString, API_KEY)
data = getJSONData(url)
data = (data['results'][0]
... | code_fim | hard | {
"lang": "python",
"repo": "kyokley/MediaViewer",
"path": "/mediaviewer/models/tvdbconfiguration.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for epoch in range(1, self.num_epoch + 1):
epoch_err_sum = 0
for batch_number in range(n_batch):
batch = X_train[batch_number * self.batch_size: (batch_number + 1) * self.batch_size]
_, batch_err = sess.run((para_update... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Hands-On-Deep-Learning-Architectures-with-Python",
"path": "/Chapter03/rbm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.Session() as sess:
sess.run(init)
epochs_err = []
n_batch = int(X_train.shape[0] / self.batch_size)
for epoch in range(1, self.num_epoch + 1):
epoch_err_sum = 0
for batch_number in range(n_batch):
... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Hands-On-Deep-Learning-Architectures-with-Python",
"path": "/Chapter03/rbm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PacktPublishing/Hands-On-Deep-Learning-Architectures-with-Python path: /Chapter03/rbm.py
'''
Source codes for Hands-On Deep Learning Architectures with Python (Packt Publishing)
Chapter 3 Restricted Boltzmann Machines and Autoencoders
Author: Yuxi (Hayden) Liu
'''
import numpy as np
import tenso... | code_fim | hard | {
"lang": "python",
"repo": "PacktPublishing/Hands-On-Deep-Learning-Architectures-with-Python",
"path": "/Chapter03/rbm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davgit/kuk-A-droid path: /android/python/accessory.py
#!/usr/bin/python
# accessory.py
# License GPLv2
# (c) Manuel Di Cerbo, Nexus-Computing GmbH
import usb.core
import usb.util
import fcntl
import struct
import time
import threading
import os
import sys
import socket
from attribs import *
AC... | code_fim | hard | {
"lang": "python",
"repo": "davgit/kuk-A-droid",
"path": "/android/python/accessory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
try:
length = ep_out.write([0])
print("%d bytes written" % length)
time.sleep(0.5)
except usb.core.USBError, e:
print("error in writer thread %s" %e)
break
def accessory(dev):
version = dev.ctrl_transfer(
... | code_fim | hard | {
"lang": "python",
"repo": "davgit/kuk-A-droid",
"path": "/android/python/accessory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def LayoutDetection(app_context):
log_debug('layout detection process starting {}'.format(app_context.application_context), app_context.application_context)
try:
response = get_layout(app_context)
return {
'code': 200,
'message': 'request completed... | code_fim | hard | {
"lang": "python",
"repo": "Roshan2810/anuvaad",
"path": "/anuvaad-etl/anuvaad-extractor/document-processor/layout-detector/prima/src/services/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> coord =[]
if len(bboxs)>0:
for bbox in bboxs:
temp_box = []
temp_box.append(bbox["boundingBox"]['vertices'][0]['x'])
temp_box.append(bbox["boundingBox"]['vertices'][0]['y'])
temp_box.append(bbox["boundingBox"]['vertices'][2]['x'])
... | code_fim | medium | {
"lang": "python",
"repo": "Roshan2810/anuvaad",
"path": "/anuvaad-etl/anuvaad-extractor/document-processor/layout-detector/prima/src/services/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Roshan2810/anuvaad path: /anuvaad-etl/anuvaad-extractor/document-processor/layout-detector/prima/src/services/main.py
from anuvaad_auditor.loghandler import log_info
from anuvaad_auditor.loghandler import log_exception
from anuvaad_auditor.loghandler import log_debug
import src.utilities.app_cont... | code_fim | hard | {
"lang": "python",
"repo": "Roshan2810/anuvaad",
"path": "/anuvaad-etl/anuvaad-extractor/document-processor/layout-detector/prima/src/services/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if found_role is None:
self.close()
raise ObjectNotFoundHTTPError('The provided role name')
if simplify:
found_role = self.simplify(found_role)
return found_role
def add_role(self, role):
"""
Adds a new Role to the database... | code_fim | hard | {
"lang": "python",
"repo": "RobinQuetin/CAIRIS-web",
"path": "/cairis/cairis/data/RoleDAO.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RobinQuetin/CAIRIS-web path: /cairis/cairis/data/RoleDAO.py
import ARM
from CairisHTTPError import ARMHTTPError, MalformedJSONHTTPError, MissingParameterHTTPError, ObjectNotFoundHTTPError
from Role import Role
from RoleEnvironmentProperties import RoleEnvironmentProperties
from RoleParameters imp... | code_fim | hard | {
"lang": "python",
"repo": "RobinQuetin/CAIRIS-web",
"path": "/cairis/cairis/data/RoleDAO.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> json_dict = json['object']
check_required_keys(json_dict, RoleModel.required)
json_dict['__python_obj__'] = Role.__module__+'.'+Role.__name__
role = json_serialize(json_dict)
role = json_deserialize(role)
if not isinstance(role, Role):
self.close... | code_fim | hard | {
"lang": "python",
"repo": "RobinQuetin/CAIRIS-web",
"path": "/cairis/cairis/data/RoleDAO.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gr3eMx/aliexpress-sdk path: /aliexpress/api/rest/SolutionSkuAttributeQuery.py
"""
Created by auto_sdk on 2019.04.08
"""
from aliexpress.api.base import RestApi
<|fim_suffix|> def __init__(self, domain="gw.api.taobao.com", port=80):
RestApi.__init__(self, domain, port)
self.que... | code_fim | medium | {
"lang": "python",
"repo": "Gr3eMx/aliexpress-sdk",
"path": "/aliexpress/api/rest/SolutionSkuAttributeQuery.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "aliexpress.solution.sku.attribute.query"<|fim_prefix|># repo: Gr3eMx/aliexpress-sdk path: /aliexpress/api/rest/SolutionSkuAttributeQuery.py
"""
Created by auto_sdk on 2019.04.08
"""
from aliexpress.api.base import RestApi
<|fim_middle|>class AliexpressSolutionSkuAttributeQueryRequest(Re... | code_fim | hard | {
"lang": "python",
"repo": "Gr3eMx/aliexpress-sdk",
"path": "/aliexpress/api/rest/SolutionSkuAttributeQuery.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_v_induced_by_horseshoe_vortex():
P = np.array([1, 0.5])
P1 = np.array([0, 0])
P2 = np.array([0, 1])
calculated_vel = v_induced_by_horseshoe_vortex(P, P1, P2)
expected_vel = -0.674191156, -0.6030149
assert_almost_equal(calculated_vel, expected_vel)
def test_v_induced_by... | code_fim | hard | {
"lang": "python",
"repo": "aqreed/PyVLM",
"path": "/tests/test_vortices.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aqreed/PyVLM path: /tests/test_vortices.py
"""
Unit tests of the Vortices methods
"""
import pytest
import numpy as np
from numpy.testing import assert_almost_equal
from vlm.vortices import (vortex_position_in_panel,
v_induced_by_horseshoe_vortex,
... | code_fim | hard | {
"lang": "python",
"repo": "aqreed/PyVLM",
"path": "/tests/test_vortices.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> P = np.array([1, 0.5])
P1 = np.array([0, 0])
P2 = np.array([0, 1])
calculated_vel = v_induced_by_horseshoe_vortex(P, P1, P2)
expected_vel = -0.674191156, -0.6030149
assert_almost_equal(calculated_vel, expected_vel)
def test_v_induced_by_finite_vortex_line():
P = np.array([1... | code_fim | hard | {
"lang": "python",
"repo": "aqreed/PyVLM",
"path": "/tests/test_vortices.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class PostView(ListView):
model = Core
template_name = 'core/posts.html'
context_object_name = 'post_list'
class AddView(CreateView):
model = Core
template_name = 'core/add.html'
fields='__all__'
success_url = reverse_lazy('core:posts')
class EditView(UpdateView):
model ... | code_fim | hard | {
"lang": "python",
"repo": "samir321-pixel/Note_App_With_Django_Class_Base_View",
"path": "/core/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Core
pk_url_kwarg = 'pk'
success_url = reverse_lazy('core:posts')
template_name = 'core/confirm-delete.html'<|fim_prefix|># repo: samir321-pixel/Note_App_With_Django_Class_Base_View path: /core/views.py
from django.urls import reverse_lazy
from .models import Core
from django.vie... | code_fim | hard | {
"lang": "python",
"repo": "samir321-pixel/Note_App_With_Django_Class_Base_View",
"path": "/core/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samir321-pixel/Note_App_With_Django_Class_Base_View path: /core/views.py
from django.urls import reverse_lazy
from .models import Core
from django.views.generic import ListView, DetailView, UpdateView, CreateView, DeleteView
<|fim_suffix|>
class SingleView(DetailView):
model = Core
temp... | code_fim | medium | {
"lang": "python",
"repo": "samir321-pixel/Note_App_With_Django_Class_Base_View",
"path": "/core/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> hist2 = hist[(hist.index >= rec.index[0])]
#combine
df = pd.concat([hist2, rec], axis=1, join='outer')
df = df.fillna(method='ffill')
df = df.rename_axis(index='Date')
#df = df.append({'Date': dt.datetime.now() + dt.timedelta(days=1)}, ignore_index=True)
hist = hist.rename_axi... | code_fim | hard | {
"lang": "python",
"repo": "campbtaf/stock-predictions",
"path": "/automation/data-clean.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: campbtaf/stock-predictions path: /automation/data-clean.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 14:15:47 2021
@author: taleahbirkicht
Modified: 3/24/2021
Author: Jacob Mask
Notes: Implemented config ticker list.
"""
import yfinance as yf
import pandas as pd
f... | code_fim | hard | {
"lang": "python",
"repo": "campbtaf/stock-predictions",
"path": "/automation/data-clean.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nion-software/nionutils path: /nion/utils/test/Observable_test.py
# standard libraries
import logging
import unittest
<|fim_suffix|> pass
def tearDown(self) -> None:
pass
def test_observable(self) -> None:
Observable.Observable()
if __name__ == '__main__':
... | code_fim | medium | {
"lang": "python",
"repo": "nion-software/nionutils",
"path": "/nion/utils/test/Observable_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def tearDown(self) -> None:
pass
def test_observable(self) -> None:
Observable.Observable()
if __name__ == '__main__':
logging.getLogger().setLevel(logging.DEBUG)
unittest.main()<|fim_prefix|># repo: nion-software/nionutils path: /nion/utils/test/Observabl... | code_fim | easy | {
"lang": "python",
"repo": "nion-software/nionutils",
"path": "/nion/utils/test/Observable_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>t_solution_d13c = (None, None, 'n/a')
soil_O2 = (0, 100)
soil_pH = (0, 14)
soil_pCO2 = (0, None)
soil_Ca = (0, None)
soil_Mg = (0, None)
soil_Sr = (0, None)
soil_Ba = (0, None)
soil_d13C = (None, None)
soil_R14C = (0, None)
soil_d44Ca = (None, None)
kinet... | code_fim | hard | {
"lang": "python",
"repo": "Rob-Owen/cavecalc",
"path": "/cavecalc/data/types_and_limits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> (0, None)
atmo_exchange = (0, 1)
gas_volume = (0, None)
atm_O2 = (0, 100)
atm_pCO2 = (0, None)
atm_d13C = (None, None)
atm_R14C = (0, None)
atm_d18O = (None, None)
cave_O2 = (0, 100)
cave_pCO2 = (0, None)
cave_d13C = (None, None)
cave_R14C = (0, None)
cave_d18O = (... | code_fim | hard | {
"lang": "python",
"repo": "Rob-Owen/cavecalc",
"path": "/cavecalc/data/types_and_limits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rob-Owen/cavecalc path: /cavecalc/data/types_and_limits.py
"""Encodes accepted values and ranges for model input parameters.
This data is used by the setter.SettingsObject.validate_entry() method. To
verify input parameter types and values.
'str' : x must be a string
(a, b) ... | code_fim | hard | {
"lang": "python",
"repo": "Rob-Owen/cavecalc",
"path": "/cavecalc/data/types_and_limits.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Deletes an AWS account and all objects that are related to the account"""
name = 'DeleteAccount'
option_list = (
Option('account_name', help='Account Name', metavar='NAME'),
)
def run(self, **kwargs):
try:
acct = Account.query.filter_by(account_name=kwar... | code_fim | hard | {
"lang": "python",
"repo": "rgodishela/cloud-inquisitor",
"path": "/backend/cloud_inquisitor/plugins/commands/accounts.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rgodishela/cloud-inquisitor path: /backend/cloud_inquisitor/plugins/commands/accounts.py
from click import confirm, prompt
from flask_script import Option
from cloud_inquisitor import db
from cloud_inquisitor.plugins.commands import BaseCommand
from cloud_inquisitor.schema import Account
class... | code_fim | hard | {
"lang": "python",
"repo": "rgodishela/cloud-inquisitor",
"path": "/backend/cloud_inquisitor/plugins/commands/accounts.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def run(self, **kwargs):
try:
acct = Account.query.filter_by(account_name=kwargs['account_name']).first()
if acct:
cfm = 'Are you absolutely sure you wish to delete the account named {}'.format(acct.account_name)
if confirm(cfm):
... | code_fim | hard | {
"lang": "python",
"repo": "rgodishela/cloud-inquisitor",
"path": "/backend/cloud_inquisitor/plugins/commands/accounts.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cclib/cclib path: /cclib/parser/qchemparser.py
ed.
#
# Notice how the letter/coordinate labels change to coordinate ranks
# after hexadecapole moments, and need to be translated. Additionally,
# after 9-th order moments the ranks are not necessarily... | code_fim | hard | {
"lang": "python",
"repo": "cclib/cclib",
"path": "/cclib/parser/qchemparser.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Anharmonic vibrational analysis.
# Q-Chem includes 3 theories: VPT2, TOSH, and VCI.
# For now, just take the VPT2 results.
# if 'VIBRATIONAL ANHARMONIC ANALYSIS' in line:
# while list(set(line.strip... | code_fim | hard | {
"lang": "python",
"repo": "cclib/cclib",
"path": "/cclib/parser/qchemparser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
startidx = int(re_match.group(2)) - 1
endidx = int(re_match.group(4)) - 1 + self.nalpha
contrib = float(re_match.group(5))
start = (startidx, spin)
... | code_fim | hard | {
"lang": "python",
"repo": "cclib/cclib",
"path": "/cclib/parser/qchemparser.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yarinbar/cryptop path: /book.py
from config import *
from position import Position, Long, Short, Scalp
import asyncio
import numpy as np
class PositionBook(object):
def __init__(self, pair):
self.pair = pair
self.symbol = binance_coins[pair]
self.book = {WAIT_OPEN... | code_fim | hard | {
"lang": "python",
"repo": "yarinbar/cryptop",
"path": "/book.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
try:
position_base = self.book[status]
except:
for status, booklet in self.book.items():
position_base = {**position_base, **booklet}
for pos_id, position in position_base.items():
try:
if cond(position):
... | code_fim | hard | {
"lang": "python",
"repo": "yarinbar/cryptop",
"path": "/book.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
closing open positions and canceling wait_open positions
:param cond: gets position and returns boolean
:return: 0 on success -# on failure # is the number of unclosed positions with this cond
"""
limit = kwargs.get("limit", None)
status = kwar... | code_fim | hard | {
"lang": "python",
"repo": "yarinbar/cryptop",
"path": "/book.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EricZLou/predictionserver path: /tests/unit/test_hashconventions.py
from predictionserver.futureconventions.hashconventions import HashConventions, HashType,\
HashKeyGranularity, HashNameGranularity
import pytest
<|fim_suffix|>def test_enum():
assert HashNameGranularity[str(HashNameGranu... | code_fim | medium | {
"lang": "python",
"repo": "EricZLou/predictionserver",
"path": "/tests/unit/test_hashconventions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert HashNameGranularity[str(HashNameGranularity.write_key)]==HashNameGranularity.write_key
assert HashNameGranularity[str(HashNameGranularity.name)] == HashNameGranularity.name
assert HashKeyGranularity[str(HashKeyGranularity.name)] == HashKeyGranularity.name
assert HashKeyGranularity[s... | code_fim | medium | {
"lang": "python",
"repo": "EricZLou/predictionserver",
"path": "/tests/unit/test_hashconventions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hydratk/hydratk-ext-datagen path: /tests/yodahelpers/hydratk/extensions/datagen/serialization.py
class tst():
_order = ['_a', '_b', '_c', '_d', '_e', '_f', '_g', '_h', '_i']
_naming = {'_a':'a', '_b':'b', '_c':'c', '_d':'d', '_e':'e', '_f':'f', '_g':'g', '_h':'h', '_i':'i'}
... | code_fim | hard | {
"lang": "python",
"repo": "hydratk/hydratk-ext-datagen",
"path": "/tests/yodahelpers/hydratk/extensions/datagen/serialization.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class tst2():
_order = ['_y', '_x']
_naming = {'_x':'x', '_y':'y'}
def __init__(self):
self._x = 'x'
self._y = 2
tst_str = """tst:
a: a
b: b
c: 1
d:
tst2:
y: 2
x: x
e:
1
2
3
f:
a
b
g:
... | code_fim | hard | {
"lang": "python",
"repo": "hydratk/hydratk-ext-datagen",
"path": "/tests/yodahelpers/hydratk/extensions/datagen/serialization.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def thumbnail_image_src_verify(self, item):
return Thumbnail(self.driver).thumbnail_image_src(item)
def test_image_navigate1(self):
"""商品图片对比测试"""
for data in self.data_list:
query = data[0]
top = data[1]
item = int(data[2])
... | code_fim | hard | {
"lang": "python",
"repo": "github653224/JingDongTestProject",
"path": "/ElectronicCommerce/test_case/d_product_image_test_suite.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: github653224/JingDongTestProject path: /ElectronicCommerce/test_case/d_product_image_test_suite.py
import csv
import unittest
from ElectronicCommerce.test_case.models import function
from ElectronicCommerce.test_case.models import jduint
from ElectronicCommerce.test_case.page_object.productPage i... | code_fim | hard | {
"lang": "python",
"repo": "github653224/JingDongTestProject",
"path": "/ElectronicCommerce/test_case/d_product_image_test_suite.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """商品一览页面和商品详情页面的集成测试"""
csv_file_path_test_data = 'thumbnail_image_test_data.csv'
data_list = function.read_csv_file(csv_file_path_test_data)
def image_navigate_verify(self, query, top, item):
Thumbnail(self.driver).navigate_to_product_page(query, top, item)
def thumbnail_i... | code_fim | medium | {
"lang": "python",
"repo": "github653224/JingDongTestProject",
"path": "/ElectronicCommerce/test_case/d_product_image_test_suite.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: harshatejas/cats_vs_dogs_instance_segmentation path: /train.py
# Imports
import os
from PIL import Image
import numpy as np
import shutil
import xml.etree.ElementTree as ET
import torch
import torch.utils.data as data
import torchvision
from torchvision.models.detection.faster_rcnn import FastRC... | code_fim | hard | {
"lang": "python",
"repo": "harshatejas/cats_vs_dogs_instance_segmentation",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data_loader_test = torch.utils.data.DataLoader(dataset_test, batch_size = test_batch_size,
shuffle = False, num_workers = 4, collate_fn = utils.collate_fn)
print(f"We have: {len(indices)} images in the dataset, {len(dataset)} are training images and {len(dataset_test)} are te... | code_fim | hard | {
"lang": "python",
"repo": "harshatejas/cats_vs_dogs_instance_segmentation",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.info("Start to render Html report ...")
start_at_timestamp = summary["time"]["start_at"]
utc_time_iso_8601_str = datetime.utcfromtimestamp(start_at_timestamp).isoformat()
summary["time"]["start_datetime"] = utc_time_iso_8601_str
if report_file:
report_dir = os.path.dir... | code_fim | hard | {
"lang": "python",
"repo": "Barronliu/httprunner",
"path": "/httprunner/report/html/gen_report.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Barronliu/httprunner path: /httprunner/report/html/gen_report.py
import io
import os
from datetime import datetime
from jinja2 import Template
from loguru import logger
from httprunner.exceptions import SummaryEmpty
def gen_html_report(summary, report_template=None, report_dir=None, report_fi... | code_fim | hard | {
"lang": "python",
"repo": "Barronliu/httprunner",
"path": "/httprunner/report/html/gen_report.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> report_path = os.path.join(report_dir, report_file_name)
with io.open(report_template, "r", encoding='utf-8') as fp_r:
template_content = fp_r.read()
with io.open(report_path, 'w', encoding='utf-8') as fp_w:
rendered_content = Template(
template_content,... | code_fim | hard | {
"lang": "python",
"repo": "Barronliu/httprunner",
"path": "/httprunner/report/html/gen_report.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> real_precision += scores[0][0]
scam_precision += scores[0][1]
real_recall += scores[1][0]
scam_recall += scores[1][1]
real_f1 += scores[2][0]
scam_f1 += scores[2][1]
cnf_matrix = metrics.confusion_matrix(y_test, y_pred)
average_cnf_matrix[0] += cnf_matrix[0][0]
avera... | code_fim | hard | {
"lang": "python",
"repo": "joshhamwee/scam_contradiction_detection",
"path": "/scripts/classifiers/svm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joshhamwee/scam_contradiction_detection path: /scripts/classifiers/svm.py
import csv
import numpy as np
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn import svm
from sklearn.metrics import plot_confusion_matrix
from sklearn.metrics import prec... | code_fim | hard | {
"lang": "python",
"repo": "joshhamwee/scam_contradiction_detection",
"path": "/scripts/classifiers/svm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: the-tale/the-tale path: /src/the_tale/the_tale/game/actions/tests/test_action_religion_ceremony.py
import smart_imports
smart_imports.all()
class ReligionCeremonyActionTest(utils_testcase.TestCase):
def setUp(self):
super().setUp()
game_logic.create_test_map()
ac... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/game/actions/tests/test_action_religion_ceremony.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> while len(self.hero.actions.actions_list) != 1:
self.storage.process_turn(continue_steps_if_needed=False)
game_turn.increment()
time.sleep(0.1)
self.assertTrue(self.action_idl.leader)
self.assertEqual(self.hero.need_religion_ceremon... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/game/actions/tests/test_action_religion_ceremony.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(self.action_idl.leader)
self.assertEqual(self.hero.need_religion_ceremony, False)
self.assertEqual(self.hero.last_religion_action_at_turn, game_turn.number() - 1)
self.storage._test_save()
@mock.patch('the_tale.game.heroes.objects.Hero.can_receive_doub... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/game/actions/tests/test_action_religion_ceremony.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Asynchronously
print('> Async:')
result = add.apply_async(args=(4, 4))
print(result.get())<|fim_prefix|># repo: 0xdbe-example/python-celery-simple-tasks path: /client.py
from tasks import add
import time
if __name__ == '__main__':
<|fim_middle|> # Synchronously
print('> Syn... | code_fim | medium | {
"lang": "python",
"repo": "0xdbe-example/python-celery-simple-tasks",
"path": "/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0xdbe-example/python-celery-simple-tasks path: /client.py
from tasks import add
import time
if __name__ == '__main__':
<|fim_suffix|> # Asynchronously
print('> Async:')
result = add.apply_async(args=(4, 4))
print(result.get())<|fim_middle|> # Synchronously
print('> Syn... | code_fim | medium | {
"lang": "python",
"repo": "0xdbe-example/python-celery-simple-tasks",
"path": "/client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DeepRank/Deeprank-GNN path: /deeprank_gnn/tools/hdf5_to_csv.py
import sys
import h5py
import pandas as pd
import numpy as np
def hdf5_to_csv(hdf5_path):
hdf5 = h5py.File(hdf5_path,'r+')
name = hdf5_path.split('.')[0]
first = True
for epoch in hd... | code_fim | hard | {
"lang": "python",
"repo": "DeepRank/Deeprank-GNN",
"path": "/deeprank_gnn/tools/hdf5_to_csv.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dataset_df.to_csv('{}.csv'.format(name), mode='a', header=True)
if __name__ == "__main__":
if len(sys.argv) != 2 :
print ("""\n
This scripts converts the hdf5 output files of GraphProt into csv files
Usage:
python hdf5_to_csv.py file.... | code_fim | hard | {
"lang": "python",
"repo": "DeepRank/Deeprank-GNN",
"path": "/deeprank_gnn/tools/hdf5_to_csv.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(sys.argv) != 2 :
print ("""\n
This scripts converts the hdf5 output files of GraphProt into csv files
Usage:
python hdf5_to_csv.py file.hdf5
""")
else:
try:
hdf5_path = sys.argv[1]
hdf5_t... | code_fim | hard | {
"lang": "python",
"repo": "DeepRank/Deeprank-GNN",
"path": "/deeprank_gnn/tools/hdf5_to_csv.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ririhedou/DeepAnomaly path: /normal_model/encdec_lstm.py
import argparse
import os
import numpy as np
from keras import callbacks
from keras.layers import LSTM, Dense, TimeDistributed, RepeatVector
from keras.models import Sequential
from common.utils import create_sequences, store_prediction_a... | code_fim | medium | {
"lang": "python",
"repo": "ririhedou/DeepAnomaly",
"path": "/normal_model/encdec_lstm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
# the first argument is the wav file path
# the second argument is the TextGrid path
# -------------MENU-------------- #
# command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", help="the path to the data",
... | code_fim | hard | {
"lang": "python",
"repo": "ririhedou/DeepAnomaly",
"path": "/normal_model/encdec_lstm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wantsui/dd-trace-py path: /tests/debugging/test_config.py
from contextlib import contextmanager
import pytest
from ddtrace.debugging._config import DebuggerConfig
from ddtrace.internal.agent import get_trace_url
from ddtrace.internal.utils.config import get_application_name
from ddtrace.interna... | code_fim | hard | {
"lang": "python",
"repo": "wantsui/dd-trace-py",
"path": "/tests/debugging/test_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_service_name():
assert DebuggerConfig().service_name == get_application_name()
with debugger_config(DD_SERVICE="test-service") as config:
assert config.service_name == "test-service"<|fim_prefix|># repo: wantsui/dd-trace-py path: /tests/debugging/test_config.py
from contextlib ... | code_fim | hard | {
"lang": "python",
"repo": "wantsui/dd-trace-py",
"path": "/tests/debugging/test_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> content1 = '素顏'
if contenta == True:
if contentb == True: content1 = '粉墨登場'
else: content1 = '略施脂粉'
origin = (fr["left"], fr["top"])
p = patches.Rectangle(
origin, fr["width"], fr["height"], fill=False, linewidth=2, color='r')
ax... | code_fim | hard | {
"lang": "python",
"repo": "BbsonLin/simple-fr",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> contenta = fa_makeup["lipMakeup"]
contentb = fa_makeup["eyeMakeup"]
content1 = '素顏'
if contenta == True:
if contentb == True: content1 = '粉墨登場'
else: content1 = '略施脂粉'
origin = (fr["left"], fr["top"])
p = patches.Rectangle(
... | code_fim | hard | {
"lang": "python",
"repo": "BbsonLin/simple-fr",
"path": "/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BbsonLin/simple-fr path: /utils.py
import os
import requests
import matplotlib.pyplot as plt
from PIL import Image
from io import BytesIO
from matplotlib import patches
from matplotlib.font_manager import FontProperties
font_prop = FontProperties(fname=r"./fonts/NotoSansCJK-Black.ttc", size=14)... | code_fim | hard | {
"lang": "python",
"repo": "BbsonLin/simple-fr",
"path": "/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def query(cursor, lote):
periodo, oc = periodo_oc(lote)
sql = f"""
select
l.*
from PCPC_040 l
where l.PERIODO_PRODUCAO = {periodo}
and l.ORDEM_CONFECCAO = {oc}
"""
debug_cursor_execute(cursor, sql)
return dictlist_lower(cursor)<|fim_prefix|>... | code_fim | easy | {
"lang": "python",
"repo": "anselmobd/fo2",
"path": "/src/lotes/queries/lote/get_lote.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> periodo, oc = periodo_oc(lote)
sql = f"""
select
l.*
from PCPC_040 l
where l.PERIODO_PRODUCAO = {periodo}
and l.ORDEM_CONFECCAO = {oc}
"""
debug_cursor_execute(cursor, sql)
return dictlist_lower(cursor)<|fim_prefix|># repo: anselmobd/fo2 pat... | code_fim | easy | {
"lang": "python",
"repo": "anselmobd/fo2",
"path": "/src/lotes/queries/lote/get_lote.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anselmobd/fo2 path: /src/lotes/queries/lote/get_lote.py
from pprint import pprint
from utils.functions.models.dictlist import dictlist_lower
from utils.functions.queries import debug_cursor_execute
from lotes.functions.varias import periodo_oc
<|fim_suffix|> periodo, oc = periodo_oc(lote)
... | code_fim | easy | {
"lang": "python",
"repo": "anselmobd/fo2",
"path": "/src/lotes/queries/lote/get_lote.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arunken/PythonScripts path: /2_Python Advanced/Exceptions/Exceptions.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 12 23:03:37 2018
@author: SilverDoe
"""
try:
a = 12
b=0
c=a/b
print("result : ",c)
except:
print("Some exception occured")
#==========================... | code_fim | hard | {
"lang": "python",
"repo": "Arunken/PythonScripts",
"path": "/2_Python Advanced/Exceptions/Exceptions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#==============================================================================
try:
file = open('test.txt', 'rb')
except Exception:
print('exception occured')
# Some logging if you want
#raise
#==============================================================================
try:
f... | code_fim | hard | {
"lang": "python",
"repo": "Arunken/PythonScripts",
"path": "/2_Python Advanced/Exceptions/Exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def quantize(model, dataloader=None, eval_func=None, metric=None,
thread_num=None, **kwargs):
if compare_version("neural_compressor", operator.ge, "2.0"):
from .inc_api_2 import quantize
return quantize(model, dataloader, eval_func, metric, thread_num, **kwargs)
if kw... | code_fim | hard | {
"lang": "python",
"repo": "intel-analytics/BigDL",
"path": "/python/nano/src/bigdl/nano/deps/neural_compressor/inc_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: intel-analytics/BigDL path: /python/nano/src/bigdl/nano/deps/neural_compressor/inc_api.py
#
# Copyright 2016 The BigDL Authors.
#
# 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 Lic... | code_fim | hard | {
"lang": "python",
"repo": "intel-analytics/BigDL",
"path": "/python/nano/src/bigdl/nano/deps/neural_compressor/inc_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.