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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
44252726 | import logging
from django.contrib.gis.gdal import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.forms.widgets import Textarea
from django.utils import translation
# Creating a template context that contains Django settings
# values needed by admin map templates.
geo_contex... | null | web/env/lib/python3.6/site-packages/django/contrib/gis/admin/widgets.py | widgets.py | py | 4,720 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "django.utils.translation.get_language_bidi",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "django.utils.translation",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "logging.getLogger",
"line_number": 11,
"usage_type": "call"
},
{
... |
373332677 | import numpy as np
import time
import matplotlib.pyplot as plt
def load_label(label_file):
f = open(label_file)
line = f.readlines()
line = [int(item.strip()) for item in line]
for i in range(len(line)):
if(line[i] <= 0):
line[i] = 0
sample_num = len(line)
return l... | null | code/naiveBayes4faces.py | naiveBayes4faces.py | py | 4,925 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.zeros",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "numpy.random.shuffle",
"line_number": 50,
"usage_type": "call"
},
{
"api_name": "numpy.random",
"line... |
129177292 | import glfw
from OpenGL.GL import *
import OpenGL.GL.shaders
import numpy
from pyrr import matrix44, Vector3
from utils.glutils import load_texture
from utils.camera_pyrr import Camera
from math import sin, cos
def window_resize(window, width, height):
glViewport(0, 0, width, height)
cam = Camera()
keys = [Fals... | null | v05_camera_system.py | v05_camera_system.py | py | 6,130 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "utils.camera_pyrr.Camera",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "glfw.KEY_ESCAPE",
"line_number": 23,
"usage_type": "attribute"
},
{
"api_name": "glfw.PRESS",
"line_number": 23,
"usage_type": "attribute"
},
{
"api_name": "glfw.se... |
278660610 | from random import randint
import PySimpleGUI as sg
class Advinhe:
def __init__(self):
self.gerandonumero = 0
self.valormin = 1
self.valormax = 50
self.usuario = 0
self.total = 0
def Iniciar1(self):
layout = [
[sg.Text('Bem vindo ao Ebony Simple Gam... | null | chute1numero.py | chute1numero.py | py | 2,578 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "PySimpleGUI.Text",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "PySimpleGUI.Text",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "PySimpleGUI.Input",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "PySimpleGUI.Butto... |
471485417 | # coding: utf-8
import re
from numpy import nan
import datetime as dt
from pandas import isnull
def cleanType(string,
preferences=['journal article','conference','proceedings','book chapter','article','review','letter','note'],
mapping={'conference':'conference paper','proceedings':'pro... | null | config/cleaners.py | cleaners.py | py | 2,113 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.nan",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "numpy.nan",
"line_number": 13,
"usage_type": "name"
},
{
"api_name": "numpy.nan",
"line_number": 30,
"usage_type": "name"
},
{
"api_name": "numpy.nan",
"line_number": 40,
... |
42708842 | #!/usr/bin/env python3
#
# _cmdoption.py
"""
Sphinx extension that automatically documents click applications.
"""
#
# Copyright © 2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
#
# Based on Sphinx
# Copyright (c) 2007-2020 by the Sphinx team.
# All rights reserved.
#
# Redistribution and use in source an... | null | sphinx_click/_cmdoption.py | _cmdoption.py | py | 4,027 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "sphinx.addnodes.desc",
"line_number": 50,
"usage_type": "attribute"
},
{
"api_name": "sphinx.addnodes",
"line_number": 50,
"usage_type": "name"
},
{
"api_name": "sphinx.domains.std.Cmdoption",
"line_number": 54,
"usage_type": "attribute"
},
{
"api_n... |
123743507 | #!/usr/bin/env python
# coding: utf-8
# %%
# %%
import numpy as np
import os
import csv
import glob
from sklearn.decomposition import PCA
import time
# %%
preprocessed_name = "PCA"
# input_dir and out_dir
input_dir_path = "../rawdatas/*/*.csv"
input_dir = glob.glob(input_dir_path)
out_dir_path = "../preprocesse... | null | codes/.ipynb_checkpoints/preprocessing_PCA-checkpoint.py | preprocessing_PCA-checkpoint.py | py | 1,315 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "glob.glob",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "time.time",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "os.remove",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "os.makedirs",
"line_number": 38,
... |
77973452 | from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework import status
from pizza_app.models import Pizza, Customer, Order
class CustomerTests(APITestCase):
def setUp(self):
self.pizza_name = 'Pepperoni'
self.customer_first_name = 'Gianluigi'
self.c... | null | pizza_app/tests.py | tests.py | py | 2,877 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "rest_framework.test.APITestCase",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "django.urls.reverse",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "rest_framework.status.HTTP_201_CREATED",
"line_number": 24,
"usage_type": "attribute"
... |
101728218 | # -*- coding: utf-8 -*-
# @Author: jsonwang
# @Date : 2018/04/13 11:30:30
# @Desc : 接口关键字函数类
import logging
import threading
import pymysql
import uuid
import datetime
import requests
import xlwt
import json
from bson.json_util import loads
from requests.exceptions import ReadTimeout,ConnectionError,RequestException
... | null | sanwing/apps/apis/aaaa.py | aaaa.py | py | 46,021 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "logging.getLogger",
"line_number": 58,
"usage_type": "call"
},
{
"api_name": "django.conf.settings.LOGGER_NAME",
"line_number": 58,
"usage_type": "attribute"
},
{
"api_name": "django.conf.settings",
"line_number": 58,
"usage_type": "name"
},
{
"api_... |
277076226 | import requests
from config import Config
import json
ignore_alert_list = Config.ignore_alert_list
def get_path(event, first_key, *keys):
value = event.get(first_key, {})
if keys is None:
return value
for key in keys:
if key in value:
value = value.get(key, {})
else:
... | null | test-api/prometheus.py | prometheus.py | py | 1,875 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "config.Config.ignore_alert_list",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "config.Config",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "requests.get",
"line_number": 36,
"usage_type": "call"
},
{
"api_name": "config.... |
48009036 | from django.shortcuts import *
from django.http import Http404
from cours.models import *
from .forms import *
from django.db.models import Count
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.core.mail import EmailMultiAlternatives
from django.utils.html impor... | null | Documents/PFE/educo/cours/views.py | views.py | py | 12,722 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "django.http.Http404",
"line_number": 56,
"usage_type": "name"
},
{
"api_name": "django.http.Http404",
"line_number": 70,
"usage_type": "name"
},
{
"api_name": "random.randint",
"line_number": 100,
"usage_type": "call"
},
{
"api_name": "django.contri... |
450112726 | #!/usr/bin/python
import sys
import numpy as np
from numpy import vectorize # https://stackoverflow.com/questions/8036878/function-of-numpy-array-with-if-statement
import matplotlib.pyplot as plt
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.betainc.html
import scipy.special as sc
# https://pu... | null | LaTeX_ReportV2/plot_v_vs_x.py | plot_v_vs_x.py | py | 4,571 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.nan",
"line_number": 64,
"usage_type": "attribute"
},
{
"api_name": "scipy.optimize.brentq",
"line_number": 68,
"usage_type": "call"
},
{
"api_name": "scipy.optimize",
"line_number": 68,
"usage_type": "name"
},
{
"api_name": "numpy.vectorize",... |
495003016 | import pickle
import redis
from pod_manager.settings import REDIS_HOST, REDIS_PORT, REDIS_DB
__all__ = [
'get_client',
'cache_object',
'get_object'
]
def get_client():
client = redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)
return client
def cache_object(client, key, obj, ttl=60):
... | null | pod_manager/db.py | db.py | py | 603 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "redis.Redis",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "pod_manager.settings.REDIS_HOST",
"line_number": 13,
"usage_type": "name"
},
{
"api_name": "pod_manager.settings.REDIS_PORT",
"line_number": 13,
"usage_type": "name"
},
{
"api_n... |
24122497 | from config import BUCKET_NAME
class ImageService:
def image_upload(self, s3_connection, image_file):
s3_connection.put_object(
Body=image_file,
Bucket=BUCKET_NAME,
Key=image_file.filename,
ContentType=image_file.content_type,
)
return f"ht... | null | BackEnd/service/image_service.py | image_service.py | py | 395 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "config.BUCKET_NAME",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "config.BUCKET_NAME",
"line_number": 14,
"usage_type": "name"
}
] |
140342492 | from flask import Flask, render_template
from api import api_bp
from models import get_all, init_db, insert
app = Flask(__name__, static_folder='../frontend/dist/static', template_folder='../frontend/dist')
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///myspa.db'
app.register_blueprint(api_bp)
@app.route('/', def... | null | backend/main.py | main.py | py | 625 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "flask.Flask",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "api.api_bp",
"line_number": 7,
"usage_type": "argument"
},
{
"api_name": "flask.render_template",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "models.init_db",
"... |
251551343 | #!/usr/bin/env python
import os
import multiprocessing as mp
import shutil
import numpy as np
from scipy import linalg
from saf.action import solve
from saf.fm.nonlinear import Config
from saf.fm.nonlinear import Reader
Q = 4
THETA = 0.95
T_FINAL = 1000
def _run_solver(args):
n12, = args
c = Config()
... | null | verification-nonlinear-limit-cycle/run.py | run.py | py | 1,151 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "saf.fm.nonlinear.Config",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 43,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 43,
"usage_type": "attribute"
},
{
"api_name": "os.path.exists",
... |
552195047 | #!/usr/bin/env python
'''
This script runs in parallel with the others (especially it is needed
for the 'joystick_publisher' node) and checks if the joystick is attached
to the system. If it is, sends a message over a topic that is received
from joystick_publisher, which will stop sending data over its topic until
the ... | null | pc-core.old/ROS.old/v1/politocean/scripts/joystick_checker.py | joystick_checker.py | py | 1,151 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "rospy.init_node",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "rospy.Publisher",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "std_msgs.msg.String",
"line_number": 20,
"usage_type": "argument"
},
{
"api_name": "time.sleep",
... |
363386330 | from flask import request
from flask_jwt_extended import (
create_access_token,
create_refresh_token,
)
from flask_appbuilder.api import safe
from flask_appbuilder.security.api import SecurityApi
from flask_appbuilder.const import (
API_SECURITY_ACCESS_TOKEN_KEY,
API_SECURITY_PROVIDER_KEY,
API_SECU... | null | superset/security/peak_custom_security_api.py | peak_custom_security_api.py | py | 3,637 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "flask_appbuilder.security.api.SecurityApi",
"line_number": 22,
"usage_type": "name"
},
{
"api_name": "superset.peak.authorizer.authorize",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "superset.peak.authorizer",
"line_number": 27,
"usage_type": ... |
552167276 | import sys
from PyQt5.QtWidgets import QWidget, QApplication, QMessageBox, QPushButton
class MsgDemo(QWidget):
def __init__(self, parent=None):
super(MsgDemo, self).__init__(parent)
self.setWindowTitle('QMessageBox')
self.resize(300, 100)
self.btn = QPushButton(self)
sel... | null | ch01_basic_widgets/qt21_QMessageBox.py | qt21_QMessageBox.py | py | 725 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "PyQt5.QtWidgets.QWidget",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "PyQt5.QtWidgets.QPushButton",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "PyQt5.QtWidgets.QMessageBox.information",
"line_number": 18,
"usage_type": "call"
},... |
60581838 | from django.db import models
from django.contrib.auth.models import User
class Employee(models.Model):
"""This class is modeling the Employee table"""
user = models.OneToOneField(User, primary_key=True)
name = models.CharField(max_length=30)
level = models.CharField(max_length=30) # junior, middle o... | null | employees/models.py | models.py | py | 1,208 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "django.db.models.Model",
"line_number": 5,
"usage_type": "attribute"
},
{
"api_name": "django.db.models",
"line_number": 5,
"usage_type": "name"
},
{
"api_name": "django.db.models.OneToOneField",
"line_number": 8,
"usage_type": "call"
},
{
"api_name... |
496757003 | import os
import sys
PROJECTPATH = os.path.join(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)), 'Decision Tree')
sys.path.append(PROJECTPATH)
import numpy as np
from collections import Counter
from decision_tree import DecisionTree
def bootstrap_sample(X, y):
n_samples = X.shape[0]
idxs... | null | Random Forest/random_forest.py | random_forest.py | py | 1,529 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "os.path.join",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 4,
"usage_type": "attribute"
},
{
"api_name": "os.path.abspath",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "os.path.dirname",
"line_nu... |
358924227 | #!/usr/bin/env python
"""add file to Dock"""
import click
import mac_dock
MODULE_NAME = "mac_dock.files.add"
PROG_NAME = 'python -m %s' % MODULE_NAME
USAGE = "python -m %s path ..." % MODULE_NAME
@click.command()
@click.argument('path', nargs=-1)
def _cli(path):
mac_dock.files.add(path)
if __name__ == '__main_... | null | venv/Lib/site-packages/mac_dock/files/add.py | add.py | py | 354 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "mac_dock.files.add",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "mac_dock.files",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "click.command",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "click.argument",... |
311650023 | from django.db.models import query
from django.shortcuts import render
from rest_framework import viewsets
from .models import transaction, productSold
from .serializers import rest_api_serializer
import json
import datetime
from time import sleep
from django.db import connection
# Create your views here.
class re... | null | rest_api/views.py | views.py | py | 4,750 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "rest_framework.viewsets.ModelViewSet",
"line_number": 16,
"usage_type": "attribute"
},
{
"api_name": "rest_framework.viewsets",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "models.productSold.objects.all",
"line_number": 17,
"usage_type": "call... |
8022142 | from urllib.request import urlopen, Request
import urllib
import bs4
def search_weather(location):
Finallocation = urllib.parse.quote(location + '+날씨')
LocationInfo = ""
NowTemp = ""
CheckDust = []
url = 'https://search.naver.com/search.naver?ie=utf8&query=' + Finallocation
hdr = {'User-Agent'... | null | def_crawling/weather.py | weather.py | py | 5,790 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "urllib.parse.quote",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "urllib.parse",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "urllib.request.Request",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "urllib.requ... |
453016359 | import os, glob
import torch
import librosa
import numpy as np
class TestsetFC(torch.utils.data.Dataset):
def __init__(self, stft_root,target, form,block=3):
self.stft_root = stft_root
self.block = block
if type(target) == str :
self.data_list = [x for x in glob.glob(os.path.j... | null | src/legacy/TestsetFC.py | TestsetFC.py | py | 2,014 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "torch.utils",
"line_number": 6,
"usage_type": "attribute"
},
{
"api_name": "glob.glob",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 1... |
547196528 | from boids import *
from nose.tools import assert_equals, assert_almost_equal
import os
import yaml
def test_bad_boids_regression():
regression_data=yaml.load(open(os.path.join(os.path.dirname(__file__),'fixture.yml')))
boid_data=regression_data["before"]
update_boids(boid_data)
for after,before in zip... | null | test_boids.py | test_boids.py | py | 1,081 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "yaml.load",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 7,
"usage_type": "attribute"
},
{
"api_name": "os.path.dirname",
"line_number":... |
106487500 | import argparse
import json
import logging
import time
from collections import defaultdict
from pynet import Node, NodeHooks, Encryptor, PeerDefinition
from pynet.util import run_node
SHUTDOWN = False
class KVPDB(object):
"""A per-owner dictionary.
Each owner has their own dictionary, this class exposes metho... | null | server.py | server.py | py | 4,819 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "collections.defaultdict",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "pynet.NodeHooks",
"line_number": 82,
"usage_type": "name"
},
{
"api_name": "pynet.PeerDefinition",
"line_number": 100,
"usage_type": "call"
},
{
"api_name": "argpars... |
299631964 | # XGBoost: 3 new features (n_missing, bin_sum, bin_diff), no dropping of any feature. Use average of 5-fold CV, early stopping 100 rounds
# add new feature: average age
import numpy as np
import pandas as pd
from utils.metrics import gini
from sklearn.pipeline import FeatureUnion, Pipeline
from sklearn.feature_extract... | null | xgb_mean_enc_1.py | xgb_mean_enc_1.py | py | 13,749 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "warnings.simplefilter",
"line_number": 33,
"usage_type": "call"
},
{
"api_name": "logging.basicConfig",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "logging.INFO",
"line_number": 35,
"usage_type": "attribute"
},
{
"api_name": "utils.met... |
414246406 | import os, sys, time, atexit
import threading, requests, queue
from socksconf import get_socks, proxy_checker
url = input('\n[+] Login page URL: ')
username = input('[+] Target username: ')
wordlist = input('[+] Password list (file): ')
successed_response_text = input('[+] Element from successed response: ')
thread_c... | null | brute.py | brute.py | py | 4,692 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "queue.Queue",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "threading.Event",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "socksconf.get_socks",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "socksconf.proxy_check... |
486023633 | #!/usr/bin/env python
from flask import Flask
import logging
import sys
from cowpy import cow
ddtrace.config.analytics_enabled = True
main_logger = logging.getLogger()
main_logger.setLevel(logging.DEBUG)
c = logging.StreamHandler(sys.stdout)
c.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)... | null | snippets/flaskapp.py | flaskapp.py | py | 1,002 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "logging.getLogger",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "logging.DEBUG",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "logging.StreamHandler",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "sys.stdout",... |
33995740 | #!/usr/bin/python
import copy
import itertools
class CSP:
def __init__(self):
# self.variables is a list of the variable names in the CSP
self.variables = []
# self.domains[i] is a list of legal values for variable i
self.domains = {}
# self.constraints[i][j] is a list o... | null | 5_sudoku/assignment5-v2.py | assignment5-v2.py | py | 12,007 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "itertools.product",
"line_number": 38,
"usage_type": "call"
},
{
"api_name": "copy.deepcopy",
"line_number": 86,
"usage_type": "call"
},
{
"api_name": "copy.deepcopy",
"line_number": 126,
"usage_type": "call"
},
{
"api_name": "copy.deepcopy",
"l... |
424604372 | #!/usr/local/bin/python3
import cgi, cgitb
import re, json
from os import path, pardir
import sys
from pymongo import MongoClient
# local
dir_path = path.dirname( path.abspath(__file__) )
pkg_path = path.join( dir_path, pardir )
sys.path.append( pkg_path )
from beaconServer.lib.cgi_utils import *
from beaconServer.li... | null | services/ontologymaps.py | ontologymaps.py | py | 3,381 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "os.path.dirname",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "os.path.abspath",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "os.path.join",
"line_numb... |
270866270 | import numpy as np
import pandas as pd
from PyQt5 import QtWidgets
from point_spectra_gui.util import Qtickle
from libpyhat.regression import cv
from point_spectra_gui.util.spectral_data import spectral_data
from point_spectra_gui.core.crossValidateMethods import *
from point_spectra_gui.ui.CrossValidation import Ui_Fo... | null | point_spectra_gui/core/CrossValidation.py | CrossValidation.py | py | 13,582 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "point_spectra_gui.ui.CrossValidation.Ui_Form",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "point_spectra_gui.util.Modules.Modules",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "point_spectra_gui.util.Modules.Modules.setupUi",
"line_nu... |
536586159 | import redis
from mirrulations.redis_manager import RedisManager
import time
r = RedisManager(redis.Redis())
def expire():
"""
Checks to see if any of the in-progress jobs have expired
:return:
"""
while(True):
r.find_expired()
time.sleep(3600)
if __name__ == '__main__':
exp... | null | src/mirrulations/expire.py | expire.py | py | 326 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "mirrulations.redis_manager.RedisManager",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "redis.Redis",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "time.sleep",
"line_number": 15,
"usage_type": "call"
}
] |
346792366 | # ------------------------------------------------------------
# Icecream Microservice
# ------------------------------------------------------------
import flask
from flask import request, jsonify
from flask_cors import CORS
import json
import os
import requests
from dapr.clients import DaprClient # Dapr SDK
app = f... | null | service/IceCream/app.py | app.py | py | 1,310 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "flask.Flask",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "flask_cors.CORS",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "os.environ",
"line_number": 18,
"usage_type": "attribute"
},
{
"api_name": "os.environ",
"line_nu... |
205767614 | import cv2
import numpy as np
from matplotlib import pyplot as plt
path = "arcoiris.jpg"
img = cv2.imread(path)
print(img.shape)
h,w,c = img.shape
hn = int(h/4)
wn = int(w/4)
resized = cv2.resize(img,(wn,hn))
histR = np.zeros(256, np.float)
histV = np.zeros(256, np.float)
histA = np.zeros(256, np.float)
# tem as seg... | null | histigrama.py | histigrama.py | py | 1,028 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "cv2.imread",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "cv2.resize",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "numpy.float",
"line_number": 14,... |
395865913 | import argparse
from smw_learning.ppo.ppo_base import PPOBase
from smw_learning.brute.brute_mario_player import BrutePlayer
from smw_learning.random.random_mario_player import RandomPlayer
from smw_learning.genetic_learning.parallel_evolution import ParallelGeneticLearning
def create_parser():
"""
Creates pars... | null | smw_learning/command_line_args.py | command_line_args.py | py | 3,368 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "smw_learning.genetic_learning.parallel_evolution.ParallelGeneticLearning",
"line_number": 62,
"usage_type": "call"
},
{
"api_name": "smw_learning.brute.brute_mario_player.BrutePlaye... |
150611400 | from biomio.constants import REDIS_PROBE_RESULT_KEY, REDIS_RESULTS_COUNTER_KEY, REDIS_PARTIAL_RESULTS_KEY, \
REDIS_JOB_RESULTS_ERROR, REDIS_VERIFICATION_RETIES_COUNT_KEY
from biomio.protocol.storage.redis_storage import RedisStorage
from biomio.algorithms.logger import logger
from biomio.algorithms.plugins_tools im... | null | biomio/protocol/probes/plugins/openface_verify_plugin/helper.py | helper.py | py | 4,670 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "biomio.algorithms.logger.logger.info",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "biomio.algorithms.logger.logger",
"line_number": 12,
"usage_type": "name"
},
{
"api_name": "biomio.protocol.storage.redis_storage.RedisStorage.persistence_instance",
... |
412567273 | from collections import defaultdict, deque
import time
exploredNodes = dict()
distanceNode = dict()
def dijkstra(graph):
# Source vertex is the first vertex of the graph
sourceVertex = next(graph.__iter__())
# Set it as new vertex V
vertexV = sourceVertex
# Set distance for source v... | null | Graph Search, Shortest Paths, and Data Structures/Week 2/Dijkstra's Shortest Path/Check.py | Check.py | py | 2,553 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "collections.defaultdict",
"line_number": 54,
"usage_type": "call"
},
{
"api_name": "time.clock",
"line_number": 57,
"usage_type": "call"
},
{
"api_name": "time.clock",
"line_number": 68,
"usage_type": "call"
},
{
"api_name": "time.clock",
"line_... |
393210541 | from ImgBig import ImgBig,BBX
from os import listdir
import string
import random
import cv2
# funcion rescales the cropped image from bounding box to 12x12
def resize_images(crop, pathto):
width = 12
height = 12
dim = (width, height)
resized = cv2.resize(crop, dim, interpolation = cv2.INTER_AREA)
#... | null | crop_faces.py | crop_faces.py | py | 2,778 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "cv2.resize",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "cv2.INTER_AREA",
"line_number": 12,
"usage_type": "attribute"
},
{
"api_name": "cv2.imwrite",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "cv2.imwrite",
"line_nu... |
204999327 | #!/usr/bin/env python3
"""Placeholder."""
import functools
import hashlib
import operator
import re
from nbc.exceptions import NotSeenError
class Tokenizer:
"""Placeholder."""
def __init__(self, stop_words=None, char_filter=',&?!#%'):
"""Placeholder."""
if not isinstance(stop_words, list):
... | null | nbc/core.py | core.py | py | 6,166 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "re.compile",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "hashlib.sha256",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "re.sub",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "nbc.exceptions.NotSeenError",
"l... |
457467480 | #coding:utf-8
import requests
import json
dict_create_duser={
"head":
{
"version":"0.01",
"msgtype":"request",
"interface":"cmd_dealer_select_d4",
"remark":""
},
"params":
{
"system":"xxx",
"time":"1499139297",
"sign":"74621c9b7d6e4f749b2b18c316c4fbce",
... | null | other/dealerguanliand4.py | dealerguanliand4.py | py | 1,112 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "json.dumps",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "requests.post",
"line_number": 36,
"usage_type": "call"
}
] |
9505645 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import sys
import os
import math
from oset import oset
import scipy
################################################################################
# An experiment is caracterized by its data.
class Experiment:
# Variables::
# -all_nb_nodes: an ordered set of ... | null | scripts/summarize_mean_std_chkpt.py | summarize_mean_std_chkpt.py | py | 3,892 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "oset.oset",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "oset.oset",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "oset.oset",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "oset.oset",
"line_number": 30,
... |
344909160 | import cv2 as cv
import dlib
from scipy.spatial import distance
def ear_aspect_ratio(eye):
a = distance.euclidean(eye[1], eye[5])
b = distance.euclidean(eye[2], eye[4])
c = distance.euclidean(eye[0], eye[3])
ratio = (a+b)/(2*c)
return ratio
cap = cv.VideoCapture(0)
hog_face_detector = dlib.get_frontal_face_dete... | null | drowsiness_detector.py | drowsiness_detector.py | py | 1,996 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "scipy.spatial.distance.euclidean",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "scipy.spatial.distance",
"line_number": 6,
"usage_type": "name"
},
{
"api_name": "scipy.spatial.distance.euclidean",
"line_number": 7,
"usage_type": "call"
},
{
... |
431507212 | #!/usr/bin/env python
# coding: utf-8
# In[152]:
# def get_results(start_index, cuisines):
import requests
import pandas as pd
import matplotlib as plt
import seaborn as sns
def get_results(start_index,cuisine):
headers = {
'Accept': 'application/json',
'user-key': '4acc54ca3cf4e3c53521751bd0a2ca... | null | Zomato.py | Zomato.py | py | 4,163 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "requests.get",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_number": 108,
"usage_type": "call"
},
{
"api_name": "pandas.DataFrame.from_records",
"line_number": 121,
"usage_type": "call"
},
{
"api_name": "pandas.Data... |
585739905 | import inspect
import json
from functools import wraps
from collections import defaultdict
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.utils.text import slugify
from opal.core import discoverable, exceptions, subrecords
from opal.models import Patient, Episode, E... | null | pathway/pathways.py | pathways.py | py | 11,422 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "functools.wraps",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "opal.models.EpisodeSubrecord",
"line_number": 38,
"usage_type": "argument"
},
{
"api_name": "opal.models.PatientSubrecord",
"line_number": 40,
"usage_type": "argument"
},
{
... |
82349342 | #!/usr/bin/env python
# coding: utf-8
# # GenCode Explore
#
# Explore the human RNA sequences from GenCode.
#
# Assume user downloaded files from GenCode 38 [FTP](http://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_38/)
# to a subdirectory called data.
#
# In 103, we reduced the PC mRNA to a set where ... | null | Scripts/GenCode_Explore_104.py | GenCode_Explore_104.py | py | 6,649 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "time.time",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "time.strftime",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "time.localtime",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "google.colab.drive.mount",
... |
570439927 | __author__ = 'Connor Heaton'
import os
import math
import time
import torch
import numpy as np
import torch.distributed as dist
from sklearn.metrics import confusion_matrix
from torch import optim
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from transformers import get... | null | LSTM/runner.py | runner.py | py | 15,654 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.argmax",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "numpy.mean",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "numpy.unique",
"line_number": 32,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_number":... |
512192635 | import json
import numpy as np
import pandas as pd
import pandas_redshift as pr
def raw_to_stops(df):
#Load stop data
df_stop_times = pd.read_csv('google_transit/stop_times.txt')
#Convert datetimes
df['recorded_time'] = pd.to_datetime(df['recorded_time'])
df['valid_until_time'] = pd.to_datetime(df... | null | etl.py | etl.py | py | 9,899 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "pandas.read_csv",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "pandas.to_datetime",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "pandas.to_datetime",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "pandas.to_dateti... |
637795209 | import os, re
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import numpy as np
import random
from parameters_and_constants import *
from sklearn.cluster import KMeans
def get_h_ev(n=1, ifi='OUTPUT'):
out = [line for line in open(ifi)]
for nj in range(1, len(out)):
if... | null | src_python/rrgm_functions.py | rrgm_functions.py | py | 15,017 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.array",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "numpy.array",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "os.system",
"line_number": 44,
"usage_type": "call"
},
{
"api_name": "os.system",
"line_number": 51,
... |
101287338 | # "sweep and plot.py"
#
# Loop eksempel med løbende plot af signal
#
# Knud - SHD - 13 nov. 2020 Version 0.1 - En første simplificering mod forløb i Skanderborg
#
# Ved at ændre i konstanter kan man bruge den til lidt forskelligt.
#
# Når pogram er lsut skal der blot klikkes indenfor plot vinduet for at få det... | null | sweep and plot.py | sweep and plot.py | py | 7,047 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "matplotlib.pyplot.ion",
"line_number": 40,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 40,
"usage_type": "name"
},
{
"api_name": "matplotlib.pyplot.figure",
"line_number": 42,
"usage_type": "call"
},
{
"api_name": "matp... |
519728934 | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from autoslug import AutoSlugField
import datetime
from hub import registry
registry.register( 'poolguy', 'PoolGuy', routes={
'employees': 'poolguy.viewsets... | null | models.py | models.py | py | 4,073 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "hub.registry.register",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "hub.registry",
"line_number": 10,
"usage_type": "name"
},
{
"api_name": "django.db.models.Model",
"line_number": 20,
"usage_type": "attribute"
},
{
"api_name": "django... |
107387905 | #!-*- coding: utf-8 -*-
import logging
import os
import traceback
import jinja2
from controllers.lessons import extract_unit_and_lesson
from common import jinja_utils
from common import schema_fields
from common import tags
from controllers import utils
from models import custom_modules
from models import models
fr... | null | upload2/upload2.py | upload2.py | py | 11,978 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "os.path.join",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 23,
"usage_type": "attribute"
},
{
"api_name": "controllers.utils.BaseHandler",
"line_number": 27,
"usage_type": "attribute"
},
{
"api_name": "controll... |
255973497 | """Design of Experiment (DOE) with custom add_fiber_array function.
In this case add_fiber_array does not add labels.
You can use gf.add_labels.add_labels_to_ports.
"""
import gdsfactory as gf
if __name__ == "__main__":
c = gf.components.pack_doe_grid(
gf.components.straight,
settings={"length":... | null | gdsfactory/samples/24_doe_3.py | 24_doe_3.py | py | 656 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "gdsfactory.components.pack_doe_grid",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "gdsfactory.components",
"line_number": 11,
"usage_type": "attribute"
},
{
"api_name": "gdsfactory.components",
"line_number": 12,
"usage_type": "attribute"
},
... |
205253621 | from datadog import initialize, api
import time
import json
import sys
import string
#must pass in api key and app key from teamcity
options = {
'api_key': sys.argv[1],
'app_key': sys.argv[2]
}
event_type = sys.argv[3]
servers = sys.argv[4]
f = open('myfile','w')
f.write(sys.argv[4]) # python will convert \... | null | datadog_post_event.py | datadog_post_event.py | py | 1,000 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "sys.argv",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "sys.argv",
"line_number": 10,
"usage_type": "attribute"
},
{
"api_name": "sys.argv",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "sys.argv",
"line_number"... |
286134400 | import cx_Oracle
db=cx_Oracle.connect('fc10rpt','fc10rpt','10.183.6.19:1521/CNTBGDB')
sql="select a.message from mstb_dly_msg_out a where a.media='SWIFT' and a.swift_msg_type='940' and a.dcn='101MSOG17123H56H'"
crd=db.cursor()
crd.execute(sql)
re=crd.fetchone()
result=('').join(re)
print(result)
crd.close()
... | null | HavingFun/small_fun/others/readOracleLong.py | readOracleLong.py | py | 331 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "cx_Oracle.connect",
"line_number": 3,
"usage_type": "call"
}
] |
402548967 | #7
import timeit
import matplotlib.pyplot as plt
def soal_tiga(n):
i = n
while i > 0:
k = 2 + 2
i = i // 2
def uji_soal_tiga(n):
ls = []
jangkauan = range(1, n+1)
siap = "from __main__ import soal_tiga"
for i in jangkauan:
##print('i = ',i)
t =... | null | Tugas Modul 10/tugas3d.py | tugas3d.py | py | 548 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "timeit.timeit",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot.plot",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "matplotlib.pyplot",
"line_number": 24,
"usage_type": "name"
},
{
"api_name": "matplotlib.pyp... |
452957909 | #
# Logging is a great way to understand what's happening in your program and in what order its happening.
# To enable the logging module to display log messages on your screen as your program runs import logging
# To disable add a single logging.disable(logging.CRITICAL) call
# Logging levels provide a way to... | null | PythonEssentials/Debugging/Logging.py | Logging.py | py | 2,405 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "logging.basicConfig",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "logging.DEBUG",
"line_number": 21,
"usage_type": "attribute"
},
{
"api_name": "logging.debug",
"line_number": 23,
"usage_type": "call"
},
{
"api_name": "logging.debug",
... |
585470190 | #Hi there, Can you see this
import numpy as np
import tensorflow as tf
from numpy import load
import operator
import tensorflow as tf
import matplotlib.pyplot as plt
import os,sys,inspect
sys.path.insert(1, os.path.join(sys.path[0], '..')) #this line shold always stay above the next line below
from tfrbm import BBRBM, ... | null | tfrbm/bbrbm_test.py | bbrbm_test.py | py | 4,910 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "sys.path.insert",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": ... |
601362348 |
from web3 import Web3
"""
constant
"""
# address of mine
address1 = Web3.toChecksumAddress('0xed147cc91c1c3522c47028738b0df3b6f2c1409c')
address2 = Web3.toChecksumAddress('0xcdC4a75c413824dbB455F0095e4A18Ac2Ac2Eb3a')
# Contract address (CYCToken)
contract_address = Web3.toChecksumAddress('0x153c90dB1D26992b9e771Ab... | null | eth/constants.py | constants.py | py | 639 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "web3.Web3.toChecksumAddress",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "web3.Web3",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "web3.Web3.toChecksumAddress",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "web3.... |
181660230 | #!/usr/bin/env python3
"""
WebSockets client
"""
from pathlib import Path
import argparse
import asyncio
import websockets
import zlib
import json
async def client(port: int, addr: str, max_packets: int, log_file: Path):
log_file = Path(log_file).expanduser()
uri = f"ws://{addr}:{port}"
async with web... | null | ws_client.py | ws_client.py | py | 1,452 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "pathlib.Path",
"line_number": 14,
"usage_type": "name"
},
{
"api_name": "pathlib.Path",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "websockets.connect",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "zlib.decompress",
"l... |
149737074 | from django.conf import settings
from django.db.models import Q
from django.contrib.auth.models import Group
from simple_salesforce import Salesforce
from rest_framework import viewsets
from rest_framework.decorators import list_route
from rest_framework.response import Response
from rest_framework import serializers... | null | lims/orders/views.py | views.py | py | 2,832 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "lims.shared.mixins.AuditTrailViewMixin",
"line_number": 20,
"usage_type": "name"
},
{
"api_name": "rest_framework.viewsets.ModelViewSet",
"line_number": 20,
"usage_type": "attribute"
},
{
"api_name": "rest_framework.viewsets",
"line_number": 20,
"usage_type... |
286428415 | import os
import json
import boto3
from boto3.dynamodb.conditions import Key
from aws_lambda_powertools.logging import Logger
from common.dynamodb import DecimalEncoder, map_keys, query_till_end
logger = Logger()
def query_table(region, table):
"""
Args:
table: DynamoDB table object to query
regi... | null | pipeline/api/layers/latest_region.py | latest_region.py | py | 1,221 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "aws_lambda_powertools.logging.Logger",
"line_number": 8,
"usage_type": "call"
},
{
"api_name": "boto3.dynamodb.conditions.Key",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "common.dynamodb.query_till_end",
"line_number": 25,
"usage_type": "call... |
136228519 | '''
LabManager Environment
:title: manager_v1.py
:author: Chris Beeler and Mitchell Shahen
:history: 2020-08-07
'''
import gym
import sys
sys.path.append("../../")
from chemistrylab.manager.manager_v1_engine import LabManagerEnv
def get_environments():
'''
Function to acquire all of the environments avail... | null | chemistrylab/manager/manager_v1.py | manager_v1.py | py | 1,577 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "sys.path.append",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "sys.path",
"line_number": 14,
"usage_type": "attribute"
},
{
"api_name": "gym.make",
"line_number": 42,
"usage_type": "call"
},
{
"api_name": "gym.make",
"line_number": ... |
237372477 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 3 12:49:37 2020
@author: wardat
"""
import numpy as np
from keras.layers import Dense, Activation
from keras.models import Sequential
import matplotlib.pyplot as plt
import math
import time
import sys
import keras
x = np.arange(-100, 100, 0.5)
y... | null | Benchmark/StackOverflow/52800582/Buggy Code/untitled35.py | untitled35.py | py | 1,439 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.arange",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "keras.models.Sequential",
"line_number": 25,
"usage_type": "call"
},
{
"api_name": "keras.layers.Dense",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "keras.layers.... |
626695958 | import json
import logging
import os
import sys
from logging.config import dictConfig
from src.exceptions import ConfigException
class Config:
statuses = {'None': 0, 'Active': 1, 'Commission': 2,
'Closed': 3, 'Cancel': 4, 'Abandoned': 5}
proxy = None
def __init__(self):
self.app_... | null | talan.rf/src/config/__init__.py | __init__.py | py | 4,365 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "os.path.dirname",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 17,
"usage_type": "attribute"
},
{
"api_name": "os.path.abspath",
"line_number": 17,
"usage_type": "call"
},
{
"api_name": "logging.getLogger",
... |
606294171 | from graphics import *
from button import *
from serialKepcov3_2 import*
import matplotlib.pyplot as plt
import numpy as np
import math
def main():
refy=20;
refx=3;
refx2=13;
width_b=3;
heigh_b=1.5;
win = GraphWin("Control de Fuentes Kepco",width=1000, height=300)
win.setCoords(0,0,20,25)
w... | null | ControlFuentesv3.py | ControlFuentesv3.py | py | 8,216 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.arange",
"line_number": 218,
"usage_type": "call"
},
{
"api_name": "numpy.arange",
"line_number": 219,
"usage_type": "call"
},
{
"api_name": "numpy.arange",
"line_number": 220,
"usage_type": "call"
},
{
"api_name": "numpy.concatenate",
"li... |
483168599 | from pyserini.search import SimpleSearcher
from pyserini.index import IndexReader
import random
import itertools
import math
from nltk import FreqDist
import nltk
import json
def read_topics(file_name):
file = open(file_name)
topics = {}
for line in file:
line = line.strip().split("\... | null | run-rpf-rm-mix.py | run-rpf-rm-mix.py | py | 5,715 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "pyserini.index.IndexReader",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "math.log",
"line_number": 39,
"usage_type": "call"
},
{
"api_name": "json.loads",
"line_number": 50,
"usage_type": "call"
},
{
"api_name": "nltk.tokenize.word_tok... |
516129450 | import sys, pygame
import random
import time
ctime = time.time()
random.seed()
pygame.init()
size = width, height = 1280, 720
speed = [2, 2]
black = 255, 255, 255
screen = pygame.display.set_mode(size)
ball = pygame.image.load("ball.bmp")
ballrect = ball.get_rect()
while 1:
print(str(time.time()-ctime)+'\t\t'+str(1/(t... | null | pasta.py | pasta.py | py | 772 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "time.time",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "random.seed",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "pygame.init",
"line_number": 6,
"usage_type": "call"
},
{
"api_name": "pygame.display.set_mode",
"line_nu... |
473325867 | #-*- coding: utf-8 -*-
import csv
import psycopg2
import datetime
import glob
def main():
directory = "/Users/mujin/Projects/Python/"
db_name = "Mujin"
db_user = "Mujin"
db_password = "mujin"
filename = glob.glob(directory + "MovieAnalyzer/data/daily_data/output/*.csv")
for f in filename:
read... | null | script/movie_daily_import.py | movie_daily_import.py | py | 3,077 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "glob.glob",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "csv.reader",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "psycopg2.connect",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "datetime.date",
"line_numbe... |
616370097 | import logging
import signal
import sys
class TerminateProtected:
""" Protect a piece of code from being killed by SIGINT or SIGTERM.
It can still be killed by a force kill.
Example:
with TerminateProtected():
run_func_1()
run_func_2()
Both functions will be executed ... | null | jaenatal.py | jaenatal.py | py | 3,114 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "logging.error",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "signal.signal",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "signal.SIGINT",
"line_number": 24,
"usage_type": "attribute"
},
{
"api_name": "signal.signal",
"l... |
219630626 | import sys
import urllib.request
from bs4 import BeautifulSoup
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class CurrencyConverter(QDialog):
def __init__(self,parent=None):
super(CurrencyConverter,self).__init__(parent)
date = self.getData()
self.atDate = QLabel(date)
... | null | currencyConverterGUI.pyw | currencyConverterGUI.pyw | pyw | 3,168 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "urllib.request.request.urlopen",
"line_number": 51,
"usage_type": "call"
},
{
"api_name": "urllib.request.request",
"line_number": 51,
"usage_type": "attribute"
},
{
"api_name": "urllib.request",
"line_number": 51,
"usage_type": "name"
},
{
"api_nam... |
119844062 | import torch.nn as nn
import torch.nn.functional as F
class Perceptron(nn.Module):
def __init__(self, input_size, hidden_size, num_classes):
super(Perceptron, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, num_classes)
def forw... | null | MLPmodel.py | MLPmodel.py | py | 510 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "torch.nn.Module",
"line_number": 4,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 4,
"usage_type": "name"
},
{
"api_name": "torch.nn.Linear",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "torch.nn",
"line_numbe... |
144969892 | """setup.py module for PyGeoprocessing"""
import os
import sys
try:
from setuptools.command.sdist import sdist as _sdist
from setuptools.command.build_py import build_py as _build_py
from setuptools.command.build_ext import build_ext
from setuptools.extension import Extension
except ImportError:
f... | null | pygeoprocessing_rich/setup.py | setup.py | py | 4,993 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "sys.version_info",
"line_number": 27,
"usage_type": "attribute"
},
{
"api_name": "os.link",
"line_number": 30,
"usage_type": "attribute"
},
{
"api_name": "distutils.command.sdist.sdist",
"line_number": 49,
"usage_type": "name"
},
{
"api_name": "dist... |
106971699 | """empty message
Revision ID: 1f2939156dde
Revises: e8692e08942d
Create Date: 2019-09-04 13:54:23.551586
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1f2939156dde'
down_revision = 'e8692e08942d'
branch_labels = None
depends_on = None
def upgrade():
# ... | null | backend/migrations/versions/1f2939156dde_.py | 1f2939156dde_.py | py | 927 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "alembic.op.create_table",
"line_number": 21,
"usage_type": "call"
},
{
"api_name": "alembic.op",
"line_number": 21,
"usage_type": "name"
},
{
"api_name": "sqlalchemy.Column",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.Integ... |
346516228 | import numpy as np
import scipy.optimize as spo
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import cm
from matplotlib.ticker import PercentFormatter
from matplotlib.patches import Patch
import random
import pandas as pd
# Linearly takes x on [a,b] to [c,d]
def linearmap(ab, cd, x):
a,b... | null | genplots.py | genplots.py | py | 8,352 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.sin",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "numpy.linspace",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "numpy.sin",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "numpy.random.normal",
"line_nu... |
92501888 | # -*- coding: utf-8 -*-
from tools.dbconnect import Session
from tools.Tools import *
from db.User import User
from sqlalchemy import func
class NewUsers():
@classmethod
def reportFilters(cls):
res = {}
res['FromDate'] = {'Type': 'date', 'Label': 'Desde','Input':'datetime', 'Value': today().s... | null | reports/NewUsers.py | NewUsers.py | py | 1,440 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "tools.dbconnect.Session",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.func.concat",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "sqlalchemy.func",
"line_number": 30,
"usage_type": "name"
},
{
"api_name": "sqlalc... |
523191949 | """Module to test time_series `blend_model` functionality
"""
from random import uniform
import numpy as np # type: ignore
import pytest
from pycaret.internal.ensemble import _ENSEMBLE_METHODS
from pycaret.time_series import TSForecastingExperiment
##########################
# Tests Start Here ####
################... | null | tests/test_time_series_blending.py | test_time_series_blending.py | py | 3,115 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "random.uniform",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "pycaret.internal.ensemble._EnsembleForecasterWithVoting",
"line_number": 32,
"usage_type": "argument"
},
{
"api_name": "pytest.mark.filterwarnings",
"line_number": 16,
"usage_type": ... |
257511676 | import os
import subprocess
import chess
from players.base import BasePlayer
class StockfishPlayer(BasePlayer):
def __init__(self, path=None, depth=2, params=None):
super(StockfishPlayer, self).__init__(self.__class__.__name__)
if path is None:
stockfish_ver = 'engines/stockfish_10_x... | null | players/stockfish.py | stockfish.py | py | 2,562 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "players.base.BasePlayer",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "os.name",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "os.path.join",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_... |
297026542 | import psycopg2
import argparse
import sys
import requests
import os
import datetime
import re
# `from datetime import tzinfo, timedelta, datetime
from lxml import etree
parser = argparse.ArgumentParser(
description='Create a target env.xml based off a source env.xml')
parser.add_argument("--src", help="Source Env... | null | xmlcopy.py | xmlcopy.py | py | 11,074 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "argparse.ArgumentParser",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "lxml.etree.XMLParser",
"line_number": 52,
"usage_type": "call"
},
{
"api_name": "lxml.etree",
"line_number": 52,
"usage_type": "name"
},
{
"api_name": "lxml.etree.XM... |
103183318 | from keras.layers import Input, Dense, BatchNormalization, LSTM
from keras.layers.advanced_activations import LeakyReLU
from keras.models import Model
from keras import optimizers
class LSTMNet:
def __init__(self, day_range):
self.day_range = day_range
self.model = None
self.init_model()
... | null | research/quandl/nets/LSTMNet.py | LSTMNet.py | py | 1,373 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "keras.layers.Input",
"line_number": 14,
"usage_type": "call"
},
{
"api_name": "keras.layers.LSTM",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "keras.layers.BatchNormalization",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "... |
325974478 | from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from django.conf import settings
from tripod2.items.types import Tripod2ItemManager
from tripod2.www.portals.base import CollectionPortal
from tripod2.index.facets import Facet, Term
import simplejson, re
from lxml import... | null | index/management/commands/t2_facets.py | t2_facets.py | py | 5,144 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "logging.getLogger",
"line_number": 11,
"usage_type": "call"
},
{
"api_name": "django.conf.settings.XML_BASE_PATH",
"line_number": 13,
"usage_type": "attribute"
},
{
"api_name": "django.conf.settings",
"line_number": 13,
"usage_type": "name"
},
{
"ap... |
154480456 | import ddsp
from ddsp.models.modules import Reverb, HarmonicSynth, FilteredNoise
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
class GRUDecoder(nn.Module):
def __init__(self, hidden_size: int, z_dim: int = None):
"""ddsp GRU decoder
Args:
hidden_size (int): gru ... | null | ddsp/models/decoder.py | decoder.py | py | 6,800 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "torch.nn.Module",
"line_number": 9,
"usage_type": "attribute"
},
{
"api_name": "torch.nn",
"line_number": 9,
"usage_type": "name"
},
{
"api_name": "torch.zeros",
"line_number": 20,
"usage_type": "call"
},
{
"api_name": "ddsp.mlp",
"line_number":... |
367075153 | # https://www.kaggle.com/ernie55ernie/mnist-with-keras-visualization-and-saliency-map
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
import glob, os
import numpy as np
import matplotlib.pyp... | null | activation_map/mnist/mnist_filter_trainer.py | mnist_filter_trainer.py | py | 4,025 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "keras.datasets.mnist.load_data",
"line_number": 22,
"usage_type": "call"
},
{
"api_name": "keras.datasets.mnist",
"line_number": 22,
"usage_type": "name"
},
{
"api_name": "sklearn.preprocessing.LabelBinarizer",
"line_number": 51,
"usage_type": "call"
},
... |
198833053 | import random
from fightingice_env import FightingiceEnv
import matplotlib.pyplot as plt
# 格斗游戏是一个典型的实时动作游戏,玩家在游戏中选择一定的动作,在规
# 定的时间内击败对方角色,赢得胜利。本任务基于FightingICE 格斗游戏平台,
# 以已知的固定bot “MctsAi” 作为游戏对手,利用课堂上讲述的强化学习方法设计
# 游戏AI,通过训练学习得到具有一定智能水平的格斗AI。
# TODO:将最终学到的强化学习AI 与MctsAi 对抗,统计100 局中AI 的胜率,以及
# TODO:每局结束时双方血量差的平均值,以此作为... | null | train_PPO.py | train_PPO.py | py | 8,347 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "os.path.dirname",
"line_number": 28,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_number": 28,
"usage_type": "attribute"
},
{
"api_name": "os.path.exists",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "os.path",
"line_numbe... |
443525358 | from setuptools import setup, Extension
quicktable = Extension(
'quicktable',
[
'src/lib/quicktable.c',
'src/lib/table.c',
'src/lib/blueprint.c',
'src/lib/column.c',
],
)
setup(
name='quicktable',
version='0.0',
ext_modules=[quicktable],
include_dirs=['src/i... | null | setup.py | setup.py | py | 351 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "setuptools.Extension",
"line_number": 3,
"usage_type": "call"
},
{
"api_name": "setuptools.setup",
"line_number": 13,
"usage_type": "call"
}
] |
392469079 | from django.urls import path
from django.conf.urls import url
from . import views
app_name = 'post'
urlpatterns = [
path('', views.index, name='index'),
path('<int:post_id>/', views.detail, name='detail'),
path('create/', views.create, name='create'),
path('<int:post_id>/update', views.update, name='up... | null | post/urls.py | urls.py | py | 405 | python | en | code | null | code-starcoder2 | 76 | [
{
"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",
... |
210031905 | # encoding: utf-8
import sys
import re
import pickle
from workflow import Workflow, web
def main(wf):
import bs4
import toolz
from tqdm import tqdm
def get_toc_data():
url = "https://docs.python.org/3.5/library/index.html"
r = web.get(url)
# throw an error if request failed
... | null | scrape.py | scrape.py | py | 2,172 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "workflow.web.get",
"line_number": 16,
"usage_type": "call"
},
{
"api_name": "workflow.web",
"line_number": 16,
"usage_type": "name"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 24,
"usage_type": "call"
},
{
"api_name": "toolz.pipe",
"lin... |
325745789 | import sqlite3
from settings import DB_NAME
conn = sqlite3.connect(DB_NAME)
cursor = conn.cursor()
while True:
command = input("Enter a command:")
command_list = command.split(" ")
if command == "list_employees":
info = cursor.execute("""SELECT id, name, position FROM company""")
info_t... | null | week7/2-SQL-Starter/interface.py | interface.py | py | 2,186 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "sqlite3.connect",
"line_number": 5,
"usage_type": "call"
},
{
"api_name": "settings.DB_NAME",
"line_number": 5,
"usage_type": "argument"
}
] |
177235752 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import urllib
import time
import urllib
import json
import hashlib
import base64
import os
import sys
import getopt
import re
from urllib import request
from urllib import parse
from urllib.request import urlopen
#调用百度的ocr识别图片
""" 你的 APPID AK SK """
APP_ID =... | null | xfocr.py | xfocr.py | py | 2,309 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "base64.b64encode",
"line_number": 26,
"usage_type": "call"
},
{
"api_name": "urllib.parse.urlencode",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "urllib.parse",
"line_number": 27,
"usage_type": "name"
},
{
"api_name": "base64.b64encode... |
170396452 | from datetime import datetime
from time import timezone
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.shortcuts import render, redirect
# Create your views here.
from general.models import ArtWork, Comment
from music.forms import MTrackForm
from music.models import MTra... | null | music/views.py | views.py | py | 1,530 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "general.models.ArtWork.objects.all",
"line_number": 15,
"usage_type": "call"
},
{
"api_name": "general.models.ArtWork.objects",
"line_number": 15,
"usage_type": "attribute"
},
{
"api_name": "general.models.ArtWork",
"line_number": 15,
"usage_type": "name"
... |
366847768 | """
BinarySearch
二分查找
"""
import random
from typing import List
def main():
nums = [random.randint(1, 20) for i in range(15)]
nums.sort()
print(nums)
print(binary_search(5, nums))
def binary_search(key: int, nums: List[int]) -> int:
"""二分查找"""
# nums 必须是有序数组
lo: int = 0
hi: int = len... | null | binary_search.py | binary_search.py | py | 614 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "random.randint",
"line_number": 9,
"usage_type": "call"
},
{
"api_name": "typing.List",
"line_number": 15,
"usage_type": "name"
}
] |
47911925 | import time
import xlrd
from splinter import Browser
import unittest
# from . import canshu
def read_table(file='search.xls', sheet_index=0):
data = xlrd.open_workbook(file)
table = data.sheets()[sheet_index]
nrows = table.nrows
list = []
for i in range(1, nrows):
row = table.row_values(i)
... | null | LoadRunner&SplinterSelenium/program/实验3/testsuit/case/test2.py | test2.py | py | 1,016 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "xlrd.open_workbook",
"line_number": 7,
"usage_type": "call"
},
{
"api_name": "splinter.Browser",
"line_number": 18,
"usage_type": "call"
},
{
"api_name": "time.sleep",
"line_number": 27,
"usage_type": "call"
},
{
"api_name": "unittest.TestCase",
... |
108272571 | from flask import Flask, render_template, session, request, redirect, flash
from mysqllink import linkToMySQL
app = Flask(__name__)
@app.route('/result', methods=['POST'])
def process():
if len(request.form['name']) < 1:
flash('Name must have at least one character')
if len(request.form['dojo']) < 1:
... | null | python_stack/flask/survey/server.py | server.py | py | 1,234 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "flask.Flask",
"line_number": 4,
"usage_type": "call"
},
{
"api_name": "flask.request.form",
"line_number": 8,
"usage_type": "attribute"
},
{
"api_name": "flask.request",
"line_number": 8,
"usage_type": "name"
},
{
"api_name": "flask.flash",
"lin... |
48960536 | # Copyright 2015 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | null | manila_tempest_tests/tests/api/admin/test_share_manage.py | test_share_manage.py | py | 6,589 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "tempest.config.CONF",
"line_number": 25,
"usage_type": "attribute"
},
{
"api_name": "tempest.config",
"line_number": 25,
"usage_type": "name"
},
{
"api_name": "manila_tempest_tests.tests.api.base.BaseSharesAdminTest",
"line_number": 28,
"usage_type": "attri... |
562069358 | import requests
from bs4 import BeautifulSoup
import re
import time
def trade_spider(max_pages):
page = 1
while page <= max_pages:
url = 'http://steamcommunity.com/market/search?q=karambit#p' + str(page) + '_price_asc'
source_code = requests.get(url)
plain_text = source_code.text
... | null | WebCrawler/WebCrawler.py | WebCrawler.py | py | 1,253 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "requests.get",
"line_number": 10,
"usage_type": "call"
},
{
"api_name": "bs4.BeautifulSoup",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "time.sleep",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "requests.get",
"line_nu... |
294711650 | # encoding: utf-8
# zhangxiong
# 2016/7/01
import json
def object2json(obj):
"""
convert object to json str
:param obj:
:return:
"""
# json = {}
# json['class'] = obj.__class__.__name__
# json['module'] = obj.__module__
# json.update(obj.__dict__)
return json.dumps(dict(obj),... | null | crawler/utils/jsonutils.py | jsonutils.py | py | 837 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "json.dumps",
"line_number": 19,
"usage_type": "call"
},
{
"api_name": "json.pop",
"line_number": 29,
"usage_type": "call"
},
{
"api_name": "json.pop",
"line_number": 30,
"usage_type": "call"
},
{
"api_name": "json.items",
"line_number": 33,
... |
251713253 | # 基于pipeline的dataloader
# from
from torch.utils import data
import random
import torch
import numpy as np
from wama.utils import load_from_pkl
from scipy.ndimage import zoom
def readimg(file_name,file_path,out_size):
print('readimg file:',file_name, 'at:',file_path, "@size ",out_size)
return {'img':np.zeros([5... | null | proj/wama/data_loader_beta_demo.py | data_loader_beta_demo.py | py | 5,974 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "numpy.zeros",
"line_number": 12,
"usage_type": "call"
},
{
"api_name": "numpy.zeros",
"line_number": 121,
"usage_type": "call"
},
{
"api_name": "numpy.ones",
"line_number": 122,
"usage_type": "call"
},
{
"api_name": "torch.utils.data.Dataset",
"... |
190114908 | import torch.nn as nn
def update(d, u):
for k, v in u.items():
if isinstance(v, collections.abc.Mapping):
d[k] = update(d.get(k, {}), v)
else:
d[k] = v
return d
class DynamicsFunction(nn.Module):
def __init__(self, model, params=None):
super().__init__()
... | null | GNN_PDE/convdiff/pdegs/dynamics/dynamics.py | dynamics.py | py | 598 | 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"
}
] |
546077826 | from datetime import datetime
import os
import pickle
import uuid
import logging
from pydantic import BaseModel
from typing import List
from .. import app, schema, db
from ..config import settings
real_logger = logging.getLogger("yatb.db")
class FileDB(object):
_db = None
_index = None
def __init__(se... | null | app/db/__init__.py | __init__.py | py | 3,745 | python | en | code | null | code-starcoder2 | 76 | [
{
"api_name": "logging.getLogger",
"line_number": 13,
"usage_type": "call"
},
{
"api_name": "datetime.datetime.now",
"line_number": 35,
"usage_type": "call"
},
{
"api_name": "datetime.datetime",
"line_number": 35,
"usage_type": "name"
},
{
"api_name": "datetime.da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.