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
563210221
import tensorflow as tf from keras.callbacks import ModelCheckpoint from keras.models import load_model import os import gc import pickle import numpy as np from util import * from dataset import Dataset from score import report_score from model import build_mlp from sklearn.metrics import classification_report np.ran...
null
main.py
main.py
py
4,263
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.random.seed", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.random", "line_number": 14, "usage_type": "attribute" }, { "api_name": "tensorflow.set_random_seed", "line_number": 15, "usage_type": "call" }, { "api_name": "pickle...
299561723
# -*- coding: utf-8 -*- from selenium import webdriver import logging logger = logging.getLogger('services.service_base') class ServiceBase(object): def __init__(self, driver=None): if not driver: logger.debug('Initializing Firefox driver') self.driver = webdriver.Firefox() ...
null
tariffs/services/service_base.py
service_base.py
py
355
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 6, "usage_type": "call" }, { "api_name": "selenium.webdriver.Firefox", "line_number": 13, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 13, "usage_type": "name" } ]
585549799
import Tkinter as tk from ttk import * import datetime import sucr_input import sucr_status_UI import sucr_sensor_UI import os import cv2 from husky_msgs.msg import HuskyStatus # Manages the visual GUI methods class WindowManager: # Initializes the windows of the GUI def __init__(self,config): self.config = ...
null
snorkeling_crocodilian_remote/scripts/sucr_gui.py
sucr_gui.py
py
9,882
python
en
code
null
code-starcoder2
66
[ { "api_name": "Tkinter.Tk", "line_number": 23, "usage_type": "call" }, { "api_name": "Tkinter.Frame", "line_number": 26, "usage_type": "call" }, { "api_name": "Tkinter.Frame", "line_number": 27, "usage_type": "call" }, { "api_name": "Tkinter.Frame", "line_numb...
588774432
from __future__ import annotations import datetime import pydantic import typing from pydantic import BaseModel from swagger_codegen.api.base import BaseApi from swagger_codegen.api.request import ApiRequest from swagger_codegen.api import json class Cliente(BaseModel): cpf: typing.Optional[str] = None ende...
null
cliente/apis/clientes/get__api_clientes_cpf.py
get__api_clientes_cpf.py
py
1,338
python
en
code
null
code-starcoder2
66
[ { "api_name": "pydantic.BaseModel", "line_number": 12, "usage_type": "name" }, { "api_name": "typing.Optional", "line_number": 13, "usage_type": "attribute" }, { "api_name": "typing.Optional", "line_number": 14, "usage_type": "attribute" }, { "api_name": "typing.O...
524361589
from __future__ import print_function import ee import os ee.Initialize() def copy(collection_path,final_path): assets_list = ee.data.getList(params={'id': collection_path}) assets_names = [os.path.basename(asset['id']) for asset in assets_list] print('Copying a total of '+str(len(assets_names))+'.....') ...
null
geeadd/batch_copy.py
batch_copy.py
py
720
python
en
code
null
code-starcoder2
66
[ { "api_name": "ee.Initialize", "line_number": 4, "usage_type": "call" }, { "api_name": "ee.data.getList", "line_number": 7, "usage_type": "call" }, { "api_name": "ee.data", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.path.basename", "line_...
307512858
import sys sys.path.append('./') import pandas as pd import trueskill as th from importlib import reload reload(th) path = './simulacion.csv' df = pd.read_csv(path) env = th.TrueSkill(mu=25.0, sigma=25/3, beta=25/6, tau=0.5, draw_probability=0.0, ) player = {} ptrueskill = {} # Can define an other Prior globalPrior =...
null
Analisis/simulacion/trueskill_original.py
trueskill_original.py
py
783
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 2, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 2, "usage_type": "attribute" }, { "api_name": "importlib.reload", "line_number": 7, "usage_type": "call" }, { "api_name": "pandas.read_csv", "li...
68811188
import sys, os sys.path.insert(0, os.getenv("HOME")+'/dark/common') # add folder of Class import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np import healpy as hp import pylab as pl import operator from restore import restore ## Read NHI fro...
null
dust/tau2nh/patch_cut_94src.py
patch_cut_94src.py
py
3,489
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.insert", "line_number": 2, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 2, "usage_type": "attribute" }, { "api_name": "os.getenv", "line_number": 2, "usage_type": "call" }, { "api_name": "restore.restore", "line_numb...
155998108
# -*- coding: utf-8 -*- """ Created on Tue Feb 11 18:07:06 2020 @author: Raj """ import pyUSID as usid import ffta from ffta.pixel import Pixel from ffta.pixel_utils import badpixels import os import numpy as np from ffta.load import get_utils from pyUSID.processing.comp_utils import parallel_compute from pyUSID.io.w...
null
ffta/hdf_utils/process.py
process.py
py
16,945
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyUSID.Process", "line_number": 22, "usage_type": "attribute" }, { "api_name": "pyUSID.hdf_utils.get_attributes", "line_number": 91, "usage_type": "call" }, { "api_name": "pyUSID.hdf_utils", "line_number": 91, "usage_type": "attribute" }, { "api_nam...
351232263
import facebook import sys import os import time from random import randint from datetime import datetime from pymongo import MongoClient, DESCENDING, ASCENDING organization = "HackMcGill" #could be an environment variable sessionKey = os.environ['FB_SESSION_KEY'] pageID = os.environ['FB_PAGE_ID'] client = MongoClient...
null
poster.py
poster.py
py
2,696
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ", "line_number": 10, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 11, "usage_type": "attribute" }, { "api_name": "pymongo.MongoClient", "line_number": 12, "usage_type": "call" }, { "api_name": "os.environ.get", ...
565745369
import unittest from unittest.mock import Mock, call from scripts.FirestoreClient import FirestoreClient class TestFirestoreClient(unittest.TestCase): def test_set_peoples(self): paul = { 'name': 'Paul', 'text': 'Beautiful summary of paul', 'birth_date': '13 april 1990...
null
back/tests/FirestoreClient_test.py
FirestoreClient_test.py
py
1,758
python
en
code
null
code-starcoder2
66
[ { "api_name": "unittest.TestCase", "line_number": 6, "usage_type": "attribute" }, { "api_name": "unittest.mock.Mock", "line_number": 25, "usage_type": "call" }, { "api_name": "scripts.FirestoreClient.FirestoreClient", "line_number": 30, "usage_type": "call" }, { "...
116419381
import numpy as np import imageio import glob def load_mnist(): # Loads the MNIST dataset from png images NUM_LABELS = 10 # create list of image objects test_images = [] test_labels = [] for label in range(NUM_LABELS): for image_path in glob.glob("/Users/ZwYu/Desktop/...
null
load_mnist.py
load_mnist.py
py
1,570
python
en
code
null
code-starcoder2
66
[ { "api_name": "glob.glob", "line_number": 14, "usage_type": "call" }, { "api_name": "imageio.imread", "line_number": 15, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 26, "usage_type": "call" }, { "api_name": "imageio.imread", "line_number"...
44227258
from __future__ import absolute_import, division, print_function import re import numpy as np from qtpy.QtCore import Qt from qtpy import QtGui from qtpy.QtWidgets import (QDialog, QApplication, QPushButton, QLabel, QWidget, QHBoxLayout, QVBoxLayout, QLineEdit, QComboBox) from astropy.st...
null
cubeviz/tools/collapse_cube.py
collapse_cube.py
py
22,950
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.sum", "line_number": 18, "usage_type": "attribute" }, { "api_name": "numpy.mean", "line_number": 19, "usage_type": "attribute" }, { "api_name": "numpy.median", "line_number": 20, "usage_type": "attribute" }, { "api_name": "numpy.std", "lin...
192249130
import serial import struct import re import threading import time import config # test = serial.Serial("COM14", 9600,bytesize=8, parity='N',timeout=200) global_flag = 1 # target_mode = 'PS' target_mode = 'BT' class SerialPort: message = '' def __init__(self, port, buand): super(SerialPort, self).__in...
null
set_mode.py
set_mode.py
py
2,310
python
en
code
null
code-starcoder2
66
[ { "api_name": "serial.Serial", "line_number": 17, "usage_type": "call" }, { "api_name": "struct.pack", "line_number": 32, "usage_type": "call" }, { "api_name": "struct.pack", "line_number": 44, "usage_type": "call" }, { "api_name": "struct.pack", "line_number"...
533265853
from DatasetCreator import DatasetCreator import sys import pandas as pd import os sys.path.append("/home/usi/Documents/Drone/FrontNetPorting") import config def CreatePickle(subject_name, rosbagfolder, delay=0): rosbagName = rosbagfolder + subject_name + ".bag" pickleName = config.folder_path + "/../Pickles/1...
null
DataProcessing/HimaxScripts.py
HimaxScripts.py
py
2,277
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 6, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 6, "usage_type": "attribute" }, { "api_name": "config.folder_path", "line_number": 15, "usage_type": "attribute" }, { "api_name": "DatasetCreator.Da...
397421335
import time from django.http import HttpResponse, HttpResponseRedirect from django.template import loader from .models import * from forum.models import ForumMember import operator #for sorting objects from different tables in one aggregated list from .forms import UploadSonForm, SubscribeForm from django.shortcuts i...
null
views.py
views.py
py
9,917
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.core.paginator.Paginator", "line_number": 38, "usage_type": "call" }, { "api_name": "time.strftime", "line_number": 42, "usage_type": "call" }, { "api_name": "django.template.loader.get_template", "line_number": 53, "usage_type": "call" }, { ...
638136417
import logging import time from datetime import datetime from typing import Any, List, Optional, Union, Dict def is_list(x: Any) -> bool: """Check if input is a list or list-like. Parameters ---------- x: any the object being checked, usually a frame/list of frames or record in the proc...
null
ink/core/forge/joins/core/utils.py
utils.py
py
5,512
python
en
code
null
code-starcoder2
66
[ { "api_name": "typing.Any", "line_number": 7, "usage_type": "name" }, { "api_name": "typing.Any", "line_number": 25, "usage_type": "name" }, { "api_name": "typing.List", "line_number": 25, "usage_type": "name" }, { "api_name": "typing.List", "line_number": 43,...
601993484
#!/usr/bin/env python3 from pgmpy import Exceptions import numpy as np from collections import OrderedDict from pgmpy.Factor._factor_product import _factor_product import functools class Factor: """ Base class for *Factor*. >>> phi = Factor(['x1', 'x2', 'x3'], [2, 2, 2], np.ones(8)) Defined above, ...
null
pgmpy/Factor/Factor.py
Factor.py
py
11,499
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.OrderedDict", "line_number": 66, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 70, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 71, "usage_type": "call" }, { "api_name": "numpy.double", "l...
379839511
''' Created on Jun 25, 2017 @author: Justin Veyna and Paxton Wong ''' import SaveLoader as sl from collections import defaultdict PROGRESS_FILE = "data_files/SavedProgress.p" def load_progress_from_file(): char_dict = defaultdict(int) try: char_dict = sl.pickle_load(PROGRESS_FILE) except: ...
null
ProgressLoader.py
ProgressLoader.py
py
551
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.defaultdict", "line_number": 13, "usage_type": "call" }, { "api_name": "SaveLoader.pickle_load", "line_number": 15, "usage_type": "call" }, { "api_name": "SaveLoader.pickle_save", "line_number": 17, "usage_type": "call" }, { "api_name": ...
450049232
import os import pytest @pytest.fixture def test_file(tmpdir): """Fixture for providing a test file to pass to mwcp.""" file_path = os.path.join(str(tmpdir), 'test.txt') with open(file_path, 'wb') as f: f.write(b"This is some test data!") return file_path @pytest.fixture def test_dir(tmpdi...
null
tests/conftest.py
conftest.py
py
1,165
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "line_number": 10, "usage_type": "attribute" }, { "api_name": "pytest.fixture", "line_number": 7, "usage_type": "attribute" }, { "api_name": "os.path.join", "line...
595594792
from django.conf.urls import url from . import views app_name = 'ui' urlpatterns = [ url(r'^signup$', views.signup, name='signup'), url(r'^main$', views.landing, name='landing'), url(r'^league/join$', views.league_join, name='league_join'), url(r'^league/join/submit$', views.league_join_submit, ...
null
ui/urls.py
urls.py
py
1,065
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.conf.urls.url", "line_number": 6, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 7, "usage_type": "call" }, { "api_name": "django.conf.urls.url", "line_number": 8, "usage_type": "call" }, { "api_name": "django.co...
619946361
from tester import * from PIL import Image, EpsImagePlugin import io if not EpsImagePlugin.has_ghostscript(): skip() # Our two EPS test files (they are identical except for their bounding boxes) file1 = "Tests/images/zero_bb.eps" file2 = "Tests/images/non_zero_bb.eps" # Due to palletization, we'll need to conve...
null
Tests/test_file_eps.py
test_file_eps.py
py
4,047
python
en
code
null
code-starcoder2
66
[ { "api_name": "PIL.EpsImagePlugin.has_ghostscript", "line_number": 6, "usage_type": "call" }, { "api_name": "PIL.EpsImagePlugin", "line_number": 6, "usage_type": "name" }, { "api_name": "PIL.Image.open", "line_number": 25, "usage_type": "call" }, { "api_name": "PI...
385398032
""" WIP """ from curses import cbreak, nocbreak, echo, noecho, flushinp, KEY_RIGHT, KEY_LEFT from redditclient import RedditClient class CursesClient(object): """ Handles drawing the text based UI """ __FLUSH = 0 __MARGIN_Y = 2 __MARGIN_X = 2 def __init__(self, stdscr): self.std...
null
cursesclient.py
cursesclient.py
py
6,599
python
en
code
null
code-starcoder2
66
[ { "api_name": "redditclient.RedditClient", "line_number": 20, "usage_type": "call" }, { "api_name": "curses.flushinp", "line_number": 98, "usage_type": "call" }, { "api_name": "curses.nocbreak", "line_number": 108, "usage_type": "call" }, { "api_name": "curses.ech...
489614960
import sqlite3 from sqlite3 import Error def choice(): print(""" Put 1 to pull up the customer menu, 2 for the books menu, 3 to pull up the orders, 4 to exit code. """) answer = int(input(">")) while answer <= 1 >= 3: # Unlimited loop for the menu choice() if answe...
null
Assignment13.py
Assignment13.py
py
9,506
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlite3.connect", "line_number": 209, "usage_type": "call" }, { "api_name": "sqlite3.Error", "line_number": 211, "usage_type": "name" }, { "api_name": "sqlite3.Error", "line_number": 227, "usage_type": "name" }, { "api_name": "sqlite3.Error", "l...
278213564
# -*- coding: utf-8 -*- # @Author: SmokedInk # @Title: crawler_warning # @Time: 2020-01-02 09:47:32 # @Desc: crawler_warning import smtplib # 导入发送邮件包 from email.mime.text import MIMEText # 用来创建文本格式的邮件体内容 from twilio.rest import Client # 导入twilio客户端 # 邮箱信息 EMAIL_CONFIG = { 'form_add...
null
crawl/crawler_warning.py
crawler_warning.py
py
3,535
python
en
code
null
code-starcoder2
66
[ { "api_name": "smtplib.SMTP", "line_number": 27, "usage_type": "call" }, { "api_name": "email.mime.text.MIMEText", "line_number": 40, "usage_type": "call" }, { "api_name": "twilio.rest.Client", "line_number": 87, "usage_type": "call" } ]
576964717
import pygame, sys from Balloon import Balloon from Button import Button #from Kitten import Kitten from random import random class Engine(): def __init__(self, screen, settings, scoreboard, balloons, sword): self.screen = screen self.settings = settings self.scoreboard = scoreboard ...
null
BalloonNinja_CV-master/Engine.py
Engine.py
py
3,201
python
en
code
null
code-starcoder2
66
[ { "api_name": "Balloon.Balloon", "line_number": 64, "usage_type": "call" }, { "api_name": "pygame.event.get", "line_number": 68, "usage_type": "call" }, { "api_name": "pygame.event", "line_number": 68, "usage_type": "attribute" }, { "api_name": "pygame.QUIT", ...
212349610
import pyvista as pv from pathlib import Path import glob patients = [106, 109, 110] data_dir = "/Users/mbarbour/Dropbox/Respiratory/image_data/" p = pv.Plotter(shape=(1,3)) count = 0 for patient in patients: patient_str = "Pt_" + str(patient) surface_file = glob.glob(data_dir + patient_str + "/*.stl") ...
null
pyvista_plotting.py
pyvista_plotting.py
py
460
python
en
code
null
code-starcoder2
66
[ { "api_name": "pyvista.Plotter", "line_number": 9, "usage_type": "call" }, { "api_name": "glob.glob", "line_number": 14, "usage_type": "call" }, { "api_name": "pyvista.read", "line_number": 16, "usage_type": "call" } ]
226459009
import unittest import sys import os import types try: from StringIO import StringIO except ImportError: from io import StringIO try: from pandas import DataFrame pandas_avail = True except ImportError: pandas_avail = False try: import requests_cache caching_avail = True except ImportError: ...
null
tests/test.py
test.py
py
8,248
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.insert", "line_number": 19, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 19, "usage_type": "attribute" }, { "api_name": "os.path.split", "line_number": 19, "usage_type": "call" }, { "api_name": "os.path", "line_numbe...
90889125
from sqlalchemy import create_engine import psycopg2 import config from flask import Flask, jsonify from flask_cors import CORS, cross_origin app = Flask(__name__) cors = CORS(app) app.config['CORS_HEADERS'] = 'Content-Type' app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL', '') conn_string = f"hos...
null
app.py
app.py
py
1,028
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 6, "usage_type": "call" }, { "api_name": "flask_cors.CORS", "line_number": 7, "usage_type": "call" }, { "api_name": "config.dbname", "line_number": 11, "usage_type": "attribute" }, { "api_name": "config.user", "line_...
143441595
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings import django.contrib.gis.db.models.fields import common.validators class Migration(migrations.Migration): dependencies = [ ('cities', '__first__'), migration...
null
src/order/migrations/0007_auto_20150811_1555.py
0007_auto_20150811_1555.py
py
2,891
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.migrations.Migration", "line_number": 11, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 11, "usage_type": "name" }, { "api_name": "django.db.migrations.swappable_dependency", "line_number": 14, "usage_type": "ca...
579581392
from api_exceptions import ApiException, AlertException import game_messages_pb2 as game_messages import logging import utils import protobuf2json from itertools import chain from collections import Iterable class ProtoBufSerializer(object): @staticmethod def encode_one(resp_message): try: ...
null
protobuf_serializer.py
protobuf_serializer.py
py
1,927
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.exception", "line_number": 17, "usage_type": "call" }, { "api_name": "api_exceptions.ApiException", "line_number": 18, "usage_type": "call" }, { "api_name": "collections.Iterable", "line_number": 21, "usage_type": "argument" }, { "api_name":...
409864115
#!/usr/bin/env python import sys warnings = list() try: from setuptools import setup, Extension except ImportError: warnings.append("warning: using disutils.core.setup, cannot use \"develop\" option") from disutils.core import setup, Extension try: from distutils.command.build_py import build_py_2to3...
null
python/DEAP_deap/deap-master/setup.py
setup.py
py
3,696
python
en
code
null
code-starcoder2
66
[ { "api_name": "codecs.open", "line_number": 26, "usage_type": "call" }, { "api_name": "pypandoc.convert", "line_number": 28, "usage_type": "call" }, { "api_name": "sys.platform", "line_number": 32, "usage_type": "attribute" }, { "api_name": "sys.version_info", ...
194528007
import os, pygame from pygame.locals import * def load_image(name, sizeX = -1, sizeY = -1): fullName = os.path.join('sprites', name) image = pygame.image.load(fullName) image = image.convert() #colorkey = image.get_at((0, 0)) #image.set_colorkey(colorkey, RLEACCEL) if sizeX != -1 or sizeY != -1: ima...
null
game/lib.py
lib.py
py
1,193
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 6, "usage_type": "call" }, { "api_name": "os.path", "line_number": 6, "usage_type": "attribute" }, { "api_name": "pygame.image.load", "line_number": 7, "usage_type": "call" }, { "api_name": "pygame.image", "line_num...
394431909
# python 3 # this class combines all basic features of a generic player #import pandas as pd import numpy as np #import matplotlib.pyplot as pl import pulp class Player: def __init__(self): # some player might not have parameters self.parameters = 0 self.horizon = 48 self.res= np....
null
player.py
player.py
py
4,116
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.array", "line_number": 15, "usage_type": "call" }, { "api_name": "numpy.zeros", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 42, "usage_type": "call" }, { "api_name": "pulp.LpProblem", "line_number...
212497624
# import csv import pandas as pd import numpy as np from sklearn.preprocessing import PolynomialFeatures from sklearn.metrics import mean_squared_error,r2_score from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression data=pd.read_csv("per_n...
null
polynomoialLr/LR.py
LR.py
py
2,282
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_csv", "line_number": 11, "usage_type": "call" }, { "api_name": "sklearn.model_selection.train_test_split", "line_number": 20, "usage_type": "call" }, { "api_name": "sklearn.preprocessing.PolynomialFeatures", "line_number": 26, "usage_type": "cal...
205147960
from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required from django.urls import reverse from .models import OrderBook, Order from .forms import OrderCreateForm from cart.cart import Cart from users.models import User from .tasks import order_created @login_required def...
null
orders/views.py
views.py
py
1,957
python
en
code
null
code-starcoder2
66
[ { "api_name": "cart.cart", "line_number": 16, "usage_type": "name" }, { "api_name": "cart.cart.Cart", "line_number": 16, "usage_type": "call" }, { "api_name": "users.models.User.objects.get", "line_number": 18, "usage_type": "call" }, { "api_name": "users.models.U...
336979669
from bs4 import BeautifulSoup import logging import requests from api_keys import api_keys import helpers from logger import log import news_interface import news_orgs logging.basicConfig(filename='russia_today.log', level=logging.WARNING) class RussiaToday(news_interface.NewsOrg): '''Methods for interacting with...
null
analysis/scraping/russia_today.py
russia_today.py
py
1,956
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.basicConfig", "line_number": 11, "usage_type": "call" }, { "api_name": "logging.WARNING", "line_number": 11, "usage_type": "attribute" }, { "api_name": "news_interface.NewsOrg", "line_number": 14, "usage_type": "attribute" }, { "api_name": "...
572547608
""" 15_apply.py First, 3 separate spreadsheets are read and merged using concat yielding the following DataFrame: High Humidity Low Saturday Canon City 82.0 18.0 52.0 Colorado Springs 78.0 22.0 50.0 ...
null
Optum Tech/student_files_1/ch05_pandas/15_apply.py
15_apply.py
py
2,038
python
en
code
null
code-starcoder2
66
[ { "api_name": "pandas.read_excel", "line_number": 28, "usage_type": "call" }, { "api_name": "pandas.read_excel", "line_number": 29, "usage_type": "call" }, { "api_name": "pandas.read_excel", "line_number": 30, "usage_type": "call" }, { "api_name": "pandas.concat",...
57408229
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html import csv import logging import pandas as pd class CsvWriterPipeline(object): def open_spider(self, spider): s...
null
futbin_spider/pipelines.py
pipelines.py
py
2,120
python
en
code
null
code-starcoder2
66
[ { "api_name": "csv.DictWriter", "line_number": 22, "usage_type": "call" }, { "api_name": "logging.info", "line_number": 23, "usage_type": "call" }, { "api_name": "pandas.DataFrame", "line_number": 49, "usage_type": "call" }, { "api_name": "pandas.concat", "lin...
34421426
#!/usr/bin/env python from __future__ import print_function import cv2 class SaveVideo(object): """ Simple class to save frames to video (mp4v) """ def __init__(self): self.out = None def __del__(self): self.release() def start(self, filename, image_size, fps=30): # mpg4 = cv2.VideoWrite...
null
archives/old_2017-2018_code/code/tests/Camera/vid.py
vid.py
py
1,097
python
en
code
null
code-starcoder2
66
[ { "api_name": "cv2.VideoWriter_fourcc", "line_number": 19, "usage_type": "call" }, { "api_name": "cv2.VideoWriter", "line_number": 20, "usage_type": "call" }, { "api_name": "cv2.VideoCapture", "line_number": 38, "usage_type": "call" } ]
617623133
import json import argparse import logging from r360_py.util.TravelOptions import TravelOptions from r360_py.util.enum.PolygonSerializationType import PolygonSerializationType from r360_py.util.enum.TravelType import TravelType from r360_py.util.enum.EdgeWeightType import EdgeWeightType from r360_py.rest.ServiceExecuto...
null
r360_py/cli/__main__.py
__main__.py
py
6,764
python
en
code
null
code-starcoder2
66
[ { "api_name": "argparse.ArgumentParser", "line_number": 18, "usage_type": "call" }, { "api_name": "argparse.ArgumentDefaultsHelpFormatter", "line_number": 18, "usage_type": "attribute" }, { "api_name": "r360_py.util.TravelOptions.TravelOptions", "line_number": 49, "usage_...
621528804
from features.cards import validate_card_name from features.cards import prettify_name import urllib import requests import discord import logging logger = logging.getLogger('discord') DESCRIPTION_TEXT = 'Click the links for more information' TITLE_TEXT = 'Rulings from fiveringsdb.com' def get_rulings(command): ...
null
features/rulings.py
rulings.py
py
4,162
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "features.cards.validate_card_name", "line_number": 23, "usage_type": "call" }, { "api_name": "urllib.parse.unquote", "line_number": 31, "usage_type": "call" }, { "api_name"...
66850511
''' A method to search for playlists that contain a set of given tracks and artists, search(); and a basic CLI. To use, run: python .../search_pl.py ''' from load_data import load_data, _reduce_string import tabulate import functools import pprint import string def search(playlists, *args): ''' Returns t...
null
search_pl.py
search_pl.py
py
3,027
python
en
code
null
code-starcoder2
66
[ { "api_name": "load_data._reduce_string", "line_number": 36, "usage_type": "call" }, { "api_name": "functools.reduce", "line_number": 43, "usage_type": "call" }, { "api_name": "tabulate.tabulate", "line_number": 70, "usage_type": "call" }, { "api_name": "string.di...
347306535
#!/usr/bin/env python3 from setuptools import setup import pathlib NAME = "fcool" DESCRIPTION = "A cool tool for functional programming. Funtions can be operated directly with definition domain that can be used in type testing" LONG_DESCRIPTION = pathlib.Path("README.txt").read_text() KEYWORDS = "Functional P...
null
pypi_install_script/fcool-0.1.3.tar/setup.py
setup.py
py
1,236
python
en
code
null
code-starcoder2
66
[ { "api_name": "pathlib.Path", "line_number": 11, "usage_type": "call" }, { "api_name": "setuptools.setup", "line_number": 26, "usage_type": "call" } ]
178099669
import cv2 import time from maskrcnn_benchmark.config import cfg from predictor import COCODemo config_file = "../configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml" # update the config options with the config file cfg.merge_from_file(config_file) # manual override some options cfg.merge_from_list(["MODEL.DEVICE",...
null
demo/test.py
test.py
py
666
python
en
code
null
code-starcoder2
66
[ { "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.merge_from_list", "line_number": 12...
479614185
from enum import Enum from enum import unique from garage.tf.algos import NPO from garage.tf.algos.npo import PGLoss from garage.tf.optimizers import ConjugateGradientOptimizer from garage.tf.optimizers import PenaltyLbfgsOptimizer import time from garage.misc import logger import tensorflow as tf from garage.sampler.u...
null
Toolbox/mylab/algos/trpo.py
trpo.py
py
3,628
python
en
code
null
code-starcoder2
66
[ { "api_name": "enum.Enum", "line_number": 15, "usage_type": "name" }, { "api_name": "enum.unique", "line_number": 14, "usage_type": "name" }, { "api_name": "garage.tf.algos.NPO", "line_number": 20, "usage_type": "name" }, { "api_name": "garage.tf.optimizers.Conjug...
47737053
""" Copyright (C) 2019-2020 Vanessa Sochat. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. """ import random from .namer import RobotNamer from .utils import list_corpus,...
null
Python/Telegram_Bot/markovmeme/gil.py
gil.py
py
8,835
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.dirname", "line_number": 20, "usage_type": "call" }, { "api_name": "os.path", "line_number": 20, "usage_type": "attribute" }, { "api_name": "os.path.abspath", "line_number": 20, "usage_type": "call" }, { "api_name": "PIL.Image.open", "li...
163739041
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
null
tests/test_cli/test_publish.py
test_publish.py
py
7,237
python
en
code
null
code-starcoder2
66
[ { "api_name": "unittest.TestCase", "line_number": 53, "usage_type": "name" }, { "api_name": "aea.cli.publish._save_agent_locally", "line_number": 66, "usage_type": "call" }, { "api_name": "tests.test_cli.tools_for_testing.ContextMock", "line_number": 67, "usage_type": "ca...
653249716
# -*- coding: utf-8 -*- """ Created on Thu Sep 17 10:23:43 2020 @author: glpyz PEGAR INFORMAÇÕES TMS """ from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import * import easygui import time...
null
roteiro_automate_remessa.py
roteiro_automate_remessa.py
py
8,965
python
en
code
null
code-starcoder2
66
[ { "api_name": "selenium.webdriver.Chrome", "line_number": 21, "usage_type": "call" }, { "api_name": "selenium.webdriver", "line_number": 21, "usage_type": "name" }, { "api_name": "selenium.webdriver.common.keys.Keys.RETURN", "line_number": 28, "usage_type": "attribute" ...
270171322
"""This File contains Functions to process tweets.""" import datetime from dateutil.parser import parse from bs4 import BeautifulSoup import re import sys reload(sys) sys.setdefaultencoding("utf-8") def encoding_handle(message, regex, **kwargs): """Function to handle encoding errors.""" replace = kwargs.get('...
null
handle_process.py
handle_process.py
py
9,376
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.setdefaultencoding", "line_number": 8, "usage_type": "call" }, { "api_name": "re.compile", "line_number": 54, "usage_type": "call" }, { "api_name": "dateutil.parser.parse", "line_number": 98, "usage_type": "call" }, { "api_name": "datetime.timed...
218230461
import asyncio, discord, time from discord.ext import commands from cogs import Utils, DisplayName, Message, Nullify def setup(bot): bot.add_cog(Lockdown(bot, bot.get_cog("Settings"))) class Lockdown(commands.Cog): # Init with the bot reference, and a reference to the settings var def __init__(self, bo...
null
VoyageBot/cogs/Lockdown.py
Lockdown.py
py
27,256
python
en
code
null
code-starcoder2
66
[ { "api_name": "discord.ext.commands.Cog", "line_number": 10, "usage_type": "attribute" }, { "api_name": "discord.ext.commands", "line_number": 10, "usage_type": "name" }, { "api_name": "cogs.Utils", "line_number": 20, "usage_type": "name" }, { "api_name": "cogs.Di...
456338947
import time from functools import wraps from pyspark.sql import SparkSession def time_it(method): """decorator to measure time of execution""" @wraps(method) def _timed(*args, **kwargs): start = time.time() result = method(*args, **kwargs) end = time.time() print('method {}...
null
cdm_souffleur/utils/utils.py
utils.py
py
598
python
en
code
null
code-starcoder2
66
[ { "api_name": "time.time", "line_number": 10, "usage_type": "call" }, { "api_name": "time.time", "line_number": 12, "usage_type": "call" }, { "api_name": "functools.wraps", "line_number": 8, "usage_type": "call" }, { "api_name": "pyspark.sql.SparkSession.builder.a...
296525895
#!/usr/bin/env python2 from flask import Flask, url_for, jsonify, request, abort from client_lib import RedisClientManager app = Flask(__name__) client_manager = RedisClientManager() @app.route('/', methods=['GET']) def root(): client = client_manager.new_client() title, path = client.get_next_path() n...
null
server.py
server.py
py
1,217
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 7, "usage_type": "call" }, { "api_name": "client_lib.RedisClientManager", "line_number": 8, "usage_type": "call" }, { "api_name": "flask.url_for", "line_number": 15, "usage_type": "call" }, { "api_name": "flask.jsonify",...
519812310
# -*- coding: utf-8 -*- """ Created on Fri Oct 21 19:31:29 2016 @author: Artem """ import csv from random import randint from fun3 import get_X from fun3 import dic_to_list from fun3 import get_targed from fun3 import cbind from fun3 import make_3d from sklearn.metrics import f1_score from sklearn.ensem...
null
all_activity.py
all_activity.py
py
2,567
python
en
code
null
code-starcoder2
66
[ { "api_name": "fun3.make_3d", "line_number": 20, "usage_type": "call" }, { "api_name": "fun3.get_X", "line_number": 23, "usage_type": "call" }, { "api_name": "fun3.cbind", "line_number": 25, "usage_type": "call" }, { "api_name": "fun3.get_X", "line_number": 25...
412736747
import hashlib import os import time from typing import Dict, List, Union from urllib.parse import urlparse from devtools_testutils import recorded_by_proxy from devtools_testutils import ( PemCertificate, create_combined_bundle, is_live, is_live_and_not_recording, set_function_recording_options, )...
null
sdk/confidentialledger/azure-confidentialledger/tests/test_confidential_ledger_client.py
test_confidential_ledger_client.py
py
21,478
python
en
code
null
code-starcoder2
66
[ { "api_name": "_shared.testcase.ConfidentialLedgerTestCase", "line_number": 30, "usage_type": "name" }, { "api_name": "azure.confidentialledger.ConfidentialLedgerClient", "line_number": 36, "usage_type": "argument" }, { "api_name": "azure.confidentialledger.ConfidentialLedgerClie...
355695028
import pygame import math import os import random import objetos from pickle import NONE #se ocupa para poder usar la variable NONE import time ''' este archivo junta las 3 reglas de movimiento colectivo, la simulacion ocurre paso a paso y se muestra que regla sigue cada bot este archivo se llama FT (fin...
null
movimiento colectivo/SSPFT.py
SSPFT.py
py
17,779
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ", "line_number": 19, "usage_type": "attribute" }, { "api_name": "pygame.init", "line_number": 24, "usage_type": "call" }, { "api_name": "pygame.display.set_mode", "line_number": 26, "usage_type": "call" }, { "api_name": "pygame.display", ...
109780473
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import os import shutil from main.dataset.dataset import Dataset, ExtensionSet __author__ = "Ivan de Paz Centeno" class RawCrawledDataset(Dataset): """ Works with a raw crawled .zip dataset. """ def __init__(self, root_folder, metadata_file=N...
null
main/dataset/raw_crawled_dataset.py
raw_crawled_dataset.py
py
1,920
python
en
code
null
code-starcoder2
66
[ { "api_name": "main.dataset.dataset.Dataset", "line_number": 11, "usage_type": "name" }, { "api_name": "os.path.join", "line_number": 24, "usage_type": "call" }, { "api_name": "os.path", "line_number": 24, "usage_type": "attribute" }, { "api_name": "main.dataset.d...
105787079
import matplotlib.pyplot as plt from PIL import Image import numpy as np img_path = "img/lena.bmp" if __name__ == '__main__': img = Image.open(img_path).convert("L") arr = np.array(img) plt.subplot(2, 2, 1) plt.imshow(img) plt.subplot(2, 2, 3) plt.hist(arr.flatten(), bins=256) # 将灰度矩阵转换成一维序列...
null
demo3.1.py
demo3.1.py
py
477
python
en
code
null
code-starcoder2
66
[ { "api_name": "PIL.Image.open", "line_number": 8, "usage_type": "call" }, { "api_name": "PIL.Image", "line_number": 8, "usage_type": "name" }, { "api_name": "numpy.array", "line_number": 10, "usage_type": "call" }, { "api_name": "matplotlib.pyplot.subplot", "l...
443731978
# Copyright 2018 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
null
tests/test_gaussian.py
test_gaussian.py
py
12,214
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 20, "usage_type": "call" }, { "api_name": "pennylane.numpy.array", "line_number": 30, "usage_type": "call" }, { "api_name": "pennylane.numpy", "line_number": 30, "usage_type": "name" }, { "api_name": "pennylane.num...
498039168
import matplotlib.pyplot as plt import numpy as np import json import datetime import time import dateutil.parser def addPlotData(x,y,timeDiff,mementCount): x.append(timeDiff) y.append(mementCount) data = json.load(open("urlsClean.json")) plot = [] x = [] y = [] for uri in data: mement = data[uri]["mom...
null
lectures/cs532-s19/assignments/A2/webscience_a2/carbondate_vs_momento.py
carbondate_vs_momento.py
py
760
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 13, "usage_type": "call" }, { "api_name": "dateutil.parser.parser.parse", "line_number": 22, "usage_type": "call" }, { "api_name": "dateutil.parser.parser", "line_number": 22, "usage_type": "attribute" }, { "api_name": "da...
6669931
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 00:36:16 2020 @author: KevinChng """ "" from PIL import Image, ImageDraw import json #import matplotlib.pyplot as plt #import matplotlib.image as mpimg import os #from glob import glob #import cv2 as cv # Camera 2702 os.chdir(r'C:\Users\KevinChng\D...
null
Coding (Submission)/Milestone_2_Extract_ROI_from_Image_2702.py
Milestone_2_Extract_ROI_from_Image_2702.py
py
1,727
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.chdir", "line_number": 19, "usage_type": "call" }, { "api_name": "json.load", "line_number": 21, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 32, "usage_type": "call" }, { "api_name": "os.chdir", "line_number": 40, "...
457650138
#!/usr/bin/env python # -*- coding: utf-8 -*- import string, requests, os from app.bot import bot from app.utils import helper from app.yesno.yesno import YesNo from app.anime.anime import Anime from app.webs.quote.quote import Quote from app.passwords import CLEVER_API_KEY from app.clever.clever import Cleverbot from...
null
app/main.py
main.py
py
3,994
python
en
code
null
code-starcoder2
66
[ { "api_name": "app.utils.helper.sender_name", "line_number": 24, "usage_type": "call" }, { "api_name": "app.utils.helper", "line_number": 24, "usage_type": "name" }, { "api_name": "app.bot.bot.send_message", "line_number": 26, "usage_type": "call" }, { "api_name":...
21027647
from os import listdir from datetime import datetime from os.path import isdir, isfile, join def date_from_filename(filename): digits =''.join([c for c in filename if c.isdigit()]) year = 1900+int(digits[:2]) day = int(digits[4:]) month = int(digits[:-2][2:]) return datetime(year=year,month=month,...
null
Loader.py
Loader.py
py
998
python
en
code
null
code-starcoder2
66
[ { "api_name": "datetime.datetime", "line_number": 10, "usage_type": "call" }, { "api_name": "os.listdir", "line_number": 14, "usage_type": "call" }, { "api_name": "os.path.isdir", "line_number": 14, "usage_type": "call" }, { "api_name": "os.listdir", "line_num...
447002451
# -*- coding: utf-8 -*- # Copyright 2017 Vector Creations Ltd # Copyright 2019 New Vector Ltd # # 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....
null
synapse/replication/tcp/streams/events.py
events.py
py
4,279
python
en
code
null
code-starcoder2
66
[ { "api_name": "attr.ib", "line_number": 56, "usage_type": "call" }, { "api_name": "attr.ib", "line_number": 57, "usage_type": "call" }, { "api_name": "attr.s", "line_number": 52, "usage_type": "call" }, { "api_name": "attr.ib", "line_number": 84, "usage_ty...
227579457
from itertools import chain from os import environ, path from utils import multiple_strip __maintainer__ = "Lieber" __email__ = "fernandomdx3@gmail.com" HOME_PATH = environ.get("HOME") ALIASES_PATH = path.join(HOME_PATH, ".aliases.sh") SHELL = environ.get("SHELL").split('/')[-1] if SHELL == "zsh": PROFILE_PATH =...
null
alias_maker.py
alias_maker.py
py
4,093
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.environ.get", "line_number": 9, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 9, "usage_type": "name" }, { "api_name": "os.path.join", "line_number": 10, "usage_type": "call" }, { "api_name": "os.path", "line_number": 10,...
438316254
from selenium.webdriver.common.by import By from behave import given, when, then from time import sleep BEST_SELLER_BUTTON = (By.CSS_SELECTOR, ".a-badge-text") AMAZON_SEARCH_FIELD_LOCATOR = (By.CSS_SELECTOR, "input#twotabsearchtextbox.nav-input") AMAZON_GO_SEARCH_BUTTON = (By.CSS_SELECTOR, "input.nav-input") @given('...
null
hw5/features/steps/hw5_2.py
hw5_2.py
py
1,059
python
en
code
null
code-starcoder2
66
[ { "api_name": "selenium.webdriver.common.by.By.CSS_SELECTOR", "line_number": 5, "usage_type": "attribute" }, { "api_name": "selenium.webdriver.common.by.By", "line_number": 5, "usage_type": "name" }, { "api_name": "selenium.webdriver.common.by.By.CSS_SELECTOR", "line_number":...
621916501
from django.urls import path from . import views urlpatterns = [ path('',views.admin_index_view,name='admin_index'), path('Assessment/Manage',views.assessment_manage_view,name='assess_manage'), path('login/',views.admin_login_view,name='admin_login'), path('Authority/Manage',views.authority_manage_view,...
null
project_admin/urls.py
urls.py
py
1,585
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 8, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 9, "usage_type": "call" }, { "api_name": "django.urls.path", ...
276257689
from PyQt5.QtWidgets import QDialog, QDialogButtonBox from model.preferences import DISPLAY_DB_RANGE, DISPLAY_COLOUR_MAP, DISPLAY_POLAR_360 from ui.display import Ui_displayControlsDialog class DisplayModel: ''' Parameters to feed into how a chart should be displayed. ''' def __init__(self, preferen...
null
src/main/python/model/display.py
display.py
py
5,924
python
en
code
null
code-starcoder2
66
[ { "api_name": "model.preferences.DISPLAY_DB_RANGE", "line_number": 14, "usage_type": "argument" }, { "api_name": "model.preferences.DISPLAY_COLOUR_MAP", "line_number": 18, "usage_type": "argument" }, { "api_name": "model.preferences.DISPLAY_POLAR_360", "line_number": 21, ...
167705367
class Solution: def subarraysDivByK(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ s = [0] for e in A: s.append(s[-1] + e) s = [e % K for e in s] import collections cnt = collections.Counter(s) ...
null
WeeklyContest/119/subarray-sums-divisible-by-k.py
subarray-sums-divisible-by-k.py
py
376
python
en
code
null
code-starcoder2
66
[ { "api_name": "collections.Counter", "line_number": 14, "usage_type": "call" } ]
544881935
# uncompyle6 version 3.7.4 # Python bytecode 3.5 (3351) # Decompiled from: Python 3.6.9 (default, Apr 18 2020, 01:56:04) # [GCC 8.4.0] # Embedded file name: /home/arroyo/ovp/suzano-ovp/django-ovp-core/ovp_core/migrations/0003_cause_skill.py # Compiled at: 2017-02-22 17:56:49 # Size of source mod 2**32: 1106 bytes from...
null
pycfiles/ovp-core-1.2.7.tar/0003_cause_skill.cpython-35.py
0003_cause_skill.cpython-35.py
py
1,122
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.db.migrations.Migration", "line_number": 11, "usage_type": "attribute" }, { "api_name": "django.db.migrations", "line_number": 11, "usage_type": "name" }, { "api_name": "django.db.migrations.CreateModel", "line_number": 15, "usage_type": "call" }, ...
427759066
from flask import Flask, render_template, redirect, url_for, jsonify import pymongo import scrape_mars #Set up Flask app app = Flask(__name__) #Mongodb connection - go to/create database and drop collection if present conn = 'mongodb://localhost:27017' client = pymongo.MongoClient(conn) #Flask app routes @app.route(...
null
Missions_to_Mars/app.py
app.py
py
748
python
en
code
null
code-starcoder2
66
[ { "api_name": "flask.Flask", "line_number": 6, "usage_type": "call" }, { "api_name": "pymongo.MongoClient", "line_number": 10, "usage_type": "call" }, { "api_name": "flask.render_template", "line_number": 22, "usage_type": "call" }, { "api_name": "scrape_mars.scra...
121585899
import random import math from collections import deque import numpy as np import tensorflow as tf import tensorflow.keras.backend as K from tensorflow.keras.models import Sequential from tensorflow.keras.models import load_model, clone_model from tensorflow.keras.layers import Dense, GaussianNoise, InputLayer, Drop...
null
agent.py
agent.py
py
6,932
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.exp", "line_number": 25, "usage_type": "call" }, { "api_name": "numpy.max", "line_number": 25, "usage_type": "call" }, { "api_name": "collections.deque", "line_number": 37, "usage_type": "call" }, { "api_name": "tensorflow.keras.optimizers.Ada...
33427129
from albumentations import * from albumentations.pytorch import ToTensor import numpy as np class TrainAlbumentation(): def __init__(self): self.train_transform = Compose([ PadIfNeeded(min_height=40, min_width=40, border_mode=4, value=None, p=1.0), RandomCrop(32,32), HorizontalFlip(), Cu...
null
Week 11/Transform_utils/trainalbumentation.py
trainalbumentation.py
py
630
python
en
code
null
code-starcoder2
66
[ { "api_name": "albumentations.pytorch.ToTensor", "line_number": 16, "usage_type": "call" }, { "api_name": "numpy.array", "line_number": 20, "usage_type": "call" } ]
619267243
import os, sys, glob import argparse import numpy as np from obspy import UTCDateTime # import MSMS functions from dataset_gpu import read_temp, read_data from msms_lib_gpu import msms_det, corr_ppk, write_ctlg, write_pha import config # filter warnings import warnings warnings.filterwarnings("ignore") # torch for GPU ...
null
run_msms_gpu.py
run_msms_gpu.py
py
2,813
python
en
code
null
code-starcoder2
66
[ { "api_name": "warnings.filterwarnings", "line_number": 11, "usage_type": "call" }, { "api_name": "torch.multiprocessing.set_sharing_strategy", "line_number": 15, "usage_type": "call" }, { "api_name": "torch.multiprocessing", "line_number": 15, "usage_type": "name" }, ...
531257451
"""This module contains helper functions.""" import json, random from rules import * def rotate(pos, rot): rot = rot % 360 if rot == 0: return pos if rot == 90: return [-pos[1], pos[0]] if rot == 180: return [-pos[0], -pos[1]] if rot == 270: return [pos[1], -pos[0]] print("Not a valid rotation:", rot) return p...
null
util.py
util.py
py
5,029
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.loads", "line_number": 50, "usage_type": "call" }, { "api_name": "json.loads", "line_number": 52, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 85, "usage_type": "call" }, { "api_name": "json.dumps", "line_number": 87, ...
452445025
from . import views from django.urls import path urlpatterns=[ path('signup',views.signup,name='signup'), path('login',views.login,name='login'), path('mlogin',views.mlogin,name='mlogin'), path('msignup',views.msignup,name='msignup'), path('logout',views.lo...
null
accounts/urls.py
urls.py
py
344
python
en
code
null
code-starcoder2
66
[ { "api_name": "django.urls.path", "line_number": 6, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 7, "usage_type": "call" }, { "api_name": "django.urls.path", "line_number": 8, "usage_type": "call" }, { "api_name": "django.urls.path", ...
372275823
import time import paho.mqtt.client as mqtt import firebase_admin from firebase_admin import credentials from firebase_admin import db # Fetch the service account key JSON file contents cred = credentials.Certificate('iot_mikro.json') # Initialize the app with a service account, granting admin privileges firebase_admi...
null
sub.py
sub.py
py
1,730
python
en
code
null
code-starcoder2
66
[ { "api_name": "firebase_admin.credentials.Certificate", "line_number": 8, "usage_type": "call" }, { "api_name": "firebase_admin.credentials", "line_number": 8, "usage_type": "name" }, { "api_name": "firebase_admin.initialize_app", "line_number": 10, "usage_type": "call" ...
217392607
#!/usr/bin/python # -*- coding: utf-8 -*- """ sound.py Easily handle .wav sound files. Functions: load(fname) Load a .wav file play(sig, sr) Play a numpy array save(fname, data) Save a numpy array as .wav file """ __author__ = 'Michael Blaß' # Imports import numpy as _np import pyaudio ...
null
sound.py
sound.py
py
1,633
python
en
code
null
code-starcoder2
66
[ { "api_name": "scipy.io.wavfile.read", "line_number": 32, "usage_type": "call" }, { "api_name": "scipy.io.wavfile", "line_number": 32, "usage_type": "name" }, { "api_name": "pyaudio.PyAudio", "line_number": 44, "usage_type": "call" }, { "api_name": "numpy.max", ...
194877497
''' @Descript window function in frequency domaincy @ ''' import numpy as np from matplotlib import pyplot as plt w = np.arange(0, 15*np.pi, 10e-3) N = 10 W1 = (np.sin((w*N)/2)) / np.sin(N/2) W2 = [complex(re, vir) for re,vir in zip(np.cos(w*(N-1)/2), np.sin(w*(N-1)/2))] W = W1*W2 abs_w = abs(W) plt.plot(w,W) plt.show...
null
myprictice/python/DigitalSignal/RectFreq.py
RectFreq.py
py
322
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.arange", "line_number": 8, "usage_type": "call" }, { "api_name": "numpy.pi", "line_number": 8, "usage_type": "attribute" }, { "api_name": "numpy.sin", "line_number": 10, "usage_type": "call" }, { "api_name": "numpy.cos", "line_number": 11,...
578752145
import boto3 import requests from boto3 import Session from requests import Response from fidesops.schemas.third_party.onetrust import OneTrustOAuthResponse def get_s3_session(aws_access_key_id: str, aws_secret_access_key: str) -> Session: """Abstraction to retrieve s3 session using secrets""" session = boto...
null
src/fidesops/util/storage_authenticator.py
storage_authenticator.py
py
1,099
python
en
code
null
code-starcoder2
66
[ { "api_name": "boto3.session.Session", "line_number": 11, "usage_type": "call" }, { "api_name": "boto3.session", "line_number": 11, "usage_type": "attribute" }, { "api_name": "boto3.Session", "line_number": 9, "usage_type": "name" }, { "api_name": "requests.Respon...
584588260
"""This file is a Voestalpine spider created on top of the ATSSpider. scrapy crawl voestalpine -a mining_job_id=9999 -a iteration=1 -a url="https://jobs.voestalpine.com/cgi-bin/appl/selfservice.pl?action=searchform" sample urls: https://jobs.voestalpine.com/cgi-bin/appl/selfservice.pl?action=searchform https:/...
null
brightcorp/brightcorp/spiders/voestalpine.py
voestalpine.py
py
4,077
python
en
code
null
code-starcoder2
66
[ { "api_name": "brightcorp.base.atsspiders.ATSSpider", "line_number": 18, "usage_type": "name" }, { "api_name": "scrapy.http.FormRequest.from_response", "line_number": 34, "usage_type": "call" }, { "api_name": "scrapy.http.FormRequest", "line_number": 34, "usage_type": "na...
340679934
from sqlalchemy import create_engine from sqlalchemy import sql import json from BarBeerDrinker import config engine = create_engine(config.database_uri) def get_TransTable(): with engine.connect() as con: rs = con.execute("SELECT * from TransactionTable;") results= [dict(row) for row in rs] ...
null
server/BarBeerDrinker/database.py
database.py
py
20,234
python
en
code
null
code-starcoder2
66
[ { "api_name": "sqlalchemy.create_engine", "line_number": 7, "usage_type": "call" }, { "api_name": "BarBeerDrinker.config.database_uri", "line_number": 7, "usage_type": "attribute" }, { "api_name": "BarBeerDrinker.config", "line_number": 7, "usage_type": "name" }, { ...
643220227
import logging """ 日志的配置主要为了实现: 1.如何控制日志既输入到文件,也显示到终端 2.如何控制写入文件时的编码 日志名:一定要细化,最好是通过日志名大概就能够看出是什么模块的问题 日志轮转: 日志太大了大都打不开,因此要定期进行分割 """ # 第一步,创建一个logger logger = logging.getLogger("test_logger") # 这里可以传递一个名字 logger.setLevel(logging.DEBUG) # Log等级总开关 # 第二步,创建一个handler用于写入文件,可以指定文件的写入类型 file_path = "./...
null
fun_learn/库学习/log/日志基础.py
日志基础.py
py
1,823
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 14, "usage_type": "call" }, { "api_name": "logging.DEBUG", "line_number": 15, "usage_type": "attribute" }, { "api_name": "logging.FileHandler", "line_number": 19, "usage_type": "call" }, { "api_name": "logging.INFO...
211293718
#!/usr/bin/env python """ #DroMOOC (www.onera.fr/dromooc) #ONERA-ENSTA-CentraleSupelec-Paris Saclay #all variables are in SI unit """ import rospy from attitude_estimation.msg import RPYAngles from geometry_msgs.msg import Quaternion from sensor_msgs.msg import Imu, MagneticField import tf import numpy as np import ma...
null
attitude_estimation/scripts/KFPitchEstimationNoDynParma.py
KFPitchEstimationNoDynParma.py
py
5,697
python
en
code
null
code-starcoder2
66
[ { "api_name": "rospy.init_node", "line_number": 22, "usage_type": "call" }, { "api_name": "rospy.Publisher", "line_number": 28, "usage_type": "call" }, { "api_name": "attitude_estimation.msg.RPYAngles", "line_number": 28, "usage_type": "argument" }, { "api_name": ...
380355489
#!/usr/bin/env python import twitter import random import json import config import bitly_api import re import time import datetime import emailfunction def getRandomIndex(): return random.randrange(0, len(tweetPool)) def getRandomTweet(index): return tweetPool[index]["text"] # Load tweets.json into var...
null
main.py
main.py
py
2,845
python
en
code
null
code-starcoder2
66
[ { "api_name": "random.randrange", "line_number": 16, "usage_type": "call" }, { "api_name": "config.tweetsLocation", "line_number": 25, "usage_type": "attribute" }, { "api_name": "json.load", "line_number": 27, "usage_type": "call" }, { "api_name": "config.security...
414223933
import copy import glob import importlib import os import inspect import pickle import re import sys import tempfile import unittest import unittest.mock import pytest from ConfigSpace import Configuration import joblib from joblib import cpu_count import numpy as np import numpy.ma as npma import pandas as pd import ...
null
test/test_automl/test_estimators.py
test_estimators.py
py
31,137
python
en
code
null
code-starcoder2
66
[ { "api_name": "sys.path.append", "line_number": 40, "usage_type": "call" }, { "api_name": "sys.path", "line_number": 40, "usage_type": "attribute" }, { "api_name": "os.path.dirname", "line_number": 40, "usage_type": "call" }, { "api_name": "os.path", "line_num...
212743323
#!/usr/bin/env/python """ Calculating canopy openness from hemispheric photos """ #**What this will eventually do** #walk through the different functions in the CanopyOpeness package and help the user: # - 1) Upload image files from the TestPhotos folder that comes with the package # - 2) Normalize the exposure ...
null
CanopyOpenness/CanOpen.py
CanOpen.py
py
13,026
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.join", "line_number": 82, "usage_type": "call" }, { "api_name": "os.path", "line_number": 82, "usage_type": "attribute" }, { "api_name": "skimage.io.imread", "line_number": 84, "usage_type": "call" }, { "api_name": "skimage.io", "line_nu...
636212180
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymongo import scrapy from scrapy.exceptions import DropItem from scrapy.pipelines.images import ImagesPipeline from i...
null
rena/pipelines.py
pipelines.py
py
2,379
python
en
code
null
code-starcoder2
66
[ { "api_name": "pymongo.MongoClient", "line_number": 30, "usage_type": "call" }, { "api_name": "scrapy.exceptions.DropItem", "line_number": 42, "usage_type": "call" }, { "api_name": "scrapy.exceptions.DropItem", "line_number": 48, "usage_type": "call" }, { "api_nam...
398651467
from cx_Freeze import setup, Executable import sys import os includes = [] include_files = [r"C:\Python36-32\DLLs\tcl86t.dll", r"C:\Python36-32\DLLs\tk86t.dll"] base = 'Win32GUI' executables = [Executable("dialog.py", base=base)] packages = ["idna", "numpy", "scipy", "tkinter", "tkinter.ttk", "_tki...
null
setup.py
setup.py
py
728
python
en
code
null
code-starcoder2
66
[ { "api_name": "cx_Freeze.Executable", "line_number": 11, "usage_type": "call" }, { "api_name": "os.environ", "line_number": 21, "usage_type": "attribute" }, { "api_name": "os.environ", "line_number": 22, "usage_type": "attribute" }, { "api_name": "cx_Freeze.setup"...
50398023
########### # IMPORTS # ########### import numpy as np from scipy import integrate import matplotlib.pyplot as plt import seaborn as sns from scipy.optimize import fsolve Ek = -12 ENa = 120 EL = 10.6 V = 1 gK = 36 gNa = 120 gL = 0.3 I = 0 ############# # FUNCTIONS # ############# def alpha_m(V): alpha = 0.1*(25-...
null
izhikevich_visualization/plot_linearize.py
plot_linearize.py
py
4,552
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.exp", "line_number": 24, "usage_type": "call" }, { "api_name": "numpy.exp", "line_number": 28, "usage_type": "call" }, { "api_name": "numpy.exp", "line_number": 32, "usage_type": "call" }, { "api_name": "numpy.exp", "line_number": 36, ...
600128919
""" Created by alexandra at 11.09.19 18:20 Check Chern number functions on the simplest Chern insulator """ import numpy as np from math import pi, sqrt import matplotlib.pyplot as plt def scalarprod(a, b): # Scalar product of two stackes of wavefunctions of the same size # Returns a stack of <A[i,j,...,:]...
null
chern_insulator.py
chern_insulator.py
py
2,520
python
en
code
null
code-starcoder2
66
[ { "api_name": "numpy.sum", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.multiply", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.conj", "line_number": 14, "usage_type": "call" }, { "api_name": "numpy.angle", "line_number": ...
601389594
import pytest import doctest from insights.parsers import package_provides_httpd from insights.parsers.package_provides_httpd import PackageProvidesHttpd from insights.tests import context_wrap from insights.parsers import SkipException PACKAGE_COMMAND_MATCH = """ /opt/rh/httpd24/root/usr/sbin/httpd httpd24-httpd-2....
null
insights/tests/parsers/test_package_provides_httpd.py
test_package_provides_httpd.py
py
1,451
python
en
code
null
code-starcoder2
66
[ { "api_name": "insights.parsers.package_provides_httpd.PackageProvidesHttpd", "line_number": 23, "usage_type": "call" }, { "api_name": "insights.tests.context_wrap", "line_number": 23, "usage_type": "call" }, { "api_name": "pytest.raises", "line_number": 29, "usage_type":...
430204765
#!/usr/bin/env python import utils # Node to test, add new nodes in that list to test them nodes = ["Halles", "Pythagore", "SH1C", "Michotte", "Stevin", "Carnoy"] def inside_HTTP_HTTPS_test(): addr_list = ["fd00:200:7:13::1"] for node in nodes: for addr in addr_list: out, err, err_code = util...
null
firewalls/test.py
test.py
py
1,187
python
en
code
null
code-starcoder2
66
[ { "api_name": "utils.execute_in_host", "line_number": 12, "usage_type": "call" }, { "api_name": "utils.execute_in_host", "line_number": 22, "usage_type": "call" }, { "api_name": "utils.execute_in_host", "line_number": 32, "usage_type": "call" } ]
369481063
import elo import gspread from oauth2client.service_account import ServiceAccountCredentials import pymysql import json import trackdata import userdata sqlinfo = open("mysql.json", "r") sqlcon = json.load(sqlinfo) database = pymysql.connect( user=sqlcon["user"], host=sqlcon["host"], db=sqlcon["db"], ...
null
main.py
main.py
py
2,294
python
en
code
null
code-starcoder2
66
[ { "api_name": "json.load", "line_number": 10, "usage_type": "call" }, { "api_name": "pymysql.connect", "line_number": 12, "usage_type": "call" }, { "api_name": "oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name", "line_number": 30, "usage_type"...
156278495
'''fastVideoPlus.py''' """ This script is like fastVideo but it supports sounded and silent speeds. It might be a bit RAM intensive though. """ # External libraries import cv2 # pip3 install opencv-python import numpy as np from audiotsm import phasevocoder # Included functions from scripts.readAudio import ArrRead...
null
scripts/fastVideoPlus.py
fastVideoPlus.py
py
6,971
python
en
code
null
code-starcoder2
66
[ { "api_name": "os.path.isfile", "line_number": 41, "usage_type": "call" }, { "api_name": "os.path", "line_number": 41, "usage_type": "attribute" }, { "api_name": "sys.exit", "line_number": 43, "usage_type": "call" }, { "api_name": "tempfile.mkdtemp", "line_num...
21475682
import json import logging import threading import redis import time LOG = logging.getLogger(__name__) def bootstrap_cache(host='127.0.0.1', password=None): pool = redis.ConnectionPool(host=host, password=password) return redis.StrictRedis(connection_pool=pool) def connect_to_cache(): import os c...
null
basil_common/caching.py
caching.py
py
3,926
python
en
code
null
code-starcoder2
66
[ { "api_name": "logging.getLogger", "line_number": 9, "usage_type": "call" }, { "api_name": "redis.ConnectionPool", "line_number": 13, "usage_type": "call" }, { "api_name": "redis.StrictRedis", "line_number": 14, "usage_type": "call" }, { "api_name": "os.environ", ...
57915479
from rest_framework import serializers from django.db import transaction from django.db.models import F from .models import Task from user.models import UserProfile class TaskSerializer(serializers.ModelSerializer): owner = serializers.ReadOnlyField(source='owner.username') executor = serializers.ReadOnlyFiel...
null
task/serializers.py
serializers.py
py
2,055
python
en
code
null
code-starcoder2
66
[ { "api_name": "rest_framework.serializers.ModelSerializer", "line_number": 8, "usage_type": "attribute" }, { "api_name": "rest_framework.serializers", "line_number": 8, "usage_type": "name" }, { "api_name": "rest_framework.serializers.ReadOnlyField", "line_number": 9, "us...
114935355
from sklearn.metrics import roc_curve import numpy as np def get_acc_precison_recall(label,score): # This function returns the accuracy precision and recall by setting the threshold of scores via the nearest point # to the upper left corner of ROC curve. fpr_matrix, tpr_matrix, threshold = roc_curve(label,...
null
addtionalDataset/code_netflix_camra/compute_statistics.py
compute_statistics.py
py
734
python
en
code
null
code-starcoder2
66
[ { "api_name": "sklearn.metrics.roc_curve", "line_number": 6, "usage_type": "call" }, { "api_name": "numpy.concatenate", "line_number": 7, "usage_type": "call" }, { "api_name": "numpy.newaxis", "line_number": 7, "usage_type": "attribute" }, { "api_name": "numpy.sum...
397035784
from __future__ import print_function import requests import json from string import Template from frinx_rest import odl_url_base, odl_headers, odl_credentials, parse_response odl_url_unified_oper_shallow = odl_url_base + "/operational/network-topology:network-topology/topology/unified?depth=3" odl_url_unified_oper =...
null
microservices/netinfra_utils/workers/unified_worker.py
unified_worker.py
py
7,658
python
en
code
null
code-starcoder2
66
[ { "api_name": "frinx_rest.odl_url_base", "line_number": 8, "usage_type": "name" }, { "api_name": "frinx_rest.odl_url_base", "line_number": 9, "usage_type": "name" }, { "api_name": "frinx_rest.odl_url_base", "line_number": 10, "usage_type": "name" }, { "api_name": ...
189635812
HOME = "https://www.ubereats.com" REGION = "/cl/location" import psycopg2 try: # conn = psycopg2.connect(dbname='prueba', user='postgres', host='127.0.0.1', password='adolfo', port="5433") conn = psycopg2.connect(dbname='pimvault', user='adiaz', host='34.69.175.136', password='adiaz2021', port="5432") cu...
null
Ubereats/01.-region.py
01.-region.py
py
1,443
python
en
code
null
code-starcoder2
66
[ { "api_name": "psycopg2.connect", "line_number": 9, "usage_type": "call" }, { "api_name": "requests.get", "line_number": 18, "usage_type": "call" }, { "api_name": "bs4.BeautifulSoup", "line_number": 19, "usage_type": "call" }, { "api_name": "datetime.datetime.now"...
652285176
import logging import socket import sys host = '' port = 8888 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) b = s.bind((host, port)) print(b) class TcpClient: @classmethod def send(cls, msg): # Create a TCP/IP socket sock = socke...
null
py/udp-to-tcp-proxy.py
udp-to-tcp-proxy.py
py
1,489
python
en
code
null
code-starcoder2
66
[ { "api_name": "socket.socket", "line_number": 8, "usage_type": "call" }, { "api_name": "socket.AF_INET", "line_number": 8, "usage_type": "attribute" }, { "api_name": "socket.SOCK_DGRAM", "line_number": 8, "usage_type": "attribute" }, { "api_name": "socket.SOL_SOCK...