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
336965625
from django.db import models from cart.models import Cart from ecommerce.utils import unique_order_id_generator from django.db.models.signals import pre_save, post_save import math from billing.models import BillingProfile ORDER_STATUS_CHOICES = ( ('created', 'Created'), ('paid', 'Paid'), ('shipp...
null
ecommerce/orders/models.py
models.py
py
2,349
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.models.Model", "line_number": 17, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 17, "usage_type": "name" }, { "api_name": "django.db.models.ForeignKey", "line_number": 18, "usage_type": "call" }, { "api_name...
194565886
#!/usr/bin/env python from __future__ import absolute_import, unicode_literals import os import math import urllib3 from retry import retry from concurrent import futures from urllib3 import Timeout from planetutils import download from planetutils import log from planetutils.bbox import validate_bbox def makedirs...
null
planetutils/elevation_tile_downloader.py
elevation_tile_downloader.py
py
5,148
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.makedirs", "line_number": 19, "usage_type": "call" }, { "api_name": "urllib3.Timeout", "line_number": 25, "usage_type": "call" }, { "api_name": "urllib3.PoolManager", "line_number": 26, "usage_type": "call" }, { "api_name": "planetutils.download"...
593197931
from itertools import accumulate import sys import itertools import math import random from copy import deepcopy if len(sys.argv) < 2: print ("you must provide a textfile in system argument") exit(0) def read_file(textfile): f=open(textfile) for i in range(7): f.readline() lines = f.readli...
null
tsp_uniform_cross_over.py
tsp_uniform_cross_over.py
py
5,451
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.argv", "line_number": 10, "usage_type": "attribute" }, { "api_name": "random.uniform", "line_number": 53, "usage_type": "call" }, { "api_name": "math.sqrt", "line_number": 71, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": ...
298343476
try: from flask import Flask, session from flask_session import Session from flask_oidc import OpenIDConnect from flask_wtf.csrf import CSRFProtect from jinja2 import Template except: raise ImportError("Unable to access Flask") from totpshare.config import Config, OIDC_CREATE_SECRETS from totps...
null
totpshare/totpshare.py
totpshare.py
py
1,531
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.session", "line_number": 20, "usage_type": "name" }, { "api_name": "flask.session", "line_number": 23, "usage_type": "name" }, { "api_name": "flask.Flask", "line_number": 27, "usage_type": "call" }, { "api_name": "totpshare.config.Config", ...
471481356
# -*- coding: utf-8 -*- from __future__ import unicode_literals from rest_framework.response import Response from rest_framework.decorators import api_view @api_view(["GET"]) def root(request): """ Retrieve all endpoints that are implemented """ data = { "status": True, "result": [ "/", "/meta/heartbe...
null
src/service/encrypted/encrypted/views.py
views.py
py
536
python
en
code
null
code-starcoder2
66
[ { "api_name": "rest_framework.response.Response", "line_number": 30, "usage_type": "call" }, { "api_name": "rest_framework.decorators.api_view", "line_number": 8, "usage_type": "call" } ]
343083774
""" Extract objects """ import pandas as pd import json import pymongo from pymongo import MongoClient import os import logging logging.basicConfig(format='%(levelname)s :: %(asctime)s :: %(message)s', level=logging.DEBUG) import time import io from PIL import Image import re from joblib import Parallel, delayed import...
null
services/extract_objs/src/extract.py
extract.py
py
4,937
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.basicConfig", "line_number": 10, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 10, "usage_type": "attribute" }, { "api_name": "re.compile", "line_number": 47, "usage_type": "call" }, { "api_name": "pandas.DataFrame", ...
634661231
import configparser import os HOME = os.path.expanduser('~') SETTINGS_FILE = os.path.join(HOME, ".tgl") app_settings = { "api_url": "https://www.toggl.com/api/v8", "reports_url": "https://www.toggl.com/reports/v2" } def load_settings(): parser = configparser.ConfigParser() parser.read(SETTINGS_FILE)...
null
app/conf.py
conf.py
py
495
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.expanduser", "line_number": 5, "usage_type": "call" }, { "api_name": "os.path", "line_number": 5, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 6, "usage_type": "call" }, { "api_name": "os.path", "line_number"...
179126634
from typing import Any import pytorch_lightning as pl import torch from torch import nn from torch import optim from torch.optim import lr_scheduler from libs.graphs.cnn import * from libs.graphs.mlp import * from utils.init_weight import init_model class ImageClassifier(pl.LightningModule): def __init__(self, ...
null
agents/img_classifier.py
img_classifier.py
py
2,721
python
en
code
null
code-starcoder2
66
[ { "api_name": "pytorch_lightning.LightningModule", "line_number": 14, "usage_type": "attribute" }, { "api_name": "typing.Any", "line_number": 15, "usage_type": "name" }, { "api_name": "torch.nn", "line_number": 21, "usage_type": "argument" }, { "api_name": "utils....
81241428
# encoding: UTF-8 """Library for running an EPICS-based virtual accelertor using IMPACT particle tracker.""" from __future__ import print_function __copyright__ = "Copyright (c) 2015, Facility for Rare Isotope Beams" __author__ = "Dylan Maxwell" import os.path, tempfile, random, shutil, numpy, re import subprocess...
null
phyutil/machine/frib/virtaccel/impact.py
impact.py
py
41,549
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 52, "usage_type": "call" }, { "api_name": "phylib.layout.accel.SeqElement", "line_number": 135, "usage_type": "argument" }, { "api_name": "phylib.cfg.Configuration", "line_number": 168, "usage_type": "argument" }, { ...
596726026
# Copyright 2017 Google 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 by applicable law or a...
null
upvote/gae/datastore/models/santa_test.py
santa_test.py
py
14,957
python
en
code
null
code-starcoder2
66
[ { "api_name": "upvote.gae.lib.testing.basetest.UpvoteTestCase", "line_number": 32, "usage_type": "attribute" }, { "api_name": "upvote.gae.lib.testing.basetest", "line_number": 32, "usage_type": "name" }, { "api_name": "upvote.gae.datastore.models.santa.SantaBlockable", "line_...
365734379
import subprocess from os import makedirs from os.path import exists from os.path import join from subprocess import call from requests import get from faasmcli.util.env import FAASM_HOME def download_proj(url, filename, extension="tar.gz", tar_args="-xf", extract_file=None): if not exists(FAASM_HOME): ...
null
faasmcli/faasmcli/util/download.py
download.py
py
1,439
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.exists", "line_number": 13, "usage_type": "call" }, { "api_name": "faasmcli.util.env.FAASM_HOME", "line_number": 13, "usage_type": "argument" }, { "api_name": "os.makedirs", "line_number": 14, "usage_type": "call" }, { "api_name": "faasmcli....
195964035
import collections class A(collections.Iterable): pass import bisect class SortedItems(collections.Sequence): def __init__(self, initial=None): self._items = sorted(initial) if initial is not None else [] # Required sequence methods def __getitem__(self, index): return self....
null
python/cookbook/classes_objects/custom_containers.py
custom_containers.py
py
1,196
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.Iterable", "line_number": 3, "usage_type": "attribute" }, { "api_name": "collections.Sequence", "line_number": 7, "usage_type": "attribute" }, { "api_name": "bisect.insort", "line_number": 20, "usage_type": "call" }, { "api_name": "colle...
153202480
from flask import render_template, flash, redirect, url_for, request from app import app from app.forms import CalculatorForm from app import db #RONALD BALCHAND #109806273 #ROUTES @app.route('/') @app.route('/index', methods=['GET', 'POST'])#form starts on index page def index(): form=CalculatorForm() ...
null
CSE337/HW4/q2/app/routes.py
routes.py
py
2,451
python
en
code
null
code-starcoder2
66
[ { "api_name": "app.forms.CalculatorForm", "line_number": 12, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 20, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 25, "usage_type": "call" }, { "api_name": "...
387591283
from scipy import signal import numpy as np from math import pi import matplotlib.pyplot as plt from scipy.io import wavfile import params def autocorr(x): result = np.correlate(x, x, mode='full') return result[int(result.size/2):] filenames = params.filenames for filename in filenames: samp_rate, y...
null
assignment_3/q3/q3.py
q3.py
py
2,280
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.correlate", "line_number": 9, "usage_type": "call" }, { "api_name": "params.filenames", "line_number": 13, "usage_type": "attribute" }, { "api_name": "scipy.io.wavfile.read", "line_number": 16, "usage_type": "call" }, { "api_name": "scipy.io.w...
350898033
# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
null
awscli/customizations/s3/filters.py
filters.py
py
4,700
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 20, "usage_type": "call" }, { "api_name": "awscli.customizations.s3.utils.split_s3_bucket_key", "line_number": 37, "usage_type": "call" }, { "api_name": "os.path.abspath", "line_number": 40, "usage_type": "call" }, { ...
358047459
"""empty message Revision ID: c822e5117017 Revises: 6a90282e65e3 Create Date: 2018-03-21 11:25:02.374389 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'c822e5117017' down_revision = '6a90282e65e3' branch_labels = None depends_on = None def upgrade(): # ...
null
migrations/versions/c822e5117017_.py
c822e5117017_.py
py
935
python
en
code
null
code-starcoder2
66
[ { "api_name": "alembic.op.batch_alter_table", "line_number": 21, "usage_type": "call" }, { "api_name": "alembic.op", "line_number": 21, "usage_type": "name" }, { "api_name": "sqlalchemy.Column", "line_number": 22, "usage_type": "call" }, { "api_name": "sqlalchemy....
72641737
#!/usr/bin/env python # -*- coding:utf-8 -*- """ @version: 1.0.0 @author: xlliu @contact: liu.xuelong@163.com @site: https://github.com/xlliu @software: PyCharm @file: conn.py @time: 2016/7/29 10:59 """ from sqlalchemy import create_engine class Conn(object): """ mysql connection "...
null
com/analysis/utils/conn.py
conn.py
py
1,077
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.create_engine", "line_number": 41, "usage_type": "call" } ]
269753110
from typing import Dict, List, Any, Union, Optional, IO import networkx as nx from nereid.core.cache import cache_decorator from nereid.src.network import validate from nereid.src.network.utils import graph_factory, thin_graph_dict from nereid.src.network.algorithms import get_subset, parallel_sequential_subgraph_nod...
null
nereid/nereid/src/network/tasks.py
tasks.py
py
3,205
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.Dict", "line_number": 16, "usage_type": "name" }, { "api_name": "nereid.src.network.utils.thin_graph_dict", "line_number": 18, "usage_type": "call" }, { "api_name": "nereid.src.network.utils.graph_factory", "line_number": 19, "usage_type": "call" }...
599279090
""" Saves DataFrame containing celebrity information scraped from usmagazine.com. """ from bs4 import BeautifulSoup import pandas as pd import requests SAVE_PATH = '../celebs.csv' df = pd.DataFrame(columns=['name', 'url']) ##################################################################### # Make HTTP request mo...
null
data/code/scrape_celebs.py
scrape_celebs.py
py
1,636
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.DataFrame", "line_number": 11, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 26, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 27, "usage_type": "call" } ]
220825390
import gdal import numpy def get_count_equel(tif_path,chislo,ker): raster=gdal.Open(tif_path) xsize=raster.RasterXSize ysize=raster.RasterYSize s=0 #print(xsize*ysize) for i in range(0,xsize,ker): for j in range(0,ysize,ker): if i+ker>=xsize: ker_realx=ker-...
null
SOURCE_FOLDER/ldncalc/count.py
count.py
py
1,027
python
en
code
null
code-starcoder2
66
[ { "api_name": "gdal.Open", "line_number": 5, "usage_type": "call" }, { "api_name": "numpy.float32", "line_number": 21, "usage_type": "attribute" }, { "api_name": "numpy.sum", "line_number": 23, "usage_type": "call" } ]
416518971
"""magicgui is a utility for generating a GUI from a python function.""" from importlib.metadata import PackageNotFoundError, version from typing import Any try: __version__ = version("magicgui") except PackageNotFoundError: # pragma: no cover __version__ = "uninstalled" __author__ = """Talley Lambert""" __e...
null
src/magicgui/__init__.py
__init__.py
py
1,082
python
en
code
null
code-starcoder2
66
[ { "api_name": "importlib.metadata.version", "line_number": 6, "usage_type": "call" }, { "api_name": "importlib.metadata.PackageNotFoundError", "line_number": 7, "usage_type": "name" }, { "api_name": "warnings.warn", "line_number": 34, "usage_type": "call" }, { "ap...
612198689
#!/usr/bin/env python # # 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
logtools/join_backends.py
join_backends.py
py
17,872
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.orm.declarative_base", "line_number": 57, "usage_type": "call" }, { "api_name": "sys.stderr", "line_number": 66, "usage_type": "attribute" }, { "api_name": "abc.ABCMeta", "line_number": 79, "usage_type": "name" }, { "api_name": "abc.abstr...
362518843
""" Plotting stuff! """ from typing import Union import pandas as pd import altair as alt def hist(df: Union[pd.DataFrame, pd.Series], varname: str = None): """Plot a histogram.""" if isinstance(df, pd.Series): assert df.index.name != '', "Series should have a name!" varname = df.name ...
null
data_science_tools/plot.py
plot.py
py
493
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.Union", "line_number": 10, "usage_type": "name" }, { "api_name": "pandas.DataFrame", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pandas.Series", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pandas.Series",...
295808230
#!/usr/bin/python import sys import numpy as np import cv2 import time if len(sys.argv) < 5: print( "Usage: capture <# frames to OR> <file output prefix> <number of files> <float sec delay>") exit() list_of_frames = [] frame_number = 1 sleepy_time = float(sys.argv[4]) cap = cv2.VideoCapture('/dev/video0') #I...
null
test/capture.py
capture.py
py
1,207
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.argv", "line_number": 7, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_number": 13, "usage_type": "attribute" }, { "api_name": "cv2.VideoCapture", "line_number": 15, "usage_type": "call" }, { "api_name": "sys.argv", "line_numb...
138289658
"""Creates the sequence file using a split. The output are two files with the sequences and labels sequence_lenght element1 element2 ... label1 label2 ... """ from __future__ import absolute_import import argparse import numpy as np import pandas import pickle import os from tqdm import tqdm SEPARATOR =...
null
preprocess_scripts/for_third_party/02_create_sequences.py
02_create_sequences.py
py
4,535
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.random.choice", "line_number": 57, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 57, "usage_type": "attribute" }, { "api_name": "numpy.a...
578245501
from jinja2 import Template import FinancialAnalysis import date import time def makepage(code): data = FinancialAnalysis.Data(code) # make time web string time_list = data.time time = "" for time_temp in time_list: time += "<th >" time += time_temp time += "<...
null
Website/page.py
page.py
py
3,187
python
en
code
null
code-starcoder2
66
[ { "api_name": "FinancialAnalysis.Data", "line_number": 7, "usage_type": "call" }, { "api_name": "date.DateData", "line_number": 24, "usage_type": "call" }, { "api_name": "jinja2.Template", "line_number": 82, "usage_type": "call" }, { "api_name": "time.ctime", ...
488018624
import curses import queue import threading import wchar import config import debug class Input(queue.Queue): def __init__(self, ui): super().__init__(0) self.ui = ui self.commands = self.ui.commands self.keys = self.commands.keys self.actions = self.__init_action...
null
inp.py
inp.py
py
2,871
python
en
code
null
code-starcoder2
66
[ { "api_name": "queue.Queue", "line_number": 10, "usage_type": "attribute" }, { "api_name": "threading.Thread", "line_number": 18, "usage_type": "call" }, { "api_name": "config.UP", "line_number": 25, "usage_type": "attribute" }, { "api_name": "config.DOWN", "l...
573797587
""" Determine the gender of a person based on Name. This program uses the Random Forest Classifier. """ import collections from nltk.corpus import names #You won't need this, I'll provide the files import random import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy...
null
all_features.py
all_features.py
py
5,877
python
en
code
null
code-starcoder2
66
[ { "api_name": "nltk.corpus.names.words", "line_number": 13, "usage_type": "call" }, { "api_name": "nltk.corpus.names", "line_number": 13, "usage_type": "name" }, { "api_name": "nltk.corpus.names.words", "line_number": 14, "usage_type": "call" }, { "api_name": "nlt...
531689768
# # This is just a simple interface to the winsspi library to support Kerberos # Will only work on windows, ovbiously # # # from msldap.authentication.spnego.asn1_structs import KRB5Token from winsspi.sspi import KerberosSMBSSPI from winsspi.common.function_defs import ISC_REQ from minikerberos.gssapi.gssapi import g...
null
msldap/authentication/kerberos/sspi.py
sspi.py
py
2,561
python
en
code
null
code-starcoder2
66
[ { "api_name": "winsspi.sspi.KerberosSMBSSPI", "line_number": 20, "usage_type": "call" }, { "api_name": "winsspi.common.function_defs.ISC_REQ.CONFIDENTIALITY", "line_number": 46, "usage_type": "attribute" }, { "api_name": "winsspi.common.function_defs.ISC_REQ", "line_number": ...
250561364
#!user/bin/env/python #-*-coding:utf-8-*- # author: albert time:2019/8/21 from django.urls import path from . import views app_name = 'polls' urlpatterns = [ #url连接视图 #ex:/polls/ path('',views.IndexView.as_view(),name='index'), #login # path('login/',views.LoginView.as_view(),name = 'login'), p...
null
Django/HelloWorld/polls/urls.py
urls.py
py
739
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 11, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 14, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 15, "usage_type": "call" }, { "api_name": "django.urls.path",...
14070432
# coding: utf-8 """Train the original network using a feed dictionary.""" import tensorflow as tf import time import os.path import original_cnn as oc import cnn_deconv as cd import data_preprocess_pos as dp import numpy as np import math import scipy.io as sio from data_config import * # Basic model parameters as ex...
null
tf_try/PPR/train.py
train.py
py
13,895
python
en
code
null
code-starcoder2
66
[ { "api_name": "tensorflow.app", "line_number": 16, "usage_type": "attribute" }, { "api_name": "tensorflow.placeholder", "line_number": 41, "usage_type": "call" }, { "api_name": "tensorflow.float32", "line_number": 41, "usage_type": "attribute" }, { "api_name": "te...
35271454
from __future__ import print_function # Python 2/3 compatibility import boto3 import json import decimal AWS_KEY = '****' AWS_SECRET = '****' def handler(event, context): dynamodb = boto3.resource('dynamodb', region_name='us-west-2', aws_access_key_id=AWS_KEY , aws_secret_access_key=AWS_SECRET) table = dynamo...
null
post-order/post-order.py
post-order.py
py
948
python
en
code
null
code-starcoder2
66
[ { "api_name": "boto3.resource", "line_number": 10, "usage_type": "call" } ]
562579896
from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse from .models import NetworkList, AddSubList, NewExposure from .forms import NetListForm, AddSubListForm, NewExpForm # Create your views here. def index(request): """Home page""" return HttpResponse("<h1>Hi! You are at...
null
myProject/transections/views.py
views.py
py
2,330
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.http.HttpResponse", "line_number": 11, "usage_type": "call" }, { "api_name": "models.AddSubList.objects.all", "line_number": 15, "usage_type": "call" }, { "api_name": "models.AddSubList.objects", "line_number": 15, "usage_type": "attribute" }, { ...
393421651
#!/usr/bin/env python import openpyxl """ Goes through the production plan excel sheet and returns a list of products""" def load_production_plan(): more_products = True incrementer = 3 production_list = [] # Adds all the cells that have a value to the production list while more_products: ...
null
scripts/loadProductionSchedule.py
loadProductionSchedule.py
py
1,164
python
en
code
null
code-starcoder2
66
[ { "api_name": "openpyxl.load_workbook", "line_number": 23, "usage_type": "call" } ]
94423536
from django.shortcuts import render, redirect from datetime import datetime from student.models import Student def get_session_details(grad_year): grad_year = int(grad_year) current_month = int(datetime.now().strftime('%m')) current_year = int(datetime.now().strftime('%Y')) current_session = 'Summer...
null
student/views.py
views.py
py
2,326
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime.now", "line_number": 9, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 9, "usage_type": "name" }, { "api_name": "datetime.datetime.now", "line_number": 10, "usage_type": "call" }, { "api_name": "datetime....
256574300
"""Mongo DB class to import the CSV data and to display the data""" import csv import time import os import pymongo from pymongo import MongoClient from line_profiler import LineProfiler import atexit import multiprocessing from multiprocessing.pool import ThreadPool import threading profile = LineProfiler() atexit.reg...
null
students/g_rama/lesson07/src/parllelthread.py
parllelthread.py
py
4,975
python
en
code
null
code-starcoder2
66
[ { "api_name": "line_profiler.LineProfiler", "line_number": 12, "usage_type": "call" }, { "api_name": "atexit.register", "line_number": 13, "usage_type": "call" }, { "api_name": "pymongo.MongoClient", "line_number": 27, "usage_type": "call" }, { "api_name": "multip...
410169380
""" This module contains application middlewares """ from starlette.requests import Request from starlette.authentication import AuthenticationBackend, AuthenticationError, \ SimpleUser, UnauthenticatedUser, AuthCredentials from starlette.middleware.base import BaseHTTPMiddleware from starlette.requests import Req...
null
app/middlewares.py
middlewares.py
py
4,398
python
en
code
null
code-starcoder2
66
[ { "api_name": "starlette.middleware.base.BaseHTTPMiddleware", "line_number": 15, "usage_type": "name" }, { "api_name": "starlette.requests.Request", "line_number": 22, "usage_type": "name" }, { "api_name": "starlette.responses.Response", "line_number": 22, "usage_type": "...
63508551
import logging import urllib import urllib2 from bs4 import BeautifulSoup from youtube_search.engine import utils class YouTube: """ Enables support for YouTube search """ YOUTUBE_URL = 'https://www.youtube.com' YOUTUBE_QUERY = YOUTUBE_URL + '/results?search_query=' def __init__(self): ...
null
youtube/youtube_search/engine/youtube.py
youtube.py
py
1,573
python
en
code
null
code-starcoder2
66
[ { "api_name": "urllib.quote", "line_number": 32, "usage_type": "call" }, { "api_name": "urllib2.urlopen", "line_number": 34, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 36, "usage_type": "call" }, { "api_name": "youtube_search.engine....
351205733
#!/usr/bin/python # (c) 2020, Lucas Basquerotto # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # pylint: disable=missing-module-docstring # pylint: disable=missing-function-docstring # pylint: disable=import-error # pylint: disable=broad-except from __future__ import abs...
null
collection/plugins/modules/vars.py
vars.py
py
2,071
python
en
code
null
code-starcoder2
66
[ { "api_name": "ansible.module_utils.basic.AnsibleModule", "line_number": 34, "usage_type": "call" }, { "api_name": "ansible_collections.lrd.ext_cloud.plugins.module_utils.s3.prepare_data", "line_number": 51, "usage_type": "call" }, { "api_name": "ansible_collections.lrd.ext_cloud...
329126558
import time import schedule import holiday as holiday, DingDing as Ding import configparser import check_holiday import random import datetime config = configparser.ConfigParser(allow_no_value=False) config.read("dingding.cfg",encoding='utf-8') directory = config.get("ADB","directory") gowork_time=config.get("time","g...
null
test_timer.py
test_timer.py
py
2,407
python
en
code
null
code-starcoder2
66
[ { "api_name": "configparser.ConfigParser", "line_number": 9, "usage_type": "call" }, { "api_name": "time.time", "line_number": 16, "usage_type": "call" }, { "api_name": "time.localtime", "line_number": 17, "usage_type": "call" }, { "api_name": "check_holiday.check...
619673214
"ICECREAM" from sqlalchemy import Column, Integer, String, ForeignKey, Boolean, Numeric, Table, Date from sqlalchemy.orm import relationship, backref from ICECREAM.db_initializer import Base ######### simple table tutorial ############# class Product(Base): __tablename__ = 'product' id = Column(Integer,...
null
app_tutorial/models.py
models.py
py
2,414
python
en
code
null
code-starcoder2
66
[ { "api_name": "ICECREAM.db_initializer.Base", "line_number": 9, "usage_type": "name" }, { "api_name": "sqlalchemy.Column", "line_number": 11, "usage_type": "call" }, { "api_name": "sqlalchemy.Integer", "line_number": 11, "usage_type": "argument" }, { "api_name": "...
41527786
from __future__ import absolute_import from __future__ import print_function from select import select import termios import os import sys import optparse import subprocess import random import time #import cv2 import curses #import readscreen3 import numpy as np import pandas as pd import datetime from time import tim...
null
single_intection_lane4/testLane4.py
testLane4.py
py
17,889
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ", "line_number": 29, "usage_type": "attribute" }, { "api_name": "optparse.OptionParser", "line_number": 33, "usage_type": "call" }, { "api_name": "random.sample", "line_number": 44, "usage_type": "call" }, { "api_name": "sys.path.append",...
440893830
# -*- coding: utf-8 -*- # Copyright European Organization for Nuclear Research (CERN) since 2012 # # 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-...
null
lib/rucio/core/topology.py
topology.py
py
15,197
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.TYPE_CHECKING", "line_number": 34, "usage_type": "name" }, { "api_name": "typing.Callable", "line_number": 38, "usage_type": "name" }, { "api_name": "typing.Any", "line_number": 38, "usage_type": "name" }, { "api_name": "rucio.common.cache.ma...
248746102
import glob import json import os import sys from xml.etree.ElementTree import Element, SubElement import ast from lxml import etree import numpy as np from skimage.draw import polygon_perimeter from skimage.io import imread, imsave from skimage.morphology import dilation from xml.etree import ElementTree from unet.da...
null
unettrainer.py
unettrainer.py
py
3,088
python
en
code
null
code-starcoder2
66
[ { "api_name": "glob.glob", "line_number": 27, "usage_type": "call" }, { "api_name": "lxml.etree.XMLParser", "line_number": 29, "usage_type": "call" }, { "api_name": "lxml.etree", "line_number": 29, "usage_type": "name" }, { "api_name": "os.path.exists", "line_...
376495879
#!/usr/bin/env python import numpy as np import rospy import itertools import time from vicon_bridge.msg import Marker, Markers def data_key(string): return string.split(":")[1].strip() def key_str(string): return data_key(string).replace('"', "") def parse_markers(string): markers = [] for mark...
null
scripts/fakeVicon.py
fakeVicon.py
py
2,853
python
en
code
null
code-starcoder2
66
[ { "api_name": "vicon_bridge.msg.Marker", "line_number": 22, "usage_type": "call" }, { "api_name": "vicon_bridge.msg.Markers", "line_number": 61, "usage_type": "call" }, { "api_name": "itertools.cycle", "line_number": 62, "usage_type": "call" }, { "api_name": "iter...
259799605
# coding=utf-8 import codecs import torch import numpy as np #import cPickle from utils import constant import time import argparse from os.path import join np.random.seed(188) GLOVE_PATH = "/research/king3/hpchan/datasets/glove_6B/glove.6B.300d.txt" class PreProcess(object): """ preprosess for sick data ...
null
preprocess_amazon.py
preprocess_amazon.py
py
7,535
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.random.seed", "line_number": 11, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 11, "usage_type": "attribute" }, { "api_name": "torch.manual_seed", "line_number": 43, "usage_type": "call" }, { "api_name": "codecs.open", ...
220427290
"""Module for reading and writing messages to queues between ccaas parts""" import boto.sqs from boto.sqs.message import Message from shared.ccaas_config import config def send_message(queue,message): """sends a message to a queue""" sqs = boto.sqs.connect_to_region(config['aws_region'], aw...
null
shared/messaging.py
messaging.py
py
565
python
en
code
null
code-starcoder2
66
[ { "api_name": "boto.sqs.sqs.connect_to_region", "line_number": 8, "usage_type": "call" }, { "api_name": "boto.sqs.sqs", "line_number": 8, "usage_type": "attribute" }, { "api_name": "boto.sqs", "line_number": 8, "usage_type": "name" }, { "api_name": "shared.ccaas_c...
162383214
# Agilent_E8267D.py class, to perform the communication between the Wrapper and the device # Pieter de Groot <pieterdegroot@gmail.com>, 2008 # Martijn Schaafsma <qtlab@mcschaafsma.nl>, 2008 # Sam Hile <samhile@gmail.com>, 2014 # # This program is free software; you can redistribute it and/or modify # it under the terms...
null
bilby/instrument_plugins/x_Agilent_E8267D.py
x_Agilent_E8267D.py
py
21,402
python
en
code
null
code-starcoder2
66
[ { "api_name": "instrument.Instrument", "line_number": 26, "usage_type": "name" }, { "api_name": "logging.info", "line_number": 44, "usage_type": "call" }, { "api_name": "instrument.Instrument.__init__", "line_number": 45, "usage_type": "call" }, { "api_name": "ins...
436273762
from __future__ import absolute_import, unicode_literals from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.http.response import HttpResponse from django.views.static import serve as...
null
project/wikiproject/urls.py
urls.py
py
1,282
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.contrib.admin.autodiscover", "line_number": 10, "usage_type": "call" }, { "api_name": "django.contrib.admin", "line_number": 10, "usage_type": "name" }, { "api_name": "django.conf.urls.url", "line_number": 13, "usage_type": "call" }, { "api_n...
293769800
#!/usr/bin/env python # coding: utf-8 # In[222]: import pymysql import pandas as pd con = pymysql.Connect( host='120.79.36.32', port=3306, user='www_802k_cn', password='ksxGX8QfWipYte5z', db='www_802k_cn', charset='utf8' ) sql = "select * from dd_user" df = pd.read_sql(sql,con) from pandas...
null
novel_analysis/new_fans_trend .py
new_fans_trend .py
py
1,360
python
en
code
null
code-starcoder2
66
[ { "api_name": "pymysql.Connect", "line_number": 9, "usage_type": "call" }, { "api_name": "pandas.read_sql", "line_number": 18, "usage_type": "call" }, { "api_name": "time.localtime", "line_number": 43, "usage_type": "call" }, { "api_name": "time.strftime", "li...
131864781
""" This file contains all global variables """ import pygame # initialize pygame pygame.init() pygame.display.set_caption("Music Theory RPG") FPSclock = pygame.time.Clock() # display screen values SCREENX = 1275 SCREENY = 750 MENUTOP = SCREENY - 75 SCREEN = pygame.display.set_mode((SCREENX, SCREENY))
null
code/config.py
config.py
py
307
python
en
code
null
code-starcoder2
66
[ { "api_name": "pygame.init", "line_number": 8, "usage_type": "call" }, { "api_name": "pygame.display.set_caption", "line_number": 9, "usage_type": "call" }, { "api_name": "pygame.display", "line_number": 9, "usage_type": "attribute" }, { "api_name": "pygame.time.C...
166661877
import argparse from src.functions import * def main(): """Main module checks the arguments passed by the user and adds as an exclusion rule the simultaneous use of encoding and decoding arguments """ parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group() g...
null
base64codec.py
base64codec.py
py
1,981
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 12, "usage_type": "call" } ]
585260339
# !/usr/bin/env python # -*- coding:utf-8 -*- # author;鸿 import requests as r import re import time import os '''请求响应''' url = 'https://www.vmgirls.com/12353.html' headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36' } respon...
null
阶段一/爬虫实战.py
爬虫实战.py
py
847
python
en
code
null
code-starcoder2
66
[ { "api_name": "requests.get", "line_number": 13, "usage_type": "call" }, { "api_name": "re.findall", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_number": 1...
269640400
import numpy as np import torch import multiprocessing import threading import models import gym import torch.multiprocessing as mp from a3c_agent_continues import A3C_Workers torch.set_default_tensor_type('torch.DoubleTensor') if __name__ == '__main__': env_name = 'Pendulum-v0' save_path = 'saved_models/Pend...
null
a3c/train_network_continues.py
train_network_continues.py
py
1,425
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.set_default_tensor_type", "line_number": 10, "usage_type": "call" }, { "api_name": "multiprocessing.cpu_count", "line_number": 16, "usage_type": "call" }, { "api_name": "gym.make", "line_number": 18, "usage_type": "call" }, { "api_name": "mode...
325436047
import os from datasets import get_dataset import argparse import torch import torch.nn as nn import numpy as np import time import GPUtil from tools.build_network import get_net_by_name from ann2snn import trans_ann2snn import matplotlib.pyplot as plt import seaborn as sns from validation import validate_ann,validate_...
null
analyse_error.py
analyse_error.py
py
3,055
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.argmin", "line_number": 17, "usage_type": "call" }, { "api_name": "GPUtil.getGPUs", "line_number": 17, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 19, "usage_type": "attribute" }, { "api_name": "argparse.ArgumentParser",...
607658252
import sys from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtGui import QPainter from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import * from PyQt5.QtCore import * windowSizeX = 440 windowSizeY = 250 userName = 'Aperture' fontMajor = "Arial" fontMinor = "Dotum" class Form(QWidget): ...
null
QT/GUI_Privasee_PasswordToRegister.py
GUI_Privasee_PasswordToRegister.py
py
2,432
python
en
code
null
code-starcoder2
66
[ { "api_name": "PyQt5.QtGui.QFont", "line_number": 26, "usage_type": "call" }, { "api_name": "PyQt5.QtGui", "line_number": 26, "usage_type": "name" }, { "api_name": "PyQt5.QtGui.QFont", "line_number": 32, "usage_type": "call" }, { "api_name": "PyQt5.QtGui", "li...
343422244
from matplotlib import pyplot from matplotlib import rc import numpy as np from scipy.integrate import quad np.seterr(all = 'ignore') #rc('font', **{'family': 'sans-serif', 'sans-serif':['Helvetica']}) #rc('text', usetex = True) h = 6.626e-34 c = 3.0e+8 k = 1.38e-23 sol_rad = 6.957e+8 pars = 3.086e+16 def generate...
null
black_body.py
black_body.py
py
2,274
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.seterr", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.pi", "line_number": 20, "usage_type": "attribute" }, { "api_name": "numpy.exp", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.arange", "line_number":...
568454
import numpy as np import cv2 import soundfile as sf from tqdm import tqdm import os class CFG: n_mels = 256 fmin = 20 fmax = 16000 n_fft = 2048 hop_length = 2048 sample_rate = 32000 img_size = 512 def mono_to_color( X: np.ndarray, mean=None, std=None, norm_max=None, norm_min=No...
null
code/mangguo/audio2melspectrogram.py
audio2melspectrogram.py
py
2,144
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.ndarray", "line_number": 20, "usage_type": "attribute" }, { "api_name": "numpy.stack", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.uint8", "line_number": 40, "usage_type": "attribute" }, { "api_name": "numpy.zeros_like", ...
579924018
# 가장 잘 나온 전이학습모델로 # 이 데이터를 학습시켜서 결과치 도출 # keras 59번과의 성능 비교 import numpy as np from tensorflow.keras.datasets import cifar100 from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Conv2D, Flatten, MaxPooling2D, Conv1D, Dropout, GlobalAveragePooling2D from sklearn.model_selection im...
null
keras2/keras73_1_men_women.py
keras73_1_men_women.py
py
2,593
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.load", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.load", "line_number": 17, "usage_type": "call" }, { "api_name": "numpy.load", "line_number": 18, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_s...
215018590
# -*- coding:utf-8 -*- import logging from os import path from django.http import HttpResponse class AuthenticationMiddleware(object): def process_request(self, request): if request.path.startswith('/docs'): logging.info('> ' + request.path) content_types = { '': ...
null
plugins/auth/middleware.py
middleware.py
py
1,105
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.info", "line_number": 12, "usage_type": "call" }, { "api_name": "django.http.HttpResponse", "line_number": 24, "usage_type": "call" }, { "api_name": "os.path.splitext", "line_number": 25, "usage_type": "call" }, { "api_name": "os.path", ...
321387069
import bpy from bpy_extras.node_shader_utils import PrincipledBSDFWrapper from bpy_extras.image_utils import load_image def setMaterial(ob, mat, debug=False): if ob.data.materials: # assign to 1st material slot ob.data.materials[0] = mat if debug: print("Set material fo...
null
materialUtils.py
materialUtils.py
py
2,223
python
en
code
null
code-starcoder2
66
[ { "api_name": "bpy.data.materials.new", "line_number": 17, "usage_type": "call" }, { "api_name": "bpy.data", "line_number": 17, "usage_type": "attribute" }, { "api_name": "bpy_extras.node_shader_utils.PrincipledBSDFWrapper", "line_number": 19, "usage_type": "call" }, ...
356769390
import bs4 import requests from bs4 import BeautifulSoup as soup import sqlite3 from urllib2 import urlopen as uReq from bs4 import BeautifulSoup as soup import re import sys reload(sys) sys.setdefaultencoding('utf8') #list of URLs to scrape from my_url = ['https://magicseaweed.com/Narragansett-Beach-Surf-Report/1103/...
null
0Snapshot_Works.py
0Snapshot_Works.py
py
2,927
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.setdefaultencoding", "line_number": 10, "usage_type": "call" }, { "api_name": "urllib2.urlopen", "line_number": 29, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 37, "usage_type": "call" }, { "api_name": "re.compile",...
625504768
#author:lixiangyang import tensorflow as tf import os from sklearn import datasets from matplotlib import pyplot as plt import numpy as np os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 只显示error,不显示其他信息 def normalize(train): # 线性归一化 x_data = train.T for i in range(4): x_data[i] = (x_data[i] - tf.red...
null
第三次签到作业/adadelta.py
adadelta.py
py
6,173
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ", "line_number": 8, "usage_type": "attribute" }, { "api_name": "tensorflow.reduce_min", "line_number": 15, "usage_type": "call" }, { "api_name": "tensorflow.reduce_max", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.log1...
73548852
import pytest from eth_tester.exceptions import TransactionFailed from raiden_contracts.utils.config import E_TRANSFER_UPDATED, CHANNEL_STATE_CLOSED from raiden_contracts.utils.events import check_transfer_updated from .fixtures.config import fake_bytes def test_update_channel_state( token_network, cr...
null
raiden_contracts/tests/test_channel_update_transfer.py
test_channel_update_transfer.py
py
3,988
python
en
code
null
code-starcoder2
66
[ { "api_name": "fixtures.config.fake_bytes", "line_number": 22, "usage_type": "call" }, { "api_name": "fixtures.config.fake_bytes", "line_number": 23, "usage_type": "call" }, { "api_name": "raiden_contracts.utils.config.CHANNEL_STATE_CLOSED", "line_number": 40, "usage_type...
631286031
""" 线性回归模型 """ import tensorflow as tf import numpy as np import matplotlib.pyplot as mp data = np.loadtxt('single.txt',delimiter=',') x = data[:,0] y = data[:,1] #顺序模型 model = tf.keras.Sequential() #添加层 第一个参数输出数据的维度, 第二个是输入数据的维度 model.add(tf.keras.layers.Dense(1,input_shape=(1,))) print(model.summary()) #编译 model...
null
Tensorflow/day01/10_keras.py
10_keras.py
py
625
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.loadtxt", "line_number": 7, "usage_type": "call" }, { "api_name": "tensorflow.keras.Sequential", "line_number": 11, "usage_type": "call" }, { "api_name": "tensorflow.keras", "line_number": 11, "usage_type": "attribute" }, { "api_name": "tensor...
77799157
import os # isort: skip import time from shutil import copyfile import torch from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter import segmentation_models_pytorch as smp from utils import configuration from utils.dataset import SegmDataset from utils.build_model import build...
null
train.py
train.py
py
5,806
python
en
code
null
code-starcoder2
66
[ { "api_name": "utils.configuration.System", "line_number": 24, "usage_type": "attribute" }, { "api_name": "utils.configuration", "line_number": 24, "usage_type": "name" }, { "api_name": "torch.manual_seed", "line_number": 25, "usage_type": "call" }, { "api_name": ...
438006417
import ast from argparse import ArgumentParser, Namespace, Action from typing import List from ml4ir.base.config.keys import OptimizerKey, DataFormatKey, TFRecordTypeKey, ExecutionModeKey, ServingSignatureKey, FileHandlerKey from ml4ir.applications.ranking.config.keys import LossKey as RankingLoss, MetricKey as Ranking...
null
python/ml4ir/base/config/parse_args.py
parse_args.py
py
15,714
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.Action", "line_number": 9, "usage_type": "name" }, { "api_name": "argparse.ArgumentParser", "line_number": 44, "usage_type": "name" }, { "api_name": "ml4ir.base.config.keys.DataFormatKey.get_all_keys", "line_number": 65, "usage_type": "call" }, ...
528088583
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
null
nemo_text_processing/text_normalization/de/verbalizers/measure.py
measure.py
py
2,243
python
en
code
null
code-starcoder2
66
[ { "api_name": "nemo_text_processing.text_normalization.en.graph_utils.GraphFst", "line_number": 31, "usage_type": "name" }, { "api_name": "nemo_text_processing.text_normalization.en.graph_utils.GraphFst", "line_number": 45, "usage_type": "name" }, { "api_name": "pynini.lib.pynuti...
363922682
from bottle import route, default_app, request, response, template import pdfkit import unicodedata import time import os wkhtmltopdf_dir = os.path.dirname(__file__) filename = wkhtmltopdf_dir[:-5] + '/wkhtmltopdf/wkhtmltopdf' config = pdfkit.configuration(wkhtmltopdf=filename) num_of_pdf = 0 HTML = """\ <html> <head...
null
wsgi/mybottleapp.py
mybottleapp.py
py
1,316
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": "pdfkit.configuration", "line_number": 9, "usage_type": "call" }, { "api_name": "bottle.template", ...
116119537
from opentrons import robot, labware, instruments, protocol_api #from opentrons import #import numpy as np #from copy import deepcopy # metadata metadata = { 'protocolName': 'SeparateGradientsErisGradient', 'author': 'Eric Behle eric.behle@hhu.de', 'description': '\ Protocol designed to pipe...
null
SeparateGradientsEricsGradient_changed.py
SeparateGradientsEricsGradient_changed.py
py
13,422
python
en
code
null
code-starcoder2
66
[ { "api_name": "opentrons.labware.list", "line_number": 64, "usage_type": "call" }, { "api_name": "opentrons.labware", "line_number": 64, "usage_type": "name" }, { "api_name": "opentrons.labware.create", "line_number": 65, "usage_type": "call" }, { "api_name": "ope...
546685
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ @Project:renran @file: view.py @author: 薛吉祥 @time: 2022/12/14 16:28 @desc: """ import time from urllib.parse import urlencode import jwt import requests from flask import g, request, jsonify from util import SALT from util import identify, authenticate from renranapi.m...
null
renranapi/app/users/view.py
view.py
py
8,868
python
en
code
null
code-starcoder2
66
[ { "api_name": "renranapi.manage.app.config", "line_number": 26, "usage_type": "attribute" }, { "api_name": "renranapi.manage.app", "line_number": 26, "usage_type": "name" }, { "api_name": "renranapi.manage.app.after_request", "line_number": 37, "usage_type": "call" }, ...
501988488
from setuptools import find_packages, setup import django_spaceless_templates readme = open('README.rst').read() requirements = open('requirements.txt').readlines() setup( name='django-spaceless-templates', version=django_spaceless_templates.__version__, packages=find_packages(), include_package_data...
null
setup.py
setup.py
py
1,191
python
en
code
null
code-starcoder2
66
[ { "api_name": "setuptools.setup", "line_number": 8, "usage_type": "call" }, { "api_name": "django_spaceless_templates.__version__", "line_number": 10, "usage_type": "attribute" }, { "api_name": "setuptools.find_packages", "line_number": 11, "usage_type": "call" } ]
448798702
#!/usr/bin/env python2.7 import mmap, time, struct, os, sys import numpy as np from sklearn import linear_model, svm, tree, neighbors from sklearn.neighbors.nearest_centroid import NearestCentroid from sklearn.linear_model import * from sklearn.ensemble import * from sklearn.dummy import * from sklearn.neural_network ...
null
train_programs/NEW_sigterm_microbenchmarks/demo_poly.py
demo_poly.py
py
11,529
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.hstack", "line_number": 45, "usage_type": "call" }, { "api_name": "numpy.hstack", "line_number": 76, "usage_type": "call" }, { "api_name": "numpy.vstack", "line_number": 93, "usage_type": "call" }, { "api_name": "numpy.vstack", "line_numbe...
171958381
import argparse import itertools import multiprocessing from functools import partial from lhc.argparse import OpenReadableFile, OpenWritableFile from lhc.io.bed.iterator import BedLineIterator from lhc.io.bed.set_ import BedSet from lhc.io.sam.iterator import SamLineIterator def filter(args): filters = [] i...
null
lhc/io/sam/filter.py
filter.py
py
3,548
python
en
code
null
code-starcoder2
66
[ { "api_name": "functools.partial", "line_number": 15, "usage_type": "call" }, { "api_name": "functools.partial", "line_number": 17, "usage_type": "call" }, { "api_name": "functools.partial", "line_number": 19, "usage_type": "call" }, { "api_name": "lhc.io.bed.set_...
548316016
# -*- coding: utf-8 -*- # @Time : 2019/12/10 # @Author : Lattine # ====================== import os import torch from torch import optim from torch.utils.data import DataLoader from data_helper import dataset from data_helper import StrLabelConverter from models import crnn as nets from process import utils torc...
null
crnn_ctc/process/trainer.py
trainer.py
py
5,234
python
en
code
null
code-starcoder2
66
[ { "api_name": "torch.manual_seed", "line_number": 16, "usage_type": "call" }, { "api_name": "models.crnn.Config", "line_number": 21, "usage_type": "call" }, { "api_name": "models.crnn", "line_number": 21, "usage_type": "name" }, { "api_name": "torch.device", "...
558068896
# # Mqttagent that measure the existance of several wifi id, # # import paho.mqtt.client as mqtt import random import time import re import ConfigParser import os.path import freebox import json config = ConfigParser.RawConfigParser() PRESENCE = "home/agents/presence" ########################################...
null
agents/freebox/presence.py
presence.py
py
2,453
python
en
code
null
code-starcoder2
66
[ { "api_name": "ConfigParser.RawConfigParser", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path.path.expanduser", "line_number": 27, "usage_type": "call" }, { "api_name": "os.path.path", "line_number": 27, "usage_type": "attribute" }, { "api_name":...
548439279
import boto3 import logging import math import os import pandas as pd from django.conf import settings logger = logging.getLogger("console") def multipart_upload(bucketname, regionname, source_path, keyname): s3client = boto3.client("s3", region_name=regionname) source_size = os.stat(source_path).st_size ...
null
usaspending_api/download/helpers/monthly_helpers.py
monthly_helpers.py
py
2,267
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "boto3.client", "line_number": 13, "usage_type": "call" }, { "api_name": "os.stat", "line_number": 14, "usage_type": "call" }, { "api_name": "math.sqrt", "line_number": ...
332867579
# # -*- coding: utf-8 -*- # __author__ = "Mengxuan Chen" # __email__ = "chenmx19@mails.tsinghua.edu.cn" # __date__ = "20200801" import grpc import question_pb2, question_pb2_grpc import contest_pb2, contest_pb2_grpc import pandas as pd import numpy as np import os, time from universal import tools from un...
null
codes/client___.py
client___.py
py
10,193
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.basicConfig", "line_number": 18, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 18, "usage_type": "attribute" }, { "api_name": "warnings.filterwarnings", "line_number": 19, "usage_type": "call" }, { "api_name": "grpc.i...
203522566
from flask import Flask,render_template,redirect,request import caption_it #__name__== __main__ app=Flask(__name__) # @-> It is known as decorator @app.route('/') def hello(): return render_template("index.html") @app.route('/',methods=['POST']) def caption_prediction(): if request.method =="POST": #name=reques...
null
app.py
app.py
py
784
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 5, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 11, "usage_type": "call" }, { "api_name": "flask.request.method", "line_number": 15, "usage_type": "attribute" }, { "api_name": "flask.requ...
188495113
#!/bin/env python # File: components.py # Description: A module containing graphical components, which are about # to be used in the main class. # Done: 2% __author__ = "Milan Skala" __credits__ = ["Milan Skala"] __version__ = "0.1a" __maintainer__ = "Milan Skala" __email__ = "xskala09@stud.fit.vu...
null
VirtualBox_Manager/modules/components.py
components.py
py
3,228
python
en
code
null
code-starcoder2
66
[ { "api_name": "wx.Frame", "line_number": 16, "usage_type": "attribute" }, { "api_name": "wx.ID_ANY", "line_number": 17, "usage_type": "attribute" }, { "api_name": "wx.DefaultPosition", "line_number": 17, "usage_type": "attribute" }, { "api_name": "wx.DefaultSize",...
111180224
#!/usr/bin/env python3 """ Tells us if a tree file is in order. """ import argparse from treesorting import * if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('TreeFile', help='The file containing the tree.') args = parser.parse_args() file_...
null
isfilesortedtree.py
isfilesortedtree.py
py
426
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 11, "usage_type": "call" } ]
96208522
## This file contains all the functions necessary to the development and use of the DKB import functools from owlready2 import * from .DareKB import * from .Profile import * import os.path import uuid from . import setting from .internal import datatype as dt from .internal import consts from . import server_state ...
null
server/sbridge.py
sbridge.py
py
7,292
python
en
code
null
code-starcoder2
66
[ { "api_name": "functools.wraps", "line_number": 37, "usage_type": "call" }, { "api_name": "typing.Optional", "line_number": 55, "usage_type": "name" }, { "api_name": "uuid.uuid1", "line_number": 103, "usage_type": "call" }, { "api_name": "typing.List", "line_n...
305046448
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pyVim.connect import SmartConnectNoSSL,SmartConnect,Disconnect from pyVmomi import vim from pyVmomi import vmodl import atexit import getpass __author__ = 'jyxie' # 从文件中读取所有ip,忽略以#开头的ip,并去除ip的前后空格 def read_all_ip(): f = None ip_list = [] ...
null
vm_manage.py
vm_manage.py
py
16,273
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyVim.connect.SmartConnect", "line_number": 36, "usage_type": "call" }, { "api_name": "pyVim.connect.SmartConnectNoSSL", "line_number": 39, "usage_type": "call" }, { "api_name": "atexit.register", "line_number": 44, "usage_type": "call" }, { "api_na...
512522062
# coding: utf-8 import scipy.io as scio from logistic_regression import * from sklearn.preprocessing import scale data=scio.loadmat('digit_train.mat') X_train=data['X'].astype(float) y_train=data['y'][0] def norm(X): return np.mean(X,axis=1),np.var(X,axis=1) train_mean,train_var=norm(X_train) X_train=scale(X_...
null
hw2/src/Regularization and Cross-Validation/logistic_regression_train.py
logistic_regression_train.py
py
2,286
python
en
code
null
code-starcoder2
66
[ { "api_name": "scipy.io.loadmat", "line_number": 7, "usage_type": "call" }, { "api_name": "scipy.io", "line_number": 7, "usage_type": "name" }, { "api_name": "sklearn.preprocessing.scale", "line_number": 16, "usage_type": "call" }, { "api_name": "scipy.io.loadmat"...
39763343
''' A program that multiplies the adjacency matrix of a graph once. DBMS used is vertica. Author: Sikder Tahsin Al-Amin ''' import vertica_python import string import sys import math import time ######connection string to vertica ##### try: conn_info = {'host':'hostname/ip', 'po...
null
adjacency_matrix.py
adjacency_matrix.py
py
3,174
python
en
code
null
code-starcoder2
66
[ { "api_name": "vertica_python.connect", "line_number": 28, "usage_type": "call" }, { "api_name": "sys.exit", "line_number": 33, "usage_type": "call" }, { "api_name": "sys.argv", "line_number": 35, "usage_type": "attribute" }, { "api_name": "sys.argv", "line_nu...
181577170
import os import unittest from pathlib import Path import openmc import paramak import pytest class TestObjectNeutronicsArguments(unittest.TestCase): """Tests Shape object arguments that involve neutronics usage""" def setUp(self): self.test_shape = paramak.ExtrudeMixedShape( points=[ ...
null
tests/test_parametric_neutronics/test_Shape_neutronics.py
test_Shape_neutronics.py
py
8,615
python
en
code
null
code-starcoder2
66
[ { "api_name": "unittest.TestCase", "line_number": 11, "usage_type": "attribute" }, { "api_name": "paramak.ExtrudeMixedShape", "line_number": 15, "usage_type": "call" }, { "api_name": "os.system", "line_number": 28, "usage_type": "call" }, { "api_name": "pathlib.Pa...
235974844
#!/usr/bin/env python """Run benchmarks with build/lib.* in sys.path""" import sys import time import logging from contextlib import contextmanager logger = logging.getLogger('pylibmc.bench') def build_lib_dirname(): from distutils.dist import Distribution from distutils.command.build import build build_...
null
bin/runbench.py
runbench.py
py
3,216
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "distutils.command.build.build", "line_number": 14, "usage_type": "call" }, { "api_name": "distutils.dist.Distribution", "line_number": 14, "usage_type": "call" }, { "api_na...
652340875
from django.shortcuts import redirect from rest_framework.viewsets import ModelViewSet, GenericViewSet from rest_framework.renderers import TemplateHTMLRenderer from rest_framework.response import Response from rest_framework.decorators import action from rest_framework.mixins import ListModelMixin, RetrieveModelMixin ...
null
article/views.py
views.py
py
9,798
python
en
code
null
code-starcoder2
66
[ { "api_name": "rest_framework.pagination.PageNumberPagination", "line_number": 23, "usage_type": "name" }, { "api_name": "rest_framework.pagination.PageNumberPagination", "line_number": 31, "usage_type": "name" }, { "api_name": "rest_framework.pagination.PageNumberPagination", ...
295401899
# -*- coding: utf-8 -*- """ Product: PyCharm Project: xinrui File: head_spider Author : ZXR date: 2019/2/14 time: 16:43 """ import requests import pymysql import time import base64 import re from bs4 import BeautifulSoup import threading class Yidian: header...
null
pyqtpro/xinrui/headline/head_spider.py
head_spider.py
py
20,552
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.time", "line_number": 52, "usage_type": "call" }, { "api_name": "threading.Lock", "line_number": 60, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 68, "usage_type": "call" }, { "api_name": "time.time", "line_number": ...
37424011
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from django.http import QueryDict from django.urls import reverse from model_utils import Choices from aids.models import Aid from aids.forms import AidSearchForm class Bookmark(models.Model): "...
null
src/bookmarks/models.py
models.py
py
2,460
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.models.Model", "line_number": 12, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 12, "usage_type": "name" }, { "api_name": "model_utils.Choices", "line_number": 26, "usage_type": "call" }, { "api_name": "djan...
562230958
import pytest from sfa_dash.blueprints.form import MetadataForm @pytest.fixture() def meta_form(): return MetadataForm('forecast') def test_flatten_dict(meta_form): original_dict = { 'a': 1, 'b': {'z': 5, 'y': 4, 'x': 3}, 'c': [1, 2, 3, 4] } expe...
null
sfa_dash/tests/test_form_helpers.py
test_form_helpers.py
py
1,352
python
en
code
null
code-starcoder2
66
[ { "api_name": "sfa_dash.blueprints.form.MetadataForm", "line_number": 9, "usage_type": "call" }, { "api_name": "pytest.fixture", "line_number": 7, "usage_type": "call" }, { "api_name": "pytest.mark.parametrize", "line_number": 31, "usage_type": "call" }, { "api_na...
268805463
import numpy import json import array def read_from_db(): with open('datajson.json') as f: data = json.load(f) names = [sensors['sensor_id'] for sensors in data['sensor_data']] states = [sensors['sensor_state'] for sensors in data['sensor_data']] print (names) return name...
null
paho/database1.py
database1.py
py
331
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 10, "usage_type": "call" } ]
558936396
""" 1、使用defaultdict实现 2、还可以使用普通字典的setdefault """ from collections import defaultdict # 方法1 a = defaultdict(list) a['a'].append(1) a['a'].append(2) a['b'].append(1) print(a) # 方法2 b = dict() b.setdefault('a',[]).append(1) b.setdefault('b',[]) b['a'].append(2) print(b)
null
1_Data_Algorithm/5_字典的一键存储多值.py
5_字典的一键存储多值.py
py
319
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.defaultdict", "line_number": 8, "usage_type": "call" } ]
604566985
from flask_login import login_required, current_user from flask import flash, redirect, render_template, url_for, request, redirect from . import notes from ..models import User, Minutes from app import db @notes.route('/note/<int:n_id>', methods=["GET"]) @login_required def view_note(n_id): note = Minutes.query.a...
null
app/notes/views.py
views.py
py
994
python
en
code
null
code-starcoder2
66
[ { "api_name": "models.Minutes.query.add_columns", "line_number": 10, "usage_type": "call" }, { "api_name": "models.Minutes.query", "line_number": 10, "usage_type": "attribute" }, { "api_name": "models.Minutes", "line_number": 10, "usage_type": "name" }, { "api_nam...
284959380
from models.generators.GeneralGenerator import GeneralGenerator import torch.nn as nn import torch from models.losses.NonSaturatingGLoss import NonSaturatingGLoss as GLoss from models.discriminators.PatchDiscriminator import PatchDiscriminator class ResnetGenerator(GeneralGenerator): """ Defines the pix2pix (Cycl...
null
models/generators/ResnetGenerator.py
ResnetGenerator.py
py
6,144
python
en
code
null
code-starcoder2
66
[ { "api_name": "models.generators.GeneralGenerator.GeneralGenerator", "line_number": 8, "usage_type": "name" }, { "api_name": "torch.nn.Module", "line_number": 13, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 13, "usage_type": "name" }, { "...
123919702
import ray import ray.tune as tune from ray.rllib import train import os import sys if __name__ == "__main__": # Parse arguments train_parser = train.create_parser() args = train_parser.parse_args() print("Algorithm config:", args.config) if args.ray_address is None: # start local Ray c...
null
ray-sample/main.py
main.py
py
776
python
en
code
null
code-starcoder2
66
[ { "api_name": "ray.rllib.train.create_parser", "line_number": 11, "usage_type": "call" }, { "api_name": "ray.rllib.train", "line_number": 11, "usage_type": "name" }, { "api_name": "ray.init", "line_number": 18, "usage_type": "call" }, { "api_name": "ray.init", ...
223594921
import copy import time from PyQt5.QtCore import QThread, pyqtSignal from PyQt5.QtWidgets import QWidget from Entities.Bullet import Bullet from Entities.Box import Box from Entities.Spaceship import Spaceship from Factories.BulletFactory import BulletFactory from Handlers.CollisionHandler import CollisionHandler ...
null
space_invaders/Workers/BulletWorker.py
BulletWorker.py
py
2,146
python
en
code
null
code-starcoder2
66
[ { "api_name": "PyQt5.QtCore.QThread", "line_number": 15, "usage_type": "name" }, { "api_name": "PyQt5.QtCore.pyqtSignal", "line_number": 16, "usage_type": "call" }, { "api_name": "Entities.Bullet.Bullet", "line_number": 16, "usage_type": "argument" }, { "api_name"...
396761930
#!/usr/bin/env python # coding: utf-8 # # Project: Investigating TMDB Movie Dataset provided by Udacity # *** # ### Table of contents > # # - Introduction # # - Data Wrangling # - Removing duplicates rows and empty rows # # - Data Analysis # - Which genres are most popular from year to year? # - What kind...
null
InvestigatingDatasets/investigating-datasets-udacity.py
investigating-datasets-udacity.py
py
9,957
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 72, "usage_type": "call" }, { "api_name": "pandas.Series", "line_number": 143, "usage_type": "call" }, { "api_name": "seaborn.set", "line_number": 152, "usage_type": "call" }, { "api_name": "seaborn.color_palette", ...
47926129
__author__ = 'linwe991' print("views.py") # from Twidder import app import random from flask import Flask, jsonify, request from Twidder import database_helper from gevent.wsgi import WSGIServer from geventwebsocket.handler import WebSocketHandler from geventwebsocket.websocket import WebSocketError import json from T...
null
Twidder/views.py
views.py
py
8,668
python
en
code
null
code-starcoder2
66
[ { "api_name": "Twidder.app", "line_number": 15, "usage_type": "argument" }, { "api_name": "Twidder.app.send_static_file", "line_number": 24, "usage_type": "call" }, { "api_name": "Twidder.app", "line_number": 24, "usage_type": "name" }, { "api_name": "Twidder.app....
611811736
import pytest import time import stl_path from trex_stl_lib.api import * """ An example on how to use TRex for functional tests using the stateless API with service mode """ @pytest.mark.parametrize("protocol", ["TCP", "UDP", "ICMP"]) def test_one_packet(trex, protocol): tx_port, rx_port = trex.get_all_ports() ...
null
labs/tests/test_simple_service.py
test_simple_service.py
py
1,545
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.sleep", "line_number": 34, "usage_type": "call" }, { "api_name": "pytest.mark.parametrize", "line_number": 11, "usage_type": "call" }, { "api_name": "pytest.mark", "line_number": 11, "usage_type": "attribute" } ]