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
310699147
import os import sys import argparse from math import log2 def get_list(path: str) -> str: return [file for file in os.listdir(path) if os.path.isfile(file)] def get_contents(path: str) -> list: data = [] with open(path, "rb") as file: for i in file.read(): data.append(i) ...
null
enc_det.py
enc_det.py
py
3,970
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.listdir", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path.isfile", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "math.log2", "line_number": 22...
323508780
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights t...
null
src/registerpage.py
registerpage.py
py
3,072
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ.get", "line_number": 24, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 24, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 25, "usage_type": "call" }, { "api_name": "logging.StreamHandle...
641266555
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import pandas as pd import warnings import concurrent.futures class Scraper: """ A class used to represent a Scraper Attributes ---------- home_url : str the string used to access the main page where letters filte...
null
scraper.py
scraper.py
py
13,054
python
en
code
null
code-starcoder2
66
[ { "api_name": "warnings.simplefilter", "line_number": 37, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 90, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 91, "usage_type": "call" }, { "api_name": "requests.get", ...
527392753
''' Usage: find all link of skyon and download Created on 2016年6月28日 @author: Administrator ''' from idlelib.IOBinding import encoding import os import urllib.request from bs4 import BeautifulSoup linkList = []; def get_content(toUrl, count): """Return the content of given url Args: ...
null
WebClawer/src/com/sut/beginner/SpiderSkyon.py
SpiderSkyon.py
py
3,496
python
en
code
null
code-starcoder2
66
[ { "api_name": "urllib.request.request.urlopen", "line_number": 27, "usage_type": "call" }, { "api_name": "urllib.request.request", "line_number": 27, "usage_type": "attribute" }, { "api_name": "urllib.request", "line_number": 27, "usage_type": "name" }, { "api_nam...
642577121
#!/usr/bin/env python from __future__ import division import numpy as np from numpy import sin, cos, pi, linspace import matplotlib.pyplot as plt from matplotlib import animation # First set up the figure, the axis, and the plot element we want to animate l, h = 1.0, 0.4 v = 0.01 fig = plt.figure() ax = plt.axes(xlim=...
null
WavesOnStrings/plucked_string1.py
plucked_string1.py
py
920
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.figure", "line_number": 11, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 11, "usage_type": "name" }, { "api_name": "matplotlib.pyplot.axes", "line_number": 12, "usage_type": "call" }, { "api_name": "mat...
82572941
import torch from typing import Union from pytorch3d.renderer import FoVOrthographicCameras, FoVPerspectiveCameras class Camera: @classmethod def get_cameras(cls, camera_type: str, fov: float, znear: float, zfar: float, ...
null
renderer/utils/camera.py
camera.py
py
1,854
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.Union", "line_number": 13, "usage_type": "name" }, { "api_name": "torch.device", "line_number": 13, "usage_type": "attribute" }, { "api_name": "typing.Union", "line_number": 14, "usage_type": "name" }, { "api_name": "torch.Tensor", "line_...
579389751
#!/usr/bin/python import sys import matplotlib.pyplot as plt import numpy as np x_size = 10 y_size = 10 u = [[0 for x in range(x_size)] for x in range(y_size)] h = [[0 for x in range(x_size)] for x in range(y_size)] for i in range(0, y_size): u[i][0] = 0 h[i][0] = 0 for j in range(0, x_size): u[0][j] = ...
null
Faiman.py
Faiman.py
py
1,024
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.array", "line_number": 31, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.figure", "line_number": 33, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 33, "usage_type": "name" }, { "api_name": "matplotlib.pyp...
152415995
from django.contrib import admin from django.urls import path,include from bsl import views urlpatterns = [ path('login/', views.login), path('logout/', views.logout), path('add_job/', views.add_job), path('run_job/',views.run_job), path('index/',views.index), path('add_host/',views.add_host), ...
null
wshell/bsl/urls.py
urls.py
py
791
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 5, "usage_type": "call" }, { "api_name": "bsl.views.login", "line_number": 5, "usage_type": "attribute" }, { "api_name": "bsl.views", "line_number": 5, "usage_type": "name" }, { "api_name": "django.urls.path", "...
475108386
""" Tests for the configuration loading and dumping capabilities, including Vault mixin """ from unittest.mock import patch, mock_open, call, Mock from json import dumps as jdumps from stat import S_IRUSR, S_IWUSR import pytest from vault_anyconfig.vault_anyconfig import VaultAnyConfig @pytest.fixture def gen_inpu...
null
tests/unit/test_config_loading_and_dumping.py
test_config_loading_and_dumping.py
py
6,880
python
en
code
null
code-starcoder2
66
[ { "api_name": "pytest.fixture", "line_number": 14, "usage_type": "attribute" }, { "api_name": "pytest.fixture", "line_number": 35, "usage_type": "attribute" }, { "api_name": "pytest.fixture", "line_number": 55, "usage_type": "attribute" }, { "api_name": "unittest....
247124498
#!/usr/bin/env python """Check if the time for starting is over.""" __all__ = [ "is_start_time_now", "nearest_start_time", ] from datetime import datetime, timedelta _LATEST = datetime.now().replace(hour=20, minute=0, second=0) _EARLIEST = datetime.now().replace(hour=0, minute=0, second=0) _EARLIEST_LIMIT...
null
development/starting_time.py
starting_time.py
py
1,519
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.now", "line_number": 14, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 14, "usage_type": "name" }, { "api_name": "datetime.datetime.now", "line_number": 15, "usage_type": "call" }, { "api_name": "datetim...
33743582
from os import environ import boto3 from botocore.exceptions import ClientError, NoCredentialsError class S3client: def __init__(self): self.client = boto3.client( 's3', aws_access_key_id=environ.get('AWS_ACCESS_KEY'), aws_secret_access_key=environ.get('AWS_ACCESS_SECRET'), ...
null
lib/aws/client.py
client.py
py
2,649
python
en
code
null
code-starcoder2
66
[ { "api_name": "boto3.client", "line_number": 8, "usage_type": "call" }, { "api_name": "os.environ.get", "line_number": 9, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 9, "usage_type": "name" }, { "api_name": "os.environ.get", "line_number...
456667229
import hashlib from helpers import int_to_little_endian, parse_varint, serialize_as_varint, little_endian_to_int, epoch_to_datetime import io from html_formatter import HTMLBytesFormatter class Block: def __init__(self, version, previous_block_hash, merkle_root, timestamp, difficulty, nonce): self...
null
block.py
block.py
py
3,834
python
en
code
null
code-starcoder2
66
[ { "api_name": "io.BytesIO", "line_number": 21, "usage_type": "call" }, { "api_name": "io.BufferedReader", "line_number": 23, "usage_type": "attribute" }, { "api_name": "helpers.little_endian_to_int", "line_number": 29, "usage_type": "call" }, { "api_name": "helper...
375697411
#!/usr/bin/python3 import sys import os from matplotlib import pyplot as plt import numpy as np import pandas as pd import cv2 as cv from sklearn.cluster import MiniBatchKMeans from skimage.feature import greycomatrix """ params: data path - contains ManipulatedFrames, ManipulatedMasks, and OriginalFrames p...
null
steg_svm/image_proc.py
image_proc.py
py
8,406
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.CV_32F", "line_number": 28, "usage_type": "attribute" }, { "api_name": "numpy.pi", "line_number": 33, "usage_type": "attribute" }, { "api_name": "cv2.Laplacian", "line_number": 44, "usage_type": "call" }, { "api_name": "cv2.Sobel", "line_num...
439834881
import numpy as np import pandas as pd import uuid """Step1: read excel data ==================================================================""" Con_slab={'element ID':str,'Delivery ID':str,'PO ID':str,'WBS code':str,'Family':str,'Type':str,'Family and Type':str, 'Volume':str,'Area':str,'Perimeter':str,'Bauab...
null
data_interaction_Ver1.py
data_interaction_Ver1.py
py
19,737
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_excel", "line_number": 19, "usage_type": "call" }, { "api_name": "pandas.to_datetime", "line_number": 28, "usage_type": "attribute" }, { "api_name": "pandas.read_excel", "line_number": 29, "usage_type": "call" }, { "api_name": "pandas.Se...
27369740
import boto3 import json import logging import traceback import random import string import datetime from .models import Server, Permission, Backup from .serializers import ServerSerializer, BackupSerializer from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin from django.core.exc...
null
smitty/apps/console/views.py
views.py
py
15,550
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 26, "usage_type": "call" }, { "api_name": "django.contrib.auth.mixins.LoginRequiredMixin", "line_number": 29, "usage_type": "name" }, { "api_name": "django.views.generic.TemplateView", "line_number": 29, "usage_type": "nam...
72383267
from parse import parse from util import step_has_prerequisite, distinct file = open("input.txt", "r") lines = file.readlines() # parse file instructions = [] for line in lines: parsed = parse("Step {step} must be finished before step {next} can begin.", line) instructions.append((parsed['step'], parsed['next'])...
null
2018/07/part1.py
part1.py
py
986
python
en
code
null
code-starcoder2
66
[ { "api_name": "parse.parse", "line_number": 11, "usage_type": "call" }, { "api_name": "util.step_has_prerequisite", "line_number": 18, "usage_type": "call" } ]
378255721
import os import sys import json import asttostr from pprint import pprint from asttocfg import CFG import graphviz from graphviz import Digraph def faintvariable_analysis(cfg): pass def remove_faint_variables(cfg, faint_variables): pass def render_graph(cfg, outfile): """ function to render th...
null
faintvariable/source/livevariable.py
livevariable.py
py
5,548
python
en
code
null
code-starcoder2
66
[ { "api_name": "graphviz.ExecutableNotFound", "line_number": 23, "usage_type": "attribute" }, { "api_name": "pprint.pprint", "line_number": 148, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 186, "usage_type": "attribute" }, { "api_name": "sys.ar...
428803788
from sklearn.feature_extraction.text import TfidfVectorizer as TFIDF from dataProcess import remove_pun_and_stopWords import pandas as pd from sklearn.naive_bayes import MultinomialNB as MNB from sklearn.model_selection import cross_val_score from sklearn.metrics import accuracy_score,f1_score,roc_auc_score import nu...
null
数据清洗与训练/train_tfidf.py
train_tfidf.py
py
2,274
python
en
code
null
code-starcoder2
66
[ { "api_name": "sklearn.naive_bayes.MultinomialNB", "line_number": 11, "usage_type": "call" }, { "api_name": "sklearn.naive_bayes.MultinomialNB", "line_number": 13, "usage_type": "call" }, { "api_name": "numpy.mean", "line_number": 15, "usage_type": "call" }, { "ap...
345280265
import os from io import open from setuptools import setup, find_packages # Load package info, without importing the package basedir = os.path.dirname(os.path.abspath(__file__)) package_info_path = os.path.join(basedir, "hybrid", "package_info.py") package_info = {} try: with open(package_info_path, encoding='utf...
null
setup.py
setup.py
py
1,912
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path.join", "line_nu...
95272458
import logging import re from streamlink.compat import urlparse from streamlink.plugin import Plugin from streamlink.plugin.api.utils import itertags from streamlink.stream import HLSStream log = logging.getLogger(__name__) class CbcSportTv(Plugin): """ Support for Azer live channel stream on cbcsport.tv/liv...
null
cbcsport_tv.py
cbcsport_tv.py
py
1,274
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "streamlink.plugin.Plugin", "line_number": 11, "usage_type": "name" }, { "api_name": "re.compile", "line_number": 15, "usage_type": "call" }, { "api_name": "streamlink.plugi...
267343581
""" Label connected regions and return the corresponding areas. Author: Chao Huang (chaohuang.stat@gmail.com) Last update: 2017-10-14 """ import numpy as np from skimage.measure import regionprops """ installed all the libraries above """ def label_region(img_size, img_idx, l_stat, c_alpha): """ Label ...
null
stat_label_region.py
stat_label_region.py
py
1,463
python
en
code
null
code-starcoder2
66
[ { "api_name": "skimage.measure.regionprops", "line_number": 35, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 36, "usage_type": "call" }, { "api_name": "numpy.max", "line_number": 39, "usage_type": "call" }, { "api_name": "numpy.zeros", "...
527424444
import datetime from .game import Game class Player(): def __init__(self, player_username, player_id, room_sid=None, **player_config): self.game = Game() self.username = player_username self.id = player_id self.room_sid = room_sid self.opponent = None self.current_...
null
app/game/game_models/player.py
player.py
py
1,981
python
en
code
null
code-starcoder2
66
[ { "api_name": "game.Game", "line_number": 8, "usage_type": "call" }, { "api_name": "datetime.datetime.utcnow", "line_number": 21, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 21, "usage_type": "attribute" }, { "api_name": "datetime.tim...
314787291
import cherrypy, json, os, time, mymqtt def register(new_device): new_device["insert-timestamp"] = time.time() with open(f"{os.getcwd()}/res/json_db.json") as f: data = json.loads(f.read()) for device in data["devices"]: if new_device["deviceID"] in device["deviceID"]: return 40...
null
Software/Lab4/catalog.py
catalog.py
py
5,362
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.time", "line_number": 4, "usage_type": "call" }, { "api_name": "os.getcwd", "line_number": 5, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 6, "usage_type": "call" }, { "api_name": "os.getcwd", "line_number": 12, "u...
366347600
from tkinter import * import random import qrcode from PIL import ImageTk, Image from datetime import * from klant_in_klantenbestand_goed import invoer_gegevens_aanbieder def ticketFilmNaam(info, i, naam1, mail1): naam = info[i][1] tijd = str(datetime.fromtimestamp(int(info[i][5])))[11:16] dag = ...
null
Bezoeker_Ticket.py
Bezoeker_Ticket.py
py
2,626
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.fromtimestamp", "line_number": 10, "usage_type": "call" }, { "api_name": "datetime.fromtimestamp", "line_number": 11, "usage_type": "call" }, { "api_name": "random.randrange", "line_number": 15, "usage_type": "call" }, { "api_name": "random...
128345267
from typing import Collection from copy import copy import simulacra as si import simulacra.units as u import numpy as np earth_surface_acceleration = 9.81 * u.m / (u.s ** 2) earth_mass = 5.972e24 * u.kg class GravitationalField: """An abstract class that represents a gravitational field.""" def get_accele...
null
apples.py
apples.py
py
6,015
python
en
code
null
code-starcoder2
66
[ { "api_name": "simulacra.units.m", "line_number": 8, "usage_type": "attribute" }, { "api_name": "simulacra.units", "line_number": 8, "usage_type": "name" }, { "api_name": "simulacra.units.s", "line_number": 8, "usage_type": "attribute" }, { "api_name": "simulacra....
358023661
# Includes import os import numpy as np import bifurcations_toolbox_roads as tb import torch from torch.autograd import Variable import Nets as nt import scipy.misc from PIL import Image from photutils import find_peaks from astropy.stats import sigma_clipped_stats import json # Setting of parameters model_dir = './...
null
roads/patch/test_road_patches.py
test_road_patches.py
py
3,485
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ", "line_number": 36, "usage_type": "attribute" }, { "api_name": "bifurcations_toolbox_roads.construct_name", "line_number": 37, "usage_type": "call" }, { "api_name": "Nets.Net_SHG", "line_number": 40, "usage_type": "call" }, { "api_name":...
28210635
import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPooling2D from keras import backend as K import pandas as pd import matplotlib.pyplot as plt batch_size = 64 num_classes = 10 epochs = 12 img_rows, img_cols = 28, 28 train = pd.read_c...
null
cnn.py
cnn.py
py
1,978
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 15, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 17, "usage_type": "call" }, { "api_name": "keras.backend.image_data_format", "line_number": 21, "usage_type": "call" }, { "api_name": "keras...
206836660
# Demonstrates how to send json messages with the request body. json = { 'string': 'string data', 'bool': 'no', 'int': 1.5, 'direction': 'n' } domain = 'http://localhost:8000' path = f'{domain}/pydantic' def send_request(path, post=False, **kwargs): import requests if post: try: ...
null
fastapi/02_post_json_test.py
02_post_json_test.py
py
919
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.post", "line_number": 17, "usage_type": "call" }, { "api_name": "requests.exceptions", "line_number": 18, "usage_type": "attribute" }, { "api_name": "requests.get", "line_number": 23, "usage_type": "call" }, { "api_name": "requests.exceptio...
493394179
from Coordonnees import Coordonnees from Balle import Balle from Barre import Barre from Joueur import Joueur from Menu import Menu from Enum import Direction from Enum import Cote from Enum import Bouton from Enum import Statut import math import random import sys, pygame, time, numpy from pygame.locals import * # ...
null
code/Simulateur.py
Simulateur.py
py
6,859
python
en
code
null
code-starcoder2
66
[ { "api_name": "Enum.Statut.JEU_EN_COURS", "line_number": 56, "usage_type": "attribute" }, { "api_name": "Enum.Statut", "line_number": 56, "usage_type": "name" }, { "api_name": "Enum.Statut.PAUSE", "line_number": 69, "usage_type": "attribute" }, { "api_name": "Enum...
176872297
# coding:utf-8 from BaiTaAirport2_month.TestData.PictureBase64One import Base64Picture from locust import HttpLocust,TaskSequence,task from BaiTaAirport2_month.API.AirportProcess import * from BaiTaAirport2_month.common.Log import MyLog name = os.path.realpath(__file__).split("\\")[-1].split(".")[0] log = MyLog(name=na...
null
BaiTaAirport2_month/LoadTest/api_security_ticket_check_B.py
api_security_ticket_check_B.py
py
3,056
python
en
code
null
code-starcoder2
66
[ { "api_name": "BaiTaAirport2_month.common.Log.MyLog", "line_number": 7, "usage_type": "call" }, { "api_name": "locust.TaskSequence", "line_number": 14, "usage_type": "name" }, { "api_name": "BaiTaAirport2_month.TestData.PictureBase64One.Base64Picture", "line_number": 36, ...
379853676
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from crhelper import CfnResource import boto3 import logging import json import copy logger = logging.getLogger(__name__) # Initialise the helper, all inputs are optional, this example shows the defaults he...
null
source/cfn-add-edge-lambda/cfn-add-edge-lambda.py
cfn-add-edge-lambda.py
py
5,752
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 10, "usage_type": "call" }, { "api_name": "crhelper.CfnResource", "line_number": 12, "usage_type": "call" }, { "api_name": "boto3.client", "line_number": 22, "usage_type": "call" }, { "api_name": "json.dumps", ...
98526771
from bs4 import BeautifulSoup def get_url_walmart(search_term): """ :param search_term: :return: """ template = "https://www.walmart.com/search?q={}" search_term = search_term.replace(" ", "+") url = template.format(search_term) print(f"Constructed Walmart URL: \n >>{url}<<") retu...
null
code/web/scraper/scrap/walmart.py
walmart.py
py
1,892
python
en
code
null
code-starcoder2
66
[ { "api_name": "bs4.BeautifulSoup", "line_number": 26, "usage_type": "call" } ]
381766515
''' Created on Sep 10, 2015 @author: David Zwicker <dzwicker@seas.harvard.edu> ''' from __future__ import division import logging import numpy as np from utils.math.distributions import lognorm_mean, DeterministicDistribution __all__ = ['LibraryLogNormal'] class LibraryLogNormal(object): """ represents a s...
null
sensing/binary_response/library_theory.py
library_theory.py
py
5,120
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.sqrt", "line_number": 38, "usage_type": "call" }, { "api_name": "numpy.log", "line_number": 38, "usage_type": "call" }, { "api_name": "numpy.sqrt", "line_number": 44, "usage_type": "call" }, { "api_name": "numpy.log", "line_number": 44, ...
384151569
#!/usr/bin/env python3 # see https://github.com/NikolaiT/GoogleScraper for API details # TODO make cache optional # FIXME external config file option in config.py # TODO support search multiple keywords import argparse import os, sys, re sys.path.append('GoogleScraper') from GoogleScraper import scrape_with_config, G...
null
run_image_search.py
run_image_search.py
py
9,210
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 10, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser", "line_number": 21, "usage_type": "call" }, { "api_name": "threading.Threa...
371654795
import json import os.path as path from scipy import stats debug=True CHANNELS_KEY = "Channels" DATA_KEY = "Data" REFERENCE_CHART_KEY = "reference" TEST_CHART_KEY = "test" def ping(): """ Method to validate that this script has been imported and is accessible """ print("file {0} is here!".format(__nam...
null
dtk/tools/serialization/ks_channel_testing.py
ks_channel_testing.py
py
3,531
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 25, "usage_type": "call" }, { "api_name": "os.path", "line_number": 25, "usage_type": "name" }, { "api_name": "json.load", "line_number": 28, "usage_type": "call" }, { "api_name": "json.load", "line_number": 30, ...
227760850
#!/usr/bin/env python3 from fastapi import FastAPI, Response, Request, Header from pydantic import BaseModel app = FastAPI() TOKEN = "secret" # --------------------------------------------------------------------------- # - Token auth method - # ------------------------------------------------------------------------...
null
sandbox/vim/templates/fastapi_template.py
fastapi_template.py
py
2,151
python
en
code
null
code-starcoder2
66
[ { "api_name": "fastapi.FastAPI", "line_number": 5, "usage_type": "call" }, { "api_name": "fastapi.Request", "line_number": 21, "usage_type": "name" }, { "api_name": "fastapi.Response", "line_number": 21, "usage_type": "name" }, { "api_name": "pydantic.BaseModel", ...
140831095
#!/usr/bin/env python #import numpy as np #import pandas as pd #from sqlalchemy import create_engine #from snowflake.sqlalchemy import URL import snowflake.connector import os, sys import json import csv rolesDict = {} dbSchema = {} with open('elems_last.json') as json_file: data = json.load(json_file) #ro...
null
RBAC_VisualCrt/Project2/getting-started/py/csv2db-vz.py
csv2db-vz.py
py
7,973
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 16, "usage_type": "call" }, { "api_name": "snowflake.connector.connector.connect", "line_number": 92, "usage_type": "call" }, { "api_name": "snowflake.connector.connector", "line_number": 92, "usage_type": "attribute" }, { ...
316711608
import sys import wx import os from hashlib import sha1 from time import strftime, localtime, time from traceback import format_exc from urllib import quote, unquote from BitTornado.bencode import bencode, bdecode from BitTornado.magnet import MAGNET_PREFIX, HashToMagnet, getHash, getArgument from files ...
null
LMG/Torrent/torrent.py
torrent.py
py
29,804
python
en
code
null
code-starcoder2
66
[ { "api_name": "BitTornado.magnet.getArgument", "line_number": 39, "usage_type": "call" }, { "api_name": "LMG.Utility.helpers.forceunicode", "line_number": 41, "usage_type": "call" }, { "api_name": "urllib.unquote", "line_number": 41, "usage_type": "call" }, { "api...
102888845
#!usr/bin/python3 #File: baseline.py #Author: Thijs Horstman #Date: 01-06-2017 #Description: Naive Bayes baseline for prediction MBTI dimensions for Twitter users. #--------------------------- #Imports #--------------------------- #scikit imports import numpy as np import argparse from sklearn.naive_bayes import Mult...
null
baseline.py
baseline.py
py
7,874
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 43, "usage_type": "call" }, { "api_name": "nltk.tokenize.TweetTokenizer", "line_number": 66, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 69, "usage_type": "call" }, { "api_name": "os.pat...
326303817
import sqlalchemy as db from sqlalchemy.orm.session import sessionmaker import json class BaseDao: def __init__(self, table): self.table = table engine = db.create_engine("mysql+mysqlconnector://topskills01:ts2019@mysql.topskills.dev:3306/topskills01") session_mk = sessionmaker() ses...
null
Aula55Desafio/dao/base_dao.py
base_dao.py
py
1,157
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.create_engine", "line_number": 7, "usage_type": "call" }, { "api_name": "sqlalchemy.orm.session.sessionmaker", "line_number": 8, "usage_type": "call" } ]
518163642
import csv # built in import datetime as dt # built in import feather import math # built in import matplotlib.pyplot as plt import numpy as np import os # built in import pandas as pd import random # built in import sklearn as sk from sklearn import metrics # import accuracy-score classification_report, confusion_m...
null
bin/01-jk-credit-card-data-dtree.py
01-jk-credit-card-data-dtree.py
py
7,861
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 18, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 28, "usage_type": "call" }, { "api_name": "sklearn.tree.DecisionTreeClassifier", "line_number": 30, "usage_type": "call" ...
390629475
# -*- coding: utf-8 -*- """ Created on Thu Mar 15 12:41:29 2018 @author: Rohit """ from __future__ import print_function from __future__ import division import os import math from nltk.corpus import stopwords from nltk.tokenize import RegexpTokenizer from nltk.stem import PorterStemmer import matplotlib...
null
assignment-3/bonus.py
bonus.py
py
13,005
python
en
code
null
code-starcoder2
66
[ { "api_name": "math.log10", "line_number": 49, "usage_type": "call" }, { "api_name": "os.walk", "line_number": 81, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 82, "usage_type": "call" }, { "api_name": "random.shuffle", "line_number": 85,...
605124336
from django.conf.urls import url from .views import * urlpatterns = [ url(r'^$', foodfinder, name='foodfinder'), url(r'^search$', foodsearch, name='foodsearch'), url(r'^recipedisplay$', recipedisplay, name='recipedisplay'), url(r'^testingdummy', testingdummy, name="testdummy") #write URLS to grab extra data be...
null
feedzonefinder_project/feedzone_app/urls.py
urls.py
py
394
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 7, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 9, "usage_type": "call" }, { "api_name": "django.co...
105951944
import os import json import requests if not os.path.isdir('data_source/data_from_creeper'): os.makedirs('data_source/data_from_creeper') if not os.path.isdir('data_source/data_from_creeper/腾讯新闻疫苗数据'): os.makedirs('data_source/data_from_creeper/腾讯新闻疫苗数据') def China_vaccines_daily_trend_func(): url = '...
null
data_source/腾讯新闻疫苗数据.py
腾讯新闻疫苗数据.py
py
6,542
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.isdir", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.makedirs", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path.isdir", "line_number"...
369721292
import os import numpy as np from config import conf from lib.utility import utils from lib.model.dlnn_karal import Dlnn as dlnn def main(): meta = utils.pickle_load(conf.METADATA_FILE) label_and_data = utils.pickle_load(conf.DATA_FILE) np.random.shuffle(label_and_data) length = len(label_and_data) ...
null
ML/Categolization/News/Play/lib/trainer/trainer2.py
trainer2.py
py
1,287
python
en
code
null
code-starcoder2
66
[ { "api_name": "lib.utility.utils.pickle_load", "line_number": 10, "usage_type": "call" }, { "api_name": "lib.utility.utils", "line_number": 10, "usage_type": "name" }, { "api_name": "config.conf.METADATA_FILE", "line_number": 10, "usage_type": "attribute" }, { "ap...
100198860
import re from bs4 import BeautifulSoup from error import BookingServiceError from model.booking import Booking from model.event import Event from service import raven_service BOOKING_SERVICE_URL = 'https://www.mealbookings.cai.cam.ac.uk/index.php' _AVAILABLE_EVENTS_CACHE = None _ATTENDEE_NAME_CACHE = {} _MENU_TEXT_C...
null
service/booking_service.py
booking_service.py
py
7,127
python
en
code
null
code-starcoder2
66
[ { "api_name": "service.raven_service.get_default_authenticated_browser", "line_number": 24, "usage_type": "call" }, { "api_name": "service.raven_service", "line_number": 24, "usage_type": "name" }, { "api_name": "bs4.BeautifulSoup", "line_number": 26, "usage_type": "call"...
110726260
''' GAN: 基于分钟股价数据的生成模型,数据特征是1个交易日内分钟股价数据、成交量数据, 数据标签是交易日开收盘价和最高最低价以及成交量,也就是1日的特征累加和。 基于消息向量的生成模型,特征分成两个部分: 一是休市阶段,对应于下一个交易日开始的n分钟股价 二是开市阶段,对应于与其接近的一段时间的股价分钟数据。 股价一个时间点的数据不太具备参考性,将n分钟时间段的股价数据作为标签。 相当于标签是一个多维的时间序列,比如将涨跌1%以内的都划分成1个区间,涨跌2%以内的超过1%的划分为1个区间 分钟数据剧烈波动的可能性比较小,所以考虑采用对数函数划分区间。 划分区间做标签可以减少标签空间的大小,便于模型学习。 ...
null
bin/gan/models_GAN.py
models_GAN.py
py
6,621
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 27, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 27, "usage_type": "attribute" }, { "api_name": "os.path.exists", "line_number": 46, "usage_type": "call" }, { "api_name": "os.path", "line_numb...
50618567
# -*- coding:utf-8 -*- # Name: bit_num # Product_name: PyCharm # Description: # Author : 'zhangjiawen' # Data : 2019-12-24 9:27 from functools import reduce from .base_bit_num import BaseBitNum, NUM class BitNum(object): def __init__(self, val, bit=NUM): self._val = val self._bit = bit.num_bit ...
null
crypt/bit_num.py
bit_num.py
py
1,175
python
en
code
null
code-starcoder2
66
[ { "api_name": "base_bit_num.NUM", "line_number": 15, "usage_type": "name" }, { "api_name": "base_bit_num.BaseBitNum", "line_number": 20, "usage_type": "name" }, { "api_name": "base_bit_num.NUM.num_bit", "line_number": 31, "usage_type": "attribute" }, { "api_name":...
527271106
import pymongo MONGO_URL = "192.168.0.8" MONGO_PORT = 27017 MONGO_DB = "itjuzi" MONGO_COLLECTION = "company_list_test" MONGO_COLLECTION2 = "merger_list" MONGO_COLLECTION3 = "financing_list" MONGO_USER = "indexvc" MONGO_PSW = "indexvc01" client = pymongo.MongoClient(MONGO_URL) # client.admin.authenticate(MONGO_USER, ...
null
new_itjuzi/config.py
config.py
py
353
python
en
code
null
code-starcoder2
66
[ { "api_name": "pymongo.MongoClient", "line_number": 13, "usage_type": "call" } ]
218886378
from WEB_Flask_sqlalchemy.Task_1.data import db_session from WEB_Flask_sqlalchemy.Task_1.data.jobs import Jobs from flask import Flask from flask import render_template app = Flask(__name__) app.config['SECRET_KEY'] = 'yandexlyceum_secret_key' listUser = [] @app.route("/") def Program(): return render_templat...
null
Task_1/Work log.py
Work log.py
py
993
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 6, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 14, "usage_type": "call" }, { "api_name": "WEB_Flask_sqlalchemy.Task_1.data.db_session.global_init", "line_number": 18, "usage_type": "call" }, ...
634248425
""" CEASIOMpy: Conceptual Aircraft Design Software Developed by CFS ENGINEERING, 1015 Lausanne, Switzerland This programm stors all function needed for stability analysis (dynamic and static) Python version: >=3.6 | Author: Loic Verdier | Creation: 2020-02-24 | Last modifiction: 2020-03-25 (AJ) TODO: * ... "...
null
ceasiompy/StabilityStatic/func_static.py
func_static.py
py
17,149
python
en
code
null
code-starcoder2
66
[ { "api_name": "ceasiompy.utils.ceasiomlogger.get_logger", "line_number": 37, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 39, "usage_type": "call" }, { "api_name": "os.path", "line_number": 39, "usage_type": "attribute" }, { "api_name": ...
114030915
import sys from setuptools import setup, find_packages if not '2.5' <= sys.version: raise ImportError('Python version not supported') tests_require = [] with open("LICENSE", 'r') as f: LICENSE = f.read() setup( name="Inflector", version="2.0.7", description="A port of ROR's inflector class", ...
null
setup.py
setup.py
py
851
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.version", "line_number": 5, "usage_type": "attribute" }, { "api_name": "setuptools.setup", "line_number": 13, "usage_type": "call" } ]
17063990
from django.conf import settings from django.conf.urls import url from . import views from . import feed doc_urlpatterns = [ url(r"^$", views.view_document, name="view-document"), ] urlpatterns = [ url(r"^list$", views.list_proposals, name="list-proposals"), url(r"^closed$", views.closed_proposals), ...
null
server/proposal/urls.py
urls.py
py
852
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 12, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 13, "usage_type": "call" }, { "api_name": "django....
119153805
import torchvision from torchvision.models.detection.backbone_utils import resnet_fpn_backbone from torchvision.models.detection.faster_rcnn import FasterRCNN, FastRCNNPredictor def fasterrcnn_resnet_fpn(num_classes, backbone_name='resnet18', pretrained_backbone=True, progress=True, **kwargs...
null
src/models.py
models.py
py
857
python
en
code
null
code-starcoder2
66
[ { "api_name": "torchvision.models.detection.fasterrcnn_resnet50_fpn", "line_number": 8, "usage_type": "call" }, { "api_name": "torchvision.models", "line_number": 8, "usage_type": "attribute" }, { "api_name": "torchvision.models.detection.faster_rcnn.FastRCNNPredictor", "line...
264734314
import torchvision.transforms as transforms from torch.utils.data import DataLoader from detectron2.config import get_cfg from detectron2.utils.visualizer import Visualizer from detectron2.data import MetadataCatalog, DatasetCatalog import detectron2 import os, json, cv2, random import matplotlib.pyplot as plt from tqd...
null
week4/Code/model_training.py
model_training.py
py
11,736
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.__version__", "line_number": 13, "usage_type": "attribute" }, { "api_name": "torch.cuda.is_available", "line_number": 13, "usage_type": "call" }, { "api_name": "torch.cuda", "line_number": 13, "usage_type": "attribute" }, { "api_name": "detect...
314635486
from summit.strategies.base import Transform from summit.experiment import Experiment from summit.domain import * from summit.utils.dataset import DataSet import numpy as np from scipy.integrate import solve_ivp class MIT_case1(Experiment): """Benchmark representing a simulated kinetic reaction network and accomp...
null
summit/benchmarks/MIT/MIT_kin_case1.py
MIT_kin_case1.py
py
5,223
python
en
code
null
code-starcoder2
66
[ { "api_name": "summit.experiment.Experiment", "line_number": 9, "usage_type": "name" }, { "api_name": "numpy.random.default_rng", "line_number": 47, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 47, "usage_type": "attribute" }, { "api_name":...
53642753
"""lonelyplanet URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
null
backend/app/urls.py
urls.py
py
2,823
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 27, "usage_type": "call" }, { "api_name": "django.contrib.admin.site", "line_number": 27, "usage_type": "attribute" }, { "api_name": "django.contrib.admin", "line_number": 27, "usage_type": "name" }, { "api_name...
416975000
from typing import List, Set, Dict, Tuple, Optional import utils.aq_exposures as aq_exps class PathAqiAttrs: """Holds and manipulates all AQI related path attributes. """ def __init__(self, path_type: str, aqi_exp_list: List[Tuple[float, float]]): self.path_type: str = path_type self.aqi_e...
null
src/app/path_aqi_attrs.py
path_aqi_attrs.py
py
1,970
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.List", "line_number": 8, "usage_type": "name" }, { "api_name": "typing.Tuple", "line_number": 8, "usage_type": "name" }, { "api_name": "typing.Dict", "line_number": 14, "usage_type": "name" }, { "api_name": "utils.aq_exposures.get_mean_aqi", ...
233934032
from Model import PCA import numpy as np import DataProcessing as dp import matplotlib.pyplot as plt def test(X, Y, k, r=10, weighted=False): result = np.empty(r) for i in range(r): X_train, Y_train, X_test, Y_test = dp.split(X,Y,p=0.20) pca = PCA(X_train,Y_train) pca.fit() pr...
null
Src/Main.py
Main.py
py
1,346
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.empty", "line_number": 9, "usage_type": "call" }, { "api_name": "DataProcessing.split", "line_number": 11, "usage_type": "call" }, { "api_name": "Model.PCA", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", ...
369405247
# from torchnlp.datasets import penn_treebank_dataset from utils.preprocessing import ( load_params, clean_str, CharsVocabulary, WordsVocabulary, ) from utils.dataloader import DataLoader from models.model import CharCNNLSTM import argparse import os import torch import torch.nn as nn import torch.optim...
null
test.py
test.py
py
3,774
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 20, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 53, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 57, "usage_type": "call" }, { "api_name": "os.path", "line_n...
553534713
import numpy as np import pickle from galpy import potential from galpy.df import dehnendf, evolveddiskdf from scipy.optimize import minimize from astropy import units as u import warnings warnings.filterwarnings('ignore') def pickle_data(filename, data): output = open(filename, 'wb') pickle.dump(data, output)...
null
warm_spiral.py
warm_spiral.py
py
2,350
python
en
code
null
code-starcoder2
66
[ { "api_name": "warnings.filterwarnings", "line_number": 8, "usage_type": "call" }, { "api_name": "pickle.dump", "line_number": 12, "usage_type": "call" }, { "api_name": "astropy.units.Gyr", "line_number": 15, "usage_type": "attribute" }, { "api_name": "astropy.uni...
630512388
import numpy as np import networkx as nx from math import pi from scipy.optimize import basinhopping from scipy.optimize import minimize import sys sys.path.insert(0, '../common/') import os import matplotlib.pyplot as plt import common import pickle import random import time import datetime def find_best(monte, p, nu...
null
monte-best-found/post_best.py
post_best.py
py
1,913
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.insert", "line_number": 7, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "numpy.max", "line_number": 20, "usage_type": "call" }, { "api_name": "pickle.load", "line_number"...
642049663
import random import string from flask import Flask, render_template, redirect, request, url_for from flaskext.mysql import MySQL mysql = MySQL() app = Flask(__name__) app.config['MYSQL_DATABASE_USER'] = 'root' app.config['MYSQL_DATABASE_PASSWORD'] = '1ga12cs060' app.config['MYSQL_DATABASE_DB'] = 'flaskdemo...
null
print_toprankers_eachdivision/app.py
app.py
py
1,876
python
en
code
null
code-starcoder2
66
[ { "api_name": "flaskext.mysql.MySQL", "line_number": 7, "usage_type": "call" }, { "api_name": "flask.Flask", "line_number": 8, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 22, "usage_type": "call" }, { "api_name": "flask.render_tem...
369838462
# -*- coding: utf-8 -*- import cPickle as pickle from BeautifulSoup import BeautifulSoup import os import lxml.html as HTML import random import time f_gsid_st = open("/home/sf/shouji/gsid_st.txt","r") gsid = pickle.load(f_gsid_st) f_gsid_st.close() f_uiddata = open('/home/sf/shouji/uiddata.txt','r') uiddata = pick...
null
xx.py
xx.py
py
5,321
python
en
code
null
code-starcoder2
66
[ { "api_name": "cPickle.load", "line_number": 12, "usage_type": "call" }, { "api_name": "cPickle.load", "line_number": 16, "usage_type": "call" }, { "api_name": "lxml.html.fromstring", "line_number": 39, "usage_type": "call" }, { "api_name": "lxml.html", "line_...
638346238
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Test for viewdatabase and related functions Created on Thu Mar 19 13:35:28 2020 @author: kallstadt """ import os import shutil import numpy as np import tempfile # third party from impactutils.io.cmd import get_command_output # where is this script? homedir = os.p...
null
tests/viewdb_test.py
viewdb_test.py
py
3,039
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 20, "usage_type": "call" }, { "api_name": "os.path", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 20, "usage_type": "call" }, { "api_name": "os.path.join", "line...
646330614
# skl2.py # Logistic Regression using SCIKIT Learn ''' Using vectorizer: https://machinelearningmastery.com/prepare-text-data-machine-learning-scikit-learn/ ''' from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.feature_extraction.text import CountVec...
null
TextMining/test/sklLR.py
sklLR.py
py
4,043
python
en
code
null
code-starcoder2
66
[ { "api_name": "sklearn.feature_extraction.text.CountVectorizer", "line_number": 41, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 60, "usage_type": "call" }, { "api_name": "sklearn.linear_model.LogisticRegression", "line_numb...
147983977
# -*- coding: UTF-8 -*- """ base class and functions to handle with hmp file and GWAS results """ import re import sys import numpy as np import pandas as pd import os.path as op from tqdm import tqdm from pathlib import Path from subprocess import call from collections import Counter from schnablelab.apps.base import...
null
autoGWAS/base.py
base.py
py
23,533
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.abspath", "line_number": 17, "usage_type": "call" }, { "api_name": "os.path", "line_number": 17, "usage_type": "name" }, { "api_name": "os.path.dirname", "line_number": 17, "usage_type": "call" }, { "api_name": "os.path.abspath", "line_n...
56645408
import os import json from functools import partial # TEMPORARY SOLUTION import warnings warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.ufunc size changed") import numpy as np from sklearn.externals import joblib import librosa import torch fro...
null
musmtl/tool.py
tool.py
py
6,923
python
en
code
null
code-starcoder2
66
[ { "api_name": "warnings.filterwarnings", "line_number": 8, "usage_type": "call" }, { "api_name": "warnings.filterwarnings", "line_number": 9, "usage_type": "call" }, { "api_name": "tqdm.tqdm", "line_number": 25, "usage_type": "call" }, { "api_name": "os.path.split...
191434584
import numpy as np from utils.Utils import * from preferentialnet.PNetwork import * import sklearn.preprocessing as prep import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from dataprovider.cifar import * from models.MultilayerCNN import * import pickle cifarData = CifarData...
null
experiment_cnn.py
experiment_cnn.py
py
6,809
python
en
code
null
code-starcoder2
66
[ { "api_name": "sklearn.preprocessing.StandardScaler", "line_number": 16, "usage_type": "call" }, { "api_name": "sklearn.preprocessing", "line_number": 16, "usage_type": "name" }, { "api_name": "numpy.random.randint", "line_number": 26, "usage_type": "call" }, { "a...
111486981
import numpy as np import matplotlib.pyplot as plt def plot_data1d(data1d_fname, ax=None, xlim=None, linestyle='-', marker=None, title=None, axis_fontsize=20, tick_labelsize=16): # read in the data file data = np.genfromtxt(data1d_fname) # plot the data if ax is None: ax = plt.gca() ...
null
component_learning/bandwidth_selection/kde_visual_utils.py
kde_visual_utils.py
py
3,034
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.genfromtxt", "line_number": 8, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.gca", "line_number": 11, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 11, "usage_type": "name" }, { "api_name": "numpy.genfrom...
565916727
import glob from datetime import datetime first_part = "tmp/users/results/" second_part = "_real.txt" starting_index = len(first_part) ending_index = len(second_part) def get_name_and_type(oname): name = oname[:] if name.endswith("_AR"): log_type = "AR" name = name[:-3] elif name.endswith("_player"): log_...
null
StudentAnalysis/results_to_csv.py
results_to_csv.py
py
1,609
python
en
code
null
code-starcoder2
66
[ { "api_name": "glob.glob", "line_number": 31, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 48, "usage_type": "call" }, { "api_name": "datetime.datetime.strptime", "line_number": 60, "usage_type": "call" }, { "api_name": "datetime.datetime", ...
492351394
""" This is for pytest to find and stop being upset not finding any tests. >>> 'Happy?'[:-1] 'Happy' """ # pylint: disable=C0111,W0621 import os import pytest # type: ignore from xfmt import json_fmt, misc _BAD_SAMPELS = [ "mumbo_jumbo.json", "nested_directory/argle_bargle.json", "short_and_squat.py", ]...
null
tests/test_xfmt.py
test_xfmt.py
py
1,614
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.normpath", "line_number": 20, "usage_type": "call" }, { "api_name": "os.path", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 20, "usage_type": "call" }, { "api_name": "xfmt.misc.get_formatters",...
201294389
import os import math import numpy import datetime import functools import iris import cf_units import iris.coord_categorisation import forest.util import forest.data def conv_func(coord, value): '''Create a new time coordinate in an iris cube, with values to the previous hour divisible by three, i.e. ...
null
bokeh_apps/plot_sea_model_and_gpm_mpl/model_gpm_data.py
model_gpm_data.py
py
8,180
python
en
code
null
code-starcoder2
66
[ { "api_name": "math.floor", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.sum", "line_number": 30, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 60, "usage_type": "call" }, { "api_name": "os.path", "line_number": 60, ...
88695668
import pytest from grandchallenge.algorithms.serializers import ( AlgorithmImageSerializer, AlgorithmSerializer, HyperlinkedJobSerializer, ) from tests.algorithms_tests.factories import ( AlgorithmFactory, AlgorithmImageFactory, AlgorithmJobFactory, ) from tests.serializer_helpers import ( ...
null
app/tests/algorithms_tests/test_serializers.py
test_serializers.py
py
1,763
python
en
code
null
code-starcoder2
66
[ { "api_name": "tests.serializer_helpers.do_test_serializer_valid", "line_number": 50, "usage_type": "call" }, { "api_name": "tests.serializer_helpers.do_test_serializer_fields", "line_number": 53, "usage_type": "call" }, { "api_name": "pytest.mark", "line_number": 19, "us...
216736840
from data import paginatedLeaderboard from decorators import help import discord from discord.ext import commands from enums.help_categories import Category from enums.numbers import Numbers from functions import checks, xp from functions.database import currency, stats, poke, muttn import math import requests # TODO...
null
cogs/leaderboards.py
leaderboards.py
py
9,613
python
en
code
null
code-starcoder2
66
[ { "api_name": "discord.ext.commands.Cog", "line_number": 14, "usage_type": "attribute" }, { "api_name": "discord.ext.commands", "line_number": 14, "usage_type": "name" }, { "api_name": "discord.Embed", "line_number": 30, "usage_type": "call" }, { "api_name": "disc...
445782767
import nltk,re import enchant d=enchant.Dict("en_US") from keras.preprocessing.text import Tokenizer def feature_getter(text): try: text=text.decode('utf-8') except: pass text1=re.sub(r'[^\x00-\x7F]+',' ', text) text=text1 features=[] tokens=[] sentences=nltk.sent_tokenize(text) [tokens.extend(nltk.word_t...
null
additional_feature_getter.py
additional_feature_getter.py
py
856
python
en
code
null
code-starcoder2
66
[ { "api_name": "enchant.Dict", "line_number": 4, "usage_type": "call" }, { "api_name": "re.sub", "line_number": 12, "usage_type": "call" }, { "api_name": "nltk.sent_tokenize", "line_number": 16, "usage_type": "call" }, { "api_name": "nltk.word_tokenize", "line_...
61167671
import math import cv2 import numpy as np import dlib detector = dlib.get_frontal_face_detector() cap = cv2.VideoCapture(0) while True: _, frame = cap.read() frame = cv2.flip(frame, 1) gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = detector(frame) print(faces) for face in faces: ...
null
face_Scrap_Dlib.py
face_Scrap_Dlib.py
py
635
python
en
code
null
code-starcoder2
66
[ { "api_name": "dlib.get_frontal_face_detector", "line_number": 5, "usage_type": "call" }, { "api_name": "cv2.VideoCapture", "line_number": 7, "usage_type": "call" }, { "api_name": "cv2.flip", "line_number": 10, "usage_type": "call" }, { "api_name": "cv2.cvtColor",...
652050812
from datetime import datetime from django.utils import timezone from student.tests.factories import CourseEnrollmentFactory from xmodule.modulestore.tests.factories import CourseFactory import course_dashboard.stats as stats from fun.utils import countries from .base import BaseCourseDashboardTestCase class StatsT...
null
course_dashboard/tests/test_stats.py
test_stats.py
py
4,091
python
en
code
null
code-starcoder2
66
[ { "api_name": "base.BaseCourseDashboardTestCase", "line_number": 13, "usage_type": "name" }, { "api_name": "course_dashboard.stats.EnrollmentStats", "line_number": 18, "usage_type": "call" }, { "api_name": "course_dashboard.stats", "line_number": 18, "usage_type": "name" ...
171877305
from cosmic.evolve import Evolve import numpy as np import pandas as pd import os call = os.system import sys import subprocess import h5py import argparse sys.path.append("./inits") import run_config import astropy.units as u import astropy.constants as c import BatchRunSN as SN sys.path.append(run_config.LMXB_INSTALL...
null
RunBSESN.py
RunBSESN.py
py
5,940
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.system", "line_number": 5, "usage_type": "attribute" }, { "api_name": "sys.path.append", "line_number": 10, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "sys.path.append", "li...
538772044
from django.shortcuts import render from price.models import Woman, Man, Dlinna, Nails, Nails_type,Other, Other_type def price(request): return render(request, 'price/price.html', locals()) def nogty(request): nails_3 = Nails.objects.filter(type_id = 3) nails_2 = Nails.objects.filter(type_id = 2) nails...
null
price/views.py
views.py
py
1,021
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.shortcuts.render", "line_number": 5, "usage_type": "call" }, { "api_name": "price.models.Nails.objects.filter", "line_number": 7, "usage_type": "call" }, { "api_name": "price.models.Nails.objects", "line_number": 7, "usage_type": "attribute" }, {...
323850903
from flask import Flask, render_template, request, redirect, url_for application = Flask(__name__) alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !?1234567890,.:()-=+{}[]*&^%£";<>#~@\/' @application.route('/', methods=['GET']) def show_form(): message = request.args.get('message', '') encry...
null
application.py
application.py
py
1,453
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 3, "usage_type": "call" }, { "api_name": "flask.request.args.get", "line_number": 9, "usage_type": "call" }, { "api_name": "flask.request.args", "line_number": 9, "usage_type": "attribute" }, { "api_name": "flask.request...
499270633
from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from .models import Image, Profile, Likes, Comments, User from django.db import models import cloudinary import cloudinary.uploader import cloudinary.api # Create your views here. @login_required(login_url='/acco...
null
pixels_app/views.py
views.py
py
5,596
python
en
code
null
code-starcoder2
66
[ { "api_name": "models.Image.objects.all", "line_number": 18, "usage_type": "call" }, { "api_name": "models.Image.objects", "line_number": 18, "usage_type": "attribute" }, { "api_name": "models.Image", "line_number": 18, "usage_type": "name" }, { "api_name": "djang...
248421519
'''formats/json_cutlist.py''' """ Make a pre-edited file reference that can be inputted back into auto-editor. """ import os import json def read_json_cutlist(json_file, version, log): with open(json_file, 'r') as f: data = json.load(f) if(data['presets']['version'] != version): log.warning(...
null
auto_editor/formats/make_json.py
make_json.py
py
1,135
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 12, "usage_type": "call" }, { "api_name": "os.path.isfile", "line_number": 20, "usage_type": "call" }, { "api_name": "os.path", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_num...
549951596
#!/usr/bin/env python # -*- coding: utf-8 -*- # Doku: http://www.crummy.com/software/BeautifulSoup/bs4/doc/ # in Word als Webseite, gefiltert exportieren # vorher in UTF-8 (ohne BOM?) konvertieren from bs4 import BeautifulSoup import codecs import re import os def convert_to_lca_style(filename): outfile = open(...
null
python/clean-word-markup-table.py
clean-word-markup-table.py
py
1,506
python
en
code
null
code-starcoder2
66
[ { "api_name": "bs4.BeautifulSoup", "line_number": 16, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 52, "usage_type": "call" }, { "api_name": "os.getcwd", "line_number": 52, "usage_type": "call" }, { "api_name": "os.path.splitext", "line_n...
561791394
import torch import torch.nn as nn def get_state_dict_on_cpu(obj): ''' args: model Move model.data to cpu state_dict.keys like ['Pconv1.weight', 'Pconv2.weight'...] state_dict[key] is weight.data ''' cpu_device = torch.device('cpu') state_dict = obj.state_dict() for ke...
null
xuggg/utils/io.py
io.py
py
1,629
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.device", "line_number": 12, "usage_type": "call" }, { "api_name": "torch.save", "line_number": 34, "usage_type": "call" }, { "api_name": "torch.load", "line_number": 38, "usage_type": "call" }, { "api_name": "torch.nn.Module", "line_number...
224949783
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.pipelines.images import ImagesPipeline from scrapy.exceptions import DropItem import scrapy import re headers = { ...
null
qiankuwang/qiankuwang/pipelines.py
pipelines.py
py
1,424
python
en
code
null
code-starcoder2
66
[ { "api_name": "scrapy.pipelines.images.ImagesPipeline", "line_number": 17, "usage_type": "name" }, { "api_name": "scrapy.Request", "line_number": 20, "usage_type": "call" }, { "api_name": "re.sub", "line_number": 27, "usage_type": "call" }, { "api_name": "scrapy.e...
444651658
import synapse.tests.utils as s_test class StormHttpTest(s_test.SynTest): async def test_storm_http_get(self): async with self.getTestCore() as core: addr, port = await core.addHttpPort(0) core.insecure = True text = ''' $hdr = ( ("U...
null
synapse/tests/test_lib_stormhttp.py
test_lib_stormhttp.py
py
788
python
en
code
null
code-starcoder2
66
[ { "api_name": "synapse.tests.utils.SynTest", "line_number": 3, "usage_type": "attribute" }, { "api_name": "synapse.tests.utils", "line_number": 3, "usage_type": "name" } ]
313346081
import os #os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" #os.environ["CUDA_VISIBLE_DEVICES"]="0" import numpy as np import random import pickle as pkl from model_zoo import * from multiprocessing import cpu_count from tensorflow.keras.callbacks import EarlyStopping, LambdaCallback, ReduceLROnPlateau, CSVLogger, ModelCh...
null
train.py
train.py
py
3,615
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 32, "usage_type": "call" }, { "api_name": "os.path", "line_number": 32, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 34, "usage_type": "call" }, { "api_name": "os.path", "line_number": 3...
114180943
#!/usr/bin/env python # coding=utf-8 import os from iron_worker import * from config import ICON_WORKER_TOKEN, ICON_WORKER_PROJECT_ID def add_dir(files, dir_name): names = os.listdir(dir_name) for name in names: basename, ext = os.path.splitext(name) if ext == '.pyc': continue ...
null
update_worker.py
update_worker.py
py
887
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.listdir", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path.splitext", "line_number": 12, "usage_type": "call" }, { "api_name": "os.path", "line_number": 12, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_num...
160867762
import os import configparser as cparser class Conf: def __init__(self): # 定位当前脚本所在位置的上级 base_dir = str(os.path.dirname(__file__)) # 对文件路径进行格式处理 base_dir = base_dir.replace("\\", "/") # 定位到api_config.ini文件 file_path = base_dir + "/url.ini" # ConfigParser功能—...
null
DiffTest/config/readConfig.py
readConfig.py
py
817
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path", "line_number": 8, "usage_type": "attribute" }, { "api_name": "configparser.ConfigParser", "line_number": 15, "usage_type": "call" } ]
393732172
import asyncio import functools import pathlib import aioftp import nose PORT = 8888 @nose.tools.nottest def aioftp_setup(*, server_args=([], {}), client_args=([], {})): def decorator(f): @functools.wraps(f) def wrapper(): s_args, s_kwargs = server_args c_args, c_kwar...
null
tests/common.py
common.py
py
2,724
python
en
code
null
code-starcoder2
66
[ { "api_name": "asyncio.new_event_loop", "line_number": 25, "usage_type": "call" }, { "api_name": "asyncio.set_event_loop", "line_number": 26, "usage_type": "call" }, { "api_name": "aioftp.Server", "line_number": 28, "usage_type": "call" }, { "api_name": "aioftp.Cl...
615288934
from collections import deque from calculador import Calculador class Balanca(object): """ A Balanca pode atender uma entidade por vez. Ela deve ter uma fila FIFO, usar popleft() para remover da fila. Existe um Tempo de Balanco (TP - segundo enunciado) que deve ser repassado ao caminhao par...
null
src/balanca.py
balanca.py
py
4,536
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.deque", "line_number": 20, "usage_type": "call" }, { "api_name": "calculador.Calculador", "line_number": 22, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 23, "usage_type": "call" } ]
319619566
from copy import deepcopy from typing import List from typing import Set from typing import Tuple from typing import Union import numpy as np import pandas as pd import pytest from typing_extensions import Literal from etna.datasets import TSDataset from etna.ensembles.stacking_ensemble import StackingEnsemble from e...
null
tests/test_ensembles/test_stacking_ensemble.py
test_stacking_ensemble.py
py
9,899
python
en
code
null
code-starcoder2
66
[ { "api_name": "etna.pipeline.Pipeline", "line_number": 20, "usage_type": "name" }, { "api_name": "pytest.raises", "line_number": 22, "usage_type": "call" }, { "api_name": "etna.ensembles.stacking_ensemble.StackingEnsemble", "line_number": 23, "usage_type": "call" }, {...
118693042
import requests import spotipy from spotipy.oauth2 import SpotifyOAuth from bs4 import BeautifulSoup client_id = "Enter ID" client_secret = "Secret" # Ask user for a date user_input = input( "Which year do you want to travel to? Type the date in this format YYYY-MM-DD" ) # Build url based on user input base_url ...
null
Day_46/main.py
main.py
py
1,943
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 19, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 23, "usage_type": "call" }, { "api_name": "spotipy.Spotify", "line_number": 35, "usage_type": "call" }, { "api_name": "spotipy.oauth2.Spotify...
353220025
# -*- coding:utf-8 -*- from pyecharts import Bar import csv bar = Bar("各年份就业人数堆叠图", title_pos="left", width=1000) filename = "file.csv" datax = [] with open(filename) as f: reader = csv.reader(f) for datarow in reader: datax.append(datarow) x = datax[0] y1 = datax[1] y2 = datax[2] y3 = datax[3] y4 = da...
null
homework/数据可视化第一次大作业/code_keshihua2.py
code_keshihua2.py
py
739
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyecharts.Bar", "line_number": 5, "usage_type": "call" }, { "api_name": "csv.reader", "line_number": 9, "usage_type": "call" } ]
304894913
import os import cv2 import scipy import scipy.io import numpy as np import pandas as pd import torchvision.transforms as transforms from PIL import Image from torch.utils.data import Dataset __all__ = ['CarsDataset'] class CarsDataset(Dataset): def __init__(self, mat_anno, data_dir, car_names, transform=Non...
null
dataset.py
dataset.py
py
1,824
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.utils.data.Dataset", "line_number": 14, "usage_type": "name" }, { "api_name": "scipy.io.loadmat", "line_number": 16, "usage_type": "call" }, { "api_name": "scipy.io", "line_number": 16, "usage_type": "attribute" }, { "api_name": "scipy.io.load...
638228376
import json import os from cfenv import AppEnv env = AppEnv() from regcore.settings.base import * REGCORE_APPS = tuple(INSTALLED_APPS) REGCORE_DATABASES = dict(DATABASES) from regulations.settings.base import * REGSITE_APPS = tuple(INSTALLED_APPS) INSTALLED_APPS = ('overextends', 'fec_eregs',) + REGCORE_APPS + REGS...
null
fec_eregs/settings/base.py
base.py
py
1,360
python
en
code
null
code-starcoder2
66
[ { "api_name": "cfenv.AppEnv", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path.dirname", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_...
378224364
# coverage: ignore # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
null
src/openfermion/resource_estimates/pbc/sparse/generate_costing_table_sparse_test.py
generate_costing_table_sparse_test.py
py
1,675
python
en
code
null
code-starcoder2
66
[ { "api_name": "openfermion.resource_estimates.HAVE_DEPS_FOR_RESOURCE_ESTIMATES", "line_number": 19, "usage_type": "name" }, { "api_name": "openfermion.resource_estimates.pbc.testing.make_diamond_113_szv", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.array", ...
337025503
#__coding__:'utf-8' #auther:ly from openpyxl import load_workbook from kx_api.common.my_config import MyConfig class DoExcel: '''该类完成从excel中读取数据,并写回测试结果''' def __init__(self,file_name): self.file_name = file_name #excel工作簿文件名或者路径 self.my_config = MyConfig() def read_data(self,sheet_name):...
null
common/do_excel.py
do_excel.py
py
3,201
python
en
code
null
code-starcoder2
66
[ { "api_name": "kx_api.common.my_config.MyConfig", "line_number": 9, "usage_type": "call" }, { "api_name": "openpyxl.load_workbook", "line_number": 16, "usage_type": "call" }, { "api_name": "kx_api.common.my_config.MyConfig", "line_number": 47, "usage_type": "call" }, ...
122224761
from bs4 import BeautifulSoup from urllib.request import Request, urlopen url = 'https://fortnitestats.net/stats/AshinGod' hdr = {'User-Agent': 'Mozilla/5.0'} req = Request(url,headers=hdr) page = urlopen(req) soup = BeautifulSoup(page, "lxml") try: overall_stats = soup.find_all('h3') counter = 0 for val...
null
scraper.py
scraper.py
py
892
python
en
code
null
code-starcoder2
66
[ { "api_name": "urllib.request.Request", "line_number": 6, "usage_type": "call" }, { "api_name": "urllib.request.urlopen", "line_number": 7, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 8, "usage_type": "call" } ]