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
311887062
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from sklearn.externals import joblib import plotly.graph_objs as go import feature_engineering as fe import neural_network as nn import random_forest as rf from keras.models import load_model ...
null
app.py
app.py
py
3,569
python
en
code
null
code-starcoder2
76
[ { "api_name": "dash.Dash", "line_number": 17, "usage_type": "call" }, { "api_name": "dash_html_components.Div", "line_number": 22, "usage_type": "call" }, { "api_name": "dash_html_components.H1", "line_number": 23, "usage_type": "call" }, { "api_name": "dash_html_...
588159900
import torch from transformers import BertModel import argparse import os device = "cuda" if torch.cuda.is_available() else "cpu" print("Using {} device".format(device)) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--save", default="model.pt") args = parser.parse_args...
null
sagemaker-triton/benchmark/pytorch/workspace/pt_exporter.py
pt_exporter.py
py
764
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.cuda.is_available", "line_number": 6, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 6, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser", "line_number": 10, "usage_type": "call" }, { "api_name": "transfo...
511636603
import os import time import json import pandas as pd import numpy as np import gc import datetime from pandas.io.json import json_normalize import itertools import configparser import warnings import re import sys config = configparser.ConfigParser() config.read('/home/melgazar9/Trading/TD/Scripts/Trading-Scripts/ES/...
null
Trading/scripts/Trading-Scripts/ES/ES_1min_concat-new-data.py
ES_1min_concat-new-data.py
py
4,365
python
en
code
null
code-starcoder2
76
[ { "api_name": "configparser.ConfigParser", "line_number": 15, "usage_type": "call" }, { "api_name": "warnings.filterwarnings", "line_number": 18, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 37, "usage_type": "call" }, { "api_name": "sys.exit...
482948408
import urllib2 from bs4 import BeautifulSoup import random def get_page(url): data = None try: response = urllib2.urlopen(url) data = response.read() except urllib2.HTTPError as err: pass return data def get_responses(url): data = get_page(url) links_list = [] if da...
null
modules/stackoverflow/so.py
so.py
py
1,289
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib2.urlopen", "line_number": 8, "usage_type": "call" }, { "api_name": "urllib2.HTTPError", "line_number": 10, "usage_type": "attribute" }, { "api_name": "bs4.BeautifulSoup", "line_number": 18, "usage_type": "call" }, { "api_name": "random.randin...
400326776
# coding: utf8 # TP Régression linéaire - Outils statistiques import csv # data.txt is a csv like file import numpy as np import matplotlib.pyplot as plt # ********* # # FONCTIONS # # ********* # # Fonction f(x) = ax + b def lineaire(a, b, x): return a * x + b # Fonction de calcul de régression linéaire def regre...
null
Licence 2/S4/Outils_statistiques/outilsStats/TP3/exo.py
exo.py
py
2,780
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.average", "line_number": 20, "usage_type": "call" }, { "api_name": "numpy.average", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.average", "line_number": 40, "usage_type": "call" }, { "api_name": "numpy.average", "line_n...
431483399
import numpy as np import pandas as pd import pickle from collections import Counter # cross_validation for training and testing set, neighbour bcoz we are doing kmeans neighbours # VotingClassifier - because we are going to use many classifiers and vote for the best # RandomForestClassifier is a type of classifier fro...
null
simple_ml_with_indicators.py
simple_ml_with_indicators.py
py
5,116
python
en
code
null
code-starcoder2
76
[ { "api_name": "pickle.load", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.round", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.round", "line_number": 29, "usage_type": "call" }, { "api_name": "collections.Counter", "line_n...
488742189
# August 30th 2016 # Testing how the pairwise histogram gets set up import numpy as np import matplotlib.pyplot as plt import seaborn as sns data_1 = [0, 2, 1, 2, 1, 0, 1, 1, 1, 2] data_2 = [2, 0, 0, 0, 1, 1, 0, 0, 2, 2] j_dist, x, y = np.histogram2d(data_1, data_2, bins=[-0.5, 0.5, 1.5, 2.5]) # j_dist[a, b] is the...
null
examine_decoded_angle/2016_08_tuning_curve_angle_analyses/test_pairwise_hist.py
test_pairwise_hist.py
py
680
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.histogram2d", "line_number": 11, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 14, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 14, "usage_type": "name" }, { "api_name": "matplotl...
44627988
from mpl_toolkits.mplot3d import Axes3D from matplotlib.pyplot import * from scipy.optimize import minimize penalidade_interior = lambda x: f(x)+rp*sum([(-1/g(x) if g(x)<=(-C*(rp)**a) else -(2*(-C*(rp)**a)-g(x))/((-C*(rp)**a)**2)) for g in restricoes]) penalidade_exterior = lambda x: f(x)+rp*sum([max(0,g(x))**2 for g ...
null
Lista 3/Q4/util.py
util.py
py
4,798
python
en
code
null
code-starcoder2
76
[ { "api_name": "scipy.optimize.minimize", "line_number": 92, "usage_type": "call" }, { "api_name": "scipy.optimize.minimize", "line_number": 113, "usage_type": "call" }, { "api_name": "scipy.optimize.minimize", "line_number": 151, "usage_type": "call" } ]
538456535
import logging import yaml with open("config.yaml", 'r', encoding='UTF-8') as ymlfile: cfg = yaml.load(ymlfile) from HM_functions import get_request, set_request, find_device # ------------------------------------------------------------------------- def fctTemperatur_Abfragen(Ort): act_temp = 'empty' msg = "D...
null
HM_temperature.py
HM_temperature.py
py
2,771
python
en
code
null
code-starcoder2
76
[ { "api_name": "yaml.load", "line_number": 3, "usage_type": "call" }, { "api_name": "HM_functions.find_device", "line_number": 14, "usage_type": "call" }, { "api_name": "HM_functions.get_request", "line_number": 16, "usage_type": "call" }, { "api_name": "HM_functio...
528995212
"""yolowa URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based ...
null
Hackathon/yolowa/yolowa/urls.py
urls.py
py
1,783
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 23, "usage_type": "call" }, { "api_name": "django.contrib.admin.site", "line_number": 23, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 23, "usage_type": "name" }, { "api_name": "...
513412573
#!/usr/bin/env python #coding=utf-8 #上面这条声明让程序在unix系统中可以通过./manage.py执行脚本 import os COV = None if os.environ.get('FLASK_COVERAGE'): import coverage COV = coverage.coverage(branch=True,include='app/*') COV.start() from app import create_app,db from app.models import User,Role,Post,Permission,Follow,Comment from fla...
null
manage.py
manage.py
py
2,222
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ.get", "line_number": 6, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 6, "usage_type": "attribute" }, { "api_name": "coverage.coverage", "line_number": 8, "usage_type": "call" }, { "api_name": "app.create_app", "l...
256398516
"""Analysis script for the EEG project. Notes ----- - Baseline: -500 - 350 - All trials average (all subjects), or average of subject averages? - Filter individual channels or single frequency estimate per subject? """ from os import listdir from os.path import join as pjoin import numpy as np from scipy.signal impo...
null
scripts/fooof_eeg.py
fooof_eeg.py
py
19,166
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.mean", "line_number": 71, "usage_type": "attribute" }, { "api_name": "os.listdir", "line_number": 97, "usage_type": "call" }, { "api_name": "fooof.data.FOOOFSettings", "line_number": 102, "usage_type": "call" }, { "api_name": "fooof.FOOOF", ...
325203860
""" 日历相关函数 """ from flask import Blueprint cal_blueprint = Blueprint('cal', __name__) from flask import request, session, redirect, url_for, render_template from flask import current_app as app from everyclass.commons import semester_to_string, semester_to_tuple from everyclass.mysql_operations import get_classes_for_...
null
server/everyclass/cal.py
cal.py
py
1,274
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Blueprint", "line_number": 5, "usage_type": "call" }, { "api_name": "flask.request.values.get", "line_number": 16, "usage_type": "call" }, { "api_name": "flask.request.values", "line_number": 16, "usage_type": "attribute" }, { "api_name": "fla...
120192911
#!/usr/bin/env python ################################################################################ # Libraries import import sys import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties import numpy as np import glob ########################################################################...
null
analysis/PlotPrefixes/prefixes_comb_ipv6_cdf.py
prefixes_comb_ipv6_cdf.py
py
5,272
python
en
code
null
code-starcoder2
76
[ { "api_name": "glob.glob1", "line_number": 34, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 47, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 47, "usage_type": "name" }, { "api_name": "numpy.cumsum", ...
208129123
from django.core.management.base import BaseCommand, CommandError from django.core.mail import send_mail from ...models import OrderItem, VendorEmail from django.template import Context from django.template.loader import get_template import datetime class Command(BaseCommand): def handle(self, *args, **options):...
null
orders/management/commands/sendemail.py
sendemail.py
py
1,002
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.core.management.base.BaseCommand", "line_number": 9, "usage_type": "name" }, { "api_name": "datetime.date.today", "line_number": 12, "usage_type": "call" }, { "api_name": "datetime.date", "line_number": 12, "usage_type": "attribute" }, { "api...
638265115
import docker # from docker.api.service import ServiceMode from docker.types import SecretReference, ServiceMode client = docker.DockerClient(base_url='unix://var/run/docker.sock') image = 'aerospike/aerospike-server' # network = 'aerospikenetwork' # client.networks.create(network, internal=True) mode = ServiceMode...
null
data/docker/database/aerospike/test_server/run_docker.py
run_docker.py
py
840
python
en
code
null
code-starcoder2
76
[ { "api_name": "docker.DockerClient", "line_number": 5, "usage_type": "call" }, { "api_name": "docker.types.ServiceMode", "line_number": 12, "usage_type": "call" }, { "api_name": "docker.types.SecretReference", "line_number": 18, "usage_type": "call" } ]
606421975
# # This file is part of Brazil Data Cube Collection Builder. # Copyright (C) 2019-2020 INPE. # # Brazil Data Cube Collection Builder is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Handle Sentinel Download interface.""" import o...
null
bdc_collection_builder/collections/sentinel1/download.py
download.py
py
3,913
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.Response", "line_number": 22, "usage_type": "attribute" }, { "api_name": "os.makedirs", "line_number": 29, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 29, "usage_type": "call" }, { "api_name": "os.path", "lin...
437480628
# construct Codon Markov Model # Input: genbank file of Prokaryote in one folder # Output: codon Markov Model of every input genebank import argparse import sys import os import numpy as np np_load_old = np.load np.load = lambda *a,**k: np_load_old(*a, allow_pickle=True, **k) import pandas as pd from Bio import SeqIO i...
null
cmm_HoPhage_S.py
cmm_HoPhage_S.py
py
5,271
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.load", "line_number": 8, "usage_type": "attribute" }, { "api_name": "numpy.load", "line_number": 9, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser", "line_number": 15, "usage_type": "call" }, { "api_name": "os.getcwd", ...
241332813
import collections, itertools import nltk.classify.util, nltk.metrics import random from sklearn import metrics from sklearn.svm import SVC from nltk.classify import NaiveBayesClassifier , DecisionTreeClassifier , MaxentClassifier from nltk.classify import SklearnClassifier from nltk.corpus import movie_reviews, stopw...
null
PA4/Baozhi_PA4_final.py
Baozhi_PA4_final.py
py
4,641
python
en
code
null
code-starcoder2
76
[ { "api_name": "sklearn.metrics.precision_score", "line_number": 22, "usage_type": "call" }, { "api_name": "sklearn.metrics", "line_number": 22, "usage_type": "name" }, { "api_name": "sklearn.metrics.recall_score", "line_number": 23, "usage_type": "call" }, { "api_...
103207020
# uncompyle6 version 3.7.4 # Python bytecode 3.6 (3379) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: C:\Users\R and L\Dropbox\Coding Notes and Programming\gcapi-python\gcapi\gcapi_client.py # Compiled at: 2020-02-29 16:31:02 # Size of source mod 2**32: 7679 bytes...
null
pycfiles/gcapi-python-0.0.7.tar/gcapi_client.cpython-36.py
gcapi_client.cpython-36.py
py
10,121
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.post", "line_number": 20, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 21, "usage_type": "call" }, { "api_name": "gcapi.gcapi_exception.GCapiException", "line_number": 23, "usage_type": "call" }, { "api_name": "request...
277165358
import os from math import ceil import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from tensorflow.keras.datasets import mnist import tensorflow.keras.backend as K from Checkpoint import load_checkpoint from Utils import make_noise, korea_time, save_summary, make_folders_for_model, save_initi...
null
MNIST/Complicated/WGAN/Model.py
Model.py
py
11,577
python
en
code
null
code-starcoder2
76
[ { "api_name": "Utils.make_folders_for_model", "line_number": 35, "usage_type": "call" }, { "api_name": "math.ceil", "line_number": 41, "usage_type": "call" }, { "api_name": "tensorflow.keras.utils.Progbar", "line_number": 46, "usage_type": "call" }, { "api_name": ...
393653374
import pandas as pd import torch from torch import nn from torch.nn import functional as F from rebar import recurrence, profiling import time from boardlaw import cuda class Optimal(nn.Module): def __init__(self, features, n_models, n_layers): super().__init__() self.layers = nn.ModuleList([nn.Li...
null
experiments/parallel/multinet.py
multinet.py
py
5,776
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 9, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 9, "usage_type": "name" }, { "api_name": "torch.nn.ModuleList", "line_number": 13, "usage_type": "call" }, { "api_name": "torch.nn", "line_...
620028624
# Lukas - 24.05.18 # xmlrpc-client based on https://docs.python.org/3.1/library/xmlrpc.server.html and interface with TraitsUI. Script is written for Phython2 import xmlrpclib # Different in Python3 from traits.api import HasTraits, Button, Int, Float, String, Bool, Range, Enum from traitsui.api import View, Item, H...
null
xmlrpc/sh_client/client.py
client.py
py
4,306
python
en
code
null
code-starcoder2
76
[ { "api_name": "threading.Thread", "line_number": 11, "usage_type": "name" }, { "api_name": "time.sleep", "line_number": 15, "usage_type": "call" }, { "api_name": "traits.api.HasTraits", "line_number": 17, "usage_type": "name" }, { "api_name": "traits.api.Float", ...
565579244
import os from flask import Flask, request, make_response, jsonify from flask_restful import Api from flask_cors import CORS import os app = Flask(__name__) api = Api(app) CORS(app, resources={r"/api/*": {"origins": "*"}}) app.config['JSON_AS_ASCII'] = False respE = { "events":[ { ...
null
server/__init__.py
__init__.py
py
1,401
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 9, "usage_type": "call" }, { "api_name": "flask_restful.Api", "line_number": 10, "usage_type": "call" }, { "api_name": "flask_cors.CORS", "line_number": 11, "usage_type": "call" }, { "api_name": "flask.make_response", ...
289078977
import sys, inspect import NovelParsers import NovelDownloader import TKWrapper import threading from multiprocessing.pool import ThreadPool import uuid class NovelGUI: def __init__(self): # Set download pool size (how many chapters to download at a time) self.poolSize = ...
null
novel2ebook.py
novel2ebook.py
py
10,382
python
en
code
null
code-starcoder2
76
[ { "api_name": "TKWrapper.TKWrapper", "line_number": 17, "usage_type": "call" }, { "api_name": "inspect.getmembers", "line_number": 21, "usage_type": "call" }, { "api_name": "inspect.isclass", "line_number": 21, "usage_type": "attribute" }, { "api_name": "uuid.uuid...
535358919
# you can watch more on ' www.mllounge.com ' # Basic CNN project from keras.models import Sequential from keras.layers import Conv2D, MaxPool2D, Flatten, Dropout, Dense from keras.optimizers import Adam, rmsprop import numpy as np import cv2 import serial from PIL import Image import time import sys class CnnModel()...
null
Basic Project/CNN - Distinguish language according to characters/CNN - Distinguish language according to characters.py
CNN - Distinguish language according to characters.py
py
3,850
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.load", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.reshape", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.reshape", "line_number": 19, "usage_type": "call" }, { "api_name": "keras.models.Sequential", ...
296970072
import torch import torch.nn as nn def kld(mu1, std1, mu2, std2): p = torch.distributions.Normal(mu1, std1) q = torch.distributions.Normal(mu2, std2) return torch.distributions.kl_divergence(p, q).mean() class Encoder(nn.Module): def __init__(self, inShape, muSize, sigSize, h = 300): su...
null
experiment_2_face_tasks/vae.py
vae.py
py
4,426
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.distributions.Normal", "line_number": 10, "usage_type": "call" }, { "api_name": "torch.distributions", "line_number": 10, "usage_type": "attribute" }, { "api_name": "torch.distributions.Normal", "line_number": 11, "usage_type": "call" }, { "ap...
647999621
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import njango.fields class Migration(migrations.Migration): dependencies = [ ('core', '0003_budgethead_recurrent'), ('project', '0008_auto_20160630_2118'), ] operations = [ m...
null
project/migrations/0009_exchangerate.py
0009_exchangerate.py
py
879
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.migrations.Migration", "line_number": 8, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 8, "usage_type": "name" }, { "api_name": "django.db.migrations.CreateModel", "line_number": 16, "usage_type": "call" }, ...
72324595
# Copyright (C) 2020 Zurich Instruments # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. import pytest from hypothesis import given, strategies as st import numpy as np from .context import ( UHFQA, UHFQA_AWG, ReadoutChannel, Dev...
null
tests/test_uhfqa.py
test_uhfqa.py
py
10,989
python
en
code
null
code-starcoder2
76
[ { "api_name": "context.uhfqa_logger.disable_logging", "line_number": 20, "usage_type": "call" }, { "api_name": "context.uhfqa_logger", "line_number": 20, "usage_type": "name" }, { "api_name": "context.UHFQA", "line_number": 24, "usage_type": "call" }, { "api_name"...
80583926
from django.test import TestCase from topspots.services import get_lat_lng, get_nearby_airports,\ get_location_from_address, get_city_state class TestGetLocationData(TestCase): def test_lat_lng_returns_correct_lat_and_lng(self): address = 'Sunnyside Park, Summit Street, KCMO, MO' expected_la...
null
topspots/tests/test_services.py
test_services.py
py
1,668
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.test.TestCase", "line_number": 7, "usage_type": "name" }, { "api_name": "topspots.services.get_lat_lng", "line_number": 14, "usage_type": "call" }, { "api_name": "topspots.services.get_city_state", "line_number": 21, "usage_type": "call" }, { ...
400873995
import numpy as np from pathlib import Path from ray.util.joblib import register_ray from numpy import load, save from sklearn.pipeline import Pipeline from sklearn.model_selection import train_test_split from sklearn.model_selection import RepeatedKFold, cross_val_score from sklearn.metrics import make_scorer from xgb...
null
preprocessing/02_encoding.py
02_encoding.py
py
7,042
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.set_option", "line_number": 19, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 38, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 45, "usage_type": "call" }, { "api_name": "Transformers.RareLa...
15453993
from random import randint, random import math, sys, colorsys, threading from math import pi, sin #import direct.directbase.DirectStart from direct.actor.Actor import Actor from panda3d.core import Filename, CardMaker #from direct.showbase.DirectObject import DirectObject #from panda3d.core import * from pa...
null
demo_artoolkit/ar_demo4.py
ar_demo4.py
py
3,720
python
en
code
null
code-starcoder2
76
[ { "api_name": "demobase.DemoBase", "line_number": 24, "usage_type": "attribute" }, { "api_name": "demobase.DemoBase.__init__", "line_number": 30, "usage_type": "call" }, { "api_name": "demobase.DemoBase", "line_number": 30, "usage_type": "attribute" }, { "api_name...
328050314
import json import os import functools import decimal import operator from django.utils.dateparse import parse_datetime from django.http import HttpResponse from rest_framework import status from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.exceptions import Permi...
null
api/views/employee_views.py
employee_views.py
py
18,294
python
en
code
null
code-starcoder2
76
[ { "api_name": "rest_framework_jwt.settings.api_settings.JWT_DECODE_HANDLER", "line_number": 31, "usage_type": "attribute" }, { "api_name": "rest_framework_jwt.settings.api_settings", "line_number": 31, "usage_type": "name" }, { "api_name": "rest_framework_jwt.settings.api_setting...
48829133
import numpy as np import math import matplotlib.pyplot as plt from matplotlib2tikz import save as tikz_save from label_lines import * fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.spines['left'].set_position('zero') ax.spines['bottom'].set_position('zero') ax.spines['right'].set_color('none') ax.spines['top']....
null
Spring 2018/Calc IV/Project/graphs/haar.py
haar.py
py
2,124
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.pyplot.figure", "line_number": 8, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 8, "usage_type": "name" }, { "api_name": "math.pi", "line_number": 19, "usage_type": "attribute" }, { "api_name": "numpy.linspace"...
140470339
""" weather_parser.py: Parses and cleans json weather data from the Dark Sky API WeatherRecordParser (cls): Parses an individual weather record WeatherParser (cls): Wrapper for WeatherRecordParser; parses multiple records WeatherCleaner (cls): Cleans and transforms parsed weather data """ import json...
null
lib/weather_parser.py
weather_parser.py
py
9,519
python
en
code
null
code-starcoder2
76
[ { "api_name": "pendulum.from_timestamp", "line_number": 45, "usage_type": "call" }, { "api_name": "pandas.io.json.json_normalize", "line_number": 91, "usage_type": "call" }, { "api_name": "pandas.io.json.json_normalize", "line_number": 103, "usage_type": "call" }, { ...
537484239
import sys from django.db import models from PIL import Image from io import BytesIO from django.core.files.uploadedfile import InMemoryUploadedFile # Create your models here. class upload(models.Model): user=models.CharField(max_length=100) image=models.ImageField(upload_to="photos/",default='/media/...
null
models.py
models.py
py
1,000
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.models.Model", "line_number": 8, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 8, "usage_type": "name" }, { "api_name": "django.db.models.CharField", "line_number": 9, "usage_type": "call" }, { "api_name": "...
460326543
from random import randrange from scipy import io from PIL import Image, ImageDraw import matplotlib.pyplot as plt import matplotlib.image as mpimg class Dataset: def __init__(self, filename): mat = io.loadmat(filename) self.examples = mat["examples"][0] self.size = self.examples.size ...
null
DatasetImport.py
DatasetImport.py
py
1,586
python
en
code
null
code-starcoder2
76
[ { "api_name": "scipy.io.loadmat", "line_number": 12, "usage_type": "call" }, { "api_name": "scipy.io", "line_number": 12, "usage_type": "name" }, { "api_name": "random.randrange", "line_number": 17, "usage_type": "call" }, { "api_name": "matplotlib.image.imread", ...
104660275
from collections import Counter from csv import writer class PlayerExposures: def __init__(self): self.total_exposures = Counter({}) self.positional_exposures = {} def bump_exposures(self, lineup): for player in lineup: if player in self.total_exposures: se...
null
pydfs_lineup_optimizer/player_exposures.py
player_exposures.py
py
2,666
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.Counter", "line_number": 7, "usage_type": "call" }, { "api_name": "collections.Counter", "line_number": 31, "usage_type": "call" }, { "api_name": "csv.writer", "line_number": 42, "usage_type": "call" } ]
52537197
# -*- coding:utf-8 -*- import os import time from pathlib import Path from .fs import read_json from .fs import write_json from .fs import mkdir from .http import fetch class Crawler(object): u"""爬虫 Parameters ---------- timeout : int, optional, default=3 请求超时时间 timesleep : int, optiona...
null
nlptools/crawler.py
crawler.py
py
6,777
python
en
code
null
code-starcoder2
76
[ { "api_name": "fs.mkdir", "line_number": 39, "usage_type": "call" }, { "api_name": "time.sleep", "line_number": 43, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 164, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_number": 169...
395176504
from os import path, mkdir, walk # pip install Crypto from Crypto.Cipher import AES from Crypto.Hash import MD5 from base64 import b64encode, b64decode from sys import version if version[0] == 3: raw_input = input BLOCK_SIZE = 32 PADDING = '{' pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING Enco...
null
dox.py
dox.py
py
2,350
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.version", "line_number": 8, "usage_type": "name" }, { "api_name": "base64.b64encode", "line_number": 15, "usage_type": "call" }, { "api_name": "base64.b64decode", "line_number": 16, "usage_type": "call" }, { "api_name": "os.path.isdir", "lin...
227795524
from varglas.meshing import MeshGenerator, MeshRefiner, GetBasin from varglas.data.data_factory import DataFactory from varglas.io import DataInput, print_min_max from pylab import * from scipy.interpolate import interp2d kappa = 1.0 # ice thickness to refine #===...
null
antarctica/gen_basin_mesh.py
gen_basin_mesh.py
py
2,836
python
en
code
null
code-starcoder2
76
[ { "api_name": "varglas.data.data_factory.DataFactory.get_ant_measures", "line_number": 15, "usage_type": "call" }, { "api_name": "varglas.data.data_factory.DataFactory", "line_number": 15, "usage_type": "name" }, { "api_name": "varglas.data.data_factory.DataFactory.get_bedmap2", ...
258800080
""" Q503 Next Greater Element II Medium Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first greater number to its traversing-order next in the array, which means you could se...
null
Q503.py
Q503.py
py
1,335
python
en
code
null
code-starcoder2
76
[ { "api_name": "typing.List", "line_number": 20, "usage_type": "name" } ]
342147849
from django.conf.urls import url from . import views urlpatterns = [ url(r'^list/$', views.cveindex,name="list"), #DJango自动补充url / url(r"^search/$",views.cvesearch), url(r'^detail/(?P<id>.*)/$', views.cvedetail, name='detail'), url(r'^cvedit/$', views.cvedit, name="cvedit"), url(r'cveImagelUplo...
null
WikiList2/list/urls.py
urls.py
py
568
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.urls.url", "line_number": 4, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 5, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 6, "usage_type": "call" }, { "api_name": "django.co...
230997476
from django.test import TestCase from django.test.simple import DjangoTestSuiteRunner # custom test runner only sets up test DB if necessary. class CustomTestSuiteRunner(DjangoTestSuiteRunner): def run_tests(self, test_labels, extra_tests=None, **kwargs): self.setup_test_environment() suite = self....
null
editorsnotes/testrunner.py
testrunner.py
py
799
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.test.simple.DjangoTestSuiteRunner", "line_number": 5, "usage_type": "name" }, { "api_name": "django.test.TestCase", "line_number": 11, "usage_type": "argument" } ]
521999527
from django.contrib import admin from app.models import Todo # Register your models here. class TodoAdmin(admin.ModelAdmin): list_display = ( "title", "user", "status", 'priority', 'updated_date', 'created_date', ) list_filter = ("user", ) search_f...
null
app/admin.py
admin.py
py
393
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.admin.ModelAdmin", "line_number": 5, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 5, "usage_type": "name" }, { "api_name": "django.contrib.admin.site.register", "line_number": 17, "usage_type": "call" },...
162104565
"""server URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based ...
null
webserver/server/main/urls.py
urls.py
py
1,088
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 20, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 21, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 22, "usage_type": "call" }, { "api_name": "django.urls.path",...
124164151
#!C:/Users/Anjana/Anaconda3/python.exe # coding: utf-8 # In[1]: ''' * Author : Anjana Tiha * Course : Inform Retrieval/Web Search * Course Instructor: Professor Visali Rus * Semester : Fall 2017 * University : University of Memphis * Project Name : Web Search Engine Implementat...
null
search_engine/search_engine_website/Obsolete/search_engine2.py
search_engine2.py
py
33,707
python
en
code
null
code-starcoder2
76
[ { "api_name": "queue.Queue", "line_number": 75, "usage_type": "call" }, { "api_name": "time.time", "line_number": 79, "usage_type": "call" }, { "api_name": "os.makedirs", "line_number": 125, "usage_type": "call" }, { "api_name": "errno.EEXIST", "line_number": ...
490320112
import pandas as pd import sqlalchemy as db from sqlalchemy import Column, Float, Table, Integer, String from sqlalchemy.ext.declarative import declarative_base engine = db.create_engine('sqlite:///traindb.db', echo=True) Base = declarative_base() Base.metadata.reflect(engine) def create_tb(table_name, column_names)...
null
Assignment 1/Database/Resources/Database_utilities.py
Database_utilities.py
py
1,463
python
en
code
null
code-starcoder2
76
[ { "api_name": "sqlalchemy.create_engine", "line_number": 6, "usage_type": "call" }, { "api_name": "sqlalchemy.ext.declarative.declarative_base", "line_number": 7, "usage_type": "call" }, { "api_name": "sqlalchemy.Column", "line_number": 15, "usage_type": "call" }, { ...
631617206
#!/usr/bin/env python3 """ Author: Harsh Desai Course: JHU EN.685 Data Science Problem Set 2: Obtaining and Querying Data Description: Excel file parser for Top 100 Contractors of the U.S. federal goverment. """ import sqlite3 import os import pandas as pd import re def parse_xlsx(excel_file): # Starts parsing e...
null
ProblemSets/Problem_Set_2/contracts.py
contracts.py
py
4,666
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_excel", "line_number": 18, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 21, "usage_type": "call" }, { "api_name": "re.search", "line_number": 24, "usage_type": "call" }, { "api_name": "pandas.Series", "lin...
357714408
from setuptools import setup, find_packages version = '0.4' long_description = ('a package destined to be forgotten') setup(name='themes.realestate_ecuador', version=version, description="Theme for Real Estate Agents", long_description=long_description, # Get more strings from # http://...
null
pypi_install_script/themes.realestate_ecuador-0.4/setup.py
setup.py
py
1,082
python
en
code
null
code-starcoder2
76
[ { "api_name": "setuptools.setup", "line_number": 7, "usage_type": "call" }, { "api_name": "setuptools.find_packages", "line_number": 21, "usage_type": "call" } ]
430664575
# -*- coding: utf-8 -*- # @Author = moon # @Create = 2018/4/28 14:35 # @File = baisi.py # 用于爬取百思不得姐图片,可指定爬取页面 import requests,re,urllib.request def getPic(page): response = requests.get("http://www.budejie.com/pic/%s" % page) html = response.text reg = r'data-original="(.*?)"' for i in re.findall(reg...
null
百思不得姐/baisi.py
baisi.py
py
560
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 10, "usage_type": "call" }, { "api_name": "re.findall", "line_number": 13, "usage_type": "call" }, { "api_name": "urllib.request.request.urlretrieve", "line_number": 16, "usage_type": "call" }, { "api_name": "urllib.req...
60272334
from keras.datasets import reuters from keras import models from keras import layers import numpy as np # 读取数据 (train_data, train_labels), (test_data, test_labels) = reuters.load_data( path='/users/yu/desktop/keras__datasets/reuters.npz', num_words=10000) print(len(train_data)) # 数据向量化 def vectorize_sequenc...
null
ai2_mouple.py
ai2_mouple.py
py
1,656
python
en
code
null
code-starcoder2
76
[ { "api_name": "keras.datasets.reuters.load_data", "line_number": 8, "usage_type": "call" }, { "api_name": "keras.datasets.reuters", "line_number": 8, "usage_type": "name" }, { "api_name": "numpy.zeros", "line_number": 16, "usage_type": "call" }, { "api_name": "num...
272602468
"""Audit functions to simplify adding context and extra data to log messages destined for audit logs """ import logging from hydrant.logserverhandler import LogServerHandler EVENT_LOG_NAME = "hydrant_event_logger" def audit_log_init(app): log_server_handler = LogServerHandler( jwt=app.config['LOGSERVER...
null
hydrant/audit.py
audit.py
py
921
python
en
code
null
code-starcoder2
76
[ { "api_name": "hydrant.logserverhandler.LogServerHandler", "line_number": 13, "usage_type": "call" }, { "api_name": "logging.getLogger", "line_number": 16, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 17, "usage_type": "attribute" }, { "api...
264579636
import twitter outfile = open("twitterFollowers.txt", 'w') # Variables that contains the user credentials to access Twitter API ACCESS_TOKEN = '824794440409706496-CGUoqhcZpfk4lOcblNVG1OuubwaCqZp' ACCESS_SECRET = 'Mgd7wctkwI3nNUL6RHD4Cqjg9HVngccRrynoWfEsTUzlJ' CONSUMER_KEY = '72haUMMgwOXNNGXXz4G0N7B9m' CONSUMER_SECRET...
null
assignments/a4-solution/getFollowers.py
getFollowers.py
py
1,165
python
en
code
null
code-starcoder2
76
[ { "api_name": "twitter.Api", "line_number": 10, "usage_type": "call" } ]
205353916
from alerta.models.alert import Alert from alerta.webhooks import WebhookBase import json class DynatraceWebhook(WebhookBase): def incoming(self, query_string, payload): services = [] #serviceValue = payload['ImpactedEntities'][1]['entity'].split('-')[0] #services.append(serviceValue) ...
null
webhooks/dynatrace/alerta_dynatrace.py
alerta_dynatrace.py
py
1,047
python
en
code
null
code-starcoder2
76
[ { "api_name": "alerta.webhooks.WebhookBase", "line_number": 6, "usage_type": "name" }, { "api_name": "alerta.models.alert.Alert", "line_number": 21, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 33, "usage_type": "call" } ]
356862931
#!/usr/bin/env python3 # # Copyright 2017 Google Inc. # # 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 ...
null
tools/plot_satisfaction.py
plot_satisfaction.py
py
3,002
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.asarray", "line_number": 36, "usage_type": "call" }, { "api_name": "numpy.sum", "line_number": 38, "usage_type": "call" }, { "api_name": "simulation.static.user_satisfaction", "line_number": 47, "usage_type": "call" }, { "api_name": "simulatio...
327967529
# coding=utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import ast import argparse from math import ceil import paddle import numpy as np import paddle.static from paddlehub.module.module import moduleinfo, runnable, serving from paddle.inf...
null
modules/image/object_detection/faster_rcnn_resnet50_coco2017/module.py
module.py
py
8,513
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 32, "usage_type": "call" }, { "api_name": "os.path", "line_number": 32, "usage_type": "attribute" }, { "api_name": "processor.load_label_info", "line_number": 34, "usage_type": "call" }, { "api_name": "os.path.join", ...
200973279
#!/usr/local/bin/python2.7 from sys import exit, stdout, argv from os import environ, system environ['KERAS_BACKEND'] = 'tensorflow' environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" environ["CUDA_VISIBLE_DEVICES"] = "" import numpy as np import utils import signal from keras.layers import Input, Dense, Dropout, concaten...
null
train/full/models/train_shallow_panda_5_decorr.py
train_shallow_panda_5_decorr.py
py
3,703
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ", "line_number": 5, "usage_type": "name" }, { "api_name": "os.environ", "line_number": 6, "usage_type": "name" }, { "api_name": "os.environ", "line_number": 7, "usage_type": "name" }, { "api_name": "keras.backend.set_image_data_format", ...
444566081
import os from fabric.api import cd, env, task, require, sudo, prefix, shell_env, run from fabric.contrib.files import exists, upload_template REPO_URL = 'https://github.com/pudo/nomenklatura.git' PACKAGES = ( 'git-core', 'nginx', # 'npm', 'python-dev', 'python-virtualenv', 'supervisor', ) @...
null
fabfile.py
fabfile.py
py
3,461
python
en
code
null
code-starcoder2
76
[ { "api_name": "fabric.api.env.user", "line_number": 19, "usage_type": "attribute" }, { "api_name": "fabric.api.env", "line_number": 19, "usage_type": "name" }, { "api_name": "fabric.api.env.hosts", "line_number": 20, "usage_type": "attribute" }, { "api_name": "fab...
543145775
import csv import django django.setup() import website.alimentos as alimentos def run(nomeArq): with open(nomeArq, encoding='utf8') as csvfile: reader = csv.reader(csvfile, delimiter=';') for row in reader: numero = int(row[0]) porcao = row[1] descricao = row[2] ...
null
carregar_alimentos.py
carregar_alimentos.py
py
2,681
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.setup", "line_number": 3, "usage_type": "call" }, { "api_name": "csv.reader", "line_number": 8, "usage_type": "call" }, { "api_name": "website.alimentos.Alimento", "line_number": 38, "usage_type": "call" }, { "api_name": "website.alimentos", ...
198010386
from flask import Flask from app.routes import app application = Flask(__name__) application.config.from_object('config.ConfigDev') application.register_blueprint(app) if __name__ == '__main__': application.debug = True application.run(host="0.0.0.0",port=3000,debug=True)
null
application.py
application.py
py
282
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 4, "usage_type": "call" }, { "api_name": "app.routes.app", "line_number": 6, "usage_type": "argument" } ]
441252048
import cv2 import numpy as np from PIL import Image from PIL.ExifTags import TAGS import PIL.ExifTags tImgNum=7 imgNames = [] for i in range(1,tImgNum+1): imgNames.append("01 ("+str(i)+").JPG") print(i) imgList = [cv2.imread(fn) for fn in imgNames] def get_field (exif,field) : for (k,v) in exif.items(): if TAGS.ge...
null
HDR.py
HDR.py
py
1,624
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.imread", "line_number": 11, "usage_type": "call" }, { "api_name": "PIL.ExifTags.TAGS.get", "line_number": 14, "usage_type": "call" }, { "api_name": "PIL.ExifTags.TAGS", "line_number": 14, "usage_type": "name" }, { "api_name": "PIL.Image.open", ...
508303503
import gc import json import sys from time import sleep from confluent_kafka import Consumer, KafkaError, KafkaException from clickhouse import init_clickhouse_database, save_to_clickhouse from config import settings from models import Event # kafka client init conf = { "bootstrap.servers": settings.kafka_hosts_...
null
etl/src/main.py
main.py
py
1,723
python
en
code
null
code-starcoder2
76
[ { "api_name": "config.settings.kafka_hosts_as_string", "line_number": 14, "usage_type": "attribute" }, { "api_name": "config.settings", "line_number": 14, "usage_type": "name" }, { "api_name": "config.settings.kafka_consumer_group", "line_number": 15, "usage_type": "attri...
22564525
import torch from model import ModelSimple1 import const,utils import numpy as np from torch.autograd import Variable import math import scipy.stats from sklearn.metrics import f1_score from io import open def cal_f1(targets,outputs): outputs_bin = [] targets_bin = [] for i in xrange(len(outputs)): ...
null
eval.py
eval.py
py
1,952
python
en
code
null
code-starcoder2
76
[ { "api_name": "sklearn.metrics.f1_score", "line_number": 25, "usage_type": "call" }, { "api_name": "torch.from_numpy", "line_number": 30, "usage_type": "call" }, { "api_name": "numpy.dot", "line_number": 42, "usage_type": "call" }, { "api_name": "math.sqrt", "...
339731834
"""The module for the Resource class. Classes: Resource """ from typing import List, Optional, Union from rdflib import Namespace, URIRef from modules.nampi_graph import Nampi_graph from modules.node import Node class Resource(Node): """A RDF resource resource with an individual uri and possibly a label."...
null
modules/resource.py
resource.py
py
1,122
python
en
code
null
code-starcoder2
76
[ { "api_name": "modules.node.Node", "line_number": 15, "usage_type": "name" }, { "api_name": "typing.Optional", "line_number": 18, "usage_type": "name" }, { "api_name": "modules.nampi_graph.Nampi_graph", "line_number": 22, "usage_type": "name" }, { "api_name": "typ...
30886225
#!/usr/bin/env python3 import os import argparse import cv2 import numpy as np import imutils # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="path to input image for preprocessing") ap.add_argument("-t", "--threshold", require...
null
MachineLearning/natural-language-processing/tesseract/preprocess.py
preprocess.py
py
4,141
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 10, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number": 19, "usage_type": "call" }, { "api_name": "cv2.IMREAD_GRAYSCALE", "line_number": 19, "usage_type": "attribute" }, { "api_name": "imutils....
472821756
from django.conf.urls import re_path from django.urls import path from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from .views import ( AppointmentCreateView, AppointmentDeleteView, AppointmentDetailView, AppointmentListView, Appointment...
null
reminders/urls.py
urls.py
py
1,358
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 16, "usage_type": "call" }, { "api_name": "django.contrib.auth.decorators.login_required", "line_number": 16, "usage_type": "call" }, { "api_name": "views.AppointmentListView.as_view", "line_number": 16, "usage_type": "call...
320203693
import decimal import logging import ujson from collections import defaultdict import operator import pandas as pd from django.contrib.contenttypes.models import ContentType from django.db import transaction from django.db.models.query_utils import Q from django.utils import timezone from rest_framework import status,...
null
api/v1/goals/views.py
views.py
py
29,720
python
en
code
null
code-starcoder2
76
[ { "api_name": "decimal.getcontext", "line_number": 37, "usage_type": "call" }, { "api_name": "decimal.FloatOperation", "line_number": 37, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 39, "usage_type": "call" }, { "api_name": "api....
184077974
# -*- coding: utf-8 -*- """ Created on Fri Apr 22 10:58:08 2016 @author: David """ from __future__ import division import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint import pyx from pyxgraph import PyXGraph, pyxcolorbar, pyxsave def r_rescale(r, e0): """ Parameters --...
null
Programme/imports/tov_functions.py
tov_functions.py
py
12,062
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.zeros", "line_number": 93, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 95, "usage_type": "call" }, { "api_name": "numpy.pi", "line_number": 95, "usage_type": "attribute" }, { "api_name": "numpy.pi", "line_number": 9...
49844547
from pathlib import Path from soulstruct.base.events.core import convert_events as convert_events_base, compare_events as compare_events_base from .emevd import EMEVD from ..maps.constants import ALL_MAPS def convert_events( output_type, output_directory, input_type=None, input_directory=None, ma...
null
soulstruct/darksouls3/events/utilities.py
utilities.py
py
2,121
python
en
code
null
code-starcoder2
76
[ { "api_name": "pathlib.Path", "line_number": 30, "usage_type": "call" }, { "api_name": "maps.constants", "line_number": 31, "usage_type": "name" }, { "api_name": "maps.constants", "line_number": 32, "usage_type": "name" }, { "api_name": "maps.constants.ALL_MAPS", ...
552357671
#! /usr/bin/env python # coding: utf-8 """Contains the parser class which allows to cut a sentence.""" import unicodedata import config as const from fuzzywuzzy import fuzz class Parser: """The objects in this class are used to cut and clean sentences.""" def __init__(self): """Initialise the word...
null
grandpyapp/backend/parser.py
parser.py
py
2,098
python
en
code
null
code-starcoder2
76
[ { "api_name": "config.STOP_WORDS_GENERIQUE", "line_number": 17, "usage_type": "attribute" }, { "api_name": "config.STOP_WORD_ADDED", "line_number": 17, "usage_type": "attribute" }, { "api_name": "unicodedata.normalize", "line_number": 24, "usage_type": "call" }, { ...
625166324
#This program performs surface and volume rendering for a dataset. import vtk from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk import argparse import numpy as np #Gaussian filter def gaussianFilter(image): filter = vtk.vtkImageGaussianSmooth() filter.SetInputConnection(image.GetOutp...
null
visualization_final_2.py
visualization_final_2.py
py
16,481
python
en
code
null
code-starcoder2
76
[ { "api_name": "vtk.vtkImageGaussianSmooth", "line_number": 11, "usage_type": "call" }, { "api_name": "vtk.vtkImageThreshold", "line_number": 24, "usage_type": "call" }, { "api_name": "vtk.vtkMarchingCubes", "line_number": 39, "usage_type": "call" }, { "api_name": ...
191385798
#实例: #中国大学排名爬虫 #定向爬虫 #输入URL排名,输出大学排名信息 import requests from bs4 import BeautifulSoup import bs4 def getHTMLText(url): try: r = requests.get(url, timeout=30); r.raise_for_status() r.encoding = r.apparent_encoding return r.text except: return "" def fillU...
null
UnivRanklist.py
UnivRanklist.py
py
1,254
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 11, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 19, "usage_type": "call" }, { "api_name": "bs4.element", "line_number": 21, "usage_type": "attribute" } ]
304736819
import numpy as np import matplotlib.pyplot as plt date, recordedWeather, conditions, high, low = np.loadtxt("RealWeatherData.csv", unpack=True, delimiter=',', dtype='str') #part a: ratio of cloudy to clear days def getRatioOfCloudyToClear(conditions): daysClear = 0 #initialize daysClear to 0 for i in range (...
null
p6problem1/p6problem1.py
p6problem1.py
py
3,684
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.loadtxt", "line_number": 4, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 33, "usage_type": "call" }, { "api_name": "numpy.where", "line_number": 35, "usage_type": "call" }, { "api_name": "numpy.amax", "line_number": ...
597603745
import csv import json fr = open("data4030000-4035499.json") fw = open("data.csv", "w", newline="") csv_writer = csv.writer(fw) json_fr = json.load(fr) csv_writer.writerow(["maths","phy","chem","mech","bee","workshop","cgpa","sgpa"]) for student in json_fr: marks = student['marks'] csv_writer.writerow(list(m...
null
jsontocsv.py
jsontocsv.py
py
358
python
en
code
null
code-starcoder2
76
[ { "api_name": "csv.writer", "line_number": 5, "usage_type": "call" }, { "api_name": "json.load", "line_number": 7, "usage_type": "call" } ]
598851005
#!/usr/bin/env python3 import os import re import yaml script_path = os.path.dirname(os.path.abspath(__file__)) def_path = os.path.join(script_path, "definitions") for fn in os.listdir(def_path): print(f"processing {fn} ...") with open(os.path.join(def_path, fn)) as f: y = yaml.safe_load(f) bn = os.path.s...
null
generate.py
generate.py
py
1,009
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.dirname", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path.join", "line_nu...
70154575
from sklearn.cluster import KMeans from scipy.spatial.distance import cdist import matplotlib.pyplot as plt ### ElbowMethod distortions = [] K = range(1,10) for k in K: kmeanModel = KMeans(n_clusters=k) kmeanModel.fit(X) distortions.append(sum(np.min(cdist(X,kmeanModel.cluster_centers_, 'euclidean'), a...
null
English/Clustering.py
Clustering.py
py
2,196
python
en
code
null
code-starcoder2
76
[ { "api_name": "sklearn.cluster.KMeans", "line_number": 10, "usage_type": "call" }, { "api_name": "scipy.spatial.distance.cdist", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", "line_number": 15, "usage_type": "call" }, { "api_na...
323633722
from __future__ import unicode_literals from django.shortcuts import render, redirect from datetime import datetime import random def index(request): if 'gold' not in request.session: request.session['gold'] = 0 request.session['activities'] = [] context = { "gold": request.session["gold"], "activities": re...
null
PythonDjango - Week 6/ninja_gold/main/apps/ninja_gold/views.py
views.py
py
1,566
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.shortcuts.render", "line_number": 15, "usage_type": "call" }, { "api_name": "datetime.datetime.now", "line_number": 18, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 18, "usage_type": "name" }, { "api_name": "rando...
482110090
''' PyDenseCRF: https://github.com/lucasb-eyer/pydensecrf reference of opencv color histogram: https://www.pyimagesearch.com/2014/07/14/3-ways-compare-histograms-using-opencv-python/ https://docs.opencv.org/3.3.1/dd/d0d/tutorial_py_2d_histogram.html ''' import numpy as np import pydensecrf.densecrf as dcrf from pyde...
null
CRF_all_class_paral.py
CRF_all_class_paral.py
py
18,449
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.max", "line_number": 54, "usage_type": "call" }, { "api_name": "numpy.exp", "line_number": 57, "usage_type": "call" }, { "api_name": "numpy.sum", "line_number": 58, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 67, ...
44704960
# ! /usr/bin/python # -*- coding: utf-8 -*- import time, struct, os # from openpyxl import Workbook, load_workbook from jinja2 import Environment, FileSystemLoader log_config = { } def set_log_path(): # 日志函数辅助函数 fmt = '%Y%m%d%H%M%S' value = time.localtime(int(time.time())) dt = time.strftime(fmt, va...
null
utils.py
utils.py
py
1,470
python
en
code
null
code-starcoder2
76
[ { "api_name": "time.localtime", "line_number": 15, "usage_type": "call" }, { "api_name": "time.time", "line_number": 15, "usage_type": "call" }, { "api_name": "time.strftime", "line_number": 16, "usage_type": "call" }, { "api_name": "time.localtime", "line_num...
305185281
from kivy.lang import Builder from plyer import gps from kivy.app import App from kivy.properties import BooleanProperty, ListProperty, StringProperty from kivy.clock import mainthread from kivy.utils import platform kv = ''' <ProviderToggleButton@ToggleButton>: red: rgba('#8B0000') black: rgba('#ffffff') ...
null
examples/gps/main.py
main.py
py
4,803
python
en
code
null
code-starcoder2
76
[ { "api_name": "kivy.app.App", "line_number": 66, "usage_type": "name" }, { "api_name": "kivy.properties.StringProperty", "line_number": 67, "usage_type": "call" }, { "api_name": "kivy.properties.StringProperty", "line_number": 68, "usage_type": "call" }, { "api_na...
606643667
#!/usr/lib/env python35 # for more information about matplotlib, see: # http://matplotlib.org/users/pyplot_tutorial.html import numpy as np import matplotlib.pyplot as plt if __name__=="__main__": # Create some fake data run1 = [1,2,3] run2 = [2,4,5] run3 = [1,10,2] xpoints = [1,2,3] run1_l...
null
Assignment/A2/grapher.py
grapher.py
py
731
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.pyplot.plot", "line_number": 17, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 17, "usage_type": "name" }, { "api_name": "matplotlib.pyplot.plot", "line_number": 18, "usage_type": "call" }, { "api_name": "matpl...
639958166
"""Process EEG data from the EEGDev dataset, saving out PSDs from resting EEG data. Notes ----- - This script can / should be updated to save out FOOOF objects, rather than extracted slope data. """ import os import csv import mne import numpy as np from fooof import FOOOFGroup from slf.core.db import SLFDB from sl...
null
childmind/scripts/proc_dev_dat.py
proc_dev_dat.py
py
7,974
python
en
code
null
code-starcoder2
76
[ { "api_name": "mne.set_log_level", "line_number": 34, "usage_type": "call" }, { "api_name": "slf.core.db.SLFDB", "line_number": 37, "usage_type": "call" }, { "api_name": "numpy.loadtxt", "line_number": 85, "usage_type": "call" }, { "api_name": "csv.reader", "l...
515625333
import csv import time import requests from bs4 import BeautifulSoup import re import os headers = { 'user-agent': 'Renty', } duplicate_count = 0 max_duplicate_count = 3 propertyData = [] class urlManager: index = 0 base_url = "https://www.rightmove.co.uk/property-for-sale/find.html?locationIdentifier=...
null
main.py
main.py
py
2,311
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.sep", "line_number": 50, "usage_type": "attribute" }, { "api_name": "bs4.BeautifulSoup", "line_number": 52, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 54, "usage_type": "call" }, { "api_name": "time.sleep", "lin...
47875336
"""wp_dj URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class...
null
wordpress_django_integration/wp_dj/urls.py
urls.py
py
1,382
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.urls.path", "line_number": 22, "usage_type": "call" }, { "api_name": "django.contrib.admin.site", "line_number": 22, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 22, "usage_type": "name" }, { "api_name": "...
100425580
import numpy as np import pandas as pd import matplotlib.pyplot as plt import math from scipy.optimize import curve_fit from scipy.optimize import minimize from iminuit import Minuit from pprint import pprint #import median stack data + associated fitting results from observationcode import * #########################...
null
attenuationcode.py
attenuationcode.py
py
3,639
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.genfromtxt", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.genfromtxt", "line_number": 17, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 40, "usage_type": "call" }, { "api_name": "matplotlib...
454669234
from flask import Flask from flask import render_template from flask import redirect from flask import Blueprint from flask import make_response from flask import request from flask import url_for from flask import session from flask import abort import uuid import yagmail from models.user import User from utils impo...
null
routes/login.py
login.py
py
2,225
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Blueprint", "line_number": 19, "usage_type": "call" }, { "api_name": "flask.make_response", "line_number": 25, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 25, "usage_type": "call" }, { "api_name": "flask.make_...
70752505
#!/usr/bin/env python """Tests the BME280 sensor""" import time import logging from nanpy import BME280 from nanpy.serialmanager import SerialManager logging.basicConfig(level=logging.INFO) logger = logging.getLogger("BME280") connection = SerialManager(sleep_after_connect=2) connection.open() sensor = BME280(conn...
null
nanpy/examples/bme280.py
bme280.py
py
697
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.basicConfig", "line_number": 10, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 10, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 11, "usage_type": "call" }, { "api_name": "nanpy.serialm...
72405103
# 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: paxmusica/model.py # Compiled at: 2013-03-05 16:27:54 import os, fnmatch, id3reader from flask import g from os.path import join, isdir import sqlite3 db_locatio...
null
pycfiles/paxmusica-0.0.3.tar/model.py
model.py
py
5,618
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.g.cur.execute", "line_number": 24, "usage_type": "call" }, { "api_name": "flask.g.cur", "line_number": 24, "usage_type": "attribute" }, { "api_name": "flask.g", "line_number": 24, "usage_type": "name" }, { "api_name": "flask.g.cur.execute", ...
349469483
import pickle from gensim.corpora import Dictionary from gensim.models.ldamodel import LdaModel from tqdm import tqdm from utils import ( load_config, prep_text, ) config = load_config() n = 100000 # Preprocessing text print("Preprocessing text...") data = [] for doc in tqdm(open(config["gigaword"], "r")): ...
null
scripts/train_lda_model.py
train_lda_model.py
py
763
python
en
code
null
code-starcoder2
76
[ { "api_name": "utils.load_config", "line_number": 12, "usage_type": "call" }, { "api_name": "tqdm.tqdm", "line_number": 18, "usage_type": "call" }, { "api_name": "utils.prep_text", "line_number": 19, "usage_type": "call" }, { "api_name": "gensim.corpora.Dictionary...
602267276
import openpyxl from openpyxl.utils.cell import get_column_letter def replace_nulls(filename): wb = openpyxl.load_workbook(filename) wb.sheetnames sheet = wb["Sheet1"] amountOfRows = sheet.max_row amountOfColumns = sheet.max_column for i in range(amountOfColumns): for k in range(amountOfRows): cell = str(...
null
file_processing/etls/excelswapper.py
excelswapper.py
py
1,011
python
en
code
null
code-starcoder2
76
[ { "api_name": "openpyxl.load_workbook", "line_number": 6, "usage_type": "call" }, { "api_name": "openpyxl.utils.cell.get_column_letter", "line_number": 14, "usage_type": "call" }, { "api_name": "openpyxl.utils.cell.get_column_letter", "line_number": 17, "usage_type": "cal...
130031182
# compare new / old versions of SNAP downscaled outputs def open_raster( fn, band=1 ): with rasterio.open( fn ) as rst: arr = rst.read(1) return arr def compare_files( old, new ): old = open_raster(old) new = open_raster(new) diff = (old-new) return (np.min(diff),np.max(diff)) def wrap( x ): old, new = x r...
null
snap_scripts/downscaling_v2/compare_variable_output_versions.py
compare_variable_output_versions.py
py
1,047
python
en
code
null
code-starcoder2
76
[ { "api_name": "glob.glob", "line_number": 29, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 29, "usage_type": "call" }, { "api_name": "os.path", "line_number": 29, "usage_type": "attribute" }, { "api_name": "multiprocessing.Pool", "line_...
477035934
import urwid class MsgInput(urwid.Edit): signals = ['move-focus', 'send-msg'] def submitMsg(self): urwid.emit_signal(self, 'send-msg', self.edit_text) self.set_edit_text('') def keypress(self, size, key): if key == 'enter': # send a message self.submitMsg() if key == 'up' and self.get_cursor_coord...
null
lib/ui/msg_input.py
msg_input.py
py
610
python
en
code
null
code-starcoder2
76
[ { "api_name": "urwid.Edit", "line_number": 3, "usage_type": "attribute" }, { "api_name": "urwid.emit_signal", "line_number": 8, "usage_type": "call" }, { "api_name": "urwid.emit_signal", "line_number": 18, "usage_type": "call" }, { "api_name": "urwid.ExitMainLoop"...
20953072
from datetime import datetime from http.client import HTTPMessage import io import os import unittest from github3.session import AppInstallationTokenAuth import mock import responses from cumulusci.core.exceptions import GithubException from cumulusci.core import github from cumulusci.core.github import get_github_a...
null
cumulusci/core/tests/test_github.py
test_github.py
py
3,674
python
en
code
null
code-starcoder2
76
[ { "api_name": "mock.Mock", "line_number": 18, "usage_type": "attribute" }, { "api_name": "http.client.HTTPMessage", "line_number": 25, "usage_type": "call" }, { "api_name": "io.BytesIO", "line_number": 25, "usage_type": "call" }, { "api_name": "unittest.TestCase",...
22037612
#!/usr/bin/python """ Automation Framework to run tests usage: autopsy.py [-h] --test-bed TEST_BED --log-file LOG_FILE --test-suite TEST_SUITE [--run-tests RUN_TEST[,RUN_TEST,RUN_TEST]] [--skip-tests SKIP_TEST[,SKIP_TEST,SKIP_TEST]] [-d] """ import os import parser...
null
main/autopsy.py
autopsy.py
py
15,134
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.chdir", "line_number": 21, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 21, "usage_type": "call" }, { "api_name": "os.path", "line_number": 21, "usage_type": "attribute" }, { "api_name": "os.path.realpath", "line_nu...
616891261
import utils # fetch data data = utils.line_to_list('input_files/aoc_17.txt') ### START SOLUTION BODY ### def get_neighbors(x, y, z, w): return [(i, j, k, l) for i in range(x - 1, x + 2) for j in range(y - 1, y + 2) for k in range(z - 1, z + 2) for l in range(w - 1, w + 2) if not i == x or not j == y or not k ==...
null
2020/day_17/part_b.py
part_b.py
py
1,872
python
en
code
null
code-starcoder2
76
[ { "api_name": "utils.line_to_list", "line_number": 4, "usage_type": "call" }, { "api_name": "utils.one_val_out", "line_number": 58, "usage_type": "call" } ]
309420754
import sys sys.path.insert(0, "..") from opcua import Client import time from time import sleep from pyo import * import tkinter as tk import threading rootTk = tk.Tk() canvas = tk.Canvas(rootTk, width=400, height=400, borderwidth=0, highlightthickness=0, bg="black") canvas.grid() fileName = 'alerts.log' def _...
null
client-minimal-prueba.py
client-minimal-prueba.py
py
5,581
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.insert", "line_number": 2, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 2, "usage_type": "attribute" }, { "api_name": "tkinter.Tk", "line_number": 16, "usage_type": "call" }, { "api_name": "tkinter.Canvas", "line_num...
291539209
from django.shortcuts import render from myapp.models import Article, Categories def index(request): return render(request, 'index.html') def contact(request): # articles = Article.objects.get(title='Google IA beats Human') # articles = Article.objects.filter(title='Google IA beats Human') # articles = Article...
null
myapp/views.py
views.py
py
1,003
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.shortcuts.render", "line_number": 7, "usage_type": "call" }, { "api_name": "myapp.models.Article.objects.all", "line_number": 14, "usage_type": "call" }, { "api_name": "myapp.models.Article.objects", "line_number": 14, "usage_type": "attribute" }, ...
625785067
from django.shortcuts import render from django.http import HttpResponse from gallery.models import Images, Themes from django.template import loader # Create your views here. def index(request): #latest_images = FileUpload.objects.order_by('-date_added')[:4] images = Images.objects.all() #background = Bac...
null
views.py
views.py
py
706
python
en
code
null
code-starcoder2
76
[ { "api_name": "gallery.models.Images.objects.all", "line_number": 9, "usage_type": "call" }, { "api_name": "gallery.models.Images.objects", "line_number": 9, "usage_type": "attribute" }, { "api_name": "gallery.models.Images", "line_number": 9, "usage_type": "name" }, ...
112993623
import numpy as np import mdutils import os # Load a file not on the path import runpy fetcher = runpy.run_path('../notebook/fetcher.py') fetch_difumo = fetcher['fetch_difumo'] dic = {64: "https://osf.io/pqu9r/download", 128: "https://osf.io/wjvd5/download", 256: "https://osf.io/3vrct/download", ...
null
scripts/create_each_dimension_md.py
create_each_dimension_md.py
py
1,556
python
en
code
null
code-starcoder2
76
[ { "api_name": "runpy.run_path", "line_number": 7, "usage_type": "call" }, { "api_name": "mdutils.MdUtils", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_number...