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
249683287
import requests import matplotlib as plt def Exchange_rates(Base, Destination): data =requests.get('https://api.cryptonator.com/api/full/{}-{}'.format(Base, Destination)) Data = (data.json()['ticker']['markets']) market = [] price = [] volume = [] for A in range(len(Data)): ...
null
File_1.py
File_1.py
py
1,114
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 5, "usage_type": "call" }, { "api_name": "matplotlib.scatter", "line_number": 23, "usage_type": "call" }, { "api_name": "matplotlib.annotate", "line_number": 26, "usage_type": "call" }, { "api_name": "matplotlib.title",...
81329303
import gpiozero import cwiid import time from rpi_ws281x import * robot = gpiozero.Robot(left=(17,18), right=(27,22)) print("Press and hold the 1+2 buttons on your Wiimote simultaneously") wii = cwiid.Wiimote() print("Connection established") wii.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC LED_COUNT = 8 LED_PIN ...
null
Chapter 6 - Adding RGB LEDs and Sound/neo_remote_control.py
neo_remote_control.py
py
1,594
python
en
code
null
code-starcoder2
66
[ { "api_name": "gpiozero.Robot", "line_number": 6, "usage_type": "call" }, { "api_name": "cwiid.Wiimote", "line_number": 9, "usage_type": "call" }, { "api_name": "cwiid.RPT_BTN", "line_number": 11, "usage_type": "attribute" }, { "api_name": "cwiid.RPT_ACC", "li...
56040240
import requests import json apikey = "fc0bffbf1a792d2b6d97f06456c19a4d451029e91318ac05ff671fa529efc769" #Mimikatz Hashes md5 = "6c042d2609b037b2adec7f2f2562ba6a" sha1 = "7e577e3019408edfcc245faa4421d77655f2e447" sha2 = "d429f6915975af38adf75e0bfce3195b54895e15cac3abbf790f8fa666ed87ee" #Get Hashes from file...
null
HashSwapTest.py
HashSwapTest.py
py
893
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 23, "usage_type": "call" } ]
72496438
#!/usr/bin/env python3 __doc__ =''' Version: pybash-0.0.5 Purpose: - Mimicing `bash --verbose` on a line-by-line basis. Useful for illustrating a bash session. - pybash does not support do-done directives currently - runs in verbose mode by default Options: --help print this help --stderr print stder...
null
pybash.py
pybash.py
py
14,631
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.utcnow", "line_number": 192, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 192, "usage_type": "attribute" }, { "api_name": "tzlocal.get_localzone", "line_number": 193, "usage_type": "call" }, { "api_name...
358287425
#!/usr/bin/env python ''' tag_generator.py Copyright 2017 Long Qian Contact: lqian8@jhu.edu This script creates tags for your Jekyll blog hosted by Github page. No plugins required. ''' import glob import os import yaml post_dir = '_posts/' tag_dir = 'tag/' filenames = glob.glob(post_dir + '*md') total_tags = [] ...
null
tag_generator.py
tag_generator.py
py
693
python
en
code
null
code-starcoder2
66
[ { "api_name": "glob.glob", "line_number": 18, "usage_type": "call" }, { "api_name": "yaml.load", "line_number": 36, "usage_type": "call" } ]
363599312
import requests import itertools as it words = ["test", "worry", "heat", "take"] request = requests.get( "https://raw.githubusercontent.com/ehamiter/anagram/master/wordlist.txt" ) out = dict() for word in words: out[word] = list() for perm in it.permutations(word, r=4): pair = "".join("{0}".forma...
null
activities/alan_iter.py
alan_iter.py
py
575
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 6, "usage_type": "call" }, { "api_name": "itertools.permutations", "line_number": 13, "usage_type": "call" } ]
115098097
import datetime import time from google.appengine.ext import db from models import Comments from request import BlogRequestHandler class AddComments(BlogRequestHandler): """ Class to add comments for the post Only logged in user can post comments """ def get(self): self.write('Hello comments')...
null
handlers/add_comments.py
add_comments.py
py
907
python
en
code
null
code-starcoder2
66
[ { "api_name": "request.BlogRequestHandler", "line_number": 10, "usage_type": "name" }, { "api_name": "google.appengine.ext.db.Key", "line_number": 20, "usage_type": "call" }, { "api_name": "google.appengine.ext.db", "line_number": 20, "usage_type": "name" }, { "ap...
613823726
import pandas as pd import h5py #%% def load_locs(path): """ Returns localization .hdf5 from picasso as pandas.DataFrame and corresponding .yaml as list of dictionaries. Parameters --------- readpath : str Path to .hdf5 file as generated by Picasso Returns ------- locs :...
null
lbfcs/io.py
io.py
py
1,844
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.HDFStore", "line_number": 21, "usage_type": "call" }, { "api_name": "picasso.io.load_info", "line_number": 26, "usage_type": "call" }, { "api_name": "h5py.File", "line_number": 49, "usage_type": "call" }, { "api_name": "pandas.HDFStore", ...
167326450
import pyutils.csv import matplotlib.pyplot as plt import pandas as pd import numpy as np # TODO: Move this to lib? def plot_correlation( x_data, y_data, x_label='', y_label='', fig_title='' ): # TODO: Read column names from spec fig = plt.figure(fig_title, figsize=(10, 7)) ax11 = fi...
null
sample.py
sample.py
py
8,122
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.figure", "line_number": 17, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 17, "usage_type": "name" }, { "api_name": "matplotlib.pyplot.show", "line_number": 29, "usage_type": "call" }, { "api_name": "mat...
129678134
from django.contrib.gis.geos import MultiPolygon from django.utils import timezone from django.core.exceptions import ObjectDoesNotExist from django.db.models import QuerySet from model_bakery import baker, seq from monitoring.models import MonitoringRun from monitoring.settings import WARNING_RESPONSE_TIME from struc...
null
tests/baker_recipes/db_setup.py
db_setup.py
py
14,311
python
en
code
null
code-starcoder2
66
[ { "api_name": "structure.models.MrMapUser.objects.get", "line_number": 20, "usage_type": "call" }, { "api_name": "structure.models.MrMapUser.objects", "line_number": 20, "usage_type": "attribute" }, { "api_name": "structure.models.MrMapUser", "line_number": 20, "usage_typ...
247732049
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt from ....Functions.init_fig import init_fig def plot( self, fig=None, ax=None, sym=1, alpha=0, delta=0, is_edge_only=False, comp_machine=None, is_show_fig=True, save_path=None, ): """Plot the Machine in a matplotlib fi...
null
pyleecan/Methods/Machine/Machine/plot.py
plot.py
py
3,046
python
en
code
null
code-starcoder2
66
[ { "api_name": "Functions.init_fig.init_fig", "line_number": 44, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.axis", "line_number": 114, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 114, "usage_type": "name" }, { "api_name":...
112634241
import os,time import unittest import requests import random from common import encrypt_oper, csv_oper, log_oper from common.encrypt_oper import serialOrder class V2_deposit(unittest.TestCase): """会员充值操作""" def setUp(self): self.baseurl = encrypt_oper.getURL('interfaceurl', 'newdeposit') ...
null
interface_testcase/Member_V2_withDrawal_test.py
Member_V2_withDrawal_test.py
py
6,136
python
en
code
null
code-starcoder2
66
[ { "api_name": "unittest.TestCase", "line_number": 8, "usage_type": "attribute" }, { "api_name": "common.encrypt_oper.getURL", "line_number": 11, "usage_type": "call" }, { "api_name": "common.encrypt_oper", "line_number": 11, "usage_type": "name" }, { "api_name": "...
162777489
# Copyright 2018 Riki # # the purpose of this file is get information to answer the question # tools: GoogleScraper # # ============================================================================= import multiprocessing from GoogleScraper import scrape_with_config, GoogleSearchError import time import re class Go...
null
google.py
google.py
py
4,341
python
en
code
null
code-starcoder2
66
[ { "api_name": "multiprocessing.Process", "line_number": 16, "usage_type": "attribute" }, { "api_name": "multiprocessing.Process.__init__", "line_number": 18, "usage_type": "call" }, { "api_name": "multiprocessing.Process", "line_number": 18, "usage_type": "attribute" },...
94992653
from kivy.app import App from kivy.uix.anchorlayout import AnchorLayout from kivy.uix.button import Button class DemoAPP(App): def build(self): lay1 = AnchorLayout(anchor_x="left", anchor_y="top") bt1 = Button(text ="Click", font_size ="20sp", back...
null
03.Layout/02.RightTop.py
02.RightTop.py
py
586
python
en
code
null
code-starcoder2
66
[ { "api_name": "kivy.app.App", "line_number": 6, "usage_type": "name" }, { "api_name": "kivy.uix.anchorlayout.AnchorLayout", "line_number": 8, "usage_type": "call" }, { "api_name": "kivy.uix.button.Button", "line_number": 9, "usage_type": "call" } ]
417587678
# Checkpoint 3 from PIL import Image from PIL import ImageOps import numpy as np T_shirt = Image.open("T-shirt.png") bag = Image.open("bag.png") shoes = Image.open("shoes.png") #np_T_shirt = np.array(T_shirt) #np_bag = np.array(bag) #bp_shoes = np.array(shoes) newT_shirt=ImageOps.fit(T_shirt, (28,28), method=0, bleed...
null
labs/lab-09/image_handler.py
image_handler.py
py
834
python
en
code
null
code-starcoder2
66
[ { "api_name": "PIL.Image.open", "line_number": 6, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 6, "usage_type": "name" }, { "api_name": "PIL.Image.open", "line_number": 7, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 7...
636521378
import re import logging from defaults import Default, Text, Trait from raceDefault import RaceDefault from subRace import SubRace from templates import TPL import config logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class Race(RaceDefault): def __init__(self, xml, bookname): Defau...
null
races/race.py
race.py
py
1,990
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.basicConfig", "line_number": 11, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 11, "usage_type": "attribute" }, { "api_name": "logging.getLogger", "line_number": 12, "usage_type": "call" }, { "api_name": "raceDefault.R...
363820128
#!/usr/bin/python import sys import math import numpy as np import matplotlib.pyplot as plt from os import listdir from os.path import isfile, join #================================== def DrawFig(filename): x = [] avg = [] sdv = [] #average of log time with open(filename) as f: data = f.read() data = ...
null
cs739/project3/data/statistic/hadoop_write.py
hadoop_write.py
py
1,043
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.figure", "line_number": 30, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 30, "usage_type": "name" }, { "api_name": "matplotlib.pyplot.xlabel", "line_number": 33, "usage_type": "call" }, { "api_name": "m...
590861465
# coding:utf-8 import re from django.http import JsonResponse, HttpResponse import settings def get_url(urllist , parent='' , depth=0 , url_list=[]): url_dict = {}.copy() for entry in urllist: url = entry.regex.pattern if re.search('\(' , url) : continue #过滤正则表达式的URL地址 ...
null
TheLazyDays/views.py
views.py
py
2,019
python
en
code
null
code-starcoder2
66
[ { "api_name": "re.search", "line_number": 10, "usage_type": "call" }, { "api_name": "re.search", "line_number": 23, "usage_type": "call" }, { "api_name": "TheLazyDays.urls.urlpatterns", "line_number": 52, "usage_type": "attribute" }, { "api_name": "TheLazyDays.url...
104764520
# coding: utf-8 import pandas as pd import geopandas as gpd from sqlalchemy import create_engine from shapely.geometry import Point import shapely.wkb import numpy as np import sys from functools import reduce from datetime import datetime #su rasters parametriRasters={"temperature": "t2m", "precipi...
null
python/estrai_postgis.py
estrai_postgis.py
py
7,834
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.date", "line_number": 56, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 56, "usage_type": "name" }, { "api_name": "datetime.datetime.strptime", "line_number": 56, "usage_type": "call" }, { "api_name": "s...
582811945
import config import ImageFunctions import RAPID import random import threading # Show video feed in separate thread cam_thread = threading.Thread(target=ImageFunctions.showVideo, args=(config.cam,), daemon=True) cam_thread.start() robtarget_pucks = [] puck_to_RAPID = 0 # Initialize robot communication, start motor...
null
ABB-pucks/main.py
main.py
py
5,693
python
en
code
null
code-starcoder2
66
[ { "api_name": "threading.Thread", "line_number": 8, "usage_type": "call" }, { "api_name": "ImageFunctions.showVideo", "line_number": 8, "usage_type": "attribute" }, { "api_name": "config.cam", "line_number": 8, "usage_type": "attribute" }, { "api_name": "RAPID.RAP...
643990528
import locale import unittest from datetime import datetime, timedelta from canonicalwebteam.http import heuristics class TestHeuristics(unittest.TestCase): def test_custom_heuristic(self): today = datetime.utcnow() one_day_delta = timedelta(days=1) tomorrow = today + one_day_delta ...
null
tests/test_heuristics.py
test_heuristics.py
py
1,267
python
en
code
null
code-starcoder2
66
[ { "api_name": "unittest.TestCase", "line_number": 8, "usage_type": "attribute" }, { "api_name": "datetime.datetime.utcnow", "line_number": 10, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 10, "usage_type": "name" }, { "api_name": "date...
98432903
# -*- coding: utf-8 -*- import datetime from babel.core import Locale from sqlalchemy import func from pyramid.view import view_config from intranet3.utils.views import BaseView from intranet3.models import User, PresenceEntry, Late, Absence, DBSession from intranet3 import helpers as h from intranet3.utils import ex...
null
src/intranet3/intranet3/views/presence.py
presence.py
py
3,777
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.time", "line_number": 14, "usage_type": "call" }, { "api_name": "datetime.time", "line_number": 15, "usage_type": "call" }, { "api_name": "datetime.time", "line_number": 16, "usage_type": "call" }, { "api_name": "babel.core.Locale", "li...
2149887
''' This plots Trend charts of selected countries starting from April 01, 2020 until today. Webscraping to GET JSON formatted response, then convert into DF ''' import pandas as pd import requests import datetime from matplotlib import pyplot as plt cc:list = ["BD"] countryName:list = ["Bangladesh"] # cc:list = ["BD"...
null
myWebScrapping11__InProgress.py
myWebScrapping11__InProgress.py
py
5,703
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.now", "line_number": 17, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 17, "usage_type": "attribute" }, { "api_name": "requests.get", "line_number": 27, "usage_type": "call" }, { "api_name": "pandas.Data...
514144981
from __future__ import annotations import logging from typing import TYPE_CHECKING from ...models import ( Planning, ) from ..abc import ( Algorithm, ) from ..utils import ( ThreeIndexModel, ) if TYPE_CHECKING: from typing import ( Type ) from ..utils import ( Model, ) l...
null
jinete/algorithms/exacts/milp.py
milp.py
py
899
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.TYPE_CHECKING", "line_number": 17, "usage_type": "name" }, { "api_name": "logging.getLogger", "line_number": 25, "usage_type": "call" }, { "api_name": "abc.Algorithm", "line_number": 28, "usage_type": "name" }, { "api_name": "typing.Type", ...
31603579
#!/usr/bin/env python3 from __future__ import annotations import abc import argparse import itertools import functools import fractions import operator import sys import typing as typ import collections import z3 PARSER = argparse.ArgumentParser( description="Calculate coverage from samples file and smt2 file" ) ...
null
scripts/calc_metric.py
calc_metric.py
py
17,085
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 15, "usage_type": "call" }, { "api_name": "z3.Context", "line_number": 54, "usage_type": "call" }, { "api_name": "functools.reduce", "line_number": 60, "usage_type": "call" }, { "api_name": "operator.mul", ...
485361184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 24 00:01:17 2018 @author: sumanyu """ import numpy as np import torch import os import torchvision.models as models import torch.optim as optim import torchvision.transforms as transforms import torch.utils as utils import torch.nn as nn import tor...
null
ar_model.py
ar_model.py
py
2,694
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.nn.Module", "line_number": 21, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 21, "usage_type": "name" }, { "api_name": "torchvision.models.resnet101", "line_number": 25, "usage_type": "call" }, { "api_name": "torchvisio...
89409254
import pandas as pd import numpy as np import mdtraj as md import itertools from DEERPREdict.utils import Operations def loadExpPREs(name,prot): value = {} error = {} resnums = np.arange(1,len(prot.fasta)+1) for label in prot.labels: value[label], error[label] = np.loadtxt(name+'/expPREs/exp-{:...
null
2022/CG-cutoffs-Tesei-et-al/SC/code/analyse.py
analyse.py
py
29,441
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.arange", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.loadtxt", "line_number": 12, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 13, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "l...
610067998
import random import csv import sys import os import time import numpy as np from keras.preprocessing.image import ImageDataGenerator from spectral import * from skimage import io as skio from sklearn.preprocessing import MinMaxScaler import cv2 from tqdm import tqdm from os import listdir from os.path import isfile, j...
null
data.py
data.py
py
12,372
python
en
code
null
code-starcoder2
66
[ { "api_name": "csv.reader", "line_number": 67, "usage_type": "call" }, { "api_name": "numpy.arange", "line_number": 70, "usage_type": "call" }, { "api_name": "numpy.arange", "line_number": 80, "usage_type": "call" }, { "api_name": "numpy.arange", "line_number"...
568454520
from flask import jsonify, request, url_for, g from app import db from app.models import Post from app.api import bp from app.api.auth import token_auth from app.api.errors import bad_request, unauthorized_access @bp.route('/posts/<int:id>', methods=['GET']) @token_auth.login_required def get_post(id): return jso...
null
app/api/posts.py
posts.py
py
1,692
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.jsonify", "line_number": 12, "usage_type": "call" }, { "api_name": "app.models.Post.query.get_or_404", "line_number": 12, "usage_type": "call" }, { "api_name": "app.models.Post.query", "line_number": 12, "usage_type": "attribute" }, { "api_nam...
182392315
import json from django.views.generic import View from django.core.exceptions import ObjectDoesNotExist from django.views.decorators.http import require_http_methods from django.contrib.admin.views.decorators import staff_member_required from django.utils.decorators import method_decorator from django.core.validators ...
null
contacts/views.py
views.py
py
5,562
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.loads", "line_number": 21, "usage_type": "call" }, { "api_name": "utils.helper.render_to_json", "line_number": 23, "usage_type": "call" }, { "api_name": "django.views.generic.View", "line_number": 30, "usage_type": "name" }, { "api_name": "util...
606810540
# -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup import csv import pandas import sys data_url = 'https://www.statcrunch.com/grabdata.php?dataid=1096769&_=1470977876486' req = requests.get(data_url) data = req.text.splitlines() headers = data.pop(0).split() with open("nbaplayers.csv", 'wb') as ...
null
data_get.py
data_get.py
py
610
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 10, "usage_type": "call" }, { "api_name": "csv.writer", "line_number": 17, "usage_type": "call" } ]
77930460
from keras.models import load_model from keras.preprocessing.image import ImageDataGenerator import numpy as np model = load_model("flowers_model_VGG.h5") train_datagen = ImageDataGenerator(rescale=1./255) val_datagen = ImageDataGenerator(rescale=1./255) test_datagen = ImageDataGenerator( rescale=1./255) train_generat...
null
flowers/flowers_predict.py
flowers_predict.py
py
1,963
python
en
code
null
code-starcoder2
66
[ { "api_name": "keras.models.load_model", "line_number": 4, "usage_type": "call" }, { "api_name": "keras.preprocessing.image.ImageDataGenerator", "line_number": 5, "usage_type": "call" }, { "api_name": "keras.preprocessing.image.ImageDataGenerator", "line_number": 6, "usag...
281676635
from django.conf.urls import url from .views import * # from . import views urlpatterns = [ url(r'^$', index), url(r'^courses/create$', create_course), url(r'^courses/(?P<course_id>\d+)/destroy$', destroy_course, name='destroy_course'), url(r'^comments/(?P<course_id>\d+)/show$', show_comment, name='sho...
null
Django/courses_project/apps/courses/urls.py
urls.py
py
517
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 6, "usage_type": "call" }, { "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.co...
186104319
from django.db import models from django.contrib.auth.models import User # Create your models here. city_choices = [ ('Chennai', 'Chennai'), ('Delhi', 'Delhi'), ('Bombay', 'Bombay'), ('Tirupati', 'Tirupati'), ('Agra','Agra'), ] alert_choices=[ ('Forest_Fire', 'Forest_Fire')...
null
home/models.py
models.py
py
2,028
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.models.Model", "line_number": 34, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 34, "usage_type": "name" }, { "api_name": "django.db.models.ForeignKey", "line_number": 35, "usage_type": "call" }, { "api_name...
104193064
execfile('scripts/load_net.py') from collections import OrderedDict n = 4 # Blobs to save for u10f1 model u10_to_save = OrderedDict() u10_to_save['frames'] = [n] u10_to_save['all_frames'] = np.arange(0,320,32) + n u10_to_save['conv1'] = np.arange(0,320,32) + n u10_to_save['conv2'] = np.arange(0,320,32) + n u10_to_sav...
null
scripts/test.py
test.py
py
2,902
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.OrderedDict", "line_number": 7, "usage_type": "call" }, { "api_name": "collections.OrderedDict", "line_number": 15, "usage_type": "call" } ]
427227035
# -*- coding: utf-8 -*- from core.base_page import BasePage import logging, sys, time, os import pytest # logging.basicConfig(level=logging.INFO, stream=sys.stdout) # log = logging.getLogger() class CustomForecasts(BasePage): def __init__(self, driver): self.driver = driver self.logger = logging.ge...
null
pages/custom_forecasts_page.py
custom_forecasts_page.py
py
828
python
en
code
null
code-starcoder2
66
[ { "api_name": "core.base_page.BasePage", "line_number": 8, "usage_type": "name" }, { "api_name": "logging.getLogger", "line_number": 11, "usage_type": "call" } ]
521637115
""" Algorithm source: https://pycryptodome.readthedocs.io/en/latest/src/public_key/rsa.html Author: Tymoteusz Mirski """ from Crypto.PublicKey import RSA from Crypto.Random import get_random_bytes from Crypto.Cipher import AES, PKCS1_OAEP from encryption_n_decryption import utils import time def generate_keys(priva...
null
encryption_n_decryption/rsa.py
rsa.py
py
4,441
python
en
code
null
code-starcoder2
66
[ { "api_name": "Crypto.PublicKey.RSA.generate", "line_number": 32, "usage_type": "call" }, { "api_name": "Crypto.PublicKey.RSA", "line_number": 32, "usage_type": "name" }, { "api_name": "encryption_n_decryption.utils.write_to_file_b", "line_number": 35, "usage_type": "call...
391222573
# -*- coding: utf-8 -*- from django import forms from django.http import HttpResponse from django.shortcuts import render_to_response from django.http.response import HttpResponseRedirect import ShareMethod.views import time import datetime def chart(req): first_day=req.REQUEST.get('first_day','') end_day=re...
null
Monitor_v3/Chart/views.py
views.py
py
13,465
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.strftime", "line_number": 16, "usage_type": "call" }, { "api_name": "time.localtime", "line_number": 16, "usage_type": "call" }, { "api_name": "time.time", "line_number": 16, "usage_type": "call" }, { "api_name": "datetime.datetime.now", "l...
184908368
""" # URL : http://localhost:8080/cgi-bin/bmi_web.py """ # 모듈 로딩 --------------------------------------------------- import cgi, sys, codecs, os import joblib # WEB 인코딩 설정 --------------------------------------------- sys.stdout=codecs.getwriter('utf-8')(sys.stdout.detach()) # 함수 선언 ----------------------------------...
null
PythonAI/Source/W2D3/src/bmi_web.py
bmi_web.py
py
2,199
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.stdout", "line_number": 9, "usage_type": "attribute" }, { "api_name": "codecs.getwriter", "line_number": 9, "usage_type": "call" }, { "api_name": "sys.stdout.detach", "line_number": 9, "usage_type": "call" }, { "api_name": "os.path.dirname", ...
182727367
"""Configuation library for LLAMA. This is mostly used by the Collector process to determine target hosts and tag mappings. """ import collections import logging import yaml class Error(Exception): """Top level error.""" Tag = collections.namedtuple('Tag', ['key', 'value']) class Target(object): """Conf...
null
llama/config.py
config.py
py
1,538
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.namedtuple", "line_number": 16, "usage_type": "call" }, { "api_name": "yaml.safe_load", "line_number": 48, "usage_type": "call" }, { "api_name": "logging.info", "line_number": 51, "usage_type": "call" } ]
105485290
from numpy import array from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM import pandas as pd import random as rd def model(): RSP = pd.read_csv("RPS/data.csv") This_Id = list(RSP["id"]) Playerlist = list(RSP["Player"]) AI = list(RSP["Lose_or_Win"]) ...
null
RPS/RNNModel.py
RNNModel.py
py
1,632
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 30, "usage_type": "call" }, { "api_name": "keras.models.Sequential", "line_number": 32, "usage_type": "call" }, { "api_name": "keras.layers.LSTM...
64743864
import requests import sys from bs4 import BeautifulSoup import re import datetime import pymysql from datetime import datetime as dtime sys.path.append('/home/linsam/github') import PTTKey host = PTTKey.host user = PTTKey.user password = PTTKey.password database = PTTKey.database # 建立 SQL 檔案 def creat_sql_file(sql_...
null
Crawler/auto_craw_new_ptt_data.py
auto_craw_new_ptt_data.py
py
27,944
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": "PTTKey.host", "line_number": 13, "usage_type": "attribute" }, { "api_name": "PTTKey.user", "lin...
48736758
import json import reversion from autoslug import AutoSlugField from django.conf import settings from django.contrib.gis.db import models from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.indexes import GinIndex from django.contrib.postgres.search import SearchVector, SearchVectorField...
null
erp/models.py
models.py
py
37,277
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.contrib.gis.db.models.CharField.register_lookup", "line_number": 29, "usage_type": "call" }, { "api_name": "django.db.models.functions.Lower", "line_number": 29, "usage_type": "argument" }, { "api_name": "django.contrib.gis.db.models.CharField", "line_nu...
450040077
import cv2 import face_recognition import ft2 import pickle def face_in_camera(): # pickle文件提取 f1 = open('show_name.pkl', 'rb') known_names = pickle.load(f1) f = open('show_data.pkl', 'rb', ) known_face_encodings = pickle.load(f) # opencv vc = cv2.VideoCapture(0, cv2.CAP_DSHOW) while Tr...
null
face_in_camera.py
face_in_camera.py
py
1,477
python
en
code
null
code-starcoder2
66
[ { "api_name": "pickle.load", "line_number": 9, "usage_type": "call" }, { "api_name": "pickle.load", "line_number": 11, "usage_type": "call" }, { "api_name": "cv2.VideoCapture", "line_number": 13, "usage_type": "call" }, { "api_name": "cv2.CAP_DSHOW", "line_num...
90308752
#!/usr/bin/env python """setup.py file for a GRR API client library.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import os import shutil import subprocess import sys from distutils.command.build_py import build_py from setuptools import find_packa...
null
grr/proto/setup.py
setup.py
py
3,052
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.version_info", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path", "line_number": 27, "usage_type": "attribute" }, { "api_name": "os.path.realpath",...
28026683
import os import random import struct import uuid # noinspection PyUnresolvedReferences from Crypto.Cipher import AES class CryptKeeper: CHUNK_SIZE = 64 * 1024 # in bits # KEY_SIZE = 32 # in bytes TEST_STRING = 'TESTSTRING' def encrypt(self, file_path, key=None): """ Encrypts the g...
null
CryptKeeper.py
CryptKeeper.py
py
4,634
python
en
code
null
code-starcoder2
66
[ { "api_name": "uuid.uuid4", "line_number": 31, "usage_type": "call" }, { "api_name": "random.randint", "line_number": 34, "usage_type": "call" }, { "api_name": "Crypto.Cipher.AES.new", "line_number": 36, "usage_type": "call" }, { "api_name": "Crypto.Cipher.AES", ...
504901950
import sqlalchemy as sa from core import metadata_columns class FileTables: def __init__(self, schema_name="public"): self.schema_name = schema_name self.metadata = sa.MetaData() self.file = sa.Table("file", self.metadata, *metadata_column_list, sa.Column("data_source_key", sa...
null
etl/database/file_tables.py
file_tables.py
py
586
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.MetaData", "line_number": 9, "usage_type": "call" }, { "api_name": "sqlalchemy.Table", "line_number": 10, "usage_type": "call" }, { "api_name": "sqlalchemy.Column", "line_number": 11, "usage_type": "call" }, { "api_name": "sqlalchemy.Text...
231102118
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy from dataclasses import dataclass from PyMieSim.binary.Fibonacci import FIBONACCI from MPSPlots.Render3D import Scene3D from MPSPlots.Math import Angle @dataclass class FibonacciMesh(): """ Class wich represent an angular mesh. The distribution of p...
null
PyMieSim/Tools/Mesh.py
Mesh.py
py
6,852
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.array", "line_number": 49, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 50, "usage_type": "call" }, { "api_name": "numpy.asarray", "line_number": 57, "usage_type": "call" }, { "api_name": "MPSPlots.Math.Angle", "line...
335885255
from ftw.table import helper from opengever.base.schema import TableChoice from opengever.contact import _ as contact_mf from opengever.document.behaviors.metadata import IDocumentMetadata from opengever.dossier import _ from opengever.dossier.command import CreateDocumentFromTemplateCommand from opengever.kub import i...
null
opengever/dossier/templatefolder/form.py
form.py
py
5,950
python
en
code
null
code-starcoder2
66
[ { "api_name": "plone.api.content.find", "line_number": 31, "usage_type": "call" }, { "api_name": "plone.api.content", "line_number": 31, "usage_type": "attribute" }, { "api_name": "plone.api", "line_number": 31, "usage_type": "name" }, { "api_name": "zope.schema.v...
352898213
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import argparse from . import _version PROG = "mutanno" DEFAULT_OPT = {'annot': {}, 'makedata': {}, 'convert': {}} DEFAULT_OPT['annot']['vcf'] = "" DEFAULT_OPT['annot']['out'] = "mutanno" DEFAULT_OPT['annot']['outtype'] = ['vcf'] DEFAULT_OPT['annot']['ds'] = ""...
null
src/mutanno/_options.py
_options.py
py
10,492
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 31, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 157, "usage_type": "attribute" }, { "api_name": "sys.argv.append", "line_number": 158, "usage_type": "call" }, { "api_name": "sys.argv", ...
576240340
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 11:39:48 2021 @author: daan """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import math #%% LW=5 FS=25 # %% data1 = pd.read_csv('bifurcation.txt',sep='\s+',header=None) data1 = pd.DataFrame(data1) # %% AMOC_1=data1[...
null
Revision/figure5/figure5a.py
figure5a.py
py
3,340
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 19, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 20, "usage_type": "call" }, { "api_name": "numpy.size", "line_number": 47, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_n...
323547955
from fileToStructure import * import json #necesitar partir el indice en varios archivos para subirlo a github. #el tiempo de generacion del indice demora aprox 2 horas. Es mejor tenerlo en archivo. index = jsonToDict("index.json") nElements = len(index.keys()) #nElements = 161220. Vamos a dividir según la distribució...
null
divideIndex.py
divideIndex.py
py
1,089
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.dump", "line_number": 30, "usage_type": "call" }, { "api_name": "json.dump", "line_number": 33, "usage_type": "call" }, { "api_name": "json.dump", "line_number": 36, "usage_type": "call" }, { "api_name": "json.dump", "line_number": 39, ...
547254626
""" Geographic coordinate system ---------------------------- """ from typing import List, Optional, Tuple import numpy from .. import interface from ..core import geodetic from ..core.geodetic import ( Crossover, LineString, calculate_crossover, calculate_crossover_list, coordinate_distances, ) ...
null
src/pyinterp/geodetic/__init__.py
__init__.py
py
13,723
python
en
code
null
code-starcoder2
66
[ { "api_name": "core.geodetic.Spheroid", "line_number": 36, "usage_type": "attribute" }, { "api_name": "core.geodetic", "line_number": 36, "usage_type": "name" }, { "api_name": "typing.Optional", "line_number": 59, "usage_type": "name" }, { "api_name": "typing.Tupl...
120155724
from bs4 import BeautifulSoup from splinter import Browser import pandas as pd import datetime as dt def mars_news(browser): url = "https://mars.nasa.gov/news/" browser.visit(url) html = browser.html news_soup = BeautifulSoup(html, 'html.parser') slide_element = news_soup.select_one('ul.item_list ...
null
scrape_mars.py
scrape_mars.py
py
4,230
python
en
code
null
code-starcoder2
66
[ { "api_name": "bs4.BeautifulSoup", "line_number": 10, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 34, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 48, "usage_type": "call" }, { "api_name": "bs4.BeautifulSo...
473429366
#!/hpcf/apps/python/install/2.7.13/bin/python import os import argparse import subprocess import glob import pandas as pd import uuid import base64 import sys import PIL from PIL import Image import cStringIO p_dir = os.path.dirname(os.path.realpath(__file__)) + "/" cwd = os.getcwd() """Convert pandas dataframe to htm...
null
bin/dataframe_to_html.py
dataframe_to_html.py
py
6,156
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 13, "usage_type": "call" }, { "api_name": "os.path", "line_number": 13, "usage_type": "attribute" }, { "api_name": "os.path.realpath", "line_number": 13, "usage_type": "call" }, { "api_name": "os.getcwd", "line_n...
293661754
from typing import List def largestIsland( grid: List[List[int]]) -> int: directions = [(1,0),(0,1),(0,-1),(-1,0)] area = [1] dict_ = {} id_ = [2] xlimit = len(grid) - 1 ylimit = len(grid[0]) - 1 def helper(grid, id_, x, y): for direction in directions: x_ = x + direct...
null
MakingaLargeIsland/MakingaLargeIsland.py
MakingaLargeIsland.py
py
1,669
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.List", "line_number": 3, "usage_type": "name" } ]
526185928
import os import cv2 import random import argparse parser = argparse.ArgumentParser() parser.add_argument('video', help='video to process') parser.add_argument('--num', help='num of frames to sample from video', type=int, default=10) args = parser.parse_args() assert os.path.exists(args.video),'Video path does not ex...
null
sample_frames.py
sample_frames.py
py
1,024
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 6, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 11, "usage_type": "call" }, { "api_name": "os.path", "line_number": 11, "usage_type": "attribute" }, { "api_name": "os.path.basename",...
540711751
from ssixa.base.database.basedb import SSIXADBBase from ssixa.base.database.oidcdbobject import OIDCSession, OIDCUidToSid from ssixa.base.database.uid2siddb import UidToSidDB from oic.utils.sdb import SessionDB as SessionDBBase import logging log = logging.getLogger(__name__) class SessionDB(SessionDBBase, SSIXADBB...
null
ssixa/base/database/sessiondb.py
sessiondb.py
py
6,332
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 8, "usage_type": "call" }, { "api_name": "oic.utils.sdb.SessionDB", "line_number": 11, "usage_type": "name" }, { "api_name": "ssixa.base.database.basedb.SSIXADBBase", "line_number": 11, "usage_type": "name" }, { "a...
420664752
import cv2 import numpy as np import matplotlib.pyplot as plt import os # Functions def ishow(img, max_t = 10000): # Kill window if Q is pressed if cv2.waitKey(1) & 0xFF == ord('q'): v2.destroyAllWindows() # Show image cv2.imshow('Preview',img) # Otherwise kill after max_t, defau...
null
data-analysis/modules/utils.py
utils.py
py
1,039
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.waitKey", "line_number": 10, "usage_type": "call" }, { "api_name": "cv2.imshow", "line_number": 14, "usage_type": "call" }, { "api_name": "cv2.waitKey", "line_number": 17, "usage_type": "call" }, { "api_name": "cv2.destroyAllWindows", "line_...
243170614
from hashlib import sha256 ################################################################################# # https://github.com/michaelhly/solana-py/blob/master/src/solana/publickey.py # # The MIT License (MIT) # Copyright (C) 2020 Michael Huang # Permission is hereby granted, free of charge, to any person obtaini...
null
_reference/hacking-101/picoctf-2022-greatest-hits/solfire/solana_helpers.py
solana_helpers.py
py
5,204
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.List", "line_number": 35, "usage_type": "name" }, { "api_name": "hashlib.sha256", "line_number": 41, "usage_type": "call" }, { "api_name": "typing.List", "line_number": 46, "usage_type": "name" }, { "api_name": "typing.Tuple", "line_numbe...
16674551
import discord client = discord.Client() @client.event async def on_ready(): print('You are logged in as {0.user}'.format(client)) @client.event async def on_message(message): file = open('messages.txt', 'a') file.write(message.author.name + ': ' + message.content + '\n') if message.author.name == 'D...
null
main.py
main.py
py
511
python
en
code
null
code-starcoder2
66
[ { "api_name": "discord.Client", "line_number": 3, "usage_type": "call" } ]
50428509
# Given a binary tree, find its minimum depth. # The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. # Note: A leaf is a node with no children. # Example 1: # Input: 3 # / \ # 9 20 # / \ # ...
null
111. Minimum Depth of Binary Tree.py
111. Minimum Depth of Binary Tree.py
py
3,857
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.deque", "line_number": 46, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 47, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 59, "usage_type": "call" }, { "api_name": "collections.deq...
477020230
import cv2 import numpy as np import matplotlib.pyplot as plt import os import sys def load_image(image_file): file_name_lists = os.listdir(image_file) label_arrays = [] # cv2 load images as BGR image_bgr = [] for i in file_name_lists: img = cv2.imread(image_file+'/'+i) height, wid...
null
scripts/utils/data_loader.py
data_loader.py
py
4,120
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.listdir", "line_number": 8, "usage_type": "call" }, { "api_name": "cv2.imread", "line_number": 14, "usage_type": "call" }, { "api_name": "cv2.cvtColor", "line_number": 24, "usage_type": "call" }, { "api_name": "cv2.COLOR_BGR2RGB", "line_numbe...
601379835
import numpy as np import brainiak.eventseg.event from scipy.stats import norm,zscore,pearsonr,stats from nilearn.image import load_img import sys from brainiak.funcalign.srm import SRM import nibabel as nib import os from scipy.spatial import distance from sklearn import linear_model from scipy.spatial.distance import...
null
phase_scramble.py
phase_scramble.py
py
5,769
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.newaxis", "line_number": 51, "usage_type": "attribute" }, { "api_name": "numpy.dstack", "line_number": 52, "usage_type": "call" }, { "api_name": "numpy.ndarray", ...
449807888
# # module tank.core.testcase # from typing import Dict from copy import deepcopy import yaml import jsonschema from tank.core.exc import TankTestCaseError from tank.core.utils import yaml_load, yaml_dump class TestCase: """ Entity describing single test performed by Tank. """ def __init__(self, ...
null
tank/core/testcase.py
testcase.py
py
2,152
python
en
code
null
code-starcoder2
66
[ { "api_name": "tank.core.utils.yaml_load", "line_number": 22, "usage_type": "call" }, { "api_name": "jsonschema.validate", "line_number": 24, "usage_type": "call" }, { "api_name": "jsonschema.ValidationError", "line_number": 25, "usage_type": "attribute" }, { "api...
462372989
import requests from bs4 import BeautifulSoup as bs user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36' header = {'user-agent':user_agent} myUrl = "https://maoyan.com/films?showType=3" response = requests.get(myUrl,headers=header) bs...
null
week01/work1.py
work1.py
py
784
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 7, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 9, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 19, "usage_type": "call" } ]
321398548
# standard library from pathlib import Path from tempfile import TemporaryDirectory # third-party packages import xarray as xr from mao_merge_45m import accelerometer, antenna, correlator, merge, weather from xarray.testing import assert_allclose # constants TEST_CSV = Path("data") / "weather_20201123T004000Z.csv" ...
null
tests/test_merge.py
test_merge.py
py
1,900
python
en
code
null
code-starcoder2
66
[ { "api_name": "pathlib.Path", "line_number": 13, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_number": 14, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_number": 15, "usage_type": "call" }, { "api_name": "pathlib.Path", "line_numbe...
528440242
from __future__ import absolute_import import logging import sys import re from flask import request, current_app from flask.ctx import has_request_context from pythonjsonlogger.jsonlogger import JsonFormatter as BaseJSONFormatter LOG_FORMAT = '%(asctime)s %(app_name)s %(name)s %(levelname)s ' \ '%(requ...
null
dmutils/logging.py
logging.py
py
4,755
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 14, "usage_type": "call" }, { "api_name": "flask.current_app.logger.log", "line_number": 23, "usage_type": "call" }, { "api_name": "flask.current_app.logger", "line_number": 23, "usage_type": "attribute" }, { "api_...
425280155
import pandas as pd import json, os, time # nation data def get_date(i): y = i[3:7] m = i[7:9] d = i[9:11] return(f'{y}-{m}-{d}') def prase_json(j,dat): l = [] header = ['date'] + list(j['features'][0]['properties'].keys()) for i in range(len(j['features'])): tmp = j['features'][i][...
null
CDC_data/shell/start.py
start.py
py
1,755
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.DataFrame", "line_number": 16, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 19, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 20, "usage_type": "call" }, { "api_name": "json.load", "line_nu...
172434885
import string import pickle import nltk from nltk.sentiment.vader import SentimentIntensityAnalyzer punctuation = list(string.punctuation) numbers = list(string.digits) def saveLexicon(fileName='lexicon'): sia = SentimentIntensityAnalyzer() lexicon = sia.lexicon print("VADER lexicon's size: {}".format(len...
null
examples/Task1 - Sentiment Calculation/vader_lexicon.py
vader_lexicon.py
py
1,127
python
en
code
null
code-starcoder2
66
[ { "api_name": "string.punctuation", "line_number": 6, "usage_type": "attribute" }, { "api_name": "string.digits", "line_number": 7, "usage_type": "attribute" }, { "api_name": "nltk.sentiment.vader.SentimentIntensityAnalyzer", "line_number": 10, "usage_type": "call" }, ...
433036132
from django.core.cache import cache from cache_midware.settings import CACHE_URLS def caching_middleware(get_response): def middleware(request): request_url = request.get_full_path() response = cache.get(request_url) search_url = request_url[ 1:-1] if request_url[-1] == '/' e...
null
cacher/middleware.py
middleware.py
py
762
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.core.cache.cache.get", "line_number": 10, "usage_type": "call" }, { "api_name": "django.core.cache.cache", "line_number": 10, "usage_type": "name" }, { "api_name": "cache_midware.settings.CACHE_URLS", "line_number": 18, "usage_type": "argument" }, ...
192465648
from datetime import datetime import numpy as np import pytz from matplotlib import rcParams from nilmtk import DataSet from sklearn.metrics import classification_report, confusion_matrix, accuracy_score from sklearn.neural_network import MLPClassifier from sklearn.model_selection import cross_val_score from sklearn.d...
null
code/tester.py
tester.py
py
14,728
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.rcParams", "line_number": 28, "usage_type": "name" }, { "api_name": "constants.SAMPLE_PERIOD", "line_number": 31, "usage_type": "attribute" }, { "api_name": "joblib.load", "line_number": 36, "usage_type": "call" }, { "api_name": "joblib.l...
563485674
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from pathlib import Path from collections import OrderedDict def plot_change(vals_first, vals_last, names, plot_title, dir_output, fn_output, y_label): fig, ax = plt.subplots(figsize=(4, 6), dpi=300, facecolor='w', edgeco...
null
common/statistics_plots.py
statistics_plots.py
py
25,791
python
en
code
null
code-starcoder2
66
[ { "api_name": "matplotlib.pyplot.subplots", "line_number": 10, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 10, "usage_type": "name" }, { "api_name": "numpy.zeros", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.ones",...
309878379
import numpy as np from ox import OX class OX_minimax(OX): def __init__(self): super(OX_minimax, self).__init__() def ai_move(self): if np.all(self.board== ' '): super().ai_move() else: score,loc = self.minimax() print('score',score) ...
null
minimax.py
minimax.py
py
1,390
python
en
code
null
code-starcoder2
66
[ { "api_name": "ox.OX", "line_number": 4, "usage_type": "name" }, { "api_name": "numpy.all", "line_number": 8, "usage_type": "call" }, { "api_name": "numpy.sum", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.inf", "line_number": 22, "usage...
528268979
import json import collections import jieba import re titles = [] with open('data/mzitu.json') as f: mzitu = json.load(f) for pretty_type in mzitu: models = pretty_type['models'] for model in models: for item in model: title = item['title'] titles.ap...
null
words_cut.py
words_cut.py
py
1,479
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 9, "usage_type": "call" }, { "api_name": "json.load", "line_number": 18, "usage_type": "call" }, { "api_name": "re.sub", "line_number": 28, "usage_type": "call" }, { "api_name": "jieba.cut", "line_number": 37, "usa...
359952260
from django.core.exceptions import ValidationError from django.db import models from django.db.models import Sum from django.utils.translation import ugettext_lazy as _ from ordered_model.models import OrderedModel, OrderedModelQuerySet from coapp.core.models import OwnedBase, TimeStampedBase from coapp.core.scopes.fi...
null
backend/coapp/palace/focus/models.py
models.py
py
3,281
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.models.QuerySet", "line_number": 13, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 13, "usage_type": "name" }, { "api_name": "coapp.core.models.OwnedBase", "line_number": 19, "usage_type": "name" }, { "api_n...
267561216
from FileEncryption import myEncrypt, myDecrypt from os import urandom, remove from os.path import basename from cryptography.hazmat.primitives import hashes, hmac from cryptography.hazmat.backends import default_backend from cryptography.exceptions import InvalidSignature from constants import KEY_LENGTH, EXT, DOT, ...
null
src/FileEncryption_HMAC.py
FileEncryption_HMAC.py
py
4,476
python
en
code
null
code-starcoder2
66
[ { "api_name": "constants.KEY_LENGTH", "line_number": 14, "usage_type": "name" }, { "api_name": "FileEncryption.myEncrypt", "line_number": 16, "usage_type": "call" }, { "api_name": "cryptography.hazmat.primitives.hmac.HMAC", "line_number": 20, "usage_type": "call" }, {...
213701050
from tkinter import * from PIL import ImageTk, Image from tkinter import font from tkinter import messagebox import pyrebase def view_req(Uid): firebase_config = { "apiKey" : "AIzaSyCvuNFssXW4k1cHifCRH_-KP6IPuxJHzqk", "authDomain" : "financelock-c6ea8.firebaseapp.com", "databaseURL" : "https:/...
null
View_Req_Inves.py
View_Req_Inves.py
py
8,981
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyrebase.initialize_app", "line_number": 20, "usage_type": "call" }, { "api_name": "tkinter.messagebox.showinfo", "line_number": 98, "usage_type": "call" }, { "api_name": "tkinter.messagebox", "line_number": 98, "usage_type": "name" }, { "api_name":...
478234988
# --Function to display menu for EMS -- import csv import pyodbc as odbccon import os from pprint import pprint import pickle # connection to database conn = odbccon.connect("Driver={SQL Server Native Client 11.0};" "Server=LAPTOP-3D1J4GB8;" "Database=ems;" ...
null
practice.py
practice.py
py
3,897
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyodbc.connect", "line_number": 11, "usage_type": "call" }, { "api_name": "csv.reader", "line_number": 143, "usage_type": "call" } ]
574848080
#!/usr/bin/python import sys sys.path.append("/var/www/TapeOpMain/app") from django.core.management import setup_environ from django.utils.encoding import smart_str, force_unicode, smart_unicode import settings setup_environ(settings) from django.db import models from django.db.models import Q import MySQLdb import ti...
null
app/_admin_scripts/newsletter_daemon.py
newsletter_daemon.py
py
6,024
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 3, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 3, "usage_type": "attribute" }, { "api_name": "django.core.management.setup_environ", "line_number": 7, "usage_type": "call" }, { "api_name": "subsc...
326415207
from die import Die from plotly.graph_objs import Bar, Layout from plotly import offline #Create a D6 # die = Die() die_1 = Die() die_2 = Die() #make some rolls and store the result in the list results = [] for roll_num in range(1000): # result = die.roll() result = die_1.roll() + die_2.roll() results.a...
null
Die/die_visual.py
die_visual.py
py
918
python
en
code
null
code-starcoder2
66
[ { "api_name": "die.Die", "line_number": 7, "usage_type": "call" }, { "api_name": "die.Die", "line_number": 8, "usage_type": "call" }, { "api_name": "plotly.graph_objs.Bar", "line_number": 26, "usage_type": "call" }, { "api_name": "plotly.graph_objs.Layout", "l...
49534072
def index(): form = FORM(TABLE(TR(TD("Type of disaster: "), TD(SELECT("Earthquake", "Floods", "Landslides", "Fire", ...
null
controllers/report.py
report.py
py
3,641
python
en
code
null
code-starcoder2
66
[ { "api_name": "gluon.contrib.simplejson.dumps", "line_number": 43, "usage_type": "call" }, { "api_name": "gluon.contrib.simplejson", "line_number": 43, "usage_type": "name" }, { "api_name": "requests.get", "line_number": 60, "usage_type": "call" }, { "api_name": "...
205146274
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import json import shutil import urllib.request from base64 import b64encode sys.path.append(os.getcwd()) from some_stuff.agent_config import AgentConfig class Jenkins: def __init__(self): # Proxy disabler proxy = urllib.reque...
null
some_stuff/jenkins.py
jenkins.py
py
4,235
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 12, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 12, "usage_type": "attribute" }, { "api_name": "os.getcwd", "line_number": 12, "usage_type": "call" }, { "api_name": "urllib.request.request.ProxyH...
61000072
import cv2 image = cv2.imread('/home/zx/桌面/代码/物流检查项目/物流测试图片/cc131425041070131602.jpg') img = cv2.pyrMeanShiftFiltering(image, 25, 10) gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) ret, binary = cv2.threshold(gray,127,255,cv2.THRESH_BINARY) _, contours, _ = cv2.findContours(binary,cv2.RETR_EXTERNAL,cv2.CHAIN...
null
test直线检查.py
test直线检查.py
py
558
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.imread", "line_number": 3, "usage_type": "call" }, { "api_name": "cv2.pyrMeanShiftFiltering", "line_number": 4, "usage_type": "call" }, { "api_name": "cv2.cvtColor", "line_number": 5, "usage_type": "call" }, { "api_name": "cv2.COLOR_BGR2GRAY", ...
196988349
from django.contrib.auth.models import User from django.core.validators import RegexValidator from django.db import models # Create your models here. from django.db.models import Avg from catalogue.models import Content def get_upload_path(instance, filename): return 'avatars/user_{0}/{1}'.format(instance.user.i...
null
userprofiles/models.py
models.py
py
2,933
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.models.Model", "line_number": 14, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 14, "usage_type": "name" }, { "api_name": "django.db.models.OneToOneField", "line_number": 19, "usage_type": "call" }, { "api_n...
338933077
# Copyright 2016: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
null
tests/unit/task/test_trigger.py
test_trigger.py
py
1,915
python
en
code
null
code-starcoder2
66
[ { "api_name": "rally.task.trigger.Trigger", "line_number": 26, "usage_type": "attribute" }, { "api_name": "rally.task.trigger", "line_number": 26, "usage_type": "name" }, { "api_name": "rally.task.trigger.configure", "line_number": 25, "usage_type": "call" }, { "a...
390456336
from typing import Optional from .document_set import DocumentSet from google.protobuf.pyext._message import RepeatedCompositeContainer if False: from ..document import Document class MatchSet(DocumentSet): def __init__(self, docs_proto, reference_doc: 'Document'): super().__init__(docs_proto) ...
null
jina/types/sets/match_set.py
match_set.py
py
1,298
python
en
code
null
code-starcoder2
66
[ { "api_name": "document_set.DocumentSet", "line_number": 11, "usage_type": "name" }, { "api_name": "typing.Optional", "line_number": 16, "usage_type": "name" }, { "api_name": "google.protobuf.pyext._message.RepeatedCompositeContainer", "line_number": 22, "usage_type": "ar...
329409065
from easygui import * import sys import sqlite3 while 1: buttonbox('What do you want to do?', 'Choose what to do', ('Stocktake',\ 'Edit your bar')) conn = sqlite3.connect('mybar.db') c = conn.cursor() n_and_ids = {} title = 'Stocktake'...
null
Stocktake_gui.py
Stocktake_gui.py
py
1,837
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 8, "usage_type": "call" } ]
335456754
# -*- coding: utf-8 -*- """ Created on Sat Jan 16 10:07:41 2021 @author: loai_ """ import pandas as pd import re import json from tqdm import tqdm class regular_exp_matcher(): def reg_ex (self, func_type,reg_ex, data=None, tags=None): if tags==None: tags=['DOCNO', 'TITLE', 'DESCRIPTION', ...
null
reg_ex.py
reg_ex.py
py
1,585
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.loads", "line_number": 18, "usage_type": "call" }, { "api_name": "re.match", "line_number": 26, "usage_type": "call" }, { "api_name": "re.IGNORECASE", "line_number": 26, "usage_type": "attribute" }, { "api_name": "re.search", "line_number":...
499640497
from tbats import TBATS from datetime import date from tsmetrics import tsmetrics import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import pandas as pd from scipy.signal import savgol_filter from pkg.TBATSmod import saveforecast, save_individual_graph #=====================...
null
__main__.py
__main__.py
py
2,093
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_excel", "line_number": 14, "usage_type": "call" }, { "api_name": "tbats.TBATS", "line_number": 21, "usage_type": "call" }, { "api_name": "pkg.TBATSmod.saveforecast", "line_number": 32, "usage_type": "call" }, { "api_name": "pandas.DataFr...
194575359
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from time import sleep, ctime import threading from selenium import webdriver from selenium.webdriver import ChromeOptions def test_baidu(browser, search): print('start %s' % ctime()) print('browser %s' % browser) err_msg = "browser參數有誤: 只能為edge, chrome, ff"...
null
ch10/baidu_thread.py
baidu_thread.py
py
2,218
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.ctime", "line_number": 11, "usage_type": "call" }, { "api_name": "selenium.webdriver.ChromeOptions", "line_number": 15, "usage_type": "call" }, { "api_name": "selenium.webdriver.Edge", "line_number": 19, "usage_type": "call" }, { "api_name": "s...
196633321
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import scipy as sp from scipy import stats from sklearn.linear_model import LinearRegression url = r"C:\Users\HP\Desktop\2020_04_10_Datas_Analysis_python\data\imports-85.data" df = pd.read_csv(url, header = None,na_values="?...
null
scripts/model-eval.py
model-eval.py
py
1,778
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 11, "usage_type": "call" }, { "api_name": "sklearn.linear_model.LinearRegression", "line_number": 26, "usage_type": "call" }, { "api_name": "seaborn.distplot", "line_number": 46, "usage_type": "call" }, { "api_name":...
17979825
# -*- coding: UTF-8 -*- #iptables -D INPUT -s ***.***.***.*** -j DROP 解封ip #iptables -L to view iptables status import sys import os import time from collections import Counter from Mail import SendEmail #Globle params filename = '' visit_limit = '' helps = ['help','h','-help','-h'] def readfile(): file = open(sys...
null
anti-tcp-attack/ata.py
ata.py
py
2,926
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.argv", "line_number": 14, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 19, "usage_type": "attribute" }, { "api_name": "sys.exit", "line_number": 21, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 23...
311697612
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ex_test.settings') import django django.setup() from aplicacion.models import Paciente, Medico, Receta def populate(): # First, we will create lists of dictionaries containing the pages # we want to add into each category. # ...
null
poblar.py
poblar.py
py
1,747
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ.setdefault", "line_number": 2, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 2, "usage_type": "attribute" }, { "api_name": "django.setup", "line_number": 5, "usage_type": "call" }, { "api_name": "aplicacion.models.Med...
467217006
# uncompyle6 version 3.7.4 # Python bytecode 2.5 (62131) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: build/bdist.macosx-10.6-i386/egg/google/protobuf/reflection.py # Compiled at: 2009-12-02 20:07:05 """Contains a metaclass and helper functions used to create pro...
null
pycfiles/bdbdatastore-0.2.2-py2.5/reflection.py
reflection.py
py
49,724
python
en
code
null
code-starcoder2
66
[ { "api_name": "google.protobuf.descriptor.FieldDescriptor", "line_number": 31, "usage_type": "attribute" }, { "api_name": "google.protobuf.descriptor", "line_number": 31, "usage_type": "name" }, { "api_name": "google.protobuf.internal.containers.RepeatedCompositeFieldContainer", ...
392056185
import collections import functools import itertools import operator import numpy from scipy import sparse from .matrix import (normalize, metaedge_to_adjacency_matrix, auto_convert, copy_array) def dwwc_step(matrix, row_damping=0, column_damping=0, cop...
null
hetmech/degree_weight.py
degree_weight.py
py
6,435
python
en
code
null
code-starcoder2
66
[ { "api_name": "matrix.copy_array", "line_number": 42, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 44, "usage_type": "call" }, { "api_name": "matrix.sum", "line_number": 44, "usage_type": "call" }, { "api_name": "numpy.array", "line_numb...
431028337
from django.urls import path, include from . import views urlpatterns = [ path('', views.home , name= 'home'), path('detailblocks/main', views.main, name = 'main'), path('detailblocks/addcomment', views.addcomment, name = 'addcomment'), path('createbid', views.createbid, name = 'createbid'), ]
null
PCHelp/urls.py
urls.py
py
312
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 6, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 8, "usage_type": "call" }, { "api_name": "django.urls.path", ...
86389850
import numpy as np import os import pandas as pd import sqlite3 class Team: """Provides the basis for the programme to characterise any team at any particular point during the league.""" def __init__(self, name, league): # General attributes self.name = name self.league = league ...
null
footballleagues/classes/team.py
team.py
py
13,511
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.nan", "line_number": 14, "usage_type": "attribute" }, { "api_name": "numpy.nan", "line_number": 53, "usage_type": "attribute" }, { "api_name": "numpy.nan", "line_number": 54, "usage_type": "attribute" }, { "api_name": "numpy.nan", "line_nu...
292748395
import json import os import time import requests ''' 以下为蓝胖子的爬虫,哆啦A梦七小子漫画。共计12卷。 来源,动漫之家 16315为哆啦A梦S历险记特别篇的id 36076为第一卷,-36087第12卷 ''' def get_page(juan_id,time_stamp): url='http://v3api.dmzj.com/chapter/16315/{}.json?timestamp={}&channel=Android&_debug=0&version=2.7.019'.format(juan_id,time_stamp) heade...
null
basepro/blue_fat7_spider.py
blue_fat7_spider.py
py
2,304
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 26, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 36, "usage_type": "call" }, { "api_name": "os.path", "line_number": 3...
229465210
import pandas as pd import numpy as np from collections import defaultdict import pyomo.opt import pyomo.environ as pe from scipy.cluster.hierarchy import linkage, fcluster colors = ["0x000000", "0x1CE6FF", "0xFFFF00", "0xFF34FF", "0xFF4A46", "0x008941", "0x006FA6", "0xA30059", "0xFFDBE5", "0x7A4900", "0x000...
null
tsp.py
tsp.py
py
7,895
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.repeat", "line_number": 29, "usage_type": "call" }, { "api_name": "pyomo.opt.opt.SolverFactory", "line_number": 35, "usage_type": "call" }, { "api_name": "pyomo.opt.opt", "line_number": 35, "usage_type": "attribute" }, { "api_name": "pyomo.opt...