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
359243330
# Copyright 2016 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
pubsub/cloud-client/subscriber_test.py
subscriber_test.py
py
7,311
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.environ", "line_number": 25, "usage_type": "attribute" }, { "api_name": "google.cloud.pubsub_v1.PublisherClient", "line_number": 36, "usage_type": "call" }, { "api_name": "google.cloud.pubsub_v1", "line_number": 36, "usage_type": "name" }, { "api...
420512232
import numpy as np from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF class MGPR(GaussianProcessRegressor): """ Multivariate Gaussian Process Regression """ def __init__(self, dim, optimizer="fmin_l_bfgs_b", kernel=RBF(), alpha=1e-10, n_rest...
null
PILCO/MGPR.py
MGPR.py
py
2,075
python
en
code
null
code-starcoder2
76
[ { "api_name": "sklearn.gaussian_process.GaussianProcessRegressor", "line_number": 6, "usage_type": "name" }, { "api_name": "sklearn.gaussian_process.kernels.RBF", "line_number": 11, "usage_type": "call" }, { "api_name": "sklearn.gaussian_process.GaussianProcessRegressor", "li...
428189472
"""@package MuSCADeT """ import numpy as np import matplotlib.pyplot as plt import pyfits as pf #from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes import matplotlib.colors as mc import subprocess as sp import scipy.signal as sc import os from MuSCADeT import MCA def make_colour_sub(Sfile,Afile,Xfile,suffixe,pref...
null
MuSCADeT/colour_subtraction.py
colour_subtraction.py
py
7,341
python
en
code
null
code-starcoder2
76
[ { "api_name": "pyfits.open", "line_number": 47, "usage_type": "call" }, { "api_name": "pyfits.open", "line_number": 48, "usage_type": "call" }, { "api_name": "pyfits.open", "line_number": 49, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": ...
329051228
# coding=utf-8 import json import urllib def run(bot, chat_id, user, keyConfig, message, totalResults=1): requestText = urllib.quote(message.replace(bot.name, "").strip()) translateUrl = 'https://www.googleapis.com/language/translate/v2?key=' + \ keyConfig.get('Google', 'GCSE_APP_ID') + '&...
null
commands/translate.py
translate.py
py
1,854
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib.quote", "line_number": 7, "usage_type": "call" }, { "api_name": "json.load", "line_number": 12, "usage_type": "call" }, { "api_name": "urllib.urlopen", "line_number": 12, "usage_type": "call" }, { "api_name": "json.load", "line_number": 1...
552366571
import sqlite3 import os import psycopg2 from dotenv import load_dotenv load_dotenv() DB_NAME2 = os.getenv("DB_NAME3") DB_USER2 = os.getenv("DB_USER3") DB_PASS2 = os.getenv("DB_PASS3") DB_HOST2 = os.getenv("DB_HOST3") conn = psycopg2.connect(dbname=DB_NAME2, user=DB_USER2, ...
null
module2-sql-for-analysis/rpg_db.py
rpg_db.py
py
1,174
python
en
code
null
code-starcoder2
76
[ { "api_name": "dotenv.load_dotenv", "line_number": 6, "usage_type": "call" }, { "api_name": "os.getenv", "line_number": 8, "usage_type": "call" }, { "api_name": "os.getenv", "line_number": 9, "usage_type": "call" }, { "api_name": "os.getenv", "line_number": 10...
545468024
from django.db import models from django.urls import reverse_lazy from django.utils import timezone class City(models.Model): city_name = models.CharField(max_length=64) def __str__(self): return self.city_name class Meta: verbose_name = 'City' verbose_name_plural = 'Cities' cl...
null
clients/models.py
models.py
py
6,055
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.models.Model", "line_number": 6, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 6, "usage_type": "name" }, { "api_name": "django.db.models.CharField", "line_number": 7, "usage_type": "call" }, { "api_name": "...
125465381
import tensorflow as tf import numpy as np from util import atrous_conv1d import sys import os import model_utils import time import input_readers from tflearn.layers.conv import max_pool_1d import ops def model_fn(net, X_len, max_reach, block_size, out_classes, batch_size, k, reuse=False, **kwargs): """ A...
null
mincall/models/model_test_reg.py
model_test_reg.py
py
3,952
python
en
code
null
code-starcoder2
76
[ { "api_name": "tensorflow.variable_scope", "line_number": 23, "usage_type": "call" }, { "api_name": "tensorflow.variable_scope", "line_number": 25, "usage_type": "call" }, { "api_name": "tensorflow.get_variable", "line_number": 26, "usage_type": "call" }, { "api_n...
445928567
import numpy as np import sys import argparse import os import pandas as pd import matplotlib matplotlib.use('TkAgg') from matplotlib import pyplot as plt import random from keras.layers import LSTM, Activation, Dropout, Dense from keras.models import Sequential from keras.optimizers import Adam os.environ['KMP_DUPLI...
null
rnn/LSTM.py
LSTM.py
py
6,203
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.use", "line_number": 7, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 15, "usage_type": "attribute" }, { "api_name": "pandas.DataFrame", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.log1p", "lin...
403676547
"""surface.py: Surface element and geometry""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import properties from .base import ProjectElement, ProjectElementGeometry from .data import Int3Array,...
null
omf/surface.py
surface.py
py
5,709
python
en
code
null
code-starcoder2
76
[ { "api_name": "base.ProjectElementGeometry", "line_number": 15, "usage_type": "name" }, { "api_name": "properties.Instance", "line_number": 17, "usage_type": "call" }, { "api_name": "data.Vector3Array", "line_number": 19, "usage_type": "argument" }, { "api_name": ...
432826623
#!/usr/bin/env python3.2 from pyquery import PyQuery as pq from lxml import etree import urllib import sys from pymongo import MongoClient import time HOST = "localhost" def print_if_stored(word, host, tag): client = MongoClient(host) db = client['word'] words = db.words; record = words.find_one({'name':word, 't...
null
auto_dict.py
auto_dict.py
py
3,621
python
en
code
null
code-starcoder2
76
[ { "api_name": "pymongo.MongoClient", "line_number": 11, "usage_type": "call" }, { "api_name": "pymongo.MongoClient", "line_number": 31, "usage_type": "call" }, { "api_name": "sys.stderr", "line_number": 48, "usage_type": "attribute" }, { "api_name": "urllib.parse....
237932354
import cv2 import tensorflow as tf import numpy as np from tensorflow.keras import layers as tfl img =cv2.imread("test.jpeg") print(img.shape) original_img=np.asarray(img) #print(original_img) #hYPER parameters epsilon=0.00005 class hdrGAN: def __init__(self,generator,discriminator,inputimg): self.genera...
null
hdr.py
hdr.py
py
2,032
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.imread", "line_number": 5, "usage_type": "call" }, { "api_name": "numpy.asarray", "line_number": 7, "usage_type": "call" }, { "api_name": "tensorflow.variable_scope", "line_number": 20, "usage_type": "call" }, { "api_name": "tensorflow.keras.Seq...
284571922
''' Copyright (C) 2017-2021 Bryant Moscon - bmoscon@gmail.com Please see the LICENSE file for the terms and conditions associated with this software. ''' import asyncio import atexit from collections import defaultdict import functools import ast from aiofile import AIOFile from cryptofeed.defines import HUOBI, UPB...
null
cryptofeed/util/async_file.py
async_file.py
py
4,643
python
en
code
null
code-starcoder2
76
[ { "api_name": "ast.parse", "line_number": 19, "usage_type": "call" }, { "api_name": "asyncio.run", "line_number": 24, "usage_type": "call" }, { "api_name": "collections.defaultdict", "line_number": 28, "usage_type": "call" }, { "api_name": "collections.defaultdict...
52103834
# %% Setup import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer # %% Read Comments events = ['2020_Nov_Post', '2020_Nov', '2020_Nov_Pre', '2020_Oct_Post', '2020_Oct', '2020_Oct_Pre', '2020_Sept_Post', '2020_Sept', '2020_Sept_Pre', '2020_Jun_Post', '2020_Jun', '2020_Jun_Pre', '2019_Sept_Post...
null
task_1/similarity/event_similarity.py
event_similarity.py
py
4,410
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 10, "usage_type": "call" }, { "api_name": "sklearn.feature_extraction.text.TfidfVectorizer", "line_number": 36, "usage_type": "call" }, { "api_name": "sklearn.cluster.KMeans", "line_number": 44, "usage_type": "call" }, {...
196050772
from django.urls import path from rest_framework import routers from .. import views from ..api import pushdeploy from deploy.api import rollback, polling, GetBuildConsoleLogApiView, DeployHistoryViewSet app_name = 'deploy' router = routers.DefaultRouter() router.register('history', DeployHistoryViewSet, 'history'...
null
deploy/urls/api_urls.py
api_urls.py
py
967
python
en
code
null
code-starcoder2
76
[ { "api_name": "rest_framework.routers.DefaultRouter", "line_number": 12, "usage_type": "call" }, { "api_name": "rest_framework.routers", "line_number": 12, "usage_type": "name" }, { "api_name": "deploy.api.DeployHistoryViewSet", "line_number": 13, "usage_type": "argument"...
636311156
"""Zombie survival game core.tools.collisions - Functions for detecting collisions between game objects. TO DO: explain axis_collide(). """ import pygame as pg from core.sprites.items import Gun from constants.settings import * # shorten name vec = pg.math.Vector2 def collide_hit_rect(A, B): """Detect a co...
null
core/tools/collisions.py
collisions.py
py
3,227
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.math", "line_number": 16, "usage_type": "attribute" }, { "api_name": "pygame.sprite.spritecollide", "line_number": 30, "usage_type": "call" }, { "api_name": "pygame.sprite", "line_number": 30, "usage_type": "attribute" }, { "api_name": "pygam...
149956856
import os import shutil import subprocess import requests from tqdm import tqdm dir_path = os.path.dirname(os.path.realpath(__file__)) server_dir = dir_path + "/server/" """ Description :type file: :param file: :type word: :param word: - what should be replaced :type replacement: :p...
null
main.py
main.py
py
3,050
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.dirname", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path.realpath", "line_number": 8, "usage_type": "call" }, { "api_name": "os.chdir", "line_numbe...
538656276
import sys, math, struct # import InvertedFileUtils as inv from collections import Counter from tokenizer import tokenize def getQuery(txt): return Counter(tokenize(txt)) def lookupInvertedFile(invFH, offset, DF): ## read posting list from inverted file invFH.seek(offset*8,0) # postings stored as 8 by...
null
cosineSimilarity.py
cosineSimilarity.py
py
2,346
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.Counter", "line_number": 7, "usage_type": "call" }, { "api_name": "tokenizer.tokenize", "line_number": 7, "usage_type": "call" }, { "api_name": "struct.unpack", "line_number": 12, "usage_type": "call" }, { "api_name": "collections.Counte...
403557070
# -*- coding: utf-8 -*- # 2. Написать программу сложения и умножения двух шестнадцатеричных чисел. # При этом каждое число представляется как массив, элементы которого это цифры числа. # # Например, пользователь ввёл A2 и C4F. # Сохранить их как [‘A’, ‘2’] и [‘C’, ‘4’, ‘F’] соответственно. # Сумма чисел из примера: [‘C...
null
lesson_05/lesson05_hw02.py
lesson05_hw02.py
py
2,285
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.deque", "line_number": 16, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 50, "usage_type": "call" } ]
539017035
# -*- coding: utf-8 -*- from django.conf import settings from .parsers import MegafonParser, MTSParser, Tele2Parser def handle_uploaded_file(file_path, operator): parser = { 'mts': MTSParser, 'megafon': MegafonParser, 'tele2': Tele2Parser }.get(operator) parser = parser(operator=o...
null
mobile_analyzer/utils.py
utils.py
py
397
python
en
code
null
code-starcoder2
76
[ { "api_name": "parsers.MTSParser", "line_number": 9, "usage_type": "name" }, { "api_name": "parsers.MegafonParser", "line_number": 10, "usage_type": "name" }, { "api_name": "parsers.Tele2Parser", "line_number": 11, "usage_type": "name" }, { "api_name": "django.con...
327391698
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('controles', '0004_control_ic_enfermeria'), ] operations = [ migrations.AddField( model_name='examenfisico', ...
null
apps/controles/migrations/0005_examenfisico_especuloscopia.py
0005_examenfisico_especuloscopia.py
py
491
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.migrations.Migration", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 7, "usage_type": "name" }, { "api_name": "django.db.migrations.AddField", "line_number": 14, "usage_type": "call" }, { ...
120112445
import re from dataclasses import dataclass from enum import IntEnum from typing import List, Optional, Tuple class MessageType(IntEnum): PRIVATE_MESSAGE = 0 JOIN = 1 PART = 2 PING = 3 QUIT = 4 TOPIC = 5 END_OF_MOTD = 6 NICK_IN_USE = 7 TOPIC_REPLY = 9 USERS = 10 END_OF_USER...
null
irckaaja/protocol.py
protocol.py
py
14,098
python
en
code
null
code-starcoder2
76
[ { "api_name": "enum.IntEnum", "line_number": 7, "usage_type": "name" }, { "api_name": "dataclasses.dataclass", "line_number": 27, "usage_type": "name" }, { "api_name": "dataclasses.dataclass", "line_number": 33, "usage_type": "name" }, { "api_name": "dataclasses.d...
181853702
# -*- coding: utf-8 -*- import re from setuptools import setup with open("requirements.txt") as f: requirements = f.read().splitlines() f.close() with open("steam/ext/dota/__init__.py") as f: search = re.search(r'^__version__\s*=\s*"([^"]*)"', f.read(), re.MULTILINE) if search is None: raise Runtim...
null
setup.py
setup.py
py
1,593
python
en
code
null
code-starcoder2
76
[ { "api_name": "re.search", "line_number": 12, "usage_type": "call" }, { "api_name": "re.MULTILINE", "line_number": 12, "usage_type": "attribute" }, { "api_name": "subprocess.getoutput", "line_number": 26, "usage_type": "call" }, { "api_name": "subprocess.getoutput...
227792228
""" Module for working with the AWS Step Functions API. """ import json import boto3 from .utils import search_dictionary_list ENTRY_FAIL_MAPPING = { 'MapStateFailed': 'MapStateEntered', 'LambdaFunctionFailed': 'TaskStateEntered' } def get_execution_history(execution_arn, region='us-west-2'): """ ...
null
persist_error/sfn.py
sfn.py
py
2,954
python
en
code
null
code-starcoder2
76
[ { "api_name": "boto3.client", "line_number": 33, "usage_type": "call" }, { "api_name": "utils.search_dictionary_list", "line_number": 57, "usage_type": "call" }, { "api_name": "utils.search_dictionary_list", "line_number": 61, "usage_type": "call" }, { "api_name":...
498453757
import sys, os, zipfile, shutil, win32com.client from appInterface._classes import HyperlinkManager import github3 as git from tkinter import * def callBack(): interp_path=os.path.dirname(sys.executable) workPath = os.path.join(interp_path, 'whatsNew.docx') word = win32com.client.Dispatch("Word.A...
null
toolBox/codeUpgrader.py
codeUpgrader.py
py
4,558
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.dirname", "line_number": 8, "usage_type": "call" }, { "api_name": "os.path", "line_number": 8, "usage_type": "attribute" }, { "api_name": "sys.executable", "line_number": 8, "usage_type": "attribute" }, { "api_name": "os.path.join", "lin...
205917210
import logging import os from buildpack import util AGENT_VERSION = "6.2.1" NAMESPACE = "newrelic" ROOT_DIR = ".local" def stage(install_path, cache_path): if get_new_relic_license_key(): util.download_and_unpack( util.get_blobstore_url( "/mx-buildpack/newrelic/newrelic-java-...
null
buildpack/newrelic.py
newrelic.py
py
1,702
python
en
code
null
code-starcoder2
76
[ { "api_name": "buildpack.util.download_and_unpack", "line_number": 13, "usage_type": "call" }, { "api_name": "buildpack.util", "line_number": 13, "usage_type": "name" }, { "api_name": "buildpack.util.get_blobstore_url", "line_number": 14, "usage_type": "call" }, { ...
486132031
import argparse from sectubs.vigenere.filecompresser import compressFile from sectubs.vigenere.vig_methods import encrypt, decrypt, writeToFile ##### # Args-parser ##### parser = argparse.ArgumentParser( "Encrypts or decrypts a file using Vigenere cipher" ) actions = parser.add_mutually_exclusive...
null
Uebung/sectubs/vigenere/vig.py
vig.py
py
1,331
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 11, "usage_type": "call" }, { "api_name": "sectubs.vigenere.filecompresser.compressFile", "line_number": 57, "usage_type": "call" }, { "api_name": "sectubs.vigenere.vig_methods.encrypt", "line_number": 58, "usage_typ...
294772501
import argparse import os,sys,inspect import numpy as np import random import time import math import csv import _pickle as pickle random.seed = 0 import cv2 from PIL import Image import torch import matplotlib.pyplot as plt # add relevant packages and directories to path detector_path = os.path.join(os.getcwd(),"...
null
track/track_all.py
track_all.py
py
5,105
python
en
code
null
code-starcoder2
76
[ { "api_name": "random.seed", "line_number": 9, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 18, "usage_type": "call" }, { "api_name": "os.path", "line_number": 18, "usage_type": "attribute" }, { "api_name": "os.getcwd", "line_numbe...
421597369
# # This file is part of Brazil Data Cube Collection Builder. # Copyright (C) 2019-2020 INPE. # # Brazil Data Cube Collection Builder is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. # """Describe Sentinel 1 publish generation.""" from...
null
bdc_collection_builder/collections/sentinel1/publish.py
publish.py
py
8,186
python
en
code
null
code-starcoder2
76
[ { "api_name": "bdc_db.models.CollectionItem", "line_number": 27, "usage_type": "name" }, { "api_name": "bdc_collection_builder.collections.models.RadcorActivity", "line_number": 27, "usage_type": "name" }, { "api_name": "pathlib.Path", "line_number": 39, "usage_type": "ca...
121576596
import math import torchvision import numpy as np import torch as tc from datasets.dataset_abc import DataSetABC from experiments.model_params import BASE_PARAMS class FashionMNIST(DataSetABC): def __init__(self, params): self.data_dir = "/tmp" # def _transform_fn(input): # input =...
null
datasets/fashion_mnist.py
fashion_mnist.py
py
2,747
python
en
code
null
code-starcoder2
76
[ { "api_name": "datasets.dataset_abc.DataSetABC", "line_number": 11, "usage_type": "name" }, { "api_name": "torch.utils.data.DataLoader", "line_number": 43, "usage_type": "call" }, { "api_name": "torch.utils", "line_number": 43, "usage_type": "attribute" }, { "api_...
516984041
from troposphere import Parameter, Ref, GetAtt, Join, Output from troposphere.events import Rule, Target from troposphere.awslambda import Function, Code from troposphere.iam import Role, Policy class LambdaEvent: ''' Class creates a CloudWatch Event that triggers a Lambda Function when a new ELB is added ...
null
ecs-service-discovery/src/lambda_event.py
lambda_event.py
py
10,149
python
en
code
null
code-starcoder2
76
[ { "api_name": "troposphere.awslambda.Function", "line_number": 140, "usage_type": "call" }, { "api_name": "troposphere.awslambda.Code", "line_number": 142, "usage_type": "call" }, { "api_name": "troposphere.Join", "line_number": 143, "usage_type": "call" }, { "api...
113474138
import numpy as np import scipy.ndimage from matplotlib import pyplot as plt # from matplotlib import colors def control_plot(reference, initial, optimal): fig, ax = plt.subplots() ax.set_title('Control optimization') x_dots = np.arange(len(reference)) ax.set_xticks(x_dots) ax.scatter(x_dots, r...
null
visualization.py
visualization.py
py
2,936
python
en
code
null
code-starcoder2
76
[ { "api_name": "matplotlib.pyplot.subplots", "line_number": 9, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 9, "usage_type": "name" }, { "api_name": "numpy.arange", "line_number": 12, "usage_type": "call" }, { "api_name": "matplotlib.py...
503009467
# # Copyright 2020 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. #...
null
renku/ui/service/views/cache.py
cache.py
py
6,722
python
en
code
null
code-starcoder2
76
[ { "api_name": "renku.ui.service.views.api_versions.VersionedBlueprint", "line_number": 39, "usage_type": "call" }, { "api_name": "renku.ui.service.config.SERVICE_PREFIX", "line_number": 39, "usage_type": "name" }, { "api_name": "renku.ui.service.controllers.cache_list_uploaded.Li...
610419519
import cv2 cap = cv2.VideoCapture(-1) while True: ret, frame = cap.read() print(frame.shape) break if not ret: break cv2.imshow('frame',frame) key = cv2.waitKey(1) if key == ord('Q') or key == ord('q'): break cap.release() cv2.destroyAllWindows()
null
camera.py
camera.py
py
296
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.VideoCapture", "line_number": 3, "usage_type": "call" }, { "api_name": "cv2.imshow", "line_number": 13, "usage_type": "call" }, { "api_name": "cv2.waitKey", "line_number": 14, "usage_type": "call" }, { "api_name": "cv2.destroyAllWindows", "l...
358497770
import os from django.http import HttpResponse from django.conf import settings def media(req, path): file_name = os.path.join(settings.MEDIA_ROOT, path) _, file_ext = os.path.splitext(file_name) mime_types = { 'image/jpeg': ('.jpg', '.jpeg'), 'image/png': ('.png',), ...
null
utils/extra_views.py
extra_views.py
py
692
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 7, "usage_type": "call" }, { "api_name": "os.path", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.conf.settings.MEDIA_ROOT", "line_number": 7, "usage_type": "attribute" }, { "api_name": "django.co...
536886908
import pytz from django.conf import settings from django.utils import timezone from django.utils.deprecation import MiddlewareMixin class TimezoneMiddleware(MiddlewareMixin): """ Converts aware datetime objects onto the time zone provided by the logged in user. """ def process_request(self, reque...
null
Services/care_adopt_backend/middleware.py
middleware.py
py
992
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.utils.deprecation.MiddlewareMixin", "line_number": 8, "usage_type": "name" }, { "api_name": "django.conf.settings.TIME_ZONE", "line_number": 15, "usage_type": "attribute" }, { "api_name": "django.conf.settings", "line_number": 15, "usage_type": "name...
517206920
import sys from collections import deque import copy import pprint def year(): visit = [[0] * M for _ in range(N)] di = [(-1,0),(1,0),(0,1),(0,-1)] for y in range(N): for x in range(M): if m[y][x] != 0: c = 0 for dy,dx in di: ny = y...
null
9월/0904/빙산 수정.py
빙산 수정.py
py
1,723
python
en
code
null
code-starcoder2
76
[ { "api_name": "copy.deepcopy", "line_number": 27, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 30, "usage_type": "call" }, { "api_name": "sys.stdin", "line_number": 54, "usage_type": "attribute" } ]
131340665
#!/usr/bin/env python # -*- coding: utf-8 -*- import xlwt import re def txt_to_exl(file): book = xlwt.Workbook(encoding='utf-8',style_compression=0) sheet = book.add_sheet('sheet1') with open(file,'r') as f: count = 0 for line in f: cols = re.split('[" :\[\],]',line.strip()) ...
null
0015/0015.py
0015.py
py
570
python
en
code
null
code-starcoder2
76
[ { "api_name": "xlwt.Workbook", "line_number": 7, "usage_type": "call" }, { "api_name": "re.split", "line_number": 12, "usage_type": "call" } ]
252374266
import numpy as np from pycqed.analysis import composite_analysis as ca import matplotlib.pyplot as plt # # initial arches scan_start = '20170123_191225' scan_stop = '20170123_231225' for i, scan_label in enumerate(['AncT', 'AncB', 'DataT', 'DataM', 'DataB']): pdict = { # 'Heterodyne frequency': 'Heterodyne fre...
null
pycqed/scripts/examples/combined_analysis.py
combined_analysis.py
py
2,184
python
en
code
null
code-starcoder2
76
[ { "api_name": "pycqed.analysis.composite_analysis.quick_analysis", "line_number": 19, "usage_type": "call" }, { "api_name": "pycqed.analysis.composite_analysis", "line_number": 19, "usage_type": "name" }, { "api_name": "numpy.array", "line_number": 34, "usage_type": "call...
178541224
#find(), findAll()은 BeautifulSoup에서 가장 자주 쓰는 함수이다. ''' find(),findAll()의 parameter find(tag,attribute,recursive,text,limit,keywords) findAll(tag,attribute,recursive,text,limit,keywords) tag : 태그 이름을 문자열로 넘겨주거나, 태그 이름들로 이루어진 리스트를 넘겨줄 수 있다. attribute : 태그 이름인 문자열을 넘기거나, 태그 이름으로 이루어진 파이썬 리스트를 넘길수 있다. recursive : 얼마나 깊...
null
5 . find()findAll().py
5 . find()findAll().py
py
1,610
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib.request.urlopen", "line_number": 29, "usage_type": "call" }, { "api_name": "urllib.request.HTTPError", "line_number": 30, "usage_type": "name" }, { "api_name": "bs4.BeautifulSoup", "line_number": 34, "usage_type": "call" }, { "api_name": "url...
200820760
# coding: utf-8 # # Different types of data # # + <u>Cross-sectional data</u> - # Cross-sectional data or cross-section of a population is obtained by taking # observations from multiple individuals at the same point in time. # # # + <u>Time series data</u>- # A time series is made up of qua...
null
Untitled3-Copy1.py
Untitled3-Copy1.py
py
16,878
python
en
code
null
code-starcoder2
76
[ { "api_name": "pandas.read_csv", "line_number": 38, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", "line_number": 103, "usage_type": "call" }, { "api_name": "matplotlib.pyplot", "line_number": 103, "usage_type": "name" }, { "api_name": "matplotlib...
67570490
__author__ = 'jobin' from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index), url(r'^index/', views.index), url(r'^list/', views.list), url(r'^reg/', views.register), url(r'^login/', views.login), url(r'^profile/', views.getUserInfo), url(r'^change_pwd/...
null
server/user/urls.py
urls.py
py
342
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.urls.url", "line_number": 7, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 9, "usage_type": "call" }, { "api_name": "django.co...
160759672
import numpy as n from scipy import special as sp from scipy.sparse.construct import spdiags def sym_sqrt(a): """ NAME: sym_sqrt PURPOSE: take 'square root' of a symmetric matrix via diagonalization USAGE: s = sym_sqrt(a) ARGUMENT: a: real symmetric square 2D ndarray RETURNS: s such that a ...
null
python/bbspec/spec2d/boltonfuncs.py
boltonfuncs.py
py
6,200
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.linalg.eigh", "line_number": 20, "usage_type": "call" }, { "api_name": "numpy.linalg", "line_number": 20, "usage_type": "attribute" }, { "api_name": "scipy.sparse.construct.spdiags", "line_number": 28, "usage_type": "call" }, { "api_name": "nu...
385112160
import json import argparse import re from lxml import etree from collections import OrderedDict parser = argparse.ArgumentParser(description='') parser.add_argument('dir', type=str, help='directory to read xml data from') args = parser.parse_args() def load_xml(xml_file): it = etree.iterparse(xml_file) for...
null
rajuniper/model/sim/databases/db_gen/db_gen.py
db_gen.py
py
9,385
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 7, "usage_type": "call" }, { "api_name": "lxml.etree.iterparse", "line_number": 14, "usage_type": "call" }, { "api_name": "lxml.etree", "line_number": 14, "usage_type": "name" }, { "api_name": "collections.Or...
541218191
from django.contrib.auth.decorators import login_required from django.shortcuts import redirect, render from django.contrib.auth.forms import UserCreationForm #知らない人から登録されないように本番環境でのみアクセス制限を有効化 #@login_required def signup(request): if request.method == "POST": form = UserCreationForm(request.POST) ...
null
accounts/views.py
views.py
py
583
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.contrib.auth.forms.UserCreationForm", "line_number": 9, "usage_type": "call" }, { "api_name": "django.shortcuts.redirect", "line_number": 12, "usage_type": "call" }, { "api_name": "django.contrib.auth.forms.UserCreationForm", "line_number": 14, "usag...
463740785
# coding=utf-8 from re import findall from urllib import urlopen from bs4 import BeautifulSoup def get_word(url, page = 1): global text html = urlopen(url+'&pn=%d'%page).read() title_pattern = r'<title>(.+)_百度文库</title>' word_pattern = r'<div class="content bgcolor1">([\s\S]+?)<p class="page">第.* / (....
null
Python/Spider/practice/9_baiduwenku/baiduwenku.py
baiduwenku.py
py
1,052
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib.urlopen", "line_number": 8, "usage_type": "call" }, { "api_name": "re.findall", "line_number": 11, "usage_type": "call" }, { "api_name": "re.findall", "line_number": 12, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_num...
461733590
# +------------------------------------------------+ # | Atack: Bof Win Function | # +------------------------------------------------+ # # For more info checkout: https://github.com/guyinatuxedo/nightmare/tree/master/modules/05-bof_callfunction from pwn import * import sf target = process("./...
null
01_BofFunc-unit-tests/04_64/verified-exploit-BofFunc.py
verified-exploit-BofFunc.py
py
1,110
python
en
code
null
code-starcoder2
76
[ { "api_name": "sf.BufferOverflow", "line_number": 14, "usage_type": "call" } ]
62829770
from typing import Sequence, List, Tuple import numpy from pybio.core.array import PyBioArray from pybio.core.transformations import PyBioTransformation class Reshape(PyBioTransformation): def __init__(self, shape: Sequence[int], **super_kwargs): self.shape = shape super().__init__(**super_kwarg...
null
pybio/core/transformations/reshape.py
reshape.py
py
1,979
python
en
code
null
code-starcoder2
76
[ { "api_name": "pybio.core.transformations.PyBioTransformation", "line_number": 9, "usage_type": "name" }, { "api_name": "typing.Sequence", "line_number": 10, "usage_type": "name" }, { "api_name": "pybio.core.array.PyBioArray", "line_number": 14, "usage_type": "name" }, ...
499173101
from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User from django.core.urlresolvers import reverse_lazy from django.utils import timezone from fcfLocation.models import Location from photo.models import CatPicture # Create your models here. RATING_CHOICES = (...
null
cat_info/models.py
models.py
py
2,295
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.db.models.Model", "line_number": 15, "usage_type": "attribute" }, { "api_name": "django.db.models", "line_number": 15, "usage_type": "name" }, { "api_name": "django.db.models.CharField", "line_number": 16, "usage_type": "call" }, { "api_name"...
53954807
from collections import Counter def initInterests(): interests = [ (0, "Hadoop"), (0, "Big Data"), (0, "HBase"), (0, "Java"), (0, "Spark"), (0, "Storm"), (0, "Cassandra"), (1, "NoSQL"), (1, "MongoDB"), (1, "Cassandra"), (1, "HBase"), (1, "Postg...
null
Chapter-01-Introduction/04-Topics-of-Interest.py
04-Topics-of-Interest.py
py
1,663
python
en
code
null
code-starcoder2
76
[ { "api_name": "collections.Counter", "line_number": 30, "usage_type": "call" } ]
526621755
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time, requests,sys, socket, keyboard, schedule, os from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select from selenium.common.exceptions import TimeoutException from selenium.webdriver.supp...
null
BotESAJ-RJ/bot_esajrj.py
bot_esajrj.py
py
4,439
python
en
code
null
code-starcoder2
76
[ { "api_name": "dotenv.load_dotenv", "line_number": 12, "usage_type": "call" }, { "api_name": "socket.gethostname", "line_number": 17, "usage_type": "call" }, { "api_name": "socket.gethostbyname", "line_number": 18, "usage_type": "call" }, { "api_name": "selenium.w...
8510519
from appium import webdriver # 开机 重启 关机 首页 from test_app.task_four.page.main_page import MainPage from test_app.task_four.basepage import BasePage class App(BasePage): def start(self): if self.driver == None: # server 启动参数 desired_caps = {} # 设备信息 # 平台的名称 ...
null
test_app/task_four/app.py
app.py
py
1,922
python
en
code
null
code-starcoder2
76
[ { "api_name": "test_app.task_four.basepage.BasePage", "line_number": 8, "usage_type": "name" }, { "api_name": "appium.webdriver.Remote", "line_number": 37, "usage_type": "call" }, { "api_name": "appium.webdriver", "line_number": 37, "usage_type": "name" }, { "api_...
608857591
"""Basic database schema. Revision ID: fa4b74d9c734 Revises: 147a1cfccba4 Create Date: 2017-09-15 12:29:00.820902 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = 'fa4b74d9c734' down_revision = None JSON = sa.Text().wi...
null
memorious/migrate/versions/fa4b74d9c734_basic_database_schema.py
fa4b74d9c734_basic_database_schema.py
py
3,164
python
en
code
null
code-starcoder2
76
[ { "api_name": "sqlalchemy.Text", "line_number": 17, "usage_type": "call" }, { "api_name": "sqlalchemy.dialects.postgresql.JSONB", "line_number": 17, "usage_type": "attribute" }, { "api_name": "sqlalchemy.dialects.postgresql", "line_number": 17, "usage_type": "name" }, ...
160252060
# -*- coding: utf-8 -*- """ Created on Fri Oct 20 11:05:03 2017 @author: Long """ ### 边检测 import cv2 ## 加载图像 img = cv2.imread('chair.jpg', cv2.IMREAD_GRAYSCALE) # 提取图像高度和宽度 h, w = img.shape # 定义索贝尔滤波器 sobel_horizontal = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=5) sobel_vertical = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksi...
null
Python Machine Learning Cookbook/09_ComputerVision/edge_detector.py
edge_detector.py
py
709
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.imread", "line_number": 12, "usage_type": "call" }, { "api_name": "cv2.IMREAD_GRAYSCALE", "line_number": 12, "usage_type": "attribute" }, { "api_name": "cv2.Sobel", "line_number": 18, "usage_type": "call" }, { "api_name": "cv2.CV_64F", "line...
196155640
from django.conf.urls import url from django.contrib import admin from .import views app_name = 'landlords' urlpatterns = [ url(r'^login$', views.landlord_login, name='login'), # url(r'^upload$', views.landlord_upload, name='upload'), url(r'^register$', views.landlord_register, name='register'), ...
null
mysite/landlords/urls.py
urls.py
py
486
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.urls.url", "line_number": 9, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 12, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 13, "usage_type": "call" }, { "api_name": "django....
516440443
from bs4 import BeautifulSoup import pandas as pd import requests import os from astro_ghost.PS1QueryFunctions import create_df import urllib.request from os import listdir import numpy as np from os.path import isfile, join import matplotlib.pyplot as plt from astro_ghost.PS1QueryFunctions import find_all def remove_...
null
astro_ghost/TNSQueryFunctions.py
TNSQueryFunctions.py
py
3,394
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.listdir", "line_number": 21, "usage_type": "call" }, { "api_name": "pandas.read_csv", "line_number": 23, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.plot", "line_number": 24, "usage_type": "call" }, { "api_name": "matplotlib.pyplot",...
36076613
""" @package api Data import controllers """ from flask import Blueprint, jsonify, redirect, request, make_response, abort from api import log from lib.casevaultdb import UserCollection from oic import rndstr from oic.oic import Client from oic.oic.message import AuthorizationResponse from lib.settings import Settings ...
null
clearnetcore/auth_controller.py
auth_controller.py
py
2,764
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Blueprint", "line_number": 17, "usage_type": "call" }, { "api_name": "jwt.decode", "line_number": 22, "usage_type": "call" }, { "api_name": "flask.request.form", "line_number": 22, "usage_type": "attribute" }, { "api_name": "flask.request", ...
23228727
# # Author: Tyler Reese # File: file_comp.py # Project 3 - Searches through current directory and creates a list of all file names which # are then compared against all of the files in a separate directory to see if there are # any discrepancies. File discrepancies are saved to a dated '.txt' file. # import i...
null
file_comp.py
file_comp.py
py
5,978
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.listdir", "line_number": 25, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 30, "usage_type": "call" }, { "api_name": "os.path", "line_number": 30, "usage_type": "attribute" }, { "api_name": "os.path.isdir", "line_number...
24112107
#!/usr/bin/env python # coding: utf-8 # In[1]: from astropy.visualization import SqrtStretch from astropy.visualization.mpl_normalize import ImageNormalize from astropy.convolution import Gaussian2DKernel from astropy.stats import gaussian_fwhm_to_sigma from astropy.io import fits from photutils import detect_thresh...
null
0.Deblending/param_addDeblend.py
param_addDeblend.py
py
4,610
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.walk", "line_number": 32, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 33, "usage_type": "call" }, { "api_name": "os.path", "line_number": 33, "usage_type": "attribute" }, { "api_name": "astropy.io.fits.open", "line_nu...
570084552
import sqlite3 conn=sqlite3.connect('test.db') cursor=conn.cursor() cursor.execute(""" UPDATE PHONEBOOK SET PHONE=?, EMAIL=? WHERE NAME=? """, ('070-1234-4567', 'psh@shinhye.com', 'aaa')) conn.commit() cursor.execute(""" SELECT NAME, PHONE, EMAIL FROM PHONEBOOK WHERE NAME=? """, ('aaa',)) rows=cursor.fetchall() for...
null
update_record.py
update_record.py
py
438
python
en
code
null
code-starcoder2
76
[ { "api_name": "sqlite3.connect", "line_number": 2, "usage_type": "call" } ]
14209152
from django import forms from django.db import transaction from django.forms import HiddenInput from django.utils.translation import ugettext_lazy as _ from nsc.policy.models import Policy from .models import Organisation class SearchForm(forms.Form): name = forms.CharField(label=_("Stakeholder name"), require...
null
nsc/organisation/forms.py
forms.py
py
2,764
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.forms.Form", "line_number": 11, "usage_type": "attribute" }, { "api_name": "django.forms", "line_number": 11, "usage_type": "name" }, { "api_name": "django.forms.CharField", "line_number": 13, "usage_type": "call" }, { "api_name": "django.for...
495829649
# -*- coding: utf-8 -*- import numpy as np import geatpy as ea # import geatpy from pruning import * import xlwt import argparse # from MyProblem import MyProblem # 导入自定义问题接口 parser = argparse.ArgumentParser(description='PyTorch Slimming CIFAR training') parser.add_argument('--ptarget', type=int, default=32, help='pru...
null
cifar/analyse/ga.py
ga.py
py
4,712
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 9, "usage_type": "call" }, { "api_name": "xlwt.Workbook", "line_number": 16, "usage_type": "call" }, { "api_name": "geatpy.Problem", "line_number": 20, "usage_type": "attribute" }, { "api_name": "numpy.zeros"...
313269820
from Daily import Daily from MultiDays import MultiDays from Analyze import Analyze import os from os import listdir from os.path import isfile,join import sys from functools import reduce import sys #do not read in hidden files def listdir_nohidden(path): for f in os.listdir(path): if not f.startswith(...
null
Main.py
Main.py
py
1,201
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.listdir", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path.join", "line_number": 25, "usage_type": "call" }, { "api_name": "Daily.Daily", "line_number": 26, "usage_type": "call" }, { "api_name": "functools.reduce", "line_numb...
92454493
from math import exp from random import random import numpy as np import matplotlib.pyplot as plt def bipolar_sigmoid(z, derivative=False): if derivative: return 0.5 * (1 + z) * (1 - z) return -1 + 2/(1+np.exp(-z)) class TwoHiddenLayersBipolarNeuralNetwork: def __init__(self, X, T, H, H2, alpha)...
null
two_hidden_layers.py
two_hidden_layers.py
py
3,847
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.exp", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 19, "usage_type": "call" }, { "api_name": "numpy.random.rand", "line_number": 20, "usage_type": "call" }, { "api_name": "numpy.random", "line_numb...
48232694
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : draw_circle.py # @Date : 2018/12/24 import sys import time import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((600, 500)) pygame.display.set_caption("Drawing Circle") pos_x = 300 pos_y = 250 vel_x = 2 vel_y = 1 while True...
null
pie/draw_circle.py
draw_circle.py
py
871
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.init", "line_number": 12, "usage_type": "call" }, { "api_name": "pygame.display.set_mode", "line_number": 13, "usage_type": "call" }, { "api_name": "pygame.display", "line_number": 13, "usage_type": "attribute" }, { "api_name": "pygame.displa...
179181760
import torch import torchvision import torch.nn as nn import torch.optim as optim import torchvision.transforms as transforms import torch.nn.functional as F from tqdm import tqdm # 定义网络结构 class AlexNet(nn.Module): def __init__(self): super(AlexNet, self).__init__() self.name = "AlexNet" ...
null
AlexNet.py
AlexNet.py
py
7,148
python
en
code
null
code-starcoder2
76
[ { "api_name": "torch.nn.Module", "line_number": 11, "usage_type": "attribute" }, { "api_name": "torch.nn", "line_number": 11, "usage_type": "name" }, { "api_name": "torch.nn.Conv2d", "line_number": 18, "usage_type": "call" }, { "api_name": "torch.nn", "line_nu...
433479458
#!/usr/bin/env python import random import pytest from radical.repex import algorithms as rxa # ------------------------------------------------------------------------------ # class Replica(): def __init__(self, rid): self.rid = rid # -----------------------------------------------------------------...
null
tests/test_async/test_async.py
test_async.py
py
2,008
python
en
code
null
code-starcoder2
76
[ { "api_name": "radical.repex.algorithms.select_replicas_1D", "line_number": 22, "usage_type": "attribute" }, { "api_name": "radical.repex.algorithms", "line_number": 22, "usage_type": "name" }, { "api_name": "radical.repex.algorithms.select_replicas_test", "line_number": 23, ...
115218474
'''scrapesy - easy web scraper and file downloader provides downloading with cache as well as parsing in get() function ''' import requests import pickle from bs4 import BeautifulSoup class Page: '''Page - a Web page Page.page is a BeautifulSoup object Page.request is a requests request object ''' ...
null
scrapesy/__init__.py
__init__.py
py
2,346
python
en
code
null
code-starcoder2
76
[ { "api_name": "pickle.dumps", "line_number": 24, "usage_type": "call" }, { "api_name": "pickle.loads", "line_number": 36, "usage_type": "call" }, { "api_name": "pickle.loads", "line_number": 38, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_...
70423552
import os, sys, argparse from PIL import Image import numpy as np from predict import COCODemo import cv2 def getCGF(args): from maskrcnn_benchmark.config import cfg cfg.merge_from_file(args.cfg) cfg.MODEL.WEIGHT = args.model #assert os.path.exists(cfg.OUTPUT_DIR) cfg.merge_from_list(args.opts) ...
null
tools/counter.py
counter.py
py
2,104
python
en
code
null
code-starcoder2
76
[ { "api_name": "maskrcnn_benchmark.config.cfg.merge_from_file", "line_number": 10, "usage_type": "call" }, { "api_name": "maskrcnn_benchmark.config.cfg", "line_number": 10, "usage_type": "name" }, { "api_name": "maskrcnn_benchmark.config.cfg.MODEL", "line_number": 11, "usa...
512672445
# coding: utf-8 import socketserver import datetime import os # Copyright 2013 Abram Hindle, Eddie Antonio Santos # # 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.apach...
null
server.py
server.py
py
5,610
python
en
code
null
code-starcoder2
76
[ { "api_name": "socketserver.BaseRequestHandler", "line_number": 36, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 41, "usage_type": "call" }, { "api_name": "os.path", "line_number": 41, "usage_type": "attribute" }, { "api_name": "dat...
344183898
import logging import json from flask import Flask, request from commands import DialogManager, State, COMMANDS from ui import UI app = Flask(__name__) logging.basicConfig(level=logging.INFO) sessionStorage = {} @app.route('/post', methods=['POST']) def main(): res = { 'session': request.json['session']...
null
main.py
main.py
py
1,943
python
en
code
null
code-starcoder2
76
[ { "api_name": "flask.Flask", "line_number": 8, "usage_type": "call" }, { "api_name": "logging.basicConfig", "line_number": 9, "usage_type": "call" }, { "api_name": "logging.INFO", "line_number": 9, "usage_type": "attribute" }, { "api_name": "flask.request.json", ...
442624019
import pygame from collections import deque from numba import njit from numba.core import types from numba.typed import Dict from numba import int32 import random from map import * import math @njit(fastmath = True, cache = True) def mapping(a, b): return int(a // 100) * 100, int(b // 100) * 100 @njit(fastmath ...
null
Grey Dungeon Project/Grey Dungeon (compiled ver.)/world.py
world.py
py
22,237
python
en
code
null
code-starcoder2
76
[ { "api_name": "numba.njit", "line_number": 12, "usage_type": "call" }, { "api_name": "math.pi", "line_number": 23, "usage_type": "attribute" }, { "api_name": "math.sin", "line_number": 25, "usage_type": "call" }, { "api_name": "math.cos", "line_number": 27, ...
465827586
import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from pymongo.mongo_client import MongoClient from movieproject.items import MovieprojectItem class MovieSpider(CrawlSpider): #初始化爬虫对象是调用该方法 def __init__(self): #调用父类的方法 super().__init__(se...
null
movieproject/movieproject/spiders/movie.py
movie.py
py
2,355
python
en
code
null
code-starcoder2
76
[ { "api_name": "scrapy.spiders.CrawlSpider", "line_number": 7, "usage_type": "name" }, { "api_name": "pymongo.mongo_client.MongoClient", "line_number": 13, "usage_type": "call" }, { "api_name": "scrapy.linkextractors.LinkExtractor", "line_number": 22, "usage_type": "call" ...
370361680
#!/usr/bin/env python3 # API Python wrapper for The Next Generation Vulnerability & Threat Intelligence Database - https://vfeed.io # Copyright (C) 2013 - 2018 vFeed IO import json from lib.Database import Database from common import utils as utility class Inspection(object): def __init__(self, id): ""...
null
core/Inspection.py
Inspection.py
py
3,191
python
en
code
null
code-starcoder2
76
[ { "api_name": "lib.Database.Database", "line_number": 15, "usage_type": "call" }, { "api_name": "common.utils.serialize_data", "line_number": 35, "usage_type": "call" }, { "api_name": "common.utils", "line_number": 35, "usage_type": "name" }, { "api_name": "common...
97203162
from django import template register = template.Library() #import re #from urllib.parse import urlparse #from http.client import HTTPSConnection #def expand(url): # o = urlparse(url) # con = HTTPSConnection(o.netloc) # con.request('HEAD', o.path) # res = con.getresponse() # if res.getheader('location')...
null
apps/twitter/templatetags/twitter_tag.py
twitter_tag.py
py
935
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.template.Library", "line_number": 2, "usage_type": "call" }, { "api_name": "django.template", "line_number": 2, "usage_type": "name" } ]
177361413
#Importando biblioteca do OpenCV import cv2 #Lendo imagens img1 = cv2.imread('../images/shark.jpg', cv2.IMREAD_COLOR) img2 = cv2.imread('../images/shark.jpg', cv2.IMREAD_GRAYSCALE) #Mostrando imagens cv2.imshow('Colorida', img1) cv2.imshow('Escala de cinza', img2) #E preciso informar que o programa deve esperar algu...
null
01Exemplopy/abririmagem.py
abririmagem.py
py
434
python
en
code
null
code-starcoder2
76
[ { "api_name": "cv2.imread", "line_number": 5, "usage_type": "call" }, { "api_name": "cv2.IMREAD_COLOR", "line_number": 5, "usage_type": "attribute" }, { "api_name": "cv2.imread", "line_number": 6, "usage_type": "call" }, { "api_name": "cv2.IMREAD_GRAYSCALE", "...
482623951
#coding: utf-8 import time import datetime try: import simplejson as json except ImportError: import json from django.shortcuts import render_to_response from django.template import RequestContext from django.http import HttpResponse def expire_in(**kwargs): def renderer(func): def wrapper(reque...
null
views/decorators.py
decorators.py
py
7,285
python
en
code
null
code-starcoder2
76
[ { "api_name": "time.altzone", "line_number": 19, "usage_type": "attribute" }, { "api_name": "datetime.datetime.today", "line_number": 22, "usage_type": "call" }, { "api_name": "datetime.datetime", "line_number": 22, "usage_type": "attribute" }, { "api_name": "date...
25883030
import sys import struct import datetime import time import numpy as np import pprint from path_parts import PathParts from sdal_spectrum import SdalSpectrum class AsdReader: ''' Read a .asd file into SdalSpectrum object ''' def __init__(self): self._warn = "**WARNING: AsdReader**\n " ...
null
asd_reader.py
asd_reader.py
py
11,088
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.linspace", "line_number": 56, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 61, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 63, "usage_type": "call" }, { "api_name": "path_parts.PathParts", "li...
643386087
import openpyxl def read07Excel(path): rb = openpyxl.load_workbook(path) # # 读数据 sheet = rb.get_sheet_by_name(rb.sheetnames[0]) max_row = sheet.max_row max_column = sheet.max_column print(sheet.max_row) # 最大行数 print(sheet.max_column) # 最大列数 print(sheet['C2'].value) # 关键词 name...
null
Repositories/isSensitiveWords/isSensitiveWords.py
isSensitiveWords.py
py
1,540
python
en
code
null
code-starcoder2
76
[ { "api_name": "openpyxl.load_workbook", "line_number": 5, "usage_type": "call" } ]
453739377
import hashlib import json import math import random import string from time import time from uhttp.auth import login, auth_required from uhttp.core import HTTPFound, Request, Response def api_response(status=True, data=None, error=None, headers=None): response = { "status": status } if data is not None: ...
null
evernotebot/web/admin/api.py
api.py
py
1,888
python
en
code
null
code-starcoder2
76
[ { "api_name": "json.dumps", "line_number": 18, "usage_type": "call" }, { "api_name": "uhttp.core.Response", "line_number": 19, "usage_type": "call" }, { "api_name": "uhttp.core.Request", "line_number": 22, "usage_type": "name" }, { "api_name": "uhttp.auth.login", ...
637588294
import argparse def checkSyntax(): # Script syntax parser = argparse.ArgumentParser() parser.add_argument("file", help="CSV database with crimes", type=argparse.FileType('r')) parser.add_argument("q_lat", help="amount of cell along latitude", type=int) parser.add_argument("q_lon", help="amount...
null
fwdfiles/syntax.py
syntax.py
py
2,354
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 6, "usage_type": "call" }, { "api_name": "argparse.FileType", "line_number": 7, "usage_type": "call" } ]
408129847
#!/usr/bin/env python3 """ Author : patricklohr Date : 2019-05-07 Purpose: Rock the Casbah """ import argparse import sys import re import os from statistics import mean # -------------------------------------------------- def get_args(): """get command-line arguments""" parser = argparse.ArgumentParser( ...
null
assignments/finals/grad/averager/averager.py
averager.py
py
1,583
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 17, "usage_type": "call" }, { "api_name": "argparse.ArgumentDefaultsHelpFormatter", "line_number": 19, "usage_type": "attribute" }, { "api_name": "sys.stderr", "line_number": 30, "usage_type": "attribute" }, { ...
650528930
import serial #identifying paramaters for serial comm ser = serial.Serial('/dev/ttyUSB0', 230400, timeout=.5) #ascii <*> initiates serial comm with controller, ascii carriage return <\r> ends it #function which reads the current temperature of the controller def temp_view(): ser.close() ser.open()...
null
serial_com.py
serial_com.py
py
1,615
python
en
code
null
code-starcoder2
76
[ { "api_name": "serial.Serial", "line_number": 5, "usage_type": "call" } ]
373348824
import json import os import shutil import dateutil.parser from os import path from clint.textui import prompt import repo import commit def sizeof_fmt(num): """ Parameters ---------- num : number number bytes of bytes to turn into human readable form Returns ------- string : bytes as human readable string ...
null
rino/list.py
list.py
py
1,974
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.join", "line_number": 38, "usage_type": "call" }, { "api_name": "os.path", "line_number": 38, "usage_type": "name" }, { "api_name": "os.getcwd", "line_number": 38, "usage_type": "call" }, { "api_name": "repo.is_repo", "line_number": 40, ...
244298925
# -*- coding: utf-8 -*- # author: peilun # 提取图像,用于pytorch提取特征 # 车辆处于图像中间位置,detection框分数大于一定阈值,并且与其他框iou不大于0.7 import numpy as np import os import cv2 input_dir = "../aic19-track1-mtmc/train" out_dir = "../aic19-track1-mtmc/adjust_c_cropped_imgs" IMAGE_SIZE = 224 TH_SCORE = 0.5 PAD_SIZE = 10 IOU_TH = 0.7 W_PAD = 0 H_P...
null
src/main_pipeline/1_crop_vehicle_img_from_vdo.py
1_crop_vehicle_img_from_vdo.py
py
7,644
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.ones", "line_number": 23, "usage_type": "call" }, { "api_name": "numpy.linalg.inv", "line_number": 29, "usage_type": "call" }, { "api_name": "numpy.linalg", "line_number": 29, "usage_type": "attribute" }, { "api_name": "cv2.copyMakeBorder", ...
360765242
import logging import jax.numpy as jnp from pyscf import gto from pyscf.mcscf import CASSCF from pyscf.scf import RHF from ...utils import pad_list_of_3D_arrays_to_one_array log = logging.getLogger(__name__) def pyscf_from_mol(mol, basis, cas=None, **kwargs): r"""Create a pyscf molecule and perform an SCF calc...
null
src/deepqmc/wf/baseline/pyscfext.py
pyscfext.py
py
4,919
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 10, "usage_type": "call" }, { "api_name": "jax.numpy.invert", "line_number": 24, "usage_type": "call" }, { "api_name": "jax.numpy", "line_number": 24, "usage_type": "name" }, { "api_name": "pyscf.gto.M", "line_...
272540097
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import os.path import re import sys import urllib import urllib3 from tkinter import * from excel_tool import * import tkinter.filedialog import threading import hashlib import requests urllib3.disable_warnings() def md5(message, salt=''): new_s = str(messag...
null
XTImageDownloader.py
XTImageDownloader.py
py
7,447
python
en
code
null
code-starcoder2
76
[ { "api_name": "urllib3.disable_warnings", "line_number": 16, "usage_type": "call" }, { "api_name": "hashlib.md5", "line_number": 21, "usage_type": "call" }, { "api_name": "os.path.exists", "line_number": 44, "usage_type": "call" }, { "api_name": "os.path", "li...
310947879
import pygame import sys import Quad_Tree_Project_2 import random class Window: def __init__(self, w, h): self.w = w self.h = h self.screen = pygame.display.set_mode((self.w, self.h)) def fill(self): self.screen.fill((255, 255, 255)) screen = Window(600, 600)...
null
Quad_Tree_Project_2/test1.py
test1.py
py
2,302
python
en
code
null
code-starcoder2
76
[ { "api_name": "pygame.display.set_mode", "line_number": 11, "usage_type": "call" }, { "api_name": "pygame.display", "line_number": 11, "usage_type": "attribute" }, { "api_name": "pygame.init", "line_number": 18, "usage_type": "call" }, { "api_name": "pygame.time.C...
180999984
import json import inspect import pytest from pyco.code import Code from pyco.function import Function from pyco import errors, helpers def test_code_with_error(): with pytest.raises(errors.ValidationError) as err: Function() assert err.value.args assert err.value.messages def test_simple_fn(hello_world...
null
tests/test_function.py
test_function.py
py
2,408
python
en
code
null
code-starcoder2
76
[ { "api_name": "pytest.raises", "line_number": 12, "usage_type": "call" }, { "api_name": "pyco.errors.ValidationError", "line_number": 12, "usage_type": "attribute" }, { "api_name": "pyco.errors", "line_number": 12, "usage_type": "name" }, { "api_name": "pyco.funct...
227044782
#!/usr/bin/python import argparse # def find_max_profit(prices): # maximum = prices[1] - prices[0] # for i in range(0, len(prices) - 1): # for k in range(i + 1, len(prices) - 1): # if prices[k] - prices[i] > maximum: # maximum = (prices[k] - prices[i]) # # print(prices[i], 'i') # ...
null
stock_prices/stock_prices.py
stock_prices.py
py
1,114
python
en
code
null
code-starcoder2
76
[ { "api_name": "argparse.ArgumentParser", "line_number": 29, "usage_type": "call" } ]
180661343
from django.conf.urls import url from Tango_app.views import IndexView,AboutView,LoginView ,GWView,RegisterView,GW_Mdf_View,GW_AjaxView,GW_MdfView_ajax,PRD_View,PRD_ViewAjax,PRD_MdfView,PRD_MdfViewAjax,DF_View,DF_AjaxView,DF_MdfView,DF_MdfViewAjax,ZJ_View,ZJ_AjaxView,ZJ_MdfView,ZJ_MdfViewAjax,OUT_View,OUT_AjaxView,OUT...
null
Tango/Tango_app/urls.py
urls.py
py
2,610
python
en
code
null
code-starcoder2
76
[ { "api_name": "django.conf.urls.url", "line_number": 4, "usage_type": "call" }, { "api_name": "Tango_app.views.IndexView.as_view", "line_number": 4, "usage_type": "call" }, { "api_name": "Tango_app.views.IndexView", "line_number": 4, "usage_type": "name" }, { "api...
443488935
#!/usr/bin/env python # python script to run the D meson jet analysis on 2010 pp data import argparse import yaml import IPython import DMesonJetResponse import DMesonJetProjectors import subprocess import ROOT globalList = [] def main(config, maxEvents, suffix, format, doNotAsk, bg): if bg: ROOT.gROOT.SetBatch...
null
DMesonJetAnalysis/runResponseAnalysis.py
runResponseAnalysis.py
py
2,271
python
en
code
null
code-starcoder2
76
[ { "api_name": "ROOT.gROOT.SetBatch", "line_number": 16, "usage_type": "call" }, { "api_name": "ROOT.gROOT", "line_number": 16, "usage_type": "attribute" }, { "api_name": "ROOT.TH1.AddDirectory", "line_number": 18, "usage_type": "call" }, { "api_name": "ROOT.TH1", ...
9482944
""" Experiment summary ------------------ Treat each province/state in a country cases over time as a vector, do a simple K-Nearest Neighbor between countries. What country has the most similar trajectory to a given country? This one is different in that it uses the difference in cases from day to day, rather than th...
null
exp/knn_diff.py
knn_diff.py
py
5,729
python
en
code
null
code-starcoder2
76
[ { "api_name": "sys.path.insert", "line_number": 14, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 14, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 36, "usage_type": "call" }, { "api_name": "os.path", "line_number...
401673023
from django.urls import include, path from rest_framework import routers from quickstart import views routers = routers.DefaultRouter() routers.register(r'users', views.UserViewSet) routers.register(r'groups', views.GroupViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for...
null
quickstart/urls.py
urls.py
py
477
python
en
code
null
code-starcoder2
76
[ { "api_name": "rest_framework.routers", "line_number": 5, "usage_type": "name" }, { "api_name": "rest_framework.routers.DefaultRouter", "line_number": 5, "usage_type": "call" }, { "api_name": "rest_framework.routers.register", "line_number": 6, "usage_type": "call" }, ...
481142770
# -*- coding: utf-8 -*- import os import rsa import json import base64 import urllib import logging import requests from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from luckycommon.db.pay import get_pay, update_pay_ext from luckycommon.db.transaction import (add...
null
luckycommon/third/alipay.py
alipay.py
py
6,969
python
en
code
null
code-starcoder2
76
[ { "api_name": "logging.getLogger", "line_number": 28, "usage_type": "call" }, { "api_name": "logging.getLogger", "line_number": 29, "usage_type": "call" }, { "api_name": "django.conf.settings.ROOT_URL", "line_number": 38, "usage_type": "attribute" }, { "api_name":...
15577770
#--------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #---------------------------------------------------------------------...
null
src/command_modules/azure-cli-keyvault/azure/cli/command_modules/keyvault/tests/test_keyvault_commands.py
test_keyvault_commands.py
py
16,759
python
en
code
null
code-starcoder2
76
[ { "api_name": "os.path.abspath", "line_number": 15, "usage_type": "call" }, { "api_name": "os.path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "os.path.join", "line_number": 15, "usage_type": "call" }, { "api_name": "azure.cli.core.test_utils.v...
497275091
import networkx as nx import json import matplotlib.pyplot as plt def getKey(dictionary, value): """ A basic function that returns the key(s) from dictionary that corresponds with value. Parameters: * dictionary: the dictionary used to search for the value * value: the value whose key(s) is being ...
null
DataChallenge/AuthorGraph/PubGraphNetwork.py
PubGraphNetwork.py
py
13,133
python
en
code
null
code-starcoder2
76
[ { "api_name": "networkx.MultiDiGraph", "line_number": 79, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 90, "usage_type": "call" }, { "api_name": "networkx.get_node_attributes", "line_number": 96, "usage_type": "call" }, { "api_name": "network...
95501993
#!/usr/bin/python #-*- coding: utf-8 -*- #Developer by Bafomet #и одного импорта хватит с головой import requests # Set color R = '\033[31m' # Red N = '\033[1;37m' # White G = '\033[32m' # Green O = '\033[0;33m' # Orange B = '\033[1;34m' # Blue P = '\033[1;35m' # Purple def maildb(emailaddress): if ("@" and ...
null
plugins/maildb.py
maildb.py
py
1,434
python
en
code
null
code-starcoder2
76
[ { "api_name": "requests.get", "line_number": 17, "usage_type": "call" } ]
481195614
import requests import json from config import keys class ConvertionException(Exception): pass class CurrencyConverter: @staticmethod def get_price(base: str, quote: str, amount: str): if quote == base: raise ConvertionException(f'Невозможно конвертировать одинаковые валют...
null
extensions.py
extensions.py
py
1,162
python
en
code
null
code-starcoder2
76
[ { "api_name": "config.keys", "line_number": 16, "usage_type": "name" }, { "api_name": "config.keys", "line_number": 21, "usage_type": "name" }, { "api_name": "requests.get", "line_number": 30, "usage_type": "call" }, { "api_name": "json.loads", "line_number": ...
583125296
from bokeh.plotting import figure from bokeh.io import curdoc from bokeh.models.annotations import LabelSet from bokeh.models import ColumnDataSource, Range1d from bokeh.models.widgets import Select, Slider, RadioButtonGroup from bokeh.layouts import layout # Source Data source_original = ColumnDataSource(dict(averag...
null
server5.py
server5.py
py
1,985
python
en
code
null
code-starcoder2
76
[ { "api_name": "bokeh.models.ColumnDataSource", "line_number": 10, "usage_type": "call" }, { "api_name": "bokeh.models.ColumnDataSource", "line_number": 14, "usage_type": "call" }, { "api_name": "bokeh.plotting.figure", "line_number": 19, "usage_type": "call" }, { ...
167343067
import numpy as np import math import matplotlib.pyplot as plt from scipy.constants import speed_of_light, epsilon_0, mu_0 class MeasureTransmittance: ''' Measure transmittance through a layer ''' def __init__(self,layer,t,field, fieldDispersed): #Border of the layer self._endIndex...
null
fdtd/1d/src/measure/Transmittance.py
Transmittance.py
py
4,851
python
en
code
null
code-starcoder2
76
[ { "api_name": "numpy.array", "line_number": 18, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 21, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 22, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": ...