seq_id
string
text
string
repo_name
string
sub_path
string
file_name
string
file_ext
string
file_size_in_byte
int64
program_lang
string
lang
string
doc_type
string
stars
int64
dataset
string
pt
string
api
list
181948390
# time measure import datetime class TimeMeasure: cycle_cnt = 0 # all checkpoints are run in cycle; this is cycle counter first_ckp = None # label of first ckp in cycle (to count cycles) last_ckp = None # last checkpoints called checkpoints = {} # info about all checkpoints$ they will be added by .s...
null
timer.py
timer.py
py
3,279
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.now", "line_number": 25, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 25, "usage_type": "attribute" }, { "api_name": "datetime.datetime.now", "line_number": 28, "usage_type": "call" }, { "api_name": "da...
606966776
import fpdf as fpdf import xlwt from flask import Flask, render_template, session, redirect, url_for, request, flash, make_response, Response from flask_mysqldb import MySQL #imported mysql for database from passlib.handlers.sha2_crypt import sha256_crypt from wtforms import Form,StringField,TextAreaField,IntegerF...
null
app.py
app.py
py
42,929
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 11, "usage_type": "call" }, { "api_name": "flask_mysqldb.MySQL", "line_number": 22, "usage_type": "call" }, { "api_name": "wtforms.Form", "line_number": 26, "usage_type": "name" }, { "api_name": "wtforms.StringField", ...
284273644
# encoding = 'utf-8' import re import requests import json import time from multiprocessing import Pool def addadress(url, page): page = str(page) return url + '/page/' + page def getnameandurl(eachclassurl): page = 1 nameandurl = {} f = open('moviex.txt', 'a', encoding='utf-8') while True: eachpage = addadre...
null
movie.py
movie.py
py
1,735
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 18, "usage_type": "call" }, { "api_name": "re.findall", "line_number": 19, "usage_type": "call" }, { "api_name": "re.S", "line_number": 19, "usage_type": "attribute" }, { "api_name": "re.findall", "line_number": 24,...
326955287
# coding: utf-8 # <h3>Question 2</h3> # In[ ]: import numpy as np import matplotlib.pyplot as mp # In[ ]: ########################## Question 2.1 : compute mean squared error #################### def compute_mse(pred,sample): totalError = 0 a = pred b = sample diff_vals = np.subtract...
null
gradient_descent.py
gradient_descent.py
py
7,412
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.subtract", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.square", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.random.uniform", "line_number": 36, "usage_type": "call" }, { "api_name": "numpy.random", "...
102001056
import time from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler from subprocess import call from time import sleep from sentiment import relativepath import os class Watcher: DIRECTORY_TO_WATCH="." def __init__(self): self.observer = Observer() def run(s...
null
wawtchdawg/wtchdg.py
wtchdg.py
py
2,293
python
en
code
null
code-starcoder2
66
[ { "api_name": "watchdog.observers.Observer", "line_number": 13, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 20, "usage_type": "call" }, { "api_name": "watchdog.events.PatternMatchingEventHandler", "line_number": 28, "usage_type": "name" }, { ...
272803247
# coding=UTF-8 from django.conf.urls import patterns, url from party_bl import views urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^report', views.report, name='report'), url(r'^event', views.event, name='event') )
null
partyprice/party_bl/urls.py
urls.py
py
254
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.patterns", "line_number": 6, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 7, "usage_type": "call" }, { "api_name": "party_bl.views.index", "line_number": 7, "usage_type": "attribute" }, { "api_name": ...
146559406
import os import sys import shutil import pandas_datareader as web import numpy as np from configobj import ConfigObj class dynamicaly_calculate_nine_one_rule: def add_date_column(input_df): input_df['date'] = input_df.index # Calculate customized exponential moving average def calculate_input_d...
null
python/LEI/dynamicly_calculate_nine_one_rule.py
dynamicly_calculate_nine_one_rule.py
py
4,141
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.round", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.round", "line_number": 20, "usage_type": "call" }, { "api_name": "numpy.round", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.round", "line_number": ...
201494390
#!/usr/bin/env python3 from sage.all import * from itertools import chain, combinations, takewhile from functools import reduce import operator import math from Crypto.PublicKey import RSA message = b"Quack! Quack!" question_to_ask = b"Hello! Can you give me the flag, please? I would really appreciate it!" base = int....
null
rsa-service/smooth.bak.py
smooth.bak.py
py
2,315
python
en
code
null
code-starcoder2
66
[ { "api_name": "functools.reduce", "line_number": 15, "usage_type": "call" }, { "api_name": "operator.mul", "line_number": 15, "usage_type": "attribute" }, { "api_name": "itertools.chain.from_iterable", "line_number": 42, "usage_type": "call" }, { "api_name": "iter...
507178406
from selenium import webdriver import time import itertools url = 'https://www.bestbuy.com/site/promo/health-fitness-deals' driver = webdriver.Firefox() driver.get(url) time.sleep(2) # page "Hello! Choose a Country" - selecting Unitet State flag driver.find_element_by_class_name('us-link').click() items = [] for ...
null
__scraping__/bestbuy.com - selenium/main-url-with-params---itertools-count.py
main-url-with-params---itertools-count.py
py
907
python
en
code
null
code-starcoder2
66
[ { "api_name": "selenium.webdriver.Firefox", "line_number": 7, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 7, "usage_type": "name" }, { "api_name": "time.sleep", "line_number": 10, "usage_type": "call" }, { "api_name": "itertools.coun...
213498978
# -*- coding: utf-8 -*- import pdb import os import argparse from tensorboardX import SummaryWriter from Networks import * from torchvision.utils import make_grid from itertools import chain from util.image_pool import ImagePool from util.loss import GANLoss from util.net import weights_init, Discriminato...
null
main_translation.py
main_translation.py
py
14,623
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.now", "line_number": 50, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 50, "usage_type": "name" }, { "api_name": "utils.load_data", "line_number": 93, "usage_type": "call" }, { "api_name": "util.sampler....
478461822
# This file is a part of MediaDrop (http://www.mediadrop.video), # Copyright 2009-2015 MediaDrop contributors # For the exact contribution history, see the git revision log. # The source code contained in this file is licensed under the GPLv3 or # (at your option) any later version. # See LICENSE.txt in the main projec...
null
lib/players.py
players.py
py
39,203
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 29, "usage_type": "call" }, { "api_name": "mediadrop.plugin.abc.AbstractClass", "line_number": 35, "usage_type": "name" }, { "api_name": "mediadrop.plugin.abc.abstractproperty", "line_number": 40, "usage_type": "call" },...
330859867
"""Tests for scandir.scandir().""" import os import sys import unittest try: import scandir has_scandir = True except ImportError: has_scandir = False FILE_ATTRIBUTE_DIRECTORY = 16 test_path = os.path.join(os.path.dirname(__file__), 'dir') IS_PY3 = sys.version_info >= (3, 0) if IS_PY3: int_types =...
null
test/test_scandir.py
test_scandir.py
py
8,097
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 15, "usage_type": "call" }, { "api_name": "sys.version_info", "lin...
523629944
from __future__ import unicode_literals from threading import Timer from wxpy import * import requests import random bot = Bot() my_friend = bot.friends().search('Omine')[0] def get_news(): url = "http://open.iciba.com/dsapi/" r = requests.get(url) content = r.json()['content'] note = r.json()['note']...
null
robot-demo/index.py
index.py
py
1,417
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 12, "usage_type": "call" }, { "api_name": "threading.Timer", "line_number": 46, "usage_type": "call" } ]
474831586
import subprocess import shutil import os import logging class Renamer: def getRenamePath(self, contentFile): return os.path.join( self.renameRoot, contentFile.getCosmeticDir(), contentFile.getCosmeticFileName()) def __init__(self, renameRoot): self.renameRo...
null
src/renamers.py
renamers.py
py
1,970
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path.islink", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path", "line_number": 1...
235276419
# fmt: off import sys sys.path.append('../') from utils.base import Base # pylint: disable=wrong-import-position,import-error # fmt: on import re import copy class Valve: pattern = r"^Valve (\w+) has flow rate=(\d+);" def __init__(self, line): match = re.search(self.pattern, line) self.name =...
null
2022/Day16/main.py
main.py
py
2,582
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 3, "usage_type": "attribute" }, { "api_name": "re.search", "line_number": 14, "usage_type": "call" }, { "api_name": "utils.base.Base", "line_num...
232024971
from tkinter import Image, Canvas, Tk, Button, YES, BOTH, LEFT, RIGHT, BOTTOM import PIL from PIL import Image, ImageDraw import pickle import numpy from neural_lib import feed_forward2 def activate_paint(e): global lastx, lasty cv.bind('<B1-Motion>', paint) lastx, lasty = e.x, e.y def paint(e): glo...
null
main.py
main.py
py
3,420
python
en
code
null
code-starcoder2
66
[ { "api_name": "pickle.load", "line_number": 41, "usage_type": "call" }, { "api_name": "PIL.Image.open", "line_number": 47, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 47, "usage_type": "name" }, { "api_name": "PIL.Image", "line_number": 5...
572309849
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 21 11:12:46 2019 @author: vardanchennupati """ # import pandas as pd import numpy as np import seaborn as sns import mpl_toolkits import matplotlib.pyplot as plt import re # data=pd.read_csv('new5.csv') data1=pd.read_csv('New_Crime_Watch.csv') #Dro...
null
House price Prediction model/models/DC_CrimeData/rent prediction IND1.py
rent prediction IND1.py
py
7,680
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 16, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.nan", "line_number": 62, "usage_type": "attribute" }, { "api_name": "numpy.nan", "line_...
489914380
import six import time from six.moves.queue import Queue from scrapy_plus.utils.log import logger from scrapy_plus.utils.queue import Queue as RedisQueue import w3lib.url from hashlib import sha1 from scrapy_plus.conf.settings import SCHEDULER_PERSIST from scrapy_plus.utils.set import RedisFilterContainer, NoramlFilte...
null
temp/build/lib/scrapy_plus/cores/scheduler.py
scheduler.py
py
2,982
python
en
code
null
code-starcoder2
66
[ { "api_name": "scrapy_plus.conf.settings.SCHEDULER_PERSIST", "line_number": 20, "usage_type": "name" }, { "api_name": "scrapy_plus.utils.queue.Queue", "line_number": 21, "usage_type": "call" }, { "api_name": "scrapy_plus.utils.set.RedisFilterContainer", "line_number": 22, ...
18487553
from helpers.nexushelpers import OpenNexusFileWhenAvailable from helpers.kafkahelpers import ( create_producer, send_writer_command, consume_everything, publish_f142_message, ) from helpers.timehelpers import unix_time_milliseconds from time import sleep from datetime import datetime def test_filewrit...
null
system-tests/test_filewriter_stop_time.py
test_filewriter_stop_time.py
py
3,272
python
en
code
null
code-starcoder2
66
[ { "api_name": "helpers.kafkahelpers.create_producer", "line_number": 14, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 15, "usage_type": "call" }, { "api_name": "helpers.kafkahelpers.send_writer_command", "line_number": 17, "usage_type": "call" }, ...
451527542
from inspect import stack import pytest from MobileApps.libs.flows.ios.smart.flow_container import FlowContainer from MobileApps.resources.const.ios.const import * from MobileApps.resources.const.ios.const import HOME_TILES from SAF.misc import saf_misc from time import sleep pytest.app_info = "SMART" class Test_Sui...
null
tests/ios/smart/functionality/onboarding/test_suite_02_user_onboarding_functionality.py
test_suite_02_user_onboarding_functionality.py
py
5,221
python
en
code
null
code-starcoder2
66
[ { "api_name": "pytest.app_info", "line_number": 9, "usage_type": "attribute" }, { "api_name": "MobileApps.libs.flows.ios.smart.flow_container.FlowContainer", "line_number": 18, "usage_type": "call" }, { "api_name": "pytest.fixture", "line_number": 14, "usage_type": "call"...
564865589
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from mock import DEFAULT, Mock, patch, call import six from mylinux.libs import AppErr from mylinux.model import Files from mylinux.model import module_Files from mylinux.libs.Assert import Assert Test = Assert() builtin_str = six.moves.builtins.__name...
null
tests/units/model/test_Files.py
test_Files.py
py
11,298
python
en
code
null
code-starcoder2
66
[ { "api_name": "mylinux.libs.Assert.Assert", "line_number": 15, "usage_type": "call" }, { "api_name": "six.moves", "line_number": 17, "usage_type": "attribute" }, { "api_name": "unittest.TestCase", "line_number": 19, "usage_type": "attribute" }, { "api_name": "myli...
11845709
import sqlite3 def ExecuteSQL(sql): db = sqlite3.connect("../src/server/databases/codeBlocks.db") cursor = db.cursor() data = cursor.execute(sql).fetchall() db.close() return data; def ReadDatabase(): sql_entry = "SELECT * FROM codeBlocks"; data = ExecuteSQL(sql_entry); for i in ...
null
src/stats/stats.py
stats.py
py
361
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 4, "usage_type": "call" } ]
456201061
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jan 2 12:36:25 2020 @author: burt do heatmaps for model specific parameters timer rmyc and ril2 and look at readouts """ import numpy as np import seaborn as sns from parameters import d import sys sys.path.append("/home/burt/Documents/projects/2019/...
null
results/2020_w3_menten/heatmaps/heatmap_timer_il2.py
heatmap_timer_il2.py
py
2,519
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 15, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "seaborn.set", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.arange", "line_nu...
60020561
# -*- coding: utf-8 -*- """ Created on Wed Dec 16 22:48:01 2015 @author: BobbyIngram """ import data_access as db import web_scraper as ws import numpy as np import pandas as pd import itertools def kelly(prob, odds, bank): ''' 1/2 Kelly Criterion ''' kelly_stake = bank * (((prob*(odds+1))-1)/(2*prob)) ...
null
bet_chooser.py
bet_chooser.py
py
2,684
python
en
code
null
code-starcoder2
66
[ { "api_name": "itertools.permutations", "line_number": 25, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 28, "usage_type": "call" }, { "api_name": "itertools.permutations", "line_number": 30, "usage_type": "call" }, { "api_name": "numpy....
478463006
from moto import mock_s3 from pfio.v2 import S3, from_url, pathlib def test_name(): p = pathlib.Path('foo.txt') assert 'foo.txt' == p.name p = pathlib.Path('foo/') assert 'foo' == p.name def test_suffix(): p = pathlib.Path('foo.txt') assert '.txt' == p.suffix assert 'foo.asc' == str(p...
null
tests/v2_tests/test_pathlib.py
test_pathlib.py
py
3,709
python
en
code
null
code-starcoder2
66
[ { "api_name": "pfio.v2.pathlib.Path", "line_number": 7, "usage_type": "call" }, { "api_name": "pfio.v2.pathlib", "line_number": 7, "usage_type": "name" }, { "api_name": "pfio.v2.pathlib.Path", "line_number": 10, "usage_type": "call" }, { "api_name": "pfio.v2.pathl...
481146262
'''ResNet in PyTorch. For Pre-activation ResNet, see 'preact_resnet.py'. Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 ''' import torch import torch.nn as nn import torch.nn.functional as F from woollylib.models.model import get_no...
null
woollylib/models/resnet.py
resnet.py
py
5,067
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.nn.Module", "line_number": 16, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 16, "usage_type": "name" }, { "api_name": "woollylib.models.model.WyConv2d", "line_number": 23, "usage_type": "call" }, { "api_name": "woollyl...
474736192
import sqlite3 arq = open ("PesoAltura.txt","r") L = arq.readlines() arq.close() print("\nLinha do arquivo") sql="""update cadastro set peso = ?, altura = ? where codigo = ?""" conector = sqlite3.connect("academia.db") cursor = conector.cursor() for s in L: d = s.rstrip() d = s.split(";") ...
null
projeto agenda/python com sql/4 UPDATE NOS DADOS DO CADASTRO.py
4 UPDATE NOS DADOS DO CADASTRO.py
py
532
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 8, "usage_type": "call" } ]
467282459
#!python3 ''' 数据库操作类 author: justZero email: alonezero@foxmail.com date: 2017-8-6 ''' import time import pandas as pd import numpy as np import pymysql import pymysql.cursors import pprint class MySQLdb(object): def __init__(self): self.conn = pymysql.connect( host='localho...
null
spider/db.py
db.py
py
1,682
python
en
code
null
code-starcoder2
66
[ { "api_name": "pymysql.connect", "line_number": 22, "usage_type": "call" }, { "api_name": "pymysql.cursors", "line_number": 29, "usage_type": "attribute" }, { "api_name": "pandas.read_csv", "line_number": 55, "usage_type": "call" }, { "api_name": "numpy.array", ...
447195806
# See LICENSE for details import os import sys import pluggy import shutil from river_core.log import logger import river_core.utils as utils from river_core.constants import * import random import re import datetime import pytest from envyaml import EnvYAML def gen_cmd_list(gen_config, seed, count, output_dir, modu...
null
generator_plugins/aapg_plugin/gen_framework.py
gen_framework.py
py
4,164
python
en
code
null
code-starcoder2
66
[ { "api_name": "river_core.log.logger.debug", "line_number": 19, "usage_type": "call" }, { "api_name": "river_core.log.logger", "line_number": 19, "usage_type": "name" }, { "api_name": "os.getcwd", "line_number": 20, "usage_type": "call" }, { "api_name": "envyaml.E...
390017939
""" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Make animations of 3d rotating polyhedron ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This script computes the data of the polyhedron, writes them as macros into a POV-Ray include file, and automatically calls POV-Ray to render the frames and finally calls FFmpeg to convert ...
null
src/polytopes/run_3d_polyhedra_animation.py
run_3d_polyhedra_animation.py
py
6,293
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.exists", "line_number": 62, "usage_type": "call" }, { "api_name": "os.path", "line_number": 62, "usage_type": "attribute" }, { "api_name": "os.makedirs", "line_number": 63, "usage_type": "call" }, { "api_name": "helpers.pov_array", "line...
165120424
import scrapy import time from urllib import parse import json import math import pymongo import requests import hack.include.stock as stock from datetime import datetime class dongfang(scrapy.Spider): name='dongfangcaifu' def __init__(self): myclient = pymongo.MongoClient("mongodb://192.168.142.1:2701...
null
bigData/spiders/dongfangcaifu.py
dongfangcaifu.py
py
3,985
python
en
code
null
code-starcoder2
66
[ { "api_name": "scrapy.Spider", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pymongo.MongoClient", "line_number": 14, "usage_type": "call" }, { "api_name": "time.time", "line_number": 38, "usage_type": "call" }, { "api_name": "time.time", "lin...
119982576
# def convert(): def multiplot(view, x, y, divisions, divisor): # x, y & divisor are SQLite column names, divisions an integer if divisions==1: query = "" # convert() import matplotlib.pyplot as plt exec('xvar=%s' % (x)) exec('yvar=%s' % (x)) yvar = '%s' % (x) ...
null
detail.py
detail.py
py
2,419
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.plot", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 12, "usage_type": "name" }, { "api_name": "matplotlib.pyplot.title", "line_number": 13, "usage_type": "call" }, { "api_name": "matp...
224001219
#fashion-mnist training import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision import torchvision.transforms as transforms from pathlib import Path device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') print("Device used:", device) file_Save...
null
Learning PyTorch/FashionMNIST.py
FashionMNIST.py
py
3,247
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.device", "line_number": 10, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", "line_number": 10, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pathlib.Path", ...
525738741
import glfw from OpenGL.GL import * import numpy as np def render(T): glClear(GL_COLOR_BUFFER_BIT) glLoadIdentity() # draw cooridnate glBegin(GL_LINES) glColor3ub(255, 0, 0) glVertex2fv(np.array([0.,0.])) glVertex2fv(np.array([1.,0.])) glColor3ub(0, 255, 0) glVertex2fv(np.array([0....
null
LabAssignment/LabAssignment3/1/1.py
1.py
py
1,661
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.array", "line_number": 12, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": ...
134076181
""" 无向带权连通图 1-k为休息点(基地) q个查询 问能否从xi走到yi 高桥君不休息一次最多能行走距离为ti (ti单调递增;其实不递增也可以,并查集+离线查询按ti排序即可) n,m,q<=2e5 解法: 1. 多源dijkstra算出点离他最近的基地 形成若干个组(每个点属于哪个基地) 那么从一个组走到另一个组后 最好先马上去休息 (最好先去离这个点最近的基地) 问题就转化为基地之间走了 2. 建立新图 3. 边排序;离线查询+并查集 判断两个组是否连通 """ from collections import defaultdict from heapq import heappo...
null
20_杂题/atc競プロ/AtCoder Beginner Contest/250/Ex - Trespassing Takahashi-并查集.py
Ex - Trespassing Takahashi-并查集.py
py
4,835
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.setrecursionlimit", "line_number": 22, "usage_type": "call" }, { "api_name": "sys.stdin.readline", "line_number": 23, "usage_type": "call" }, { "api_name": "sys.stdin", "line_number": 23, "usage_type": "attribute" }, { "api_name": "collections.d...
312083123
import requests import json from bs4 import BeautifulSoup def megasena_api(): URL_ULTIMOS_RESULTADOS = "http://www1.caixa.gov.br/loterias/loterias/megasena/megasena_pesquisa_new.asp" page = requests.get(URL_ULTIMOS_RESULTADOS) bs = BeautifulSoup(page.content, "html.parser") numeros_sena = [ n.contents[...
null
ExemplosAPI/numerosMegaSena.py
numerosMegaSena.py
py
617
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 7, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 8, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 15, "usage_type": "call" } ]
370199553
import pandas as pd import matplotlib.pyplot as plt import numpy as np ''' Aqui vamos fazer um histograma com a produção de produtos unicamente energéticos derivados do petróleo entre os anos de 2009 a 2018, e fazer a sua comparação (isolados e juntos).''' energetico = pd.read_csv('Anuário Estatístico 2019 - Di...
null
Evolução produtos unicamente energéticos.py
Evolução produtos unicamente energéticos.py
py
6,093
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 7, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 40, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 55, "usage_type": "call" }, { "api_name": "matplotlib.p...
272771801
from ptxprint.runner import fclist, checkoutput import struct, re from gi.repository import Pango pango_styles = {Pango.Style.ITALIC: "italic", Pango.Style.NORMAL: "", Pango.Style.OBLIQUE: "oblique", Pango.Weight.ULTRALIGHT: "ultra light", Pango.Weight.LIGHT: "light", Pango.Weight.NORMAL: "", P...
null
python/lib/ptxprint/font.py
font.py
py
7,605
python
en
code
null
code-starcoder2
66
[ { "api_name": "gi.repository.Pango.Style", "line_number": 5, "usage_type": "attribute" }, { "api_name": "gi.repository.Pango", "line_number": 5, "usage_type": "name" }, { "api_name": "gi.repository.Pango.Style", "line_number": 6, "usage_type": "attribute" }, { "ap...
505070549
from PIL import Image, ImageDraw import numpy as np def str_into_number(line): '''Превращает список символов в список чисел''' line = line.split() result = np.zeros(len(line)) for i in range(len(line)): result[i] = float(line[i]) return list(result) def read_file(file_name, x_dimen, y_dimen): '''...
null
Render.py
Render.py
py
2,138
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.zeros", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 17, "usage_type": "call" }, { "api_name": "PIL.Image.new", "line_number":...
169944110
'''Train with PyTorch.''' import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.transforms as transforms import os import os.path as osp import argparse from models import * from utils import progress_...
null
main.py
main.py
py
7,111
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 25, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", "line_number": 38, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 38, "usage_type": "attribute" }, { "api_name": "torch...
45018751
#!/usr/bin/env python3 import io import os import tempfile from unittest import TestCase, main from readalongs.app import app from readalongs.cli import align from readalongs.log import LOGGER class TestAlignCli(TestCase): LOGGER.setLevel("DEBUG") data_dir = os.path.join(os.path.dirname(__file__), "data") ...
null
test/test_align_cli.py
test_align_cli.py
py
7,079
python
en
code
null
code-starcoder2
66
[ { "api_name": "unittest.TestCase", "line_number": 13, "usage_type": "name" }, { "api_name": "readalongs.log.LOGGER.setLevel", "line_number": 14, "usage_type": "call" }, { "api_name": "readalongs.log.LOGGER", "line_number": 14, "usage_type": "name" }, { "api_name":...
595001709
from pylab import * import networkx as nx from networkx.algorithms import bipartite import itertools import warnings import numpy.random # from scipy.special import factorial import itertools import scipy import sys import pickle import argparse from multiprocessing import Pool sys.path.insert(0, "../../lib/") # add ...
null
Section-4/gene-knockout/knockout_cascade.py
knockout_cascade.py
py
4,268
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.insert", "line_number": 15, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "pathlib.Path", "line_number": 19, "usage_type": "call" }, { "api_name": "pickle.dump", "line_nu...
371553104
from operator import truediv import os from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy import pymysql DATABASE_ACCOUNT = os.environ["DATABASE_ACCOUNT"] DATABASE_PASSWORD = os.environ["DATABASE_PASSWORD"] DATABASE_DOMAIN_NAME = os.environ["DATABASE_DOMAIN_NAME"] DATABASE_NAME = os.envir...
null
flask_blog/app.py
app.py
py
4,615
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 9, "usage_type": "attribute" }, { "api_name": "os.environ", "line_n...
24309628
import time from twisted.internet import defer, reactor @defer.inlineCallbacks def wait_until(condition, timeout=5): end_time = time.time() + timeout while True: result = yield defer.maybeDeferred(condition) if result: defer.returnValue(condition) elif time.time() > end_t...
null
testing/twisted_util.py
twisted_util.py
py
733
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.time", "line_number": 8, "usage_type": "call" }, { "api_name": "twisted.internet.defer.maybeDeferred", "line_number": 11, "usage_type": "call" }, { "api_name": "twisted.internet.defer", "line_number": 11, "usage_type": "name" }, { "api_name": "...
213184139
#!/usr/bin/python3 # 3b-opt.py # Backup tool # Anthony DOMINGUE # 04/11/2018 import argparse import tarfile import hashlib import signal import json import sys import os config_dir = "./.config" hashes_json = config_dir + "/hashes.json" def terminate(code: int, message=""): """ Properly exit the script wi...
null
scripts/3b-opt/3b-opt.py
3b-opt.py
py
7,633
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.exit", "line_number": 31, "usage_type": "call" }, { "api_name": "sys.stderr.write", "line_number": 34, "usage_type": "call" }, { "api_name": "sys.stderr", "line_number": 34, "usage_type": "attribute" }, { "api_name": "sys.stderr.write", "lin...
316904726
import os import json from datapackage_pipelines.generators import \ GeneratorBase, slugify, steps SCHEMA_FILE = os.path.join(os.path.dirname(__file__), 'schema.json') class Generator(GeneratorBase): @classmethod def get_schema(cls): return json.load(open(SCHEMA_FILE)) @classmethod def...
null
datapackage_pipelines_fiscal/generator.py
generator.py
py
6,584
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 7, "usage_type": "call" }, { "api_name": "datapackage_pipelines.generato...
583963919
""" This script tests the full MPI Delaunay triangulation algorithm. Example run command: mpiexec -np 4 python .\run_triangulation_test_mpi.py """ # ---------------------------------- Imports ---------------------------------- # Standard library imports from mpi4py import MPI # Repo module imports ...
null
src/delauney_triangulation/run_triangulation_test_mpi.py
run_triangulation_test_mpi.py
py
2,205
python
en
code
null
code-starcoder2
66
[ { "api_name": "mpi4py.MPI.COMM_WORLD", "line_number": 25, "usage_type": "attribute" }, { "api_name": "mpi4py.MPI", "line_number": 25, "usage_type": "name" }, { "api_name": "mpi4py.MPI.Wtime", "line_number": 28, "usage_type": "call" }, { "api_name": "mpi4py.MPI", ...
492145241
# coding:utf-8 from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor from mysql.items import NewsItem from scrapy import log import urllib import scrapy import re import string import time from selenium import webdriver class test_crawler(CrawlSpider): name = '8_Philippines...
null
mysql/spiders/8_Philippines_dti.py
8_Philippines_dti.py
py
3,229
python
en
code
null
code-starcoder2
66
[ { "api_name": "scrapy.spiders.CrawlSpider", "line_number": 14, "usage_type": "name" }, { "api_name": "scrapy.Request", "line_number": 28, "usage_type": "call" }, { "api_name": "scrapy.Request", "line_number": 38, "usage_type": "call" }, { "api_name": "scrapy.log",...
143597046
""" This module contains the necessary fixtures for running test cases with Ixia devices and IxNetwork. If more fixtures are required, they should be included in this file. """ import pytest from ixnetwork_restpy import SessionAssistant from tests.common.fixtures.conn_graph_facts import conn_graph_facts,\ fanout_g...
null
tests/common/ixia/ixia_fixtures.py
ixia_fixtures.py
py
9,923
python
en
code
null
code-starcoder2
66
[ { "api_name": "pytest.skip.Exception", "line_number": 26, "usage_type": "call" }, { "api_name": "pytest.skip", "line_number": 26, "usage_type": "attribute" }, { "api_name": "pytest.fixture", "line_number": 28, "usage_type": "call" }, { "api_name": "pytest.fixture"...
275397322
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.cm as cm from matplotlib.colors import LogNorm from mpl_toolkits.axes_grid1 import make_axes_locatable def massDistribution(dataPath='',showPlot=True,arguments=[]): zParam = 1 if len(arguments)>0: ...
null
src/Plots/massDistribution.py
massDistribution.py
py
1,802
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.loadtxt", "line_number": 12, "usage_type": "call" }, { "api_name": "numpy.loadtxt", "line_number": 13, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.subplots", "line_number": 21, "usage_type": "call" }, { "api_name": "matplotlib.pyp...
600630881
# -*- coding: utf-8 -*- """ Created on Tue Oct 10 12:09:54 2017 @author: shubra """ import tensorflow import keras from utils import * # Load training set X_train, y_train = load_data() print("X_train.shape == {}".format(X_train.shape)) print("y_train.shape == {}; y_train.min == {:.3f}; y_train.max =...
null
CV-FacialKeypoints/test.py
test.py
py
3,962
python
en
code
null
code-starcoder2
66
[ { "api_name": "keras.models.Sequential", "line_number": 30, "usage_type": "call" }, { "api_name": "keras.layers.Convolution2D", "line_number": 66, "usage_type": "call" }, { "api_name": "keras.layers.Convolution2D", "line_number": 67, "usage_type": "call" }, { "api...
628856835
import pickle import json import pprint import time from charger_schema import JOURNEY_MODEL from oef.agents import OEFAgent from oef.messages import CFP_TYPES from oef.schema import Description from fetchai.ledger.api import LedgerApi from fetchai.ledger.contract import SmartContract from fetchai.ledger.crypto import...
null
charger_agent.py
charger_agent.py
py
5,589
python
en
code
null
code-starcoder2
66
[ { "api_name": "oef.agents.OEFAgent", "line_number": 16, "usage_type": "name" }, { "api_name": "oef.schema.Description", "line_number": 19, "usage_type": "call" }, { "api_name": "charger_schema.JOURNEY_MODEL", "line_number": 23, "usage_type": "argument" }, { "api_n...
151970712
"""Constants for the Ruckus Unleashed integration.""" import logging DOMAIN = "ruckus_unleashed" PLATFORMS = ["device_tracker"] SCAN_INTERVAL = 180 _LOGGER = logging.getLogger(__name__) COORDINATOR = "coordinator" UNDO_UPDATE_LISTENERS = "undo_update_listeners" CLIENTS = "clients"
null
homeassistant/components/ruckus_unleashed/const.py
const.py
py
286
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 8, "usage_type": "call" } ]
555877590
from django.urls import path from . import views app_name = 'products' urlpatterns = [ path('', views.products_list, name = 'list'), path('create/', views.product_create, name='create'), path('<int:id>/', views.products_detail, name='detail'), path('edit/<int:id>/', views.product_edit, name='edit'), ...
null
ProductWeb/products/urls.py
urls.py
py
388
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 8, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 9, "usage_type": "call" }, { "api_name": "django.urls.path", ...
232566002
from django.shortcuts import render from games.serializes import GameSerializer from games.models import Game from rest_framework.response import Response from rest_framework import status from rest_framework.decorators import api_view import json # Create your views here. @api_view(['GET', 'POST']) def game_list(req...
null
games/views.py
views.py
py
1,637
python
en
code
null
code-starcoder2
66
[ { "api_name": "games.serializes", "line_number": 15, "usage_type": "name" }, { "api_name": "games.models.Game.objects.all", "line_number": 15, "usage_type": "call" }, { "api_name": "games.models.Game.objects", "line_number": 15, "usage_type": "attribute" }, { "api...
317312035
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
null
keystone/common/sql/data_migration_repo/versions/062_migrate_extract_redelegation_data_from_extras.py
062_migrate_extract_redelegation_data_from_extras.py
py
1,509
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.MetaData", "line_number": 18, "usage_type": "call" }, { "api_name": "sqlalchemy.Table", "line_number": 21, "usage_type": "call" }, { "api_name": "oslo_serialization.jsonutils.loads", "line_number": 28, "usage_type": "call" }, { "api_name"...
19375815
import openslide import math import numpy as np import os from PIL import Image patch_size=299 level=0 mean_grey_values=0.2*255 ##?????0.8 number_of_useful_regions = 0 basename="/Users/general/Projects/PathologicalImages/" outname=basename+"out/" wsi=basename+"Leica-3.scn" img = openslide.OpenSlide(wsi) print(wsi) img...
null
CoRegistration/temp/Extract_Patchs.py
Extract_Patchs.py
py
1,791
python
en
code
null
code-starcoder2
66
[ { "api_name": "openslide.OpenSlide", "line_number": 14, "usage_type": "call" }, { "api_name": "math.floor", "line_number": 17, "usage_type": "call" }, { "api_name": "math.floor", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.array", "line_num...
200205678
# Copyright 2011 James McCauley # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
null
p3/pox_module/cs640/ofhandler.py
ofhandler.py
py
4,039
python
en
code
null
code-starcoder2
66
[ { "api_name": "pox.core.core.getLogger", "line_number": 32, "usage_type": "call" }, { "api_name": "pox.core.core", "line_number": 32, "usage_type": "name" }, { "api_name": "pox.openflow.libopenflow_01.ofp_set_config", "line_number": 52, "usage_type": "call" }, { "...
159111431
import sys from PyQt4 import QtGui from PyQt4 import QtCore from serial.tools import list_ports import threading import time import serial is_running = True class UpperFrame(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) initial_scrollback = 2000 self.layout = QtGui.QVB...
null
main_qt.py
main_qt.py
py
12,997
python
en
code
null
code-starcoder2
66
[ { "api_name": "PyQt4.QtGui.QWidget", "line_number": 11, "usage_type": "attribute" }, { "api_name": "PyQt4.QtGui", "line_number": 11, "usage_type": "name" }, { "api_name": "PyQt4.QtGui.QWidget.__init__", "line_number": 13, "usage_type": "call" }, { "api_name": "PyQ...
516978101
# from models.layers import * from itertools import combinations from collections import defaultdict as ddict import torch.nn.functional as F import torch import torch.nn as nn import torch_geometric as tg from torch_geometric.nn import GCNConv, SAGEConv, GINConv, TAGConv, GATConv # from models.mlp import MLP from mlp ...
null
lp/homo/homo_delta/models.py
models.py
py
17,219
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.nn.Module", "line_number": 16, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 16, "usage_type": "name" }, { "api_name": "torch.device", "line_number": 19, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", ...
593799816
""" This module is used to subclass flask blueprints so as to store the information about the routes. One of the uses of this information is to make python and unity bindings """ __author__ = 'Ben Christenson' __date__ = "10/12/15" from functools import wraps from flask import Blueprint from seaborn import funct...
null
seaborn/flask/blueprint/blueprint.py
blueprint.py
py
7,489
python
en
code
null
code-starcoder2
66
[ { "api_name": "seaborn.function_arguments", "line_number": 28, "usage_type": "call" }, { "api_name": "seaborn.function_path", "line_number": 30, "usage_type": "call" }, { "api_name": "seaborn.function_defaults", "line_number": 35, "usage_type": "call" }, { "api_na...
10682357
import dicom import numpy import matplotlib.pyplot as plt import matplotlib.widgets as wdg path = "/media/sf_hserver1_images/hugh/patient/" orig = dicom.read_file(path + "orig.ima") mcor = dicom.read_file(path + "mcor_hermes_axis.ima") fixed = dicom.read_file(path + "fixed.ima") w, h = 0.25, 0.7 def load_frame(f):...
null
headerfix/imagedisp.py
imagedisp.py
py
787
python
en
code
null
code-starcoder2
66
[ { "api_name": "dicom.read_file", "line_number": 9, "usage_type": "call" }, { "api_name": "dicom.read_file", "line_number": 10, "usage_type": "call" }, { "api_name": "dicom.read_file", "line_number": 11, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.axes...
606264546
from collections import defaultdict from algorithms.graphs.src.graph import Graph __author__ = 'PankajSharma' class UndirectedGraph(Graph): def __init__(self, vertices): if vertices < 1: raise ValueError("A graph should have at least one vertex.") self._vertices = vertices ...
null
Graphs/algorithms/graphs/src/undirected_graph.py
undirected_graph.py
py
1,255
python
en
code
null
code-starcoder2
66
[ { "api_name": "algorithms.graphs.src.graph.Graph", "line_number": 9, "usage_type": "name" }, { "api_name": "collections.defaultdict", "line_number": 17, "usage_type": "call" } ]
11675547
#!/usr/bin/env python # coding: utf-8 # Noise model selection on NANOGrav pulsars import json, pickle, copy import logging from enterprise_extensions.models import model_singlepsr_noise from enterprise_extensions.hypermodel import HyperModel from enterprise_extensions.chromatic import chrom_exp_decay from enterprise_...
null
pta_sim/scripts/ng12p5yr_nm_j1713_final_fl_cWN.py
ng12p5yr_nm_j1713_final_fl_cWN.py
py
4,083
python
en
code
null
code-starcoder2
66
[ { "api_name": "pta_sim.parse_sim.arguments", "line_number": 16, "usage_type": "call" }, { "api_name": "pta_sim.parse_sim", "line_number": 16, "usage_type": "name" }, { "api_name": "logging.basicConfig", "line_number": 17, "usage_type": "call" }, { "api_name": "log...
524638994
import sqlite3, secrets, os import database as db import watchlist as wl import trade as tr # Global vars numStocks = 1376 numSuggest = 5 sellChance = 0.5 path = os.getcwd() path = path[:path.index("react_app")] + 'react_app/' dbPath = path + 'backend/users.db' # Generates crytographically secure random number from 1...
null
react_app/backend/advisor.py
advisor.py
py
3,134
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.getcwd", "line_number": 10, "usage_type": "call" }, { "api_name": "secrets.choice", "line_number": 16, "usage_type": "call" }, { "api_name": "sqlite3.connect", "line_number": 20, "usage_type": "call" }, { "api_name": "sqlite3.connect", "line_...
407553466
import sys import time import numpy as np import psycopg2 import requests from matplotlib import pyplot as plt from sklearn.cluster import KMeans import vk conn = psycopg2.connect(database='socialnetwork', user='postgres', password='postgres') cur = conn.cursor() leisure = ['Покупки', 'Туризм, путешествия', 'Развлеч...
null
analysis/classifier.py
classifier.py
py
5,673
python
en
code
null
code-starcoder2
66
[ { "api_name": "psycopg2.connect", "line_number": 12, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 38, "usage_type": "call" }, { "api_name": "vk.request_url", "line_number": 38, "usage_type": "call" }, { "api_name": "time.sleep", "line_n...
293705070
from click.testing import CliRunner from dagit.cli import ui def test_invoke_ui(): runner = CliRunner() result = runner.invoke(ui, ['--version']) assert 'dagit, version' in result.output def test_invoke_ui_bad_no_watch(): runner = CliRunner() result = runner.invoke(ui, ['--no-watch']) asser...
null
python_modules/dagit/dagit_tests/test_cli.py
test_cli.py
py
445
python
en
code
null
code-starcoder2
66
[ { "api_name": "click.testing.CliRunner", "line_number": 7, "usage_type": "call" }, { "api_name": "dagit.cli.ui", "line_number": 8, "usage_type": "argument" }, { "api_name": "click.testing.CliRunner", "line_number": 13, "usage_type": "call" }, { "api_name": "dagit....
316044607
import matplotlib.pyplot as plt import Adafruit_MCP4725 import RPi.GPIO import serial import time import xlwt book = xlwt.Workbook() # output as Excel sheet = book.add_sheet('EMG_Encryption',cell_overwrite_ok=True) # output as Excel sheet2 = book.add_sheet('EMG_Decryption',cell_overwrite_ok=True) # output as Excel...
null
RaspberryPi_Python/2_Slave_uart_輸出excel.py
2_Slave_uart_輸出excel.py
py
3,393
python
en
code
null
code-starcoder2
66
[ { "api_name": "xlwt.Workbook", "line_number": 8, "usage_type": "call" }, { "api_name": "Adafruit_MCP4725.MCP4725", "line_number": 12, "usage_type": "call" }, { "api_name": "serial.Serial", "line_number": 13, "usage_type": "call" }, { "api_name": "time.time", "...
604245103
# Copyright (c) 2019-2020, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
null
python/cugraph/tests/utils.py
utils.py
py
6,411
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 74, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 79, "usage_type": "call" }, { "api_name": "cudf.read_csv", "line_number": 93, "usage_type": "call" }, { "api_name": "cudf.read_csv", "li...
315569220
from logging import getLogger from collections import OrderedDict from concurrent.futures import ProcessPoolExecutor from datahandler import create_data_loader import os import torch import sympy as sp from utils import to_cuda, timeout, TimeoutError logger = getLogger() BUCKET_LENGTH_SIZE = 5 def idx_to_sp(env, id...
null
evaluator.py
evaluator.py
py
6,637
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 10, "usage_type": "call" }, { "api_name": "sympy.S", "line_number": 22, "usage_type": "call" }, { "api_name": "utils.timeout", "line_number": 26, "usage_type": "call" }, { "api_name": "utils.TimeoutError", "lin...
459838590
# See LICENSE for licensing information. # #Copyright (c) 2016-2019 Regents of the University of California and The Board #of Regents for the Oklahoma Agricultural and Mechanical College #(acting for and on behalf of Oklahoma State University) #All rights reserved. # import sys from tech import drc, parameter import de...
null
compiler/modules/bank.py
bank.py
py
57,153
python
en
code
null
code-starcoder2
66
[ { "api_name": "design.design", "line_number": 21, "usage_type": "attribute" }, { "api_name": "design.design.__init__", "line_number": 35, "usage_type": "call" }, { "api_name": "design.design", "line_number": 35, "usage_type": "attribute" }, { "api_name": "debug.in...
55035676
# -*- encoding:utf-8 -*- from zen import crypto import io import os import sys import json import shlex import getpass import requests import datetime import subprocess __PY3__ = True if sys.version_info[0] >= 3 else False ROOT = os.path.abspath(os.path.dirname(__file__)) NAME = os.path.splitext(os.path.basename(__f...
null
zen/cmn.py
cmn.py
py
6,222
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.version_info", "line_number": 15, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path", "line_number": 16, "usage_type": "attribute" }, { "api_name": "os.path.dirname", ...
540415290
#! /usr/bin/env python # -*- coding: utf-8 -*- import urllib import json from time import sleep from datetime import datetime, timedelta import vk_auth import sys sys.path.insert(0,'..') from cfg import app_id, vk_login, vk_pass, access_token def get_json(url): getjson = urllib.request.urlopen(url).read().decode...
null
part2/scripts/members_graphs.py
members_graphs.py
py
5,618
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.insert", "line_number": 10, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "urllib.request.urlopen", "line_number": 15, "usage_type": "call" }, { "api_name": "urllib.request",...
646771619
from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt ## 这是由于Django默认启动了防止CSRF(Cross-site request forgery:跨站请求伪造,是一种对网站的恶意利用)攻击的安全设置。通过装饰器(decorator)关闭这个设置。 text = """<form method="post" action="/add/"> <input type="text" name="a" value="%d"> + <input type="text" name="b" value=...
null
newtest/newtest/add.py
add.py
py
1,013
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.http.HttpResponse", "line_number": 18, "usage_type": "call" }, { "api_name": "django.views.decorators.csrf.csrf_exempt", "line_number": 10, "usage_type": "name" } ]
439720560
import os import re import django import pandas as pd os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'listings.settings') django.setup() from api.models import Home, Address, ZillowData dir = os.path.abspath(os.getcwd()) path = os.path.join(dir.rsplit('/', 4)[0], 'sample-data/data.csv') df = pd.read_csv(path) las...
null
listings/api/management/commands/import_house_data.py
import_house_data.py
py
2,664
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ.setdefault", "line_number": 7, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.setup", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path.abspath", ...
474241969
''' !/usr/bin/env python _*_coding: utf-8 _*_ @Time    : 2019/12/27 11:18 @Author  : Zhangyunjia @FileName: 4.3.2 实现基于unigram的负采样.py @Software: PyCharm # @Github: https://github.com/Tang4109 ''' import bz2 import collections import csv import math import pickle import random from urllib.request import urlretrieve impor...
null
4.3.3 降采样.py
4.3.3 降采样.py
py
12,790
python
en
code
null
code-starcoder2
66
[ { "api_name": "tensorflow.compat.v1.disable_eager_execution", "line_number": 21, "usage_type": "call" }, { "api_name": "tensorflow.compat.v1", "line_number": 21, "usage_type": "name" }, { "api_name": "pickle.load", "line_number": 31, "usage_type": "call" }, { "api...
48229906
# 얼굴 정해진 비율대로 자르는 코드 # 눈 : 세로 - 얼굴 3등분 했을 때 0.5~1.7번째 -> 2등분 했을 때 첫번째 # 코 : 세로 - 얼굴 3등분 했을 때 두번째 , 가로 - 5등분 했을 때 2~4번째 # 입 : 세로 - 얼굴 3등분 했을 때 1.5~3.5번째 -> 2등분 했을 때 첫번째 , 가로 - 5등분 했을 때 1.5~4.5번째 # 이미지 불러오기 # 사진 크기 확인하기 # 비율대로 자르기 # 저장하기 import cv2 import glob import numpy as np #작업할 이미지 경로 img_dir = "C...
null
face_ratio_cut.py
face_ratio_cut.py
py
1,982
python
en
code
null
code-starcoder2
66
[ { "api_name": "glob.glob", "line_number": 17, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number": 23, "usage_type": "call" }, { "api_name": "cv2.imwrite", "line_number": 48, "usage_type": "call" }, { "api_name": "cv2.imwrite", "line_number": 51,...
338130957
#!/usr/bin/env python # This script picks a random album from the MPD playlist. # Copyright (C) 2009 Kyle MacLeod kyle.macleod is at gmail # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software...
null
mpd-random-playlist-album.py
mpd-random-playlist-album.py
py
19,063
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.getenv", "line_number": 110, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 112, "usage_type": "call" }, { "api_name": "os.path", "line_number": 112, "usage_type": "attribute" }, { "api_name": "tempfile.gettempdir", "lin...
151834499
# -*- coding:utf-8 -*- # @Author:zxy '''' 这里的封装用是requests中自带的类方法seesion seesion中有个request方法 request(self, method, url, params=None, data=None, headers=None, cookies=None, files=None, auth=None, timeout=None, allow_redirects=True, proxies=None, hooks=None, stream=None, verify=None, ...
null
APITest/scripts/MyRequest.py
MyRequest.py
py
5,397
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.Session", "line_number": 27, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 58, "usage_type": "call" } ]
22903229
from .forms import NewAccountForm, ContactForm from django.template.loader import get_template from django.template import Context from django.http import HttpResponse from django.shortcuts import render, redirect from django.core.mail import EmailMessage, BadHeaderError def home(request): return render(request, '...
null
portal/views.py
views.py
py
2,067
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.shortcuts.render", "line_number": 9, "usage_type": "call" }, { "api_name": "forms.NewAccountForm", "line_number": 14, "usage_type": "call" }, { "api_name": "forms.NewAccountForm", "line_number": 17, "usage_type": "call" }, { "api_name": "djan...
340540544
# https://github.com/Shivanshu-Gupta/Pytorch-Double-DQN/blob/1cff44d95d7881c6afc029b734508b1a705dfe14/agent.py#L92 from collections import namedtuple, deque import random import time import numpy as np import torch import pandas as pd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim imp...
null
Lunar_lander_Double.py
Lunar_lander_Double.py
py
12,462
python
en
code
null
code-starcoder2
66
[ { "api_name": "warnings.filterwarnings", "line_number": 14, "usage_type": "call" }, { "api_name": "torch.device", "line_number": 15, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", "line_number": 15, "usage_type": "call" }, { "api_name": "torch.cu...
484053564
from __future__ import absolute_import from . import load_fixture, fixer_ini, create_pull_files from lintreview.config import build_review_config from lintreview.diff import DiffCollection from lintreview.processor import Processor from lintreview.repo import GithubPullRequest from lintreview.fixers.error import Config...
null
tests/test_processor.py
test_processor.py
py
6,006
python
en
code
null
code-starcoder2
66
[ { "api_name": "github3.pulls.PullRequest", "line_number": 26, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 26, "usage_type": "call" }, { "api_name": "lintreview.repo.GithubPullRequest", "line_number": 31, "usage_type": "call" }, { "api_name":...
100012878
import PyPDF2 from tqdm import tqdm # Convert PDF to Text def pdf_to_text(path): file_name = path.split("/") book_name = ' '.join(file_name[-1].split('.')[0].split('-')).title() print('\n\nReading "' + book_name + '"') pdfFileObj = open(path, 'rb') pdfReader = PyPDF2.PdfFileReader(pdfFileObj) ...
null
src/utility.py
utility.py
py
547
python
en
code
null
code-starcoder2
66
[ { "api_name": "PyPDF2.PdfFileReader", "line_number": 15, "usage_type": "call" }, { "api_name": "tqdm.tqdm", "line_number": 21, "usage_type": "call" } ]
521970164
#!/usr/bin/python # -*- coding: utf-8 -*- import os,os.path,re,platform,logging,logging.handlers import psutil,urllib,json,time class show_ip(): def __init__(self): py_path=os.path.realpath(__file__) log_path=os.path.join(os.path.split(py_path)[0],"log") if not os.path.exists(log_pat...
null
network/show_ip.py
show_ip.py
py
4,098
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.realpath", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path", "line_number": ...
439427354
import torch from model import AlexNet from PIL import Image from torchvision import transforms import matplotlib.pyplot as plt import json import os data_transform = transforms.Compose( [transforms.Resize((224, 224)), transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) # rea...
null
pytorch_learning/Test2_alexnet/predict.py
predict.py
py
1,313
python
en
code
null
code-starcoder2
66
[ { "api_name": "torchvision.transforms.Compose", "line_number": 9, "usage_type": "call" }, { "api_name": "torchvision.transforms", "line_number": 9, "usage_type": "name" }, { "api_name": "torchvision.transforms.Resize", "line_number": 10, "usage_type": "call" }, { ...
404453004
import pdb from numpy import * class Map: """Read in base-map of reef cell locations, and subregion ids.""" def __init__(self): self.init_errors = 0 self.error_text = [] def reefmap(self,pathname,forc_hurr,forc_cm,hmax_sr,cmmax_sr): """Read in map defining location of r...
null
scenario3_300y/test.py
test.py
py
5,679
python
en
code
null
code-starcoder2
66
[ { "api_name": "pdb.set_trace", "line_number": 50, "usage_type": "call" } ]
552522423
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2013 NTT MCL Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
null
easystack_dashboard/dashboards/project/network_topology/views.py
views.py
py
13,223
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.views.generic.TemplateView", "line_number": 33, "usage_type": "name" }, { "api_name": "django.views.generic.View", "line_number": 37, "usage_type": "name" }, { "api_name": "django.core.urlresolvers.reverse", "line_number": 44, "usage_type": "call" ...
530249959
from time import time from datetime import datetime from helpers.filters import command from helpers.decorators import sudo_users_only from pyrogram import Client, filters from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup, Chat, CallbackQuery from config import BOT_USERNAME START_TIME = d...
null
bot/start.py
start.py
py
4,648
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.utcnow", "line_number": 10, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 10, "usage_type": "name" }, { "api_name": "pyrogram.types.Message", "line_number": 33, "usage_type": "name" }, { "api_name": "pyr...
214550413
from __future__ import absolute_import import argparse import logging import re import urllib import json import pandas as pd from pandas.tseries.offsets import BDay import pandas_datareader.data as dr from datetime import datetime, date import apache_beam as beam from .mail_utils import send_mail from apache_beam.io ...
null
dataflow/shareloader/modules/monthly_superperformers.py
monthly_superperformers.py
py
3,522
python
en
code
null
code-starcoder2
66
[ { "api_name": "apache_beam.options.pipeline_options.PipelineOptions", "line_number": 21, "usage_type": "name" }, { "api_name": "superperf_metrics.get_fmprep_metrics", "line_number": 34, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 37, "usage_ty...
641565847
from __future__ import division import numpy as np from sklearn import utils class ANN: def __init__(self, inputs, outputs, hidden_layers, epochs, learning_rate, momentum_rate, learning_accelaration, learning_backup, reg_param, activation_fn, cost_fn): self.learning_rate = learning_rate self...
null
part2/ann.py
ann.py
py
5,684
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.random.rand", "line_number": 34, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 34, "usage_type": "attribute" }, { "api_name": "sklearn.utils.shuffle", "line_number": 39, "usage_type": "call" }, { "api_name": "sklearn.uti...
145006639
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from dash_table import DataTable ########### Initiate the app external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_sty...
null
app.py
app.py
py
2,146
python
en
code
null
code-starcoder2
66
[ { "api_name": "dash.Dash", "line_number": 10, "usage_type": "call" }, { "api_name": "dash_html_components.Div", "line_number": 14, "usage_type": "call" }, { "api_name": "dash_html_components.Label", "line_number": 15, "usage_type": "call" }, { "api_name": "dash_co...
2853610
from pony.orm import db_session import json from faker import Faker fake = Faker() @db_session() def fake_users(Users, Posts, amount=10): for _ in range(amount): Users( first_name=fake.first_name(), second_name=fake.last_name(), age=fake.random_int(18, 99), ...
null
entities/faking_users.py
faking_users.py
py
1,025
python
en
code
null
code-starcoder2
66
[ { "api_name": "faker.Faker", "line_number": 5, "usage_type": "call" }, { "api_name": "pony.orm.db_session", "line_number": 7, "usage_type": "call" }, { "api_name": "pony.orm.db_session", "line_number": 18, "usage_type": "name" }, { "api_name": "pony.orm.db_session...
206190705
import json from country_codes import get_country_code # Load the data into a list. filename = 'population_data.json' with open(filename) as f: pop_data = json.load(f) # print the 2010 population for pop_dict in pop_data: if pop_dict['Year'] == '2010': country_name = pop_dict['Country Name'] ...
null
Python_Book/part2_data/world_population.2.py
world_population.2.py
py
594
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 8, "usage_type": "call" }, { "api_name": "country_codes.get_country_code", "line_number": 15, "usage_type": "call" } ]
339739324
"""Summary. #CADL Copyright Parag K. Mital 2016 """ import numpy as np from scipy.signal import hann def ztoc(re, im): return np.sqrt(re**2 + im**2), np.angle(re + im * 1j) def ctoz(mag, phs): return mag * np.cos(phs), mag * np.sin(phs) def dft_np(signal, hop_size=256, fft_size=512): n_hops = len(sig...
null
session-4/libs/dft.py
dft.py
py
1,429
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.sqrt", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.angle", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.cos", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.sin", "line_number": 15, ...
76453817
"""Created by: David Pigliavento""" # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file # except in compliance with the License. A copy of the License is located at # # http://aws.amazon.com/apache2....
null
GuardDuty/Defender/cfn/src/defender.py
defender.py
py
2,295
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.exit", "line_number": 39, "usage_type": "call" }, { "api_name": "ec2.get_instance_vpc", "line_number": 43, "usage_type": "call" }, { "api_name": "sg.get_lockdown_security_group", "line_number": 48, "usage_type": "call" }, { "api_name": "ec2.lock...
571075677
import numpy as np from vispy import app, scene, visuals, gloo from vispy.color import Color from vispy.visuals.transforms import STTransform white = Color("#ecf0f1") gray = Color("#121212") red = Color("#e74c3c") blue = Color("#2980b9") orange = Color("#e88834") def star(inner=0.5, outer=1.0, n=5): R = np.array...
null
examples/demo/scene/probe_view.py
probe_view.py
py
2,934
python
en
code
null
code-starcoder2
66
[ { "api_name": "vispy.color.Color", "line_number": 6, "usage_type": "call" }, { "api_name": "vispy.color.Color", "line_number": 7, "usage_type": "call" }, { "api_name": "vispy.color.Color", "line_number": 8, "usage_type": "call" }, { "api_name": "vispy.color.Color"...
618422066
import urllib.request from bs4 import BeautifulSoup crimes_committed = dict() search_city = "Birmingham" search_state = "Alabama" url = "http://www.city-data.com/crime/crime-" + search_city + "-" + search_state + ".html" page = urllib.request.urlopen(url) soup = BeautifulSoup(page, "html.parser") table = soup.find(id...
null
crime_webscrape.py
crime_webscrape.py
py
854
python
en
code
null
code-starcoder2
66
[ { "api_name": "urllib.request.request.urlopen", "line_number": 9, "usage_type": "call" }, { "api_name": "urllib.request.request", "line_number": 9, "usage_type": "attribute" }, { "api_name": "urllib.request", "line_number": 9, "usage_type": "name" }, { "api_name":...
106901850
import numpy as np import imageio from scipy import stats import torch import torch.utils.data as data from torch.utils.data import Dataset, DataLoader from torch.autograd import Variable import os import cv2 import pickle as pickle def script_to_fix_frame0(): folders = listFolders('/data/stationary_motion/pixel2x...
null
utils/movie_readin.py
movie_readin.py
py
13,127
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.imread", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path", "line_number": 18, "usage_type": "attribute" }, { "api_name": "cv2.imread", "line_number": ...
480891259
import numpy as np import pandas as pd import scipy as sc import sympy as sy import math as myth import itertools import statsmodels.api as stats # FOR QUESTION 1 # A function that returns the columnwise product of two dataframes (must have same number of rows) def create_interaction (inDF1, inDF2): name1 = inDF1...
null
assignment_4/assignment_4_rahul_nair.py
assignment_4_rahul_nair.py
py
11,844
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.DataFrame", "line_number": 14, "usage_type": "call" }, { "api_name": "sympy.Matrix", "line_number": 31, "usage_type": "call" }, { "api_name": "statsmodels.api.MNLogit", "line_number": 45, "usage_type": "call" }, { "api_name": "statsmodels.api...
353426592
import cv2 import os import json import numpy as np font1 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 13, } font2 = {'family': 'Times New Roman', 'weight': 'normal', 'size': 17, } # computing average value def getss(list): avg=s...
null
SGF/SGF.py
SGF.py
py
1,862
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.resize", "line_number": 26, "usage_type": "call" }, { "api_name": "cv2.INTER_CUBIC", "line_number": 26, "usage_type": "attribute" }, { "api_name": "cv2.cvtColor", "line_number": 27, "usage_type": "call" }, { "api_name": "cv2.COLOR_BGR2GRAY", ...